CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::Application Class Reference

A base class to be used by all engine applications. More...

#include <CeresEngine/Application.hpp>

Inheritance diagram for CeresEngine::Application:
CeresEngine::Engine

Public Member Functions

 Application (const Vector< StringView > &arguments={})
 Creates a new application instance.
 
 Application (const char *argv[], int argc)
 Creates a new application instance.
 
 ~Application () override
 Destroys the application instance.
 
virtual bool prepareStartUp ()
 A method called to prepare the application for start-up.
 
virtual void startUp ()
 A method called to perform the application for start-up.
 
virtual void shutDown ()
 A method called to perform the application for shutdown.
 
virtual void update ()
 A method called by the application on every update loop.
 
void updateFromPlatform ()
 A temporary function that must be invoked by the platform on every update tick.
 
int run ()
 Runs the engine main loop.
 
- Public Member Functions inherited from CeresEngine::Engine
 Engine ()
 Creates a new engine instance.
 
 Engine (const Engine &engine)=delete
 
Engineoperator= (const Engine &engine)=delete
 
virtual ~Engine ()
 Destroys the engine instance.
 

Static Public Member Functions

static Applicationshared () noexcept
 
- Static Public Member Functions inherited from CeresEngine::Engine
static Engineshared () noexcept
 

Public Attributes

const Vector< StringViewarguments
 The argument given to the application command line.
 
- Public Attributes inherited from CeresEngine::Engine
UPtr< ExecutionContextbackgroundQueue
 A work queue that gets drained by several background threads.
 
Service< RunLoopmainRunLoop
 The engine's main thread run loop.
 
Service< ResourceManagerresourceManager
 The engine's resource manager.
 
Service< RenderAPIrenderAPI
 The engine's render API.
 
Service< AudioAPIaudioAPI
 The engine's audio API.
 
Service< InputProviderinputProvider
 The engine's input provider.
 
Service< InputManagerinputManager
 The engine's input manager.
 
Service< SceneManagersceneManager
 The engine's scene manager. Handles the simulation of a scene.
 
Service< Rendererrenderer
 The engine's scene renderer. Can be null if rendering is disabled.
 
Service< Platformplatform
 The engine's platform implementation.
 
Service< URLSessionurlSession
 The engine URL session service.
 
double lastSimulationTime = 0.0
 The amount of time took to render the last frame.
 
double lastRenderTime = 0.0
 The amount of time took to render the last frame.
 
UInt64 visibleObjects = 0
 

Protected Member Functions

virtual void createCommandLineParser (CommandLineInterface &cli)
 A method called by the engine whenever it is creating the command line parser.
 

Private Attributes

bool mShouldExitProgram = false
 A flag set by Window::didClose to indicate that the engine's main loop should exit when the window gets closed.
 
SteadyClockDate mLastRenderTime
 The last time a frame was rendered by the engine.
 

Detailed Description

A base class to be used by all engine applications.

This class can be used to initialize engine, game and application services.

Constructor & Destructor Documentation

◆ Application() [1/2]

CeresEngine::Application::Application ( const Vector< StringView > &  arguments = {})
explicit

Creates a new application instance.

Parameters
argumentsThe command line arguments.

◆ Application() [2/2]

CeresEngine::Application::Application ( const char argv[],
int  argc 
)
explicit

Creates a new application instance.

Parameters
argvThe command-line argument array given by the OS.
argcThe number of command-line arguments in argv.

◆ ~Application()

CeresEngine::Application::~Application ( )
override

Destroys the application instance.

Member Function Documentation

◆ createCommandLineParser()

virtual void CeresEngine::Application::createCommandLineParser ( CommandLineInterface cli)
protectedvirtual

A method called by the engine whenever it is creating the command line parser.

Applications can override this method to add custom command line arguments.

◆ prepareStartUp()

virtual bool CeresEngine::Application::prepareStartUp ( )
virtual

A method called to prepare the application for start-up.

◆ run()

int CeresEngine::Application::run ( )

Runs the engine main loop.

This method will normally not return until the user has left the game (by triggering exitAction) or closed the application window.

Returns
The return code

◆ shared()

static Application & CeresEngine::Application::shared ( )
staticnoexcept
Returns
A shared instance of the engine

◆ shutDown()

virtual void CeresEngine::Application::shutDown ( )
virtual

A method called to perform the application for shutdown.

◆ startUp()

virtual void CeresEngine::Application::startUp ( )
virtual

A method called to perform the application for start-up.

◆ update()

virtual void CeresEngine::Application::update ( )
virtual

A method called by the application on every update loop.

◆ updateFromPlatform()

void CeresEngine::Application::updateFromPlatform ( )

A temporary function that must be invoked by the platform on every update tick.

Member Data Documentation

◆ arguments

const Vector<StringView> CeresEngine::Application::arguments

The argument given to the application command line.

◆ mLastRenderTime

SteadyClockDate CeresEngine::Application::mLastRenderTime
private

The last time a frame was rendered by the engine.

This is used to compute the time interval since two frames.

◆ mShouldExitProgram

bool CeresEngine::Application::mShouldExitProgram = false
private

A flag set by Window::didClose to indicate that the engine's main loop should exit when the window gets closed.


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