C# Class XnaConsole.XnaConsoleComponent

This class creates a graphical text console for running code while executing a game.
Inheritance: Microsoft.Xna.Framework.DrawableGameComponent
Exibir arquivo Open project: WCell/WCell-Terrain Class Usage Examples

Public Methods

Method Description
Chomp ( string str ) : string

Returns a string with one less character at the end

Clear ( ) : void

Clears the output.

ClearHistory ( ) : void

Clears the command history.

Draw ( GameTime gameTime ) : void

Draws the console

DrawCursor ( double now ) : string

Used to draw the cursor

IsOpen ( ) : bool

Is this console open?

Open ( ) : void

Opens the console

Prompt ( string str, InputHandler callback ) : void

Prompts for input asynchronously via callback

Render ( string output ) : List

Renders a list of strings to the console

Update ( GameTime gameTime ) : void

Updates

Write ( string str ) : void

Write to the console

WriteLine ( string str ) : void

Write a line to the console

XnaConsoleComponent ( Microsoft.Xna.Framework.Game game, SpriteFont font ) : System

Initializes a new instance of the class, which creates a console for executing commands while running a game.

Private Methods

Method Description
GetStringFromKeyState ( double elapsedTime ) : string

Takes keyboard input and returns certain characters as a string

IsKeyPressed ( Keys key ) : bool
KeyPressWithRepeat ( Keys key, double elapsedTime ) : bool
WrapLine ( string line, int columns ) : List

This takes a single string and splits it at the newlines and the specified number of columns

WrapLines ( string lines, int columns ) : List

This takes an array of strings and splits each of them every newline and specified number of columns

Method Details

Chomp() public method

Returns a string with one less character at the end
public Chomp ( string str ) : string
str string String to chomp
return string

Clear() public method

Clears the output.
public Clear ( ) : void
return void

ClearHistory() public method

Clears the command history.
public ClearHistory ( ) : void
return void

Draw() public method

Draws the console
public Draw ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime gameTime
return void

DrawCursor() public method

Used to draw the cursor
public DrawCursor ( double now ) : string
now double Current time
return string

IsOpen() public method

Is this console open?
public IsOpen ( ) : bool
return bool

Open() public method

Opens the console
public Open ( ) : void
return void

Prompt() public method

Prompts for input asynchronously via callback
public Prompt ( string str, InputHandler callback ) : void
str string
callback InputHandler
return void

Render() public method

Renders a list of strings to the console
public Render ( string output ) : List
output string String to render
return List

Update() public method

Updates
public Update ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime Not Sure
return void

Write() public method

Write to the console
public Write ( string str ) : void
str string
return void

WriteLine() public method

Write a line to the console
public WriteLine ( string str ) : void
str string
return void

XnaConsoleComponent() public method

Initializes a new instance of the class, which creates a console for executing commands while running a game.
public XnaConsoleComponent ( Microsoft.Xna.Framework.Game game, SpriteFont font ) : System
game Microsoft.Xna.Framework.Game
font Microsoft.Xna.Framework.Graphics.SpriteFont
return System