fix examples

This commit is contained in:
jem 2022-11-20 19:35:03 +00:00
parent 75fe0532f1
commit 0f3182d5b8
2 changed files with 14 additions and 7 deletions

View file

@ -27,9 +27,10 @@ fn main(mut gba: Gba) -> ! {
init_background(&mut bg, &mut vram);
let mut writer = FONT.render_text((0u16, 3u16).into(), 1, 0, &mut bg, &mut vram);
let mut title_renderer = FONT.render_text((0u16, 3u16).into());
let mut writer = title_renderer.writer(1, 0, &mut bg, &mut vram);
writeln!(&mut writer, "Crazy Glue by Josh Woodward").unwrap();
writeln!(&mut writer, "Crazy Glue by Josh Woodward\n\n").unwrap();
writer.commit();
@ -51,6 +52,7 @@ fn main(mut gba: Gba) -> ! {
let mut frame_counter = 0i32;
let mut has_written_frame_time = false;
let mut stats_renderer = FONT.render_text((0u16, 6u16).into());
loop {
vblank_provider.wait_for_vblank();
bg.commit(&mut vram);
@ -66,7 +68,9 @@ fn main(mut gba: Gba) -> ! {
let percent = (total_cycles * 100) / 280896;
let mut writer = FONT.render_text((0u16, 6u16).into(), 2, 0, &mut bg, &mut vram);
stats_renderer.clear(&mut vram);
let mut writer = stats_renderer.writer(1, 0, &mut bg, &mut vram);
writeln!(&mut writer, "{total_cycles} cycles").unwrap();
writeln!(&mut writer, "{percent} percent").unwrap();

View file

@ -27,9 +27,10 @@ fn main(mut gba: Gba) -> ! {
init_background(&mut bg, &mut vram);
let mut writer = FONT.render_text((0u16, 3u16).into(), 1, 0, &mut bg, &mut vram);
let mut title_renderer = FONT.render_text((0u16, 3u16).into());
let mut writer = title_renderer.writer(1, 0, &mut bg, &mut vram);
writeln!(&mut writer, "Let it in by Josh Woodward").unwrap();
writeln!(&mut writer, "Crazy Glue by Josh Woodward\n\n").unwrap();
writer.commit();
@ -49,6 +50,8 @@ fn main(mut gba: Gba) -> ! {
let mut frame_counter = 0i32;
let mut has_written_frame_time = false;
let mut stats_renderer = FONT.render_text((0u16, 6u16).into());
loop {
vblank_provider.wait_for_vblank();
bg.commit(&mut vram);
@ -65,7 +68,7 @@ fn main(mut gba: Gba) -> ! {
let percent = (total_cycles * 100) / 280896;
let mut writer = FONT.render_text((0u16, 6u16).into(), 2, 0, &mut bg, &mut vram);
let mut writer = stats_renderer.writer(1, 0, &mut bg, &mut vram);
writeln!(&mut writer, "{total_cycles} cycles").unwrap();
writeln!(&mut writer, "{percent} percent").unwrap();