Input.h 795 B

1234567891011121314151617181920212223242526272829303132333435
  1. #ifndef INPUT_H
  2. #define INPUT_H
  3. #include <SDL/SDL_scancode.h>
  4. #include "Vec.h"
  5. #include "Math.h"
  6. #include "Object.h"
  7. /// Handle the SDL input
  8. class Input: public Object
  9. {
  10. public:
  11. Input(Object* parent);
  12. // keys and btns
  13. Vec<short> keys; ///< Shows the current key state. 0: unpressed, 1: pressed once, n is >1: kept pressed 'n' times continuously
  14. Vec<short> mouseBtns; ///< Mouse btns. Supporting 3 btns & wheel. @see keys
  15. void reset();
  16. void handleEvents();
  17. // mouse stuff
  18. Vec2 mousePosNdc; ///< The coords are in the NDC space
  19. Vec2 mousePos; ///< The coords are in the window space. (0, 0) is in the upper left corner
  20. Vec2 mouseVelocity;
  21. bool warpMouse;
  22. bool hideCursor;
  23. private:
  24. Object* parentApp; ///< Hold the parrent here cause we use him
  25. };
  26. #endif