Class ScrollingText
A text viewer that scrolls automatically the text from right to left.
[DataContract("ScrollingText")]
public class ScrollingText : TextBlock, IUIElementUpdate, IUIElementChildren, IIdentifiable
- Inheritance
-
ScrollingText
- Implements
- Inherited Members
- Extension Methods
Constructors
ScrollingText()
public ScrollingText()
Properties
AccumulatedWidth
The total accumulated width of the scrolling text since the last display text reset.
public float AccumulatedWidth { get; }
Property Value
Remarks
The text display is reset internally under certain conditions, which affects the accumulated width.
DesiredCharacterNumber
Gets or sets the desired number of character in average to display at a given time. This value is taken in account during the measurement stage of the element.
[DataMember]
[Display(null, "Behavior")]
public uint DesiredCharacterNumber { get; set; }
Property Value
RepeatText
Gets or sets the a value indicating if the text message must be repeated (wrapped) or not.
[DataMember]
[Display(null, "Behavior")]
public bool RepeatText { get; set; }
Property Value
ScrollingOffset
The current offset of the text in the Ox axis.
public float ScrollingOffset { get; }
Property Value
ScrollingSpeed
Gets or sets the scrolling speed of the text. The unit is in virtual pixels.
[DataMember]
[DataMemberRange(0, 3)]
[Display(null, "Behavior")]
public float ScrollingSpeed { get; set; }
Property Value
Remarks
The value is coerced in the range [0, MaxValue].
TextToDisplay
Returns the text to display during the draw call.
public override string TextToDisplay { get; }
Property Value
Methods
AppendText(string)
Append the provided text to the end of the current Text without restarting the display to the begin of the Text.
public void AppendText(string text)
Parameters
text
stringThe text to append
ArrangeOverride(Vector3)
When overridden in a derived class, positions possible child elements and determines a size for a UIElement derived class.
protected override Vector3 ArrangeOverride(Vector3 finalSizeWithoutMargins)
Parameters
finalSizeWithoutMargins
Vector3The final area within the parent that this element should use to arrange itself and its children.
Returns
- Vector3
The actual size used.
ClearText()
Clear the currently scrolling text.
public void ClearText()
MeasureOverride(Vector3)
When overridden in a derived class, measures the size in layout required for possible child elements and determines a size for the UIElement-derived class.
protected override Vector3 MeasureOverride(Vector3 availableSizeWithoutMargins)
Parameters
availableSizeWithoutMargins
Vector3The available size that this element can give to child elements. Infinity can be specified as a value to indicate that the element will size to whatever content is available.
Returns
- Vector3
The size desired by the children
MeasureSize()
Measure the size of the ScrollingText element.
public Vector3 MeasureSize()
Returns
- Vector3
The size of the element
OnTextChanged()
Method triggered when the Text changes. Can be overridden in inherited class to changed the default behavior.
protected override void OnTextChanged()
Update(GameTime)
Method called by Update(GameTime). This method can be overridden by inherited classes to perform time-based actions. This method is not in charge to recursively call the update on child elements, this is automatically done.
protected override void Update(GameTime time)
Parameters
time
GameTimeThe current time of the game