1234567891011121314151617181920212223242526272829303132333435363738 |
- #ifndef MOUSE_H
- #define MOUSE_H
- #include <GLFW/glfw3.h>
- class MouseManager
- {
- public:
- MouseManager();
-
- bool isDown(int mapping);
- bool isReleased(int mapping);
- unsigned int getDownTime(int mapping);
- void resetDownTime(int mapping);
- bool map(int mapping, int key);
-
- void tick();
- void press(int button);
- void release(int button);
-
- private:
- static const int NUMBER_OF_BUTTONS = GLFW_MOUSE_BUTTON_LAST + 1;
-
- bool isInRange(int i);
-
- struct Mouse
- {
- bool down = false;
- bool shouldRelease = false;
- unsigned int downTime = 0;
- };
-
- Mouse mouseArray[NUMBER_OF_BUTTONS];
- int mappingArray[NUMBER_OF_BUTTONS];
- };
- #endif
|