![](/media/cache/profiles/LinkedIn_0NghoZJ.jpeg.50x50_q85.jpg)
Snake vs Block Game to be run upon K64F.
MenuClasses/StartScreen/StartScreen.h@60:d3a9e0e4a0de, 2019-04-29 (annotated)
- Committer:
- AhmedPlaymaker
- Date:
- Mon Apr 29 14:40:42 2019 +0000
- Revision:
- 60:d3a9e0e4a0de
- Parent:
- 59:c65a2e933c47
- Child:
- 65:2872ca289b49
Created Tutorials class and added some sprites in it i will use later to implement
Who changed what in which revision?
User | Revision | Line number | New 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 | 60:d3a9e0e4a0de | 10 | #include "Tutorial.h" |
AhmedPlaymaker | 3:fbb1fa853f09 | 11 | |
AhmedPlaymaker | 3:fbb1fa853f09 | 12 | class StartScreen |
AhmedPlaymaker | 3:fbb1fa853f09 | 13 | { |
AhmedPlaymaker | 3:fbb1fa853f09 | 14 | public: |
AhmedPlaymaker | 3:fbb1fa853f09 | 15 | |
AhmedPlaymaker | 3:fbb1fa853f09 | 16 | StartScreen(); |
AhmedPlaymaker | 30:461231877c89 | 17 | ~StartScreen() |
AhmedPlaymaker | 30:461231877c89 | 18 | ; |
AhmedPlaymaker | 3:fbb1fa853f09 | 19 | |
AhmedPlaymaker | 3:fbb1fa853f09 | 20 | /** Initialise StartScreen |
AhmedPlaymaker | 3:fbb1fa853f09 | 21 | * |
AhmedPlaymaker | 3:fbb1fa853f09 | 22 | * This function initialises the Game Interface and restarts the display. |
AhmedPlaymaker | 3:fbb1fa853f09 | 23 | */ |
AhmedPlaymaker | 33:249cf423fb18 | 24 | void init(); |
AhmedPlaymaker | 3:fbb1fa853f09 | 25 | |
AhmedPlaymaker | 3:fbb1fa853f09 | 26 | /** Draw |
AhmedPlaymaker | 3:fbb1fa853f09 | 27 | * |
AhmedPlaymaker | 3:fbb1fa853f09 | 28 | * This function draws the Sprite onto the screen. |
AhmedPlaymaker | 3:fbb1fa853f09 | 29 | */ |
AhmedPlaymaker | 33:249cf423fb18 | 30 | void screen_saver(N5110 &lcd, Gamepad &pad); |
AhmedPlaymaker | 3:fbb1fa853f09 | 31 | |
AhmedPlaymaker | 3:fbb1fa853f09 | 32 | /** Instruct |
AhmedPlaymaker | 3:fbb1fa853f09 | 33 | * |
AhmedPlaymaker | 3:fbb1fa853f09 | 34 | * This function updates the user about how to progress after the game banner has been displayed.. |
AhmedPlaymaker | 3:fbb1fa853f09 | 35 | */ |
AhmedPlaymaker | 33:249cf423fb18 | 36 | void instruct(N5110 &lcd, Gamepad &pad); |
AhmedPlaymaker | 3:fbb1fa853f09 | 37 | |
AhmedPlaymaker | 3:fbb1fa853f09 | 38 | /** Display userID |
AhmedPlaymaker | 3:fbb1fa853f09 | 39 | * |
AhmedPlaymaker | 3:fbb1fa853f09 | 40 | * This function shows who the author of the game is before showing the menu screen. |
AhmedPlaymaker | 3:fbb1fa853f09 | 41 | */ |
AhmedPlaymaker | 49:441c32f6603e | 42 | void credits(N5110 &lcd); |
AhmedPlaymaker | 49:441c32f6603e | 43 | |
AhmedPlaymaker | 49:441c32f6603e | 44 | /** Read Stats |
AhmedPlaymaker | 49:441c32f6603e | 45 | * |
AhmedPlaymaker | 49:441c32f6603e | 46 | * This function just reads the current top level stored in the sd card and saves it for displaying in the menu. |
AhmedPlaymaker | 49:441c32f6603e | 47 | */ |
AhmedPlaymaker | 49:441c32f6603e | 48 | void read_stats(SDFileSystem &sd); |
AhmedPlaymaker | 3:fbb1fa853f09 | 49 | |
AhmedPlaymaker | 3:fbb1fa853f09 | 50 | /** The First Menu Screen |
AhmedPlaymaker | 3:fbb1fa853f09 | 51 | * |
AhmedPlaymaker | 3:fbb1fa853f09 | 52 | * This function obtains the user input on how they want to progress. |
AhmedPlaymaker | 3:fbb1fa853f09 | 53 | */ |
AhmedPlaymaker | 49:441c32f6603e | 54 | void main_menu(N5110 &lcd, Gamepad &pad); |
AhmedPlaymaker | 30:461231877c89 | 55 | |
AhmedPlaymaker | 30:461231877c89 | 56 | /** Displaying The First Menu Screen |
AhmedPlaymaker | 30:461231877c89 | 57 | * |
AhmedPlaymaker | 30:461231877c89 | 58 | * This function just displays Menu Screen 1 contents. |
AhmedPlaymaker | 30:461231877c89 | 59 | */ |
AhmedPlaymaker | 56:142e9fdb77a8 | 60 | void ImplementMenu(N5110 &lcd, Gamepad &pad); |
AhmedPlaymaker | 34:89f53ffc81bb | 61 | |
AhmedPlaymaker | 34:89f53ffc81bb | 62 | /** Implementing The First Menu Screen |
AhmedPlaymaker | 34:89f53ffc81bb | 63 | * |
AhmedPlaymaker | 34:89f53ffc81bb | 64 | * This function just implements the things decided in main menu. |
AhmedPlaymaker | 34:89f53ffc81bb | 65 | */ |
AhmedPlaymaker | 56:142e9fdb77a8 | 66 | void NextMenu(N5110 &lcd, Gamepad &pad); |
AhmedPlaymaker | 33:249cf423fb18 | 67 | |
AhmedPlaymaker | 4:1fe015b66bb8 | 68 | /** The Second Menu Screen |
AhmedPlaymaker | 4:1fe015b66bb8 | 69 | * |
AhmedPlaymaker | 4:1fe015b66bb8 | 70 | * This function obtains the user input on the game type they would like to play. |
AhmedPlaymaker | 4:1fe015b66bb8 | 71 | */ |
AhmedPlaymaker | 49:441c32f6603e | 72 | void game_mode(N5110 &lcd, Gamepad &pad); |
AhmedPlaymaker | 4:1fe015b66bb8 | 73 | |
AhmedPlaymaker | 56:142e9fdb77a8 | 74 | /** Displaying Mode Options |
AhmedPlaymaker | 42:973bb6036f81 | 75 | * |
AhmedPlaymaker | 56:142e9fdb77a8 | 76 | * This function displays game_mode contents. |
AhmedPlaymaker | 42:973bb6036f81 | 77 | */ |
AhmedPlaymaker | 56:142e9fdb77a8 | 78 | void ModeOptions(N5110 &lcd); |
AhmedPlaymaker | 42:973bb6036f81 | 79 | |
AhmedPlaymaker | 56:142e9fdb77a8 | 80 | /** Selecting the game mode |
AhmedPlaymaker | 34:89f53ffc81bb | 81 | * |
AhmedPlaymaker | 56:142e9fdb77a8 | 82 | * value of g_mode is changed in this function that allows the choise beteen joystick/motion control.. |
AhmedPlaymaker | 34:89f53ffc81bb | 83 | */ |
AhmedPlaymaker | 56:142e9fdb77a8 | 84 | void SelectMode(Gamepad &pad); |
AhmedPlaymaker | 34:89f53ffc81bb | 85 | |
AhmedPlaymaker | 58:affb42c56cf8 | 86 | /** Motion Control Instructions |
AhmedPlaymaker | 58:affb42c56cf8 | 87 | * |
AhmedPlaymaker | 58:affb42c56cf8 | 88 | * This promts the user to press A to centre position their angle if Motion Control is selected.. |
AhmedPlaymaker | 58:affb42c56cf8 | 89 | */ |
AhmedPlaymaker | 58:affb42c56cf8 | 90 | void motionControlInstructions(N5110 &lcd); |
AhmedPlaymaker | 58:affb42c56cf8 | 91 | |
AhmedPlaymaker | 4:1fe015b66bb8 | 92 | /** The Third Menu Screen |
AhmedPlaymaker | 4:1fe015b66bb8 | 93 | * |
AhmedPlaymaker | 4:1fe015b66bb8 | 94 | * This function obtains the user input on the game speed that suits them. |
AhmedPlaymaker | 4:1fe015b66bb8 | 95 | */ |
AhmedPlaymaker | 49:441c32f6603e | 96 | void game_speed(N5110 &lcd, Gamepad &pad); |
AhmedPlaymaker | 33:249cf423fb18 | 97 | |
AhmedPlaymaker | 35:ce47cde57bd3 | 98 | /** Implementing GS |
AhmedPlaymaker | 35:ce47cde57bd3 | 99 | * |
AhmedPlaymaker | 35:ce47cde57bd3 | 100 | * This function just decides what has to be done next. |
AhmedPlaymaker | 35:ce47cde57bd3 | 101 | */ |
AhmedPlaymaker | 58:affb42c56cf8 | 102 | void selectSpeedPage(Gamepad &pad); |
AhmedPlaymaker | 35:ce47cde57bd3 | 103 | |
AhmedPlaymaker | 35:ce47cde57bd3 | 104 | /** Displaying GAME speed Contents |
AhmedPlaymaker | 35:ce47cde57bd3 | 105 | * |
AhmedPlaymaker | 35:ce47cde57bd3 | 106 | * This function just displays game_speed contents. |
AhmedPlaymaker | 35:ce47cde57bd3 | 107 | */ |
AhmedPlaymaker | 58:affb42c56cf8 | 108 | void showSpeedOptions(N5110 &lcd); |
AhmedPlaymaker | 35:ce47cde57bd3 | 109 | |
AhmedPlaymaker | 16:7b474f873683 | 110 | |
AhmedPlaymaker | 16:7b474f873683 | 111 | int fps; // this sends over the game speed |
AhmedPlaymaker | 30:461231877c89 | 112 | int i; |
AhmedPlaymaker | 38:30e4e6191762 | 113 | int gs; |
AhmedPlaymaker | 39:210ac915e0a0 | 114 | int g_mode; //this helps to select between joystick and motion control. |
AhmedPlaymaker | 30:461231877c89 | 115 | int st; |
AhmedPlaymaker | 30:461231877c89 | 116 | int sc; |
AhmedPlaymaker | 30:461231877c89 | 117 | float cs; |
AhmedPlaymaker | 34:89f53ffc81bb | 118 | int back_pressed; //remembers if back is pressed. |
AhmedPlaymaker | 59:c65a2e933c47 | 119 | int Start_Pressed; //remembers if start is pressed. |
AhmedPlaymaker | 33:249cf423fb18 | 120 | |
AhmedPlaymaker | 33:249cf423fb18 | 121 | private: |
AhmedPlaymaker | 33:249cf423fb18 | 122 | int _level; |
AhmedPlaymaker | 33:249cf423fb18 | 123 | Stats _stats; |
AhmedPlaymaker | 60:d3a9e0e4a0de | 124 | Settings _settings; |
AhmedPlaymaker | 60:d3a9e0e4a0de | 125 | Tutorial _tutorial; |
AhmedPlaymaker | 3:fbb1fa853f09 | 126 | |
AhmedPlaymaker | 3:fbb1fa853f09 | 127 | |
AhmedPlaymaker | 3:fbb1fa853f09 | 128 | |
AhmedPlaymaker | 3:fbb1fa853f09 | 129 | }; |
AhmedPlaymaker | 3:fbb1fa853f09 | 130 | #endif |