public class TextraLabel
extends com.badlogic.gdx.scenes.scene2d.ui.Widget
Font rather than a libGDX BitmapFont. This supports being
laid out in a Table just like the typical Label.| Modifier and Type | Field and Description |
|---|---|
int |
align |
protected Font |
font |
Layout |
layout |
java.lang.String |
storedText |
com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle |
style |
boolean |
wrap |
| Constructor and Description |
|---|
TextraLabel()
Creates a TextraLabel that uses the default libGDX font (lsans-15 in the current version) with white color.
|
TextraLabel(java.lang.String text,
Font font)
Creates a TextraLabel with the given text (which may be multi-line) and using the given Font.
|
TextraLabel(java.lang.String text,
Font font,
com.badlogic.gdx.graphics.Color color)
Creates a TextraLabel with the given text (which may be multi-line), using the given Font, and using the given
default color.
|
TextraLabel(java.lang.String text,
com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle style)
Creates a TextraLabel with the given text (which may be multi-line) and using the given style.
|
TextraLabel(java.lang.String text,
com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle style,
boolean makeGridGlyphs)
Creates a TextraLabel with the given text (which may be multi-line) and using the given style.
|
TextraLabel(java.lang.String text,
com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle style,
Font replacementFont)
Creates a TextraLabel with the given text (which may be multi-line) and using the given style.
|
TextraLabel(java.lang.String text,
com.badlogic.gdx.scenes.scene2d.ui.Skin skin)
Creates a TextraLabel with the given text (which may be multi-line) and using the specified Skin's LabelStyle.
|
TextraLabel(java.lang.String text,
com.badlogic.gdx.scenes.scene2d.ui.Skin skin,
boolean makeGridGlyphs)
Creates a TextraLabel with the given text (which may be multi-line) and using the specified Skin's LabelStyle.
|
TextraLabel(java.lang.String text,
com.badlogic.gdx.scenes.scene2d.ui.Skin skin,
Font replacementFont)
Creates a TextraLabel with the given text (which may be multi-line) and using the default style from
a Skin, replacing any font that would be drawn from the style with
replacementFont. |
TextraLabel(java.lang.String text,
com.badlogic.gdx.scenes.scene2d.ui.Skin skin,
java.lang.String styleName)
Creates a TextraLabel with the given text (which may be multi-line) and using the specified style from the given
Skin.
|
TextraLabel(java.lang.String text,
com.badlogic.gdx.scenes.scene2d.ui.Skin skin,
java.lang.String styleName,
boolean makeGridGlyphs)
Creates a TextraLabel with the given text (which may be multi-line) and using the specified style from the given
Skin.
|
TextraLabel(java.lang.String text,
com.badlogic.gdx.scenes.scene2d.ui.Skin skin,
java.lang.String styleName,
com.badlogic.gdx.graphics.Color color)
Creates a TextraLabel with the given text (which may be multi-line), using the specified style from the given
Skin, with the default Color overridden by the given one.
|
TextraLabel(java.lang.String text,
com.badlogic.gdx.scenes.scene2d.ui.Skin skin,
java.lang.String styleName,
Font replacementFont)
Creates a TextraLabel with the given text (which may be multi-line) and using the given style taken by name from
a Skin, replacing any font that would be drawn from the style with
replacementFont. |
TextraLabel(java.lang.String text,
com.badlogic.gdx.scenes.scene2d.ui.Skin skin,
java.lang.String styleName,
Font replacementFont,
com.badlogic.gdx.graphics.Color color)
Creates a TextraLabel with the given text (which may be multi-line) and using the given style taken by name from
a Skin, replacing any font that would be drawn from the style with
replacementFont. |
TextraLabel(java.lang.String text,
com.badlogic.gdx.scenes.scene2d.ui.Skin skin,
java.lang.String styleName,
java.lang.String colorName)
Creates a TextraLabel with the given text (which may be multi-line), using the specified style from the given
Skin, with the default Color overridden by the color with the given name in the skin.
|
| Modifier and Type | Method and Description |
|---|---|
void |
draw(com.badlogic.gdx.graphics.g2d.Batch batch,
float parentAlpha) |
int |
getAlignment()
Gets the alignment for the text in this TextraLabel.
|
Font |
getFont() |
float |
getPrefHeight() |
float |
getPrefWidth() |
boolean |
isWrap()
Gets the current wrapping mode.
|
void |
layout() |
void |
setAlignment(int alignment)
Sets the alignment for the text in this TextraLabel.
|
void |
setFont(Font font)
Sets the font to the specified Font and then regenerates the layout using
Font.regenerateLayout(Layout). |
void |
setFont(Font font,
boolean regenerate)
Just like
setFont(Font), except this only regenerates the layout if regenerate is true. |
void |
setSize(float width,
float height) |
void |
setText(java.lang.String markupText)
Changes the text in this TextraLabel to the given String, parsing any markup in it.
|
TextraLabel |
setWrap(boolean wrap)
Sets the wrapping mode; if this changes the mode, then this invalidates the hierarchy.
|
void |
skipToTheEnd()
By default, does nothing; this is overridden in TypingLabel to skip its text progression ahead.
|
TextraLabel |
useIntegerPositions(boolean integer) |
getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, invalidate, invalidateHierarchy, needsLayout, pack, setFillParent, setLayoutEnabled, sizeChanged, validateact, addAction, addCaptureListener, addListener, ancestorsVisible, ascendantsVisible, clear, clearActions, clearListeners, clipBegin, clipBegin, clipEnd, debug, drawDebug, drawDebugBounds, fire, firstAscendant, getActions, getCaptureListeners, getColor, getDebug, getHeight, getListeners, getName, getOriginX, getOriginY, getParent, getRight, getRotation, getScaleX, getScaleY, getStage, getTop, getTouchable, getUserObject, getWidth, getX, getX, getY, getY, getZIndex, hasActions, hasKeyboardFocus, hasParent, hasScrollFocus, hit, isAscendantOf, isDescendantOf, isTouchable, isTouchFocusListener, isTouchFocusTarget, isVisible, localToActorCoordinates, localToAscendantCoordinates, localToParentCoordinates, localToScreenCoordinates, localToStageCoordinates, moveBy, notify, parentToLocalCoordinates, positionChanged, remove, removeAction, removeCaptureListener, removeListener, rotateBy, rotationChanged, scaleBy, scaleBy, scaleChanged, screenToLocalCoordinates, setBounds, setColor, setColor, setDebug, setHeight, setName, setOrigin, setOrigin, setOriginX, setOriginY, setParent, setPosition, setPosition, setRotation, setScale, setScale, setScaleX, setScaleY, setStage, setTouchable, setUserObject, setVisible, setWidth, setX, setX, setY, setY, setZIndex, sizeBy, sizeBy, stageToLocalCoordinates, toBack, toFront, toStringpublic Layout layout
protected Font font
public int align
public boolean wrap
public java.lang.String storedText
public com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle style
public TextraLabel()
public TextraLabel(java.lang.String text,
com.badlogic.gdx.scenes.scene2d.ui.Skin skin)
text - the text to use; may be multi-line, but will default to not wrappingskin - the default Label.LabelStyle will be obtained from this and usedpublic TextraLabel(java.lang.String text,
com.badlogic.gdx.scenes.scene2d.ui.Skin skin,
boolean makeGridGlyphs)
text - the text to use; may be multi-line, but will default to not wrappingskin - the default Label.LabelStyle will be obtained from this and usedmakeGridGlyphs - if true, the font should have a solid block glyph available, and underline/strikethrough
may be drawn more clearly; if false, underline/strikethrough will use underscore/dashpublic TextraLabel(java.lang.String text,
com.badlogic.gdx.scenes.scene2d.ui.Skin skin,
java.lang.String styleName)
text - the text to use; may be multi-line, but will default to not wrappingskin - the named Label.LabelStyle will be obtained from this and usedstyleName - the name of a Label.LabelStyle to use from the Skinpublic TextraLabel(java.lang.String text,
com.badlogic.gdx.scenes.scene2d.ui.Skin skin,
java.lang.String styleName,
boolean makeGridGlyphs)
text - the text to use; may be multi-line, but will default to not wrappingskin - the named Label.LabelStyle will be obtained from this and usedstyleName - the name of a Label.LabelStyle to use from the SkinmakeGridGlyphs - if true, the font should have a solid block glyph available, and underline/strikethrough
may be drawn more clearly; if false, underline/strikethrough will use underscore/dashpublic TextraLabel(java.lang.String text,
com.badlogic.gdx.scenes.scene2d.ui.Skin skin,
java.lang.String styleName,
com.badlogic.gdx.graphics.Color color)
text - the text to use; may be multi-line, but will default to not wrappingskin - the named Label.LabelStyle will be obtained from this and usedstyleName - the name of a Label.LabelStyle to use from the Skincolor - the color to use for the font when unspecified (at the start and when reset)public TextraLabel(java.lang.String text,
com.badlogic.gdx.scenes.scene2d.ui.Skin skin,
java.lang.String styleName,
java.lang.String colorName)
text - the text to use; may be multi-line, but will default to not wrappingskin - the named Label.LabelStyle will be obtained from this and usedstyleName - the name of a Label.LabelStyle to use from the SkincolorName - the name in the skin of the color to use for the font when unspecified (at the start and when reset)public TextraLabel(java.lang.String text,
com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle style)
text - the text to use; may be multi-line, but will default to not wrappingstyle - the Label.LabelStyle to usepublic TextraLabel(java.lang.String text,
com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle style,
boolean makeGridGlyphs)
text - the text to use; may be multi-line, but will default to not wrappingstyle - the Label.LabelStyle to usemakeGridGlyphs - if true, the font should have a solid block glyph available, and underline/strikethrough
may be drawn more clearly; if false, underline/strikethrough will use underscore/dashpublic TextraLabel(java.lang.String text,
com.badlogic.gdx.scenes.scene2d.ui.Skin skin,
Font replacementFont)
replacementFont.text - the text to use; may be multi-line, but will default to not wrappingskin - the default Label.LabelStyle will be obtained from this and usedreplacementFont - a Font that will be used in place of the one in stylepublic TextraLabel(java.lang.String text,
com.badlogic.gdx.scenes.scene2d.ui.Skin skin,
java.lang.String styleName,
Font replacementFont)
replacementFont.text - the text to use; may be multi-line, but will default to not wrappingskin - the named Label.LabelStyle will be obtained from this and usedstyleName - the name of a Label.LabelStyle to use from the SkinreplacementFont - a Font that will be used in place of the one in stylepublic TextraLabel(java.lang.String text,
com.badlogic.gdx.scenes.scene2d.ui.Skin skin,
java.lang.String styleName,
Font replacementFont,
com.badlogic.gdx.graphics.Color color)
replacementFont.text - the text to use; may be multi-line, but will default to not wrappingskin - the named Label.LabelStyle will be obtained from this and usedstyleName - the name of a Label.LabelStyle to use from the SkinreplacementFont - a Font that will be used in place of the one in stylecolor - the base color to use for the label, used when resetpublic TextraLabel(java.lang.String text,
com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle style,
Font replacementFont)
text - the text to use; may be multi-line, but will default to not wrappingstyle - the Label.LabelStyle to use, except for its fontreplacementFont - a Font that will be used in place of the one in stylepublic TextraLabel(java.lang.String text,
Font font)
text - the text to use; may be multi-line, but will default to not wrappingfont - a Font from this library, such as one obtained from KnownFontspublic TextraLabel(java.lang.String text,
Font font,
com.badlogic.gdx.graphics.Color color)
text - the text to use; may be multi-line, but will default to not wrappingfont - a Font from this library, such as one obtained from KnownFontscolor - the color to use for the font when unspecified (at the start and when reset)public void draw(com.badlogic.gdx.graphics.g2d.Batch batch,
float parentAlpha)
draw in class com.badlogic.gdx.scenes.scene2d.ui.Widgetpublic float getPrefWidth()
getPrefWidth in interface com.badlogic.gdx.scenes.scene2d.utils.LayoutgetPrefWidth in class com.badlogic.gdx.scenes.scene2d.ui.Widgetpublic float getPrefHeight()
getPrefHeight in interface com.badlogic.gdx.scenes.scene2d.utils.LayoutgetPrefHeight in class com.badlogic.gdx.scenes.scene2d.ui.Widgetpublic TextraLabel useIntegerPositions(boolean integer)
public boolean isWrap()
public TextraLabel setWrap(boolean wrap)
wrap - whether to wrap or notpublic void setSize(float width,
float height)
setSize in class com.badlogic.gdx.scenes.scene2d.Actorpublic void layout()
layout in interface com.badlogic.gdx.scenes.scene2d.utils.Layoutlayout in class com.badlogic.gdx.scenes.scene2d.ui.Widgetpublic int getAlignment()
Align.AlignAlignpublic void setAlignment(int alignment)
alignment - a constant from AlignAlignpublic Font getFont()
public void setFont(Font font)
Font.regenerateLayout(Layout).
This is equivalent to calling setFont(Font, boolean) with true for regenerate.
This won't regenerate the layout if the given font is equal to the current font for this TextraLabel.font - the non-null font to use for this TextraLabelpublic void setFont(Font font, boolean regenerate)
setFont(Font), except this only regenerates the layout if regenerate is true.
(To contrast, setFont(Font) always regenerates the layout.)
This won't regenerate the layout if the given font is equal to the current font for this TextraLabel.font - the non-null font to use for this TextraLabelregenerate - if true, the layout will be re-wrapped and its size re-calculated for the new fontpublic void setText(java.lang.String markupText)
markupText - a String that can contain Font markuppublic void skipToTheEnd()