rmp::assets
From rmp/assets.h
rmp::assets:: — loading from resources/
init
Detect and open the resource pack, if there is one, and route raylib's own file loading through it. Called for you by the entry point; calling it twice is harmless.
shutdown
Release the pack and unhook raylib's loaders. Called for you after your stop hook.
using_pack
True when assets are being served from a .rres pack.
load_image, load_texture
Load by resource name (e.g. "rabbit.png"). Nothing to unload: the returned value releases itself when the last copy goes, and asking twice for the same name gives you the SAME resource with the reference count at two.
A name that is in neither the pack nor resources/ gives an empty resource rather than a crash, and so does a file that is there and does not decode — a font included: not raylib's built-in one in its place. valid() tells them apart, and drawing an empty one draws nothing — a hole in the picture, not a dead process. Both count in failed_loads().
load_sound
The sound device opens on the first call, the same lazy way rmp::audio opens it; on a machine with no device this comes back empty.
load_font
font_size is the baked glyph size, and it is part of the cache key: the same font at 16 and at 32 is two resources, because it is two textures. It is 1 to 1024: anything else is an empty font, a failed load and one warning — a negative size aborted inside stb_truetype.
load_sheet
An .aseprite or .ase from resources/. Every frame is packed into one texture in a single row, so drawing a hundred enemies from the same sheet is one texture bind. Tags, frame ranges and per-frame durations come with it.
On a machine with no GPU the texture is left empty and the metadata is still there, which is what lets tests/animation_test.cpp exist.
load_map
A level: an LDtk project (.ldtk) or a Tiled map (.json), told apart by the extension. See rmp/tilemap.h for what each editor's conventions mean here, and which of the two is maintained. The tileset images — and an LDtk project's separate level files — are loaded by FILE NAME through the same asset layer, so they come out of resources.rres in a release and out of resources/ while developing without the map knowing which.
level picks an LDtk level by its identifier; without it, the first level. Tiled maps have one level and ignore it.
Returns an empty map and says why if it cannot be read: map = rmp::assets::load_map("world.ldtk");
load_data
The bytes of a file — a level, a shader's source, JSON, anything whose meaning only the caller knows — as a vector that frees itself. Not cached: every call reads the file again. Empty when the name is in neither the pack nor resources/.
Empty when it is not there
load_value
A JSON file — tuning numbers, a table of items, dialogue — read into an rmp::Value, which remembers its file: while a Debug build runs on the desktop, if (tuning.changed()) tuning.reload(); picks up an edit made in any text editor (rmp::Value::changed() says how). An empty Value, said once, when the file is not there or is not JSON. Include rmp/save.h to use it:
#include <rmp/save.h>
static rmp::Value tuning = rmp::assets::load_value("tuning.json");requested_loads, failed_loads
How many rmp::assets:: loads were asked for, and how many gave nothing usable: nothing in the pack and nothing on disk, or a file that is there and does not decode. The entry point reports these to the CI boot gate; you are unlikely to need them yourself.
From rmp/dialogue.h
rmp::Dialogue — conversations written in Yarn Spinner 3.
load_dialogue
A .yarn file of resources/, compiled. Its errors, if any, are in errors(), said in the log and, in a debug build, on screen.