Balint Bogdan 2645 project, 200966741
Snake.h@1:93a4cb86f100, 2017-05-05 (annotated)
- Committer:
- Nefos
- Date:
- Fri May 05 10:36:54 2017 +0000
- Revision:
- 1:93a4cb86f100
- Parent:
- 0:2eb4d7e86e2f
- Child:
- 2:5e04e34a3b66
The snake code is working, snake is acting like a snake
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Nefos | 0:2eb4d7e86e2f | 1 | #ifndef SNAKE_H |
Nefos | 0:2eb4d7e86e2f | 2 | #define SNAKE_H |
Nefos | 0:2eb4d7e86e2f | 3 | |
Nefos | 0:2eb4d7e86e2f | 4 | |
Nefos | 0:2eb4d7e86e2f | 5 | #include "mbed.h" |
Nefos | 0:2eb4d7e86e2f | 6 | #include "N5110.h" |
Nefos | 0:2eb4d7e86e2f | 7 | #include "Gamepad.h" |
Nefos | 0:2eb4d7e86e2f | 8 | #include "GameEngine.h" |
Nefos | 0:2eb4d7e86e2f | 9 | #include <deque> |
Nefos | 0:2eb4d7e86e2f | 10 | |
Nefos | 0:2eb4d7e86e2f | 11 | struct snakePart{ |
Nefos | 0:2eb4d7e86e2f | 12 | char _x[4000]; |
Nefos | 0:2eb4d7e86e2f | 13 | char _y[4000]; |
Nefos | 0:2eb4d7e86e2f | 14 | char _dir[4000]; |
Nefos | 0:2eb4d7e86e2f | 15 | |
Nefos | 0:2eb4d7e86e2f | 16 | }; |
Nefos | 0:2eb4d7e86e2f | 17 | |
Nefos | 0:2eb4d7e86e2f | 18 | |
Nefos | 0:2eb4d7e86e2f | 19 | class Snake |
Nefos | 0:2eb4d7e86e2f | 20 | { |
Nefos | 0:2eb4d7e86e2f | 21 | public: |
Nefos | 0:2eb4d7e86e2f | 22 | |
Nefos | 0:2eb4d7e86e2f | 23 | Snake(); |
Nefos | 0:2eb4d7e86e2f | 24 | ~Snake(); |
Nefos | 0:2eb4d7e86e2f | 25 | void init(int x, int y, int lenght); |
Nefos | 0:2eb4d7e86e2f | 26 | void draw(N5110 &lcd); |
Nefos | 0:2eb4d7e86e2f | 27 | void update(Gamepad &pad); |
Nefos | 0:2eb4d7e86e2f | 28 | snakePart add_point(int x, int y); |
Nefos | 0:2eb4d7e86e2f | 29 | void get_length(); |
Nefos | 0:2eb4d7e86e2f | 30 | int _length; |
Nefos | 0:2eb4d7e86e2f | 31 | |
Nefos | 1:93a4cb86f100 | 32 | |
Nefos | 0:2eb4d7e86e2f | 33 | |
Nefos | 0:2eb4d7e86e2f | 34 | |
Nefos | 0:2eb4d7e86e2f | 35 | private: |
Nefos | 0:2eb4d7e86e2f | 36 | //deque<snakePart> snek; |
Nefos | 0:2eb4d7e86e2f | 37 | |
Nefos | 0:2eb4d7e86e2f | 38 | int _speed; |
Nefos | 0:2eb4d7e86e2f | 39 | int _direction; |
Nefos | 0:2eb4d7e86e2f | 40 | int counter; |
Nefos | 1:93a4cb86f100 | 41 | int startx; |
Nefos | 1:93a4cb86f100 | 42 | int starty; |
Nefos | 0:2eb4d7e86e2f | 43 | //int _snakeX[4000]; |
Nefos | 0:2eb4d7e86e2f | 44 | //int _snakeY[4000]; |
Nefos | 0:2eb4d7e86e2f | 45 | //int _snakeDir[4000]; |
Nefos | 0:2eb4d7e86e2f | 46 | int x; |
Nefos | 0:2eb4d7e86e2f | 47 | Direction d; |
Nefos | 0:2eb4d7e86e2f | 48 | |
Nefos | 0:2eb4d7e86e2f | 49 | |
Nefos | 0:2eb4d7e86e2f | 50 | }; |
Nefos | 0:2eb4d7e86e2f | 51 | |
Nefos | 0:2eb4d7e86e2f | 52 | #endif |