C# Class SadConsole.Consoles.SurfaceEditor

Afficher le fichier Open project: Thraka/SadConsole Class Usage Examples

Méthodes publiques

Свойство Type Description
TimesShiftedDown int
TimesShiftedLeft int
TimesShiftedRight int
TimesShiftedUp int
UsePrintProcessor bool

Protected Properties

Свойство Type Description
textSurface ITextSurface

Private Properties

Свойство Type Description
PrintNoCheck void

Méthodes publiques

Méthode Description
Clear ( ) : void

Clears the console data. Characters are reset to 0, the forground and background are set to default, and effect set to none.

Clear ( int x, int y ) : void

Clears a cell. Character is reset to 0, the forground and background is set to default, and effect is set to none.

ClearShiftValues ( ) : void
Fill ( Microsoft.Xna.Framework.Color foreground, Microsoft.Xna.Framework.Color background, int glyph, Microsoft.Xna.Framework.Graphics.SpriteEffects spriteEffect = null ) : Cell[]

Fills the console.

Fill ( Microsoft.Xna.Framework.Rectangle area, Microsoft.Xna.Framework.Color foreground, Microsoft.Xna.Framework.Color background, int glyph, Microsoft.Xna.Framework.Graphics.SpriteEffects spriteEffect = null ) : Cell[]

Fills the specified area.

FillWithRandomGarbage ( bool useEffect = false ) : void

Fills a console with random colors and glyphs.

GetBackground ( int x, int y ) : Microsoft.Xna.Framework.Color

Gets the background of a specified cell.

GetCellAppearance ( int x, int y ) : ICellAppearance

Gets the appearance of a cell.

GetEffect ( int x, int y ) : Effects.ICellEffect

Gets the effect of the specified cell.

GetForeground ( int x, int y ) : Microsoft.Xna.Framework.Color

Gets the foreground of a specified cell.

GetGlyph ( int x, int y ) : int

Gets the glyph of a specified cell.

GetSpriteEffect ( int x, int y ) : Microsoft.Xna.Framework.Graphics.SpriteEffects

Gets the sprite effect of a specified cell.

GetString ( int index, int length ) : string

Builds a string from the text surface.

GetString ( int x, int y, int length ) : string

Builds a string from the text surface from the specified coordinates.

GetStringColored ( int index, int length ) : ColoredString

Builds a string from the text surface.

GetStringColored ( int x, int y, int length ) : ColoredString

Builds a string from the text surface from the specified coordinates.

IsValidCell ( int index ) : bool

Tests if a cell is valid based on its index.

IsValidCell ( int x, int y ) : bool

Tests if a cell is valid based on its x,y position.

IsValidCell ( int x, int y, int &index ) : bool

Tests if a cell is valid based on its x,y position.

Print ( int x, int y, ColoredString text ) : void

Draws the string on the console at the specified location, wrapping if needed.

Print ( int x, int y, string text ) : void

Draws the string on the console at the specified location, wrapping if needed.

Print ( int x, int y, string text, ICellAppearance appearance, ICellEffect effect = null ) : void

Draws the string on the console at the specified location, wrapping if needed.

Print ( int x, int y, string text, Microsoft.Xna.Framework.Color foreground ) : void

Draws the string on the console at the specified location and color, wrapping if needed.

Print ( int x, int y, string text, Microsoft.Xna.Framework.Color foreground, Microsoft.Xna.Framework.Color background ) : void

Draws the string on the console at the specified location with the specified foreground and background color, wrapping if needed.

Print ( int x, int y, string text, Microsoft.Xna.Framework.Color foreground = null, Microsoft.Xna.Framework.Color background = null, Microsoft.Xna.Framework.Graphics.SpriteEffects spriteEffect = null ) : void

Draws the string on the console at the specified location with the specified settings.

SetBackground ( int x, int y, Microsoft.Xna.Framework.Color color ) : void

Changes the background of a cell to the specified color.

SetCellAppearance ( int x, int y, ICellAppearance appearance ) : void

Changes the appearance of the cell. The appearance represents the look of a cell and will first be cloned, then applied to the cell.

SetEffect ( IEnumerable cells, Effects effect ) : void

Changes the effect of a list of cells to the specified effect.

SetEffect ( int index, ICellEffect effect ) : void

Changes the effect of a cell to the specified effect.

SetEffect ( int x, int y, Effects effect ) : void

Changes the effect of a cell to the specified effect.

SetForeground ( int x, int y, Microsoft.Xna.Framework.Color color ) : void

Changes the foreground of a specified cell to a new color.

SetGlyph ( int x, int y, int glyph ) : void

Changes the glyph of a specified cell to a new value.

SetGlyph ( int x, int y, int glyph, Microsoft.Xna.Framework.Color foreground ) : void

Changes the glyph, foreground, and background of a cell.

SetGlyph ( int x, int y, int glyph, Microsoft.Xna.Framework.Color foreground, Microsoft.Xna.Framework.Color background ) : void

Changes the glyph, foreground, and background of a cell.

SetGlyph ( int x, int y, int glyph, Microsoft.Xna.Framework.Color foreground, Microsoft.Xna.Framework.Color background, ICellEffect effect ) : void

Changes the glyph, foreground, background, and effect of a cell.

SetPixels ( Microsoft.Xna.Framework.Color pixels ) : void

Sets each background of a cell to the array of colors. Must be the same length as this cell surface.

SetSpriteEffect ( int x, int y, Microsoft.Xna.Framework.Graphics.SpriteEffects spriteEffect ) : void

Sets the sprite effect of a specified cell.

ShiftDown ( ) : void

Scrolls all the console data down by one.

ShiftDown ( int amount, bool wrap = false ) : void

Scrolls all the console data down by the specified amount of rows.

ShiftLeft ( ) : void

Scrolls all the console data left by one.

ShiftLeft ( int amount, bool wrap = false ) : void

Scrolls all the console data left by the specified amount.

ShiftRight ( ) : void

Scrolls all the console data right by one.

ShiftRight ( int amount, bool wrap = false ) : void

Scrolls all the console data right by the specified amount.

ShiftUp ( ) : void

Scrolls all the console data up by one.

ShiftUp ( int amount, bool wrap = false ) : void

Scrolls all the console data up by the specified amount of rows.

SurfaceEditor ( ITextSurface surface ) : System

Creates a new cell surface that can be resized and also have its textSurface.Cells resized.

You must set the Font property before rendering this cell surface.

this ( int index ) : Cell

Gets a cell by index.

this ( int x, int y ) : Cell

Gets a cell based on it's coordinates on the surface.

Méthodes protégées

Méthode Description
OnSurfaceChanged ( ITextSurface oldSurface, ITextSurface newSurface ) : void

Called when the TextSurface property is changed. Sets Effects to a new instance of EffectsManager.

Private Methods

Méthode Description
PrintNoCheck ( int index, ColoredString text ) : void

Method Details

Clear() public méthode

Clears the console data. Characters are reset to 0, the forground and background are set to default, and effect set to none.
public Clear ( ) : void
Résultat void

Clear() public méthode

Clears a cell. Character is reset to 0, the forground and background is set to default, and effect is set to none.
public Clear ( int x, int y ) : void
x int The x location of the cell.
y int The y location of the cell.
Résultat void

ClearShiftValues() public méthode

public ClearShiftValues ( ) : void
Résultat void

Fill() public méthode

Fills the console.
public Fill ( Microsoft.Xna.Framework.Color foreground, Microsoft.Xna.Framework.Color background, int glyph, Microsoft.Xna.Framework.Graphics.SpriteEffects spriteEffect = null ) : Cell[]
foreground Microsoft.Xna.Framework.Color Foregorund of every cell. If null, skips.
background Microsoft.Xna.Framework.Color Foregorund of every cell. If null, skips.
glyph int Glyph of every cell. If null, skips.
spriteEffect Microsoft.Xna.Framework.Graphics.SpriteEffects Sprite effect of every cell. If null, skips.
Résultat Cell[]

Fill() public méthode

Fills the specified area.
public Fill ( Microsoft.Xna.Framework.Rectangle area, Microsoft.Xna.Framework.Color foreground, Microsoft.Xna.Framework.Color background, int glyph, Microsoft.Xna.Framework.Graphics.SpriteEffects spriteEffect = null ) : Cell[]
area Microsoft.Xna.Framework.Rectangle The area to fill.
foreground Microsoft.Xna.Framework.Color Foregorund of every cell. If null, skips.
background Microsoft.Xna.Framework.Color Foregorund of every cell. If null, skips.
glyph int Glyph of every cell. If null, skips.
spriteEffect Microsoft.Xna.Framework.Graphics.SpriteEffects Sprite effect of every cell. If null, skips.
Résultat Cell[]

FillWithRandomGarbage() public méthode

Fills a console with random colors and glyphs.
public FillWithRandomGarbage ( bool useEffect = false ) : void
useEffect bool
Résultat void

GetBackground() public méthode

Gets the background of a specified cell.
public GetBackground ( int x, int y ) : Microsoft.Xna.Framework.Color
x int The x location of the cell.
y int The y location of the cell.
Résultat Microsoft.Xna.Framework.Color

GetCellAppearance() public méthode

Gets the appearance of a cell.
public GetCellAppearance ( int x, int y ) : ICellAppearance
x int The x location of the cell.
y int The y location of the cell.
Résultat ICellAppearance

GetEffect() public méthode

Gets the effect of the specified cell.
public GetEffect ( int x, int y ) : Effects.ICellEffect
x int The x location of the cell.
y int The y location of the cell.
Résultat Effects.ICellEffect

GetForeground() public méthode

Gets the foreground of a specified cell.
public GetForeground ( int x, int y ) : Microsoft.Xna.Framework.Color
x int The x location of the cell.
y int The y location of the cell.
Résultat Microsoft.Xna.Framework.Color

GetGlyph() public méthode

Gets the glyph of a specified cell.
public GetGlyph ( int x, int y ) : int
x int The x location of the cell.
y int The y location of the cell.
Résultat int

GetSpriteEffect() public méthode

Gets the sprite effect of a specified cell.
public GetSpriteEffect ( int x, int y ) : Microsoft.Xna.Framework.Graphics.SpriteEffects
x int The x location of the cell.
y int The y location of the cell.
Résultat Microsoft.Xna.Framework.Graphics.SpriteEffects

GetString() public méthode

Builds a string from the text surface.
public GetString ( int index, int length ) : string
index int Where to start getting characters from.
length int How many characters to fill the string with.
Résultat string

GetString() public méthode

Builds a string from the text surface from the specified coordinates.
public GetString ( int x, int y, int length ) : string
x int The x position of the surface to start at.
y int The y position of the surface to start at.
length int How many characters to fill the string with.
Résultat string

GetStringColored() public méthode

Builds a string from the text surface.
public GetStringColored ( int index, int length ) : ColoredString
index int Where to start getting characters from.
length int How many characters to fill the string with.
Résultat ColoredString

GetStringColored() public méthode

Builds a string from the text surface from the specified coordinates.
public GetStringColored ( int x, int y, int length ) : ColoredString
x int The x position of the surface to start at.
y int The y position of the surface to start at.
length int How many characters to fill the string with.
Résultat ColoredString

IsValidCell() public méthode

Tests if a cell is valid based on its index.
public IsValidCell ( int index ) : bool
index int The index to test.
Résultat bool

IsValidCell() public méthode

Tests if a cell is valid based on its x,y position.
public IsValidCell ( int x, int y ) : bool
x int The x coordinate of the cell to test.
y int The y coordinate of the cell to test.
Résultat bool

IsValidCell() public méthode

Tests if a cell is valid based on its x,y position.
public IsValidCell ( int x, int y, int &index ) : bool
x int The x coordinate of the cell to test.
y int The y coordinate of the cell to test.
index int If the cell is valid, the index of the cell when found.
Résultat bool

OnSurfaceChanged() protected méthode

Called when the TextSurface property is changed. Sets Effects to a new instance of EffectsManager.
protected OnSurfaceChanged ( ITextSurface oldSurface, ITextSurface newSurface ) : void
oldSurface ITextSurface The previous text surface.
newSurface ITextSurface The new text surface.
Résultat void

Print() public méthode

Draws the string on the console at the specified location, wrapping if needed.
public Print ( int x, int y, ColoredString text ) : void
x int X location of the text.
y int Y location of the text.
text ColoredString The string to display.
Résultat void

Print() public méthode

Draws the string on the console at the specified location, wrapping if needed.
public Print ( int x, int y, string text ) : void
x int X location of the text.
y int Y location of the text.
text string The string to display.
Résultat void

Print() public méthode

Draws the string on the console at the specified location, wrapping if needed.
public Print ( int x, int y, string text, ICellAppearance appearance, ICellEffect effect = null ) : void
x int X location of the text.
y int Y location of the text.
text string The string to display.
appearance ICellAppearance The appearance of the cell
effect ICellEffect An optional effect to apply to the printed cells.
Résultat void

Print() public méthode

Draws the string on the console at the specified location and color, wrapping if needed.
public Print ( int x, int y, string text, Microsoft.Xna.Framework.Color foreground ) : void
x int X location of the text.
y int Y location of the text.
text string The string to display.
foreground Microsoft.Xna.Framework.Color Sets the foreground of all characters in the text.
Résultat void

Print() public méthode

Draws the string on the console at the specified location with the specified foreground and background color, wrapping if needed.
public Print ( int x, int y, string text, Microsoft.Xna.Framework.Color foreground, Microsoft.Xna.Framework.Color background ) : void
x int X location of the text.
y int Y location of the text.
text string The string to display.
foreground Microsoft.Xna.Framework.Color Sets the foreground of all characters in the text.
background Microsoft.Xna.Framework.Color Sets the background of all characters in the text.
Résultat void

Print() public méthode

Draws the string on the console at the specified location with the specified settings.
public Print ( int x, int y, string text, Microsoft.Xna.Framework.Color foreground = null, Microsoft.Xna.Framework.Color background = null, Microsoft.Xna.Framework.Graphics.SpriteEffects spriteEffect = null ) : void
x int X location of the text.
y int Y location of the text.
text string The string to display.
foreground Microsoft.Xna.Framework.Color Sets the foreground of all characters in the text.
background Microsoft.Xna.Framework.Color Sets the background of all characters in the text.
spriteEffect Microsoft.Xna.Framework.Graphics.SpriteEffects The sprite effect to set on the cell.
Résultat void

SetBackground() public méthode

Changes the background of a cell to the specified color.
public SetBackground ( int x, int y, Microsoft.Xna.Framework.Color color ) : void
x int The x location of the cell.
y int The y location of the cell.
color Microsoft.Xna.Framework.Color The desired color of the cell.
Résultat void

SetCellAppearance() public méthode

Changes the appearance of the cell. The appearance represents the look of a cell and will first be cloned, then applied to the cell.
public SetCellAppearance ( int x, int y, ICellAppearance appearance ) : void
x int The x location of the cell.
y int The y location of the cell.
appearance ICellAppearance The desired appearance of the cell. A null value cannot be passed.
Résultat void

SetEffect() public méthode

Changes the effect of a list of cells to the specified effect.
public SetEffect ( IEnumerable cells, Effects effect ) : void
cells IEnumerable The cells for the effect.
effect Effects The desired effect.
Résultat void

SetEffect() public méthode

Changes the effect of a cell to the specified effect.
public SetEffect ( int index, ICellEffect effect ) : void
index int Index of the cell.
effect ICellEffect The desired effect.
Résultat void

SetEffect() public méthode

Changes the effect of a cell to the specified effect.
public SetEffect ( int x, int y, Effects effect ) : void
x int The x location of the cell.
y int The y location of the cell.
effect Effects The desired effect.
Résultat void

SetForeground() public méthode

Changes the foreground of a specified cell to a new color.
public SetForeground ( int x, int y, Microsoft.Xna.Framework.Color color ) : void
x int The x location of the cell.
y int The y location of the cell.
color Microsoft.Xna.Framework.Color The desired color of the cell.
Résultat void

SetGlyph() public méthode

Changes the glyph of a specified cell to a new value.
public SetGlyph ( int x, int y, int glyph ) : void
x int The x location of the cell.
y int The y location of the cell.
glyph int The desired glyph of the cell.
Résultat void

SetGlyph() public méthode

Changes the glyph, foreground, and background of a cell.
public SetGlyph ( int x, int y, int glyph, Microsoft.Xna.Framework.Color foreground ) : void
x int The x location of the cell.
y int The y location of the cell.
glyph int The desired glyph.
foreground Microsoft.Xna.Framework.Color The desired foreground.
Résultat void

SetGlyph() public méthode

Changes the glyph, foreground, and background of a cell.
public SetGlyph ( int x, int y, int glyph, Microsoft.Xna.Framework.Color foreground, Microsoft.Xna.Framework.Color background ) : void
x int The x location of the cell.
y int The y location of the cell.
glyph int The desired glyph.
foreground Microsoft.Xna.Framework.Color The desired foreground.
background Microsoft.Xna.Framework.Color The desired background.
Résultat void

SetGlyph() public méthode

Changes the glyph, foreground, background, and effect of a cell.
public SetGlyph ( int x, int y, int glyph, Microsoft.Xna.Framework.Color foreground, Microsoft.Xna.Framework.Color background, ICellEffect effect ) : void
x int The x location of the cell.
y int The y location of the cell.
glyph int The desired glyph.
foreground Microsoft.Xna.Framework.Color The desired foreground.
background Microsoft.Xna.Framework.Color The desired background.
effect ICellEffect Sets the effect of the cell
Résultat void

SetPixels() public méthode

Sets each background of a cell to the array of colors. Must be the same length as this cell surface.
public SetPixels ( Microsoft.Xna.Framework.Color pixels ) : void
pixels Microsoft.Xna.Framework.Color The colors to place.
Résultat void

SetSpriteEffect() public méthode

Sets the sprite effect of a specified cell.
public SetSpriteEffect ( int x, int y, Microsoft.Xna.Framework.Graphics.SpriteEffects spriteEffect ) : void
x int The x location of the cell.
y int The y location of the cell.
spriteEffect Microsoft.Xna.Framework.Graphics.SpriteEffects The sprite effect of the cell.
Résultat void

ShiftDown() public méthode

Scrolls all the console data down by one.
public ShiftDown ( ) : void
Résultat void

ShiftDown() public méthode

Scrolls all the console data down by the specified amount of rows.
public ShiftDown ( int amount, bool wrap = false ) : void
amount int How many rows to shift.
wrap bool
Résultat void

ShiftLeft() public méthode

Scrolls all the console data left by one.
public ShiftLeft ( ) : void
Résultat void

ShiftLeft() public méthode

Scrolls all the console data left by the specified amount.
public ShiftLeft ( int amount, bool wrap = false ) : void
amount int How much to scroll.
wrap bool
Résultat void

ShiftRight() public méthode

Scrolls all the console data right by one.
public ShiftRight ( ) : void
Résultat void

ShiftRight() public méthode

Scrolls all the console data right by the specified amount.
public ShiftRight ( int amount, bool wrap = false ) : void
amount int How much to scroll.
wrap bool
Résultat void

ShiftUp() public méthode

Scrolls all the console data up by one.
public ShiftUp ( ) : void
Résultat void

ShiftUp() public méthode

Scrolls all the console data up by the specified amount of rows.
public ShiftUp ( int amount, bool wrap = false ) : void
amount int How many rows to shift.
wrap bool
Résultat void

SurfaceEditor() public méthode

Creates a new cell surface that can be resized and also have its textSurface.Cells resized.
You must set the Font property before rendering this cell surface.
public SurfaceEditor ( ITextSurface surface ) : System
surface ITextSurface
Résultat System

this() public méthode

Gets a cell by index.
public this ( int index ) : Cell
index int The index of the cell.
Résultat Cell

this() public méthode

Gets a cell based on it's coordinates on the surface.
public this ( int x, int y ) : Cell
x int The X coordinate.
y int The Y coordinate.
Résultat Cell

Property Details

TimesShiftedDown public_oe property

public int TimesShiftedDown
Résultat int

TimesShiftedLeft public_oe property

public int TimesShiftedLeft
Résultat int

TimesShiftedRight public_oe property

public int TimesShiftedRight
Résultat int

TimesShiftedUp public_oe property

public int TimesShiftedUp
Résultat int

UsePrintProcessor public_oe property

When true, the ColoredString.Parse(string, int, ITextSurface, ParseCommandStacks) command is used to print strings.
public bool UsePrintProcessor
Résultat bool

textSurface protected_oe property

protected ITextSurface textSurface
Résultat ITextSurface