summaryrefslogtreecommitdiffstats
path: root/examples/animation/sub-attaq
diff options
context:
space:
mode:
Diffstat (limited to 'examples/animation/sub-attaq')
-rw-r--r--examples/animation/sub-attaq/boat.cpp10
-rw-r--r--examples/animation/sub-attaq/bomb.cpp4
-rw-r--r--examples/animation/sub-attaq/graphicsscene.cpp8
-rw-r--r--examples/animation/sub-attaq/states.cpp8
-rw-r--r--examples/animation/sub-attaq/submarine.cpp6
-rw-r--r--examples/animation/sub-attaq/torpedo.cpp4
6 files changed, 20 insertions, 20 deletions
diff --git a/examples/animation/sub-attaq/boat.cpp b/examples/animation/sub-attaq/boat.cpp
index d286be5..68e646e 100644
--- a/examples/animation/sub-attaq/boat.cpp
+++ b/examples/animation/sub-attaq/boat.cpp
@@ -142,14 +142,14 @@ Boat::Boat(QGraphicsItem * parent, Qt::WindowFlags wFlags)
//We setup the state machien of the boat
machine = new QStateMachine(this);
- QState *moving = new QState(machine->rootState());
+ QState *moving = new QState(machine);
StopState *stopState = new StopState(this, moving);
machine->setInitialState(moving);
moving->setInitialState(stopState);
MoveStateRight *moveStateRight = new MoveStateRight(this, moving);
MoveStateLeft *moveStateLeft = new MoveStateLeft(this, moving);
- LaunchStateRight *launchStateRight = new LaunchStateRight(this, machine->rootState());
- LaunchStateLeft *launchStateLeft = new LaunchStateLeft(this, machine->rootState());
+ LaunchStateRight *launchStateRight = new LaunchStateRight(this, machine);
+ LaunchStateLeft *launchStateLeft = new LaunchStateLeft(this, machine);
//then setup the transitions for the rightMove state
KeyStopTransition *leftStopRight = new KeyStopTransition(this, QEvent::KeyPress, Qt::Key_Left);
@@ -216,10 +216,10 @@ Boat::Boat(QGraphicsItem * parent, Qt::WindowFlags wFlags)
launchStateLeft->addTransition(historyState);
launchStateRight->addTransition(historyState);
- QFinalState *final = new QFinalState(machine->rootState());
+ QFinalState *final = new QFinalState(machine);
//This state play the destroyed animation
- QAnimationState *destroyedState = new QAnimationState(machine->rootState());
+ QAnimationState *destroyedState = new QAnimationState(machine);
destroyedState->setAnimation(destroyAnimation);
//Play a nice animation when the boat is destroyed
diff --git a/examples/animation/sub-attaq/bomb.cpp b/examples/animation/sub-attaq/bomb.cpp
index 454970a..e92a723 100644
--- a/examples/animation/sub-attaq/bomb.cpp
+++ b/examples/animation/sub-attaq/bomb.cpp
@@ -85,11 +85,11 @@ void Bomb::launch(Bomb::Direction direction)
QStateMachine *machine = new QStateMachine(this);
//This state is when the launch animation is playing
- QAnimationState *launched = new QAnimationState(machine->rootState());
+ QAnimationState *launched = new QAnimationState(machine);
launched->setAnimation(launchAnimation);
//End
- QFinalState *final = new QFinalState(machine->rootState());
+ QFinalState *final = new QFinalState(machine);
machine->setInitialState(launched);
diff --git a/examples/animation/sub-attaq/graphicsscene.cpp b/examples/animation/sub-attaq/graphicsscene.cpp
index bd37ce2..fcbc1b3 100644
--- a/examples/animation/sub-attaq/graphicsscene.cpp
+++ b/examples/animation/sub-attaq/graphicsscene.cpp
@@ -230,17 +230,17 @@ void GraphicsScene::setupScene(const QList<QAction *> &actions)
QStateMachine *machine = new QStateMachine(this);
//This state is when the player is playing
- PlayState *gameState = new PlayState(this,machine->rootState());
+ PlayState *gameState = new PlayState(this,machine);
//Final state
- QFinalState *final = new QFinalState(machine->rootState());
+ QFinalState *final = new QFinalState(machine);
//Animation when the player enter in the game
- QAnimationState *lettersMovingState = new QAnimationState(machine->rootState());
+ QAnimationState *lettersMovingState = new QAnimationState(machine);
lettersMovingState->setAnimation(lettersGroupMoving);
//Animation when the welcome screen disappear
- QAnimationState *lettersFadingState = new QAnimationState(machine->rootState());
+ QAnimationState *lettersFadingState = new QAnimationState(machine);
lettersFadingState->setAnimation(lettersGroupFading);
//if new game then we fade out the welcome screen and start playing
diff --git a/examples/animation/sub-attaq/states.cpp b/examples/animation/sub-attaq/states.cpp
index 81fd2de..d63737f 100644
--- a/examples/animation/sub-attaq/states.cpp
+++ b/examples/animation/sub-attaq/states.cpp
@@ -83,7 +83,7 @@ void PlayState::onEntry(QEvent *)
machine = new QStateMachine(this);
//This state is when player is playing
- LevelState *levelState = new LevelState(scene, this, machine->rootState());
+ LevelState *levelState = new LevelState(scene, this, machine);
//This state is when the player is actually playing but the game is not paused
QState *playingState = new QState(levelState);
@@ -105,10 +105,10 @@ void PlayState::onEntry(QEvent *)
pauseState->addTransition(pressPpause);
//This state is when player have lost
- LostState *lostState = new LostState(scene, this, machine->rootState());
+ LostState *lostState = new LostState(scene, this, machine);
//This state is when player have won
- WinState *winState = new WinState(scene, this, machine->rootState());
+ WinState *winState = new WinState(scene, this, machine);
//The boat has been destroyed then the game is finished
levelState->addTransition(scene->boat, SIGNAL(boatExecutionFinished()),lostState);
@@ -136,7 +136,7 @@ void PlayState::onEntry(QEvent *)
machine->setInitialState(levelState);
//Final state
- QFinalState *final = new QFinalState(machine->rootState());
+ QFinalState *final = new QFinalState(machine);
//This transition is triggered when the player press space after completing a level
CustomSpaceTransition *spaceTransition = new CustomSpaceTransition(scene->views().at(0), this, QEvent::KeyPress, Qt::Key_Space);
diff --git a/examples/animation/sub-attaq/submarine.cpp b/examples/animation/sub-attaq/submarine.cpp
index 04b7916..78a9539 100644
--- a/examples/animation/sub-attaq/submarine.cpp
+++ b/examples/animation/sub-attaq/submarine.cpp
@@ -115,7 +115,7 @@ SubMarine::SubMarine(int type, const QString &name, int points, QGraphicsItem *
QStateMachine *machine = new QStateMachine(this);
//This state is when the boat is moving/rotating
- QState *moving = new QState(machine->rootState());
+ QState *moving = new QState(machine);
//This state is when the boat is moving from left to right
MovementState *movement = new MovementState(this, moving);
@@ -132,7 +132,7 @@ SubMarine::SubMarine(int type, const QString &name, int points, QGraphicsItem *
machine->setInitialState(moving);
//End
- QFinalState *final = new QFinalState(machine->rootState());
+ QFinalState *final = new QFinalState(machine);
//If the moving animation is finished we move to the return state
movement->addTransition(movement, SIGNAL(animationFinished()), rotation);
@@ -141,7 +141,7 @@ SubMarine::SubMarine(int type, const QString &name, int points, QGraphicsItem *
rotation->addTransition(rotation, SIGNAL(animationFinished()), movement);
//This state play the destroyed animation
- QAnimationState *destroyedState = new QAnimationState(machine->rootState());
+ QAnimationState *destroyedState = new QAnimationState(machine);
destroyedState->setAnimation(setupDestroyAnimation(this));
//Play a nice animation when the submarine is destroyed
diff --git a/examples/animation/sub-attaq/torpedo.cpp b/examples/animation/sub-attaq/torpedo.cpp
index 5ef237a..fe79488 100644
--- a/examples/animation/sub-attaq/torpedo.cpp
+++ b/examples/animation/sub-attaq/torpedo.cpp
@@ -74,11 +74,11 @@ void Torpedo::launch()
QStateMachine *machine = new QStateMachine(this);
//This state is when the launch animation is playing
- QAnimationState *launched = new QAnimationState(machine->rootState());
+ QAnimationState *launched = new QAnimationState(machine);
launched->setAnimation(launchAnimation);
//End
- QFinalState *final = new QFinalState(machine->rootState());
+ QFinalState *final = new QFinalState(machine);
machine->setInitialState(launched);