#include <endsequence.hpp>
Inherits GameObject.
Inherited by EndSequenceFireworks, EndSequenceWalkLeft, and EndSequenceWalkRight.
Public Member Functions | |
EndSequence () | |
virtual | ~EndSequence () |
virtual void | update (float elapsed_time) |
This function is called once per frame and allows the object to update it's state. | |
virtual void | draw (DrawingContext &context) |
The GameObject should draw itself onto the provided DrawingContext if this function is called. | |
void | start () |
play EndSequence | |
void | stop_tux () |
called when Tux has reached his final position | |
void | stop () |
stop playing EndSequence, mark it as done playing | |
bool | is_tux_stopped () |
returns true if Tux has reached his final position | |
bool | is_done () |
returns true if EndSequence has finished playing | |
Protected Member Functions | |
virtual void | starting () |
called when EndSequence starts | |
virtual void | running (float elapsed_time) |
called while the EndSequence is running | |
virtual void | stopping () |
called when EndSequence stops | |
Protected Attributes | |
bool | isrunning |
true while EndSequence plays | |
bool | isdone |
true if EndSequence has finished playing | |
bool | tux_may_walk |
true while tux is allowed to walk | |
CodeController * | end_sequence_controller |
Private Member Functions | |
EndSequence (const EndSequence &) | |
EndSequence & | operator= (const EndSequence &) |
Definition at line 23 of file endsequence.hpp.
EndSequence::EndSequence | ( | ) |
Definition at line 22 of file endsequence.cpp.
00022 : 00023 isrunning(false), 00024 isdone(false), 00025 tux_may_walk(true), 00026 end_sequence_controller(0) 00027 { 00028 }
EndSequence::~EndSequence | ( | ) | [virtual] |
Definition at line 30 of file endsequence.cpp.
References end_sequence_controller.
00031 { 00032 delete end_sequence_controller; 00033 }
EndSequence::EndSequence | ( | const EndSequence & | ) | [private] |
void EndSequence::update | ( | float | elapsed_time | ) | [virtual] |
This function is called once per frame and allows the object to update it's state.
The elapsed_time is the time since the last frame in seconds and should be the base for all timed calculations (don't use SDL_GetTicks directly as this will fail in pause mode)
Implements GameObject.
Definition at line 36 of file endsequence.cpp.
References isrunning, and running().
Referenced by GameSession::update().
void EndSequence::draw | ( | DrawingContext & | context | ) | [virtual] |
The GameObject should draw itself onto the provided DrawingContext if this function is called.
Implements GameObject.
Reimplemented in EndSequenceFireworks, EndSequenceWalkLeft, and EndSequenceWalkRight.
Definition at line 43 of file endsequence.cpp.
void EndSequence::start | ( | ) |
play EndSequence
Definition at line 48 of file endsequence.cpp.
References Sector::current(), end_sequence_controller, isdone, isrunning, Sector::player, Player::set_controller(), Player::set_speedlimit(), and starting().
Referenced by GameSession::start_sequence().
00049 { 00050 if (isrunning) return; 00051 isrunning = true; 00052 isdone = false; 00053 00054 Player& tux = *Sector::current()->player; 00055 end_sequence_controller = new CodeController(); 00056 tux.set_controller(end_sequence_controller); 00057 tux.set_speedlimit(230); //MAX_WALK_XM 00058 00059 starting(); 00060 }
void EndSequence::stop_tux | ( | ) |
called when Tux has reached his final position
Definition at line 63 of file endsequence.cpp.
References tux_may_walk.
Referenced by GameSession::start_sequence().
00064 { 00065 tux_may_walk = false; 00066 }
void EndSequence::stop | ( | ) |
stop playing EndSequence, mark it as done playing
Definition at line 69 of file endsequence.cpp.
References isdone, isrunning, and stopping().
00070 { 00071 if (!isrunning) return; 00072 isrunning = false; 00073 isdone = true; 00074 stopping(); 00075 }
bool EndSequence::is_tux_stopped | ( | ) |
returns true if Tux has reached his final position
Definition at line 78 of file endsequence.cpp.
References tux_may_walk.
Referenced by GameSession::update().
00079 { 00080 return !tux_may_walk; 00081 }
bool EndSequence::is_done | ( | ) |
returns true if EndSequence has finished playing
Definition at line 84 of file endsequence.cpp.
References isdone.
Referenced by GameSession::check_end_conditions().
00085 { 00086 return isdone; 00087 }
void EndSequence::starting | ( | ) | [protected, virtual] |
called when EndSequence starts
Reimplemented in EndSequenceFireworks, EndSequenceWalkLeft, and EndSequenceWalkRight.
Definition at line 90 of file endsequence.cpp.
Referenced by start(), EndSequenceWalkRight::starting(), EndSequenceWalkLeft::starting(), and EndSequenceFireworks::starting().
void EndSequence::running | ( | float | elapsed_time | ) | [protected, virtual] |
called while the EndSequence is running
Reimplemented in EndSequenceFireworks, EndSequenceWalkLeft, and EndSequenceWalkRight.
Definition at line 95 of file endsequence.cpp.
References end_sequence_controller, and CodeController::update().
Referenced by EndSequenceWalkRight::running(), EndSequenceWalkLeft::running(), EndSequenceFireworks::running(), and update().
00096 { 00097 end_sequence_controller->update(); 00098 }
void EndSequence::stopping | ( | ) | [protected, virtual] |
called when EndSequence stops
Reimplemented in EndSequenceFireworks, EndSequenceWalkLeft, and EndSequenceWalkRight.
Definition at line 101 of file endsequence.cpp.
Referenced by stop(), EndSequenceWalkRight::stopping(), EndSequenceWalkLeft::stopping(), and EndSequenceFireworks::stopping().
EndSequence& EndSequence::operator= | ( | const EndSequence & | ) | [private] |
bool EndSequence::isrunning [protected] |
bool EndSequence::isdone [protected] |
true if EndSequence has finished playing
Definition at line 45 of file endsequence.hpp.
Referenced by is_done(), EndSequenceWalkRight::running(), EndSequenceWalkLeft::running(), EndSequenceFireworks::running(), start(), and stop().
bool EndSequence::tux_may_walk [protected] |
true while tux is allowed to walk
Definition at line 46 of file endsequence.hpp.
Referenced by is_tux_stopped(), EndSequenceWalkRight::running(), EndSequenceWalkLeft::running(), EndSequenceFireworks::running(), and stop_tux().
CodeController* EndSequence::end_sequence_controller [protected] |
Definition at line 47 of file endsequence.hpp.
Referenced by EndSequenceWalkRight::running(), EndSequenceWalkLeft::running(), EndSequenceFireworks::running(), running(), start(), and ~EndSequence().