Class Text
-
-
Field Summary
Fields Modifier and Type Field Description private final TextPropertiespropertiesprivate FloatfontSizeprivate final Vec2<Unit>stringSizeprivate final ArrayList<Line>linesprivate final Booleanfullprivate final Fontfontprivate Stringstringprivate Translator.TextinitialTextprivate final TextAligntextAlignprivate transient PolyColor.Animatedcolorprivate transient Drawableparentprivate transient Layoutlayoutprivate transient BooleanconsumesHoverprivate Booleandisabledprivate Vec2<Unit>sizeprivate final transient HashMap<Event, Function2<Drawable, Event, Boolean>>eventHandlersprivate transient StringsimpleNameprivate transient Rendererrendererprivate transient PolyUIpolyUIprivate BooleanacceptsInputprivate final transient ByteinitStageprivate final transient BooleanmouseOverprivate Booleanrendersprivate Floatxprivate Floatyprivate Floatwidthprivate Floatheightprivate Booleanexistsprivate transient FloattrueXprivate transient FloattrueYprivate final Unit.TypeatTypeprivate final Unit.TypesizeTypeprivate final BooleanisDynamicprivate Doublerotationprivate DoubleskewXprivate DoubleskewYprivate FloatscaleXprivate FloatscaleYprivate Floatalphaprivate transient Floatacxprivate transient Floatacyprivate final Vec2<Unit>atprivate final BooleanrawResize
-
Constructor Summary
Constructors Constructor Description Text(String txt, Vec2<Unit> at, Vec2<Unit> size, Unit fontSize, TextAlign textAlign, Boolean rawResize, Boolean acceptInput, Function1<EventDSL<Text>, Unit> events)Internally txt is stored as a PolyText object, which supports localization and object substitution Text(String txt, Vec2<Unit> at, Vec2<Unit> size, Unit fontSize, TextAlign textAlign, Boolean rawResize, Boolean acceptInput)Internally txt is stored as a PolyText object, which supports localization and object substitution Text(String txt, Vec2<Unit> at, Vec2<Unit> size, Unit fontSize, TextAlign textAlign, Boolean rawResize)Internally txt is stored as a PolyText object, which supports localization and object substitution Text(String txt, Vec2<Unit> at, Vec2<Unit> size, Unit fontSize, TextAlign textAlign)Internally txt is stored as a PolyText object, which supports localization and object substitution Text(String txt, Vec2<Unit> at, Vec2<Unit> size, Unit fontSize)Internally txt is stored as a PolyText object, which supports localization and object substitution Text(String txt, Vec2<Unit> at, Vec2<Unit> size)Internally txt is stored as a PolyText object, which supports localization and object substitution Text(String txt, Vec2<Unit> at)Internally txt is stored as a PolyText object, which supports localization and object substitution Text(TextProperties properties, Translator.Text text, Unit fontSize, Vec2<Unit> at)Text(TextProperties properties, Translator.Text initialText, Vec2<Unit> at, Vec2<Unit> size, Unit fontSize, TextAlign textAlign, Boolean rawResize, Boolean acceptInput, Function1<EventDSL<Text>, Unit> events)Text(TextProperties properties, Translator.Text initialText, Vec2<Unit> at, Vec2<Unit> size, Unit fontSize, TextAlign textAlign, Boolean rawResize, Boolean acceptInput)Text(TextProperties properties, Translator.Text initialText, Vec2<Unit> at, Vec2<Unit> size, Unit fontSize, TextAlign textAlign, Boolean rawResize)Text(TextProperties properties, Translator.Text initialText, Vec2<Unit> at, Vec2<Unit> size, Unit fontSize, TextAlign textAlign)Text(TextProperties properties, Translator.Text initialText, Vec2<Unit> at, Vec2<Unit> size, Unit fontSize)Text(TextProperties properties, Translator.Text initialText, Vec2<Unit> at, Vec2<Unit> size)Text(TextProperties properties, Translator.Text initialText, Vec2<Unit> at)Text(Translator.Text initialText, Vec2<Unit> at)
-
Method Summary
Modifier and Type Method Description final TextPropertiesgetProperties()final FloatgetFontSize()final UnitsetFontSize(Float fontSize)final Vec2<Unit>getStringSize()final ArrayList<Line>getLines()final BooleangetFull()final FontgetFont()final StringgetString()final UnitsetString(String string)final Translator.TextgetInitialText()final UnitsetInitialText(Translator.Text initialText)final TextAligngetTextAlign()FloattrueX()Note that this method will return the x if this method is called before the component is added to a layout. FloattrueY()Note that this method will return the y if this method is called before the component is added to a layout. Unitrender()draw script for this drawable. final Lineget(Integer index)Unitreset()Use this function to reset your drawable's PolyText if it is using one. final Triple<Line, Integer, Integer>getLineByIndex(Integer index)Unitrescale(Float scaleX, Float scaleY)Method that is called when the physical size of the total window area changes. Unitsetup(Renderer renderer, PolyUI polyUI)give this a renderer reference and a PolyUI reference. UnitcalculateBounds()Calculate the position and size of this drawable. Vec2<Unit>calculateSize()Implement this function to return the size of this drawable, if no size is specified during construction. -
Methods inherited from class org.polyfrost.polyui.component.Component
accept, addKeyframes, addOperation, canBeRemoved, debugRender, draggable, every, getColor, getConsumesHover, getDisabled, getLayout, getParent, getSize, onColorsChanged, onFontsChanged, preRender, recolor, setColor, setConsumesHover, setDisabled, setLayout, setParent, setProperties, setSize, toString, wantRedraw -
Methods inherited from class org.polyfrost.polyui.component.Drawable
addEventHandler, addEventhandler, animateBy, animateTo, clone, debugPrint, doDynamicSize, events, fadeBy, fadeTo, getAcceptsInput, getAcx, getAcy, getAlpha, getAt, getAtType, getContainingLayout, getEventHandlers, getExists, getHeight, getInitStage, getMouseOver, getPolyUI, getRawResize, getRenderer, getRenders, getRotation, getScaleX, getScaleY, getSimpleName, getSizeType, getSkewX, getSkewY, getTrueX, getTrueY, getWidth, getX, getY, intersects, isDynamic, isInside, isInside, moveBy, moveTo, onInitComplete, onParentInitComplete, postRender, removeOperation, resize, rotateBy, rotateTo, scaleBy, scaleTo, setAcceptsInput, setAcx, setAcy, setAlpha, setExists, setHeight, setPolyUI, setRenderer, setRenders, setRotation, setScaleX, setScaleY, setSimpleName, setSkewX, setSkewY, setTrueX, setTrueY, setWidth, setX, setY, skewBy, skewTo -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
Text
Text(String txt, Vec2<Unit> at, Vec2<Unit> size, Unit fontSize, TextAlign textAlign, Boolean rawResize, Boolean acceptInput, Function1<EventDSL<Text>, Unit> events)
Internally txt is stored as a PolyText object, which supports localization and object substitution
-
Text
Text(String txt, Vec2<Unit> at, Vec2<Unit> size, Unit fontSize, TextAlign textAlign, Boolean rawResize, Boolean acceptInput)
Internally txt is stored as a PolyText object, which supports localization and object substitution
-
Text
Text(String txt, Vec2<Unit> at, Vec2<Unit> size, Unit fontSize, TextAlign textAlign, Boolean rawResize)
Internally txt is stored as a PolyText object, which supports localization and object substitution
-
Text
Text(String txt, Vec2<Unit> at, Vec2<Unit> size, Unit fontSize, TextAlign textAlign)
Internally txt is stored as a PolyText object, which supports localization and object substitution
-
Text
Text(String txt, Vec2<Unit> at, Vec2<Unit> size, Unit fontSize)
Internally txt is stored as a PolyText object, which supports localization and object substitution
-
Text
Text(String txt, Vec2<Unit> at, Vec2<Unit> size)
Internally txt is stored as a PolyText object, which supports localization and object substitution
-
Text
Text(String txt, Vec2<Unit> at)
Internally txt is stored as a PolyText object, which supports localization and object substitution
-
Text
Text(TextProperties properties, Translator.Text text, Unit fontSize, Vec2<Unit> at)
-
Text
Text(TextProperties properties, Translator.Text initialText, Vec2<Unit> at, Vec2<Unit> size, Unit fontSize, TextAlign textAlign, Boolean rawResize, Boolean acceptInput, Function1<EventDSL<Text>, Unit> events)
-
Text
Text(TextProperties properties, Translator.Text initialText, Vec2<Unit> at, Vec2<Unit> size, Unit fontSize, TextAlign textAlign, Boolean rawResize, Boolean acceptInput)
-
Text
Text(TextProperties properties, Translator.Text initialText, Vec2<Unit> at, Vec2<Unit> size, Unit fontSize, TextAlign textAlign, Boolean rawResize)
-
Text
Text(TextProperties properties, Translator.Text initialText, Vec2<Unit> at, Vec2<Unit> size, Unit fontSize, TextAlign textAlign)
-
Text
Text(TextProperties properties, Translator.Text initialText, Vec2<Unit> at, Vec2<Unit> size, Unit fontSize)
-
Text
Text(TextProperties properties, Translator.Text initialText, Vec2<Unit> at, Vec2<Unit> size)
-
Text
Text(TextProperties properties, Translator.Text initialText, Vec2<Unit> at)
-
Text
Text(Translator.Text initialText, Vec2<Unit> at)
-
-
Method Detail
-
getProperties
final TextProperties getProperties()
-
getFontSize
final Float getFontSize()
-
setFontSize
final Unit setFontSize(Float fontSize)
-
getStringSize
final Vec2<Unit> getStringSize()
-
getInitialText
final Translator.Text getInitialText()
-
setInitialText
final Unit setInitialText(Translator.Text initialText)
-
getTextAlign
final TextAlign getTextAlign()
-
trueX
Float trueX()
Note that this method will return the x if this method is called before the component is added to a layout.
-
trueY
Float trueY()
Note that this method will return the y if this method is called before the component is added to a layout.
-
getLineByIndex
final Triple<Line, Integer, Integer> getLineByIndex(Integer index)
- Returns:
the Line that encapsulates this character, the index of the character relative to the start of the line, and the index of this line
- Since:
0.18.5
-
rescale
Unit rescale(Float scaleX, Float scaleY)
Method that is called when the physical size of the total window area changes.
-
setup
Unit setup(Renderer renderer, PolyUI polyUI)
give this a renderer reference and a PolyUI reference.
You can also use this method to do some calculations (such as text widths) that are not dependent on other sizes.
If you need a method that has access to component's sizes, see here or here (if you are operating on yourself only).
this method is called once, and only once.
-
calculateBounds
Unit calculateBounds()
Calculate the position and size of this drawable. Make sure to call doDynamicSize in this method to avoid issues with sizing.
This method is called once the layout is populated for children and component, and when a recalculation is requested.
The value of layout's bounds will be updated after this method is called, so do not use layout's bounds as an updated value in this method.
-
calculateSize
Vec2<Unit> calculateSize()
Implement this function to return the size of this drawable, if no size is specified during construction.
This should be so that if the drawable can determine its own size (for example, it is an image), then the size parameter in the constructor can be omitted using:
size: Vec2<org.polyfrost.polyui.unit.Unit>? = null;and this method needs to be implemented!Otherwise, the size parameter in the constructor must be specified.
-
-
-
-