46 lines
743 B
C++
46 lines
743 B
C++
#ifndef DRONE_CONTROLLER_HH
|
|
#define DRONE_CONTROLLER_HH
|
|
|
|
#include "drone.hh"
|
|
|
|
#include <QJsonObject>
|
|
#include <QTimer>
|
|
|
|
|
|
class DroneController : public QObject {
|
|
Q_OBJECT
|
|
|
|
int framerate;
|
|
int frame = 0;
|
|
int duration = 0;
|
|
QVector<Drone> drones;
|
|
QTimer timer;
|
|
bool paused = true;
|
|
|
|
static bool collides(const Drone &a, const Drone &b, double radius);
|
|
|
|
public:
|
|
DroneController(const QJsonObject &json);
|
|
int getDuration() 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);
|
|
};
|
|
|
|
|
|
#endif
|