Berserk
Public Member Functions | List of all members
Application Class Reference

Game application main class. More...

#include <Application.hpp>

Public Member Functions

virtual BRK_API ~Application ()=default
 
BRK_API int Run (int argc, const char *const *argv)
 Application entry point. More...
 
virtual BRK_API void OnWindowCreate ()
 On application primary window creation. More...
 
virtual BRK_API void OnInitialize ()
 On application initialize callback. More...
 
virtual void OnPreUpdate ()
 Called each frame before engine update. More...
 
virtual void OnPostUpdate ()
 Called each frame after engine update. More...
 
virtual BRK_API void OnFinalize ()
 On application finalize callback. More...
 

Detailed Description

Game application main class.

Application class is an entry point and main loop manager for an end user application or a game. Controls overall application and engine setup. Allows to customise various stages of the application by overriding On* callback functions.

Example of the usage in the game bellow:

int main(int argc, const char* const *argv) {
return app.Run(argc, argv);
}
Game application main class.
Definition: Application.hpp:63
BRK_API int Run(int argc, const char *const *argv)
Application entry point.
Definition: Application.cpp:38

Constructor & Destructor Documentation

◆ ~Application()

virtual BRK_API Application::~Application ( )
virtualdefault

Member Function Documentation

◆ OnFinalize()

virtual BRK_API void Application::OnFinalize ( )
inlinevirtual

On application finalize callback.

Called once, before the engine systems are finalized. Override this method in our application game to add custom init finalize to the engine and application.

◆ OnInitialize()

virtual BRK_API void Application::OnInitialize ( )
inlinevirtual

On application initialize callback.

Called once, when the engine systems fully initialized. Override this method in our application game to add custom init logic to the engine and application.

◆ OnPostUpdate()

virtual void Application::OnPostUpdate ( )
inlinevirtual

Called each frame after engine update.

Override this method to add custom pre update logic of the application inside main thread loop

◆ OnPreUpdate()

virtual void Application::OnPreUpdate ( )
inlinevirtual

Called each frame before engine update.

Override this method to add custom pre update logic of the application inside main thread loop

◆ OnWindowCreate()

virtual BRK_API void Application::OnWindowCreate ( )
inlinevirtual

On application primary window creation.

Called once, when the engine is ready to create primary window, but not yet set up rendering and RHI device layer. Override this method to create your primary application window.

◆ Run()

BRK_NS_BEGIN int Application::Run ( int  argc,
const char *const *  argv 
)

Application entry point.

This function initializes application and engine system, and enters main application loop of the game update. This function blocks execution flow and returns only when game is finished (or close of the application is requested).

Parameters
argcInput args count; must be passed from main
argvInput args list; must be passed from main
Returns
Status code after execution; 0 on success

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