summary refs log tree commit diff stats
path: root/src/components/ponderable.h
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2018-02-11 12:34:52 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2018-02-11 12:34:52 -0500
commit77be863f4f15d2481a64e4e8dadb4060a6e4e590 (patch)
treeca571702d2148a75b5b847e77d26270257f54ebc /src/components/ponderable.h
parent1400ade977e13e3b535d3c2fddb6e15de3c9b5a5 (diff)
downloadtherapy-77be863f4f15d2481a64e4e8dadb4060a6e4e590.tar.gz
therapy-77be863f4f15d2481a64e4e8dadb4060a6e4e590.tar.bz2
therapy-77be863f4f15d2481a64e4e8dadb4060a6e4e590.zip
Implemented map rendering and basic collision
Only wall and platform collision currently works, and map edges are not currently implemented.
Diffstat (limited to 'src/components/ponderable.h')
-rw-r--r--src/components/ponderable.h23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/components/ponderable.h b/src/components/ponderable.h index dfbf908..ac759b6 100644 --- a/src/components/ponderable.h +++ b/src/components/ponderable.h
@@ -6,13 +6,27 @@
6class PonderableComponent : public Component { 6class PonderableComponent : public Component {
7public: 7public:
8 8
9 enum class state { 9 enum class Type {
10 vacuumed,
11 freefalling
12 };
13
14 enum class State {
10 grounded, 15 grounded,
11 jumping, 16 jumping,
12 falling, 17 falling,
13 dropping 18 dropping
14 }; 19 };
15 20
21 PonderableComponent(Type type) : type_(type)
22 {
23 }
24
25 inline Type getType() const
26 {
27 return type_;
28 }
29
16 inline double getVelocityX() const 30 inline double getVelocityX() const
17 { 31 {
18 return velX_; 32 return velX_;
@@ -53,12 +67,12 @@ public:
53 accelY_ = v; 67 accelY_ = v;
54 } 68 }
55 69
56 inline state getState() const 70 inline State getState() const
57 { 71 {
58 return state_; 72 return state_;
59 } 73 }
60 74
61 inline void setState(state arg) 75 inline void setState(State arg)
62 { 76 {
63 state_ = arg; 77 state_ = arg;
64 } 78 }
@@ -69,7 +83,8 @@ private:
69 double velY_ = 0.0; 83 double velY_ = 0.0;
70 double accelX_ = 0.0; 84 double accelX_ = 0.0;
71 double accelY_ = 0.0; 85 double accelY_ = 0.0;
72 state state_ = state::grounded; 86 Type type_ = Type::vacuumed;
87 State state_ = State::grounded;
73}; 88};
74 89
75#endif /* end of include guard: TANGIBLE_H_746DB3EE */ 90#endif /* end of include guard: TANGIBLE_H_746DB3EE */