SuperTuxKart
Loading...
Searching...
No Matches
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
29class GrandPrixData;
30
31namespace GUIEngine
32{
33 class IconButtonWidget;
34 class SpinnerWidget;
35 class ListWidget;
36}
37
43 public GUIEngine::ScreenSingleton<GPInfoScreen>
44{
45private:
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
83protected: // Necessary for RandomGPInfoScreen
84 float m_curr_time;
85
88
93 void addTracks();
94 void addScreenshot();
95 void updateRandomGP();
97
98public:
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
Dialog that shows information about a specific grand prix.
Definition: gp_info_screen.hpp:44
GPInfoScreen()
Constructor, initialised some variables which might be used before loadedFromFile is called.
Definition: gp_info_screen.cpp:59
int getMaxNumTracks(std::string group)
Get number of available tracks for random GPs.
Definition: gp_info_screen.cpp:468
virtual void onUpdate(float dt) OVERRIDE
Called every update.
Definition: gp_info_screen.cpp:444
virtual void init() OVERRIDE
Called before the screen is shown.
Definition: gp_info_screen.cpp:182
virtual void eventCallback(GUIEngine::Widget *, const std::string &name, const int player_id) OVERRIDE
Handle user input.
Definition: gp_info_screen.cpp:350
virtual ~GPInfoScreen()
Places the focus back on the selected GP, in the case that the dialog was cancelled and we're returni...
Definition: gp_info_screen.hpp:102
GrandPrixData m_gp
The grand prix data.
Definition: gp_info_screen.hpp:87
GUIEngine::SpinnerWidget * m_reverse_spinner
Spinner for reverse mode.
Definition: gp_info_screen.hpp:50
std::string m_group_name
The currently selected group name.
Definition: gp_info_screen.hpp:65
GUIEngine::SpinnerWidget * m_time_target_spinner
Spinner for time target in Lap Trial.
Definition: gp_info_screen.hpp:59
virtual void unloaded() OVERRIDE
Callback invoked when this screen is being unloaded.
Definition: gp_info_screen.cpp:562
virtual void loadedFromFile() OVERRIDE
Called when the stkgui file is read.
Definition: gp_info_screen.cpp:71
void updateHighscores()
Load highscores for grandprix.
Definition: gp_info_screen.cpp:505
std::vector< std::string > m_group_names
The untranslated group names, used as internal IDs.
Definition: gp_info_screen.hpp:68
int m_max_num_tracks
Number of available tracks.
Definition: gp_info_screen.hpp:71
GUIEngine::SpinnerWidget * m_ai_kart_spinner
Spinner for number of AI karts.
Definition: gp_info_screen.hpp:56
GrandPrixData::GPReverseType getReverse() const
Converts the currently selected reverse status into a value of type GPReverseType .
Definition: gp_info_screen.cpp:131
virtual void beforeAddingWidget() OVERRIDE
Optional callback invoked very early, before widgets have been added (contrast with init(),...
Definition: gp_info_screen.cpp:145
void setGP(const std::string &gp_ident)
Sets the GP to be displayed.
Definition: gp_info_screen.cpp:112
int m_unknown_kart_icon
Icon for unknown kart in highscore list.
Definition: gp_info_screen.hpp:75
GUIEngine::SpinnerWidget * m_num_tracks_spinner
Spinner for number of tracks (in case of random GP).
Definition: gp_info_screen.hpp:53
GUIEngine::ListWidget * m_highscore_list
List with last 5 highscores.
Definition: gp_info_screen.hpp:62
GUIEngine::SpinnerWidget * m_group_spinner
Spinner for the different track groups.
Definition: gp_info_screen.hpp:47
void addTracks()
display all the tracks according to the current gp For a normal gp info dialog, it just creates a lab...
Definition: gp_info_screen.cpp:314
void addScreenshot()
Creates a screenshot widget in the placeholder of the GUI.
Definition: gp_info_screen.cpp:331
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:97
A spinner or gauge widget (to select numbers / percentages).
Definition: spinner_widget.hpp:41
The nearly-abstract base of all widgets (not fully abstract since a bare Widget can be created for th...
Definition: widget.hpp:143
Simple class that hold the data relevant to a 'grand_prix', aka.
Definition: grand_prix_data.hpp:36
GPReverseType
Used to define the reverse setting when creating a random GP: No reverse, all reverse (if available o...
Definition: grand_prix_data.hpp:89
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:33