|
SleakEngine 1.0.0
C++23 multi-backend game engine
|
#include <Application.hpp>
Public Member Functions | |
| Application (ApplicationDefaults settings) | |
| Application (const char *ProjectName) | |
| ~Application () | |
| void | ApplyGraphicsConfig (const GraphicsConfig &cfg) |
| Pushes every field of cfg onto the active renderer in one call. | |
| void | CloseApplication () |
| Benchmark * | GetBenchmark () |
| int | GetFPS () const |
| Frames rendered in the last second. | |
| float | GetFrameTime () const |
| Duration of the last frame, in seconds. | |
| GameBase * | GetGame () |
| size_t | GetGPUMemoryBudget () const |
| size_t | GetGPUMemoryUsed () const |
| uint32_t | GetGraphicsCaps () const |
| const GraphicsConfig & | GetGraphicsConfig () const |
| Config last passed to ApplyGraphicsConfig(). | |
| float | GetIBLIntensity () const |
| uint32_t | GetMaxMSAASampleCount () const |
| uint32_t | GetMSAASampleCount () const |
| RenderEngine::Renderer * | GetRenderer () |
| Active renderer backend, or null before Run() initializes it. | |
| void | GetRendererTypeColor (float &r, float &g, float &b) const |
| UI accent color associated with the active backend. | |
| const char * | GetRendererTypeStr () const |
| Human-readable name of the active backend (e.g. "Vulkan"). | |
| float | GetSSAOBias () const |
| float | GetSSAOPower () const |
| float | GetSSAORadius () const |
| int | GetTriangles () const |
| Triangles submitted in the last frame. | |
| int | GetVertices () const |
| Vertices submitted in the last frame. | |
| bool | GetVSync () const |
| Window & | GetWindow () |
| bool | IsBloomEnabled () const |
| bool | IsIBLEnabled () const |
| bool | IsSSAOEnabled () const |
| bool | IsSSREnabled () const |
| bool | IsTAAEnabled () const |
| void | OnKeyPressed (const Sleak::Events::Input::KeyPressedEvent &e) |
| Handles engine-level hotkeys (F9 camera toggle, F11 fullscreen, F12 benchmark, Esc). | |
| void | onMouseClick (const Sleak::Events::Input::MouseButtonPressedEvent &e) |
| void | onMouseMove (const Sleak::Events::Input::MouseMovedEvent &e) |
| void | OnWindowFullScreen (const Sleak::Events::WindowFullScreen &e) |
| Treats entering/leaving fullscreen as a resize to the current window size. | |
| void | OnWindowResize (const Sleak::Events::WindowResizeEvent &e) |
| Stashes the new size; the resize is applied at the start of the next frame. | |
| Application & | operator= (Application &&)=delete |
| Application & | operator= (const Application &)=delete |
| int | Run (GameBase *game) |
| Drives the game loop until the window closes; returns the process exit code. | |
| void | SetBloomEnabled (bool enabled) |
| void | SetCursorVisible (bool visible) |
| void | SetIBLEnabled (bool enabled) |
| void | SetIBLIntensity (float intensity) |
| void | SetMouseRelativeMode (bool enabled) |
| void | SetMSAASampleCount (uint32_t samples) |
| void | SetSSAOBias (float bias) |
| void | SetSSAOEnabled (bool enabled) |
| void | SetSSAOPower (float power) |
| void | SetSSAORadius (float radius) |
| void | SetSSREnabled (bool enabled) |
| void | SetTAAEnabled (bool enabled) |
| void | SetVSync (bool enabled) |
| void | WaitGPUIdle () |
| Blocks until the GPU finishes all in-flight work. Call before tearing down scene resources. | |
Static Public Member Functions | |
| static Application * | GetInstance () |
| The one Application for this process, or null before construction. | |
Owns the window, renderer, and game loop. One instance per process, reachable globally through GetInstance().
Construct one in main(), hand it your GameBase, and call Run(). It creates the window, selects a graphics backend, and then drives the frame loop until the window closes: poll events, update the active scene, call GameBase::Loop, render, present.
The backend comes from the -r command line flag when Sleak::CommandLine::Parse has run, otherwise from the platform default (DirectX 11 on Windows, Vulkan elsewhere). Window size and title honor -w, -h, and -t the same way.
Everything on this class is main-thread only. Constructing a second Application throws.
Rendering quality settings (MSAA, VSync, SSAO, SSR, TAA, bloom, IBL) can be changed at any point after Run() starts. Settings that belong to the deferred path are ignored by backends that do not implement it, so check GetGraphicsCaps() before exposing them in a settings UI.
Definition at line 109 of file Application.hpp.
| Sleak::Application::Application | ( | const char * | ProjectName | ) |
Definition at line 46 of file Application.cpp.
| Sleak::Application::Application | ( | ApplicationDefaults | settings | ) |
Definition at line 52 of file Application.cpp.
| Sleak::Application::~Application | ( | ) |
Definition at line 102 of file Application.cpp.
| void Sleak::Application::ApplyGraphicsConfig | ( | const GraphicsConfig & | cfg | ) |
Pushes every field of cfg onto the active renderer in one call.
Definition at line 413 of file Application.cpp.
| void Sleak::Application::CloseApplication | ( | ) |
Definition at line 345 of file Application.cpp.
|
inline |
Definition at line 194 of file Application.hpp.
| int Sleak::Application::GetFPS | ( | ) | const |
Frames rendered in the last second.
Definition at line 365 of file Application.cpp.
| float Sleak::Application::GetFrameTime | ( | ) | const |
Duration of the last frame, in seconds.
Definition at line 366 of file Application.cpp.
|
inline |
Definition at line 130 of file Application.hpp.
| size_t Sleak::Application::GetGPUMemoryBudget | ( | ) | const |
Definition at line 370 of file Application.cpp.
| size_t Sleak::Application::GetGPUMemoryUsed | ( | ) | const |
Definition at line 369 of file Application.cpp.
| uint32_t Sleak::Application::GetGraphicsCaps | ( | ) | const |
Definition at line 436 of file Application.cpp.
| const GraphicsConfig & Sleak::Application::GetGraphicsConfig | ( | ) | const |
Config last passed to ApplyGraphicsConfig().
Definition at line 432 of file Application.cpp.
| float Sleak::Application::GetIBLIntensity | ( | ) | const |
Definition at line 401 of file Application.cpp.
|
inlinestatic |
The one Application for this process, or null before construction.
Definition at line 133 of file Application.hpp.
| uint32_t Sleak::Application::GetMaxMSAASampleCount | ( | ) | const |
Definition at line 384 of file Application.cpp.
| uint32_t Sleak::Application::GetMSAASampleCount | ( | ) | const |
Definition at line 383 of file Application.cpp.
|
inline |
Active renderer backend, or null before Run() initializes it.
Definition at line 129 of file Application.hpp.
| void Sleak::Application::GetRendererTypeColor | ( | float & | r, |
| float & | g, | ||
| float & | b ) const |
UI accent color associated with the active backend.
Definition at line 373 of file Application.cpp.
| const char * Sleak::Application::GetRendererTypeStr | ( | ) | const |
Human-readable name of the active backend (e.g. "Vulkan").
Definition at line 371 of file Application.cpp.
| float Sleak::Application::GetSSAOBias | ( | ) | const |
Definition at line 394 of file Application.cpp.
| float Sleak::Application::GetSSAOPower | ( | ) | const |
Definition at line 396 of file Application.cpp.
| float Sleak::Application::GetSSAORadius | ( | ) | const |
Definition at line 392 of file Application.cpp.
| int Sleak::Application::GetTriangles | ( | ) | const |
Triangles submitted in the last frame.
Definition at line 368 of file Application.cpp.
| int Sleak::Application::GetVertices | ( | ) | const |
Vertices submitted in the last frame.
Definition at line 367 of file Application.cpp.
| bool Sleak::Application::GetVSync | ( | ) | const |
Definition at line 387 of file Application.cpp.
| Window & Sleak::Application::GetWindow | ( | ) |
Definition at line 341 of file Application.cpp.
| bool Sleak::Application::IsBloomEnabled | ( | ) | const |
Definition at line 410 of file Application.cpp.
| bool Sleak::Application::IsIBLEnabled | ( | ) | const |
Definition at line 399 of file Application.cpp.
| bool Sleak::Application::IsSSAOEnabled | ( | ) | const |
Definition at line 390 of file Application.cpp.
| bool Sleak::Application::IsSSREnabled | ( | ) | const |
Definition at line 404 of file Application.cpp.
| bool Sleak::Application::IsTAAEnabled | ( | ) | const |
Definition at line 407 of file Application.cpp.
| void Sleak::Application::OnKeyPressed | ( | const Sleak::Events::Input::KeyPressedEvent & | e | ) |
Handles engine-level hotkeys (F9 camera toggle, F11 fullscreen, F12 benchmark, Esc).
Definition at line 290 of file Application.cpp.
| void Sleak::Application::onMouseClick | ( | const Sleak::Events::Input::MouseButtonPressedEvent & | e | ) |
Definition at line 283 of file Application.cpp.
| void Sleak::Application::onMouseMove | ( | const Sleak::Events::Input::MouseMovedEvent & | e | ) |
Definition at line 287 of file Application.cpp.
| void Sleak::Application::OnWindowFullScreen | ( | const Sleak::Events::WindowFullScreen & | e | ) |
Treats entering/leaving fullscreen as a resize to the current window size.
Definition at line 273 of file Application.cpp.
| void Sleak::Application::OnWindowResize | ( | const Sleak::Events::WindowResizeEvent & | e | ) |
Stashes the new size; the resize is applied at the start of the next frame.
Definition at line 266 of file Application.cpp.
|
delete |
|
delete |
| int Sleak::Application::Run | ( | GameBase * | game | ) |
Drives the game loop until the window closes; returns the process exit code.
Definition at line 126 of file Application.cpp.
| void Sleak::Application::SetBloomEnabled | ( | bool | enabled | ) |
Definition at line 411 of file Application.cpp.
| void Sleak::Application::SetCursorVisible | ( | bool | visible | ) |
Definition at line 353 of file Application.cpp.
| void Sleak::Application::SetIBLEnabled | ( | bool | enabled | ) |
Definition at line 400 of file Application.cpp.
| void Sleak::Application::SetIBLIntensity | ( | float | intensity | ) |
Definition at line 402 of file Application.cpp.
| void Sleak::Application::SetMouseRelativeMode | ( | bool | enabled | ) |
Definition at line 360 of file Application.cpp.
| void Sleak::Application::SetMSAASampleCount | ( | uint32_t | samples | ) |
Definition at line 385 of file Application.cpp.
| void Sleak::Application::SetSSAOBias | ( | float | bias | ) |
Definition at line 395 of file Application.cpp.
| void Sleak::Application::SetSSAOEnabled | ( | bool | enabled | ) |
Definition at line 391 of file Application.cpp.
| void Sleak::Application::SetSSAOPower | ( | float | power | ) |
Definition at line 397 of file Application.cpp.
| void Sleak::Application::SetSSAORadius | ( | float | radius | ) |
Definition at line 393 of file Application.cpp.
| void Sleak::Application::SetSSREnabled | ( | bool | enabled | ) |
Definition at line 405 of file Application.cpp.
| void Sleak::Application::SetTAAEnabled | ( | bool | enabled | ) |
Definition at line 408 of file Application.cpp.
| void Sleak::Application::SetVSync | ( | bool | enabled | ) |
Definition at line 388 of file Application.cpp.
| void Sleak::Application::WaitGPUIdle | ( | ) |
Blocks until the GPU finishes all in-flight work. Call before tearing down scene resources.
Definition at line 349 of file Application.cpp.