2.3. Data types

2.3.1. struct s3d_but_info

struct s3d_obj_info 
	unsigned long object;
	unsigned long 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.

2.3.2. struct s3d_but_info

struct s3d_but_info     
    unsigned char button, state;

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

2.3.3. struct mcp_object

struct mcp_object 
	unsigned long 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). ;)

2.3.4. struct s3d_evt

struct s3d_evt {
	unsigned char event;
	int length;
	char *buf;
	struct s3d_evt *next;

This is the event information holder.


gives the event type


gives the length of the buffer *buf


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


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.

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