SuperTuxKart
track_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_TRACK_INFO_SCREEN_HPP
21 #define HEADER_TRACK_INFO_SCREEN_HPP
22 
23 #include "guiengine/screen.hpp"
24 
25 namespace irr { namespace gui { class STKModifiedSpriteBank; } }
26 namespace GUIEngine
27 {
28  class CheckBoxWidget;
29  class IconButtonWidget;
30  class LabelWidget;
31  class ListWidget;
32  class SpinnerWidget;
33  class Widget;
34 }
35 class Track;
36 
42  public GUIEngine::ScreenSingleton<TrackInfoScreen>
43 {
44  static const int HIGHSCORE_COUNT = 5;
45 
48 
49  bool m_record_this_race;
50 
51  bool m_is_soccer;
52 
53  bool m_is_lap_trial;
54 
55  bool m_show_ffa_spinner;
56 
57  // When there is no need to tab through / click on images/labels, we can add directly
58  // irrlicht labels (more complicated uses require the use of our widget set)
59 
62 
65 
68 
71 
72  /* The div that contains the blue ai spinner and label */
73  GUIEngine::Widget* m_ai_blue_div;
74 
75  /* The div that contains the target type spinner and label */
76  GUIEngine::Widget* m_target_type_div;
77 
80 
83 
86 
89 
92 
95 
98 
101 
102  irr::gui::STKModifiedSpriteBank* m_icon_bank;
103 
104  int m_icon_unknown_kart;
105 
106  void updateHighScores();
107  void setSoccerWidgets(bool has_AI);
108  void setSoccerTarget(bool time_limit);
109  void soccerSpinnerUpdate(bool blue_spinner);
110 
111 public:
112  TrackInfoScreen();
113  virtual ~TrackInfoScreen();
114 
115  virtual void init() OVERRIDE;
116  virtual void beforeAddingWidget() OVERRIDE;
117  virtual void loadedFromFile() OVERRIDE;
118  virtual void tearDown() OVERRIDE;
119  virtual void unloaded() OVERRIDE;
120  virtual void eventCallback(GUIEngine::Widget *,const std::string &name ,
121  const int player_id) OVERRIDE;
122 
123  void onEnterPressedInternal();
124  void setTrack(Track *track);
125 };
126 
127 #endif
A checkbox widget.
Definition: check_box_widget.hpp:34
A simple label widget.
Definition: label_widget.hpp:41
A vertical list widget with text entries.
Definition: list_widget.hpp:50
Declares a class to be a singleton.
Definition: screen.hpp:59
Represents a single GUI screen.
Definition: screen.hpp:94
A spinner or gauge widget (to select numbers / percentages).
Definition: spinner_widget.hpp:44
The nearly-abstract base of all widgets (not fully abstract since a bare Widget can be created for th...
Definition: widget.hpp:147
Dialog that shows the information about a given track.
Definition: track_info_screen.hpp:43
TrackInfoScreen()
Constructor, which loads the corresponding track_info.stkgui file.
Definition: track_info_screen.cpp:60
virtual void init() OVERRIDE
Initialised the display.
Definition: track_info_screen.cpp:134
GUIEngine::LabelWidget * m_highscore_label
The label of the highscore list.
Definition: track_info_screen.hpp:97
GUIEngine::CheckBoxWidget * m_record_race
Check box for record race.
Definition: track_info_screen.hpp:94
GUIEngine::ListWidget * m_highscore_entries
The actual highscore text values shown.
Definition: track_info_screen.hpp:100
virtual void beforeAddingWidget() OVERRIDE
Optional callback invoked very early, before widgets have been added (contrast with init(),...
Definition: track_info_screen.cpp:111
GUIEngine::CheckBoxWidget * m_option
Check box for reverse mode or random item in arena.
Definition: track_info_screen.hpp:91
virtual void eventCallback(GUIEngine::Widget *, const std::string &name, const int player_id) OVERRIDE
will be called everytime something happens.
Definition: track_info_screen.cpp:633
GUIEngine::LabelWidget * m_ai_blue_label
The label besides the blue AI karts spinner.
Definition: track_info_screen.hpp:70
GUIEngine::LabelWidget * m_target_value_label
The label besides the target value spinner.
Definition: track_info_screen.hpp:82
GUIEngine::SpinnerWidget * m_ai_kart_spinner
Spinner for number of AI karts.
Definition: track_info_screen.hpp:85
virtual void loadedFromFile() OVERRIDE
Callback invoked when loading this menu.
Definition: track_info_screen.cpp:67
GUIEngine::LabelWidget * m_ai_kart_label
The label besides the AI karts spinner.
Definition: track_info_screen.hpp:88
GUIEngine::SpinnerWidget * m_target_type_spinner
Spinner for target types.
Definition: track_info_screen.hpp:61
virtual void unloaded() OVERRIDE
Callback invoked when this screen is being unloaded.
Definition: track_info_screen.cpp:471
virtual void tearDown() OVERRIDE
Callback invoked before leaving this menu.
Definition: track_info_screen.cpp:463
GUIEngine::SpinnerWidget * m_target_value_spinner
Spinner for target value e.g.
Definition: track_info_screen.hpp:79
GUIEngine::SpinnerWidget * m_ai_blue_spinner
Spinner for number of blue AI karts.
Definition: track_info_screen.hpp:67
Track * m_track
A pointer to the track of which the info is shown.
Definition: track_info_screen.hpp:47
GUIEngine::LabelWidget * m_target_type_label
The label besides the target types spinner.
Definition: track_info_screen.hpp:64
Definition: track.hpp:115
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:33