Plasma Engine  2.0
Loading...
Searching...
No Matches
plEngineProcessGameApplication Class Reference
Inheritance diagram for plEngineProcessGameApplication:

Public Types

using SUPER = plGameApplication
 
- Public Types inherited from plGameApplication
using SUPER = plGameApplicationBase
 
- Public Types inherited from plGameApplicationBase
using SUPER = plApplication
 
- Public Types inherited from plApplication
enum class  Execution { Continue , Quit }
 Defines the possible return values for the plApplication::Run() function. More...
 

Public Member Functions

virtual plResult BeforeCoreSystemsStartup () override
 This function is called before any kind of engine initialization is done.
 
virtual void AfterCoreSystemsStartup () override
 This function is called after basic engine initialization has been done.
 
virtual void BeforeCoreSystemsShutdown () override
 This function is called after the application main loop has run for the last time, before engine deinitialization.
 
virtual plApplication::Execution Run () override
 Main run function which is called periodically. This function must be overridden.
 
void LogWriter (const plLoggingEventData &e)
 
- Public Member Functions inherited from plGameApplication
 plGameApplication (const char *szAppName, const char *szProjectPath)
 szProjectPath may be nullptr, if FindProjectDirectory() is overridden.
 
void ReinitializeInputConfig ()
 Used at runtime (by the editor) to reload input maps. Forwards to Init_ConfigureInput()
 
plStringView GetAppProjectPath () const
 Returns the project path that was given to the constructor (or modified by an overridden implementation).
 
- Public Member Functions inherited from plGameApplicationBase
 plGameApplicationBase (plStringView sAppName)
 
void TakeProfilingCapture ()
 Does a profiling capture and writes it to disk at ':appdata'.
 
void TakeScreenshot ()
 Schedules a screenshot to be taken at the end of the frame.
 
void CaptureFrame ()
 Schedules a frame capture if the corresponding plugin is loaded.
 
void SetContinuousFrameCapture (bool bEnable)
 Controls if frame captures are taken continuously (without being persisted) or only on-demand.
 
bool GetContinousFrameCapture () const
 
virtual plResult GetAbsFrameCaptureOutputPath (plStringBuilder &ref_sOutputPath)
 Get the absolute base output path for frame captures.
 
plResult ActivateGameState (plWorld *pWorld=nullptr, const plTransform *pStartPosition=nullptr)
 Creates and activates the game state for this application.
 
void DeactivateGameState ()
 Deactivates and destroys the active game state.
 
plGameStateBaseGetActiveGameState () const
 Returns the currently active game state. Could be nullptr.
 
plGameStateBaseGetActiveGameStateLinkedToWorld (const plWorld *pWorld) const
 Returns the currently active game state IF it was created for the given world.
 
const plPlatformProfileGetPlatformProfile () const
 Returns the plPlatformProfile that has been loaded for this application.
 
void RunOneFrame ()
 
plTime GetFrameTime () const
 
- Public Member Functions inherited from plApplication
 plApplication (plStringView sAppName)
 Constructor.
 
virtual ~plApplication ()
 Virtual destructor.
 
void SetApplicationName (plStringView sAppName)
 Changes the application name.
 
const plStringGetApplicationName () const
 Returns the application name.
 
virtual void AfterHighLevelSystemsShutdown ()
 Called after plStartup::ShutdownHighLevelSystems() has been executed.
 
virtual void AfterCoreSystemsShutdown ()
 This function is called after plStartup::ShutdownCoreSystems() has been called.
 
virtual void BeforeEnterBackground ()
 This function is called when an application is moved to the background.
 
virtual void BeforeEnterForeground ()
 This function is called whenever an application is resumed from background mode.
 
void SetReturnCode (plInt32 iReturnCode)
 Sets the value that the application will return to the OS. You can call this function at any point during execution to update the return value of the application. Default is zero.
 
plInt32 GetReturnCode () const
 Returns the currently set value that the application will return to the OS.
 
virtual const char * TranslateReturnCode () const
 If the return code is not zero, this function might be called to get a string to print the error code in human readable form.
 
void SetCommandLineArguments (plUInt32 uiArgumentCount, const char **pArguments)
 Will set the command line arguments that were passed to the app by the OS. This is automatically called by PL_APPLICATION_ENTRY_POINT() and PL_CONSOLEAPP_ENTRY_POINT().
 
plUInt32 GetArgumentCount () const
 Returns the number of command line arguments that were passed to the application.
 
const char * GetArgument (plUInt32 uiArgument) const
 Returns one of the command line arguments that was passed to the application.
 
const char ** GetArgumentsArray () const
 Returns the complete array of command line arguments that were passed to the application.
 
void EnableMemoryLeakReporting (bool bEnable)
 
bool IsMemoryLeakReportingEnabled () const
 
virtual void RequestQuit ()
 Calling this function requests that the application quits after the current invocation of Run() finishes.
 
PL_ALWAYS_INLINE bool WasQuitRequested () const
 Returns whether RequestQuit() was called.
 

Protected Member Functions

virtual void BaseInit_ConfigureLogging () override
 
virtual void Deinit_ShutdownLogging () override
 
virtual void Init_FileSystem_ConfigureDataDirs () override
 
virtual bool Run_ProcessApplicationInput () override
 
virtual plUniquePtr< plEditorEngineProcessAppCreateEngineProcessApp ()
 
virtual void ActivateGameStateAtStartup () override
 Allows to override whether a game state is created and activated at application startup.
 
- Protected Member Functions inherited from plGameApplication
virtual void Init_ConfigureInput () override
 
virtual void Init_ConfigureAssetManagement () override
 
virtual void Init_LoadRequiredPlugins () override
 
virtual void Init_SetupDefaultResources () override
 
virtual void Init_SetupGraphicsDevice () override
 
virtual void Deinit_ShutdownGraphicsDevice () override
 
virtual bool IsGameUpdateEnabled () const override
 
virtual void Run_AcquireImage () override
 This function can be used to acquire a new window from a swap-chain or do any other update operations on windows before the multi-threaded rendering and update phase starts.
 
virtual void Run_WorldUpdateAndRender () override
 
virtual void Run_PresentImage () override
 This function can be used to present the final image to a window. It is run at the end of the rendering phase. It can also be used to inspect the swap-chain e.g. for screenshot purposes before presenting.
 
virtual void Run_FinishFrame () override
 
void RenderFps ()
 
void RenderInfo ()
 
void RenderConsole ()
 
void UpdateWorldsAndExtractViews ()
 
- Protected Member Functions inherited from plGameApplicationBase
virtual void BeforeHighLevelSystemsShutdown () override
 This function is called after the application main loop has run for the last time, before engine deinitialization.
 
virtual void Deinit_UnloadPlugins ()
 
virtual void StoreScreenshot (plImage &&image, plStringView sContext={})
 Called with the result from taking a screenshot. The default implementation writes the image to disk at ':appdata/Screenshots'.
 
void ExecuteTakeScreenshot (plWindowOutputTargetBase *pOutputTarget, plStringView sContext={})
 
void ExecuteFrameCapture (plWindowHandle targetWindowHandle, plStringView sContext={})
 
virtual plUniquePtr< plGameStateBaseCreateGameState (plWorld *pWorld)
 Creates a game state for the application to use.
 
virtual plString GetBaseDataDirectoryPath () const
 Returns the target of the 'base' data directory.
 
virtual plString GetProjectDataDirectoryPath () const
 Returns the target of the 'project' data directory.
 
virtual void ExecuteBaseInitFunctions ()
 Executes all 'BaseInit_' functions. Typically done very early, before core system startup.
 
virtual void ExecuteInitFunctions ()
 Executes all 'Init_' functions. Typically done after core system startup.
 
virtual void Init_PlatformProfile_SetPreferred ()
 
virtual void Init_ConfigureTelemetry ()
 
virtual void Init_FileSystem_SetSpecialDirs ()
 
virtual void Init_LoadWorldModuleConfig ()
 
virtual void Init_PlatformProfile_LoadForRuntime ()
 
virtual void Init_ConfigureTags ()
 
virtual void Init_ConfigureCVars ()
 
virtual void Run_InputUpdate ()
 
virtual void Run_BeforeWorldUpdate ()
 
virtual void Run_AfterWorldUpdate ()
 
virtual void Run_UpdatePlugins ()
 
void UpdateFrameTime ()
 

Private Member Functions

virtual plString FindProjectDirectory () const override
 Implementation of plGameApplicationBase::FindProjectDirectory to define the 'project' special data directory.
 

Additional Inherited Members

- Static Public Member Functions inherited from plGameApplication
static plGameApplicationGetGameApplicationInstance ()
 Returns the plGameApplication singleton.
 
static plStringView GetActiveRenderer ()
 Returns the active renderer of the current app. Either the default or overridden via -render command line flag.
 
static void SetOverrideDefaultDeviceCreator (plDelegate< plGALDevice *(const plGALDeviceCreationDescription &)> creator)
 When the graphics device is created, by default the game application will pick a platform specific implementation. This function allows to override that by setting a custom function that creates a graphics device.
 
- Static Public Member Functions inherited from plGameApplicationBase
static plGameApplicationBaseGetGameApplicationBaseInstance ()
 Returns the plGameApplicationBase singleton.
 
- Static Public Member Functions inherited from plApplication
static plApplicationGetApplicationInstance ()
 Returns the one instance of plApplication that is available.
 
- Public Attributes inherited from plGameApplicationBase
plCopyOnBroadcastEvent< const plGameApplicationExecutionEvent & > m_ExecutionEvents
 
- Static Public Attributes inherited from plGameApplication
static plCVarBool cvar_AppVSync
 
static plCVarBool cvar_AppShowFPS
 
static plCVarBool cvar_AppShowInfo
 
- Protected Attributes inherited from plGameApplication
plString m_sAppProjectPath
 Stores what is given to the constructor.
 
bool m_bIgnoreErrors = false
 
plSharedPtr< plDelegateTask< void > > m_pUpdateTask
 
bool m_bShowConsole = false
 
plUniquePtr< plQuakeConsolem_pConsole
 
- Protected Attributes inherited from plGameApplicationBase
bool m_bTakeScreenshot = false
 
plConsoleFunction< void()> m_ConFunc_TakeScreenshot
 expose TakeScreenshot() as a console function
 
bool m_bContinuousFrameCapture = false
 
bool m_bCaptureFrame = false
 
plConsoleFunction< void()> m_ConFunc_CaptureFrame
 expose CaptureFrame() as a console function
 
plUniquePtr< plGameStateBasem_pGameState
 
plWorldm_pWorldLinkedWithGameState = nullptr
 
plPlatformProfile m_PlatformProfile
 
plEventSubscriptionID m_LogToConsoleID = 0
 
plEventSubscriptionID m_LogToVsID = 0
 
plEvent< const plGameApplicationStaticEvent & > m_StaticEvents
 
plTime m_FrameTime
 
- Protected Attributes inherited from plApplication
bool m_bWasQuitRequested = false
 
- Static Protected Attributes inherited from plGameApplication
static plGameApplications_pGameApplicationInstance = nullptr
 
static plDelegate< plGALDevice *(const plGALDeviceCreationDescription &)> s_DefaultDeviceCreator
 
- Static Protected Attributes inherited from plGameApplicationBase
static plGameApplicationBases_pGameApplicationBaseInstance = nullptr
 

Member Function Documentation

◆ ActivateGameStateAtStartup()

virtual void plEngineProcessGameApplication::ActivateGameStateAtStartup ( )
inlineoverrideprotectedvirtual

Allows to override whether a game state is created and activated at application startup.

The default implementation just calls ActivateGameState(), but applications that run inside the editor override this to do nothing, as they only want the game state to become active during simulation, not during editing.

Reimplemented from plGameApplicationBase.

◆ AfterCoreSystemsStartup()

void plEngineProcessGameApplication::AfterCoreSystemsStartup ( )
overridevirtual

This function is called after basic engine initialization has been done.

plApplication will automatically call plStartup::StartupCoreSystems() to initialize the application. This function can be overridden to do additional application specific initialization. To startup entire subsystems, you should however use the features provided by plStartup and plSubSystem.

Reimplemented from plGameApplicationBase.

◆ BaseInit_ConfigureLogging()

void plEngineProcessGameApplication::BaseInit_ConfigureLogging ( )
overrideprotectedvirtual

Reimplemented from plGameApplicationBase.

◆ BeforeCoreSystemsShutdown()

void plEngineProcessGameApplication::BeforeCoreSystemsShutdown ( )
overridevirtual

This function is called after the application main loop has run for the last time, before engine deinitialization.

Override this function to do application specific deinitialization that still requires a running engine. After this function returns plStartup::ShutdownCoreSystems() is called and thus everything, including allocators, is shut down. To shut down entire subsystems, you should, however, use the features provided by plStartup and plSubSystem.

Reimplemented from plGameApplicationBase.

◆ BeforeCoreSystemsStartup()

plResult plEngineProcessGameApplication::BeforeCoreSystemsStartup ( )
overridevirtual

This function is called before any kind of engine initialization is done.

Override this function to be able to configure subsystems, before they are initialized. After this function returns, plStartup::StartupCoreSystems() is automatically called. If you need to set up custom allocators, this is the place to do this.

Reimplemented from plGameApplicationBase.

◆ Deinit_ShutdownLogging()

void plEngineProcessGameApplication::Deinit_ShutdownLogging ( )
overrideprotectedvirtual

Reimplemented from plGameApplicationBase.

◆ FindProjectDirectory()

plString plEngineProcessGameApplication::FindProjectDirectory ( ) const
overrideprivatevirtual

Implementation of plGameApplicationBase::FindProjectDirectory to define the 'project' special data directory.

The default implementation will try to resolve m_sAppProjectPath to an absolute path. m_sAppProjectPath can be absolute itself, relative to ">sdk/" or relative to plOSFile::GetApplicationDirectory(). m_sAppProjectPath must be set either via the plGameApplication constructor or manually set before project.

Alternatively, plGameApplication::FindProjectDirectory() must be overwritten.

Reimplemented from plGameApplication.

◆ Init_FileSystem_ConfigureDataDirs()

void plEngineProcessGameApplication::Init_FileSystem_ConfigureDataDirs ( )
overrideprotectedvirtual

Reimplemented from plGameApplicationBase.

◆ Init_LoadProjectPlugins()

void plEngineProcessGameApplication::Init_LoadProjectPlugins ( )
overrideprivatevirtual

Reimplemented from plGameApplicationBase.

◆ Run()

plApplication::Execution plEngineProcessGameApplication::Run ( )
overridevirtual

Main run function which is called periodically. This function must be overridden.

Return Execution::Quit when the application should quit. You may set a return code via SetReturnCode() beforehand.

Reimplemented from plGameApplicationBase.

◆ Run_ProcessApplicationInput()

bool plEngineProcessGameApplication::Run_ProcessApplicationInput ( )
overrideprotectedvirtual

Reimplemented from plGameApplication.


The documentation for this class was generated from the following files: