AirsoftTimer software based on mbed

Dependencies:   mbed TextLCD keypad

Files at this revision

API Documentation at this revision

Comitter:
sillevl
Date:
Sun May 24 21:09:30 2015 +0000
Parent:
24:f0989eca7469
Child:
26:1c7f293ba49c
Commit message:
prevent WaitForKeyObjective from continuously refreshing the screen

Changed in this revision

objectives/Objective.h Show annotated file Show diff for this revision Revisions of this file
objectives/WaitForKeyObjective.cpp Show annotated file Show diff for this revision Revisions of this file
objectives/WaitForKeyObjective.h Show annotated file Show diff for this revision Revisions of this file
--- a/objectives/Objective.h	Sun May 24 20:50:17 2015 +0000
+++ b/objectives/Objective.h	Sun May 24 21:09:30 2015 +0000
@@ -12,17 +12,18 @@
 
 class Objective /*: public ButtonListener*/{
     
-    enum Status { WAITING, ACTIVE, COMPLETED };
     
     public:
     Objective(Game* game);
+    
+    enum Status { WAITING, ACTIVE, COMPLETED };
     Status getStatus();
     
     void start();
     virtual void run() = 0;
     void complete();
     
-    protected:
+    protected:    
     Game* game;
     
     LCD* lcd;
--- a/objectives/WaitForKeyObjective.cpp	Sun May 24 20:50:17 2015 +0000
+++ b/objectives/WaitForKeyObjective.cpp	Sun May 24 21:09:30 2015 +0000
@@ -3,12 +3,17 @@
 #include "../games/Game.h"
 
 WaitForKeyObjective::WaitForKeyObjective(Game* game) : Objective(game){
-    
+    //keyboard->attach(this, &WaitForKeyObjective::buttonEvent);
 }
 
 void WaitForKeyObjective::run(){  
     lcd->cls();
-    lcd->printf("press any key to continue");
+    lcd->printf("press any key");
+    lcd->locate(0,1);
+    lcd->printf("to continue...");
+    
+    //wait until completed
+    while(getStatus() != COMPLETED){}
 }
 
 void WaitForKeyObjective::buttonEvent(char c){
--- a/objectives/WaitForKeyObjective.h	Sun May 24 20:50:17 2015 +0000
+++ b/objectives/WaitForKeyObjective.h	Sun May 24 21:09:30 2015 +0000
@@ -8,7 +8,7 @@
     public:
     WaitForKeyObjective(Game* game);
     virtual void run();
-    virtual void buttonEvent(char c);
+    void buttonEvent(char c);
     
 };