SuperTuxKart
|
Displays the results (while the end animation is shown). More...
#include <race_result_gui.hpp>
Classes | |
class | RowInfo |
Public Member Functions | |
RaceResultGUI () | |
Constructor, initialises internal data structures. | |
virtual void | renderGlobal (float dt) OVERRIDE |
Render all global parts of the race gui, i.e. | |
virtual void | loadedFromFile () OVERRIDE |
Implement callback from parent class GUIEngine::Screen. | |
virtual void | init () OVERRIDE |
Besides calling init in the base class this makes all buttons of this screen invisible. | |
virtual void | tearDown () OVERRIDE |
Callback invoked before leaving this menu. | |
virtual bool | onEscapePressed () OVERRIDE |
If escape is pressed, don't do the default option (close the screen), but advance to the next animation phase. | |
virtual void | unload () OVERRIDE |
Next time this menu needs to be shown, don't use cached values, re-calculate everything. | |
virtual GUIEngine::EventPropagation | filterActions (PlayerAction action, int deviceID, const unsigned int value, Input::InputType type, int playerId) OVERRIDE |
This is called before an event is sent to a widget. | |
void | eventCallback (GUIEngine::Widget *widget, const std::string &name, const int playerID) OVERRIDE |
will be called everytime something happens. | |
const core::dimension2du | getMiniMapSize () const OVERRIDE |
Should not be called anymore. | |
virtual void | renderPlayerView (const Camera *camera, float dt) OVERRIDE |
No kart specific view needs to be rendered in the result gui. | |
virtual void | onUpdate (float dt) OVERRIDE |
Called once a frame. | |
virtual void | onDraw (float dt) OVERRIDE |
Called once a frame, this now triggers the rendering of the actual race result gui. | |
virtual void | addMessage (const irr::core::stringw &m, const AbstractKart *kart, float time, const video::SColor &color=video::SColor(255, 255, 0, 255), bool important=true, bool big_font=false, bool outline=false) OVERRIDE |
No more messages need to be displayed, but the function might still be called (e.g. | |
void | nextPhase () |
This function is called when one of the player presses 'fire'. | |
void | clearHighscores () |
Show no highscore. | |
void | setHighscore (int rank) |
To call if the user got a new highscore. | |
virtual void | onConfirm () OVERRIDE |
Implement to be notified of dialog confirmed. | |
void | cleanupGPProgress () |
Public Member Functions inherited from RaceGUIBase | |
virtual | ~RaceGUIBase () |
The destructor removes the marker texture and the referee scene node. | |
virtual void | renderGlobal (float dt) |
Updates lightning related information. | |
virtual void | init () |
This is a second initialisation call (after the constructor) for the race gui. | |
virtual void | reset () |
This is called when restarting a race. | |
virtual void | renderPlayerView (const Camera *camera, float dt) |
virtual void | addMessage (const irr::core::stringw &m, const AbstractKart *kart, float time, const video::SColor &color=video::SColor(255, 255, 0, 255), bool important=true, bool big_font=false, bool outline=false) |
Adds a message to the message queue. | |
virtual void | update (float dt) |
Update, called once per frame. | |
virtual void | preRenderCallback (const Camera *camera) |
This function is called just before rendering the view for each kart. | |
virtual const core::dimension2du | getMiniMapSize () const =0 |
Returns the size of the texture on which to render the minimap to. | |
virtual void | calculateMinimapSize () |
virtual void | clearAllMessages () |
void | drawGlobalPlayerIcons (int bottom_margin) |
Draw players icons and, depending on the current mode, their time or their score (battle lives, egg collected, etc.). | |
void | drawPlayerIcon (AbstractKart *kart, int x, int y, int w, bool is_local) |
Draw one player icon Takes care of icon looking different due to plumber, squashing, ... | |
virtual void | drawEnergyMeter (int x, int y, const AbstractKart *kart, const core::recti &viewport, const core::vector2df &scaling) |
void | cleanupMessages (const float dt) |
Removes messages which have been displayed long enough. | |
void | removeReferee () |
RaceGUIMultitouch * | getMultitouchGUI () |
void | recreateGUI () |
virtual void | initSize () |
Called when loading the race gui or screen resized. | |
Public Member Functions inherited from GUIEngine::Screen | |
std::function< Screen *()> | getNewScreenPointer () const |
Save the function before GUIEngine::clearScreenCache, call it after to get the new screen instance pointer. | |
void | setScreenPointerFunction (const std::function< Screen *()> &f) |
Screen (bool pause_race=true) | |
Creates a dummy incomplete object; only use to override behaviour in sub-class. | |
Screen (const char *filename, bool pause_race=true) | |
Creates a screen populated by the widgets described in a STK GUI file. | |
bool | operator== (const char *filename) const |
void | loadFromFile () |
loads this Screen from the file passed to the constructor | |
bool | isLoaded () const |
void | addWidgets () |
Adds the IrrLicht widgets corresponding to this screen to the IGUIEnvironment. | |
void | calculateLayout () |
Called after all widgets have been added. | |
void | manualAddWidget (Widget *w) |
Can be used for custom purposes for which the load-screen-from-XML code won't make it. | |
void | manualRemoveWidget (Widget *w) |
Can be used for custom purposes for which the load-screen-from-XML code won't make it. | |
void | setUpdateInBackground (bool value) |
When set to true it updates the screen even if modal dialog is opened. | |
bool | getUpdateInBackground () |
const std::string & | getName () const |
virtual void | unload () |
Next time this menu needs to be shown, don't use cached values, re-calculate everything. | |
bool | needs3D () |
Will be called to determine if the 3D scene must be rendered when at this screen. | |
void | setNeeds3D (bool needs3D) |
Invoke this method for screens that use a 3D scene as background. | |
virtual void | loadedFromFile ()=0 |
Callback invoked when loading this menu. | |
virtual void | unloaded () |
Callback invoked when this screen is being unloaded. | |
virtual void | beforeAddingWidget () |
Optional callback invoked very early, before widgets have been added (contrast with init(), which is invoked afer widgets were added) | |
virtual void | init () |
Callback invoked when entering this menu (after the widgets have been added). | |
void | push () |
Displays this screen bu pushing it onto the stack of screen in the state manager. | |
virtual void | tearDown () |
Callback invoked before leaving this menu. | |
virtual bool | onEscapePressed () |
Called when escape is pressed. | |
virtual void | eventCallback (Widget *widget, const std::string &name, const int playerID)=0 |
will be called everytime something happens. | |
virtual void | onUpdate (float dt) |
optional callback you can override to be notified at every frame. | |
virtual void | onDraw (float dt) |
optional callback you can override to be notified at every frame. | |
virtual MusicInformation * | getMusic () const |
virtual MusicInformation * | getInGameMenuMusic () const |
virtual int | getWidth () |
virtual int | getHeight () |
virtual bool | isResizable () const |
virtual EventPropagation | filterActions (PlayerAction action, int deviceID, const unsigned int value, Input::InputType type, int playerId) |
Override this if you need to be notified of player actions in subclasses. | |
virtual void | onDisabledItemClicked (const std::string &item) |
Callback you can use if you want to know when the user pressed on a disabled ribbon item. | |
virtual void | filterInput (Input::InputType type, int deviceID, int btnID, int axisDir, int value) |
Override this if you need to be notified of raw input in subclasses. | |
virtual void | onDialogClose () |
Callback that gets called when a dialog is closed. | |
virtual void | onFocusChanged (Widget *previous, Widget *focus, int playerID) |
Callback called when focus changes. | |
Public Member Functions inherited from GUIEngine::AbstractTopLevelContainer | |
virtual int | getWidth ()=0 |
virtual int | getHeight ()=0 |
Widget * | getWidget (const char *name) |
This function returns a widget by name if that widget is found. | |
Widget * | getWidget (const int id) |
This function returns a widget by irrlicht ID if that widget is found. | |
template<typename T > | |
T * | getWidget (const char *name) |
This function searches and returns a widget by name, cast as specified type, if that widget is found and the type is correct. | |
Widget * | getFirstWidget (PtrVector< Widget > *within_vector=NULL) |
This function returns the first widget found in within_vector. | |
Widget * | getLastWidget (PtrVector< Widget > *within_vector=NULL) |
This function returns the last widget found in within_vector. | |
void | elementsWereDeleted (PtrVector< Widget > *within_vector=NULL) |
This function is called when screen is removed. | |
bool | isMyChild (Widget *widget) const |
This function checks if a widget is a child of the container. | |
virtual bool | enableScreenPadding () const |
Public Member Functions inherited from MessageDialog::IConfirmDialogListener | |
virtual void | onConfirm () |
Implement to be notified of dialog confirmed. | |
virtual void | onCancel () |
Implement to be notified of dialog cancelled. | |
virtual void | onDialogUpdate (float dt) |
Optional callback. | |
Private Types | |
enum | { RR_INIT , RR_RACE_RESULT , RR_WAITING_GP_RESULT , RR_OLD_GP_RESULTS , RR_INCREASE_POINTS , RR_RESORT_TABLE , RR_WAIT_TILL_END } |
Finite state machine for the animations: INIT: Set up data structures. More... | |
Private Member Functions | |
void | displayOneEntry (unsigned int x, unsigned int y, unsigned int n, bool display_points) |
Displays the race results for a single kart. | |
void | determineTableLayout () |
This determines the layout, i.e. | |
void | determineGPLayout () |
Determine the layout and fields for the GP table based on the previous GP results. | |
void | enableAllButtons () |
Makes the correct buttons visible again, and gives them the right label. | |
void | enableGPProgress () |
void | addGPProgressWidget (GUIEngine::Widget *widget) |
void | displayGPProgress () |
void | displayPostRaceInfo () |
void | displayCTFResults () |
void | displaySoccerResults () |
void | displayScreenShots () |
int | getFontHeight () const |
Private Attributes | |
float | m_timer |
Timer variable for animations. | |
enum RaceResultGUI:: { ... } | m_animation_state |
Finite state machine for the animations: INIT: Set up data structures. | |
std::vector< RowInfo > | m_all_row_infos |
The team icons. | |
std::vector< RowInfo > | m_all_row_info_waiting |
float | m_time_between_rows |
Time to wait till the next row starts to be animated. | |
float | m_time_single_scroll |
The time a single line scrolls into place. | |
float | m_time_rotation |
Time to rotate the GP entries. | |
float | m_time_for_points |
The time for inreasing the points by one during the point update phase. | |
float | m_time_overall_scroll |
The overall time the first phase (scrolling) is displayed. | |
unsigned int | m_distance_between_rows |
Distance between each row of the race results. | |
unsigned int | m_distance_between_meta_rows |
Distance between each row of the highscore, race data, etc. | |
unsigned int | m_width_icon |
The size of the kart icons. | |
unsigned int | m_width_kart_name |
Width of the kart name column. | |
unsigned int | m_width_finish_time |
Width of the finish time column. | |
unsigned int | m_width_new_points |
Width of the new points columns. | |
unsigned int | m_leftmost_column |
Position of left end of table (so that the whole table is aligned. | |
unsigned int | m_top |
Top-most pixel for first row. | |
unsigned int | m_width_column_space |
Size of space between columns. | |
unsigned int | m_table_width |
The overall width of the table. | |
gui::ScalableFont * | m_font |
The font to use. | |
bool | m_gp_position_was_changed |
True if a GP position was changed. | |
bool | m_started_race_over_music |
SFXBase * | m_finish_sound |
The previous monospace state of the font. | |
MusicInformation * | m_race_over_music |
Music to be played after race ended. | |
int | m_highscore_rank |
For highscores. | |
unsigned int | m_width_all_points |
int | m_max_tracks |
int | m_start_track |
int | m_end_track |
int | m_sshot_height |
PtrVector< GUIEngine::Widget, HOLD > | m_gp_progress_widgets |
Static Private Attributes | |
static const int | SSHOT_SEPARATION = 10 |
Friends | |
class | GUIEngine::ScreenSingleton< RaceResultGUI > |
Additional Inherited Members | |
Static Public Member Functions inherited from GUIEngine::Screen | |
static void | parseScreenFileDiv (irr::io::IXMLReader *xml, PtrVector< Widget > &append_to, irr::gui::IGUIElement *parent=NULL) |
Loads a GUI screen from its XML file. | |
Static Public Member Functions inherited from GUIEngine::AbstractTopLevelContainer | |
static Widget * | getWidget (const char *name, PtrVector< Widget > *within_vector) |
This function returns a widget by name if that widget is found in within_vector. | |
static Widget * | getWidget (const int id, PtrVector< Widget > *within_vector) |
This function returns a widget by irrlicht ID if that widget is found. | |
Static Public Member Functions inherited from GUIEngine::ScreenSingleton< RaceResultGUI > | |
static RaceResultGUI * | getInstance () |
Public Attributes inherited from RaceGUIBase | |
bool | m_enabled |
Protected Types inherited from RaceGUIBase | |
enum | PlungerState { PLUNGER_STATE_INIT , PLUNGER_STATE_SLOW_1 , PLUNGER_STATE_SLOW_2 , PLUNGER_STATE_FAST } |
State of the plunger: From the 'init' states the plunger switches between two slow moving states ('shakily moving') till the end of the plunger time is nearly reached, then it goes to a very fast moving state ('plunger blown off'). | |
Protected Member Functions inherited from RaceGUIBase | |
void | createRegularPolygon (unsigned int n, float radius, const core::vector2df ¢er, const video::SColor &color, video::S3DVertex *v, unsigned short int *index) |
Creates the 2D vertices for a regular polygon. | |
void | drawAllMessages (const AbstractKart *kart, const core::recti &viewport, const core::vector2df &scaling) |
Displays all messages in the message queue. | |
void | drawPowerupIcons (const AbstractKart *kart, const core::recti &viewport, const core::vector2df &scaling) |
Draws the powerup icons on the screen (called once for each player). | |
void | drawGlobalMusicDescription () |
Displays the description given for the music currently being played. | |
void | drawGlobalReadySetGo () |
Draws the ready-set-go message on the screen. | |
void | drawGlobalGoal () |
void | drawPlungerInFace (const Camera *camera, float dt) |
Draws the plunger-in-face if necessary. | |
void | ignoreUnimportantMessages () |
Instructs the base gui to ignore unimportant messages (like item messages). | |
Protected Member Functions inherited from GUIEngine::AbstractTopLevelContainer | |
void | addWidgetsRecursively (PtrVector< Widget > &widgets, Widget *parent=NULL) |
This function adds a list of widgets recursively, effectively creating the hierarchy of widgets. | |
Protected Attributes inherited from RaceGUIBase | |
enum RaceGUIBase::PlungerState | m_plunger_state |
float | m_plunger_move_time |
How long the plunger should stay in the current state. | |
core::vector2di | m_plunger_offset |
Offset of the plunger. | |
core::vector2df | m_plunger_speed |
video::ITexture * | m_gauge_empty |
The size of a single marker in pixels, must be a power of 2. | |
video::ITexture * | m_gauge_full |
Default texture for nitro gauge. | |
video::ITexture * | m_gauge_full_bright |
Highlight gauge, used when a kart uses nitro. | |
video::ITexture * | m_gauge_goal |
video::ITexture * | m_icons_frame |
The frame around player karts in the mini map. | |
video::ITexture * | m_icons_kart_list |
The frame around player karts in the kart list. | |
video::ITexture * | m_lap_flag |
Texture for the lap icon. | |
RaceGUIMultitouch * | m_multitouch_gui |
float | m_dist_show_overlap |
Distance on track to begin showing overlap in drawGlobalPlayerIcons. | |
float | m_icons_inertia |
can be zero | |
std::vector< core::vector2d< s32 > > | m_previous_icons_position |
can be zero | |
std::vector< KartIconDisplayInfo > | m_kart_display_infos |
This vector is passed to world to be filled with the current race data information. | |
Protected Attributes inherited from GUIEngine::Screen | |
bool | m_resizable |
True if this screen is resizable. | |
Protected Attributes inherited from GUIEngine::AbstractTopLevelContainer | |
PtrVector< Widget, HOLD > | m_widgets |
the widgets in this screen | |
Widget * | m_first_widget |
AbstractTopLevelContainer is generally able to determine its first widget just fine, but in highly complex screens (e.g. | |
Widget * | m_last_widget |
AbstractTopLevelContainer is generally able to determine its last widget just fine, but in highly complex screens (e.g. | |
Static Protected Attributes inherited from GUIEngine::ScreenSingleton< RaceResultGUI > | |
static RaceResultGUI * | singleton |
Displays the results (while the end animation is shown).
|
private |
Finite state machine for the animations: INIT: Set up data structures.
RACE_RESULT: The rows scroll into place. WAITING_GP_RESULT: Waiting for user pressing continue button OLD_GP_TABLE: Scroll new table into place, sorted by previous GP ranks INCREASE_POINTS: The overall points are added up RESORT_TABLE: Resort the table so that it is now sorted by GP points. WAIT_TILL_END Some delay to wait for end, after a period it wii automatically end.
|
inlinevirtual |
No more messages need to be displayed, but the function might still be called (e.g.
'new lap' message if the end controller is used for more than one lap). So do nothing in this case.
Reimplemented from RaceGUIBase.
|
private |
This determines the layout, i.e.
the size of all columns, font size etc.
|
private |
Displays the race results for a single kart.
n | Index of the kart to be displayed. |
display_points | True if GP points should be displayed, too |
|
private |
Makes the correct buttons visible again, and gives them the right label.
1) If something was unlocked, only a 'next' button is displayed.
|
virtual |
will be called everytime something happens.
Events are generally a widget state change. In this case, a pointer to the said widget is passed along its name, so you get its new state and/or act. There are two special events, passed with a NULL widget, and which bear the names "init" and "tearDown", called respectively when a screen is being made visible and when it's being left, allowing for setup/clean-up.
Implements GUIEngine::Screen.
|
virtual |
This is called before an event is sent to a widget.
Since in this case no widget is active, the event would be lost, so we act on fire events here and trigger the next phase.
Reimplemented from GUIEngine::Screen.
|
inlinevirtual |
|
virtual |
Besides calling init in the base class this makes all buttons of this screen invisible.
The buttons will be displayed only once the animation is over.
Reimplemented from GUIEngine::Screen.
|
inlinevirtual |
Implement callback from parent class GUIEngine::Screen.
Implements GUIEngine::Screen.
void RaceResultGUI::nextPhase | ( | ) |
This function is called when one of the player presses 'fire'.
The next phase of the animation will be displayed. E.g. in a GP: pressing fire while/after showing the latest race result will start the animation for the current GP result in a normal race: when pressing fire while an animation is played, start the menu showing 'rerun, new race, back to main' etc.
|
virtual |
Implement to be notified of dialog confirmed.
Reimplemented from MessageDialog::IConfirmDialogListener.
|
virtual |
Called once a frame, this now triggers the rendering of the actual race result gui.
Reimplemented from GUIEngine::Screen.
|
virtual |
If escape is pressed, don't do the default option (close the screen), but advance to the next animation phase.
Reimplemented from GUIEngine::Screen.
|
virtual |
Called once a frame.
Reimplemented from GUIEngine::Screen.
|
virtual |
Render all global parts of the race gui, i.e.
things that are only displayed once even in splitscreen.
dt | Timestep sized. |
Reimplemented from RaceGUIBase.
|
inlinevirtual |
No kart specific view needs to be rendered in the result gui.
Reimplemented from RaceGUIBase.
void RaceResultGUI::setHighscore | ( | int | rank | ) |
To call if the user got a new highscore.
kart | identity of the kart that made the highscore |
player | identity of the player that made the highscore |
rank | Highscore rank (first highscore, second highscore, etc.). This is not the race rank |
time | Finish time in seconds |
|
virtual |
Callback invoked before leaving this menu.
Prepares removal of this screen.
If necessary this will unpause the race (so this means that if you have several consecutive screens while the race is running the race will be unpaused and paused when switching from one screen to the next.
Reimplemented from GUIEngine::Screen.
|
virtual |
Next time this menu needs to be shown, don't use cached values, re-calculate everything.
(useful e.g. on reschange, when sizes have changed and must be re-calculated)
Reimplemented from GUIEngine::Screen.
enum { ... } RaceResultGUI::m_animation_state |
Finite state machine for the animations: INIT: Set up data structures.
RACE_RESULT: The rows scroll into place. WAITING_GP_RESULT: Waiting for user pressing continue button OLD_GP_TABLE: Scroll new table into place, sorted by previous GP ranks INCREASE_POINTS: The overall points are added up RESORT_TABLE: Resort the table so that it is now sorted by GP points. WAIT_TILL_END Some delay to wait for end, after a period it wii automatically end.
|
private |
The previous monospace state of the font.
Sound effect at end of race.
|
private |
True if a GP position was changed.
If not, the point increase animation can be skipped.
|
private |
The overall time the first phase (scrolling) is displayed.
This includes a small waiting time at the end.