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.
Dependencies: mbed Gamepad N5110
snake/snake.h@1:b49c36604125, 2019-04-13 (annotated)
- Committer:
 - 694617778
 - Date:
 - Sat Apr 13 10:07:50 2019 +0000
 - Revision:
 - 1:b49c36604125
 - Parent:
 - 0:b67614a0c4cf
 - Child:
 - 2:934daa65f73d
 
test2
Who changed what in which revision?
| User | Revision | Line number | New contents of line | 
|---|---|---|---|
| 694617778 | 1:b49c36604125 | 1 | #ifndef SNAKE_H | 
| 694617778 | 1:b49c36604125 | 2 | #define SNAKE_H | 
| 694617778 | 1:b49c36604125 | 3 | |
| 694617778 | 1:b49c36604125 | 4 | |
| 694617778 | 0:b67614a0c4cf | 5 | #include "mbed.h" | 
| 694617778 | 0:b67614a0c4cf | 6 | #include "N5110.h" | 
| 694617778 | 0:b67614a0c4cf | 7 | #include "Gamepad.h" | 
| 694617778 | 0:b67614a0c4cf | 8 | |
| 694617778 | 0:b67614a0c4cf | 9 | class snake | 
| 694617778 | 0:b67614a0c4cf | 10 | { | 
| 694617778 | 0:b67614a0c4cf | 11 | |
| 694617778 | 0:b67614a0c4cf | 12 | public: | 
| 694617778 | 0:b67614a0c4cf | 13 | snake(); | 
| 694617778 | 1:b49c36604125 | 14 | ~snake(); | 
| 694617778 | 1:b49c36604125 | 15 | void init(int size,int length); | 
| 694617778 | 1:b49c36604125 | 16 | void update(int direction, int length); | 
| 694617778 | 1:b49c36604125 | 17 | void draw(N5110 &lcd, int length); | 
| 694617778 | 0:b67614a0c4cf | 18 | void add_score(); | 
| 694617778 | 0:b67614a0c4cf | 19 | int get_score(); | 
| 694617778 | 1:b49c36604125 | 20 | int get_length(); | 
| 694617778 | 0:b67614a0c4cf | 21 | |
| 694617778 | 0:b67614a0c4cf | 22 | private: | 
| 694617778 | 0:b67614a0c4cf | 23 | |
| 694617778 | 0:b67614a0c4cf | 24 | Vector2D _velocity; | 
| 694617778 | 0:b67614a0c4cf | 25 | int _size; | 
| 694617778 | 1:b49c36604125 | 26 | int _x [40]; | 
| 694617778 | 1:b49c36604125 | 27 | int _y [40]; | 
| 694617778 | 0:b67614a0c4cf | 28 | int _score; | 
| 694617778 | 1:b49c36604125 | 29 | int _length; | 
| 694617778 | 0:b67614a0c4cf | 30 | |
| 694617778 | 1:b49c36604125 | 31 | }; | 
| 694617778 | 1:b49c36604125 | 32 | #endif |