summary refs log tree commit diff stats
path: root/src/components/orientable.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/orientable.h')
-rw-r--r--src/components/orientable.h69
1 files changed, 69 insertions, 0 deletions
diff --git a/src/components/orientable.h b/src/components/orientable.h new file mode 100644 index 0000000..e356b78 --- /dev/null +++ b/src/components/orientable.h
@@ -0,0 +1,69 @@
1#ifndef ORIENTABLE_H_EDB6C4A1
2#define ORIENTABLE_H_EDB6C4A1
3
4#include "component.h"
5
6class OrientableComponent : public Component {
7public:
8
9 enum class WalkState {
10 still,
11 left,
12 right
13 };
14
15 enum class DropState {
16 none,
17 ready,
18 active
19 };
20
21 inline bool isFacingRight() const
22 {
23 return facingRight_;
24 }
25
26 inline void setFacingRight(bool v)
27 {
28 facingRight_ = v;
29 }
30
31 inline WalkState getWalkState() const
32 {
33 return walkState_;
34 }
35
36 inline void setWalkState(WalkState v)
37 {
38 walkState_ = v;
39 }
40
41 inline bool isJumping() const
42 {
43 return jumping_;
44 }
45
46 inline void setJumping(bool v)
47 {
48 jumping_ = v;
49 }
50
51 inline DropState getDropState() const
52 {
53 return dropState_;
54 }
55
56 inline void setDropState(DropState v)
57 {
58 dropState_ = v;
59 }
60
61private:
62
63 bool facingRight_ = false;
64 WalkState walkState_ = WalkState::still;
65 bool jumping_ = false;
66 DropState dropState_ = DropState::none;
67};
68
69#endif /* end of include guard: ORIENTABLE_H_EDB6C4A1 */