zhangxinyu01text

Dependencies:   mbed

Committer:
Jenny121
Date:
Mon May 06 09:33:50 2019 +0000
Revision:
24:8b1494a6bdbe
Parent:
12:3952ba0683c7
the final WORK

Who changed what in which revision?

UserRevisionLine numberNew contents of line
eencae 5:3c9407e2fe55 1 #ifndef BALL_H
eencae 5:3c9407e2fe55 2 #define BALL_H
eencae 5:3c9407e2fe55 3
eencae 5:3c9407e2fe55 4 #include "mbed.h"
eencae 5:3c9407e2fe55 5 #include "N5110.h"
eencae 5:3c9407e2fe55 6 #include "Gamepad.h"
Jenny121 12:3952ba0683c7 7 #include "CXK.h"
eencae 5:3c9407e2fe55 8
eencae 6:d9d05b321b4d 9 /** Ball Class
Jenny121 12:3952ba0683c7 10 * @brief Controls the ball in Ubeautiful CXK game
Jenny121 12:3952ba0683c7 11 * @author Zhang Xinyu
Jenny121 12:3952ba0683c7 12 * @school EE of SWJTU &leeds joint school
Jenny121 12:3952ba0683c7 13 * @date MAY 2019
eencae 6:d9d05b321b4d 14 */
Jenny121 12:3952ba0683c7 15
eencae 5:3c9407e2fe55 16 class Ball
eencae 5:3c9407e2fe55 17 {
eencae 5:3c9407e2fe55 18
eencae 5:3c9407e2fe55 19 public:
Jenny121 12:3952ba0683c7 20 /** Constructor */
eencae 5:3c9407e2fe55 21 Ball();
Jenny121 12:3952ba0683c7 22
Jenny121 12:3952ba0683c7 23 /** Destrctor */
eencae 5:3c9407e2fe55 24 ~Ball();
Jenny121 12:3952ba0683c7 25
Jenny121 12:3952ba0683c7 26 /** Set the ball init
Jenny121 12:3952ba0683c7 27 * @param the value of init (size,speed, direction)
Jenny121 12:3952ba0683c7 28 */
Jenny121 12:3952ba0683c7 29 void init(int size,int speed, int direction);
Jenny121 12:3952ba0683c7 30
Jenny121 12:3952ba0683c7 31
Jenny121 12:3952ba0683c7 32 /** Set the balldraw
Jenny121 12:3952ba0683c7 33 * @ details lcd.drawCircle(_x,_y,_size,FILL_BLACK);
Jenny121 12:3952ba0683c7 34 * @ param value that updated (_x,_y, _size)
Jenny121 12:3952ba0683c7 35 */
eencae 5:3c9407e2fe55 36 void draw(N5110 &lcd);
Jenny121 12:3952ba0683c7 37
Jenny121 12:3952ba0683c7 38
Jenny121 12:3952ba0683c7 39 /** Set the update
Jenny121 12:3952ba0683c7 40 * @details updated the _x,_y value by speed means move the ball
Jenny121 12:3952ba0683c7 41 */
eencae 5:3c9407e2fe55 42 void update();
Jenny121 12:3952ba0683c7 43
eencae 5:3c9407e2fe55 44 /// accessors and mutators
Jenny121 12:3952ba0683c7 45
Jenny121 12:3952ba0683c7 46 /** Set the balldraw
Jenny121 12:3952ba0683c7 47 * @ details set the value of veocity LCD cooresponding v = {_velocity.x,_velocity.y};
Jenny121 12:3952ba0683c7 48 * @ param value that updated (v)
Jenny121 12:3952ba0683c7 49 * @ returns v
Jenny121 12:3952ba0683c7 50 */
eencae 5:3c9407e2fe55 51 void set_velocity(Vector2D v);
eencae 5:3c9407e2fe55 52 Vector2D get_velocity();
eencae 5:3c9407e2fe55 53 Vector2D get_pos();
Jenny121 12:3952ba0683c7 54
Jenny121 12:3952ba0683c7 55 /** Set the balldraw
Jenny121 12:3952ba0683c7 56 * @ details set the value of position of LCD cooresponding p= {x,y};
Jenny121 12:3952ba0683c7 57 * @ param value that updated (p)
Jenny121 12:3952ba0683c7 58 * @ returns p
Jenny121 12:3952ba0683c7 59 */
eencae 5:3c9407e2fe55 60 void set_pos(Vector2D p);
eencae 5:3c9407e2fe55 61
eencae 5:3c9407e2fe55 62 private:
eencae 5:3c9407e2fe55 63
eencae 5:3c9407e2fe55 64 Vector2D _velocity;
eencae 5:3c9407e2fe55 65 int _size;
eencae 5:3c9407e2fe55 66 int _x;
eencae 5:3c9407e2fe55 67 int _y;
Jenny121 12:3952ba0683c7 68 int _direction;
eencae 5:3c9407e2fe55 69 };
eencae 5:3c9407e2fe55 70 #endif