Move player selection to the options as was discussed

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@10414 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2011-12-12 23:23:50 +00:00
parent 43c63910a9
commit 1b57f7430f
4 changed files with 25 additions and 20 deletions

View File

@ -6,12 +6,6 @@
<spacer width="2%" height="1"/>
<label text="You are playing as" height="100%"/>
<spacer width="2%" height="1"/>
<button id="playername" width="15%" align="center"/>
<spacer proportion="1" height="1"/>
<buttonbar id="menu_bottomrow" x="0" y="0" width="30%" height="100%" align="center">
<icon-button id="options" width="64" height="64" icon="gui/main_options.png"

View File

@ -18,6 +18,16 @@
<spacer width="5" height="5"/>
<div layout="horizontal-row" width="75%" height="fit" align="center">
<spacer proportion="1"/>
<label text="You are playing as" height="100%"/>
<spacer width="2%" height="1"/>
<button id="playername" width="27%" align="center"/>
<spacer proportion="1"/>
</div>
<spacer width="5" height="10"/>
<label width="100%"
I18N="In players configuration menu"
text="Press enter or double-click on a player to edit him/her"

View File

@ -20,10 +20,8 @@
#include "states_screens/main_menu_screen.hpp"
#include <string>
#include <IGUIButton.h>
#include "addons/network_http.hpp"
#include "challenges/unlock_manager.hpp"
#include "graphics/irr_driver.hpp"
#include "guiengine/scalable_font.hpp"
#include "guiengine/widgets/label_widget.hpp"
@ -41,7 +39,6 @@
#include "states_screens/kart_selection.hpp"
#include "states_screens/options_screen_video.hpp"
#include "states_screens/state_manager.hpp"
#include "states_screens/story_mode_lobby.hpp"
#include "states_screens/tutorial_screen.hpp"
#if DEBUG_MENU_ITEM
@ -121,10 +118,6 @@ void MainMenuScreen::init()
w->setText(news_text, true);
w->update(0.01f);
ButtonWidget* you = getWidget<ButtonWidget>("playername");
you->setText( unlock_manager->getCurrentSlot()->getPlayerName() );
((gui::IGUIButton*)you->getIrrlichtElement())->setOverrideFont( GUIEngine::getSmallFont() );
RibbonWidget* r = getWidget<RibbonWidget>("menu_bottomrow");
// FIXME: why do I need to do this manually
((IconButtonWidget*)r->getChildren().get(0))->unfocused(PLAYER_ID_GAME_MASTER, NULL);
@ -179,12 +172,6 @@ void MainMenuScreen::onUpdate(float delta, irr::video::IVideoDriver* driver)
void MainMenuScreen::eventCallback(Widget* widget, const std::string& name,
const int playerID)
{
if (name == "playername")
{
UserConfigParams::m_default_player = L"";
StateManager::get()->resetAndGoToScreen(StoryModeLobbyScreen::getInstance());
}
// most interesting stuff is in the ribbons, so start there
RibbonWidget* ribbon = dynamic_cast<RibbonWidget*>(widget);

View File

@ -17,10 +17,12 @@
#include "states_screens/options_screen_players.hpp"
#include "challenges/unlock_manager.hpp"
#include "config/player.hpp"
#include "config/device_config.hpp"
#include "graphics/irr_driver.hpp"
#include "guiengine/engine.hpp"
#include "guiengine/scalable_font.hpp"
#include "guiengine/screen.hpp"
#include "guiengine/widget.hpp"
#include "guiengine/widgets/list_widget.hpp"
@ -32,7 +34,9 @@
#include "states_screens/options_screen_video.hpp"
#include "states_screens/options_screen_ui.hpp"
#include "states_screens/state_manager.hpp"
#include "states_screens/story_mode_lobby.hpp"
#include <IGUIButton.h>
#include <iostream>
#include <sstream>
@ -91,6 +95,11 @@ void OptionsScreenPlayers::init()
players->setActivated();
}
ButtonWidget* you = getWidget<ButtonWidget>("playername");
you->setText( unlock_manager->getCurrentSlot()->getPlayerName() );
((gui::IGUIButton*)you->getIrrlichtElement())->setOverrideFont( GUIEngine::getSmallFont() );
} // init
// -----------------------------------------------------------------------------
@ -199,7 +208,12 @@ void OptionsScreenPlayers::eventCallback(Widget* widget, const std::string& name
return;
}
} // end for
} // name=="players"
}
else if (name == "playername")
{
UserConfigParams::m_default_player = L"";
StateManager::get()->resetAndGoToScreen(StoryModeLobbyScreen::getInstance());
}
} // eventCallback