UI/UX: Add back button on server creation screen

This functions the same as the cancel button, adding it for UI consistency.
This commit is contained in:
QwertyChouskie 2023-04-22 00:22:16 -07:00
parent 082d02eef3
commit cce966683b
3 changed files with 9 additions and 0 deletions

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<stkgui>
<icon-button id="back" x="1%" y="0" height="9%" icon="gui/icons/back.png"/>
<div x="0" y="1%" width="100%" height="99%" layout="vertical-row" >
<header id="title" text_align="center" height="8%" width="80%" align="center" I18N="In the server creation screen" text="Server Creation"/>
<spacer width="100%" height="1%"/>

View File

@ -83,6 +83,8 @@ void CreateServerScreen::loadedFromFile()
assert(m_create_widget != NULL);
m_cancel_widget = getWidget<IconButtonWidget>("cancel");
assert(m_cancel_widget != NULL);
m_back_widget = getWidget<IconButtonWidget>("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
// ----------------------------------------------------------------------------

View File

@ -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);