mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-25 01:01:34 +11:00
add println macro for mgba
This commit is contained in:
parent
c265a95996
commit
42647b7373
|
@ -5,7 +5,6 @@ extern crate agb;
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn main() -> ! {
|
pub fn main() -> ! {
|
||||||
let mut gba = agb::Gba::new();
|
let mut gba = agb::Gba::new();
|
||||||
let mut mgba = agb::mgba::Mgba::new().unwrap();
|
|
||||||
|
|
||||||
let vblank = gba.display.vblank.get();
|
let vblank = gba.display.vblank.get();
|
||||||
|
|
||||||
|
@ -13,11 +12,7 @@ pub fn main() -> ! {
|
||||||
loop {
|
loop {
|
||||||
vblank.wait_for_VBlank();
|
vblank.wait_for_VBlank();
|
||||||
|
|
||||||
mgba.print(
|
agb::println!("Hello, world, frame = {}", count);
|
||||||
format_args!("Hello, world, frame = {}", count),
|
|
||||||
agb::mgba::DebugLevel::Info,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
count += 1;
|
count += 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,3 +78,14 @@ impl core::fmt::Write for Mgba {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! println {
|
||||||
|
($( $x:expr ),*) => {
|
||||||
|
{
|
||||||
|
if let Some(mut mgba) = $crate::mgba::Mgba::new() {
|
||||||
|
let _ = mgba.print(format_args!($($x,)*), $crate::mgba::DebugLevel::Info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue