Plasma Engine  2.0
Loading...
Searching...
No Matches
GameApplication.h
1#pragma once
2
3#include <GameEngine/GameState/GameState.h>
4
5#include <Core/Console/ConsoleFunction.h>
6#include <Core/GameApplication/GameApplicationBase.h>
7#include <Foundation/Configuration/CVar.h>
8#include <Foundation/Threading/DelegateTask.h>
9#include <Foundation/Types/UniquePtr.h>
10
11class plQuakeConsole;
12
13// TODO: update comments below
14
35class PL_GAMEENGINE_DLL plGameApplication : public plGameApplicationBase
36{
37public:
38 static plCVarBool cvar_AppVSync;
39 static plCVarBool cvar_AppShowFPS;
40 static plCVarBool cvar_AppShowInfo;
41
42public:
44
46 plGameApplication(const char* szAppName, const char* szProjectPath);
48
50 static plGameApplication* GetGameApplicationInstance() { return s_pGameApplicationInstance; }
51
53 static plStringView GetActiveRenderer();
54
57 static void SetOverrideDefaultDeviceCreator(plDelegate<plGALDevice*(const plGALDeviceCreationDescription&)> creator);
58
66 virtual plString FindProjectDirectory() const override;
67
69 void ReinitializeInputConfig();
70
72 plStringView GetAppProjectPath() const { return m_sAppProjectPath; }
73
74protected:
75 virtual void Init_ConfigureInput() override;
76 virtual void Init_ConfigureAssetManagement() override;
77 virtual void Init_LoadRequiredPlugins() override;
78 virtual void Init_SetupDefaultResources() override;
79 virtual void Init_SetupGraphicsDevice() override;
80 virtual void Deinit_ShutdownGraphicsDevice() override;
81
82 virtual bool IsGameUpdateEnabled() const override;
83
84 virtual bool Run_ProcessApplicationInput() override;
85 virtual void Run_AcquireImage() override;
86 virtual void Run_WorldUpdateAndRender() override;
87 virtual void Run_PresentImage() override;
88 virtual void Run_FinishFrame() override;
89
92 bool m_bIgnoreErrors = false;
93
94protected:
95 static plGameApplication* s_pGameApplicationInstance;
96
97 void RenderFps();
98 void RenderInfo();
99 void RenderConsole();
100
101 void UpdateWorldsAndExtractViews();
103
104 static plDelegate<plGALDevice*(const plGALDeviceCreationDescription&)> s_DefaultDeviceCreator;
105
106 bool m_bShowConsole = false;
108};
The plRenderDevice class is the primary interface for interactions with rendering APIs It contains a ...
Definition Device.h:19
Definition GameApplicationBase.h:51
virtual plString FindProjectDirectory() const =0
Returns the target of the 'project' special data directory.
virtual void Run_AcquireImage()
This function can be used to acquire a new window from a swap-chain or do any other update operations...
Definition GameApplicationBase.cpp:475
virtual void Run_PresentImage()
This function can be used to present the final image to a window. It is run at the end of the renderi...
Definition GameApplicationBase.cpp:530
The base class for all typical game applications made with plEngine.
Definition GameApplication.h:36
plStringView GetAppProjectPath() const
Returns the project path that was given to the constructor (or modified by an overridden implementati...
Definition GameApplication.h:72
plString m_sAppProjectPath
Stores what is given to the constructor.
Definition GameApplication.h:91
static plGameApplication * GetGameApplicationInstance()
Returns the plGameApplication singleton.
Definition GameApplication.h:50
A Quake-style console for in-game configuration of plCVar and plConsoleFunction.
Definition QuakeConsole.h:16
A Shared ptr manages a shared object and destroys that object when no one references it anymore....
Definition SharedPtr.h:10
plStringView represent a read-only sub-string of a larger string, as it can store a dedicated string ...
Definition StringView.h:34
[internal] Helper class to implement plCVarInt, plCVarFlag, plCVarBool and plCVarString.
Definition CVar.h:267
A Unique ptr manages an object and destroys that object when it goes out of scope....
Definition UniquePtr.h:10
A generic delegate class which supports static functions and member functions.
Definition Delegate.h:76
Definition Descriptors.h:39