Inherits Mindshifter.IGameConsole.
Inheritance diagram for Mindshifter.GameConsole:
Public Member Functions | |
override void | Update (GameTime gameTime) |
Updates any input to the console. | |
override void | Draw (GameTime gameTime) |
Draws the console to the screen if the console is currently open. | |
void | BindCommandHandler (string command, ConsoleCommandHandler handler, params char[] argumentSeparators) |
Binds a ConsoleCommandHandler to the specified command. | |
ConsoleCommandHandler | UnbindCommandHandler (string command) |
Unbinds the ConsoleCommandHandler for the specified command. | |
void | Open (Keys closeKey) |
Displays the console. | |
void | Log (string message, uint level) |
Logs a message with the specified log level to the console. | |
void | Log (string message) |
Logs a message with log level 0 to the console. | |
void | SetLogLevelCustomColor (uint level, Color color) |
Sets the custom display color of text for the specified log level. | |
Color | GetLogLevelCustomColor (uint level) |
Gets the custom display color of text for the specified log level, or returns the default text color if a custom color is not set for the level. | |
void | UnsetLogLevelCustomColor (uint level) |
Unsets the custom display color of text for the specified log level. | |
Static Public Member Functions | |
static void | Initialize (Game game, string font, Color textColor, Color backgroundColor, float backgroundAlpha, int lineCount) |
Initializes the Console, adding an instance of the Console class to the specified Game's component and service lists. The IInputManager service may then be retrieved using the Game's GetService function. | |
Public Attributes | |
event ConsoleInputHandler | TextEntered |
Event triggered when text is entered into the console. | |
event ConsoleLogHandler | MessageLogged |
Event triggered when a message is logged to the console. | |
Protected Member Functions | |
override void | LoadContent () |
Loads managed resources used by the console. | |
Properties | |
Color | TextColor [get, set] |
Gets or sets the console's text color. | |
Color | BackgroundColor [get, set] |
Gets or sets the console's background color. | |
float | BackgroundAlpha [get, set] |
Gets or sets the console's background alpha translucency. | |
ConsoleDisplayOptions | DisplayOptions [get, set] |
Gets or sets the console's display options. | |
string | TimestampFormat [get, set] |
Gets or sets the timestamp format for message timestamps. The following symblols are replaced with their corresponding values when the timestamp for each message is constructed: {Hr} - Hour (in 24 hour format) {Min} - Minute {Sec} - Second {Ms} - Millisecond. | |
string | Prompt [get, set] |
Gets or sets the prompt used on the input line of the console. | |
int | VisibleLineCount [get, set] |
Gets or sets the number of text lines visible in the console. | |
float | VerticalLineSpacing [get, set] |
Gets or sets the vertical spacing between text lines in the console. | |
float | HorizontalPadding [get, set] |
Gets or sets the amount by which text in the console will be right offset from the leftmost side of the screen. | |
bool | AutoScrollOnOutput [get, set] |
Gets or sets a value indicating whether or not the console should automatically scroll to the last line of the message log whenever a message is output to the console. | |
bool | AlertOnUnrecognizedCommand [get, set] |
Gets or sets a value indicating whether or not the console will output the warning "Unrecognized Command" if the user inputs a command not registered with a command handler. | |
bool | EchoEnabled [get, set] |
Gets or sets a value indicating whether or not the console should automatically echo and input it receives from the user to the console log. | |
uint | EchoLogLevel [get, set] |
Gets or sets the log level of messages echoed automatically if the EchoEnabled property is set to true. | |
uint | DefaultLogLevel [get, set] |
Gets or sets the console's default log level which will be assigned to messages logged to the console with no log level defined. | |
int | LogLevelThreshold [get, set] |
Gets or sets the console's log level threshold. If a message's whose log level is higher than the threshold is logged to the console, it will be ignored. However, if the value is negative then all messages will be logged regardless of their log level. | |
int | DisplayLevelThreshold [get, set] |
Gets or sets the console's display level threshold. The console will only display messages in the log with log levels lower or equal to the display level threshold. However, if the value is negative, then all messages will be displayed regardless of their threshold. | |
bool | CursorEnabled [get, set] |
Gets or sets a value indicating whether or not the input cursor is enabled. If enabled, the user can use the arrow keys to navigate the edit position within the current input string. | |
float | CursorBlinkSpeed [get, set] |
Gets or sets the blink interval of the input cursor, in seconds. The cursor will not blink if this value is set to 0. | |
float | NotifyBlinkSpeed [get, set] |
Gets or sets the blink interval of the notifier that is displayed when the console's current line is not the last line of the log, that is: when the user has used PageUp/Up to scroll upward in the console. The notifier will not blink if this value is set to 0. | |
ReadOnlyCollection< ConsoleMessage > | MessageLog [get] |
Gets the console log of messages. | |
bool | IsOpen [get] |
Gets a value indicating whether or not the console is currently open. | |
Private Member Functions | |
internal | GameConsole (Game game, string font, Color textColor, Color bgColor, float bgAlpha, int lineCount) |
Creates a new instance of Console. | |
List< string > | GetLines (float screenWidth, string text) |
Breaks the specified text into multiple lines if neccessary, based on the specified screen width. | |
Private Attributes | |
Dictionary< string, ConsoleCommandHandlerInfo > | mCommandHandlers |
SpriteBatch | mSpriteBatch |
SpriteFont | mFont |
BasicEffect | mEffect |
VertexDeclaration | mVertexDeclaration |
ConsoleDisplayOptions | mDisplayOptions |
string | mTimestampFormat |
Dictionary< char, Vector2 > | mCharSizeLut |
float | mFontHeight |
float | mHorizontalPadding |
int | mVisibleLineCount |
float | mVerticalSpacing |
int | mCurrentLine |
bool | mAutoScrollOnOutput |
bool | mAlertOnUnrecognizedCommand |
string | mFontName |
Color | mDefaultTextColor |
Dictionary< uint, Color > | mTextColors |
Color | mBackgroundColor |
float | mBackgroundAlpha |
bool | mEchoEnabled |
uint | mEchoLogLevel |
uint | mDefaultLogLevel |
int | mLogLevelThreshold |
int | mDisplayLevelThreshold |
int | mInputPosition |
bool | mCursorEnabled |
float | mCursorBlinkSpeed |
float | mCursorTimer |
bool | mDrawCursor |
float | mNotifyBlinkSpeed |
float | mNotifyTimer |
bool | mDrawNotify |
List< ConsoleMessage > | mLog |
StringBuilder | mCurrentText |
string | mInputPrompt |
GameTime | mCurrentTime |
KeyboardState | mLastKeyboardState |
Keys | mCloseKey |
Classes | |
class | ConsoleCommandHandlerInfo |
Describes a ConsoleCommandHandler entry and the argument separators it requires. More... |
internal Mindshifter.GameConsole.GameConsole | ( | Game | game, | |
string | font, | |||
Color | textColor, | |||
Color | bgColor, | |||
float | bgAlpha, | |||
int | lineCount | |||
) | [private] |
Creates a new instance of Console.
game | The XNA Game with which to register the Console component and IConsole service | |
font | The path to the SpriteFont used to draw text to the console | |
textColor | The color of the console text | |
bgColor | The color of the console background | |
bgAlpha | The alpha translucency of the console background | |
lineCount | The maximum number of text lines visible in the console at any given time |
static void Mindshifter.GameConsole.Initialize | ( | Game | game, | |
string | font, | |||
Color | textColor, | |||
Color | backgroundColor, | |||
float | backgroundAlpha, | |||
int | lineCount | |||
) | [static] |
Initializes the Console, adding an instance of the Console class to the specified Game's component and service lists. The IInputManager service may then be retrieved using the Game's GetService function.
game | The XNA Game with which to register the Console component and IConsole service | |
font | The path to the SpriteFont used to draw text to the console | |
textColor | The color of the console text | |
backgroundColor | The color of the console background | |
backgroundAlpha | The alpha translucency of the console background | |
lineCount | The maximum number of text lines visible in the console at any given time |
override void Mindshifter.GameConsole.LoadContent | ( | ) | [protected] |
Loads managed resources used by the console.
override void Mindshifter.GameConsole.Update | ( | GameTime | gameTime | ) |
Updates any input to the console.
gameTime | The current game time |
List<string> Mindshifter.GameConsole.GetLines | ( | float | screenWidth, | |
string | text | |||
) | [private] |
Breaks the specified text into multiple lines if neccessary, based on the specified screen width.
screenWidth | The width of the current viewport | |
text | The text to process |
override void Mindshifter.GameConsole.Draw | ( | GameTime | gameTime | ) |
Draws the console to the screen if the console is currently open.
gameTime | The current game time |
void Mindshifter.GameConsole.BindCommandHandler | ( | string | command, | |
ConsoleCommandHandler | handler, | |||
params char[] | argumentSeparators | |||
) |
Binds a ConsoleCommandHandler to the specified command.
command | The command to which the command handler will be bound | |
handler | The command handler to bind to the specified command | |
argumentSeparators | The characters with which the command argument string will be split into separate arguments |
Implements Mindshifter.IGameConsole.
ConsoleCommandHandler Mindshifter.GameConsole.UnbindCommandHandler | ( | string | command | ) |
Unbinds the ConsoleCommandHandler for the specified command.
command | The command for which to unbind the current command handler |
Implements Mindshifter.IGameConsole.
void Mindshifter.GameConsole.Open | ( | Keys | closeKey | ) |
Displays the console.
closeKey | The key that should deactivate the console when pressed |
Implements Mindshifter.IGameConsole.
void Mindshifter.GameConsole.Log | ( | string | message, | |
uint | level | |||
) |
Logs a message with the specified log level to the console.
message | The message to output to the console | |
level | The log level of the message |
Implements Mindshifter.IGameConsole.
void Mindshifter.GameConsole.Log | ( | string | message | ) |
Logs a message with log level 0 to the console.
message | The message to output to the console |
Implements Mindshifter.IGameConsole.
void Mindshifter.GameConsole.SetLogLevelCustomColor | ( | uint | level, | |
Color | color | |||
) |
Sets the custom display color of text for the specified log level.
level | The log level for which to set the custom text display color | |
color | The custom color with which to display text for the specified log level |
Implements Mindshifter.IGameConsole.
Color Mindshifter.GameConsole.GetLogLevelCustomColor | ( | uint | level | ) |
Gets the custom display color of text for the specified log level, or returns the default text color if a custom color is not set for the level.
level | The log level for which to get the custom display color |
Implements Mindshifter.IGameConsole.
void Mindshifter.GameConsole.UnsetLogLevelCustomColor | ( | uint | level | ) |
Unsets the custom display color of text for the specified log level.
level | The log level for which to unset the custom text color |
Implements Mindshifter.IGameConsole.
event ConsoleInputHandler Mindshifter.GameConsole.TextEntered |
event ConsoleLogHandler Mindshifter.GameConsole.MessageLogged |
Dictionary<string, ConsoleCommandHandlerInfo> Mindshifter.GameConsole.mCommandHandlers [private] |
SpriteBatch Mindshifter.GameConsole.mSpriteBatch [private] |
SpriteFont Mindshifter.GameConsole.mFont [private] |
BasicEffect Mindshifter.GameConsole.mEffect [private] |
VertexDeclaration Mindshifter.GameConsole.mVertexDeclaration [private] |
string Mindshifter.GameConsole.mTimestampFormat [private] |
Dictionary<char, Vector2> Mindshifter.GameConsole.mCharSizeLut [private] |
float Mindshifter.GameConsole.mFontHeight [private] |
float Mindshifter.GameConsole.mHorizontalPadding [private] |
int Mindshifter.GameConsole.mVisibleLineCount [private] |
float Mindshifter.GameConsole.mVerticalSpacing [private] |
int Mindshifter.GameConsole.mCurrentLine [private] |
bool Mindshifter.GameConsole.mAutoScrollOnOutput [private] |
bool Mindshifter.GameConsole.mAlertOnUnrecognizedCommand [private] |
string Mindshifter.GameConsole.mFontName [private] |
Color Mindshifter.GameConsole.mDefaultTextColor [private] |
Dictionary<uint, Color> Mindshifter.GameConsole.mTextColors [private] |
Color Mindshifter.GameConsole.mBackgroundColor [private] |
float Mindshifter.GameConsole.mBackgroundAlpha [private] |
bool Mindshifter.GameConsole.mEchoEnabled [private] |
uint Mindshifter.GameConsole.mEchoLogLevel [private] |
uint Mindshifter.GameConsole.mDefaultLogLevel [private] |
int Mindshifter.GameConsole.mLogLevelThreshold [private] |
int Mindshifter.GameConsole.mDisplayLevelThreshold [private] |
int Mindshifter.GameConsole.mInputPosition [private] |
bool Mindshifter.GameConsole.mCursorEnabled [private] |
float Mindshifter.GameConsole.mCursorBlinkSpeed [private] |
float Mindshifter.GameConsole.mCursorTimer [private] |
bool Mindshifter.GameConsole.mDrawCursor [private] |
float Mindshifter.GameConsole.mNotifyBlinkSpeed [private] |
float Mindshifter.GameConsole.mNotifyTimer [private] |
bool Mindshifter.GameConsole.mDrawNotify [private] |
List<ConsoleMessage> Mindshifter.GameConsole.mLog [private] |
StringBuilder Mindshifter.GameConsole.mCurrentText [private] |
string Mindshifter.GameConsole.mInputPrompt [private] |
GameTime Mindshifter.GameConsole.mCurrentTime [private] |
KeyboardState Mindshifter.GameConsole.mLastKeyboardState [private] |
Keys Mindshifter.GameConsole.mCloseKey [private] |
Color Mindshifter.GameConsole.TextColor [get, set] |
Color Mindshifter.GameConsole.BackgroundColor [get, set] |
float Mindshifter.GameConsole.BackgroundAlpha [get, set] |
ConsoleDisplayOptions Mindshifter.GameConsole.DisplayOptions [get, set] |
string Mindshifter.GameConsole.TimestampFormat [get, set] |
Gets or sets the timestamp format for message timestamps. The following symblols are replaced with their corresponding values when the timestamp for each message is constructed: {Hr} - Hour (in 24 hour format) {Min} - Minute {Sec} - Second {Ms} - Millisecond.
Sample timestamp strings: "{Hr}:{Min}:{Sec}" "[{Hr}:{Min}:{Sec}:{Ms}]"
Implements Mindshifter.IGameConsole.
string Mindshifter.GameConsole.Prompt [get, set] |
int Mindshifter.GameConsole.VisibleLineCount [get, set] |
float Mindshifter.GameConsole.VerticalLineSpacing [get, set] |
Gets or sets the vertical spacing between text lines in the console.
Implements Mindshifter.IGameConsole.
float Mindshifter.GameConsole.HorizontalPadding [get, set] |
Gets or sets the amount by which text in the console will be right offset from the leftmost side of the screen.
Implements Mindshifter.IGameConsole.
bool Mindshifter.GameConsole.AutoScrollOnOutput [get, set] |
Gets or sets a value indicating whether or not the console should automatically scroll to the last line of the message log whenever a message is output to the console.
Implements Mindshifter.IGameConsole.
bool Mindshifter.GameConsole.AlertOnUnrecognizedCommand [get, set] |
Gets or sets a value indicating whether or not the console will output the warning "Unrecognized Command" if the user inputs a command not registered with a command handler.
Implements Mindshifter.IGameConsole.
bool Mindshifter.GameConsole.EchoEnabled [get, set] |
Gets or sets a value indicating whether or not the console should automatically echo and input it receives from the user to the console log.
Implements Mindshifter.IGameConsole.
uint Mindshifter.GameConsole.EchoLogLevel [get, set] |
Gets or sets the log level of messages echoed automatically if the EchoEnabled property is set to true.
Implements Mindshifter.IGameConsole.
uint Mindshifter.GameConsole.DefaultLogLevel [get, set] |
Gets or sets the console's default log level which will be assigned to messages logged to the console with no log level defined.
Implements Mindshifter.IGameConsole.
int Mindshifter.GameConsole.LogLevelThreshold [get, set] |
Gets or sets the console's log level threshold. If a message's whose log level is higher than the threshold is logged to the console, it will be ignored. However, if the value is negative then all messages will be logged regardless of their log level.
Implements Mindshifter.IGameConsole.
int Mindshifter.GameConsole.DisplayLevelThreshold [get, set] |
Gets or sets the console's display level threshold. The console will only display messages in the log with log levels lower or equal to the display level threshold. However, if the value is negative, then all messages will be displayed regardless of their threshold.
Implements Mindshifter.IGameConsole.
bool Mindshifter.GameConsole.CursorEnabled [get, set] |
Gets or sets a value indicating whether or not the input cursor is enabled. If enabled, the user can use the arrow keys to navigate the edit position within the current input string.
Implements Mindshifter.IGameConsole.
float Mindshifter.GameConsole.CursorBlinkSpeed [get, set] |
Gets or sets the blink interval of the input cursor, in seconds. The cursor will not blink if this value is set to 0.
Implements Mindshifter.IGameConsole.
float Mindshifter.GameConsole.NotifyBlinkSpeed [get, set] |
Gets or sets the blink interval of the notifier that is displayed when the console's current line is not the last line of the log, that is: when the user has used PageUp/Up to scroll upward in the console. The notifier will not blink if this value is set to 0.
Implements Mindshifter.IGameConsole.
ReadOnlyCollection<ConsoleMessage> Mindshifter.GameConsole.MessageLog [get] |
bool Mindshifter.GameConsole.IsOpen [get] |
Gets a value indicating whether or not the console is currently open.
Implements Mindshifter.IGameConsole.