summary refs log tree commit diff stats
path: root/src/components/ponderable.h
blob: 78af25f6aec7c909bcda81419872a3039183c5b3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#ifndef TANGIBLE_H_746DB3EE
#define TANGIBLE_H_746DB3EE

#include "component.h"

class PonderableComponent : public Component {
public:

  enum class Type {
    vacuumed,
    freefalling
  };

  PonderableComponent(Type type) : type_(type)
  {
  }

  inline Type getType() const
  {
    return type_;
  }

  inline double getVelocityX() const
  {
    return velX_;
  }

  inline void setVelocityX(double v)
  {
    velX_ = v;
  }

  inline double getVelocityY() const
  {
    return velY_;
  }

  inline void setVelocityY(double v)
  {
    velY_ = v;
  }

  inline double getAccelX() const
  {
    return accelX_;
  }

  inline void setAccelX(double v)
  {
    accelX_ = v;
  }

  inline double getAccelY() const
  {
    return accelY_;
  }

  inline void setAccelY(double v)
  {
    accelY_ = v;
  }

  inline bool isGrounded() const
  {
    return grounded_;
  }

  inline void setGrounded(bool v)
  {
    grounded_ = v;
  }

  inline bool isFrozen() const
  {
    return frozen_;
  }

  inline void setFrozen(bool v)
  {
    frozen_ = v;
  }

  inline bool isCollidable() const
  {
    return collidable_;
  }

  inline void setCollidable(bool v)
  {
    collidable_ = v;
  }

private:

  double velX_ = 0.0;
  double velY_ = 0.0;
  double accelX_ = 0.0;
  double accelY_ = 0.0;
  Type type_ = Type::vacuumed;
  bool grounded_ = false;
  bool frozen_ = false;
  bool collidable_ = true;
};

#endif /* end of include guard: TANGIBLE_H_746DB3EE */