Ball physics library for OCE360 HW#4
Diff: bouncing_ball.h
- Revision:
- 0:aff81f4c72f3
- Child:
- 1:0aa572c0f2b1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bouncing_ball.h Thu Oct 19 14:07:25 2017 +0000 @@ -0,0 +1,37 @@ +\\ 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) + +#ifndef MMA8452Q_H +#include MMA8452Q_H \\includes our new accelerometer library if not yet included +#endif \\MMA8452Q_H + +// Class declaration +class physics_ball +{ + public: + physics_ball(int color, int radius); + ~physics_ball(); + + float speedx; + float speedy; + int posx; + int posy; + + 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); + + private: + +}; + +#endif \\bouncing_ball_H + +