1111111112

Committer:
Jenny121
Date:
Mon May 06 06:24:24 2019 +0000
Revision:
0:4ca1ed928a81
ZHANGXINYU55

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jenny121 0:4ca1ed928a81 1 #ifndef CXK_H
Jenny121 0:4ca1ed928a81 2 #define CXK_H
Jenny121 0:4ca1ed928a81 3
Jenny121 0:4ca1ed928a81 4 #include "mbed.h"
Jenny121 0:4ca1ed928a81 5 #include "N5110.h"
Jenny121 0:4ca1ed928a81 6 #include "Gamepad.h"
Jenny121 0:4ca1ed928a81 7
Jenny121 0:4ca1ed928a81 8
Jenny121 0:4ca1ed928a81 9 /** CXK Class
Jenny121 0:4ca1ed928a81 10 * @brief defined the cxk and the add score funvtion
Jenny121 0:4ca1ed928a81 11 * @author Zhang Xinyu
Jenny121 0:4ca1ed928a81 12 * @school EE of SWJTU &leeds joint school
Jenny121 0:4ca1ed928a81 13 * @date MAY 2019
Jenny121 0:4ca1ed928a81 14 */
Jenny121 0:4ca1ed928a81 15
Jenny121 0:4ca1ed928a81 16 class CXK
Jenny121 0:4ca1ed928a81 17 {
Jenny121 0:4ca1ed928a81 18 public:
Jenny121 0:4ca1ed928a81 19 /** Constructor */
Jenny121 0:4ca1ed928a81 20 CXK();
Jenny121 0:4ca1ed928a81 21
Jenny121 0:4ca1ed928a81 22 /** Destrctor */
Jenny121 0:4ca1ed928a81 23 ~CXK();
Jenny121 0:4ca1ed928a81 24
Jenny121 0:4ca1ed928a81 25 /** Set the CXKinit
Jenny121 0:4ca1ed928a81 26 * @ param value that updated (x,y,height, width)
Jenny121 0:4ca1ed928a81 27 * @ details the (x,y) mean the centre point figure of cxk ,height meansheight of CXK
Jenny121 0:4ca1ed928a81 28 */
Jenny121 0:4ca1ed928a81 29 void init(int x,int y,int height,int width);
Jenny121 0:4ca1ed928a81 30
Jenny121 0:4ca1ed928a81 31
Jenny121 0:4ca1ed928a81 32 /** Set the CXKdraw
Jenny121 0:4ca1ed928a81 33 * @ param value that updated _x is x, _y is y (_x,_y)
Jenny121 0:4ca1ed928a81 34 */
Jenny121 0:4ca1ed928a81 35 void draw(N5110 &lcd);
Jenny121 0:4ca1ed928a81 36
Jenny121 0:4ca1ed928a81 37 /** Set the CXKupdate
Jenny121 0:4ca1ed928a81 38 * @ param drection of movement (direction)
Jenny121 0:4ca1ed928a81 39 * @ vara means magenitude of the jiysticks
Jenny121 0:4ca1ed928a81 40 * @ details North is decrement as origin is at the top-left so decreasing moves up
Jenny121 0:4ca1ed928a81 41 */
Jenny121 0:4ca1ed928a81 42 void update(Direction d,float vara);
Jenny121 0:4ca1ed928a81 43
Jenny121 0:4ca1ed928a81 44 /** Set the CXKscore
Jenny121 0:4ca1ed928a81 45 * @ param the score of the game palyer (score)
Jenny121 0:4ca1ed928a81 46 * @ details add the score when meet the order of the code
Jenny121 0:4ca1ed928a81 47 */
Jenny121 0:4ca1ed928a81 48 void add_score();
Jenny121 0:4ca1ed928a81 49
Jenny121 0:4ca1ed928a81 50 /** Set the CXKscore
Jenny121 0:4ca1ed928a81 51 * @ returns the score (score)
Jenny121 0:4ca1ed928a81 52 * @ details score = 0
Jenny121 0:4ca1ed928a81 53 */
Jenny121 0:4ca1ed928a81 54 int get_score();
Jenny121 0:4ca1ed928a81 55
Jenny121 0:4ca1ed928a81 56
Jenny121 0:4ca1ed928a81 57 Vector2D get_pos();
Jenny121 0:4ca1ed928a81 58
Jenny121 0:4ca1ed928a81 59 private:
Jenny121 0:4ca1ed928a81 60
Jenny121 0:4ca1ed928a81 61 int _height;
Jenny121 0:4ca1ed928a81 62 int _width;
Jenny121 0:4ca1ed928a81 63 int _x;
Jenny121 0:4ca1ed928a81 64 int _y;
Jenny121 0:4ca1ed928a81 65 int _speed;
Jenny121 0:4ca1ed928a81 66 int _score;
Jenny121 0:4ca1ed928a81 67
Jenny121 0:4ca1ed928a81 68 };
Jenny121 0:4ca1ed928a81 69 #endif