![]() |
XII Release 0.1.0
|
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 | |
using | MapType = xiiMap<xiiString, xiiVariant> |
using | xiiEventStats = xiiEvent<const StatsEventData&, xiiMutex> |
Static Public Member Functions | |
static void | RemoveStat (xiiStringView sStatName) |
Removes the stat with the given name. | |
static void | SetStat (xiiStringView sStatName, const xiiVariant &value) |
Sets the value of the given stat, adds it if it did not exist before. | |
static const xiiVariant & | GetStat (xiiStringView sStatName) |
Returns the value of the given stat. Returns an invalid xiiVariant, 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 (xiiEventStats::Handler handler) |
Adds an event handler that is called every time a stat is changed. | |
static void | RemoveEventHandler (xiiEventStats::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 xiiTelemetry, and the xiiInspector tool will display the information.
|
static |
Removes the stat with the given name.
This will also send a 'remove' message through xiiTelemetry, 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.
sStatName may contain slashes (but not backslashes) to define groups and subgroups, which can be used by tools such as xiiInspector to display the stats in a hierarchical way. This function will also send the name and value of the stat through xiiTelemetry, such that tools like xiiInspector will show the changed value.