zhangxinyu01text

Dependencies:   mbed

Committer:
Jenny121
Date:
Mon May 06 06:09:02 2019 +0000
Revision:
12:3952ba0683c7
zhang xinyu

Who changed what in which revision?

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