![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
testing documentation
Dependencies: mbed ll16j23s_test_docs
SnakeBody/SnakeBody.h@3:fcd6d70e9694, 2020-05-20 (annotated)
- Committer:
- JoeShotton
- Date:
- Wed May 20 21:25:40 2020 +0000
- Revision:
- 3:fcd6d70e9694
- Child:
- 4:ea3fa51c4386
test
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
JoeShotton | 3:fcd6d70e9694 | 1 | #ifndef SNAKEBODY_H |
JoeShotton | 3:fcd6d70e9694 | 2 | #define SNAKEBODY_H |
JoeShotton | 3:fcd6d70e9694 | 3 | |
JoeShotton | 3:fcd6d70e9694 | 4 | #include "mbed.h" |
JoeShotton | 3:fcd6d70e9694 | 5 | #include "N5110.h" |
JoeShotton | 3:fcd6d70e9694 | 6 | #include "Gamepad.h" |
JoeShotton | 3:fcd6d70e9694 | 7 | #include <vector> |
JoeShotton | 3:fcd6d70e9694 | 8 | |
JoeShotton | 3:fcd6d70e9694 | 9 | class SnakeBody |
JoeShotton | 3:fcd6d70e9694 | 10 | { |
JoeShotton | 3:fcd6d70e9694 | 11 | |
JoeShotton | 3:fcd6d70e9694 | 12 | struct Direction { |
JoeShotton | 3:fcd6d70e9694 | 13 | int output; // output value |
JoeShotton | 3:fcd6d70e9694 | 14 | int delta_x; // increment value for x |
JoeShotton | 3:fcd6d70e9694 | 15 | int delta_y; // increment value for y |
JoeShotton | 3:fcd6d70e9694 | 16 | int nextState[5]; // array of next states |
JoeShotton | 3:fcd6d70e9694 | 17 | }; |
JoeShotton | 3:fcd6d70e9694 | 18 | |
JoeShotton | 3:fcd6d70e9694 | 19 | |
JoeShotton | 3:fcd6d70e9694 | 20 | public: |
JoeShotton | 3:fcd6d70e9694 | 21 | |
JoeShotton | 3:fcd6d70e9694 | 22 | SnakeBody(); |
JoeShotton | 3:fcd6d70e9694 | 23 | ~SnakeBody(); |
JoeShotton | 3:fcd6d70e9694 | 24 | void update_movement(int x_max, int y_max, int cell_size); |
JoeShotton | 3:fcd6d70e9694 | 25 | /* |
JoeShotton | 3:fcd6d70e9694 | 26 | void init(int x,int height,int width); |
JoeShotton | 3:fcd6d70e9694 | 27 | void draw(N5110 &lcd); |
JoeShotton | 3:fcd6d70e9694 | 28 | void update(Direction d,float mag); |
JoeShotton | 3:fcd6d70e9694 | 29 | void add_score(); |
JoeShotton | 3:fcd6d70e9694 | 30 | int get_score(); |
JoeShotton | 3:fcd6d70e9694 | 31 | Vector2D get_pos(); |
JoeShotton | 3:fcd6d70e9694 | 32 | */ |
JoeShotton | 3:fcd6d70e9694 | 33 | private: |
JoeShotton | 3:fcd6d70e9694 | 34 | |
JoeShotton | 3:fcd6d70e9694 | 35 | int _state; |
JoeShotton | 3:fcd6d70e9694 | 36 | int _x_head; |
JoeShotton | 3:fcd6d70e9694 | 37 | int _y_head; |
JoeShotton | 3:fcd6d70e9694 | 38 | std::vector<int> _body_x; |
JoeShotton | 3:fcd6d70e9694 | 39 | std::vector<int> _body_y; |
JoeShotton | 3:fcd6d70e9694 | 40 | |
JoeShotton | 3:fcd6d70e9694 | 41 | /* |
JoeShotton | 3:fcd6d70e9694 | 42 | int _height; |
JoeShotton | 3:fcd6d70e9694 | 43 | int _width; |
JoeShotton | 3:fcd6d70e9694 | 44 | int _x; |
JoeShotton | 3:fcd6d70e9694 | 45 | int _y; |
JoeShotton | 3:fcd6d70e9694 | 46 | int _speed; |
JoeShotton | 3:fcd6d70e9694 | 47 | int _score; |
JoeShotton | 3:fcd6d70e9694 | 48 | */ |
JoeShotton | 3:fcd6d70e9694 | 49 | }; |
JoeShotton | 3:fcd6d70e9694 | 50 | #endif |