From cce966683bbd85b0f839ccbb537124e7d8f53541 Mon Sep 17 00:00:00 2001 From: QwertyChouskie Date: Sat, 22 Apr 2023 00:22:16 -0700 Subject: [PATCH] UI/UX: Add back button on server creation screen This functions the same as the cancel button, adding it for UI consistency. --- data/gui/screens/online/create_server.stkgui | 1 + src/states_screens/online/create_server_screen.cpp | 7 +++++++ src/states_screens/online/create_server_screen.hpp | 1 + 3 files changed, 9 insertions(+) diff --git a/data/gui/screens/online/create_server.stkgui b/data/gui/screens/online/create_server.stkgui index e1a3d6498..f46e569d7 100644 --- a/data/gui/screens/online/create_server.stkgui +++ b/data/gui/screens/online/create_server.stkgui @@ -1,5 +1,6 @@ +
diff --git a/src/states_screens/online/create_server_screen.cpp b/src/states_screens/online/create_server_screen.cpp index 0a4c23f37..070b96199 100644 --- a/src/states_screens/online/create_server_screen.cpp +++ b/src/states_screens/online/create_server_screen.cpp @@ -83,6 +83,8 @@ void CreateServerScreen::loadedFromFile() assert(m_create_widget != NULL); m_cancel_widget = getWidget("cancel"); assert(m_cancel_widget != NULL); + m_back_widget = getWidget("back"); + assert(m_back_widget != NULL); } // loadedFromFile // ---------------------------------------------------------------------------- @@ -171,6 +173,11 @@ void CreateServerScreen::eventCallback(Widget* widget, const std::string& name, m_game_mode_widget->getSelection(PLAYER_ID_GAME_MASTER); updateMoreOption(selection); } + else if (name == m_back_widget->m_properties[PROP_ID]) + { + NetworkConfig::get()->unsetNetworking(); + StateManager::get()->escapePressed(); + } } // eventCallback // ---------------------------------------------------------------------------- diff --git a/src/states_screens/online/create_server_screen.hpp b/src/states_screens/online/create_server_screen.hpp index 614de418b..232d0d998 100644 --- a/src/states_screens/online/create_server_screen.hpp +++ b/src/states_screens/online/create_server_screen.hpp @@ -51,6 +51,7 @@ private: GUIEngine::RibbonWidget * m_options_widget; GUIEngine::IconButtonWidget * m_create_widget; GUIEngine::IconButtonWidget * m_cancel_widget; + GUIEngine::IconButtonWidget * m_back_widget; void createServer(); void updateMoreOption(int game_mode);