OCE 360 Assignment #4

Dependents:   Barros_Assignment4

Revision:
0:9591bae8d04c
Child:
1:a2dda7baafaa
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/physics_ball.h	Tue Oct 31 12:59:49 2017 +0000
@@ -0,0 +1,37 @@
+//Library for physics of LCD ball bouncing controlled by accelerometer
+//Based on MMA8452Q and 4DGL-uLCD-SE library. 
+
+#include "mbed.h"
+#include "MMA8452Q.h"
+
+// Class declaration
+class physics_ball
+{
+    public:
+        physics_ball(); //Constructor 
+        float speedx;   //Returns ball speed in X direction 
+        float speedy;   //Returns ball speed in Y direction 
+        
+        float posx;       //Returns ball location in X
+        float posy;       //Returns ball location in Y
+        
+        int color;      //Assigns ball color 
+        int radius;     //Assigns ball radius
+        
+        int width;      //Screen Spec: 128 pixel width
+        int height;     //Screen Spec: 128 pixel Height 
+        
+        float time_step;
+         
+        void update(float time_step, int posx, int posy, int speedx, int speedy, MMA8452Q & accel); 
+        // Calculates new ball position given time elapsed since last position
+        
+        void define_space(int width, int height); 
+        // Defines environment, i.e the width & height of the area in which the ball can travel.
+       
+                                            
+        void set_param(int radius, int color);    // Defines ball parameters: radius, color (1 or 2)
+        
+        void set_state(int x, int y, float speedx, float speedy); //Sets new ball position & speed
+        
+        };
\ No newline at end of file