]> git.localhorst.tv Git - orbi.git/blob - src/app/Controller.h
simple controller
[orbi.git] / src / app / Controller.h
1 #ifndef ORBI_CONTROLLER_H_
2 #define ORBI_CONTROLLER_H_
3
4 namespace orbi {
5
6 class Entity;
7
8 class Controller {
9
10 public:
11         explicit Controller(Entity * = nullptr);
12
13         void Control(Entity &ent) { e = &ent; }
14         void Relinquish() { e = nullptr; }
15
16         bool Controlling() const { return e; }
17         const Entity &Controlled() const { return *e; }
18
19         void Update(float delta);
20
21 public:
22         void MoveLeft();
23         void StopLeft();
24         void MoveRight();
25         void StopRight();
26
27         void StartJump();
28         void StopJump();
29
30 private:
31         Entity *e;
32
33         int moving;
34         float moveAcc;
35         float moveTerm;
36
37         bool jumping;
38         float jumpVel;
39
40 };
41
42 }
43
44 #endif