Spaces

Spaces are containers for game objects. It is a way to keep objects seperated so that they don't interact or cause issues. For example, pausing a space would allow another space to keep running without having to have a weird way to pause some of the objects and keep some of the other objects running.

Spaces also allow for multiple instances of systems to be created. Mainly each space should have a physics system and sound system. There is also a way graphics hooks into each space by a proxy system that interfaces with the bigger graphics system. Systems must be registered with the Meta system in order to work correctly with spaces.

Space Types

 * Level
 * All objects that belong in the level and don't need to persist throughout the entire game.
 * HUD
 * Any information that will need to be displayed on the HUD.  These objects persist through the entire game.
 * Pause
 * Menus and other information that will appear when the rest of the game is paused.
 * Menu
 * Menus that will be on the Main Menu, Options, etc.

C++
There are a few ways to access Spaces. If you want to directly get a space, you can do either of these: // Get the spaces through static methods Engine::Space::GetLevelSpace; Engine::Space::GetHUDSpace; Engine::Space::GetPauseSpace; Engine::Space::GetMenuSpace; // Get the spaces through the enumeration in the Space Manager gSpaceManager->GetSpace(SpaceType::Level); gSpaceManager->GetSpace(SpaceType::HUD); gSpaceManager->GetSpace(SpaceType::Pause); gSpaceManager->GetSpace(SpaceType::Menu); If you have a pointer to a GameObject and you need to interact with the Space it belongs in, you can get a pointer to that space. GameObject *gameObject = SomeFunctionThatGetsAGameObject; Space *space = gameObject->GetSpace;

Lua
You can access the individual spaces like this: Space.Level Space.HUD Space.Pause Space.Menu Also if you have a reference to a game object: gameObject.Space

You can also access different systems that are registered to each space like this: Space.Level.Audio