SuperTuxKart
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
RaceResultGUI Class Reference

Displays the results (while the end animation is shown). More...

#include <race_result_gui.hpp>

Inheritance diagram for RaceResultGUI:
Inheritance graph
[legend]

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. More...
 
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. More...
 
virtual void tearDown () OVERRIDE
 Callback invoked before leaving this menu. More...
 
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 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. More...
 
void eventCallback (GUIEngine::Widget *widget, const std::string &name, const int playerID) OVERRIDE
 will be called everytime something happens. More...
 
void backToLobby ()
 Sets up the gui to go back to the lobby. More...
 
const core::dimension2du getMiniMapSize () const OVERRIDE
 Should not be called anymore. More...
 
virtual void renderPlayerView (const Camera *camera, float dt) OVERRIDE
 No kart specific view needs to be rendered in the result gui. More...
 
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. More...
 
void nextPhase ()
 This function is called when one of the player presses 'fire'. More...
 
void clearHighscores ()
 Show no highscore.
 
void setHighscore (int rank)
 To call if the user got a new highscore. More...
 
virtual void onConfirm () OVERRIDE
 Implement to be notified of dialog confirmed. More...
 
- Public Member Functions inherited from RaceGUIBase
virtual ~RaceGUIBase ()
 The destructor removes the marker texture and the referee scene node.
 
virtual void reset ()
 This is called when restarting a race. More...
 
virtual void update (float dt)
 Update, called once per frame. More...
 
virtual void preRenderCallback (const Camera *camera)
 This function is called just before rendering the view for each kart. More...
 
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. More...
 
void removeReferee ()
 
RaceGUIMultitouchgetMultitouchGUI ()
 
void recreateMultitouchGUI ()
 
- Public Member Functions inherited from GUIEngine::Screen
 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. More...
 
bool operator== (const char *filename) const
 
void loadFromFile ()
 loads this Screen from the file passed to the constructor
 
bool isLoaded () const
 
bool throttleFPS () const
 
void addWidgets ()
 Adds the IrrLicht widgets corresponding to this screen to the IGUIEnvironment.
 
void calculateLayout ()
 Called after all widgets have been added. More...
 
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. More...
 
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. More...
 
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. More...
 
virtual void unloaded ()
 Callback invoked when this screen is being unloaded. More...
 
virtual void beforeAddingWidget ()
 Optional callback invoked very early, before widgets have been added (contrast with init(), which is invoked afer widgets were added)
 
void push ()
 Displays this screen bu pushing it onto the stack of screen in the state manager. More...
 
virtual MusicInformationgetMusic () const
 
virtual MusicInformationgetInGameMenuMusic () const
 
virtual int getWidth ()
 Implementing method from AbstractTopLevelContainer.
 
virtual int getHeight ()
 Implementing method from AbstractTopLevelContainer.
 
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. More...
 
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. More...
 
virtual void onFocusChanged (Widget *previous, Widget *focus, int playerID)
 Callback called when focus changes.
 
- Public Member Functions inherited from GUIEngine::AbstractTopLevelContainer
WidgetgetWidget (const char *name)
 This function returns a widget by name if that widget is found. More...
 
WidgetgetWidget (const int id)
 This function returns a widget by irrlicht ID if that widget is found. More...
 
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. More...
 
WidgetgetFirstWidget (PtrVector< Widget > *within_vector=NULL)
 This function returns the first widget found in within_vector. More...
 
WidgetgetLastWidget (PtrVector< Widget > *within_vector=NULL)
 This function returns the last widget found in within_vector. More...
 
void elementsWereDeleted (PtrVector< Widget > *within_vector=NULL)
 This function is called when screen is removed. More...
 
bool isMyChild (Widget *widget) const
 This function checks if a widget is a child of the container. More...
 
- Public Member Functions inherited from MessageDialog::IConfirmDialogListener
virtual void onCancel ()
 Implement to be notified of dialog cancelled. More...
 
virtual void onDialogUpdate (float dt)
 Optional callback.
 

Private Types

enum  {
  RR_INIT, RR_RACE_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. More...
 
void determineTableLayout ()
 This determines the layout, i.e. More...
 
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. More...
 
void enableGPProgress ()
 
void addGPProgressWidget (GUIEngine::Widget *widget)
 
void displayGPProgress ()
 
void cleanupGPProgress ()
 
void displayPostRaceInfo ()
 
void displayCTFResults ()
 
void displaySoccerResults ()
 
void displayScreenShots ()
 
int getFontHeight () const
 

Private Attributes

float m_timer
 Timer variable for animations. More...
 
enum RaceResultGUI:: { ... }  m_animation_state
 Finite state machine for the animations: INIT: Set up data structures. More...
 
std::vector< RowInfom_all_row_infos
 The team icons. More...
 
float m_time_between_rows
 Time to wait till the next row starts to be animated. More...
 
float m_time_single_scroll
 The time a single line scrolls into place. More...
 
float m_time_rotation
 Time to rotate the GP entries. More...
 
float m_time_for_points
 The time for inreasing the points by one during the point update phase. More...
 
float m_time_overall_scroll
 The overall time the first phase (scrolling) is displayed. More...
 
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. More...
 
unsigned int m_width_icon
 The size of the kart icons. More...
 
unsigned int m_width_kart_name
 Width of the kart name column. More...
 
unsigned int m_width_finish_time
 Width of the finish time column. More...
 
unsigned int m_width_new_points
 Width of the new points columns. More...
 
unsigned int m_leftmost_column
 Position of left end of table (so that the whole table is aligned. More...
 
unsigned int m_top
 Top-most pixel for first row. More...
 
unsigned int m_width_column_space
 Size of space between columns. More...
 
unsigned int m_table_width
 The overall width of the table. More...
 
gui::ScalableFontm_font
 The font to use. More...
 
bool m_gp_position_was_changed
 True if a GP position was changed. More...
 
SFXBasem_finish_sound
 The previous monospace state of the font. More...
 
MusicInformationm_race_over_music
 Music to be played after race ended. More...
 
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. More...
 
- Static Public Member Functions inherited from GUIEngine::AbstractTopLevelContainer
static WidgetgetWidget (const char *name, PtrVector< Widget > *within_vector)
 This function returns a widget by name if that widget is found in within_vector. More...
 
static WidgetgetWidget (const int id, PtrVector< Widget > *within_vector)
 This function returns a widget by irrlicht ID if that widget is found. More...
 
- Static Public Member Functions inherited from GUIEngine::ScreenSingleton< RaceResultGUI >
static RaceResultGUIgetInstance ()
 
- 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'). More...
 
- Protected Member Functions inherited from RaceGUIBase
void createRegularPolygon (unsigned int n, float radius, const core::vector2df &center, const video::SColor &color, video::S3DVertex *v, unsigned short int *index)
 Creates the 2D vertices for a regular polygon. More...
 
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). More...
 
void drawGlobalMusicDescription ()
 Displays the description given for the music currently being played. More...
 
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. More...
 
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. More...
 
- 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. More...
 
core::vector2di m_plunger_offset
 Offset of the plunger. More...
 
core::vector2df m_plunger_speed
 
video::ITexture * m_gauge_empty
 The size of a single marker in pixels, must be a power of 2. More...
 
video::ITexture * m_gauge_full
 Default texture for nitro gauge. More...
 
video::ITexture * m_gauge_full_bright
 Highlight gauge, used when a kart uses nitro. More...
 
video::ITexture * m_gauge_goal
 
video::ITexture * m_icons_frame
 The frame around player karts in the mini map. More...
 
video::ITexture * m_lap_flag
 Texture for the lap icon.
 
RaceGUIMultitouchm_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 More...
 
std::vector< KartIconDisplayInfom_kart_display_infos
 This vector is passed to world to be filled with the current race data information. More...
 
- Protected Attributes inherited from GUIEngine::Screen
bool m_throttle_FPS
 
- Protected Attributes inherited from GUIEngine::AbstractTopLevelContainer
PtrVector< Widget, HOLD > m_widgets
 the widgets in this screen
 
Widgetm_first_widget
 AbstractTopLevelContainer is generally able to determine its first widget just fine, but in highly complex screens (e.g. More...
 
Widgetm_last_widget
 AbstractTopLevelContainer is generally able to determine its last widget just fine, but in highly complex screens (e.g. More...
 
- Static Protected Attributes inherited from GUIEngine::ScreenSingleton< RaceResultGUI >
static RaceResultGUIsingleton
 

Detailed Description

Displays the results (while the end animation is shown).

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private

Finite state machine for the animations: INIT: Set up data structures.

RACE_RESULT: The rows scroll into place. 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.

Member Function Documentation

◆ addMessage()

virtual void RaceResultGUI::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 
)
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.

◆ backToLobby()

void RaceResultGUI::backToLobby ( )

Sets up the gui to go back to the lobby.

Can only be called in case of a networked game.

◆ determineTableLayout()

void RaceResultGUI::determineTableLayout ( )
private

This determines the layout, i.e.

the size of all columns, font size etc.

◆ displayOneEntry()

void RaceResultGUI::displayOneEntry ( unsigned int  x,
unsigned int  y,
unsigned int  n,
bool  display_points 
)
private

Displays the race results for a single kart.

Parameters
nIndex of the kart to be displayed.
display_pointsTrue if GP points should be displayed, too

◆ enableAllButtons()

void RaceResultGUI::enableAllButtons ( )
private

Makes the correct buttons visible again, and gives them the right label.

1) If something was unlocked, only a 'next' button is displayed.

◆ eventCallback()

void RaceResultGUI::eventCallback ( GUIEngine::Widget widget,
const std::string &  name,
const int  playerID 
)
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.

◆ filterActions()

GUIEngine::EventPropagation RaceResultGUI::filterActions ( PlayerAction  action,
int  deviceID,
const unsigned int  value,
Input::InputType  type,
int  playerId 
)
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.

◆ getMiniMapSize()

const core::dimension2du RaceResultGUI::getMiniMapSize ( ) const
inlinevirtual

Should not be called anymore.

Implements RaceGUIBase.

◆ init()

void RaceResultGUI::init ( )
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.

◆ nextPhase()

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.

◆ onConfirm()

void RaceResultGUI::onConfirm ( )
virtual

Implement to be notified of dialog confirmed.

Note
The dialog is not closed automatically, close it in the callback if this behavior is desired.

Reimplemented from MessageDialog::IConfirmDialogListener.

◆ renderGlobal()

void RaceResultGUI::renderGlobal ( float  dt)
virtual

Render all global parts of the race gui, i.e.

things that are only displayed once even in splitscreen.

Parameters
dtTimestep sized.

Reimplemented from RaceGUIBase.

◆ renderPlayerView()

virtual void RaceResultGUI::renderPlayerView ( const Camera camera,
float  dt 
)
inlinevirtual

No kart specific view needs to be rendered in the result gui.

Reimplemented from RaceGUIBase.

◆ setHighscore()

void RaceResultGUI::setHighscore ( int  rank)

To call if the user got a new highscore.

Parameters
kartidentity of the kart that made the highscore
playeridentity of the player that made the highscore
rankHighscore rank (first highscore, second highscore, etc.). This is not the race rank
timeFinish time in seconds

◆ tearDown()

void RaceResultGUI::tearDown ( )
virtual

Callback invoked before leaving this menu.

Prepares removal of this screen.

Note
The same instance of your object may be entered/left more than once, so make sure that one instance of your object can be used several times if the same screen is visited several times.

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.

Member Data Documentation

◆ m_all_row_infos

std::vector<RowInfo> RaceResultGUI::m_all_row_infos
private

The team icons.

◆ m_animation_state

enum { ... } RaceResultGUI::m_animation_state

Finite state machine for the animations: INIT: Set up data structures.

RACE_RESULT: The rows scroll into place. 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.

◆ m_distance_between_meta_rows

unsigned int RaceResultGUI::m_distance_between_meta_rows
private

Distance between each row of the highscore, race data, etc.

◆ m_finish_sound

SFXBase* RaceResultGUI::m_finish_sound
private

The previous monospace state of the font.

Sound effect at end of race.

◆ m_font

gui::ScalableFont* RaceResultGUI::m_font
private

The font to use.

◆ m_gp_position_was_changed

bool RaceResultGUI::m_gp_position_was_changed
private

True if a GP position was changed.

If not, the point increase animation can be skipped.

◆ m_leftmost_column

unsigned int RaceResultGUI::m_leftmost_column
private

Position of left end of table (so that the whole table is aligned.

◆ m_race_over_music

MusicInformation* RaceResultGUI::m_race_over_music
private

Music to be played after race ended.

◆ m_table_width

unsigned int RaceResultGUI::m_table_width
private

The overall width of the table.

◆ m_time_between_rows

float RaceResultGUI::m_time_between_rows
private

Time to wait till the next row starts to be animated.

◆ m_time_for_points

float RaceResultGUI::m_time_for_points
private

The time for inreasing the points by one during the point update phase.

◆ m_time_overall_scroll

float RaceResultGUI::m_time_overall_scroll
private

The overall time the first phase (scrolling) is displayed.

This includes a small waiting time at the end.

◆ m_time_rotation

float RaceResultGUI::m_time_rotation
private

Time to rotate the GP entries.

◆ m_time_single_scroll

float RaceResultGUI::m_time_single_scroll
private

The time a single line scrolls into place.

◆ m_timer

float RaceResultGUI::m_timer
private

Timer variable for animations.

◆ m_top

unsigned int RaceResultGUI::m_top
private

Top-most pixel for first row.

◆ m_width_column_space

unsigned int RaceResultGUI::m_width_column_space
private

Size of space between columns.

◆ m_width_finish_time

unsigned int RaceResultGUI::m_width_finish_time
private

Width of the finish time column.

◆ m_width_icon

unsigned int RaceResultGUI::m_width_icon
private

The size of the kart icons.

◆ m_width_kart_name

unsigned int RaceResultGUI::m_width_kart_name
private

Width of the kart name column.

◆ m_width_new_points

unsigned int RaceResultGUI::m_width_new_points
private

Width of the new points columns.


The documentation for this class was generated from the following files: