🎉 Cache extra tiles

This commit is contained in:
Aitor Moreno 2025-03-25 16:39:45 +01:00 committed by Alejandro Alonso
parent e8549ffb79
commit 08fc32cdc6
2 changed files with 15 additions and 10 deletions

View file

@ -33,6 +33,14 @@ pub fn get_tiles_for_viewbox(viewbox: Viewbox) -> (i32, i32, i32, i32) {
get_tiles_for_rect(viewbox.area, tile_size)
}
pub fn get_tiles_for_viewbox_with_interest(
viewbox: Viewbox,
interest: i32,
) -> (i32, i32, i32, i32) {
let (sx, sy, ex, ey) = get_tiles_for_viewbox(viewbox);
(sx - interest, sy - interest, ex + interest, ey + interest)
}
pub fn get_tile_pos(viewbox: Viewbox, (x, y): Tile) -> (f32, f32) {
(
x as f32 * get_tile_size(viewbox),