# rmp::assets

> rmp::assets:: — loading from resources/

Source: https://omardev29.github.io/rmp-docs/reference/namespaces/rmp-assets.html

namespace `#include <rmp/assets.h>` `#include <rmp/dialogue.h>`

## From `rmp/assets.h`

`rmp::assets::` — loading from resources/

### `init`

void init()

function [include/rmp/assets.h:335](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/assets.h#L335)

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`

void shutdown()

function [include/rmp/assets.h:339](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/assets.h#L339)

Release the pack and unhook raylib's loaders. Called for you after your stop hook.

### `using_pack`

bool using_pack()

function [include/rmp/assets.h:342](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/assets.h#L342)

True when assets are being served from a .rres pack.

### `load_image`, `load_texture`

rmp::Image load_image(std::string_view name)

rmp::Texture load_texture(std::string_view name)

function [include/rmp/assets.h:353](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/assets.h#L353)

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`

rmp::Sound load_sound(std::string_view name)

function [include/rmp/assets.h:358](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/assets.h#L358)

The sound device opens on the first call, the same lazy way [`rmp::audio`](https://omardev29.github.io/rmp-docs/reference/namespaces/rmp-audio.html) opens it; on a machine with no device this comes back empty.

### `load_font`

rmp::Font load_font(std::string_view name, int font_size)

function [include/rmp/assets.h:364](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/assets.h#L364)

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`

rmp::SpriteSheet load_sheet(std::string_view name)

function [include/rmp/assets.h:372](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/assets.h#L372)

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`

rmp::Tilemap load_map(std::string_view name)

rmp::Tilemap load_map(std::string_view name, std::string_view level)

function [include/rmp/assets.h:386](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/assets.h#L386)

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`

std::vector<unsigned char> load_data(std::string_view name)

function [include/rmp/assets.h:394](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/assets.h#L394)

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`

rmp::Value load_value(std::string_view name)

function [include/rmp/assets.h:404](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/assets.h#L404)

A JSON file — tuning numbers, a table of items, dialogue — read into an [`rmp::Value`](https://omardev29.github.io/rmp-docs/reference/classes/rmp-Value.html), 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()`](https://omardev29.github.io/rmp-docs/reference/classes/rmp-Value.html#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:

```cpp
#include <rmp/save.h>
static rmp::Value tuning = rmp::assets::load_value("tuning.json");
```

### `requested_loads`, `failed_loads`

int requested_loads()

int failed_loads()

function [include/rmp/assets.h:410](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/assets.h#L410)

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`](https://omardev29.github.io/rmp-docs/reference/classes/rmp-Dialogue.html) — conversations written in Yarn Spinner 3.

### `load_dialogue`

Dialogue load_dialogue(std::string_view file)

Dialogue load_dialogue(std::span<const std::string_view> files)

function [include/rmp/dialogue.h:388](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/dialogue.h#L388)

A .yarn file of resources/, compiled. Its errors, if any, are in `errors()`, said in the log and, in a debug build, on screen.
