![]() |
Gorgon Game Engine
|
This class represents a scene in the game like menu screen in game, post game, pause or different game modes. More...
Public Member Functions | |
Scene (SceneID id=NoSceneID, bool mouseinput=true) | |
Empty constructor. More... | |
Scene (SceneManager &parent, SceneID id=NoSceneID, bool mouseinput=true) | |
Sets the parent layer so that the scene can be activated. More... | |
virtual void | Activate () override |
Activates the current scene. More... | |
SceneID | GetID () const |
Returns the ID of the current scene. More... | |
virtual void | KeyEvent (Gorgon::Input::Key, float) |
Called when the scene receives a key. More... | |
virtual bool | RequiresKeyInput () const =0 |
Whether this scene requires keyboard input. More... | |
![]() | |
virtual | ~Governor () |
Destroys this governor. If it is the active governor, default governor will be activated. More... | |
virtual void | Animate () const |
Animates the animations within this governor. More... | |
Public Attributes | |
Gorgon::Event< Scene > | ActivatedEvent |
Fires whenever activation of this layer is completed. More... | |
Gorgon::Event< Scene > | DeactivatedEvent |
Fires whenever deactivation of this layer is completed. More... | |
Protected Member Functions | |
virtual void | activate () |
Called after very activation. More... | |
virtual void | deactivate () |
Called before deactivation. More... | |
virtual void | doframe (unsigned int delta)=0 |
Scene should perform its frame based operations in this function. More... | |
virtual void | first_activation () |
Called only for the first time this scene is activated. More... | |
virtual void | render ()=0 |
This is called after doframe to perform rendering operation. More... | |
void | setlayerbounds (const Geometry::Bounds &bounds) |
Changes the boundaries of the main layer. More... | |
Protected Attributes | |
Gorgon::Graphics::Layer | graphics |
Graphics layer that can be drawn on. More... | |
SceneID | id |
ID of the current scene. More... | |
Gorgon::Input::Layer | mouse |
Mouse layer that can be used to receive mouse events. More... | |
SceneManager * | parent |
The parent window for the scene. More... | |
Additional Inherited Members | |
![]() | |
static Governor & | Active () |
Returns the current governor. More... | |
static Governor & | Default () |
Returns the default governor. More... | |
This class represents a scene in the game like menu screen in game, post game, pause or different game modes.
Scenes can be swapped on the fly and some scenes can be linked to others. Scene class is abstract, it must be derived by other classes in order to work.
Empty constructor.
After this constructor, the scene cannot be activated.
|
explicit |
Sets the parent layer so that the scene can be activated.
|
protectedvirtual |
Called after very activation.
first_activation will be called before activate.
|
overridevirtual |
Activates the current scene.
Reimplemented from Governor.
References Scene::parent, and SceneManager::SwitchScene().
|
protectedvirtual |
Called before deactivation.
|
protectedpure virtual |
Scene should perform its frame based operations in this function.
|
protectedvirtual |
Called only for the first time this scene is activated.
Allocate your resources here.
|
virtual |
Called when the scene receives a key.
|
protectedpure virtual |
This is called after doframe to perform rendering operation.
It is possible to receive render without receiving doframe, thus they should not be co-dependent.
|
pure virtual |
Whether this scene requires keyboard input.
|
protected |
Changes the boundaries of the main layer.
References Layer::SetBounds().
Gorgon::Event<Scene> ActivatedEvent |
Fires whenever activation of this layer is completed.
Will not be fired if the layer is already active and Activate function is called.
Gorgon::Event<Scene> DeactivatedEvent |
Fires whenever deactivation of this layer is completed.
Will not be fired if the layer is already inactive and Deactivate function is called.
|
protected |
Graphics layer that can be drawn on.
|
protected |
ID of the current scene.
|
protected |
Mouse layer that can be used to receive mouse events.
If the mouseinput parameter of the constructor is set to true, this layer will be attached, otherwise it will not be functional.
|
protected |
The parent window for the scene.
Unless you are explicitly requesting a parent, this member could be nullptr.