|
MochiEngine
|
The layer class offers a simple way to organize domains of the application while having access to most of the Engine subsystems. Note that a layer is meant to be inherited from and can't be instantated as is. A layer will Update, Render and show the GUI as a small Engine class. So the layer is just a convenient responsability separator. Ownership: More...
#include <Layer.h>
Public Member Functions | |
| Layer () | |
| Default constructor. It initializes with references to the engine subsystems. Should only be constructed after the engine is setup. | |
| virtual void | InitLayer () |
| Override this to initialize members and data of your layer when the engine adds this layer to the layer list. This is useful if you want to create the layer and delay its inclusion on the engine. | |
| virtual bool | Update (const float &dt) |
| Override this to give your layer a way to be updated each frame. | |
| virtual void | Render () const |
| Override this to send the render commands to the engine. This task could be done on the update, but making it here its clearer. | |
| virtual void | GUI () const |
| Override this to draw the GUI of your layer. Even if this could be done anywhere, doing it here ensure it to be drawn after all rendering is done. | |
| virtual void | Debug () const |
| Override this to print, draw or show debug GUI's. This will be called after all renderings and other GUIs and will only be shown while in DEBUG configuration. | |
Protected Attributes | |
| FS::PackCatalog * | mCatalog |
| Scripting::ScriptingManager * | mScripting |
| Graphics::Camera * | mCamera |
| Event::EventBus * | mEventBus |
| Graphics::AbstractGUI * | mGUI |
| Input::IActionManager * | mActionManager |
| Audio::IAudioManager * | mAudioManager |
| Graphics::IRenderer * | mRenderer |
| Debug::IGizmos * | mGizmos |
The layer class offers a simple way to organize domains of the application while having access to most of the Engine subsystems. Note that a layer is meant to be inherited from and can't be instantated as is. A layer will Update, Render and show the GUI as a small Engine class. So the layer is just a convenient responsability separator. Ownership:
Lifecycle:
Guarantees:
Thread safety:
|
inlinevirtual |
Override this to print, draw or show debug GUI's. This will be called after all renderings and other GUIs and will only be shown while in DEBUG configuration.
Reimplemented in Mochi::DebugLayer, and Mochi::Scripting::ScriptingLayer.
|
inlinevirtual |
Override this to draw the GUI of your layer. Even if this could be done anywhere, doing it here ensure it to be drawn after all rendering is done.
Reimplemented in Mochi::DebugLayer, and Mochi::Scripting::ScriptingLayer.
|
inlinevirtual |
Override this to initialize members and data of your layer when the engine adds this layer to the layer list. This is useful if you want to create the layer and delay its inclusion on the engine.
Reimplemented in Mochi::DebugLayer, and Mochi::Scripting::ScriptingLayer.
|
inlinevirtual |
Override this to send the render commands to the engine. This task could be done on the update, but making it here its clearer.
Reimplemented in Mochi::DebugLayer, and Mochi::Scripting::ScriptingLayer.
|
inlinevirtual |
Override this to give your layer a way to be updated each frame.
| dt | The delta time |
Reimplemented in Mochi::DebugLayer, and Mochi::Scripting::ScriptingLayer.