VUEngine Class Reference
#include <VUEngine.h>
![](../class_v_u_engine.png)
# 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 | |
![]() | |
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) |
![]() | |
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 |
Add a game state to the top of the engine's state machine's stack.
- Parameters
-
state Game state to push
Definition at line 115 of file VUEngine.c.
# changeState()
|
static |
Swap the game state at the top of the engine's state machine's stack wht the provided one.
- Parameters
-
state Game state to swap to
Definition at line 132 of file VUEngine.c.
# getActiveToolState()
|
static |
Retrieve the active tool state if any.
- Returns
- Currently active tool state
Definition at line 163 of file VUEngine.c.
# 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 |
Retrieve the saved data manager.
- Returns
- Save data manager
Definition at line 201 of file VUEngine.c.
# handleMessage()
Receive and process a Telegram.
- Parameters
-
telegram Received telegram to process
- Returns
- True if the telegram was processed
Reimplemented from ListenerObject.
Definition at line 334 of file VUEngine.c.
# 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 |
Check if the game is paused.
- Returns
- True if the game is paused; false otherwise
# onEvent()
|
virtual |
Process an event that the instance is listen for.
- Parameters
-
eventFirer ListenerObject that signals the event eventCode Code 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 |
Pause the game by pushing the provided game state into the engine's state machine's stack.
- Parameters
-
pauseState Pause game state
Definition at line 59 of file VUEngine.c.
# setGameFrameRate()
|
static |
Set the target frame rate.
- Parameters
-
gameFrameRate New frame rate target
Definition at line 179 of file VUEngine.c.
# setSaveDataManager()
|
static |
Set the saved data manager.
- Parameters
-
saveDataManager,: Save data manager to use
Definition at line 192 of file VUEngine.c.
# setState()
|
static |
Ste the current game state at the top of the engine's state machine's stack.
- Parameters
-
gameState Game state to set
Definition at line 95 of file VUEngine.c.
# startProfiling()
|
static |
Start profiling the game.
# unpause()
|
static |
Unpause the game by removing the provided game state from the engine's state machine's stack.
- Parameters
-
pauseState Pause game state
Definition at line 75 of file VUEngine.c.
# wait()
|
static |
Halt the game by the provided time.
- Parameters
-
milliSeconds Time to halt the game
Definition at line 219 of file VUEngine.c.
# Member Data Documentation
# activeToolState
|
protected |
Currently active tool state.
Definition at line 93 of file VUEngine.h.
# currentGameCycleEnded
|
protected |
Flag raised when the game loop is completed.
Definition at line 84 of file VUEngine.h.
# currentGameState
|
protected |
Current game state that the engine is in.
Definition at line 75 of file VUEngine.h.
# gameFrameStarted
|
protected |
Flag raised upon VIP's GAMESTART.
Definition at line 87 of file VUEngine.h.
# isPaused
|
protected |
If true, the game is paused.
Definition at line 90 of file VUEngine.h.
# saveDataManager
|
protected |
Saved data manager.
Definition at line 81 of file VUEngine.h.
# 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:
- VUEngine-Core/source/VUEngine.h
- VUEngine-Core/source/VUEngine.c