Fixed various bugs in menu not showing up.

This commit is contained in:
hiker 2014-05-16 08:24:15 +10:00
parent 0459c33f66
commit 6650827784
3 changed files with 20 additions and 18 deletions

View File

@ -1,3 +1,4 @@
//
// SuperTuxKart - a fun racing game with go-kart
// Copyright (C) 2004-2013 Steve Baker <sjbaker1@airmail.net>
@ -1286,6 +1287,12 @@ int main(int argc, char *argv[] )
if(!UserConfigParams::m_no_start_screen)
{
// If there is a current player, it was saved in the config file,
// so we immediately start the main menu. Otherwise show the login
// screen first.
if(PlayerManager::getCurrentPlayer())
StateManager::get()->pushScreen(MainMenuScreen::getInstance());
else
StateManager::get()->pushScreen(UserScreen::getInstance());
#ifdef ENABLE_WIIUSE
// Show a dialog to allow connection of wiimotes. */

View File

@ -193,6 +193,14 @@ void BaseUserScreen::makeEntryFieldsVisible(bool online)
m_password_tb->setVisible(online);
} // makeEntryFieldsVisible
// ----------------------------------------------------------------------------
/** Make sure that a current player is defined when escape is pressed.
*/
bool BaseUserScreen::onEscapePressed()
{
return Screen::onEscapePressed();
} // onEscapePressed
// ----------------------------------------------------------------------------
/** Called when the user selects anything on the screen.
*/
@ -460,21 +468,6 @@ void BaseUserScreen::onDialogClose()
} // onDialogClose
// ============================================================================
/** If there already is a player (i.e. default player is saved), no need to
* show this dialog, go directly to the main menu screen.
*/
void UserScreen::init()
{
PlayerProfile *player = PlayerManager::getCurrentPlayer();
if (player)
{
StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance());
return;
}
BaseUserScreen::init();
} // init
// ============================================================================
/** In the tab version, make sure the right tab is selected.
*/
@ -494,7 +487,7 @@ void TabbedUserScreen::init()
*/
void TabbedUserScreen::eventCallback(GUIEngine::Widget* widget,
const std::string& name,
const int playerID)
const int player_id)
{
if (name == "options_choice")
{
@ -509,5 +502,7 @@ void TabbedUserScreen::eventCallback(GUIEngine::Widget* widget,
assert(s);
StateManager::get()->replaceTopMostScreen(s);
}
else
BaseUserScreen::eventCallback(widget, name, player_id);
} // eventCallback

View File

@ -95,6 +95,7 @@ public:
/** \brief implement optional callback from parent class GUIEngine::Screen */
virtual void unloaded();
virtual bool onEscapePressed();
void loginSuccessful();
void loginError(const irr::core::stringw &error_message);
@ -111,7 +112,6 @@ private:
{};
public:
friend class GUIEngine::ScreenSingleton<UserScreen>;
virtual void init();
}; // class UserScreenTabed
// ============================================================================