Class Application#

Nested Relationships#

Nested Types#

Class Documentation#

class Application#

Public Functions

explicit Application(std::string gameName, std::optional<u32> appID = std::nullopt)#

Constructor.

Remark

Headless mode: SteamAPI won’t be initialized automatically, clients should manually initialize it using TRAP::Utils::Steam::InitializeServer().

Parameters:
  • gameName – Name of the game.

  • appIDOptional: Steam AppID for this application. If appID is a valid Steam AppID then the SteamAPI for clients will be initialized.

virtual ~Application()#

Destructor.

consteval Application(const Application&) = delete#

Copy constructor.

consteval Application &operator=(const Application&) = delete#

Copy assignment operator.

consteval Application(Application&&) noexcept = delete#

Move constructor.

consteval Application &operator=(Application&&) noexcept = delete#

Move assignment operator.

void PushLayer(std::unique_ptr<Layer> layer)#

Pushes a layer to the applications layer stack.

Parameters:

layer – Unique ptr containing the layer to be pushed.

void PushOverlay(std::unique_ptr<Layer> overlay)#

Pushes a layer to the applications layer stack.

Parameters:

overlay – Unique ptr containing the layer to be pushed.

Public Static Functions

static const Utils::Config &GetConfig()#

Get the Engine.cfg config from the application.

Returns:

Constant reference to the config.

static LayerStack &GetLayerStack()#

Get the layer stack from the application.

Returns:

Reference to the layer stack.

static ImGuiLayer &GetImGuiLayer()#

Get the default ImGuiLayer.

Remark

Headless mode: This function is not available in headless mode.

Returns:

Reference to ImGuiLayer.

static void SetFPSLimit(u32 targetFPS)#

Set a FPS limit.

Note

Valid FPS range is 25 - 500 (values outside this range are clamped). 0 sets unlimited FPS.

Parameters:

targetFPS – FPS to limit to.

static u32 GetFPSLimit()#

Retrieve the current FPS limit.

Note

0 means unlimited FPS.

Returns:

Current FPS limit.

static void SetUnfocusedFPSLimit(u32 targetFPS)#

Set a FPS limit when not focused.

Note

Valid FPS range is 10 - 500 (values outside this range are clamped). 0 sets unlimited FPS.

Parameters:

targetFPS – FPS to limit to.

static u32 GetUnfocusedFPSLimit()#

Retrieve the current FPS limit when unfocused.

Note

0 means unlimited FPS.

Returns:

Current FPS limit.

static f32 GetCPUFrameTime()#

Get the current CPU frame time.

Returns:

Current CPU frame time.

static f32 GetTimeScale()#

Get the current time scale.

Returns:

Current time scale.

static u32 GetTickRate()#

Get the current tick rate (Default: 64).

Returns:

Current tick rate.

static void SetTickRate(u32 tickRate)#

Set the tick rate (fixed update interval for OnTick()).

Parameters:

tickRate – New Tick rate.

static void SetTimeScale(f32 timeScale)#

Set the time scale.

Parameters:

timeScale – Time scale.

static void SetNewRenderAPI(Graphics::RenderAPI renderAPI)#

Sets the RenderAPI to be used on the next start of the engine.

Parameters:

renderAPI – New RenderAPI to be used.

static void Shutdown()#

Shutdown the engine.

static Window *GetWindow()#

Get the Main Render window.

Remark

Headless mode: This function is not available in headless mode.

Returns:

Pointer to the main render window.

static Utils::TimeStep GetTime()#

Get the Time since the Engine was started.

Returns:

Time step containing the passed time since the engine was started.

static ThreadPool &GetThreadPool()#

Get the thread pool to be used for small tasks that can be multi-threaded.

Returns:

Reference to the thread pool.

static void SetClipboardString(const std::string &string)#

Set the content of the clipboard.

Remark

Headless mode: This function is not available in headless mode.

Parameters:

string – Content to set the clipboard to.

static std::string GetClipboardString()#

Get current content of the clipboard.

Remark

Headless mode: This function is not available in headless mode.

Returns:

Content of the clipboard as string.

static std::thread::id GetMainThreadID()#

Get the id of the main engine thread.

Returns:

Main thread ID.

static std::string GetGameName()#

Get the name of the game.

Returns:

Name of the game.

static std::optional<std::reference_wrapper<TRAP::FileSystem::FileSystemWatcher>> GetHotReloadingFileSystemWatcher()#

Get the hot reloading filesystem watcher.

Returns:

Reference to TRAP::FileSystem::FileSystemWatcher if filesystem watcher is running, empty optional otherwise.

static bool IsHotReloadingEnabled()#

Get whether hot reloading is enabled or not.

Returns:

True if hot reloading is enabled, false otherwise.

static void SetHotReloading(bool enable)#

Set whether to enable or disable hot reloading.

Parameters:

enable – True to enable hot reloading, false otherwise.