pub enum TileType {
Ortho {
width: u32,
height: u32,
render_order: RenderOrder,
},
Isometric {
width: u32,
height: u32,
stagger: bool,
stagger_odd: bool,
stagger_y: bool,
render_order: RenderOrder,
},
Hexagonal {
width: u32,
height: u32,
stagger_odd: bool,
stagger_y: bool,
side_length: u32,
render_order: RenderOrder,
},
}
Expand description
Tiled has three different rendering types: orthographic, isometric and hexagonal. They are represented through this enum.
Variants§
Ortho
Orthographic (square/rectangle) rendering mode
Fields
§
render_order: RenderOrder
RenderOrder of tiles. Todo.
Isometric
Isometric rendering mode
Fields
§
render_order: RenderOrder
RenderOrder of tiles. Todo.
Hexagonal
Hexagonal rendering mode
Fields
§
render_order: RenderOrder
RenderOrder of tiles. Todo.
Implementations§
Source§impl TileType
impl TileType
Sourcepub fn coord_to_pos(&self, layer_height: i32, x: i32, y: i32) -> (i32, i32)
pub fn coord_to_pos(&self, layer_height: i32, x: i32, y: i32) -> (i32, i32)
Convert tile coordinates to it’s top left coordinates in pixels. Returns (x, y) in pixels.
layer_height
- The height in tiles of the layer that the coordinates belong to. Ignored for non isometric layouts.x
- The horizontal component of the coordinatey
- The vertical component of the coordinate
Sourcepub fn pos_to_coord(&self, layer_height: i32, x: i32, y: i32) -> (i32, i32)
pub fn pos_to_coord(&self, layer_height: i32, x: i32, y: i32) -> (i32, i32)
Convert coordinates in pixels to tile coordinates. Returns (x, y) in tile coordinates.
layer_height
- The height in tiles of the layer that the coordinates belong to. Ignored for non isometric layouts.x
- The horizontal pixel coordinatey
- The vertical pixel coordinate
Sourcepub fn tile_width(&self) -> u32
pub fn tile_width(&self) -> u32
Get the tile width of this tile type.
Sourcepub fn tile_height(&self) -> u32
pub fn tile_height(&self) -> u32
Get the tile height of this tile type.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TileType
impl RefUnwindSafe for TileType
impl Send for TileType
impl Sync for TileType
impl Unpin for TileType
impl UnwindSafe for TileType
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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