# The framework

> How raylib_multiplatform is put together — its layers, one frame in order, the config pipeline, how it is tested, its licences — why it is built the way it is, how to work on it, and how to keep it alive for years.

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

What the framework is made of, the order it does things in, and the reasons behind the shape it has. You do not need any of this to make a game. It is here for when you want to know why something works the way it does, or what exactly happens between your `_update` and the picture on the screen.

## In short

Three things. The `rmp` library: one header per module under `include/rmp/` and their implementation under `src/rmp/`, compiled into your game. One configuration file, `raylib_multiplatform.toml`, which `tools/configure.py` turns into what CMake, Gradle and Xcode read, so they cannot disagree with it. And a CI that builds the game for 17 targets, starts it, and checks that it drew.

## How it is put together

[Architecture](https://omardev29.github.io/rmp-docs/framework/architecture.html)

The five layers, from your code down to the targets: what each one is responsible for, which libraries sit where, and how the modules depend on one another.

[One frame](https://omardev29.github.io/rmp-docs/framework/the-frame.html)

Everything that happens between one picture and the next, in the order the framework does it: input, the scenes and their objects, collision, the camera, drawing, and the changes that wait for the end of the frame.

[The config pipeline](https://omardev29.github.io/rmp-docs/framework/config-pipeline.html)

How one `.toml` becomes the input of every build system, why a mistake in it stops in the first second with the line it is on, and what each generated file is for.

[Performance](https://omardev29.github.io/rmp-docs/framework/performance.html)

What the framework costs over raylib, and what it saves you: how the scenes, the behaviors, the map, the collisions and the UI keep a frame cheap, which abstractions cost nothing and which cost a little, and how it all compares with raylib and with OpenGL by hand.

[Testing](https://omardev29.github.io/rmp-docs/framework/testing.html)

Unit tests with no window, a frame rendered in software and compared, the game booted on every target a runner can start, every example run, a game played by a bot and the examples played from a script, what the tests reach measured — and what `rmp test` runs in your game.

[Security](https://omardev29.github.io/rmp-docs/framework/security.html)

Every safety measure the framework takes: the release hardened flag by flag, every debug build under the sanitizers, two static analysers, what the tests reach, the shipped binary read back, the supply chain pinned, secrets kept out of the repository — what each one costs, and what is not done.

[Licences](https://omardev29.github.io/rmp-docs/framework/licences.html)

The framework's MIT licence, the modified raylib under it, every component it carries, and the notice that ships with your game.

## Why it is built this way

The decisions behind the API, each with its reason and, where there is one, the tool that keeps it true. They start from [the rule above the others](https://omardev29.github.io/rmp-docs/framework/why/the-three-function-menu.html): a main menu is three function calls, and nothing is allowed to make it longer.

- [Naming](https://omardev29.github.io/rmp-docs/guidelines/naming.html) and [the access rule](https://omardev29.github.io/rmp-docs/framework/why/the-access-rule.html): what a name tells you before you look it up.
- [One header per module](https://omardev29.github.io/rmp-docs/framework/why/one-header-per-module.html): no umbrella header, and every include measured.
- [Designated initialisers](https://omardev29.github.io/rmp-docs/framework/why/designated-initialisers.html): options as `{ .speed = 320 }`, and why their order is fixed.
- [Ownership](https://omardev29.github.io/rmp-docs/framework/why/ownership.html): nothing to free, and a handle for what you keep.
- [No exceptions](https://omardev29.github.io/rmp-docs/framework/why/no-exceptions.html): what the framework does instead of throwing.
- [Macros](https://omardev29.github.io/rmp-docs/framework/why/macros.html): where one is the right tool, and the rule about them.
- [Time is a parameter](https://omardev29.github.io/rmp-docs/framework/why/delta-and-time.html): `delta`, the clock, and `[app] max_delta`.

## Working on it

[Contributing](https://omardev29.github.io/rmp-docs/framework/contributing/index.html) is for whoever changes the framework itself, a person or an agent: setting up a machine and the build image, the repository and what a new game is copied from, the rules with their reasons, writing tests, the verification ladder, CI, pull requests and the approval a change to the API needs, and keeping this site true to the code.

## Keeping it alive

[Maintaining](https://omardev29.github.io/rmp-docs/framework/maintaining/index.html) is for whoever keeps the framework building after it is written: the framework as a system of repositories, generators, toolchains and images; every dependency, where its version is held and every file that names it; the build image and how a new one is made; Python; a playbook for upgrading each dependency; the changes the stores and GitHub force every year; and what to archive so a desktop build still works in decades.
