Skip to content

DrawString Class

Draws a string to a console as if someone was typing.

C#
public class DrawString : InstructionBase, IComponent

Inheritance objectUpdateComponentInstructionBase

Implements IComponent

Creates a new instance of the object with the specified text.

C#
public DrawString(ColoredString text, TimeSpan duration)

text ColoredString
The text to print.

duration TimeSpan
The time to print the entire text.

Creates a new instance of the object with the specified text. Prints the text in one second.

C#
public DrawString(ColoredString text)

text ColoredString

Creates a new instance of the object. Text must be set manually.

C#
public DrawString()

Gets or sets the text to print.

C#
public ColoredString Text { get; set; }

Gets or sets the total time to take to write the string. Use Zero for no duration.

C#
public TimeSpan TotalTimeToPrint { get; set; }

Gets or sets the position on the console to write the text.

C#
public Point Position { get; set; }

Represents the cursor used in printing. Use this for styling and printing behavior.

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

Executes the instruction. This base class method should be called from derived classes. If the IsFinished property is set to true, will try to repeat if needed and will raise all appropriate events.

C#
public override void Update(IScreenObject componentHost, TimeSpan delta)

componentHost IScreenObject
The object that hosts this instruction.

delta TimeSpan
The time that has elapsed since this method was last called.

Resets the Done flag.

C#
public override void Reset()

On the base class, resets the IsFinished to false. Override this method to reset the derived class’ counters and status flags for the instruction.

Creates an invisible cursor that prints on the target surface.

C#
public override void OnAdded(IScreenObject host)

host IScreenObject
The host this instruction is added to.