12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- #ifndef KEYS_H
- #define KEYS_H
- #include <iostream>
- #include <array>
- #include "common/utils/Types.h"
- class Keys final {
- public:
- class Key final {
- public:
- friend class Keys;
- bool isDown() const;
- bool isReleased() const;
- uint getDownTime() const;
- private:
- Key();
- Key(const Key&) = delete;
- Key(Key&&) = delete;
- Key& operator=(const Key&) = delete;
- Key& operator=(Key&&) = delete;
- int glfwKey;
- bool down;
- bool shouldRelease;
- uint downTime;
- };
- private:
- Key keys[15];
- public:
- Keys();
- const Key& left;
- const Key& right;
- const Key& up;
- const Key& down;
- const Key& jump;
- const Key& sneak;
- const Key& camLeft;
- const Key& camRight;
- const Key& camUp;
- const Key& camDown;
- const Key& test;
- const Key& test2;
- const Key& test3;
- const Key& test4;
- const Key& test5;
- void release(int key);
- void press(int key);
- void tick();
- private:
- Keys(const Keys&) = delete;
- Keys& operator=(const Keys&) = delete;
- Keys(Key&&) = delete;
- Keys& operator=(Keys&&) = delete;
- };
- std::ostream& operator<<(std::ostream& os, const Keys::Key& k);
- #endif
|