Class PixelLayout
-
- All Implemented Interfaces:
-
kotlin.Cloneable
public class PixelLayout extends Layout
The most basic layout.
Just a container basically, that can infer it's size.
-
-
Field Summary
Fields Modifier and Type Field Description private transient PropertyManagerpropertyManagerprivate final transient Colorscolorsprivate final transient FontFamilyfontsprivate final ArrayList<Component>componentsprivate final ArrayList<Layout>childrenprivate BooleanconsumesHoverprivate transient BooleanneedsRedrawprivate BooleanrefuseFramebufferprivate transient Layoutlayoutprivate final transient ArrayList<Function1<Layout, Unit>>initCompleteHooksprivate final transient Booleandraggableprivate Vec2<Unit>visibleSizeprivate Vec2<Unit>sizeprivate final BooleanresizesChildrenprivate final transient HashMap<Event, Function2<Drawable, Event, Boolean>>eventHandlersprivate transient StringsimpleNameprivate transient Rendererrendererprivate transient PolyUIpolyUIprivate BooleanacceptsInputprivate final transient ByteinitStageprivate final transient BooleanmouseOverprivate transient 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
-
Method Summary
Modifier and Type Method Description UnitcalculateBounds()Calculate the position and size of this drawable. UnitonInitComplete()This function is called when initialization of a drawable is complete, so it has been fully calculated. 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.layout.Layout
add, add, add, background, changeColors, changeFonts, clipDrawables, countDrawables, debugPrint, debugRender, draggable, every, get, getChildren, getColors, getComponent, getComponents, getConsumesHover, getDraggable, getFonts, getInitCompleteHooks, getLayout, getLayout, getNeedsRedraw, getOrNull, getPropertyManager, getRefuseFramebuffer, getResizesChildren, getSize, getVisibleSize, intersects, isInside, isInside, onAll, onAllLayouts, onColorsChanged, onFontsChanged, reRenderIfNecessary, remove, remove, removeNow, removeNow, render, rescale, reset, scrolling, setConsumesHover, setLayout, setNeedsRedraw, setPropertyManager, setRefuseFramebuffer, setSize, setVisibleSize, setup, toString, trueX, trueY -
Methods inherited from class org.polyfrost.polyui.component.Drawable
accept, addEventHandler, addEventhandler, addOperation, animateBy, animateTo, canBeRemoved, clone, 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, isDynamic, moveBy, moveTo, onParentInitComplete, postRender, preRender, 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
-
-
Method Detail
-
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.
-
onInitComplete
Unit onInitComplete()
This function is called when initialization of a drawable is complete, so it has been fully calculated.
This function is called once, and only once.
- Since:
0.19.0
-
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.
-
-
-
-