
Final Commit
Dependencies: mbed
SnakeEngine/SnakeEngine.h
- Committer:
- JRM1986
- Date:
- 2018-03-16
- Revision:
- 6:f3f508cea1c4
- Parent:
- 3:50f01159c61d
- Child:
- 7:c38800a428a6
File content as of revision 6:f3f508cea1c4:
#ifndef SNAKEENGINE_H #define SNAKEENGINE_H #include "mbed.h" #include "FXOS8700CQ.h" #include "Gamepad.h" #include "N5110.h" #include "Food.h" #include "Snake.h" /** SnakeEngine Class * @brief Class that initialises and defines the game charectoristics ready for the main file * @author Joshua R. Marshall * @date Feb, 2018 */ class SnakeEngine { public: SnakeEngine(); // constructor ~SnakeEngine(); // destructor void init(Vector2D food_position); // initiallises the position of the food, and snake void draw(N5110 &lcd); // draws snake/food to the lcd void update(Gamepad &pad); // updates depending on gamepad input void get_input(Gamepad &pad); // gets the input from the gamepad private: void check_wall_reached(); // checks if snake has hit the side void check_food_eaten(); // checks if snake has eaten the food void check_tail_collision(); // checks if snake has collided with its own tail // ----- Food Position ----- int _fx; int _fy; Food _food; Snake _snake; }; #endif