SuperTuxKart
gp_info_screen.hpp
1 // SuperTuxKart - a fun racing game with go-kart
2 // Copyright (C) 2009-2015 Marianne Gagnon
3 // (C) 2014-2015 Joerg Henrichs
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 3
8 // of the License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 
19 
20 #ifndef HEADER_GP_INFO_SCREEN_HPP
21 #define HEADER_GP_INFO_SCREEN_HPP
22 
23 #include "guiengine/screen.hpp"
24 #include "race/grand_prix_data.hpp"
25 #include "guiengine/CGUISpriteBank.hpp"
26 
27 #include <vector>
28 
29 class GrandPrixData;
30 
31 namespace GUIEngine
32 {
33  class IconButtonWidget;
34  class SpinnerWidget;
35  class ListWidget;
36 }
37 
43  public GUIEngine::ScreenSingleton<GPInfoScreen>
44 {
45 private:
48 
51 
54 
57 
60 
63 
65  std::string m_group_name;
66 
68  std::vector<std::string> m_group_names;
69 
72 
73  irr::gui::STKModifiedSpriteBank* m_icon_bank;
76 
78  int getMaxNumTracks(std::string group);
79 
81  void updateHighscores();
82 
83 protected: // Necessary for RandomGPInfoScreen
84  float m_curr_time;
85 
88 
93  void addTracks();
94  void addScreenshot();
95  void updateRandomGP();
96  GrandPrixData::GPReverseType getReverse() const;
97 
98 public:
99  GPInfoScreen();
102  virtual ~GPInfoScreen() {}
103 
104  void onEnterPressedInternal();
105  virtual void eventCallback(GUIEngine::Widget *, const std::string &name,
106  const int player_id) OVERRIDE;
107  virtual void loadedFromFile() OVERRIDE;
108  virtual void init() OVERRIDE;
109  virtual void beforeAddingWidget() OVERRIDE;
110 
111  virtual void onUpdate(float dt) OVERRIDE;
112 
113  void setGP(const std::string &gp_ident);
114  virtual void unloaded() OVERRIDE;
115 }; // GPInfoScreen
116 
117 #endif
A spinner or gauge widget (to select numbers / percentages).
Definition: spinner_widget.hpp:40
GUIEngine::SpinnerWidget * m_num_tracks_spinner
Spinner for number of tracks (in case of random GP).
Definition: gp_info_screen.hpp:53
Dialog that shows information about a specific grand prix.
Definition: gp_info_screen.hpp:42
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:31
GUIEngine::SpinnerWidget * m_ai_kart_spinner
Spinner for number of AI karts.
Definition: gp_info_screen.hpp:56
GPReverseType
Used to define the reverse setting when creating a random GP: No reverse, all reverse (if available o...
Definition: grand_prix_data.hpp:88
std::vector< std::string > m_group_names
The untranslated group names, used as internal IDs.
Definition: gp_info_screen.hpp:68
int m_unknown_kart_icon
Icon for unknown kart in highscore list.
Definition: gp_info_screen.hpp:75
GUIEngine::SpinnerWidget * m_time_target_spinner
Spinner for time target in Lap Trial.
Definition: gp_info_screen.hpp:59
std::string m_group_name
The currently selected group name.
Definition: gp_info_screen.hpp:65
GUIEngine::SpinnerWidget * m_reverse_spinner
Spinner for reverse mode.
Definition: gp_info_screen.hpp:50
A vertical list widget with text entries.
Definition: list_widget.hpp:49
Represents a single GUI screen.
Definition: screen.hpp:96
GrandPrixData m_gp
The grand prix data.
Definition: gp_info_screen.hpp:87
virtual ~GPInfoScreen()
Places the focus back on the selected GP, in the case that the dialog was cancelled and we&#39;re returni...
Definition: gp_info_screen.hpp:102
Declares a class to be a singleton.
Definition: screen.hpp:58
GUIEngine::SpinnerWidget * m_group_spinner
Spinner for the different track groups.
Definition: gp_info_screen.hpp:47
int m_max_num_tracks
Number of available tracks.
Definition: gp_info_screen.hpp:71
The nearly-abstract base of all widgets (not fully abstract since a bare Widget can be created for th...
Definition: widget.hpp:142
GUIEngine::ListWidget * m_highscore_list
List with last 5 highscores.
Definition: gp_info_screen.hpp:62
Simple class that hold the data relevant to a &#39;grand_prix&#39;, aka.
Definition: grand_prix_data.hpp:35