Ahmed Adamjee
/
SnakeVSBlock
Snake vs Block Game to be run upon K64F.
MenuClasses/StartScreen/StartScreen.cpp@84:9950d561fdf8, 2019-05-06 (annotated)
- Committer:
- AhmedPlaymaker
- Date:
- Mon May 06 16:15:21 2019 +0000
- Revision:
- 84:9950d561fdf8
- Parent:
- 83:329da564799a
- Child:
- 87:871d9fecb593
Added some more comments to describe what some of my functions and methods do.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AhmedPlaymaker | 3:fbb1fa853f09 | 1 | #include "StartScreen.h" |
AhmedPlaymaker | 3:fbb1fa853f09 | 2 | |
AhmedPlaymaker | 68:b9cfd27987ac | 3 | int titleSprite[48][84] = { |
AhmedPlaymaker | 6:3ffab44ed49c | 4 | {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, |
AhmedPlaymaker | 6:3ffab44ed49c | 5 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 6:3ffab44ed49c | 6 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 6:3ffab44ed49c | 7 | {1,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0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,1,0,1,1,0,0,0,1,1,0,1,1,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,0,1,1,0,0,1,1,0,1,1,0,1,1,0,0,1,0,1,1,0,0,1,0,0,0,1}, |
AhmedPlaymaker | 68:b9cfd27987ac | 49 | {1,0,0,1,1,1,0,0,0,1,1,0,0,0,1,0,1,1,0,0,0,1,1,0,1,1,0,0,1,1,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,1,1,1,1,0,1,1,1,0,0,0,1,1,1,1,0,1,1,0,0,1,1,0,0,1}, |
AhmedPlaymaker | 6:3ffab44ed49c | 50 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 6:3ffab44ed49c | 51 | {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, |
AhmedPlaymaker | 3:fbb1fa853f09 | 52 | |
AhmedPlaymaker | 4:1fe015b66bb8 | 53 | }; |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 54 | |
AhmedPlaymaker | 4:1fe015b66bb8 | 55 | int arrow[7][9] = { |
AhmedPlaymaker | 3:fbb1fa853f09 | 56 | {0,0,0,0,1,0,0,0,0}, |
AhmedPlaymaker | 3:fbb1fa853f09 | 57 | {0,0,0,1,1,0,0,0,0}, |
AhmedPlaymaker | 3:fbb1fa853f09 | 58 | {0,0,1,1,1,0,0,0,0}, |
AhmedPlaymaker | 3:fbb1fa853f09 | 59 | {0,1,1,1,1,1,1,1,1}, |
AhmedPlaymaker | 3:fbb1fa853f09 | 60 | {0,0,1,1,1,0,0,0,0}, |
AhmedPlaymaker | 3:fbb1fa853f09 | 61 | {0,0,0,1,1,0,0,0,0}, |
AhmedPlaymaker | 3:fbb1fa853f09 | 62 | {0,0,0,0,1,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 63 | }; |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 64 | |
AhmedPlaymaker | 56:142e9fdb77a8 | 65 | int motionControl[12][21] = { |
AhmedPlaymaker | 56:142e9fdb77a8 | 66 | {0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0}, |
AhmedPlaymaker | 56:142e9fdb77a8 | 67 | {0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0}, |
AhmedPlaymaker | 56:142e9fdb77a8 | 68 | {0,0,0,0,0,1,0,0,0,1,1,1,0,0,0,1,0,0,0,0,0}, |
AhmedPlaymaker | 56:142e9fdb77a8 | 69 | {0,0,0,0,0,1,0,0,0,1,1,1,0,0,0,1,0,0,0,0,0}, |
AhmedPlaymaker | 56:142e9fdb77a8 | 70 | {0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0}, |
AhmedPlaymaker | 56:142e9fdb77a8 | 71 | {0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0}, |
AhmedPlaymaker | 56:142e9fdb77a8 | 72 | {1,1,1,0,1,0,0,1,1,1,1,1,1,1,0,0,1,0,1,1,1}, |
AhmedPlaymaker | 56:142e9fdb77a8 | 73 | {1,1,0,0,1,0,1,0,0,0,0,0,0,0,1,0,1,0,0,1,1}, |
AhmedPlaymaker | 56:142e9fdb77a8 | 74 | {1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,0,1}, |
AhmedPlaymaker | 56:142e9fdb77a8 | 75 | {0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0}, |
AhmedPlaymaker | 56:142e9fdb77a8 | 76 | {0,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0,1,0,0,0,0}, |
AhmedPlaymaker | 56:142e9fdb77a8 | 77 | {0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 78 | }; |
AhmedPlaymaker | 56:142e9fdb77a8 | 79 | |
AhmedPlaymaker | 57:845781aea5ec | 80 | int joystick[13][48] = { |
AhmedPlaymaker | 57:845781aea5ec | 81 | {0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0}, |
AhmedPlaymaker | 57:845781aea5ec | 82 | {0,0,0,0,0,1,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,1,1,0,0,0,0,0}, |
AhmedPlaymaker | 57:845781aea5ec | 83 | {0,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,1,1,0,0,0,0}, |
AhmedPlaymaker | 57:845781aea5ec | 84 | {0,0,0,1,1,0,0,0,0,1,0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,0,0,1,0,0,0,0,1,1,0,0,0}, |
AhmedPlaymaker | 57:845781aea5ec | 85 | {0,0,1,1,0,0,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,0,1,1,0,0}, |
AhmedPlaymaker | 57:845781aea5ec | 86 | {0,1,1,0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0,1,0,0,0,0,0,1,1,0}, |
AhmedPlaymaker | 57:845781aea5ec | 87 | {1,1,1,1,1,1,1,0,1,0,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0,1,0,1,1,1,1,1,1,1}, |
AhmedPlaymaker | 57:845781aea5ec | 88 | {0,1,1,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,0,0,1,1,0}, |
AhmedPlaymaker | 57:845781aea5ec | 89 | {0,0,1,1,0,0,0,0,0,1,0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,0,0,1,0,0,0,0,0,1,1,0,0}, |
AhmedPlaymaker | 57:845781aea5ec | 90 | {0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,1,0,0,0}, |
AhmedPlaymaker | 57:845781aea5ec | 91 | {0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,1,0,0,0,0}, |
AhmedPlaymaker | 57:845781aea5ec | 92 | {0,0,0,0,0,1,1,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,1,1,0,0,0,0,0}, |
AhmedPlaymaker | 57:845781aea5ec | 93 | {0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0}, |
AhmedPlaymaker | 56:142e9fdb77a8 | 94 | }; |
AhmedPlaymaker | 56:142e9fdb77a8 | 95 | |
AhmedPlaymaker | 4:1fe015b66bb8 | 96 | int navL[13][8] = { |
AhmedPlaymaker | 4:1fe015b66bb8 | 97 | {0,0,0,0,0,0,1,1}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 98 | {0,0,0,0,0,1,1,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 99 | {0,0,0,0,1,1,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 100 | {0,0,0,1,1,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 101 | {0,0,1,1,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 102 | {0,1,1,0,0,0,0,0}, |
AhmedPlaymaker | 56:142e9fdb77a8 | 103 | {1,1,1,1,1,1,1,1}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 104 | {0,1,1,0,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 105 | {0,0,1,1,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 106 | {0,0,0,1,1,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 107 | {0,0,0,0,1,1,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 108 | {0,0,0,0,0,1,1,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 109 | {0,0,0,0,0,0,1,1}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 110 | }; |
AhmedPlaymaker | 3:fbb1fa853f09 | 111 | |
AhmedPlaymaker | 4:1fe015b66bb8 | 112 | int navR[13][8] = { |
AhmedPlaymaker | 4:1fe015b66bb8 | 113 | {1,1,0,0,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 114 | {0,1,1,0,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 115 | {0,0,1,1,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 116 | {0,0,0,1,1,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 117 | {0,0,0,0,1,1,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 118 | {0,0,0,0,0,1,1,0}, |
AhmedPlaymaker | 56:142e9fdb77a8 | 119 | {1,1,1,1,1,1,1,1}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 120 | {0,0,0,0,0,1,1,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 121 | {0,0,0,0,1,1,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 122 | {0,0,0,1,1,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 123 | {0,0,1,1,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 124 | {0,1,1,0,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 125 | {1,1,0,0,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 126 | }; |
AhmedPlaymaker | 16:7b474f873683 | 127 | |
AhmedPlaymaker | 3:fbb1fa853f09 | 128 | StartScreen::StartScreen() |
AhmedPlaymaker | 3:fbb1fa853f09 | 129 | { |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 130 | |
AhmedPlaymaker | 3:fbb1fa853f09 | 131 | } |
AhmedPlaymaker | 3:fbb1fa853f09 | 132 | |
AhmedPlaymaker | 3:fbb1fa853f09 | 133 | StartScreen::~StartScreen() |
AhmedPlaymaker | 3:fbb1fa853f09 | 134 | { |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 135 | |
AhmedPlaymaker | 3:fbb1fa853f09 | 136 | } |
AhmedPlaymaker | 3:fbb1fa853f09 | 137 | |
AhmedPlaymaker | 83:329da564799a | 138 | void StartScreen::init(N5110 *lcd, Gamepad *pad) |
AhmedPlaymaker | 30:461231877c89 | 139 | { |
AhmedPlaymaker | 83:329da564799a | 140 | _lcd = lcd; |
AhmedPlaymaker | 83:329da564799a | 141 | _pad = pad; |
AhmedPlaymaker | 84:9950d561fdf8 | 142 | StartScreen::object_initialisations(); |
AhmedPlaymaker | 63:205f0ca48473 | 143 | fps = 15; //sets the default frames per second to a certain value. |
AhmedPlaymaker | 67:39b9ba6019b0 | 144 | menu_index = 16; //main menu selection arrow position |
AhmedPlaymaker | 56:142e9fdb77a8 | 145 | g_mode = 1; //game mode selection (joystick/motion control). |
AhmedPlaymaker | 67:39b9ba6019b0 | 146 | speed_index = 2; //game speed page selection index. |
AhmedPlaymaker | 65:2872ca289b49 | 147 | showCredits = 1; //this helps in wether ot not to show credits to the user. |
AhmedPlaymaker | 65:2872ca289b49 | 148 | controlSensitivity = 5; //sensitivity of control speed of menu options. |
AhmedPlaymaker | 30:461231877c89 | 149 | } |
AhmedPlaymaker | 3:fbb1fa853f09 | 150 | |
AhmedPlaymaker | 84:9950d561fdf8 | 151 | |
AhmedPlaymaker | 84:9950d561fdf8 | 152 | void StartScreen::object_initialisations() |
AhmedPlaymaker | 84:9950d561fdf8 | 153 | { |
AhmedPlaymaker | 84:9950d561fdf8 | 154 | _stats.init(_lcd, _pad); //Stats object initialisation. |
AhmedPlaymaker | 84:9950d561fdf8 | 155 | _settings.init(_lcd, _pad); //Settings object initialisation. |
AhmedPlaymaker | 84:9950d561fdf8 | 156 | _tutorial.init(_lcd, _pad); //Tutorial object initialisation. |
AhmedPlaymaker | 84:9950d561fdf8 | 157 | } |
AhmedPlaymaker | 84:9950d561fdf8 | 158 | |
AhmedPlaymaker | 84:9950d561fdf8 | 159 | |
AhmedPlaymaker | 83:329da564799a | 160 | void StartScreen::titleScreen() |
AhmedPlaymaker | 3:fbb1fa853f09 | 161 | { |
AhmedPlaymaker | 28:d2c621d67e3b | 162 | //this saves the Theme song I want to play at the start. |
AhmedPlaymaker | 26:3495f7b0ede7 | 163 | int song[18] = {441,494,439,372,392,370,330,246,329,331,370,555,555,495,440,392,392,370}; |
AhmedPlaymaker | 83:329da564799a | 164 | _pad->leds_on(); |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 165 | |
AhmedPlaymaker | 28:d2c621d67e3b | 166 | for(int ani = -51; ani <= 0; ani+=3) { |
AhmedPlaymaker | 83:329da564799a | 167 | _lcd->clear(); |
AhmedPlaymaker | 83:329da564799a | 168 | _lcd->drawSprite(0,ani,48,84,(int *)titleSprite); //Function used to draw the sprite |
AhmedPlaymaker | 83:329da564799a | 169 | _lcd->refresh(); |
AhmedPlaymaker | 83:329da564799a | 170 | _pad->tone(song[(ani+48)/3],0.1); |
AhmedPlaymaker | 65:2872ca289b49 | 171 | |
AhmedPlaymaker | 65:2872ca289b49 | 172 | //This Allows us to skip/play the animation before the menu screen |
AhmedPlaymaker | 84:9950d561fdf8 | 173 | if (StartScreen::checkStartorAPressed()) { |
AhmedPlaymaker | 84:9950d561fdf8 | 174 | return; //if StartorA is pressed, the while loop is escaped. |
AhmedPlaymaker | 84:9950d561fdf8 | 175 | } else { |
AhmedPlaymaker | 84:9950d561fdf8 | 176 | wait(0.2); |
AhmedPlaymaker | 59:c65a2e933c47 | 177 | } |
AhmedPlaymaker | 26:3495f7b0ede7 | 178 | } |
AhmedPlaymaker | 84:9950d561fdf8 | 179 | wait(0.3); |
AhmedPlaymaker | 83:329da564799a | 180 | _pad->leds_off(); |
AhmedPlaymaker | 83:329da564799a | 181 | _lcd->clear(); |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 182 | |
AhmedPlaymaker | 83:329da564799a | 183 | StartScreen::instruct(); //after the screen_saver is displayed we need to send in instructions of how to preoceed to menu. |
AhmedPlaymaker | 3:fbb1fa853f09 | 184 | } |
AhmedPlaymaker | 3:fbb1fa853f09 | 185 | |
AhmedPlaymaker | 83:329da564799a | 186 | void StartScreen::instruct() |
AhmedPlaymaker | 3:fbb1fa853f09 | 187 | { |
AhmedPlaymaker | 83:329da564799a | 188 | //_pad->init(); |
AhmedPlaymaker | 65:2872ca289b49 | 189 | wait(1/controlSensitivity); //to avoid race condition of the following while loop being skipped. |
AhmedPlaymaker | 83:329da564799a | 190 | while ((_pad->check_event(Gamepad::START_PRESSED) == false)&&(_pad->check_event(Gamepad::A_PRESSED) == false)&&(_startPressed == false)) { |
AhmedPlaymaker | 67:39b9ba6019b0 | 191 | //Start_Pressed is 1 if start is already pressed during animation in titleScreen(); |
AhmedPlaymaker | 83:329da564799a | 192 | _lcd->printString("Please Press",5,1); //Function used to promt the user to start. |
AhmedPlaymaker | 83:329da564799a | 193 | _lcd->printString("Start",25,3); |
AhmedPlaymaker | 83:329da564799a | 194 | _lcd->printString("to Begin",15,5); |
AhmedPlaymaker | 83:329da564799a | 195 | _lcd->refresh(); |
AhmedPlaymaker | 83:329da564799a | 196 | _pad->leds_on(); |
AhmedPlaymaker | 3:fbb1fa853f09 | 197 | wait(0.1); |
AhmedPlaymaker | 83:329da564799a | 198 | _pad->leds_off(); |
AhmedPlaymaker | 3:fbb1fa853f09 | 199 | wait(0.1); |
AhmedPlaymaker | 3:fbb1fa853f09 | 200 | } |
AhmedPlaymaker | 84:9950d561fdf8 | 201 | if (_startPressed == false) {//dont wait anymore if start is pressed. (this is to allow for quick skip towards menu) |
AhmedPlaymaker | 84:9950d561fdf8 | 202 | _pad->tone(1000.0,0.1); |
AhmedPlaymaker | 84:9950d561fdf8 | 203 | } |
AhmedPlaymaker | 83:329da564799a | 204 | _lcd->clear(); |
AhmedPlaymaker | 83:329da564799a | 205 | _pad->leds_off(); |
AhmedPlaymaker | 3:fbb1fa853f09 | 206 | } |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 207 | |
AhmedPlaymaker | 83:329da564799a | 208 | void StartScreen::credits() |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 209 | { |
AhmedPlaymaker | 83:329da564799a | 210 | _lcd->clear(); |
AhmedPlaymaker | 65:2872ca289b49 | 211 | if(showCredits) { |
AhmedPlaymaker | 83:329da564799a | 212 | _lcd->printString("Created BY",8,1); |
AhmedPlaymaker | 83:329da564799a | 213 | _lcd->printString("Ahmed",24,3); |
AhmedPlaymaker | 83:329da564799a | 214 | _lcd->printString("Adamjee",20,4); |
AhmedPlaymaker | 83:329da564799a | 215 | _lcd->printString("201161436",15,5); |
AhmedPlaymaker | 83:329da564799a | 216 | _lcd->refresh(); |
AhmedPlaymaker | 5:e4df87957a5b | 217 | wait(2); |
AhmedPlaymaker | 5:e4df87957a5b | 218 | } |
AhmedPlaymaker | 83:329da564799a | 219 | _lcd->clear(); |
AhmedPlaymaker | 3:fbb1fa853f09 | 220 | } |
AhmedPlaymaker | 3:fbb1fa853f09 | 221 | |
AhmedPlaymaker | 63:205f0ca48473 | 222 | void StartScreen::read_stats(SDFileSystem &sd) //to read the data from the SD card at the start of the game to be able to display before starting game. |
AhmedPlaymaker | 49:441c32f6603e | 223 | { |
AhmedPlaymaker | 49:441c32f6603e | 224 | _stats.read(sd); |
AhmedPlaymaker | 49:441c32f6603e | 225 | } |
AhmedPlaymaker | 49:441c32f6603e | 226 | |
AhmedPlaymaker | 83:329da564799a | 227 | bool StartScreen::checkBackPressed() |
AhmedPlaymaker | 66:e47333ffc6ca | 228 | { |
AhmedPlaymaker | 66:e47333ffc6ca | 229 | //This is a very important process, this helps the code to not get stuck in menu loop but also allow to toggle between diffrent menu screens. |
AhmedPlaymaker | 83:329da564799a | 230 | if (_pad->check_event(Gamepad::BACK_PRESSED) == true) { |
AhmedPlaymaker | 83:329da564799a | 231 | _pad->tone(1000.0,0.1); |
AhmedPlaymaker | 66:e47333ffc6ca | 232 | _backPressed = true; |
AhmedPlaymaker | 66:e47333ffc6ca | 233 | } else { |
AhmedPlaymaker | 66:e47333ffc6ca | 234 | _backPressed = false; |
AhmedPlaymaker | 66:e47333ffc6ca | 235 | } |
AhmedPlaymaker | 80:51ca38c5dcdf | 236 | return _backPressed; //returns true if back is pressed, returns false otherwise. |
AhmedPlaymaker | 66:e47333ffc6ca | 237 | } |
AhmedPlaymaker | 66:e47333ffc6ca | 238 | |
AhmedPlaymaker | 84:9950d561fdf8 | 239 | |
AhmedPlaymaker | 84:9950d561fdf8 | 240 | bool StartScreen::checkStartorAPressed() |
AhmedPlaymaker | 84:9950d561fdf8 | 241 | { |
AhmedPlaymaker | 84:9950d561fdf8 | 242 | //This Allows us to skip/play the animation before the menu screen |
AhmedPlaymaker | 84:9950d561fdf8 | 243 | if((_pad->check_event(Gamepad::START_PRESSED) == true)||(_pad->check_event(Gamepad::A_PRESSED) == true)) { //to allow the gamer to skip the long starting animation if they are not a fan. |
AhmedPlaymaker | 84:9950d561fdf8 | 244 | _pad->tone(1000.0,0.1); |
AhmedPlaymaker | 84:9950d561fdf8 | 245 | _startPressed = true; |
AhmedPlaymaker | 84:9950d561fdf8 | 246 | } else { |
AhmedPlaymaker | 84:9950d561fdf8 | 247 | _startPressed = false; |
AhmedPlaymaker | 84:9950d561fdf8 | 248 | } |
AhmedPlaymaker | 84:9950d561fdf8 | 249 | return _startPressed; //returns true if start/A is pressed, returns false otherwise. |
AhmedPlaymaker | 84:9950d561fdf8 | 250 | } |
AhmedPlaymaker | 84:9950d561fdf8 | 251 | |
AhmedPlaymaker | 83:329da564799a | 252 | void StartScreen::menu() |
AhmedPlaymaker | 3:fbb1fa853f09 | 253 | { |
AhmedPlaymaker | 83:329da564799a | 254 | _lcd->clear(); |
AhmedPlaymaker | 52:c2faa96cf293 | 255 | //StartScreen::init(); |
AhmedPlaymaker | 83:329da564799a | 256 | //_pad->init(); |
AhmedPlaymaker | 83:329da564799a | 257 | while ((_pad->check_event(Gamepad::A_PRESSED) == false)&&(_pad->check_event(Gamepad::START_PRESSED) == false)) { |
AhmedPlaymaker | 76:7fa91122907f | 258 | //This menu loop won't be skipped unless the player decides to press START/A. |
AhmedPlaymaker | 83:329da564799a | 259 | _lcd->clear(); |
AhmedPlaymaker | 83:329da564799a | 260 | StartScreen::mainMenu(); |
AhmedPlaymaker | 83:329da564799a | 261 | _lcd->refresh(); |
AhmedPlaymaker | 84:9950d561fdf8 | 262 | |
AhmedPlaymaker | 3:fbb1fa853f09 | 263 | } |
AhmedPlaymaker | 83:329da564799a | 264 | _pad->tone(1000.0,0.1); |
AhmedPlaymaker | 83:329da564799a | 265 | StartScreen::nextMenu(); //after all main menu operations have been completed, this function allows us to get to the next menu. |
AhmedPlaymaker | 34:89f53ffc81bb | 266 | } |
AhmedPlaymaker | 34:89f53ffc81bb | 267 | |
AhmedPlaymaker | 83:329da564799a | 268 | void StartScreen::mainMenu() //Displays the main menu contents, and then allows the user to select the next menu using the selection arrow. |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 269 | { |
AhmedPlaymaker | 83:329da564799a | 270 | StartScreen::drawSelectionArrow(); //draws arrow to select menu option. |
AhmedPlaymaker | 67:39b9ba6019b0 | 271 | |
AhmedPlaymaker | 83:329da564799a | 272 | _lcd->printString("Snake vs Block",0,0); |
AhmedPlaymaker | 83:329da564799a | 273 | _lcd->printString("Play",0,2); |
AhmedPlaymaker | 83:329da564799a | 274 | _lcd->printString("Settings",0,3); |
AhmedPlaymaker | 83:329da564799a | 275 | _lcd->printString("Stats",0,4); |
AhmedPlaymaker | 83:329da564799a | 276 | _lcd->printString("Tutorial",0,5); |
AhmedPlaymaker | 34:89f53ffc81bb | 277 | } |
AhmedPlaymaker | 34:89f53ffc81bb | 278 | |
AhmedPlaymaker | 83:329da564799a | 279 | void StartScreen::drawSelectionArrow() |
AhmedPlaymaker | 67:39b9ba6019b0 | 280 | { |
AhmedPlaymaker | 76:7fa91122907f | 281 | wait(1/controlSensitivity); |
AhmedPlaymaker | 83:329da564799a | 282 | Direction d = _pad->get_direction(); |
AhmedPlaymaker | 83:329da564799a | 283 | if(((d==N)||(_pad->check_event(Gamepad::L_PRESSED) == true))&&(menu_index>16)) { |
AhmedPlaymaker | 83:329da564799a | 284 | menu_index=menu_index-8; // menu_index is the position of the selection arrow in menu and also the index of the case structure to select the next menu in StartScreen::NextMenu(). |
AhmedPlaymaker | 67:39b9ba6019b0 | 285 | } |
AhmedPlaymaker | 83:329da564799a | 286 | if(((d==S)||(_pad->check_event(Gamepad::R_PRESSED) == true))&&(menu_index<40)) { |
AhmedPlaymaker | 83:329da564799a | 287 | menu_index=menu_index+8; // menu_index is the position of the selection arrow in menu and also the index of the case structure to select the next menu in StartScreen::NextMenu(). |
AhmedPlaymaker | 67:39b9ba6019b0 | 288 | } |
AhmedPlaymaker | 83:329da564799a | 289 | _lcd->drawSprite(60,menu_index,7,9,(int *)arrow); // menu_index is the postion of where the arrow will be drawn and is determined by the above if command using joystick. |
AhmedPlaymaker | 67:39b9ba6019b0 | 290 | } |
AhmedPlaymaker | 67:39b9ba6019b0 | 291 | |
AhmedPlaymaker | 76:7fa91122907f | 292 | //////////////////////////////DECIDES THE NEXT MENU PAGE////////////////////////////// |
AhmedPlaymaker | 76:7fa91122907f | 293 | |
AhmedPlaymaker | 83:329da564799a | 294 | void StartScreen::nextMenu() |
AhmedPlaymaker | 55:df0825049171 | 295 | { |
AhmedPlaymaker | 67:39b9ba6019b0 | 296 | switch (menu_index) { //this menu_index saves the value from the coordinates of arrow in main menu, and allows us to select the next menu accordingly. |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 297 | case 16: |
AhmedPlaymaker | 83:329da564799a | 298 | game_mode(); //calls game mode after play has been pressed. |
AhmedPlaymaker | 83:329da564799a | 299 | game_speed(); //calls game speed after the game mode has been selected. |
AhmedPlaymaker | 67:39b9ba6019b0 | 300 | return; //This forces us out of the menu class and back into int main(). |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 301 | case 24: |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 302 | float *cs_sc; |
AhmedPlaymaker | 83:329da564799a | 303 | cs_sc = _settings.Implement(controlSensitivity); |
AhmedPlaymaker | 65:2872ca289b49 | 304 | controlSensitivity = cs_sc[0]; //saves the number in controlSensitivity which controls the control speed of the menu oftions (basically the wait time of between reading joystick input). |
AhmedPlaymaker | 67:39b9ba6019b0 | 305 | showCredits = cs_sc[1]; //saves the logic in showCredits which decides weather or not to show credits when game starts. |
AhmedPlaymaker | 83:329da564799a | 306 | menu(); //to return to main_menu if back is pressed |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 307 | break; |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 308 | case 32: |
AhmedPlaymaker | 83:329da564799a | 309 | _stats.StatsDisplay(); |
AhmedPlaymaker | 83:329da564799a | 310 | menu(); //to return to main_menu if back is pressed |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 311 | break; |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 312 | case 40: |
AhmedPlaymaker | 83:329da564799a | 313 | _tutorial.Implement(); |
AhmedPlaymaker | 83:329da564799a | 314 | menu(); //to return to main_menu if back is pressed |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 315 | break; |
AhmedPlaymaker | 56:142e9fdb77a8 | 316 | } |
AhmedPlaymaker | 3:fbb1fa853f09 | 317 | } |
AhmedPlaymaker | 30:461231877c89 | 318 | |
AhmedPlaymaker | 76:7fa91122907f | 319 | |
AhmedPlaymaker | 76:7fa91122907f | 320 | //////////////////////////////GAME MODE SELECTION////////////////////////////// |
AhmedPlaymaker | 76:7fa91122907f | 321 | |
AhmedPlaymaker | 83:329da564799a | 322 | void StartScreen::game_mode() |
AhmedPlaymaker | 4:1fe015b66bb8 | 323 | { |
AhmedPlaymaker | 83:329da564799a | 324 | _lcd->clear(); |
AhmedPlaymaker | 83:329da564799a | 325 | //_pad->init(); |
AhmedPlaymaker | 83:329da564799a | 326 | while ((_pad->check_event(Gamepad::A_PRESSED) == false)&&(_pad->check_event(Gamepad::START_PRESSED) == false)) { //Change this to if button pressed. |
AhmedPlaymaker | 76:7fa91122907f | 327 | |
AhmedPlaymaker | 83:329da564799a | 328 | _lcd->clear(); |
AhmedPlaymaker | 83:329da564799a | 329 | StartScreen::selectMode(); //displays to the user what are the mode options |
AhmedPlaymaker | 83:329da564799a | 330 | _lcd->refresh(); |
AhmedPlaymaker | 64:540aa1602372 | 331 | |
AhmedPlaymaker | 83:329da564799a | 332 | if (StartScreen::checkBackPressed()) { |
AhmedPlaymaker | 67:39b9ba6019b0 | 333 | break; //if back is pressed, the while loop is escaped. |
AhmedPlaymaker | 67:39b9ba6019b0 | 334 | } |
AhmedPlaymaker | 66:e47333ffc6ca | 335 | |
AhmedPlaymaker | 34:89f53ffc81bb | 336 | } |
AhmedPlaymaker | 83:329da564799a | 337 | _pad->tone(1000.0,0.1); |
AhmedPlaymaker | 76:7fa91122907f | 338 | |
AhmedPlaymaker | 66:e47333ffc6ca | 339 | if(_backPressed) { //if back was pressed in the while loop, the previous menu is called. |
AhmedPlaymaker | 83:329da564799a | 340 | StartScreen::menu(); |
AhmedPlaymaker | 34:89f53ffc81bb | 341 | } |
AhmedPlaymaker | 34:89f53ffc81bb | 342 | } |
AhmedPlaymaker | 34:89f53ffc81bb | 343 | |
AhmedPlaymaker | 83:329da564799a | 344 | void StartScreen::selectMode() |
AhmedPlaymaker | 42:973bb6036f81 | 345 | { |
AhmedPlaymaker | 83:329da564799a | 346 | StartScreen::scrollModeSelection(); //the mode is selected by moving joystick in this function. |
AhmedPlaymaker | 56:142e9fdb77a8 | 347 | switch (g_mode) { |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 348 | case 1: |
AhmedPlaymaker | 83:329da564799a | 349 | _lcd->printString("Joystick",18,1); |
AhmedPlaymaker | 83:329da564799a | 350 | _lcd->drawSprite(17,22,13,48,(int *)joystick); //Function used to draw the sprite. |
AhmedPlaymaker | 83:329da564799a | 351 | _lcd->refresh(); |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 352 | break; |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 353 | case 2: |
AhmedPlaymaker | 83:329da564799a | 354 | _lcd->drawSprite(10,22,13,8,(int *)navL); //Function used to draw the sprite. |
AhmedPlaymaker | 83:329da564799a | 355 | _lcd->drawSprite(65,22,13,8,(int *)navR); //Function used to draw the sprite. |
AhmedPlaymaker | 83:329da564799a | 356 | _lcd->printString("Motion Control",1,1); |
AhmedPlaymaker | 83:329da564799a | 357 | _lcd->drawSprite(32,22,12,21,(int *)motionControl); //Function used to draw the sprite. |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 358 | break; |
AhmedPlaymaker | 34:89f53ffc81bb | 359 | } |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 360 | |
AhmedPlaymaker | 4:1fe015b66bb8 | 361 | } |
AhmedPlaymaker | 34:89f53ffc81bb | 362 | |
AhmedPlaymaker | 83:329da564799a | 363 | void StartScreen::scrollModeSelection() |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 364 | { |
AhmedPlaymaker | 83:329da564799a | 365 | Direction d = _pad->get_direction(); |
AhmedPlaymaker | 76:7fa91122907f | 366 | wait(1/controlSensitivity);//to make the joystick selection's speed inversely proportional to controlSensitivity. |
AhmedPlaymaker | 83:329da564799a | 367 | if(((d==E)||(d==W)||(_pad->check_event(Gamepad::R_PRESSED) == true)||(_pad->check_event(Gamepad::L_PRESSED) == true))&&(g_mode==1)) { |
AhmedPlaymaker | 56:142e9fdb77a8 | 368 | g_mode=2; |
AhmedPlaymaker | 56:142e9fdb77a8 | 369 | } |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 370 | |
AhmedPlaymaker | 83:329da564799a | 371 | else if(((d==E)||(d==W)||(_pad->check_event(Gamepad::R_PRESSED) == true)||(_pad->check_event(Gamepad::L_PRESSED) == true))&&(g_mode==2)) { |
AhmedPlaymaker | 56:142e9fdb77a8 | 372 | g_mode=1; |
AhmedPlaymaker | 56:142e9fdb77a8 | 373 | } |
AhmedPlaymaker | 56:142e9fdb77a8 | 374 | } |
AhmedPlaymaker | 56:142e9fdb77a8 | 375 | |
AhmedPlaymaker | 76:7fa91122907f | 376 | //////////////////////////////INSTRUCTIONS FOR MOTION CONTROL////////////////////////////// |
AhmedPlaymaker | 76:7fa91122907f | 377 | |
AhmedPlaymaker | 83:329da564799a | 378 | void StartScreen::motionControlInstructions() |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 379 | { |
AhmedPlaymaker | 83:329da564799a | 380 | _lcd->clear(); |
AhmedPlaymaker | 83:329da564799a | 381 | _lcd->printString("While playing the",5,0); //Function used to promt the user to start. |
AhmedPlaymaker | 83:329da564799a | 382 | _lcd->printString("game, press",9,1); |
AhmedPlaymaker | 83:329da564799a | 383 | _lcd->printString("A to centre",8,2); |
AhmedPlaymaker | 83:329da564799a | 384 | _lcd->printString("the snake at",9,3); |
AhmedPlaymaker | 83:329da564799a | 385 | _lcd->printString("prefered angle",0,4); |
AhmedPlaymaker | 83:329da564799a | 386 | _lcd->refresh(); |
AhmedPlaymaker | 58:affb42c56cf8 | 387 | wait(2); |
AhmedPlaymaker | 58:affb42c56cf8 | 388 | } |
AhmedPlaymaker | 58:affb42c56cf8 | 389 | |
AhmedPlaymaker | 76:7fa91122907f | 390 | |
AhmedPlaymaker | 76:7fa91122907f | 391 | //////////////////////////////GAME SPEED SELECTION////////////////////////////// |
AhmedPlaymaker | 76:7fa91122907f | 392 | |
AhmedPlaymaker | 83:329da564799a | 393 | void StartScreen::game_speed() |
AhmedPlaymaker | 4:1fe015b66bb8 | 394 | { |
AhmedPlaymaker | 83:329da564799a | 395 | _lcd->clear(); |
AhmedPlaymaker | 83:329da564799a | 396 | //_pad->init(); |
AhmedPlaymaker | 83:329da564799a | 397 | while ((_pad->check_event(Gamepad::A_PRESSED) == false)&&(_pad->check_event(Gamepad::START_PRESSED) == false)) { //Change this to if button pressed. |
AhmedPlaymaker | 76:7fa91122907f | 398 | |
AhmedPlaymaker | 83:329da564799a | 399 | _lcd->clear(); |
AhmedPlaymaker | 83:329da564799a | 400 | StartScreen::selectSpeed(); //this displays all the speed options and saves the data obtained (fps) for use in main(). |
AhmedPlaymaker | 83:329da564799a | 401 | _lcd->refresh(); |
AhmedPlaymaker | 67:39b9ba6019b0 | 402 | |
AhmedPlaymaker | 83:329da564799a | 403 | if (StartScreen::checkBackPressed()) { |
AhmedPlaymaker | 67:39b9ba6019b0 | 404 | break; //if back is pressed, the while loop is escaped. |
AhmedPlaymaker | 67:39b9ba6019b0 | 405 | } |
AhmedPlaymaker | 35:ce47cde57bd3 | 406 | } |
AhmedPlaymaker | 83:329da564799a | 407 | _pad->tone(1000.0,0.1); |
AhmedPlaymaker | 64:540aa1602372 | 408 | |
AhmedPlaymaker | 66:e47333ffc6ca | 409 | if(_backPressed) { //if back was pressed in the while loop, the previous menu is called. |
AhmedPlaymaker | 83:329da564799a | 410 | StartScreen::menu(); //To go back to Menu if back is pressed. |
AhmedPlaymaker | 64:540aa1602372 | 411 | } |
AhmedPlaymaker | 64:540aa1602372 | 412 | |
AhmedPlaymaker | 35:ce47cde57bd3 | 413 | } |
AhmedPlaymaker | 35:ce47cde57bd3 | 414 | |
AhmedPlaymaker | 83:329da564799a | 415 | void StartScreen::selectSpeed() //decrease code size. |
AhmedPlaymaker | 76:7fa91122907f | 416 | { |
AhmedPlaymaker | 83:329da564799a | 417 | StartScreen::scrollSpeedSelection(); //this swipes through the speed pages, dependent on the joystick input. |
AhmedPlaymaker | 83:329da564799a | 418 | _lcd->drawSprite(10,22,13,8,(int *)navL); //Function used to draw the sprite. |
AhmedPlaymaker | 83:329da564799a | 419 | _lcd->drawSprite(65,22,13,8,(int *)navR); //Function used to draw the sprite. |
AhmedPlaymaker | 83:329da564799a | 420 | _lcd->printString("Game Speed",10,1); |
AhmedPlaymaker | 76:7fa91122907f | 421 | switch (speed_index) { |
AhmedPlaymaker | 76:7fa91122907f | 422 | case 1: |
AhmedPlaymaker | 83:329da564799a | 423 | _lcd->printString("SNAKE",28,3); |
AhmedPlaymaker | 76:7fa91122907f | 424 | fps = 15; |
AhmedPlaymaker | 76:7fa91122907f | 425 | break; |
AhmedPlaymaker | 76:7fa91122907f | 426 | case 2: |
AhmedPlaymaker | 83:329da564799a | 427 | _lcd->printString("HUMAN",28,3); |
AhmedPlaymaker | 76:7fa91122907f | 428 | fps = 22; |
AhmedPlaymaker | 76:7fa91122907f | 429 | break; |
AhmedPlaymaker | 76:7fa91122907f | 430 | case 3: |
AhmedPlaymaker | 83:329da564799a | 431 | _lcd->printString("HORSE",28,3); |
AhmedPlaymaker | 76:7fa91122907f | 432 | fps = 26; |
AhmedPlaymaker | 76:7fa91122907f | 433 | break; |
AhmedPlaymaker | 76:7fa91122907f | 434 | case 4: |
AhmedPlaymaker | 83:329da564799a | 435 | _lcd->printString("CHEETHA",21,3); |
AhmedPlaymaker | 76:7fa91122907f | 436 | fps = 30; |
AhmedPlaymaker | 76:7fa91122907f | 437 | } |
AhmedPlaymaker | 76:7fa91122907f | 438 | |
AhmedPlaymaker | 76:7fa91122907f | 439 | } |
AhmedPlaymaker | 76:7fa91122907f | 440 | |
AhmedPlaymaker | 83:329da564799a | 441 | void StartScreen::scrollSpeedSelection() |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 442 | { |
AhmedPlaymaker | 83:329da564799a | 443 | Direction d = _pad->get_direction(); |
AhmedPlaymaker | 76:7fa91122907f | 444 | wait(1/controlSensitivity);//to make the joystick selection's speed inversely proportional to controlSensitivity. |
AhmedPlaymaker | 83:329da564799a | 445 | if(((d==E)||(_pad->check_event(Gamepad::R_PRESSED) == true))&&(speed_index==4)) { |
AhmedPlaymaker | 67:39b9ba6019b0 | 446 | speed_index=1; |
AhmedPlaymaker | 83:329da564799a | 447 | } else if(((d==W)||(_pad->check_event(Gamepad::L_PRESSED) == true))&&(speed_index==1)) { |
AhmedPlaymaker | 67:39b9ba6019b0 | 448 | speed_index=4; |
AhmedPlaymaker | 83:329da564799a | 449 | } else if(((d==E)||(_pad->check_event(Gamepad::R_PRESSED) == true))&&(1<=speed_index<=3)) { |
AhmedPlaymaker | 67:39b9ba6019b0 | 450 | speed_index=speed_index+1; |
AhmedPlaymaker | 83:329da564799a | 451 | } else if(((d==W)||(_pad->check_event(Gamepad::L_PRESSED) == true))&&(2<=speed_index<=4)) { |
AhmedPlaymaker | 67:39b9ba6019b0 | 452 | speed_index=speed_index-1; |
AhmedPlaymaker | 35:ce47cde57bd3 | 453 | } |
AhmedPlaymaker | 35:ce47cde57bd3 | 454 | } |