
Final Commit
Dependencies: mbed
Diff: Snake/Snake.h
- Revision:
- 13:72bc2579e85e
- Parent:
- 12:9f2f64016f56
- Child:
- 14:c3a435597196
--- a/Snake/Snake.h Mon Apr 09 10:16:58 2018 +0000 +++ b/Snake/Snake.h Wed Apr 11 11:42:16 2018 +0000 @@ -5,21 +5,19 @@ #include "FXOS8700CQ.h" #include "Gamepad.h" #include "N5110.h" - +/* struct StateDirection { Direction output; Direction nextState[4]; }; - -Vector2D g_snake_position(); // global variable to increment/decrement the position of the snake + */ +Vector2D g_snake_position(); // global function to increment/decrement the position of the snake +Direction g_current_direction(); // global variable to hold the current direction -static Vector2D g_p; - -Direction current_direction(); // global variable to hold the current direction - -static Direction g_d; +static Vector2D g_p; // global variable to increment/decrement the position of the snake +static Direction g_d; // global variable to hold the current direction /** Snake Class @@ -35,21 +33,27 @@ Snake(); // constructor ~Snake(); // destructor - void init(); + + void init(Direction direction, int pos_x, int pos_y); + void update(Direction in, Direction cur); void draw(N5110 &lcd); void set_snake_direction(Direction input, Direction current); Direction get_snake_direction(); - // void set_current_direction(Direction new_cur); + + void set_current_direction(); Direction get_current_direction(); + void set_snake_position(Direction next); Vector2D get_snake_position(); private: - Direction _direction; + // Direction _direction; Direction _next; + Direction _current; + Vector2D _pos; int _x; int _y;