Controller.h 675 B

1234567891011121314151617181920212223242526272829303132333435
  1. #ifndef CONTROLLER_H
  2. #define CONTROLLER_H
  3. #include <GL/glew.h>
  4. #include <GLFW/glfw3.h>
  5. #include "utils/Array.h"
  6. #include "input/Button.h"
  7. class Controller final {
  8. int index;
  9. Array<Button, 2 + GLFW_JOYSTICK_LAST> buttons;
  10. public:
  11. Controller();
  12. void tick();
  13. bool isDown(int button) const;
  14. int getDownTime(int button) const;
  15. bool isUp(int button) const;
  16. int getUpTime(int button) const;
  17. private:
  18. int getRangeMask(int button) const;
  19. /*bool findController();
  20. void reset();
  21. void increment(uint button, const u8* mapping, uint index);
  22. void increment(uint button, bool notReleased);
  23. uint activeController;*/
  24. };
  25. #endif