Ultibo API
C/C++ API for Ultibo Core
Loading...
Searching...
No Matches
joystick.h File Reference

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

Typedefs

typedef struct _JOYSTICK_DATA JOYSTICK_DATA
typedef struct _JOYSTICK_BUFFER JOYSTICK_BUFFER
typedef struct _JOYSTICK_EXTENT JOYSTICK_EXTENT
typedef struct _JOYSTICK_AXIS JOYSTICK_AXIS
typedef struct _JOYSTICK_HAT JOYSTICK_HAT
typedef struct _JOYSTICK_PROPERTIES JOYSTICK_PROPERTIES
typedef struct _JOYSTICK_DEVICE JOYSTICK_DEVICE
typedef uint32_t STDCALL(* joystick_event_cb) (JOYSTICK_DEVICE *joystick, JOYSTICK_DATA *data)
typedef uint32_t STDCALL(* joystick_enumerate_cb) (JOYSTICK_DEVICE *joystick, void *data)
typedef uint32_t STDCALL(* joystick_notification_cb) (DEVICE *device, void *data, uint32_t notification)
typedef uint32_t STDCALL(* joystick_device_start_proc) (JOYSTICK_DEVICE *joystick)
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)

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.

Macro Definition Documentation

◆ JOYSTICK_NAME_PREFIX

#define JOYSTICK_NAME_PREFIX   "Joystick"

Name prefix for Joystick Devices.

Joystick specific constants

◆ JOYSTICK_TYPE_NONE

#define JOYSTICK_TYPE_NONE   0

Joystick Device Types

◆ JOYSTICK_TYPE_JOYSTICK

#define JOYSTICK_TYPE_JOYSTICK   1

◆ JOYSTICK_TYPE_GAMEPAD

#define JOYSTICK_TYPE_GAMEPAD   2

◆ JOYSTICK_TYPE_MAX

#define JOYSTICK_TYPE_MAX   2

◆ JOYSTICK_STATE_DISABLED

#define JOYSTICK_STATE_DISABLED   0

Joystick Device States

◆ JOYSTICK_STATE_ENABLED

#define JOYSTICK_STATE_ENABLED   1

◆ JOYSTICK_STATE_MAX

#define JOYSTICK_STATE_MAX   1

◆ JOYSTICK_FLAG_NONE

#define JOYSTICK_FLAG_NONE   0x00000000

Joystick Device Flags

◆ JOYSTICK_FLAG_NON_BLOCK

#define JOYSTICK_FLAG_NON_BLOCK   0x00000001

If set device reads are non blocking (Also supported in Flags parameter of JoystickDeviceRead).

◆ JOYSTICK_FLAG_PEEK_BUFFER

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

◆ JOYSTICK_FLAG_LED

#define JOYSTICK_FLAG_LED   0x00000004

If set the device contains one or more LEDs.

◆ JOYSTICK_FLAG_RGBLED

#define JOYSTICK_FLAG_RGBLED   0x00000008

If set the device contains one or more RGB LEDs.

◆ JOYSTICK_FLAG_RUMBLE

#define JOYSTICK_FLAG_RUMBLE   0x00000010

If set the device has rumble or force feedback.

◆ JOYSTICK_FLAG_GYROSCOPE

#define JOYSTICK_FLAG_GYROSCOPE   0x00000020

If set the device contains a gyroscope.

◆ JOYSTICK_FLAG_TOUCHPAD

#define JOYSTICK_FLAG_TOUCHPAD   0x00000040

If set the device contains a touchpad.

◆ JOYSTICK_FLAG_MASK

Flags supported by JOYSTICK_CONTROL_GET/SET/CLEAR_FLAG

◆ JOYSTICK_CONTROL_GET_FLAG

#define JOYSTICK_CONTROL_GET_FLAG   1

Get Flag.

Joystick Device Control Codes

◆ JOYSTICK_CONTROL_SET_FLAG

#define JOYSTICK_CONTROL_SET_FLAG   2

Set Flag.

◆ JOYSTICK_CONTROL_CLEAR_FLAG

#define JOYSTICK_CONTROL_CLEAR_FLAG   3

Clear Flag.

◆ JOYSTICK_CONTROL_FLUSH_BUFFER

#define JOYSTICK_CONTROL_FLUSH_BUFFER   4

Flush Buffer.

◆ JOYSTICK_CONTROL_GET_HAT

#define JOYSTICK_CONTROL_GET_HAT   5

Get the name (identifier) associated with a Hat.

◆ JOYSTICK_CONTROL_SET_HAT

#define JOYSTICK_CONTROL_SET_HAT   6

Set the name (identifier) associated with a Hat.

◆ JOYSTICK_CONTROL_GET_AXIS

#define JOYSTICK_CONTROL_GET_AXIS   7

Get the name (identifier) associated with an Axis.

◆ JOYSTICK_CONTROL_SET_AXIS

#define JOYSTICK_CONTROL_SET_AXIS   8

Set the name (identifier) associated with an Axis.

◆ JOYSTICK_CONTROL_GET_BUTTON

#define JOYSTICK_CONTROL_GET_BUTTON   9

Get the name (identifier) associated with a Button.

◆ JOYSTICK_CONTROL_SET_BUTTON

#define JOYSTICK_CONTROL_SET_BUTTON   10

Set the name (identifier) associated with a Button.

◆ JOYSTICK_CONTROL_GET_CALLBACK

#define JOYSTICK_CONTROL_GET_CALLBACK   11

Get the registered callback function for joystick events.

◆ JOYSTICK_CONTROL_SET_CALLBACK

#define JOYSTICK_CONTROL_SET_CALLBACK   12

Set the registered callback function for joystick events.

◆ JOYSTICK_BUFFER_SIZE

#define JOYSTICK_BUFFER_SIZE   2048

Joystick Buffer Size

◆ JOYSTICK_MAX_AXIS

#define JOYSTICK_MAX_AXIS   16

Joystick Axis, Hat and Button Maximum

◆ JOYSTICK_MAX_HAT

#define JOYSTICK_MAX_HAT   4

◆ JOYSTICK_MAX_BUTTON

#define JOYSTICK_MAX_BUTTON   32

◆ JOYSTICK_DEFAULT_MINIMUM

#define JOYSTICK_DEFAULT_MINIMUM   0

Joystick Default Minimum and Maximum

◆ JOYSTICK_DEFAULT_MAXIMUM

#define JOYSTICK_DEFAULT_MAXIMUM   255

◆ JOYSTICK_AXIS_NONE

#define JOYSTICK_AXIS_NONE   0

Joystick and Gamepad Axis Names (Includes Buttons, Sliders, Wheels etc that report an analog value)

◆ JOYSTICK_AXIS_1

#define JOYSTICK_AXIS_1   1

◆ JOYSTICK_AXIS_2

#define JOYSTICK_AXIS_2   2

◆ JOYSTICK_AXIS_3

#define JOYSTICK_AXIS_3   3

◆ JOYSTICK_AXIS_4

#define JOYSTICK_AXIS_4   4

◆ JOYSTICK_AXIS_5

#define JOYSTICK_AXIS_5   5

◆ JOYSTICK_AXIS_6

#define JOYSTICK_AXIS_6   6

◆ JOYSTICK_AXIS_7

#define JOYSTICK_AXIS_7   7

◆ JOYSTICK_AXIS_8

#define JOYSTICK_AXIS_8   8

◆ JOYSTICK_AXIS_9

#define JOYSTICK_AXIS_9   9

◆ JOYSTICK_AXIS_10

#define JOYSTICK_AXIS_10   10

◆ JOYSTICK_AXIS_11

#define JOYSTICK_AXIS_11   11

◆ JOYSTICK_AXIS_12

#define JOYSTICK_AXIS_12   12

◆ JOYSTICK_AXIS_13

#define JOYSTICK_AXIS_13   13

◆ JOYSTICK_AXIS_14

#define JOYSTICK_AXIS_14   14

◆ JOYSTICK_AXIS_15

#define JOYSTICK_AXIS_15   15

◆ JOYSTICK_AXIS_16

#define JOYSTICK_AXIS_16   16

◆ JOYSTICK_AXIS_X

#define JOYSTICK_AXIS_X   17

X.

◆ JOYSTICK_AXIS_Y

#define JOYSTICK_AXIS_Y   18

Y.

◆ JOYSTICK_AXIS_Z

#define JOYSTICK_AXIS_Z   19

Z.

◆ JOYSTICK_ROTATION_X

#define JOYSTICK_ROTATION_X   20

Rotation X.

◆ JOYSTICK_ROTATION_Y

#define JOYSTICK_ROTATION_Y   21

Rotation Y.

◆ JOYSTICK_ROTATION_Z

#define JOYSTICK_ROTATION_Z   22

Rotation Z.

◆ JOYSTICK_SLIDER

#define JOYSTICK_SLIDER   23

Slider.

◆ GAMEPAD_AXIS_LEFT_X

#define GAMEPAD_AXIS_LEFT_X   24

Left X.

◆ GAMEPAD_AXIS_LEFT_Y

#define GAMEPAD_AXIS_LEFT_Y   25

Left Y.

◆ GAMEPAD_AXIS_X

#define GAMEPAD_AXIS_X   GAMEPAD_AXIS_LEFT_X

◆ GAMEPAD_AXIS_Y

#define GAMEPAD_AXIS_Y   GAMEPAD_AXIS_LEFT_Y

◆ GAMEPAD_AXIS_RIGHT_X

#define GAMEPAD_AXIS_RIGHT_X   26

Right X.

◆ GAMEPAD_AXIS_RIGHT_Y

#define GAMEPAD_AXIS_RIGHT_Y   27

Right Y.

◆ GAMEPAD_CONTROL_LT

#define GAMEPAD_CONTROL_LT   28

Left Trigger analog button.

◆ GAMEPAD_CONTROL_L2

#define GAMEPAD_CONTROL_L2   GAMEPAD_CONTROL_LT

◆ GAMEPAD_CONTROL_RT

#define GAMEPAD_CONTROL_RT   29

Right Trigger analog button.

◆ GAMEPAD_CONTROL_R2

#define GAMEPAD_CONTROL_R2   GAMEPAD_CONTROL_RT

◆ GAMEPAD_CONTROL_UP

#define GAMEPAD_CONTROL_UP   30

Up analog button.

◆ GAMEPAD_CONTROL_RIGHT

#define GAMEPAD_CONTROL_RIGHT   31

Right analog button.

◆ GAMEPAD_CONTROL_DOWN

#define GAMEPAD_CONTROL_DOWN   32

Down analog button.

◆ GAMEPAD_CONTROL_LEFT

#define GAMEPAD_CONTROL_LEFT   33

Left analog button.

◆ GAMEPAD_CONTROL_L1

#define GAMEPAD_CONTROL_L1   34

L1 analog button.

◆ GAMEPAD_CONTROL_R1

#define GAMEPAD_CONTROL_R1   35

R1 analog button.

◆ GAMEPAD_CONTROL_TRIANGLE

#define GAMEPAD_CONTROL_TRIANGLE   36

Triangle analog button.

◆ GAMEPAD_CONTROL_CIRCLE

#define GAMEPAD_CONTROL_CIRCLE   37

Circle analog button.

◆ GAMEPAD_CONTROL_CROSS

#define GAMEPAD_CONTROL_CROSS   38

Cross analog button.

◆ GAMEPAD_CONTROL_SQUARE

#define GAMEPAD_CONTROL_SQUARE   39

Square analog button.

◆ JOYSTICK_AXIS_MAX

#define JOYSTICK_AXIS_MAX   39

◆ JOYSTICK_HAT_NONE

#define JOYSTICK_HAT_NONE   0

Joystick and Gamepad Hat Names

◆ JOYSTICK_HAT_1

#define JOYSTICK_HAT_1   1

◆ JOYSTICK_HAT_2

#define JOYSTICK_HAT_2   2

◆ JOYSTICK_HAT_3

#define JOYSTICK_HAT_3   3

◆ JOYSTICK_HAT_4

#define JOYSTICK_HAT_4   4

◆ JOYSTICK_HAT_POV

#define JOYSTICK_HAT_POV   5

Point of View (POV).

◆ JOYSTICK_HAT_MAX

#define JOYSTICK_HAT_MAX   5

◆ JOYSTICK_BUTTON_NONE

#define JOYSTICK_BUTTON_NONE   0

Joystick and Gamepad Button Names

◆ JOYSTICK_BUTTON_1

#define JOYSTICK_BUTTON_1   1

◆ JOYSTICK_BUTTON_2

#define JOYSTICK_BUTTON_2   2

◆ JOYSTICK_BUTTON_3

#define JOYSTICK_BUTTON_3   3

◆ JOYSTICK_BUTTON_4

#define JOYSTICK_BUTTON_4   4

◆ JOYSTICK_BUTTON_5

#define JOYSTICK_BUTTON_5   5

◆ JOYSTICK_BUTTON_6

#define JOYSTICK_BUTTON_6   6

◆ JOYSTICK_BUTTON_7

#define JOYSTICK_BUTTON_7   7

◆ JOYSTICK_BUTTON_8

#define JOYSTICK_BUTTON_8   8

◆ JOYSTICK_BUTTON_9

#define JOYSTICK_BUTTON_9   9

◆ JOYSTICK_BUTTON_10

#define JOYSTICK_BUTTON_10   10

◆ JOYSTICK_BUTTON_11

#define JOYSTICK_BUTTON_11   11

◆ JOYSTICK_BUTTON_12

#define JOYSTICK_BUTTON_12   12

◆ JOYSTICK_BUTTON_13

#define JOYSTICK_BUTTON_13   13

◆ JOYSTICK_BUTTON_14

#define JOYSTICK_BUTTON_14   14

◆ JOYSTICK_BUTTON_15

#define JOYSTICK_BUTTON_15   15

◆ JOYSTICK_BUTTON_16

#define JOYSTICK_BUTTON_16   16

◆ JOYSTICK_BUTTON_17

#define JOYSTICK_BUTTON_17   17

◆ JOYSTICK_BUTTON_18

#define JOYSTICK_BUTTON_18   18

◆ JOYSTICK_BUTTON_19

#define JOYSTICK_BUTTON_19   19

◆ JOYSTICK_BUTTON_20

#define JOYSTICK_BUTTON_20   20

◆ JOYSTICK_BUTTON_21

#define JOYSTICK_BUTTON_21   21

◆ JOYSTICK_BUTTON_22

#define JOYSTICK_BUTTON_22   22

◆ JOYSTICK_BUTTON_23

#define JOYSTICK_BUTTON_23   23

◆ JOYSTICK_BUTTON_24

#define JOYSTICK_BUTTON_24   24

◆ JOYSTICK_BUTTON_25

#define JOYSTICK_BUTTON_25   25

◆ JOYSTICK_BUTTON_26

#define JOYSTICK_BUTTON_26   26

◆ JOYSTICK_BUTTON_27

#define JOYSTICK_BUTTON_27   27

◆ JOYSTICK_BUTTON_28

#define JOYSTICK_BUTTON_28   28

◆ JOYSTICK_BUTTON_29

#define JOYSTICK_BUTTON_29   29

◆ JOYSTICK_BUTTON_30

#define JOYSTICK_BUTTON_30   30

◆ JOYSTICK_BUTTON_31

#define JOYSTICK_BUTTON_31   31

◆ JOYSTICK_BUTTON_32

#define JOYSTICK_BUTTON_32   32

◆ GAMEPAD_BUTTON_HOME

#define GAMEPAD_BUTTON_HOME   33

Home or special function button.

◆ GAMEPAD_BUTTON_PS

#define GAMEPAD_BUTTON_PS   GAMEPAD_BUTTON_HOME

Playstation button.

◆ GAMEPAD_BUTTON_XBOX

#define GAMEPAD_BUTTON_XBOX   GAMEPAD_BUTTON_HOME

XBox button.

◆ GAMEPAD_BUTTON_GUIDE

#define GAMEPAD_BUTTON_GUIDE   GAMEPAD_BUTTON_HOME

Guide button.

◆ GAMEPAD_BUTTON_LT

#define GAMEPAD_BUTTON_LT   34

Left Trigger button.

◆ GAMEPAD_BUTTON_L2

#define GAMEPAD_BUTTON_L2   GAMEPAD_BUTTON_LT

◆ GAMEPAD_BUTTON_LZ

#define GAMEPAD_BUTTON_LZ   GAMEPAD_BUTTON_LT

◆ GAMEPAD_BUTTON_RT

#define GAMEPAD_BUTTON_RT   35

Right Trigger button.

◆ GAMEPAD_BUTTON_R2

#define GAMEPAD_BUTTON_R2   GAMEPAD_BUTTON_RT

◆ GAMEPAD_BUTTON_RZ

#define GAMEPAD_BUTTON_RZ   GAMEPAD_BUTTON_RT

◆ GAMEPAD_BUTTON_LB

#define GAMEPAD_BUTTON_LB   36

Left Bumper button.

◆ GAMEPAD_BUTTON_L1

#define GAMEPAD_BUTTON_L1   GAMEPAD_BUTTON_LB

◆ GAMEPAD_BUTTON_L

#define GAMEPAD_BUTTON_L   GAMEPAD_BUTTON_LB

◆ GAMEPAD_BUTTON_RB

#define GAMEPAD_BUTTON_RB   37

Right Bumper button.

◆ GAMEPAD_BUTTON_R1

#define GAMEPAD_BUTTON_R1   GAMEPAD_BUTTON_RB

◆ GAMEPAD_BUTTON_R

#define GAMEPAD_BUTTON_R   GAMEPAD_BUTTON_RB

◆ GAMEPAD_BUTTON_Y

#define GAMEPAD_BUTTON_Y   38

Y button.

◆ GAMEPAD_BUTTON_TRIANGLE

#define GAMEPAD_BUTTON_TRIANGLE   GAMEPAD_BUTTON_Y

Triangle button.

◆ GAMEPAD_BUTTON_B

#define GAMEPAD_BUTTON_B   39

B button.

◆ GAMEPAD_BUTTON_CIRCLE

#define GAMEPAD_BUTTON_CIRCLE   GAMEPAD_BUTTON_B

Circle button.

◆ GAMEPAD_BUTTON_A

#define GAMEPAD_BUTTON_A   40

A button.

◆ GAMEPAD_BUTTON_CROSS

#define GAMEPAD_BUTTON_CROSS   GAMEPAD_BUTTON_A

Cross button.

◆ GAMEPAD_BUTTON_X

#define GAMEPAD_BUTTON_X   41

X button.

◆ GAMEPAD_BUTTON_SQUARE

#define GAMEPAD_BUTTON_SQUARE   GAMEPAD_BUTTON_X

Square button.

◆ GAMEPAD_BUTTON_SELECT

#define GAMEPAD_BUTTON_SELECT   42

Select button.

◆ GAMEPAD_BUTTON_BACK

#define GAMEPAD_BUTTON_BACK   GAMEPAD_BUTTON_SELECT

Back button.

◆ GAMEPAD_BUTTON_SHARE

#define GAMEPAD_BUTTON_SHARE   GAMEPAD_BUTTON_SELECT

Share button.

◆ GAMEPAD_BUTTON_CAPTURE

#define GAMEPAD_BUTTON_CAPTURE   GAMEPAD_BUTTON_SELECT

Capture button.

◆ GAMEPAD_BUTTON_L3

#define GAMEPAD_BUTTON_L3   43

Left Stick or Left Axis button.

◆ GAMEPAD_BUTTON_SL

#define GAMEPAD_BUTTON_SL   GAMEPAD_BUTTON_L3

◆ GAMEPAD_BUTTON_R3

#define GAMEPAD_BUTTON_R3   44

Right Stick or Right Axis button.

◆ GAMEPAD_BUTTON_SR

#define GAMEPAD_BUTTON_SR   GAMEPAD_BUTTON_R3

◆ GAMEPAD_BUTTON_START

#define GAMEPAD_BUTTON_START   45

Start button.

◆ GAMEPAD_BUTTON_OPTIONS

#define GAMEPAD_BUTTON_OPTIONS   GAMEPAD_BUTTON_START

◆ GAMEPAD_BUTTON_UP

#define GAMEPAD_BUTTON_UP   46

Up button.

◆ GAMEPAD_BUTTON_RIGHT

#define GAMEPAD_BUTTON_RIGHT   47

Right button.

◆ GAMEPAD_BUTTON_DOWN

#define GAMEPAD_BUTTON_DOWN   48

Down button.

◆ GAMEPAD_BUTTON_LEFT

#define GAMEPAD_BUTTON_LEFT   49

Left button.

◆ GAMEPAD_BUTTON_PLUS

#define GAMEPAD_BUTTON_PLUS   50

Plus button.

◆ GAMEPAD_BUTTON_MINUS

#define GAMEPAD_BUTTON_MINUS   51

Minus button.

◆ GAMEPAD_BUTTON_TOUCHPAD

#define GAMEPAD_BUTTON_TOUCHPAD   52

Touchpad button.

◆ JOYSTICK_BUTTON_MAX

#define JOYSTICK_BUTTON_MAX   52

Typedef Documentation

◆ JOYSTICK_DATA

typedef struct _JOYSTICK_DATA JOYSTICK_DATA

Joystick specific types Joystick Data

◆ JOYSTICK_BUFFER

Joystick Buffer

◆ JOYSTICK_EXTENT

Joystick Properties

◆ JOYSTICK_AXIS

typedef struct _JOYSTICK_AXIS JOYSTICK_AXIS

◆ JOYSTICK_HAT

typedef struct _JOYSTICK_HAT JOYSTICK_HAT

◆ JOYSTICK_PROPERTIES

◆ JOYSTICK_DEVICE

Joystick Device

◆ joystick_event_cb

typedef uint32_t STDCALL(* joystick_event_cb) (JOYSTICK_DEVICE *joystick, JOYSTICK_DATA *data)

Joystick Event Callback

◆ joystick_enumerate_cb

typedef uint32_t STDCALL(* joystick_enumerate_cb) (JOYSTICK_DEVICE *joystick, void *data)

Joystick Enumeration Callback

◆ joystick_notification_cb

typedef uint32_t STDCALL(* joystick_notification_cb) (DEVICE *device, void *data, uint32_t notification)

Joystick Notification Callback

◆ joystick_device_start_proc

typedef uint32_t STDCALL(* joystick_device_start_proc) (JOYSTICK_DEVICE *joystick)

Joystick Device Methods

◆ joystick_device_stop_proc

typedef uint32_t STDCALL(* joystick_device_stop_proc) (JOYSTICK_DEVICE *joystick)

◆ joystick_device_peek_proc

typedef uint32_t STDCALL(* joystick_device_peek_proc) (JOYSTICK_DEVICE *joystick)

◆ joystick_device_read_proc

typedef uint32_t STDCALL(* joystick_device_read_proc) (JOYSTICK_DEVICE *joystick, void *buffer, uint32_t size, uint32_t flags, uint32_t *count)

◆ joystick_device_write_proc

typedef uint32_t STDCALL(* joystick_device_write_proc) (JOYSTICK_DEVICE *joystick, void *buffer, uint32_t size, uint32_t count)

◆ joystick_device_flush_proc

typedef uint32_t STDCALL(* joystick_device_flush_proc) (JOYSTICK_DEVICE *joystick)

◆ joystick_device_update_proc

typedef uint32_t STDCALL(* joystick_device_update_proc) (JOYSTICK_DEVICE *joystick)

◆ joystick_device_control_proc

typedef uint32_t STDCALL(* joystick_device_control_proc) (JOYSTICK_DEVICE *joystick, int request, size_t argument1, size_t *argument2)

◆ joystick_device_get_properties_proc

typedef uint32_t STDCALL(* joystick_device_get_properties_proc) (JOYSTICK_DEVICE *joystick, JOYSTICK_PROPERTIES *properties)

Function Documentation

◆ joystick_device_start()

uint32_t STDCALL joystick_device_start ( JOYSTICK_DEVICE * joystick)

Start the specified Joystick device ready for receiving events.

Joystick Functions

Parameters
JoystickThe Joystick device to start
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ joystick_device_stop()

uint32_t STDCALL joystick_device_stop ( JOYSTICK_DEVICE * joystick)

Stop the specified Joystick device and terminate receiving events.

Parameters
JoystickThe Joystick device to stop
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ joystick_device_peek()

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.

Parameters
JoystickThe Joystick device to peek at
Returns
ERROR_SUCCESS if packets are ready, ERROR_NO_MORE_ITEMS if not or another error code on failure

◆ joystick_device_read()

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.

Parameters
JoystickThe Joystick device to read from
BufferPointer to a buffer to copy the joystick data packets to
SizeThe size of the buffer in bytes (Must be at least TJoystickData or greater)
FlagsThe flags for the behaviour of the read (eg JOYSTICK_FLAG_NON_BLOCK)
CountThe number of joystick data packets copied to the buffer
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ joystick_device_write()

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.

Parameters
JoystickThe Joystick device to write to
BufferPointer to a buffer to copy the joystick data packets from
SizeThe size of the buffer in bytes (Must be at least TJoystickData or greater)
CountThe number of joystick data packets to copy from the buffer
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ joystick_device_flush()

uint32_t STDCALL joystick_device_flush ( JOYSTICK_DEVICE * joystick)

Flush the contents of the buffer of the specified joystick device.

Parameters
JoystickThe Joystick device to flush
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ joystick_device_update()

uint32_t STDCALL joystick_device_update ( JOYSTICK_DEVICE * joystick)

Request the specified Joystick device to update the current configuration.

Parameters
JoystickThe Joystick device to update
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
Items updated can include rotation, maximum X and Y and flags (If supported)

◆ joystick_device_control()

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.

Parameters
JoystickThe Joystick device to control
RequestThe request code for the operation (eg JOYSTICK_CONTROL_GET_FLAG)
Argument1The first argument for the operation (Dependent on request code)
Argument2The second argument for the operation (Dependent on request code)
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ joystick_device_get_properties()

uint32_t STDCALL joystick_device_get_properties ( JOYSTICK_DEVICE * joystick,
JOYSTICK_PROPERTIES * properties )

Get the properties for the specified Joystick device.

Parameters
JoystickThe Joystick device to get properties from
PropertiesPointer to a TJoystickProperties structure to fill in
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ joystick_device_set_state()

uint32_t STDCALL joystick_device_set_state ( JOYSTICK_DEVICE * joystick,
uint32_t state )

Set the state of the specified joystick and send a notification.

Parameters
JoystickThe joystick to set the state for
StateThe new state to set and notify
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ joystick_device_create()

JOYSTICK_DEVICE *STDCALL joystick_device_create ( void )

Create a new Joystick device entry.

Returns
Pointer to new Joystick device entry or nil if Joystick device could not be created

◆ joystick_device_create_ex()

JOYSTICK_DEVICE *STDCALL joystick_device_create_ex ( uint32_t size)

Create a new Joystick device entry.

Parameters
SizeSize in bytes to allocate for new Joystick device (Including the Joystick device entry)
Returns
Pointer to new Joystick device entry or nil if Joystick device could not be created

◆ joystick_device_destroy()

uint32_t STDCALL joystick_device_destroy ( JOYSTICK_DEVICE * joystick)

Destroy an existing Joystick device entry.

Parameters
JoystickThe Joystick device to destroy
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ joystick_device_register()

uint32_t STDCALL joystick_device_register ( JOYSTICK_DEVICE * joystick)

Register a new Joystick device in the Joystick device table.

Parameters
JoystickThe Joystick device to register
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ joystick_device_deregister()

uint32_t STDCALL joystick_device_deregister ( JOYSTICK_DEVICE * joystick)

Deregister a Joystick device from the Joystick device table.

Parameters
JoystickThe Joystick device to deregister
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ joystick_device_find()

JOYSTICK_DEVICE *STDCALL joystick_device_find ( uint32_t joystickid)

Find a Joystick device by ID in the Joystick device table.

Parameters
JoystickIdThe ID number of the Joystick device to find
Returns
Pointer to Joystick device entry or nil if not found

◆ joystick_device_find_by_name()

JOYSTICK_DEVICE *STDCALL joystick_device_find_by_name ( const char * name)

Find a Joystick device by name in the device table.

Parameters
NameThe name of the Joystick device to find (eg Joystick0)
Returns
Pointer to Joystick device entry or nil if not found

◆ joystick_device_find_by_description()

JOYSTICK_DEVICE *STDCALL joystick_device_find_by_description ( const char * description)

Find a Joystick device by description in the device table.

Parameters
DescriptionThe description of the Joystick to find (eg USB Gamepad)
Returns
Pointer to Joystick device entry or nil if not found

◆ joystick_device_enumerate()

uint32_t STDCALL joystick_device_enumerate ( joystick_enumerate_cb callback,
void * data )

Enumerate all Joystick devices in the Joystick device table.

Parameters
CallbackThe callback function to call for each Joystick device in the table
DataA private data pointer to pass to callback for each Joystick device in the table
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ joystick_device_notification()

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.

Parameters
JoystickThe Joystick device to notify changes for (Optional, pass nil for all Joystick devices)
CallbackThe function to call when a notification event occurs
DataA private data pointer to pass to callback when a notification event occurs
NotificationThe events to register for notification of (eg DEVICE_NOTIFICATION_REGISTER)
FlagsThe flags to control the notification (eg NOTIFIER_FLAG_WORKER)
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ joystick_get_count()

uint32_t STDCALL joystick_get_count ( void )

Get the current Joystick device count.

Joystick Helper Functions

Returns
The number of Joystick devices

◆ joystick_device_get_default()

JOYSTICK_DEVICE *STDCALL joystick_device_get_default ( void )

Get the current default Joystick device.

Returns
Pointer to default Joystick device entry

◆ joystick_device_set_default()

uint32_t STDCALL joystick_device_set_default ( JOYSTICK_DEVICE * joystick)

Set the current default Joystick device.

Parameters
JoystickThe Joystick device to set as default
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ joystick_device_check()

JOYSTICK_DEVICE *STDCALL joystick_device_check ( JOYSTICK_DEVICE * joystick)

Check if the supplied Joystick device is in the Joystick device table.

Parameters
JoystickThe Joystick device to check
Returns
Pointer to Joystick device entry or nil if not found

◆ joystick_device_axis_to_string()

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

◆ joystick_device_hat_to_string()

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

◆ joystick_device_button_to_string()

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

◆ joystick_device_type_to_string()

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

◆ joystick_device_state_to_string()

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

◆ joystick_device_state_to_notification()

uint32_t STDCALL joystick_device_state_to_notification ( uint32_t state)

Convert a Joystick state value into the notification code for device notifications.

◆ joystick_device_get_axis()

uint32_t STDCALL joystick_device_get_axis ( JOYSTICK_DEVICE * joystick,
uint32_t index )

Get the name (identifier) of an Axis on the specified Joystick.

Parameters
JoystickThe Joystick device to get the name from
IndexThe index of the Axis in the Joystick properties (First Axis is 0)
Returns
The current name of the Axis (eg GAMEPAD_AXIS_LEFT_X)

◆ joystick_device_set_axis()

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.

Parameters
JoystickThe Joystick device to set the name for
IndexThe index of the Axis in the Joystick properties (First Axis is 0)
NameThe name (identifier) to set for the Axis (eg JOYSTICK_AXIS_X
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ joystick_device_get_hat()

uint32_t STDCALL joystick_device_get_hat ( JOYSTICK_DEVICE * joystick,
uint32_t index )

Get the name (identifier) of a Hat on the specified Joystick.

Parameters
JoystickThe Joystick device to get the name from
IndexThe index of the Hat in the Joystick properties (First Hat is 0)
Returns
The current name of the Hat (eg GAMEPAD_HAT_POV)

◆ joystick_device_set_hat()

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.

Parameters
JoystickThe Joystick device to set the name for
IndexThe index of the Hat in the Joystick properties (First Hat is 0)
NameThe name (identifier) to set for the Hat (eg JOYSTICK_HAT_POV)
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ joystick_device_get_button()

uint32_t STDCALL joystick_device_get_button ( JOYSTICK_DEVICE * joystick,
uint32_t index )

Get the name (identifier) of a Button on the specified Joystick.

Parameters
JoystickThe Joystick device to get the name from
IndexThe index of the Button in the Joystick properties (First Button is 0)
Returns
The current name of the Button (eg GAMEPAD_BUTTON_B)

◆ joystick_device_set_button()

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.

Parameters
JoystickThe Joystick device to set the name for
IndexThe index of the Button in the Joystick properties (First Button is 0)
NameThe name (identifier) to set for the Button (eg GAMEPAD_BUTTON_LT)
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ joystick_device_set_callback()

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.

Parameters
JoystickThe Joystick device to set the event callback for
EventThe event callback function to be called when Joystick data is received
ParameterA pointer to private data to be passed to the callback with each event
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ joystick_insert_data()

uint32_t STDCALL joystick_insert_data ( JOYSTICK_DEVICE * joystick,
JOYSTICK_DATA * data,
BOOL signal )

Insert a TJoystickData entry into the joystick device buffer.

Parameters
JoystickThe joystick device to insert data for
DataThe TJoystickData entry to insert
SignalIf True then signal that new data is available in the buffer
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
Caller must hold the joystick device lock