summaryrefslogtreecommitdiffstats
path: root/examples/animation/sub-attaq/states.h
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-04-29 12:23:54 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-04-29 12:23:54 (GMT)
commiteea1c9f34b9b98c55c48f9ed1dbef9a9883c6f2a (patch)
tree2710760fe8a79cdeda9555debd6d520d6cee9a96 /examples/animation/sub-attaq/states.h
parent20702b4a5992a87e8edc40949ea80fa625a3fc8c (diff)
parent36aa9e0468bfa874679dd94b2d50850a1dd7a1d1 (diff)
downloadQt-eea1c9f34b9b98c55c48f9ed1dbef9a9883c6f2a.zip
Qt-eea1c9f34b9b98c55c48f9ed1dbef9a9883c6f2a.tar.gz
Qt-eea1c9f34b9b98c55c48f9ed1dbef9a9883c6f2a.tar.bz2
Merge branch 'kinetic-animations' into kinetic-statemachine
Conflicts: examples/animation/sub-attaq/states.cpp
Diffstat (limited to 'examples/animation/sub-attaq/states.h')
-rw-r--r--examples/animation/sub-attaq/states.h39
1 files changed, 34 insertions, 5 deletions
diff --git a/examples/animation/sub-attaq/states.h b/examples/animation/sub-attaq/states.h
index 52d4ffa..ec69ae7 100644
--- a/examples/animation/sub-attaq/states.h
+++ b/examples/animation/sub-attaq/states.h
@@ -47,12 +47,14 @@
#include "qstate.h"
#include "qsignaltransition.h"
#include "qpropertyanimation.h"
+#include "qkeyeventtransition.h"
#else
-#include <QState>
-#include <QSignalTransition>
-#include <QPropertyAnimation>
+#include <QtCore/QState>
+#include <QtCore/QSignalTransition>
+#include <QtCore/QPropertyAnimation>
+# include <QtGui/QKeyEventTransition>
#endif
-#include <QSet>
+#include <QtCore/QSet>
class GraphicsScene;
class Boat;
@@ -64,7 +66,6 @@ class PlayState : public QState
public:
PlayState(GraphicsScene *scene, QState *parent = 0);
~PlayState();
- void initializeLevel();
protected:
void onEntry();
@@ -79,8 +80,22 @@ private :
friend class UpdateScoreState;
friend class UpdateScoreTransition;
friend class WinTransition;
+ friend class CustomSpaceTransition;
friend class WinState;
friend class LostState;
+ friend class LevelState;
+};
+
+class LevelState : public QState
+{
+public:
+ LevelState(GraphicsScene *scene, PlayState *game, QState *parent = 0);
+protected:
+ void onEntry();
+private :
+ void initializeLevel();
+ GraphicsScene *scene;
+ PlayState *game;
};
class PauseState : public QState
@@ -140,6 +155,7 @@ protected:
virtual bool eventTest(QEvent *event) const;
private:
PlayState * game;
+ GraphicsScene *scene;
};
//These transtion test if we have won the game
@@ -151,6 +167,19 @@ protected:
virtual bool eventTest(QEvent *event) const;
private:
PlayState * game;
+ GraphicsScene *scene;
+};
+
+//These transtion is true if one level has been completed and the player want to continue
+ class CustomSpaceTransition : public QKeyEventTransition
+{
+public:
+ CustomSpaceTransition(QWidget *widget, PlayState *game, QEvent::Type type, int key);
+protected:
+ virtual bool eventTest(QEvent *event) const;
+private:
+ PlayState *game;
+ int key;
};
#endif // STATES_H