Host typegenerated
Ui
The interface drawn over the game: changing text and bars, and checking buttons and sliders.
30 members · engine 0.1.0
Ui.caret(input: Entity) -> numberWhere a text field's caret is, in characters.Ui.changed(element: Entity) -> boolWhether user interaction changed a widget this step.Ui.drag(element: Entity) -> Vec2How far the finger that landed on an element moved this frame, as a Vec2 in overlay units, even once it slides off: a look pad is an element a thumb drags across. Zero when nothing is on it.Ui.input_text(input: Entity) -> StringThe committed text in a single-line input.Ui.is_checked(toggle: Entity) -> boolWhether a toggle is checked.Ui.is_focused(element: Entity) -> boolWhether this element has keyboard focus.Ui.is_held(button: Entity) -> boolWhether a button is being held down right now, by any finger: a thumb on a button counts while another thumb steers.Ui.is_hovered(button: Entity) -> boolWhether the mouse or finger is over a button.Ui.is_open(dropdown: Entity) -> boolWhether a dropdown's list is open.Ui.is_pressed(button: Entity) -> boolWhether a button was clicked this frame: pressed and let go while on it.Ui.position(element: Entity) -> Vec2Where an element was laid out on the screen, as a Vec2 in overlay units: 0 is the middle, and one unit is half the screen's height, up positive.Ui.scroll_offset(scroll: Entity) -> numberVertical scroll distance in overlay units.Ui.selected(dropdown: Entity) -> numberWhich option a dropdown has chosen, counted from zero.Ui.selection_end(input: Entity) -> numberWhere a text field's selection ends, in characters; the caret when nothing is selected.Ui.selection_start(input: Entity) -> numberWhere a text field's selection begins, in characters; the caret when nothing is selected.Ui.set_checked(toggle: Entity, checked: bool) -> unitSets a toggle without emitting a user-change event.Ui.set_class(element: Entity, class: String, on: bool) -> unitGives an element a stylesheet class (true) or takes it away: it is restyled on the next frame, and an animation the class names starts.Ui.set_disabled(button: Entity, disabled: bool) -> unitTurns a button off (true) or on: a disabled button cannot be pressed, and a stylesheet shows it with:disabled.Ui.set_fill(bar: Entity, amount: number) -> unitShows part of an image, from 0 (none) to 1 (all). This is how health and progress bars work:Ui.set_fill(bar, hp / max_hp).Ui.set_input_text(input: Entity, text: String) -> unitWrites text using the input's Unicode length limit.Ui.set_number(label: Entity, value: number) -> unitPuts a number into a text element. Its text is set up in the scene with a{}where the number goes, such as"Score: {}".Ui.set_numbers(label: Entity, first: number, second: number) -> unitPuts two numbers into a text element with two{}places, such as"{}/{}"for45/100.Ui.set_scroll_offset(scroll: Entity, offset: number) -> unitClamps the offset to the authored content height.Ui.set_selected(dropdown: Entity, index: number) -> unitChooses a dropdown's option without emitting a user-change event.Ui.set_slider_value(slider: Entity, value: number) -> unitMoves a slider to a value, kept within the slider's range.Ui.set_text(label: Entity, text: String) -> unitChanges the words a text element shows.Ui.size(element: Entity) -> Vec2How wide and tall an element was laid out, in the same units asposition, including room a stylesheet'sflex-growgave it.Ui.slider_changed(slider: Entity) -> boolWhether the player moved a slider this frame.Ui.slider_value(slider: Entity) -> numberThe value a slider is set to.Ui.submitted(input: Entity) -> boolWhether Enter submitted the focused input this step.
- Source
- docs/generated/decay-api.json
- Schema
- v1
- Engine version
- 0.1.0
- Source commit
909aca81368b