Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: element/element.h
- Revision:
- 10:ae5f62a1e40e
- Child:
- 11:357970a7a5a6
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/element/element.h Wed May 08 20:08:17 2019 +0000 @@ -0,0 +1,42 @@ +#ifndef ELEMENT_H +#define ELEMENT_H + +#include "mbed.h" +#include "N5110.h" +#include "Gamepad.h" +/** snakegame +* @brief snakegame +* @author WUWEILONG 201282622 +* @date May.2019 +*/ +class element +{ + +public: + /** Constructor */ + element(); + /** Destructor */ + ~element(); + void init(int foodsize,int foodx,int foody,int snakex,int snakey,int n); + Vector2D getfoodpos(); + Vector2D getsnakepos(int n); + void draw(N5110 &lcd,int n); + void update(); + void input(Gamepad &pad); + void move(int n); + void initdirection(); + + + + + /// accessors and mutators + +private: + + int _size; + Vector2D _foodpos; + Vector2D _snakebody[]; + Direction _d; + +}; +#endif \ No newline at end of file