summaryrefslogtreecommitdiffstats
path: root/examples/statemachine/tankgame/mainwindow.h
blob: 622dabe75e93f36b30817925a25f95fd4d3081ac (plain)
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
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QTime>

class QGraphicsScene;
class QStateMachine;
class QState;
class TankItem;
class MainWindow: public QMainWindow
{
    Q_OBJECT
    Q_PROPERTY(bool started READ started WRITE setStarted)
public:
    MainWindow(QWidget *parent = 0);
    ~MainWindow();

    void setStarted(bool b) { m_started = b; }
    bool started() const { return m_started; }

public slots:
    void addTank();
    void addRocket();
    void runStep();

signals:
    void mapFull();

private:
    void init();
    void addWall(const QRectF &wall);

    QGraphicsScene *m_scene;
    
    QStateMachine *m_machine;
    QState *m_runningState;

    QList<TankItem *> m_spawns;
    QTime m_time;
    
    bool m_started : 1;
};

#endif