Moved callbacks to config.cpp, fixed Subtitles option not applying to stages (#400)

This commit is contained in:
Hyper
2025-02-13 17:30:12 +00:00
committed by GitHub
parent 431a6d9841
commit 414ccb3637
9 changed files with 62 additions and 86 deletions
-21
View File
@@ -173,27 +173,6 @@ void GameWindow::Init(const char* sdlVideoDriver)
SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE);
#endif
Config::WindowSize.LockCallback = [](ConfigDef<int32_t>* def)
{
// Try matching the current window size with a known configuration.
if (def->Value < 0)
def->Value = FindNearestDisplayMode();
};
Config::WindowSize.ApplyCallback = [](ConfigDef<int32_t>* def)
{
auto displayModes = GetDisplayModes();
// Use largest supported resolution if overflowed.
if (def->Value >= displayModes.size())
def->Value = displayModes.size() - 1;
auto& mode = displayModes[def->Value];
auto centre = SDL_WINDOWPOS_CENTERED_DISPLAY(GetDisplay());
SetDimensions(mode.w, mode.h, centre, centre);
};
s_x = Config::WindowX;
s_y = Config::WindowY;
s_width = Config::WindowWidth;