James Cummins / Mbed 2 deprecated el17jnc

Dependencies:   mbed

Revision:
25:b52aa23df120
Parent:
23:61fa82f76808
Child:
26:0dc10374546f
--- a/BrickBreaker_Engine/BrickBreakerEngine.cpp	Fri Apr 19 11:16:19 2019 +0000
+++ b/BrickBreaker_Engine/BrickBreakerEngine.cpp	Sun Apr 21 13:20:12 2019 +0000
@@ -16,30 +16,9 @@
     srand(time(NULL));
     _square_coord.x = 2 + rand()%80;
     _square_coord.y = 8 + rand()%36;
-    _pause.init();
 }
 
-/////////////////Methods for different game modes////////////////////////////
-void BrickBreakerEngine::brickbreaker_mode(FXOS8700CQ &accelerometer, Gamepad &gamepad, N5110 &lcd, AnalogIn &randnoise, int fps, Ball &ball){
-    for(int i = 0; i <45*fps; i++){
-        if(i == 1){ _score = 0; }       //reset score when game restarts 
-        ball.read_input(accelerometer);
-        ball.update();
-        /*Vector2D position = _ball.get_position();
-        printf("ball_x = %f | ball_y = %f\n", position.x, position.y);  //note: running with tests causes the game to run slow and take ~2min30s*/
-        check_square_collision(randnoise, ball);
-        lcd.clear();
-        brickbreaker_draw(lcd, ball);
-        lcd.refresh();
-        wait_ms(1000/fps);
-        if(gamepad.check_event(gamepad.BACK_PRESSED)){
-            int choice = _pause.pause_menu(gamepad, lcd, fps, i, BRICKBREAKER_MODE);
-            i = choice;
-        }
-    }
-}
-
-//////////////Methods for updating and rendering//////////////////
+//Method for rendering
 
 void BrickBreakerEngine::brickbreaker_draw(N5110 &lcd, Ball &ball){
     ball.draw(lcd);
@@ -49,6 +28,10 @@
 
 /////////////Brickbreaker functionality/////////////////////
 
+void BrickBreakerEngine::set_score(int score){
+    _score = score;
+}
+
 void BrickBreakerEngine::generate_rand_square(AnalogIn &randnoise){
     int rand = randnoise.read_u16();
     Vector2D square_coords = {rand % 80, 8 + rand % 36};
@@ -71,3 +54,7 @@
     sprintf(buffer, "%d", score);
     lcd.printString(buffer, 72, 0);
 }
+
+void BrickBreakerEngine::check_high_score(SDFileSystem &sd){
+    sd.disk_read(
+}
\ No newline at end of file