-
Notifications
You must be signed in to change notification settings - Fork 0
/
controller.h
56 lines (43 loc) · 1.14 KB
/
controller.h
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
#ifndef CONTROLLER_H
#define CONTROLLER_H
#include "ammo.h"
#include "genalg.h"
#include "tank.h"
#include "utils.h"
#include <QGraphicsEllipseItem>
#include <QTimer>
#include <QDebug>
class Controller: public QObject
{
Q_OBJECT
public:
Controller(QGraphicsScene* scene);
const Tank::TankVector& get_tanks() const;
const AmmoVector& get_ammo() const;
void stop_loop() { m_timer.stop(); }
void set_interval(int interval) { m_timer.setInterval(interval); }
public slots:
void update();
signals:
void start_loop(int fps);
private:
// *********** VARS ***********
QGraphicsScene* m_scene;
int m_num_tanks;
int m_num_ammo;
Tank::TankVector m_tanks;
AmmoVector m_ammo;
QTimer m_timer;
TimeDelta m_time_delta;
int m_tick_count;
GenAlg m_gen_alg;
QGraphicsEllipseItem m_selected_tank;
QGraphicsEllipseItem m_best_tank;
QGraphicsEllipseItem m_closest_ammo;
// *********** Functions ***********
Tank::TankVector create_tanks();
AmmoVector create_ammo();
QVector<Genome> get_tank_genomes() const;
void set_tank_genomes(QVector<Genome>&);
};
#endif // CONTROLLER_H