Kostadin Chakarov / Mbed 2 deprecated el17kec

Dependencies:   mbed

Revision:
2:006a2ddfabb6
Parent:
1:b82c4c2de9a8
Child:
3:fe856d0890ee
diff -r b82c4c2de9a8 -r 006a2ddfabb6 main.cpp
--- a/main.cpp	Tue Mar 19 11:56:20 2019 +0000
+++ b/main.cpp	Wed Mar 20 20:58:36 2019 +0000
@@ -5,7 +5,7 @@
 Username: el17kec
 Student ID Number:201171978 Date:11/03/2019
 */
-// breakout++ logo sprite
+// Breakout++ logo sprite
 const int breakout[10][75] =   {
     { 1,0,0,1,1,0,0,0,0,0,1,0,0,1,1,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,1,1,1,1,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0 },
     { 1,0,1,0,0,1,0,0,1,0,1,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,1,0,0,1,1,1,0,0,1,0,1,1,1,1,1,1,1,1,1 },
@@ -23,12 +23,14 @@
 #include "mbed.h"
 #include "N5110.h"
 #include "Gamepad.h"
-#include "PlayerControl.h"    
+#include "PlayerControl.h" 
+#include "Ball.h"   
 
 /////////////// objects ///////////////
 N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);  // K64F - pwr from 3V3
 Gamepad pad; // Gamepad buttons
 PlayerControl cont; // Object for player
+Ball ball;
 
 ///////////// function prototypes ///////////////
 void init();
@@ -45,7 +47,13 @@
     {
         render();
         wait(1.0f/fps);
+        if (ball.endCondition(pad)){
+            break;
+            }
     }
+    lcd.clear();
+    lcd.printString("You Lose",20,3);
+    lcd.refresh();
 }
 
 void init() 
@@ -80,7 +88,9 @@
 
 void render() {
     lcd.clear(); // initialise the LCD
-    cont.controlPlayer(pad); 
-    cont.drawPlayer(lcd); 
+    cont.drawPlayer(lcd);
+    cont.controlPlayer(pad);  
+    ball.drawBall(lcd);
+    ball.moveBall();
     lcd.refresh();
 }
\ No newline at end of file