in SDL1, don't reopen the window needlessly

This commit is contained in:
Zeno Rogue 2021-03-21 11:18:15 +01:00
parent 50c4e2be62
commit 16e3c549a0
1 changed files with 13 additions and 6 deletions

View File

@ -1128,11 +1128,7 @@ EX bool want_vsync() {
return vid.want_vsync;
}
EX bool need_to_apply_screen_settings() {
if(vid.want_fullscreen != vid.full)
return true;
if(make_pair(vid.xres, vid.yres) != get_requested_resolution())
return true;
EX bool need_to_reopen_window() {
if(vid.want_antialias != vid.antialias)
return true;
if(vid.wantGL != vid.usingGL)
@ -1142,6 +1138,16 @@ EX bool need_to_apply_screen_settings() {
return false;
}
EX bool need_to_apply_screen_settings() {
if(need_to_reopen_window())
return true;
if(vid.want_fullscreen != vid.full)
return true;
if(make_pair(vid.xres, vid.yres) != get_requested_resolution())
return true;
return false;
}
EX void close_renderer() {
#if CAP_SDL2
if(s_renderer) SDL_DestroyRenderer(s_renderer), s_renderer = nullptr;
@ -1173,7 +1179,8 @@ EX void apply_screen_settings() {
#endif
#if !CAP_SDL2
SDL_QuitSubSystem(SDL_INIT_VIDEO);
if(need_to_reopen_window())
SDL_QuitSubSystem(SDL_INIT_VIDEO);
#endif
graphics_on = false;