Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

API documentation overview

TODO: introduction to API documentation here.

Assets

API docs

Handles management of the asset library (and containing asset packs), indexing, thumbnail generation and provides an interface for searching and resolving assets from this library.

The primary feature is to abstract the exact location on the device away so that the same assets can be located on different devices, even if they are in different locations on each device. Each asset is assigned a stable identifier that is the same on each device, independent for the specific location in the file system, and maps refer to these assets by their assigned IDs. When resolving an asset, this crate is responsible for finding the actual location in the filesystem and providing it to Bevy's asset system.

Features

FeatureDescriptiondefault
jpegEnables the crate to process and generate JPEG files
pngEnables the crate to process and generate PNG files
webpEnables the crate to process and generate WEBP files

CLI

API docs

The DungeonRS CLI is a command line interface to interact with assets and maps.

Features

FeatureDescriptiondefault
jpegEnables the CLI to process and generate JPEG files
pngEnables the CLI to process and generate PNG files
webpEnables the CLI to process and generate WEBP files

Config

API docs

Configuration management for the application. This crate handles loading and validation of configuration files during early startup, before Bevy initialisation, allowing configuration of the entire bootstrap process.

The two main configuration types are:

  • Configuration - Application settings including language preferences, recent files, and asset directory paths
  • LogConfiguration - Logging system configuration with output levels and destinations

Configuration files are loaded from platform-appropriate directories and validated at startup.

Data

API docs

Core data structures shared throughout the application. This crate is kept lightweight and dependency-free so other crates can use these types without pulling in heavy dependencies. Compiling this crate with dev feature enabled will derive Reflect for all types.

Contains the fundamental types:

  • Project - Top-level marker component that defines the boundary of saveable map content
  • Element - Individual map elements and components
  • Layer - Map layer organisation and structure
  • Level - Multi-floor/level support and metadata

The Project component serves as a crucial boundary marker in the ECS hierarchy. Only entities beneath a Project component are considered during save/load and export operations, which prevents editor tools, gizmos, and temporary objects from being inadvertently included in persisted data.

To make working with these data structures easier, the data crate provides a Query implementation for each type. The fundamental types and their corresponding Query implementations are:

  • Project - ProjectQuery
  • Level - LevelQuery
  • Layer - LayerQuery
  • Element - ElementQuery

There is also the [DungeonQueries] system parameter for fetching all the above types in a single query.

Editor

API docs

The DungeonRS editor is where most users will actually be working in. It's the binary crate that actually handles bootstrapping the application, setting up a graphical interface and run the application.

Features

FeatureDescriptiondefault
jpegEnables the editor to process and generate JPEG files
pngEnables the editor to process and generate PNG files
webpEnables the editor to process and generate WEBP files
no_consoleDisables showing the console window (only works on Windows)

i18n

API docs

A wrapper around fluent-template to make static access a bit more convenient. It does this by providing a static LOCALES which wraps ArcLoader and tracks the currently selected language. It also provides a t! macro which makes using it even more intuitive.

IO

API docs

Core functionality of the editor that isn't tied specifically to the UI. This crate centralises shared functionality between the ui and cli crates, preventing code duplication and providing a consistent event-driven architecture.

The core crate implements an event-driven system where:

  • Events are exposed for triggering core functionality
  • Event listeners handle the actual implementation
  • Other crates can dispatch events to trigger functionality without duplicating logic

The core crate serves as the foundation for:

  • Map manipulation and processing algorithms
  • Asset management operations
  • Core editing operations and transformations
  • Event-driven business logic shared between UI and CLI implementations

By centralising this logic with an event-based approach, functionality can be easily shared between different frontends (UI, CLI, automation tools).

Logging

API docs

Handles configuring Bevy's logging system and handles outputting logging to a rolling file.

Features

FeatureDescriptiondefault
consoleEnables a few console-only enhancements (such as auto progress-tracking of spans)

Serialisation

API docs

This crate handles serialisation from and to binary representations. It's essentially a wrapper around Serde using various formats depending on the enabled features.

These are the currently supported features:

FormatDocFeature
MessagePackBinary format with small output sizemsgpack
JSONHuman-readable text formatjson
TOMLHuman-readable configuration formattoml

UI

API docs

Handles building the user interface that users can interact with. Currently, this implementation uses the excellent egui crate, but this might change in the future to bevy_ui once it matures enough.

Utils

API docs

Common utilities shared across the codebase. This includes platform-specific directory resolution, async ECS helpers, path manipulation utilities, hashing functions, build version information, and re-exported macros from utils_macros.

The directory handling follows each platform's recommended conventions:

  • Windows: Known Folder API
  • Linux: XDG Base Directory specifications
  • macOS: Standard Directories

This implementation is based on the approach used by the directories crate, though we maintain our own version due to licensing considerations.

Utils macros

API docs

Contains several utility macros exported through utils. Notably, the bevy_system macro is used by all Bevy systems.