
Final Commit
Dependencies: mbed
Snake/Snake.h@11:e260c17a0489, 2018-04-06 (annotated)
- Committer:
- JRM1986
- Date:
- Fri Apr 06 15:15:50 2018 +0000
- Revision:
- 11:e260c17a0489
- Parent:
- 10:62d8cb7742c3
- Child:
- 12:9f2f64016f56
Direction function debugged and test routine run ; Postion function test routine created not run
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
JRM1986 | 2:ea90cec2489a | 1 | #ifndef SNAKE_H |
JRM1986 | 2:ea90cec2489a | 2 | #define SNAKE_H |
JRM1986 | 2:ea90cec2489a | 3 | |
JRM1986 | 2:ea90cec2489a | 4 | #include "mbed.h" |
JRM1986 | 3:50f01159c61d | 5 | #include "FXOS8700CQ.h" |
JRM1986 | 3:50f01159c61d | 6 | #include "Gamepad.h" |
JRM1986 | 2:ea90cec2489a | 7 | #include "N5110.h" |
JRM1986 | 2:ea90cec2489a | 8 | |
JRM1986 | 9:561e5681b7a6 | 9 | struct StateDirection { |
JRM1986 | 9:561e5681b7a6 | 10 | |
JRM1986 | 9:561e5681b7a6 | 11 | Direction output; |
JRM1986 | 9:561e5681b7a6 | 12 | Direction nextState[4]; |
JRM1986 | 9:561e5681b7a6 | 13 | |
JRM1986 | 9:561e5681b7a6 | 14 | }; |
JRM1986 | 9:561e5681b7a6 | 15 | |
JRM1986 | 9:561e5681b7a6 | 16 | |
JRM1986 | 2:ea90cec2489a | 17 | /** Snake Class |
JRM1986 | 1:c3fdbc4b1293 | 18 | * @brief Describes the methods and functions for the snake |
JRM1986 | 1:c3fdbc4b1293 | 19 | * @author Joshua R. Marshall |
JRM1986 | 1:c3fdbc4b1293 | 20 | * @date Feb, 2018 |
JRM1986 | 2:ea90cec2489a | 21 | */ |
JRM1986 | 9:561e5681b7a6 | 22 | |
JRM1986 | 2:ea90cec2489a | 23 | class Snake |
JRM1986 | 2:ea90cec2489a | 24 | { |
JRM1986 | 2:ea90cec2489a | 25 | |
JRM1986 | 2:ea90cec2489a | 26 | public: |
JRM1986 | 9:561e5681b7a6 | 27 | |
JRM1986 | 2:ea90cec2489a | 28 | Snake(); // constructor |
JRM1986 | 2:ea90cec2489a | 29 | ~Snake(); // destructor |
JRM1986 | 9:561e5681b7a6 | 30 | void init(); |
JRM1986 | 10:62d8cb7742c3 | 31 | void update(Direction in, Direction cur); |
JRM1986 | 9:561e5681b7a6 | 32 | void draw(N5110 &lcd); |
JRM1986 | 9:561e5681b7a6 | 33 | |
JRM1986 | 10:62d8cb7742c3 | 34 | void set_snake_direction(Direction input, Direction current); |
JRM1986 | 9:561e5681b7a6 | 35 | Direction get_snake_direction(); |
JRM1986 | 11:e260c17a0489 | 36 | // void set_current_direction(Direction new_cur); |
JRM1986 | 11:e260c17a0489 | 37 | Direction get_current_direction(); |
JRM1986 | 10:62d8cb7742c3 | 38 | void set_snake_position(Direction next); |
JRM1986 | 9:561e5681b7a6 | 39 | Vector2D get_snake_position(); |
JRM1986 | 2:ea90cec2489a | 40 | |
JRM1986 | 2:ea90cec2489a | 41 | private: |
JRM1986 | 9:561e5681b7a6 | 42 | |
JRM1986 | 9:561e5681b7a6 | 43 | Direction _direction; |
JRM1986 | 10:62d8cb7742c3 | 44 | Direction _next; |
JRM1986 | 9:561e5681b7a6 | 45 | int _x; |
JRM1986 | 9:561e5681b7a6 | 46 | int _y; |
JRM1986 | 9:561e5681b7a6 | 47 | |
JRM1986 | 2:ea90cec2489a | 48 | }; |
JRM1986 | 2:ea90cec2489a | 49 | #endif |