# rmp::ui

> rmp::ui — the interface layer.

Source: https://omardev29.github.io/rmp-docs/reference/namespaces/rmp-ui.html

namespace `#include <rmp/ui.h>`

`rmp::ui` — the interface layer.

The whole point, in four lines:

```cpp
rmp::ui::begin();
if (rmp::ui::button("Play")) play();
if (rmp::ui::button("Quit")) quit();
rmp::ui::end();
```

That is a centred, responsive main menu. No coordinates, no sizes, no anchors, no fonts, no hitboxes, and it looks the same at 800x600 as it does at 4K. Everything else in this header is what you reach for when the default is not what you want — and you only pay for it when you use it.

Three rules worth knowing, and that is genuinely all of them:

1. `end()` draws. So the `begin()`/`end()` pair goes between `BeginDrawing()` and `EndDrawing()`, and before `SmokeTest_CaptureFrame()` if you keep that.
2. Describe it where it is drawn: in a scene's `_draw()`, in screen space. Not in `_update()`, which draws nothing, and not in an object's `_draw()`, which runs under the camera — `at()` is how a box follows the world. A call in the wrong place is reported once, and does nothing. Each `begin()`/`end()` pair is a pass, and a frame may hold several: a HUD and the pause menu over it, or a screen and its `overlay()`.
3. Interaction uses the previous frame's geometry. A button cannot be clicked on the very first frame it appears — 16 ms at 60 fps. This is inherent to immediate mode; see TECHNICAL.md for why the alternative is worse.

The layout engine underneath is Clay, and it is deliberately invisible: not one of its types appears in this header, so it can be replaced without any of your code changing.

## On pages of their own

- [`rmp::ui::Picture`](https://omardev29.github.io/rmp-docs/reference/classes/rmp-ui-Picture.html) — Anything `rmp::ui` can show.
- [`rmp::ui::SoundName`](https://omardev29.github.io/rmp-docs/reference/classes/rmp-ui-SoundName.html) — The name of a sound, as `rmp::audio::play()` takes it ("click" is click.wav, click.ogg...): written as a string, `.click = "click"`.
- [`rmp::ui::DialogueBox`](https://omardev29.github.io/rmp-docs/reference/classes/rmp-ui-DialogueBox.html) — The classic box: along the bottom of the screen, the speaker's portrait and name beside the line, the choices as buttons under it.
- [`rmp::ui::DialogueStage`](https://omardev29.github.io/rmp-docs/reference/classes/rmp-ui-DialogueStage.html) — A visual novel's stage: big portraits of who is on it, the speaker in front and the rest dimmed, and the line in a box under them.
- [`rmp::ui::Button`](https://omardev29.github.io/rmp-docs/reference/classes/rmp-ui-Button.html) — A button: text, an icon, or both.
- [`rmp::ui::Label`](https://omardev29.github.io/rmp-docs/reference/classes/rmp-ui-Label.html) — Text, as `text()` draws it, with a style of its own: a title in another font, with an outline.
- [`rmp::ui::Image`](https://omardev29.github.io/rmp-docs/reference/classes/rmp-ui-Image.html) — A picture with a style — a frame, a shadow — that can be clicked.
- [`rmp::ui::Panel`](https://omardev29.github.io/rmp-docs/reference/classes/rmp-ui-Panel.html) — A container: a panel with a look of its own (`style`), and a look for everything inside it (`children`), which every descendant inherits — the nearest container's wins.
- [`rmp::ui::Checkbox`](https://omardev29.github.io/rmp-docs/reference/classes/rmp-ui-Checkbox.html) — A checkbox that holds its own value.
- [`rmp::ui::Slider`](https://omardev29.github.io/rmp-docs/reference/classes/rmp-ui-Slider.html) — A slider that holds its own value.
- [`rmp::ui::Dropdown`](https://omardev29.github.io/rmp-docs/reference/classes/rmp-ui-Dropdown.html) — A dropdown that holds its items and its choice.
- [`rmp::ui::TextInput`](https://omardev29.github.io/rmp-docs/reference/classes/rmp-ui-TextInput.html) — A text field that holds its own text.
- [`rmp::ui::ProgressBar`](https://omardev29.github.io/rmp-docs/reference/classes/rmp-ui-ProgressBar.html) — A progress bar with a look of its own: the style is the track's (its background, its skin), `fill` and `fill_picture` the bar's.

## Vocabulary

### `Align`

enum class Align

enum [include/rmp/ui.h:83](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L83-L93)

Where content sits inside the space it was given. Read them as a 3x3 grid: three verticals (top/center/bottom) crossed with three horizontals (left/center/right).

| Value |  | Means |
|---|---|---|
| `TOP_LEFT` |  |  |
| `TOP_CENTER` |  |  |
| `TOP_RIGHT` |  |  |
| `CENTER_LEFT` |  |  |
| `CENTER` |  |  |
| `CENTER_RIGHT` |  |  |
| `BOTTOM_LEFT` |  |  |
| `BOTTOM_CENTER` |  |  |
| `BOTTOM_RIGHT` |  |  |

### `Variant`

enum class Variant

enum [include/rmp/ui.h:103](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L103)

What a control *means*, not what colour it is. The theme decides the colour, so restyling the game never means revisiting every call site.

```text
normal    a filled surface: the default, and most buttons
primary   the one thing you want pressed on this screen
danger    destructive, and it should look like it
outline   an outline and a label, no fill: a secondary action
ghost     just the label until you point at it: toolbars, "back" links
```

| Value |  | Means |
|---|---|---|
| `NORMAL` |  |  |
| `PRIMARY` |  |  |
| `DANGER` |  |  |
| `OUTLINE` |  |  |
| `GHOST` |  |  |

### `ColorRole`

enum class ColorRole

enum [include/rmp/ui.h:107](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L107)

Which colour of the theme a piece of text uses: TEXT is the theme's text, MUTED its text_muted, PRIMARY its primary and DANGER its danger.

| Value |  | Means |
|---|---|---|
| `TEXT` |  |  |
| `MUTED` |  |  |
| `PRIMARY` |  |  |
| `DANGER` |  |  |

### `Size`

enum class Size

enum [include/rmp/ui.h:119](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L119)

The three type steps. Anywhere a size is asked for you can write one of these or a plain number of design units — it is the same field either way:

```cpp
rmp::ui::text("Chapter One", { .size = rmp::ui::Size::LARGE });
rmp::ui::text("Chapter One", { .size = 34 });
```

The steps are what you want almost always: they come from the theme, so they move together when someone changes the type scale, and they stay in proportion at every screen size. A number is the escape hatch. SMALL, MEDIUM and LARGE are the theme's font_size_small, font_size and font_size_large.

| Value |  | Means |
|---|---|---|
| `SMALL` |  |  |
| `MEDIUM` |  |  |
| `LARGE` |  |  |

## Pictures

### `NineSlice`

struct NineSlice

struct [include/rmp/ui.h:165](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L165-L178)

A picture that stretches without stretching its corners: the classic "9-patch". The four margins cut the source into a 3x3 grid; the corners are drawn at their size, the edges stretch along one axis and the middle along both. That is how one small frame becomes a button of any length.

```cpp
rmp::ui::NineSlice frame{ .texture = ui_art, .source = { 0, 0, 24, 24 },
                          .left = 8, .top = 8, .right = 8, .bottom = 8 };
```

Or read from Aseprite, where an artist draws it: a slice with 9-slices on gives its own margins — [`rmp::ui::nine_slice`](https://omardev29.github.io/rmp-docs/reference/namespaces/rmp-ui.html#nine_slice)(sheet, "button").

| Field | Type | Default | What it is |
|---|---|---|---|
| `texture` | `rmp::Texture` |  | The picture |
| `sheet` | `rmp::SpriteSheet` |  | Or an Aseprite sheet's, when `texture` is empty |
| `source` | `Rectangle` | `{}` | The part of it to cut; {0,0,0,0} = all of it |
| `left` | `float` | `0` | The margins, in pixels of the SOURCE: the left column |
| `top` | `float` | `0` | The top row |
| `right` | `float` | `0` | The right column |
| `bottom` | `float` | `0` | The bottom row |
| `scale` | `float` | `0` | How big a source pixel is drawn, in design units: the corners are left * scale design units wide, and grow with the UI's scale like everything else. 0 = 1, so a 24-pixel frame is drawn as drawn. Pixel art wants a whole number: 2, 3, 4. |

### `slice`

Picture slice(const rmp::SpriteSheet &sheet, std::string_view name)

function [include/rmp/ui.h:227](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L227)

A named slice of an Aseprite file, as a Picture: the part of the first frame the slice covers, with its 9-slice margins when the slice has them. This is how one .aseprite becomes an atlas of icons, by name:

```cpp
static rmp::SpriteSheet icons = rmp::assets::load_sheet("icons.aseprite");
rmp::ui::image(rmp::ui::slice(icons, "coin"));
```

A name the sheet does not have is an empty Picture, said once.

### `nine_slice`

NineSlice nine_slice(const rmp::SpriteSheet &sheet, std::string_view name)

function [include/rmp/ui.h:231](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L231)

The same slice as a NineSlice, to change its scale or hand it on. A slice without 9-slices comes back with all four margins 0, said once.

## Looks: shadows, outlines, skins, sounds and motion

### `Shadow`

struct Shadow

struct [include/rmp/ui.h:243](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L243-L248)

A soft shadow under a box: under a button, a panel, an image. Drawn as a few rounded rectangles that get fainter outwards, which reads as blurred on every target — the software renderer and OpenGL ES 2.0 included — and costs a handful of rectangles. Sizes are in design units.

| Field | Type | Default | What it is |
|---|---|---|---|
| `offset` | `Vector2` | `{ 0, 4 }` | Where it falls: down a little, as light from above |
| `blur` | `float` | `8` | How far it fades out past the box; 0 = a hard shadow |
| `spread` | `float` | `0` | How much bigger than the box it is before it fades |
| `color` | `Color` | `CLITERAL(Color){ 0, 0, 0, 90 }` | At the box; fainter outwards |

### `TextOutline`

struct TextOutline

struct [include/rmp/ui.h:252](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L252-L255)

An outline around every letter, so a title reads over any background. In design units; drawn as copies of the text around it, so keep it small: 1 to 3.

| Field | Type | Default | What it is |
|---|---|---|---|
| `width` | `float` | `1` | How far it reaches past each letter, in design units |
| `color` | `Color` | `CLITERAL(Color){ 0, 0, 0, 255 }` | Its colour |

### `TextShadow`

struct TextShadow

struct [include/rmp/ui.h:258](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L258-L261)

A copy of the text under it, offset: the shadow of a letter.

| Field | Type | Default | What it is |
|---|---|---|---|
| `offset` | `Vector2` | `{ 1, 2 }` | Design units |
| `color` | `Color` | `CLITERAL(Color){ 0, 0, 0, 160 }` | Its colour |

### `Skin`

struct Skin

struct [include/rmp/ui.h:267](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L267-L273)

Pictures instead of a flat colour, one per state. Only `normal` is needed: a state without its own picture shows `normal`, tinted the way the colours of that state would be — lighter under the pointer, darker pressed, grey disabled. Give the others when the artist drew them.

| Field | Type | Default | What it is |
|---|---|---|---|
| `normal` | `Picture` |  | At rest |
| `hover` | `Picture` |  | Under the pointer |
| `press` | `Picture` |  | Held down |
| `disabled` | `Picture` |  | Enabled = false |
| `focus` | `Picture` |  | Has the keyboard or gamepad focus (the ring is still drawn) |

### `Sounds`

struct Sounds

struct [include/rmp/ui.h:313](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L313-L324)

Sounds, by name. Each event has its own; one that is not set is inherited from what is around it and, at the end, from the Theme. An EMPTY name is silence: `.hover = ""` turns off a hover sound set further out.

| Field | Type | Default | What it is |
|---|---|---|---|
| `hover` | `std::optional<SoundName>` |  | The pointer arrives on a control |
| `press` | `std::optional<SoundName>` |  | The pointer goes down on it |
| `release` | `std::optional<SoundName>` |  | ...and comes up |
| `click` | `std::optional<SoundName>` |  | It was pressed: pointer, Enter, the A button |
| `focus` | `std::optional<SoundName>` |  | The keyboard or gamepad focus arrives |
| `change` | `std::optional<SoundName>` |  | A checkbox, slider, dropdown or field changed |
| `open` | `std::optional<SoundName>` |  | A dropdown opened |
| `close` | `std::optional<SoundName>` |  | ...and closed |
| `shake` | `std::optional<SoundName>` |  | `Shake()`: "no", a wrong password |
| `volume` | `std::optional<float>` |  | 0..1, for all of them; 1 when nobody sets it |

### `Motion`

struct Motion

struct [include/rmp/ui.h:330](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L330-L348)

Movement, which the framework's own themes leave all off: a button that grows under the pointer is a choice of style, and a game that wants it says so here. Nothing here moves the LAYOUT: a control is drawn bigger, lifted or sliding, but it is laid out — and clicked — where it always was.

| Field | Type | Default | What it is |
|---|---|---|---|
| `hover_scale` | `float` | `1` | 1.05: 5% bigger under the pointer |
| `press_scale` | `float` | `1` | 0.95: 5% smaller while held down |
| `hover_lift` | `float` | `0` | How far the box rises under the pointer, in design units, its shadow falling further below it: a card lifting off the table. |
| `speed` | `float` | `0.12f` | How long hover and press take to get there, in seconds. |
| `appear` | `float` | `0` | Arriving: the first frame a box is drawn, it fades in over `appear` seconds, sliding up from `appear_offset` design units below and growing from `appear_scale`. 0 = it is simply there. Panels and overlays are where this is for. |
| `appear_offset` | `float` | `0` | Arriving: the first frame a box is drawn, it fades in over `appear` seconds, sliding up from `appear_offset` design units below and growing from `appear_scale`. 0 = it is simply there. Panels and overlays are where this is for. |
| `appear_scale` | `float` | `1` | Arriving: the first frame a box is drawn, it fades in over `appear` seconds, sliding up from `appear_offset` design units below and growing from `appear_scale`. 0 = it is simply there. Panels and overlays are where this is for. |
| `shake` | `float` | `0.4f` | `Shake()`: how long, and how far side to side, in design units. |
| `shake_strength` | `float` | `8` | `Shake()`: how long, and how far side to side, in design units. |

### `Style`

struct Style

struct [include/rmp/ui.h:365](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L365-L400)

How ONE thing looks: a button, a panel, a label. Every field is optional, and one that is not set comes from around it: the `children` style of the containers it is in (the nearest wins), then the Theme's style for its kind (theme.styles.button, theme.styles.panel...), then the Theme's colours and metrics.

```cpp
const rmp::ui::Style gold{
    .background = GOLD, .text = BLACK, .radius = 0,
    .shadow = rmp::ui::Shadow{}, .text_outline = rmp::ui::TextOutline{ .color = WHITE },
};
rmp::ui::Button buy{ .text = "Buy", .style = gold };
```

`Theme::styles` holds one for every kind of widget, under them all.

Written in the order you would think of them: the box, its spacing, its text, and how it feels. Designated initialisers have to follow that order.

| Field | Type | Default | What it is |
|---|---|---|---|
| `background` | `std::optional<Color>` |  | Its fill. On a button, checkbox, dropdown or field, the hover and press colours are worked out from it — a little lighter, a little darker — unless you give them. |
| `background_hover` | `std::optional<Color>` |  | Its fill. On a button, checkbox, dropdown or field, the hover and press colours are worked out from it — a little lighter, a little darker — unless you give them. |
| `background_press` | `std::optional<Color>` |  | Its fill. On a button, checkbox, dropdown or field, the hover and press colours are worked out from it — a little lighter, a little darker — unless you give them. |
| `background_disabled` | `std::optional<Color>` |  | Its fill. On a button, checkbox, dropdown or field, the hover and press colours are worked out from it — a little lighter, a little darker — unless you give them. |
| `skin` | `std::optional<Skin>` |  | Pictures instead of the fill, per state. See Skin. |
| `tint` | `std::optional<Color>` |  | Multiplies the colours of a skin or an image: WHITE leaves them as drawn. |
| `border` | `std::optional<Color>` |  | The outline's colour; shown when border_width > 0 |
| `border_width` | `std::optional<float>` |  | Design units; 0 = none |
| `radius` | `std::optional<float>` |  | Of the corners, design units; 0 = square |
| `shadow` | `std::optional<Shadow>` |  | Under the box |
| `padding_x` | `std::optional<float>` |  | Inside, left and right |
| `padding_y` | `std::optional<float>` |  | Inside, above and below |
| `gap` | `std::optional<float>` |  | Between the children of a container |
| `text` | `std::optional<Color>` |  | The colour of its text |
| `text_disabled` | `std::optional<Color>` |  | ...when enabled = false |
| `font` | `rmp::Font` |  | A font you loaded: `.font = rmp::assets::load_font("title.ttf", 32)`. The interface draws with that FILE, baked by itself at every size it needs, with any letter a text asks for — so the size you loaded it at does not matter, and the text stays sharp. Empty = inherited. |
| `font_size` | `std::optional<float>` |  | Design units: what `Size::MEDIUM` is here |
| `text_outline` | `std::optional<TextOutline>` |  | A font you loaded: `.font = rmp::assets::load_font("title.ttf", 32)`. The interface draws with that FILE, baked by itself at every size it needs, with any letter a text asks for — so the size you loaded it at does not matter, and the text stays sharp. Empty = inherited. |
| `text_shadow` | `std::optional<TextShadow>` |  | A font you loaded: `.font = rmp::assets::load_font("title.ttf", 32)`. The interface draws with that FILE, baked by itself at every size it needs, with any letter a text asks for — so the size you loaded it at does not matter, and the text stays sharp. Empty = inherited. |
| `motion` | `std::optional<Motion>` |  | How it moves; see Motion |
| `sounds` | `Sounds` |  | Per event; see Sounds |

## The theme

### `Theme`

struct Theme

struct [include/rmp/ui.h:420](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L420-L534)

Every colour and metric the widgets are drawn with. A default-constructed Theme is the dark theme: `theme_dark()` returns exactly that.

| Field | Type | Default | What it is |
|---|---|---|---|
| `background` | `Color` | `CLITERAL(Color){ 18, 18, 22, 255 }` | The colour behind the interface; no widget paints it. [`rmp::app`](https://omardev29.github.io/rmp-docs/reference/namespaces/rmp-app.html) clears every frame with it unless the scene sets [`rmp::Scene::background`](https://omardev29.github.io/rmp-docs/reference/classes/rmp-Scene.html#background); in a plain raylib loop, pass it to `ClearBackground()` yourself. |
| `panel` | `Color` | `CLITERAL(Color){ 30, 30, 38, 255 }` | The fill of `panel()` and of a dropdown's open list. |
| `surface` | `Color` | `CLITERAL(Color){ 44, 44, 56, 255 }` | A NORMAL button at rest, the field of a dropdown and of a text input, a slider's rail, an unticked checkbox's box, and the track of `progress()`. |
| `surface_hover` | `Color` | `CLITERAL(Color){ 60, 60, 76, 255 }` | A NORMAL, OUTLINE or GHOST button under the pointer; also a checkbox's row, a dropdown's field and the items of its open list. |
| `surface_press` | `Color` | `CLITERAL(Color){ 26, 26, 34, 255 }` | What surface_hover paints, while the pointer is held down on it. |
| `border` | `Color` | `CLITERAL(Color){ 70, 70, 88, 255 }` | The outline of an OUTLINE button, of an unticked checkbox's box and of a dropdown's open list; and, when border_width > 0, of a NORMAL button and of a panel that has no border of its own. |
| `text` | `Color` | `CLITERAL(Color){ 235, 235, 242, 255 }` | [`Text()`](https://omardev29.github.io/rmp-docs/reference/classes/rmp-Text.html) with `ColorRole::TEXT`, the label of a NORMAL, OUTLINE or GHOST button, the labels of the controls, and what a dropdown or a text input shows. |
| `text_muted` | `Color` | `CLITERAL(Color){ 150, 150, 168, 255 }` | [`Text()`](https://omardev29.github.io/rmp-docs/reference/classes/rmp-Text.html) with `ColorRole::MUTED`, a slider's percentage, and the placeholder of an empty text input. |
| `text_on_accent` | `Color` | `CLITERAL(Color){ 255, 255, 255, 255 }` | The label of a PRIMARY or DANGER button, and the dot of a ticked checkbox. |
| `primary` | `Color` | `CLITERAL(Color){ 88, 120, 245, 255 }` | A PRIMARY button at rest, `text()` with `ColorRole::PRIMARY`, a ticked checkbox, the filled part of a slider, and the bar of `progress()`. |
| `primary_hover` | `Color` | `CLITERAL(Color){ 110, 140, 255, 255 }` | A PRIMARY button under the pointer. |
| `primary_press` | `Color` | `CLITERAL(Color){ 70, 98, 210, 255 }` | A PRIMARY button while the pointer is held down on it. |
| `danger` | `Color` | `CLITERAL(Color){ 220, 72, 80, 255 }` | A DANGER button at rest, and `text()` with `ColorRole::DANGER`. |
| `danger_hover` | `Color` | `CLITERAL(Color){ 236, 96, 104, 255 }` | A DANGER button under the pointer. |
| `danger_press` | `Color` | `CLITERAL(Color){ 184, 56, 64, 255 }` | A DANGER button while the pointer is held down on it. |
| `disabled` | `Color` | `CLITERAL(Color){ 60, 60, 70, 255 }` | The fill of a control whose `enabled` is false: a button, a checkbox's box, a slider's filled part, a text input's field. |
| `disabled_text` | `Color` | `CLITERAL(Color){ 110, 110, 124, 255 }` | The label of a control whose `enabled` is false, and the value a disabled dropdown or text input shows. |
| `focus` | `Color` | `CLITERAL(Color){ 130, 170, 255, 255 }` | The outline on whatever the keyboard or gamepad is pointing at. Without it a controller build is unusable, so it is a theme colour rather than something each widget decides. |
| `font_size` | `float` | `RMP_UI_FONT_SIZE` | `[ui] font_size` |
| `font_size_small` | `float` | `RMP_UI_FONT_SIZE * 0.8f` | `Size::SMALL` |
| `font_size_large` | `float` | `RMP_UI_FONT_SIZE * 1.4f` | `Size::LARGE` |
| `padding_x` | `float` | `20` | Inside a button, left and right of the label |
| `padding_y` | `float` | `12` | Inside a button, above and below the label |
| `gap` | `float` | `12` | Between siblings |
| `panel_padding` | `float` | `20` | Inside a `panel()`, and around what `begin()` lays out |
| `corner_radius` | `float` | `8` | Of buttons, panels and the controls' fields; 0 = square |
| `border_width` | `float` | `0` | 0 = the default Theme draws no borders |
| `control_size` | `float` | `22` | A checkbox's box; the height of a slider's drag area |
| `track_thickness` | `float` | `6` | A slider's rail |
| `focus_ring` | `float` | `2` | The outline on the focused control |
| `transition` | `float` | `0.12f` | How long a control takes to reach its new colour, in seconds. Nothing about the layout moves — only colour — so this can never make a button arrive somewhere else than where you clicked. 0 turns it off, which is both the "reduce motion" setting and what a test wants. |
| `min_touch_size` | `float` | `44` | The shortest a button can be. It follows the button's type size, so a SMALL one may be shorter, except on Android and iOS, where no button is. 44 design units is Apple's touch target guidance and close to Material's 48dp — it is the difference between a menu you can use with a thumb and one you cannot. |
| `sounds` | `Sounds` | `{}` | Sounds and motion every widget starts from. Silent in `theme_dark()` and `theme_light()`; the motion they have is the buttons' and the panels', in `styles` below. |
| `motion` | `Motion` | `{}` | Sounds and motion every widget starts from. Silent in `theme_dark()` and `theme_light()`; the motion they have is the buttons' and the panels', in `styles` below. |
| `styles` |  | `{}` | One Style per kind of widget, under every widget of it |

### `current_theme`, `set_theme`

const Theme &current_theme()

void set_theme(const Theme &t)

function [include/rmp/ui.h:544](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L544)

The theme every widget is drawn with: `current_theme()` reads it, `set_theme()` copies a new one over it. There is one stored copy, so the reference `current_theme()` returns sees every later `set_theme()`, and a widget drawn after the call already uses the new one. Both work at any time, before the window exists too; until the first `set_theme()` it is the one `[ui] theme` names. A metric `set_theme()` is handed that is NaN, below 0 or past 4096 design units (transition: 60 seconds) is the game's mistake: said once by its name, and `theme_dark()`'s is kept in its place.

### `theme_dark`, `theme_light`

Theme theme_dark()

Theme theme_light()

function [include/rmp/ui.h:555](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L555)

The two that come with the framework. Which one starts is `[ui] theme` in raylib_multiplatform.toml; these let you switch at runtime, which is what an in-game "appearance" setting does:

```cpp
if (rmp::ui::checkbox("Light Theme", light))
    rmp::ui::set_theme(light ? rmp::ui::theme_light() : rmp::ui::theme_dark());
```

They return a copy, so the usual copy-modify-set still applies on top.

## Fonts

### `set_font`

void set_font(std::string_view name)

void set_font(const rmp::Font &font)

function [include/rmp/ui.h:572](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L572)

The global font, by its name in resources/ ("" = raylib's built-in one).

### `font_name`

std::string_view font_name()

function [include/rmp/ui.h:577](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L577)

The global font's name right now: the last `set_font()`, or `[ui] font`.

## Scale

### `scale`

float scale()

function [include/rmp/ui.h:597](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L597)

The factor in use right now.

### `set_scale`

void set_scale(float s)

function [include/rmp/ui.h:602](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L602)

Pin it, above 0 and at most 16. 0 goes back to automatic; NaN or below 0 is a mistake, said once, and automatic too, and past 16 is 16, said once. This is how you would implement an "interface size" accessibility option.

## Breakpoints

### `Breakpoint`

enum class Breakpoint

enum [include/rmp/ui.h:631](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L631)

The shape of the screen, by width / height: COMPACT below 1 (taller than it is wide), MEDIUM from 1 up to 1.6, EXPANDED at 1.6 and wider.

| Value |  | Means |
|---|---|---|
| `COMPACT` |  |  |
| `MEDIUM` |  |  |
| `EXPANDED` |  |  |

### `current_breakpoint`

Breakpoint current_breakpoint()

function [include/rmp/ui.h:637](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L637)

Which Breakpoint the game's area is right now: the window, or under [`rmp::app::Stretch::LETTERBOX`](https://omardev29.github.io/rmp-docs/reference/namespaces/rmp-app.html#Stretch-LETTERBOX) the world inside its bars — the design's shape, whatever the window does. It reads the size when it is called, so it needs no `begin()` first; a window with no height yet is MEDIUM.

### `compact`

bool compact()

function [include/rmp/ui.h:640](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L640)

Shorthand for the case that comes up: `current_breakpoint()` == `Breakpoint::COMPACT`.

## The frame

### `FrameOptions`

struct FrameOptions

struct [include/rmp/ui.h:649](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L649-L676)

How `begin()` lays out the frame: a root that fills the screen, holding one column that everything you declare goes into. The defaults are the centred menu that `begin()` with no arguments opens.

| Field | Type | Default | What it is |
|---|---|---|---|
| `placement` | `Align` | `Align::CENTER` | Where the root's content sits |
| `gap` | `float` | `-1` | Between children; -1 = the theme's |
| `padding` | `float` | `-1` | Inside the root; -1 = the theme's |
| `grow` | `bool` | `false` | False: the column FITS what is in it, so a child that grows fills the column and no more — which is what makes the buttons of a menu one width. true: the column fills the window, less the padding, on both axes, so a child with grow_x or grow_y reaches the edges: a sidebar and a content area that take the whole screen. What does not grow is still placed by `placement`. `rmp::ui::begin({ .grow = true }); rmp::ui::row({ .grow_x = true, .grow_y = true }, [&] { side(); main(); }); rmp::ui::end();` |
| `focus_first` | `std::optional<bool>` | `{}` | Whether the frame's first control takes the focus by itself, so that Enter and the A button press it the moment it appears. Left unset, the framework decides: yes — which is what keeps a menu three functions long — unless the scene drawing it reads the keys the interface navigates with (Enter, Space, the arrows, Tab, the d-pad, the A button, the left stick) through [`rmp::input`](https://omardev29.github.io/rmp-docs/reference/namespaces/rmp-input.html). That scene is being played, so this is a HUD over it: its controls take no focus and no key until the player presses Tab, and Escape, the B button or a click elsewhere hands the keys back to the game. true or false decides it yourself. `rmp::ui::begin({ .placement = rmp::ui::Align::TOP_RIGHT, .focus_first = false });` |

### `begin`

void begin()

void begin(const FrameOptions &o)

function [include/rmp/ui.h:680](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L680)

Open the UI for this frame. The default is a centred column, which is what makes a main menu three functions.

### `end`

void end()

function [include/rmp/ui.h:685](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L685)

Lay out, resolve interaction, and draw. Call it between `BeginDrawing()` and `EndDrawing()`.

## Overlays

### `OverlayOptions`

struct OverlayOptions

struct [include/rmp/ui.h:715](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L715-L725)

How `overlay()` covers what is under it, and where its content goes.

| Field | Type | Default | What it is |
|---|---|---|---|
| `placement` | `Align` | `Align::CENTER` | Where its content sits, as `FrameOptions::placement` |
| `blur` | `float` | `0` | How far to blur what is underneath: the Gaussian's standard deviation in design units, as CSS's `blur()` means it; 0 = no blur, which costs one rectangle. A real blur on every GPU raylib drives, OpenGL ES 2.0 and WebGL included. raylib's software renderer has no shaders, so there — and wherever a shader cannot be built — the veil comes alone. |
| `dim` | `float` | `0.45f` | 0..1: how far what is underneath goes towards `veil` |
| `veil` | `Color` | `CLITERAL(Color){ 0, 0, 0, 255 }` | What it is dimmed towards |

### `overlay`

template <class Body> void overlay(const OverlayOptions &o, Body &&body)

template <class Body> void overlay(Body &&body)

function [include/rmp/ui.h:744](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L744-L748)

A frame in front of everything drawn before it. See above.

## Widgets

### `ButtonOptions`

struct ButtonOptions

struct [include/rmp/ui.h:758](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L758-L769)

How a `button()` looks, how big it is, and whether it can be pressed.

| Field | Type | Default | What it is |
|---|---|---|---|
| `style` | `Variant` | `Variant::NORMAL` | What it means; the theme picks its colours |
| `size` | `detail::Sizing` | `{}` | One of the three steps, or a number of design units. The padding and the minimum touch height follow the type size, so a large button is a large button all over rather than a normal one with bigger letters. |
| `enabled` | `bool` | `true` | False = the theme's disabled colours; no press, no focus |
| `id` | `std::string_view` | `{}` | Only needed when two buttons share a label AND the UI is conditional. Identical labels in one frame are already told apart automatically. Empty means none. It is hashed on the spot, so a temporary is fine. |

### `TextOptions`

struct TextOptions

struct [include/rmp/ui.h:772](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L772-L776)

How `text()` paints a string: its colour, its size, and whether it wraps.

| Field | Type | Default | What it is |
|---|---|---|---|
| `color` | `ColorRole` | `ColorRole::TEXT` | Which theme colour it is painted in |
| `size` | `detail::Sizing` | `{}` | A step, a number, or nothing for the theme's |
| `wrap` | `bool` | `true` | Break between words to fit; false = never broken to fit |

### `RichTextOptions`

struct RichTextOptions

struct [include/rmp/ui.h:787](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L787-L793)

Text with markup, drawn a letter at a time: Yarn's markup, which a dialogue line already carries --

```cpp
rmp::ui::rich_text("A [wave]strange[/wave] [color=#ffcc00]light[/color]!");
```

```text
[b]           bold                [color=#rrggbb] or [color=red]
[size=30]     in design units     [wave] [shake] [rainbow]: moving letters
```

Its `visible` letters, the rest held back: a typewriter counts them up.

| Field | Type | Default | What it is |
|---|---|---|---|
| `width` | `float` | `0` | Wrap at this many design units; 0 = the width it is given |
| `size` | `detail::Sizing` | `{}` | A step, a number, or nothing for the theme's |
| `color` | `ColorRole` | `ColorRole::TEXT` | The colour of what no `[color] paints` |
| `visible` | `int` | `-1` | How many letters show; -1 = every one |
| `id` | `std::string_view` | `{}` | As `ButtonOptions::id:` two with one text |

### `rich_text`

void rich_text(const rmp::Text &text)

void rich_text(const rmp::Text &text, const RichTextOptions &o)

function [include/rmp/ui.h:794](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L794)

### `rich_text_length`

int rich_text_length(const rmp::Text &text)

function [include/rmp/ui.h:798](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L798)

How many letters a rich text has once its markup is gone: where a typewriter stops.

### `button`

bool button(const rmp::Text &label)

bool button(const rmp::Text &label, const ButtonOptions &o)

function [include/rmp/ui.h:805](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L805)

True on the frame it is pressed: the pointer released over it, or, while it has the focus, Enter or the gamepad's accept button. Reads as it looks:

```cpp
if (rmp::ui::button("Play")) play();
```

### `ImageButtonOptions`

struct ImageButtonOptions

struct [include/rmp/ui.h:810](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L810-L817)

How `image_button()` is sized, and whether it can be pressed. Sizes are in design units.

| Field | Type | Default | What it is |
|---|---|---|---|
| `width` | `float` | `0` | 0 = the picture's own width, scaled |
| `height` | `float` | `0` | 0 = the picture's own height, scaled |
| `enabled` | `bool` | `true` | False = the disabled tint; no press, no focus |
| `id` | `std::string_view` | `{}` | It has no label to be told apart by, so two image buttons that come and go are told apart by this. Empty = by its order among the unnamed ones. |

### `image_button`

bool image_button(const Picture &picture)

bool image_button(const Picture &picture, const ImageButtonOptions &o)

function [include/rmp/ui.h:825](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L825)

A button that is a picture: an icon, an inventory slot, a skinned "Play" drawn by your artist. Pressed like `button()`, focusable like `button()`, and it wears theme.styles.button — its skin behind the picture, its sounds.

```cpp
if (rmp::ui::image_button(gear)) open_settings();
```

### `text`

void text(const rmp::Text &s)

void text(const rmp::Text &s, const TextOptions &o)

function [include/rmp/ui.h:832](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L832)

The string is copied immediately, so a temporary is safe:

```cpp
rmp::ui::text(std::to_string(score));
```

## Containers

### `BoxOptions`

struct BoxOptions

struct [include/rmp/ui.h:859](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L859-L878)

Shared by every container. All measurements are in design units and are scaled; -1 means "whatever the theme says".

| Field | Type | Default | What it is |
|---|---|---|---|
| `gap` | `float` | `-1` | Between children |
| `padding` | `float` | `-1` | Inside this container; -1 = none, panel_padding in a panel |
| `items` | `Align` | `Align::CENTER` | Where children sit in the leftover space |
| `grow_x` | `bool` | `false` | Sizing is interleaved by axis — x then y — rather than grouped by kind, and that is not cosmetic. Designated initialisers have to be written in declaration order, so grouping them as grow_x, grow_y, width, height would make { .width = 240, .grow_y = true } illegal: a fixed-width sidebar that fills the height, which is about the most ordinary thing anyone writes. This way round, every combination is legal. |
| `width` | `float` | `0` | > 0 = a fixed width, overriding fit/grow |
| `grow_y` | `bool` | `false` | Fill the parent's height instead of fitting content |
| `height` | `float` | `0` | > 0 = a fixed height, overriding fit/grow |
| `id` | `std::string_view` | `{}` | A stable name for the container: the same element from frame to frame, whatever else is on screen. Nothing in `rmp::ui` needs it — it is for a test that finds an element by name, as tests/ui_layout_test.cpp does. Unnamed containers are anonymous, which is what almost all of them want. |

### `PanelOptions`

struct PanelOptions

struct [include/rmp/ui.h:881](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L881-L891)

A panel is a box with a background, which is what makes it visible.

| Field | Type | Default | What it is |
|---|---|---|---|
| `box` | `BoxOptions` | `{}` | The layout, as `column()` takes it, except that a padding of -1 is the theme's panel_padding rather than none. |
| `background` | `Color` | `CLITERAL(Color){ 0, 0, 0, 0 }` | {0,0,0,0} = the theme's panel |
| `radius` | `float` | `-1` | -1 = the theme's |
| `border` | `Color` | `CLITERAL(Color){ 0, 0, 0, 0 }` | {0,0,0,0} = the theme's border, drawn only when the theme's border_width is above 0 (it is 1 in `theme_light()`, 0 in `theme_dark()`). |
| `border_width` | `float` | `-1` | Of `border`, when set; -1 = 1 design unit |

### `ImageOptions`

struct ImageOptions

struct [include/rmp/ui.h:900](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L900-L905)

How `image()` sizes and tints a texture. Sizes are in design units.

| Field | Type | Default | What it is |
|---|---|---|---|
| `grow` | `bool` | `false` | Fill the space available |
| `width` | `float` | `0` | Otherwise: 0 = the texture's own width, scaled |
| `height` | `float` | `0` | 0 = the texture's own height, scaled |
| `tint` | `Color` | `WHITE` | Multiplies the texture's colours; WHITE leaves them as they are |

### `ProgressOptions`

struct ProgressOptions

struct [include/rmp/ui.h:908](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L908-L915)

How `progress()` sizes and colours its bar. Sizes are in design units.

| Field | Type | Default | What it is |
|---|---|---|---|
| `width` | `float` | `0` | 0 = fill the space available |
| `height` | `float` | `-1` | -1 = derived from the theme's font size |
| `radius` | `float` | `-1` | -1 = half the height, for round ends |
| `fill` | `Color` | `CLITERAL(Color){ 0, 0, 0, 0 }` | {0,0,0,0} = the theme's primary |
| `track` | `Color` | `CLITERAL(Color){ 0, 0, 0, 0 }` | {0,0,0,0} = the theme's surface |
| `id` | `std::string_view` | `{}` | Names the bar, as `BoxOptions::id` names a container |

### `row`

template <class Body> void row(const BoxOptions &o, Body &&body)

template <class Body> void row(Body &&body)

function [include/rmp/ui.h:942](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L942-L946)

Left to right.

### `column`

template <class Body> void column(const BoxOptions &o, Body &&body)

template <class Body> void column(Body &&body)

function [include/rmp/ui.h:952](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L952-L956)

Top to bottom.

### `panel`

template <class Body> void panel(const PanelOptions &o, Body &&body)

template <class Body> void panel(Body &&body)

function [include/rmp/ui.h:962](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L962-L966)

A column with a background and padding: the thing you put a dialog in.

### `center`

template <class Body> void center(Body &&body)

function [include/rmp/ui.h:972](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L972-L976)

Takes all the space it is given and puts its contents in the middle of it.

### `stack`, `layer`

template <class Body> void stack(Body &&body)

template <class Body> void layer(Body &&body)

function [include/rmp/ui.h:987](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L987-L991)

Layers, drawn back to front. Each child has to be a `layer()`:

```cpp
rmp::ui::stack([&]{
    rmp::ui::layer([&]{ rmp::ui::image(background); });
    rmp::ui::layer([&]{ rmp::ui::text("PAUSED");   });
});
```

The explicit `layer()` is not ceremony — it is what tells the layout which things are supposed to overlap and which are ordinary children.

### `spacer`

void spacer()

void spacer(float fixed)

function [include/rmp/ui.h:1005](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1005)

Eats the space left over, which is how you push things apart:

```cpp
rmp::ui::row({ .grow_x = true }, []{
    rmp::ui::text("Health");
    rmp::ui::spacer();          // <- shoves the score to the right
    rmp::ui::text("999");
});
```

## More widgets

### `image`

void image(const Texture2D &texture)

void image(const Texture2D &texture, const ImageOptions &o)

void image(const Picture &picture)

void image(const Picture &picture, const ImageOptions &o)

void image(const rmp::Texture &texture)

void image(const rmp::Texture &texture, const ImageOptions &o)

function [include/rmp/ui.h:1020](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1020)

The Texture2D is copied on the way in, so the struct you pass may be a temporary. What the copy holds is a GPU handle, though, so the texture itself has to stay loaded until `end()` has drawn the frame: keep the [`rmp::Texture`](https://omardev29.github.io/rmp-docs/reference/namespaces/rmp.html#Texture) that owns it, as a member or a global. A temporary [`rmp::Texture`](https://omardev29.github.io/rmp-docs/reference/namespaces/rmp.html#Texture) does not compile here — `image(rmp::assets::load_texture("icon.png"))` would unload the texture at the semicolon. By default it is drawn at its own size, scaled with the rest of the UI.

### `progress`

void progress(float fraction)

void progress(float fraction, const ProgressOptions &o)

function [include/rmp/ui.h:1032](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1032)

A bar. `fraction` is 0..1 and is clamped; NaN — hp / max_hp with no max_hp — is an empty bar, said once.

## Grid and scroll

### `GridOptions`

struct GridOptions

struct [include/rmp/ui.h:1041](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1041-L1052)

How `grid()` counts its columns, spaces its cells, and how much room it takes. Measurements are in design units, and -1 means the default given beside it.

| Field | Type | Default | What it is |
|---|---|---|---|
| `columns` | `int` | `0` | 0 = as many as fit, at least one, recomputed as the window changes |
| `min_cell` | `float` | `96` | Only used when columns = 0 |
| `gap` | `float` | `-1` | Between cells and between rows; -1 = the theme's |
| `padding` | `float` | `-1` | Inside the grid; -1 = none |
| `grow_x` | `bool` | `true` | A grid almost always wants the width it is offered |
| `grow_y` | `bool` | `false` | Fill the parent's height instead of fitting the rows |
| `id` | `std::string_view` | `{}` | A name for the grid. columns = 0 reads the width the grid had last frame and finds it by this name; without one, by its order among the unnamed grids of the pass, which a grid that comes and goes before it changes. |

### `ScrollOptions`

struct ScrollOptions

struct [include/rmp/ui.h:1056](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1056-L1071)

How `scroll()` clips its contents, spaces them, and how much room it takes. Measurements are in design units, and -1 means the default given beside it.

| Field | Type | Default | What it is |
|---|---|---|---|
| `horizontal` | `bool` | `false` | Vertical by default, which is what lists want |
| `vertical` | `bool` | `true` | Clip and scroll top to bottom |
| `gap` | `float` | `-1` | Between children; -1 = the theme's |
| `padding` | `float` | `-1` | Inside the area; -1 = none |
| `grow_x` | `bool` | `true` | Fill the parent's width |
| `width` | `float` | `0` | > 0 = a fixed width, overriding grow_x |
| `grow_y` | `bool` | `true` | Fill the parent's height, and clip there. In a parent that fits its contents, that is the room left in the window: the rows never push it. |
| `height` | `float` | `0` | > 0 = a fixed height, overriding grow_y |
| `id` | `std::string_view` | `{}` | A name for the area. Without one it is told apart by its order among the unnamed scroll areas of the pass, so an area that comes and goes before it changes which one it is. |

### `grid`

template <class Body> void grid(const GridOptions &o, Body &&body)

function [include/rmp/ui.h:1117](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1117-L1121)

Equal columns, as many rows as it takes. Each item goes in a `cell()`, which is what lets the grid count them and start a new row at the right moment — the layout engine underneath wraps text, not elements, so the rows are real rows.

```cpp
rmp::ui::grid(4, [&]{
    for (auto &item : inventory)
        rmp::ui::cell([&]{ rmp::ui::image(item.icon); });
});
```

With columns = 0 it works out how many fit in the width it has and works it out again when the window changes, which is what an inventory should do rather than staying at the number someone typed on a desktop.

### `cell`, `grid`

template <class Body> void cell(Body &&body)

template <class Body> void grid(int columns, Body &&body)

template <class Body> void grid(Body &&body)

function [include/rmp/ui.h:1124](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1124-L1128)

One item in a grid. Every child of a grid has to be one.

### `scroll`

template <class Body> void scroll(const ScrollOptions &o, Body &&body)

template <class Body> void scroll(Body &&body)

function [include/rmp/ui.h:1138](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1138-L1142)

Clips its contents and scrolls them. The wheel works, and so does dragging with a finger — the same gesture on a phone.

## Controls that own a value

### `CheckboxOptions`

struct CheckboxOptions

struct [include/rmp/ui.h:1162](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1162-L1165)

Whether a `checkbox()` can be toggled, and the name that tells it apart.

| Field | Type | Default | What it is |
|---|---|---|---|
| `enabled` | `bool` | `true` | False = the theme's disabled colours; no toggle, no focus |
| `id` | `std::string_view` | `{}` | As `ButtonOptions::id:` for a shared label |

### `SliderOptions`

struct SliderOptions

struct [include/rmp/ui.h:1168](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1168-L1174)

How a `slider()` is sized, stepped and shown. Sizes are in design units.

| Field | Type | Default | What it is |
|---|---|---|---|
| `width` | `float` | `0` | 0 = fill the space available |
| `step` | `float` | `0` | 0 = continuous; otherwise snap to multiples |
| `enabled` | `bool` | `true` | False = the theme's disabled colours; no drag, no focus |
| `show_value` | `bool` | `true` | Draw the position, as a percentage, after the bar |
| `id` | `std::string_view` | `{}` | As `ButtonOptions::id:` for a shared label |

### `DropdownOptions`

struct DropdownOptions

struct [include/rmp/ui.h:1177](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1177-L1181)

How a `dropdown()` is sized, and whether it can be opened.

| Field | Type | Default | What it is |
|---|---|---|---|
| `width` | `float` | `0` | Of the field, in design units; 0 = fill the space available |
| `enabled` | `bool` | `true` | False = the disabled text colour; no opening, no focus |
| `id` | `std::string_view` | `{}` | As `ButtonOptions::id:` for a shared label |

### `TextInputOptions`

struct TextInputOptions

struct [include/rmp/ui.h:1185](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1185-L1197)

How a `text_input()` is sized, what it shows while it is empty, and how much it takes.

| Field | Type | Default | What it is |
|---|---|---|---|
| `width` | `float` | `0` | Of the field, in design units; 0 = fill the space available |
| `enabled` | `bool` | `true` | False = the theme's disabled colours; no typing, no focus |
| `placeholder` | `rmp::Text` | `{}` | Shown in the theme's text_muted while the field is empty and does not have the focus. It is copied, so a temporary is fine. |
| `id` | `std::string_view` | `{}` | As `ButtonOptions::id:` for a shared label |
| `max_length` | `int` | `0` | The most CHARACTERS it holds — what the player counts, so an "é" is one and not the two bytes it takes. 0 = no limit. Typing stops at it, and a longer value you hand in is cut to it on the frame the field is drawn, never inside a character. |

### `checkbox`

bool checkbox(const rmp::Text &label, bool &value)

bool checkbox(const rmp::Text &label, bool &value, const CheckboxOptions &o)

function [include/rmp/ui.h:1201](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1201)

A box that flips `value` when it is clicked, or activated from the keyboard or a gamepad while it has the focus. True on the frame it flipped.

### `slider`

bool slider(const rmp::Text &label, float &value, float min, float max)

bool slider(const rmp::Text &label, float &value, float min, float max, const SliderOptions &o)

function [include/rmp/ui.h:1211](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1211)

A bar that sets `value` between min and max: dragged, or moved with left and right while it has the focus, one `step` (or 5% of the range) per press, then twelve a second while held. `value` is clamped to the range, and snapped to `step` when there is one, on every call; true on any frame that changed it. Nothing is drawn when max <= min — nor when an end is NaN or an infinity, which is said once. A value that is NaN is set to min, and a step that is not a positive number is none, each said once.

### `dropdown`

bool dropdown(const rmp::Text &label, int &selected, std::span<const std::string_view> items)

bool dropdown(const rmp::Text &label, int &selected, std::span<const std::string_view> items, const DropdownOptions &o)

bool dropdown(const rmp::Text &label, int &selected, std::initializer_list<rmp::Text> items)

bool dropdown(const rmp::Text &label, int &selected, std::initializer_list<rmp::Text> items, const DropdownOptions &o)

function [include/rmp/ui.h:1226](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1226-L1227)

`selected` is the index into `items`, and is kept inside it.

```cpp
rmp::ui::dropdown("Quality", quality, { "Low", "Medium", "High" });
```

A list written in place, as above, or any array of string_views you keep — std::array, std::vector, a C array — they are copied on the way in. A click, or Enter or the A button while it has the focus, opens the list. Open and focused, up and down walk its items instead of moving the focus, Enter or A picks the one they are on, and Escape or B closes it without changing anything. True on the frame `selected` changed. Nothing is drawn for an empty list.

### `text_input`

bool text_input(const rmp::Text &label, std::string &value)

bool text_input(const rmp::Text &label, std::string &value, const TextInputOptions &o)

function [include/rmp/ui.h:1245](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1245)

Edits your string, in UTF-8 — what the player types goes on the end, and Backspace takes off the last character, never half of one — and only while the field has the keyboard; `TextInputOptions::max_length` caps it. True on the frame it changed. It takes the keyboard when it is clicked, when the focus is moved onto it (Tab, the arrows, the d-pad, `focus()`), or when Enter, Space or the A button is pressed while it has the focus — but not from the focus a screen gives its first control by itself. It gives it back on Enter or the A button (Space is typed), on Escape or the B button, and on a click anywhere else; the focus stays on it. Tab, up and down move the focus on from a field as from any other control, and take the keyboard with them.

## Over the world, over a control, over everything

### `AtOptions`

struct AtOptions

struct [include/rmp/ui.h:1258](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1258-L1264)

Where `at()` puts its box, relative to the point it follows.

| Field | Type | Default | What it is |
|---|---|---|---|
| `anchor` | `Align` | `Align::BOTTOM_CENTER` | The point of the box that sits on the world position: BOTTOM_CENTER puts the box above it, which is where a health bar or a name goes. |
| `offset` | `Vector2` | `{ 0, 0 }` | Design units, after projecting: { 0, -8 } lifts it |
| `id` | `std::string_view` | `{}` | A stable name for the box, as `BoxOptions::id` |

### `at`

template <class Body> void at(Vector2 world, const AtOptions &o, Body &&body)

template <class Body> void at(Vector2 world, Body &&body)

function [include/rmp/ui.h:1295](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1295-L1299)

A box over a point of the WORLD, wherever the scene's camera shows it — zoomed, scrolled, shaken and stretched with it. Between `begin()` and `end()`, in the scene's `_draw()`, like everything else here:

```cpp
rmp::ui::begin();
for (const rmp::Handle<Enemy> &e : enemies)
    if (e) rmp::ui::at(e->position, [&] { rmp::ui::progress(e->hp / 10.0f); });
rmp::ui::end();
```

What it paints does not take the pointer: a click on the enemy under its health bar still reaches the enemy. A control inside it is a control like any other — it can be clicked and focused where it is drawn. While the point is off the screen the box is not drawn at all, and nothing in it takes the pointer, the focus or the keys. Without scenes there is no camera, and the world is the screen.

## Dialogue presenters

### `Portrait`

struct Portrait

struct [include/rmp/ui.h:1336](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1336-L1340)

A speaker's picture, and one for each mood a line's #mood:happy names.

| Field | Type | Default | What it is |
|---|---|---|---|
| `speaker` | `std::string` |  | The name before the colon of a line: "Mika" |
| `mood` | `std::string` | `{}` | Empty: the picture for any mood without its own |
| `picture` | `Picture` | `{}` | A texture, an atlas region, a sprite's frame or a nine-slice |

### `Speaker`

struct Speaker

struct [include/rmp/ui.h:1344](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1344-L1350)

Who speaks, as they look and sound: their lines in a box of their own, their name plate, their voice. Unset fields are the presenter's.

| Field | Type | Default | What it is |
|---|---|---|---|
| `name` | `std::string` |  | The name before the colon of a line: "Mika" |
| `blip` | `SoundName` | `{}` | Their blip; empty: the flow's |
| `pitch` | `float` | `1` | Their blip's pitch: 1.3 higher, 0.8 lower |
| `style` | `Style` | `{}` | Over the presenter's style, for their lines |
| `name_style` | `Style` | `{}` | Over the presenter's name_style |

### `DialogueSide`

enum class DialogueSide

enum [include/rmp/ui.h:1353](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1353-L1356)

Which side of the box a portrait sits on.

| Value |  | Means |
|---|---|---|
| `LEFT` |  | Before the line |
| `RIGHT` |  | After it |

### `DialogueChoices`

enum class DialogueChoices

enum [include/rmp/ui.h:1359](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1359-L1363)

Where a box puts the choices.

| Value |  | Means |
|---|---|---|
| `IN_BOX` |  | In the box, in place of the line |
| `ABOVE` |  | In a panel of their own above the box, at its right |
| `CENTER` |  | In a panel in the middle of the screen |

### `DialogueFlow`

struct DialogueFlow

struct [include/rmp/ui.h:1366](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1366-L1376)

How a presenter types a line out, and goes on.

| Field | Type | Default | What it is |
|---|---|---|---|
| `letters_per_second` | `float` | `45` | The typewriter; 0 = the whole line at once |
| `blip` | `SoundName` | `{}` | A sound as the letters appear |
| `blip_every` | `int` | `2` | Letters between two blips |
| `blip_jitter` | `float` | `0` | Each blip's pitch moves by up to this: 0.08 = 8 % |
| `auto_advance` | `float` | `0` | Seconds a whole line stays before it goes on; 0 = wait |
| `skip_seen` | `bool` | `false` | A line already read goes by at once |
| `voices` | `std::string` | `{}` | A recorded line: the sound named voices + its id ("vo/hello") |
| `choice_seconds` | `float` | `0` | A timed choice: seconds to choose; 0 = no timer |
| `default_choice` | `int` | `0` | What a timed choice takes when the time is up |

### `DialogueMemory`

struct DialogueMemory

struct [include/rmp/ui.h:1379](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1379-L1399)

What a presenter remembers from one frame to the next.

| Field | Type | Default | What it is |
|---|---|---|---|
| `line_id` | `std::string` |  | The line on screen |
| `shown` | `float` | `0` | Letters typed so far |
| `length` | `int` | `0` | Letters in the line |
| `waited` | `float` | `0` | Seconds since it was all shown, or of a [pause] |
| `choice_left` | `float` | `0` | Seconds left of a timed choice |
| `blips` | `int` | `0` | Blips played for this line |
| `history` | `std::vector<std::pair<std::string, std::string>>` |  | Speaker, line: read so far |
| `seen` | `std::vector<std::string>` |  | The ids of the lines read |
| `stage` | `std::vector<std::string>` |  | DialogueStage: who is on stage, left to right |
| `entered` | `std::vector<float>` |  | DialogueStage: seconds each has been on stage |
| `focus` | `std::vector<float>` |  | DialogueStage: 0..1, how much each is the speaker |
| `shaking` | `float` | `-1` | DialogueStage: seconds into a `shake()`; -1 = none |
| `shake_strength` | `float` | `0` | ...how far, in design units |
| `shake_seconds` | `float` | `0` | ...how long |
| `flashing` | `float` | `-1` | DialogueStage: seconds into a `flash()`; -1 = none |
| `flash_seconds` | `float` | `0` | ...how long |
| `flash_color` | `Color` | `WHITE` | ...of which colour |
| `showing_history` | `bool` | `false` | `Toggle_history()`: the backlog instead of the box |

### `dialogue_line`

bool dialogue_line(rmp::Dialogue &dialogue, DialogueMemory &memory, const DialogueFlow &flow, const RichTextOptions &text = {})

function [include/rmp/ui.h:1407](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1407-L1408)

A presenter's pieces, for a presenter of your own: the dialogue's line, typed out where the call is in your layout — its `[speed] and` [pause], its blips and recorded voice, auto-advance, skip-seen, and a click or Enter going on (on the line, or the next button it draws after it). True while there is a line. The `flow` blip is the one played: a Speaker's is yours to put in it.

### `dialogue_choices`

bool dialogue_choices(rmp::Dialogue &dialogue, DialogueMemory &memory, const DialogueFlow &flow, const Style &choice_style = {})

function [include/rmp/ui.h:1411](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1411-L1412)

The choices, as buttons in a column where the call is, and a timed choice's bar. True while there are choices.

### `BubbleSpeaker`

struct BubbleSpeaker

struct [include/rmp/ui.h:1441](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1441-L1449)

Who a bubble points at: a speaker by name, and the object that speaks.

| Field | Type | Default | What it is |
|---|---|---|---|
| `name` | `std::string` |  | The speaker of the lines it says |
| `object` | `rmp::Handle<rmp::Object>` | `{}` | What it is drawn over; empty: where the UI puts it |
| `offset` | `Vector2` | `{ 0, -18 }` | From the object's position, in world units |
| `blip` | `SoundName` | `{}` | Their blip; empty: the flow's |
| `pitch` | `float` | `1` | Their blip's pitch |
| `style` | `Style` | `{}` | Over the bubble's style, for their lines |

### `DialogueBubble`

struct DialogueBubble

struct [include/rmp/ui.h:1453](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1453-L1470)

A bubble over the speaker's head, in the world ([`rmp::ui::at()`](https://omardev29.github.io/rmp-docs/reference/namespaces/rmp-ui.html#at)), the choices in it too. The world goes on around it.

| Field | Type | Default | What it is |
|---|---|---|---|
| `speakers` | `std::vector<BubbleSpeaker>` | `{}` | Who says what, and over which object |
| `flow` | `DialogueFlow` | `{}` | The typewriter, the blips, auto-advance, timed choices |
| `width` | `float` | `220` | Design units: the line wraps inside it |
| `tail` | `float` | `10` | Design units: the tail under it, to the speaker; 0 = none |
| `tail_color` | `Color` | `CLITERAL(Color){ 0, 0, 0, 0 }` | The tail's colour; { 0, 0, 0, 0 } = the bubble's background, or the theme's panel. A bubble of art draws its own: give it a tail_picture. |
| `tail_picture` | `Picture` | `{}` | Drawn in the tail's place, 2 tails wide, 1 tall |
| `pauses_world` | `bool` | `false` | The world goes on around a bubble |
| `style` | `Style` | `{}` | The bubble |
| `choice_style` | `Style` | `{}` | Each choice |
| `ours` | `DialogueMemory` |  | Its state between frames; yours to read |

bool show(rmp::Dialogue &dialogue)

Draws the line or the choices, and takes the player's answer. True while the dialogue has something to show.

### `TooltipOptions`

struct TooltipOptions

struct [include/rmp/ui.h:1506](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1506-L1511)

How `tooltip()` places its line, and how long it waits.

| Field | Type | Default | What it is |
|---|---|---|---|
| `side` | `Align` | `Align::TOP_CENTER` | Which side of the control it appears on |
| `delay` | `float` | `0.5f` | Seconds the pointer rests on the control before it shows; infinity: never by the pointer, by the focus alone. |

### `tooltip`

void tooltip(const rmp::Text &text)

void tooltip(const rmp::Text &text, const TooltipOptions &o)

function [include/rmp/ui.h:1522](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1522)

A line about the control declared just before it, shown while the pointer rests on that control, or while the keyboard or gamepad focus is on it:

```cpp
if (rmp::ui::button("Sell")) sell(item);
rmp::ui::tooltip("Gives you half of what it cost");
```

The text is copied. One with no control before it in the frame is reported once and shows nothing. An empty one shows nothing and is no mistake: `tooltip(item.description)` for an item without one.

### `NotifyOptions`

struct NotifyOptions

struct [include/rmp/ui.h:1526](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1526-L1529)

How long `notify()` keeps a message, and its colour.

| Field | Type | Default | What it is |
|---|---|---|---|
| `seconds` | `float` | `3` | On screen for this long, then it fades out |
| `color` | `ColorRole` | `ColorRole::TEXT` | Which theme colour the text is painted in |

### `notify`

void notify(const rmp::Text &text)

void notify(const rmp::Text &text, const NotifyOptions &o)

function [include/rmp/ui.h:1543](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1543)

A short message at the bottom of the screen that goes away by itself: "Saved", "Achievement unlocked". Call it from anywhere — `_update()`, a callback, a frame with no UI — because it only queues: the framework draws what is queued over everything else, and it never takes the pointer or the focus. The newest few are shown, one above the other. (In a game with its own frame hook they are drawn over the frame's first `begin()`/`end()`, there being no telling which `end()` is the last; and a frame of its that describes no interface draws none, so they wait, no older, for the next one that does.)

In a debug build the framework's own warnings arrive here too: a mistake it reports once in the log (an action nobody defined, a widget outside `begin()`/`end()`) is also said on screen, where it cannot scroll past.

## Input, and who gets it

### `wants_pointer`

bool wants_pointer()

function [include/rmp/ui.h:1572](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1572)

The pointer is over the interface, or the interface is using it (dragging a slider). "Over the interface" is over anything it paints as a surface: every control, every box with a background colour or a border (a panel, a progress bar, an open dropdown list), an image, and a scroll area, empty part included — but not where a scroll area has clipped its contents away. Plain text with nothing behind it is NOT: a score drawn over the game does not stop the game being clicked through it.

### `wants_keyboard`

bool wants_keyboard()

function [include/rmp/ui.h:1580](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1580)

A text field has the keyboard, so the keys are its own: see `text_input()`. Having the focus is not enough — a field the player pressed Enter on keeps the focus and gives the keyboard back. And a HUD over a game being played that the player walked into with Tab, or whose control the game chose with `focus()`, has the keys until Escape, the B button, a click elsewhere or `set_navigation_enabled(false)`: see `FrameOptions::focus_first`.

## Focus, keyboard and gamepad

### `focus`

void focus(std::string_view id)

function [include/rmp/ui.h:1625](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1625)

Give a named control the focus — when a menu opens, or to point a controller at something other than the first control. Pass "" to clear it. A focus asked for by name is drawn straight away: you meant it, and a text field given it takes the keyboard. `id` is the control's label, or its explicit .id.

Outside `begin()`/`end()` — in a scene's `_ready()`, say — it waits for the next frame that draws controls and lands on the first one carrying that name, whichever scene draws it; if that frame has none, the request is dropped and the screen keeps its own default. On a HUD over a game being played it is the game choosing that control, as Tab would be: the keys are the interface's until Escape, the B button or a click elsewhere.

### `focused`

std::string_view focused()

function [include/rmp/ui.h:1628](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1628)

What has the focus right now, or "" if nothing does.

### `set_navigation_enabled`, `navigation_enabled`

void set_navigation_enabled(bool on)

bool navigation_enabled()

function [include/rmp/ui.h:1634](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1634)

Turn keyboard and gamepad navigation off if your game drives focus itself, and ask whether it is on. It starts on. Turning it off also gives back the keys of a HUD the player walked into with Tab, and turning it on again does not take them back.

## Events

### `EventKind`

enum class EventKind

enum [include/rmp/ui.h:1653](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1653-L1665)

What a control did.

| Value |  | Means |
|---|---|---|
| `HOVER` |  | The pointer arrived on it |
| `UNHOVER` |  | ...and left |
| `PRESS` |  | The pointer went down on it |
| `RELEASE` |  | The pointer came up after a PRESS, on it or not |
| `CLICK` |  | It was pressed: released on it, or Enter or the A button with the focus |
| `FOCUS` |  | The keyboard or gamepad focus arrived |
| `BLUR` |  | ...and left |
| `CHANGE` |  | A checkbox, slider, dropdown or text field changed its value |
| `OPEN` |  | A dropdown opened its list |
| `CLOSE` |  | ...and closed it |
| `SHAKE` |  | `Shake()` was called on it |

### `WidgetKind`

enum class WidgetKind

enum [include/rmp/ui.h:1668](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1668-L1678)

Which kind of widget an event came from.

| Value |  | Means |
|---|---|---|
| `BUTTON` |  |  |
| `LABEL` |  |  |
| `IMAGE` |  |  |
| `PANEL` |  |  |
| `CHECKBOX` |  |  |
| `SLIDER` |  |  |
| `DROPDOWN` |  |  |
| `TEXT_INPUT` |  |  |
| `PROGRESS` |  |  |

### `Event`

struct Event

struct [include/rmp/ui.h:1682](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1682-L1686)

One event. `name` is the control's label, or its id when it has one; it is valid during the call only.

| Field | Type | Default | What it is |
|---|---|---|---|
| `kind` | `EventKind` | `EventKind::CLICK` | What happened |
| `widget` | `WidgetKind` | `WidgetKind::BUTTON` | To which kind of widget |
| `name` | `std::string_view` | `{}` | Its label or id |

### `on_event`

void on_event(rmp::Callback<const Event &> hook)

function [include/rmp/ui.h:1690](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1690)

The one hook every event goes to, after its sound. Setting it again replaces it; an empty one — [`rmp::ui::on_event({})`](https://omardev29.github.io/rmp-docs/reference/namespaces/rmp-ui.html#on_event) — turns it off.

## Widgets you keep

### `KeptState`

struct KeptState

struct [include/rmp/ui.h:1729](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1729-L1734)

What a kept widget remembers between frames.

| Field | Type | Default | What it is |
|---|---|---|---|
| `hovered` | `bool` | `false` | The pointer is on it |
| `pressed` | `bool` | `false` | Held down on it |
| `focused` | `bool` | `false` | It has the focus |
| `shakes` | `int` | `0` | `Shake()` calls not yet started |

## Lifecycle

### `shutdown`

void shutdown()

function [include/rmp/ui.h:1997](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/ui.h#L1997)

Called for you by the entry point macro, before `on_exit()` — while the window is still open, because releasing a font after `CloseWindow()` would be touching a GL context that no longer exists.

There is no `init()`: the UI starts itself on the first `begin()`, by which time there is a window. A game that never draws UI allocates nothing.
