diff options
Diffstat (limited to 'src/components/controllable.h')
| -rw-r--r-- | src/components/controllable.h | 92 | 
1 files changed, 92 insertions, 0 deletions
| diff --git a/src/components/controllable.h b/src/components/controllable.h new file mode 100644 index 0000000..1b12985 --- /dev/null +++ b/src/components/controllable.h | |||
| @@ -0,0 +1,92 @@ | |||
| 1 | #ifndef CONTROLLABLE_H_4E0B85B4 | ||
| 2 | #define CONTROLLABLE_H_4E0B85B4 | ||
| 3 | |||
| 4 | #include "component.h" | ||
| 5 | #include "renderer/gl.h" | ||
| 6 | |||
| 7 | class ControllableComponent : public Component { | ||
| 8 | public: | ||
| 9 | |||
| 10 | inline int getLeftKey() const | ||
| 11 | { | ||
| 12 | return leftKey_; | ||
| 13 | } | ||
| 14 | |||
| 15 | inline void setLeftKey(int k) | ||
| 16 | { | ||
| 17 | leftKey_ = k; | ||
| 18 | } | ||
| 19 | |||
| 20 | inline int getRightKey() const | ||
| 21 | { | ||
| 22 | return rightKey_; | ||
| 23 | } | ||
| 24 | |||
| 25 | inline void setRightKey(int k) | ||
| 26 | { | ||
| 27 | rightKey_ = k; | ||
| 28 | } | ||
| 29 | |||
| 30 | inline int getJumpKey() const | ||
| 31 | { | ||
| 32 | return jumpKey_; | ||
| 33 | } | ||
| 34 | |||
| 35 | inline void setJumpKey(int k) | ||
| 36 | { | ||
| 37 | jumpKey_ = k; | ||
| 38 | } | ||
| 39 | |||
| 40 | inline int getDropKey() const | ||
| 41 | { | ||
| 42 | return dropKey_; | ||
| 43 | } | ||
| 44 | |||
| 45 | inline void setDropKey(int k) | ||
| 46 | { | ||
| 47 | dropKey_ = k; | ||
| 48 | } | ||
| 49 | |||
| 50 | inline bool isFrozen() const | ||
| 51 | { | ||
| 52 | return frozen_; | ||
| 53 | } | ||
| 54 | |||
| 55 | inline void setFrozen(bool f) | ||
| 56 | { | ||
| 57 | frozen_ = f; | ||
| 58 | } | ||
| 59 | |||
| 60 | inline bool isHoldingLeft() const | ||
| 61 | { | ||
| 62 | return holdingLeft_; | ||
| 63 | } | ||
| 64 | |||
| 65 | inline void setHoldingLeft(bool f) | ||
| 66 | { | ||
| 67 | holdingLeft_ = f; | ||
| 68 | } | ||
| 69 | |||
| 70 | inline bool isHoldingRight() const | ||
| 71 | { | ||
| 72 | return holdingRight_; | ||
| 73 | } | ||
| 74 | |||
| 75 | inline void setHoldingRight(bool f) | ||
| 76 | { | ||
| 77 | holdingRight_ = f; | ||
| 78 | } | ||
| 79 | |||
| 80 | private: | ||
| 81 | |||
| 82 | int leftKey_ = GLFW_KEY_LEFT; | ||
| 83 | int rightKey_ = GLFW_KEY_RIGHT; | ||
| 84 | int jumpKey_ = GLFW_KEY_UP; | ||
| 85 | int dropKey_ = GLFW_KEY_DOWN; | ||
| 86 | |||
| 87 | bool frozen_ = false; | ||
| 88 | bool holdingLeft_ = false; | ||
| 89 | bool holdingRight_ = false; | ||
| 90 | }; | ||
| 91 | |||
| 92 | #endif /* end of include guard: CONTROLLABLE_H_4E0B85B4 */ | ||
