# Examples

> The framework's examples: small, complete projects, each showing one part of it, and whole games playable from start to finish.

Source: https://omardev29.github.io/rmp-docs/examples/index.html

The framework comes with 29 examples. Each one is a small, complete project in its own folder under `examples/`, and 9 of them are whole games you can play from start to finish.

Every example is built by CI on every change to the framework, and every one that is a program — the plain C one included — is started, headless, with a screenshot taken of it, and has to boot with every asset loaded, draw and exit cleanly. An example that is a source file with no program in it is compiled, and has nothing to run. None of them can quietly stop working.

From a clone of the framework, `rmp example` lists them, and one runs with its name or its path:

```shell
rmp example
rmp example 01_pong
rmp example games/01_pong
```

## Ads

[**Interstitial**source Full-screen ads between levels: request, check, show, request the next one.](https://omardev29.github.io/rmp-docs/examples/ads/01_interstitial.html) [**Rewarded**source Watch an ad, get a reward — and only if the player actually finished it.](https://omardev29.github.io/rmp-docs/examples/ads/02_rewarded.html)

## Assets

[**Loading**playable Loading by name — the same code whether it comes from loose files or a packed, AES-encrypted resources.rres.](https://omardev29.github.io/rmp-docs/examples/assets/01_loading.html)

## Games

[**Pong**playable rmp::behavior::Ball and Edge::CLAMP, two players, first to seven.](https://omardev29.github.io/rmp-docs/examples/games/01_pong.html) [**Breakout**playable A wall of bricks, and "a brick breaks" as a one-line on_collision — which is exactly why destroy_on_hit is not in the catalogue.](https://omardev29.github.io/rmp-docs/examples/games/02_breakout.html) [**Space invaders**playable Collision layers earning their place, Timer + a callback instead of a shooter behavior, hurt_by deciding what may hurt the ship, and the formation written out — because the formation is Space Invaders.](https://omardev29.github.io/rmp-docs/examples/games/03_space_invaders.html) [**Top down**playable TopDown with eight normalised directions, Follow for the enemies, an HP bar with rmp::ui::progress (and one over every enemy with rmp::ui::at(), wherever it has walked to), and what you can only say with layers: the player's shot misses the player, enemies pass through each other but not walls, and the doorway out sees the player and nothing else.](https://omardev29.github.io/rmp-docs/examples/games/04_top_down.html) [**Endless runner**playable Parallax, Runner, a Spawner by distance and a camera that follows, with a little smoothing.](https://omardev29.github.io/rmp-docs/examples/games/05_endless_runner.html) [**Tetris**playable The honest one: a Tetris is a 10×20 array and the rules of Tetris, and the framework does not pretend otherwise.](https://omardev29.github.io/rmp-docs/examples/games/06_tetris.html) [**Platformer**playable A level designed in LDtk. Three levels side by side in one world — a meadow, a desert, a snowfield — with Kenney's Pixel Platformer art.](https://omardev29.github.io/rmp-docs/examples/games/07_platformer.html) [**Dungeon**playable A dungeon crawler made of the behavior catalogue. Two LDtk levels -- the Crypt and the Sanctum -- in Kenney's Tiny Dungeon art, lit by braziers, gems and the hero's own light in the dark.](https://omardev29.github.io/rmp-docs/examples/games/08_dungeon.html) [**After school**playable An afternoon in town, told in Yarn. The lantern festival is at seven, and whom you talk to -- and what you say -- decides how the evening ends: with Mika at the festival, in the front row of Sora's concert, or at home.](https://omardev29.github.io/rmp-docs/examples/games/09_after_school.html)

## Input

[**Actions**playable Named actions with as many bindings as you like, eight-direction movement in one call, and the routing that stops a finger on a UI button from also firing the gun — which costs no code at all.](https://omardev29.github.io/rmp-docs/examples/input/01_actions.html)

## Platform

[**Mobile raymob**source The raymob mobile API: vibration, soft keyboard, sensors, orientation, app storage.](https://omardev29.github.io/rmp-docs/examples/platform/02_mobile_raymob.html) [**Minimal includes**source The proof that rmp/ui.h stands alone. One translation unit that includes <rmp/ui.h> and nothing else of ours, and no main() on purpose: it is compiled, never linked, and if it stops compiling the header has grown a dependency.](https://omardev29.github.io/rmp-docs/examples/platform/03_minimal_includes.html)

## Scenes

[**Stack**playable The whole model, one scene per file under src/scenes/: a menu that changes to a game, and a game that pushes a pause menu onto itself.](https://omardev29.github.io/rmp-docs/examples/scenes/01_stack.html) [**Stretch**playable [window] stretch, in a window that is not the design's size: a court that is letterboxed, expanded or shown 1:1, a key and a button to go round the three, and a HUD that stays on the court.](https://omardev29.github.io/rmp-docs/examples/scenes/02_stretch.html)

## UI

[**Menu**playable A main menu in three lines, then an options screen, a confirm dialog and a HUD — one scene per screen under src/scenes/, and change<>() between them.](https://omardev29.github.io/rmp-docs/examples/ui/01_menu.html) [**Layout**playable row, column, panel, center, stack/layer, spacer, plus image and progress.](https://omardev29.github.io/rmp-docs/examples/ui/02_layout.html) [**Clay direct**playable The escape hatch. Clay's own macros in the same frame as rmp::ui, for anything the small API does not expose yet.](https://omardev29.github.io/rmp-docs/examples/ui/03_clay_direct.html) [**Settings**playable Checkbox, slider, dropdown, text input — and the focus/keyboard/gamepad navigation you get without writing any.](https://omardev29.github.io/rmp-docs/examples/ui/04_settings.html) [**Inventory**playable grid with a column count worked out from the space available, scroll with clipping, tooltip() for what each item is -- under a resting pointer or the keyboard's focus -- and wants_pointer() keeping the game's hands off the UI's clicks.](https://omardev29.github.io/rmp-docs/examples/ui/05_inventory.html) [**Style**playable The two themes, the five variants, the three sizes and the transition.](https://omardev29.github.io/rmp-docs/examples/ui/06_style.html) [**Responsive**playable scale() versus current_breakpoint(), and which to reach for.](https://omardev29.github.io/rmp-docs/examples/ui/07_responsive.html) [**Overlay**playable overlay(): a pause menu pushed as a scene of its own, blurred, that freezes the game below; and "Really quit?" drawn by the game scene itself -- an overlay with a panel() in it, which is all a dialog is.](https://omardev29.github.io/rmp-docs/examples/ui/08_overlay.html) [**Skinned**playable The other way to write rmp::ui: a game's shop screen designed rather than written.](https://omardev29.github.io/rmp-docs/examples/ui/09_skinned.html) [**Dialogue**playable One Yarn conversation, three ways, switched while it runs: a DialogueBox (a portrait, a name plate on the frame, a voice per Speaker), a DialogueBubble over whoever speaks with its tail pointing at them, and a DialogueStage whose cast slides in and comes forward, shaken by a <<quake>>.](https://omardev29.github.io/rmp-docs/examples/ui/10_dialogue.html) [**Localization**playable A lantern stall in English, Spanish, Japanese and German, switched while it runs: every literal its own key in resources/lang.tsv, German in a file of its own (lang/de.tsv), {placeholders}, plurals in each language's forms, a context, and a font per language -- Japanese in Jigmo (CC0), cut down to the letters the table uses -- with each language's name in the menu in a font that has its letters (Style::font).](https://omardev29.github.io/rmp-docs/examples/ui/11_localization.html) [**Font**playable A menu in a font of your own: a title, its options and its credits, one scene each, every word in Hack Bold through one rmp::ui::set_font().](https://omardev29.github.io/rmp-docs/examples/ui/12_font.html)

## Plain c

[**Plain C**source The opt-out. A C entry point with your own main(): raylib, plus two headers of ours that are C -- <rmp/config.h> for the [window] values and <smoke_test.h> for the CI hooks -- and none of rmp::.](https://omardev29.github.io/rmp-docs/examples/plain_c.html)
