Zhang Xin yu
/
ZhangXinyu201090208
zhangxinyu01text
Diff: Ball/Ball.h
- Revision:
- 12:3952ba0683c7
- Parent:
- 6:d9d05b321b4d
--- a/Ball/Ball.h Tue Apr 17 08:00:08 2018 +0000 +++ b/Ball/Ball.h Mon May 06 06:09:02 2019 +0000 @@ -4,26 +4,59 @@ #include "mbed.h" #include "N5110.h" #include "Gamepad.h" -#include "Paddle.h" +#include "CXK.h" /** Ball Class -@author Dr Craig A. Evans, University of Leeds -@brief Controls the ball in the Pong game -@date Febraury 2017 +* @brief Controls the ball in Ubeautiful CXK game +* @author Zhang Xinyu +* @school EE of SWJTU &leeds joint school +* @date MAY 2019 */ + class Ball { public: + /** Constructor */ Ball(); + + /** Destrctor */ ~Ball(); - void init(int size,int speed); + + /** Set the ball init + * @param the value of init (size,speed, direction) + */ + void init(int size,int speed, int direction); + + + /** Set the balldraw + * @ details lcd.drawCircle(_x,_y,_size,FILL_BLACK); + * @ param value that updated (_x,_y, _size) + */ void draw(N5110 &lcd); + + + /** Set the update + * @details updated the _x,_y value by speed means move the ball + */ void update(); + /// accessors and mutators + + /** Set the balldraw + * @ details set the value of veocity LCD cooresponding v = {_velocity.x,_velocity.y}; + * @ param value that updated (v) + * @ returns v + */ void set_velocity(Vector2D v); Vector2D get_velocity(); Vector2D get_pos(); + + /** Set the balldraw + * @ details set the value of position of LCD cooresponding p= {x,y}; + * @ param value that updated (p) + * @ returns p + */ void set_pos(Vector2D p); private: @@ -32,5 +65,6 @@ int _size; int _x; int _y; + int _direction; }; #endif \ No newline at end of file