On this page
  1. Ads
  2. Assets
  3. Games
  4. Input
  5. Platform
  6. Scenes
  7. UI
  8. Plain c

Examples

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:

rmp example
rmp example 01_pong
rmp example games/01_pong

Ads#

Assets#

Games#

Pongplayable rmp::behavior::Ball and Edge::CLAMP, two players, first to seven. Breakoutplayable 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. Space invadersplayable 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. Top downplayable 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. Endless runnerplayable Parallax, Runner, a Spawner by distance and a camera that follows, with a little smoothing. Tetrisplayable The honest one: a Tetris is a 10×20 array and the rules of Tetris, and the framework does not pretend otherwise. Platformerplayable 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. Dungeonplayable 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. After schoolplayable 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.

Input#

Platform#

Scenes#

UI#

Menuplayable 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. Layoutplayable row, column, panel, center, stack/layer, spacer, plus image and progress. Clay directplayable The escape hatch. Clay's own macros in the same frame as rmp::ui, for anything the small API does not expose yet. Settingsplayable Checkbox, slider, dropdown, text input — and the focus/keyboard/gamepad navigation you get without writing any. Inventoryplayable 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. Styleplayable The two themes, the five variants, the three sizes and the transition. Responsiveplayable scale() versus current_breakpoint(), and which to reach for. Overlayplayable 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. Skinnedplayable The other way to write rmp::ui: a game's shop screen designed rather than written. Dialogueplayable 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>>. Localizationplayable 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). Fontplayable 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().

Plain c#