Chapter 5. Definitions

5.1. S3D events

This defines the callback format. Each callback should return void and take an argument of struct s3d_evt *. Callbacks can be defined with s3d_set_callback().

S3D_EVENT_OBJ_CLICK

An object got clicked (when you set the flag S3D_OF_SELECTABLE), buf will contain the object id of the object which got clicked (unsigned long, 4 byte)

S3D_EVENT_KEY

A key was pressed, buf will contain a keycode. use #include <s3d_keysym.h> to have the keycodes available. buf is a 2 byte unsigned short keycode.

S3D_EVENT_MBUTTON

A mouse button was clicked. Use struct s3d_but_info on buf to get more info.

S3D_EVENT_NEW_OBJECT

deprecated, will use S3D_EVENT_OBJ_INFO

S3D_EVENT_OBJ_INFO

Something happened to an object. This can happen if the camera was moved, the mouse (pointer) was moved or an application appeared/changed in the mcp

S3D_MCP_OBJECT

As the name suggests, those will only happen to the MCP. This tells it about new/changed application object. struct mcp_object can be used on buf. To be removed in the future.

S3D_MCP_DEL_OBJECT

As the name suggests, those will only happen to the MCP. This tells it about deleted application object. struct mcp_object can be used on buf. To be removed in the future.

S3D_EVENT_QUIT

Server sent the quit signal, or the connection was terminated. Usually, this is only processed internally.


/* a callback handler could look like this: */
void my_key_handler(struct s3d_evt *event_data)
{
	...
}