Skip to content

RmlUi examples ​

Run RmlUi documents in native SFML windows. Start with the counter, then explore themes, draggable windows, templates and visual test pages.

Prerequisites ​

Run all commands from the monorepo root. Bootstrap installs dependencies and builds the packages. A display and OpenGL are required; on macOS the native build also needs Xcode Command Line Tools and CMake. See the quick start.

sh
node tools/bootstrap.cjs

After editing RmlUi TypeScript sources, run npm run build:ts --prefix packages/sfml.js-rmlui. Examples use the locally built package.

The launcher reads RmlUi 6.3's bundled resources under the package's third_party/rmlui directory. List all entries:

sh
node packages/sfml.js-rmlui/examples/official.cjs --list

Examples ​

Dark theme with mission buttons

Themes and variables

Theme switching, accent colors and hover styles

node packages/sfml.js-rmlui/examples/official.cjs variables

Controls: 1 selects dark, 2 light, 3 high contrast, R a random accent and C resets the accent. Escape exits. Mission buttons demonstrate hover styles only; upstream does not attach click actions.

The original stylesheet uses fixed px lengths. This sample keeps a 1024 × 768 framebuffer on Retina as well, with highDpi: false, matching the upstream window. F8 toggles Debugger; Ctrl +/-/0 adjusts the shell's display density.

Upstream RML

Two inventory windows

Drag tutorial

Movable and resizable inventory windows

node packages/sfml.js-rmlui/examples/official.cjs drag

Controls: Move and resize both windows with the mouse. Escape exits.

This ports the tutorial's window setup, separate from the upstream basic/drag application.

Upstream RML

Textured tutorial window

Template tutorial

Nine-slice textures and external templates

node packages/sfml.js-rmlui/examples/official.cjs template

Controls: Inspect the decorated window. Escape exits.

Upstream RML

Upstream document and assets

Document loading

Load an upstream document with its original template, fonts and textures

node packages/sfml.js-rmlui/examples/official.cjs load-document

Controls: Inspect the loaded document. Escape exits. Application actions from other upstream demos are not wired.

Upstream RML

Green text rendered by a custom font effect

Custom font effect

JavaScript FontEffectInstancer and native glyph texture callbacks

node packages/sfml.js-rmlui/examples/font-effect.cjs

Controls: Space toggles the glow effect. Escape exits.

Bounded smoke run: --frames N; --screenshot path.png captures the last frame.

Three native byte stream sources

Byte streams

File document loading, native memory snapshots and synchronous callback RCSS input

node packages/sfml.js-rmlui/examples/streams.cjs

Controls: Escape exits. Use --frames N --screenshot path.png for a bounded capture.

Stream API and lifetime guide

Native nested blending, Gaussian blur and positioned alpha mask

Layer composition

Balanced native layers, premultiplied blending, self-composite filters and saved mask snapshots

node packages/sfml.js-rmlui/examples/render-layers.cjs

Controls: Space moves shapes. Escape exits.

--frames 6 --exercise --screenshot path.png exercises both positions and captures the last frame.

Layer handles, filter ownership and masks

Generated RGBA, transferred texture and native layer snapshot

Callback textures

Lazy premultiplied byte generation, owned handle transfer and scissored layer snapshots

node packages/sfml.js-rmlui/examples/callback-textures.cjs

Controls: Space regenerates colours. Escape exits.

--frames 6 --exercise --screenshot path.png verifies caching and regeneration, then captures the last frame.

Submission methods, lifetime and ownership

Native input instancing and parsed RML children

Element factory

Custom native context/input allocation and release, owned document streams, independent tags and Factory caches

node packages/sfml.js-rmlui/examples/factory-elements.cjs

Controls: type in the field, Space updates text, Escape exits.

--frames 6 --exercise --screenshot path.png verifies edits and captures the last frame.

Factory parsing and cache guide

Element instancer ownership

Native model expressions and two-way controls

Native data models

Native scalars, recursive data-for, shared arrays, sparse patches, getter/transform evaluation, custom Factory views and delegated two-way controllers

node packages/sfml.js-rmlui/examples/data-models.cjs

Controls: Increment updates the count, edit the title, toggle details, Escape exits.

--frames 6 --exercise --screenshot path.png verifies actual bindings and captures the last frame.

Data model contracts and remaining scope

Upstream events model with recorded mouse positions

Official data binding

All four upstream models: Basics, Events, Invaders and Forms, with native expressions and synchronous array changes

node packages/sfml.js-rmlui/examples/official.cjs data-binding

Controls: switch tabs, edit fields, record or clear mouse positions, add or remove subjects, start and fire at invaders. Escape exits.

--frames 45 --exercise --panel invaders --screenshot path.png checks real state and captures the selected tab.

Basics · Invaders · Forms

Upstream application

Original RML and RCSS editors updating a real nested document

Official controls and sandbox

Six original tabs, decorator and color tweens, form controls, a four-second submission animation, and live RML/RCSS editors

node packages/sfml.js-rmlui/examples/official.cjs basic-demo

Controls: switch tabs, change tween settings, submit the form, edit the sandbox. Escape cancels an open subject selection; otherwise it exits. F8 toggles Debugger.

--panel sandbox --frames 8 --exercise --screenshot path.png verifies both editors and captures the sandbox. Panels: welcome, decorators, font-effects, animations, controls, sandbox.

Form controls · Window logic · Event listeners

Upstream application

Real upstream sample directory tree

Official tree view

Traverse the sample directory and toggle descendant visibility using the upstream FileBrowser rules

node packages/sfml.js-rmlui/examples/official.cjs tree-view

Controls: click directory arrows to expand or collapse. Escape exits.

--frames 12 --exercise --screenshot path.png verifies an actual directory toggle.

Upstream application

Original transform, mixed-unit and transition animations

Official animation

Original transform sequences, color keys, fade cycle, transitions and animation events

node packages/sfml.js-rmlui/examples/official.cjs animation

Controls: Space pauses, Return steps once, +/- nudges, arrows animate, F8 toggles Debugger, Escape exits.

--frames 8 --exercise --screenshot path.png verifies pause, step and click controls before capture.

Upstream application

Original benchmark with route rows, range controls and selections

Official benchmark

Regenerate 50 original rows per update; retain independent rendering and the 200-entry FPS ring

node packages/sfml.js-rmlui/examples/official.cjs benchmark

Controls: Space pauses rendering, Down renders once, Return pauses row updates, Right updates once, F8 toggles Debugger, Escape exits.

--frames 3 --screenshot path.png captures a bounded run.

Upstream application

Original draggable icons in two native windows

Official drag

Transfer native-owned icons between windows and change their order.

node packages/sfml.js-rmlui/examples/official.cjs basic-drag

Drag an icon into another window or onto a preceding icon. Escape exits.

Upstream application

Original effect controls and filtered content

Official effects

Adjust original color filters, blur, shadows, transforms and opacity.

node packages/sfml.js-rmlui/examples/official.cjs effects

Open the menu, change sliders and reset the settings. Escape exits.

Upstream application

Original orthographic and perspective transforms

Official transform

Rotate the original documents with orthographic and perspective projection.

node packages/sfml.js-rmlui/examples/official.cjs transform

Space pauses rotation; Escape exits.

Upstream application

Original SVG elements and decorators

Official SVG

Render the original SVG element, decorator and inline updates.

node packages/sfml.js-rmlui/examples/official.cjs svg

Use the original update controls; Escape exits.

Upstream application

Original mountain animation rendered by native rlottie

Official Lottie

Play the original mountain animation with native frame timing and rasterization.

node packages/sfml.js-rmlui/examples/official.cjs lottie

The animation loops automatically. Escape exits.

Upstream application

Original Comfortaa bitmap font atlas

Official bitmap font

Use the original FNT glyph advances, kerning and native atlas textures.

node packages/sfml.js-rmlui/examples/official.cjs bitmap-font

Inspect the three original paragraphs. Escape exits.

Upstream application

Original multilingual HarfBuzz text shaping

Official HarfBuzz

Shape the original English, Arabic and Hindi paragraphs using their original fonts.

node packages/sfml.js-rmlui/examples/official.cjs harfbuzz

Click a language button to switch paragraphs. Escape exits.

Upstream application

Original document using an application-owned log interface

Official custom log

Write original native log messages and severity prefixes to a chosen file.

node packages/sfml.js-rmlui/examples/official.cjs custom-log --log-file /tmp/rmlui-log.txt

The default log uses the system temporary directory. Escape exits.

Upstream application

Original IME form with emoji and eight-language text

Official IME

Open the original native input and textarea with all ten original font faces.

Prepare the five optional Noto fonts once (38 MB, SHA-256 verified): npm run download:ime-fonts --prefix packages/sfml.js-rmlui. Valid cached files are reused.

node packages/sfml.js-rmlui/examples/official.cjs ime

Select a system input method and focus either field. Escape exits.

Upstream application

Original Invaders formation, shields, defender and native HUD

Invaders

Run the original C++ game, menus, decorators and high-score data model.

node packages/sfml.js-rmlui/examples/official.cjs invaders

Left/Right moves, Space fires, Escape opens the pause menu and F8 toggles Debugger. Use the original menus to restart or exit.

Build the package first; the game module is produced in the same build directory. Loading needs no compiler. macOS is verified; Linux and Windows execution remain unverified.

Scores use application data storage. --scores-file /absolute/path/scores.txt selects an existing parent directory. --frames 8 --exercise starts a bounded game.

Native registrations · Upstream application

Original Lua Invaders game with native formation and score display

Lua Invaders

Run the original Lua documents and Game table with the original native game.

node packages/sfml.js-rmlui/examples/official.cjs lua-invaders

Left/Right moves, Space fires, Escape opens the pause menu and F8 toggles Debugger. Options persist beside the selected scores file.

Build the package first; the game module is produced in the same build directory. Loading needs no compiler. macOS is verified; Linux and Windows execution remain unverified.

--scores-file /absolute/path/scores.txt selects storage under an existing parent. --frames 8 --exercise starts a bounded game.

Native registrations · Upstream application and scripts

Clip mask visual test

VisualTests browser

Browse 113 upstream visual test pages

node packages/sfml.js-rmlui/examples/official.cjs visual/clip_mask

Controls: F6 / F7 switches pages. Escape exits.

Append --frames 60 to close after 60 frames. --frames N accepts a positive integer for bounded smoke runs. These are previews without the upstream assertion harness.

Upstream VisualTests · Renderer coverage

The 113-page VisualTests assertions, physical IME checks, remaining game platform work and independent whole-project acceptance remain open. Renderer and module checks have separate evidence in their guides. Screenshots show the native applications running.

All examples · RmlUi quick start · Upstream samples

Icons made by Lorc, Delapouite & Skoll game-icons.net · CC BY 3.0