diff --git a/agb/examples/test_logo.rs b/agb/examples/test_logo.rs index 8cfc8164..e61da840 100644 --- a/agb/examples/test_logo.rs +++ b/agb/examples/test_logo.rs @@ -7,7 +7,10 @@ use agb::display::example_logo; fn main(mut gba: agb::Gba) -> ! { let mut gfx = gba.display.video.tiled0(); - example_logo::display_logo(&mut gfx); + let mut map = gfx.background(); + let mut vram = gfx.vram; + + example_logo::display_logo(&mut map, &mut vram); loop {} } diff --git a/agb/src/display/example_logo.rs b/agb/src/display/example_logo.rs index 0f65a178..93f571bc 100644 --- a/agb/src/display/example_logo.rs +++ b/agb/src/display/example_logo.rs @@ -1,31 +1,32 @@ -use crate::display::background::Tiled0; - -use super::background::{Tile, TileFormat, TileSet}; +use super::background::{RegularMap, TileFormat, TileSet, TileSetting, VRamManager}; crate::include_gfx!("gfx/agb_logo.toml"); -pub fn display_logo(gfx: &mut Tiled0) { - gfx.vram - .set_background_palettes(agb_logo::test_logo.palettes); +pub fn display_logo(map: &mut RegularMap, vram: &mut VRamManager) { + vram.set_background_palettes(agb_logo::test_logo.palettes); let background_tilemap = TileSet::new(agb_logo::test_logo.tiles, TileFormat::FourBpp); - let background_tilemap_reference = gfx.vram.add_tileset(background_tilemap); - - let mut back = gfx.background(); + let background_tilemap_reference = vram.add_tileset(background_tilemap); for y in 0..20 { for x in 0..30 { let tile_id = y * 30 + x; - let palette_entry = agb_logo::test_logo.palette_assignments[tile_id as usize] as u16; - let tile = gfx.vram.add_tile(background_tilemap_reference, tile_id); + let palette_entry = agb_logo::test_logo.palette_assignments[tile_id as usize]; + let tile_setting = TileSetting::new(false, false, palette_entry); - back.set_tile(x, y, Tile::new(tile, false, false, palette_entry)) + map.set_tile( + vram, + (x, y).into(), + background_tilemap_reference, + tile_id, + tile_setting, + ); } } - back.commit(); - back.show(); + map.commit(); + map.show(); } #[cfg(test)] mod tests { @@ -35,7 +36,9 @@ mod tests { fn logo_display(gba: &mut crate::Gba) { let mut gfx = gba.display.video.tiled0(); - display_logo(&mut gfx); + let mut map = gfx.background(); + + display_logo(&mut map, &mut gfx.vram); crate::test_runner::assert_image_output("gfx/test_logo.png"); }