pub struct TileMapBuilder { /* private fields */ }Expand description
Wygodny builder do tworzenia mapy z danych tekstowych.
let map = TileMapBuilder::new(tileset, 16.0, 16.0)
.layer("bg", 0.1, vec![
"000000000",
"001111100",
"001111100",
"000000000",
])
.build();Znaki: ‘0’–‘9’ = tile_id 0-9, ’ ’ = pusta komórka Dla większych ID użyj layer_raw().
Implementations§
Source§impl TileMapBuilder
impl TileMapBuilder
pub fn new(tileset: TileSet, tile_w: f32, tile_h: f32) -> Self
pub fn position(self, pos: Vec2) -> Self
Sourcepub fn layer(self, name: &str, z_order: f32, rows: Vec<&str>) -> Self
pub fn layer(self, name: &str, z_order: f32, rows: Vec<&str>) -> Self
Dodaj warstwę z danych tekstowych (znaki ‘0’-‘9’ lub ’ ’).
Sourcepub fn layer_raw(
self,
name: &str,
width: u32,
height: u32,
z_order: f32,
tiles: Vec<Option<u32>>,
) -> Self
pub fn layer_raw( self, name: &str, width: u32, height: u32, z_order: f32, tiles: Vec<Option<u32>>, ) -> Self
Dodaj warstwę z surowych danych (Vec<Option
pub fn build(self) -> TileMap
Auto Trait Implementations§
impl Freeze for TileMapBuilder
impl RefUnwindSafe for TileMapBuilder
impl Send for TileMapBuilder
impl Sync for TileMapBuilder
impl Unpin for TileMapBuilder
impl UnsafeUnpin for TileMapBuilder
impl UnwindSafe for TileMapBuilder
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.