supertux
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Statistics Class Referencefinal

This class is a layer between level and worldmap to keep track of stuff like scores, and minor, but funny things, like number of jumps and stuff. More...

#include <statistics.hpp>

Public Types

enum  Status { INVALID, ACCUMULATING, FINAL }
 

Public Member Functions

 Statistics ()
 Creates new statistics, call reset() before counting.
 
void serialize_to_squirrel (ssq::Table &table) const
 serialize statistics object as squirrel table "statistics"
 
void unserialize_from_squirrel (const ssq::Table &table)
 unserialize statistics object from squirrel table "statistics"
 
void draw_worldmap_info (DrawingContext &context, float target_time)
 draw worldmap stat HUD
 
void draw_endseq_panel (DrawingContext &context, Statistics *best_stats, const SurfacePtr &backdrop, float target_time)
 draw panel shown during level's end sequence
 
void draw_ingame_stats (DrawingContext &context, bool on_pause_menu)
 draw in-game stats
 
void update_timers (float dt_sec)
 Updates the timers for in-game stats rendering. More...
 
void init (const Level &level)
 
void finish (float time)
 
void invalidate ()
 
void update (const Statistics &stats)
 Given another Statistics object finds the best of each one.
 
bool completed (const Statistics &stats, const float target_time) const
 
int get_coins () const
 
int get_badguys () const
 
int get_secrets () const
 
float get_time () const
 
Status get_status () const
 
void increment_coins ()
 
void increment_badguys ()
 
void increment_secrets ()
 

Static Public Member Functions

static std::string coins_to_string (int coins, int total_coins)
 
static std::string frags_to_string (int badguys, int total_badguys)
 
static std::string time_to_string (float time)
 
static std::string secrets_to_string (int secrets, int total_secrets)
 

Public Attributes

int m_total_coins
 coins in level
 
int m_total_badguys
 (vincible) badguys in level
 
int m_total_secrets
 secret areas in level
 

Detailed Description

This class is a layer between level and worldmap to keep track of stuff like scores, and minor, but funny things, like number of jumps and stuff.

Member Function Documentation

◆ update_timers()

void Statistics::update_timers ( float  dt_sec)

Updates the timers for in-game stats rendering.

Should be used from the same object that calls draw_ingame_stats().


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