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 |
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,
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,
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.
|
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 |
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.
|
void |
setWrap(boolean wrap)
Sets the wrapping mode; if this changes the mode, then this invalidates the hierarchy.
|
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
public 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 default 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 default 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 default 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 default 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.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 void 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 void setText(java.lang.String markupText)
markupText - a String that can contain Font markup