27#include <unordered_map>
43 auto update(
float dt) -> void;
51 auto getSticksMap() -> std::unordered_map<int, std::pair<std::string, std::string>>;
89 std::unordered_map<int, std::pair<std::string, std::string>>
stickMap;
Helper class that assists Controllers by managing when a stick should be considered pressed or not.
Definition ControllerStick.h:30
static auto controllerCallback(int joystickID, int event) -> void
Callback used by GLFW whenever a controller is connected/disconnected.
Definition Controllers.cpp:224
auto getEnabled() const -> bool
Returns if controller input is currently enabled or not.
Definition Controllers.cpp:208
static auto getControllerNameFromID(int id) -> std::string
Public function that gets the name for a controller based on its ID. Primarily used for debugging.
Definition Controllers.cpp:259
auto getStickStatesOfController(int controllerID) -> std::array< ControllerStick, 6 > &
Definition Controllers.cpp:270
auto getButtonStatesOfController(int controllerID) -> std::array< std::unique_ptr< ControllerButton >, 15 > &
Definition Controllers.cpp:264
auto getSticksMap() -> std::unordered_map< int, std::pair< std::string, std::string > >
Returns the map of all the sticks and their corresponding events.
Definition Controllers.cpp:203
auto setEnabled(bool newState) -> void
Sets whether input from controllers are accepted or not.
Definition Controllers.cpp:213
Controllers()
Definition Controllers.cpp:36
bool enabled
Bool used to see if we should be receiving input from controllers.
Definition Controllers.h:77
auto connectController(int controllerID) -> void
Helper function that handles all the necessary protocols whenever a new controller is detected.
Definition Controllers.cpp:239
auto removeControllerID(int id) -> void
Removes a controller ID from the updating list, meaning its inputs will no longer be received.
Definition Controllers.cpp:218
auto getTapButtonsMap() -> std::unordered_map< int, std::string > &
Returns the map of all buttons that have ControllerButton behavior and their corresponding event.
Definition Controllers.cpp:198
std::unordered_map< int, std::pair< std::string, std::string > > stickMap
Map that takes GLFW gamepad sticks and maps them to the two events per stick (sticks go from -1 to 1,...
Definition Controllers.h:89
auto update(float dt) -> void
Definition Controllers.cpp:95
std::array< controllerInputTracker, 16 > lastFrameControllerState
An array that tracks the previous frame state of the buttons and joysticks for controllers.
Definition Controllers.h:92
std::vector< int > connectedControllers
Tracks every single controller that is currently plugged in.
Definition Controllers.h:80
int maxConnectedControllers
Tracker used to see if we need to create another controllerInputTracker (so we're not allocating a lo...
Definition Controllers.h:95
auto showMenu() -> void
Definition Controllers.cpp:159
auto getHeldButtonsMap() -> std::unordered_map< int, std::string > &
Returns the map of all buttons that have ControllerHoldButton behavior and their corresponding event.
Definition Controllers.cpp:193
std::unordered_map< int, std::string > holdButtonMap
Map that takes GLFW gamepad buttons and maps them to input event names. Should only store buttons tha...
Definition Controllers.h:83
std::unordered_map< int, std::string > tapButtonMap
Map that takes GLFW gamepad buttons and maps them to input event names. Should only store buttons tha...
Definition Controllers.h:86