pub struct WorldMap {
pub sprites: Vec<Sprite>,
pub fog_color: [u8; 4],
pub fog_distance: f32,
pub lights: FxHashMap<(i32, i32), Light>,
pub light_map: FxHashMap<(i32, i32), f32>,
/* private fields */
}
Fields§
§sprites: Vec<Sprite>
§fog_color: [u8; 4]
§fog_distance: f32
§lights: FxHashMap<(i32, i32), Light>
§light_map: FxHashMap<(i32, i32), f32>
Implementations§
Source§impl WorldMap
The world map
impl WorldMap
The world map
pub fn new() -> Self
Sourcepub fn set_default_ceiling(&mut self, tile: Tile)
pub fn set_default_ceiling(&mut self, tile: Tile)
Sets the ceiling tile
Sourcepub fn get_default_ceiling(&self) -> Option<&Tile>
pub fn get_default_ceiling(&self) -> Option<&Tile>
Gets the ceiling tile
Sourcepub fn set_ceiling(&mut self, x: i32, y: i32, tile: Tile)
pub fn set_ceiling(&mut self, x: i32, y: i32, tile: Tile)
Sets a ceiling at the given position
Sourcepub fn has_ceiling(&self, x: i32, y: i32) -> bool
pub fn has_ceiling(&self, x: i32, y: i32) -> bool
Checks if there is a ceiling at the given position
Sourcepub fn get_ceiling(&self, x: i32, y: i32) -> Option<&Tile>
pub fn get_ceiling(&self, x: i32, y: i32) -> Option<&Tile>
Gets the ceiling at the given position
Sourcepub fn set_default_floor(&mut self, tile: Tile)
pub fn set_default_floor(&mut self, tile: Tile)
Sets the floor tile
Sourcepub fn get_default_floor(&self) -> Option<&Tile>
pub fn get_default_floor(&self) -> Option<&Tile>
Gets the floor tile
Sourcepub fn has_floor(&self, x: i32, y: i32) -> bool
pub fn has_floor(&self, x: i32, y: i32) -> bool
Checks if there is a floor at the given position
Sourcepub fn add_image(&mut self, data: Vec<u8>, width: u32, height: u32) -> usize
pub fn add_image(&mut self, data: Vec<u8>, width: u32, height: u32) -> usize
Adds an image to the list of images
Sourcepub fn get_image(&self, index: usize) -> Option<&(Vec<u8>, u32, u32)>
pub fn get_image(&self, index: usize) -> Option<&(Vec<u8>, u32, u32)>
Gets the image at the given index
Sourcepub fn add_sprite(&mut self, sprite: Sprite)
pub fn add_sprite(&mut self, sprite: Sprite)
Adds a sprite to the list of sprites
pub fn compute_lighting(&mut self)
Auto Trait Implementations§
impl Freeze for WorldMap
impl RefUnwindSafe for WorldMap
impl Send for WorldMap
impl Sync for WorldMap
impl Unpin for WorldMap
impl UnwindSafe for WorldMap
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more