class Application

Primary entry point for the framework.

Handles startup and shutdown.

Public

Constructors

Application

Application(const ApplicationCreateInformation &createInformation)

Application

Application(VideoMode videoMode, const String &title, bool fullscreen)

Methods

~Application

~Application() noexcept override

RunMainLoop

void RunMainLoop()

Executes the main loop.

This will update your components and modules, queue objects for rendering and run the simulation. Usually called immediately after startUp().

This will run infinitely until stopMainLoop is called (usually from another thread or internally).

StopMainLoop

void StopMainLoop()

Stops the (infinite) main loop from running.

The loop will complete its current cycle before stopping.

IsMainLoopRunning

bool IsMainLoopRunning() const

SetFpsLimit

void SetFpsLimit(u32 limit)

Changes the maximum FPS the application is allowed to run in.

Zero means unlimited.

NotifyQuitRequested

virtual void NotifyQuitRequested()

Issues a request for the application to close.

Application may choose to ignore the request depending on the circumstances and the implementation.

BeginMainLoop

virtual void BeginMainLoop()

Call before the first time runMainLoopFrame is called

EndMainLoop

virtual void EndMainLoop()

Call after the last time runMainLoopFrame is called

RunMainLoopFrame

void RunMainLoopFrame()

Alternative to runMainLoop, processes one step at a time

WaitUntilFrameFinished

void WaitUntilFrameFinished()

Waits until previous frame is complete

GetPrimaryWindow

SPtr<RenderWindow> GetPrimaryWindow() const

Returns the main window that was created on application start-up.

GetPrimaryGpuDevice

SPtr<GpuDevice> GetPrimaryGpuDevice() const

Returns the primary GPU on which to perform rendering.

GetMainThreadId

ThreadId GetMainThreadId() const

Returns a unique identifier of the main thread.

IsEditor

virtual bool IsEditor() const

Returns true if the application is running in an editor, false if standalone.

GetApplicationCache

PersistentCache &GetApplicationCache()

Returns cache for storing application-wide data that persists application reset.

GetTaskScheduler

Scheduler &GetTaskScheduler() const

Returns the scheduler on which you can queue tasks on for execution on worker threads.

GetMainThreadScheduler

Scheduler &GetMainThreadScheduler()

Returns the scheduler responsible for running tasks on the main thread.

ShowProfilerOverlay

void ShowProfilerOverlay(ProfilerOverlayType type, const HCamera &camera = nullptr)

Shows the profiler overlay.

type
Type of information to display on the overlay.
camera
Camera to show the overlay on. If none the overlay will be shown on the main camera.

HideProfilerOverlay

void HideProfilerOverlay()

Hides the profiler overlay.

LoadPlugin

void *LoadPlugin(const String &pluginName, void *passThrough = nullptr)

Loads a plugin.

pluginName
Name of the plugin to load, without extension.
passThrough
Optional parameter that will be passed to the loadPlugin function.

Returns: Value returned from the plugin start-up method.

UnloadPlugin

void UnloadPlugin(const String &pluginName)

Unloads a previously loaded plugin.

UnloadAllPlugins

void UnloadAllPlugins()

Unloads all loaded plugins.

staticBuildCreateInformation

static ApplicationCreateInformation BuildCreateInformation(VideoMode videoMode, const String &title, bool fullscreen)

Builds the start-up descriptor structure, filling out the provided parameters and using the default values for the rest.

staticInstance

static T &Instance()

Returns a reference to the module instance.

Module has to have been started up first otherwise an exception will be thrown.

staticInstancePtr

static T *InstancePtr()

Returns a pointer to the module instance.

Module has to have been started up first otherwise an exception will be thrown.

staticShutDown

static void ShutDown()

Shuts down this module and frees any resources it is using.

staticIsStarted

static bool IsStarted()

Query if the module has been started.

Protected

Methods

OnStartUp

void OnStartUp() override

Override if you want your module to be notified once it has been constructed and started.

OnShutDown

void OnShutDown() override

Override if you want your module to be notified just before it is deleted.

PreUpdate

virtual void PreUpdate()

Called for each iteration of the main loop.

Called before any game objects or plugins are updated.

PostUpdate

virtual void PostUpdate()

Called for each iteration of the main loop.

Called after all game objects and plugins are updated.

StartUpRenderer

virtual void StartUpRenderer()

Initializes the renderer specified during construction.

Called during initialization.

GetShaderIncludeHandler

virtual SPtr<IShaderIncludeHandler> GetShaderIncludeHandler() const

Returns a handler that is used for resolving shader include file paths.

StartUpScriptManager

virtual void StartUpScriptManager()

Initializes the script manager.

UpdateScriptManager

virtual void UpdateScriptManager()

Calls per-frame update on the script manager.

FrameRenderingFinishedCallback

void FrameRenderingFinishedCallback()

Called when the frame finishes rendering.

BeginRenderThreadProfiling

void BeginRenderThreadProfiling()

Called by the render thread to begin profiling.

EndRenderThreadProfiling

void EndRenderThreadProfiling()

Called by the render thread to end profiling.

~Module<T>

virtual ~Module<T>() = default

staticInstanceInternal

static T *&InstanceInternal()

Returns a singleton instance of this module.

staticIsDestroyed

static bool &IsDestroyed()

Checks has the Module been shut down.

staticIsStartedUp

static bool &IsStartedUp()

Checks has the Module been started up.

Fields

mPrimaryWindow

SPtr<RenderWindow> mPrimaryWindow

mPrimaryGpu

SPtr<GpuDevice> mPrimaryGpu

mMainThreadScheduler

Scheduler mMainThreadScheduler

mTaskScheduler

SPtr<Scheduler> mTaskScheduler

mInformation

mFrameStep

u64 mFrameStep

mLastFrameTime

u64 mLastFrameTime

mExitAfterNFrames

u32 mExitAfterNFrames

0 = unlimited.

mApplicationCache

SPtr<PersistentCache> mApplicationCache

mProfilerOverlay

SPtr<ProfilerOverlay> mProfilerOverlay

mLoadedPlugins

UnorderedMap<String, LoadedPlugin> mLoadedPlugins

mFrameRenderingFinishedSignal

SignalEvent mFrameRenderingFinishedSignal

mSimThreadId

ThreadId mSimThreadId

mRunMainLoop

volatile bool mRunMainLoop

mSnapshotTestRunner

UPtr<SnapshotTestRunner> mSnapshotTestRunner