#ifndef DRONE_CONTROLLER_HH #define DRONE_CONTROLLER_HH #include "drone.hh" #include "opengl_widget.hh" #include #include #include class DroneController : public QObject, public Painter { Q_OBJECT int framerate; int frame = 0; int duration = 0; QVector drones; QTimer timer; bool paused = true; bool draw_spheres = false; double sphere_radius = 0; QTimer sphere_timer; QMap>> collisions; static OpenGLMesh *sphere; static const unsigned char sphere_neutral[]; static bool collides(const Drone &a, const Drone &b, double radius); public: DroneController(const QJsonObject &json); int getDuration() const; void draw(QOpenGLExtraFunctions *f) const; signals: void frameChanged(int frame); void playing(); void pausing(); void collision(int idA, int idB, int frame); private slots: void step(); public slots: void play(); void pause(); void suspend(); void resume(); void seek(int frame); void computeCollisions(double sphere_radius); void displaySpheres(double sphere_radius); }; #endif