Console Class Reference

Class that allows for in-game text output and user input. More...

#include <Application/Console.h>

List of all members.

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.
ConVarRegisterVar (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.
ConVarFindVar (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.

Detailed Description

Class that allows for in-game text output and user input.


Member Function Documentation

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.

Parameters:
[in] name optional name of the file to dump to. Defaults to NULL.
void Console::ExecuteCommand ( const char *  cmd  ) 

Executes a console command.

Parameters:
[in] cmd the command to execute.
ConVar * Console::FindVar ( const char *  name  ) 

Searches the console for matching command or variable.

Parameters:
[in] name the name of a console variable or command to find. Not case sensitive.
Returns:
A pointer to the console variable or NULL if no variable or command is found.
uint Console::GetNumberOfVisibleLines (  )  const

Determines the maximum number of lines that can be visible in the console window.

Returns:
The number of lines.
bool Console::IsOpened (  )  const

Determines if the console windows is open or not.

Returns:
True if the console window is open, false otherwise.
void Console::Predict ( const std::string &  txt,
std::vector< ConVar * > &  vars 
)

Predicts possible console commands given a partial command.

Parameters:
[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.

Parameters:
[in] str the string to append.
[in] c the color to draw 'str'. Defaults to white.
ConStream Console::Print ( const Color4f c = Color::White  )  [inline]

Creates a console stream that can be used to print to the console output in a std::iostream like fashion.

Parameters:
[in] c the color the draw the text. Defaults to white.
Returns:
A Console stream that can be used to further print to the console.
ConStream Console::PrintError (  )  [inline]

Creates a console stream that suitable for displaying an error.

Returns:
A Console stream that can be used to further print to the console.
void Console::PrintLine ( const char *  str,
const Color4f c = Color::White 
)

Adds a line of text to the console output.

Parameters:
[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.

Returns:
A Console stream that can be used to further print to the console.
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.

Parameters:
[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.

Parameters:
[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.

Parameters:
[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.
Returns:
A pointer to the newly registered Console variable. DO NOT deallocate the returned pointer.
static ConStream::RevertStreamColorClass Console::RevertColor (  )  [inline, static]

A useful shortcut for reverting a console streams color.

Returns:
A Console stream object that changes reverts a console streams color.
void Console::Search ( const std::string &  txt,
std::vector< ConVar * > &  vars 
)

Searches the console variables for matches.

Parameters:
[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.

Parameters:
[in] c the color.
Returns:
A Console stream object that changes the color of the console stream.
void Console::SetFont ( FontRef  f  ) 

Sets the font used to draw the console text.

Parameters:
[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.

Parameters:
[in] h the height of the console window.
void Console::SetWidth ( float  w  ) 

Sets the width of the console window.

Parameters:
[in] w the width of the console window.
void Console::Update ( float  dt,
const IMouse m,
const IKeyboard kb 
)

Updates the console, should be called once every frame.

Parameters:
[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.

The documentation for this class was generated from the following files:
Generated on Mon Apr 5 19:08:05 2010 for BrickOut |ReDuX| by  doxygen 1.6.3