Why it is built this way
A framework is mostly decisions, and a decision you cannot see the reason for looks like an accident. These pages give the reasons: why a menu is three calls, why a hook starts with an underscore, why nothing throws, why every struct of options is ordered the way it is. Each one is a rule the framework holds itself to, and most of them are checked by a tool rather than remembered.
The rule above the others#
The three-function menu. The API has to be as simple as possible for the person making the game, and a main menu written in three calls is the measure. Every other decision on these pages is answerable to it.
How the code reads#
- Naming
- One spelling per kind of name, so a type, a value and a constant never look alike where they are used, and no prefix carries meaning a dot can carry better. It is a rule of style, so it lives with the rest of the style guide, in the Guidelines.
- The access rule
_nameis a method of yours the framework calls;on_nameis a function you hand to it. Two spellings, two directions.- Designated initialisers
- Why options are written
{ .speed = 320 }, why the order of the fields matters, and why a behavior has no base class. - Macros
- Where a macro is the right tool โ the entry point, the values from the
.tomlโ and the one rule about them: a header never makes you use one.
How the framework holds together#
- One header per module
- No umbrella header, headers that do not include each other, and the cost of every include measured rather than guessed.
- Ownership
- Everything is owned by something that releases it: a texture, an object, a scene, a callback. No raw pointer in the API, nothing you have to free, and the handle for what you keep across frames.
- No exceptions
- What the framework does instead of throwing, and why throwing in the middle of a frame is not an option.
- Time is a parameter
- Why every hook is handed
delta, where the clock is read, and what[app] max_deltaprotects you from.
Checked, not remembered#
A rule written only in a document is kept until the day someone has not read it. So wherever a
mistake can be described precisely, something in the framework's own checks rejects it โ a
check of clang-tidy, a stage of rmp test,
clang-format or the compiler. The Guidelines list
every one of those rules with the tool that holds it, and where: in the framework, in its examples
and in a game.