Skip to content

luxe API (2025.1.2)


luxe: ui/button module


UIButton

import "luxe: ui/button" for UIButton

UIButton is a Control that represents a clickable button with optional text content.

var btn = UIButton.create(ui)
UIButton.set_text(btn, "click me!")
Control.set_events(btn) {|event|
  if(event.type == UIEvent.release) {
    Log.print("clicked button")
  }
}

UIButton.create(ui_entity: Entity) returns UIButton

Create a new button control.

UIButton.set_text(control: UIButton, text: String) returns None

Set the text displayed on a button.

UIButton.set_outline(control: UIButton, radius: Num, softness: Num, color: Color, offset: Float2) returns None

Set the text outline parameters.

UIButton.set_shadow(control: UIButton, radius: Num, softness: Num, color: Color, offset: Float2) returns None

Set the text shadow parameters.

UIButton.get_text(control: UIButton) returns String

Get the text displayed on a button.

UIButton.set_font(control: UIButton, font: String) returns None

Set the font of the text on a button.

UIButton.get_font(control: UIButton) returns Id32

Get the font asset id of the text on the button. The asset id is returned as the string hash, to get the string use Strings.get.

UIButton.set_color(control: UIButton, color: Color) returns None

Set the color of a button.

UIButton.get_color(control: UIButton) returns Color

Get the color of a button.

UIButton.set_text_size(control: UIButton, size: Num) returns None

Set the size of the text on a button.

UIButton.get_text_size(control: UIButton) returns Num

Get the size of the text on a button.

UIButton.set_align(control: UIButton, align: TextAlign) returns None

Set the horizontal alignment of the text on a button.

UIButton.get_align(control: UIButton) returns TextAlign

Get the horizontal alignment of the text on a button.

UIButton.set_align_vertical(control: UIButton, align: TextAlign) returns None

Set the vertical alignment of the text on a button.

UIButton.get_align_vertical(control: UIButton) returns TextAlign

Get the vertical alignment of the text on a button.

UIButton.get_render_text(control: UIButton) returns RenderText

Get the underlying lowlevel text render object. Usable with the Render.text_* API.

UIButton.set_colors(control: UIButton, bg: Color, bg_hover: Color, border: Color, border_hover: Color) returns unknown

no docs found