mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-24 00:31:34 +11:00
Merge pull request #99 from agbrs/println-macro
add println macro for mgba
This commit is contained in:
commit
8cd5055e80
|
@ -5,7 +5,6 @@ extern crate agb;
|
|||
#[no_mangle]
|
||||
pub fn main() -> ! {
|
||||
let mut gba = agb::Gba::new();
|
||||
let mut mgba = agb::mgba::Mgba::new().unwrap();
|
||||
|
||||
let vblank = gba.display.vblank.get();
|
||||
|
||||
|
@ -13,11 +12,7 @@ pub fn main() -> ! {
|
|||
loop {
|
||||
vblank.wait_for_VBlank();
|
||||
|
||||
mgba.print(
|
||||
format_args!("Hello, world, frame = {}", count),
|
||||
agb::mgba::DebugLevel::Info,
|
||||
)
|
||||
.unwrap();
|
||||
agb::println!("Hello, world, frame = {}", count);
|
||||
|
||||
count += 1;
|
||||
}
|
||||
|
|
|
@ -78,3 +78,14 @@ impl core::fmt::Write for Mgba {
|
|||
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