diff --git a/agb/examples/bitmap3.rs b/agb/examples/bitmap3.rs index 5c45544c..06fb89c6 100644 --- a/agb/examples/bitmap3.rs +++ b/agb/examples/bitmap3.rs @@ -14,7 +14,7 @@ struct Vector2D { pub fn main() -> ! { let mut gba = agb::Gba::new(); let mut bitmap = gba.display.video.bitmap3(); - let vblank = agb::interrupt::VBlank::new(); + let vblank = agb::interrupt::VBlank::get(); let mut input = agb::input::ButtonController::new(); let mut pos = Vector2D { diff --git a/agb/examples/bitmap4.rs b/agb/examples/bitmap4.rs index 4c40fafc..b097e688 100644 --- a/agb/examples/bitmap4.rs +++ b/agb/examples/bitmap4.rs @@ -9,7 +9,7 @@ use agb::display; pub fn main() -> ! { let mut gba = agb::Gba::new(); let mut bitmap = gba.display.video.bitmap4(); - let vblank = agb::interrupt::VBlank::new(); + let vblank = agb::interrupt::VBlank::get(); bitmap.set_palette_entry(1, 0x001F); bitmap.set_palette_entry(2, 0x03E0); diff --git a/agb/examples/chicken.rs b/agb/examples/chicken.rs index 47f531f0..8650730d 100644 --- a/agb/examples/chicken.rs +++ b/agb/examples/chicken.rs @@ -45,7 +45,7 @@ pub fn main() -> ! { let mut gba = agb::Gba::new(); let mut gfx = gba.display.video.tiled0(); - let vblank = agb::interrupt::VBlank::new(); + let vblank = agb::interrupt::VBlank::get(); let mut input = agb::input::ButtonController::new(); gfx.set_sprite_palette_raw(&CHICKEN_PALETTE); diff --git a/agb/examples/mixer_basic.rs b/agb/examples/mixer_basic.rs index a5bc18d7..b26deda6 100644 --- a/agb/examples/mixer_basic.rs +++ b/agb/examples/mixer_basic.rs @@ -15,7 +15,7 @@ const I_WILL_NOT_LET_YOU_LET_ME_DOWN: &[u8] = include_bytes!("i-will-not-let-you pub fn main() -> ! { let mut gba = Gba::new(); let mut input = ButtonController::new(); - let vblank_provider = agb::interrupt::VBlank::new(); + let vblank_provider = agb::interrupt::VBlank::get(); let mut mixer = gba.mixer.mixer(); mixer.enable(); diff --git a/agb/examples/multiple_video.rs b/agb/examples/multiple_video.rs index 226c1afe..174241e1 100644 --- a/agb/examples/multiple_video.rs +++ b/agb/examples/multiple_video.rs @@ -13,7 +13,7 @@ struct Vector2D { #[no_mangle] pub fn main() -> ! { let mut gba = agb::Gba::new(); - let vblank = agb::interrupt::VBlank::new(); + let vblank = agb::interrupt::VBlank::get(); let mut input = agb::input::ButtonController::new(); loop { diff --git a/agb/examples/output.rs b/agb/examples/output.rs index 6eb91406..01702656 100644 --- a/agb/examples/output.rs +++ b/agb/examples/output.rs @@ -4,7 +4,7 @@ extern crate agb; #[no_mangle] pub fn main() -> ! { - let vblank = agb::interrupt::VBlank::new(); + let vblank = agb::interrupt::VBlank::get(); let mut count = 0; loop { diff --git a/agb/examples/wave.rs b/agb/examples/wave.rs index 9c45ff4b..3ebec1aa 100644 --- a/agb/examples/wave.rs +++ b/agb/examples/wave.rs @@ -45,7 +45,7 @@ pub fn main() -> ! { backc.row += 1; }); - let vblank = agb::interrupt::VBlank::new(); + let vblank = agb::interrupt::VBlank::get(); loop { vblank.wait_for_vblank(); diff --git a/agb/src/interrupt.rs b/agb/src/interrupt.rs index c68e34c5..db91d961 100644 --- a/agb/src/interrupt.rs +++ b/agb/src/interrupt.rs @@ -257,7 +257,7 @@ fn test_vblank_interrupt_handler(_gba: &mut crate::Gba) { add_interrupt_handler!(Interrupt::VBlank, || *counter.lock() += 1); add_interrupt_handler!(Interrupt::VBlank, || *counter_2.lock() += 1); - let vblank = VBlank::new(); + let vblank = VBlank::get(); while *counter.lock() < 100 || *counter_2.lock() < 100 { vblank.wait_for_vblank(); @@ -353,7 +353,7 @@ impl<'a, T> DerefMut for MutexRef<'a, T> { pub struct VBlank {} impl VBlank { - pub fn new() -> Self { + pub fn get() -> Self { interrupt_to_root(Interrupt::VBlank).add(); VBlank {} } diff --git a/agb/src/lib.rs b/agb/src/lib.rs index dfa25595..618021a7 100644 --- a/agb/src/lib.rs +++ b/agb/src/lib.rs @@ -164,7 +164,7 @@ mod test { #[test_case] fn wait_30_frames(_gba: &mut Gba) { - let vblank = crate::interrupt::VBlank::new(); + let vblank = crate::interrupt::VBlank::get(); let mut counter = 0; loop { if counter > 30 {