Ball physics library for OCE360 HW#4

Revision:
2:ba1844b0eb9f
Parent:
1:0aa572c0f2b1
--- a/bouncing_ball.h	Tue Oct 24 12:33:39 2017 +0000
+++ b/bouncing_ball.h	Tue Nov 07 12:07:13 2017 +0000
@@ -8,20 +8,21 @@
 #define bouncing_ball_H  //in case any other library wishes to check for presence of this library (see example below)
 #include "MMA8452Q.h"  //includes our new accelerometer library definitions
 
-#define DEFAULT_WIDTH 126
-#define DEFAULT_HEIGHT 126
+#define DEFAULT_WIDTH 128
+#define DEFAULT_HEIGHT 128
 #define DEFAULT_SPEEDX 0
 #define DEFAULT_SPEEDY 0
 #define DEFAULT_POSX 64
 #define DEFAULT_POSY 64
 #define DEFAULT_COLOR 0
 #define DEFAULT_RADIUS 10
+#define GRAVITY 9.8
 
 // Class declaration
 class physics_ball
 {
     public:
-        physics_ball(int color, int radius);
+        physics_ball();
         ~physics_ball();
 
         float speedx;
@@ -31,15 +32,20 @@
         int color;
         int radius; 
         
-        void update(float time_step, MMA8452Q accelerometer);
-        void define_space(int width, int height);
-        void set_param(int radius, int color);
-        void set_state(int x, int y, float vx, float vy);
+        void update(float time_step, MMA8452Q &accelerometer);
+        void define_space(int desired_width, int desired_height);
+        void set_param(int desired_radius, int desired_color);
+        void set_state(int desired_x, int desired_y, float desired_vx, float desired_vy);
         
     private:
 
-        int space_width;
-        int space_height;
+        int _width;
+        int _height;
+        int _upside_down_status;
+        float _posx_f;
+        float _posy_f;
+        
+        void _reset_upside_down();
 };
 
 #endif  //bouncing_ball_H