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