From eaf6cfb4c97e275b8ceb8ae16931affe22fcf641 Mon Sep 17 00:00:00 2001 From: Joshua Saxby <joshua.a.saxby@gmail.com> Date: Sun, 9 Feb 2020 00:47:41 +0000 Subject: [PATCH] Some tweaks to hopefully get event-handling demo working --- source/main.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/main.cpp b/source/main.cpp index 14cf50b..7a1cff4 100755 --- a/source/main.cpp +++ b/source/main.cpp @@ -68,7 +68,7 @@ Game::Game(MicroBit& micro_bit) {} void Game::run() { - this->micro_bit.display.scroll("NEW GAME!"); + // this->micro_bit.display.scroll("NEW GAME!"); // init screen display mode, to be sure it is in a known-state // TODO: consider changing to greyscale to allow "mutli-coloured" blocks this->micro_bit.display.setDisplayMode(DISPLAY_MODE_BLACK_AND_WHITE); @@ -86,9 +86,9 @@ void Game::run() { &Game::press_button_b ); while (true) { // TODO: change to use game-over condition - this->draw(); // render screen buffer + // this->draw(); // render screen buffer // sleep to conserve CPU cycles and allow other fibers a chance to run - this->micro_bit.sleep(50); // a 50ms sleep gives us a 20Hz tick-rate + this->micro_bit.sleep(100); // a 100ms sleep gives us a 10Hz tick-rate } // TODO: add the rest of the game logic this->micro_bit.display.scroll("GAME OVER!"); @@ -117,12 +117,12 @@ void Game::draw() { void Game::press_button_a(MicroBitEvent e) { // XXX: debug - this->screen_buffer.setPixelValue(0, 2, 255); + this->micro_bit.display.print("A"); } void Game::press_button_b(MicroBitEvent e) { // XXX: debug - this->screen_buffer.setPixelValue(4, 2, 255); + this->micro_bit.display.print("B"); } -- GitLab