diff options
Diffstat (limited to 'src/components/ponderable.h')
-rw-r--r-- | src/components/ponderable.h | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/src/components/ponderable.h b/src/components/ponderable.h new file mode 100644 index 0000000..e21cbab --- /dev/null +++ b/src/components/ponderable.h | |||
@@ -0,0 +1,83 @@ | |||
1 | #ifndef TANGIBLE_H_746DB3EE | ||
2 | #define TANGIBLE_H_746DB3EE | ||
3 | |||
4 | #include "component.h" | ||
5 | |||
6 | class PonderableComponent : public Component { | ||
7 | public: | ||
8 | |||
9 | enum class Type { | ||
10 | vacuumed, | ||
11 | freefalling | ||
12 | }; | ||
13 | |||
14 | PonderableComponent(Type type) : type_(type) | ||
15 | { | ||
16 | } | ||
17 | |||
18 | inline Type getType() const | ||
19 | { | ||
20 | return type_; | ||
21 | } | ||
22 | |||
23 | inline double getVelocityX() const | ||
24 | { | ||
25 | return velX_; | ||
26 | } | ||
27 | |||
28 | inline void setVelocityX(double v) | ||
29 | { | ||
30 | velX_ = v; | ||
31 | } | ||
32 | |||
33 | inline double getVelocityY() const | ||
34 | { | ||
35 | return velY_; | ||
36 | } | ||
37 | |||
38 | inline void setVelocityY(double v) | ||
39 | { | ||
40 | velY_ = v; | ||
41 | } | ||
42 | |||
43 | inline double getAccelX() const | ||
44 | { | ||
45 | return accelX_; | ||
46 | } | ||
47 | |||
48 | inline void setAccelX(double v) | ||
49 | { | ||
50 | accelX_ = v; | ||
51 | } | ||
52 | |||
53 | inline double getAccelY() const | ||
54 | { | ||
55 | return accelY_; | ||
56 | } | ||
57 | |||
58 | inline void setAccelY(double v) | ||
59 | { | ||
60 | accelY_ = v; | ||
61 | } | ||
62 | |||
63 | inline bool isGrounded() const | ||
64 | { | ||
65 | return grounded_; | ||
66 | } | ||
67 | |||
68 | inline void setGrounded(bool v) | ||
69 | { | ||
70 | grounded_ = v; | ||
71 | } | ||
72 | |||
73 | private: | ||
74 | |||
75 | double velX_ = 0.0; | ||
76 | double velY_ = 0.0; | ||
77 | double accelX_ = 0.0; | ||
78 | double accelY_ = 0.0; | ||
79 | Type type_ = Type::vacuumed; | ||
80 | bool grounded_ = false; | ||
81 | }; | ||
82 | |||
83 | #endif /* end of include guard: TANGIBLE_H_746DB3EE */ | ||