SuperTuxKart
credits.hpp
1 // SuperTuxKart - a fun racing game with go-kart
2 // Copyright (C) 2009-2015 Marianne Gagnon
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 3
7 // of the License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 
18 
19 #ifndef HEADER_CREDITS_HPP
20 #define HEADER_CREDITS_HPP
21 
22 #include <rect.h>
23 namespace irr
24 {
25  namespace video { class IVideoDriver; }
26 }
27 
28 using namespace irr;
29 
30 #include "audio/music_manager.hpp"
31 #include "guiengine/screen.hpp"
32 #include "utils/ptr_vector.hpp"
33 
34 
35 class CreditsSection;
36 
42  public GUIEngine::ScreenSingleton<CreditsScreen>
43 {
44  float m_time_element;
45 
47  CreditsSection* getCurrentSection();
48 
49  int m_x, m_y, m_w, m_h;
50  core::rect< s32 > m_section_rect;
51 
52  int m_curr_section;
53  int m_curr_element;
54 
55  float time_before_next_step;
56 
58  CreditsScreen();
59  bool getLineAsWide(std::ifstream& file, core::stringw* out);
60 
61  bool m_is_victory_music;
62 
63 public:
64 
65 
66  void setArea(const int x, const int y, const int w, const int h);
67 
68  // start from beginning again
69  void reset();
70 
72  virtual void loadedFromFile() OVERRIDE;
73 
76  void onDraw(float dt) OVERRIDE;
77 
79  void init() OVERRIDE;
80 
82  void eventCallback(GUIEngine::Widget* widget, const std::string& name,
83  const int playerID) OVERRIDE;
84 
85  void setVictoryMusic(bool isVictory) { m_is_victory_music = isVictory; }
86 
87  virtual MusicInformation* getMusic() const OVERRIDE
88  {
89  if (m_is_victory_music)
90  return music_manager->getMusicInformation("win_theme.music");
91  else
92  return stk_config->m_title_music;
93  }
94 };
95 
96 #endif
Wrapper around an instance of the Music interface Adds information like composer, song title,...
Definition: music_information.hpp:42
Screen where STK credits are shown.
Definition: credits.hpp:41
Represents a single GUI screen.
Definition: screen.hpp:94
Definition: credits.cpp:59
Declares a class to be a singleton.
Definition: screen.hpp:57
virtual MusicInformation * getMusic() const OVERRIDE
Definition: credits.hpp:87
MusicInformation * getMusicInformation(const std::string &filename)
Definition: music_manager.cpp:287
The nearly-abstract base of all widgets (not fully abstract since a bare Widget can be created for th...
Definition: widget.hpp:138
MusicInformation * m_title_music
Filename of the title music to play.
Definition: stk_config.hpp:165