Data types
Prev | Chapter 2. libs3d - The S3D API | Next

## Data types

### 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 ;)

### struct mcp_object

    struct mcp_object {
    	uint32_t object;
    	float trans_x;
    	float trans_y;
    	float trans_z;
    	float r;
    	char name;
    }

Deprecated

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

### struct s3d_obj_info

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

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 s3d_key_event

    struct s3d_key_event {
    	uint16_t keysym;
    	uint16_t unicode;
    	uint16_t modifier;
    	uint16_t state;
    }

Can be used on the buffer of an event of type S3D_EVENT_KEY*.

### typedef s3d_cb

    typedef int(* 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().

Prev | Up | Next
function reference | Home | Definitions