Macros
The framework's macros are all spelled RMP_: the preprocessor has one namespace, shared with raylib, the C library and the game.
RMP_DECLARE_ENTRY_POINT_ONCE
A symbol that exists only so that two errors read like sentences.
TWO entry points in one program -> it is defined twice, and the linker
names it. (`main` collides too, but
"duplicate symbol _main" does not say
which of your files to look at.)
NO entry point at all -> src/rmp/app/app.cpp references it, so the
linker asks for it by this name, next
to the "undefined reference to `main`"
that alone tells a newcomer nothing
about what to write. Checked by
EntryPointGuardTest, which links one.It is emitted by RMP_ENTRY_POINT rather than by RMP_GAME because the examples use the entry point directly, without scenes, and they are entry points too.
RMP_IOS_FUNCS
iOS. UIKit owns the run loop, so this runner is three callbacks instead of a main(). iOS rcore declares: extern void ios_ready(); ios_update(bool); ios_destroy(); extern "C" so the symbols match the C declarations in rcore_ios.c.
UIKit owns the run loop and offers no way to return from it, so the CI path tears down and exits explicitly. Outside CI that branch never runs.
RMP_WEB_FUNCS
Web. The browser owns the frame loop, and giving it to the browser is worth a paragraph because the alternative is expensive in a way that is invisible.
A while loop in a browser only works if you build with -s ASYNCIFY, which rewrites the whole program so its stack can be unwound and restored at any suspension point. That instrumentation is not billed to the loop: it is billed to every function in the binary that might be on the stack when it happens, in code size and in speed, whether or not the frame ever yields. raylib says so itself, in the comment above WindowShouldClose() on web: "WindowShouldClose() is not called on a web-ready raylib application if using emscripten_set_main_loop()". That call is the only emscripten_sleep() in raylib, so not calling it is what lets ASYNCIFY go away entirely.
fps = 0 means requestAnimationFrame, which is the right answer on web — do NOT call SetTargetFPS() here. The 1 is "simulate an infinite loop", so main() never returns and nothing after the call runs, which is exactly the contract the desktop while loop has.
RMP_DESKTOP_FUNCS
Everywhere else — Windows, Linux, macOS, the BSDs and Android, where raylib's own android_main() calls main() — a main() that owns the frame loop: the ordinary raylib shape, ended by the window's X, rmp::app::quit() or the CI frame budget, and then the same stop sequence as the other two.
RMP_ENTRY_POINT
The entry point. Give it your three hooks; it picks the right runner — RMP_IOS_FUNCS on iOS, RMP_WEB_FUNCS on the web, RMP_DESKTOP_FUNCS everywhere else. RMP_GAME uses it, and a game with no scenes can call it directly:
RMP_ENTRY_POINT(on_ready, on_frame, on_exit);Defined per platform:
| When | Expands to |
|---|---|
#if defined(PLATFORM_IOS) | RMP_IOS_FUNCS(READY, FRAME, STOP) |
#elif defined(PLATFORM_WEB) || defined(__EMSCRIPTEN__) | RMP_WEB_FUNCS(READY, FRAME, STOP) |
#else | RMP_DESKTOP_FUNCS(READY, FRAME, STOP) |
RMP_GAME
The whole of src/main.cpp: give it your first scene's type, and it opens the window, enters that scene, runs the stack every frame and closes everything on the way out. It is RMP_ENTRY_POINT with the three hooks written for you.
RMP_UI_FONT_SIZE
[ui] font_size in design units. This 20 is only the fallback for a rmp/config.h that does not define it, and matches the .toml's default.
Set by the .toml
Every value of raylib_multiplatform.toml a game can read in C or C++ is a macro of the generated rmp/config.h, which every public header includes. The values here are the framework's own; a game's are whatever its .toml says.
| Macro | From | The framework's value |
|---|---|---|
RMP_PROJECT_NAME | [project] name | "ray_test" |
RMP_WINDOW_TITLE | [window] title | "Raylib is Multiplatform!" |
RMP_WINDOW_WIDTH | [window] width | 800 |
RMP_WINDOW_HEIGHT | [window] height | 450 |
RMP_WINDOW_VSYNC | [window] vsync | 1 |
RMP_WINDOW_FPS | [window] fps | 0 |
RMP_WINDOW_PAUSE_UNFOCUSED | [window] pause_unfocused | 0 |
RMP_WINDOW_STRETCH | [window] stretch | 1 |
RMP_RRES_PASSWORD | [resources] rres_password | "raylib-template" |
RMP_UI_THEME | [ui] theme | "dark" |
RMP_UI_FONT | [ui] font | "" |
RMP_UI_FONT_SIZE | [ui] font_size | 20 |
RMP_UI_SCALE | [ui] scale | 0.0f |
RMP_UI_MAX_ELEMENTS | [ui] max_elements | 512 |
RMP_LANG_DEFAULT | [lang] default | "en" |
RMP_LANG_FILE | [lang] file | "lang.tsv" |
RMP_LANG_FOLDER | [lang] folder | "lang" |
RMP_LANG_COLLECT | [lang] collect | 1 |
RMP_LANG_LANGUAGES | [lang] languages | "" |
RMP_LANG_FONTS | [lang] fonts | "" |
RMP_INPUT_DEADZONE | [input] deadzone | 0.2f |
RMP_AUDIO_MASTER | [audio] master | 1.0f |
RMP_AUDIO_MUSIC | [audio] music | 0.8f |
RMP_AUDIO_SFX | [audio] sfx | 1.0f |
RMP_SAVE_PORTABLE | [save] portable | 0 |
RMP_SAVE_ENCRYPT | [save] encrypt | 0 |
RMP_SAVE_VERSION | [save] version | 1 |
RMP_MAX_DELTA | [app] max_delta | 0.05f |
RMP_DEV_STRICT | [dev] strict | 0 |
Set by the build
Macros no header defines: the build passes them to the compiler, for the framework and for your game.
| Macro | What it is |
|---|---|
RMP_PRODUCTION_BUILD | 1 in a release build and 0 in a debug one, on every platform: rmp build release, rmp web and every build CI ships are 1; rmp build and rmp run are 0. A build system that forgets it is a compile error in src/rmp/app/app.cpp, not a quiet debug build, so #if RMP_PRODUCTION_BUILD is safe to write. |
RMP_SANITIZE | Defined, as 1, in a debug build that runs under a sanitizer [dev] sanitize lists and the compiler could run; not defined otherwise, and never in a release. For code that has to allow for the slowdown, such as a timing test: #if defined(RMP_SANITIZE). The CMake option of the same name is on by default, and -DRMP_SANITIZE=OFF builds one debug folder without them, to measure what they cost. |
RMP_SANITIZE_ADDRESS | Defined, as 1, when that build runs under AddressSanitizer ("address"). |
RMP_SANITIZE_UNDEFINED | Defined, as 1, when that build runs under UndefinedBehaviorSanitizer ("undefined"). |
RMP_RESOURCES_PATH | The folder loose resources are read from, ending in a slash. A game does not need it: rmp::assets resolves a name against the pack first and this folder second, and so does plain raylib's LoadTexture() on a path inside it. |
Read by the build
Names that are not macros at all: switches of the build itself, given to CMake with -D or set in the environment.
| Name | Is | What it does |
|---|---|---|
RMP_WERROR | a CMake option | -DRMP_WERROR=ON makes a compiler warning in the game's code and the framework's an error. Off unless asked for: the framework's own checks turn it on, and a game is never made to, because a newer compiler on its author's machine must not stop a build that was fine yesterday. |
RMP_RELEASE_PIE | a CMake option | On by default: a Linux or BSD release is linked position-independent, so ASLR can move the executable too. -DRMP_RELEASE_PIE=OFF only to measure what it costs. |
RMP_REQUIRE_SANITIZERS | an environment variable | 1 turns a sanitizer [dev] sanitize lists and the compiler cannot run from a warning into a failed configure. CI sets it where a debug build is a gate. |
RMP_TARGET_DRM | a CMake option | -DRMP_TARGET_DRM=ON builds for DRM/KMS: raylib's DRM platform, straight to the screen through the kernel, with no X11 and no Wayland. The debug-drm and release-drm presets turn it on, in build/debug-drm and build/release-drm, and rmp uses them on a Linux console with no desktop; the DRM targets' CI jobs pass it to the release preset. |
RMP_DRM | an environment variable | What rmp builds for on Linux, whatever it would decide by itself: 1 for DRM/KMS, as on a console with no desktop, and 0 for the desktop. Unset or empty, rmp decides; any other value is refused, and so is 1 anywhere but Linux. The installer reads it too, to list the headers that build needs. |
RMP_ACCEPT_MICROSOFT_LICENSE | an environment variable | 1 says you accept Microsoft's licence for its C runtime and Windows SDK, which rmp build windows clang-cl has xwin download into ~/.xwin the first time. Unset, rmp asks on a terminal and refuses anywhere else; nothing is downloaded until the licence is accepted. |
XWIN_DIR | an environment variable | Where rmp build windows clang-cl keeps Microsoft's C runtime and Windows SDK, which xwin downloads once; ~/.xwin when unset. |