Package-level declarations

Types

Link copied to clipboard
abstract class Drawable(children: Drawable? = arrayOf(), x: Float = 0.0f, y: Float = 0.0f, val alignment: Align = AlignDefault, size: Vec2? = null, visibleSize: Vec2? = null, palette: Colors.Palette? = null, val focusable: Boolean = false) : Cloneable

The most basic thing in the PolyUI rendering system.

Link copied to clipboard
fun interface Positioner

Positioning strategies are the methods used in PolyUI to place both components across the screen, and components inside a layout.

Properties

Link copied to clipboard
const val MIN_DRAG: Float = 3.0f

Functions

Link copied to clipboard
fun <S : Drawable> S.addHoverInfo(text: String?): S

Add some text that is shown when the mouse is left still over this drawable for 1 second or more.

Link copied to clipboard
fun <S : Drawable> S.afterInit(function: S.(Event.Lifetime.PostInit) -> Unit): S
Link copied to clipboard
fun <S : Drawable> S.afterParentInit(depth: Int = 1, handler: S.() -> Unit): S

Add an event handler to this drawable's parent, and (optionally) it's parent's parent (depth).

Link copied to clipboard
fun Drawable.animateBy(at: Vec2? = null, size: Vec2? = null, rotation: Double = 0.0, scaleX: Float = 0.0f, scaleY: Float = 0.0f, skewX: Double = 0.0, skewY: Double = 0.0, color: PolyColor? = null, animation: Animation? = null)

Bulk add method for all the builtin drawable operations in PolyUI.

Link copied to clipboard
fun Drawable.animateTo(tx: Float = this.x, ty: Float = this.y, size: Vec2 = this.size, rotation: Double = this.rotation, skewX: Double = this.skewX, skewY: Double = this.skewY, scaleX: Float = this.scaleX, scaleY: Float = this.scaleY, color: PolyColor = this.color, animation: Animation? = null)

Bulk add method for all the builtin drawable operations in PolyUI.

Link copied to clipboard

Returns a count of this drawable's children, including children of children.

Link copied to clipboard
fun <S : Drawable> S.disable(state: Boolean = true): S
Link copied to clipboard
fun <S : Drawable> S.draggable(withX: Boolean = true, withY: Boolean = true, free: Boolean = false, onStart: S.() -> Unit? = null, onDrag: S.() -> Unit? = null, onDrop: S.() -> Unit? = null): S

Make this component draggable.

Link copied to clipboard
inline fun <S : Drawable> S.events(dsl: EventDSL<S>.() -> Unit): S
Link copied to clipboard
fun <S : Drawable> S.fix(): S
Link copied to clipboard
fun Drawable.hasChildIn(x: Float, y: Float, width: Float, height: Float): Boolean
Link copied to clipboard

Returns true if this drawable has a DrawableOp of the type T.

Link copied to clipboard
fun <S : Drawable> S.hide(state: Boolean = true): S
Link copied to clipboard

Returns true if this drawable is a child of the specified drawable.

Link copied to clipboard

Returns true if this drawable is a child of the specified drawable, or if the drawable is a child of this.

Link copied to clipboard
fun <S : Drawable> Drawable.locate(id: String): S?

Locate a drawable by its name.

Link copied to clipboard
fun <S : Drawable> S.named(name: String): S
Link copied to clipboard
fun <S : Drawable> S.namedId(name: String): S
Link copied to clipboard
@JvmName(name = "onChangeState")
fun <S : Drawable> S.onChange(func: S.(Boolean) -> Boolean): S

Add a listener for changes to the given Boolean-type property.

@JvmName(name = "onChangeNumber")
fun <S : Drawable> S.onChange(func: S.(Float) -> Boolean): S

Add a listener for changes to the given Float-type property.

@JvmName(name = "onChangeIndex")
fun <S : Drawable> S.onChange(func: S.(Int) -> Boolean): S

Add a listener for changes to the given Int-type property.

@JvmName(name = "onChangeString")
fun <S : Drawable> S.onChange(func: S.(String) -> Boolean): S

Add a listener for changes to the given String-type property.

Link copied to clipboard
@JvmName(name = "onClickZ")
fun <S : Drawable> S.onClick(func: S.(Event.Mouse.Clicked) -> Boolean): S
fun <S : Drawable> S.onClick(func: S.(Event.Mouse.Clicked) -> Unit): S
Link copied to clipboard
fun <S : Drawable> S.onDrag(func: S.(Event.Mouse.Dragged) -> Unit): S
Link copied to clipboard
fun <S : Drawable> S.onInit(function: S.(Event.Lifetime.Init) -> Unit): S
Link copied to clipboard
fun <S : Drawable> S.onPress(func: S.(Event.Mouse.Pressed) -> Unit): S
Link copied to clipboard
fun <S : Drawable> S.padded(padding: Vec2): S
fun <S : Drawable> S.padded(xPad: Float, yPad: Float): S
Link copied to clipboard
@ApiStatus.Experimental
fun <S : Drawable> S.prioritize(): S

Prioritize this drawable, meaning it will, in relation to its siblings:

Link copied to clipboard
@ApiStatus.Experimental
fun <S : Drawable> S.relegate(): S

Relegate this drawable, meaning it will, in relation to its siblings:

Link copied to clipboard
fun <S : Text> S.secondary(): S
Link copied to clipboard
fun <S : Drawable> S.setAlpha(alpha: Float): S
Link copied to clipboard
Link copied to clipboard
fun <S : Text> S.setFont(font: FontFamily.() -> Font): S

Set the font of this text component during initialization, using the PolyUI fonts instance.

Link copied to clipboard
fun <S : Drawable> S.setPalette(palette: Colors.() -> Colors.Palette): S

Set the color palette of this drawable during initialization, using the PolyUI colors instance.

Link copied to clipboard
fun <S : Drawable> S.setState(state: Byte): S

Set the palette of this drawable according to one of the three possible component states in PolyUI.

Link copied to clipboard
fun <S : Block> S.withBoarder(width: Float = 1.0f, color: Colors.() -> PolyColor = { page.border5 }): S
fun <S : Block> S.withBoarder(color: PolyColor, width: Float = 1.0f): S
Link copied to clipboard
fun <S : Drawable> S.withCursor(cursor: Cursor = Cursor.Clicker): S
Link copied to clipboard
fun <S : Drawable> S.withStates(): S
fun <S : Drawable> S.withStates(consume: Boolean = false, showClicker: Boolean = true, animation: () -> Animation? = { Animations.EaseInOutQuad.create(0.08.seconds) }): S