From 2f1acc81399fc32c329aae8eb6e7d06fa15c2c40 Mon Sep 17 00:00:00 2001 From: Benau Date: Thu, 4 Jun 2020 15:51:54 +0800 Subject: [PATCH] Enable screen resizing in some places --- src/states_screens/dialogs/custom_video_settings.cpp | 2 ++ src/states_screens/main_menu_screen.cpp | 2 ++ src/states_screens/options/options_screen_general.cpp | 4 ++++ src/states_screens/options/options_screen_video.cpp | 4 ++++ 4 files changed, 12 insertions(+) diff --git a/src/states_screens/dialogs/custom_video_settings.cpp b/src/states_screens/dialogs/custom_video_settings.cpp index 49ca4621c..4e20e541f 100644 --- a/src/states_screens/dialogs/custom_video_settings.cpp +++ b/src/states_screens/dialogs/custom_video_settings.cpp @@ -40,6 +40,7 @@ using namespace irr::gui; CustomVideoSettingsDialog::CustomVideoSettingsDialog(const float w, const float h) : ModalDialog(w, h) { + GUIEngine::getDevice()->setResizable(false); loadFromFile("custom_video_settings.stkgui"); updateActivation(); } @@ -48,6 +49,7 @@ CustomVideoSettingsDialog::CustomVideoSettingsDialog(const float w, const float CustomVideoSettingsDialog::~CustomVideoSettingsDialog() { + GUIEngine::getDevice()->setResizable(true); } // ----------------------------------------------------------------------------- diff --git a/src/states_screens/main_menu_screen.cpp b/src/states_screens/main_menu_screen.cpp index 849cf5908..a4e8986d4 100644 --- a/src/states_screens/main_menu_screen.cpp +++ b/src/states_screens/main_menu_screen.cpp @@ -120,6 +120,7 @@ void MainMenuScreen::beforeAddingWidget() // void MainMenuScreen::init() { + GUIEngine::getDevice()->setResizable(true); Screen::init(); m_user_id = getWidget("user-id"); @@ -603,6 +604,7 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name, void MainMenuScreen::tearDown() { + GUIEngine::getDevice()->setResizable(false); } // tearDown // ---------------------------------------------------------------------------- diff --git a/src/states_screens/options/options_screen_general.cpp b/src/states_screens/options/options_screen_general.cpp index 59c4f3979..4c2ad1839 100644 --- a/src/states_screens/options/options_screen_general.cpp +++ b/src/states_screens/options/options_screen_general.cpp @@ -78,6 +78,8 @@ void OptionsScreenGeneral::loadedFromFile() void OptionsScreenGeneral::init() { + if (StateManager::get()->getGameState() == GUIEngine::MENU) + GUIEngine::getDevice()->setResizable(true); Screen::init(); RibbonWidget* ribbon = getWidget("options_choice"); assert(ribbon != NULL); @@ -277,6 +279,8 @@ void OptionsScreenGeneral::setInternetCheckboxes(bool activate) void OptionsScreenGeneral::tearDown() { + if (StateManager::get()->getGameState() == GUIEngine::MENU) + GUIEngine::getDevice()->setResizable(false); Screen::tearDown(); // save changes when leaving screen user_config->saveConfig(); diff --git a/src/states_screens/options/options_screen_video.cpp b/src/states_screens/options/options_screen_video.cpp index 0080b70c4..c2ad17993 100644 --- a/src/states_screens/options/options_screen_video.cpp +++ b/src/states_screens/options/options_screen_video.cpp @@ -192,6 +192,8 @@ void OptionsScreenVideo::loadedFromFile() void OptionsScreenVideo::init() { + if (StateManager::get()->getGameState() == GUIEngine::MENU) + GUIEngine::getDevice()->setResizable(true); Screen::init(); m_prev_adv_pipline = UserConfigParams::m_dynamic_lights; m_prev_img_quality = getImageQuality(); @@ -745,6 +747,8 @@ void OptionsScreenVideo::eventCallback(Widget* widget, const std::string& name, void OptionsScreenVideo::tearDown() { + if (StateManager::get()->getGameState() == GUIEngine::MENU) + GUIEngine::getDevice()->setResizable(false); #ifndef SERVER_ONLY if (m_prev_adv_pipline != UserConfigParams::m_dynamic_lights && CVS->isGLSL())