summaryrefslogtreecommitdiffstats
path: root/examples/statemachine/tankgame/mainwindow.h
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-05-20 04:51:29 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-05-20 04:51:29 (GMT)
commite484ee27f929aca738a269947237d834dab89b39 (patch)
tree216f95598411eb4c72141308973695d5e0d8b372 /examples/statemachine/tankgame/mainwindow.h
parentded29009f766a8373193d94bcb8309270f66a266 (diff)
parentd1f1f2c91f63609ca1ffad32efdd6590f9f0ce6a (diff)
downloadQt-e484ee27f929aca738a269947237d834dab89b39.zip
Qt-e484ee27f929aca738a269947237d834dab89b39.tar.gz
Qt-e484ee27f929aca738a269947237d834dab89b39.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'examples/statemachine/tankgame/mainwindow.h')
-rw-r--r--examples/statemachine/tankgame/mainwindow.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/examples/statemachine/tankgame/mainwindow.h b/examples/statemachine/tankgame/mainwindow.h
new file mode 100644
index 0000000..40e1595
--- /dev/null
+++ b/examples/statemachine/tankgame/mainwindow.h
@@ -0,0 +1,49 @@
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QMainWindow>
+#include <QTime>
+
+class QGraphicsScene;
+class QStateMachine;
+class QState;
+class GameOverTransition;
+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();
+ void gameOver();
+
+signals:
+ void mapFull();
+
+private:
+ void init();
+ void addWall(const QRectF &wall);
+
+ QGraphicsScene *m_scene;
+
+ QStateMachine *m_machine;
+ QState *m_runningState;
+ GameOverTransition *m_gameOverTransition;
+
+ QList<TankItem *> m_spawns;
+ QTime m_time;
+
+ bool m_started : 1;
+};
+
+#endif
+