Snake vs Block Game to be run upon K64F.

Dependencies:   mbed

Committer:
AhmedPlaymaker
Date:
Mon May 06 14:28:35 2019 +0000
Revision:
83:329da564799a
Parent:
80:51ca38c5dcdf
Child:
85:d50ba0994676
Now, I have put gamepad and lcd objects from the main() in a pointer, so that i can declare them in init() in every class i use them in and use them as global objects for each class, without having to send their addresses to all of the functions.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AhmedPlaymaker 60:d3a9e0e4a0de 1 #ifndef TUTORIAL_H
AhmedPlaymaker 60:d3a9e0e4a0de 2 #define TUTORIAL_H
AhmedPlaymaker 60:d3a9e0e4a0de 3
AhmedPlaymaker 60:d3a9e0e4a0de 4 #include "mbed.h"
AhmedPlaymaker 60:d3a9e0e4a0de 5 #include "N5110.h"
AhmedPlaymaker 60:d3a9e0e4a0de 6 #include "Gamepad.h"
AhmedPlaymaker 60:d3a9e0e4a0de 7
AhmedPlaymaker 60:d3a9e0e4a0de 8 class Tutorial
AhmedPlaymaker 60:d3a9e0e4a0de 9 {
AhmedPlaymaker 60:d3a9e0e4a0de 10 public:
AhmedPlaymaker 60:d3a9e0e4a0de 11
AhmedPlaymaker 60:d3a9e0e4a0de 12 Tutorial();
AhmedPlaymaker 60:d3a9e0e4a0de 13 ~Tutorial();
AhmedPlaymaker 60:d3a9e0e4a0de 14
AhmedPlaymaker 83:329da564799a 15 /** Initialise Tutorial
AhmedPlaymaker 83:329da564799a 16 *
AhmedPlaymaker 83:329da564799a 17 * This function passes the pointers to the tutorial class so that it can control the screen and the gamepad.
AhmedPlaymaker 83:329da564799a 18 */
AhmedPlaymaker 83:329da564799a 19 void init(N5110 *lcd, Gamepad *pad);
AhmedPlaymaker 83:329da564799a 20
AhmedPlaymaker 60:d3a9e0e4a0de 21 /** Implement Tutorial
AhmedPlaymaker 60:d3a9e0e4a0de 22 *
AhmedPlaymaker 60:d3a9e0e4a0de 23 * This function is used to configure Tutorial.
AhmedPlaymaker 60:d3a9e0e4a0de 24 */
AhmedPlaymaker 83:329da564799a 25 void Implement();
AhmedPlaymaker 60:d3a9e0e4a0de 26
AhmedPlaymaker 80:51ca38c5dcdf 27 /** Check Back Pressed
AhmedPlaymaker 80:51ca38c5dcdf 28 *
AhmedPlaymaker 80:51ca38c5dcdf 29 * This function makes a centralised approach to check when back is pressed in a loop, so that it can be used to exit it and also go to.
AhmedPlaymaker 80:51ca38c5dcdf 30 * the previous menu option.
AhmedPlaymaker 80:51ca38c5dcdf 31 */
AhmedPlaymaker 83:329da564799a 32 bool checkBackPressed();
AhmedPlaymaker 80:51ca38c5dcdf 33
AhmedPlaymaker 60:d3a9e0e4a0de 34 /** game Pad
AhmedPlaymaker 60:d3a9e0e4a0de 35 *
AhmedPlaymaker 60:d3a9e0e4a0de 36 * This function introduces the gamepad to the user.
AhmedPlaymaker 60:d3a9e0e4a0de 37 */
AhmedPlaymaker 83:329da564799a 38 void gamePad();
AhmedPlaymaker 60:d3a9e0e4a0de 39
AhmedPlaymaker 78:10e5cc013806 40 /** settings
AhmedPlaymaker 78:10e5cc013806 41 *
AhmedPlaymaker 78:10e5cc013806 42 * This function shows how to control parameters in settings.
AhmedPlaymaker 78:10e5cc013806 43 */
AhmedPlaymaker 83:329da564799a 44 void settings();
AhmedPlaymaker 78:10e5cc013806 45
AhmedPlaymaker 78:10e5cc013806 46 /** Controls To Navigate In Menu
AhmedPlaymaker 78:10e5cc013806 47 *
AhmedPlaymaker 78:10e5cc013806 48 * This function shows how to scroll through menu.
AhmedPlaymaker 78:10e5cc013806 49 */
AhmedPlaymaker 83:329da564799a 50 void controlsToNavigateInMenu();
AhmedPlaymaker 78:10e5cc013806 51
AhmedPlaymaker 78:10e5cc013806 52 /** Controls To Navigate through Game Mode and Game Speed.
AhmedPlaymaker 78:10e5cc013806 53 *
AhmedPlaymaker 78:10e5cc013806 54 * This function shows how to scroll through menu.
AhmedPlaymaker 78:10e5cc013806 55 */
AhmedPlaymaker 83:329da564799a 56 void controlsToNavigateGameModeSpeed();
AhmedPlaymaker 78:10e5cc013806 57
AhmedPlaymaker 78:10e5cc013806 58 /** Controls To Play Game.
AhmedPlaymaker 78:10e5cc013806 59 *
AhmedPlaymaker 78:10e5cc013806 60 * This function shows how to move the snake in the game.
AhmedPlaymaker 78:10e5cc013806 61 */
AhmedPlaymaker 83:329da564799a 62 void controlsToPlayGame();
AhmedPlaymaker 78:10e5cc013806 63
AhmedPlaymaker 78:10e5cc013806 64 /** ControlsvForvPreviousvOr Next.
AhmedPlaymaker 78:10e5cc013806 65 *
AhmedPlaymaker 78:10e5cc013806 66 * This function shows how to start/end the game and also go to the next/previous menu.
AhmedPlaymaker 78:10e5cc013806 67 */
AhmedPlaymaker 83:329da564799a 68 void controlsForPreviousOrNext();
AhmedPlaymaker 80:51ca38c5dcdf 69
AhmedPlaymaker 80:51ca38c5dcdf 70 private:
AhmedPlaymaker 80:51ca38c5dcdf 71 bool _backPressed; //remembers if back is pressed.
AhmedPlaymaker 80:51ca38c5dcdf 72
AhmedPlaymaker 83:329da564799a 73 //Pointer to the game pad object pad.
AhmedPlaymaker 83:329da564799a 74 Gamepad *_pad;
AhmedPlaymaker 83:329da564799a 75 //Pointer to the N5110 object lcd.
AhmedPlaymaker 83:329da564799a 76 N5110 *_lcd;
AhmedPlaymaker 83:329da564799a 77
AhmedPlaymaker 60:d3a9e0e4a0de 78 };
AhmedPlaymaker 60:d3a9e0e4a0de 79 #endif