wu weilong / Mbed 2 deprecated frdm_gpio1

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers element.h Source File

element.h

00001 #ifndef ELEMENT_H
00002 #define ELEMENT_H
00003 
00004 #include "mbed.h"
00005 #include "N5110.h"
00006 #include "Gamepad.h"
00007 /** snakegame
00008 * @brief snakegame
00009 * @author WUWEILONG 201282622
00010 * @date May.2019
00011 */
00012 class element
00013 {
00014 
00015 public:
00016      /** Constructor */
00017      element();
00018       /** Destructor */
00019     ~element();
00020     void init(int foodsize,int foodx,int foody,int snakex,int snakey,int n);
00021     Vector2D getfoodpos();
00022     Vector2D getsnakepos(int n);
00023     void draw(N5110 &lcd,int n);
00024     void update();
00025     void input(Gamepad &pad);
00026     void move(int n);
00027     void initdirection();
00028     
00029     
00030     
00031    
00032     /// accessors and mutators
00033     
00034 private:
00035 
00036     int _size;
00037     Vector2D _foodpos;
00038     Vector2D _snakebody[];
00039     Direction _d;
00040     
00041 };
00042 #endif