1234567891011121314151617181920212223242526272829303132333435 |
- #ifndef KEY_H
- #define KEY_H
- #include "GameEngine.h"
- class Key
- {
- public:
- static bool isDown(int mapping);
- static bool isReleased(int mapping);
- static unsigned int getDownTime(int mapping);
- static void resetDownTime(int mapping);
- static bool map(int mapping, int key);
-
- friend GameEngine;
- private:
- Key();
-
- static const int NUMBER_OF_KEYS = GLFW_KEY_LAST + 1;
- static bool isInRange(int i);
- static void init();
- static void tick();
- static bool press(int key);
- static bool release(int key);
-
- bool down = false;
- bool shouldRelease = false;
- unsigned int downTime = 0;
-
- static Key keyArray[NUMBER_OF_KEYS];
- static int mappingArray[NUMBER_OF_KEYS];
- };
- #endif
|