Console class. The console class provides a feedback window and interface with xygine. Any class can register a command with the console as long as it inherits the ConsoleClient interface.
More...
#include <Console.hpp>
|
using | Command = std::function< void(const std::string &)> |
|
|
const ConfigObject & | getConvars () |
| Returns a reference to the ConfigObject containing any existing convars. The returned reference is const, use addConvar() to write to the ConfigObject.
|
|
template<> |
std::string | getConvarValue (const std::string &name) |
|
template<> |
sf::Int32 | getConvarValue (const std::string &name) |
|
template<> |
float | getConvarValue (const std::string &name) |
|
template<> |
bool | getConvarValue (const std::string &name) |
|
|
static void | print (const std::string &) |
| Prints the given string to the console window.
|
|
static void | show () |
| Toggles the console window visibility.
|
|
static bool | isVisible () |
| Returns true if the console is currently shown.
|
|
static void | doCommand (const std::string &) |
| Executes the given command line. Allows for programatically executing arbitrary commands.
|
|
static void | addConvar (const std::string &name, const std::string &value, const std::string &helpText=std::string()) |
| Adds a convar it if it doesn't exist. More...
|
|
template<typename T > |
static T | getConvarValue (const std::string &convar) |
| Attempts to retrieve the current value of the given console variable.
|
|
static void | printStat (const std::string &, const std::string &) |
| Prints the name/value pair to the stats window.
|
|
|
class | App |
|
class | ConsoleClient |
|
Console class. The console class provides a feedback window and interface with xygine. Any class can register a command with the console as long as it inherits the ConsoleClient interface.
The Console functions are not threadsafe - appropriate care should be taken when using the Console from multiple threads.
◆ Command
Command functions are registered with an associated string, and executed when that string is entered into the consle window. Any further characters entered after the command are passed into the command function as a parameter. If this is a list of parameters it is up to the command function implementation to properly parse the given string. Registering a command with the console may be done by any class which inherits ConsoleClient.
- See also
- ConsoleClient
◆ addConvar()
static void xy::Console::addConvar |
( |
const std::string & |
name, |
|
|
const std::string & |
value, |
|
|
const std::string & |
helpText = std::string() |
|
) |
| |
|
static |
Adds a convar it if it doesn't exist.
- Parameters
-
name | Name of the variable as it appears in the console. |
value | the default value of the variable |
helpText | Optional string describing the variable which appears the console when searching for variable names. |