testing documentation

Dependencies:   mbed ll16j23s_test_docs

Committer:
JoeShotton
Date:
Mon May 25 14:45:32 2020 +0000
Revision:
8:bcc3403d7e79
Parent:
7:dd84e0fab346
Child:
9:0571880085cc
Added contrast adjustments for all menu states

Who changed what in which revision?

UserRevisionLine numberNew 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 struct Direction {
JoeShotton 4:ea3fa51c4386 12 int delta_x; // increment value for x
JoeShotton 4:ea3fa51c4386 13 int delta_y; // increment value for y
JoeShotton 4:ea3fa51c4386 14 int nextState[5]; // array of next states
JoeShotton 3:fcd6d70e9694 15 };
JoeShotton 3:fcd6d70e9694 16
JoeShotton 3:fcd6d70e9694 17 public:
JoeShotton 3:fcd6d70e9694 18
JoeShotton 3:fcd6d70e9694 19 SnakeBody();
JoeShotton 3:fcd6d70e9694 20 ~SnakeBody();
JoeShotton 4:ea3fa51c4386 21 void init();
JoeShotton 4:ea3fa51c4386 22 void snake_movement(Gamepad &pad);
JoeShotton 4:ea3fa51c4386 23 void draw_body(N5110 &lcd);
JoeShotton 8:bcc3403d7e79 24 bool snake_snake_collision(Gamepad &pad); //(int _x_head, int _y_head, vector<int> _body_x, vector<int> _body_y, int _length);
JoeShotton 4:ea3fa51c4386 25
JoeShotton 4:ea3fa51c4386 26 int _state;
JoeShotton 4:ea3fa51c4386 27 int _x_head;
JoeShotton 4:ea3fa51c4386 28 int _y_head;
JoeShotton 4:ea3fa51c4386 29 int _length;
JoeShotton 6:6c9453397f4a 30
JoeShotton 6:6c9453397f4a 31 std::vector<int> _body_x;
JoeShotton 6:6c9453397f4a 32 std::vector<int> _body_y;
JoeShotton 7:dd84e0fab346 33
JoeShotton 3:fcd6d70e9694 34 private:
JoeShotton 3:fcd6d70e9694 35
JoeShotton 4:ea3fa51c4386 36 int update_direction(float _angle, int _x_head, int _y_head); //int _angle, int _x_head, int _y_head
JoeShotton 4:ea3fa51c4386 37 void update_position(); //int _d, int _state, int &_x_head, int &_y_head
JoeShotton 4:ea3fa51c4386 38 void update_body();
JoeShotton 4:ea3fa51c4386 39
JoeShotton 4:ea3fa51c4386 40 float _angle;
JoeShotton 4:ea3fa51c4386 41 int _d;
JoeShotton 3:fcd6d70e9694 42
JoeShotton 3:fcd6d70e9694 43 };
JoeShotton 3:fcd6d70e9694 44 #endif