pub trait MapProvider<M: MapTrait> {
// Required methods
fn dimensions(&self, map: M) -> (u8, u8);
fn tileset(&self, map: M) -> u8;
fn block_data(&self, map: M) -> &[u8] ⓘ;
fn border_block(&self, map: M) -> u8;
fn connections(&self, map: M) -> Vec<MapConnection<M>>;
}Expand description
Provider trait that supplies map data to the engine.
This is the central abstraction for loading map dimensions, tile block data, border blocks, and connection information. The overworld system queries this provider to render maps and handle movement/collision.
Required Methods§
Sourcefn dimensions(&self, map: M) -> (u8, u8)
fn dimensions(&self, map: M) -> (u8, u8)
Returns the dimensions of the map as (width, height) in tiles.
Sourcefn block_data(&self, map: M) -> &[u8] ⓘ
fn block_data(&self, map: M) -> &[u8] ⓘ
Returns the block data for the map.
Each byte in the returned slice corresponds to a block index in the tileset’s block definition table. Blocks are stored in row-major order.
Sourcefn border_block(&self, map: M) -> u8
fn border_block(&self, map: M) -> u8
Returns the border block ID used to fill the area outside the map.
Sourcefn connections(&self, map: M) -> Vec<MapConnection<M>>
fn connections(&self, map: M) -> Vec<MapConnection<M>>
Returns the list of connected maps for seamless scrolling.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".