15 SDL_Joystick *joystick;
16 std::vector<int> switches;
18 static unsigned int id_max;
19 EXPORT
static std::list<unsigned int> ids;
75 EXPORT
void mark_switch(
int button,
bool mark =
true);
std::vector< int > buttons_pressed
A list of all buttons currently pressed.
unsigned int instance_id
The instance ID of the gamepad as provided by an SDL2 event.
int get_axis_value(unsigned int axis)
Call this function to get the current value of an axis.
unsigned int num_axes
The number of axes the joystick has.
unsigned int get_hat_value(unsigned int hat)
Call this function to get the current value of a hat.
std::string name
The name of the joystick.
void set_button_state(int button, bool state)
Sets the state of a button.
unsigned int deadzone
The axis deadzone.
unsigned int num_hats
The number of hats the joystick has.
unsigned int id
The joystick id. When a new joystick is attached it is assigned the first free ID starting at 0.
void set_deadzone(unsigned int deadzone)
Sets a dedzone for all axes.
void mark_switch(int button, bool mark=true)
Marks or unmarks a button as a switch. Switches will not be added to the buttons_pressed list.
Joystick(unsigned int device_id)
unsigned int num_buttons
The number of buttons the joystick has.