Difference between revisions of "Unit Joystick"
(8 intermediate revisions by the same user not shown) | |||
Line 18: | Line 18: | ||
---- | ---- | ||
− | '' | + | |
+ | <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%;"| | ||
+ | |- | ||
+ | | <code>JOYSTICK_TYPE_JOYSTICK = 1;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_TYPE_GAMEPAD = 2;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>JOYSTICK_TYPE_MAX = 2;</code> | ||
+ | | | ||
+ | |- | ||
+ | |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_STATE_* </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%;"| | ||
+ | |- | ||
+ | | <code>JOYSTICK_STATE_ENABLED = 1;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>JOYSTICK_STATE_MAX = 1;</code> | ||
+ | | | ||
+ | |- | ||
+ | |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> | ||
+ | | | ||
+ | |- | ||
+ | | <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"| | ||
+ | |- | ||
+ | |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> | ||
+ | |- | ||
+ | |} | ||
+ | </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%;"| | ||
+ | |- | ||
+ | |} | ||
+ | </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 axis, 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%;"| | ||
+ | |- | ||
+ | | <code>JOYSTICK_MAX_HAT = 4;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_MAX_BUTTON = 32;</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 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%;"| | ||
+ | |- | ||
+ | | <code>JOYSTICK_DEFAULT_MAXIMUM = 255;</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 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> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_AXIS_1 = 1;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_AXIS_2 = 2;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_AXIS_3 = 3;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_AXIS_4 = 4;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_AXIS_5 = 5;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_AXIS_6 = 6;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_AXIS_7 = 7;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_AXIS_8 = 8;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_AXIS_9 = 9;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_AXIS_10 = 10;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_AXIS_11 = 11;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_AXIS_12 = 12;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_AXIS_13 = 13;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_AXIS_14 = 14;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_AXIS_15 = 15;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_AXIS_16 = 16;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <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"| | ||
+ | |- | ||
+ | | <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> | ||
+ | | | ||
+ | |- | ||
+ | | <code>GAMEPAD_AXIS_Y = GAMEPAD_AXIS_LEFT_Y;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <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> | ||
+ | | | ||
+ | |- | ||
+ | | <code>GAMEPAD_CONTROL_RT = 29;</code> | ||
+ | | Right Trigger analog button | ||
+ | |- | ||
+ | | <code>GAMEPAD_CONTROL_R2 = GAMEPAD_CONTROL_RT;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <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"| | ||
+ | |- | ||
+ | | <code>JOYSTICK_AXIS_MAX = 39;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | |colspan="2"|''Joystick and Gamepad Axis Names'' | ||
+ | |- | ||
+ | | <code>JOYSTICK_AXIS_NAMES:array[JOYSTICK_AXIS_NONE..JOYSTICK_AXIS_MAX] of String = (</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_AXIS_NONE',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_AXIS_1',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_AXIS_2',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_AXIS_3',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_AXIS_4',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_AXIS_5',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_AXIS_6',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_AXIS_7',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_AXIS_8',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_AXIS_9',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_AXIS_10',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_AXIS_11',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_AXIS_12',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_AXIS_13',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_AXIS_14',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_AXIS_15',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_AXIS_16',</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>'JOYSTICK_AXIS_X',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_AXIS_Y',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_AXIS_Z',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_ROTATION_X',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_ROTATION_Y',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_ROTATION_Z',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_SLIDER',</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>'GAMEPAD_AXIS_LEFT_X',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'GAMEPAD_AXIS_LEFT_Y',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'GAMEPAD_AXIS_RIGHT_X',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'GAMEPAD_AXIS_RIGHT_Y',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'GAMEPAD_CONTROL_LT',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'GAMEPAD_CONTROL_RT',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'GAMEPAD_CONTROL_UP',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'GAMEPAD_CONTROL_RIGHT',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'GAMEPAD_CONTROL_DOWN',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'GAMEPAD_CONTROL_LEFT',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'GAMEPAD_CONTROL_L1',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'GAMEPAD_CONTROL_R1',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'GAMEPAD_CONTROL_TRIANGLE',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'GAMEPAD_CONTROL_CIRCLE',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'GAMEPAD_CONTROL_CROSS',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'GAMEPAD_CONTROL_SQUARE');</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 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> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_HAT_1 = 1;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_HAT_2 = 2;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_HAT_3 = 3;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_HAT_4 = 4;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>JOYSTICK_HAT_POV = 5;</code> | ||
+ | | Point of View (POV) | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>JOYSTICK_HAT_MAX = 5;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | |colspan="2"|''Joystick and Gamepad Hat Names'' | ||
+ | |- | ||
+ | | <code>JOYSTICK_HAT_NAMES:array[JOYSTICK_HAT_NONE..JOYSTICK_HAT_MAX] of String = (</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_HAT_NONE',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_HAT_1',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_HAT_2',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_HAT_3',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_HAT_4',</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>'JOYSTICK_HAT_POV');</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 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> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_BUTTON_1 = 1;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_BUTTON_2 = 2;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_BUTTON_3 = 3;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_BUTTON_4 = 4;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_BUTTON_5 = 5;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_BUTTON_6 = 6;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_BUTTON_7 = 7;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_BUTTON_8 = 8;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_BUTTON_9 = 9;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_BUTTON_10 = 10;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_BUTTON_11 = 11;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_BUTTON_12 = 12;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_BUTTON_13 = 13;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_BUTTON_14 = 14;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_BUTTON_15 = 15;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_BUTTON_16 = 16;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_BUTTON_17 = 17;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_BUTTON_18 = 18;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_BUTTON_19 = 19;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_BUTTON_20 = 20;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_BUTTON_21 = 21;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_BUTTON_22 = 22;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_BUTTON_23 = 23;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_BUTTON_24 = 24;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_BUTTON_25 = 25;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_BUTTON_26 = 26;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_BUTTON_27 = 27;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_BUTTON_28 = 28;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_BUTTON_29 = 29;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_BUTTON_30 = 30;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_BUTTON_31 = 31;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>JOYSTICK_BUTTON_32 = 32;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <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> | ||
+ | | | ||
+ | |- | ||
+ | | <code>GAMEPAD_BUTTON_LZ = GAMEPAD_BUTTON_LT;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>GAMEPAD_BUTTON_RT = 35;</code> | ||
+ | | Right Trigger button | ||
+ | |- | ||
+ | | <code>GAMEPAD_BUTTON_R2 = GAMEPAD_BUTTON_RT;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>GAMEPAD_BUTTON_RZ = GAMEPAD_BUTTON_RT;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>GAMEPAD_BUTTON_LB = 36;</code> | ||
+ | | Left Bumper button | ||
+ | |- | ||
+ | | <code>GAMEPAD_BUTTON_L1 = GAMEPAD_BUTTON_LB;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>GAMEPAD_BUTTON_L = GAMEPAD_BUTTON_LB;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>GAMEPAD_BUTTON_RB = 37;</code> | ||
+ | | Right Bumper button | ||
+ | |- | ||
+ | | <code>GAMEPAD_BUTTON_R1 = GAMEPAD_BUTTON_RB;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>GAMEPAD_BUTTON_R = GAMEPAD_BUTTON_RB;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <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> | ||
+ | | | ||
+ | |- | ||
+ | | <code>GAMEPAD_BUTTON_R3 = 44;</code> | ||
+ | | Right Stick or Right Axis button | ||
+ | |- | ||
+ | | <code>GAMEPAD_BUTTON_SR = GAMEPAD_BUTTON_R3;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>GAMEPAD_BUTTON_START = 45;</code> | ||
+ | | Start button | ||
+ | |- | ||
+ | | <code>GAMEPAD_BUTTON_OPTIONS = GAMEPAD_BUTTON_START;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <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"| | ||
+ | |- | ||
+ | | <code>JOYSTICK_BUTTON_MAX = 52;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | |colspan="2"|''Joystick and Gamepad Button Names'' | ||
+ | |- | ||
+ | | <code>JOYSTICK_BUTTON_NAMES:array[JOYSTICK_BUTTON_NONE..JOYSTICK_BUTTON_MAX] of String = (</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_BUTTON_NONE',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_BUTTON_1',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_BUTTON_2',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_BUTTON_3',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_BUTTON_4',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_BUTTON_5',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_BUTTON_6',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_BUTTON_7',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_BUTTON_8',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_BUTTON_9',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_BUTTON_10',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_BUTTON_11',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_BUTTON_12',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_BUTTON_13',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_BUTTON_14',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_BUTTON_15',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_BUTTON_16',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_BUTTON_17',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_BUTTON_18',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_BUTTON_19',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_BUTTON_20',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_BUTTON_21',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_BUTTON_22',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_BUTTON_23',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_BUTTON_24',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_BUTTON_25',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_BUTTON_26',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_BUTTON_27',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_BUTTON_28',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_BUTTON_29',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_BUTTON_30',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_BUTTON_31',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'JOYSTICK_BUTTON_32',</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>'GAMEPAD_BUTTON_HOME',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'GAMEPAD_BUTTON_LT',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'GAMEPAD_BUTTON_RT',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'GAMEPAD_BUTTON_LB',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'GAMEPAD_BUTTON_RB',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'GAMEPAD_BUTTON_Y',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'GAMEPAD_BUTTON_B',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'GAMEPAD_BUTTON_A',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'GAMEPAD_BUTTON_X',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'GAMEPAD_BUTTON_SELECT',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'GAMEPAD_BUTTON_L3',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'GAMEPAD_BUTTON_R3',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'GAMEPAD_BUTTON_START',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'GAMEPAD_BUTTON_UP',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'GAMEPAD_BUTTON_RIGHT',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'GAMEPAD_BUTTON_DOWN',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'GAMEPAD_BUTTON_LEFT',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'GAMEPAD_BUTTON_PLUS',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'GAMEPAD_BUTTON_MINUS',</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>'GAMEPAD_BUTTON_TOUCHPAD');</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 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 === | ||
---- | ---- | ||
− | '' | + | |
+ | '''Joystick data''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PJoystickData = ^TJoystickData;</code> | ||
+ | |||
+ | <code>TJoystickData = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>AxisCount:LongInt;</code> | ||
+ | | The number of Axes reported by this device | ||
+ | |- | ||
+ | | <code>Axes:array[0..JOYSTICK_MAX_AXIS - 1] of SmallInt;</code> | ||
+ | | The currently reported value of each Axis | ||
+ | |- | ||
+ | | <code>HatCount:LongInt;</code> | ||
+ | | The number of Hats reported by this device | ||
+ | |- | ||
+ | | <code>Hats:array[0..JOYSTICK_MAX_HAT - 1] of SmallInt;</code> | ||
+ | | The currently reported value of each Hat | ||
+ | |- | ||
+ | | <code>ButtonCount:LongInt;</code> | ||
+ | | The number of Buttons reported by this device | ||
+ | |- | ||
+ | | <code>Buttons:LongWord;</code> | ||
+ | | The currently reported state of each Button | ||
+ | |- | ||
+ | | <code>Parameter:Pointer;</code> | ||
+ | | The parameter for the event callback (If applicable) | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''Joystick buffer''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PJoystickBuffer = ^TJoystickBuffer;</code> | ||
+ | |||
+ | <code>TJoystickBuffer = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>Wait:TSemaphoreHandle;</code> | ||
+ | | Buffer ready semaphore | ||
+ | |- | ||
+ | | <code>Start:LongWord;</code> | ||
+ | | Index of first buffer ready | ||
+ | |- | ||
+ | | <code>Count:LongWord;</code> | ||
+ | | Number of entries ready in buffer | ||
+ | |- | ||
+ | | <code>Buffer:array[0..(JOYSTICK_BUFFER_SIZE - 1)] of TJoystickData;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''Joystick extent''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PJoystickExtent = ^TJoystickExtent;</code> | ||
+ | |||
+ | <code>TJoystickExtent = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>Minimum:LongInt;</code> | ||
+ | | The minimum value for this extent | ||
+ | |- | ||
+ | | <code>Maximum:LongInt;</code> | ||
+ | | The maximum value for this extent | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''Joystick axis''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PJoystickAxis = ^TJoystickAxis;</code> | ||
+ | |||
+ | <code>TJoystickAxis = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>Name:LongWord;</code> | ||
+ | | The associated name (identifier) for this Axis | ||
+ | |- | ||
+ | | <code>Logical:TJoystickExtent;</code> | ||
+ | | The minimum and maximum logical values for this Axis | ||
+ | |- | ||
+ | | <code>Physical:TJoystickExtent;</code> | ||
+ | | The minimum and maximum physical values for this Axis | ||
+ | |- | ||
+ | | <code>Multiplier:Double;</code> | ||
+ | | The conversion multiplier for this Axis from logical to physical units | ||
+ | |- | ||
+ | | <code>Resolution:Double;</code> | ||
+ | | The unit resolution for this Axis in counts per physical unit | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''Joystick hat''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PJoystickHat = ^TJoystickHat;</code> | ||
+ | |||
+ | <code>TJoystickHat = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>Name:LongWord;</code> | ||
+ | | The associated name (identifier) for this Hat | ||
+ | |- | ||
+ | | <code>Logical:TJoystickExtent;</code> | ||
+ | | The minimum and maximum logical values for this Hat | ||
+ | |- | ||
+ | | <code>Physical:TJoystickExtent;</code> | ||
+ | | The minimum and maximum physical values for this Hat | ||
+ | |- | ||
+ | | <code>Multiplier:Double;</code> | ||
+ | | The conversion multiplier for this Hat from logical to physical units | ||
+ | |- | ||
+ | | <code>Resolution:Double;</code> | ||
+ | | The unit resolution for this Hat in counts per physical unit | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''Joystick properties''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PJoystickProperties = ^TJoystickProperties;</code> | ||
+ | |||
+ | <code>TJoystickProperties = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>Flags:LongWord;</code> | ||
+ | | Device flags (eg JOYSTICK_FLAG_LED) | ||
+ | |- | ||
+ | | <code>AxisCount:LongWord;</code> | ||
+ | | The number of Axes reported by this device | ||
+ | |- | ||
+ | | <code>Axes:array[0..JOYSTICK_MAX_AXIS - 1] of TJoystickAxis;</code> | ||
+ | | The current properties of each Axis | ||
+ | |- | ||
+ | | <code>HatCount:LongWord;</code> | ||
+ | | The number of Hats reported by this device | ||
+ | |- | ||
+ | | <code>Hats:array[0..JOYSTICK_MAX_HAT - 1] of TJoystickHat;</code> | ||
+ | | The current properties of each Hat | ||
+ | |- | ||
+ | | <code>ButtonCount:LongWord;</code> | ||
+ | | The number of Buttons reported by this device | ||
+ | |- | ||
+ | | <code>Buttons:array[0..JOYSTICK_MAX_BUTTON - 1] of LongWord;</code> | ||
+ | | The current name (identifier) of each Button | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''Joystick event callback''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TJoystickEvent = function(Joystick:PJoystickDevice; Data:PJoystickData):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''Joystick enumeration callback''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TJoystickEnumerate = function(Joystick:PJoystickDevice; Data:Pointer):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''Joystick notification callback''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TJoystickNotification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''Joystick device start''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TJoystickDeviceStart = function(Joystick:PJoystickDevice):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''Joystick device stop''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TJoystickDeviceStop = function(Joystick:PJoystickDevice):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''Joystick device peek''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TJoystickDevicePeek = function(Joystick:PJoystickDevice):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''Joystick device read''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TJoystickDeviceRead = function(Joystick:PJoystickDevice; Buffer:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''Joystick device write''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TJoystickDeviceWrite = function(Joystick:PJoystickDevice; Buffer:Pointer; Size,Count:LongWord):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''Joystick device flush''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TJoystickDeviceFlush = function(Joystick:PJoystickDevice):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''Joystick device update''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TJoystickDeviceUpdate = function(Joystick:PJoystickDevice):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''Joystick device control''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TJoystickDeviceControl = function(Joystick:PJoystickDevice; Request:Integer; Argument1:PtrUInt; var Argument2:PtrUInt):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''Joystick device get properties''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TJoystickDeviceGetProperties = function(Joystick:PJoystickDevice; Properties:PJoystickProperties):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''Joystick device''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PJoystickDevice = ^TJoystickDevice;</code> | ||
+ | |||
+ | <code>TJoystickDevice = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|''Device Properties'' | ||
+ | |- | ||
+ | | <code>Device:TDevice;</code> | ||
+ | | The Device entry for this Joystick device | ||
+ | |- | ||
+ | |colspan="2"|''Joystick Properties'' | ||
+ | |- | ||
+ | | <code>JoystickId:LongWord;</code> | ||
+ | | Unique Id of this Joystick device in the Joystick device table | ||
+ | |- | ||
+ | | <code>JoystickState:LongWord;</code> | ||
+ | | Joystick device state (eg JOYSTICK_STATE_ENABLED) | ||
+ | |- | ||
+ | | <code>DeviceStart:TJoystickDeviceStart;</code> | ||
+ | | A Device specific DeviceStart method implementing the standard Joystick device interface (Mandatory) | ||
+ | |- | ||
+ | | <code>DeviceStop:TJoystickDeviceStop;</code> | ||
+ | | A Device specific DeviceStop method implementing the standard Joystick device interface (Mandatory) | ||
+ | |- | ||
+ | | <code>DevicePeek:TJoystickDevicePeek;</code> | ||
+ | | A Device specific DevicePeek method implementing a standard Joystick device interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | | <code>DeviceRead:TJoystickDeviceRead;</code> | ||
+ | | A Device specific DeviceRead method implementing a standard Joystick device interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | | <code>DeviceWrite:TJoystickDeviceWrite;</code> | ||
+ | | A Device specific DeviceWrite method implementing a standard Joystick device interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | | <code>DeviceFlush:TJoystickDeviceFlush;</code> | ||
+ | | A Device specific DeviceFlush method implementing a standard Joystick device interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | | <code>DeviceUpdate:TJoystickDeviceUpdate;</code> | ||
+ | | A Device specific DeviceUpdate method implementing a standard Joystick device interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | | <code>DeviceControl:TJoystickDeviceControl;</code> | ||
+ | | A Device specific DeviceControl method implementing a standard Joystick device interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | | <code>DeviceGetProperties:TJoystickDeviceGetProperties;</code> | ||
+ | | A Device specific DeviceGetProperties method implementing a standard Joystick device interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | |colspan="2"|''Driver Properties'' | ||
+ | |- | ||
+ | | <code>Lock:TMutexHandle;</code> | ||
+ | | Device lock | ||
+ | |- | ||
+ | | <code>Event:TJoystickEvent;</code> | ||
+ | | Event callback function (If assigned) | ||
+ | |- | ||
+ | | <code>Parameter:Pointer;</code> | ||
+ | | Parameter for the event callback (or nil) | ||
+ | |- | ||
+ | | <code>Buffer:TJoystickBuffer;</code> | ||
+ | | Joystick input buffer | ||
+ | |- | ||
+ | | <code>Properties:TJoystickProperties;</code> | ||
+ | | Device properties | ||
+ | |- | ||
+ | |colspan="2"|''Statistics Properties'' | ||
+ | |- | ||
+ | | <code>ReceiveCount:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>ReceiveErrors:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>BufferOverruns:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|''Internal Properties'' | ||
+ | |- | ||
+ | | <code>Prev:PJoystickDevice;</code> | ||
+ | | Previous entry in Joystick device table | ||
+ | |- | ||
+ | | <code>Next:PJoystickDevice;</code> | ||
+ | | Next entry in Joystick device table | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
=== Public variables === | === Public variables === | ||
---- | ---- | ||
− | '' | + | |
+ | '''Joystick logging''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>JOYSTICK_DEFAULT_LOG_LEVEL:LongWord = JOYSTICK_LOG_LEVEL_DEBUG;</code> | ||
+ | | style="width: 40%;"|Minimum level for Joystick messages. Only messages with level greater than or equal to this will be printed. | ||
+ | |- | ||
+ | |} | ||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>JOYSTICK_LOG_ENABLED:Boolean;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | <br /> | ||
=== Function declarations === | === Function declarations === | ||
---- | ---- | ||
− | |||
+ | '''Initialization functions''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">procedure JoystickInit;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Initialize the Joystick unit and Joystick device table</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | Called only during system startup | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | |||
+ | '''Joystick functions''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function JoystickDeviceStart(Joystick:PJoystickDevice):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Start the specified Joystick device ready for receiving events</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Joystick | ||
+ | | The Joystick device to start | ||
+ | |- | ||
+ | ! Return | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function JoystickDeviceStop(Joystick:PJoystickDevice):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Stop the specified Joystick device and terminate receiving events</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Joystick | ||
+ | | The Joystick device to stop | ||
+ | |- | ||
+ | ! Return | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function JoystickDevicePeek(Joystick:PJoystickDevice):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Peek at the buffer of the specified joystick device to see if any data packets are ready</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Joystick | ||
+ | | The Joystick device to peek at | ||
+ | |- | ||
+ | ! Return | ||
+ | | ERROR_SUCCESS if packets are ready, ERROR_NO_MORE_ITEMS if not or another error code on failure. | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function JoystickDeviceRead(Joystick:PJoystickDevice; Buffer:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Read joystick data packets from the buffer of the specified joystick device</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Joystick | ||
+ | | The Joystick device to read from | ||
+ | |- | ||
+ | ! Buffer | ||
+ | | Pointer to a buffer to copy the joystick data packets to | ||
+ | |- | ||
+ | ! Size | ||
+ | | The size of the buffer in bytes (Must be at least TJoystickData or greater) | ||
+ | |- | ||
+ | ! Flags | ||
+ | | The flags for the behaviour of the read (eg JOYSTICK_FLAG_NON_BLOCK) | ||
+ | |- | ||
+ | ! Count | ||
+ | | The number of joystick data packets copied to the buffer | ||
+ | |- | ||
+ | ! Return | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function JoystickDeviceWrite(Joystick:PJoystickDevice; Buffer:Pointer; Size,Count:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Write joystick data packets to the buffer of the specified joystick device</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Joystick | ||
+ | | The Joystick device to write to | ||
+ | |- | ||
+ | ! Buffer | ||
+ | | Pointer to a buffer to copy the joystick data packets from | ||
+ | |- | ||
+ | ! Size | ||
+ | | The size of the buffer in bytes (Must be at least TJoystickData or greater) | ||
+ | |- | ||
+ | ! Count | ||
+ | | The number of joystick data packets to copy from the buffer | ||
+ | |- | ||
+ | ! Return | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function JoystickDeviceFlush(Joystick:PJoystickDevice):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Flush the contents of the buffer of the specified joystick device</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Joystick | ||
+ | | The Joystick device to flush | ||
+ | |- | ||
+ | ! Return | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function JoystickDeviceUpdate(Joystick:PJoystickDevice):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Request the specified Joystick device to update the current configuration</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Joystick | ||
+ | | The Joystick device to update | ||
+ | |- | ||
+ | ! Return | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | ! Note | ||
+ | | Items updated can include rotation, maximum X and Y and flags (If supported) | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function JoystickDeviceControl(Joystick:PJoystickDevice; Request:Integer; Argument1:PtrUInt; var Argument2:PtrUInt):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Perform a control request on the specified Joystick device</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Joystick | ||
+ | | The Joystick device to control | ||
+ | |- | ||
+ | ! Request | ||
+ | | The request code for the operation (eg JOYSTICK_CONTROL_GET_FLAG) | ||
+ | |- | ||
+ | ! Argument1 | ||
+ | | The first argument for the operation (Dependent on request code) | ||
+ | |- | ||
+ | ! Argument2 | ||
+ | | The second argument for the operation (Dependent on request code) | ||
+ | |- | ||
+ | ! Return | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function JoystickDeviceGetProperties(Joystick:PJoystickDevice; Properties:PJoystickProperties):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the properties for the specified Joystick device</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Joystick | ||
+ | | The Joystick device to get properties from | ||
+ | |- | ||
+ | ! Properties | ||
+ | | Pointer to a TJoystickProperties structure to fill in | ||
+ | |- | ||
+ | ! Return | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function JoystickDeviceSetState(Joystick:PJoystickDevice; State:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the state of the specified joystick and send a notification</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Joystick | ||
+ | | The joystick to set the state for | ||
+ | |- | ||
+ | ! State | ||
+ | | The new state to set and notify | ||
+ | |- | ||
+ | ! Return | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function JoystickDeviceCreate:PJoystickDevice;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Create a new Joystick device entry</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Return | ||
+ | | Pointer to new Joystick device entry or nil if Joystick device could not be created | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function JoystickDeviceCreateEx(Size:LongWord):PJoystickDevice;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Create a new Joystick device entry</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Size | ||
+ | | Size in bytes to allocate for new Joystick device (Including the Joystick device entry) | ||
+ | |- | ||
+ | ! Return | ||
+ | | Pointer to new Joystick device entry or nil if Joystick device could not be created | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function JoystickDeviceDestroy(Joystick:PJoystickDevice):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Destroy an existing Joystick device entry</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Joystick | ||
+ | | The Joystick device to destroy | ||
+ | |- | ||
+ | ! Return | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function JoystickDeviceRegister(Joystick:PJoystickDevice):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Register a new Joystick device in the Joystick device table</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Joystick | ||
+ | | The Joystick device to register | ||
+ | |- | ||
+ | ! Return | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function JoystickDeviceDeregister(Joystick:PJoystickDevice):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Deregister a Joystick device from the Joystick device table</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Joystick | ||
+ | | The Joystick device to deregister | ||
+ | |- | ||
+ | ! Return | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function JoystickDeviceFind(JoystickId:LongWord):PJoystickDevice;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find a Joystick device by ID in the Joystick device table</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! JoystickId | ||
+ | | The ID number of the Joystick device to find | ||
+ | |- | ||
+ | ! Return | ||
+ | | Pointer to Joystick device entry or nil if not found | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function JoystickDeviceFindByName(const Name:String):PJoystickDevice; inline;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find a Joystick device by name in the device table</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Name | ||
+ | | The name of the Joystick device to find (eg Joystick0) | ||
+ | |- | ||
+ | ! Return | ||
+ | | Pointer to Joystick device entry or nil if not found | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function JoystickDeviceFindByDescription(const Description:String):PJoystickDevice; inline;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find a Joystick device by description in the device table</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Description | ||
+ | | The description of the Joystick to find (eg USB Gamepad) | ||
+ | |- | ||
+ | ! Return | ||
+ | | Pointer to Joystick device entry or nil if not found | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function JoystickDeviceEnumerate(Callback:TJoystickEnumerate; Data:Pointer):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Enumerate all Joystick devices in the Joystick device table</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Callback | ||
+ | | The callback function to call for each Joystick device in the table | ||
+ | |- | ||
+ | ! Data | ||
+ | | A private data pointer to pass to callback for each Joystick device in the table | ||
+ | |- | ||
+ | ! Return | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function JoystickDeviceNotification(Joystick:PJoystickDevice; Callback:TJoystickNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Register a notification for Joystick device changes</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Joystick | ||
+ | | The Joystick device to notify changes for (Optional, pass nil for all Joystick devices) | ||
+ | |- | ||
+ | ! Callback | ||
+ | | The function to call when a notification event occurs | ||
+ | |- | ||
+ | ! Data | ||
+ | | A private data pointer to pass to callback when a notification event occurs | ||
+ | |- | ||
+ | ! Notification | ||
+ | | The events to register for notification of (eg DEVICE_NOTIFICATION_REGISTER) | ||
+ | |- | ||
+ | ! Flags | ||
+ | | The flags to control the notification (eg NOTIFIER_FLAG_WORKER) | ||
+ | |- | ||
+ | ! Return | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | |||
+ | '''Joystick helper functions''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function JoystickGetCount:LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current Joystick device count</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Return | ||
+ | | The number of Joystick devices | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function JoystickDeviceGetDefault:PJoystickDevice;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current default Joystick device</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Return | ||
+ | | Pointer to default Joystick device entry | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function JoystickDeviceSetDefault(Joystick:PJoystickDevice):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the current default Joystick device</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Joystick | ||
+ | | The Joystick device to set as default | ||
+ | |- | ||
+ | ! Return | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function JoystickDeviceCheck(Joystick:PJoystickDevice):PJoystickDevice;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check if the supplied Joystick device is in the Joystick device table</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Joystick | ||
+ | | The Joystick device to check | ||
+ | |- | ||
+ | ! Return | ||
+ | | Pointer to Joystick device entry or nil if not found | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function JoystickDeviceAxisToString(Name:LongWord):String;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return a string describing a Joystick or Gamepad Axis (eg JOYSTICK_AXIS_X)</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function JoystickDeviceHatToString(Name:LongWord):String;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return a string describing a Joystick or Gamepad Hat (eg JOYSTICK_HAT_POV)</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function JoystickDeviceButtonToString(Name:LongWord):String;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return a string describing a Joystick or Gamepad Button (eg GAMEPAD_BUTTON_UP)</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function JoystickDeviceTypeToString(JoystickType:LongWord):String;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return a string describing the Joystick device type (eg JOYSTICK_TYPE_JOYSTICK)</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function JoystickDeviceStateToString(JoystickState:LongWord):String;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return a string describing the Joystick device state (eg JOYSTICK_STATE_ENABLED)</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function JoystickDeviceStateToNotification(State:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Convert a Joystick state value into the notification code for device notifications</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function JoystickDeviceGetAxis(Joystick:PJoystickDevice; Index:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the name (identifier) of an Axis on the specified Joystick</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Joystick | ||
+ | | The Joystick device to get the name from | ||
+ | |- | ||
+ | ! Index | ||
+ | | The index of the Axis in the Joystick properties (First Axis is 0) | ||
+ | |- | ||
+ | ! Return | ||
+ | | The current name of the Axis (eg GAMEPAD_AXIS_LEFT_X) | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function JoystickDeviceSetAxis(Joystick:PJoystickDevice; Index,Name:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the name (identifier) of an Axis on the specified Joystick</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Joystick | ||
+ | | The Joystick device to set the name for | ||
+ | |- | ||
+ | ! Index | ||
+ | | The index of the Axis in the Joystick properties (First Axis is 0) | ||
+ | |- | ||
+ | ! Name | ||
+ | | The name (identifier) to set for the Axis (eg JOYSTICK_AXIS_X) | ||
+ | |- | ||
+ | ! Return | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function JoystickDeviceGetHat(Joystick:PJoystickDevice; Index:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the name (identifier) of a Hat on the specified Joystick</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Joystick | ||
+ | | The Joystick device to get the name from | ||
+ | |- | ||
+ | ! Index | ||
+ | | The index of the Hat in the Joystick properties (First Hat is 0) | ||
+ | |- | ||
+ | ! Return | ||
+ | | The current name of the Hat (eg GAMEPAD_HAT_POV) | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function JoystickDeviceSetHat(Joystick:PJoystickDevice; Index,Name:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the name (identifier) of a Hat on the specified Joystick</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Joystick | ||
+ | | The Joystick device to set the name for | ||
+ | |- | ||
+ | ! Index | ||
+ | | The index of the Hat in the Joystick properties (First Hat is 0) | ||
+ | |- | ||
+ | ! Name | ||
+ | | The name (identifier) to set for the Hat (eg JOYSTICK_HAT_POV) | ||
+ | |- | ||
+ | ! Return | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function JoystickDeviceGetButton(Joystick:PJoystickDevice; Index:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the name (identifier) of a Button on the specified Joystick</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Joystick | ||
+ | | The Joystick device to get the name from | ||
+ | |- | ||
+ | ! Index | ||
+ | | The index of the Button in the Joystick properties (First Button is 0) | ||
+ | |- | ||
+ | ! Return | ||
+ | | The current name of the Button (eg GAMEPAD_BUTTON_B) | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function JoystickDeviceSetButton(Joystick:PJoystickDevice; Index,Name:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the name (identifier) of a Button on the specified Joystick</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Joystick | ||
+ | | The Joystick device to set the name for | ||
+ | |- | ||
+ | ! Index | ||
+ | | The index of the Button in the Joystick properties (First Button is 0) | ||
+ | |- | ||
+ | ! Name | ||
+ | | The name (identifier) to set for the Button (eg GAMEPAD_BUTTON_LT) | ||
+ | |- | ||
+ | ! Return | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function JoystickDeviceSetCallback(Joystick:PJoystickDevice; Event:TJoystickEvent; Parameter:Pointer):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the event callback function for the specified Joystick</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Joystick | ||
+ | | The Joystick device to set the event callback for | ||
+ | |- | ||
+ | ! Event | ||
+ | | The event callback function to be called when Joystick data is received | ||
+ | |- | ||
+ | ! Parameter | ||
+ | | A pointer to private data to be passed to the callback with each event | ||
+ | |- | ||
+ | ! Return | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function JoystickInsertData(Joystick:PJoystickDevice; Data:PJoystickData; Signal:Boolean):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Insert a TJoystickData entry into the joystick device buffer</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Joystick | ||
+ | | The joystick device to insert data for | ||
+ | |- | ||
+ | ! Data | ||
+ | | The TJoystickData entry to insert | ||
+ | |- | ||
+ | ! Signal | ||
+ | | If True then signal that new data is available in the buffer | ||
+ | |- | ||
+ | ! Return | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | ! Note | ||
+ | | Caller must hold the joystick device lock | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">procedure JoystickLog(Level:LongWord; Joystick:PJoystickDevice; const AText:String);</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">procedure JoystickLogInfo(Joystick:PJoystickDevice; const AText:String); inline;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">procedure JoystickLogWarn(Joystick:PJoystickDevice; const AText:String); inline;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">procedure JoystickLogError(Joystick:PJoystickDevice; const AText:String); inline;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">procedure JoystickLogDebug(Joystick:PJoystickDevice; const AText:String); inline;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
Return to [[Unit_Reference|Unit Reference]] | Return to [[Unit_Reference|Unit Reference]] |
Latest revision as of 03:46, 15 December 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
JOYSTICK_*
JOYSTICK_NAME_PREFIX = 'Joystick';
|
Name prefix for Joystick Devices |
JOYSTICK_TYPE_*
JOYSTICK_TYPE_NONE = 0;
|
|
JOYSTICK_TYPE_JOYSTICK = 1;
|
|
JOYSTICK_TYPE_GAMEPAD = 2;
|
|
JOYSTICK_TYPE_MAX = 2;
|
|
Joystick Type Names | |
JOYSTICK_TYPE_NAMES:array[JOYSTICK_TYPE_NONE..JOYSTICK_TYPE_MAX] of String = ('JOYSTICK_TYPE_NONE', 'JOYSTICK_TYPE_JOYSTICK', 'JOYSTICK_TYPE_GAMEPAD');
|
JOYSTICK_STATE_*
JOYSTICK_STATE_DISABLED = 0;
|
|
JOYSTICK_STATE_ENABLED = 1;
|
|
JOYSTICK_STATE_MAX = 1;
|
|
Joystick State Names | |
JOYSTICK_TYPE_NAMES:array[JOYSTICK_TYPE_NONE..JOYSTICK_TYPE_MAX] of String = ('JOYSTICK_TYPE_NONE', 'JOYSTICK_TYPE_JOYSTICK', 'JOYSTICK_TYPE_GAMEPAD');
|
JOYSTICK_FLAG_*
JOYSTICK_FLAG_NONE = $00000000;
|
|
JOYSTICK_FLAG_NON_BLOCK = $00000001;
|
If set device reads are non blocking (Also supported in Flags parameter of JoystickDeviceRead) |
JOYSTICK_FLAG_PEEK_BUFFER = $00000002;
|
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 = $00000004;
|
If set the device contains one or more LEDs |
JOYSTICK_FLAG_RGBLED = $00000008;
|
If set the device contains one or more RGB LEDs |
JOYSTICK_FLAG_RUMBLE = $00000010;
|
If set the device has rumble or force feedback |
JOYSTICK_FLAG_GYROSCOPE = $00000020;
|
If set the device contains a gyroscope |
JOYSTICK_FLAG_TOUCHPAD = $00000040;
|
If set the device contains a touchpad |
Flags supported by JOYSTICK_CONTROL_GET/SET/CLEAR_FLAG | |
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;
|
JOYSTICK_CONTROL_*
JOYSTICK_CONTROL_GET_FLAG = 1;
|
Get Flag |
JOYSTICK_CONTROL_SET_FLAG = 2;
|
Set Flag |
JOYSTICK_CONTROL_CLEAR_FLAG = 3;
|
Clear Flag |
JOYSTICK_CONTROL_FLUSH_BUFFER = 4;
|
Flush Buffer |
JOYSTICK_CONTROL_GET_HAT = 5;
|
Get the name (identifier) associated with a Hat |
JOYSTICK_CONTROL_SET_HAT = 6;
|
Set the name (identifier) associated with a Hat |
JOYSTICK_CONTROL_GET_AXIS = 7;
|
Get the name (identifier) associated with an Axis |
JOYSTICK_CONTROL_SET_AXIS = 8;
|
Set the name (identifier) associated with an Axis |
JOYSTICK_CONTROL_GET_BUTTON = 9;
|
Get the name (identifier) associated with a Button |
JOYSTICK_CONTROL_SET_BUTTON = 10;
|
Set the name (identifier) associated with a Button |
JOYSTICK_CONTROL_GET_CALLBACK = 11;
|
Get the registered callback function for joystick events |
JOYSTICK_CONTROL_SET_CALLBACK = 12;
|
Set the registered callback function for joystick events |
JOYSTICK_BUFFER_*
JOYSTICK_BUFFER_SIZE = 2048;
|
JOYSTICK_MAX_*
JOYSTICK_MAX_AXIS = 16;
|
|
JOYSTICK_MAX_HAT = 4;
|
|
JOYSTICK_MAX_BUTTON = 32;
|
JOYSTICK_DEFAULT_*
JOYSTICK_DEFAULT_MINIMUM = 0;
|
|
JOYSTICK_DEFAULT_MAXIMUM = 255;
|
JOYSTICK_AXIS_*
Includes Buttons, Sliders, Wheels etc that report an analog value) | |
JOYSTICK_AXIS_NONE = 0;
|
|
JOYSTICK_AXIS_1 = 1;
|
|
JOYSTICK_AXIS_2 = 2;
|
|
JOYSTICK_AXIS_3 = 3;
|
|
JOYSTICK_AXIS_4 = 4;
|
|
JOYSTICK_AXIS_5 = 5;
|
|
JOYSTICK_AXIS_6 = 6;
|
|
JOYSTICK_AXIS_7 = 7;
|
|
JOYSTICK_AXIS_8 = 8;
|
|
JOYSTICK_AXIS_9 = 9;
|
|
JOYSTICK_AXIS_10 = 10;
|
|
JOYSTICK_AXIS_11 = 11;
|
|
JOYSTICK_AXIS_12 = 12;
|
|
JOYSTICK_AXIS_13 = 13;
|
|
JOYSTICK_AXIS_14 = 14;
|
|
JOYSTICK_AXIS_15 = 15;
|
|
JOYSTICK_AXIS_16 = 16;
|
|
JOYSTICK_AXIS_X = 17;
|
X |
JOYSTICK_AXIS_Y = 18;
|
Y |
JOYSTICK_AXIS_Z = 19;
|
Z |
JOYSTICK_ROTATION_X = 20;
|
Rotation X |
JOYSTICK_ROTATION_Y = 21;
|
Rotation Y |
JOYSTICK_ROTATION_Z = 22;
|
Rotation Z |
JOYSTICK_SLIDER = 23;
|
Slider |
GAMEPAD_AXIS_LEFT_X = 24;
|
Left X |
GAMEPAD_AXIS_LEFT_Y = 25;
|
Left Y |
GAMEPAD_AXIS_X = GAMEPAD_AXIS_LEFT_X;
|
|
GAMEPAD_AXIS_Y = GAMEPAD_AXIS_LEFT_Y;
|
|
GAMEPAD_AXIS_RIGHT_X = 26;
|
Right X |
GAMEPAD_AXIS_RIGHT_Y = 27;
|
Right Y |
GAMEPAD_CONTROL_LT = 28;
|
Left Trigger analog button |
GAMEPAD_CONTROL_L2 = GAMEPAD_CONTROL_LT;
|
|
GAMEPAD_CONTROL_RT = 29;
|
Right Trigger analog button |
GAMEPAD_CONTROL_R2 = GAMEPAD_CONTROL_RT;
|
|
GAMEPAD_CONTROL_UP = 30;
|
Up analog button |
GAMEPAD_CONTROL_RIGHT = 31;
|
Right analog button |
GAMEPAD_CONTROL_DOWN = 32;
|
Down analog button |
GAMEPAD_CONTROL_LEFT = 33;
|
Left analog button |
GAMEPAD_CONTROL_L1 = 34;
|
L1 analog button |
GAMEPAD_CONTROL_R1 = 35;
|
R1 analog button |
GAMEPAD_CONTROL_TRIANGLE = 36;
|
Triangle analog button |
GAMEPAD_CONTROL_CIRCLE = 37;
|
Circle analog button |
GAMEPAD_CONTROL_CROSS = 38;
|
Cross analog button |
GAMEPAD_CONTROL_SQUARE = 39;
|
Square analog button |
JOYSTICK_AXIS_MAX = 39;
|
|
Joystick and Gamepad Axis Names | |
JOYSTICK_AXIS_NAMES:array[JOYSTICK_AXIS_NONE..JOYSTICK_AXIS_MAX] of String = (
|
|
'JOYSTICK_AXIS_NONE',
|
|
'JOYSTICK_AXIS_1',
|
|
'JOYSTICK_AXIS_2',
|
|
'JOYSTICK_AXIS_3',
|
|
'JOYSTICK_AXIS_4',
|
|
'JOYSTICK_AXIS_5',
|
|
'JOYSTICK_AXIS_6',
|
|
'JOYSTICK_AXIS_7',
|
|
'JOYSTICK_AXIS_8',
|
|
'JOYSTICK_AXIS_9',
|
|
'JOYSTICK_AXIS_10',
|
|
'JOYSTICK_AXIS_11',
|
|
'JOYSTICK_AXIS_12',
|
|
'JOYSTICK_AXIS_13',
|
|
'JOYSTICK_AXIS_14',
|
|
'JOYSTICK_AXIS_15',
|
|
'JOYSTICK_AXIS_16',
|
|
'JOYSTICK_AXIS_X',
|
|
'JOYSTICK_AXIS_Y',
|
|
'JOYSTICK_AXIS_Z',
|
|
'JOYSTICK_ROTATION_X',
|
|
'JOYSTICK_ROTATION_Y',
|
|
'JOYSTICK_ROTATION_Z',
|
|
'JOYSTICK_SLIDER',
|
|
'GAMEPAD_AXIS_LEFT_X',
|
|
'GAMEPAD_AXIS_LEFT_Y',
|
|
'GAMEPAD_AXIS_RIGHT_X',
|
|
'GAMEPAD_AXIS_RIGHT_Y',
|
|
'GAMEPAD_CONTROL_LT',
|
|
'GAMEPAD_CONTROL_RT',
|
|
'GAMEPAD_CONTROL_UP',
|
|
'GAMEPAD_CONTROL_RIGHT',
|
|
'GAMEPAD_CONTROL_DOWN',
|
|
'GAMEPAD_CONTROL_LEFT',
|
|
'GAMEPAD_CONTROL_L1',
|
|
'GAMEPAD_CONTROL_R1',
|
|
'GAMEPAD_CONTROL_TRIANGLE',
|
|
'GAMEPAD_CONTROL_CIRCLE',
|
|
'GAMEPAD_CONTROL_CROSS',
|
|
'GAMEPAD_CONTROL_SQUARE');
|
JOYSTICK_HAT*
JOYSTICK_HAT_NONE = 0;
|
|
JOYSTICK_HAT_1 = 1;
|
|
JOYSTICK_HAT_2 = 2;
|
|
JOYSTICK_HAT_3 = 3;
|
|
JOYSTICK_HAT_4 = 4;
|
|
JOYSTICK_HAT_POV = 5;
|
Point of View (POV) |
JOYSTICK_HAT_MAX = 5;
|
|
Joystick and Gamepad Hat Names | |
JOYSTICK_HAT_NAMES:array[JOYSTICK_HAT_NONE..JOYSTICK_HAT_MAX] of String = (
|
|
'JOYSTICK_HAT_NONE',
|
|
'JOYSTICK_HAT_1',
|
|
'JOYSTICK_HAT_2',
|
|
'JOYSTICK_HAT_3',
|
|
'JOYSTICK_HAT_4',
|
|
'JOYSTICK_HAT_POV');
|
JOYSTICK_BUTTON_*
JOYSTICK_BUTTON_NONE = 0;
|
|
JOYSTICK_BUTTON_1 = 1;
|
|
JOYSTICK_BUTTON_2 = 2;
|
|
JOYSTICK_BUTTON_3 = 3;
|
|
JOYSTICK_BUTTON_4 = 4;
|
|
JOYSTICK_BUTTON_5 = 5;
|
|
JOYSTICK_BUTTON_6 = 6;
|
|
JOYSTICK_BUTTON_7 = 7;
|
|
JOYSTICK_BUTTON_8 = 8;
|
|
JOYSTICK_BUTTON_9 = 9;
|
|
JOYSTICK_BUTTON_10 = 10;
|
|
JOYSTICK_BUTTON_11 = 11;
|
|
JOYSTICK_BUTTON_12 = 12;
|
|
JOYSTICK_BUTTON_13 = 13;
|
|
JOYSTICK_BUTTON_14 = 14;
|
|
JOYSTICK_BUTTON_15 = 15;
|
|
JOYSTICK_BUTTON_16 = 16;
|
|
JOYSTICK_BUTTON_17 = 17;
|
|
JOYSTICK_BUTTON_18 = 18;
|
|
JOYSTICK_BUTTON_19 = 19;
|
|
JOYSTICK_BUTTON_20 = 20;
|
|
JOYSTICK_BUTTON_21 = 21;
|
|
JOYSTICK_BUTTON_22 = 22;
|
|
JOYSTICK_BUTTON_23 = 23;
|
|
JOYSTICK_BUTTON_24 = 24;
|
|
JOYSTICK_BUTTON_25 = 25;
|
|
JOYSTICK_BUTTON_26 = 26;
|
|
JOYSTICK_BUTTON_27 = 27;
|
|
JOYSTICK_BUTTON_28 = 28;
|
|
JOYSTICK_BUTTON_29 = 29;
|
|
JOYSTICK_BUTTON_30 = 30;
|
|
JOYSTICK_BUTTON_31 = 31;
|
|
JOYSTICK_BUTTON_32 = 32;
|
|
GAMEPAD_BUTTON_HOME = 33;
|
Home or special function button |
GAMEPAD_BUTTON_PS = GAMEPAD_BUTTON_HOME;
|
Playstation button |
GAMEPAD_BUTTON_XBOX = GAMEPAD_BUTTON_HOME;
|
XBox button |
GAMEPAD_BUTTON_GUIDE = GAMEPAD_BUTTON_HOME;
|
Guide button |
GAMEPAD_BUTTON_LT = 34;
|
Left Trigger button |
GAMEPAD_BUTTON_L2 = GAMEPAD_BUTTON_LT;
|
|
GAMEPAD_BUTTON_LZ = GAMEPAD_BUTTON_LT;
|
|
GAMEPAD_BUTTON_RT = 35;
|
Right Trigger button |
GAMEPAD_BUTTON_R2 = GAMEPAD_BUTTON_RT;
|
|
GAMEPAD_BUTTON_RZ = GAMEPAD_BUTTON_RT;
|
|
GAMEPAD_BUTTON_LB = 36;
|
Left Bumper button |
GAMEPAD_BUTTON_L1 = GAMEPAD_BUTTON_LB;
|
|
GAMEPAD_BUTTON_L = GAMEPAD_BUTTON_LB;
|
|
GAMEPAD_BUTTON_RB = 37;
|
Right Bumper button |
GAMEPAD_BUTTON_R1 = GAMEPAD_BUTTON_RB;
|
|
GAMEPAD_BUTTON_R = GAMEPAD_BUTTON_RB;
|
|
GAMEPAD_BUTTON_Y = 38;
|
Y button |
GAMEPAD_BUTTON_TRIANGLE = GAMEPAD_BUTTON_Y;
|
Triangle button |
GAMEPAD_BUTTON_B = 39;
|
B button |
GAMEPAD_BUTTON_CIRCLE = GAMEPAD_BUTTON_B;
|
Circle button |
GAMEPAD_BUTTON_A = 40;
|
A button |
GAMEPAD_BUTTON_CROSS = GAMEPAD_BUTTON_A;
|
Cross button |
GAMEPAD_BUTTON_X = 41;
|
X button |
GAMEPAD_BUTTON_SQUARE = GAMEPAD_BUTTON_X;
|
Square button |
GAMEPAD_BUTTON_SELECT = 42;
|
Select button |
GAMEPAD_BUTTON_BACK = GAMEPAD_BUTTON_SELECT;
|
Back button |
GAMEPAD_BUTTON_SHARE = GAMEPAD_BUTTON_SELECT;
|
Share button |
GAMEPAD_BUTTON_CAPTURE = GAMEPAD_BUTTON_SELECT;
|
Capture button |
GAMEPAD_BUTTON_L3 = 43;
|
Left Stick or Left Axis button |
GAMEPAD_BUTTON_SL = GAMEPAD_BUTTON_L3;
|
|
GAMEPAD_BUTTON_R3 = 44;
|
Right Stick or Right Axis button |
GAMEPAD_BUTTON_SR = GAMEPAD_BUTTON_R3;
|
|
GAMEPAD_BUTTON_START = 45;
|
Start button |
GAMEPAD_BUTTON_OPTIONS = GAMEPAD_BUTTON_START;
|
|
GAMEPAD_BUTTON_UP = 46;
|
Up button |
GAMEPAD_BUTTON_RIGHT = 47;
|
Right button |
GAMEPAD_BUTTON_DOWN = 48;
|
Down button |
GAMEPAD_BUTTON_LEFT = 49;
|
Left button |
GAMEPAD_BUTTON_PLUS = 50;
|
Plus button |
GAMEPAD_BUTTON_MINUS = 51;
|
Minus button |
GAMEPAD_BUTTON_TOUCHPAD = 52;
|
Touchpad button |
JOYSTICK_BUTTON_MAX = 52;
|
|
Joystick and Gamepad Button Names | |
JOYSTICK_BUTTON_NAMES:array[JOYSTICK_BUTTON_NONE..JOYSTICK_BUTTON_MAX] of String = (
|
|
'JOYSTICK_BUTTON_NONE',
|
|
'JOYSTICK_BUTTON_1',
|
|
'JOYSTICK_BUTTON_2',
|
|
'JOYSTICK_BUTTON_3',
|
|
'JOYSTICK_BUTTON_4',
|
|
'JOYSTICK_BUTTON_5',
|
|
'JOYSTICK_BUTTON_6',
|
|
'JOYSTICK_BUTTON_7',
|
|
'JOYSTICK_BUTTON_8',
|
|
'JOYSTICK_BUTTON_9',
|
|
'JOYSTICK_BUTTON_10',
|
|
'JOYSTICK_BUTTON_11',
|
|
'JOYSTICK_BUTTON_12',
|
|
'JOYSTICK_BUTTON_13',
|
|
'JOYSTICK_BUTTON_14',
|
|
'JOYSTICK_BUTTON_15',
|
|
'JOYSTICK_BUTTON_16',
|
|
'JOYSTICK_BUTTON_17',
|
|
'JOYSTICK_BUTTON_18',
|
|
'JOYSTICK_BUTTON_19',
|
|
'JOYSTICK_BUTTON_20',
|
|
'JOYSTICK_BUTTON_21',
|
|
'JOYSTICK_BUTTON_22',
|
|
'JOYSTICK_BUTTON_23',
|
|
'JOYSTICK_BUTTON_24',
|
|
'JOYSTICK_BUTTON_25',
|
|
'JOYSTICK_BUTTON_26',
|
|
'JOYSTICK_BUTTON_27',
|
|
'JOYSTICK_BUTTON_28',
|
|
'JOYSTICK_BUTTON_29',
|
|
'JOYSTICK_BUTTON_30',
|
|
'JOYSTICK_BUTTON_31',
|
|
'JOYSTICK_BUTTON_32',
|
|
'GAMEPAD_BUTTON_HOME',
|
|
'GAMEPAD_BUTTON_LT',
|
|
'GAMEPAD_BUTTON_RT',
|
|
'GAMEPAD_BUTTON_LB',
|
|
'GAMEPAD_BUTTON_RB',
|
|
'GAMEPAD_BUTTON_Y',
|
|
'GAMEPAD_BUTTON_B',
|
|
'GAMEPAD_BUTTON_A',
|
|
'GAMEPAD_BUTTON_X',
|
|
'GAMEPAD_BUTTON_SELECT',
|
|
'GAMEPAD_BUTTON_L3',
|
|
'GAMEPAD_BUTTON_R3',
|
|
'GAMEPAD_BUTTON_START',
|
|
'GAMEPAD_BUTTON_UP',
|
|
'GAMEPAD_BUTTON_RIGHT',
|
|
'GAMEPAD_BUTTON_DOWN',
|
|
'GAMEPAD_BUTTON_LEFT',
|
|
'GAMEPAD_BUTTON_PLUS',
|
|
'GAMEPAD_BUTTON_MINUS',
|
|
'GAMEPAD_BUTTON_TOUCHPAD');
|
JOYSTICK_LOG_*
JOYSTICK_LOG_LEVEL_DEBUG = LOG_LEVEL_DEBUG;
|
Joystick debugging messages |
JOYSTICK_LOG_LEVEL_INFO = LOG_LEVEL_INFO;
|
Joystick informational messages, such as a device being attached or detached. |
JOYSTICK_LOG_LEVEL_WARN = LOG_LEVEL_WARN;
|
Joystick warning messages |
JOYSTICK_LOG_LEVEL_ERROR = LOG_LEVEL_ERROR;
|
Joystick error messages |
JOYSTICK_LOG_LEVEL_NONE = LOG_LEVEL_NONE;
|
No Joystick messages |
Type definitions
Joystick data
PJoystickData = ^TJoystickData;
TJoystickData = record
AxisCount:LongInt;
|
The number of Axes reported by this device |
Axes:array[0..JOYSTICK_MAX_AXIS - 1] of SmallInt;
|
The currently reported value of each Axis |
HatCount:LongInt;
|
The number of Hats reported by this device |
Hats:array[0..JOYSTICK_MAX_HAT - 1] of SmallInt;
|
The currently reported value of each Hat |
ButtonCount:LongInt;
|
The number of Buttons reported by this device |
Buttons:LongWord;
|
The currently reported state of each Button |
Parameter:Pointer;
|
The parameter for the event callback (If applicable) |
Joystick buffer
PJoystickBuffer = ^TJoystickBuffer;
TJoystickBuffer = record
Wait:TSemaphoreHandle;
|
Buffer ready semaphore |
Start:LongWord;
|
Index of first buffer ready |
Count:LongWord;
|
Number of entries ready in buffer |
Buffer:array[0..(JOYSTICK_BUFFER_SIZE - 1)] of TJoystickData;
|
Joystick extent
PJoystickExtent = ^TJoystickExtent;
TJoystickExtent = record
Minimum:LongInt;
|
The minimum value for this extent |
Maximum:LongInt;
|
The maximum value for this extent |
Joystick axis
PJoystickAxis = ^TJoystickAxis;
TJoystickAxis = record
Name:LongWord;
|
The associated name (identifier) for this Axis |
Logical:TJoystickExtent;
|
The minimum and maximum logical values for this Axis |
Physical:TJoystickExtent;
|
The minimum and maximum physical values for this Axis |
Multiplier:Double;
|
The conversion multiplier for this Axis from logical to physical units |
Resolution:Double;
|
The unit resolution for this Axis in counts per physical unit |
Joystick hat
PJoystickHat = ^TJoystickHat;
TJoystickHat = record
Name:LongWord;
|
The associated name (identifier) for this Hat |
Logical:TJoystickExtent;
|
The minimum and maximum logical values for this Hat |
Physical:TJoystickExtent;
|
The minimum and maximum physical values for this Hat |
Multiplier:Double;
|
The conversion multiplier for this Hat from logical to physical units |
Resolution:Double;
|
The unit resolution for this Hat in counts per physical unit |
Joystick properties
PJoystickProperties = ^TJoystickProperties;
TJoystickProperties = record
Flags:LongWord;
|
Device flags (eg JOYSTICK_FLAG_LED) |
AxisCount:LongWord;
|
The number of Axes reported by this device |
Axes:array[0..JOYSTICK_MAX_AXIS - 1] of TJoystickAxis;
|
The current properties of each Axis |
HatCount:LongWord;
|
The number of Hats reported by this device |
Hats:array[0..JOYSTICK_MAX_HAT - 1] of TJoystickHat;
|
The current properties of each Hat |
ButtonCount:LongWord;
|
The number of Buttons reported by this device |
Buttons:array[0..JOYSTICK_MAX_BUTTON - 1] of LongWord;
|
The current name (identifier) of each Button |
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
PJoystickDevice = ^TJoystickDevice;
TJoystickDevice = record
Device Properties | |
Device:TDevice;
|
The Device entry for this Joystick device |
Joystick Properties | |
JoystickId:LongWord;
|
Unique Id of this Joystick device in the Joystick device table |
JoystickState:LongWord;
|
Joystick device state (eg JOYSTICK_STATE_ENABLED) |
DeviceStart:TJoystickDeviceStart;
|
A Device specific DeviceStart method implementing the standard Joystick device interface (Mandatory) |
DeviceStop:TJoystickDeviceStop;
|
A Device specific DeviceStop method implementing the standard Joystick device interface (Mandatory) |
DevicePeek:TJoystickDevicePeek;
|
A Device specific DevicePeek method implementing a standard Joystick device interface (Or nil if the default method is suitable) |
DeviceRead:TJoystickDeviceRead;
|
A Device specific DeviceRead method implementing a standard Joystick device interface (Or nil if the default method is suitable) |
DeviceWrite:TJoystickDeviceWrite;
|
A Device specific DeviceWrite method implementing a standard Joystick device interface (Or nil if the default method is suitable) |
DeviceFlush:TJoystickDeviceFlush;
|
A Device specific DeviceFlush method implementing a standard Joystick device interface (Or nil if the default method is suitable) |
DeviceUpdate:TJoystickDeviceUpdate;
|
A Device specific DeviceUpdate method implementing a standard Joystick device interface (Or nil if the default method is suitable) |
DeviceControl:TJoystickDeviceControl;
|
A Device specific DeviceControl method implementing a standard Joystick device interface (Or nil if the default method is suitable) |
DeviceGetProperties:TJoystickDeviceGetProperties;
|
A Device specific DeviceGetProperties method implementing a standard Joystick device interface (Or nil if the default method is suitable) |
Driver Properties | |
Lock:TMutexHandle;
|
Device lock |
Event:TJoystickEvent;
|
Event callback function (If assigned) |
Parameter:Pointer;
|
Parameter for the event callback (or nil) |
Buffer:TJoystickBuffer;
|
Joystick input buffer |
Properties:TJoystickProperties;
|
Device properties |
Statistics Properties | |
ReceiveCount:LongWord;
|
|
ReceiveErrors:LongWord;
|
|
BufferOverruns:LongWord;
|
|
Internal Properties | |
Prev:PJoystickDevice;
|
Previous entry in Joystick device table |
Next:PJoystickDevice;
|
Next entry in Joystick device table |
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
procedure JoystickInit;
Note | Called only during system startup |
---|
Joystick functions
function JoystickDeviceStart(Joystick:PJoystickDevice):LongWord;
Joystick | The Joystick device to start |
---|---|
Return | ERROR_SUCCESS if completed or another error code on failure |
function JoystickDeviceStop(Joystick:PJoystickDevice):LongWord;
Joystick | The Joystick device to stop |
---|---|
Return | ERROR_SUCCESS if completed or another error code on failure |
function JoystickDevicePeek(Joystick:PJoystickDevice):LongWord;
Joystick | The Joystick device to peek at |
---|---|
Return | ERROR_SUCCESS if packets are ready, ERROR_NO_MORE_ITEMS if not or another error code on failure. |
function JoystickDeviceRead(Joystick:PJoystickDevice; Buffer:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord;
Joystick | The Joystick device to read from |
---|---|
Buffer | Pointer to a buffer to copy the joystick data packets to |
Size | The size of the buffer in bytes (Must be at least TJoystickData or greater) |
Flags | The flags for the behaviour of the read (eg JOYSTICK_FLAG_NON_BLOCK) |
Count | The number of joystick data packets copied to the buffer |
Return | ERROR_SUCCESS if completed or another error code on failure |
function JoystickDeviceWrite(Joystick:PJoystickDevice; Buffer:Pointer; Size,Count:LongWord):LongWord;
Joystick | The Joystick device to write to |
---|---|
Buffer | Pointer to a buffer to copy the joystick data packets from |
Size | The size of the buffer in bytes (Must be at least TJoystickData or greater) |
Count | The number of joystick data packets to copy from the buffer |
Return | ERROR_SUCCESS if completed or another error code on failure |
function JoystickDeviceFlush(Joystick:PJoystickDevice):LongWord;
Joystick | The Joystick device to flush |
---|---|
Return | ERROR_SUCCESS if completed or another error code on failure |
function JoystickDeviceUpdate(Joystick:PJoystickDevice):LongWord;
Joystick | The Joystick device to update |
---|---|
Return | ERROR_SUCCESS if completed or another error code on failure |
Note | Items updated can include rotation, maximum X and Y and flags (If supported) |
function JoystickDeviceControl(Joystick:PJoystickDevice; Request:Integer; Argument1:PtrUInt; var Argument2:PtrUInt):LongWord;
Joystick | The Joystick device to control |
---|---|
Request | The request code for the operation (eg JOYSTICK_CONTROL_GET_FLAG) |
Argument1 | The first argument for the operation (Dependent on request code) |
Argument2 | The second argument for the operation (Dependent on request code) |
Return | ERROR_SUCCESS if completed or another error code on failure |
function JoystickDeviceGetProperties(Joystick:PJoystickDevice; Properties:PJoystickProperties):LongWord;
Joystick | The Joystick device to get properties from |
---|---|
Properties | Pointer to a TJoystickProperties structure to fill in |
Return | ERROR_SUCCESS if completed or another error code on failure |
function JoystickDeviceSetState(Joystick:PJoystickDevice; State:LongWord):LongWord;
Joystick | The joystick to set the state for |
---|---|
State | The new state to set and notify |
Return | ERROR_SUCCESS if completed or another error code on failure |
function JoystickDeviceCreate:PJoystickDevice;
Return | Pointer to new Joystick device entry or nil if Joystick device could not be created |
---|
function JoystickDeviceCreateEx(Size:LongWord):PJoystickDevice;
Size | Size in bytes to allocate for new Joystick device (Including the Joystick device entry) |
---|---|
Return | Pointer to new Joystick device entry or nil if Joystick device could not be created |
function JoystickDeviceDestroy(Joystick:PJoystickDevice):LongWord;
Joystick | The Joystick device to destroy |
---|---|
Return | ERROR_SUCCESS if completed or another error code on failure |
function JoystickDeviceRegister(Joystick:PJoystickDevice):LongWord;
Joystick | The Joystick device to register |
---|---|
Return | ERROR_SUCCESS if completed or another error code on failure |
function JoystickDeviceDeregister(Joystick:PJoystickDevice):LongWord;
Joystick | The Joystick device to deregister |
---|---|
Return | ERROR_SUCCESS if completed or another error code on failure |
function JoystickDeviceFind(JoystickId:LongWord):PJoystickDevice;
JoystickId | The ID number of the Joystick device to find |
---|---|
Return | Pointer to Joystick device entry or nil if not found |
function JoystickDeviceFindByName(const Name:String):PJoystickDevice; inline;
Name | The name of the Joystick device to find (eg Joystick0) |
---|---|
Return | Pointer to Joystick device entry or nil if not found |
function JoystickDeviceFindByDescription(const Description:String):PJoystickDevice; inline;
Description | The description of the Joystick to find (eg USB Gamepad) |
---|---|
Return | Pointer to Joystick device entry or nil if not found |
function JoystickDeviceEnumerate(Callback:TJoystickEnumerate; Data:Pointer):LongWord;
Callback | The callback function to call for each Joystick device in the table |
---|---|
Data | A private data pointer to pass to callback for each Joystick device in the table |
Return | ERROR_SUCCESS if completed or another error code on failure |
function JoystickDeviceNotification(Joystick:PJoystickDevice; Callback:TJoystickNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
Joystick | The Joystick device to notify changes for (Optional, pass nil for all Joystick devices) |
---|---|
Callback | The function to call when a notification event occurs |
Data | A private data pointer to pass to callback when a notification event occurs |
Notification | The events to register for notification of (eg DEVICE_NOTIFICATION_REGISTER) |
Flags | The flags to control the notification (eg NOTIFIER_FLAG_WORKER) |
Return | ERROR_SUCCESS if completed or another error code on failure |
Joystick helper functions
function JoystickGetCount:LongWord;
Return | The number of Joystick devices |
---|
function JoystickDeviceGetDefault:PJoystickDevice;
Return | Pointer to default Joystick device entry |
---|
function JoystickDeviceSetDefault(Joystick:PJoystickDevice):LongWord;
Joystick | The Joystick device to set as default |
---|---|
Return | ERROR_SUCCESS if completed or another error code on failure |
function JoystickDeviceCheck(Joystick:PJoystickDevice):PJoystickDevice;
Joystick | The Joystick device to check |
---|---|
Return | Pointer to Joystick device entry or nil if not found |
function JoystickDeviceAxisToString(Name:LongWord):String;
Note | None documented |
---|
function JoystickDeviceHatToString(Name:LongWord):String;
Note | None documented |
---|
function JoystickDeviceButtonToString(Name:LongWord):String;
Note | None documented |
---|
function JoystickDeviceTypeToString(JoystickType:LongWord):String;
Note | None documented |
---|
function JoystickDeviceStateToString(JoystickState:LongWord):String;
Note | None documented |
---|
function JoystickDeviceStateToNotification(State:LongWord):LongWord;
Note | None documented |
---|
function JoystickDeviceGetAxis(Joystick:PJoystickDevice; Index:LongWord):LongWord;
Joystick | The Joystick device to get the name from |
---|---|
Index | The index of the Axis in the Joystick properties (First Axis is 0) |
Return | The current name of the Axis (eg GAMEPAD_AXIS_LEFT_X) |
function JoystickDeviceSetAxis(Joystick:PJoystickDevice; Index,Name:LongWord):LongWord;
Joystick | The Joystick device to set the name for |
---|---|
Index | The index of the Axis in the Joystick properties (First Axis is 0) |
Name | The name (identifier) to set for the Axis (eg JOYSTICK_AXIS_X) |
Return | ERROR_SUCCESS if completed or another error code on failure |
function JoystickDeviceGetHat(Joystick:PJoystickDevice; Index:LongWord):LongWord;
Joystick | The Joystick device to get the name from |
---|---|
Index | The index of the Hat in the Joystick properties (First Hat is 0) |
Return | The current name of the Hat (eg GAMEPAD_HAT_POV) |
function JoystickDeviceSetHat(Joystick:PJoystickDevice; Index,Name:LongWord):LongWord;
Joystick | The Joystick device to set the name for |
---|---|
Index | The index of the Hat in the Joystick properties (First Hat is 0) |
Name | The name (identifier) to set for the Hat (eg JOYSTICK_HAT_POV) |
Return | ERROR_SUCCESS if completed or another error code on failure |
function JoystickDeviceGetButton(Joystick:PJoystickDevice; Index:LongWord):LongWord;
Joystick | The Joystick device to get the name from |
---|---|
Index | The index of the Button in the Joystick properties (First Button is 0) |
Return | The current name of the Button (eg GAMEPAD_BUTTON_B) |
function JoystickDeviceSetButton(Joystick:PJoystickDevice; Index,Name:LongWord):LongWord;
Joystick | The Joystick device to set the name for |
---|---|
Index | The index of the Button in the Joystick properties (First Button is 0) |
Name | The name (identifier) to set for the Button (eg GAMEPAD_BUTTON_LT) |
Return | ERROR_SUCCESS if completed or another error code on failure |
function JoystickDeviceSetCallback(Joystick:PJoystickDevice; Event:TJoystickEvent; Parameter:Pointer):LongWord;
Joystick | The Joystick device to set the event callback for |
---|---|
Event | The event callback function to be called when Joystick data is received |
Parameter | A pointer to private data to be passed to the callback with each event |
Return | ERROR_SUCCESS if completed or another error code on failure |
function JoystickInsertData(Joystick:PJoystickDevice; Data:PJoystickData; Signal:Boolean):LongWord;
Joystick | The joystick device to insert data for |
---|---|
Data | The TJoystickData entry to insert |
Signal | If True then signal that new data is available in the buffer |
Return | ERROR_SUCCESS if completed or another error code on failure |
Note | Caller must hold the joystick device lock |
procedure JoystickLog(Level:LongWord; Joystick:PJoystickDevice; const AText:String);
Note | None documented |
---|
procedure JoystickLogInfo(Joystick:PJoystickDevice; const AText:String); inline;
Note | None documented |
---|
procedure JoystickLogWarn(Joystick:PJoystickDevice; const AText:String); inline;
Note | None documented |
---|
procedure JoystickLogError(Joystick:PJoystickDevice; const AText:String); inline;
Note | None documented |
---|
procedure JoystickLogDebug(Joystick:PJoystickDevice; const AText:String); inline;
Note | None documented |
---|
Return to Unit Reference