29#ifndef NOMLIB_SYSTEM_GAME_CONTROLLER_HPP
30#define NOMLIB_SYSTEM_GAME_CONTROLLER_HPP
32#include "nomlib/config.hpp"
33#include "nomlib/system/Joystick.hpp"
36typedef struct _SDL_Joystick SDL_Joystick;
37typedef struct _SDL_GameController SDL_GameController;
46bool init_game_controller_subsystem();
49void shutdown_game_controller_subsystem();
52void GameControllerDeleter(SDL_GameController* dev);
85 BUTTON_RIGHT_SHOULDER,
90 BUTTON_MAX = SDL_CONTROLLER_BUTTON_MAX,
98 static bool device_closed_;
138 bool open(JoystickIndex device_index);
156 static std::string
name(JoystickIndex device_index);
181 std::string mapping_string();
192 static int load_mapping_string(
const std::string& mapping);
205 static JoystickID
device_id(JoystickIndex device_index);
212 typedef std::unique_ptr<SDL_GameController, void (*)(SDL_GameController*)>
215 joystick_dev device_;
218std::unique_ptr<GameController> make_unique_game_controller();
219std::shared_ptr<GameController> make_shared_game_controller();
SDL2 game controller interface.
static void update()
Update the current state of the opened game controllers.
JoystickID device_id() const
Get the instance ID of an opened game controller.
static std::string name(JoystickIndex device_index)
Get the implementation-dependent name of the joystick.
static int set_event_state(int state)
Toggle the game controller's event polling state.
bool open(JoystickIndex device_index)
Open a joystick for use.
static bool compatible_joystick(JoystickIndex device_index)
Check to see if the joystick is supported by SDL's game controller interface.
static std::string mapping_string(JoystickGUID guid)
SDL_Joystick * device() const
Get the underlying implementation pointer.
static int load_mapping_memory(const char *buffer, int buffer_size)
Button
Game controller button definitions.
std::string name() const
Get the implementation-dependent name of the joystick.
static JoystickID device_id(JoystickIndex device_index)
Get the instance ID of a joystick device.
Axis
Game controller axis definitions.
static int load_mapping_file(const std::string &filename)
bool attached() const
Get the status of the joystick.
void close()
Close an opened joystick.
Internal representation of a stable, fixed identifier – 128 bits wide – for a joystick device....