pub struct MetatileRegistry {
pub defs: Vec<MetatileDef>,
}Expand description
Registry of all metatile definitions for a tileset.
A registry holds every MetatileDef used by a map or tileset. The map’s
block data references metatiles by their index in this registry (the
index is returned by add_def).
Fields§
§defs: Vec<MetatileDef>Implementations§
Source§impl MetatileRegistry
impl MetatileRegistry
Sourcepub fn add_def(&mut self, def: MetatileDef) -> usize
pub fn add_def(&mut self, def: MetatileDef) -> usize
Adds a metatile definition and returns its index in the registry.
Sourcepub fn get(&self, index: usize) -> Option<&MetatileDef>
pub fn get(&self, index: usize) -> Option<&MetatileDef>
Looks up a metatile definition by index. Returns None if the
index is out of bounds.
Sourcepub fn from_gb_blocksets(bst_data: &[u8]) -> Self
pub fn from_gb_blocksets(bst_data: &[u8]) -> Self
Parses a complete .bst byte slice into a MetatileRegistry.
The slice is expected to be a multiple of 16 bytes (the standard
Game Boy block size). Each 16-byte chunk is fed to
MetatileDef::from_gb_block.
§Panics
Panics if bst_data.len() is not a multiple of 16.
Trait Implementations§
Source§impl Clone for MetatileRegistry
impl Clone for MetatileRegistry
Source§fn clone(&self) -> MetatileRegistry
fn clone(&self) -> MetatileRegistry
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MetatileRegistry
impl Debug for MetatileRegistry
Auto Trait Implementations§
impl Freeze for MetatileRegistry
impl RefUnwindSafe for MetatileRegistry
impl Send for MetatileRegistry
impl Sync for MetatileRegistry
impl Unpin for MetatileRegistry
impl UnsafeUnpin for MetatileRegistry
impl UnwindSafe for MetatileRegistry
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