API reference
Preparing search index…

RmlUi context bound to one sfml.js render window.

Obtain registered instances through createContext, or independently owned instances through Factory.instanceContext. The native context owns attached documents. Stop using wrappers after remove or shutdown.

Type hierarchy

Hierarchy (View Summary)

Source & inheritance
Member directory62

Constructors

Accessors

Methods

Constructors

  • Construct an independently owned native Rml::Context.

    Parameters

    name
    string

    Native name, independent of the Core registry.

    manager

    Live native render manager retained by the context.

    handler

    Explicit borrowed text-input handler, or null.

    Returns

    Preserves native zero dimensions and density 1 without Core registration or plugin creation notices. Retains the manager until remove or collection. The explicit null handler remains null; it does not select the global one. This constructor can be used inside ContextInstancer callbacks.

    Source & inheritance

Accessors

  • get densityIndependentPixelRatio(): number

    Physical pixels per RCSS dp.

    Returns

    number

    Current display density.

    Corresponds to Rml::Context::GetDensityIndependentPixelRatio(). Auto mode refreshes from the window on creation, update and resize. A manual ratio persists until setDensityIndependentPixelRatio(null).

    Source & inheritance
  • get dimensions(): ContextDimensions

    Read the context's cached dimensions through shared native memory.

    Returns

    Cached width and height view in physical pixels.

    The same view reflects setDimensions() and forwarded resize events. Accessors have no setters. Use Context.setDimensions to change layout. A retained view becomes zero when its context is destroyed.

    Source & inheritance
  • get isMouseInteracting(): boolean

    Current Rml::Context::IsMouseInteracting hint, independent of opacity.

    Returns

    boolean

    Whether an element is hovered, active, or autoscrolling.

    Source & inheritance
  • get name(): string

    Rml::Context::GetName, validated against this runtime generation.

    Returns

    string

    Context name.

    Source & inheritance

Methods

  • Enable or disable a named RCSS media theme (Rml::Context::ActivateTheme).

    Parameters

    name
    string

    Theme name used in @media (theme: name).

    activate
    boolean

    True enables the theme; false disables it.

    Returns

    void
    Source & inheritance
  • Attach to the context root, as Rml::Context::AddEventListener does.

    Parameters

    type
    string | number

    Event name or registered native EventId.

    listener

    Synchronous callback.

    capture
    boolean = false

    Capture phase; defaults to false.

    Returns

    void
    Source & inheritance
  • Create an empty document through Rml::Context::CreateDocument.

    Parameters

    instancerName
    string = 'body'

    Registered document instancer; defaults to "body".

    Returns

    null | Document

    Context-owned document, or null if the factory fails.

    Source & inheritance
  • Control system cursor updates through Rml::Context::EnableMouseCursor.

    Parameters

    enable
    boolean

    True lets RmlUi drive the system cursor.

    Returns

    void

    The next mouse update refreshes the enabled cursor. Disabling stops cursor changes; it does not hide the system cursor.

    Source & inheritance
  • Find a document through either Rml::Context::GetDocument overload.

    Parameters

    idOrIndex
    string | number

    Document id or zero-based int32 index in stack order.

    Returns

    null | Document

    First match, or null for missing ids and out-of-range indices.

    Source & inheritance
  • Get the root tag used to create subsequent documents.

    Returns

    string

    Base tag for subsequent documents.

    Source & inheritance
  • Hit-test current layout through Rml::Context::GetElementAtPoint.

    Parameters

    point

    Physical pixels; float-rounded coordinates must fit int32.

    ignoreElement
    null | Element = null

    Ignore this subtree; default null.

    element
    null | Element = null

    Native search root, or null for the context root.

    Returns

    null | Element

    Deepest hit, or null. Arguments must belong to this context.

    RmlUi refreshes transform matrices during render(). Transformed hit tests use the last rendered matrices, and upstream clipping compares the inverse-projected point with the ancestor clip rectangle.

    Source & inheritance
  • Get the element that currently holds input focus.

    Returns

    null | Element

    Focused element, which may be the context root, or null.

    Source & inheritance
  • Get the element under the pointer after the latest input or update.

    Returns

    null | Element

    Hovered element from the latest input/update, or null.

    Source & inheritance
  • Get the number of seconds until the next scheduled context update.

    Returns

    number

    Seconds until update; Infinity means no pending native deadline.

    Source & inheritance
  • Count loaded documents through Rml::Context::GetNumDocuments.

    Returns

    number

    Count excluding documents queued for destruction.

    Source & inheritance
  • Return Rml::Context::GetRootElement with canonical element identity.

    Returns

    Context root, valid until context destruction.

    Source & inheritance
  • Query a named theme (Rml::Context::IsThemeActive).

    Parameters

    name
    string

    Theme name.

    Returns

    boolean

    Whether the theme is active.

    Source & inheritance
  • Load an external .rml document or parse a native stream at its cursor.

    Parameters

    documentPath
    string | Stream

    File-interface path or stream with a source URL.

    Returns

    Loaded, initially hidden document; call show() to display it.

    Error if loading fails.

    Source & inheritance
  • Parse an RML string into a document.

    Parameters

    rml
    string

    RML markup.

    sourceUrlOptional
    string

    Optional source URL for relative resource resolution.

    Returns

    Parsed, initially hidden document; call show() to display it.

    Omission uses "[document from memory]"; an empty string stays empty. RmlUi records sourceURL when parsing a head element. Relative resource paths resolve from this URL. Invalid types and embedded nulls are rejected.

    Error if parsing fails.

    Source & inheritance
  • Forward an sfml.js window event to the RmlUi context.

    Parameters

    event
    Event<(keyof EventPayloads)> | EventData

    sfml.js event object or event data.

    Returns

    boolean

    Propagation or interaction result; true for ignored events.

    Key, text and wheel events return propagation; mouse/touch input returns whether no element is interacting. Coordinates use physical pixels. Key modifiers come from the event snapshot; pointer modifiers use live keyboard state. Touch events forward a one-entry TouchList. SFML system keys map to LMETA/RMETA on macOS and LWIN/RWIN elsewhere. TextEntered normalizes CR to LF and skips other control characters. Resize events update dimensions and density automatically.

    Source & inheritance
  • Send Rml::Context::ProcessKeyDown, including custom keys (177–250).

    Parameters

    key
    number

    RmlUi key identifier, not an SFML key code.

    modifiers
    number = 0

    Bitwise OR of KeyModifier flags; defaults to 0.

    Returns

    boolean

    Whether the event remains propagating.

    Source & inheritance
  • Send Rml::Context::ProcessKeyUp.

    Parameters

    key
    number

    RmlUi KeyIdentifier or custom key (177–250).

    modifiers
    number = 0

    KeyModifier flags; defaults to 0.

    Returns

    boolean

    Whether the event remains propagating.

    Source & inheritance
  • Send Rml::Context::ProcessMouseButtonDown at the last mouse position.

    Parameters

    button
    number

    Nonnegative button index: left 0, right 1, middle 2.

    modifiers
    number = 0

    KeyModifier flags; defaults to 0.

    Returns

    boolean

    True when the mouse is not interacting with an element.

    Source & inheritance
  • Send Rml::Context::ProcessMouseButtonUp at the last mouse position.

    Parameters

    button
    number

    Nonnegative button index: left 0, right 1, middle 2.

    modifiers
    number = 0

    KeyModifier flags; defaults to 0.

    Returns

    boolean

    True when the mouse is not interacting with an element.

    Source & inheritance
  • Clear hover with Rml::Context::ProcessMouseLeave until the next mouse move.

    Returns

    boolean

    True when the mouse is not interacting with an element.

    Source & inheritance
  • Send Rml::Context::ProcessMouseMove in physical window pixels.

    Parameters

    x
    number

    Signed 32-bit horizontal coordinate.

    y
    number

    Signed 32-bit vertical coordinate.

    modifiers
    number = 0

    KeyModifier flags; defaults to 0.

    Returns

    boolean

    True when the mouse is not interacting with an element.

    Source & inheritance
  • Send Rml::Context::ProcessMouseWheel.

    Parameters

    delta

    Wheel vector, positive right/down. A number uses the deprecated vertical overload.

    modifiers
    number = 0

    KeyModifier flags; defaults to 0.

    Returns

    boolean

    Whether the event remains propagating.

    Source & inheritance
  • Send Unicode text through Rml::Context::ProcessTextInput.

    Parameters

    text
    string | number

    String or Unicode scalar; isolated surrogates are rejected.

    Returns

    boolean

    Whether the event remains propagating.

    A string produces one textinput event. Numeric ASCII and Unicode inputs use the character overload. Direct input preserves control characters.

    Source & inheritance
  • Call Rml::Context::ProcessTextInput(char) with one byte.

    Parameters

    byte
    number

    Integer from 0 to 255.

    Returns

    boolean

    Whether the event remains propagating; high bytes return false.

    ASCII bytes 0–127 preserve control characters. Bytes 128–255 produce no event, matching the native char overload. Use processTextInput for Unicode scalars or strings.

    Source & inheritance
  • Cancel touches with Rml::Context::ProcessTouchCancel.

    Parameters

    touches
    readonly Touch[]

    Ordered touch list.

    Returns

    boolean

    AND of results; unknown touches return false, empty lists true.

    RmlUi 6.3 simulates left-button release with no modifiers. This may click.

    Source & inheritance
  • Release every touch with Rml::Context::ProcessTouchEnd.

    Parameters

    touches
    readonly Touch[]

    Ordered touch list.

    modifiers
    number = 0

    KeyModifier flags; defaults to 0.

    Returns

    boolean

    AND of results; unknown touches and empty lists return true.

    Source & inheritance
  • Move every touch with Rml::Context::ProcessTouchMove.

    Parameters

    touches
    readonly Touch[]

    Ordered touch list.

    modifiers
    number = 0

    KeyModifier flags; defaults to 0.

    Returns

    boolean

    AND of results; unknown touches and empty lists return true.

    Source & inheritance
  • Start every touch with Rml::Context::ProcessTouchStart.

    Parameters

    touches
    readonly Touch[]

    Touch list, processed in order after full validation.

    modifiers
    number = 0

    KeyModifier flags; defaults to 0.

    Returns

    boolean

    AND of upstream interaction results; true for an empty list.

    Source & inheritance
  • Move a document to the front through Rml::Context::PullDocumentToFront.

    Parameters

    document

    Document belonging to this context.

    Returns

    void
    Source & inheritance
  • Move a document to the back through Rml::Context::PushDocumentToBack.

    Parameters

    document

    Document belonging to this context.

    Returns

    void
    Source & inheritance
  • Release an independently owned Context through its original instancer.

    Returns

    void

    Registered contexts reject release; use remove() to remove registration.

    Source & inheritance
  • Remove the context from RmlUi.

    Returns

    boolean

    Whether the native context was removed.

    Calls Rml::RemoveContext for registered contexts, or releases independent native ownership. Owned removal never removes a same-name registration. Listeners release automatically. Later operations throw, including repeated remove(). Dimensions become zero; a same-name context never revives old wrappers.

    Source & inheritance
  • Remove Rml::Context::RemoveDataModel and invalidate all its leases.

    Parameters

    name
    string

    Model name.

    Returns

    boolean

    Native removal result.

    Source & inheritance
  • Remove the matching context-root registration.

    Parameters

    type
    string | number

    Event name or registered native EventId.

    listener

    Previously registered callback.

    capture
    boolean = false

    Original capture flag; defaults to false.

    Returns

    void
    Source & inheritance
  • Compile and submit geometry for this frame.

    Returns

    boolean

    The native render result, currently always true.

    RmlUi 6.3's Rml::Context::Render returns true even with no geometry. Flush queued sfml.js drawing before calling, then present with display(). The renderer changes the window view and scissor. Reapply the scene view with window.setView(sceneView) before recording scene draws each frame.

    Source & inheritance
  • Request RmlUi's next update after a nonnegative delay in seconds.

    Parameters

    delay
    number

    Seconds, including zero and Infinity.

    Returns

    void

    Corresponds to Rml::Context::RequestNextUpdate. Only reduces the delay. update() resets it before native elements request their next deadlines.

    Source & inheritance
  • Set the default scroll behavior and speed for this context.

    Parameters

    behavior

    Default behavior; Auto selects Smooth.

    speedFactor
    number = 1

    Positive finite float; defaults to 1.

    Returns

    void
    Source & inheritance
  • Set Rml::Context::SetDensityIndependentPixelRatio or restore auto mode.

    Parameters

    ratio
    null | number

    Positive finite ratio; null resumes window synchronization.

    Returns

    void
    Source & inheritance
  • Update the context dimensions, usually on window resize.

    Parameters

    width
    number

    Physical pixel width for Rml::Context::SetDimensions.

    height
    number

    Height in physical pixels.

    Returns

    void
    Source & inheritance
  • Set Rml::Context::SetDocumentsBaseTag for subsequent documents.

    Parameters

    tag
    string

    Base tag; initially "body".

    Returns

    void
    Source & inheritance
  • Select a document script host for subsequent loads, or disable scripting.

    Parameters

    host

    Captured host, or null to use normal RmlUi documents.

    Returns

    void

    Existing documents retain their own host. Global body/listener registries remain intact. Host selection is forbidden from active native callbacks.

    Source & inheritance
  • Register a script object with the Context's existing ownership.

    Parameters

    object
    null | object

    Host object, or null to clear its association.

    Returns

    void

    Registered contexts retain the object natively. Independently owned contexts use their JS owner edge so context/object cycles can collect.

    Source & inheritance
  • Restore previous document focus through Rml::Context::UnfocusDocument.

    Parameters

    document

    Document to remove from this context's focus history.

    Returns

    void
    Source & inheritance
  • Queue all documents through Rml::Context::UnloadAllDocuments.

    Returns

    void
    Source & inheritance
  • Queue destruction through Rml::Context::UnloadDocument.

    Parameters

    document

    Document belonging to this context.

    Returns

    void

    Dispatches unload synchronously, then removes the document from lookup. Destruction occurs on update; already queued documents are ignored.

    Source & inheritance
  • Run layout and event dispatch for this frame.

    Returns

    boolean

    The native update result, currently always true.

    RmlUi 6.3's Rml::Context::Update always returns true. This is not an activity flag. Call once per frame before render(), even when no input arrived.

    Source & inheritance

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