Allocate inputs

When a input device wants to expose its functionality to Betray it needs to allocate new buttons, axis and pointers. Input devices can also callocate new users as one singler application may have many users whos input should be treated differently. If the input only provides functionalty for a single user, you can use the defalut user Zero.


uint betray_plugin_user_allocate(void);

Description: Allocate a user


uint betray_plugin_input_device_allocate(uint user_id, char *name);

Description: Allocate input device.


uint betray_plugin_input_device_free(uint id);

Description: Free input device.


uint betray_plugin_button_allocate(uint code, char *name);

Description: Allocate a new button. The Code parameter refers to the Betray Key code the button corresponds to. If there is no Key code that fits, this parameter should be set to -1. Name refers to a string describing the button. The function returns an id to be used when the button is triggerd.


void betray_plugin_button_set(uint user_id, uint id, boolean press, uint character);

Description: Call this Function to set the current state of a button.


void betray_plugin_button_free(uint id);

Description: Frees the button id, if the device is nolonger active.


uint betray_plugin_pointer_allocate(uint user_id, uint device_id, uint button_count, float x, float y, float z, float *origin, char *name, boolean draw);

Description: Allocate a pointer id for anew pointer.


uint betray_plugin_pointer_set(uint id, float x, float y, float z, float *origin, boolean *buttons);

Description: Set the current state of the button.,


void betray_plugin_pointer_free(uint id);

Description: Frees the pointer id, if the device is nolonger active.


uint betray_plugin_axis_allocate(uint user_id, uint device_id, char *name, BAxisType type, uint axis_count);

Description: Allocates a new axis, and describes its user id, name type and axis count.


void betray_plugin_axis_set(uint id, float axis_x, float axis_y, float axis_z);

Description: Sets the current state of the axis.


void betray_plugin_axis_free(uint id);

Description: Frees the axis id, if the device is nolonger active.