The engine that drives the game. The Singleton class GameEngine manages the Game itself. It provides several sub-engines that outside objects have access to (through interfaces) that are responsible for different parts of the system. GameEngine is the one single command and control center for running the game. The application is only responsible for starting and stopping the GameEngine at application load and exit, and the GameEngine handles all other initialization and cleanup of Game and Map data and all sub-engines.
GameEngine only returns interfaces to the sub-engines by design. This allows the actual implementations of the interfaces used internally by GameEngine to change dramatically without having to recompile the entire project.
GameEngine.h
The engine that drives the game. | |
Provides access to the PluginEngine. | |
Provides access to the RuleEngine. | |
Provides access to the ImageEngine. | |
Provides access to the GameObjectEngine. | |
Provides access to the DrawObjectEngine. | |
Provides access to the SoundEngine. | |
Provides access to the AnyEngine. | |
Provides access to the INetworkEngine interface, which may not exist if the game is not being played on a network. | |
Provides read-only access to the current Map. | |
Returns the index in the MapDatabase of the currently loaded Map. | |
Registers (or unregisters, if network parameter is empty) the given INetworkEngine interface as the current network. | |
Loads the Map at the given MapDatabase index into memory. | |
Starts the GameEngine. | |
Stops the GameEngine. | |
Loads a Game from disk. | |
Saves the currently played Game to disk. | |
The GameEngine constructor. | |
The GameEngine destructor. |
Provides access to the PluginEngine. | |
Provides access to the RuleEngine. | |
Provides access to the ImageEngine. | |
Provides access to the GameObjectEngine. | |
Provides access to the DrawObjectEngine. | |
Provides access to the SoundEngine. | |
Provides access to the AnyEngine. | |
Provides access to the INetworkEngine interface, which may not exist if the game is not being played on a network. | |
Provides read-only access to the current Map. | |
Returns the index in the MapDatabase of the currently loaded Map. | |
Registers (or unregisters, if network parameter is empty) the given INetworkEngine interface as the current network. | |
Loads the Map at the given MapDatabase index into memory. | |
Starts the GameEngine. | |
Stops the GameEngine. | |
Loads a Game from disk. | |
Saves the currently played Game to disk. |
| IPluginEngine &plugin() const |
Provides access to the PluginEngine. A calling object should use the PLUGIN macro as a shortcut to this function.
A reference to the IPluginEngine interface.
| IRuleEngine &rule() const |
Provides access to the RuleEngine. A calling object should use the RULE macro as a shortcut to this function.
A reference to the IRuleEngine interface.
| IImageEngine &image() const |
Provides access to the ImageEngine. A calling object should use the IMAGE macro as a shortcut to this function.
A reference to the IImageEngine interface.
| IGameObjectEngine &gameobject() const |
Provides access to the GameObjectEngine. A calling object should use the GAMEOBJECT macro as a shortcut to this function.
A reference to the IGameObjectEngine interface.
| IDrawObjectEngine &drawobject() const |
Provides access to the DrawObjectEngine. A calling object should use the DRAWOBJECT macro as a shortcut to this function.
A reference to the IDrawObjectEngine interface.
| ISoundEngine &sound() const |
Provides access to the SoundEngine. A calling object should use the SOUND macro as a shortcut to this function.
A reference to the ISoundEngine interface.
| IAnyEngine &any() const |
Provides access to the AnyEngine.
A reference to the IAnyEngine interface.
| NetworkEnginePtr &network() const |
Provides access to the INetworkEngine interface, which may not exist if the game is not being played on a network.
A boost::shared_ptr to the INetworkEngine interface. May be NULL.
| wxInt32 mapIndex() const |
Returns the index in the MapDatabase of the currently loaded Map.
The index in the MapDatabase of the currently loaded Map. May be -1 if no Map is currently loaded.
|
Registers (or unregisters, if network parameter is empty) the given INetworkEngine interface as the current network.
| network | The INetworkEngine to use as the current network. May be empty to set no network. |
|
Loads the Map at the given MapDatabase index into memory.
| index | The index in the MapDatabase of the map to load. |
| void StartEngine() |
Starts the GameEngine. First calls StopEngine to shut down anything currently happening. Creates new Game and Map objects (though no map is loaded from the MapDatabase). Sets the Access data to the newly created Game object. Starts the PluginEngine.
| void StopEngine() |
Stops the GameEngine. Resets the Game data in Access to empty. Clears the current Game and Map objects and sets the current map index to -1. Calls Stop on the DrawObjectEngine, ImageEngine, RuleEngine, and PluginEngine, in that order, to clear out any memory loaded from plugins.
|
Loads a Game from disk. Because a certain ordering of events must take place (i.e. the RuleSets must be loaded first, then the OpenGL window created, then the Game data be loaded), the developer can send a boost::function object as a callback function. This callback function will be called when the RuleSet names for the game have been loaded from disk but before the actual Game data is loaded. In this way, the calling function can do whatever RuleSet loading and OpenGL initialization is required before the Game data is loaded. Once the Game is loaded, the proper Map for the Game is loaded via the MapDatabase. Then the eventResetCamera Event is triggered to readjust the View, and finally, the RuleRestartGame IRule is executed to get things going again.
| index | The index in the MapDatabase of the Game to load. |
| incomplete | Whether the index is in the completed games database or the incomplete games database. |
| func | A boost::function object to callback during load. May be empty. |
| GameEngine() |
The GameEngine constructor. Creates the private, static RuleEngine, DrawObjectEngine, ImageEngine, SoundEngine, and PluginEngine. Seeds the random number generator with the current timestamp.
| ~GameEngine() |
The GameEngine destructor. Resets the private static RuleEngine, DrawObjectEngine, ImageEngine, SoundEngine, and PluginEngine.
| IPluginEngine &plugin() const |
| IRuleEngine &rule() const |
| IImageEngine &image() const |
| IGameObjectEngine &gameobject() const |
| IDrawObjectEngine &drawobject() const |
| ISoundEngine &sound() const |
| IAnyEngine &any() const |
| NetworkEnginePtr &network() const |
| const Map &map() const |
| wxInt32 mapIndex() const |
|
|
| void StartEngine() |
| void StopEngine() |
|
| void SaveGame() |
| GameEngine() |
| ~GameEngine() |