X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fapp%2FController.h;fp=src%2Fapp%2FController.h;h=356d78ef3c59613e3876eb7c6eae39f8e9db6559;hb=dbc08d84d9de1a77cba0dd97e4701f4ac99d056e;hp=0000000000000000000000000000000000000000;hpb=79a34acdc1beff20213f03c326a4aa03c5d47c92;p=orbi.git diff --git a/src/app/Controller.h b/src/app/Controller.h new file mode 100644 index 0000000..356d78e --- /dev/null +++ b/src/app/Controller.h @@ -0,0 +1,44 @@ +#ifndef ORBI_CONTROLLER_H_ +#define ORBI_CONTROLLER_H_ + +namespace orbi { + +class Entity; + +class Controller { + +public: + explicit Controller(Entity * = nullptr); + + void Control(Entity &ent) { e = &ent; } + void Relinquish() { e = nullptr; } + + bool Controlling() const { return e; } + const Entity &Controlled() const { return *e; } + + void Update(float delta); + +public: + void MoveLeft(); + void StopLeft(); + void MoveRight(); + void StopRight(); + + void StartJump(); + void StopJump(); + +private: + Entity *e; + + int moving; + float moveAcc; + float moveTerm; + + bool jumping; + float jumpVel; + +}; + +} + +#endif