Expand description
Load Tiled maps into SpacetimeDB.
This library parses TMX files and stores them in SpacetimeDB tables. Since SpacetimeDB modules run in WASM without filesystem access, it includes an in-memory XML parser.
§Quick Start
use spacetimedb::{reducer, ReducerContext};
pub use spacetime_tiled::*;
#[reducer]
pub fn load_map(ctx: &ReducerContext) -> Result<(), String> {
// Embed the TMX file at compile time
const MAP_DATA: &str = include_str!("../assets/map.tmx");
// Parse and store in database
load_tmx_map_from_str(ctx, "level1", MAP_DATA)?;
Ok(())
}§WASM Limitations
SpacetimeDB modules can’t access the filesystem. Use load_tmx_map_from_str() with
include_str!() to embed maps at compile time, or have clients send TMX content as
reducer parameters.
Structs§
- Tiled
Layer - Represents a layer in a Tiled map
- Tiled
Map - Represents a Tiled map with its core metadata
- Tiled
Object - Represents an object in an object layer
- Tiled
Property - Represents custom properties on any Tiled element
- Tiled
Tile - Represents a single tile in a tile layer
- Tiled
Tileset - Represents a tileset used by maps
- tiled_
layer__ Table Handle - tiled_
map__ Table Handle - tiled_
object__ Table Handle - tiled_
property__ Table Handle - tiled_
tile__ Table Handle - tiled_
tileset__ Table Handle
Traits§
Functions§
- load_
tmx_ map - Load a TMX map file into SpacetimeDB tables
- load_
tmx_ map_ from_ str - Load a TMX map from a string into SpacetimeDB tables