Skip to content

Console Class

A surface that has a cursor.

C#
[DataContract]
[JsonObject(MemberSerialization = MemberSerialization.OptIn)]
public class Console : ScreenSurface, IDisposable, IScreenSurfaceEditable, IScreenSurface, IScreenObject, IPositionable, IComponentHost, ISurface, ISurfaceSettable, ICellSurfaceResize

Inheritance objectScreenObjectScreenSurface

Implements IDisposable, IScreenSurfaceEditable, IScreenSurface, IScreenObject, SadRogue.Primitives.IPositionable, IComponentHost, ISurface, ISurfaceSettable, ICellSurfaceResize

Creates a new console.

C#
public Console(int width, int height)

width int
The width in cells of the surface.

height int
The height in cells of the surface.

Creates a new screen object that can render a surface. Uses the specified cells to generate the surface.

C#
public Console(int width, int height, ColoredGlyphBase[] initialCells)

width int
The width in cells of the surface.

height int
The height in cells of the surface.

initialCells ColoredGlyphBase[]
The initial cells to seed the surface.

Creates a new console with the specified width and height, with SadRogue.Primitives.Color.Transparent for the background and SadRogue.Primitives.Color.White for the foreground.

C#
public Console(int width, int height, int bufferWidth, int bufferHeight)

width int
The visible width of the console in cells.

height int
The visible height of the console in cells.

bufferWidth int
The total width of the console in cells.

bufferHeight int
The total height of the console in cells.

Console(int, int, int, int, ColoredGlyphBase[]?)

Section titled “Console(int, int, int, int, ColoredGlyphBase[]?)”

Creates a console with the specified width and height, with SadRogue.Primitives.Color.Transparent for the background and SadRogue.Primitives.Color.White for the foreground.

C#
public Console(int width, int height, int bufferWidth, int bufferHeight, ColoredGlyphBase[]? initialCells)

width int
The width of the console in cells.

height int
The height of the console in cells.

bufferWidth int
The total width of the console in cells.

bufferHeight int
The total height of the console in cells.

initialCells ColoredGlyphBase[]
The cells to seed the console with. If null, creates the cells for you.

Creates a new console using the existing surface.

C#
public Console(ICellSurface surface, IFont? font = null, Point? fontSize = null)

surface ICellSurface
The surface.

font IFont
The font to use with the surface.

fontSize System.NullableSadRogue.Primitives.Point
The font size.

The virtual cursor reference.

C#
public Cursor Cursor { get; protected set; }

Toggles the cursor as visible\hidden when the console if focused\unfocused.

C#
[DataMember]
public bool AutoCursorOnFocus { get; set; }

Called when the visibility of the object changes.

C#
protected override void OnVisibleChanged()

Called when this console’s focus has been lost. Hides the Cursor if AutoCursorOnFocus is true.

C#
public override void OnFocusLost()

Called when this console is focused. Shows the Cursor if AutoCursorOnFocus is true.

C#
public override void OnFocused()

Returns the value “Console”.

C#
public override string ToString()

string
The string “Console”.