Plasma Engine  2.0
Loading...
Searching...
No Matches
GameStateBase.h
1#pragma once
2
3#include <Core/CoreDLL.h>
4
5#include <Foundation/Reflection/Reflection.h>
6
7class plWorld;
8
9enum class plGameStatePriority
10{
11 None = -1,
12 Fallback = 0,
13 Default = 5,
14 Override = 10,
15};
16
37class PL_CORE_DLL plGameStateBase : public plReflectedClass
38{
39 PL_ADD_DYNAMIC_REFLECTION(plGameStateBase, plReflectedClass)
40
41public:
43 virtual ~plGameStateBase();
44
56 virtual void OnActivation(plWorld* pWorld, const plTransform* pStartPosition) = 0;
57
59 virtual void OnDeactivation() = 0;
60
62 virtual void ProcessInput();
63
65 virtual void BeforeWorldUpdate();
66
68 virtual void AfterWorldUpdate();
69
70
75 virtual plGameStatePriority DeterminePriority(plWorld* pWorld) const = 0;
76
78 virtual void ScheduleRendering() = 0;
79
83 virtual void RequestQuit();
84
86 bool WasQuitRequested() const;
87
88protected:
89 bool m_bStateWantsToQuit = false;
90};
plGameState is the base class to build custom game logic upon. It works closely together with plGameA...
Definition GameStateBase.h:38
virtual void OnDeactivation()=0
Called when the game state is being shut down.
virtual void ScheduleRendering()=0
Has to call plRenderLoop::AddMainView for all views that need to be rendered.
virtual plGameStatePriority DeterminePriority(plWorld *pWorld) const =0
Called by plGameApplication to determine which game state is best suited to handle a situation.
virtual void OnActivation(plWorld *pWorld, const plTransform *pStartPosition)=0
When a game state was chosen, it gets activated through this function.
All classes that should be dynamically reflectable, need to be derived from this base class.
Definition DynamicRTTI.h:86
A world encapsulates a scene graph of game objects and various component managers and their component...
Definition World.h:22