![]() |
ezEngine
Milestone 9
|
This class holds a simple map that maps strings (keys) to strings (values), which represent certain stats. More...
#include <Stats.h>
Classes | |
struct | StatsEventData |
The event data that is broadcast whenever a stat is changed. More... | |
Public Types | |
typedef ezMap< ezString, ezVariant > | MapType |
typedef ezEvent< const StatsEventData &, ezMutex > | ezEventStats |
Static Public Member Functions | |
static void | RemoveStat (const char *szStatName) |
Removes the stat with the given name. More... | |
static void | SetStat (const char *szStatName, const ezVariant &value) |
Sets the value of the given stat, adds it if it did not exist before. More... | |
static const ezVariant & | GetStat (const char *szStatName) |
Returns the value of the given stat. Returns an invalid ezVariant, if the stat did not exist before. | |
static const MapType & | GetAllStats () |
Returns the entire map of stats, can be used to display them. | |
static void | AddEventHandler (ezEventStats::Handler handler) |
Adds an event handler that is called every time a stat is changed. | |
static void | RemoveEventHandler (ezEventStats::Handler handler) |
Removes a previously added event handler. | |
This class holds a simple map that maps strings (keys) to strings (values), which represent certain stats.
This can be used by a game to store (and continuously update) information about the internal game state. Other tools can then display this information in a convenient manner. For example the stats can be shown on screen. The data is also transmitted through ezTelemetry, and the ezInspector tool will display the information.
|
static |
Removes the stat with the given name.
This will also send a 'remove' message through ezTelemetry, such that external tools can remove it from their list.
|
static |
Sets the value of the given stat, adds it if it did not exist before.
szStatName may contain slashes (but not backslashes) to define groups and subgroups, which can be used by tools such as ezInspector to display the stats in a hierarchical way. This function will also send the name and value of the stat through ezTelemetry, such that tools like ezInspector will show the changed value.