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.
element/element.h@10:ae5f62a1e40e, 2019-05-08 (annotated)
- Committer:
- wuweilong
- Date:
- Wed May 08 20:08:17 2019 +0000
- Revision:
- 10:ae5f62a1e40e
- Child:
- 11:357970a7a5a6
version1
Who changed what in which revision?
User | Revision | Line number | New 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 | 10:ae5f62a1e40e | 20 | void init(int foodsize,int foodx,int foody,int snakex,int snakey,int n); |
wuweilong | 10:ae5f62a1e40e | 21 | Vector2D getfoodpos(); |
wuweilong | 10:ae5f62a1e40e | 22 | Vector2D getsnakepos(int n); |
wuweilong | 10:ae5f62a1e40e | 23 | void draw(N5110 &lcd,int n); |
wuweilong | 10:ae5f62a1e40e | 24 | void update(); |
wuweilong | 10:ae5f62a1e40e | 25 | void input(Gamepad &pad); |
wuweilong | 10:ae5f62a1e40e | 26 | void move(int n); |
wuweilong | 10:ae5f62a1e40e | 27 | void initdirection(); |
wuweilong | 10:ae5f62a1e40e | 28 | |
wuweilong | 10:ae5f62a1e40e | 29 | |
wuweilong | 10:ae5f62a1e40e | 30 | |
wuweilong | 10:ae5f62a1e40e | 31 | |
wuweilong | 10:ae5f62a1e40e | 32 | /// accessors and mutators |
wuweilong | 10:ae5f62a1e40e | 33 | |
wuweilong | 10:ae5f62a1e40e | 34 | private: |
wuweilong | 10:ae5f62a1e40e | 35 | |
wuweilong | 10:ae5f62a1e40e | 36 | int _size; |
wuweilong | 10:ae5f62a1e40e | 37 | Vector2D _foodpos; |
wuweilong | 10:ae5f62a1e40e | 38 | Vector2D _snakebody[]; |
wuweilong | 10:ae5f62a1e40e | 39 | Direction _d; |
wuweilong | 10:ae5f62a1e40e | 40 | |
wuweilong | 10:ae5f62a1e40e | 41 | }; |
wuweilong | 10:ae5f62a1e40e | 42 | #endif |