
Final Commit
Dependencies: mbed
Snake/Snake.h@21:63c5590cb2c2, 2018-04-30 (annotated)
- Committer:
- JRM1986
- Date:
- Mon Apr 30 14:37:23 2018 +0000
- Revision:
- 21:63c5590cb2c2
- Parent:
- 19:b437806e579b
- Child:
- 22:7f81fca01f02
No longer increments in steps of 2, init functions work
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 | 9:561e5681b7a6 | 8 | |
JRM1986 | 2:ea90cec2489a | 9 | /** Snake Class |
JRM1986 | 1:c3fdbc4b1293 | 10 | * @brief Describes the methods and functions for the snake |
JRM1986 | 1:c3fdbc4b1293 | 11 | * @author Joshua R. Marshall |
JRM1986 | 1:c3fdbc4b1293 | 12 | * @date Feb, 2018 |
JRM1986 | 2:ea90cec2489a | 13 | */ |
JRM1986 | 9:561e5681b7a6 | 14 | |
JRM1986 | 2:ea90cec2489a | 15 | class Snake |
JRM1986 | 2:ea90cec2489a | 16 | { |
JRM1986 | 2:ea90cec2489a | 17 | |
JRM1986 | 2:ea90cec2489a | 18 | public: |
JRM1986 | 9:561e5681b7a6 | 19 | |
JRM1986 | 2:ea90cec2489a | 20 | Snake(); // constructor |
JRM1986 | 2:ea90cec2489a | 21 | ~Snake(); // destructor |
JRM1986 | 13:72bc2579e85e | 22 | |
JRM1986 | 19:b437806e579b | 23 | void init(Direction in, Direction cur, int pos_x, int pos_y); |
JRM1986 | 13:72bc2579e85e | 24 | |
JRM1986 | 10:62d8cb7742c3 | 25 | void update(Direction in, Direction cur); |
JRM1986 | 9:561e5681b7a6 | 26 | void draw(N5110 &lcd); |
JRM1986 | 9:561e5681b7a6 | 27 | |
JRM1986 | 10:62d8cb7742c3 | 28 | void set_snake_direction(Direction input, Direction current); |
JRM1986 | 19:b437806e579b | 29 | void set_current(Direction input, Direction current); |
JRM1986 | 19:b437806e579b | 30 | void set_north(Direction input, Direction current); |
JRM1986 | 19:b437806e579b | 31 | void set_east(Direction input, Direction current); |
JRM1986 | 19:b437806e579b | 32 | void set_south(Direction input, Direction current); |
JRM1986 | 19:b437806e579b | 33 | void set_west(Direction input, Direction current); |
JRM1986 | 19:b437806e579b | 34 | |
JRM1986 | 9:561e5681b7a6 | 35 | Direction get_snake_direction(); |
JRM1986 | 13:72bc2579e85e | 36 | |
JRM1986 | 14:c3a435597196 | 37 | void set_current_direction(Direction input); |
JRM1986 | 11:e260c17a0489 | 38 | Direction get_current_direction(); |
JRM1986 | 13:72bc2579e85e | 39 | |
JRM1986 | 10:62d8cb7742c3 | 40 | void set_snake_position(Direction next); |
JRM1986 | 9:561e5681b7a6 | 41 | Vector2D get_snake_position(); |
JRM1986 | 14:c3a435597196 | 42 | |
JRM1986 | 14:c3a435597196 | 43 | |
JRM1986 | 2:ea90cec2489a | 44 | |
JRM1986 | 2:ea90cec2489a | 45 | private: |
JRM1986 | 9:561e5681b7a6 | 46 | |
JRM1986 | 13:72bc2579e85e | 47 | // Direction _direction; |
JRM1986 | 10:62d8cb7742c3 | 48 | Direction _next; |
JRM1986 | 13:72bc2579e85e | 49 | Direction _current; |
JRM1986 | 21:63c5590cb2c2 | 50 | Direction _d; |
JRM1986 | 13:72bc2579e85e | 51 | Vector2D _pos; |
JRM1986 | 21:63c5590cb2c2 | 52 | //int _x; |
JRM1986 | 21:63c5590cb2c2 | 53 | //int _y; |
JRM1986 | 9:561e5681b7a6 | 54 | |
JRM1986 | 2:ea90cec2489a | 55 | }; |
JRM1986 | 2:ea90cec2489a | 56 | #endif |