| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
SDL3.Sys.Bindgen.Joystick.Unsafe
Synopsis
- sDL_LockJoysticks :: IO ()
- sDL_UnlockJoysticks :: IO ()
- sDL_HasJoystick :: IO CBool
- sDL_GetJoysticks :: Ptr CInt -> IO (Ptr SDL_JoystickID)
- sDL_GetJoystickNameForID :: SDL_JoystickID -> IO (PtrConst CChar)
- sDL_GetJoystickPathForID :: SDL_JoystickID -> IO (PtrConst CChar)
- sDL_GetJoystickPlayerIndexForID :: SDL_JoystickID -> IO CInt
- sDL_GetJoystickGUIDForID :: SDL_JoystickID -> IO SDL_GUID
- sDL_GetJoystickVendorForID :: SDL_JoystickID -> IO Uint16
- sDL_GetJoystickProductForID :: SDL_JoystickID -> IO Uint16
- sDL_GetJoystickProductVersionForID :: SDL_JoystickID -> IO Uint16
- sDL_GetJoystickTypeForID :: SDL_JoystickID -> IO SDL_JoystickType
- sDL_OpenJoystick :: SDL_JoystickID -> IO (Ptr SDL_Joystick)
- sDL_GetJoystickFromID :: SDL_JoystickID -> IO (Ptr SDL_Joystick)
- sDL_GetJoystickFromPlayerIndex :: CInt -> IO (Ptr SDL_Joystick)
- sDL_AttachVirtualJoystick :: PtrConst SDL_VirtualJoystickDesc -> IO SDL_JoystickID
- sDL_DetachVirtualJoystick :: SDL_JoystickID -> IO CBool
- sDL_IsJoystickVirtual :: SDL_JoystickID -> IO CBool
- sDL_SetJoystickVirtualAxis :: Ptr SDL_Joystick -> CInt -> Sint16 -> IO CBool
- sDL_SetJoystickVirtualBall :: Ptr SDL_Joystick -> CInt -> Sint16 -> Sint16 -> IO CBool
- sDL_SetJoystickVirtualButton :: Ptr SDL_Joystick -> CInt -> CBool -> IO CBool
- sDL_SetJoystickVirtualHat :: Ptr SDL_Joystick -> CInt -> Uint8 -> IO CBool
- sDL_SetJoystickVirtualTouchpad :: Ptr SDL_Joystick -> CInt -> CInt -> CBool -> CFloat -> CFloat -> CFloat -> IO CBool
- sDL_SendJoystickVirtualSensorData :: Ptr SDL_Joystick -> SDL_SensorType -> Uint64 -> PtrConst CFloat -> CInt -> IO CBool
- sDL_GetJoystickProperties :: Ptr SDL_Joystick -> IO SDL_PropertiesID
- sDL_GetJoystickName :: Ptr SDL_Joystick -> IO (PtrConst CChar)
- sDL_GetJoystickPath :: Ptr SDL_Joystick -> IO (PtrConst CChar)
- sDL_GetJoystickPlayerIndex :: Ptr SDL_Joystick -> IO CInt
- sDL_SetJoystickPlayerIndex :: Ptr SDL_Joystick -> CInt -> IO CBool
- sDL_GetJoystickGUID :: Ptr SDL_Joystick -> IO SDL_GUID
- sDL_GetJoystickVendor :: Ptr SDL_Joystick -> IO Uint16
- sDL_GetJoystickProduct :: Ptr SDL_Joystick -> IO Uint16
- sDL_GetJoystickProductVersion :: Ptr SDL_Joystick -> IO Uint16
- sDL_GetJoystickFirmwareVersion :: Ptr SDL_Joystick -> IO Uint16
- sDL_GetJoystickSerial :: Ptr SDL_Joystick -> IO (PtrConst CChar)
- sDL_GetJoystickType :: Ptr SDL_Joystick -> IO SDL_JoystickType
- sDL_GetJoystickGUIDInfo :: SDL_GUID -> Ptr Uint16 -> Ptr Uint16 -> Ptr Uint16 -> Ptr Uint16 -> IO ()
- sDL_JoystickConnected :: Ptr SDL_Joystick -> IO CBool
- sDL_GetJoystickID :: Ptr SDL_Joystick -> IO SDL_JoystickID
- sDL_GetNumJoystickAxes :: Ptr SDL_Joystick -> IO CInt
- sDL_GetNumJoystickBalls :: Ptr SDL_Joystick -> IO CInt
- sDL_GetNumJoystickHats :: Ptr SDL_Joystick -> IO CInt
- sDL_GetNumJoystickButtons :: Ptr SDL_Joystick -> IO CInt
- sDL_SetJoystickEventsEnabled :: CBool -> IO ()
- sDL_JoystickEventsEnabled :: IO CBool
- sDL_UpdateJoysticks :: IO ()
- sDL_GetJoystickAxis :: Ptr SDL_Joystick -> CInt -> IO Sint16
- sDL_GetJoystickAxisInitialState :: Ptr SDL_Joystick -> CInt -> Ptr Sint16 -> IO CBool
- sDL_GetJoystickBall :: Ptr SDL_Joystick -> CInt -> Ptr CInt -> Ptr CInt -> IO CBool
- sDL_GetJoystickHat :: Ptr SDL_Joystick -> CInt -> IO Uint8
- sDL_GetJoystickButton :: Ptr SDL_Joystick -> CInt -> IO CBool
- sDL_RumbleJoystick :: Ptr SDL_Joystick -> Uint16 -> Uint16 -> Uint32 -> IO CBool
- sDL_RumbleJoystickTriggers :: Ptr SDL_Joystick -> Uint16 -> Uint16 -> Uint32 -> IO CBool
- sDL_SetJoystickLED :: Ptr SDL_Joystick -> Uint8 -> Uint8 -> Uint8 -> IO CBool
- sDL_SendJoystickEffect :: Ptr SDL_Joystick -> PtrConst Void -> CInt -> IO CBool
- sDL_CloseJoystick :: Ptr SDL_Joystick -> IO ()
- sDL_GetJoystickConnectionState :: Ptr SDL_Joystick -> IO SDL_JoystickConnectionState
- sDL_GetJoystickPowerInfo :: Ptr SDL_Joystick -> Ptr CInt -> IO SDL_PowerState
Documentation
sDL_LockJoysticks :: IO () Source #
Locking for atomic access to the joystick API.
The SDL joystick functions are thread-safe, however you can lock the joysticks while processing to guarantee that the joystick list won't change and joystick and gamepad events will not be delivered.
- Thread safety
- It is safe to call this function from any thread.
- C declaration
SDL_LockJoysticks, defined atSDL3/SDL_joystick.h 189:34
Since: 3.2.0
sDL_UnlockJoysticks :: IO () Source #
Unlocking for atomic access to the joystick API.
- Thread safety
- This should be called from the same thread that called
SDL_LockJoysticks(). - C declaration
SDL_UnlockJoysticks, defined atSDL3/SDL_joystick.h 199:34
Since: 3.2.0
sDL_HasJoystick :: IO CBool Source #
Return whether a joystick is currently connected.
- Returns
- true if a joystick is connected, false otherwise.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_GetJoysticks- C declaration
SDL_HasJoystick, defined atSDL3/SDL_joystick.h 212:34
Since: 3.2.0
Arguments
| :: Ptr CInt |
|
| -> IO (Ptr SDL_JoystickID) |
Get a list of currently connected joysticks.
- Returns
- a 0 terminated array of joystick instance IDs or NULL on failure; call SDL_GetError() for more information. This should be freed with SDL_free() when it is no longer needed.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_HasJoystick,sDL_OpenJoystick- C declaration
SDL_GetJoysticks, defined atSDL3/SDL_joystick.h 230:46
Since: 3.2.0
sDL_GetJoystickNameForID Source #
Arguments
| :: SDL_JoystickID |
|
| -> IO (PtrConst CChar) |
Get the implementation dependent name of a joystick.
This can be called before any joysticks are opened.
- Returns
- the name of the selected joystick. If no name can be found, this function returns NULL; call SDL_GetError() for more information.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_GetJoystickName,sDL_GetJoysticks- C declaration
SDL_GetJoystickNameForID, defined atSDL3/SDL_joystick.h 248:42
Since: 3.2.0
sDL_GetJoystickPathForID Source #
Arguments
| :: SDL_JoystickID |
|
| -> IO (PtrConst CChar) |
Get the implementation dependent path of a joystick.
This can be called before any joysticks are opened.
- Returns
- the path of the selected joystick. If no path can be found, this function returns NULL; call SDL_GetError() for more information.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_GetJoystickPath,sDL_GetJoysticks- C declaration
SDL_GetJoystickPathForID, defined atSDL3/SDL_joystick.h 266:42
Since: 3.2.0
sDL_GetJoystickPlayerIndexForID Source #
Arguments
| :: SDL_JoystickID |
|
| -> IO CInt |
Get the player index of a joystick.
This can be called before any joysticks are opened.
- Returns
- the player index of a joystick, or -1 if it's not available.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_GetJoystickPlayerIndex,sDL_GetJoysticks- C declaration
SDL_GetJoystickPlayerIndexForID, defined atSDL3/SDL_joystick.h 283:33
Since: 3.2.0
sDL_GetJoystickGUIDForID Source #
Arguments
| :: SDL_JoystickID |
|
| -> IO SDL_GUID |
Get the implementation-dependent GUID of a joystick.
This can be called before any joysticks are opened.
- Returns
- the GUID of the selected joystick. If called with an invalid instance_id, this function returns a zero GUID.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_GetJoystickGUID, SDL_GUIDToString- C declaration
SDL_GetJoystickGUIDForID, defined atSDL3/SDL_joystick.h 301:38
Since: 3.2.0
sDL_GetJoystickVendorForID Source #
Arguments
| :: SDL_JoystickID |
|
| -> IO Uint16 |
Get the USB vendor ID of a joystick, if available.
This can be called before any joysticks are opened. If the vendor ID isn't available this function returns 0.
- Returns
- the USB vendor ID of the selected joystick. If called with an invalid instance_id, this function returns 0.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_GetJoystickVendor,sDL_GetJoysticks- C declaration
SDL_GetJoystickVendorForID, defined atSDL3/SDL_joystick.h 320:36
Since: 3.2.0
sDL_GetJoystickProductForID Source #
Arguments
| :: SDL_JoystickID |
|
| -> IO Uint16 |
Get the USB product ID of a joystick, if available.
This can be called before any joysticks are opened. If the product ID isn't available this function returns 0.
- Returns
- the USB product ID of the selected joystick. If called with an invalid instance_id, this function returns 0.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_GetJoystickProduct,sDL_GetJoysticks- C declaration
SDL_GetJoystickProductForID, defined atSDL3/SDL_joystick.h 339:36
Since: 3.2.0
sDL_GetJoystickProductVersionForID Source #
Arguments
| :: SDL_JoystickID |
|
| -> IO Uint16 |
Get the product version of a joystick, if available.
This can be called before any joysticks are opened. If the product version isn't available this function returns 0.
- Returns
- the product version of the selected joystick. If called with an invalid instance_id, this function returns 0.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_GetJoystickProductVersion,sDL_GetJoysticks- C declaration
SDL_GetJoystickProductVersionForID, defined atSDL3/SDL_joystick.h 358:36
Since: 3.2.0
sDL_GetJoystickTypeForID Source #
Arguments
| :: SDL_JoystickID |
|
| -> IO SDL_JoystickType |
Get the type of a joystick, if available.
This can be called before any joysticks are opened.
- Returns
- the
SDL_JoystickTypeof the selected joystick. If called with an invalid instance_id, this function returnsSDL_JOYSTICK_TYPE_UNKNOWN. - Thread safety
- It is safe to call this function from any thread.
- See also
sDL_GetJoystickType,sDL_GetJoysticks- C declaration
SDL_GetJoystickTypeForID, defined atSDL3/SDL_joystick.h 377:46
Since: 3.2.0
Arguments
| :: SDL_JoystickID |
|
| -> IO (Ptr SDL_Joystick) |
Open a joystick for use.
The joystick subsystem must be initialized before a joystick can be opened for use.
- Returns
- a joystick identifier or NULL on failure; call SDL_GetError() for more information.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_CloseJoystick- C declaration
SDL_OpenJoystick, defined atSDL3/SDL_joystick.h 395:44
Since: 3.2.0
sDL_GetJoystickFromID Source #
Arguments
| :: SDL_JoystickID |
|
| -> IO (Ptr SDL_Joystick) |
Get the SDL_Joystick associated with an instance ID, if it has been opened.
- Returns
- an
SDL_Joystickon success or NULL on failure or if it hasn't been opened yet; call SDL_GetError() for more information. - Thread safety
- It is safe to call this function from any thread.
- C declaration
SDL_GetJoystickFromID, defined atSDL3/SDL_joystick.h 408:44
Since: 3.2.0
sDL_GetJoystickFromPlayerIndex Source #
Arguments
| :: CInt |
|
| -> IO (Ptr SDL_Joystick) |
Get the SDL_Joystick associated with a player index.
- Returns
- an
SDL_Joystickon success or NULL on failure; call SDL_GetError() for more information. - Thread safety
- It is safe to call this function from any thread.
- See also
sDL_GetJoystickPlayerIndex,sDL_SetJoystickPlayerIndex- C declaration
SDL_GetJoystickFromPlayerIndex, defined atSDL3/SDL_joystick.h 424:44
Since: 3.2.0
sDL_AttachVirtualJoystick Source #
Arguments
| :: PtrConst SDL_VirtualJoystickDesc |
|
| -> IO SDL_JoystickID |
Attach a new virtual joystick.
Apps can create virtual joysticks, that exist without hardware directly backing them, and have program-supplied inputs. Once attached, a virtual joystick looks like any other joystick that SDL can access. These can be used to make other things look like joysticks, or provide pre-recorded input, etc.
Once attached, the app can send joystick inputs to the new virtual joystick using SDL_SetJoystickVirtualAxis(), etc.
When no longer needed, the virtual joystick can be removed by calling SDL_DetachVirtualJoystick().
- Returns
- the joystick instance ID, or 0 on failure; call SDL_GetError() for more information.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_DetachVirtualJoystick,sDL_SetJoystickVirtualAxis,sDL_SetJoystickVirtualButton,sDL_SetJoystickVirtualBall,sDL_SetJoystickVirtualHat,sDL_SetJoystickVirtualTouchpad, SDL_SetJoystickVirtualSensorData- C declaration
SDL_AttachVirtualJoystick, defined atSDL3/SDL_joystick.h 539:44
Since: 3.2.0
sDL_DetachVirtualJoystick Source #
Arguments
| :: SDL_JoystickID |
|
| -> IO CBool |
Detach a virtual joystick.
- Returns
- true on success or false on failure; call SDL_GetError() for more information.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_AttachVirtualJoystick- C declaration
SDL_DetachVirtualJoystick, defined atSDL3/SDL_joystick.h 555:34
Since: 3.2.0
sDL_IsJoystickVirtual Source #
Arguments
| :: SDL_JoystickID |
|
| -> IO CBool |
Query whether or not a joystick is virtual.
- Returns
- true if the joystick is virtual, false otherwise.
- Thread safety
- It is safe to call this function from any thread.
- C declaration
SDL_IsJoystickVirtual, defined atSDL3/SDL_joystick.h 567:34
Since: 3.2.0
sDL_SetJoystickVirtualAxis Source #
Arguments
| :: Ptr SDL_Joystick |
|
| -> CInt |
|
| -> Sint16 |
|
| -> IO CBool |
Set the state of an axis on an opened virtual joystick.
Please note that values set here will not be applied until the next call to SDL_UpdateJoysticks, which can either be called directly, or can be called indirectly through various other SDL APIs, including, but not limited to the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout, SDL_WaitEvent.
Note that when sending trigger axes, you should scale the value to the full range of Sint16. For example, a trigger at rest would have the value of .sDL_JOYSTICK_AXIS_MIN
- Returns
- true on success or false on failure; call SDL_GetError() for more information.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_SetJoystickVirtualButton,sDL_SetJoystickVirtualBall,sDL_SetJoystickVirtualHat,sDL_SetJoystickVirtualTouchpad, SDL_SetJoystickVirtualSensorData- C declaration
SDL_SetJoystickVirtualAxis, defined atSDL3/SDL_joystick.h 598:34
Since: 3.2.0
sDL_SetJoystickVirtualBall Source #
Arguments
| :: Ptr SDL_Joystick |
|
| -> CInt |
|
| -> Sint16 |
|
| -> Sint16 |
|
| -> IO CBool |
Generate ball motion on an opened virtual joystick.
Please note that values set here will not be applied until the next call to SDL_UpdateJoysticks, which can either be called directly, or can be called indirectly through various other SDL APIs, including, but not limited to the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout, SDL_WaitEvent.
- Returns
- true on success or false on failure; call SDL_GetError() for more information.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_SetJoystickVirtualAxis,sDL_SetJoystickVirtualButton,sDL_SetJoystickVirtualHat,sDL_SetJoystickVirtualTouchpad, SDL_SetJoystickVirtualSensorData- C declaration
SDL_SetJoystickVirtualBall, defined atSDL3/SDL_joystick.h 626:34
Since: 3.2.0
sDL_SetJoystickVirtualButton Source #
Arguments
| :: Ptr SDL_Joystick |
|
| -> CInt |
|
| -> CBool |
|
| -> IO CBool |
Set the state of a button on an opened virtual joystick.
Please note that values set here will not be applied until the next call to SDL_UpdateJoysticks, which can either be called directly, or can be called indirectly through various other SDL APIs, including, but not limited to the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout, SDL_WaitEvent.
- Returns
- true on success or false on failure; call SDL_GetError() for more information.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_SetJoystickVirtualAxis,sDL_SetJoystickVirtualBall,sDL_SetJoystickVirtualHat,sDL_SetJoystickVirtualTouchpad, SDL_SetJoystickVirtualSensorData- C declaration
SDL_SetJoystickVirtualButton, defined atSDL3/SDL_joystick.h 653:34
Since: 3.2.0
sDL_SetJoystickVirtualHat Source #
Arguments
| :: Ptr SDL_Joystick |
|
| -> CInt |
|
| -> Uint8 |
|
| -> IO CBool |
Set the state of a hat on an opened virtual joystick.
Please note that values set here will not be applied until the next call to SDL_UpdateJoysticks, which can either be called directly, or can be called indirectly through various other SDL APIs, including, but not limited to the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout, SDL_WaitEvent.
- Returns
- true on success or false on failure; call SDL_GetError() for more information.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_SetJoystickVirtualAxis,sDL_SetJoystickVirtualButton,sDL_SetJoystickVirtualBall,sDL_SetJoystickVirtualTouchpad, SDL_SetJoystickVirtualSensorData- C declaration
SDL_SetJoystickVirtualHat, defined atSDL3/SDL_joystick.h 680:34
Since: 3.2.0
sDL_SetJoystickVirtualTouchpad Source #
Arguments
| :: Ptr SDL_Joystick |
|
| -> CInt |
|
| -> CInt |
|
| -> CBool |
|
| -> CFloat |
|
| -> CFloat |
|
| -> CFloat |
|
| -> IO CBool |
Set touchpad finger state on an opened virtual joystick.
Please note that values set here will not be applied until the next call to SDL_UpdateJoysticks, which can either be called directly, or can be called indirectly through various other SDL APIs, including, but not limited to the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout, SDL_WaitEvent.
- Returns
- true on success or false on failure; call SDL_GetError() for more information.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_SetJoystickVirtualAxis,sDL_SetJoystickVirtualButton,sDL_SetJoystickVirtualBall,sDL_SetJoystickVirtualHat, SDL_SetJoystickVirtualSensorData- C declaration
SDL_SetJoystickVirtualTouchpad, defined atSDL3/SDL_joystick.h 714:34
Since: 3.2.0
sDL_SendJoystickVirtualSensorData Source #
Arguments
| :: Ptr SDL_Joystick |
|
| -> SDL_SensorType |
|
| -> Uint64 |
|
| -> PtrConst CFloat |
|
| -> CInt |
|
| -> IO CBool |
Send a sensor update for an opened virtual joystick.
Please note that values set here will not be applied until the next call to SDL_UpdateJoysticks, which can either be called directly, or can be called indirectly through various other SDL APIs, including, but not limited to the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout, SDL_WaitEvent.
- Returns
- true on success or false on failure; call SDL_GetError() for more information.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_SetJoystickVirtualAxis,sDL_SetJoystickVirtualButton,sDL_SetJoystickVirtualBall,sDL_SetJoystickVirtualHat,sDL_SetJoystickVirtualTouchpad- C declaration
SDL_SendJoystickVirtualSensorData, defined atSDL3/SDL_joystick.h 744:34
Since: 3.2.0
sDL_GetJoystickProperties Source #
Arguments
| :: Ptr SDL_Joystick |
|
| -> IO SDL_PropertiesID |
Get the properties associated with a joystick.
The following read-only properties are provided by SDL:
: true if this joystick has an LED that has adjustable brightnesssDL_PROP_JOYSTICK_CAP_MONO_LED_BOOLEAN: true if this joystick has an LED that has adjustable colorsDL_PROP_JOYSTICK_CAP_RGB_LED_BOOLEAN: true if this joystick has a player LEDsDL_PROP_JOYSTICK_CAP_PLAYER_LED_BOOLEAN: true if this joystick has left/right rumblesDL_PROP_JOYSTICK_CAP_RUMBLE_BOOLEAN: true if this joystick has simple trigger rumblesDL_PROP_JOYSTICK_CAP_TRIGGER_RUMBLE_BOOLEAN
- Returns
- a valid property ID on success or 0 on failure; call SDL_GetError() for more information.
- Thread safety
- It is safe to call this function from any thread.
- C declaration
SDL_GetJoystickProperties, defined atSDL3/SDL_joystick.h 770:46
Since: 3.2.0
Arguments
| :: Ptr SDL_Joystick |
|
| -> IO (PtrConst CChar) |
Get the implementation dependent name of a joystick.
- Returns
- the name of the selected joystick. If no name can be found, this function returns NULL; call SDL_GetError() for more information.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_GetJoystickNameForID- C declaration
SDL_GetJoystickName, defined atSDL3/SDL_joystick.h 791:42
Since: 3.2.0
Arguments
| :: Ptr SDL_Joystick |
|
| -> IO (PtrConst CChar) |
Get the implementation dependent path of a joystick.
- Returns
- the path of the selected joystick. If no path can be found, this function returns NULL; call SDL_GetError() for more information.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_GetJoystickPathForID- C declaration
SDL_GetJoystickPath, defined atSDL3/SDL_joystick.h 806:42
Since: 3.2.0
sDL_GetJoystickPlayerIndex Source #
Arguments
| :: Ptr SDL_Joystick |
|
| -> IO CInt |
Get the player index of an opened joystick.
For XInput controllers this returns the XInput user index. Many joysticks will not be able to supply this information.
- Returns
- the player index, or -1 if it's not available.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_SetJoystickPlayerIndex- C declaration
SDL_GetJoystickPlayerIndex, defined atSDL3/SDL_joystick.h 823:33
Since: 3.2.0
sDL_SetJoystickPlayerIndex Source #
Arguments
| :: Ptr SDL_Joystick |
|
| -> CInt |
|
| -> IO CBool |
Set the player index of an opened joystick.
- Returns
- true on success or false on failure; call SDL_GetError() for more information.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_GetJoystickPlayerIndex- C declaration
SDL_SetJoystickPlayerIndex, defined atSDL3/SDL_joystick.h 840:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Joystick |
|
| -> IO SDL_GUID |
Get the implementation-dependent GUID for the joystick.
This function requires an open joystick.
- Returns
- the GUID of the given joystick. If called on an invalid index, this function returns a zero GUID; call SDL_GetError() for more information.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_GetJoystickGUIDForID, SDL_GUIDToString- C declaration
SDL_GetJoystickGUID, defined atSDL3/SDL_joystick.h 859:38
Since: 3.2.0
sDL_GetJoystickVendor Source #
Arguments
| :: Ptr SDL_Joystick |
|
| -> IO Uint16 |
Get the USB vendor ID of an opened joystick, if available.
If the vendor ID isn't available this function returns 0.
- Returns
- the USB vendor ID of the selected joystick, or 0 if unavailable.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_GetJoystickVendorForID- C declaration
SDL_GetJoystickVendor, defined atSDL3/SDL_joystick.h 875:36
Since: 3.2.0
sDL_GetJoystickProduct Source #
Arguments
| :: Ptr SDL_Joystick |
|
| -> IO Uint16 |
Get the USB product ID of an opened joystick, if available.
If the product ID isn't available this function returns 0.
- Returns
- the USB product ID of the selected joystick, or 0 if unavailable.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_GetJoystickProductForID- C declaration
SDL_GetJoystickProduct, defined atSDL3/SDL_joystick.h 891:36
Since: 3.2.0
sDL_GetJoystickProductVersion Source #
Arguments
| :: Ptr SDL_Joystick |
|
| -> IO Uint16 |
Get the product version of an opened joystick, if available.
If the product version isn't available this function returns 0.
- Returns
- the product version of the selected joystick, or 0 if unavailable.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_GetJoystickProductVersionForID- C declaration
SDL_GetJoystickProductVersion, defined atSDL3/SDL_joystick.h 907:36
Since: 3.2.0
sDL_GetJoystickFirmwareVersion Source #
Arguments
| :: Ptr SDL_Joystick |
|
| -> IO Uint16 |
Get the firmware version of an opened joystick, if available.
If the firmware version isn't available this function returns 0.
- Returns
- the firmware version of the selected joystick, or 0 if unavailable.
- Thread safety
- It is safe to call this function from any thread.
- C declaration
SDL_GetJoystickFirmwareVersion, defined atSDL3/SDL_joystick.h 922:36
Since: 3.2.0
sDL_GetJoystickSerial Source #
Arguments
| :: Ptr SDL_Joystick |
|
| -> IO (PtrConst CChar) |
Get the serial number of an opened joystick, if available.
Returns the serial number of the joystick, or NULL if it is not available.
- Returns
- the serial number of the selected joystick, or NULL if unavailable.
- Thread safety
- It is safe to call this function from any thread.
- C declaration
SDL_GetJoystickSerial, defined atSDL3/SDL_joystick.h 937:42
Since: 3.2.0
Arguments
| :: Ptr SDL_Joystick |
|
| -> IO SDL_JoystickType |
Get the type of an opened joystick.
- Returns
- the
SDL_JoystickTypeof the selected joystick. - Thread safety
- It is safe to call this function from any thread.
- See also
sDL_GetJoystickTypeForID- C declaration
SDL_GetJoystickType, defined atSDL3/SDL_joystick.h 951:46
Since: 3.2.0
sDL_GetJoystickGUIDInfo Source #
Arguments
| :: SDL_GUID |
|
| -> Ptr Uint16 |
|
| -> Ptr Uint16 |
|
| -> Ptr Uint16 |
|
| -> Ptr Uint16 |
|
| -> IO () |
Get the device information encoded in a SDL_GUID structure.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_GetJoystickGUIDForID- C declaration
SDL_GetJoystickGUIDInfo, defined atSDL3/SDL_joystick.h 972:34
Since: 3.2.0
sDL_JoystickConnected Source #
Arguments
| :: Ptr SDL_Joystick |
|
| -> IO CBool |
Get the status of a specified joystick.
- Returns
- true if the joystick has been opened, false if it has not; call SDL_GetError() for more information.
- Thread safety
- It is safe to call this function from any thread.
- C declaration
SDL_JoystickConnected, defined atSDL3/SDL_joystick.h 985:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Joystick |
|
| -> IO SDL_JoystickID |
Get the instance ID of an opened joystick.
- Returns
- the instance ID of the specified joystick on success or 0 on failure; call SDL_GetError() for more information.
- Thread safety
- It is safe to call this function from any thread.
- C declaration
SDL_GetJoystickID, defined atSDL3/SDL_joystick.h 998:44
Since: 3.2.0
sDL_GetNumJoystickAxes Source #
Arguments
| :: Ptr SDL_Joystick |
|
| -> IO CInt |
Get the number of general axis controls on a joystick.
Often, the directional pad on a game controller will either look like 4 separate buttons or a POV hat, and not axes, but all of this is up to the device and platform.
- Returns
- the number of axis controls/number of axes on success or -1 on failure; call SDL_GetError() for more information.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_GetJoystickAxis,sDL_GetNumJoystickBalls,sDL_GetNumJoystickButtons,sDL_GetNumJoystickHats- C declaration
SDL_GetNumJoystickAxes, defined atSDL3/SDL_joystick.h 1020:33
Since: 3.2.0
sDL_GetNumJoystickBalls Source #
Arguments
| :: Ptr SDL_Joystick |
|
| -> IO CInt |
Get the number of trackballs on a joystick.
Joystick trackballs have only relative motion events associated with them and their state cannot be polled.
Most joysticks do not have trackballs.
- Returns
- the number of trackballs on success or -1 on failure; call SDL_GetError() for more information.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_GetJoystickBall,sDL_GetNumJoystickAxes,sDL_GetNumJoystickButtons,sDL_GetNumJoystickHats- C declaration
SDL_GetNumJoystickBalls, defined atSDL3/SDL_joystick.h 1043:33
Since: 3.2.0
sDL_GetNumJoystickHats Source #
Arguments
| :: Ptr SDL_Joystick |
|
| -> IO CInt |
Get the number of POV hats on a joystick.
- Returns
- the number of POV hats on success or -1 on failure; call SDL_GetError() for more information.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_GetJoystickHat,sDL_GetNumJoystickAxes,sDL_GetNumJoystickBalls,sDL_GetNumJoystickButtons- C declaration
SDL_GetNumJoystickHats, defined atSDL3/SDL_joystick.h 1061:33
Since: 3.2.0
sDL_GetNumJoystickButtons Source #
Arguments
| :: Ptr SDL_Joystick |
|
| -> IO CInt |
Get the number of buttons on a joystick.
- Returns
- the number of buttons on success or -1 on failure; call SDL_GetError() for more information.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_GetJoystickButton,sDL_GetNumJoystickAxes,sDL_GetNumJoystickBalls,sDL_GetNumJoystickHats- C declaration
SDL_GetNumJoystickButtons, defined atSDL3/SDL_joystick.h 1079:33
Since: 3.2.0
sDL_SetJoystickEventsEnabled Source #
Set the state of joystick event processing.
If joystick events are disabled, you must call SDL_UpdateJoysticks() yourself and check the state of the joystick when you want joystick information.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_JoystickEventsEnabled,sDL_UpdateJoysticks- C declaration
SDL_SetJoystickEventsEnabled, defined atSDL3/SDL_joystick.h 1097:34
Since: 3.2.0
sDL_JoystickEventsEnabled :: IO CBool Source #
Query the state of joystick event processing.
If joystick events are disabled, you must call SDL_UpdateJoysticks() yourself and check the state of the joystick when you want joystick information.
- Returns
- true if joystick events are being processed, false otherwise.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_SetJoystickEventsEnabled- C declaration
SDL_JoystickEventsEnabled, defined atSDL3/SDL_joystick.h 1114:34
Since: 3.2.0
sDL_UpdateJoysticks :: IO () Source #
Update the current state of the open joysticks.
This is called automatically by the event loop if any joystick events are enabled.
- Thread safety
- It is safe to call this function from any thread.
- C declaration
SDL_UpdateJoysticks, defined atSDL3/SDL_joystick.h 1126:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Joystick |
|
| -> CInt |
|
| -> IO Sint16 |
Get the current state of an axis control on a joystick.
SDL makes no promises about what part of the joystick any given axis refers to. Your game should have some sort of configuration UI to let users specify what each axis should be bound to. Alternately, SDL's higher-level Game Controller API makes a great effort to apply order to this lower-level interface, so you know that a specific axis is the "left thumb stick," etc.
The value returned by SDL_GetJoystickAxis() is a signed integer (-32768 to 32767) representing the current position of the axis. It may be necessary to impose certain tolerances on these values to account for jitter.
- Returns
- a 16-bit signed integer representing the current position of the axis or 0 on failure; call SDL_GetError() for more information.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_GetNumJoystickAxes- C declaration
SDL_GetJoystickAxis, defined atSDL3/SDL_joystick.h 1152:36
Since: 3.2.0
sDL_GetJoystickAxisInitialState Source #
Arguments
| :: Ptr SDL_Joystick |
|
| -> CInt |
|
| -> Ptr Sint16 |
|
| -> IO CBool |
Get the initial state of an axis control on a joystick.
The state is a value ranging from -32768 to 32767.
The axis indices start at index 0.
- Returns
- true if this axis has any initial value, or false if not.
- Thread safety
- It is safe to call this function from any thread.
- C declaration
SDL_GetJoystickAxisInitialState, defined atSDL3/SDL_joystick.h 1170:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Joystick |
|
| -> CInt |
|
| -> Ptr CInt |
|
| -> Ptr CInt |
|
| -> IO CBool |
Get the ball axis change since the last poll.
Trackballs can only return relative motion since the last call to SDL_GetJoystickBall(), these motion deltas are placed into dx and dy.
Most joysticks do not have trackballs.
- Returns
- true on success or false on failure; call SDL_GetError() for more information.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_GetNumJoystickBalls- C declaration
SDL_GetJoystickBall, defined atSDL3/SDL_joystick.h 1193:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Joystick |
|
| -> CInt |
|
| -> IO Uint8 |
Get the current state of a POV hat on a joystick.
The returned value will be one of the SDL_HAT_* values.
- Returns
- the current hat position.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_GetNumJoystickHats- C declaration
SDL_GetJoystickHat, defined atSDL3/SDL_joystick.h 1210:35
Since: 3.2.0
sDL_GetJoystickButton Source #
Arguments
| :: Ptr SDL_Joystick |
|
| -> CInt |
|
| -> IO CBool |
Get the current state of a button on a joystick.
- Returns
- true if the button is pressed, false otherwise.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_GetNumJoystickButtons- C declaration
SDL_GetJoystickButton, defined atSDL3/SDL_joystick.h 1236:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Joystick |
|
| -> Uint16 |
|
| -> Uint16 |
|
| -> Uint32 |
|
| -> IO CBool |
Start a rumble effect.
Each call to this function cancels any previous rumble effect, and calling it with 0 intensity stops any rumbling.
This function requires you to process SDL events or call SDL_UpdateJoysticks() to update rumble state.
- Returns
- true, or false if rumble isn't supported on this joystick.
- Thread safety
- It is safe to call this function from any thread.
- C declaration
SDL_RumbleJoystick, defined atSDL3/SDL_joystick.h 1259:34
Since: 3.2.0
sDL_RumbleJoystickTriggers Source #
Arguments
| :: Ptr SDL_Joystick |
|
| -> Uint16 |
|
| -> Uint16 |
|
| -> Uint32 |
|
| -> IO CBool |
Start a rumble effect in the joystick's triggers.
Each call to this function cancels any previous trigger rumble effect, and calling it with 0 intensity stops any rumbling.
Note that this is rumbling of the triggers and not the game controller as a whole. This is currently only supported on Xbox One controllers. If you want the (more common) whole-controller rumble, use SDL_RumbleJoystick() instead.
This function requires you to process SDL events or call SDL_UpdateJoysticks() to update rumble state.
- Returns
- true on success or false on failure; call SDL_GetError() for more information.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_RumbleJoystick- C declaration
SDL_RumbleJoystickTriggers, defined atSDL3/SDL_joystick.h 1290:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Joystick |
|
| -> Uint8 |
|
| -> Uint8 |
|
| -> Uint8 |
|
| -> IO CBool |
Update a joystick's LED color.
An example of a joystick LED is the light on the back of a PlayStation 4's DualShock 4 controller.
For joysticks with a single color LED, the maximum of the RGB values will be used as the LED brightness.
- Returns
- true on success or false on failure; call SDL_GetError() for more information.
- Thread safety
- It is safe to call this function from any thread.
- C declaration
SDL_SetJoystickLED, defined atSDL3/SDL_joystick.h 1312:34
Since: 3.2.0
sDL_SendJoystickEffect Source #
Arguments
| :: Ptr SDL_Joystick |
|
| -> PtrConst Void |
|
| -> CInt |
|
| -> IO CBool |
Send a joystick specific effect packet.
- Returns
- true on success or false on failure; call SDL_GetError() for more information.
- Thread safety
- It is safe to call this function from any thread.
- C declaration
SDL_SendJoystickEffect, defined atSDL3/SDL_joystick.h 1327:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Joystick |
|
| -> IO () |
Close a joystick previously opened with SDL_OpenJoystick().
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_OpenJoystick- C declaration
SDL_CloseJoystick, defined atSDL3/SDL_joystick.h 1340:34
Since: 3.2.0
sDL_GetJoystickConnectionState Source #
Arguments
| :: Ptr SDL_Joystick |
|
| -> IO SDL_JoystickConnectionState |
Get the connection state of a joystick.
- Returns
- the connection state on success or
SDL_JOYSTICK_CONNECTION_INVALIDon failure; call SDL_GetError() for more information. - Thread safety
- It is safe to call this function from any thread.
- C declaration
SDL_GetJoystickConnectionState, defined atSDL3/SDL_joystick.h 1354:57
Since: 3.2.0
sDL_GetJoystickPowerInfo Source #
Arguments
| :: Ptr SDL_Joystick |
|
| -> Ptr CInt |
|
| -> IO SDL_PowerState |
Get the battery state of a joystick.
You should never take a battery status as absolute truth. Batteries (especially failing batteries) are delicate hardware, and the values reported here are best estimates based on what that hardware reports. It's not uncommon for older batteries to lose stored power much faster than it reports, or completely drain when reporting it has 20 percent left, etc.
- Returns
- the current battery state or
SDL_POWERSTATE_ERRORon failure; call SDL_GetError() for more information. - Thread safety
- It is safe to call this function from any thread.
- C declaration
SDL_GetJoystickPowerInfo, defined atSDL3/SDL_joystick.h 1377:44
Since: 3.2.0