pub struct TileMap { /* private fields */ }Expand description
Grid-based 2D tilemap supporting O(visible) frustum-culled rendering, cached static chunk batching, and tile solidity queries.
Implementations§
Source§impl TileMap
Tile lookup, mutation, static chunk-cache batching, and world-space queries for TileMap.
impl TileMap
Tile lookup, mutation, static chunk-cache batching, and world-space queries for TileMap.
Sourcepub fn add_palette_entry(&mut self, entry: TilePaletteEntry) -> u16
pub fn add_palette_entry(&mut self, entry: TilePaletteEntry) -> u16
Sourcepub fn set_tile(&mut self, col: usize, row: usize, tile_id: u16)
pub fn set_tile(&mut self, col: usize, row: usize, tile_id: u16)
Sets the tile identifier at grid coordinate (col, row).
§Arguments
&Self- Mutable tilemap.usize- Column index.usize- Row index.u16- Tile identifier.
Sourcepub fn has_fresh_chunk_cache(&self) -> bool
pub fn has_fresh_chunk_cache(&self) -> bool
Sourcepub fn cached_chunks(&self) -> &[TileMapChunkBatch]
pub fn cached_chunks(&self) -> &[TileMapChunkBatch]
Sourcepub fn rebuild_chunk_cache(&mut self)
pub fn rebuild_chunk_cache(&mut self)
Rebuilds the retained 16x16 static chunk run cache merging contiguous same-color horizontal tiles to reduce draw command counts.
§Arguments
&Self- Mutable tilemap.
Sourcepub fn is_solid_at_world(&self, world_pt: Point) -> bool
pub fn is_solid_at_world(&self, world_pt: Point) -> bool
Sourcepub fn world_bounds(&self) -> Rect
pub fn world_bounds(&self) -> Rect
Source§impl TileMap
impl TileMap
pub fn get_columns(&self) -> usize
pub fn get_mut_columns(&mut self) -> &mut usize
pub fn set_columns(&mut self, val: usize) -> &mut Self
pub fn get_rows(&self) -> usize
pub fn get_mut_rows(&mut self) -> &mut usize
pub fn set_rows(&mut self, val: usize) -> &mut Self
pub fn get_tile_size(&self) -> f32
pub fn get_mut_tile_size(&mut self) -> &mut f32
pub fn set_tile_size(&mut self, val: f32) -> &mut Self
pub fn get_cells(&self) -> &Vec<u16>
pub fn get_mut_cells(&mut self) -> &mut Vec<u16>
pub fn set_cells(&mut self, val: Vec<u16>) -> &mut Self
pub fn get_palette(&self) -> &Vec<TilePaletteEntry>
pub fn get_mut_palette(&mut self) -> &mut Vec<TilePaletteEntry>
pub fn set_palette(&mut self, val: Vec<TilePaletteEntry>) -> &mut Self
pub fn get_cache_revision(&self) -> u64
pub fn get_mut_cache_revision(&mut self) -> &mut u64
pub fn set_cache_revision(&mut self, val: u64) -> &mut Self
pub fn get_built_revision(&self) -> u64
pub fn get_mut_built_revision(&mut self) -> &mut u64
pub fn set_built_revision(&mut self, val: u64) -> &mut Self
Trait Implementations§
Auto Trait Implementations§
impl Forget for TileMap
impl Freeze for TileMapwhere
*const u8 is !null: Freeze,
PhantomData<u16>: Freeze,
PhantomData<TilePaletteEntry>: Freeze,
PhantomData<TileMapChunkBatch>: Freeze,
impl Move for TileMap
impl RefUnwindSafe for TileMap
impl Send for TileMapwhere
RawVecInner: Send,
impl Sync for TileMapwhere
RawVecInner: Sync,
impl Unpin for TileMap
impl UnsafeUnpin for TileMapwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u16>: UnsafeUnpin,
PhantomData<TilePaletteEntry>: UnsafeUnpin,
PhantomData<TileMapChunkBatch>: UnsafeUnpin,
impl UnwindSafe for TileMapwhere
RawVecInner: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more