Plasma Engine  2.0
Loading...
Searching...
No Matches
GameState.h
1#pragma once
2
3#include <Core/GameState/GameStateBase.h>
4#include <Core/Graphics/Camera.h>
5#include <Core/ResourceManager/ResourceHandle.h>
6#include <Foundation/Math/Size.h>
7#include <Foundation/Reflection/Reflection.h>
8#include <Foundation/Types/UniquePtr.h>
9#include <GameEngine/GameEngineDLL.h>
10#include <RendererCore/Pipeline/Declarations.h>
11#include <RendererFoundation/RendererFoundationDLL.h>
12
13class plWindow;
15class plView;
16struct plActorEvent;
18class plActor;
19class plDummyXR;
20
22
43class PL_GAMEENGINE_DLL plGameState : public plGameStateBase
44{
45 PL_ADD_DYNAMIC_REFLECTION(plGameState, plGameStateBase)
46
47protected:
50
51public:
52 virtual ~plGameState();
53
65 virtual void OnActivation(plWorld* pWorld, const plTransform* pStartPosition) override;
66
68 virtual void OnDeactivation() override;
69
71 virtual void ScheduleRendering() override;
72
74 plCamera* GetMainCamera() { return &m_MainCamera; }
75
76protected:
80 virtual void CreateActors();
81
84 virtual void ConfigureInputActions();
85
94 virtual plResult SpawnPlayer(const plTransform* pStartPosition);
95
97 plUniquePtr<plActor> CreateXRActor();
98
100 plView* CreateMainView();
101
103 void ChangeMainWorld(plWorld* pNewMainWorld);
104
106 virtual void ConfigureMainCamera();
107
109 virtual plUniquePtr<plWindow> CreateMainWindow();
110
112 virtual plUniquePtr<plWindowOutputTargetGAL> CreateMainOutputTarget(plWindow* pMainWindow);
113
115 virtual void SetupMainView(plGALSwapChainHandle hSwapChain, plSizeU32 viewportSize);
116
119 virtual void ConfigureMainWindowInputDevices(plWindow* pWindow);
120
121 plViewHandle m_hMainView;
122
123 plWorld* m_pMainWorld = nullptr;
124
125 plCamera m_MainCamera;
126 bool m_bStateWantsToQuit = false;
127 bool m_bXREnabled = false;
128 bool m_bXRRemotingEnabled = false;
129 plUniquePtr<plDummyXR> m_pDummyXR;
130};
Definition Actor.h:9
A camera class that stores the orientation and some basic camera settings.
Definition Camera.h:41
Definition DummyXR.h:38
Definition RendererFoundationDLL.h:397
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 void OnActivation(plWorld *pWorld, const plTransform *pStartPosition)=0
When a game state was chosen, it gets activated through this function.
plGameState is the base class to build custom game logic upon. It works closely together with plGameA...
Definition GameState.h:44
plCamera * GetMainCamera()
Gives access to the game state's main camera object.
Definition GameState.h:74
plGameState()
This class cannot be instantiated directly.
A Unique ptr manages an object and destroys that object when it goes out of scope....
Definition UniquePtr.h:10
Definition Declarations.h:64
Encapsulates a view on the given world through the given camera and rendered with the specified Rende...
Definition View.h:21
A simple abstraction for platform specific window creation.
Definition Window.h:244
Base class for window output targets.
Definition WindowOutputTargetBase.h:16
Creates a swapchain and keeps it up to date with the window.
Definition WindowOutputTarget.h:17
A world encapsulates a scene graph of game objects and various component managers and their component...
Definition World.h:22
Definition ActorManager.h:15
Default enum for returning failure or success, instead of using a bool.
Definition Types.h:54