]> git.localhorst.tv Git - orbi.git/blobdiff - src/app/Controller.h
simple controller
[orbi.git] / src / app / Controller.h
diff --git a/src/app/Controller.h b/src/app/Controller.h
new file mode 100644 (file)
index 0000000..356d78e
--- /dev/null
@@ -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