From 74ccdfcd7fc77c975f7197cd10fd01e6c6224605 Mon Sep 17 00:00:00 2001
From: Corwin <corwin@kuiper.dev>
Date: Thu, 28 Sep 2023 21:19:07 +0100
Subject: [PATCH] update example to excersise the broken case

---
 agb/examples/bitmap4.rs | 29 +++++++++++++----------------
 1 file changed, 13 insertions(+), 16 deletions(-)

diff --git a/agb/examples/bitmap4.rs b/agb/examples/bitmap4.rs
index a46f6c72..3084cfa4 100644
--- a/agb/examples/bitmap4.rs
+++ b/agb/examples/bitmap4.rs
@@ -1,7 +1,7 @@
 #![no_std]
 #![no_main]
 
-use agb::display;
+use agb::display::{self, HEIGHT, WIDTH};
 
 #[agb::entry]
 fn main(mut gba: agb::Gba) -> ! {
@@ -11,25 +11,22 @@ fn main(mut gba: agb::Gba) -> ! {
     bitmap.set_palette_entry(1, 0x001F);
     bitmap.set_palette_entry(2, 0x03E0);
 
-    bitmap.draw_point_page(
-        display::WIDTH / 2,
-        display::HEIGHT / 2,
-        1,
-        display::bitmap4::Page::Front,
-    );
-    bitmap.draw_point_page(
-        display::WIDTH / 2 + 5,
-        display::HEIGHT / 2,
-        2,
-        display::bitmap4::Page::Back,
-    );
+    for y in 0..HEIGHT {
+        for x in 0..WIDTH {
+            bitmap.draw_point_page(x, y, 0xF, display::bitmap4::Page::Front);
+            bitmap.draw_point_page(x, y, 1, display::bitmap4::Page::Front);
+            bitmap.draw_point_page(x, y, 0xFF, display::bitmap4::Page::Back);
+            bitmap.draw_point_page(x, y, 2, display::bitmap4::Page::Back);
+        }
+    }
 
-    let mut count = 0;
+    let mut input = agb::input::ButtonController::new();
 
     loop {
         vblank.wait_for_vblank();
-        count += 1;
-        if count % 6 == 0 {
+        input.update();
+
+        if input.is_just_pressed(agb::input::Button::A) {
             bitmap.flip_page();
         }
     }