From 12406fc952dd9f0fe15aaafaa5b0e146fb7cab46 Mon Sep 17 00:00:00 2001 From: Corwin Kuiper Date: Fri, 4 Jun 2021 10:30:25 +0100 Subject: [PATCH] test the test logo --- agb/src/display/example_logo.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/agb/src/display/example_logo.rs b/agb/src/display/example_logo.rs index 8ae0d052..42e2c47b 100644 --- a/agb/src/display/example_logo.rs +++ b/agb/src/display/example_logo.rs @@ -1 +1,31 @@ include!(concat!(env!("OUT_DIR"), "/test_logo.rs")); + +#[test_case] +fn logo_display(gba: &mut crate::Gba) { + let mut gfx = gba.display.video.tiled0(); + + gfx.set_background_palettes(PALETTE_DATA); + gfx.set_background_tilemap(0, TILE_DATA); + + let mut back = gfx.get_background().unwrap(); + + let mut entries: [u16; 30 * 20] = [0; 30 * 20]; + for tile_id in 0..(30 * 20) { + let palette_entry = PALETTE_ASSIGNMENT[tile_id as usize] as u16; + entries[tile_id as usize] = tile_id | (palette_entry << 12); + } + + back.set_map(&entries, 30, 20); + back.set_position(0, 0); + back.show(); + + let vblank = gba.display.vblank.get(); + vblank.wait_for_VBlank(); + let mut mgba = crate::mgba::Mgba::new().unwrap(); + mgba.print( + format_args!("image:gfx/test_logo.png"), + crate::mgba::DebugLevel::Info, + ) + .unwrap(); + vblank.wait_for_VBlank(); +}