Class Drawable
-
- All Implemented Interfaces:
-
kotlin.Cloneable
public abstract class Drawable extends Scrollable implements Cloneable
The most basic thing in the PolyUI rendering system.
Supports recoloring, animations, and the entire event system.
-
-
Field Summary
Fields Modifier and Type Field Description private 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
-
Method Summary
Modifier and Type Method Description Vec2getVisibleSize()UnitsetVisibleSize(Vec2 visibleSize)final RenderergetRenderer()final FramebuffergetFramebuffer()final PolyColorgetColorOrNull()internal storage for the color. final UnitsetColorInternal(@ApiStatus.Internal() PolyColor _color)internal storage for the color. final PolyColorgetColor()final UnitsetColor(PolyColor color)final Colors.PalettegetColorOrNull()internal storage for the palette. final UnitsetColorInternal(@ApiStatus.Internal() Colors.Palette _palette)internal storage for the palette. final Colors.PalettegetPalette()final UnitsetPalette(@SideEffects(values = {"color", "palette"}) Colors.Palette palette)final BooleanneedsRedraw()final UnitsetNeedsRedraw(@SideEffects(values = {"_parent.needsRedraw"}, when = "field != value") Boolean needsRedraw)final DoublegetRotation()current rotation of this drawable (radians). final UnitsetRotation(@Locking(when = "value == 0.0") Double rotation)final DoublegetSkewX()current skew in x dimension of this drawable (radians). final UnitsetSkewX(@Locking(when = "value == 0.0") Double skewX)final DoublegetSkewY()current skew in y dimension of this drawable (radians). final UnitsetSkewY(@Locking(when = "value == 0.0") Double skewY)final FloatgetScaleX()current scale in x dimension of this drawable. final UnitsetScaleX(Float scaleX)final FloatgetScaleY()current scale in y dimension of this drawable. final UnitsetScaleY(Float scaleY)final FloatgetAlpha()final UnitsetAlpha(Float alpha)The alpha value of this drawable. Unitdraw()This method is called every frame, and is used to update the component. BooleanisInside(Float x, Float y)Unitrescale0(Float scaleX, Float scaleY, Boolean withChildren)raw rescale method that does not check rawResize and uses the given scale factors directly. final UnitdebugDraw()Booleansetup(PolyUI polyUI)give this a PolyUI reference. Unitposition()Reposition all the children of this component. Drawableclone()Implement this function to enable cloning of your Drawable. Drawableget(Integer index)-
Methods inherited from class org.polyfrost.polyui.component.Scrollable
accept, fixVisibleSize, 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, calculateSize, clipChildren, contains, contains, createdWithSetPosition, createdWithSetSize, debugString, 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
-
getVisibleSize
Vec2 getVisibleSize()
-
setVisibleSize
Unit setVisibleSize(Vec2 visibleSize)
-
getRenderer
final Renderer getRenderer()
-
getFramebuffer
final Framebuffer getFramebuffer()
-
getColorOrNull
final PolyColor getColorOrNull()
internal storage for the color.
-
setColorInternal
final Unit setColorInternal(@ApiStatus.Internal() PolyColor _color)
internal storage for the color.
-
getColorOrNull
final Colors.Palette getColorOrNull()
internal storage for the palette.
-
setColorInternal
final Unit setColorInternal(@ApiStatus.Internal() Colors.Palette _palette)
internal storage for the palette.
-
getPalette
final Colors.Palette getPalette()
-
setPalette
final Unit setPalette(@SideEffects(values = {"color", "palette"}) Colors.Palette palette)
-
needsRedraw
final Boolean needsRedraw()
-
setNeedsRedraw
final Unit setNeedsRedraw(@SideEffects(values = {"_parent.needsRedraw"}, when = "field != value") Boolean needsRedraw)
-
getRotation
final Double getRotation()
current rotation of this drawable (radians).
note: this method locks due to the fact the object needs to be translated to the center, rotated, and then translated back. It only locks if the value is
0.0.
-
setRotation
final Unit setRotation(@Locking(when = "value == 0.0") Double rotation)
-
getSkewX
final Double getSkewX()
current skew in x dimension of this drawable (radians).
locking if set to
0.0. See rotation.
-
getSkewY
final Double getSkewY()
current skew in y dimension of this drawable (radians).
Locking if set to
0.0. See rotation.
-
setAlpha
final Unit setAlpha(Float alpha)
The alpha value of this drawable.
Note: This value is clamped to the parent's alpha value.
- Since:
0.20.0
-
draw
@Locking()@Synchronized() Unit draw()
This method is called every frame, and is used to update the component.
-
isInside
Boolean isInside(Float x, Float y)
- Returns:
trueif the given point is inside this component.
-
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.
-
position
Unit position()
Reposition all the children of this component.
Note that in most circumstances, recalculate is the method that you actually want.
- Since:
1.0.2
-
-
-
-