|
wavelength 1.0.0
|
Driver of the World that is loading, running, or being torn down. More...
#include <worldmgr.h>
Public Types | |
| enum | State { kStateIdle = 0 , kStateLoading = 1 , kStatePlaying = 2 , kStateUnloaded = 3 } |
| Values of mState. More... | |
| enum | Event { kEventNone = 0 , kEventLoaded = 1 , kEventFinished = 2 , kEventUnloaded = 3 , kEventRestart = 4 } |
| Values Poll() reports. More... | |
Public Member Functions | |
| WorldMgr () | |
| Construct the driver with every member clear. | |
| ~WorldMgr () | |
| Release the driver. | |
| void | Init () |
| Initialise TheGfxManager and TheGameConfig, and mark the driver initialised. | |
| void | Terminate () |
| Destroy the world and the router if either exists, and shut down TheGfxManager. | |
| int | GetState () const |
| Report mState. | |
| void | Reset () |
| Reset TheGfxManager and enter kStateIdle. | |
| void | Load () |
| Build the World for the selected rule set and enter kStateLoading. | |
| void | Start () |
| Attach an InputMgr to the loaded world and enter kStatePlaying. | |
| void | Unload () |
| Destroy the router and the world and enter kStateUnloaded. | |
| void | UpdateTime () |
| Copy two timing values of the running world into the game database. | |
| int | Poll () |
| Advance the current state by one frame and report what changed. | |
| void | Draw () |
| Draw TheGfxManager, at the running world's tick or at time 0 otherwise. | |
Static Public Member Functions | |
| static WorldMgr * | shared () |
| Report the single instance, constructing it on first use. | |
Driver of the World that is loading, running, or being torn down.
The class is not polymorphic and has no RTTI, and the name is inferred from the members it manages. The one instance is the function-local static of shared(), and TheWorldMgr addresses it.
Load() builds the World subclass for the rule set the game database selects, Start() attaches an InputMgr, and Unload() destroys both. Poll() advances the state each frame and reports what changed as an Event.
Load(), Start(), Unload(), and Reset() each time their body on a stack Timer. The measurement is never read.
| enum WorldMgr::State |
| enum WorldMgr::Event |
| WorldMgr::WorldMgr | ( | ) |
Construct the driver with every member clear.
| WorldMgr::~WorldMgr | ( | ) |
Release the driver.
The body is empty, and the world and the router are not destroyed.
|
static |
Report the single instance, constructing it on first use.
| void WorldMgr::Init | ( | ) |
Initialise TheGfxManager and TheGameConfig, and mark the driver initialised.
| void WorldMgr::Terminate | ( | ) |
Destroy the world and the router if either exists, and shut down TheGfxManager.
The two pointers are not cleared.
| int WorldMgr::GetState | ( | ) | const |
Report mState.
| void WorldMgr::Reset | ( | ) |
Reset TheGfxManager and enter kStateIdle.
| void WorldMgr::Load | ( | ) |
Build the World for the selected rule set and enter kStateLoading.
Rule set 1 builds a Game, rule set 2 a Remix, and rule set 3 a Duel. Any other value builds no world and passes "invalid ruleset" to DebugWarn(). The periodic controller check is turned off until Unload().
| void WorldMgr::Start | ( | ) |
Attach an InputMgr to the loaded world and enter kStatePlaying.
| void WorldMgr::Unload | ( | ) |
Destroy the router and the world and enter kStateUnloaded.
| void WorldMgr::UpdateTime | ( | ) |
Copy two timing values of the running world into the game database.
Only a world in kStatePlaying publishes. The main loop calls the routine first in each frame. The name is inferred.
| int WorldMgr::Poll | ( | ) |
Advance the current state by one frame and report what changed.
The pending event is cleared as it is reported.
| void WorldMgr::Draw | ( | ) |
Draw TheGfxManager, at the running world's tick or at time 0 otherwise.