From f4e65a6c78162cc19b044452f0ea263ee0d838a3 Mon Sep 17 00:00:00 2001
From: Joshua Saxby <Joshua2.Saxby@live.uwe.ac.uk>
Date: Sun, 9 Feb 2020 16:09:27 +0000
Subject: [PATCH] Implement block scrolling test

---
 source/main.cpp | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/source/main.cpp b/source/main.cpp
index f53f3c9..3ea1739 100755
--- a/source/main.cpp
+++ b/source/main.cpp
@@ -180,17 +180,19 @@ int main() {
     UBIT.display.scroll("BLOCKS!");
 
     // XXX: simple debug test to check my FLASH images were stored correctly
-    // a simple clocker to check frame rate
-    bool strober = false;
     while (true) {
-        // display new random blocks each second
-        Block block;
-        UBIT.display.print(block.image(), 2, 2);
-        // display clocker
-        UBIT.display.image.setPixelValue(0, 0, strober);
-        UBIT.sleep(1000); // 1000ms or 1s sleep
-        // invert the clocker
-        strober = !strober;
+        // scroll random blocks down the screen
+        Block block; // make a new random Block
+        // starting positions:
+        int x = 1;
+        int y = -3;
+        // print image until scrolled down off the screen
+        while (y < 6) {
+            UBIT.display.clear();
+            UBIT.display.print(block.image(), x, y);
+            y++;
+            UBIT.sleep(350); // 350ms sleep for 2.85 FPS
+        }
     }
 
     // TODO: potentially remove this call, if clarified that it is not required.
-- 
GitLab