aboutsummaryrefslogtreecommitdiff
path: root/src/drone_controller.hh
diff options
context:
space:
mode:
authorccolin2020-12-22 13:15:23 +0100
committerccolin2020-12-22 13:15:23 +0100
commit7fbe0814d52ba861a02b0560d4e6872845ef241e (patch)
tree1a8f6fd67b5d1606a58c0df00fbab285f1206d36 /src/drone_controller.hh
initial commit
Diffstat (limited to 'src/drone_controller.hh')
-rw-r--r--src/drone_controller.hh57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/drone_controller.hh b/src/drone_controller.hh
new file mode 100644
index 0000000..484cd57
--- /dev/null
+++ b/src/drone_controller.hh
@@ -0,0 +1,57 @@
+#ifndef DRONE_CONTROLLER_HH
+#define DRONE_CONTROLLER_HH
+
+#include <QJsonObject>
+#include <QVector3D>
+#include <QTimer>
+
+
+struct Waypoint {
+ int frame;
+ QVector3D pos;
+
+ Waypoint(unsigned frame, QVector3D pos);
+ Waypoint(const QJsonObject &json);
+};
+
+
+class Drone {
+ QVector<Waypoint> waypoints;
+
+public:
+ Drone(const QJsonObject &json);
+ const QVector<Waypoint> getWaypoints() const;
+};
+
+
+class DroneController : public QObject {
+ Q_OBJECT
+
+ int framerate;
+ int frame = 0;
+ int duration = 0;
+ QVector<Drone> drones;
+ QTimer timer;
+ bool paused = true;
+
+public:
+ DroneController(const QJsonObject &json);
+ ~DroneController();
+ int getDuration() const;
+
+signals:
+ void frameChanged(int frame);
+
+private slots:
+ void step();
+
+public slots:
+ void play();
+ void pause();
+ void suspend();
+ void resume();
+ void seek(int frame);
+};
+
+
+#endif