pub struct Grid {
pub origin: Pos,
pub corner: (i32, i32),
pub tile: (i32, i32),
pub tiles: (i32, i32),
pub scale: i32,
pub projection: Projection,
}Expand description
The tiles of a scene laid out on the console.
Fields§
§origin: PosThe map tile in the top-left corner.
corner: (i32, i32)The top-left pixel of that tile.
tile: (i32, i32)A tile’s size in pixels, across × down.
tiles: (i32, i32)Tiles drawn, across × down.
scale: i32Console pixels per pixel of the art (the skin’s zoom): 1 unless
everything on the map is drawn bigger. tile already counts it.
projection: ProjectionHow the tiles are laid.
Implementations§
Source§impl Grid
impl Grid
Sourcepub const fn top_down(
origin: Pos,
corner: (i32, i32),
tile: (i32, i32),
tiles: (i32, i32),
scale: i32,
) -> Self
pub const fn top_down( origin: Pos, corner: (i32, i32), tile: (i32, i32), tiles: (i32, i32), scale: i32, ) -> Self
tiles tiles of tile pixels from the map tile origin, whose
top-left pixel is corner, laid top-down at the zoom scale.
Sourcepub fn offset(&self, tile: Pos) -> Option<(i32, i32)>
pub fn offset(&self, tile: Pos) -> Option<(i32, i32)>
Where tile is, as tiles right of and below the origin, if drawn.
Sourcepub fn tile_px(&self, tile: Pos) -> (i32, i32)
pub fn tile_px(&self, tile: Pos) -> (i32, i32)
The top-left pixel of tile, drawn or not (it may lie outside the
grid).
Sourcepub fn rect_at(&self, dx: i32, dy: i32) -> PxRect
pub fn rect_at(&self, dx: i32, dy: i32) -> PxRect
The pixels of the tile dx right of and dy below the origin.
Sourcepub fn art_tile(&self) -> PxRect
pub fn art_tile(&self) -> PxRect
A tile at the art’s own size, its corner at (0, 0): what a mark’s
place on a tile is worked out on, whatever the zoom
(zoomed).
Sourcepub fn at_art_size(&self) -> Self
pub fn at_art_size(&self) -> Self
The same tiles at the art’s own size, laid from (0, 0): what a
drawing across tiles (the path) is worked out on, whatever the
zoom, before zoomed from this grid’s corner
places it.