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
SnakeHead/SnakeHead.h@5:256e5e0b6cd7, 2020-05-14 (annotated)
- Committer:
- sdlashmar
- Date:
- Thu May 14 12:06:26 2020 +0000
- Revision:
- 5:256e5e0b6cd7
- Parent:
- Snake/Snake.h@4:c5addc5475d3
- Child:
- 12:cb3a81adf48b
snake tail rev 1
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| sdlashmar | 5:256e5e0b6cd7 | 1 | #ifndef SNAKEHEAD_H |
| sdlashmar | 5:256e5e0b6cd7 | 2 | #define SNAKEHEAD_H |
| sdlashmar | 3:36f9e3a75905 | 3 | |
| sdlashmar | 3:36f9e3a75905 | 4 | #include "mbed.h" |
| sdlashmar | 3:36f9e3a75905 | 5 | #include "N5110.h" |
| sdlashmar | 3:36f9e3a75905 | 6 | #include "Gamepad.h" |
| sdlashmar | 4:c5addc5475d3 | 7 | #include "time.h" |
| sdlashmar | 3:36f9e3a75905 | 8 | |
| sdlashmar | 5:256e5e0b6cd7 | 9 | class SnakeHead |
| sdlashmar | 3:36f9e3a75905 | 10 | { |
| sdlashmar | 3:36f9e3a75905 | 11 | |
| sdlashmar | 3:36f9e3a75905 | 12 | public: |
| sdlashmar | 5:256e5e0b6cd7 | 13 | SnakeHead(); |
| sdlashmar | 5:256e5e0b6cd7 | 14 | ~SnakeHead(); |
| sdlashmar | 3:36f9e3a75905 | 15 | void init(int size, int speed); |
| sdlashmar | 3:36f9e3a75905 | 16 | void draw(N5110 &lcd); |
| sdlashmar | 4:c5addc5475d3 | 17 | void update(); |
| sdlashmar | 4:c5addc5475d3 | 18 | void change_direction(Direction d); |
| sdlashmar | 3:36f9e3a75905 | 19 | void set_velocity(Vector2D v); |
| sdlashmar | 3:36f9e3a75905 | 20 | Vector2D get_velocity(); |
| sdlashmar | 3:36f9e3a75905 | 21 | Vector2D get_pos(); |
| sdlashmar | 3:36f9e3a75905 | 22 | void set_pos(Vector2D p); |
| sdlashmar | 3:36f9e3a75905 | 23 | |
| sdlashmar | 4:c5addc5475d3 | 24 | |
| sdlashmar | 3:36f9e3a75905 | 25 | private: |
| sdlashmar | 4:c5addc5475d3 | 26 | Vector2D _velocity; |
| sdlashmar | 4:c5addc5475d3 | 27 | Gamepad pad; |
| sdlashmar | 3:36f9e3a75905 | 28 | int _size; |
| sdlashmar | 3:36f9e3a75905 | 29 | int _speed; |
| sdlashmar | 3:36f9e3a75905 | 30 | int _x; |
| sdlashmar | 3:36f9e3a75905 | 31 | int _y; |
| sdlashmar | 3:36f9e3a75905 | 32 | }; |
| sdlashmar | 3:36f9e3a75905 | 33 | |
| sdlashmar | 3:36f9e3a75905 | 34 | #endif |