wu weilong / Mbed 2 deprecated frdm_gpio2

Dependencies:   mbed

Committer:
wuweilong
Date:
Wed May 08 20:16:29 2019 +0000
Revision:
11:357970a7a5a6
Parent:
10:ae5f62a1e40e
11

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 11:357970a7a5a6 20 /** Set the score
wuweilong 11:357970a7a5a6 21 * @param the value of the score (int)
wuweilong 11:357970a7a5a6 22 */
wuweilong 10:ae5f62a1e40e 23 void init(int foodsize,int foodx,int foody,int snakex,int snakey,int n);
wuweilong 10:ae5f62a1e40e 24 Vector2D getfoodpos();
wuweilong 10:ae5f62a1e40e 25 Vector2D getsnakepos(int n);
wuweilong 10:ae5f62a1e40e 26 void draw(N5110 &lcd,int n);
wuweilong 10:ae5f62a1e40e 27 void update();
wuweilong 10:ae5f62a1e40e 28 void input(Gamepad &pad);
wuweilong 10:ae5f62a1e40e 29 void move(int n);
wuweilong 10:ae5f62a1e40e 30 void initdirection();
wuweilong 10:ae5f62a1e40e 31
wuweilong 10:ae5f62a1e40e 32
wuweilong 10:ae5f62a1e40e 33
wuweilong 10:ae5f62a1e40e 34
wuweilong 10:ae5f62a1e40e 35 /// accessors and mutators
wuweilong 10:ae5f62a1e40e 36
wuweilong 10:ae5f62a1e40e 37 private:
wuweilong 10:ae5f62a1e40e 38
wuweilong 10:ae5f62a1e40e 39 int _size;
wuweilong 10:ae5f62a1e40e 40 Vector2D _foodpos;
wuweilong 10:ae5f62a1e40e 41 Vector2D _snakebody[];
wuweilong 10:ae5f62a1e40e 42 Direction _d;
wuweilong 10:ae5f62a1e40e 43
wuweilong 10:ae5f62a1e40e 44 };
wuweilong 10:ae5f62a1e40e 45 #endif