SuperTuxKart
Classes | Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Private Types | Private Attributes | List of all members
RaceGUIBase Class Referenceabstract

An abstract base class for the two race guis (race_gui and race_result gui) More...

#include <race_gui_base.hpp>

Inheritance diagram for RaceGUIBase:
Inheritance graph
[legend]

Classes

struct  KartIconDisplayInfo
 Used to display the list of karts and their times or whatever other info is relevant to the current mode. More...
 
class  TimedMessage
 

Public Member Functions

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. More...
 
virtual void reset ()
 This is called when restarting a race. More...
 
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. 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 const core::dimension2du getMiniMapSize () const =0
 Returns the size of the texture on which to render the minimap to. 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 Attributes

bool m_enabled
 

Protected Types

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

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 Attributes

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...
 

Private Types

typedef std::vector< TimedMessageAllMessageType
 

Private Attributes

bool m_ignore_unimportant_messages
 True if unimportant messags (like item messages) should not be displayed. More...
 
AllMessageType m_messages
 
int m_small_font_max_height
 
int m_max_font_height
 Used to display messages without overlapping.
 
video::ITexture * m_music_icon
 Musical notes icon (for music description and credits)
 
video::ITexture * m_plunger_face
 Texture for the 'plunger in the face' texture. More...
 
core::stringw m_string_ready
 Translated strings 'ready', 'set', 'go'. More...
 
core::stringw m_string_set
 
core::stringw m_string_go
 
core::stringw m_string_goal
 
core::stringw m_string_waiting_for_others
 
core::stringw m_string_waiting_for_the_server
 
std::vector< Vec3m_referee_pos
 The position of the referee for all karts. More...
 
std::vector< Vec3m_referee_rotation
 The actual rotation to use for the referee for each kart. More...
 
float m_referee_height
 The height of the referee. More...
 
Refereem_referee
 The referee scene node. More...
 
bool m_enabled_network_spectator
 

Detailed Description

An abstract base class for the two race guis (race_gui and race_result gui)

Member Enumeration Documentation

◆ PlungerState

enum RaceGUIBase::PlungerState
protected

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').

Member Function Documentation

◆ addMessage()

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

Adds a message to the message queue.

The message is displayed for a certain amount of time (unless time<0, then the message is displayed once).

Reimplemented in RaceResultGUI.

◆ cleanupMessages()

void RaceGUIBase::cleanupMessages ( const float  dt)

Removes messages which have been displayed long enough.

This function must be called after drawAllMessages, otherwise messages which are only displayed once will not be drawn!

◆ createRegularPolygon()

void RaceGUIBase::createRegularPolygon ( unsigned int  n,
float  radius,
const core::vector2df &  center,
const video::SColor &  color,
video::S3DVertex *  v,
unsigned short int *  index 
)
protected

Creates the 2D vertices for a regular polygon.

Adopted from Irrlicht.

Parameters
nNumber of vertices to use.
radiusRadius of the polygon.
centerThe center point of the polygon.
vPointer to the array of vertices.

◆ drawGlobalMusicDescription()

void RaceGUIBase::drawGlobalMusicDescription ( )
protected

Displays the description given for the music currently being played.

This is usually the title and composer.

◆ drawPlungerInFace()

void RaceGUIBase::drawPlungerInFace ( const Camera camera,
float  dt 
)
protected

Draws the plunger-in-face if necessary.

Does nothing if there is no plunger in face atm.

◆ drawPowerupIcons()

void RaceGUIBase::drawPowerupIcons ( const AbstractKart kart,
const core::recti &  viewport,
const core::vector2df &  scaling 
)
protected

Draws the powerup icons on the screen (called once for each player).

Parameters
kartThe kart for which to draw the powerup icons.
viewportThe viewport into which to draw the icons.
scalingThe scaling to use when drawing the icons.

◆ getMiniMapSize()

virtual const core::dimension2du RaceGUIBase::getMiniMapSize ( ) const
pure virtual

Returns the size of the texture on which to render the minimap to.

Implemented in RaceResultGUI, RaceGUI, RaceGUIOverworld, and CutsceneGUI.

◆ init()

void RaceGUIBase::init ( )
virtual

This is a second initialisation call (after the constructor) for the race gui.

This is called after the world has been initialised, e.g. all karts do exist (while the constructor is called before the karts are created). In the base gui this is used to initialise the referee data (which needs the start positions of the karts). Note that this function is (and must be called only once, after its constructor).

Precondition
All karts must be created, since this object defines the positions for the referees based on the karts.

Reimplemented in RaceResultGUI, and RaceGUI.

◆ preRenderCallback()

void RaceGUIBase::preRenderCallback ( const Camera camera)
virtual

This function is called just before rendering the view for each kart.

This is used here to display the referee during the ready-set-go phase.

Parameters
kartThe kart whose view is rendered next.

◆ reset()

void RaceGUIBase::reset ( )
virtual

This is called when restarting a race.

In the race gui base it resets height of the referee, so that it can start flying down again.

Reimplemented in RaceGUI.

◆ update()

void RaceGUIBase::update ( float  dt)
virtual

Update, called once per frame.

This updates the height of the referee (to create a flying down animation).

Parameters
dtTime step size.

Member Data Documentation

◆ m_gauge_empty

video::ITexture* RaceGUIBase::m_gauge_empty
protected

The size of a single marker in pixels, must be a power of 2.

A texture with all mini dots to be displayed in the minimap for all karts.

◆ m_gauge_full

video::ITexture* RaceGUIBase::m_gauge_full
protected

Default texture for nitro gauge.

◆ m_gauge_full_bright

video::ITexture* RaceGUIBase::m_gauge_full_bright
protected

Highlight gauge, used when a kart uses nitro.

◆ m_icons_frame

video::ITexture* RaceGUIBase::m_icons_frame
protected

The frame around player karts in the mini map.

◆ m_ignore_unimportant_messages

bool RaceGUIBase::m_ignore_unimportant_messages
private

True if unimportant messags (like item messages) should not be displayed.

◆ m_kart_display_infos

std::vector<KartIconDisplayInfo> RaceGUIBase::m_kart_display_infos
protected

This vector is passed to world to be filled with the current race data information.

◆ m_plunger_face

video::ITexture* RaceGUIBase::m_plunger_face
private

Texture for the 'plunger in the face' texture.

◆ m_plunger_move_time

float RaceGUIBase::m_plunger_move_time
protected

How long the plunger should stay in the current state.

◆ m_plunger_offset

core::vector2di RaceGUIBase::m_plunger_offset
protected

Offset of the plunger.

◆ m_previous_icons_position

std::vector< core::vector2d<s32> > RaceGUIBase::m_previous_icons_position
protected

can be zero

previous position of icons

◆ m_referee

Referee* RaceGUIBase::m_referee
private

The referee scene node.

◆ m_referee_height

float RaceGUIBase::m_referee_height
private

The height of the referee.

This is used to make the referee fly into view. This is the same Y-offset for all karts, so only a single value needs to be used.

◆ m_referee_pos

std::vector<Vec3> RaceGUIBase::m_referee_pos
private

The position of the referee for all karts.

◆ m_referee_rotation

std::vector<Vec3> RaceGUIBase::m_referee_rotation
private

The actual rotation to use for the referee for each kart.

◆ m_string_ready

core::stringw RaceGUIBase::m_string_ready
private

Translated strings 'ready', 'set', 'go'.


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