VUEngine Class Reference

#include <VUEngine.h>

Inheritance diagram for VUEngine:
ListenerObject

# Public Member Functions

override bool onEvent (ListenerObject eventFirer, uint16 eventCode)
override bool handleMessage (Telegram telegram)

# Static Public Member Functions

static bool hasGameFrameStarted ()
static void pause (GameState pauseState)
static void unpause (GameState pauseState)
static void setState (GameState gameState)
static void addState (GameState state)
static void changeState (GameState state)
static ToolState getActiveToolState ()
static uint16 getGameFrameDuration ()
static void setGameFrameRate (uint16 gameFrameRate)
static void setSaveDataManager (ListenerObject saveDataManager)
static ListenerObject getSaveDataManager ()
static bool isPaused ()
static void wait (uint32 milliSeconds)
static void startProfiling ()
 Start profiling the game.

# Protected Attributes

GameState currentGameState
 Current game state that the engine is in.
StateMachine stateMachine
 Engine's main state machine.
ListenerObject saveDataManager
 Saved data manager.
volatile bool currentGameCycleEnded
 Flag raised when the game loop is completed.
volatile bool gameFrameStarted
 Flag raised upon VIP's GAMESTART.
bool isPaused
 If true, the game is paused.
ToolState activeToolState
 Currently active tool state.

# Additional Inherited Members

- Private Member Functions inherited from ListenerObject
void constructor ()
 Class' constructor.
void destructor ()
 Class' destructor.
void addEventListener (ListenerObject listener, uint16 eventCode)
void removeEventListener (ListenerObject listener, uint16 eventCode)
void removeEventListeners (uint16 eventCode)
void removeAllEventListeners ()
 Remove all listener objects.
bool hasActiveEventListeners ()
void fireEvent (uint16 eventCode)
void sendMessageTo (ListenerObject receiver, uint32 message, uint32 delay, uint32 randomDelay)
void sendMessageToSelf (uint32 message, uint32 delay, uint32 randomDelay)
void discardAllMessages ()
 Discard all messages, both to be sent and to be received.
void discardMessages (uint32 message)
- Private Attributes inherited from ListenerObject
VirtualList events
 List of registered events.
int8 eventFirings
 Counter that keeps track of the number of fired events to prevent race conditions in nested firings.

# Detailed Description

Class VUEngine

Inherits from ListenerObject

Implements the game's life cycle.

Definition at line 70 of file VUEngine.h.

# Member Function Documentation

# addState()

static void VUEngine::addState ( GameState state)
static

Add a game state to the top of the engine's state machine's stack.

Parameters
stateGame state to push

Definition at line 115 of file VUEngine.c.

# changeState()

static void VUEngine::changeState ( GameState state)
static

Swap the game state at the top of the engine's state machine's stack wht the provided one.

Parameters
stateGame state to swap to

Definition at line 132 of file VUEngine.c.

# getActiveToolState()

static ToolState VUEngine::getActiveToolState ( )
static

Retrieve the active tool state if any.

Returns
Currently active tool state

Definition at line 163 of file VUEngine.c.

# getGameFrameDuration()

static uint16 VUEngine::getGameFrameDuration ( )
static

Retrieve the duration of game frames.

Returns
Duration in milliseconds of game frames

Definition at line 172 of file VUEngine.c.

# getSaveDataManager()

static ListenerObject VUEngine::getSaveDataManager ( )
static

Retrieve the saved data manager.

Returns
Save data manager

Definition at line 201 of file VUEngine.c.

# handleMessage()

bool VUEngine::handleMessage ( Telegram telegram)
virtual

Receive and process a Telegram.

Parameters
telegramReceived telegram to process
Returns
True if the telegram was processed

Reimplemented from ListenerObject.

Definition at line 334 of file VUEngine.c.

# hasGameFrameStarted()

static bool VUEngine::hasGameFrameStarted ( )
static

Check if the next game frame has started.

Returns
True if the game frame has started

Definition at line 50 of file VUEngine.c.

# isPaused()

static bool VUEngine::isPaused ( )
static

Check if the game is paused.

Returns
True if the game is paused; false otherwise

# onEvent()

bool VUEngine::onEvent ( ListenerObject eventFirer,
uint16 eventCode )
virtual

Process an event that the instance is listen for.

Parameters
eventFirerListenerObject that signals the event
eventCodeCode of the firing event
Returns
False if the listener has to be removed; true to keep it

Reimplemented from ListenerObject.

Definition at line 241 of file VUEngine.c.

# pause()

static void VUEngine::pause ( GameState pauseState)
static

Pause the game by pushing the provided game state into the engine's state machine's stack.

Parameters
pauseStatePause game state

Definition at line 59 of file VUEngine.c.

# setGameFrameRate()

static void VUEngine::setGameFrameRate ( uint16 gameFrameRate)
static

Set the target frame rate.

Parameters
gameFrameRateNew frame rate target

Definition at line 179 of file VUEngine.c.

# setSaveDataManager()

static void VUEngine::setSaveDataManager ( ListenerObject saveDataManager)
static

Set the saved data manager.

Parameters
saveDataManager,:Save data manager to use

Definition at line 192 of file VUEngine.c.

# setState()

static void VUEngine::setState ( GameState gameState)
static

Ste the current game state at the top of the engine's state machine's stack.

Parameters
gameStateGame state to set

Definition at line 95 of file VUEngine.c.

# startProfiling()

static void VUEngine::startProfiling ( )
static

Start profiling the game.

# unpause()

static void VUEngine::unpause ( GameState pauseState)
static

Unpause the game by removing the provided game state from the engine's state machine's stack.

Parameters
pauseStatePause game state

Definition at line 75 of file VUEngine.c.

# wait()

static void VUEngine::wait ( uint32 milliSeconds)
static

Halt the game by the provided time.

Parameters
milliSecondsTime to halt the game

Definition at line 219 of file VUEngine.c.

# Member Data Documentation

# activeToolState

ToolState VUEngine::activeToolState
protected

Currently active tool state.

Definition at line 93 of file VUEngine.h.

# currentGameCycleEnded

volatile bool VUEngine::currentGameCycleEnded
protected

Flag raised when the game loop is completed.

Definition at line 84 of file VUEngine.h.

# currentGameState

GameState VUEngine::currentGameState
protected

Current game state that the engine is in.

Definition at line 75 of file VUEngine.h.

# gameFrameStarted

void VUEngine::gameFrameStarted
protected

Flag raised upon VIP's GAMESTART.

Definition at line 87 of file VUEngine.h.

# isPaused

static bool VUEngine::isPaused
protected

If true, the game is paused.

Definition at line 90 of file VUEngine.h.

# saveDataManager

ListenerObject VUEngine::saveDataManager
protected

Saved data manager.

Definition at line 81 of file VUEngine.h.

# stateMachine

StateMachine VUEngine::stateMachine
protected

Engine's main state machine.

Definition at line 78 of file VUEngine.h.


The documentation for this class was generated from the following files: