Dragonfly  4.3
A text-based game engine
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
df::GameManager Class Reference
Inheritance diagram for df::GameManager:
Inheritance graph
[legend]
Collaboration diagram for df::GameManager:
Collaboration graph
[legend]

Public Member Functions

int startUp ()
 
bool isValid (std::string event_name) const
 
void shutDown ()
 
void run ()
 
void setGameOver (bool game_over=true)
 
bool getGameOver () const
 
int getFrameTime () const
 
int getStepCount () const
 
- Public Member Functions inherited from df::Manager
std::string getType () const
 
bool isStarted () const
 
int onEvent (const Event *p_event) const
 
int registerInterest (Object *p_o, std::string event_type)
 
int unregisterInterest (Object *p_o, std::string event_type)
 

Static Public Member Functions

static GameManagergetInstance ()
 

Private Member Functions

 GameManager ()
 
 GameManager (GameManager const &)
 
void operator= (GameManager const &)
 

Private Attributes

bool m_game_over
 
int m_frame_time
 
int m_step_count
 

Additional Inherited Members

- Protected Member Functions inherited from df::Manager
void setType (std::string new_type)
 

Constructor & Destructor Documentation

df::GameManager::GameManager ( )
private

Private since a singleton.

df::GameManager::GameManager ( GameManager const &  )
private

Don't allow copy.

Member Function Documentation

int df::GameManager::getFrameTime ( ) const

Return frame time.

Frame time is target time for each game loop, in milliseconds.

bool df::GameManager::getGameOver ( ) const

Get game over status.

static GameManager& df::GameManager::getInstance ( )
static

Get the singleton instance of the GameManager.

int df::GameManager::getStepCount ( ) const

Return game loop step count.

bool df::GameManager::isValid ( std::string  event_name) const
virtual

Game manager only accepts step events.

Return false if other event.

Reimplemented from df::Manager.

void df::GameManager::operator= ( GameManager const &  )
private

Don't allow assignment.

void df::GameManager::run ( )

Run game loop.

void df::GameManager::setGameOver ( bool  game_over = true)

Set game over status to indicated value.

If true (default), will stop game loop.

void df::GameManager::shutDown ( )
virtual

Shut down GameManager services.

Reimplemented from df::Manager.

int df::GameManager::startUp ( )
virtual

Startup all GameManager services.

Reimplemented from df::Manager.

Member Data Documentation

int df::GameManager::m_frame_time
private

Target time per game loop, in millisec.

bool df::GameManager::m_game_over
private

True -> game loop should stop.

int df::GameManager::m_step_count
private

Count of game loop iterations.