[uni GSoC] dialogs/login_dialog.cpp:39: undefined reference to 'vtable for LoginDialog'
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/uni@12875 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
d21b8d890a
commit
f863609de8
30
data/gui/login.stkgui
Normal file
30
data/gui/login.stkgui
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<stkgui>
|
||||||
|
|
||||||
|
<div x="2%" y="10%" width="96%" height="80%" layout="vertical-row" >
|
||||||
|
|
||||||
|
|
||||||
|
<label id="title" width="100%" text_align="center" word_wrap="true"
|
||||||
|
I18N="In the 'add new player' dialog" text="Sign in" proportion="1" />
|
||||||
|
|
||||||
|
<spacer height="25" width="10" />
|
||||||
|
|
||||||
|
|
||||||
|
<div width="75%" height="fit" layout="horizontal-row" >
|
||||||
|
<label proportion="1" height="100%" text_align="left" I18N="In the login form" text="Username"/>
|
||||||
|
<div proportion="1" height="fit" layout="horizontal-row" >
|
||||||
|
<spacer width="40" height="100%" />
|
||||||
|
<textbox id="username" I18N="In the 'login' dialog" align="center"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<spacer height="20" width="20" />
|
||||||
|
|
||||||
|
<!-- TODO: ok button? -->
|
||||||
|
|
||||||
|
<button id="cancel" I18N="When configuring input" text="Press ESC to cancel" align="center"/>
|
||||||
|
|
||||||
|
<spacer height="15" width="20" />
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</stkgui>
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<icon id="logo" align="center" proportion="5" width="100%" icon="gui/logo.png"/>
|
<icon id="logo" align="center" proportion="5" width="100%" icon="gui/logo.png"/>
|
||||||
|
|
||||||
<buttonbar id="menu_toprow" proportion="3" width="75%" align="center">
|
<buttonbar id="menu_toprow" proportion="3" width="90%" align="center">
|
||||||
<icon-button id="story" width="128" height="128"
|
<icon-button id="story" width="128" height="128"
|
||||||
icon="gui/menu_story.png" focus_icon="gui/menu_story_focus.png"
|
icon="gui/menu_story.png" focus_icon="gui/menu_story_focus.png"
|
||||||
I18N="Main menu button" text="Story Mode"/>
|
I18N="Main menu button" text="Story Mode"/>
|
||||||
@ -14,6 +14,9 @@
|
|||||||
<icon-button id="multiplayer" width="128" height="128"
|
<icon-button id="multiplayer" width="128" height="128"
|
||||||
icon="gui/menu_multi.png" focus_icon="gui/menu_multi_focus.png"
|
icon="gui/menu_multi.png" focus_icon="gui/menu_multi_focus.png"
|
||||||
I18N="Main menu button" text="Multiplayer"/>
|
I18N="Main menu button" text="Multiplayer"/>
|
||||||
|
<icon-button id="online" width="128" height="128"
|
||||||
|
icon="gui/menu_online.png" focus_icon="gui/menu_online_focus.png"
|
||||||
|
I18N="Main menu button" text="Online"/>
|
||||||
<icon-button id="addons" width="128" height="128"
|
<icon-button id="addons" width="128" height="128"
|
||||||
icon="gui/menu_addons.png" focus_icon="gui/menu_addons_focus.png"
|
icon="gui/menu_addons.png" focus_icon="gui/menu_addons_focus.png"
|
||||||
I18N="Main menu button" text="Addons"/>
|
I18N="Main menu button" text="Addons"/>
|
||||||
|
BIN
data/gui/menu_online.png
Normal file
BIN
data/gui/menu_online.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 71 KiB |
BIN
data/gui/menu_online_focus.png
Normal file
BIN
data/gui/menu_online_focus.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 71 KiB |
33
data/gui/online.stkgui
Normal file
33
data/gui/online.stkgui
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<stkgui>
|
||||||
|
|
||||||
|
<div x="0" y="0" width="100%" height="100%" layout="vertical-row" >
|
||||||
|
|
||||||
|
<icon id="logo" align="center" proportion="5" width="100%" icon="gui/logo.png"/>
|
||||||
|
|
||||||
|
<buttonbar id="menu_toprow" proportion="3" width="75%" align="center">
|
||||||
|
<icon-button id="login" width="128" height="128"
|
||||||
|
icon="gui/menu_race.png" focus_icon="gui/menu_race_focus.png"
|
||||||
|
I18N="Online menu button" text="Sign in"/>
|
||||||
|
</buttonbar>
|
||||||
|
|
||||||
|
<spacer width="10" height="7%"/>
|
||||||
|
|
||||||
|
<bottombar width="100%" height="10%" layout="horizontal-row">
|
||||||
|
|
||||||
|
<spacer width="10" height="10" />
|
||||||
|
|
||||||
|
<label proportion="3" height="100%" id="info_addons"
|
||||||
|
I18N="In the main screen"
|
||||||
|
text=""
|
||||||
|
align="center" text_align="left" />
|
||||||
|
|
||||||
|
<spacer width="10" height="10" />
|
||||||
|
|
||||||
|
<buttonbar id="menu_bottomrow" x="0" y="0" width="30%" height="100%" align="center">
|
||||||
|
</buttonbar>
|
||||||
|
|
||||||
|
</bottombar>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</stkgui>
|
@ -1,4 +1,4 @@
|
|||||||
# Generated by ./update_file_list.sh. Do not edit this file manually.
|
# Generated by /home/gl3nn/repos/gsoc-stk-branch/update_file_list.sh. Do not edit this file manually.
|
||||||
set(STK_SOURCES
|
set(STK_SOURCES
|
||||||
src/addons/addon.cpp
|
src/addons/addon.cpp
|
||||||
src/addons/addons_manager.cpp
|
src/addons/addons_manager.cpp
|
||||||
@ -96,8 +96,8 @@ src/items/projectile_manager.cpp
|
|||||||
src/items/rubber_ball.cpp
|
src/items/rubber_ball.cpp
|
||||||
src/items/rubber_band.cpp
|
src/items/rubber_band.cpp
|
||||||
src/items/swatter.cpp
|
src/items/swatter.cpp
|
||||||
src/karts/abstract_kart.cpp
|
|
||||||
src/karts/abstract_kart_animation.cpp
|
src/karts/abstract_kart_animation.cpp
|
||||||
|
src/karts/abstract_kart.cpp
|
||||||
src/karts/cannon_animation.cpp
|
src/karts/cannon_animation.cpp
|
||||||
src/karts/controller/ai_base_controller.cpp
|
src/karts/controller/ai_base_controller.cpp
|
||||||
src/karts/controller/ai_properties.cpp
|
src/karts/controller/ai_properties.cpp
|
||||||
@ -169,6 +169,7 @@ src/states_screens/dialogs/confirm_resolution_dialog.cpp
|
|||||||
src/states_screens/dialogs/custom_video_settings.cpp
|
src/states_screens/dialogs/custom_video_settings.cpp
|
||||||
src/states_screens/dialogs/enter_player_name_dialog.cpp
|
src/states_screens/dialogs/enter_player_name_dialog.cpp
|
||||||
src/states_screens/dialogs/gp_info_dialog.cpp
|
src/states_screens/dialogs/gp_info_dialog.cpp
|
||||||
|
src/states_screens/dialogs/login_dialog.cpp
|
||||||
src/states_screens/dialogs/message_dialog.cpp
|
src/states_screens/dialogs/message_dialog.cpp
|
||||||
src/states_screens/dialogs/player_info_dialog.cpp
|
src/states_screens/dialogs/player_info_dialog.cpp
|
||||||
src/states_screens/dialogs/press_a_key_dialog.cpp
|
src/states_screens/dialogs/press_a_key_dialog.cpp
|
||||||
@ -186,14 +187,15 @@ src/states_screens/help_screen_4.cpp
|
|||||||
src/states_screens/kart_selection.cpp
|
src/states_screens/kart_selection.cpp
|
||||||
src/states_screens/main_menu_screen.cpp
|
src/states_screens/main_menu_screen.cpp
|
||||||
src/states_screens/minimal_race_gui.cpp
|
src/states_screens/minimal_race_gui.cpp
|
||||||
|
src/states_screens/online_screen.cpp
|
||||||
src/states_screens/options_screen_audio.cpp
|
src/states_screens/options_screen_audio.cpp
|
||||||
src/states_screens/options_screen_input.cpp
|
|
||||||
src/states_screens/options_screen_input2.cpp
|
src/states_screens/options_screen_input2.cpp
|
||||||
|
src/states_screens/options_screen_input.cpp
|
||||||
src/states_screens/options_screen_players.cpp
|
src/states_screens/options_screen_players.cpp
|
||||||
src/states_screens/options_screen_ui.cpp
|
src/states_screens/options_screen_ui.cpp
|
||||||
src/states_screens/options_screen_video.cpp
|
src/states_screens/options_screen_video.cpp
|
||||||
src/states_screens/race_gui.cpp
|
|
||||||
src/states_screens/race_gui_base.cpp
|
src/states_screens/race_gui_base.cpp
|
||||||
|
src/states_screens/race_gui.cpp
|
||||||
src/states_screens/race_gui_overworld.cpp
|
src/states_screens/race_gui_overworld.cpp
|
||||||
src/states_screens/race_result_gui.cpp
|
src/states_screens/race_result_gui.cpp
|
||||||
src/states_screens/race_setup_screen.cpp
|
src/states_screens/race_setup_screen.cpp
|
||||||
@ -253,8 +255,8 @@ src/animations/animation_base.hpp
|
|||||||
src/animations/ipo.hpp
|
src/animations/ipo.hpp
|
||||||
src/animations/three_d_animation.hpp
|
src/animations/three_d_animation.hpp
|
||||||
src/audio/dummy_sfx.hpp
|
src/audio/dummy_sfx.hpp
|
||||||
src/audio/music.hpp
|
|
||||||
src/audio/music_dummy.hpp
|
src/audio/music_dummy.hpp
|
||||||
|
src/audio/music.hpp
|
||||||
src/audio/music_information.hpp
|
src/audio/music_information.hpp
|
||||||
src/audio/music_manager.hpp
|
src/audio/music_manager.hpp
|
||||||
src/audio/music_ogg.hpp
|
src/audio/music_ogg.hpp
|
||||||
@ -262,8 +264,8 @@ src/audio/sfx_base.hpp
|
|||||||
src/audio/sfx_buffer.hpp
|
src/audio/sfx_buffer.hpp
|
||||||
src/audio/sfx_manager.hpp
|
src/audio/sfx_manager.hpp
|
||||||
src/audio/sfx_openal.hpp
|
src/audio/sfx_openal.hpp
|
||||||
src/challenges/challenge.hpp
|
|
||||||
src/challenges/challenge_data.hpp
|
src/challenges/challenge_data.hpp
|
||||||
|
src/challenges/challenge.hpp
|
||||||
src/challenges/game_slot.hpp
|
src/challenges/game_slot.hpp
|
||||||
src/challenges/unlock_manager.hpp
|
src/challenges/unlock_manager.hpp
|
||||||
src/config/device_config.hpp
|
src/config/device_config.hpp
|
||||||
@ -305,11 +307,11 @@ src/guiengine/scalable_font.hpp
|
|||||||
src/guiengine/screen.hpp
|
src/guiengine/screen.hpp
|
||||||
src/guiengine/skin.hpp
|
src/guiengine/skin.hpp
|
||||||
src/guiengine/widget.hpp
|
src/guiengine/widget.hpp
|
||||||
src/guiengine/widgets.hpp
|
|
||||||
src/guiengine/widgets/bubble_widget.hpp
|
src/guiengine/widgets/bubble_widget.hpp
|
||||||
src/guiengine/widgets/button_widget.hpp
|
src/guiengine/widgets/button_widget.hpp
|
||||||
src/guiengine/widgets/check_box_widget.hpp
|
src/guiengine/widgets/check_box_widget.hpp
|
||||||
src/guiengine/widgets/dynamic_ribbon_widget.hpp
|
src/guiengine/widgets/dynamic_ribbon_widget.hpp
|
||||||
|
src/guiengine/widgets.hpp
|
||||||
src/guiengine/widgets/icon_button_widget.hpp
|
src/guiengine/widgets/icon_button_widget.hpp
|
||||||
src/guiengine/widgets/label_widget.hpp
|
src/guiengine/widgets/label_widget.hpp
|
||||||
src/guiengine/widgets/list_widget.hpp
|
src/guiengine/widgets/list_widget.hpp
|
||||||
@ -320,8 +322,8 @@ src/guiengine/widgets/spinner_widget.hpp
|
|||||||
src/guiengine/widgets/text_box_widget.hpp
|
src/guiengine/widgets/text_box_widget.hpp
|
||||||
src/input/binding.hpp
|
src/input/binding.hpp
|
||||||
src/input/device_manager.hpp
|
src/input/device_manager.hpp
|
||||||
src/input/input.hpp
|
|
||||||
src/input/input_device.hpp
|
src/input/input_device.hpp
|
||||||
|
src/input/input.hpp
|
||||||
src/input/input_manager.hpp
|
src/input/input_manager.hpp
|
||||||
src/input/wiimote.hpp
|
src/input/wiimote.hpp
|
||||||
src/input/wiimote_manager.hpp
|
src/input/wiimote_manager.hpp
|
||||||
@ -343,8 +345,8 @@ src/items/projectile_manager.hpp
|
|||||||
src/items/rubber_ball.hpp
|
src/items/rubber_ball.hpp
|
||||||
src/items/rubber_band.hpp
|
src/items/rubber_band.hpp
|
||||||
src/items/swatter.hpp
|
src/items/swatter.hpp
|
||||||
src/karts/abstract_kart.hpp
|
|
||||||
src/karts/abstract_kart_animation.hpp
|
src/karts/abstract_kart_animation.hpp
|
||||||
|
src/karts/abstract_kart.hpp
|
||||||
src/karts/cannon_animation.hpp
|
src/karts/cannon_animation.hpp
|
||||||
src/karts/controller/ai_base_controller.hpp
|
src/karts/controller/ai_base_controller.hpp
|
||||||
src/karts/controller/ai_properties.hpp
|
src/karts/controller/ai_properties.hpp
|
||||||
@ -355,8 +357,8 @@ src/karts/controller/player_controller.hpp
|
|||||||
src/karts/controller/skidding_ai.hpp
|
src/karts/controller/skidding_ai.hpp
|
||||||
src/karts/explosion_animation.hpp
|
src/karts/explosion_animation.hpp
|
||||||
src/karts/ghost_kart.hpp
|
src/karts/ghost_kart.hpp
|
||||||
src/karts/kart.hpp
|
|
||||||
src/karts/kart_gfx.hpp
|
src/karts/kart_gfx.hpp
|
||||||
|
src/karts/kart.hpp
|
||||||
src/karts/kart_model.hpp
|
src/karts/kart_model.hpp
|
||||||
src/karts/kart_properties.hpp
|
src/karts/kart_properties.hpp
|
||||||
src/karts/kart_properties_manager.hpp
|
src/karts/kart_properties_manager.hpp
|
||||||
@ -429,6 +431,7 @@ src/states_screens/dialogs/confirm_resolution_dialog.hpp
|
|||||||
src/states_screens/dialogs/custom_video_settings.hpp
|
src/states_screens/dialogs/custom_video_settings.hpp
|
||||||
src/states_screens/dialogs/enter_player_name_dialog.hpp
|
src/states_screens/dialogs/enter_player_name_dialog.hpp
|
||||||
src/states_screens/dialogs/gp_info_dialog.hpp
|
src/states_screens/dialogs/gp_info_dialog.hpp
|
||||||
|
src/states_screens/dialogs/login_dialog.hpp
|
||||||
src/states_screens/dialogs/message_dialog.hpp
|
src/states_screens/dialogs/message_dialog.hpp
|
||||||
src/states_screens/dialogs/player_info_dialog.hpp
|
src/states_screens/dialogs/player_info_dialog.hpp
|
||||||
src/states_screens/dialogs/press_a_key_dialog.hpp
|
src/states_screens/dialogs/press_a_key_dialog.hpp
|
||||||
@ -446,14 +449,15 @@ src/states_screens/help_screen_4.hpp
|
|||||||
src/states_screens/kart_selection.hpp
|
src/states_screens/kart_selection.hpp
|
||||||
src/states_screens/main_menu_screen.hpp
|
src/states_screens/main_menu_screen.hpp
|
||||||
src/states_screens/minimal_race_gui.hpp
|
src/states_screens/minimal_race_gui.hpp
|
||||||
|
src/states_screens/online_screen.hpp
|
||||||
src/states_screens/options_screen_audio.hpp
|
src/states_screens/options_screen_audio.hpp
|
||||||
src/states_screens/options_screen_input.hpp
|
|
||||||
src/states_screens/options_screen_input2.hpp
|
src/states_screens/options_screen_input2.hpp
|
||||||
|
src/states_screens/options_screen_input.hpp
|
||||||
src/states_screens/options_screen_players.hpp
|
src/states_screens/options_screen_players.hpp
|
||||||
src/states_screens/options_screen_ui.hpp
|
src/states_screens/options_screen_ui.hpp
|
||||||
src/states_screens/options_screen_video.hpp
|
src/states_screens/options_screen_video.hpp
|
||||||
src/states_screens/race_gui.hpp
|
|
||||||
src/states_screens/race_gui_base.hpp
|
src/states_screens/race_gui_base.hpp
|
||||||
|
src/states_screens/race_gui.hpp
|
||||||
src/states_screens/race_gui_overworld.hpp
|
src/states_screens/race_gui_overworld.hpp
|
||||||
src/states_screens/race_result_gui.hpp
|
src/states_screens/race_result_gui.hpp
|
||||||
src/states_screens/race_setup_screen.hpp
|
src/states_screens/race_setup_screen.hpp
|
||||||
@ -483,8 +487,8 @@ src/tracks/check_sphere.hpp
|
|||||||
src/tracks/check_structure.hpp
|
src/tracks/check_structure.hpp
|
||||||
src/tracks/graph_node.hpp
|
src/tracks/graph_node.hpp
|
||||||
src/tracks/lod_node_loader.hpp
|
src/tracks/lod_node_loader.hpp
|
||||||
src/tracks/quad.hpp
|
|
||||||
src/tracks/quad_graph.hpp
|
src/tracks/quad_graph.hpp
|
||||||
|
src/tracks/quad.hpp
|
||||||
src/tracks/quad_set.hpp
|
src/tracks/quad_set.hpp
|
||||||
src/tracks/terrain_info.hpp
|
src/tracks/terrain_info.hpp
|
||||||
src/tracks/track.hpp
|
src/tracks/track.hpp
|
||||||
|
127
src/states_screens/dialogs/login_dialog.cpp
Normal file
127
src/states_screens/dialogs/login_dialog.cpp
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
// SuperTuxKart - a fun racing game with go-kart
|
||||||
|
// Copyright (C) Glenn De Jonghe
|
||||||
|
//
|
||||||
|
// This program is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU General Public License
|
||||||
|
// as published by the Free Software Foundation; either version 3
|
||||||
|
// of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
#include "states_screens/dialogs/login_dialog.hpp"
|
||||||
|
|
||||||
|
#include <IGUIEnvironment.h>
|
||||||
|
|
||||||
|
#include "audio/sfx_manager.hpp"
|
||||||
|
#include "challenges/unlock_manager.hpp"
|
||||||
|
#include "config/player.hpp"
|
||||||
|
#include "guiengine/engine.hpp"
|
||||||
|
#include "guiengine/widgets/button_widget.hpp"
|
||||||
|
#include "guiengine/widgets/label_widget.hpp"
|
||||||
|
#include "guiengine/widgets/text_box_widget.hpp"
|
||||||
|
#include "states_screens/state_manager.hpp"
|
||||||
|
#include "utils/translation.hpp"
|
||||||
|
|
||||||
|
using namespace GUIEngine;
|
||||||
|
using namespace irr;
|
||||||
|
using namespace irr::gui;
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
LoginDialog::LoginDialog(const float w, const float h) :
|
||||||
|
ModalDialog(w,h)
|
||||||
|
{
|
||||||
|
m_self_destroy = false;
|
||||||
|
loadFromFile("login_dialog.stkgui");
|
||||||
|
|
||||||
|
TextBoxWidget* textCtrl = getWidget<TextBoxWidget>("username");
|
||||||
|
assert(textCtrl != NULL);
|
||||||
|
textCtrl->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
|
||||||
|
|
||||||
|
//if (translations->isRTLLanguage()) textCtrl->addListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
GUIEngine::EventPropagation LoginDialog::processEvent(const std::string& eventSource)
|
||||||
|
{
|
||||||
|
if (eventSource == "cancel")
|
||||||
|
{
|
||||||
|
dismiss();
|
||||||
|
return GUIEngine::EVENT_BLOCK;
|
||||||
|
}
|
||||||
|
return GUIEngine::EVENT_LET;
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void LoginDialog::onEnterPressedInternal()
|
||||||
|
{
|
||||||
|
// ---- Cancel button pressed
|
||||||
|
const int playerID = PLAYER_ID_GAME_MASTER;
|
||||||
|
ButtonWidget* cancelButton = getWidget<ButtonWidget>("cancel");
|
||||||
|
if (GUIEngine::isFocusedForPlayer(cancelButton, playerID))
|
||||||
|
{
|
||||||
|
std::string fakeEvent = "cancel";
|
||||||
|
processEvent(fakeEvent);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- Otherwise, see if we can accept the new name
|
||||||
|
TextBoxWidget* textCtrl = getWidget<TextBoxWidget>("username");
|
||||||
|
stringw username = textCtrl->getText().trim();
|
||||||
|
const int size = username.size();
|
||||||
|
|
||||||
|
// sanity check
|
||||||
|
int nonEmptyChars = 0;
|
||||||
|
for (int n=0; n<size; n++)
|
||||||
|
{
|
||||||
|
if (username[n] != L' ')
|
||||||
|
{
|
||||||
|
nonEmptyChars++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (size > 0 && nonEmptyChars > 0)
|
||||||
|
{
|
||||||
|
Log::info("Login Dialog","Username : '%s'",username.c_str());
|
||||||
|
// It's unsafe to delete from inside the event handler so we do it
|
||||||
|
// in onUpdate (which checks for m_self_destroy)
|
||||||
|
m_self_destroy = true;
|
||||||
|
} // if valid name
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LabelWidget* label = getWidget<LabelWidget>("title");
|
||||||
|
label->setText(_("Not a valid username"), false);
|
||||||
|
sfx_manager->quickSound( "anvil" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void LoginDialog::onUpdate(float dt)
|
||||||
|
{
|
||||||
|
// It's unsafe to delete from inside the event handler so we do it here
|
||||||
|
if (m_self_destroy)
|
||||||
|
{
|
||||||
|
TextBoxWidget* textCtrl = getWidget<TextBoxWidget>("username");
|
||||||
|
stringw playerName = textCtrl->getText().trim();
|
||||||
|
|
||||||
|
// irrLicht is too stupid to remove focus from deleted widgets
|
||||||
|
// so do it by hand
|
||||||
|
GUIEngine::getGUIEnv()->removeFocus( textCtrl->getIrrlichtElement() );
|
||||||
|
GUIEngine::getGUIEnv()->removeFocus( m_irrlicht_window );
|
||||||
|
|
||||||
|
|
||||||
|
ModalDialog::dismiss();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
60
src/states_screens/dialogs/login_dialog.hpp
Normal file
60
src/states_screens/dialogs/login_dialog.hpp
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
// SuperTuxKart - a fun racing game with go-kart
|
||||||
|
// Copyright (C) 2009 Marianne Gagnon
|
||||||
|
//
|
||||||
|
// This program is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU General Public License
|
||||||
|
// as published by the Free Software Foundation; either version 3
|
||||||
|
// of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef HEADER_LOGIN_DIALOG_HPP
|
||||||
|
#define HEADER_LOGIN_DIALOG_HPP
|
||||||
|
|
||||||
|
#include <irrString.h>
|
||||||
|
|
||||||
|
#include "guiengine/modaldialog.hpp"
|
||||||
|
#include "guiengine/widgets/text_box_widget.hpp"
|
||||||
|
/*
|
||||||
|
namespace GUIEngine
|
||||||
|
{
|
||||||
|
class TextBoxWidget;
|
||||||
|
class ButtonWidget;
|
||||||
|
class LabelWidget;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Dialog that allows a user to sign in
|
||||||
|
* \ingroup states_screens
|
||||||
|
*/
|
||||||
|
class LoginDialog : public GUIEngine::ModalDialog
|
||||||
|
{
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
bool m_self_destroy;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a modal dialog with given percentage of screen width and height
|
||||||
|
*/
|
||||||
|
LoginDialog(const float percentWidth, const float percentHeight);
|
||||||
|
~LoginDialog();
|
||||||
|
|
||||||
|
void onEnterPressedInternal();
|
||||||
|
GUIEngine::EventPropagation processEvent(const std::string& eventSource);
|
||||||
|
|
||||||
|
virtual void onUpdate(float dt);
|
||||||
|
//virtual void onTextUpdated();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -38,6 +38,7 @@
|
|||||||
#include "modes/overworld.hpp"
|
#include "modes/overworld.hpp"
|
||||||
#include "modes/demo_world.hpp"
|
#include "modes/demo_world.hpp"
|
||||||
#include "network/network_manager.hpp"
|
#include "network/network_manager.hpp"
|
||||||
|
#include "states_screens/online_screen.hpp"
|
||||||
#include "states_screens/addons_screen.hpp"
|
#include "states_screens/addons_screen.hpp"
|
||||||
#include "states_screens/credits.hpp"
|
#include "states_screens/credits.hpp"
|
||||||
#include "states_screens/help_screen_1.hpp"
|
#include "states_screens/help_screen_1.hpp"
|
||||||
@ -367,6 +368,10 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name,
|
|||||||
OverWorld::enterOverWorld();
|
OverWorld::enterOverWorld();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (selection == "online")
|
||||||
|
{
|
||||||
|
StateManager::get()->pushScreen(OnlineScreen::getInstance());
|
||||||
|
}
|
||||||
else if (selection == "addons")
|
else if (selection == "addons")
|
||||||
{
|
{
|
||||||
StateManager::get()->pushScreen(AddonsScreen::getInstance());
|
StateManager::get()->pushScreen(AddonsScreen::getInstance());
|
||||||
@ -402,4 +407,4 @@ void MainMenuScreen::onDisabledItemClicked(const std::string& item)
|
|||||||
new MessageDialog( _("Please wait while the add-ons are loading"));
|
new MessageDialog( _("Please wait while the add-ons are loading"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // onDisabledItemClicked
|
} // onDisabledItemClicked
|
||||||
|
136
src/states_screens/online_screen.cpp
Normal file
136
src/states_screens/online_screen.cpp
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
// SuperTuxKart - a fun racing game with go-kart
|
||||||
|
// Copyright (C) 2009 Marianne Gagnon
|
||||||
|
//
|
||||||
|
// This program is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU General Public License
|
||||||
|
// as published by the Free Software Foundation; either version 3
|
||||||
|
// of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
#define DEBUG_MENU_ITEM 0
|
||||||
|
|
||||||
|
#include "states_screens/online_screen.hpp"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "addons/inetwork_http.hpp"
|
||||||
|
#include "challenges/game_slot.hpp"
|
||||||
|
#include "challenges/unlock_manager.hpp"
|
||||||
|
#include "graphics/irr_driver.hpp"
|
||||||
|
#include "guiengine/scalable_font.hpp"
|
||||||
|
#include "guiengine/widgets/label_widget.hpp"
|
||||||
|
#include "guiengine/widgets/list_widget.hpp"
|
||||||
|
#include "guiengine/widgets/ribbon_widget.hpp"
|
||||||
|
#include "input/device_manager.hpp"
|
||||||
|
#include "input/input_manager.hpp"
|
||||||
|
#include "io/file_manager.hpp"
|
||||||
|
#include "karts/kart_properties_manager.hpp"
|
||||||
|
#include "main_loop.hpp"
|
||||||
|
#include "modes/cutscene_world.hpp"
|
||||||
|
#include "modes/overworld.hpp"
|
||||||
|
#include "modes/demo_world.hpp"
|
||||||
|
#include "network/network_manager.hpp"
|
||||||
|
#include "states_screens/online_screen.hpp"
|
||||||
|
#include "states_screens/addons_screen.hpp"
|
||||||
|
#include "states_screens/credits.hpp"
|
||||||
|
#include "states_screens/help_screen_1.hpp"
|
||||||
|
#include "states_screens/kart_selection.hpp"
|
||||||
|
#include "states_screens/options_screen_video.hpp"
|
||||||
|
#include "states_screens/state_manager.hpp"
|
||||||
|
#include "modes/demo_world.hpp"
|
||||||
|
|
||||||
|
#include "states_screens/dialogs/login_dialog.hpp"
|
||||||
|
|
||||||
|
using namespace GUIEngine;
|
||||||
|
|
||||||
|
DEFINE_SCREEN_SINGLETON( OnlineScreen );
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
OnlineScreen::OnlineScreen() : Screen("online.stkgui")
|
||||||
|
{
|
||||||
|
} // OnlineScreen
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void OnlineScreen::loadedFromFile()
|
||||||
|
{
|
||||||
|
|
||||||
|
} // loadedFromFile
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
void OnlineScreen::init()
|
||||||
|
{
|
||||||
|
Screen::init();
|
||||||
|
|
||||||
|
// Avoid incorrect behaviour in certain race circumstances:
|
||||||
|
// If a multi-player game is played with two keyboards, the 2nd
|
||||||
|
// player selects his kart last, and only the keyboard is used
|
||||||
|
// to select all other settings - then if the next time the kart
|
||||||
|
// selection screen comes up, the default device will still be
|
||||||
|
// the 2nd player. So if the first player presses 'select', it
|
||||||
|
// will instead add a second player (so basically the key
|
||||||
|
// binding for the second player become the default, so pressing
|
||||||
|
// select will add a new player). See bug 3090931
|
||||||
|
// To avoid this, we will clean the last used device, making
|
||||||
|
// the key bindings for the first player the default again.
|
||||||
|
input_manager->getDeviceList()->clearLatestUsedDevice();
|
||||||
|
|
||||||
|
RibbonWidget* r = getWidget<RibbonWidget>("menu_toprow");
|
||||||
|
r->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
|
||||||
|
DemoWorld::resetIdleTime();
|
||||||
|
|
||||||
|
#if _IRR_MATERIAL_MAX_TEXTURES_ < 8
|
||||||
|
getWidget<IconButtonWidget>("logo")->setImage("gui/logo_broken.png",
|
||||||
|
IconButtonWidget::ICON_PATH_TYPE_RELATIVE);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} // init
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
void OnlineScreen::onUpdate(float delta, irr::video::IVideoDriver* driver)
|
||||||
|
{
|
||||||
|
|
||||||
|
} // onUpdate
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void OnlineScreen::eventCallback(Widget* widget, const std::string& name,
|
||||||
|
const int playerID)
|
||||||
|
{
|
||||||
|
// most interesting stuff is in the ribbons, so start there
|
||||||
|
RibbonWidget* ribbon = dynamic_cast<RibbonWidget*>(widget);
|
||||||
|
|
||||||
|
if (ribbon == NULL) return; // what's that event??
|
||||||
|
|
||||||
|
// ---- A ribbon icon was clicked
|
||||||
|
std::string selection =
|
||||||
|
ribbon->getSelectionIDString(PLAYER_ID_GAME_MASTER);
|
||||||
|
|
||||||
|
if (selection == "login")
|
||||||
|
{
|
||||||
|
new LoginDialog(0.5f, 0.4f);
|
||||||
|
}
|
||||||
|
} // eventCallback
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void OnlineScreen::tearDown()
|
||||||
|
{
|
||||||
|
} // tearDown
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void OnlineScreen::onDisabledItemClicked(const std::string& item)
|
||||||
|
{
|
||||||
|
} // onDisabledItemClicked
|
57
src/states_screens/online_screen.hpp
Normal file
57
src/states_screens/online_screen.hpp
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
// SuperTuxKart - a fun racing game with go-kart
|
||||||
|
// Copyright (C) 2013 Glenn De Jonghe
|
||||||
|
//
|
||||||
|
// This program is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU General Public License
|
||||||
|
// as published by the Free Software Foundation; either version 3
|
||||||
|
// of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
#ifndef HEADER_ONLINE_SCREEN_HPP
|
||||||
|
#define HEADER_ONLINE_SCREEN_HPP
|
||||||
|
|
||||||
|
#include "guiengine/screen.hpp"
|
||||||
|
|
||||||
|
namespace GUIEngine { class Widget; class ListWidget; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Handles the main menu
|
||||||
|
* \ingroup states_screens
|
||||||
|
*/
|
||||||
|
class OnlineScreen : public GUIEngine::Screen, public GUIEngine::ScreenSingleton<OnlineScreen>
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
friend class GUIEngine::ScreenSingleton<OnlineScreen>;
|
||||||
|
|
||||||
|
OnlineScreen();
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual void onUpdate(float delta, irr::video::IVideoDriver* driver) OVERRIDE;
|
||||||
|
|
||||||
|
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||||
|
virtual void loadedFromFile() OVERRIDE;
|
||||||
|
|
||||||
|
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||||
|
virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name,
|
||||||
|
const int playerID) OVERRIDE;
|
||||||
|
|
||||||
|
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||||
|
virtual void init() OVERRIDE;
|
||||||
|
|
||||||
|
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||||
|
virtual void tearDown() OVERRIDE;
|
||||||
|
|
||||||
|
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||||
|
virtual void onDisabledItemClicked(const std::string& item) OVERRIDE;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue
Block a user