Skip to content

Add setting to memorize window size#2025

Merged
Irastris merged 3 commits into
TwilitRealm:mainfrom
Kyrio:feature/save-window-size
Jun 14, 2026
Merged

Add setting to memorize window size#2025
Irastris merged 3 commits into
TwilitRealm:mainfrom
Kyrio:feature/save-window-size

Conversation

@Kyrio

@Kyrio Kyrio commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Until now, Dusklight would either start at a window size of twice the "default resolution" of 608x448, or start in fullscreen if it had been toggled in the last session. With this new setting, resizing the window will immediately save the new window size in settings, so that it can be restored at the next startup.

I added this mostly as a way to get familiar with the codebase, feedback is appreciated!

image

@Irastris

Irastris commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

A previous PR attempted such a feature but was bugged. Because our fullscreen mode is a borderless window, remembering the window size would lock Dusklight into being "stuck" fullscreened, until the button to restore the default window size was used.

Can you confirm whether or not your PR overcomes this?

@SuperDude88

Copy link
Copy Markdown
Collaborator

(The other related PR #1238)

@Kyrio

Kyrio commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

Good point, I will do some more testing tomorrow with how it interacts with the Fullscreen toggle. I think it will probably end up saving the fullscreen dimensions, but that shouldn't prevent you from toggling it again; and it should be an easy fix to only save the dimensions when fullscreen is off.

@Kyrio Kyrio force-pushed the feature/save-window-size branch from a20c551 to 4474a7d Compare June 9, 2026 11:46
@Kyrio

Kyrio commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

@Irastris With the latest changes, the dimensions are only saved when fullscreen is off. This means your config.json will store the windowWidth/windowHeight of the last time you were in windowed mode. Since the SDL window is initialized with those even in fullscreen mode, this means fullscreen doesn't get "stuck" when rebooting the game: toggling it off returns to the saved size, or failing that, the default size. Thanks for pointing this out!

@Irastris Irastris left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disabling the option does not restore the original behavior of Dusklight creating its window at 2x the native framebuffer size, instead it keeps using whatever the last saved window size was.

@Kyrio Kyrio force-pushed the feature/save-window-size branch from 4474a7d to 108ad66 Compare June 11, 2026 14:10
@Kyrio Kyrio changed the title Add "Save Window Size" setting Add setting to memorize window size Jun 11, 2026
@Kyrio

Kyrio commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

To address your feedback, I reworked how the setting works a little:

  • At startup, the window size will default to 608x448 unless Memorize Window Size is active and there are valid (non-zero) lastWindowWidth/lastWindowHeight settings
  • This ensures we return to the original behavior (2x framebuffer size) when the setting is toggled off or if someone manually removes the dimension settings
  • You no longer have to resize the window for Dusklight to save the dimensions, it will also be done immediately after enabling Memorize Window Size

This should cover all cases, I think.

@Kyrio Kyrio requested a review from Irastris June 11, 2026 14:29
Comment thread src/m_Do/m_Do_main.cpp
@Kyrio Kyrio requested a review from Irastris June 12, 2026 10:09
@Kyrio

Kyrio commented Jun 13, 2026

Copy link
Copy Markdown
Contributor Author

Thanks!

@Irastris Irastris merged commit d089485 into TwilitRealm:main Jun 14, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants