begining with grand_prix_cutscene.cpp (first compiling prototype)

This commit is contained in:
konstin 2014-07-23 15:28:57 +02:00
parent 80e61e0ca0
commit 02d21053fc
8 changed files with 90 additions and 13 deletions

View File

@ -170,7 +170,7 @@ namespace GUIEngine
inline Skin* getSkin() { return Private::g_skin; }
Screen* getScreenNamed(const char* name);
/** \return the height of the title font in pixels */
int getTitleFontHeight();

View File

@ -46,6 +46,7 @@
#include "network/protocol_manager.hpp"
#include "network/network_world.hpp"
#include "network/protocols/start_game_protocol.hpp"
#include "states_screens/grand_prix_cutscene.hpp"
#include "states_screens/grand_prix_lose.hpp"
#include "states_screens/grand_prix_win.hpp"
#include "states_screens/kart_selection.hpp"

View File

@ -0,0 +1,39 @@
// SuperTuxKart - a fun racing game with go-kart
// Copyright (C) 2014 konstin
//
// 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 "guiengine/scalable_font.hpp"
#include "states_screens/grand_prix_cutscene.hpp"
typedef GUIEngine::ButtonWidget Button;
void GrandPrixCutscene::saveGPButton()
{
if (race_manager->getGrandPrix().getId() == "random")
{
core::stringw text = _("Save Grand Prix");
Button* save_button = new Button();
save_button->m_properties[GUIEngine::PROP_ID] = "save gp";
Button* c = getWidget<Button>("continue");
save_button->m_x = c->m_x + c->m_w + 20;
save_button->m_y = c->m_y;
save_button->m_w = GUIEngine::getFont()->getDimension(text.c_str()).Width + 30;
save_button->m_h = c->m_h;
save_button->setText(text);
save_button->add();
manualAddWidget(save_button);
}
}

View File

@ -0,0 +1,36 @@
// SuperTuxKart - a fun racing game with go-kart
// Copyright (C) 2014 konstin
//
// 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_GRAND_PRIX_CUTSCENE_HPP
#define HEADER_GRAND_PRIX_CUTSCENE_HPP
#include "guiengine/screen.hpp"
#include "guiengine/widgets/button_widget.hpp"
#include "race/race_manager.hpp"
#include <string>
class GrandPrixCutscene: public GUIEngine::CutsceneScreen
{
friend class GUIEngine::ScreenSingleton<GrandPrixCutscene>;
public:
GrandPrixCutscene(const char * filename) : CutsceneScreen(filename) {}
protected:
void saveGPButton();
};
#endif

View File

@ -35,6 +35,7 @@
#include "modes/cutscene_world.hpp"
#include "modes/overworld.hpp"
#include "modes/world.hpp"
#include "race/race_manager.hpp"
#include "states_screens/feature_unlocked.hpp"
#include "states_screens/main_menu_screen.hpp"
#include "states_screens/state_manager.hpp"
@ -83,12 +84,6 @@ DEFINE_SCREEN_SINGLETON( GrandPrixLose );
// -------------------------------------------------------------------------------------
GrandPrixLose::GrandPrixLose() : CutsceneScreen("grand_prix_lose.stkgui")
{
} // GrandPrixLose
// -------------------------------------------------------------------------------------
void GrandPrixLose::onCutsceneEnd()
{
TrackObjectManager* tobjman = World::getWorld()->getTrack()->getTrackObjectManager();

View File

@ -21,6 +21,7 @@
#include "guiengine/screen.hpp"
#include "karts/kart_model.hpp"
#include "states_screens/grand_prix_cutscene.hpp"
#include <vector>
#include <string>
@ -33,11 +34,13 @@ class TrackObject;
* \brief Screen shown at the end of a Grand Prix
* \ingroup states_screens
*/
class GrandPrixLose : public GUIEngine::CutsceneScreen, public GUIEngine::ScreenSingleton<GrandPrixLose>
class GrandPrixLose :
public GrandPrixCutscene,
public GUIEngine::ScreenSingleton<GrandPrixLose>
{
friend class GUIEngine::ScreenSingleton<GrandPrixLose>;
GrandPrixLose();
GrandPrixLose(): GrandPrixCutscene("grand_prix_lose.stkgui") {};
/** Global evolution of time */
float m_global_time;
@ -52,11 +55,10 @@ class GrandPrixLose : public GUIEngine::CutsceneScreen, public GUIEngine::Screen
float m_kart_x, m_kart_y, m_kart_z;
public:
virtual void onCutsceneEnd() OVERRIDE;
virtual bool onEscapePressed() OVERRIDE;
/** \brief implement callback from parent class GUIEngine::Screen */
virtual void loadedFromFile() OVERRIDE;

View File

@ -36,6 +36,7 @@
#include "karts/kart_properties_manager.hpp"
#include "modes/cutscene_world.hpp"
#include "modes/world.hpp"
#include "race/race_manager.hpp"
#include "states_screens/feature_unlocked.hpp"
#include "states_screens/state_manager.hpp"
#include "tracks/track.hpp"

View File

@ -22,6 +22,7 @@
#include "audio/sfx_base.hpp"
#include "guiengine/screen.hpp"
#include "karts/kart_model.hpp"
#include "states_screens/grand_prix_cutscene.hpp"
namespace irr { namespace scene { class ISceneNode; class ICameraSceneNode; class ILightSceneNode; class IMeshSceneNode; } }
namespace GUIEngine { class LabelWidget; }
@ -32,7 +33,9 @@ class TrackObject;
* \brief Screen shown at the end of a Grand Prix
* \ingroup states_screens
*/
class GrandPrixWin : public GUIEngine::CutsceneScreen, public GUIEngine::ScreenSingleton<GrandPrixWin>
class GrandPrixWin :
public GUIEngine::CutsceneScreen,
public GUIEngine::ScreenSingleton<GrandPrixWin>
{
friend class GUIEngine::ScreenSingleton<GrandPrixWin>;
@ -56,7 +59,7 @@ class GrandPrixWin : public GUIEngine::CutsceneScreen, public GUIEngine::ScreenS
GUIEngine::LabelWidget* m_unlocked_label;
int m_phase;
float m_kart_x[3], m_kart_y[3], m_kart_z[3];
//float m_podium_x[3], m_podium_z[3];
float m_kart_rotation[3];