This is the base class from which all the World Managers inherit. More...
#include <managerbase.h>
Public Types | |
| typedef bool(* | Callback )() |
| This makes working with Callback function pointer a bit easier. | |
| enum | ManagerTypeName { ActorManager = 1, AudioManager, CameraManager, CollisionShapeManager, EventManager, GraphicsManager, MeshManager, NetworkManager, PhysicsManager, ResourceManager, SceneManager, ScriptingManager, TerrainManager, TimerManager, UIManager, UserCreated = 512 } |
A listing of Manager TypeNames. More... | |
Public Member Functions | |
| ManagerBase () | |
| Default Constructor. | |
| virtual | ~ManagerBase () |
| Deconstructor. | |
| virtual void | DoMainLoopItems ()=0 |
| The main loop calls this once per frame. | |
| virtual void | ErasePostMainLoopItems () |
| This simply calls SetPostMainLoopItems() passing it 0. | |
| virtual void | ErasePreMainLoopItems () |
| This simply calls SetPreMainLoopItems() passing it 0. | |
| virtual World * | GetGameWorld () const |
| This gets the World that this manager is working with. | |
| virtual Callback | GetPostMainLoopItems () const |
| This returns the Callback that would be called before the main loop items. | |
| virtual Callback | GetPreMainLoopItems () const |
| This returns the Callback that would be called before the main loop items. | |
| virtual short int | GetPriority () |
| This gets the Priority of this manager. | |
| virtual ManagerTypeName | GetType () const =0 |
| This returns the type of this manager. | |
| std::string | GetTypeName () |
| This Allows any manager name to be sent to a stream. Primarily used for logging. | |
| virtual void | Initialize ()=0 |
| Configure Items requiring other Managers. | |
| virtual bool | PostMainLoopItems () |
| This runs any callback that is required after the mainloop items are run. | |
| virtual bool | PreMainLoopItems () |
| This runs any callback that is required before the mainloop items are run. | |
| virtual void | SetGameWorld (World *GameWorld_) |
| This sets the Mezzanine::World that this Manager works with. | |
| virtual void | SetPostMainLoopItems (Callback PostMainCallback) |
| This assigns a function to be the callback function to run prior to the main loop. | |
| virtual void | SetPreMainLoopItems (Callback PreMainCallback) |
| This assigns a function to be the callback function to run prior to the main loop. | |
| virtual void | SetPriority (short int Priority_) |
| This gets the Priority of this manager. | |
Protected Attributes | |
| World * | GameWorld |
| The actual pointer to the world. | |
| Callback | PostMainLoop |
| This is a function pointer to the function that should be called after running Main Loop Items. | |
| Callback | PreMainLoop |
| This is a function pointer to the function that should be called before running Main Loop Items. | |
| short int | Priority |
| This is a weighting used by the main loop to decide what order the managers should be called in. | |
This is the base class from which all the World Managers inherit.
This creates a base set of functions that Managers are all expected to implement.
Definition at line 57 of file managerbase.h.
A listing of Manager TypeNames.
These will be returned by ManagerBase::GetType(), and will allow code using this to determine what type of Manager class they are working with and use this information to more safely cast to the correct manager if needed.
Definition at line 65 of file managerbase.h.
| Mezzanine::ManagerBase::~ManagerBase | ( | ) | [virtual] |
| virtual void Mezzanine::ManagerBase::DoMainLoopItems | ( | ) | [pure virtual] |
The main loop calls this once per frame.
This is where each manager is expected to put anything that needs to be run each iteration of the main loop
Implemented in Mezzanine::ActorManager, Mezzanine::AudioManager, Mezzanine::CameraManager, Mezzanine::CollisionShapeManager, Mezzanine::EventManager, Mezzanine::GraphicsManager, Mezzanine::MeshManager, Mezzanine::PhysicsManager, Mezzanine::ResourceManager, Mezzanine::SceneManager, Mezzanine::ScriptingManager, Mezzanine::TerrainManager, Mezzanine::TimerManager, and Mezzanine::UIManager.
| World * Mezzanine::ManagerBase::GetGameWorld | ( | ) | const [virtual] |
This gets the World that this manager is working with.
Definition at line 64 of file managerbase.cpp.
| ManagerBase::Callback Mezzanine::ManagerBase::GetPostMainLoopItems | ( | ) | const [virtual] |
This returns the Callback that would be called before the main loop items.
Definition at line 104 of file managerbase.cpp.
| ManagerBase::Callback Mezzanine::ManagerBase::GetPreMainLoopItems | ( | ) | const [virtual] |
This returns the Callback that would be called before the main loop items.
Definition at line 85 of file managerbase.cpp.
| short int Mezzanine::ManagerBase::GetPriority | ( | ) | [virtual] |
This gets the Priority of this manager.
This has no Set counterpart to allow the changing of a manager's priority. This is expected to be set by the manager, or expose a safe method to change it at that level.
Definition at line 165 of file managerbase.cpp.
| virtual ManagerTypeName Mezzanine::ManagerBase::GetType | ( | ) | const [pure virtual] |
This returns the type of this manager.
This is intended to make using and casting from Manager base easier. With this is is possible to cast from ManagerBase to the correct Manager Type.
Implemented in Mezzanine::ActorManager, Mezzanine::AudioManager, Mezzanine::CameraManager, Mezzanine::CollisionShapeManager, Mezzanine::EventManager, Mezzanine::GraphicsManager, Mezzanine::MeshManager, Mezzanine::PhysicsManager, Mezzanine::ResourceManager, Mezzanine::SceneManager, Mezzanine::ScriptingManager, Mezzanine::TerrainManager, Mezzanine::TimerManager, and Mezzanine::UIManager.
| std::string Mezzanine::ManagerBase::GetTypeName | ( | ) |
This Allows any manager name to be sent to a stream. Primarily used for logging.
Definition at line 110 of file managerbase.cpp.
| virtual void Mezzanine::ManagerBase::Initialize | ( | ) | [pure virtual] |
Configure Items requiring other Managers.
If you are using the Mezzanine::World this is called when Mezzanine::World::GameInit() is called. It is expected that by the time this is called either ManagerBase::ManagerBase(World*) or ManagerBase::SetGameWorld(World*) will have been called. This is where all configuration that requires atleast one other manager on the Mezzanine::World to exist.
Yes we know it is spelled wrong, but are Zs cooler anyway.
Implemented in Mezzanine::ActorManager, Mezzanine::AudioManager, Mezzanine::CameraManager, Mezzanine::CollisionShapeManager, Mezzanine::EventManager, Mezzanine::GraphicsManager, Mezzanine::MeshManager, Mezzanine::PhysicsManager, Mezzanine::ResourceManager, Mezzanine::SceneManager, Mezzanine::ScriptingManager, Mezzanine::TerrainManager, Mezzanine::TimerManager, and Mezzanine::UIManager.
| bool Mezzanine::ManagerBase::PostMainLoopItems | ( | ) | [virtual] |
This runs any callback that is required after the mainloop items are run.
This will return whatever the callback returns, which is true to end the main loop after this frame, or true to continue it. If no callback is set this simply returns true, as to not interupt the mainloop.
This is a great Function to override in Manager classes where the complexity of callbacks is not required. This would make coding items that need to be performed at specific times easier. If you do that, it would be a good idea to call this version of the function, just in case a callback is set.
Reimplemented in Mezzanine::GraphicsManager.
Definition at line 95 of file managerbase.cpp.
| bool Mezzanine::ManagerBase::PreMainLoopItems | ( | ) | [virtual] |
This runs any callback that is required before the mainloop items are run.
This will return whatever the callback returns, which is true to end the main loop after this frame, or true to continue it. If no callback is set this simply returns true, as to not interupt the mainloop.
This is a great Function to override in Manager classes where the complexity of callbacks is not required. This would make coding items that need to be performed at specific times easier. If you do that, it would be a good idea to call this version of the function, just in case a callback is set.
Definition at line 76 of file managerbase.cpp.
| void Mezzanine::ManagerBase::SetGameWorld | ( | World * | GameWorld_ | ) | [virtual] |
This sets the Mezzanine::World that this Manager works with.
It is expected that this won't change very much, and for some managers changing this at the wrong time could cause some very fundamental problems. In fact, managers should be designed so that they can swapped out. For example swapping out event managers could allow for a swift re-mapping of game controls when a game switches modes.
For managers that can be moved it is expected that this function will change the pointer on the Mezzanine::World for the appropriate manager to point to this manager. This simplifies the calls that will naturally come next. To detach a Manager from the world pass this method a NULL pointer. If the manager cannot be removed or detached it should throw and exception using World::LogAndThrow, and it must not fail to attach to a world (that means it must internally handle all exception raised by the attaching process or throw an "Unrecoverable Error")
Definition at line 67 of file managerbase.cpp.
| void Mezzanine::ManagerBase::SetPostMainLoopItems | ( | ManagerBase::Callback | PostMainCallback | ) | [virtual] |
This assigns a function to be the callback function to run prior to the main loop.
| PostMainCallback | This is a pointer to a function that returns a bool and accepts no arguments, this is in the form of a ManagerBase::Callback. If SetPosMainLoopItems is passed 0, NULL or a null pointer, the callback will be forgetten and will not attempt to be called. |
Definition at line 92 of file managerbase.cpp.
| void Mezzanine::ManagerBase::SetPreMainLoopItems | ( | ManagerBase::Callback | PreMainCallback | ) | [virtual] |
This assigns a function to be the callback function to run prior to the main loop.
| PreMainCallback | This is a pointer to a function that returns a bool and accepts no arguments, this is in the form of a ManagerBase::Callback. If SetPreMainLoopItems is passed 0, NULL or a null pointer, the callback will be forgetten and will not attempt to be called. |
Definition at line 73 of file managerbase.cpp.
| void Mezzanine::ManagerBase::SetPriority | ( | short int | Priority_ | ) | [virtual] |
This gets the Priority of this manager.
This has no Set counterpart to allow the changing of a manager's priority. This is expected to be set by the manager, or expose a safe method to change it at that level.
Definition at line 170 of file managerbase.cpp.
short int Mezzanine::ManagerBase::Priority [protected] |
This is a weighting used by the main loop to decide what order the managers should be called in.
A lower number gets called earlier in the Main loop. By default rendering the graphics occurs at priority 0.
Definition at line 209 of file managerbase.h.
1.7.3