123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- #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[17];
- 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;
- const Key& test6;
- const Key& factor;
- 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
|