Skip to main content

Crate wasserxr

Crate wasserxr 

Source
Expand description

WasserXR is the foundational ECS runtime for the WasserXR engine.

WasserXR is built for dynamic, modular applications where components, systems, and asset types can live in reloadable plugins. The main runtime object is scene::Scene. A scene owns entities, components, systems, assets, resources, and loaded plugins, and Scene::tick runs the active systems.

The full engine is usually split into two parts:

  • WasserXR: this crate, the foundational ECS and plugin runtime.
  • WasserXR-Core: the standard set of engine components, systems, and asset types.

A minimal application usually creates a scene, loads the core plugin, adds a system, and ticks the scene:

use wasserxr::scene::{logging::file_logger, Scene};

fn main() {
    let mut scene = Scene::new();
    scene.register_callback_logger(file_logger);

    scene
        .load_plugin("./libwasserxr_core.so".to_owned())
        .expect("Failed to load core plugin");

    scene
        .add_system("console".to_owned(), 100)
        .expect("Failed to add system `console`");

    while scene.tick() {}
    let _ = scene.reset();
}

This crate also re-exports the procedural macros used by Rust plugins, such as component, component_creator, system, attacher, detacher, asset_type, and asset_type_creator.

For tutorials and getting-started guides, see https://wasserxr.com.

Modules§

bindings
C ABI bindings for WasserXR.
error
Error types returned by the WasserXR runtime APIs.
scene
Scene runtime, ECS storage, plugin loading, and typed query APIs.
utils
Small utility modules used by the runtime and applications. Utility helpers shared by WasserXR runtime modules.

Macros§

debug
Logs a formatted DEBUG message through a scene.
error
Logs a formatted ERROR message through a scene.
info
Logs a formatted INFO message through a scene.
warn
Logs a formatted WARN message through a scene.

Structs§

Uuid
A Universally Unique Identifier (UUID).

Attribute Macros§

asset_type
Turns a Rust asset struct into the C ABI functions WasserXR needs.
asset_type_creator
Wraps fn create(scene: &mut Scene, data: &str) -> Option<AssetType> as an asset creator.
attacher
Turns a Rust system attach function into the C ABI function WasserXR needs.
component
Turns a Rust component struct into the C ABI functions WasserXR needs.
component_creator
Wraps fn create(scene: &mut Scene) -> Option<Component> as a component creator.
detacher
Turns a Rust system detach function into the C ABI function WasserXR needs.
system
Turns a Rust system function into the C ABI functions WasserXR needs.