Interface
An interface (name.ui.json) is what sits on top of the game: HUD, menus, shop. The editor defines the appearance; the behavior lives in code.
In Resources, + › New interface…. The tab shows the list of elements and the game screen, at the project resolution.
Elements
Section titled “Elements”| Element | What it is |
|---|---|
| Panel | Box with background, border or sprite. Can contain other elements. |
| Text | One or more lines of text. |
| Image | A sprite. |
| Button | Box with text that responds to mouse, keyboard and gamepad. |
| Bar | Fills from 0 to 1. |
+ Element creates an element; with a Panel selected, it is created inside the panel.
Editing
Section titled “Editing”- Click selects, drag moves, the handles resize. Edges snap to those of the panel and neighbors; Alt moves freely.
- The arrow keys move 1 pixel; with Shift, 8.
- Ctrl+C, Ctrl+X, Ctrl+V, Ctrl+D, Delete and Ctrl+Z work as in the room.
- In the list, dragging changes the order (the top one is in front) or puts the element inside a Panel.
Inspector
Section titled “Inspector”| Option | What it does |
|---|---|
| Anchor | The point of the screen or panel the element is attached to, at any resolution. |
| Position, Size, Visible | In game pixels. Without Visible, the element starts hidden. |
| Background, Border, Thickness, Sprite | Colors with transparency and image. With Fixed border above 0, the sprite is cut into 9 slices and only the middle stretches. |
| Text, Color, Font, Size, Wrap lines | The text and its appearance. |
| Enabled, Mouse over, Pressed | Button: the initial state and the colors of each state. |
| Value | Bar: the initial value. |
| Arrange children, Gap, Padding, Scroll | Panel: arranges the children in a column, row or grid, and scrolls what does not fit. |
The default is the built-in pixel font, at sizes 8, 16, 24… For another one, import a TTF in Resources and pick it under Font. Text with an imported font is drawn at the window resolution.
Show in the game
Section titled “Show in the game”- From the room: check the interface under Interfaces, in the room Inspector.
- From code:
Ui.showandUi.hide. Guides: HUD and pause menu, List of items.
