summaryrefslogtreecommitdiffstats
path: root/examples/animation/stickman/lifecycle.h
diff options
context:
space:
mode:
authorAlexis Menard <alexis.menard@nokia.com>2009-04-17 14:06:06 (GMT)
committerAlexis Menard <alexis.menard@nokia.com>2009-04-17 14:06:06 (GMT)
commitf15b8a83e2e51955776a3f07cb85ebfc342dd8ef (patch)
treec5dc684986051654898db11ce73e03b9fec8db99 /examples/animation/stickman/lifecycle.h
downloadQt-f15b8a83e2e51955776a3f07cb85ebfc342dd8ef.zip
Qt-f15b8a83e2e51955776a3f07cb85ebfc342dd8ef.tar.gz
Qt-f15b8a83e2e51955776a3f07cb85ebfc342dd8ef.tar.bz2
Initial import of statemachine branch from the old kinetic repository
Diffstat (limited to 'examples/animation/stickman/lifecycle.h')
-rw-r--r--examples/animation/stickman/lifecycle.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/examples/animation/stickman/lifecycle.h b/examples/animation/stickman/lifecycle.h
new file mode 100644
index 0000000..437e935
--- /dev/null
+++ b/examples/animation/stickman/lifecycle.h
@@ -0,0 +1,40 @@
+#ifndef LIFECYCLE_H
+#define LIFECYCLE_H
+
+#include <Qt>
+
+class StickMan;
+class QStateMachine;
+class QAnimationGroup;
+class QState;
+class QAbstractState;
+class QAbstractTransition;
+class GraphicsView;
+class LifeCycle
+{
+public:
+ LifeCycle(StickMan *stickMan, GraphicsView *keyEventReceiver);
+ ~LifeCycle();
+
+ void setDeathAnimation(const QString &fileName);
+ void setResetKey(Qt::Key key);
+ void addActivity(const QString &fileName, Qt::Key key);
+
+ void start();
+
+private:
+ void connectByAnimation(QState *s1, QAbstractState *s2,
+ QAbstractTransition *transition = 0);
+ QState *makeState(QState *parentState, const QString &animationFileName);
+
+ StickMan *m_stickMan;
+ QStateMachine *m_machine;
+ QAnimationGroup *m_animationGroup;
+ GraphicsView *m_keyReceiver;
+
+ QState *m_alive;
+ QState *m_dead;
+ QState *m_idle;
+};
+
+#endif