Start adding first screens of story mode

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@10347 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2011-12-04 23:06:53 +00:00
parent d01a45c35e
commit d0a7af3761
9 changed files with 343 additions and 5 deletions

View File

@ -4,13 +4,13 @@
<icon id="logo" align="center" proportion="8" width="100%" icon="gui/logo.png"/>
<buttonbar id="menu_toprow" proportion="3" width="75%" align="center">
<icon-button id="story" width="128" height="128"
icon="gui/challenge.png"
I18N="Main menu button" text="Story Mode"/>
<icon-button id="new" width="128" height="128" icon="gui/main_race.png"
I18N="Main menu button" text="Single-player"/>
<icon-button id="multiplayer" width="128" height="128" icon="gui/main_race_multi.png"
I18N="Main menu button" text="Multiplayer"/>
<icon-button id="challenges" width="128" height="128"
icon="gui/challenge.png"
I18N="Main menu button" text="Challenges"/>
<icon-button id="addons" width="128" height="128"
icon="gui/addons.png"
I18N="Main menu button" text="Addons"/>

View File

@ -0,0 +1,20 @@
<stkgui>
<div x="2%" y="2%" width="96%" height="97%" layout="vertical-row" >
<header text_align="center" width="80%" align="center" text="Select a Game Slot"/>
<spacer height="15" width="10"/>
<list id="gameslots" proportion="5" width="75%" align="center"/>
<spacer width="20" height="25"/>
<button id="creategame" x="20"
I18N="In story mode 'select a game slot' menu"
text="Create a new game" align="center"/>
<spacer width="20" height="15"/>
</div>
<icon-button id="back" x="0" y="0" height="8%" icon="gui/back.png"/>
</stkgui>

View File

@ -0,0 +1,36 @@
<stkgui>
<div x="5%" y="5%" width="90%" height="90%" layout="vertical-row" >
<header width="80%" text="New Game" align="center" text_align="center" />
<spacer proportion="1" width="25"/>
<div layout="horizontal-row" width="100%" height="50" align="center">
<label proportion="1" height="100%"
I18N="In the new story mode game dialog" text="Select your identity" text_align="right" />
<spacer width="50" height="25"/>
<spinner id="identity" proportion="1" height="100%" min_value="0" warp_around="true"/>
</div>
<spacer proportion="1" width="25"/>
<ribbon id="difficulty" height="135" width="85%" align="center">
<icon-button id="novice" width="128" height="128" icon="gui/difficulty_easy.png"
I18N="Difficulty" text="Novice"/>
<icon-button id="intermediate" width="128" height="128" icon="gui/difficulty_medium.png"
I18N="Difficulty" text="Intermediate"/>
<icon-button id="expert" width="128" height="128" icon="gui/difficulty_hard.png"
I18N="Difficulty" text="Expert"/>
</ribbon>
<spacer width="25" proportion="1"/>
<button id="startgame" text="Start Game" align="center"/>
<spacer width="25" height="5"/>
<button id="cancel" text="Cancel" align="center"/>
</div>
</stkgui>

View File

@ -357,6 +357,8 @@
95DFC5021106933B00A043A9 /* slip_stream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95DFC5001106933B00A043A9 /* slip_stream.cpp */; };
95E1FCDF130369EB004D83CC /* per_camera_node.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95E1FCDD130369EB004D83CC /* per_camera_node.cpp */; };
95E246BE111A2959000C965D /* confirm_resolution_dialog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95E246BC111A2959000C965D /* confirm_resolution_dialog.cpp */; };
95E5C318148C17E500AD3FCC /* story_mode_lobby.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95E5C316148C17E500AD3FCC /* story_mode_lobby.cpp */; };
95E5C335148C19F500AD3FCC /* story_mode_new.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95E5C333148C19F500AD3FCC /* story_mode_new.cpp */; };
95E6A0C011DCF37800AE088A /* addons_loading.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95E6A0BE11DCF37800AE088A /* addons_loading.cpp */; };
95ECA10010124C5000D47C5F /* button_widget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95ECA0EC10124C5000D47C5F /* button_widget.cpp */; };
95ECA10110124C5000D47C5F /* check_box_widget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95ECA0EE10124C5000D47C5F /* check_box_widget.cpp */; };
@ -1329,6 +1331,10 @@
95E1FCE0130369F4004D83CC /* rain.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = rain.hpp; path = ../../graphics/rain.hpp; sourceTree = SOURCE_ROOT; };
95E246BC111A2959000C965D /* confirm_resolution_dialog.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = confirm_resolution_dialog.cpp; path = ../../states_screens/dialogs/confirm_resolution_dialog.cpp; sourceTree = SOURCE_ROOT; };
95E246BD111A2959000C965D /* confirm_resolution_dialog.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = confirm_resolution_dialog.hpp; path = ../../states_screens/dialogs/confirm_resolution_dialog.hpp; sourceTree = SOURCE_ROOT; };
95E5C316148C17E500AD3FCC /* story_mode_lobby.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = story_mode_lobby.cpp; path = ../../states_screens/story_mode_lobby.cpp; sourceTree = SOURCE_ROOT; };
95E5C317148C17E500AD3FCC /* story_mode_lobby.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = story_mode_lobby.hpp; path = ../../states_screens/story_mode_lobby.hpp; sourceTree = SOURCE_ROOT; };
95E5C333148C19F500AD3FCC /* story_mode_new.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = story_mode_new.cpp; path = ../../states_screens/dialogs/story_mode_new.cpp; sourceTree = SOURCE_ROOT; };
95E5C334148C19F500AD3FCC /* story_mode_new.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = story_mode_new.hpp; path = ../../states_screens/dialogs/story_mode_new.hpp; sourceTree = SOURCE_ROOT; };
95E6A0BE11DCF37800AE088A /* addons_loading.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = addons_loading.cpp; path = ../../states_screens/dialogs/addons_loading.cpp; sourceTree = SOURCE_ROOT; };
95E6A0BF11DCF37800AE088A /* addons_loading.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = addons_loading.hpp; path = ../../states_screens/dialogs/addons_loading.hpp; sourceTree = SOURCE_ROOT; };
95ECA0EC10124C5000D47C5F /* button_widget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = button_widget.cpp; path = ../../guiengine/widgets/button_widget.cpp; sourceTree = SOURCE_ROOT; };
@ -2259,6 +2265,8 @@
9522F159107949780067ECF5 /* race_setup_screen.hpp */,
958330CA10122B4A00C5137E /* state_manager.cpp */,
958330CB10122B4A00C5137E /* state_manager.hpp */,
95E5C316148C17E500AD3FCC /* story_mode_lobby.cpp */,
95E5C317148C17E500AD3FCC /* story_mode_lobby.hpp */,
9522F15C10794A350067ECF5 /* tracks_screen.cpp */,
9522F15D10794A350067ECF5 /* tracks_screen.hpp */,
);
@ -2285,12 +2293,14 @@
9583323A101243ED00C5137E /* player_info_dialog.hpp */,
9583323B101243ED00C5137E /* press_a_key_dialog.cpp */,
9583323C101243ED00C5137E /* press_a_key_dialog.hpp */,
9583323D101243ED00C5137E /* track_info_dialog.cpp */,
9583323E101243ED00C5137E /* track_info_dialog.hpp */,
9551DB33104CABFC001C53E5 /* race_over_dialog.cpp */,
9551DB32104CABFC001C53E5 /* race_over_dialog.hpp */,
958D8C53104F523000A81934 /* race_paused_dialog.cpp */,
958D8C52104F523000A81934 /* race_paused_dialog.hpp */,
95E5C333148C19F500AD3FCC /* story_mode_new.cpp */,
95E5C334148C19F500AD3FCC /* story_mode_new.hpp */,
9583323D101243ED00C5137E /* track_info_dialog.cpp */,
9583323E101243ED00C5137E /* track_info_dialog.hpp */,
);
name = dialogs;
path = ../../states_screens/dialogs;
@ -3183,6 +3193,8 @@
95703D1C1468C63F006334D7 /* btQuickprof.cpp in Sources */,
95703D1D1468C63F006334D7 /* btSerializer.cpp in Sources */,
95AA4C67148AF2CC0053771D /* lod_node_loader.cpp in Sources */,
95E5C318148C17E500AD3FCC /* story_mode_lobby.cpp in Sources */,
95E5C335148C19F500AD3FCC /* story_mode_new.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -0,0 +1,79 @@
// 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.
#include "states_screens/dialogs/story_mode_new.hpp"
#include "config/user_config.hpp"
#include "config/player.hpp"
#include "guiengine/widgets/ribbon_widget.hpp"
#include "guiengine/widgets/spinner_widget.hpp"
#include "states_screens/state_manager.hpp"
#include "utils/translation.hpp"
#include <IGUIEnvironment.h>
using namespace GUIEngine;
using namespace irr;
using namespace irr::core;
using namespace irr::gui;
// -----------------------------------------------------------------------------
StoryModeNewDialog::StoryModeNewDialog(const float w, const float h) :
ModalDialog(w, h)
{
loadFromFile("story_mode_new.stkgui");
SpinnerWidget* ident = getWidget<SpinnerWidget>("identity");
const int playerAmount = UserConfigParams::m_all_players.size();
ident->setMax(playerAmount - 1);
for(int n=0; n<playerAmount; n++)
{
ident->addLabel( translations->fribidize(UserConfigParams::m_all_players[n].getName()) );
}
RibbonWidget* difficulty = getWidget<RibbonWidget>("difficulty");
difficulty->setSelection( 1 /* medium */, PLAYER_ID_GAME_MASTER );
}
// -----------------------------------------------------------------------------
StoryModeNewDialog::~StoryModeNewDialog()
{
}
// -----------------------------------------------------------------------------
GUIEngine::EventPropagation StoryModeNewDialog::processEvent(const std::string& eventSource)
{
if (eventSource == "cancel")
{
dismiss();
return GUIEngine::EVENT_BLOCK;
}
else if (eventSource == "startgame")
{
// TODO
}
return GUIEngine::EVENT_LET;
}
// -----------------------------------------------------------------------------

View File

@ -0,0 +1,50 @@
// 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_STORY_MODE_NEW_DIALOG_HPP
#define HEADER_STORY_MODE_NEW_DIALOG_HPP
#include "guiengine/modaldialog.hpp"
namespace GUIEngine
{
class TextBoxWidget;
class ButtonWidget;
class LabelWidget;
}
/**
* \brief Dialog that allows the player to create a new story mode game
* \ingroup states_screens
*/
class StoryModeNewDialog : public GUIEngine::ModalDialog//, public GUIEngine::ITextBoxWidgetListener
{
public:
/**
* Creates a modal dialog with given percentage of screen width and height
*/
StoryModeNewDialog(const float percentWidth, const float percentHeight);
~StoryModeNewDialog();
GUIEngine::EventPropagation processEvent(const std::string& eventSource);
//virtual void onTextUpdated();
};
#endif

View File

@ -39,6 +39,7 @@
#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
@ -277,6 +278,10 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name,
{
StateManager::get()->pushScreen(ChallengesScreen::getInstance());
}
else if (selection == "story")
{
StateManager::get()->pushScreen(StoryModeLobbyScreen::getInstance());
}
else if (selection == "tutorial")
{
StateManager::get()->pushScreen(TutorialScreen::getInstance());

View File

@ -0,0 +1,80 @@
// 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.
#include "states_screens/story_mode_lobby.hpp"
#include "states_screens/dialogs/story_mode_new.hpp"
#include "states_screens/state_manager.hpp"
using namespace GUIEngine;
DEFINE_SCREEN_SINGLETON( StoryModeLobbyScreen );
// ----------------------------------------------------------------------------
StoryModeLobbyScreen::StoryModeLobbyScreen() : Screen("story_mode_lobby.stkgui")
{
} // StoryModeLobbyScreen
// ----------------------------------------------------------------------------
void StoryModeLobbyScreen::loadedFromFile()
{
} // loadedFromFile
// ----------------------------------------------------------------------------
void StoryModeLobbyScreen::init()
{
Screen::init();
} // init
// ----------------------------------------------------------------------------
void StoryModeLobbyScreen::tearDown()
{
Screen::tearDown();
} // tearDown
// ----------------------------------------------------------------------------
void StoryModeLobbyScreen::eventCallback(Widget* widget, const std::string& name, const int playerID)
{
if (name == "back")
{
StateManager::get()->escapePressed();
}
else if (name == "creategame")
{
new StoryModeNewDialog(0.8f, 0.8f);
}
else if (name == "gameslots")
{
// TODO
}
} // eventCallback
// ----------------------------------------------------------------------------
void StoryModeLobbyScreen::unloaded()
{
} // unloaded
// ----------------------------------------------------------------------------

View File

@ -0,0 +1,56 @@
// 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_STORY_MODE_LOBBY_HPP__
#define __HEADER_STORY_MODE_LOBBY_HPP__
#include <string>
#include "guiengine/screen.hpp"
namespace GUIEngine { class Widget; }
/**
* \brief Audio options screen
* \ingroup states_screens
*/
class StoryModeLobbyScreen : public GUIEngine::Screen, public GUIEngine::ScreenSingleton<StoryModeLobbyScreen>
{
StoryModeLobbyScreen();
public:
friend class GUIEngine::ScreenSingleton<StoryModeLobbyScreen>;
/** \brief implement callback from parent class GUIEngine::Screen */
virtual void loadedFromFile();
/** \brief implement callback from parent class GUIEngine::Screen */
virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID);
/** \brief implement callback from parent class GUIEngine::Screen */
virtual void init();
/** \brief implement callback from parent class GUIEngine::Screen */
virtual void tearDown();
/** \brief implement optional callback from parent class GUIEngine::Screen */
virtual void unloaded();
};
#endif