Made the few buttons there are in lobby, do something.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/uni@13229 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
unitraxx 2013-07-15 01:32:09 +00:00
parent c2c314a2c2
commit ecaa073eb5
3 changed files with 23 additions and 11 deletions

View File

@ -38,12 +38,8 @@
<spacer width="10" height="10" />
<buttonbar id="menu_bottomrow" x="0" y="0" width="20%" height="100%" align="center">
<icon-button id="sign_in" width="64" height="64" icon="gui/main_about.png" extend_label="50"
I18N="Main menu button" text="Sign In" label_location="hover"/>
<icon-button id="register" width="64" height="64" icon="gui/tutorial.png" extend_label="75"
I18N="Main menu button" text="Register" label_location="hover"/>
<icon-button id="sign_out" width="64" height="64" icon="gui/main_quit.png" extend_label="70"
I18N="Main menu button" text="Sign Out" label_location="hover"/>
<icon-button id="exit" width="64" height="64" icon="gui/main_quit.png" extend_label="50"
I18N="Main menu button" text="Exit" label_location="hover"/>
</buttonbar>
</bottombar>

View File

@ -55,6 +55,9 @@ NetworkingLobby::NetworkingLobby() : Screen("online/lobby.stkgui")
void NetworkingLobby::loadedFromFile()
{
m_back_widget = getWidget<IconButtonWidget>("back");
assert(m_back_widget != NULL);
m_server_name_widget = getWidget<LabelWidget>("server_name");
assert(m_server_name_widget != NULL);
@ -63,9 +66,9 @@ void NetworkingLobby::loadedFromFile()
m_bottom_menu_widget = getWidget<RibbonWidget>("menu_bottomrow");
assert(m_bottom_menu_widget != NULL);
/*m_sign_in_widget = (IconButtonWidget *) m_bottom_menu_widget->findWidgetNamed("sign_in");
assert(m_sign_in_widget != NULL);*/
m_exit_widget = (IconButtonWidget *) m_bottom_menu_widget->findWidgetNamed("exit");
assert(m_exit_widget != NULL);
} // loadedFromFile
@ -96,7 +99,20 @@ void NetworkingLobby::onUpdate(float delta, irr::video::IVideoDriver* driver)
void NetworkingLobby::eventCallback(Widget* widget, const std::string& name, const int playerID)
{
if (name == m_back_widget->m_properties[PROP_ID])
{
StateManager::get()->escapePressed();
return;
}
RibbonWidget* ribbon = dynamic_cast<RibbonWidget*>(widget);
if (ribbon == NULL) return;
std::string selection = ribbon->getSelectionIDString(PLAYER_ID_GAME_MASTER);
if (selection == m_exit_widget->m_properties[PROP_ID])
{
StateManager::get()->escapePressed();
}
} // eventCallback
// ----------------------------------------------------------------------------

View File

@ -40,14 +40,14 @@ private:
NetworkingLobby();
GUIEngine::IconButtonWidget * m_back_widget;
GUIEngine::LabelWidget * m_server_name_widget;
GUIEngine::LabelWidget * m_online_status_widget;
GUIEngine::RibbonWidget * m_bottom_menu_widget;
GUIEngine::IconButtonWidget * m_sign_in_widget;
GUIEngine::IconButtonWidget * m_register_widget;
GUIEngine::IconButtonWidget * m_sign_out_widget;
GUIEngine::IconButtonWidget * m_exit_widget;
/** \brief Sets which widget has to be focused. Depends on the user state. */
void setInitialFocus();