diff --git a/agb/src/display/tiled/infinite_scrolled_map.rs b/agb/src/display/tiled/infinite_scrolled_map.rs index 8b637a85..fa1c9e96 100644 --- a/agb/src/display/tiled/infinite_scrolled_map.rs +++ b/agb/src/display/tiled/infinite_scrolled_map.rs @@ -44,25 +44,23 @@ use crate::{ /// # 0, 1, 2]; /// pub const WIDTH: i32 = // set it to some width /// # 12; -/// pub const MAP_TILES: &[u8] = &[ // probably load this from a file -/// # 0]; /// } /// +/// agb::include_background_gfx!(water_tiles, tiles => "examples/water_tiles.png"); +/// /// # fn foo(mut gba: agb::Gba) { /// let (gfx, mut vram) = gba.display.video.tiled0(); /// -/// let tileset = TileSet::new(&tilemap::MAP_TILES, TileFormat::FourBpp); +/// let tileset = water_tiles::tiles.tiles; /// /// let mut backdrop = InfiniteScrolledMap::new( /// gfx.background(Priority::P2, RegularBackgroundSize::Background32x32, TileFormat::FourBpp), /// Box::new(|pos| { /// ( /// &tileset, -/// TileSetting::from_raw( -/// *tilemap::BACKGROUND_MAP +/// water_tiles.tile_settings[*tilemap::BACKGROUND_MAP /// .get((pos.x + tilemap::WIDTH * pos.y) as usize) -/// .unwrap_or(&0), -/// ), +/// .unwrap_or(&0)] /// ) /// }), /// ); @@ -140,21 +138,22 @@ impl<'a> InfiniteScrolledMap<'a> { /// # pub const MAP_TILES: &[u8] = &[0]; /// # } /// # + /// # agb::include_background_gfx!(water_tiles, tiles => "examples/water_tiles.png"); + /// # /// # fn foo(mut gba: agb::Gba) { /// # let (gfx, mut vram) = gba.display.video.tiled0(); /// # - /// # let tileset = TileSet::new(&tilemap::MAP_TILES, TileFormat::FourBpp); + /// # let tileset = water_tiles.tiles; /// # /// # let mut backdrop = InfiniteScrolledMap::new( /// # gfx.background(Priority::P2, RegularBackgroundSize::Background32x32, TileFormat::FourBpp), /// # Box::new(|pos| { /// # ( /// # &tileset, - /// # TileSetting::from_raw( + /// # tileset.tile_settings[ /// # *tilemap::BACKGROUND_MAP /// # .get((pos.x + tilemap::WIDTH * pos.y) as usize) - /// # .unwrap_or(&0), - /// # ), + /// # .unwrap_or(&0)] /// # ) /// # }), /// # ); @@ -215,21 +214,22 @@ impl<'a> InfiniteScrolledMap<'a> { /// # pub const MAP_TILES: &[u8] = &[0]; /// # } /// # + /// # agb::include_background_gfx!(water_tiles, tiles => "examples/water_tiles.png"); + /// # /// # fn foo(mut gba: agb::Gba) { /// # let (gfx, mut vram) = gba.display.video.tiled0(); /// # - /// # let tileset = TileSet::new(&tilemap::MAP_TILES, TileFormat::FourBpp); + /// # let tileset = water_tiles.tiles; /// # /// # let mut backdrop = InfiniteScrolledMap::new( /// # gfx.background(Priority::P2, RegularBackgroundSize::Background32x32, TileFormat::FourBpp), /// # Box::new(|pos| { /// # ( /// # &tileset, - /// # TileSetting::from_raw( + /// # tileset.tile_settings[ /// # *tilemap::BACKGROUND_MAP /// # .get((pos.x + tilemap::WIDTH * pos.y) as usize) - /// # .unwrap_or(&0), - /// # ), + /// # .unwrap_or(&0)] /// # ) /// # }), /// # ); diff --git a/agb/src/lib.rs b/agb/src/lib.rs index cd4762f6..73963fcc 100644 --- a/agb/src/lib.rs +++ b/agb/src/lib.rs @@ -77,11 +77,11 @@ /// agb::include_background_gfx!(water_tiles, tiles => "examples/water_tiles.png"); /// /// # fn load_tileset(mut gfx: Tiled0, mut vram: VRamManager) { -/// let tileset = TileSet::new(water_tiles::tiles.tiles, TileFormat::FourBpp); +/// let tileset = water_tiles::tiles.tiles; /// /// vram.set_background_palettes(water_tiles::PALETTES); /// -/// let mut bg = gfx.background(Priority::P0, RegularBackgroundSize::Background32x32, TileFormat::FourBpp); +/// let mut bg = gfx.background(Priority::P0, RegularBackgroundSize::Background32x32, tileset.format()); /// /// for y in 0..20u16 { /// for x in 0..30u16 {