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
-
Method Summary
Modifier and Type Method Description 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.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. final Unitdraw()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. Drawableclone()Implement this function to enable cloning of your Drawable. StringtoString()Drawableget(Integer index)-
Methods inherited from class org.polyfrost.polyui.component.Scrollable
accept, fixVisibleSize, getHasVisibleSize, getShouldScroll, getVisibleSize, isScrolling, isScrollingX, isScrollingY, popScroll, pushScroll, recalculate, resetScroll, screenAt, setHasVisibleSize, setShouldScroll, setVisibleSize, 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, get, get, getAlignment, getAt, getChildren, getHeight, getInitialized, getLayoutFlags, getName, getOperations, getPadding, getParent, getParentOrNull, getPolyUI, getRenders, getSize, getWidth, getX, getY, intersects, isInside, isLayoutIgnored, isOperating, isPositioned, isRawResize, isSizeValid, position, remove, removeChild, removeChild, removeOperation, rescale, set, set, setAt, 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
-
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.
-
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() final Unit draw()
-
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.
-
-
-
-