Snake vs Block Game to be run upon K64F.

Dependencies:   mbed

Revision:
83:329da564799a
Parent:
82:c51ae8a501d1
Child:
84:9950d561fdf8
--- a/GameEngine/SnakevsBlock/SnakevsBlock.h	Mon May 06 10:49:50 2019 +0000
+++ b/GameEngine/SnakevsBlock/SnakevsBlock.h	Mon May 06 14:28:35 2019 +0000
@@ -25,7 +25,7 @@
     *
     *   This function initialises the game machine.
     */
-    void init();
+    void init(N5110 *lcd, Gamepad *pad);
 
     /** Reset Game Machine
     *
@@ -43,37 +43,37 @@
     *
     *   This function obtains numeric data from the gamepads joystick.
     */
-    void read_input(Gamepad &pad, FXOS8700CQ &device, int gm);
+    void read_input(FXOS8700CQ &device, int gm);
 
     /** Calculate Tilt
     *
     *   This function reads the angle of tilt required for motion contol and also processes it by reseting the angle buffer if A is pressed.
     */
-    void calculateTilt(Gamepad &pad, FXOS8700CQ &device);
+    void calculateTilt(FXOS8700CQ &device);
 
     /** Light The LEDS
     *
     *   This function ligths the LEDS dependent on the direction of travel.
     */
-    void lightTheLEDS(Gamepad &pad);
+    void lightTheLEDS();
 
     /** Draw
     *
     *   This function contains the draw functions of the other libraries used in the game.
     */
-    void draw(N5110 &lcd, Gamepad &pad);
+    void draw();
 
     /** Update
     *
     *   This function contains the update functions of the other libraries used in the game.
     */
-    void update(N5110 &lcd, Gamepad &pad);
+    void update();
 
     /** Check Game Progression
     *
     *   Function handles level progression and level failure operations by using the class WinLoose.
     */
-    int CheckGameProgression(N5110 &lcd, Gamepad &pad, SDFileSystem &sd);
+    int CheckGameProgression(SDFileSystem &sd);
 
     /** Get Position
     *
@@ -89,31 +89,31 @@
     *
     *   This function checks if the Snake has come into contact with it's food.
     */
-    void CheckSnakeFoodCollision(Gamepad &pad);
+    void CheckSnakeFoodCollision();
 
     /** Check Snake Food Y Collision
     *
     *   This function automatically detects each combination of collision in the y postion.
     */
-    void CheckSnakeFoodYCollision(Gamepad &pad, int food_sr);
+    void CheckSnakeFoodYCollision(int food_sr);
 
     /** Check Snake Food X Collision
     *
     *   This function automatically detects each combination of collision in the x postion.
     */
-    void CheckSnakeFoodXCollision(Gamepad &pad, int food_sr);
+    void CheckSnakeFoodXCollision(int food_sr);
 
     /** Implement Snake Food Collision
     *
     *   This function automatically detects which food we are interacting with and increases the snake length accordingly.
     */
-    void ImplementSnakeFoodCollision(Gamepad &pad, int food_sr);
+    void ImplementSnakeFoodCollision(int food_sr);
 
     /** Check for Snake and Block collision
     *
     *   This function checks if the Snake has come into contact with any Block.
     */
-    void CheckSnakeBlockCollision(Gamepad &pad);
+    void CheckSnakeBlockCollision();
 
     /** Implement velocity alteration.
     *
@@ -131,13 +131,13 @@
     *
     *   This function allows the appropriate maths to take place after every collision.
     */
-    void ImplementSnakeBlockCollision(Gamepad &pad);
+    void ImplementSnakeBlockCollision();
 
     /** Check for Snake and Block Sides collision
     *
     *   This function checks if the Snake has come into contact with any the sides of the block and stops it moving.
     */
-    void CheckSnakeBlockSidesCollision(Gamepad &pad);
+    void CheckSnakeBlockSidesCollision();
 
     /** Make Default Motion Free
     *
@@ -167,7 +167,7 @@
     *
     *   This function checks if the Snake has come into contact with any the sides of the barriers and stops it moving in the X axis if true.
     */
-    void CheckSnakeBarrierCollision(Gamepad &pad, int bar_sr_no);
+    void CheckSnakeBarrierCollision(int bar_sr_no);
     
     /** Check Collision in Y axis
     *
@@ -200,6 +200,11 @@
     Barriers _barA;
     Barriers _barB;
     Stats _Setstats;
+    
+    //Pointer to the game pad object pad.
+    Gamepad *_pad;
+    //Pointer to the N5110 object lcd.
+    N5110 *_lcd;
 
     //OBJECT POSITIONS ON SCREEN.
     int snakex; //x position of top beed