Add setting to memorize window size (#2025)

* Add "Memorize Window Size" setting

* Code review #2025

* memorize -> remember, helpText revision

---------

Co-authored-by: Irastris <irastris15@gmail.com>
This commit is contained in:
Kyrio
2026-06-14 04:47:18 +02:00
committed by GitHub
parent cacb768725
commit d0894853d7
4 changed files with 43 additions and 2 deletions
+19 -2
View File
@@ -259,6 +259,13 @@ void main01(void) {
dusk::ui::handle_event(event->sdl);
dusk::g_imguiConsole.HandleSDLEvent(event->sdl);
break;
case AURORA_WINDOW_RESIZED:
if (dusk::getSettings().video.rememberWindowSize && !dusk::getSettings().video.enableFullscreen) {
dusk::getSettings().video.lastWindowWidth.setValue(event->windowSize.width);
dusk::getSettings().video.lastWindowHeight.setValue(event->windowSize.height);
dusk::config::Save();
}
break;
case AURORA_DISPLAY_SCALE_CHANGED:
dusk::ImGuiEngine_Initialize(event->windowSize.scale);
break;
@@ -584,8 +591,18 @@ int game_main(int argc, char* argv[]) {
config.startFullscreen = dusk::getSettings().video.enableFullscreen;
config.windowPosX = -1;
config.windowPosY = -1;
config.windowWidth = defaultWindowWidth * 2;
config.windowHeight = defaultWindowHeight * 2;
const int lastWindowWidth = dusk::getSettings().video.lastWindowWidth.getValue();
const int lastWindowHeight = dusk::getSettings().video.lastWindowHeight.getValue();
if (dusk::getSettings().video.rememberWindowSize && lastWindowWidth > 0 && lastWindowHeight > 0) {
config.windowWidth = lastWindowWidth;
config.windowHeight = lastWindowHeight;
} else {
config.windowWidth = defaultWindowWidth * 2;
config.windowHeight = defaultWindowHeight * 2;
}
config.desiredBackend = ResolveDesiredBackend(parsed_arg_options);
config.logCallback = &aurora_log_callback;
config.logLevel = startupLogLevel;