Class Text
-
-
Field Summary
Fields Modifier and Type Field Description public final static ByteUNLIMITEDpublic final static ByteWRAPpublic final static ByteLIMITED_WRAPpublic final static ByteSCROLLING_SINGLE_LINEpublic final static ByteLIMITEDprivate final Bytemodeprivate Booleanstrikethroughprivate Booleanunderlineprivate Stringtextprivate Font_fontprivate Fontfontprivate Font.WeightfontWeightprivate Booleanitalicprivate FloatuFontSizeprivate FloatfontSizeprivate Vec2visibleSizeprivate final Rendererrendererprivate final Framebufferframebufferprivate PolyColor_colorprivate PolyColorcolorprivate Colors.Palette_paletteprivate Colors.Palettepaletteprivate BooleanneedsRedrawprivate Doublerotationprivate DoubleskewXprivate DoubleskewYprivate FloatscaleXprivate FloatscaleYprivate Floatalphaprivate BooleanhasVisibleSizeprivate final Booleanscrollingprivate final BooleanscrollingXprivate final BooleanscrollingYprivate BooleanshouldScrollprivate final Vec2screenAtprivate BooleanacceptsInputprivate BooleanisEnabledprivate ByteinputStateprivate final Booleanfocusedprivate final Booleanfocusableprivate Stringnameprivate final PolyUIpolyUIprivate final <Error class: unknown class>initializedprivate final <Error class: unknown class><Component>childrenprivate Component_parentprivate Componentparentprivate Alignalignmentprivate Floatxprivate Floatyprivate Vec2atprivate Floatwidthprivate Floatheightprivate Vec2sizeprivate final BooleansizeValidprivate Vec4paddingprivate BytelayoutFlagsprivate BooleanrawResizeprivate BooleanlayoutIgnoredprivate final BooleancreatedWithSetPositionprivate final BooleancreatedWithSetSizeprivate final Booleanpositionedprivate Booleanrendersprivate Booleanclippedprivate final <Error class: unknown class><ComponentOp>operationsprivate final <Error class: unknown class>isOperating
-
Constructor Summary
Constructors Constructor Description Text(String text, Font font, Float fontSize, Vec2 at, Align alignment, Vec2 visibleSize, Boolean focusable, Boolean limited, Component children)Text(Translator.Text text, Font font, Float fontSize, Vec2 at, Align alignment, Vec2 visibleSize, Boolean focusable, Boolean limited, Component children)
-
Method Summary
Modifier and Type Method Description final BytegetMode()Mode that this text was created in. final BooleangetStrikethrough()final UnitsetStrikethrough(Boolean strikethrough)final BooleangetUnderline()final UnitsetUnderline(Boolean underline)StringgetText()UnitsetText(String text)final FontgetFontOrNull()final UnitsetFontInternal(@ApiStatus.Internal() Font _font)final FontgetFont()final UnitsetFont(Font font)final Font.WeightgetFontWeight()final UnitsetFontWeight(Font.Weight fontWeight)final BooleangetItalic()final UnitsetItalic(Boolean italic)final FloatgetUFontSize()Tracker for the unscaled fontSize. final UnitsetUFontSize(Float uFontSize)final FloatgetFontSize()Internal, scaled font size. final UnitsetFontSize(@ApiStatus.Internal() Float fontSize)Unitrescale0(Float scaleX, Float scaleY, Boolean withChildren)raw rescale method that does not check rawResize and uses the given scale factors directly. Booleansetup(PolyUI polyUI)give this a PolyUI reference. UnitupdateTextBounds(Renderer renderer)Vec2calculateSize()Use this function to calculate the size of this component. UnitfixVisibleSize()StringdebugString()Override this function to add things to the debug display of this component. final static StringgetModeName(Byte mode)Return the name of the given constant. -
Methods inherited from class org.polyfrost.polyui.component.Drawable
clone, debugDraw, draw, get, getAlpha, getColor, getColorOrNull, getColorOrNull, getFramebuffer, getPalette, getRenderer, getRotation, getScaleX, getScaleY, getSkewX, getSkewY, getVisibleSize, isInside, needsRedraw, position, setAlpha, setColor, setColorInternal, setColorInternal, setNeedsRedraw, setPalette, setRotation, setScaleX, setScaleY, setSkewX, setSkewY, setVisibleSize -
Methods inherited from class org.polyfrost.polyui.component.Scrollable
accept, getHasVisibleSize, getShouldScroll, isScrolling, isScrollingX, isScrollingY, popScroll, pushScroll, recalculate, resetScroll, screenAt, setHasVisibleSize, setShouldScroll, tryMakeScrolling -
Methods inherited from class org.polyfrost.polyui.component.Inputtable
acceptsInput, addEventhandler, clearHandlers, getInputState, hasListenersFor, hasListenersFor, isEnabled, isFocusable, isFocused, on, setAcceptsInput, setEnabled, setInputState -
Methods inherited from class org.polyfrost.polyui.component.Component
addChild, addChild, addOperation, addOperation, at, clipChildren, contains, contains, createdWithSetPosition, createdWithSetSize, extraToString, get, get, getAlignment, getAt, getChildren, getHeight, getInitialized, getLayoutFlags, getName, getOperations, getPadding, getParent, getParentOrNull, getPolyUI, getRenders, getSize, getWidth, getX, getY, intersects, isClipped, isLayoutIgnored, isOperating, isPositioned, isRawResize, isSizeValid, remove, removeChild, removeChild, removeOperation, rescale, set, set, setAlignment, setAt, setClipped, setHeight, setLayoutFlags, setLayoutIgnored, setName, setPadding, setParent, setRawResize, setRenders, setSize, setWidth, setX, setY, set_parent, size -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getMode
final Byte getMode()
Mode that this text was created in. Must be one of UNLIMITED, WRAP, SCROLLING_SINGLE_LINE, LIMITED_WRAP.
- Since:
1.4.1
-
getStrikethrough
final Boolean getStrikethrough()
- Since:
1.0.6
-
setStrikethrough
final Unit setStrikethrough(Boolean strikethrough)
- Since:
1.0.6
-
getUnderline
final Boolean getUnderline()
- Since:
1.0.6
-
setUnderline
final Unit setUnderline(Boolean underline)
- Since:
1.0.6
-
getFontOrNull
final Font getFontOrNull()
-
setFontInternal
final Unit setFontInternal(@ApiStatus.Internal() Font _font)
-
getFontWeight
final Font.Weight getFontWeight()
-
setFontWeight
final Unit setFontWeight(Font.Weight fontWeight)
-
getUFontSize
final Float getUFontSize()
Tracker for the unscaled fontSize. You should set this instead of font size in most cases.
- Since:
1.2.0
-
setUFontSize
final Unit setUFontSize(Float uFontSize)
-
getFontSize
final Float getFontSize()
Internal, scaled font size. You probably should be using uFontSize instead, as this is an internal object.
-
setFontSize
final Unit setFontSize(@ApiStatus.Internal() Float fontSize)
-
rescale0
Unit rescale0(Float scaleX, Float scaleY, Boolean withChildren)
raw rescale method that does not check rawResize and uses the given scale factors directly.
- Parameters:
withChildren- iftrue, this method will also rescale its children.
-
setup
Boolean setup(PolyUI polyUI)
give this a PolyUI reference.
You can also use this method to do some calculations (such as text widths) that are not dependent on other sizes, or operations that require access to PolyUI things, like PolyUI.settings or PolyUI.translator
this method is called once, and only once.
-
updateTextBounds
Unit updateTextBounds(Renderer renderer)
-
calculateSize
Vec2 calculateSize()
Use this function to calculate the size of this component. DO NOT include children in this calculation!
This function is only called if no size is supplied to this component at initialization. A return value of
nullindicates this component is not able to infer its own size, as it is for example, a Block with no reference. A component such as Text on the other hand, is able to infer its own size.This function is only ever called if sizeValid is false.
-
fixVisibleSize
Unit fixVisibleSize()
-
debugString
String debugString()
Override this function to add things to the debug display of this component.
- Since:
1.1.1
-
getModeName
final static String getModeName(Byte mode)
Return the name of the given constant.
-
-
-
-