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, var width: Float = 0.0f, var height: Float = 0.0f, visWidth: Float = 0.0f, visHeight: Float = 0.0f, 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
@JvmName(name = "addHoverInfo")
fun <S : Drawable> S.addHoverInfo(vararg drawables: Drawable?, size: Vec2 = Vec2.ZERO, align: Align = AlignDefault, position: Point = Point.Above): 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
@JvmName(name = "animateBy")
fun Drawable.animateBy(at: Vec2 = Vec2.ZERO, size: Vec2 = Vec2.ZERO, 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
@JvmName(name = "animateTo")
fun Drawable.animateTo(at: Vec2 = this.at, 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.dontScroll(): 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
@JvmName(name = "ensureLargerThan")
fun <S : Drawable> S.ensureLargerThan(vec: Vec2)
Link copied to clipboard
inline fun <S : Drawable> S.events(dsl: EventDSL<S>.() -> Unit): S
Link copied to clipboard
fun <S : Drawable> S.fade(in: Boolean, durationNanos: Long = 0.1.seconds): S

Fade this drawable in or out, with a given duration.

Link copied to clipboard
fun <S : Drawable> S.fadeIn(durationNanos: Long = 0.1.seconds): S

Alias for fade.

Link copied to clipboard
fun <S : Drawable> S.fadeOut(durationNanos: Long = 0.1.seconds): S

Alias for fade.

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
fun <S : Drawable> S.hide(state: Boolean = true): S
Link copied to clipboard
fun <S : Drawable> S.ignoreLayout(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
@JvmName(name = "minimumSize")
fun <S : Drawable> S.minimumSize(size: Vec2): S
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
fun <S : TextInput> S.numeric(min: Float = 0.0f, max: Float = 100.0f, integral: Boolean = false): S

Make this TextInput only accept numbers between min and max. It will then dispatch a Event.Change.Number event.

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.onToggle(func: S.(Boolean) -> Unit): S

Use this to add a simple listener for the Event.Change.State event.

Link copied to clipboard
fun <S : Drawable> S.padded(padding: Vec4): S
fun <S : Drawable> S.padded(xPad: Float, yPad: Float): S
fun <S : Drawable> S.padded(left: Float, top: Float, right: Float, bottom: 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
fun <S : Block> S.radii(radii: FloatArray): S
fun <S : Block> S.radii(topLeftRadius: Float, topRightRadius: Float, bottomLeftRadius: Float, bottomRightRadius: Float): S
Link copied to clipboard
fun <S : Block> S.radius(radius: Float): S
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.

fun <S : Drawable> S.setPalette(palette: Colors.Palette): S
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 : Drawable> S.toggleable(default: Boolean): S

Make this drawable toggleable, meaning that, when clicked:

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