diff --git a/stepmania/src/RageDisplay.cpp b/stepmania/src/RageDisplay.cpp index 82b5f2fc52..cdff20536c 100644 --- a/stepmania/src/RageDisplay.cpp +++ b/stepmania/src/RageDisplay.cpp @@ -274,6 +274,18 @@ bool RageDisplay::SetVideoMode( bool windowed, int width, int height, int bpp, i return need_reload; } +void RageDisplay::ResolutionChanged(int width, int height) +{ + g_CurrentWidth = width; + g_CurrentHeight = height; + + SetViewport(0,0); + + /* Clear any junk that's in the framebuffer. */ + Clear(); + Flip(); +} + void RageDisplay::SetViewport(int shift_left, int shift_down) { /* left and down are on a 0..SCREEN_WIDTH, 0..SCREEN_HEIGHT scale. diff --git a/stepmania/src/RageDisplay.h b/stepmania/src/RageDisplay.h index c809303fe0..13f5f0c0d5 100644 --- a/stepmania/src/RageDisplay.h +++ b/stepmania/src/RageDisplay.h @@ -30,6 +30,9 @@ public: bool SetVideoMode( bool windowed, int width, int height, int bpp, int rate, bool vsync ); + /* Call this when the resolution has been changed externally: */ + void ResolutionChanged(int width, int height); + void Clear(); void Flip(); bool IsWindowed() const; diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index 24d995eac8..e1de9e651b 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -410,9 +410,7 @@ static void GameLoop() case SDL_QUIT: return; /* exit the main loop */ case SDL_VIDEORESIZE: - PREFSMAN->m_iDisplayWidth = event.resize.w; - PREFSMAN->m_iDisplayHeight = event.resize.h; - ApplyGraphicOptions(); + DISPLAY->ResolutionChanged(event.resize.w, event.resize.h); break; } }