Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

UI elements

UI elements are engine CUI bindings exposed to Lua. XRF uses them from runtime UI classes and initializes most controls from XML generated by src/engine/forms.

Use the XRF X-Ray 16 SDK as the API reference for exact methods. This page gives the practical map of common classes.

XML initialization

CScriptXmlInit loads XML and creates controls from node selectors.

Common methods include:

  • ParseFile(path);
  • ParseShTexInfo(path);
  • InitWindow(selector, index, window);
  • InitStatic(selector, parent);
  • InitTextWnd(selector, parent);
  • Init3tButton(selector, parent);
  • InitCheck(selector, parent);
  • InitComboBox(selector, parent);
  • InitEditBox(selector, parent);
  • InitListBox(selector, parent);
  • InitScrollView(selector, parent);
  • InitTab(selector, parent);
  • InitTrackBar(selector, parent).

Call ParseFile() before using Init* helpers. Controls created with a parent are attached to that parent by the engine binding.

Window base classes

ClassUse
CUIWindowBase window rectangle, visibility, enable state, child attachment, and positioning.
CUIDialogWndDialog window that can be shown, hidden, and attached to a dialog holder.
CUIScriptWndScript-driven dialog window with callbacks, keyboard handling, child registration, and typed lookup helpers.

Use CUIScriptWnd for custom script windows that need callbacks or registered child controls.

Static and text controls

ClassUse
CUIStaticStatic image, texture, animation, or simple visual element.
CUITextWndText window with text color, alignment, string-table text, and sizing helpers.
CUILinesText lines object used by text-capable controls.
CUISleepStaticSleep/static overlay variant used by engine UI.

Use SetTextST(...) when the text should come from translations.

Buttons and inputs

ClassUse
CUIButtonBase button class.
CUI3tButtonCommon three-state button used by menus and dialogs.
CUICheckButtonCheckbox-style button with checked state.
CUICustomEditBase edit control with text and focus capture.
CUIEditBoxEdit box with texture initialization.
CUICustomSpinBase spin control.
CUISpinFltFloat spin control.
CUISpinNumInteger spin control.
CUISpinTextText spin control.
CUITrackBarSlider/track bar with integer or float values.

For settings screens, prefer the existing option window patterns under src/engine/core/ui/menu/options.

Lists and tabs

ClassUse
CUIListBoxScrollable list box with list-box items.
CUIListBoxItemItem for CUIListBox.
CUIListBoxItemMsgChainMessage-chain list item variant.
CUIListWndEngine list window that owns added list items.
CUIListItemGeneric list item.
CUIScrollViewScroll view container.
CUITabControlTab container with id and index activation.
CUITabButtonButton used by tab controls.

Ids and visual indices are not the same for combo boxes, tabs, and lists. Use ids for stable logic and indices for visual order.

Frames, maps, and message windows

ClassUse
CUIFrameWindowFramed panel.
CUIFrameLineWndRepeating frame line.
CUIComboBoxDropdown list with item ids.
CUIMessageBoxMessage box static variant.
CUIMessageBoxExDialog-window message box variant.
CUIProgressBarProgress indicator.
CUIPropertiesBoxContext/properties menu.
CUIMapInfoMap metadata control.
CUIMapListMultiplayer map list control.
CUIMMShniagaMain-menu animated/menu control.
CServerListMultiplayer server list control.

Lifetime and callbacks

Parent-owned controls are adopted by the engine UI tree. After attaching a child or adding an item to a list, treat the parent/list as owning its lifetime.

For CUIScriptWnd, register child controls before adding callbacks or using typed lookup helpers. Callback names depend on the registered window name, so keep XML node names and registration names aligned.