idx_size and cood_to_idx
This commit is contained in:
parent
c18b32660a
commit
b528c6adbe
|
@ -82,6 +82,10 @@ impl HexMap {
|
|||
Vec2 { x, y }
|
||||
}
|
||||
|
||||
fn coord_to_idx(&self, coord: Vec2<i32>) -> usize {
|
||||
(coord.x + coord.y * self.size.x) as usize
|
||||
}
|
||||
|
||||
pub fn coord_to_pixel(&self, coord: Vec2<i32>) -> Vec2<i32> {
|
||||
Vec2 {
|
||||
x: coord.x * self.pix_tile_off.x,
|
||||
|
@ -110,6 +114,10 @@ impl HexMap {
|
|||
self.size
|
||||
}
|
||||
|
||||
pub fn idx_size(&self) -> usize {
|
||||
self.size.size()
|
||||
}
|
||||
|
||||
//pubcrate
|
||||
pub(crate) fn draw_tile_to_image(
|
||||
&self,
|
||||
|
@ -122,11 +130,6 @@ impl HexMap {
|
|||
self.tileset.get(self.data[self.coord_to_idx(coord)]),
|
||||
)
|
||||
}
|
||||
|
||||
//priv
|
||||
fn coord_to_idx(&self, coord: Vec2<i32>) -> usize {
|
||||
(coord.x + coord.y * self.size.x) as usize
|
||||
}
|
||||
}
|
||||
|
||||
impl Distribution<Direction> for Standard {
|
||||
|
|
Loading…
Reference in New Issue