44 std::
string name() const;
53 [[nodiscard]] std::optional<SDL_Joystick *>
handle() const;
59 SDL_Joystick *
unwrap() const;
76 [[nodiscard]]
int numHats() const;
78 [[nodiscard]]
int numAxes() const;
85 [[nodiscard]]
bool getButton(
int button) const;
92 [[nodiscard]] Uint8
getHat(
int hat) const;
99 [[nodiscard]] Sint16
getAxis(
int axis) const;
131 bool open(
int index);
144 std::
string name() const;
153 [[nodiscard]] std::optional<SDL_Gamepad *>
handle() const;
159 [[nodiscard]] SDL_Gamepad *
unwrap() const;
178 [[nodiscard]]
bool getButton(SDL_GamepadButton button) const;
185 [[nodiscard]] Uint8
getHat(
int hat) const;
192 [[nodiscard]] Sint16
getAxis(SDL_GamepadAxis axis) const;
198 [[nodiscard]]
bool active() const;
RAII wrapper for SDL_Gamepad (standard layout mapping).
std::optional< SDL_Gamepad * > handle() const
Return the underlying SDL_Gamepad handle as an optional.
int controllerIndex() const
Return the device index this controller was opened with.
void close()
Close the controller handle if open.
Sint16 getAxis(SDL_GamepadAxis axis) const
Read the current axis value.
SDL_Gamepad * unwrap() const
Unwrap the SDL_Gamepad pointer, asserting it is open.
SDL_Gamepad * stick
Underlying SDL gamepad handle.
SDL_JoystickID instanceId
Stable SDL gamepad instance identifier.
bool active() const
Check whether the controller is currently usable.
int deviceIndex
Open index in the current gamepad list.
bool openByInstanceId(SDL_JoystickID instanceId, int index_hint=-1)
bool getButton(SDL_GamepadButton button) const
Test whether a mapped button is currently pressed.
VK_Controller()
Default constructor — device not yet opened.
bool connectEvent(SDL_Event &e)
Handle a device-added/removed event to maintain connection state.
Uint8 getHat(int hat) const
Read the position of a POV hat.
static int joysticks()
Return the number of connected joysticks/controllers.
bool open(int index)
Open a gamepad by device index.
std::string name() const
Return the controller's name as reported by SDL.
RAII wrapper for a raw SDL_Joystick device.
SDL_JoystickID instanceId
Stable SDL joystick instance identifier.
VK_Joystick()
Default constructor — device not yet opened.
~VK_Joystick() noexcept
Destructor — closes the joystick if open.
SDL_Joystick * unwrap() const
Unwrap the SDL_Joystick pointer, asserting it is open.
bool getButton(int button) const
Test whether a button is currently pressed.
bool open(int index)
Open the joystick at the given device index.
Uint8 getHat(int hat) const
Read the position of a POV hat.
static int joysticks()
Return the number of connected joysticks.
int deviceIndex
Open index in the current joystick list.
int joystickIndex() const
Return the device index this joystick was opened with.
SDL_Joystick * stick
Underlying SDL joystick handle.
std::optional< SDL_Joystick * > handle() const
Return the underlying SDL_Joystick handle as an optional.
std::string name() const
Return the joystick's name as reported by SDL.
Sint16 getAxis(int axis) const
Read the current axis value.
void close()
Close the joystick handle if open.
mxvk::VK_Joystick VK_Joystick
mxvk::VK_Controller Controller
mxvk::VK_Controller VK_Controller
mxvk::VK_Joystick Joystick
Utilities for loading and saving PNG images.