Skip to content

Components

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

FieldScript nameKindDefaultWhat it does
TitletitletextAre you sure?The heading. Empty leaves no room for one.
Bodybodytext, several linesemptyThe question. Empty leaves no room for it.
Buttonsbuttonslist2 entriesThe answers, left to right.
FieldScript nameKindDefaultWhat it does
LabellabeltextnoneWhat it reads.
ActionactiontextnoneReported when this button fires.
DisableddisabledcheckboxnoneWhether it can be pressed.
Cancel Actioncancel_actiontextcancelReported when Escape dismisses this.
Colors
Scrimscrimcolour#000000, 55% opaqueColour painted over everything behind the dialog.
Normalnormalcolour#33333dTint of an idle button.
Hoveredhoveredcolour#4d4d5cTint of the button under the pointer, or the one the ring is on.
Pressedpressedcolour#1f1f26Tint of a held button.
Foregroundforegroundcolour#e6e6f0Colour of the title, the question and every button label.
Answers
Button Texturebutton_textureassetnoneA picture to draw every answer with, or none for flat boxes.
Button Hovered Texturebutton_hovered_textureassetnoneShown instead of the answers' picture on the one under the pointer or the focus.
Button Pressed Texturebutton_pressed_textureassetnoneShown instead of the answers' picture on the one held down.
Button Borderbutton_bordernumber, at least 00 pxWidth of the answers' nine-slice border, so their corners keep their size as they stretch.
Layout
Paddingpaddingnumber, at least 016 pxInset of the dialog's contents from the edge of the dialog, in UI units.
Scalescalenumber, at least 01Scales the size of the text in the title, the question and the buttons.
Title Heighttitle_heightnumber, at least 028 pxHeight reserved for the title, in UI units. Ignored when it is empty.
Button Heightbutton_heightnumber, at least 036 pxHeight of the button row, in UI units.
Button Gapbutton_gapnumber, at least 08 pxGap between buttons, in UI units.