extended by FlxTextField, FlxTypeText, FlxInputText, FlxUIText
Extends FlxSprite to support rendering text. Can tint, fade, rotate and scale just like a sprite. Doesn't really animate though. Also does nice pixel-perfect centering on pixel fonts as long as they are only one-liners.
Creates a new
FlxText object at the specified position.
The x position of the text.
The y position of the text.
The actual text you would like to display initially.
The font size for this text object.
Whether this text field uses embedded fonts or not.
The alignment of the font. Note:
autoSize must be set to
alignment won't show any visual differences.
fieldWidth should be determined automatically. Requires
wordWrap to be
How many iterations do use when drawing the border.
0: only 1 iteration,
1: one iteration for every pixel in
A value of
1 will have the best quality for large border sizes, but might reduce performance when changing text.
NOTE: If the
1 will have the exact same effect (and performance).
Whether this text field uses an embedded font (by default) or not.
Read-only - use
systemFont to specify a system font to use, which then automatically sets this to
Offset that is applied to the shadow border style, if active.
y are multiplied by
borderSize. Default is
(1, 1), or lower-right corner.
The system font for this text (not embedded). Setting this sets
Passing an invalid font name (like
null) causes a default font to be used.
Reference to a
TextField object used internally for rendering -
be sure to know what you're doing if messing with its properties!
Adds another format to this
The format to be added.
The start index of the string where the format will be applied.
The end index of the string where the format will be applied.
Applies formats to text between marker characters, then removes those markers.
NOTE: this will clear all
FlxTextFormats and return to the default format.
text.applyMarkup( "show $green text$ between dollar-signs", [new FlxTextFormatMarkerPair(greenFormat, "$")] );
Even works for complex nested formats like this:
var yellow = new FlxTextFormatMarkerPair(yellowFormat, "@"); var green = new FlxTextFormatMarkerPair(greenFormat, "<g>"); text.applyMarkup("Hey @Buddy@, what <g>is<g> going @on<g>?<g>@", [yellow, green]);
The text you want to format
Removes a specific
FlxTextFormat from this text.
If a range is specified, this only removes the format when it touches that range.
Set border's style (shadow, outline, etc), color, and size all in one go!
outline color in
outline size in pixels
outline quality - # of iterations to use when drawing.
setFormat(?Font:String, Size:Int = 8, Color:FlxColor = FlxColor.WHITE, ?Alignment:FlxTextAlign, ?BorderStyle:FlxTextBorderStyle, BorderColor:FlxColor = FlxColor.TRANSPARENT, EmbeddedFont:Bool = true):FlxText
You can use this if you have a lot of text parameters to set instead of the individual properties.
The name of the font face for the text display.
The size of the font (in pixels essentially).
The color of the text in
The desired alignment
Which border style to use
Color for the border,
Whether this text field uses embedded fonts or not
FlxText instance (nice for chaining stuff together, if you're into that).
Stamps text onto specified atlas object and loads graphic from this atlas.
WARNING: Changing text after stamping it on the atlas will break the atlas, so do it only for
static texts and only after making all the text customizing (like
atlas to stamp graphic to.
whether the graphic was stamped on the atlas successfully