James Cummins / Mbed 2 deprecated el17jnc

Dependencies:   mbed

Revision:
38:a85bc227b907
Parent:
37:de1f584bce71
--- a/BrickBreaker_Engine/BrickBreakerEngine.h	Mon May 06 21:44:49 2019 +0000
+++ b/BrickBreaker_Engine/BrickBreakerEngine.h	Thu May 09 01:09:18 2019 +0000
@@ -11,6 +11,51 @@
 
 #include <cmath>
 
+/** BrickBreakerEngine Class
+@brief Library to power the BrickBreaker game mode
+@brief Includes feature to check for and write high scores
+
+@author James Cummins
+
+@code
+
+#include "mbed.h"
+#include "BrickBreakerEngine.h"
+#define RADIUS 3
+
+BrickBreakerEngine engine;   //Constructor to create engine object
+AnalogIn randnoise(PTB0);    //Get a random noise signal to seed the random square generator
+Gamepad gamepad;
+N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
+Ball ball;
+FXOS8700CQ accelerometer(I2C_SDA,I2C_SCL);
+
+int main(){
+    //Initialise the engine object with the ball's radius and the ball object
+    engine.init(RADIUS, ball)
+    int total_frames = 30000;
+    for (int i = 0; i < total_frames; i++){
+        //Not strictly needed as included in the initialiser
+        engine.set_score(0);
+        lcd.clear();
+        ball.read_input(accelerometer);
+        ball.update()
+        
+        //Check for a collision between a square and the ball object
+        engine.check_square_collision(randnoise, ball);     //increments score if there's a collision
+        
+        engine.draw(lcd, ball);
+        lcd.refresh();
+        
+        time_warning();
+    }
+    //End screen concludes game mode
+    engine.end(gamepad, lcd);
+    engine.write_high_scores;   //only needs computing once so perform after while loop
+}
+@endcode
+*/
+
 class BrickBreakerEngine {
     
 public:
@@ -77,7 +122,7 @@
     
 //private variables
     int _index_array[6];
-    float _array_of_values[6];
+    float _array_of_values[6];  //holds the 5 previous high scores and the score from previous play
     int _ball_radius;
     Vector2D _square_coord;
     int _score;