mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 16:21:33 +11:00
Update agb tests and all the examples
This commit is contained in:
parent
0d623fc5b0
commit
cf9ea504f6
|
@ -6,7 +6,7 @@ extern crate alloc;
|
|||
use alloc::boxed::Box;
|
||||
|
||||
#[agb::entry]
|
||||
fn main() -> ! {
|
||||
fn main(_gba: agb::Gba) -> ! {
|
||||
loop {
|
||||
let b = Box::new(1);
|
||||
agb::println!("dynamic allocation made to {:?}", &*b as *const _);
|
||||
|
|
|
@ -4,9 +4,7 @@
|
|||
use agb::sound;
|
||||
|
||||
#[agb::entry]
|
||||
fn main() -> ! {
|
||||
let gba = agb::Gba::new();
|
||||
|
||||
fn main(gba: agb::Gba) -> ! {
|
||||
gba.sound.enable();
|
||||
|
||||
let sweep_settings = sound::dmg::SweepSettings::default();
|
||||
|
|
|
@ -9,8 +9,7 @@ struct Vector2D {
|
|||
}
|
||||
|
||||
#[agb::entry]
|
||||
fn main() -> ! {
|
||||
let mut gba = agb::Gba::new();
|
||||
fn main(mut gba: agb::Gba) -> ! {
|
||||
let mut bitmap = gba.display.video.bitmap3();
|
||||
let vblank = agb::interrupt::VBlank::get();
|
||||
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
use agb::display;
|
||||
|
||||
#[agb::entry]
|
||||
fn main() -> ! {
|
||||
let mut gba = agb::Gba::new();
|
||||
fn main(mut gba: agb::Gba) -> ! {
|
||||
let mut bitmap = gba.display.video.bitmap4();
|
||||
let vblank = agb::interrupt::VBlank::get();
|
||||
|
||||
|
|
|
@ -35,14 +35,13 @@ fn frame_ranger(count: u32, start: u32, end: u32, delay: u32) -> u16 {
|
|||
}
|
||||
|
||||
#[agb::entry]
|
||||
fn main() -> ! {
|
||||
fn main(mut gba: agb::Gba) -> ! {
|
||||
let map_as_grid: &[[u16; 32]; 32] = unsafe {
|
||||
(&MAP_MAP as *const [u16; 1024] as *const [[u16; 32]; 32])
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
};
|
||||
|
||||
let mut gba = agb::Gba::new();
|
||||
let mut gfx = gba.display.video.tiled0();
|
||||
let vblank = agb::interrupt::VBlank::get();
|
||||
let mut input = agb::input::ButtonController::new();
|
||||
|
|
|
@ -10,8 +10,7 @@ use agb::{include_wav, Gba};
|
|||
const DEAD_CODE: &[u8] = include_wav!("examples/JoshWoodward-DeadCode.wav");
|
||||
|
||||
#[agb::entry]
|
||||
fn main() -> ! {
|
||||
let mut gba = Gba::new();
|
||||
fn main(mut gba: Gba) -> ! {
|
||||
let mut input = ButtonController::new();
|
||||
let vblank_provider = agb::interrupt::VBlank::get();
|
||||
|
||||
|
|
|
@ -9,8 +9,7 @@ struct Vector2D {
|
|||
}
|
||||
|
||||
#[agb::entry]
|
||||
fn main() -> ! {
|
||||
let mut gba = agb::Gba::new();
|
||||
fn main(mut gba: agb::Gba) -> ! {
|
||||
let vblank = agb::interrupt::VBlank::get();
|
||||
let mut input = agb::input::ButtonController::new();
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#![no_main]
|
||||
|
||||
#[agb::entry]
|
||||
fn main() -> ! {
|
||||
fn main(_gba: agb::Gba) -> ! {
|
||||
let count = agb::interrupt::Mutex::new(0);
|
||||
agb::add_interrupt_handler!(agb::interrupt::Interrupt::VBlank, |key| {
|
||||
let mut count = count.lock_with_key(&key);
|
||||
|
|
|
@ -4,9 +4,7 @@
|
|||
use agb::display;
|
||||
|
||||
#[agb::entry]
|
||||
fn main() -> ! {
|
||||
let mut gba = agb::Gba::new();
|
||||
|
||||
fn main(mut gba: agb::Gba) -> ! {
|
||||
let mut bitmap = gba.display.video.bitmap3();
|
||||
let mut input = agb::input::ButtonController::new();
|
||||
|
||||
|
|
|
@ -8,8 +8,7 @@ use agb::{include_wav, Gba};
|
|||
const LET_IT_IN: &[u8] = include_wav!("examples/JoshWoodward-LetItIn.wav");
|
||||
|
||||
#[agb::entry]
|
||||
fn main() -> ! {
|
||||
let mut gba = Gba::new();
|
||||
fn main(mut gba: Gba) -> ! {
|
||||
let vblank_provider = agb::interrupt::VBlank::get();
|
||||
|
||||
let mut timer_controller = gba.timers.timers();
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
use agb::{display, syscall};
|
||||
|
||||
#[agb::entry]
|
||||
fn main() -> ! {
|
||||
let mut gba = agb::Gba::new();
|
||||
fn main(mut gba: agb::Gba) -> ! {
|
||||
let mut bitmap = gba.display.video.bitmap3();
|
||||
|
||||
for x in 0..display::WIDTH {
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
use agb::display::example_logo;
|
||||
|
||||
#[agb::entry]
|
||||
fn main() -> ! {
|
||||
let mut gba = agb::Gba::new();
|
||||
fn main(mut gba: agb::Gba) -> ! {
|
||||
let mut gfx = gba.display.video.tiled0();
|
||||
|
||||
example_logo::display_logo(&mut gfx);
|
||||
|
|
|
@ -13,8 +13,7 @@ struct BackCosines {
|
|||
}
|
||||
|
||||
#[agb::entry]
|
||||
fn main() -> ! {
|
||||
let mut gba = agb::Gba::new();
|
||||
fn main(mut gba: agb::Gba) -> ! {
|
||||
let mut gfx = gba.display.video.tiled0();
|
||||
|
||||
example_logo::display_logo(&mut gfx);
|
||||
|
|
|
@ -283,7 +283,11 @@ fn panic_implementation(info: &core::panic::PanicInfo) -> ! {
|
|||
loop {}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
static mut TEST_GBA: Option<Gba> = None;
|
||||
|
||||
#[doc(hidden)]
|
||||
#[cfg(test)]
|
||||
pub fn test_runner(tests: &[&dyn Testable]) {
|
||||
let mut mgba = mgba::Mgba::new().unwrap();
|
||||
mgba.print(
|
||||
|
@ -292,7 +296,7 @@ pub fn test_runner(tests: &[&dyn Testable]) {
|
|||
)
|
||||
.unwrap();
|
||||
|
||||
let mut gba = Gba::new();
|
||||
let mut gba = unsafe { TEST_GBA.as_mut() }.unwrap();
|
||||
|
||||
for test in tests {
|
||||
test.run(&mut gba);
|
||||
|
@ -307,7 +311,8 @@ pub fn test_runner(tests: &[&dyn Testable]) {
|
|||
|
||||
#[cfg(test)]
|
||||
#[entry]
|
||||
fn agb_test_main() -> ! {
|
||||
fn agb_test_main(gba: Gba) -> ! {
|
||||
unsafe { TEST_GBA = Some(gba) };
|
||||
test_main();
|
||||
#[allow(clippy::empty_loop)]
|
||||
loop {}
|
||||
|
|
Loading…
Reference in a new issue