+
+
diff --git a/data/gui/main.stkgui b/data/gui/main.stkgui
index aba01222f..7a297aee9 100644
--- a/data/gui/main.stkgui
+++ b/data/gui/main.stkgui
@@ -4,7 +4,7 @@
-
+
@@ -14,6 +14,9 @@
+
diff --git a/data/gui/menu_online.png b/data/gui/menu_online.png
new file mode 100644
index 000000000..d1e6503d7
Binary files /dev/null and b/data/gui/menu_online.png differ
diff --git a/data/gui/menu_online_focus.png b/data/gui/menu_online_focus.png
new file mode 100644
index 000000000..d1e6503d7
Binary files /dev/null and b/data/gui/menu_online_focus.png differ
diff --git a/data/gui/online.stkgui b/data/gui/online.stkgui
new file mode 100644
index 000000000..373222bba
--- /dev/null
+++ b/data/gui/online.stkgui
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sources.cmake b/sources.cmake
index b975bccfd..532b8da7d 100644
--- a/sources.cmake
+++ b/sources.cmake
@@ -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
src/addons/addon.cpp
src/addons/addons_manager.cpp
@@ -96,8 +96,8 @@ src/items/projectile_manager.cpp
src/items/rubber_ball.cpp
src/items/rubber_band.cpp
src/items/swatter.cpp
-src/karts/abstract_kart.cpp
src/karts/abstract_kart_animation.cpp
+src/karts/abstract_kart.cpp
src/karts/cannon_animation.cpp
src/karts/controller/ai_base_controller.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/enter_player_name_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/player_info_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/main_menu_screen.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_input.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_ui.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.cpp
src/states_screens/race_gui_overworld.cpp
src/states_screens/race_result_gui.cpp
src/states_screens/race_setup_screen.cpp
@@ -253,8 +255,8 @@ src/animations/animation_base.hpp
src/animations/ipo.hpp
src/animations/three_d_animation.hpp
src/audio/dummy_sfx.hpp
-src/audio/music.hpp
src/audio/music_dummy.hpp
+src/audio/music.hpp
src/audio/music_information.hpp
src/audio/music_manager.hpp
src/audio/music_ogg.hpp
@@ -262,8 +264,8 @@ src/audio/sfx_base.hpp
src/audio/sfx_buffer.hpp
src/audio/sfx_manager.hpp
src/audio/sfx_openal.hpp
-src/challenges/challenge.hpp
src/challenges/challenge_data.hpp
+src/challenges/challenge.hpp
src/challenges/game_slot.hpp
src/challenges/unlock_manager.hpp
src/config/device_config.hpp
@@ -305,11 +307,11 @@ src/guiengine/scalable_font.hpp
src/guiengine/screen.hpp
src/guiengine/skin.hpp
src/guiengine/widget.hpp
-src/guiengine/widgets.hpp
src/guiengine/widgets/bubble_widget.hpp
src/guiengine/widgets/button_widget.hpp
src/guiengine/widgets/check_box_widget.hpp
src/guiengine/widgets/dynamic_ribbon_widget.hpp
+src/guiengine/widgets.hpp
src/guiengine/widgets/icon_button_widget.hpp
src/guiengine/widgets/label_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/input/binding.hpp
src/input/device_manager.hpp
-src/input/input.hpp
src/input/input_device.hpp
+src/input/input.hpp
src/input/input_manager.hpp
src/input/wiimote.hpp
src/input/wiimote_manager.hpp
@@ -343,8 +345,8 @@ src/items/projectile_manager.hpp
src/items/rubber_ball.hpp
src/items/rubber_band.hpp
src/items/swatter.hpp
-src/karts/abstract_kart.hpp
src/karts/abstract_kart_animation.hpp
+src/karts/abstract_kart.hpp
src/karts/cannon_animation.hpp
src/karts/controller/ai_base_controller.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/explosion_animation.hpp
src/karts/ghost_kart.hpp
-src/karts/kart.hpp
src/karts/kart_gfx.hpp
+src/karts/kart.hpp
src/karts/kart_model.hpp
src/karts/kart_properties.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/enter_player_name_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/player_info_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/main_menu_screen.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_input.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_ui.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.hpp
src/states_screens/race_gui_overworld.hpp
src/states_screens/race_result_gui.hpp
src/states_screens/race_setup_screen.hpp
@@ -483,8 +487,8 @@ src/tracks/check_sphere.hpp
src/tracks/check_structure.hpp
src/tracks/graph_node.hpp
src/tracks/lod_node_loader.hpp
-src/tracks/quad.hpp
src/tracks/quad_graph.hpp
+src/tracks/quad.hpp
src/tracks/quad_set.hpp
src/tracks/terrain_info.hpp
src/tracks/track.hpp
diff --git a/src/states_screens/dialogs/login_dialog.cpp b/src/states_screens/dialogs/login_dialog.cpp
new file mode 100644
index 000000000..04c4fba78
--- /dev/null
+++ b/src/states_screens/dialogs/login_dialog.cpp
@@ -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
+
+#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("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("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("username");
+ stringw username = textCtrl->getText().trim();
+ const int size = username.size();
+
+ // sanity check
+ int nonEmptyChars = 0;
+ for (int n=0; n 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("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("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();
+
+ }
+}
diff --git a/src/states_screens/dialogs/login_dialog.hpp b/src/states_screens/dialogs/login_dialog.hpp
new file mode 100644
index 000000000..5176576e4
--- /dev/null
+++ b/src/states_screens/dialogs/login_dialog.hpp
@@ -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
+
+#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
diff --git a/src/states_screens/main_menu_screen.cpp b/src/states_screens/main_menu_screen.cpp
index 2bbd7e606..06b632b00 100644
--- a/src/states_screens/main_menu_screen.cpp
+++ b/src/states_screens/main_menu_screen.cpp
@@ -38,6 +38,7 @@
#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"
@@ -367,6 +368,10 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name,
OverWorld::enterOverWorld();
}
}
+ else if (selection == "online")
+ {
+ StateManager::get()->pushScreen(OnlineScreen::getInstance());
+ }
else if (selection == "addons")
{
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"));
}
}
-} // onDisabledItemClicked
\ No newline at end of file
+} // onDisabledItemClicked
diff --git a/src/states_screens/online_screen.cpp b/src/states_screens/online_screen.cpp
new file mode 100644
index 000000000..1f6d703bf
--- /dev/null
+++ b/src/states_screens/online_screen.cpp
@@ -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
+#include
+
+#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("menu_toprow");
+ r->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
+ DemoWorld::resetIdleTime();
+
+#if _IRR_MATERIAL_MAX_TEXTURES_ < 8
+ getWidget("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(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
diff --git a/src/states_screens/online_screen.hpp b/src/states_screens/online_screen.hpp
new file mode 100644
index 000000000..549fa055a
--- /dev/null
+++ b/src/states_screens/online_screen.hpp
@@ -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
+{
+private:
+ friend class GUIEngine::ScreenSingleton;
+
+ 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