---
name: "s3d_set_callback"
section: "3"
platform: "linux"
package: "s3d-doc"
version: "0.2.2.1-7"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/s3d_set_callback"
---

# s3d\_set\_callback(3)

sets a callback

## NAME

s3d\_set\_callback - sets a callback

## SYNOPSIS

```
#include <s3d.h>
```

**void s3d\_set\_callback(uint8\_t** *event***, s3d\_cb** *func***);**

## DESCRIPTION

Sets a callback for a certain event. this is very useful for event-oriented applications. event callbacks will not interrupt each other or the mainloop.

**Warning**\

Defining callbacks will only work after calling s3d\_init()

```
 #include <inttypes.h>
 void obj_click(struct s3d_evt event)
 {
         printf("object id %"PRIu32" got clicked", *((uint32_t *)event->buf));
 }
 ...
 s3d_set_callback(S3D_EVENT_NEW_OBJECT, obj_click);
 // this will tell you when a object got clicked
```

## AUTHOR

**Simon Wunderlich**

Author of s3d
