Skip to main content

TwoPartTileSet

Struct TwoPartTileSet 

Source
pub struct TwoPartTileSet { /* private fields */ }
Expand description

An implementation of TileSet that expects a hash map of tile foregrounds and a single background image.

This implementation automatically combines background and foreground on the fly. Also, it assumes “realistic” light for the rendered tiles (i.e. for rotated tiles, it mirrors the background, so it always seems like the light is coming from once source).

Implementations§

Source§

impl TwoPartTileSet

Source

pub fn new( front: RgbaImage, tile_map: HashMap<Tile, RgbaImage>, ) -> Result<Self, TileSetCreationError>

Creates a new TwoPartTileSet instance using given background image and a map of tile foregrounds.

Trait Implementations§

Source§

impl Debug for TwoPartTileSet

Source§

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

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

impl TileSet for TwoPartTileSet

Source§

fn tile_image(&self, hand_tile: &HandTile) -> TileImageResult

Returns an image of given tile, taking into account the tile placement (rotation). Read more
Source§

fn tile_width(&self) -> u32

Returns tile width, in pixels. Must be the same for all images.
Source§

fn tile_height(&self) -> u32

Returns tile height, in pixels. Must be the same for all images.

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> 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, 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.