Class GamepadInputData

Class Documentation

class GamepadInputData

A wrapper for gamepad input data.

Public Functions

GamepadInputData() = default
glm::vec2 calculate_joystick_axes_delta(std::int32_t joystick)
glm::vec2 current_joystick_axes(std::int32_t joystick)
bool is_button_pressed(std::int32_t button, std::int32_t joystick = GLFW_JOYSTICK_1)
void press_button(std::int32_t button, std::int32_t joystick = GLFW_JOYSTICK_1)
void release_button(std::int32_t button, std::int32_t joystick = GLFW_JOYSTICK_1)
void set_joystick_axis(std::int32_t axis, float state, std::int32_t joystick = GLFW_JOYSTICK_1)
bool was_button_pressed_once(std::int32_t button, std::int32_t joystick = GLFW_JOYSTICK_1)

Private Members

std::array<glm::vec2, 2> m_current_joystick_axes = {}
std::array<glm::vec2, 2> m_previous_joystick_axes = {}
std::array<std::array<bool, GLFW_JOYSTICK_LAST + 1>, GLFW_GAMEPAD_BUTTON_LAST> m_button_states = {}
bool m_joysticks_updated = {false}
bool m_buttons_updated = {false}
mutable std::shared_mutex m_input_mutex