![]() |
nomlib
|
SDL2 joystick interface. More...
#include <Joystick.hpp>
Public Types | |
| enum | Axis : uint8 { AXIS_ZERO = 0 , AXIS_ONE , AXIS_TWO , AXIS_THREE , AXIS_FOUR , AXIS_FIVE , AXIS_SIX , AXIS_SEVEN , AXIS_EIGHT , AXIS_MAX } |
| Joystick axis definitions. More... | |
| enum | Button : uint8 { BUTTON_ZERO = 0 , BUTTON_ONE , BUTTON_TWO , BUTTON_THREE , BUTTON_FOUR , BUTTON_FIVE , BUTTON_SIX , BUTTON_SEVEN , BUTTON_EIGHT , BUTTON_NINE , BUTTON_TEN , BUTTON_ELEVEN , BUTTON_TWELVE , BUTTON_FOURTEEN , BUTTON_FIFTEEN , BUTTON_SIXTEEN , BUTTON_MAX } |
| Joystick button definitions. More... | |
| enum | Hat : uint8 { HAT_ZERO = 0 , HAT_ONE , HAT_TWO , HAT_THREE , HAT_FOUR , HAT_MAX } |
| Joystick hat definitions. More... | |
| enum | HatPosition : uint8 { HAT_CENTERED = 0x00 , HAT_UP = 0x01 , HAT_RIGHT = 0x02 , HAT_DOWN = 0x04 , HAT_LEFT = 0x08 , HAT_RIGHTUP = (HAT_RIGHT | HAT_UP) , HAT_RIGHTDOWN = (HAT_RIGHT | HAT_DOWN) , HAT_LEFTUP = (HAT_LEFT | HAT_UP) , HAT_LEFTDOWN = (HAT_LEFT | HAT_DOWN) } |
| Joystick hat position definitions. More... | |
| typedef Joystick | self_type |
Public Member Functions | |
| SDL_Joystick * | device () const |
| Get the underlying implementation pointer. | |
| bool | attached () const |
| Get the status of the joystick. | |
| JoystickID | device_id () const |
| Get the instance ID of an opened joystick. | |
| std::string | name () const |
| Get the implementation-dependent name of the joystick. | |
| bool | open (JoystickIndex device_index) |
| Open a joystick for use. | |
| void | close () |
| Close an opened joystick. | |
| int | num_axes () |
| Get the number of axes for this joystick. | |
| int | num_track_balls () |
| Get the number of track balls for this joystick. | |
| int | num_buttons () |
| Get the number of buttons for this joystick. | |
| int | num_hats () |
| Get the number of POV hats for this joystick. | |
| JoystickGUID | device_guid () const |
| Get the implementation-dependent GUID for this joystick instance. | |
| std::string | device_guid_string () const |
| Get the ASCII string representation of this joystick instance GUID. | |
Static Public Member Functions | |
| static int | set_event_state (int state) |
| Toggle the joystick event polling state. | |
| static void | update () |
| Update the current state of the opened joysticks. | |
| static int | num_joysticks () |
| Get the number of joysticks attached to the system. | |
| static std::string | name (JoystickIndex device_index) |
| Get the implementation-dependent name of the joystick. | |
| static JoystickGUID | device_guid (JoystickIndex device_index) |
| Get the implementation-dependent GUID for a joystick. | |
| static std::string | device_guid_string (JoystickGUID guid) |
| Get the ASCII string representation of a joystick GUID. | |
| static JoystickID | device_id (JoystickIndex device_index) |
| Get the instance ID of a joystick device. | |
Private Types | |
| typedef std::unique_ptr< SDL_Joystick, void(*)(SDL_Joystick *)> | joystick_dev |
Private Attributes | |
| joystick_dev | device_ |
|
private |
Definition at line 324 of file Joystick.hpp.
| typedef Joystick nom::Joystick::self_type |
Definition at line 148 of file Joystick.hpp.
| enum nom::Joystick::Axis : uint8 |
Joystick axis definitions.
Definition at line 87 of file Joystick.hpp.
| enum nom::Joystick::Button : uint8 |
Joystick button definitions.
Definition at line 102 of file Joystick.hpp.
| enum nom::Joystick::Hat : uint8 |
Joystick hat definitions.
Definition at line 124 of file Joystick.hpp.
| enum nom::Joystick::HatPosition : uint8 |
Joystick hat position definitions.
Definition at line 135 of file Joystick.hpp.
| bool nom::Joystick::attached | ( | ) | const |
Get the status of the joystick.
| void nom::Joystick::close | ( | ) |
Close an opened joystick.
| SDL_Joystick * nom::Joystick::device | ( | ) | const |
Get the underlying implementation pointer.
| JoystickGUID nom::Joystick::device_guid | ( | ) | const |
Get the implementation-dependent GUID for this joystick instance.
|
static |
Get the implementation-dependent GUID for a joystick.
| device_index | The index of the joystick device, as recognized by SDL. |
| std::string nom::Joystick::device_guid_string | ( | ) | const |
Get the ASCII string representation of this joystick instance GUID.
|
static |
Get the ASCII string representation of a joystick GUID.
| JoystickID nom::Joystick::device_id | ( | ) | const |
Get the instance ID of an opened joystick.
|
static |
Get the instance ID of a joystick device.
| device_index | The index of the joystick device, as recognized by SDL. |
| std::string nom::Joystick::name | ( | ) | const |
Get the implementation-dependent name of the joystick.
|
static |
Get the implementation-dependent name of the joystick.
| device_index | The index of the joystick device, as recognized by SDL. |
| int nom::Joystick::num_axes | ( | ) |
Get the number of axes for this joystick.
| int nom::Joystick::num_buttons | ( | ) |
Get the number of buttons for this joystick.
| int nom::Joystick::num_hats | ( | ) |
Get the number of POV hats for this joystick.
|
static |
Get the number of joysticks attached to the system.
| int nom::Joystick::num_track_balls | ( | ) |
Get the number of track balls for this joystick.
| bool nom::Joystick::open | ( | JoystickIndex | device_index | ) |
Open a joystick for use.
| device_index | The device index of the joystick as recognized by SDL. |
|
static |
Toggle the joystick event polling state.
| state | One of the following: SDL_QUERY, SDL_IGNORE or SDL_ENABLE. |
|
static |
Update the current state of the opened joysticks.
|
private |
Definition at line 326 of file Joystick.hpp.