Lobby settings screen. Quick draft that will be used to test the server functionality. (Looks ugly now, need to merge with trunk again.)

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/uni@13096 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
unitraxx 2013-07-05 23:26:44 +00:00
parent 8617e0e15c
commit 83b270cccd
5 changed files with 231 additions and 3 deletions

View File

@ -0,0 +1,32 @@
<stkgui>
<div x="0" y="0" width="100%" height="100%" layout="vertical-row" >
<header text_align="center" width="80%" align="center" I18N="In the lobby settings screen" text="Lobby Settings"/>
<spacer height="15" width="10"/>
<box proportion="4" width="90%" layout="vertical-row" align="center">
<div width="90%" align="center" layout="vertical-row" height="fit" >
<div width="100%" height="fit" layout="horizontal-row" >
<label proportion="1" text_align="left" I18N="In the lobby settings screen" text="Name of the server"/>
<textbox proportion="2" id="name" I18N="In the login dialog"/>
</div>
<spacer height="20" width="20">
<div width="100%" height="fit" layout="horizontal-row" >
<label proportion="1" text_align="left" I18N="In the lobby settings screen" text="Max. number of players"/>
<gauge id="max_players" proportion="2" min_value="2" max_value="12"/>
</div>
</div>
</box>
<spacer width="10" height="7%"/>
<bottombar x="2%" width="96%" height="10%" layout="horizontal-row">
</bottombar>
</div>
<icon-button id="back" x="0" y="0" height="8%" icon="gui/back.png"/>
</stkgui>

View File

@ -192,6 +192,8 @@ 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/networking_lobby.cpp
src/states_screens/networking_lobby_settings.cpp
src/states_screens/online_screen.cpp
src/states_screens/options_screen_audio.cpp
src/states_screens/options_screen_input2.cpp
@ -459,6 +461,8 @@ 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/networking_lobby.hpp
src/states_screens/networking_lobby_settings.hpp
src/states_screens/online_screen.hpp
src/states_screens/options_screen_audio.hpp
src/states_screens/options_screen_input2.hpp

View File

@ -0,0 +1,114 @@
// 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.
#define DEBUG_MENU_ITEM 0
#include "states_screens/networking_lobby_settings.hpp"
#include <string>
#include <iostream>
#include "challenges/game_slot.hpp"
#include "challenges/unlock_manager.hpp"
#include "graphics/irr_driver.hpp"
#include "guiengine/scalable_font.hpp"
#include "input/device_manager.hpp"
#include "input/input_manager.hpp"
#include "io/file_manager.hpp"
#include "main_loop.hpp"
#include "states_screens/online_screen.hpp"
#include "states_screens/state_manager.hpp"
#include "states_screens/dialogs/message_dialog.hpp"
#include "modes/demo_world.hpp"
#include "utils/translation.hpp"
#include "online/current_online_user.hpp"
using namespace GUIEngine;
DEFINE_SCREEN_SINGLETON( NetworkingLobbySettings );
// ----------------------------------------------------------------------------
NetworkingLobbySettings::NetworkingLobbySettings() : Screen("online/lobby_settings.stkgui")
{
} // NetworkingLobbySettings
// ----------------------------------------------------------------------------
void NetworkingLobbySettings::loadedFromFile()
{
} // loadedFromFile
// ----------------------------------------------------------------------------
bool NetworkingLobbySettings::hasLostConnection()
{
return !CurrentOnlineUser::get()->isSignedIn();
}
// ----------------------------------------------------------------------------
void NetworkingLobbySettings::beforeAddingWidget()
{
} // beforeAddingWidget
// ----------------------------------------------------------------------------
void NetworkingLobbySettings::init()
{
Screen::init();
setInitialFocus();
DemoWorld::resetIdleTime(); //FIXME : what's this?} // init
}
// ----------------------------------------------------------------------------
void NetworkingLobbySettings::onUpdate(float delta, irr::video::IVideoDriver* driver)
{
} // onUpdate
// ----------------------------------------------------------------------------
void NetworkingLobbySettings::eventCallback(Widget* widget, const std::string& name, const int playerID)
{
} // eventCallback
// ----------------------------------------------------------------------------
void NetworkingLobbySettings::tearDown()
{
} // tearDown
// ----------------------------------------------------------------------------
void NetworkingLobbySettings::onDisabledItemClicked(const std::string& item)
{
} // onDisabledItemClicked
// ----------------------------------------------------------------------------
void NetworkingLobbySettings::setInitialFocus()
{
} // setInitialFocus
// ----------------------------------------------------------------------------
void NetworkingLobbySettings::onDialogClose()
{
setInitialFocus();
} // onDialogClose()

View File

@ -0,0 +1,72 @@
// 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_NETWORKING_LOBBY_SETTINGS_HPP
#define HEADER_NETWORKING_LOBBY_SETTINGS_HPP
#include "guiengine/screen.hpp"
#include "guiengine/widgets/label_widget.hpp"
#include "guiengine/widgets/ribbon_widget.hpp"
#include "guiengine/widgets/icon_button_widget.hpp"
namespace GUIEngine { class Widget; class ListWidget; }
/**
* \brief Handles the main menu
* \ingroup states_screens
*/
class NetworkingLobbySettings : public GUIEngine::Screen,
public GUIEngine::ScreenSingleton<NetworkingLobbySettings>
{
private:
friend class GUIEngine::ScreenSingleton<NetworkingLobbySettings>;
NetworkingLobbySettings();
/** \brief Checks if the user is still signed in. */
bool hasLostConnection();
/** \brief Sets which widget has to be focused. Depends on the user state. */
void setInitialFocus();
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 beforeAddingWidget() 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;
/** \brief Implements the callback when a dialog gets closed. */
virtual void onDialogClose() OVERRIDE;
};
#endif

View File

@ -36,6 +36,7 @@
#include "states_screens/dialogs/login_dialog.hpp"
#include "states_screens/dialogs/registration_dialog.hpp"
#include "states_screens/networking_lobby.hpp"
#include "states_screens/networking_lobby_settings.hpp"
#include "modes/demo_world.hpp"
#include "utils/translation.hpp"
@ -185,11 +186,11 @@ void OnlineScreen::eventCallback(Widget* widget, const std::string& name, const
else if (selection == "create_server")
{
//if (m_recorded_state == Registered)
new MessageDialog("Coming soon!");
StateManager::get()->pushScreen(NetworkingLobbySettings::getInstance());
}
else if (selection == "quick_play")
{
//if (m_recorded_state == Registered || m_recorded_state == Guest)
//if (m_recorded_state == Registered || m_recorded_state == Guest) FIXME
StateManager::get()->pushScreen(NetworkingLobby::getInstance());
}
@ -204,10 +205,15 @@ void OnlineScreen::tearDown()
// ----------------------------------------------------------------------------
void OnlineScreen::onDisabledItemClicked(const std::string& item)
{
if (item == "find_server" || item =="create_server")
if (item == "find_server")
{
new LoginDialog(LoginDialog::Registration_Required);
}
else if (item =="create_server")
{
StateManager::get()->pushScreen(NetworkingLobbySettings::getInstance());
// FIXME temporary; new LoginDialog(LoginDialog::Registration_Required);
}
else if (item == "quick_play")
{
StateManager::get()->pushScreen(NetworkingLobby::getInstance());