Modal
A dialog that owns the interface until it is answered: a title, a question and up to three buttons. Nothing outside it can be reached by any input device while it is up, and Escape fires its cancel action. Needs a Panel for its frame.
On this page
Add it
+ Add node → Modal creates a node with it already on. Already have a node for it? Add component → ModalComponent.
From a script
A script on the same node writes these fields by name. ModalComponent is the name to pass.
rgs
set_text("ModalComponent", "title", "Are you sure?");
set_text("ModalComponent", "body", "");
set_text("ModalComponent", "cancel_action", "cancel");
set_colour("ModalComponent", "scrim", vec4(0.0, 0.0, 0.0, 0.55));
set_colour("ModalComponent", "normal", vec4(0.2, 0.2, 0.24, 1.0));
set_colour("ModalComponent", "hovered", vec4(0.3, 0.3, 0.36, 1.0));
set_colour("ModalComponent", "pressed", vec4(0.12, 0.12, 0.15, 1.0));
set_colour("ModalComponent", "foreground", vec4(0.9, 0.9, 0.94, 1.0));
set_number("ModalComponent", "button_border", 0.0);
set_number("ModalComponent", "padding", 16.0);
set_number("ModalComponent", "scale", 1.0);
set_number("ModalComponent", "title_height", 28.0);
set_number("ModalComponent", "button_height", 36.0);
set_number("ModalComponent", "button_gap", 8.0); Fields
| Field | Script name | Kind | Default | What it does | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Title | title | text | Are you sure? | The heading. Empty leaves no room for one. | ||||||||||||||||||||
| Body | body | text, several lines | empty | The question. Empty leaves no room for it. | ||||||||||||||||||||
| Buttons | buttons | list | 2 entries | The answers, left to right. | ||||||||||||||||||||
| ||||||||||||||||||||||||
| Cancel Action | cancel_action | text | cancel | Reported when Escape dismisses this. | ||||||||||||||||||||
| Colors | ||||||||||||||||||||||||
| Scrim | scrim | colour | #000000, 55% opaque | Colour painted over everything behind the dialog. | ||||||||||||||||||||
| Normal | normal | colour | #33333d | Tint of an idle button. | ||||||||||||||||||||
| Hovered | hovered | colour | #4d4d5c | Tint of the button under the pointer, or the one the ring is on. | ||||||||||||||||||||
| Pressed | pressed | colour | #1f1f26 | Tint of a held button. | ||||||||||||||||||||
| Foreground | foreground | colour | #e6e6f0 | Colour of the title, the question and every button label. | ||||||||||||||||||||
| Answers | ||||||||||||||||||||||||
| Button Texture | button_texture | asset | none | A picture to draw every answer with, or none for flat boxes. | ||||||||||||||||||||
| Button Hovered Texture | button_hovered_texture | asset | none | Shown instead of the answers' picture on the one under the pointer or the focus. | ||||||||||||||||||||
| Button Pressed Texture | button_pressed_texture | asset | none | Shown instead of the answers' picture on the one held down. | ||||||||||||||||||||
| Button Border | button_border | number, at least 0 | 0 px | Width of the answers' nine-slice border, so their corners keep their size as they stretch. | ||||||||||||||||||||
| Layout | ||||||||||||||||||||||||
| Padding | padding | number, at least 0 | 16 px | Inset of the dialog's contents from the edge of the dialog, in UI units. | ||||||||||||||||||||
| Scale | scale | number, at least 0 | 1 | Scales the size of the text in the title, the question and the buttons. | ||||||||||||||||||||
| Title Height | title_height | number, at least 0 | 28 px | Height reserved for the title, in UI units. Ignored when it is empty. | ||||||||||||||||||||
| Button Height | button_height | number, at least 0 | 36 px | Height of the button row, in UI units. | ||||||||||||||||||||
| Button Gap | button_gap | number, at least 0 | 8 px | Gap between buttons, in UI units. | ||||||||||||||||||||