Skip to main content

GlyphSkin

Struct GlyphSkin 

Source
pub struct GlyphSkin {
    pub colors: MapColors,
    pub walk: WalkSpeeds,
    pub foot_px: i32,
    pub style: GlyphStyle,
}
Expand description

A grid map as colored glyphs: each tile its terrain’s two glyphs, the ranges tinting their background (in its plain style).

Fields§

§colors: MapColors

The palette’s names of the path’s, the cursor’s and the threat arrows’ colors.

§walk: WalkSpeeds

How fast a walk is shown.

§foot_px: i32

How many pixels at the foot of a tile the units’ own marks use (a game’s HP bar): the cursor’s lower arms stay above them.

§style: GlyphStyle

How ranges, flashes, the cursor and the threat marks show, and the cells left at the sides. (The sprite skin’s glyph ground is always in the plain style.)

Implementations§

Source§

impl GlyphSkin

Source

pub const fn new(colors: MapColors, walk: WalkSpeeds, foot_px: i32) -> Self

The skin of colors in the plain style, showing a walk at walk, its cursor’s lower arms above the foot_px pixels at a tile’s foot.

Source

pub const fn styled(self, style: GlyphStyle) -> Self

The same skin in style.

Source

pub fn cursor_ink(&self, looks: &Looks<'_>) -> CursorInk

How its cursor looks in looks’ colors.

Source

pub fn draw_cursor<U>( &self, looks: &Looks<'_>, buf: &mut GlyphBuffer, scene: &MapScene<U>, layout: &Layout, )

Draws the scene’s cursor, if it is on a tile of layout, as the plain style does.

Trait Implementations§

Source§

impl Clone for GlyphSkin

Source§

fn clone(&self) -> GlyphSkin

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for GlyphSkin

Source§

impl Debug for GlyphSkin

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<U> GridSkin<U> for GlyphSkin

Source§

fn paint( &self, looks: &Looks<'_>, scene: &MapScene<U>, area: Rect, units: &dyn UnitPainter<U>, buf: &mut GlyphBuffer, )

Terrain, then the ranges on it, then what lies under the units (UnitPainter::paint_under), the units, the path, what lies over them (UnitPainter::paint_over) and the cursor; over them all, the threat arrows and marks.

Source§

fn name(&self) -> &'static str

A stable snake_case name for the kind of skin, e.g. "glyph".
Source§

fn tile_size(&self) -> (i32, i32)

A map tile’s size on screen, across × down, in console pixels.
Source§

fn view_tiles(&self, area: Rect) -> (i32, i32)

How many tiles, across × down, fit in a map area of area cells.
Source§

fn grid(&self, scene: &MapScene<U>, area: Rect) -> Grid

Where scene’s tiles go when it is painted into area.
Source§

fn walk(&self) -> WalkSpeeds

How fast a unit’s walk is shown under this skin.
Source§

fn zoom_levels(&self) -> &[i32]

The zooms it can draw the map at, smallest first: console pixels per pixel of its art. None if it can’t zoom (the glyph skin: its tile is two font cells).
Source§

fn zoom(&self) -> Option<i32>

The zoom it draws at, or None if it can’t zoom.
Source§

fn at_zoom(&self, _zoom: i32) -> Option<Rc<dyn GridSkin<U>>>

The same skin drawing at zoom, or None if zoom isn’t one of its zoom_levels.
Source§

fn tile_px(&self, scene: &MapScene<U>, area: Rect, tile: Pos) -> Option<PxRect>

The console pixels of tile when scene is painted into area, or None if it isn’t visible. Menus and popups go beside it.
Source§

fn tile_cells(&self, scene: &MapScene<U>, area: Rect, tile: Pos) -> Option<Rect>

The cells tile_px touches.
Source§

impl PartialEq for GlyphSkin

Source§

fn eq(&self, other: &GlyphSkin) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for GlyphSkin

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.