#ifndef BUTTONS_H #define BUTTONS_H #include "input/Button.h" #include "rendering/Window.h" #include "utils/Array.h" #include "utils/ArrayList.h" typedef ArrayList ButtonList; typedef ArrayList MouseList; class Buttons final { typedef Array DownArray; const Window& window; Button dummy; int activeController; ButtonList buttons; MouseList mouseButtons; double lastMouseX; double lastMouseY; double mouseX; double mouseY; struct Axis { float less; float greater; int lessIndex; int greaterIndex; Axis(); }; Array gamepadAxisToButton; Array gamepadToButton; public: Buttons(const Window& window); Button& add(int key, const char* name); Button& addMouse(int mouse, const char* name); void mapGamepadButton(const Button& button, int mapping); void mapGamepadAxis(const Button& button, float value, int index); void tick(); const ButtonList& get() const; const MouseList& getMouse() const; double getLastMouseX() const; double getLastMouseY() const; double getMouseX() const; double getMouseY() const; private: bool searchForGamepad(); void checkGamepad(DownArray& down); int searchButton(const Button& button) const; }; #endif