ControllerInterface: Move axes/constants to derived class

This commit is contained in:
Connor McLaughlin
2021-05-07 20:39:46 +10:00
parent 9ff1f153be
commit e5a6103f74
5 changed files with 19 additions and 15 deletions

View File

@ -43,6 +43,12 @@ public:
bool ProcessSDLEvent(const union SDL_Event* event);
private:
enum : int
{
MAX_NUM_AXES = 7,
MAX_NUM_BUTTONS = 16,
};
struct ControllerData
{
void* haptic;
@ -56,9 +62,9 @@ private:
// TODO: Turn to vectors to support arbitrary amounts of buttons and axes (for Joysticks)
// Preferably implement a simple "flat map", an ordered view over a vector
std::array<std::array<AxisCallback, 3>, MAX_NUM_AXISES> axis_mapping;
std::array<std::array<AxisCallback, 3>, MAX_NUM_AXES> axis_mapping;
std::array<ButtonCallback, MAX_NUM_BUTTONS> button_mapping;
std::array<std::array<ButtonCallback, 2>, MAX_NUM_AXISES> axis_button_mapping;
std::array<std::array<ButtonCallback, 2>, MAX_NUM_AXES> axis_button_mapping;
std::array<AxisCallback, MAX_NUM_BUTTONS> button_axis_mapping;
std::vector<std::array<ButtonCallback, 4>> hat_button_mapping;