Data types

struct s3d_but_info

struct s3d_obj_info {
	uint32_t object;
	uint32_t flags;
	float trans_x, trans_y, trans_z;
	float rot_x, rot_y, rot_z;
	float scale;
	float r;
	char name[256];
};

Can be used on the buffer of an event of type S3D_EVENT_OBJ_INFO. name will usually contain nothing for usual objects, but mcp objects will contain the applications names here. r is the radius of the convex sphere an object, which will also be interesting for the mcp.

Special objects like camera, pointer will have the "sys_" prefix in the name and will be named "pointer0", "pointer1" ... or "cam0", "cam1" ... For cam object, scale will contain the aspect ratio.

struct s3d_but_info

struct s3d_but_info {
	uint8_t button;
	uint8_t state;
};

Can be used on the buffer of an event of type S3D_EVENT_MBUTTON.

struct mcp_object

struct mcp_object {
	uint32_t object;
	float trans_x, trans_y, trans_z;
	float r;
	char name[256];
};

obsolete, deprecated, don't use, to be removed soon (use struct s3d_but_info). ;)

struct s3d_evt

struct s3d_evt {
	uint8_t event;
	int length;
	char *buf;
	struct s3d_evt *next;
};

This is the event information holder.

event

gives the event type

length

gives the length of the buffer *buf

*buf

is the pointer to the multiple purpose buffer, which will have more specific information about the object

*next

can be safely ignored ;)

Depending on the event, buf can contain the keycode pressed on keyboard event, the mouse button state on a mouse event, object information etc.

typedef s3d_cb

typedef void (*s3d_cb)(struct s3d_evt *);

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().

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