diff --git a/agb/src/display/tiled/infinite_scrolled_map.rs b/agb/src/display/tiled/infinite_scrolled_map.rs index 01bce594..dba4bef2 100644 --- a/agb/src/display/tiled/infinite_scrolled_map.rs +++ b/agb/src/display/tiled/infinite_scrolled_map.rs @@ -9,7 +9,7 @@ use crate::{ pub struct InfiniteScrolledMap<'a> { map: MapLoan<'a, RegularMap>, - get_tile: Box) -> (TileSetReference, TileSetting)>, + tile: Box) -> (TileSetReference, TileSetting)>, current_pos: Vector2D, offset: Vector2D, @@ -26,11 +26,11 @@ pub enum PartialUpdateStatus { impl<'a> InfiniteScrolledMap<'a> { pub fn new( map: MapLoan<'a, RegularMap>, - get_tile: Box) -> (TileSetReference, TileSetting)>, + tile: Box) -> (TileSetReference, TileSetting)>, ) -> Self { Self { map, - get_tile, + tile, current_pos: (0, 0).into(), offset: (0, 0).into(), copied_up_to: 0, @@ -79,7 +79,7 @@ impl<'a> InfiniteScrolledMap<'a> { { for (x_idx, x) in (x_start..x_end).enumerate() { let pos = (x, y).into(); - let (tile_set_ref, tile_setting) = (self.get_tile)(pos); + let (tile_set_ref, tile_setting) = (self.tile)(pos); self.map.set_tile( vram, @@ -172,7 +172,7 @@ impl<'a> InfiniteScrolledMap<'a> { .iter() .chain(horizontal_rect_to_update.iter()) { - let (tile_set_ref, tile_setting) = (self.get_tile)((tile_x, tile_y).into()); + let (tile_set_ref, tile_setting) = (self.tile)((tile_x, tile_y).into()); self.map.set_tile( vram, @@ -186,7 +186,7 @@ impl<'a> InfiniteScrolledMap<'a> { ); } - let current_scroll = self.map.get_scroll_pos(); + let current_scroll = self.map.scroll_pos(); let new_scroll = ( (current_scroll.x as i32 + difference.x).rem_euclid(32 * 8) as u16, (current_scroll.y as i32 + difference.y).rem_euclid(32 * 8) as u16, diff --git a/agb/src/display/tiled/map.rs b/agb/src/display/tiled/map.rs index cfb9831a..ca33ee63 100644 --- a/agb/src/display/tiled/map.rs +++ b/agb/src/display/tiled/map.rs @@ -121,7 +121,7 @@ impl RegularMap { self.y_scroll = pos.y; } - pub fn get_scroll_pos(&self) -> Vector2D { + pub fn scroll_pos(&self) -> Vector2D { (self.x_scroll, self.y_scroll).into() }