[−][src]Module fermium::joystick
Module for SDL joystick event handling.
The term device_index
identifies currently plugged in joystick devices
between 0 and SDL_NumJoysticks(), with the exact joystick behind a
device_index changing as joysticks are plugged and unplugged.
The term instance_id
is the current instantiation of a joystick device in
the system, if the joystick is removed and then re-inserted then it will get
a new instance_id, instance_id's are monotonically increasing identifiers of
a joystick plugged in.
The term JoystickGUID
is a stable 128-bit identifier for a joystick device
that does not change over time, it identifies class of the device (a X360
wired controller for example). This identifier is platform dependent.
In order to use these functions, [SDL_Init
] must have been called
with the [SDL_INIT_JOYSTICK
] flag. This causes SDL to scan the system
for joysticks, and load appropriate drivers.
If you would like to receive joystick updates while the application
is in the background, you should set the
[SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS
] hint before calling
SDL_Init
.
See Also: gamecontroller
Structs
SDL_Joystick | The |
SDL_JoystickGUID | A structure that encodes the stable unique id for a joystick device. |
SDL_JoystickID | This is a unique ID for a joystick for the time it is connected to the system. |
SDL_JoystickPowerLevel | The power level of a joystick. |
SDL_JoystickType | The general physical category of a joystick device. |
Constants
SDL_HAT_CENTERED | |
SDL_HAT_DOWN | |
SDL_HAT_LEFT | |
SDL_HAT_LEFTDOWN | |
SDL_HAT_LEFTUP | |
SDL_HAT_RIGHT | |
SDL_HAT_RIGHTDOWN | |
SDL_HAT_RIGHTUP | |
SDL_HAT_UP | |
SDL_JOYSTICK_AXIS_MAX | A joystick axis uses the |
SDL_JOYSTICK_AXIS_MIN | A joystick axis uses the |
SDL_JOYSTICK_POWER_EMPTY | <= 5% |
SDL_JOYSTICK_POWER_FULL | <= 100% |
SDL_JOYSTICK_POWER_LOW | <= 20% |
SDL_JOYSTICK_POWER_MAX | Honestly, this particular constant is probably pointless. |
SDL_JOYSTICK_POWER_MEDIUM | <= 70% |
SDL_JOYSTICK_POWER_UNKNOWN | The power level is unknown. |
SDL_JOYSTICK_POWER_WIRED | This joystick is wired to the rest of the system. |
SDL_JOYSTICK_TYPE_ARCADE_PAD | |
SDL_JOYSTICK_TYPE_ARCADE_STICK | |
SDL_JOYSTICK_TYPE_DANCE_PAD | |
SDL_JOYSTICK_TYPE_DRUM_KIT | |
SDL_JOYSTICK_TYPE_FLIGHT_STICK | |
SDL_JOYSTICK_TYPE_GAMECONTROLLER | |
SDL_JOYSTICK_TYPE_GUITAR | |
SDL_JOYSTICK_TYPE_THROTTLE | |
SDL_JOYSTICK_TYPE_UNKNOWN | |
SDL_JOYSTICK_TYPE_WHEEL |
Functions
SDL_JoystickClose⚠ | Close a joystick previously opened with |
SDL_JoystickCurrentPowerLevel⚠ | Return the battery level of this joystick. |
SDL_JoystickEventState⚠ | Enable/disable joystick event polling. |
SDL_JoystickFromInstanceID⚠ | Return the SDL_Joystick associated with an instance id. |
SDL_JoystickFromPlayerIndex⚠ | Return the SDL_Joystick associated with a player index. |
SDL_JoystickGetAttached⚠ | Returns |
SDL_JoystickGetAxis⚠ | Get the current state of an axis control on a joystick. |
SDL_JoystickGetAxisInitialState⚠ | Get the initial state of an axis control on a joystick. |
SDL_JoystickGetBall⚠ | Get the ball axis change since the last poll. |
SDL_JoystickGetButton⚠ | Get the current state of a button on a joystick. |
SDL_JoystickGetDeviceGUID⚠ | Return the GUID for the joystick at this index. |
SDL_JoystickGetDeviceInstanceID⚠ | Get the instance ID of a joystick. |
SDL_JoystickGetDevicePlayerIndex⚠ | Get the player index of a joystick, or -1 if it's not available. |
SDL_JoystickGetDeviceProduct⚠ | Get the USB product ID of a joystick, if available. |
SDL_JoystickGetDeviceProductVersion⚠ | Get the product version of a joystick, if available. |
SDL_JoystickGetDeviceType⚠ | Get the type of a joystick, if available. |
SDL_JoystickGetDeviceVendor⚠ | Get the USB vendor ID of a joystick, if available. |
SDL_JoystickGetGUID⚠ | Return the GUID for this opened joystick. |
SDL_JoystickGetGUIDFromString⚠ | Convert a string into a joystick guid |
SDL_JoystickGetGUIDString⚠ | Return a string representation for this guid. |
SDL_JoystickGetHat⚠ | Get the current state of a POV hat on a joystick. |
SDL_JoystickGetPlayerIndex⚠ | Get the player index of an opened joystick, or -1 if it's not available. |
SDL_JoystickGetProduct⚠ | Get the USB product ID of an opened joystick, if available. |
SDL_JoystickGetProductVersion⚠ | Get the product version of an opened joystick, if available. |
SDL_JoystickGetType⚠ | Get the type of an opened joystick. |
SDL_JoystickGetVendor⚠ | Get the USB vendor ID of an opened joystick, if available. |
SDL_JoystickInstanceID⚠ | Get the instance ID of an opened joystick or -1 if the joystick is invalid. |
SDL_JoystickName⚠ | Return the name for this currently opened joystick. |
SDL_JoystickNameForIndex⚠ | Get the implementation dependent name of a joystick. |
SDL_JoystickNumAxes⚠ | Get the number of general axis controls on a joystick. |
SDL_JoystickNumBalls⚠ | Get the number of trackballs on a joystick. |
SDL_JoystickNumButtons⚠ | Get the number of buttons on a joystick. |
SDL_JoystickNumHats⚠ | Get the number of POV hats on a joystick. |
SDL_JoystickOpen⚠ | Open a joystick for use. |
SDL_JoystickRumble⚠ | Trigger a rumble effect. |
SDL_JoystickSetPlayerIndex⚠ | Set the player index of an opened joystick. |
SDL_JoystickUpdate⚠ | Update the current state of the open joysticks. |
SDL_LockJoysticks⚠ | Locking for multi-threaded access to the joystick API |
SDL_NumJoysticks⚠ | Count the number of joysticks attached to the system right now |
SDL_UnlockJoysticks⚠ |