Fork of bouncing_ball by
Diff: bouncing_ball.h
- Revision:
- 1:0aa572c0f2b1
- Parent:
- 0:aff81f4c72f3
- Child:
- 2:ba1844b0eb9f
diff -r aff81f4c72f3 -r 0aa572c0f2b1 bouncing_ball.h --- a/bouncing_ball.h Thu Oct 19 14:07:25 2017 +0000 +++ b/bouncing_ball.h Tue Oct 24 12:33:39 2017 +0000 @@ -1,15 +1,21 @@ -\\ Bouncing ball is a library adding physics based ball bouncing to the Sparkfun Experiment 3/4 rolling ball demo. -\\ Example Code -\\10/19/2017 Stephen Licht +// Bouncing ball is a library adding physics based ball bouncing to the Sparkfun Experiment 3/4 rolling ball demo. +// Example Code +// 10/19/2017 Stephen Licht #include "mbed.h" #ifndef bouncing_ball_H -#define bouncing_ball_H \\in case any other library wishes to check for presence of this library (see example below) +#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 -#ifndef MMA8452Q_H -#include MMA8452Q_H \\includes our new accelerometer library if not yet included -#endif \\MMA8452Q_H +#define DEFAULT_WIDTH 126 +#define DEFAULT_HEIGHT 126 +#define DEFAULT_SPEEDX 0 +#define DEFAULT_SPEEDY 0 +#define DEFAULT_POSX 64 +#define DEFAULT_POSY 64 +#define DEFAULT_COLOR 0 +#define DEFAULT_RADIUS 10 // Class declaration class physics_ball @@ -22,7 +28,9 @@ float speedy; int posx; int posy; - + 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); @@ -30,8 +38,10 @@ private: + int space_width; + int space_height; }; -#endif \\bouncing_ball_H +#endif //bouncing_ball_H