Graphics.Text2d
Description: Defines a drawable text element.
Constructors
Text2d (x, y, text)
Creates a new instance of the Text2d object.
x: number
Initial horizontal location of the Text2d.
y: number
Initial vertical location of the Text2d.
text: string
Initial text of the Text2d.
Text2d (x, y, text, color)
Creates a new instance of the Text2d object with a specified color.
x: number
Initial horizontal location of the Text2d.
y: number
Initial vertical location of the Text2d.
text: string
Initial text of the Text2d.
color: Graphics.Color
Initial color of the Text2d. Default is Black.
Text2d (x, y, text, color)
Creates a new instance of the Text2d object with a specified color.
x: number
Initial horizontal location of the Text2d.
y: number
Initial vertical location of the Text2d.
text: string
Initial text of the Text2d.
color: string
Initial string color of the Text2d. Default is Black.
Fields
Align: string
Gets or sets the text alignment of the Text2d. Values can be "start", "end", "left", "center", or "right".
Baseline: string
Gets or sets the text baseline of the Text2d. Values can be "top", "hanging", "middle", "alphabetic", "ideographic", and "bottom".
FontSettings: Graphics.Assets.FontSettings
Gets the Text2d's FontSetting's.
Text: string
Gets or sets the current Text2d's text.
Inherited from: Graphics.Shape
ZIndex: number
Gets or sets the ZIndex of the Graphic2d. The ZIndex is used to control draw order. Higher ZIndexes appear above lower ZIndexed graphics.
Visible: boolean
Gets or sets the Visible property. The Visible property determines whether the renderable will be drawn to the game screen.
Position: EndGate.Vector2d
Gets or sets the Position of the Graphic2d. The Position determines where the graphic will be drawn on the screen.
Rotation: number
Gets or sets the Rotation of the Graphic2d..
AbsolutePosition: EndGate.Vector2d
Gets the absolute position of the Graphic2d. This is used to calculate absolute positions when graphic's have parents.
OnDisposed: EndGate.EventHandler1 <Graphic2d>
Gets an event that is triggered when the Graphic2d has been disposed. Functions can be bound or unbound to this event to be executed when the event triggers.
Opacity: number
Gets or sets the current opacity. Value is between 0 and 1.
Color: Graphics.Color
Gets or sets the current shape color. Valid colors are strings like "red" or "rgb(255,0,0)".
BorderThickness: number
Gets or sets the current border thickness.
BorderColor: Graphics.Color
Gets or sets the current border color. Valid colors are strings like "red" or "rgb(255,0,0)".
ShadowColor: Graphics.Color
Gets or sets the current shadow color. Valid colors are strings like "red" or "rgb(255,0,0)".
ShadowX: number
Gets or sets the current horizontal shadow position.
ShadowY: number
Gets or sets the current vertical shadow position.
ShadowBlur: number
Gets or sets the current shadow blur.
Methods
Draw()
Draws the text onto the given context. If this Text2d is part of a scene the Draw function will be called automatically.
GetDrawBounds()
The bounding area that represents where the Text2d will draw.
Scale()
Scale's the fonts FontSize.
Clone()
Returns a nearly identical copy of this Text2d. If this Text2d belongs to a parent, the cloned Text2d will not. If this Text2d has children, all children will be cloned as well. Lastly, the cloned Text2d will not have the same event bindings as this one does.
Inherited from: Graphics.Shape
GetChildren()
Returns the list of children for the current Graphic2d.
AddChild()
Adds a child to the Graphic2d. Children are drawn with relative positions to the parent Graphic2d. Children of a Graphic2d should not be added to the Scene, parent Graphic2d's are responsible for drawing their children.
RemoveChild()
Removes a child from the Graphic2d. Returns a Boolean value indicating whether or not the child was able to be removed.
Dispose()
Triggers the OnDisposed event. If this Graphic2d is used with a Scene2d it will be removed from the scene when disposed.
Border()
Sets the current borders thickness and color.
Shadow()
Sets the current shadow x and y positions.
Examples
There's currently no example available for this page. If you'd like to suggest one send me an containing a description, code, and link to the page for the suggested example. As a thanks I'll associate the code snippet with your name directly below the example if approved.