wu weilong / Mbed 2 deprecated el18w2w

Dependencies:   mbed

Committer:
wuweilong
Date:
Wed May 08 21:03:33 2019 +0000
Revision:
12:80e737144104
Parent:
11:357970a7a5a6
Child:
13:3eb4f8dddff1
2

Who changed what in which revision?

UserRevisionLine numberNew contents of line
wuweilong 10:ae5f62a1e40e 1 #ifndef ELEMENT_H
wuweilong 10:ae5f62a1e40e 2 #define ELEMENT_H
wuweilong 10:ae5f62a1e40e 3
wuweilong 10:ae5f62a1e40e 4 #include "mbed.h"
wuweilong 10:ae5f62a1e40e 5 #include "N5110.h"
wuweilong 10:ae5f62a1e40e 6 #include "Gamepad.h"
wuweilong 10:ae5f62a1e40e 7 /** snakegame
wuweilong 10:ae5f62a1e40e 8 * @brief snakegame
wuweilong 10:ae5f62a1e40e 9 * @author WUWEILONG 201282622
wuweilong 10:ae5f62a1e40e 10 * @date May.2019
wuweilong 10:ae5f62a1e40e 11 */
wuweilong 10:ae5f62a1e40e 12 class element
wuweilong 10:ae5f62a1e40e 13 {
wuweilong 10:ae5f62a1e40e 14
wuweilong 10:ae5f62a1e40e 15 public:
wuweilong 10:ae5f62a1e40e 16 /** Constructor */
wuweilong 10:ae5f62a1e40e 17 element();
wuweilong 10:ae5f62a1e40e 18 /** Destructor */
wuweilong 10:ae5f62a1e40e 19 ~element();
wuweilong 12:80e737144104 20 /** initialize the snake and the food
wuweilong 12:80e737144104 21 * @param the value of the foodsize
wuweilong 12:80e737144104 22 * @param the value of the x of coordinates of the food
wuweilong 12:80e737144104 23 * @param the value of the y of coordinates of the food
wuweilong 12:80e737144104 24 * @param the value of the x of coordinates of the snake
wuweilong 12:80e737144104 25 * @param the value of the y of coordinates of the snake
wuweilong 12:80e737144104 26 * @param the value of the snakelength
wuweilong 12:80e737144104 27 */
wuweilong 12:80e737144104 28
wuweilong 10:ae5f62a1e40e 29 void init(int foodsize,int foodx,int foody,int snakex,int snakey,int n);
wuweilong 10:ae5f62a1e40e 30 Vector2D getfoodpos();
wuweilong 10:ae5f62a1e40e 31 Vector2D getsnakepos(int n);
wuweilong 10:ae5f62a1e40e 32 void draw(N5110 &lcd,int n);
wuweilong 10:ae5f62a1e40e 33 void update();
wuweilong 10:ae5f62a1e40e 34 void input(Gamepad &pad);
wuweilong 10:ae5f62a1e40e 35 void move(int n);
wuweilong 10:ae5f62a1e40e 36 void initdirection();
wuweilong 10:ae5f62a1e40e 37
wuweilong 10:ae5f62a1e40e 38
wuweilong 10:ae5f62a1e40e 39
wuweilong 10:ae5f62a1e40e 40
wuweilong 10:ae5f62a1e40e 41 /// accessors and mutators
wuweilong 10:ae5f62a1e40e 42
wuweilong 10:ae5f62a1e40e 43 private:
wuweilong 10:ae5f62a1e40e 44
wuweilong 10:ae5f62a1e40e 45 int _size;
wuweilong 10:ae5f62a1e40e 46 Vector2D _foodpos;
wuweilong 10:ae5f62a1e40e 47 Vector2D _snakebody[];
wuweilong 10:ae5f62a1e40e 48 Direction _d;
wuweilong 10:ae5f62a1e40e 49
wuweilong 10:ae5f62a1e40e 50 };
wuweilong 10:ae5f62a1e40e 51 #endif