|
SleakEngine 0.1.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 |
| const bool | GetIsDeferredEnabled () const |
| Deferred rendering. | |
| 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 | GetSharpenStrength () const |
| Post-TAA contrast-adaptive sharpening strength, 0 = off, 1 = strongest. | |
| 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 | SetDeferredEnabled (bool enabled) |
| void | SetIBLEnabled (bool enabled) |
| void | SetIBLIntensity (float intensity) |
| void | SetMouseRelativeMode (bool enabled) |
| void | SetMSAASampleCount (uint32_t samples) |
| void | SetSharpenStrength (float strength) |
| Sets post-TAA sharpening strength; only applied on frames TAA resolves. | |
| 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 50 of file Application.cpp.
| Sleak::Application::Application | ( | ApplicationDefaults | settings | ) |
Definition at line 56 of file Application.cpp.
| Sleak::Application::~Application | ( | ) |
Definition at line 106 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 478 of file Application.cpp.
| void Sleak::Application::CloseApplication | ( | ) |
Definition at line 396 of file Application.cpp.
|
inline |
Definition at line 203 of file Application.hpp.
| int Sleak::Application::GetFPS | ( | ) | const |
Frames rendered in the last second.
Definition at line 416 of file Application.cpp.
| float Sleak::Application::GetFrameTime | ( | ) | const |
Duration of the last frame, in seconds.
Definition at line 417 of file Application.cpp.
|
inline |
Definition at line 130 of file Application.hpp.
| size_t Sleak::Application::GetGPUMemoryBudget | ( | ) | const |
Definition at line 421 of file Application.cpp.
| size_t Sleak::Application::GetGPUMemoryUsed | ( | ) | const |
Definition at line 420 of file Application.cpp.
| uint32_t Sleak::Application::GetGraphicsCaps | ( | ) | const |
Definition at line 502 of file Application.cpp.
| const GraphicsConfig & Sleak::Application::GetGraphicsConfig | ( | ) | const |
Config last passed to ApplyGraphicsConfig().
Definition at line 498 of file Application.cpp.
| float Sleak::Application::GetIBLIntensity | ( | ) | const |
Definition at line 459 of file Application.cpp.
|
inlinestatic |
The one Application for this process, or null before construction.
Definition at line 133 of file Application.hpp.
| const bool Sleak::Application::GetIsDeferredEnabled | ( | ) | const |
Deferred rendering.
Definition at line 441 of file Application.cpp.
| uint32_t Sleak::Application::GetMaxMSAASampleCount | ( | ) | const |
Definition at line 435 of file Application.cpp.
| uint32_t Sleak::Application::GetMSAASampleCount | ( | ) | const |
Definition at line 434 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 424 of file Application.cpp.
| const char * Sleak::Application::GetRendererTypeStr | ( | ) | const |
Human-readable name of the active backend (e.g. "Vulkan").
Definition at line 422 of file Application.cpp.
| float Sleak::Application::GetSharpenStrength | ( | ) | const |
Post-TAA contrast-adaptive sharpening strength, 0 = off, 1 = strongest.
Definition at line 468 of file Application.cpp.
| float Sleak::Application::GetSSAOBias | ( | ) | const |
Definition at line 452 of file Application.cpp.
| float Sleak::Application::GetSSAOPower | ( | ) | const |
Definition at line 454 of file Application.cpp.
| float Sleak::Application::GetSSAORadius | ( | ) | const |
Definition at line 450 of file Application.cpp.
| int Sleak::Application::GetTriangles | ( | ) | const |
Triangles submitted in the last frame.
Definition at line 419 of file Application.cpp.
| int Sleak::Application::GetVertices | ( | ) | const |
Vertices submitted in the last frame.
Definition at line 418 of file Application.cpp.
| bool Sleak::Application::GetVSync | ( | ) | const |
Definition at line 438 of file Application.cpp.
| Window & Sleak::Application::GetWindow | ( | ) |
Definition at line 392 of file Application.cpp.
| bool Sleak::Application::IsBloomEnabled | ( | ) | const |
Definition at line 475 of file Application.cpp.
| bool Sleak::Application::IsIBLEnabled | ( | ) | const |
Definition at line 457 of file Application.cpp.
| bool Sleak::Application::IsSSAOEnabled | ( | ) | const |
Definition at line 448 of file Application.cpp.
| bool Sleak::Application::IsSSREnabled | ( | ) | const |
Definition at line 462 of file Application.cpp.
| bool Sleak::Application::IsTAAEnabled | ( | ) | const |
Definition at line 465 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 341 of file Application.cpp.
| void Sleak::Application::onMouseClick | ( | const Sleak::Events::Input::MouseButtonPressedEvent & | e | ) |
Definition at line 334 of file Application.cpp.
| void Sleak::Application::onMouseMove | ( | const Sleak::Events::Input::MouseMovedEvent & | e | ) |
Definition at line 338 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 324 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 317 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 130 of file Application.cpp.
| void Sleak::Application::SetBloomEnabled | ( | bool | enabled | ) |
Definition at line 476 of file Application.cpp.
| void Sleak::Application::SetCursorVisible | ( | bool | visible | ) |
Definition at line 404 of file Application.cpp.
| void Sleak::Application::SetDeferredEnabled | ( | bool | enabled | ) |
Definition at line 444 of file Application.cpp.
| void Sleak::Application::SetIBLEnabled | ( | bool | enabled | ) |
Definition at line 458 of file Application.cpp.
| void Sleak::Application::SetIBLIntensity | ( | float | intensity | ) |
Definition at line 460 of file Application.cpp.
| void Sleak::Application::SetMouseRelativeMode | ( | bool | enabled | ) |
Definition at line 411 of file Application.cpp.
| void Sleak::Application::SetMSAASampleCount | ( | uint32_t | samples | ) |
Definition at line 436 of file Application.cpp.
| void Sleak::Application::SetSharpenStrength | ( | float | strength | ) |
Sets post-TAA sharpening strength; only applied on frames TAA resolves.
Definition at line 471 of file Application.cpp.
| void Sleak::Application::SetSSAOBias | ( | float | bias | ) |
Definition at line 453 of file Application.cpp.
| void Sleak::Application::SetSSAOEnabled | ( | bool | enabled | ) |
Definition at line 449 of file Application.cpp.
| void Sleak::Application::SetSSAOPower | ( | float | power | ) |
Definition at line 455 of file Application.cpp.
| void Sleak::Application::SetSSAORadius | ( | float | radius | ) |
Definition at line 451 of file Application.cpp.
| void Sleak::Application::SetSSREnabled | ( | bool | enabled | ) |
Definition at line 463 of file Application.cpp.
| void Sleak::Application::SetTAAEnabled | ( | bool | enabled | ) |
Definition at line 466 of file Application.cpp.
| void Sleak::Application::SetVSync | ( | bool | enabled | ) |
Definition at line 439 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 400 of file Application.cpp.