Soccer mode: WIP GUI state screen for choosing the teams and the number of goals to score in order to win
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/christmas@12318 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
be5f3e47e9
commit
fa7c3cffb3
51
data/gui/soccer_setup.stkgui
Normal file
51
data/gui/soccer_setup.stkgui
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
<stkgui>
|
||||||
|
|
||||||
|
<icon-button id="back" x="0" y="0" height="8%" icon="gui/back.png"/>
|
||||||
|
|
||||||
|
<div x="5%" y="5%" width="90%" height="90%" layout="vertical-row" >
|
||||||
|
|
||||||
|
<header width="80%" text="Race Setup" align="center" text_align="center" />
|
||||||
|
|
||||||
|
<spacer proportion="1" width="25"/>
|
||||||
|
|
||||||
|
<div layout="horizontal-row" width="100%" height="50" align="center">
|
||||||
|
<bright proportion="1" height="100%"
|
||||||
|
I18N="In soccer setup menu" text="Number of goals to win" text_align="right" />
|
||||||
|
<spacer width="50" height="25"/>
|
||||||
|
<spinner id="goalamount" proportion="1" height="100%" min_value="1" max_value="30" wrap_around="true"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<spacer proportion="1" width="25" />
|
||||||
|
|
||||||
|
<roundedbox x="2%" y="5%" width="100%" height="50%" layout="vertical-row" id="players-table">
|
||||||
|
<!-- Content is added programmatically -->
|
||||||
|
<!-- TODO: remove these tests and actually do this in the code -->
|
||||||
|
<div layout="horizontal-row" width="100%" height="50" align="center">
|
||||||
|
<spacer proportion="1" />
|
||||||
|
<icon-button id="kart-0" height="100%" icon="karts/beastie/beastie-icon.png"/>
|
||||||
|
<label proportion="1" height="100%"
|
||||||
|
I18N="In soccer setup menu" text="funto" text_align="left" />
|
||||||
|
<button id="team-0" I18N="In soccer setup screen" text="Team: blue" width="30%"/>
|
||||||
|
|
||||||
|
<spacer proportion="1" />
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div layout="horizontal-row" width="100%" height="50" align="center">
|
||||||
|
<spacer proportion="1" />
|
||||||
|
<icon-button id="kart-1" height="100%" icon="karts/tux/tuxicon.png"/>
|
||||||
|
<label proportion="1" height="100%"
|
||||||
|
I18N="In soccer setup menu" text="bouYou" text_align="left" />
|
||||||
|
<button id="team-1" I18N="In soccer setup screen" text="Team: red" width="30%"/>
|
||||||
|
|
||||||
|
<spacer proportion="1" />
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</roundedbox>
|
||||||
|
|
||||||
|
<spacer proportion="1" width="25" />
|
||||||
|
|
||||||
|
<button id="continue" I18N="In soccer setup screen" text="Continue" align="center" width="60%"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</stkgui>
|
@ -197,6 +197,7 @@ src/states_screens/race_gui_base.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
|
||||||
|
src/states_screens/soccer_setup_screen.cpp
|
||||||
src/states_screens/state_manager.cpp
|
src/states_screens/state_manager.cpp
|
||||||
src/states_screens/story_mode_lobby.cpp
|
src/states_screens/story_mode_lobby.cpp
|
||||||
src/states_screens/tracks_screen.cpp
|
src/states_screens/tracks_screen.cpp
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "io/file_manager.hpp"
|
#include "io/file_manager.hpp"
|
||||||
#include "race/race_manager.hpp"
|
#include "race/race_manager.hpp"
|
||||||
#include "states_screens/arenas_screen.hpp"
|
#include "states_screens/arenas_screen.hpp"
|
||||||
|
#include "states_screens/soccer_setup_screen.hpp"
|
||||||
#include "states_screens/state_manager.hpp"
|
#include "states_screens/state_manager.hpp"
|
||||||
#include "states_screens/tracks_screen.hpp"
|
#include "states_screens/tracks_screen.hpp"
|
||||||
#include "utils/translation.hpp"
|
#include "utils/translation.hpp"
|
||||||
@ -134,8 +135,14 @@ void RaceSetupScreen::eventCallback(Widget* widget, const std::string& name, con
|
|||||||
race_manager->setMinorMode(RaceManager::MINOR_MODE_SOCCER);
|
race_manager->setMinorMode(RaceManager::MINOR_MODE_SOCCER);
|
||||||
UserConfigParams::m_game_mode = CONFIG_CODE_SOCCER;
|
UserConfigParams::m_game_mode = CONFIG_CODE_SOCCER;
|
||||||
race_manager->setNumKarts( race_manager->getNumLocalPlayers() ); // no AI karts;
|
race_manager->setNumKarts( race_manager->getNumLocalPlayers() ); // no AI karts;
|
||||||
ArenasScreen::getInstance()->setUsedForSoccer(true);
|
// 1 player -> no need to choose a team or determine when the match ends
|
||||||
StateManager::get()->pushScreen( ArenasScreen::getInstance() );
|
if(race_manager->getNumLocalPlayers() <= 1)
|
||||||
|
{
|
||||||
|
ArenasScreen::getInstance()->setUsedForSoccer(true);
|
||||||
|
StateManager::get()->pushScreen( ArenasScreen::getInstance() );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
StateManager::get()->pushScreen( SoccerSetupScreen::getInstance() );
|
||||||
}
|
}
|
||||||
else if (selectedMode == "locked")
|
else if (selectedMode == "locked")
|
||||||
{
|
{
|
||||||
|
56
src/states_screens/soccer_setup_screen.cpp
Normal file
56
src/states_screens/soccer_setup_screen.cpp
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
// SuperTuxKart - a fun racing game with go-kart
|
||||||
|
// Copyright (C) 2013 Lionel Fuentes
|
||||||
|
//
|
||||||
|
// 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/soccer_setup_screen.hpp"
|
||||||
|
|
||||||
|
#include "states_screens/state_manager.hpp"
|
||||||
|
#include "states_screens/arenas_screen.hpp"
|
||||||
|
|
||||||
|
using namespace GUIEngine;
|
||||||
|
DEFINE_SCREEN_SINGLETON( SoccerSetupScreen );
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
SoccerSetupScreen::SoccerSetupScreen() : Screen("soccer_setup.stkgui")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void SoccerSetupScreen::loadedFromFile()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
void SoccerSetupScreen::eventCallback(Widget* widget, const std::string& name, const int playerID)
|
||||||
|
{
|
||||||
|
if(name == "continue")
|
||||||
|
{
|
||||||
|
ArenasScreen::getInstance()->setUsedForSoccer(true);
|
||||||
|
StateManager::get()->pushScreen( ArenasScreen::getInstance() );
|
||||||
|
}
|
||||||
|
else if (name == "back")
|
||||||
|
{
|
||||||
|
StateManager::get()->escapePressed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
void SoccerSetupScreen::init()
|
||||||
|
{
|
||||||
|
Screen::init();
|
||||||
|
}
|
48
src/states_screens/soccer_setup_screen.hpp
Normal file
48
src/states_screens/soccer_setup_screen.hpp
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
// SuperTuxKart - a fun racing game with go-kart
|
||||||
|
// Copyright (C) 2013 Lionel Fuentes
|
||||||
|
//
|
||||||
|
// 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_SOCCER_SETUP_SCREEN_HPP
|
||||||
|
#define HEADER_SOCCER_SETUP_SCREEN_HPP
|
||||||
|
|
||||||
|
#include "guiengine/screen.hpp"
|
||||||
|
|
||||||
|
namespace GUIEngine { class Widget; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Screen with soccer setup options
|
||||||
|
* \ingroup states_screens
|
||||||
|
*/
|
||||||
|
class SoccerSetupScreen : public GUIEngine::Screen, public GUIEngine::ScreenSingleton<SoccerSetupScreen>
|
||||||
|
{
|
||||||
|
friend class GUIEngine::ScreenSingleton<SoccerSetupScreen>;
|
||||||
|
|
||||||
|
SoccerSetupScreen();
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/** \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;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // HEADER_SOCCER_SETUP_SCREEN_HPP
|
Loading…
Reference in New Issue
Block a user