2009-06-19 20:28:25 -04:00
|
|
|
// SuperTuxKart - a fun racing game with go-kart
|
2015-03-29 20:31:42 -04:00
|
|
|
// Copyright (C) 2009-2015 Marianne Gagnon
|
2009-06-19 20:28:25 -04:00
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
|
|
|
|
|
2009-05-17 15:07:27 -04:00
|
|
|
#ifndef HEADER_CREDITS_HPP
|
|
|
|
#define HEADER_CREDITS_HPP
|
|
|
|
|
2011-05-22 14:31:25 -04:00
|
|
|
#include <rect.h>
|
|
|
|
namespace irr
|
|
|
|
{
|
|
|
|
namespace video { class IVideoDriver; }
|
|
|
|
}
|
|
|
|
|
|
|
|
using namespace irr;
|
|
|
|
|
2012-09-13 20:03:38 -04:00
|
|
|
#include "audio/music_manager.hpp"
|
2009-10-04 19:59:05 -04:00
|
|
|
#include "guiengine/screen.hpp"
|
2009-06-02 08:37:29 -04:00
|
|
|
#include "utils/ptr_vector.hpp"
|
2009-05-17 15:07:27 -04:00
|
|
|
|
2010-04-23 16:48:56 -04:00
|
|
|
|
|
|
|
class CreditsSection;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Screen where STK credits are shown
|
|
|
|
* \ingroup states_screens
|
|
|
|
*/
|
2013-05-30 15:47:39 -04:00
|
|
|
class CreditsScreen : public GUIEngine::Screen,
|
2011-10-04 18:52:30 -04:00
|
|
|
public GUIEngine::ScreenSingleton<CreditsScreen>
|
2009-05-17 15:07:27 -04:00
|
|
|
{
|
2010-04-23 16:48:56 -04:00
|
|
|
float m_time_element;
|
2013-05-30 15:47:39 -04:00
|
|
|
|
2011-02-03 17:20:53 -05:00
|
|
|
PtrVector<CreditsSection, HOLD> m_sections;
|
2010-04-23 16:48:56 -04:00
|
|
|
CreditsSection* getCurrentSection();
|
2013-05-30 15:47:39 -04:00
|
|
|
|
2011-05-03 20:01:55 -04:00
|
|
|
int m_x, m_y, m_w, m_h;
|
2010-04-23 16:48:56 -04:00
|
|
|
core::rect< s32 > m_section_rect;
|
2013-05-30 15:47:39 -04:00
|
|
|
|
2010-04-23 16:48:56 -04:00
|
|
|
int m_curr_section;
|
|
|
|
int m_curr_element;
|
2013-05-30 15:47:39 -04:00
|
|
|
|
2010-04-23 16:48:56 -04:00
|
|
|
float time_before_next_step;
|
2013-05-30 15:47:39 -04:00
|
|
|
|
2010-04-23 16:48:56 -04:00
|
|
|
friend class GUIEngine::ScreenSingleton<CreditsScreen>;
|
|
|
|
CreditsScreen();
|
2017-01-07 18:56:15 -05:00
|
|
|
bool getLineAsWide(std::ifstream& file, core::stringw* out);
|
2011-10-04 18:52:30 -04:00
|
|
|
|
2012-09-13 20:03:38 -04:00
|
|
|
bool m_is_victory_music;
|
|
|
|
|
2010-04-23 16:48:56 -04:00
|
|
|
public:
|
2013-05-30 15:47:39 -04:00
|
|
|
|
|
|
|
|
2010-04-23 16:48:56 -04:00
|
|
|
void setArea(const int x, const int y, const int w, const int h);
|
2013-05-30 15:47:39 -04:00
|
|
|
|
2010-04-23 16:48:56 -04:00
|
|
|
// start from beginning again
|
|
|
|
void reset();
|
2013-05-30 15:47:39 -04:00
|
|
|
|
2010-05-01 15:16:38 -04:00
|
|
|
/** \brief implement callback from parent class GUIEngine::Screen */
|
2012-05-13 20:04:26 -04:00
|
|
|
virtual void loadedFromFile() OVERRIDE;
|
2013-05-30 15:47:39 -04:00
|
|
|
|
|
|
|
/** \brief implement optional callback from parent class
|
2011-10-04 18:52:30 -04:00
|
|
|
* GUIEngine::Screen */
|
2014-01-21 15:43:17 -05:00
|
|
|
void onUpdate(float dt) OVERRIDE;
|
2013-05-30 15:47:39 -04:00
|
|
|
|
2010-05-01 15:16:38 -04:00
|
|
|
/** \brief implement callback from parent class GUIEngine::Screen */
|
2012-05-13 20:04:26 -04:00
|
|
|
void init() OVERRIDE;
|
2013-05-30 15:47:39 -04:00
|
|
|
|
2010-05-01 15:16:38 -04:00
|
|
|
/** \brief implement callback from parent class GUIEngine::Screen */
|
2013-05-30 15:47:39 -04:00
|
|
|
void eventCallback(GUIEngine::Widget* widget, const std::string& name,
|
2012-05-13 20:04:26 -04:00
|
|
|
const int playerID) OVERRIDE;
|
2013-05-30 15:47:39 -04:00
|
|
|
|
2012-09-13 20:03:38 -04:00
|
|
|
void setVictoryMusic(bool isVictory) { m_is_victory_music = isVictory; }
|
2013-05-30 15:47:39 -04:00
|
|
|
|
2016-02-20 19:21:43 -05:00
|
|
|
virtual MusicInformation* getMusic() const OVERRIDE
|
2012-09-13 20:03:38 -04:00
|
|
|
{
|
|
|
|
if (m_is_victory_music)
|
|
|
|
return music_manager->getMusicInformation("win_theme.music");
|
|
|
|
else
|
|
|
|
return stk_config->m_title_music;
|
|
|
|
}
|
2010-04-23 16:48:56 -04:00
|
|
|
};
|
2009-10-04 19:59:05 -04:00
|
|
|
|
2009-05-17 15:07:27 -04:00
|
|
|
#endif
|