pub struct SpriteSkin { /* private fields */ }Expand description
A grid map’s ground painted from terrain tiles.
Implementations§
Source§impl SpriteSkin
impl SpriteSkin
Sourcepub const fn new(
terrain: Option<TerrainTiles>,
glyph: GlyphSkin,
walk: WalkSpeeds,
) -> Self
pub const fn new( terrain: Option<TerrainTiles>, glyph: GlyphSkin, walk: WalkSpeeds, ) -> Self
The skin of terrain at the art’s own size, with glyph’s colors
(and its ground, without terrain tiles), showing a walk at walk.
Sourcepub fn with_zooms(self, levels: &[i32]) -> Self
pub fn with_zooms(self, levels: &[i32]) -> Self
The same skin, offering levels as its
zoom_levels when its terrain tiles paint
the ground: sorted, each once, those below 1 left out.
Sourcepub fn zoomed(self, zoom: i32) -> Self
pub fn zoomed(self, zoom: i32) -> Self
The same skin drawn zoom times the art’s size (at least once).
Sourcepub const fn terrain(&self) -> Option<&TerrainTiles>
pub const fn terrain(&self) -> Option<&TerrainTiles>
Its terrain tiles, if it has them.
Sourcepub const fn zoom(&self) -> i32
pub const fn zoom(&self) -> i32
The zoom it was given: console pixels per pixel of the art, when it has terrain tiles.
Sourcepub fn tile_size(&self) -> (i32, i32)
pub fn tile_size(&self) -> (i32, i32)
A map tile’s size on screen, across × down, in console pixels: the tiles’ times the zoom, or the glyph skin’s without terrain tiles. Everything that depends on the tile size goes through this.
Sourcepub fn view_tiles(&self, area: Rect) -> (i32, i32)
pub fn view_tiles(&self, area: Rect) -> (i32, i32)
The area’s pixels divided by the tile size, rounded down; without terrain tiles, what the glyph skin fits.
Trait Implementations§
Source§impl Clone for SpriteSkin
impl Clone for SpriteSkin
Source§fn clone(&self) -> SpriteSkin
fn clone(&self) -> SpriteSkin
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SpriteSkin
impl Debug for SpriteSkin
Source§impl<U> GridSkin<U> for SpriteSkin
impl<U> GridSkin<U> for SpriteSkin
Source§fn name(&self) -> &'static str
fn name(&self) -> &'static str
"sprite" when the tiles paint the ground, "sprite_units" on the
glyph skin’s ground.
Source§fn zoom_levels(&self) -> &[i32]
fn zoom_levels(&self) -> &[i32]
The levels it was given (SpriteSkin::with_zooms), with terrain
tiles; none without.
Source§fn paint(
&self,
looks: &Looks<'_>,
scene: &MapScene<U>,
area: Rect,
units: &dyn UnitPainter<U>,
buf: &mut GlyphBuffer,
)
fn paint( &self, looks: &Looks<'_>, scene: &MapScene<U>, area: Rect, units: &dyn UnitPainter<U>, buf: &mut GlyphBuffer, )
The ground (terrain tinted by flashes and ranges), what lies under
the units (UnitPainter::paint_under), the path’s line, the
units, the path’s arrowhead, what lies over them
(UnitPainter::paint_over), then the cursor; over them all, the
threat arrows and marks.
Source§fn tile_size(&self) -> (i32, i32)
fn tile_size(&self) -> (i32, i32)
Source§fn view_tiles(&self, area: Rect) -> (i32, i32)
fn view_tiles(&self, area: Rect) -> (i32, i32)
area cells.Source§fn grid(&self, scene: &MapScene<U>, area: Rect) -> Grid
fn grid(&self, scene: &MapScene<U>, area: Rect) -> Grid
scene’s tiles go when it is painted into area.