-
Notifications
You must be signed in to change notification settings - Fork 0
/
simulation.hpp
75 lines (59 loc) · 1.46 KB
/
simulation.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include <QVector>
#include <QPointF>
#include <QGraphicsScene>
#include <QObject>
class QTimer;
class QMenu;
class QAction;
class QGraphicsSceneMouseEvent;
class QKeyEvent;
class MainWindow;
class Boid;
class Flock;
class Landscape;
class LandscapeScene;
class Simulation : QObject {
Q_OBJECT
public:
Simulation(
int numBoids,
Landscape *landscapeView,
LandscapeScene *landscapeScene
);
~Simulation();
void initialiseWeights();
void setupTime();
void initialiseBoids(int numBoids);
void toggleScatter();
void toggleMatch();
void toggleAvoid();
void toggleTails();
void togglePause();
int ticksSinceStart();
void addBoid();
void removeBoid( );
void addBoid2( );
void removeBoid2( );
public slots:
void updateBoids();
private:
Flock *flock1;
Flock *flock2;
QTimer *timer_;
bool showTails_;
int moveWeight_;
static const int DEFAULT_MOVE_WEIGHT = 1;
static const int ALTERNATE_MOVE_WEIGHT = -5;
int matchWeight_;
static const int DEFAULT_MATCH_WEIGHT = 1;
static const int ALTERNATE_MATCH_WEIGHT = -1;
int avoidWeight_;
static const int DEFAULT_AVOID_WEIGHT = 1;
static const int ALTERNATE_AVOID_WEIGHT = -1;
int targetWeight_;
static const int DEFAULT_TARGET_WEIGHT = 1;
static const int ALTERNATE_TARGET_WEIGHT = 1;
int ticksSinceStart_;
Landscape *landscapeView_;
LandscapeScene *landscapeScene_;
};