Package com.github.tommyettinger.textra
Class TextraLabel
java.lang.Object
com.badlogic.gdx.scenes.scene2d.Actor
com.badlogic.gdx.scenes.scene2d.ui.Widget
com.github.tommyettinger.textra.TextraLabel
- All Implemented Interfaces:
com.badlogic.gdx.scenes.scene2d.utils.Layout
- Direct Known Subclasses:
TypingLabel
public class TextraLabel
extends com.badlogic.gdx.scenes.scene2d.ui.Widget
A scene2d.ui Widget that displays text using a
...Maybe not quite ready for prime-time yet. This could use some more features for ease-of-use.
Font rather than a libGDX BitmapFont. This supports being
laid out in a Table just like the typical Label.
...Maybe not quite ready for prime-time yet. This could use some more features for ease-of-use.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTextraLabel(String text, com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle style)TextraLabel(String text, com.badlogic.gdx.scenes.scene2d.ui.Skin skin)TextraLabel(String text, com.badlogic.gdx.scenes.scene2d.ui.Skin skin, String styleName)TextraLabel(String text, Font font)TextraLabel(String text, Font font, com.badlogic.gdx.graphics.Color color) -
Method Summary
Modifier and TypeMethodDescriptionvoiddraw(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha)intGets the alignment for the text in this TextraLabel.floatfloatbooleanisWrap()voidlayout()voidsetAlignment(int alignment)Sets the alignment for the text in this TextraLabel.voidsetSize(float width, float height)voidChanges the text in this TextraLabel to the given String, parsing any markup in it.voidsetWrap(boolean wrap)Methods inherited from class com.badlogic.gdx.scenes.scene2d.ui.Widget
getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, invalidate, invalidateHierarchy, needsLayout, pack, setFillParent, setLayoutEnabled, sizeChanged, validateMethods inherited from class com.badlogic.gdx.scenes.scene2d.Actor
act, 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, toString
-
Field Details
-
layout
-
font
-
align
public int align -
wrap
public boolean wrap -
storedText
-
-
Constructor Details
-
TextraLabel
public TextraLabel() -
TextraLabel
-
TextraLabel
-
TextraLabel
-
TextraLabel
-
TextraLabel
-
-
Method Details
-
draw
public void draw(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha)- Overrides:
drawin classcom.badlogic.gdx.scenes.scene2d.ui.Widget
-
getPrefWidth
public float getPrefWidth()- Specified by:
getPrefWidthin interfacecom.badlogic.gdx.scenes.scene2d.utils.Layout- Overrides:
getPrefWidthin classcom.badlogic.gdx.scenes.scene2d.ui.Widget
-
getPrefHeight
public float getPrefHeight()- Specified by:
getPrefHeightin interfacecom.badlogic.gdx.scenes.scene2d.utils.Layout- Overrides:
getPrefHeightin classcom.badlogic.gdx.scenes.scene2d.ui.Widget
-
isWrap
public boolean isWrap() -
setWrap
public void setWrap(boolean wrap) -
setSize
public void setSize(float width, float height)- Overrides:
setSizein classcom.badlogic.gdx.scenes.scene2d.Actor
-
layout
public void layout()- Specified by:
layoutin interfacecom.badlogic.gdx.scenes.scene2d.utils.Layout- Overrides:
layoutin classcom.badlogic.gdx.scenes.scene2d.ui.Widget
-
getAlignment
public int getAlignment()Gets the alignment for the text in this TextraLabel. This is a constant inAlign.- Returns:
- the alignment used by this TextraLabel, as a constant from
Align - See Also:
Align
-
setAlignment
public void setAlignment(int alignment)Sets the alignment for the text in this TextraLabel.- Parameters:
alignment- a constant fromAlign- See Also:
Align
-
setText
Changes the text in this TextraLabel to the given String, parsing any markup in it.- Parameters:
markupText- a String that can contain Font markup
-