Package-level declarations

Types

Link copied to clipboard
abstract class Component(at: Vec2, size: Vec2, val alignment: Align = AlignDefault)

Component is the base class of everything on the screen in PolyUI.

Link copied to clipboard
abstract class Drawable(children: Component? = arrayOf(), at: Vec2 = Vec2.ZERO, val alignment: Align = AlignDefault, size: Vec2 = Vec2.ZERO, visibleSize: Vec2 = Vec2.ZERO, palette: Colors.Palette? = null, val focusable: Boolean = false) : Scrollable, Cloneable

The most basic thing in the PolyUI rendering system.

Link copied to clipboard
abstract class Inputtable(at: Vec2, size: Vec2, val alignment: Align, val focusable: Boolean) : Component

Extensions to Component which allow it to send and receive events.

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.

Link copied to clipboard
abstract class Scrollable(at: Vec2, size: Vec2, visibleSize: Vec2, val alignment: Align, val focusable: Boolean) : Inputtable

Extensions to Component which allow it to listen to scroll events and scroll itself.

Properties

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

Functions

Link copied to clipboard
fun <S : Drawable> S.add3dEffect(xIntensity: Double = 0.05, yIntensity: Double = 0.05): S

Add a 3D hover effect to the specified drawable which slightly skews the object as the mouse moves across it, giving the appearance of it popping off the screen.

Link copied to clipboard
@JvmName(name = "addHoverInfo")
fun <S : Inputtable> 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
Link copied to clipboard
fun <S : Inputtable> 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 component's children, including children of children.

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

Instruct this component to refuse scrolling even if it needs to be.

Link copied to clipboard
fun <S : Inputtable> 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 : Component> S.ensureLargerThan(vec: Vec2)
Link copied to clipboard
inline fun <S : Inputtable> 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 : Component> S.fix(): S
Link copied to clipboard
fun Component.hasChildIn(x: Float, y: Float, width: Float, height: Float): Boolean
Link copied to clipboard
fun <S : Component> S.hide(state: Boolean = true): S
Link copied to clipboard
fun <S : Component> S.ignoreLayout(state: Boolean = true): S

Specify that this component should be ignored during the layout stage.

Link copied to clipboard

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

Link copied to clipboard

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

Link copied to clipboard

Locate a component by its name.

Link copied to clipboard
@JvmName(name = "minimumSize")
fun <S : Scrollable> S.minimumSize(size: Vec2): S

Specify a minimum size for this component. Note that this will also disable scrolling due to optimizations.

Link copied to clipboard
fun <S : Component> S.named(name: String): S
Link copied to clipboard
fun <S : Component> 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 : Inputtable> S.onChange(func: S.(Boolean) -> Boolean): S

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

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

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

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

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

@JvmName(name = "onChangeString")
fun <S : Inputtable> 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 : Inputtable> S.onClick(func: S.(Event.Mouse.Clicked) -> Boolean): S
Link copied to clipboard
Link copied to clipboard
fun <S : Inputtable> S.onInit(function: S.(Event.Lifetime.Init) -> Unit): S
Link copied to clipboard
Link copied to clipboard
fun <S : Inputtable> 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 : Component> S.padded(padding: Vec4): S
fun <S : Component> S.padded(xPad: Float, yPad: Float): S
fun <S : Component> S.padded(left: Float, top: Float, right: Float, bottom: Float): S
Link copied to clipboard
@ApiStatus.Experimental
fun <S : Component> S.prioritize(): S

Prioritize this component, 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 : Component> S.relegate(): S

Relegate this component, 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 : Component> S.shake(): S
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.Default.create(0.08.seconds) }): S