
Final Commit
Dependencies: mbed
Snake/Snake.h
- Committer:
- JRM1986
- Date:
- 2018-04-30
- Revision:
- 19:b437806e579b
- Parent:
- 18:406fc298a7c4
- Child:
- 21:63c5590cb2c2
File content as of revision 19:b437806e579b:
#ifndef SNAKE_H #define SNAKE_H #include "mbed.h" #include "FXOS8700CQ.h" #include "Gamepad.h" #include "N5110.h" /* struct StateDirection { Direction output; Direction nextState[4]; }; */ 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; // global variable to increment/decrement the position of the snake static Direction g_d; // global variable to hold the current direction /** Snake Class * @brief Describes the methods and functions for the snake * @author Joshua R. Marshall * @date Feb, 2018 */ class Snake { public: Snake(); // constructor ~Snake(); // destructor void init(Direction in, Direction cur, int pos_x, int pos_y); void update(Direction in, Direction cur); void draw(N5110 &lcd); void set_snake_direction(Direction input, Direction current); void set_current(Direction input, Direction current); void set_north(Direction input, Direction current); void set_east(Direction input, Direction current); void set_south(Direction input, Direction current); void set_west(Direction input, Direction current); Direction get_snake_direction(); void set_current_direction(Direction input); Direction get_current_direction(); void set_snake_position(Direction next); Vector2D get_snake_position(); private: // Direction _direction; Direction _next; Direction _current; Vector2D _pos; int _x; int _y; }; #endif