On this page
  1. Include what you use
  2. The headers
    1. rmp/math.h
  3. Which header brings which
  4. rmp/config.h
    1. Set by the build, not the .toml

Headers

The framework is 16 headers under include/rmp/, one per module, and there is no header that includes them all. A file includes the modules it uses, and what it does not include it does not pay for.

Include what you use#

A file that draws the HUD includes rmp/ui.h and nothing else of the framework's:

#include <rmp/ui.h>

#include <string>

void draw_hud(int score) {
    rmp::ui::begin({ .placement = rmp::ui::Align::TOP_CENTER });
    rmp::ui::text("Score " + std::to_string(score));
    rmp::ui::end();
}

That file gets the interface layer and only it: no entry point, no asset layer, no scene, and none of the C library's maths behind them. When the HUD changes it recompiles, and when the asset pipeline changes it does not. examples/platform/03_minimal_includes is this file as a check the framework's CI compiles on its own, so the claim cannot quietly stop being true.

The split is also what makes the framework something you take a piece at a time. A game can use rmp::ui and draw everything else with raylib, or use scenes and objects and never touch the UI. Each header is a module you can name and decide about — which is the rule for adding one: a new header has to be a part of the framework with a name, because every header is one more thing a reader has to know exists.

A missing include is a compile error that says exactly what is missing. Using rmp::input::just_pressed in a file that never included rmp/input.h is an error that rmp::input was never declared — the compiler telling you which header to add.

The headers#

HeaderWhat it givesManual
rmp/app.hThe entry point — RMP_GAME and RMP_ENTRY_POINT — closing the app with rmp::app::quit(), and rmp::global<T>(). Reference: rmp::app.The app
rmp/scene.hrmp::Scene, the stack of scenes, spawning and raycasting, and rmp::Camera.Scenes, Camera
rmp/object.hrmp::Object, rmp::Handle, rmp::Callback, rmp::Sprite, the shapes, the edges and the ray queries.Objects, Collision
rmp/behavior.hThe catalogue of rmp::behavior: movement, tweens, timers, spawners, health.Behaviors
rmp/input.hrmp::input: named actions with up to eight bindings each, axes and directions, and the pointer.Input
rmp/ui.hrmp::ui: menus, buttons, text, layout, the controls of a settings screen, and themes.Interface
rmp/assets.hrmp::assets: loading from resources/ by name, and the counted handles that release what they own — rmp::Texture, rmp::Font, rmp::Sound and the rest — with rmp::SheetData behind an Aseprite sheet.Assets, Sprites
rmp/tilemap.hrmp::Tilemap and rmp::MapObject: levels from LDtk, and from Tiled.Tilemaps
rmp/audio.hrmp::audio: sound effects and music by name, and three volume buses.Audio
rmp/save.hrmp::save and rmp::Value: saving the game, in the right folder on every platform.Saving
rmp/random.hrmp::random: one seeded generator, so a run can be reproduced.Random
rmp/ads.hrmp::ads: interstitial and rewarded ads, real on Android once [android.admob] enabled turns them on, and silently nothing otherwise.Ads
rmp/math.hraymath's operators on raylib's own Vector2, Vector3, Vector4 and Matrix, and raylib-cpp's methods on those and on Rectangle and Color.raylib in your game
rmp/config.hThe RMP_ values from raylib_multiplatform.toml. Every header above includes it, so you never write it.Below

Everything the framework adds is under rmp::, and everything else is raylib's, so in a file that mixes the two you can always tell which is which. All of raylib is there: DrawTexture, IsKeyPressed, LoadModel. The framework's types take and convert to raylib's own, so a Vector2 is the same Vector2 on both sides.

rmp/math.h#

This header exists for one line:

position = position + velocity * delta;

The operators come from raylib's own raymath.h, which defines them for C++, so they work on the plain Vector2 every raylib function takes; there is no second vector type to convert to and from. raylib-cpp's maths classes — raylib::Vector2 and its siblings — derive from raylib's structs and add methods such as Normalize, for whoever prefers them. The rest of raylib-cpp is not vendored: its loaders throw on a failure, and nothing in this framework throws to the game.

It is a header of its own because the C library's <math.h> behind it is the expensive part, and a file that only draws menus should not pay for it. rmp/ui.h deliberately does not include it.

Which header brings which#

The framework's headers do not include each other. Where one needs a type from another it declares the name and nothing more — rmp/app.h names rmp::Scene without including rmp/scene.h — so that a header can grow without dragging the rest of the framework into every file that touches it.

The exceptions are where a type is held by value, which a declaration cannot provide, and each one says so at the top of the header:

This headerIncludesBecause
rmp/scene.hrmp/object.h, rmp/tilemap.hEvery scene holds its map and its camera, and the camera holds a handle to the object it follows.
rmp/object.hrmp/assets.hAn object's sprite holds an rmp::Texture or an rmp::SpriteSheet.
rmp/tilemap.hrmp/object.hA map stores the factories registered with on_object() as rmp::Callbacks.
rmp/behavior.hrmp/object.h, rmp/scene.hThe behaviors hold handles and callbacks, and a spawner's callback is handed the scene.

So rmp/scene.h alone is enough to write a scene with objects in it. Including the headers you use by name anyway costs nothing and keeps the file honest about what it depends on.

The rule is about the framework's own headers only. The standard library and raylib are used wherever the job needs them: rmp/app.h includes <memory>, because the first scene is handed over as a std::unique_ptr. What each header costs to include is measured, and the framework's checks fail when one grows or shrinks by more than a fifth of what it was measured at.

rmp/config.h#

The values a game reads from raylib_multiplatform.toml arrive as macros:

InitWindow(RMP_WINDOW_WIDTH, RMP_WINDOW_HEIGHT, RMP_WINDOW_TITLE);

rmp/config.h is the one framework header that every other one includes, and the only exception to the rule above. It earns that by costing nothing: its one include is the generated file of #defines, which includes nothing itself, and the two parse as fast as an empty file, within the noise of measuring it. In return the values are simply there, in every scene and every object, with nothing to remember. The framework's checks compile every public header on its own and fail the one that forgets it, so a new header cannot hand you an undefined macro.

It includes rmp/generated/config.h, which tools/configure.py rewrites on every configure and which is never committed. The file you can see in your editor exists so that the word "generated" never appears in anyone's code, and so that an editor that has not configured yet still resolves the include.

They are macros, not constexpr constants, so that a game in plain C can use the same values: a C file has no namespace to reach into. Plain C is also the one place you include it yourself, because a C file includes none of the framework's C++ headers.

MacroFrom
RMP_PROJECT_NAME[project] name
RMP_WINDOW_TITLE, RMP_WINDOW_WIDTH, RMP_WINDOW_HEIGHT[window] title, width, height — the design resolution
RMP_WINDOW_VSYNC, RMP_WINDOW_FPS[window] vsync and fps, as 0 or 1 and a number
RMP_MAX_DELTA[app] max_delta
RMP_UI_THEME, RMP_UI_FONT, RMP_UI_FONT_SIZE, RMP_UI_SCALE, RMP_UI_MAX_ELEMENTS[ui]: what the interface starts with
RMP_INPUT_DEADZONE[input] deadzone
RMP_AUDIO_MASTER, RMP_AUDIO_MUSIC, RMP_AUDIO_SFX[audio]: the volumes the buses start at
RMP_SAVE_PORTABLE, RMP_SAVE_ENCRYPT, RMP_SAVE_VERSION[save]
RMP_RRES_PASSWORD[resources] rres_password
RMP_DEV_STRICT[dev] strict

The macros reference has the same list with the framework's own values.

RMP_RRES_PASSWORD is in the header, and not only in the CMake build, because Android and iOS take nothing from CMake: a value defined there alone would differ on those two, and they could not open the pack they shipped with.

Set by the build, not the .toml#

Two more values come from the build system rather than from the .toml, and every build system defines both — CMake from its preset, Gradle from the build variant, Xcode per configuration:

#if RMP_PRODUCTION_BUILD
    // compiled into a release build only
#endif
TraceLog(LOG_INFO, "assets are read from %s", RMP_RESOURCES_PATH);

The first is 1 in a release build and 0 in a debug one. It is defined everywhere on purpose: an undefined macro in #if is not an error but 0, which would quietly compile a game's debug-only code into its release on whichever platform forgot it. A build that forgets it fails to compile instead. The second is where the loose files of resources/ are read from. On a desktop that is the project's folder by its absolute path in a debug build, and ./resources/ in a release. A desktop release moves into the executable's folder when it starts, when there is a resources/ there, so that the path means the folder shipped beside it — The app has the detail. The web, Android and iOS read the copy packaged with the game.