Brunot
Loading...
Searching...
No Matches
controllerInputTracker.h
Go to the documentation of this file.
1
11// ____ __ __ __
12// /\__ _\/\ \ /\ \/\ \
13// \/_/\ \/\ \ \___ __ \ \ \_\ \ ___ __ __ ____ __
14// \ \ \ \ \ _ `\ /'__`\ \ \ _ \ / __`\/\ \/\ \ /',__\ /'__`\
15// \ \ \ \ \ \ \ \/\ __/ \ \ \ \ \/\ \L\ \ \ \_\ \/\__, `\/\ __/
16// \ \_\ \ \_\ \_\ \____\ \ \_\ \_\ \____/\ \____/\/\____/\ \____\
17// \/_/ \/_/\/_/\/____/ \/_/\/_/\/___/ \/___/ \/___/ \/____/
18
19
20
21#pragma once
22#include <array>
23#include <memory>
24#include <string>
25#include <unordered_map>
26
29
31{
38
40 auto initialize() -> void;
41
43 auto initialize(const std::unordered_map<int, std::string>& holdButtonMap, const std::unordered_map<int, std::string>& tapButtonMap, const std::unordered_map<int, std::pair<std::string,std::string>>& sticksMap) -> void;
44
46 auto clear() -> void;
47
48 // We need to store these as unique pointers so we can have polymorphic behavior between tap and hold buttons
49
51 std::array<std::unique_ptr<ControllerButton>,15> controllerButtons;
52 // Array representing all the sticks on a glfw Gamepad
53 std::array<ControllerStick,6> controllerSticks;
54};
Helper class used by Controllers to handle the logic of knowing when a button is pressed down or not.
Helper class that assists Controllers by managing when a stick should be considered pressed or not.
~controllerInputTracker()=default
auto clear() -> void
Clears out the information for the buttons and sticks. Typically used when a controller disconnects a...
Definition controllerInputTracker.cpp:98
std::array< std::unique_ptr< ControllerButton >, 15 > controllerButtons
Array representing all the buttons on a glfw Gamepad.
Definition controllerInputTracker.h:51
controllerInputTracker & operator=(controllerInputTracker &&other) noexcept=default
controllerInputTracker()=default
controllerInputTracker(controllerInputTracker &&other) noexcept=default
controllerInputTracker & operator=(const controllerInputTracker &other)
std::array< ControllerStick, 6 > controllerSticks
Definition controllerInputTracker.h:53
auto initialize() -> void
Fills out the two arrays using information from Controllers.
Definition controllerInputTracker.cpp:60