Class DrawString
Draws a string to a console as if someone was typing.
Implements
Inherited Members
Namespace: SadConsole.Instructions
Assembly: SadConsole.dll
Syntax
public class DrawString : InstructionBase, IComponent
Constructors
DrawString()
Creates a new instance of the object. Text must be set manually.
Declaration
public DrawString()
DrawString(ColoredString)
Creates a new instance of the object with the specified text. Prints the text in one second.
Declaration
public DrawString(ColoredString text)
Parameters
Type | Name | Description |
---|---|---|
ColoredString | text |
DrawString(ColoredString, TimeSpan)
Creates a new instance of the object with the specified text.
Declaration
public DrawString(ColoredString text, TimeSpan duration)
Parameters
Type | Name | Description |
---|---|---|
ColoredString | text | The text to print. |
TimeSpan | duration | The time to print the entire text. |
Properties
Cursor
Represents the cursor used in printing. Use this for styling and printing behavior.
Declaration
public Cursor? Cursor { get; set; }
Property Value
Type | Description |
---|---|
Cursor |
Position
Gets or sets the position on the console to write the text.
Declaration
public Point Position { get; set; }
Property Value
Type | Description |
---|---|
Point |
Text
Gets or sets the text to print.
Declaration
public ColoredString Text { get; set; }
Property Value
Type | Description |
---|---|
ColoredString |
TotalTimeToPrint
Gets or sets the total time to take to write the string. Use Zero for no duration.
Declaration
public TimeSpan TotalTimeToPrint { get; set; }
Property Value
Type | Description |
---|---|
TimeSpan |
Methods
OnAdded(IScreenObject)
Creates an invisible cursor that prints on the target surface.
Declaration
public override void OnAdded(IScreenObject host)
Parameters
Type | Name | Description |
---|---|---|
IScreenObject | host | The host this instruction is added to. |
Overrides
Reset()
Resets the Done flag.
Declaration
public override void Reset()
Overrides
Remarks
On the base class, resets the IsFinished to false. Override this method to reset the derived class' counters and status flags for the instruction.
Update(IScreenObject, TimeSpan)
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.
Declaration
public override void Update(IScreenObject componentHost, TimeSpan delta)
Parameters
Type | Name | Description |
---|---|---|
IScreenObject | componentHost | The object that hosts this instruction. |
TimeSpan | delta | The time that has elapsed since this method was last called. |