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