All Bundles
Joystick
Handles inputs from joysticks
Operations
New
Open a joystick for use
New(device_index:Int)
Parameters
Name | Type | Description |
---|
device_index | Int | index of the joystick to query |
CurrentPowerLevel
Get the battery level of a joystick as JoystickPowerLevel
method : public : CurrentPowerLevel() ~ JoystickPowerLevel
Return
Type | Description |
---|
JoystickPowerLevel | current battery level as JoystickPowerLevel on success or SDL_JOYSTICK_POWER_UNKNOWN |
Free
Close joystick previously opened
method : public : Free() ~ Nil
FromInstanceID
Get the Joystick associated with an instance id.
function : FromInstanceID(instance_id:Int) ~ Joystick
Parameters
Name | Type | Description |
---|
instance_id | Int | the instance id to get the SDL_Joystick for |
Return
Type | Description |
---|
Joystick | instance_id the instance id to get the SDL_Joystick for |
GetAxisInitialState
Get the initial state of an axis control on a joystick
method : public : GetAxisInitialState(axis:Int, state:IntRef) ~ Bool
Parameters
Name | Type | Description |
---|
axis | Int | the axis to query; the axis indices start at index 0 |
state | IntRef | Upon return, the initial value is supplied here |
Return
Type | Description |
---|
Bool | true if this axis has any initial value, or false if not |
GetDeviceInstanceID
Get the instance ID of a joystick
function : GetDeviceInstanceID(device_index:Int) ~ Int
Parameters
Name | Type | Description |
---|
device_index | Int | the index of the joystick to query (the N'th joystick on the system |
Return
Type | Description |
---|
Int | the instance id of the selected joystick. If called on an invalid index, this function returns zero |
GetDeviceProduct
Get the USB product ID of a joystick, if available
function : GetDeviceProduct(device_index:Int) ~ Int
Parameters
Name | Type | Description |
---|
device_index | Int | the index of the joystick to query (the N'th joystick on the system |
Return
Type | Description |
---|
Int | the USB product ID of the selected joystick. If called on an invalid index, this function returns zero |
GetDeviceProductVersion
Get the product version of a joystick, if available
function : GetDeviceProductVersion(device_index:Int) ~ Int
Parameters
Name | Type | Description |
---|
device_index | Int | the index of the joystick to query (the N'th joystick on the system |
Return
Type | Description |
---|
Int | the product version of the selected joystick. If called on an invalid index, this function returns zero |
GetDeviceType
Get the type of a joystick, if available
method : public : GetDeviceType(device_index:Int) ~ JoystickType
Parameters
Name | Type | Description |
---|
device_index | Int | the index of the joystick to query (the N'th joystick on the system |
Return
Type | Description |
---|
JoystickType | the SDL_JoystickType of the selected joystick. If called on an invalid index |
GetDeviceVendor
Get the USB vendor ID of a joystick, if available
method : public : GetDeviceVendor(device_index:Int) ~ Int
Parameters
Name | Type | Description |
---|
device_index | Int | the index of the joystick to query (the N'th joystick on the system |
Return
Type | Description |
---|
Int | the USB vendor ID of the selected joystick. If called on an invalid index, this function returns zero |
GetName
Get the implementation dependent name of a joystick
method : public : GetName() ~ String
Return
Type | Description |
---|
String | name of the selected joystick. If no name can be found, this function returns NULL, |
GetProduct
Get the USB product ID of an opened joystick, if available
method : public : GetProduct() ~ Int
Return
Type | Description |
---|
Int | the product version of the selected joystick, or 0 if unavailable. |
GetProductVersion
Get the product version of an opened joystick, if available
method : public : GetProductVersion() ~ Int
Return
Type | Description |
---|
Int | the firmware version of the selected joystick, or 0 if unavailable |
GetType
Get the type of an opened joystick
method : public : GetType() ~ JoystickType
Return
Type | Description |
---|
JoystickType | the JoystickType of the selected joystick |
GetVendor
Get the USB vendor ID of an opened joystick, if available
method : public : GetVendor() ~ Int
Return
Type | Description |
---|
Int | the USB vendor ID of the selected joystick, or 0 if unavailable |
IsNull
Determines if the underlying SDL C-struct is NULL
method : public : IsNull() ~ Bool
Return
Type | Description |
---|
Bool | true if NULL, false otherwise |
Number
Count of the number of joysticks attached to the system
function : Number() ~ Int
Return
Type | Description |
---|
Int | number of attached joysticks on success or a negative error code on failure |