11#include <spdlog/fmt/fmt.h>
34 std::string
ToString()
const override {
return fmt::format(
"{}: {} ({})",
GetName(),
static_cast<unsigned>(m_Gamepad), m_Name); }
52 std::string
ToString()
const override {
return fmt::format(
"{}: {}",
GetName(),
static_cast<unsigned>(m_Gamepad)); }
74 return fmt::format(
"{}: {}, {}",
GetName(),
static_cast<unsigned>(m_Gamepad),
static_cast<unsigned>(m_Button));
98 return fmt::format(
"{}: {}, {}",
GetName(),
static_cast<unsigned>(m_Gamepad),
static_cast<unsigned>(m_Button));
128 return fmt::format(
"{}: {}, {}, {}",
GetName(),
static_cast<unsigned>(m_Gamepad),
static_cast<unsigned>(m_Axis), m_Value);
134 float m_Value = 0.0f;
Base class of all events, with their types and categories.
Codes of the gamepads, of their buttons and of their axes, independent from GLFW.
Base class of each event class, which gives the event its type and its categories.
Definition Event.h:164
const char * GetName() const
Returns the name of the type of the event, for example "KeyPressed".
Definition Event.h:128
float GetValue() const
Returns the new value of the axis: from -1 to 1 for a stick axis, from 0 to 1 for a trigger.
Definition GamepadEvent.h:123
std::string ToString() const override
Returns the event with the id, the axis code and the value, for example "GamepadAxisMoved: 0,...
Definition GamepadEvent.h:126
GamepadAxisMovedEvent(GamepadId gamepad, GamepadAxis axis, float value)
Creates the event with the new value of the axis.
Definition GamepadEvent.h:114
GamepadId GetGamepad() const
Returns the id of the gamepad.
Definition GamepadEvent.h:117
GamepadAxis GetAxis() const
Returns the axis that moved.
Definition GamepadEvent.h:120
std::string ToString() const override
Returns the event with the id and the name, for example "GamepadConnected: 0 (Xbox Controller)".
Definition GamepadEvent.h:34
GamepadConnectedEvent(GamepadId gamepad, std::string name)
Creates the event for the connected gamepad.
Definition GamepadEvent.h:25
GamepadId GetGamepad() const
Returns the id of the gamepad.
Definition GamepadEvent.h:28
const std::string & GetGamepadName() const
Returns the name of the gamepad.
Definition GamepadEvent.h:31
std::string ToString() const override
Returns the event with the id, for example "GamepadDisconnected: 0".
Definition GamepadEvent.h:52
GamepadDisconnectedEvent(GamepadId gamepad)
Creates the event for the disconnected gamepad.
Definition GamepadEvent.h:46
GamepadId GetGamepad() const
Returns the id the gamepad had. A gamepad connected later can get the same id.
Definition GamepadEvent.h:49
Contains all the engine code.
GamepadButton
Button of a gamepad, at the position of the buttons of an Xbox controller.
Definition GamepadCodes.h:34
GamepadId
Identifies a connected gamepad, from 0 to MaxGamepads - 1.
Definition GamepadCodes.h:26
GamepadAxis
Axis of a gamepad.
Definition GamepadCodes.h:57