![]() |
Ultibo API
C/C++ API for Ultibo Core
|
Go to the source code of this file.
Data Structures | |
| struct | _JOYSTICK_DATA |
| struct | _JOYSTICK_BUFFER |
| struct | _JOYSTICK_EXTENT |
| struct | _JOYSTICK_AXIS |
| struct | _JOYSTICK_HAT |
| struct | _JOYSTICK_PROPERTIES |
| struct | _JOYSTICK_DEVICE |
Macros | |
| #define | JOYSTICK_NAME_PREFIX "Joystick" |
| Name prefix for Joystick Devices. | |
| #define | JOYSTICK_TYPE_NONE 0 |
| #define | JOYSTICK_TYPE_JOYSTICK 1 |
| #define | JOYSTICK_TYPE_GAMEPAD 2 |
| #define | JOYSTICK_TYPE_MAX 2 |
| #define | JOYSTICK_STATE_DISABLED 0 |
| #define | JOYSTICK_STATE_ENABLED 1 |
| #define | JOYSTICK_STATE_MAX 1 |
| #define | JOYSTICK_FLAG_NONE 0x00000000 |
| #define | JOYSTICK_FLAG_NON_BLOCK 0x00000001 |
| If set device reads are non blocking (Also supported in Flags parameter of JoystickDeviceRead). | |
| #define | JOYSTICK_FLAG_PEEK_BUFFER 0x00000002 |
| Peek at the buffer to see if any data is available, don't remove it (Used only in Flags parameter of JoystickDeviceRead). | |
| #define | JOYSTICK_FLAG_LED 0x00000004 |
| If set the device contains one or more LEDs. | |
| #define | JOYSTICK_FLAG_RGBLED 0x00000008 |
| If set the device contains one or more RGB LEDs. | |
| #define | JOYSTICK_FLAG_RUMBLE 0x00000010 |
| If set the device has rumble or force feedback. | |
| #define | JOYSTICK_FLAG_GYROSCOPE 0x00000020 |
| If set the device contains a gyroscope. | |
| #define | JOYSTICK_FLAG_TOUCHPAD 0x00000040 |
| If set the device contains a touchpad. | |
| #define | JOYSTICK_FLAG_MASK JOYSTICK_FLAG_NON_BLOCK | JOYSTICK_FLAG_LED | JOYSTICK_FLAG_RGBLED | JOYSTICK_FLAG_RUMBLE | JOYSTICK_FLAG_GYROSCOPE | JOYSTICK_FLAG_TOUCHPAD |
| #define | JOYSTICK_CONTROL_GET_FLAG 1 |
| Get Flag. | |
| #define | JOYSTICK_CONTROL_SET_FLAG 2 |
| Set Flag. | |
| #define | JOYSTICK_CONTROL_CLEAR_FLAG 3 |
| Clear Flag. | |
| #define | JOYSTICK_CONTROL_FLUSH_BUFFER 4 |
| Flush Buffer. | |
| #define | JOYSTICK_CONTROL_GET_HAT 5 |
| Get the name (identifier) associated with a Hat. | |
| #define | JOYSTICK_CONTROL_SET_HAT 6 |
| Set the name (identifier) associated with a Hat. | |
| #define | JOYSTICK_CONTROL_GET_AXIS 7 |
| Get the name (identifier) associated with an Axis. | |
| #define | JOYSTICK_CONTROL_SET_AXIS 8 |
| Set the name (identifier) associated with an Axis. | |
| #define | JOYSTICK_CONTROL_GET_BUTTON 9 |
| Get the name (identifier) associated with a Button. | |
| #define | JOYSTICK_CONTROL_SET_BUTTON 10 |
| Set the name (identifier) associated with a Button. | |
| #define | JOYSTICK_CONTROL_GET_CALLBACK 11 |
| Get the registered callback function for joystick events. | |
| #define | JOYSTICK_CONTROL_SET_CALLBACK 12 |
| Set the registered callback function for joystick events. | |
| #define | JOYSTICK_BUFFER_SIZE 2048 |
| #define | JOYSTICK_MAX_AXIS 16 |
| #define | JOYSTICK_MAX_HAT 4 |
| #define | JOYSTICK_MAX_BUTTON 32 |
| #define | JOYSTICK_DEFAULT_MINIMUM 0 |
| #define | JOYSTICK_DEFAULT_MAXIMUM 255 |
| #define | JOYSTICK_AXIS_NONE 0 |
| #define | JOYSTICK_AXIS_1 1 |
| #define | JOYSTICK_AXIS_2 2 |
| #define | JOYSTICK_AXIS_3 3 |
| #define | JOYSTICK_AXIS_4 4 |
| #define | JOYSTICK_AXIS_5 5 |
| #define | JOYSTICK_AXIS_6 6 |
| #define | JOYSTICK_AXIS_7 7 |
| #define | JOYSTICK_AXIS_8 8 |
| #define | JOYSTICK_AXIS_9 9 |
| #define | JOYSTICK_AXIS_10 10 |
| #define | JOYSTICK_AXIS_11 11 |
| #define | JOYSTICK_AXIS_12 12 |
| #define | JOYSTICK_AXIS_13 13 |
| #define | JOYSTICK_AXIS_14 14 |
| #define | JOYSTICK_AXIS_15 15 |
| #define | JOYSTICK_AXIS_16 16 |
| #define | JOYSTICK_AXIS_X 17 |
| X. | |
| #define | JOYSTICK_AXIS_Y 18 |
| Y. | |
| #define | JOYSTICK_AXIS_Z 19 |
| Z. | |
| #define | JOYSTICK_ROTATION_X 20 |
| Rotation X. | |
| #define | JOYSTICK_ROTATION_Y 21 |
| Rotation Y. | |
| #define | JOYSTICK_ROTATION_Z 22 |
| Rotation Z. | |
| #define | JOYSTICK_SLIDER 23 |
| Slider. | |
| #define | GAMEPAD_AXIS_LEFT_X 24 |
| Left X. | |
| #define | GAMEPAD_AXIS_LEFT_Y 25 |
| Left Y. | |
| #define | GAMEPAD_AXIS_X GAMEPAD_AXIS_LEFT_X |
| #define | GAMEPAD_AXIS_Y GAMEPAD_AXIS_LEFT_Y |
| #define | GAMEPAD_AXIS_RIGHT_X 26 |
| Right X. | |
| #define | GAMEPAD_AXIS_RIGHT_Y 27 |
| Right Y. | |
| #define | GAMEPAD_CONTROL_LT 28 |
| Left Trigger analog button. | |
| #define | GAMEPAD_CONTROL_L2 GAMEPAD_CONTROL_LT |
| #define | GAMEPAD_CONTROL_RT 29 |
| Right Trigger analog button. | |
| #define | GAMEPAD_CONTROL_R2 GAMEPAD_CONTROL_RT |
| #define | GAMEPAD_CONTROL_UP 30 |
| Up analog button. | |
| #define | GAMEPAD_CONTROL_RIGHT 31 |
| Right analog button. | |
| #define | GAMEPAD_CONTROL_DOWN 32 |
| Down analog button. | |
| #define | GAMEPAD_CONTROL_LEFT 33 |
| Left analog button. | |
| #define | GAMEPAD_CONTROL_L1 34 |
| L1 analog button. | |
| #define | GAMEPAD_CONTROL_R1 35 |
| R1 analog button. | |
| #define | GAMEPAD_CONTROL_TRIANGLE 36 |
| Triangle analog button. | |
| #define | GAMEPAD_CONTROL_CIRCLE 37 |
| Circle analog button. | |
| #define | GAMEPAD_CONTROL_CROSS 38 |
| Cross analog button. | |
| #define | GAMEPAD_CONTROL_SQUARE 39 |
| Square analog button. | |
| #define | JOYSTICK_AXIS_MAX 39 |
| #define | JOYSTICK_HAT_NONE 0 |
| #define | JOYSTICK_HAT_1 1 |
| #define | JOYSTICK_HAT_2 2 |
| #define | JOYSTICK_HAT_3 3 |
| #define | JOYSTICK_HAT_4 4 |
| #define | JOYSTICK_HAT_POV 5 |
| Point of View (POV). | |
| #define | JOYSTICK_HAT_MAX 5 |
| #define | JOYSTICK_BUTTON_NONE 0 |
| #define | JOYSTICK_BUTTON_1 1 |
| #define | JOYSTICK_BUTTON_2 2 |
| #define | JOYSTICK_BUTTON_3 3 |
| #define | JOYSTICK_BUTTON_4 4 |
| #define | JOYSTICK_BUTTON_5 5 |
| #define | JOYSTICK_BUTTON_6 6 |
| #define | JOYSTICK_BUTTON_7 7 |
| #define | JOYSTICK_BUTTON_8 8 |
| #define | JOYSTICK_BUTTON_9 9 |
| #define | JOYSTICK_BUTTON_10 10 |
| #define | JOYSTICK_BUTTON_11 11 |
| #define | JOYSTICK_BUTTON_12 12 |
| #define | JOYSTICK_BUTTON_13 13 |
| #define | JOYSTICK_BUTTON_14 14 |
| #define | JOYSTICK_BUTTON_15 15 |
| #define | JOYSTICK_BUTTON_16 16 |
| #define | JOYSTICK_BUTTON_17 17 |
| #define | JOYSTICK_BUTTON_18 18 |
| #define | JOYSTICK_BUTTON_19 19 |
| #define | JOYSTICK_BUTTON_20 20 |
| #define | JOYSTICK_BUTTON_21 21 |
| #define | JOYSTICK_BUTTON_22 22 |
| #define | JOYSTICK_BUTTON_23 23 |
| #define | JOYSTICK_BUTTON_24 24 |
| #define | JOYSTICK_BUTTON_25 25 |
| #define | JOYSTICK_BUTTON_26 26 |
| #define | JOYSTICK_BUTTON_27 27 |
| #define | JOYSTICK_BUTTON_28 28 |
| #define | JOYSTICK_BUTTON_29 29 |
| #define | JOYSTICK_BUTTON_30 30 |
| #define | JOYSTICK_BUTTON_31 31 |
| #define | JOYSTICK_BUTTON_32 32 |
| #define | GAMEPAD_BUTTON_HOME 33 |
| Home or special function button. | |
| #define | GAMEPAD_BUTTON_PS GAMEPAD_BUTTON_HOME |
| Playstation button. | |
| #define | GAMEPAD_BUTTON_XBOX GAMEPAD_BUTTON_HOME |
| XBox button. | |
| #define | GAMEPAD_BUTTON_GUIDE GAMEPAD_BUTTON_HOME |
| Guide button. | |
| #define | GAMEPAD_BUTTON_LT 34 |
| Left Trigger button. | |
| #define | GAMEPAD_BUTTON_L2 GAMEPAD_BUTTON_LT |
| #define | GAMEPAD_BUTTON_LZ GAMEPAD_BUTTON_LT |
| #define | GAMEPAD_BUTTON_RT 35 |
| Right Trigger button. | |
| #define | GAMEPAD_BUTTON_R2 GAMEPAD_BUTTON_RT |
| #define | GAMEPAD_BUTTON_RZ GAMEPAD_BUTTON_RT |
| #define | GAMEPAD_BUTTON_LB 36 |
| Left Bumper button. | |
| #define | GAMEPAD_BUTTON_L1 GAMEPAD_BUTTON_LB |
| #define | GAMEPAD_BUTTON_L GAMEPAD_BUTTON_LB |
| #define | GAMEPAD_BUTTON_RB 37 |
| Right Bumper button. | |
| #define | GAMEPAD_BUTTON_R1 GAMEPAD_BUTTON_RB |
| #define | GAMEPAD_BUTTON_R GAMEPAD_BUTTON_RB |
| #define | GAMEPAD_BUTTON_Y 38 |
| Y button. | |
| #define | GAMEPAD_BUTTON_TRIANGLE GAMEPAD_BUTTON_Y |
| Triangle button. | |
| #define | GAMEPAD_BUTTON_B 39 |
| B button. | |
| #define | GAMEPAD_BUTTON_CIRCLE GAMEPAD_BUTTON_B |
| Circle button. | |
| #define | GAMEPAD_BUTTON_A 40 |
| A button. | |
| #define | GAMEPAD_BUTTON_CROSS GAMEPAD_BUTTON_A |
| Cross button. | |
| #define | GAMEPAD_BUTTON_X 41 |
| X button. | |
| #define | GAMEPAD_BUTTON_SQUARE GAMEPAD_BUTTON_X |
| Square button. | |
| #define | GAMEPAD_BUTTON_SELECT 42 |
| Select button. | |
| #define | GAMEPAD_BUTTON_BACK GAMEPAD_BUTTON_SELECT |
| Back button. | |
| #define | GAMEPAD_BUTTON_SHARE GAMEPAD_BUTTON_SELECT |
| Share button. | |
| #define | GAMEPAD_BUTTON_CAPTURE GAMEPAD_BUTTON_SELECT |
| Capture button. | |
| #define | GAMEPAD_BUTTON_L3 43 |
| Left Stick or Left Axis button. | |
| #define | GAMEPAD_BUTTON_SL GAMEPAD_BUTTON_L3 |
| #define | GAMEPAD_BUTTON_R3 44 |
| Right Stick or Right Axis button. | |
| #define | GAMEPAD_BUTTON_SR GAMEPAD_BUTTON_R3 |
| #define | GAMEPAD_BUTTON_START 45 |
| Start button. | |
| #define | GAMEPAD_BUTTON_OPTIONS GAMEPAD_BUTTON_START |
| #define | GAMEPAD_BUTTON_UP 46 |
| Up button. | |
| #define | GAMEPAD_BUTTON_RIGHT 47 |
| Right button. | |
| #define | GAMEPAD_BUTTON_DOWN 48 |
| Down button. | |
| #define | GAMEPAD_BUTTON_LEFT 49 |
| Left button. | |
| #define | GAMEPAD_BUTTON_PLUS 50 |
| Plus button. | |
| #define | GAMEPAD_BUTTON_MINUS 51 |
| Minus button. | |
| #define | GAMEPAD_BUTTON_TOUCHPAD 52 |
| Touchpad button. | |
| #define | JOYSTICK_BUTTON_MAX 52 |
Functions | |
| uint32_t STDCALL | joystick_device_start (JOYSTICK_DEVICE *joystick) |
| Start the specified Joystick device ready for receiving events. | |
| uint32_t STDCALL | joystick_device_stop (JOYSTICK_DEVICE *joystick) |
| Stop the specified Joystick device and terminate receiving events. | |
| uint32_t STDCALL | joystick_device_peek (JOYSTICK_DEVICE *joystick) |
| Peek at the buffer of the specified joystick device to see if any data packets are ready. | |
| uint32_t STDCALL | joystick_device_read (JOYSTICK_DEVICE *joystick, void *buffer, uint32_t size, uint32_t flags, uint32_t *count) |
| Read joystick data packets from the buffer of the specified joystick device. | |
| uint32_t STDCALL | joystick_device_write (JOYSTICK_DEVICE *joystick, void *buffer, uint32_t size, uint32_t count) |
| Write joystick data packets to the buffer of the specified joystick device. | |
| uint32_t STDCALL | joystick_device_flush (JOYSTICK_DEVICE *joystick) |
| Flush the contents of the buffer of the specified joystick device. | |
| uint32_t STDCALL | joystick_device_update (JOYSTICK_DEVICE *joystick) |
| Request the specified Joystick device to update the current configuration. | |
| uint32_t STDCALL | joystick_device_control (JOYSTICK_DEVICE *joystick, int request, size_t argument1, size_t *argument2) |
| Perform a control request on the specified Joystick device. | |
| uint32_t STDCALL | joystick_device_get_properties (JOYSTICK_DEVICE *joystick, JOYSTICK_PROPERTIES *properties) |
| Get the properties for the specified Joystick device. | |
| uint32_t STDCALL | joystick_device_set_state (JOYSTICK_DEVICE *joystick, uint32_t state) |
| Set the state of the specified joystick and send a notification. | |
| JOYSTICK_DEVICE *STDCALL | joystick_device_create (void) |
| Create a new Joystick device entry. | |
| JOYSTICK_DEVICE *STDCALL | joystick_device_create_ex (uint32_t size) |
| Create a new Joystick device entry. | |
| uint32_t STDCALL | joystick_device_destroy (JOYSTICK_DEVICE *joystick) |
| Destroy an existing Joystick device entry. | |
| uint32_t STDCALL | joystick_device_register (JOYSTICK_DEVICE *joystick) |
| Register a new Joystick device in the Joystick device table. | |
| uint32_t STDCALL | joystick_device_deregister (JOYSTICK_DEVICE *joystick) |
| Deregister a Joystick device from the Joystick device table. | |
| JOYSTICK_DEVICE *STDCALL | joystick_device_find (uint32_t joystickid) |
| Find a Joystick device by ID in the Joystick device table. | |
| JOYSTICK_DEVICE *STDCALL | joystick_device_find_by_name (const char *name) |
| Find a Joystick device by name in the device table. | |
| JOYSTICK_DEVICE *STDCALL | joystick_device_find_by_description (const char *description) |
| Find a Joystick device by description in the device table. | |
| uint32_t STDCALL | joystick_device_enumerate (joystick_enumerate_cb callback, void *data) |
| Enumerate all Joystick devices in the Joystick device table. | |
| uint32_t STDCALL | joystick_device_notification (JOYSTICK_DEVICE *joystick, joystick_notification_cb callback, void *data, uint32_t notification, uint32_t flags) |
| Register a notification for Joystick device changes. | |
| uint32_t STDCALL | joystick_get_count (void) |
| Get the current Joystick device count. | |
| JOYSTICK_DEVICE *STDCALL | joystick_device_get_default (void) |
| Get the current default Joystick device. | |
| uint32_t STDCALL | joystick_device_set_default (JOYSTICK_DEVICE *joystick) |
| Set the current default Joystick device. | |
| JOYSTICK_DEVICE *STDCALL | joystick_device_check (JOYSTICK_DEVICE *joystick) |
| Check if the supplied Joystick device is in the Joystick device table. | |
| uint32_t STDCALL | joystick_device_axis_to_string (uint32_t name, char *string, uint32_t len) |
| Return a string describing a Joystick or Gamepad Axis (eg JOYSTICK_AXIS_X). | |
| uint32_t STDCALL | joystick_device_hat_to_string (uint32_t name, char *string, uint32_t len) |
| Return a string describing a Joystick or Gamepad Hat (eg JOYSTICK_HAT_POV). | |
| uint32_t STDCALL | joystick_device_button_to_string (uint32_t name, char *string, uint32_t len) |
| Return a string describing a Joystick or Gamepad Button (eg GAMEPAD_BUTTON_UP). | |
| uint32_t STDCALL | joystick_device_type_to_string (uint32_t joysticktype, char *string, uint32_t len) |
| Return a string describing the Joystick device type (eg JOYSTICK_TYPE_JOYSTICK). | |
| uint32_t STDCALL | joystick_device_state_to_string (uint32_t joystickstate, char *string, uint32_t len) |
| Return a string describing the Joystick device state (eg JOYSTICK_STATE_ENABLED). | |
| uint32_t STDCALL | joystick_device_state_to_notification (uint32_t state) |
| Convert a Joystick state value into the notification code for device notifications. | |
| uint32_t STDCALL | joystick_device_get_axis (JOYSTICK_DEVICE *joystick, uint32_t index) |
| Get the name (identifier) of an Axis on the specified Joystick. | |
| uint32_t STDCALL | joystick_device_set_axis (JOYSTICK_DEVICE *joystick, uint32_t index, uint32_t name) |
| Set the name (identifier) of an Axis on the specified Joystick. | |
| uint32_t STDCALL | joystick_device_get_hat (JOYSTICK_DEVICE *joystick, uint32_t index) |
| Get the name (identifier) of a Hat on the specified Joystick. | |
| uint32_t STDCALL | joystick_device_set_hat (JOYSTICK_DEVICE *joystick, uint32_t index, uint32_t name) |
| Set the name (identifier) of a Hat on the specified Joystick. | |
| uint32_t STDCALL | joystick_device_get_button (JOYSTICK_DEVICE *joystick, uint32_t index) |
| Get the name (identifier) of a Button on the specified Joystick. | |
| uint32_t STDCALL | joystick_device_set_button (JOYSTICK_DEVICE *joystick, uint32_t index, uint32_t name) |
| Set the name (identifier) of a Button on the specified Joystick. | |
| uint32_t STDCALL | joystick_device_set_callback (JOYSTICK_DEVICE *joystick, joystick_event_cb event, void *parameter) |
| Set the event callback function for the specified Joystick. | |
| uint32_t STDCALL | joystick_insert_data (JOYSTICK_DEVICE *joystick, JOYSTICK_DATA *data, BOOL signal) |
| Insert a TJoystickData entry into the joystick device buffer. | |
| #define JOYSTICK_NAME_PREFIX "Joystick" |
Name prefix for Joystick Devices.
Joystick specific constants
| #define JOYSTICK_TYPE_NONE 0 |
Joystick Device Types
| #define JOYSTICK_TYPE_JOYSTICK 1 |
| #define JOYSTICK_TYPE_GAMEPAD 2 |
| #define JOYSTICK_TYPE_MAX 2 |
| #define JOYSTICK_STATE_DISABLED 0 |
Joystick Device States
| #define JOYSTICK_STATE_ENABLED 1 |
| #define JOYSTICK_STATE_MAX 1 |
| #define JOYSTICK_FLAG_NONE 0x00000000 |
Joystick Device Flags
| #define JOYSTICK_FLAG_NON_BLOCK 0x00000001 |
If set device reads are non blocking (Also supported in Flags parameter of JoystickDeviceRead).
| #define JOYSTICK_FLAG_PEEK_BUFFER 0x00000002 |
Peek at the buffer to see if any data is available, don't remove it (Used only in Flags parameter of JoystickDeviceRead).
| #define JOYSTICK_FLAG_LED 0x00000004 |
If set the device contains one or more LEDs.
| #define JOYSTICK_FLAG_RGBLED 0x00000008 |
If set the device contains one or more RGB LEDs.
| #define JOYSTICK_FLAG_RUMBLE 0x00000010 |
If set the device has rumble or force feedback.
| #define JOYSTICK_FLAG_GYROSCOPE 0x00000020 |
If set the device contains a gyroscope.
| #define JOYSTICK_FLAG_TOUCHPAD 0x00000040 |
If set the device contains a touchpad.
| #define JOYSTICK_FLAG_MASK JOYSTICK_FLAG_NON_BLOCK | JOYSTICK_FLAG_LED | JOYSTICK_FLAG_RGBLED | JOYSTICK_FLAG_RUMBLE | JOYSTICK_FLAG_GYROSCOPE | JOYSTICK_FLAG_TOUCHPAD |
Flags supported by JOYSTICK_CONTROL_GET/SET/CLEAR_FLAG
| #define JOYSTICK_CONTROL_GET_FLAG 1 |
Get Flag.
Joystick Device Control Codes
| #define JOYSTICK_CONTROL_SET_FLAG 2 |
Set Flag.
| #define JOYSTICK_CONTROL_CLEAR_FLAG 3 |
Clear Flag.
| #define JOYSTICK_CONTROL_FLUSH_BUFFER 4 |
Flush Buffer.
| #define JOYSTICK_CONTROL_GET_HAT 5 |
Get the name (identifier) associated with a Hat.
| #define JOYSTICK_CONTROL_SET_HAT 6 |
Set the name (identifier) associated with a Hat.
| #define JOYSTICK_CONTROL_GET_AXIS 7 |
Get the name (identifier) associated with an Axis.
| #define JOYSTICK_CONTROL_SET_AXIS 8 |
Set the name (identifier) associated with an Axis.
| #define JOYSTICK_CONTROL_GET_BUTTON 9 |
Get the name (identifier) associated with a Button.
| #define JOYSTICK_CONTROL_SET_BUTTON 10 |
Set the name (identifier) associated with a Button.
| #define JOYSTICK_CONTROL_GET_CALLBACK 11 |
Get the registered callback function for joystick events.
| #define JOYSTICK_CONTROL_SET_CALLBACK 12 |
Set the registered callback function for joystick events.
| #define JOYSTICK_BUFFER_SIZE 2048 |
Joystick Buffer Size
| #define JOYSTICK_MAX_AXIS 16 |
Joystick Axis, Hat and Button Maximum
| #define JOYSTICK_MAX_HAT 4 |
| #define JOYSTICK_MAX_BUTTON 32 |
| #define JOYSTICK_DEFAULT_MINIMUM 0 |
Joystick Default Minimum and Maximum
| #define JOYSTICK_DEFAULT_MAXIMUM 255 |
| #define JOYSTICK_AXIS_NONE 0 |
Joystick and Gamepad Axis Names (Includes Buttons, Sliders, Wheels etc that report an analog value)
| #define JOYSTICK_AXIS_1 1 |
| #define JOYSTICK_AXIS_2 2 |
| #define JOYSTICK_AXIS_3 3 |
| #define JOYSTICK_AXIS_4 4 |
| #define JOYSTICK_AXIS_5 5 |
| #define JOYSTICK_AXIS_6 6 |
| #define JOYSTICK_AXIS_7 7 |
| #define JOYSTICK_AXIS_8 8 |
| #define JOYSTICK_AXIS_9 9 |
| #define JOYSTICK_AXIS_10 10 |
| #define JOYSTICK_AXIS_11 11 |
| #define JOYSTICK_AXIS_12 12 |
| #define JOYSTICK_AXIS_13 13 |
| #define JOYSTICK_AXIS_14 14 |
| #define JOYSTICK_AXIS_15 15 |
| #define JOYSTICK_AXIS_16 16 |
| #define JOYSTICK_AXIS_X 17 |
X.
| #define JOYSTICK_AXIS_Y 18 |
Y.
| #define JOYSTICK_AXIS_Z 19 |
Z.
| #define JOYSTICK_ROTATION_X 20 |
Rotation X.
| #define JOYSTICK_ROTATION_Y 21 |
Rotation Y.
| #define JOYSTICK_ROTATION_Z 22 |
Rotation Z.
| #define JOYSTICK_SLIDER 23 |
Slider.
| #define GAMEPAD_AXIS_LEFT_X 24 |
Left X.
| #define GAMEPAD_AXIS_LEFT_Y 25 |
Left Y.
| #define GAMEPAD_AXIS_X GAMEPAD_AXIS_LEFT_X |
| #define GAMEPAD_AXIS_Y GAMEPAD_AXIS_LEFT_Y |
| #define GAMEPAD_AXIS_RIGHT_X 26 |
Right X.
| #define GAMEPAD_AXIS_RIGHT_Y 27 |
Right Y.
| #define GAMEPAD_CONTROL_LT 28 |
Left Trigger analog button.
| #define GAMEPAD_CONTROL_L2 GAMEPAD_CONTROL_LT |
| #define GAMEPAD_CONTROL_RT 29 |
Right Trigger analog button.
| #define GAMEPAD_CONTROL_R2 GAMEPAD_CONTROL_RT |
| #define GAMEPAD_CONTROL_UP 30 |
Up analog button.
| #define GAMEPAD_CONTROL_RIGHT 31 |
Right analog button.
| #define GAMEPAD_CONTROL_DOWN 32 |
Down analog button.
| #define GAMEPAD_CONTROL_LEFT 33 |
Left analog button.
| #define GAMEPAD_CONTROL_L1 34 |
L1 analog button.
| #define GAMEPAD_CONTROL_R1 35 |
R1 analog button.
| #define GAMEPAD_CONTROL_TRIANGLE 36 |
Triangle analog button.
| #define GAMEPAD_CONTROL_CIRCLE 37 |
Circle analog button.
| #define GAMEPAD_CONTROL_CROSS 38 |
Cross analog button.
| #define GAMEPAD_CONTROL_SQUARE 39 |
Square analog button.
| #define JOYSTICK_AXIS_MAX 39 |
| #define JOYSTICK_HAT_NONE 0 |
Joystick and Gamepad Hat Names
| #define JOYSTICK_HAT_1 1 |
| #define JOYSTICK_HAT_2 2 |
| #define JOYSTICK_HAT_3 3 |
| #define JOYSTICK_HAT_4 4 |
| #define JOYSTICK_HAT_POV 5 |
Point of View (POV).
| #define JOYSTICK_HAT_MAX 5 |
| #define JOYSTICK_BUTTON_NONE 0 |
Joystick and Gamepad Button Names
| #define JOYSTICK_BUTTON_1 1 |
| #define JOYSTICK_BUTTON_2 2 |
| #define JOYSTICK_BUTTON_3 3 |
| #define JOYSTICK_BUTTON_4 4 |
| #define JOYSTICK_BUTTON_5 5 |
| #define JOYSTICK_BUTTON_6 6 |
| #define JOYSTICK_BUTTON_7 7 |
| #define JOYSTICK_BUTTON_8 8 |
| #define JOYSTICK_BUTTON_9 9 |
| #define JOYSTICK_BUTTON_10 10 |
| #define JOYSTICK_BUTTON_11 11 |
| #define JOYSTICK_BUTTON_12 12 |
| #define JOYSTICK_BUTTON_13 13 |
| #define JOYSTICK_BUTTON_14 14 |
| #define JOYSTICK_BUTTON_15 15 |
| #define JOYSTICK_BUTTON_16 16 |
| #define JOYSTICK_BUTTON_17 17 |
| #define JOYSTICK_BUTTON_18 18 |
| #define JOYSTICK_BUTTON_19 19 |
| #define JOYSTICK_BUTTON_20 20 |
| #define JOYSTICK_BUTTON_21 21 |
| #define JOYSTICK_BUTTON_22 22 |
| #define JOYSTICK_BUTTON_23 23 |
| #define JOYSTICK_BUTTON_24 24 |
| #define JOYSTICK_BUTTON_25 25 |
| #define JOYSTICK_BUTTON_26 26 |
| #define JOYSTICK_BUTTON_27 27 |
| #define JOYSTICK_BUTTON_28 28 |
| #define JOYSTICK_BUTTON_29 29 |
| #define JOYSTICK_BUTTON_30 30 |
| #define JOYSTICK_BUTTON_31 31 |
| #define JOYSTICK_BUTTON_32 32 |
| #define GAMEPAD_BUTTON_HOME 33 |
Home or special function button.
| #define GAMEPAD_BUTTON_PS GAMEPAD_BUTTON_HOME |
Playstation button.
| #define GAMEPAD_BUTTON_XBOX GAMEPAD_BUTTON_HOME |
XBox button.
| #define GAMEPAD_BUTTON_GUIDE GAMEPAD_BUTTON_HOME |
Guide button.
| #define GAMEPAD_BUTTON_LT 34 |
Left Trigger button.
| #define GAMEPAD_BUTTON_L2 GAMEPAD_BUTTON_LT |
| #define GAMEPAD_BUTTON_LZ GAMEPAD_BUTTON_LT |
| #define GAMEPAD_BUTTON_RT 35 |
Right Trigger button.
| #define GAMEPAD_BUTTON_R2 GAMEPAD_BUTTON_RT |
| #define GAMEPAD_BUTTON_RZ GAMEPAD_BUTTON_RT |
| #define GAMEPAD_BUTTON_LB 36 |
Left Bumper button.
| #define GAMEPAD_BUTTON_L1 GAMEPAD_BUTTON_LB |
| #define GAMEPAD_BUTTON_L GAMEPAD_BUTTON_LB |
| #define GAMEPAD_BUTTON_RB 37 |
Right Bumper button.
| #define GAMEPAD_BUTTON_R1 GAMEPAD_BUTTON_RB |
| #define GAMEPAD_BUTTON_R GAMEPAD_BUTTON_RB |
| #define GAMEPAD_BUTTON_Y 38 |
Y button.
| #define GAMEPAD_BUTTON_TRIANGLE GAMEPAD_BUTTON_Y |
Triangle button.
| #define GAMEPAD_BUTTON_B 39 |
B button.
| #define GAMEPAD_BUTTON_CIRCLE GAMEPAD_BUTTON_B |
Circle button.
| #define GAMEPAD_BUTTON_A 40 |
A button.
| #define GAMEPAD_BUTTON_CROSS GAMEPAD_BUTTON_A |
Cross button.
| #define GAMEPAD_BUTTON_X 41 |
X button.
| #define GAMEPAD_BUTTON_SQUARE GAMEPAD_BUTTON_X |
Square button.
| #define GAMEPAD_BUTTON_SELECT 42 |
Select button.
| #define GAMEPAD_BUTTON_BACK GAMEPAD_BUTTON_SELECT |
Back button.
| #define GAMEPAD_BUTTON_SHARE GAMEPAD_BUTTON_SELECT |
Share button.
| #define GAMEPAD_BUTTON_CAPTURE GAMEPAD_BUTTON_SELECT |
Capture button.
| #define GAMEPAD_BUTTON_L3 43 |
Left Stick or Left Axis button.
| #define GAMEPAD_BUTTON_SL GAMEPAD_BUTTON_L3 |
| #define GAMEPAD_BUTTON_R3 44 |
Right Stick or Right Axis button.
| #define GAMEPAD_BUTTON_SR GAMEPAD_BUTTON_R3 |
| #define GAMEPAD_BUTTON_START 45 |
Start button.
| #define GAMEPAD_BUTTON_OPTIONS GAMEPAD_BUTTON_START |
| #define GAMEPAD_BUTTON_UP 46 |
Up button.
| #define GAMEPAD_BUTTON_RIGHT 47 |
Right button.
| #define GAMEPAD_BUTTON_DOWN 48 |
Down button.
| #define GAMEPAD_BUTTON_LEFT 49 |
Left button.
| #define GAMEPAD_BUTTON_PLUS 50 |
Plus button.
| #define GAMEPAD_BUTTON_MINUS 51 |
Minus button.
| #define GAMEPAD_BUTTON_TOUCHPAD 52 |
Touchpad button.
| #define JOYSTICK_BUTTON_MAX 52 |
| typedef struct _JOYSTICK_DATA JOYSTICK_DATA |
Joystick specific types Joystick Data
| typedef struct _JOYSTICK_BUFFER JOYSTICK_BUFFER |
Joystick Buffer
| typedef struct _JOYSTICK_EXTENT JOYSTICK_EXTENT |
Joystick Properties
| typedef struct _JOYSTICK_AXIS JOYSTICK_AXIS |
| typedef struct _JOYSTICK_HAT JOYSTICK_HAT |
| typedef struct _JOYSTICK_PROPERTIES JOYSTICK_PROPERTIES |
| typedef struct _JOYSTICK_DEVICE JOYSTICK_DEVICE |
Joystick Device
| typedef uint32_t STDCALL(* joystick_event_cb) (JOYSTICK_DEVICE *joystick, JOYSTICK_DATA *data) |
Joystick Event Callback
| typedef uint32_t STDCALL(* joystick_enumerate_cb) (JOYSTICK_DEVICE *joystick, void *data) |
Joystick Enumeration Callback
| typedef uint32_t STDCALL(* joystick_notification_cb) (DEVICE *device, void *data, uint32_t notification) |
Joystick Notification Callback
| typedef uint32_t STDCALL(* joystick_device_start_proc) (JOYSTICK_DEVICE *joystick) |
Joystick Device Methods
| typedef uint32_t STDCALL(* joystick_device_stop_proc) (JOYSTICK_DEVICE *joystick) |
| typedef uint32_t STDCALL(* joystick_device_peek_proc) (JOYSTICK_DEVICE *joystick) |
| typedef uint32_t STDCALL(* joystick_device_read_proc) (JOYSTICK_DEVICE *joystick, void *buffer, uint32_t size, uint32_t flags, uint32_t *count) |
| typedef uint32_t STDCALL(* joystick_device_write_proc) (JOYSTICK_DEVICE *joystick, void *buffer, uint32_t size, uint32_t count) |
| typedef uint32_t STDCALL(* joystick_device_flush_proc) (JOYSTICK_DEVICE *joystick) |
| typedef uint32_t STDCALL(* joystick_device_update_proc) (JOYSTICK_DEVICE *joystick) |
| typedef uint32_t STDCALL(* joystick_device_control_proc) (JOYSTICK_DEVICE *joystick, int request, size_t argument1, size_t *argument2) |
| typedef uint32_t STDCALL(* joystick_device_get_properties_proc) (JOYSTICK_DEVICE *joystick, JOYSTICK_PROPERTIES *properties) |
| uint32_t STDCALL joystick_device_start | ( | JOYSTICK_DEVICE * | joystick | ) |
Start the specified Joystick device ready for receiving events.
Joystick Functions
| Joystick | The Joystick device to start |
| uint32_t STDCALL joystick_device_stop | ( | JOYSTICK_DEVICE * | joystick | ) |
Stop the specified Joystick device and terminate receiving events.
| Joystick | The Joystick device to stop |
| uint32_t STDCALL joystick_device_peek | ( | JOYSTICK_DEVICE * | joystick | ) |
Peek at the buffer of the specified joystick device to see if any data packets are ready.
| Joystick | The Joystick device to peek at |
| uint32_t STDCALL joystick_device_read | ( | JOYSTICK_DEVICE * | joystick, |
| void * | buffer, | ||
| uint32_t | size, | ||
| uint32_t | flags, | ||
| uint32_t * | count ) |
Read joystick data packets from the buffer of the specified joystick device.
| Joystick | The Joystick device to read from |
| Buffer | Pointer to a buffer to copy the joystick data packets to |
| Size | The size of the buffer in bytes (Must be at least TJoystickData or greater) |
| Flags | The flags for the behaviour of the read (eg JOYSTICK_FLAG_NON_BLOCK) |
| Count | The number of joystick data packets copied to the buffer |
| uint32_t STDCALL joystick_device_write | ( | JOYSTICK_DEVICE * | joystick, |
| void * | buffer, | ||
| uint32_t | size, | ||
| uint32_t | count ) |
Write joystick data packets to the buffer of the specified joystick device.
| Joystick | The Joystick device to write to |
| Buffer | Pointer to a buffer to copy the joystick data packets from |
| Size | The size of the buffer in bytes (Must be at least TJoystickData or greater) |
| Count | The number of joystick data packets to copy from the buffer |
| uint32_t STDCALL joystick_device_flush | ( | JOYSTICK_DEVICE * | joystick | ) |
Flush the contents of the buffer of the specified joystick device.
| Joystick | The Joystick device to flush |
| uint32_t STDCALL joystick_device_update | ( | JOYSTICK_DEVICE * | joystick | ) |
Request the specified Joystick device to update the current configuration.
| Joystick | The Joystick device to update |
| uint32_t STDCALL joystick_device_control | ( | JOYSTICK_DEVICE * | joystick, |
| int | request, | ||
| size_t | argument1, | ||
| size_t * | argument2 ) |
Perform a control request on the specified Joystick device.
| Joystick | The Joystick device to control |
| Request | The request code for the operation (eg JOYSTICK_CONTROL_GET_FLAG) |
| Argument1 | The first argument for the operation (Dependent on request code) |
| Argument2 | The second argument for the operation (Dependent on request code) |
| uint32_t STDCALL joystick_device_get_properties | ( | JOYSTICK_DEVICE * | joystick, |
| JOYSTICK_PROPERTIES * | properties ) |
Get the properties for the specified Joystick device.
| Joystick | The Joystick device to get properties from |
| Properties | Pointer to a TJoystickProperties structure to fill in |
| uint32_t STDCALL joystick_device_set_state | ( | JOYSTICK_DEVICE * | joystick, |
| uint32_t | state ) |
Set the state of the specified joystick and send a notification.
| Joystick | The joystick to set the state for |
| State | The new state to set and notify |
| JOYSTICK_DEVICE *STDCALL joystick_device_create | ( | void | ) |
Create a new Joystick device entry.
| JOYSTICK_DEVICE *STDCALL joystick_device_create_ex | ( | uint32_t | size | ) |
Create a new Joystick device entry.
| Size | Size in bytes to allocate for new Joystick device (Including the Joystick device entry) |
| uint32_t STDCALL joystick_device_destroy | ( | JOYSTICK_DEVICE * | joystick | ) |
Destroy an existing Joystick device entry.
| Joystick | The Joystick device to destroy |
| uint32_t STDCALL joystick_device_register | ( | JOYSTICK_DEVICE * | joystick | ) |
Register a new Joystick device in the Joystick device table.
| Joystick | The Joystick device to register |
| uint32_t STDCALL joystick_device_deregister | ( | JOYSTICK_DEVICE * | joystick | ) |
Deregister a Joystick device from the Joystick device table.
| Joystick | The Joystick device to deregister |
| JOYSTICK_DEVICE *STDCALL joystick_device_find | ( | uint32_t | joystickid | ) |
Find a Joystick device by ID in the Joystick device table.
| JoystickId | The ID number of the Joystick device to find |
| JOYSTICK_DEVICE *STDCALL joystick_device_find_by_name | ( | const char * | name | ) |
Find a Joystick device by name in the device table.
| Name | The name of the Joystick device to find (eg Joystick0) |
| JOYSTICK_DEVICE *STDCALL joystick_device_find_by_description | ( | const char * | description | ) |
Find a Joystick device by description in the device table.
| Description | The description of the Joystick to find (eg USB Gamepad) |
| uint32_t STDCALL joystick_device_enumerate | ( | joystick_enumerate_cb | callback, |
| void * | data ) |
Enumerate all Joystick devices in the Joystick device table.
| Callback | The callback function to call for each Joystick device in the table |
| Data | A private data pointer to pass to callback for each Joystick device in the table |
| uint32_t STDCALL joystick_device_notification | ( | JOYSTICK_DEVICE * | joystick, |
| joystick_notification_cb | callback, | ||
| void * | data, | ||
| uint32_t | notification, | ||
| uint32_t | flags ) |
Register a notification for Joystick device changes.
| Joystick | The Joystick device to notify changes for (Optional, pass nil for all Joystick devices) |
| Callback | The function to call when a notification event occurs |
| Data | A private data pointer to pass to callback when a notification event occurs |
| Notification | The events to register for notification of (eg DEVICE_NOTIFICATION_REGISTER) |
| Flags | The flags to control the notification (eg NOTIFIER_FLAG_WORKER) |
| uint32_t STDCALL joystick_get_count | ( | void | ) |
Get the current Joystick device count.
Joystick Helper Functions
| JOYSTICK_DEVICE *STDCALL joystick_device_get_default | ( | void | ) |
Get the current default Joystick device.
| uint32_t STDCALL joystick_device_set_default | ( | JOYSTICK_DEVICE * | joystick | ) |
Set the current default Joystick device.
| Joystick | The Joystick device to set as default |
| JOYSTICK_DEVICE *STDCALL joystick_device_check | ( | JOYSTICK_DEVICE * | joystick | ) |
Check if the supplied Joystick device is in the Joystick device table.
| Joystick | The Joystick device to check |
| uint32_t STDCALL joystick_device_axis_to_string | ( | uint32_t | name, |
| char * | string, | ||
| uint32_t | len ) |
Return a string describing a Joystick or Gamepad Axis (eg JOYSTICK_AXIS_X).
| uint32_t STDCALL joystick_device_hat_to_string | ( | uint32_t | name, |
| char * | string, | ||
| uint32_t | len ) |
Return a string describing a Joystick or Gamepad Hat (eg JOYSTICK_HAT_POV).
| uint32_t STDCALL joystick_device_button_to_string | ( | uint32_t | name, |
| char * | string, | ||
| uint32_t | len ) |
Return a string describing a Joystick or Gamepad Button (eg GAMEPAD_BUTTON_UP).
| uint32_t STDCALL joystick_device_type_to_string | ( | uint32_t | joysticktype, |
| char * | string, | ||
| uint32_t | len ) |
Return a string describing the Joystick device type (eg JOYSTICK_TYPE_JOYSTICK).
| uint32_t STDCALL joystick_device_state_to_string | ( | uint32_t | joystickstate, |
| char * | string, | ||
| uint32_t | len ) |
Return a string describing the Joystick device state (eg JOYSTICK_STATE_ENABLED).
| uint32_t STDCALL joystick_device_state_to_notification | ( | uint32_t | state | ) |
Convert a Joystick state value into the notification code for device notifications.
| uint32_t STDCALL joystick_device_get_axis | ( | JOYSTICK_DEVICE * | joystick, |
| uint32_t | index ) |
Get the name (identifier) of an Axis on the specified Joystick.
| Joystick | The Joystick device to get the name from |
| Index | The index of the Axis in the Joystick properties (First Axis is 0) |
| uint32_t STDCALL joystick_device_set_axis | ( | JOYSTICK_DEVICE * | joystick, |
| uint32_t | index, | ||
| uint32_t | name ) |
Set the name (identifier) of an Axis on the specified Joystick.
| Joystick | The Joystick device to set the name for |
| Index | The index of the Axis in the Joystick properties (First Axis is 0) |
| Name | The name (identifier) to set for the Axis (eg JOYSTICK_AXIS_X |
| uint32_t STDCALL joystick_device_get_hat | ( | JOYSTICK_DEVICE * | joystick, |
| uint32_t | index ) |
Get the name (identifier) of a Hat on the specified Joystick.
| Joystick | The Joystick device to get the name from |
| Index | The index of the Hat in the Joystick properties (First Hat is 0) |
| uint32_t STDCALL joystick_device_set_hat | ( | JOYSTICK_DEVICE * | joystick, |
| uint32_t | index, | ||
| uint32_t | name ) |
Set the name (identifier) of a Hat on the specified Joystick.
| Joystick | The Joystick device to set the name for |
| Index | The index of the Hat in the Joystick properties (First Hat is 0) |
| Name | The name (identifier) to set for the Hat (eg JOYSTICK_HAT_POV) |
| uint32_t STDCALL joystick_device_get_button | ( | JOYSTICK_DEVICE * | joystick, |
| uint32_t | index ) |
Get the name (identifier) of a Button on the specified Joystick.
| Joystick | The Joystick device to get the name from |
| Index | The index of the Button in the Joystick properties (First Button is 0) |
| uint32_t STDCALL joystick_device_set_button | ( | JOYSTICK_DEVICE * | joystick, |
| uint32_t | index, | ||
| uint32_t | name ) |
Set the name (identifier) of a Button on the specified Joystick.
| Joystick | The Joystick device to set the name for |
| Index | The index of the Button in the Joystick properties (First Button is 0) |
| Name | The name (identifier) to set for the Button (eg GAMEPAD_BUTTON_LT) |
| uint32_t STDCALL joystick_device_set_callback | ( | JOYSTICK_DEVICE * | joystick, |
| joystick_event_cb | event, | ||
| void * | parameter ) |
Set the event callback function for the specified Joystick.
| Joystick | The Joystick device to set the event callback for |
| Event | The event callback function to be called when Joystick data is received |
| Parameter | A pointer to private data to be passed to the callback with each event |
| uint32_t STDCALL joystick_insert_data | ( | JOYSTICK_DEVICE * | joystick, |
| JOYSTICK_DATA * | data, | ||
| BOOL | signal ) |
Insert a TJoystickData entry into the joystick device buffer.
| Joystick | The joystick device to insert data for |
| Data | The TJoystickData entry to insert |
| Signal | If True then signal that new data is available in the buffer |