summary refs log tree commit diff stats
path: root/src/components/controllable.h
blob: 1b12985beb7424804e2dcaada9417c90251d1a8f (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
#ifndef CONTROLLABLE_H_4E0B85B4
#define CONTROLLABLE_H_4E0B85B4

#include "component.h"
#include "renderer/gl.h"

class ControllableComponent : public Component {
public:

  inline int getLeftKey() const
  {
    return leftKey_;
  }

  inline void setLeftKey(int k)
  {
    leftKey_ = k;
  }

  inline int getRightKey() const
  {
    return rightKey_;
  }

  inline void setRightKey(int k)
  {
    rightKey_ = k;
  }

  inline int getJumpKey() const
  {
    return jumpKey_;
  }

  inline void setJumpKey(int k)
  {
    jumpKey_ = k;
  }

  inline int getDropKey() const
  {
    return dropKey_;
  }

  inline void setDropKey(int k)
  {
    dropKey_ = k;
  }

  inline bool isFrozen() const
  {
    return frozen_;
  }

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

  inline bool isHoldingLeft() const
  {
    return holdingLeft_;
  }

  inline void setHoldingLeft(bool f)
  {
    holdingLeft_ = f;
  }

  inline bool isHoldingRight() const
  {
    return holdingRight_;
  }

  inline void setHoldingRight(bool f)
  {
    holdingRight_ = f;
  }

private:

  int leftKey_ = GLFW_KEY_LEFT;
  int rightKey_ = GLFW_KEY_RIGHT;
  int jumpKey_ = GLFW_KEY_UP;
  int dropKey_ = GLFW_KEY_DOWN;

  bool frozen_ = false;
  bool holdingLeft_ = false;
  bool holdingRight_ = false;
};

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