diff options
| author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-05-17 15:55:37 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-05-17 15:55:37 -0400 |
| commit | 90aadf3844386824140a20d7fbb847bc16009a94 (patch) | |
| tree | 6f83fce90e71abb22b1a8f3e09c79963b2a34d5d /src/components/controllable.h | |
| parent | bc63fa57ced1c7329f7fdcfd168eaf7e290158bc (diff) | |
| parent | 86f0106d0523825549f1e74b835688c78a10cf6c (diff) | |
| download | therapy-90aadf3844386824140a20d7fbb847bc16009a94.tar.gz therapy-90aadf3844386824140a20d7fbb847bc16009a94.tar.bz2 therapy-90aadf3844386824140a20d7fbb847bc16009a94.zip | |
Merge pull request #7 from hatkirby/es-rewrite
The ECS rewrite exceeds the original branch in functionality, so it is time to merge it in.
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 */ | ||
