Snake vs Block Game to be run upon K64F.

Dependencies:   mbed

Committer:
AhmedPlaymaker
Date:
Tue Apr 23 15:22:09 2019 +0000
Revision:
42:973bb6036f81
Parent:
39:210ac915e0a0
changed some function names and divided a functionality into 2 functions

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AhmedPlaymaker 3:fbb1fa853f09 1 #ifndef StartScreen_H
AhmedPlaymaker 3:fbb1fa853f09 2 #define StartScreen_H
AhmedPlaymaker 3:fbb1fa853f09 3
AhmedPlaymaker 3:fbb1fa853f09 4 #include "mbed.h"
AhmedPlaymaker 3:fbb1fa853f09 5 #include "N5110.h"
AhmedPlaymaker 3:fbb1fa853f09 6 #include "Gamepad.h"
AhmedPlaymaker 5:e4df87957a5b 7 #include "Settings.h"
AhmedPlaymaker 33:249cf423fb18 8 #include "Stats.h"
AhmedPlaymaker 33:249cf423fb18 9 #include "SDFileSystem.h"
AhmedPlaymaker 3:fbb1fa853f09 10
AhmedPlaymaker 3:fbb1fa853f09 11 class StartScreen
AhmedPlaymaker 3:fbb1fa853f09 12 {
AhmedPlaymaker 3:fbb1fa853f09 13 public:
AhmedPlaymaker 3:fbb1fa853f09 14
AhmedPlaymaker 3:fbb1fa853f09 15 StartScreen();
AhmedPlaymaker 30:461231877c89 16 ~StartScreen()
AhmedPlaymaker 30:461231877c89 17 ;
AhmedPlaymaker 3:fbb1fa853f09 18
AhmedPlaymaker 3:fbb1fa853f09 19 /** Initialise StartScreen
AhmedPlaymaker 3:fbb1fa853f09 20 *
AhmedPlaymaker 3:fbb1fa853f09 21 * This function initialises the Game Interface and restarts the display.
AhmedPlaymaker 3:fbb1fa853f09 22 */
AhmedPlaymaker 33:249cf423fb18 23 void init();
AhmedPlaymaker 3:fbb1fa853f09 24
AhmedPlaymaker 3:fbb1fa853f09 25 /** Draw
AhmedPlaymaker 3:fbb1fa853f09 26 *
AhmedPlaymaker 3:fbb1fa853f09 27 * This function draws the Sprite onto the screen.
AhmedPlaymaker 3:fbb1fa853f09 28 */
AhmedPlaymaker 33:249cf423fb18 29 void screen_saver(N5110 &lcd, Gamepad &pad);
AhmedPlaymaker 3:fbb1fa853f09 30
AhmedPlaymaker 3:fbb1fa853f09 31 /** Instruct
AhmedPlaymaker 3:fbb1fa853f09 32 *
AhmedPlaymaker 3:fbb1fa853f09 33 * This function updates the user about how to progress after the game banner has been displayed..
AhmedPlaymaker 3:fbb1fa853f09 34 */
AhmedPlaymaker 33:249cf423fb18 35 void instruct(N5110 &lcd, Gamepad &pad);
AhmedPlaymaker 3:fbb1fa853f09 36
AhmedPlaymaker 3:fbb1fa853f09 37 /** Display userID
AhmedPlaymaker 3:fbb1fa853f09 38 *
AhmedPlaymaker 3:fbb1fa853f09 39 * This function shows who the author of the game is before showing the menu screen.
AhmedPlaymaker 3:fbb1fa853f09 40 */
AhmedPlaymaker 33:249cf423fb18 41 void info(N5110 &lcd, Gamepad &pad);
AhmedPlaymaker 3:fbb1fa853f09 42
AhmedPlaymaker 3:fbb1fa853f09 43 /** The First Menu Screen
AhmedPlaymaker 3:fbb1fa853f09 44 *
AhmedPlaymaker 3:fbb1fa853f09 45 * This function obtains the user input on how they want to progress.
AhmedPlaymaker 3:fbb1fa853f09 46 */
AhmedPlaymaker 33:249cf423fb18 47 void main_menu(N5110 &lcd, Gamepad &pad, SDFileSystem &sd);
AhmedPlaymaker 30:461231877c89 48
AhmedPlaymaker 30:461231877c89 49 /** Displaying The First Menu Screen
AhmedPlaymaker 30:461231877c89 50 *
AhmedPlaymaker 30:461231877c89 51 * This function just displays Menu Screen 1 contents.
AhmedPlaymaker 30:461231877c89 52 */
AhmedPlaymaker 34:89f53ffc81bb 53 void DisplayMMContents(N5110 &lcd, Gamepad &pad);
AhmedPlaymaker 34:89f53ffc81bb 54
AhmedPlaymaker 34:89f53ffc81bb 55 /** Implementing The First Menu Screen
AhmedPlaymaker 34:89f53ffc81bb 56 *
AhmedPlaymaker 34:89f53ffc81bb 57 * This function just implements the things decided in main menu.
AhmedPlaymaker 34:89f53ffc81bb 58 */
AhmedPlaymaker 34:89f53ffc81bb 59 void ImplementMM(N5110 &lcd, Gamepad &pad, SDFileSystem &sd);
AhmedPlaymaker 33:249cf423fb18 60
AhmedPlaymaker 4:1fe015b66bb8 61 /** The Second Menu Screen
AhmedPlaymaker 4:1fe015b66bb8 62 *
AhmedPlaymaker 4:1fe015b66bb8 63 * This function obtains the user input on the game type they would like to play.
AhmedPlaymaker 4:1fe015b66bb8 64 */
AhmedPlaymaker 33:249cf423fb18 65 void game_mode(N5110 &lcd, Gamepad &pad, SDFileSystem &sd);
AhmedPlaymaker 4:1fe015b66bb8 66
AhmedPlaymaker 42:973bb6036f81 67 /** Implementing GM
AhmedPlaymaker 42:973bb6036f81 68 *
AhmedPlaymaker 42:973bb6036f81 69 * This function just decides what has to selected in the next iteration.
AhmedPlaymaker 42:973bb6036f81 70 */
AhmedPlaymaker 42:973bb6036f81 71 void ImplementGM(Gamepad &pad);
AhmedPlaymaker 42:973bb6036f81 72
AhmedPlaymaker 34:89f53ffc81bb 73 /** Displaying GAME mode Contents
AhmedPlaymaker 34:89f53ffc81bb 74 *
AhmedPlaymaker 34:89f53ffc81bb 75 * This function just displays game_mode contents.
AhmedPlaymaker 34:89f53ffc81bb 76 */
AhmedPlaymaker 42:973bb6036f81 77 void DisplayGMContents(N5110 &lcd);
AhmedPlaymaker 34:89f53ffc81bb 78
AhmedPlaymaker 4:1fe015b66bb8 79 /** The Third Menu Screen
AhmedPlaymaker 4:1fe015b66bb8 80 *
AhmedPlaymaker 4:1fe015b66bb8 81 * This function obtains the user input on the game speed that suits them.
AhmedPlaymaker 4:1fe015b66bb8 82 */
AhmedPlaymaker 33:249cf423fb18 83 void game_speed(N5110 &lcd, Gamepad &pad, SDFileSystem &sd);
AhmedPlaymaker 33:249cf423fb18 84
AhmedPlaymaker 35:ce47cde57bd3 85 /** Implementing GS
AhmedPlaymaker 35:ce47cde57bd3 86 *
AhmedPlaymaker 35:ce47cde57bd3 87 * This function just decides what has to be done next.
AhmedPlaymaker 35:ce47cde57bd3 88 */
AhmedPlaymaker 42:973bb6036f81 89 void ImplementGS(Gamepad &pad);
AhmedPlaymaker 35:ce47cde57bd3 90
AhmedPlaymaker 35:ce47cde57bd3 91 /** Displaying GAME speed Contents
AhmedPlaymaker 35:ce47cde57bd3 92 *
AhmedPlaymaker 35:ce47cde57bd3 93 * This function just displays game_speed contents.
AhmedPlaymaker 35:ce47cde57bd3 94 */
AhmedPlaymaker 42:973bb6036f81 95 void DisplayGSContents(N5110 &lcd);
AhmedPlaymaker 35:ce47cde57bd3 96
AhmedPlaymaker 16:7b474f873683 97
AhmedPlaymaker 16:7b474f873683 98 int fps; // this sends over the game speed
AhmedPlaymaker 30:461231877c89 99 int i;
AhmedPlaymaker 30:461231877c89 100 int lr;
AhmedPlaymaker 38:30e4e6191762 101 int gs;
AhmedPlaymaker 39:210ac915e0a0 102 int g_mode; //this helps to select between joystick and motion control.
AhmedPlaymaker 30:461231877c89 103 int st;
AhmedPlaymaker 30:461231877c89 104 int sc;
AhmedPlaymaker 30:461231877c89 105 float cs;
AhmedPlaymaker 34:89f53ffc81bb 106 int back_pressed; //remembers if back is pressed.
AhmedPlaymaker 33:249cf423fb18 107
AhmedPlaymaker 33:249cf423fb18 108 private:
AhmedPlaymaker 33:249cf423fb18 109 int _level;
AhmedPlaymaker 33:249cf423fb18 110 Stats _stats;
AhmedPlaymaker 3:fbb1fa853f09 111
AhmedPlaymaker 3:fbb1fa853f09 112
AhmedPlaymaker 3:fbb1fa853f09 113
AhmedPlaymaker 3:fbb1fa853f09 114 };
AhmedPlaymaker 3:fbb1fa853f09 115 #endif