Ultibo API
C/C++ API for Ultibo Core
Loading...
Searching...
No Matches
joystick.h
Go to the documentation of this file.
1/*
2 * This file is part of the Ultibo project, https://ultibo.org/
3 *
4 * The MIT License (MIT)
5 *
6 * Copyright (c) 2026 Garry Wood <garry@softoz.com.au>
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files (the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 * THE SOFTWARE.
25 */
26#ifndef _ULTIBO_JOYSTICK_H
27#define _ULTIBO_JOYSTICK_H
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33#include "ultibo/globaltypes.h"
34#include "ultibo/globalconst.h"
35#include "ultibo/devices.h"
36
38#define JOYSTICK_NAME_PREFIX "Joystick"
39
41#define JOYSTICK_TYPE_NONE 0
42#define JOYSTICK_TYPE_JOYSTICK 1
43#define JOYSTICK_TYPE_GAMEPAD 2
44
45#define JOYSTICK_TYPE_MAX 2
46
48#define JOYSTICK_STATE_DISABLED 0
49#define JOYSTICK_STATE_ENABLED 1
50
51#define JOYSTICK_STATE_MAX 1
52
54#define JOYSTICK_FLAG_NONE 0x00000000
55#define JOYSTICK_FLAG_NON_BLOCK 0x00000001
56#define JOYSTICK_FLAG_PEEK_BUFFER 0x00000002
57#define JOYSTICK_FLAG_LED 0x00000004
58#define JOYSTICK_FLAG_RGBLED 0x00000008
59#define JOYSTICK_FLAG_RUMBLE 0x00000010
60#define JOYSTICK_FLAG_GYROSCOPE 0x00000020
61#define JOYSTICK_FLAG_TOUCHPAD 0x00000040
62
64#define JOYSTICK_FLAG_MASK JOYSTICK_FLAG_NON_BLOCK | JOYSTICK_FLAG_LED | JOYSTICK_FLAG_RGBLED | JOYSTICK_FLAG_RUMBLE | JOYSTICK_FLAG_GYROSCOPE | JOYSTICK_FLAG_TOUCHPAD
65
67#define JOYSTICK_CONTROL_GET_FLAG 1
68#define JOYSTICK_CONTROL_SET_FLAG 2
69#define JOYSTICK_CONTROL_CLEAR_FLAG 3
70#define JOYSTICK_CONTROL_FLUSH_BUFFER 4
71#define JOYSTICK_CONTROL_GET_HAT 5
72#define JOYSTICK_CONTROL_SET_HAT 6
73#define JOYSTICK_CONTROL_GET_AXIS 7
74#define JOYSTICK_CONTROL_SET_AXIS 8
75#define JOYSTICK_CONTROL_GET_BUTTON 9
76#define JOYSTICK_CONTROL_SET_BUTTON 10
77#define JOYSTICK_CONTROL_GET_CALLBACK 11
78#define JOYSTICK_CONTROL_SET_CALLBACK 12
79
81#define JOYSTICK_BUFFER_SIZE 2048
82
84#define JOYSTICK_MAX_AXIS 16
85#define JOYSTICK_MAX_HAT 4
86#define JOYSTICK_MAX_BUTTON 32
87
89#define JOYSTICK_DEFAULT_MINIMUM 0
90#define JOYSTICK_DEFAULT_MAXIMUM 255
91
93#define JOYSTICK_AXIS_NONE 0
94#define JOYSTICK_AXIS_1 1
95#define JOYSTICK_AXIS_2 2
96#define JOYSTICK_AXIS_3 3
97#define JOYSTICK_AXIS_4 4
98#define JOYSTICK_AXIS_5 5
99#define JOYSTICK_AXIS_6 6
100#define JOYSTICK_AXIS_7 7
101#define JOYSTICK_AXIS_8 8
102#define JOYSTICK_AXIS_9 9
103#define JOYSTICK_AXIS_10 10
104#define JOYSTICK_AXIS_11 11
105#define JOYSTICK_AXIS_12 12
106#define JOYSTICK_AXIS_13 13
107#define JOYSTICK_AXIS_14 14
108#define JOYSTICK_AXIS_15 15
109#define JOYSTICK_AXIS_16 16
110
111#define JOYSTICK_AXIS_X 17
112#define JOYSTICK_AXIS_Y 18
113#define JOYSTICK_AXIS_Z 19
114#define JOYSTICK_ROTATION_X 20
115#define JOYSTICK_ROTATION_Y 21
116#define JOYSTICK_ROTATION_Z 22
117#define JOYSTICK_SLIDER 23
118
119#define GAMEPAD_AXIS_LEFT_X 24
120#define GAMEPAD_AXIS_LEFT_Y 25
121#define GAMEPAD_AXIS_X GAMEPAD_AXIS_LEFT_X
122#define GAMEPAD_AXIS_Y GAMEPAD_AXIS_LEFT_Y
123#define GAMEPAD_AXIS_RIGHT_X 26
124#define GAMEPAD_AXIS_RIGHT_Y 27
125#define GAMEPAD_CONTROL_LT 28
126#define GAMEPAD_CONTROL_L2 GAMEPAD_CONTROL_LT
127#define GAMEPAD_CONTROL_RT 29
128#define GAMEPAD_CONTROL_R2 GAMEPAD_CONTROL_RT
129#define GAMEPAD_CONTROL_UP 30
130#define GAMEPAD_CONTROL_RIGHT 31
131#define GAMEPAD_CONTROL_DOWN 32
132#define GAMEPAD_CONTROL_LEFT 33
133#define GAMEPAD_CONTROL_L1 34
134#define GAMEPAD_CONTROL_R1 35
135#define GAMEPAD_CONTROL_TRIANGLE 36
136#define GAMEPAD_CONTROL_CIRCLE 37
137#define GAMEPAD_CONTROL_CROSS 38
138#define GAMEPAD_CONTROL_SQUARE 39
139
140#define JOYSTICK_AXIS_MAX 39
141
143#define JOYSTICK_HAT_NONE 0
144#define JOYSTICK_HAT_1 1
145#define JOYSTICK_HAT_2 2
146#define JOYSTICK_HAT_3 3
147#define JOYSTICK_HAT_4 4
148
149#define JOYSTICK_HAT_POV 5
150
151#define JOYSTICK_HAT_MAX 5
152
154#define JOYSTICK_BUTTON_NONE 0
155#define JOYSTICK_BUTTON_1 1
156#define JOYSTICK_BUTTON_2 2
157#define JOYSTICK_BUTTON_3 3
158#define JOYSTICK_BUTTON_4 4
159#define JOYSTICK_BUTTON_5 5
160#define JOYSTICK_BUTTON_6 6
161#define JOYSTICK_BUTTON_7 7
162#define JOYSTICK_BUTTON_8 8
163#define JOYSTICK_BUTTON_9 9
164#define JOYSTICK_BUTTON_10 10
165#define JOYSTICK_BUTTON_11 11
166#define JOYSTICK_BUTTON_12 12
167#define JOYSTICK_BUTTON_13 13
168#define JOYSTICK_BUTTON_14 14
169#define JOYSTICK_BUTTON_15 15
170#define JOYSTICK_BUTTON_16 16
171#define JOYSTICK_BUTTON_17 17
172#define JOYSTICK_BUTTON_18 18
173#define JOYSTICK_BUTTON_19 19
174#define JOYSTICK_BUTTON_20 20
175#define JOYSTICK_BUTTON_21 21
176#define JOYSTICK_BUTTON_22 22
177#define JOYSTICK_BUTTON_23 23
178#define JOYSTICK_BUTTON_24 24
179#define JOYSTICK_BUTTON_25 25
180#define JOYSTICK_BUTTON_26 26
181#define JOYSTICK_BUTTON_27 27
182#define JOYSTICK_BUTTON_28 28
183#define JOYSTICK_BUTTON_29 29
184#define JOYSTICK_BUTTON_30 30
185#define JOYSTICK_BUTTON_31 31
186#define JOYSTICK_BUTTON_32 32
187
188#define GAMEPAD_BUTTON_HOME 33
189#define GAMEPAD_BUTTON_PS GAMEPAD_BUTTON_HOME
190#define GAMEPAD_BUTTON_XBOX GAMEPAD_BUTTON_HOME
191#define GAMEPAD_BUTTON_GUIDE GAMEPAD_BUTTON_HOME
192#define GAMEPAD_BUTTON_LT 34
193#define GAMEPAD_BUTTON_L2 GAMEPAD_BUTTON_LT
194#define GAMEPAD_BUTTON_LZ GAMEPAD_BUTTON_LT
195#define GAMEPAD_BUTTON_RT 35
196#define GAMEPAD_BUTTON_R2 GAMEPAD_BUTTON_RT
197#define GAMEPAD_BUTTON_RZ GAMEPAD_BUTTON_RT
198#define GAMEPAD_BUTTON_LB 36
199#define GAMEPAD_BUTTON_L1 GAMEPAD_BUTTON_LB
200#define GAMEPAD_BUTTON_L GAMEPAD_BUTTON_LB
201#define GAMEPAD_BUTTON_RB 37
202#define GAMEPAD_BUTTON_R1 GAMEPAD_BUTTON_RB
203#define GAMEPAD_BUTTON_R GAMEPAD_BUTTON_RB
204#define GAMEPAD_BUTTON_Y 38
205#define GAMEPAD_BUTTON_TRIANGLE GAMEPAD_BUTTON_Y
206#define GAMEPAD_BUTTON_B 39
207#define GAMEPAD_BUTTON_CIRCLE GAMEPAD_BUTTON_B
208#define GAMEPAD_BUTTON_A 40
209#define GAMEPAD_BUTTON_CROSS GAMEPAD_BUTTON_A
210#define GAMEPAD_BUTTON_X 41
211#define GAMEPAD_BUTTON_SQUARE GAMEPAD_BUTTON_X
212#define GAMEPAD_BUTTON_SELECT 42
213#define GAMEPAD_BUTTON_BACK GAMEPAD_BUTTON_SELECT
214#define GAMEPAD_BUTTON_SHARE GAMEPAD_BUTTON_SELECT
215#define GAMEPAD_BUTTON_CAPTURE GAMEPAD_BUTTON_SELECT
216#define GAMEPAD_BUTTON_L3 43
217#define GAMEPAD_BUTTON_SL GAMEPAD_BUTTON_L3
218#define GAMEPAD_BUTTON_R3 44
219#define GAMEPAD_BUTTON_SR GAMEPAD_BUTTON_R3
220#define GAMEPAD_BUTTON_START 45
221#define GAMEPAD_BUTTON_OPTIONS GAMEPAD_BUTTON_START
222#define GAMEPAD_BUTTON_UP 46
223#define GAMEPAD_BUTTON_RIGHT 47
224#define GAMEPAD_BUTTON_DOWN 48
225#define GAMEPAD_BUTTON_LEFT 49
226#define GAMEPAD_BUTTON_PLUS 50
227#define GAMEPAD_BUTTON_MINUS 51
228#define GAMEPAD_BUTTON_TOUCHPAD 52
229
230#define JOYSTICK_BUTTON_MAX 52
231
236{
237 int32_t axiscount;
239 int32_t hatcount;
241 int32_t buttoncount;
242 uint32_t buttons;
243 void *parameter;
244};
245
246
256
257
261{
262 int32_t minimum;
263 int32_t maximum;
264};
265
266
276
277
287
288
300
301
304
306typedef uint32_t STDCALL (*joystick_event_cb)(JOYSTICK_DEVICE *joystick, JOYSTICK_DATA *data);
307
309typedef uint32_t STDCALL (*joystick_enumerate_cb)(JOYSTICK_DEVICE *joystick, void *data);
311typedef uint32_t STDCALL (*joystick_notification_cb)(DEVICE *device, void *data, uint32_t notification);
312
315typedef uint32_t STDCALL (*joystick_device_stop_proc)(JOYSTICK_DEVICE *joystick);
316
317typedef uint32_t STDCALL (*joystick_device_peek_proc)(JOYSTICK_DEVICE *joystick);
318typedef uint32_t STDCALL (*joystick_device_read_proc)(JOYSTICK_DEVICE *joystick, void *buffer, uint32_t size, uint32_t flags, uint32_t *count);
319typedef uint32_t STDCALL (*joystick_device_write_proc)(JOYSTICK_DEVICE *joystick, void *buffer, uint32_t size, uint32_t count);
322typedef uint32_t STDCALL (*joystick_device_control_proc)(JOYSTICK_DEVICE *joystick, int request, size_t argument1, size_t *argument2);
323
325
356
357
359
366
373
380
390uint32_t STDCALL joystick_device_read(JOYSTICK_DEVICE *joystick, void *buffer, uint32_t size, uint32_t flags, uint32_t *count);
391
400uint32_t STDCALL joystick_device_write(JOYSTICK_DEVICE *joystick, void *buffer, uint32_t size, uint32_t count);
401
408
416
425uint32_t STDCALL joystick_device_control(JOYSTICK_DEVICE *joystick, int request, size_t argument1, size_t *argument2);
426
434
441uint32_t STDCALL joystick_device_set_state(JOYSTICK_DEVICE *joystick, uint32_t state);
442
448
455
462
469
476
483
490
497
505
515uint32_t STDCALL joystick_device_notification(JOYSTICK_DEVICE *joystick, joystick_notification_cb callback, void *data, uint32_t notification, uint32_t flags);
516
518
524
530
537
544
548uint32_t STDCALL joystick_device_axis_to_string(uint32_t name, char *string, uint32_t len);
549
553uint32_t STDCALL joystick_device_hat_to_string(uint32_t name, char *string, uint32_t len);
554
558uint32_t STDCALL joystick_device_button_to_string(uint32_t name, char *string, uint32_t len);
559
563uint32_t STDCALL joystick_device_type_to_string(uint32_t joysticktype, char *string, uint32_t len);
564
568uint32_t STDCALL joystick_device_state_to_string(uint32_t joystickstate, char *string, uint32_t len);
569
574
581uint32_t STDCALL joystick_device_get_axis(JOYSTICK_DEVICE *joystick, uint32_t index);
582
590uint32_t STDCALL joystick_device_set_axis(JOYSTICK_DEVICE *joystick, uint32_t index, uint32_t name);
591
598uint32_t STDCALL joystick_device_get_hat(JOYSTICK_DEVICE *joystick, uint32_t index);
599
607uint32_t STDCALL joystick_device_set_hat(JOYSTICK_DEVICE *joystick, uint32_t index, uint32_t name);
608
615uint32_t STDCALL joystick_device_get_button(JOYSTICK_DEVICE *joystick, uint32_t index);
616
624uint32_t STDCALL joystick_device_set_button(JOYSTICK_DEVICE *joystick, uint32_t index, uint32_t name);
625
633uint32_t STDCALL joystick_device_set_callback(JOYSTICK_DEVICE *joystick, joystick_event_cb event, void *parameter);
634
644
645#ifdef __cplusplus
646}
647#endif
648
649#endif // _ULTIBO_JOYSTICK_H
struct _DEVICE DEVICE
Definition devices.h:373
#define STDCALL
Definition globaltypes.h:45
_Bool BOOL
Built in Boolean type (1 byte) (Redeclared here for flexibility).
Definition globaltypes.h:55
HANDLE SEMAPHORE_HANDLE
Definition globaltypes.h:107
HANDLE MUTEX_HANDLE
Definition globaltypes.h:105
JOYSTICK_DEVICE *STDCALL joystick_device_find_by_name(const char *name)
Find a Joystick device by name in the device table.
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_peek_proc)(JOYSTICK_DEVICE *joystick)
Definition joystick.h:317
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_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_flush(JOYSTICK_DEVICE *joystick)
Flush the contents of the buffer of the specified joystick device.
uint32_t STDCALL(* joystick_device_stop_proc)(JOYSTICK_DEVICE *joystick)
Definition joystick.h:315
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_DEVICE *STDCALL joystick_device_create_ex(uint32_t size)
Create a new Joystick device entry.
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_enumerate(joystick_enumerate_cb callback, void *data)
Enumerate all Joystick devices in the Joystick device table.
uint32_t STDCALL joystick_device_start(JOYSTICK_DEVICE *joystick)
Start the specified Joystick device ready for receiving events.
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.
struct _JOYSTICK_AXIS JOYSTICK_AXIS
Definition joystick.h:267
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_description(const char *description)
Find a Joystick device by description in the device table.
uint32_t STDCALL(* joystick_notification_cb)(DEVICE *device, void *data, uint32_t notification)
Definition joystick.h:311
uint32_t STDCALL(* joystick_device_update_proc)(JOYSTICK_DEVICE *joystick)
Definition joystick.h:321
uint32_t STDCALL(* joystick_enumerate_cb)(JOYSTICK_DEVICE *joystick, void *data)
Definition joystick.h:309
#define JOYSTICK_MAX_HAT
Definition joystick.h:85
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_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_get_button(JOYSTICK_DEVICE *joystick, uint32_t index)
Get the name (identifier) of a Button on the specified Joystick.
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_DEVICE *STDCALL joystick_device_create(void)
Create a new Joystick device entry.
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_deregister(JOYSTICK_DEVICE *joystick)
Deregister a Joystick device from the Joystick device table.
uint32_t STDCALL joystick_device_get_properties(JOYSTICK_DEVICE *joystick, JOYSTICK_PROPERTIES *properties)
Get the properties for the specified Joystick device.
#define JOYSTICK_MAX_BUTTON
Definition joystick.h:86
#define JOYSTICK_BUFFER_SIZE
Definition joystick.h:81
struct _JOYSTICK_BUFFER JOYSTICK_BUFFER
Definition joystick.h:248
uint32_t STDCALL joystick_device_update(JOYSTICK_DEVICE *joystick)
Request the specified Joystick device to update the current configuration.
JOYSTICK_DEVICE *STDCALL joystick_device_get_default(void)
Get the current default Joystick device.
struct _JOYSTICK_PROPERTIES JOYSTICK_PROPERTIES
Definition joystick.h:289
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_start_proc)(JOYSTICK_DEVICE *joystick)
Definition joystick.h:314
struct _JOYSTICK_DATA JOYSTICK_DATA
Definition joystick.h:234
uint32_t STDCALL(* joystick_event_cb)(JOYSTICK_DEVICE *joystick, JOYSTICK_DATA *data)
Definition joystick.h:306
uint32_t STDCALL joystick_device_set_default(JOYSTICK_DEVICE *joystick)
Set the current default Joystick device.
uint32_t STDCALL joystick_get_count(void)
Get the current Joystick device count.
uint32_t STDCALL(* joystick_device_get_properties_proc)(JOYSTICK_DEVICE *joystick, JOYSTICK_PROPERTIES *properties)
Definition joystick.h:324
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_write(JOYSTICK_DEVICE *joystick, void *buffer, uint32_t size, uint32_t count)
Write joystick data packets to the buffer of the specified joystick device.
#define JOYSTICK_MAX_AXIS
Definition joystick.h:84
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_check(JOYSTICK_DEVICE *joystick)
Check if the supplied Joystick device is in the Joystick device table.
uint32_t STDCALL joystick_insert_data(JOYSTICK_DEVICE *joystick, JOYSTICK_DATA *data, BOOL signal)
Insert a TJoystickData entry into the joystick device buffer.
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_stop(JOYSTICK_DEVICE *joystick)
Stop the specified Joystick device and terminate receiving events.
struct _JOYSTICK_HAT JOYSTICK_HAT
Definition joystick.h:278
uint32_t STDCALL joystick_device_destroy(JOYSTICK_DEVICE *joystick)
Destroy an existing Joystick device entry.
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_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_register(JOYSTICK_DEVICE *joystick)
Register a new Joystick device in the Joystick device table.
uint32_t STDCALL(* joystick_device_flush_proc)(JOYSTICK_DEVICE *joystick)
Definition joystick.h:320
uint32_t STDCALL(* joystick_device_control_proc)(JOYSTICK_DEVICE *joystick, int request, size_t argument1, size_t *argument2)
Definition joystick.h:322
uint32_t STDCALL(* joystick_device_write_proc)(JOYSTICK_DEVICE *joystick, void *buffer, uint32_t size, uint32_t count)
Definition joystick.h:319
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_device_read_proc)(JOYSTICK_DEVICE *joystick, void *buffer, uint32_t size, uint32_t flags, uint32_t *count)
Definition joystick.h:318
struct _JOYSTICK_DEVICE JOYSTICK_DEVICE
Definition joystick.h:303
struct _JOYSTICK_EXTENT JOYSTICK_EXTENT
Definition joystick.h:259
Definition joystick.h:269
uint32_t name
The associated name (identifier) for this Axis.
Definition joystick.h:270
double_t multiplier
The conversion multiplier for this Axis from logical to physical units.
Definition joystick.h:273
JOYSTICK_EXTENT logical
The minimum and maximum logical values for this Axis.
Definition joystick.h:271
double_t resolution
The unit resolution for this Axis in counts per physical unit.
Definition joystick.h:274
JOYSTICK_EXTENT physical
The minimum and maximum physical values for this Axis.
Definition joystick.h:272
Definition joystick.h:250
uint32_t start
Index of first buffer ready.
Definition joystick.h:252
uint32_t count
Number of entries ready in buffer.
Definition joystick.h:253
JOYSTICK_DATA buffer[JOYSTICK_BUFFER_SIZE]
Definition joystick.h:254
SEMAPHORE_HANDLE wait
Buffer ready semaphore.
Definition joystick.h:251
Definition joystick.h:236
int32_t buttoncount
The number of Buttons reported by this device.
Definition joystick.h:241
int32_t hatcount
The number of Hats reported by this device.
Definition joystick.h:239
int32_t axiscount
The number of Axes reported by this device.
Definition joystick.h:237
void * parameter
The parameter for the event callback (If applicable).
Definition joystick.h:243
uint32_t buttons
The currently reported state of each Button.
Definition joystick.h:242
int16_t axes[JOYSTICK_MAX_AXIS]
The currently reported value of each Axis.
Definition joystick.h:238
int16_t hats[JOYSTICK_MAX_HAT]
The currently reported value of each Hat.
Definition joystick.h:240
Definition joystick.h:327
uint32_t joystickstate
Joystick device state (eg JOYSTICK_STATE_ENABLED).
Definition joystick.h:332
MUTEX_HANDLE lock
Device lock.
Definition joystick.h:343
joystick_device_control_proc devicecontrol
A Device specific DeviceControl method implementing a standard Joystick device interface (Or nil if t...
Definition joystick.h:340
joystick_device_update_proc deviceupdate
A Device specific DeviceUpdate method implementing a standard Joystick device interface (Or nil if th...
Definition joystick.h:339
uint32_t receiveerrors
Definition joystick.h:350
joystick_device_read_proc deviceread
A Device specific DeviceRead method implementing a standard Joystick device interface (Or nil if the ...
Definition joystick.h:336
joystick_device_start_proc devicestart
A Device specific DeviceStart method implementing the standard Joystick device interface (Mandatory).
Definition joystick.h:333
DEVICE device
The Device entry for this Joystick device.
Definition joystick.h:329
joystick_event_cb event
Event callback function (If assigned).
Definition joystick.h:344
JOYSTICK_DEVICE * prev
Previous entry in Joystick device table.
Definition joystick.h:353
void * parameter
Parameter for the event callback (or nil).
Definition joystick.h:345
uint32_t receivecount
Definition joystick.h:349
joystick_device_get_properties_proc devicegetproperties
A Device specific DeviceGetProperties method implementing a standard Joystick device interface (Or ni...
Definition joystick.h:341
JOYSTICK_DEVICE * next
Next entry in Joystick device table.
Definition joystick.h:354
joystick_device_peek_proc devicepeek
A Device specific DevicePeek method implementing a standard Joystick device interface (Or nil if the ...
Definition joystick.h:335
joystick_device_stop_proc devicestop
A Device specific DeviceStop method implementing the standard Joystick device interface (Mandatory).
Definition joystick.h:334
uint32_t joystickid
Unique Id of this Joystick device in the Joystick device table.
Definition joystick.h:331
joystick_device_write_proc devicewrite
A Device specific DeviceWrite method implementing a standard Joystick device interface (Or nil if the...
Definition joystick.h:337
JOYSTICK_BUFFER buffer
Joystick input buffer.
Definition joystick.h:346
JOYSTICK_PROPERTIES properties
Device properties.
Definition joystick.h:347
joystick_device_flush_proc deviceflush
A Device specific DeviceFlush method implementing a standard Joystick device interface (Or nil if the...
Definition joystick.h:338
uint32_t bufferoverruns
Definition joystick.h:351
Definition joystick.h:261
int32_t maximum
The maximum value for this extent.
Definition joystick.h:263
int32_t minimum
The minimum value for this extent.
Definition joystick.h:262
Definition joystick.h:280
uint32_t name
The associated name (identifier) for this Hat.
Definition joystick.h:281
double_t multiplier
The conversion multiplier for this Hat from logical to physical units.
Definition joystick.h:284
JOYSTICK_EXTENT logical
The minimum and maximum logical values for this Hat.
Definition joystick.h:282
double_t resolution
The unit resolution for this Hat in counts per physical unit.
Definition joystick.h:285
JOYSTICK_EXTENT physical
The minimum and maximum physical values for this Hat.
Definition joystick.h:283
Definition joystick.h:291
uint32_t axiscount
The number of Axes reported by this device.
Definition joystick.h:293
uint32_t hatcount
The number of Hats reported by this device.
Definition joystick.h:295
uint32_t buttoncount
The number of Buttons reported by this device.
Definition joystick.h:297
JOYSTICK_HAT hats[JOYSTICK_MAX_HAT]
The current properties of each Hat.
Definition joystick.h:296
uint32_t flags
Device flags (eg JOYSTICK_FLAG_LED).
Definition joystick.h:292
uint32_t buttons[JOYSTICK_MAX_BUTTON]
The current name (identifier) of each Button.
Definition joystick.h:298
JOYSTICK_AXIS axes[JOYSTICK_MAX_AXIS]
The current properties of each Axis.
Definition joystick.h:294