Class that allows for in-game text output and user input. More...
#include <Application/Console.h>
Classes | |
| class | ConStream |
| An input stream to the console. More... | |
Public Member Functions | |
| Console () | |
| Default constructor. | |
| ~Console () | |
| De-Constructor. | |
| void | IgnoreToggleKey (Key k) |
| Sets the toggle key that sould be ignored duing input buffering. | |
| ConVar * | RegisterVar (const char *name, const char *defaultValue, const char *helpStr, ConVar::Type type) |
| Registers a Console Variable with the Console. | |
| void | RegisterCmd (const char *name, const char *helpStr, fnConCommad cmd, void *userData=NULL) |
| Registers a Console Command with the Console. | |
| ConVar * | FindVar (const char *name) |
| Searches the console for matching command or variable. | |
| void | Open () |
| Opens the console window. | |
| void | Close () |
| Closes the console window. | |
| bool | IsOpened () const |
| Determines if the console windows is open or not. | |
| void | Update (float dt, const IMouse &m, const IKeyboard &kb) |
| Updates the console, should be called once every frame. | |
| void | Draw () |
| Draws the console window. | |
| void | SetFont (FontRef f) |
| Sets the font used to draw the console text. | |
| void | SetHeight (float h) |
| Sets the height of the console window. | |
| void | SetWidth (float w) |
| Sets the width of the console window. | |
| void | ExecuteCommand (const char *cmd) |
| Executes a console command. | |
| uint | GetNumberOfVisibleLines () const |
| Determines the maximum number of lines that can be visible in the console window. | |
| void | ScrollUp () |
| Scrolls the text in the console window up by one line. | |
| void | ScrollDown () |
| Scrolls the text in the console window down by one line. | |
| void | ScrollTop () |
| Scrolls the text in the console window to the top line. | |
| void | ScrollBottom () |
| Scrolls the text in the console window to the bottom line. | |
| void | PageUp () |
| Scrolls the text in the console window up by one page. | |
| void | PageDown () |
| Scrolls the text in the console window down by one page. | |
| void | DumpToFile (const char *name=NULL) |
| Dumps console text and statistics to a file. | |
| void | ClearHistory () |
| Clears the console command history list. | |
| void | Clear () |
| Clears the console output. | |
| void | Search (const std::string &txt, std::vector< ConVar * > &vars) |
| Searches the console variables for matches. | |
| void | Predict (const std::string &txt, std::vector< ConVar * > &vars) |
| Predicts possible console commands given a partial command. | |
| void | PushPrependText (const char *str, const Color4f &c=Color::White) |
| Adds a string of text that will be printed at the start of each newline. | |
| void | PopPrependText () |
| Pops an element from the newline text stack. | |
| ConStream | Print (const Color4f &c=Color::White) |
| Creates a console stream that can be used to print to the console output in a std::iostream like fashion. | |
| ConStream | PrintWarning () |
| Creates a console stream that suitable for displaying a warning. | |
| ConStream | PrintError () |
| Creates a console stream that suitable for displaying an error. | |
| void | Print (const char *str, const Color4f &c=Color::White) |
| Appends a line of text to the console output. | |
| void | PrintLine (const char *str, const Color4f &c=Color::White) |
| Adds a line of text to the console output. | |
| void | NewLine () |
| Creates a newline in the console output. | |
Static Public Member Functions | |
| static ConStream::SetStreamColorClass | SetColor (const Color4f &c) |
| A useful shortcut for changing console stream colors. | |
| static ConStream::RevertStreamColorClass | RevertColor () |
| A useful shortcut for reverting a console streams color. | |
Class that allows for in-game text output and user input.
| void Console::Draw | ( | ) |
Draws the console window.
NOTE: The console window is only drawn if the console window is actually open.
| void Console::DumpToFile | ( | const char * | name = NULL |
) |
Dumps console text and statistics to a file.
| [in] | name | optional name of the file to dump to. Defaults to NULL. |
| void Console::ExecuteCommand | ( | const char * | cmd | ) |
Executes a console command.
| [in] | cmd | the command to execute. |
| ConVar * Console::FindVar | ( | const char * | name | ) |
Searches the console for matching command or variable.
| [in] | name | the name of a console variable or command to find. Not case sensitive. |
| uint Console::GetNumberOfVisibleLines | ( | ) | const |
Determines the maximum number of lines that can be visible in the console window.
| bool Console::IsOpened | ( | ) | const |
Determines if the console windows is open or not.
| void Console::Predict | ( | const std::string & | txt, | |
| std::vector< ConVar * > & | vars | |||
| ) |
Predicts possible console commands given a partial command.
| [in] | txt | the partial command to predict. NOTE: Should be a single non-space delimited string. |
| [out] | vars | vector to hold all potential console variables sorted by command name length from shortest to longest. |
| void Console::Print | ( | const char * | str, | |
| const Color4f & | c = Color::White | |||
| ) |
Appends a line of text to the console output.
| [in] | str | the string to append. |
| [in] | c | the color to draw 'str'. Defaults to white. |
Creates a console stream that can be used to print to the console output in a std::iostream like fashion.
| [in] | c | the color the draw the text. Defaults to white. |
| ConStream Console::PrintError | ( | ) | [inline] |
Creates a console stream that suitable for displaying an error.
| void Console::PrintLine | ( | const char * | str, | |
| const Color4f & | c = Color::White | |||
| ) |
Adds a line of text to the console output.
| [in] | str | the string to add to the console output. |
| [in] | c | the color to draw 'str'. Defaults to white. |
| ConStream Console::PrintWarning | ( | ) | [inline] |
Creates a console stream that suitable for displaying a warning.
| void Console::PushPrependText | ( | const char * | str, | |
| const Color4f & | c = Color::White | |||
| ) |
Adds a string of text that will be printed at the start of each newline.
| [in] | str | the text string. NOTE: newline characters are ignored. |
| [in] | c | the color of the text. Defaults to white. |
| void Console::RegisterCmd | ( | const char * | name, | |
| const char * | helpStr, | |||
| fnConCommad | cmd, | |||
| void * | userData = NULL | |||
| ) |
Registers a Console Command with the Console.
| [in] | name | the name used to refer to the console command. Not case sensitive. |
| [in] | helpStr | a string describing the console variable. |
| [in] | cmd | pointer to the function that will be called when the console command is evoked. |
| [in] | userData | a user defined pointer that will be passed to 'cmd' when it is called. Defaults to NULL. |
| ConVar * Console::RegisterVar | ( | const char * | name, | |
| const char * | defaultValue, | |||
| const char * | helpStr, | |||
| ConVar::Type | type | |||
| ) |
Registers a Console Variable with the Console.
| [in] | name | the name used to refer to the console variable. Not case sensitive. |
| [in] | defaultValue | the initial value of the console variable. Assumed to be formatted correctly for the choosen type. |
| [in] | helpStr | a string describing the console variable. |
| [in] | type | the data type the console variable represents. |
| static ConStream::RevertStreamColorClass Console::RevertColor | ( | ) | [inline, static] |
A useful shortcut for reverting a console streams color.
| void Console::Search | ( | const std::string & | txt, | |
| std::vector< ConVar * > & | vars | |||
| ) |
Searches the console variables for matches.
| [in] | txt | the command to search for. NOTE: Should be a single non-space delimited string. |
| [out] | vars | vector to hold all found console variables sorted by command name length from shortest to longest. |
| static ConStream::SetStreamColorClass Console::SetColor | ( | const Color4f & | c | ) | [inline, static] |
A useful shortcut for changing console stream colors.
| [in] | c | the color. |
| void Console::SetFont | ( | FontRef | f | ) |
Sets the font used to draw the console text.
| [in] | f | the font. |
NOTE: The font is assumed to be a mono space font. Its not required but it works best with the type of word wrapping used.
| void Console::SetHeight | ( | float | h | ) | [inline] |
Sets the height of the console window.
| [in] | h | the height of the console window. |
| void Console::SetWidth | ( | float | w | ) |
Sets the width of the console window.
| [in] | w | the width of the console window. |
Updates the console, should be called once every frame.
| [in] | dt | the time in seconds since the last frame. |
| [in] | m | the mouse to accept input from. |
| [in] | kb | the keyboard to accept input from. |
1.6.3