DisplaySettings
Player-facing display settings: a static facade over Config for persistence, SDL for enumeration, and Window + Renderer for applying a change at runtime.
- Module
- MowoEngine
- Header
#include "Core/DisplaySettings.h"- Namespace
Mowo
Public functions
| Returns | Name | Description |
|---|---|---|
FDisplayConfig | Get | Persisted to Display.ini under AppData / the project's Saved dir. |
void | Save | |
std::vector<FMonitorInfo> | EnumerateMonitors | Needs an initialized SDL video subsystem. |
std::vector<FDisplayMode> | EnumerateModes | |
float | GetWindowRefreshRate | Refresh rate of the monitor the window is on now, 0 when unknown. |
void | Apply | Pushes the config onto a live window (mode / monitor / resolution / refresh) and, when applyVSync is true, drives Renderer::SetVSync with a deferred swapchain recreate. |
void | ApplyPersisted | Reads the persisted config and applies it. |
void | SetVSyncRuntime | Drives Renderer::SetVSync immediately and persists the new value. |
EWindowMode | ParseMode | |
const char* | ModeToString |
Function details
Get
static FDisplayConfig Get()Persisted to Display.ini under AppData / the project's Saved dir.
Save
static void Save(const FDisplayConfig& cfg)EnumerateMonitors
static std::vector<FMonitorInfo> EnumerateMonitors()Needs an initialized SDL video subsystem.
EnumerateModes
static std::vector<FDisplayMode> EnumerateModes(int32_t monitorIndex)GetWindowRefreshRate
static float GetWindowRefreshRate(Window& window)Refresh rate of the monitor the window is on now, 0 when unknown. Cheap enough to poll once per frame (SDL caches the current mode).
Apply
static void Apply(Window& window, const FDisplayConfig& cfg, bool applyVSync = true)Pushes the config onto a live window (mode / monitor / resolution / refresh) and, when applyVSync is true, drives Renderer::SetVSync with a deferred swapchain recreate. Persists nothing — call Save() for that.
ApplyPersisted
static void ApplyPersisted(Window& window)Reads the persisted config and applies it. No-op for window/monitor/ resolution when the user has never set anything (hasBeenSet == false), so launch defaults survive; vsync always follows the config.
SetVSyncRuntime
static void SetVSyncRuntime(bool enabled)Drives Renderer::SetVSync immediately and persists the new value. Safe to call every frame — SetVSync early-outs when unchanged.
ParseMode
static EWindowMode ParseMode(const std::string& s)ModeToString
static const char* ModeToString(EWindowMode m)