Difference between revisions of "Unit Joystick"

From Ultibo.org
Jump to: navigation, search
Line 18: Line 18:
 
----
 
----
  
''To be documented''
+
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Joystick specific constants''' <code> JOYSTICK_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>JOYSTICK_NAME_PREFIX = 'Joystick';</code>
 +
| Name prefix for Joystick Devices
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Joystick device types''' <code> JOYSTICK_TYPE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>JOYSTICK_TYPE_NONE = 0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>JOYSTICK_TYPE_JOYSTICK = 1;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_TYPE_GAMEPAD = 2;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>JOYSTICK_TYPE_MAX = 2;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|''Joystick Type Names''
 +
|-
 +
|colspan="2"|<code>JOYSTICK_TYPE_NAMES:array[JOYSTICK_TYPE_NONE..JOYSTICK_TYPE_MAX] of String = ('JOYSTICK_TYPE_NONE', 'JOYSTICK_TYPE_JOYSTICK', 'JOYSTICK_TYPE_GAMEPAD');</code>
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Joystick device states''' <code> JOYSTICK_TYPE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>JOYSTICK_STATE_DISABLED = 0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>JOYSTICK_STATE_ENABLED = 1;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>JOYSTICK_STATE_MAX = 1;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|''Joystick State Names''
 +
|-
 +
|colspan="2"|<code>JOYSTICK_TYPE_NAMES:array[JOYSTICK_TYPE_NONE..JOYSTICK_TYPE_MAX] of String = ('JOYSTICK_TYPE_NONE', 'JOYSTICK_TYPE_JOYSTICK', 'JOYSTICK_TYPE_GAMEPAD');</code>
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Joystick device flags''' <code> JOYSTICK_FLAG_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>JOYSTICK_FLAG_NONE = $00000000;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_FLAG_NON_BLOCK = $00000001;</code>
 +
| If set device reads are non blocking (Also supported in Flags parameter of JoystickDeviceRead)
 +
|-
 +
| <code>JOYSTICK_FLAG_PEEK_BUFFER = $00000002;</code>
 +
| Peek at the buffer to see if any data is available, don't remove it (Used only in Flags parameter of JoystickDeviceRead)
 +
|-
 +
| <code>JOYSTICK_FLAG_LED = $00000004;</code>
 +
| If set the device contains one or more LEDs
 +
|-
 +
| <code>JOYSTICK_FLAG_RGBLED = $00000008;</code>
 +
| If set the device contains one or more RGB LEDs
 +
|-
 +
| <code>JOYSTICK_FLAG_RUMBLE = $00000010;</code>
 +
| If set the device has rumble or force feedback
 +
|-
 +
| <code>JOYSTICK_FLAG_GYROSCOPE = $00000020;</code>
 +
| If set the device contains a gyroscope
 +
|-
 +
| <code>JOYSTICK_FLAG_TOUCHPAD = $00000040;</code>
 +
| If set the device contains a touchpad
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''Flags supported by JOYSTICK_CONTROL_GET/SET/CLEAR_FLAG''
 +
|-
 +
|colspan="2"|<code>JOYSTICK_FLAG_MASK = JOYSTICK_FLAG_NON_BLOCK or JOYSTICK_FLAG_LED or JOYSTICK_FLAG_RGBLED or JOYSTICK_FLAG_RUMBLE or JOYSTICK_FLAG_GYROSCOPE or JOYSTICK_FLAG_TOUCHPAD;</code>
 +
|-
 +
| <code>NAME</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Joystick device control codes''' <code> JOYSTICK_CONTROL_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>JOYSTICK_CONTROL_GET_FLAG = 1;</code>
 +
| Get Flag
 +
|-
 +
| <code>JOYSTICK_CONTROL_SET_FLAG = 2;</code>
 +
| Set Flag
 +
|-
 +
| <code>JOYSTICK_CONTROL_CLEAR_FLAG = 3;</code>
 +
| Clear Flag
 +
|-
 +
| <code>JOYSTICK_CONTROL_FLUSH_BUFFER = 4;</code>
 +
| Flush Buffer
 +
|-
 +
| <code>JOYSTICK_CONTROL_GET_HAT = 5;</code>
 +
| Get the name (identifier) associated with a Hat
 +
|-
 +
| <code>JOYSTICK_CONTROL_SET_HAT = 6;</code>
 +
| Set the name (identifier) associated with a Hat
 +
|-
 +
| <code>JOYSTICK_CONTROL_GET_AXIS = 7;</code>
 +
| Get the name (identifier) associated with an Axis
 +
|-
 +
| <code>JOYSTICK_CONTROL_SET_AXIS = 8;</code>
 +
| Set the name (identifier) associated with an Axis
 +
|-
 +
| <code>JOYSTICK_CONTROL_GET_BUTTON = 9;</code>
 +
| Get the name (identifier) associated with a Button
 +
|-
 +
| <code>JOYSTICK_CONTROL_SET_BUTTON = 10;</code>
 +
| Set the name (identifier) associated with a Button
 +
|-
 +
| <code>JOYSTICK_CONTROL_GET_CALLBACK = 11;</code>
 +
| Get the registered callback function for joystick events
 +
|-
 +
| <code>JOYSTICK_CONTROL_SET_CALLBACK = 12;</code>
 +
| Set the registered callback function for joystick events
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Joystick buffer size''' <code> JOYSTICK_BUFFER_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>JOYSTICK_BUFFER_SIZE = 2048;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Joystick xxis, hat and button maximum''' <code> JOYSTICK_MAX_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>JOYSTICK_MAX_AXIS = 16;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>JOYSTICK_MAX_HAT = 4;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_MAX_BUTTON = 32;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Joystick default minimum and maximum''' <code> JOYSTICK_DEFAULT_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>JOYSTICK_DEFAULT_MINIMUM = 0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>JOYSTICK_DEFAULT_MAXIMUM = 255;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Joystick and Gamepad axis names''' <code> JOYSTICK_AXIS_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|''Includes Buttons, Sliders, Wheels etc that report an analog value)''
 +
|-
 +
| <code>JOYSTICK_AXIS_NONE = 0;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_AXIS_1 = 1;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_AXIS_2 = 2;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_AXIS_3 = 3;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_AXIS_4 = 4;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_AXIS_5 = 5;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_AXIS_6 = 6;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_AXIS_7 = 7;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_AXIS_8 = 8;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_AXIS_9 = 9;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_AXIS_10 = 10;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_AXIS_11 = 11;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_AXIS_12 = 12;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_AXIS_13 = 13;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_AXIS_14 = 14;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_AXIS_15 = 15;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_AXIS_16 = 16;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>JOYSTICK_AXIS_X = 17;</code>
 +
| X
 +
|-
 +
| <code>JOYSTICK_AXIS_Y = 18;</code>
 +
| Y
 +
|-
 +
| <code>JOYSTICK_AXIS_Z = 19;</code>
 +
| Z
 +
|-
 +
| <code>JOYSTICK_ROTATION_X = 20;</code>
 +
| Rotation X
 +
|-
 +
| <code>JOYSTICK_ROTATION_Y = 21;</code>
 +
| Rotation Y
 +
|-
 +
| <code>JOYSTICK_ROTATION_Z = 22;</code>
 +
| Rotation Z
 +
|-
 +
| <code>JOYSTICK_SLIDER = 23;</code>
 +
| Slider
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>GAMEPAD_AXIS_LEFT_X = 24;</code>
 +
| Left X
 +
|-
 +
| <code>GAMEPAD_AXIS_LEFT_Y = 25;</code>
 +
| Left Y
 +
|-
 +
| <code>GAMEPAD_AXIS_X = GAMEPAD_AXIS_LEFT_X;</code>
 +
| &nbsp;
 +
|-
 +
| <code>GAMEPAD_AXIS_Y = GAMEPAD_AXIS_LEFT_Y;</code>
 +
| &nbsp;
 +
|-
 +
| <code>GAMEPAD_AXIS_RIGHT_X = 26;</code>
 +
| Right X
 +
|-
 +
| <code>GAMEPAD_AXIS_RIGHT_Y = 27;</code>
 +
| Right Y
 +
|-
 +
| <code>GAMEPAD_CONTROL_LT = 28;</code>
 +
| Left Trigger analog button
 +
|-
 +
| <code>GAMEPAD_CONTROL_L2 = GAMEPAD_CONTROL_LT;</code>
 +
| &nbsp;
 +
|-
 +
| <code>GAMEPAD_CONTROL_RT = 29;</code>
 +
| Right Trigger analog button
 +
|-
 +
| <code>GAMEPAD_CONTROL_R2 = GAMEPAD_CONTROL_RT;</code>
 +
| &nbsp;
 +
|-
 +
| <code>GAMEPAD_CONTROL_UP = 30;</code>
 +
| Up analog button
 +
|-
 +
| <code>GAMEPAD_CONTROL_RIGHT = 31;</code>
 +
| Right analog button
 +
|-
 +
| <code>GAMEPAD_CONTROL_DOWN = 32;</code>
 +
| Down analog button
 +
|-
 +
| <code>GAMEPAD_CONTROL_LEFT = 33;</code>
 +
| Left analog button
 +
|-
 +
| <code>GAMEPAD_CONTROL_L1 = 34;</code>
 +
| L1 analog button
 +
|-
 +
| <code>GAMEPAD_CONTROL_R1 = 35;</code>
 +
| R1 analog button
 +
|-
 +
| <code>GAMEPAD_CONTROL_TRIANGLE = 36;</code>
 +
| Triangle analog button
 +
|-
 +
| <code>GAMEPAD_CONTROL_CIRCLE = 37;</code>
 +
| Circle analog button
 +
|-
 +
| <code>GAMEPAD_CONTROL_CROSS = 38;</code>
 +
| Cross analog button
 +
|-
 +
| <code>GAMEPAD_CONTROL_SQUARE = 39;</code>
 +
| Square analog button
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>JOYSTICK_AXIS_MAX = 39;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''Joystick and Gamepad Axis Names''
 +
|-
 +
| <code>JOYSTICK_AXIS_NAMES:array[JOYSTICK_AXIS_NONE..JOYSTICK_AXIS_MAX] of String = (</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_AXIS_NONE',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_AXIS_1',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_AXIS_2',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_AXIS_3',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_AXIS_4',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_AXIS_5',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_AXIS_6',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_AXIS_7',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_AXIS_8',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_AXIS_9',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_AXIS_10',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_AXIS_11',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_AXIS_12',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_AXIS_13',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_AXIS_14',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_AXIS_15',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_AXIS_16',</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>'JOYSTICK_AXIS_X',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_AXIS_Y',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_AXIS_Z',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_ROTATION_X',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_ROTATION_Y',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_ROTATION_Z',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_SLIDER',</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>'GAMEPAD_AXIS_LEFT_X',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'GAMEPAD_AXIS_LEFT_Y',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'GAMEPAD_AXIS_RIGHT_X',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'GAMEPAD_AXIS_RIGHT_Y',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'GAMEPAD_CONTROL_LT',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'GAMEPAD_CONTROL_RT',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'GAMEPAD_CONTROL_UP',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'GAMEPAD_CONTROL_RIGHT',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'GAMEPAD_CONTROL_DOWN',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'GAMEPAD_CONTROL_LEFT',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'GAMEPAD_CONTROL_L1',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'GAMEPAD_CONTROL_R1',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'GAMEPAD_CONTROL_TRIANGLE',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'GAMEPAD_CONTROL_CIRCLE',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'GAMEPAD_CONTROL_CROSS',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'GAMEPAD_CONTROL_SQUARE');</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Joystick and Gamepad hat names''' <code> JOYSTICK_HAT* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>JOYSTICK_HAT_NONE = 0;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_HAT_1 = 1;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_HAT_2 = 2;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_HAT_3 = 3;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_HAT_4 = 4;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>JOYSTICK_HAT_POV = 5;</code>
 +
| Point of View (POV)
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>JOYSTICK_HAT_MAX = 5;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''Joystick and Gamepad Hat Names''
 +
|-
 +
| <code>JOYSTICK_HAT_NAMES:array[JOYSTICK_HAT_NONE..JOYSTICK_HAT_MAX] of String = (</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_HAT_NONE',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_HAT_1',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_HAT_2',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_HAT_3',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_HAT_4',</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>'JOYSTICK_HAT_POV');</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Joystick and Gamepad button names''' <code> JOYSTICK_BUTTON_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>JOYSTICK_BUTTON_NONE = 0;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_BUTTON_1 = 1;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_BUTTON_2 = 2;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_BUTTON_3 = 3;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_BUTTON_4 = 4;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_BUTTON_5 = 5;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_BUTTON_6 = 6;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_BUTTON_7 = 7;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_BUTTON_8 = 8;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_BUTTON_9 = 9;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_BUTTON_10 = 10;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_BUTTON_11 = 11;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_BUTTON_12 = 12;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_BUTTON_13 = 13;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_BUTTON_14 = 14;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_BUTTON_15 = 15;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_BUTTON_16 = 16;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_BUTTON_17 = 17;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_BUTTON_18 = 18;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_BUTTON_19 = 19;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_BUTTON_20 = 20;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_BUTTON_21 = 21;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_BUTTON_22 = 22;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_BUTTON_23 = 23;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_BUTTON_24 = 24;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_BUTTON_25 = 25;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_BUTTON_26 = 26;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_BUTTON_27 = 27;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_BUTTON_28 = 28;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_BUTTON_29 = 29;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_BUTTON_30 = 30;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_BUTTON_31 = 31;</code>
 +
| &nbsp;
 +
|-
 +
| <code>JOYSTICK_BUTTON_32 = 32;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>GAMEPAD_BUTTON_HOME = 33;</code>
 +
| Home or special function button
 +
|-
 +
| <code>GAMEPAD_BUTTON_PS = GAMEPAD_BUTTON_HOME;</code>
 +
| Playstation button
 +
|-
 +
| <code>GAMEPAD_BUTTON_XBOX = GAMEPAD_BUTTON_HOME;</code>
 +
| XBox button
 +
|-
 +
| <code>GAMEPAD_BUTTON_GUIDE = GAMEPAD_BUTTON_HOME;</code>
 +
| Guide button
 +
|-
 +
| <code>GAMEPAD_BUTTON_LT = 34;</code>
 +
| Left Trigger button
 +
|-
 +
| <code>GAMEPAD_BUTTON_L2 = GAMEPAD_BUTTON_LT;</code>
 +
| &nbsp;
 +
|-
 +
| <code>GAMEPAD_BUTTON_LZ = GAMEPAD_BUTTON_LT;</code>
 +
| &nbsp;
 +
|-
 +
| <code>GAMEPAD_BUTTON_RT = 35;</code>
 +
| Right Trigger button
 +
|-
 +
| <code>GAMEPAD_BUTTON_R2 = GAMEPAD_BUTTON_RT;</code>
 +
| &nbsp;
 +
|-
 +
| <code>GAMEPAD_BUTTON_RZ = GAMEPAD_BUTTON_RT;</code>
 +
| &nbsp;
 +
|-
 +
| <code>GAMEPAD_BUTTON_LB = 36;</code>
 +
| Left Bumper button
 +
|-
 +
| <code>GAMEPAD_BUTTON_L1 = GAMEPAD_BUTTON_LB;</code>
 +
| &nbsp;
 +
|-
 +
| <code>GAMEPAD_BUTTON_L = GAMEPAD_BUTTON_LB;</code>
 +
| &nbsp;
 +
|-
 +
| <code>GAMEPAD_BUTTON_RB = 37;</code>
 +
| Right Bumper button
 +
|-
 +
| <code>GAMEPAD_BUTTON_R1 = GAMEPAD_BUTTON_RB;</code>
 +
| &nbsp;
 +
|-
 +
| <code>GAMEPAD_BUTTON_R = GAMEPAD_BUTTON_RB;</code>
 +
| &nbsp;
 +
|-
 +
| <code>GAMEPAD_BUTTON_Y = 38;</code>
 +
| Y button
 +
|-
 +
| <code>GAMEPAD_BUTTON_TRIANGLE = GAMEPAD_BUTTON_Y;</code>
 +
| Triangle button
 +
|-
 +
| <code>GAMEPAD_BUTTON_B = 39;</code>
 +
| B button
 +
|-
 +
| <code>GAMEPAD_BUTTON_CIRCLE = GAMEPAD_BUTTON_B;</code>
 +
| Circle button
 +
|-
 +
| <code>GAMEPAD_BUTTON_A = 40;</code>
 +
| A button
 +
|-
 +
| <code>GAMEPAD_BUTTON_CROSS = GAMEPAD_BUTTON_A;</code>
 +
| Cross button
 +
|-
 +
| <code>GAMEPAD_BUTTON_X = 41;</code>
 +
| X button
 +
|-
 +
| <code>GAMEPAD_BUTTON_SQUARE = GAMEPAD_BUTTON_X;</code>
 +
| Square button
 +
|-
 +
| <code>GAMEPAD_BUTTON_SELECT = 42;</code>
 +
| Select button
 +
|-
 +
| <code>GAMEPAD_BUTTON_BACK = GAMEPAD_BUTTON_SELECT;</code>
 +
| Back button
 +
|-
 +
| <code>GAMEPAD_BUTTON_SHARE = GAMEPAD_BUTTON_SELECT;</code>
 +
| Share button
 +
|-
 +
| <code>GAMEPAD_BUTTON_CAPTURE = GAMEPAD_BUTTON_SELECT;</code>
 +
| Capture button
 +
|-
 +
| <code>GAMEPAD_BUTTON_L3 = 43;</code>
 +
| Left Stick or Left Axis button
 +
|-
 +
| <code>GAMEPAD_BUTTON_SL = GAMEPAD_BUTTON_L3;</code>
 +
| &nbsp;
 +
|-
 +
| <code>GAMEPAD_BUTTON_R3 = 44;</code>
 +
| Right Stick or Right Axis button
 +
|-
 +
| <code>GAMEPAD_BUTTON_SR = GAMEPAD_BUTTON_R3;</code>
 +
| &nbsp;
 +
|-
 +
| <code>GAMEPAD_BUTTON_START = 45;</code>
 +
| Start button
 +
|-
 +
| <code>GAMEPAD_BUTTON_OPTIONS = GAMEPAD_BUTTON_START;</code>
 +
| &nbsp;
 +
|-
 +
| <code>GAMEPAD_BUTTON_UP = 46;</code>
 +
| Up button
 +
|-
 +
| <code>GAMEPAD_BUTTON_RIGHT = 47;</code>
 +
| Right button
 +
|-
 +
| <code>GAMEPAD_BUTTON_DOWN = 48;</code>
 +
| Down button
 +
|-
 +
| <code>GAMEPAD_BUTTON_LEFT = 49;</code>
 +
| Left button
 +
|-
 +
| <code>GAMEPAD_BUTTON_PLUS = 50;</code>
 +
| Plus button
 +
|-
 +
| <code>GAMEPAD_BUTTON_MINUS = 51;</code>
 +
| Minus button
 +
|-
 +
| <code>GAMEPAD_BUTTON_TOUCHPAD = 52;</code>
 +
| Touchpad button
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>JOYSTICK_BUTTON_MAX = 52;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''Joystick and Gamepad Button Names''
 +
|-
 +
| <code>JOYSTICK_BUTTON_NAMES:array[JOYSTICK_BUTTON_NONE..JOYSTICK_BUTTON_MAX] of String = (</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_BUTTON_NONE',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_BUTTON_1',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_BUTTON_2',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_BUTTON_3',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_BUTTON_4',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_BUTTON_5',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_BUTTON_6',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_BUTTON_7',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_BUTTON_8',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_BUTTON_9',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_BUTTON_10',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_BUTTON_11',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_BUTTON_12',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_BUTTON_13',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_BUTTON_14',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_BUTTON_15',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_BUTTON_16',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_BUTTON_17',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_BUTTON_18',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_BUTTON_19',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_BUTTON_20',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_BUTTON_21',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_BUTTON_22',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_BUTTON_23',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_BUTTON_24',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_BUTTON_25',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_BUTTON_26',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_BUTTON_27',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_BUTTON_28',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_BUTTON_29',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_BUTTON_30',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_BUTTON_31',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'JOYSTICK_BUTTON_32',</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>'GAMEPAD_BUTTON_HOME',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'GAMEPAD_BUTTON_LT',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'GAMEPAD_BUTTON_RT',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'GAMEPAD_BUTTON_LB',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'GAMEPAD_BUTTON_RB',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'GAMEPAD_BUTTON_Y',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'GAMEPAD_BUTTON_B',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'GAMEPAD_BUTTON_A',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'GAMEPAD_BUTTON_X',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'GAMEPAD_BUTTON_SELECT',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'GAMEPAD_BUTTON_L3',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'GAMEPAD_BUTTON_R3',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'GAMEPAD_BUTTON_START',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'GAMEPAD_BUTTON_UP',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'GAMEPAD_BUTTON_RIGHT',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'GAMEPAD_BUTTON_DOWN',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'GAMEPAD_BUTTON_LEFT',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'GAMEPAD_BUTTON_PLUS',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'GAMEPAD_BUTTON_MINUS',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'GAMEPAD_BUTTON_TOUCHPAD');</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Joystick logging''' <code> JOYSTICK_LOG_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>JOYSTICK_LOG_LEVEL_DEBUG = LOG_LEVEL_DEBUG;</code>
 +
| Joystick debugging messages
 +
|-
 +
| <code>JOYSTICK_LOG_LEVEL_INFO = LOG_LEVEL_INFO;</code>
 +
| Joystick informational messages, such as a device being attached or detached.
 +
|-
 +
| <code>JOYSTICK_LOG_LEVEL_WARN = LOG_LEVEL_WARN;</code>
 +
| Joystick warning messages
 +
|-
 +
| <code>JOYSTICK_LOG_LEVEL_ERROR = LOG_LEVEL_ERROR;</code>
 +
| Joystick error messages
 +
|-
 +
| <code>JOYSTICK_LOG_LEVEL_NONE = LOG_LEVEL_NONE;</code>
 +
| No Joystick messages
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
=== Type definitions ===
 
=== Type definitions ===

Revision as of 01:54, 18 November 2022

Return to Unit Reference


Description


Ultibo Joystick and Gamepad Interface unit

Gamepads are almost universally used to control game consoles and other gaming platforms as they provide an easy way to interact with many different types of movement in gaming scenarios.

They range from simple devices with a 4 way rocker switch (often known as the D-pad) and a small number of push buttons to elaborate units with multi-axis controls and buttons that cover a whole range of uses.

Joysticks are used for more than just gaming, many modern industrial machines use a joystick as the primary control interface. Even common machines like ride on lawn mowers and earth moving equipment often feature a joystick type of control mechanism.

Devices such as flight simulator yokes will often also appear as a joystick to the system as the available ranges of movement and the reported axes are the same.

Constants



[Expand]
Joystick specific constants JOYSTICK_*


[Expand]
Joystick device types JOYSTICK_TYPE_*


[Expand]
Joystick device states JOYSTICK_TYPE_*


[Expand]
Joystick device flags JOYSTICK_FLAG_*


[Expand]
Joystick device control codes JOYSTICK_CONTROL_*


[Expand]
Joystick buffer size JOYSTICK_BUFFER_*


[Expand]
Joystick xxis, hat and button maximum JOYSTICK_MAX_*


[Expand]
Joystick default minimum and maximum JOYSTICK_DEFAULT_*


[Expand]
Joystick and Gamepad axis names JOYSTICK_AXIS_*


[Expand]
Joystick and Gamepad hat names JOYSTICK_HAT*


[Expand]
Joystick and Gamepad button names JOYSTICK_BUTTON_*


[Expand]
Joystick logging JOYSTICK_LOG_*


Type definitions



Joystick data

[Expand]

PJoystickData = ^TJoystickData;

TJoystickData = record

Joystick buffer

[Expand]

PJoystickBuffer = ^TJoystickBuffer;

TJoystickBuffer = record

Joystick extent

[Expand]

PJoystickExtent = ^TJoystickExtent;

TJoystickExtent = record

Joystick axis

[Expand]

PJoystickAxis = ^TJoystickAxis;

TJoystickAxis = record

Joystick hat

[Expand]

PJoystickHat = ^TJoystickHat;

TJoystickHat = record

Joystick properties

[Expand]

PJoystickProperties = ^TJoystickProperties;

TJoystickProperties = record

Joystick event callback

TJoystickEvent = function(Joystick:PJoystickDevice; Data:PJoystickData):LongWord;

Joystick enumeration callback

TJoystickEnumerate = function(Joystick:PJoystickDevice; Data:Pointer):LongWord;

Joystick notification callback

TJoystickNotification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;

Joystick device start

TJoystickDeviceStart = function(Joystick:PJoystickDevice):LongWord;

Joystick device stop

TJoystickDeviceStop = function(Joystick:PJoystickDevice):LongWord;

Joystick device peek

TJoystickDevicePeek = function(Joystick:PJoystickDevice):LongWord;

Joystick device read

TJoystickDeviceRead = function(Joystick:PJoystickDevice; Buffer:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord;

Joystick device write

TJoystickDeviceWrite = function(Joystick:PJoystickDevice; Buffer:Pointer; Size,Count:LongWord):LongWord;

Joystick device flush

TJoystickDeviceFlush = function(Joystick:PJoystickDevice):LongWord;

Joystick device update

TJoystickDeviceUpdate = function(Joystick:PJoystickDevice):LongWord;

Joystick device control

TJoystickDeviceControl = function(Joystick:PJoystickDevice; Request:Integer; Argument1:PtrUInt; var Argument2:PtrUInt):LongWord;

Joystick device get properties

TJoystickDeviceGetProperties = function(Joystick:PJoystickDevice; Properties:PJoystickProperties):LongWord;

Joystick device

[Expand]

PJoystickDevice = ^TJoystickDevice;

TJoystickDevice = record


Public variables



Joystick logging

JOYSTICK_DEFAULT_LOG_LEVEL:LongWord = JOYSTICK_LOG_LEVEL_DEBUG; Minimum level for Joystick messages. Only messages with level greater than or equal to this will be printed.
JOYSTICK_LOG_ENABLED:Boolean;


Function declarations



Initialization functions

[Expand]
procedure JoystickInit;
Description: Initialize the Joystick unit and Joystick device table


Joystick functions

[Expand]
function JoystickDeviceStart(Joystick:PJoystickDevice):LongWord;
Description: Start the specified Joystick device ready for receiving events


[Expand]
function JoystickDeviceStop(Joystick:PJoystickDevice):LongWord;
Description: Stop the specified Joystick device and terminate receiving events


[Expand]
function JoystickDevicePeek(Joystick:PJoystickDevice):LongWord;
Description: Peek at the buffer of the specified joystick device to see if any data packets are ready


[Expand]
function JoystickDeviceRead(Joystick:PJoystickDevice; Buffer:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord;
Description: Read joystick data packets from the buffer of the specified joystick device


[Expand]
function JoystickDeviceWrite(Joystick:PJoystickDevice; Buffer:Pointer; Size,Count:LongWord):LongWord;
Description: Write joystick data packets to the buffer of the specified joystick device


[Expand]
function JoystickDeviceFlush(Joystick:PJoystickDevice):LongWord;
Description: Flush the contents of the buffer of the specified joystick device


[Expand]
function JoystickDeviceUpdate(Joystick:PJoystickDevice):LongWord;
Description: Request the specified Joystick device to update the current configuration


[Expand]
function JoystickDeviceControl(Joystick:PJoystickDevice; Request:Integer; Argument1:PtrUInt; var Argument2:PtrUInt):LongWord;
Description: Perform a control request on the specified Joystick device


[Expand]
function JoystickDeviceGetProperties(Joystick:PJoystickDevice; Properties:PJoystickProperties):LongWord;
Description: Get the properties for the specified Joystick device


[Expand]
function JoystickDeviceSetState(Joystick:PJoystickDevice; State:LongWord):LongWord;
Description: Set the state of the specified joystick and send a notification


[Expand]
function JoystickDeviceCreate:PJoystickDevice;
Description: Create a new Joystick device entry


[Expand]
function JoystickDeviceCreateEx(Size:LongWord):PJoystickDevice;
Description: Create a new Joystick device entry


[Expand]
function JoystickDeviceDestroy(Joystick:PJoystickDevice):LongWord;
Description: Destroy an existing Joystick device entry


[Expand]
function JoystickDeviceRegister(Joystick:PJoystickDevice):LongWord;
Description: Register a new Joystick device in the Joystick device table


[Expand]
function JoystickDeviceDeregister(Joystick:PJoystickDevice):LongWord;
Description: Deregister a Joystick device from the Joystick device table


[Expand]
function JoystickDeviceFind(JoystickId:LongWord):PJoystickDevice;
Description: Find a Joystick device by ID in the Joystick device table


[Expand]
function JoystickDeviceFindByName(const Name:String):PJoystickDevice; inline;
Description: Find a Joystick device by name in the device table


[Expand]
function JoystickDeviceFindByDescription(const Description:String):PJoystickDevice; inline;
Description: Find a Joystick device by description in the device table


[Expand]
function JoystickDeviceEnumerate(Callback:TJoystickEnumerate; Data:Pointer):LongWord;
Description: Enumerate all Joystick devices in the Joystick device table


[Expand]
function JoystickDeviceNotification(Joystick:PJoystickDevice; Callback:TJoystickNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
Description: Register a notification for Joystick device changes


Joystick helper functions

[Expand]
function JoystickGetCount:LongWord; inline;
Description: Get the current Joystick device count


[Expand]
function JoystickDeviceGetDefault:PJoystickDevice; inline;
Description: Get the current default Joystick device


[Expand]
function JoystickDeviceSetDefault(Joystick:PJoystickDevice):LongWord;
Description: Set the current default Joystick device


[Expand]
function JoystickDeviceCheck(Joystick:PJoystickDevice):PJoystickDevice;
Description: Check if the supplied Joystick device is in the Joystick device table


[Expand]
function JoystickDeviceAxisToString(Name:LongWord):String;
Description: Return a string describing a Joystick or Gamepad Axis (eg JOYSTICK_AXIS_X)


[Expand]
function JoystickDeviceHatToString(Name:LongWord):String;
Description: Return a string describing a Joystick or Gamepad Hat (eg JOYSTICK_HAT_POV)


[Expand]
function JoystickDeviceButtonToString(Name:LongWord):String;
Description: Return a string describing a Joystick or Gamepad Button (eg GAMEPAD_BUTTON_UP)


[Expand]
function JoystickDeviceTypeToString(JoystickType:LongWord):String;
Description: Return a string describing the Joystick device type (eg JOYSTICK_TYPE_JOYSTICK)


[Expand]
function JoystickDeviceStateToString(JoystickState:LongWord):String;
Description: Return a string describing the Joystick device state (eg JOYSTICK_STATE_ENABLED)


[Expand]
function JoystickDeviceStateToNotification(State:LongWord):LongWord;
Description: Convert a Joystick state value into the notification code for device notifications


[Expand]
function JoystickDeviceGetAxis(Joystick:PJoystickDevice; Index:LongWord):LongWord;
Description: Get the name (identifier) of an Axis on the specified Joystick


[Expand]
function JoystickDeviceSetAxis(Joystick:PJoystickDevice; Index,Name:LongWord):LongWord;
Description: Set the name (identifier) of an Axis on the specified Joystick


[Expand]
function JoystickDeviceGetHat(Joystick:PJoystickDevice; Index:LongWord):LongWord;
Description: Get the name (identifier) of a Hat on the specified Joystick


[Expand]
function JoystickDeviceSetHat(Joystick:PJoystickDevice; Index,Name:LongWord):LongWord;
Description: Set the name (identifier) of a Hat on the specified Joystick


[Expand]
function JoystickDeviceGetButton(Joystick:PJoystickDevice; Index:LongWord):LongWord;
Description: Get the name (identifier) of a Button on the specified Joystick


[Expand]
function JoystickDeviceSetButton(Joystick:PJoystickDevice; Index,Name:LongWord):LongWord;
Description: Set the name (identifier) of a Button on the specified Joystick


[Expand]
function JoystickDeviceSetCallback(Joystick:PJoystickDevice; Event:TJoystickEvent; Parameter:Pointer):LongWord;
Description: Set the event callback function for the specified Joystick


[Expand]
function JoystickInsertData(Joystick:PJoystickDevice; Data:PJoystickData; Signal:Boolean):LongWord;
Description: Insert a TJoystickData entry into the joystick device buffer


[Expand]
procedure JoystickLog(Level:LongWord; Joystick:PJoystickDevice; const AText:String);
Description: To be documented


[Expand]
procedure JoystickLogInfo(Joystick:PJoystickDevice; const AText:String);
Description: To be documented


[Expand]
procedure JoystickLogWarn(Joystick:PJoystickDevice; const AText:String);
Description: To be documented


[Expand]
procedure JoystickLogError(Joystick:PJoystickDevice; const AText:String);
Description: To be documented


[Expand]
procedure JoystickLogDebug(Joystick:PJoystickDevice; const AText:String);
Description: To be documented


Return to Unit Reference