From d94d9dbcf327bf2f919d637d637d0acafcb79b64 Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper Date: Mon, 7 Feb 2022 23:36:46 +0000 Subject: [PATCH] Print number of cycles for background initialisation --- examples/the-hat-chooses-the-wizard/src/main.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/examples/the-hat-chooses-the-wizard/src/main.rs b/examples/the-hat-chooses-the-wizard/src/main.rs index 3a44e8ba..f2b8fbc2 100644 --- a/examples/the-hat-chooses-the-wizard/src/main.rs +++ b/examples/the-hat-chooses-the-wizard/src/main.rs @@ -787,6 +787,9 @@ fn main(mut agb: agb::Gba) -> ! { let mut timer_controller = agb.timers.timers(); let mut mixer = agb.mixer.mixer(&mut timer_controller.timer0); + let mut timer = timer_controller.timer1; + timer.set_enabled(true); + object.set_sprite_palettes(object_sheet::object_sheet.palettes); object.set_sprite_tilemap(object_sheet::object_sheet.tiles); @@ -877,12 +880,17 @@ fn main(mut agb: agb::Gba) -> ! { agb::input::ButtonController::new(), ); + let before_init_cycles = timer.get_value(); level.background.init_background(&mut vram); + let after_init_cycles = timer.get_value(); + music_box.before_frame(&mut mixer); mixer.frame(); vblank.wait_for_vblank(); mixer.after_vblank(); + agb::println!("cycles for init {}", after_init_cycles - before_init_cycles); + level.background.init_foreground(&mut vram); for _ in 0..60 {