ELEC2645 (2018/19) / Mbed 2 deprecated el17szs

Dependencies:   mbed

Revision:
9:a81db6a703b7
Parent:
7:a1a6bff238c1
Child:
10:6c6e09023942
--- a/main.cpp	Thu Apr 18 13:04:37 2019 +0000
+++ b/main.cpp	Sun Apr 21 17:35:15 2019 +0000
@@ -31,25 +31,21 @@
     init();
    // welcome();
     draw();
-    /*
-    while (1){
-        draw();
-        wait(1.0f/fps);
-    }
-    */
     float f;
+    int status=0;
     while(1){
-        f= pad1.get_mag();
-        printf("MAG %f \n",f);
-        int lol=bat.get_hitBall();
-        
-        ball.start(lcd,lol,pad1.get_direction());
-        draw();
-        wait(1.0f/fps);
+        ball.reset();
+        ball.set_field(lcd);
+        while (status!=1){
+            f= pad1.get_mag();
+            printf("MAG %f \n",f);
+            int lol=bat.get_hitBall();  
+            ball.start(lcd,lol,pad1.get_direction());
+            draw();
+            wait(1.0f/fps);
+        }
     }
-    
-    
-    
+       
 }
 void init(){
     lcd.init();
@@ -83,7 +79,7 @@
     lcd.drawCircle((WIDTH/2),HEIGHT/2,23,FILL_TRANSPARENT);
     lcd.drawRect(37,11,12,30,FILL_TRANSPARENT);
     ball.draw(lcd);
-    ball.set_field(lcd);
+    ball.draw_field(lcd);
     bat.draw(lcd);
     lcd.refresh();
 }