Ahmed Adamjee
/
SnakeVSBlock
Snake vs Block Game to be run upon K64F.
MenuClasses/StartScreen/StartScreen.cpp@80:51ca38c5dcdf, 2019-05-06 (annotated)
- Committer:
- AhmedPlaymaker
- Date:
- Mon May 06 08:00:56 2019 +0000
- Revision:
- 80:51ca38c5dcdf
- Parent:
- 76:7fa91122907f
- Child:
- 83:329da564799a
Implemented back functionality in tutorials.
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,0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,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 | 30:461231877c89 | 138 | void StartScreen::init() |
AhmedPlaymaker | 30:461231877c89 | 139 | { |
AhmedPlaymaker | 63:205f0ca48473 | 140 | fps = 15; //sets the default frames per second to a certain value. |
AhmedPlaymaker | 67:39b9ba6019b0 | 141 | menu_index = 16; //main menu selection arrow position |
AhmedPlaymaker | 56:142e9fdb77a8 | 142 | g_mode = 1; //game mode selection (joystick/motion control). |
AhmedPlaymaker | 67:39b9ba6019b0 | 143 | speed_index = 2; //game speed page selection index. |
AhmedPlaymaker | 65:2872ca289b49 | 144 | showCredits = 1; //this helps in wether ot not to show credits to the user. |
AhmedPlaymaker | 65:2872ca289b49 | 145 | controlSensitivity = 5; //sensitivity of control speed of menu options. |
AhmedPlaymaker | 30:461231877c89 | 146 | } |
AhmedPlaymaker | 3:fbb1fa853f09 | 147 | |
AhmedPlaymaker | 66:e47333ffc6ca | 148 | void StartScreen::titleScreen(N5110 &lcd, Gamepad &pad) |
AhmedPlaymaker | 3:fbb1fa853f09 | 149 | { |
AhmedPlaymaker | 28:d2c621d67e3b | 150 | //this saves the Theme song I want to play at the start. |
AhmedPlaymaker | 26:3495f7b0ede7 | 151 | int song[18] = {441,494,439,372,392,370,330,246,329,331,370,555,555,495,440,392,392,370}; |
AhmedPlaymaker | 6:3ffab44ed49c | 152 | pad.leds_on(); |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 153 | |
AhmedPlaymaker | 28:d2c621d67e3b | 154 | for(int ani = -51; ani <= 0; ani+=3) { |
AhmedPlaymaker | 26:3495f7b0ede7 | 155 | lcd.clear(); |
AhmedPlaymaker | 68:b9cfd27987ac | 156 | lcd.drawSprite(0,ani,48,84,(int *)titleSprite); //Function used to draw the sprite |
AhmedPlaymaker | 26:3495f7b0ede7 | 157 | lcd.refresh(); |
AhmedPlaymaker | 26:3495f7b0ede7 | 158 | pad.tone(song[(ani+48)/3],0.1); |
AhmedPlaymaker | 65:2872ca289b49 | 159 | |
AhmedPlaymaker | 65:2872ca289b49 | 160 | //This Allows us to skip/play the animation before the menu screen |
AhmedPlaymaker | 66:e47333ffc6ca | 161 | _startPressed = false; //by default, animmation is not skipped, as StartScreen::instruct(lcd,pad) requires Start_Pressed to be 0 to be displayed |
AhmedPlaymaker | 59:c65a2e933c47 | 162 | 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 | 66:e47333ffc6ca | 163 | _startPressed = true; |
AhmedPlaymaker | 59:c65a2e933c47 | 164 | break; |
AhmedPlaymaker | 59:c65a2e933c47 | 165 | } |
AhmedPlaymaker | 26:3495f7b0ede7 | 166 | wait(0.2); |
AhmedPlaymaker | 26:3495f7b0ede7 | 167 | } |
AhmedPlaymaker | 66:e47333ffc6ca | 168 | if (_startPressed == false) { |
AhmedPlaymaker | 63:205f0ca48473 | 169 | wait(0.3); //dont wait anymore if start is pressed. (this is to allow for quick skip towards menu) |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 170 | } |
AhmedPlaymaker | 3:fbb1fa853f09 | 171 | pad.leds_off(); |
AhmedPlaymaker | 3:fbb1fa853f09 | 172 | lcd.clear(); |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 173 | |
AhmedPlaymaker | 56:142e9fdb77a8 | 174 | StartScreen::instruct(lcd,pad); //after the screen_saver is displayed we need to send in instructions of how to preoceed to menu. |
AhmedPlaymaker | 3:fbb1fa853f09 | 175 | } |
AhmedPlaymaker | 3:fbb1fa853f09 | 176 | |
AhmedPlaymaker | 3:fbb1fa853f09 | 177 | void StartScreen::instruct(N5110 &lcd, Gamepad &pad) |
AhmedPlaymaker | 3:fbb1fa853f09 | 178 | { |
AhmedPlaymaker | 61:f3c402bc2ad0 | 179 | //pad.init(); |
AhmedPlaymaker | 65:2872ca289b49 | 180 | wait(1/controlSensitivity); //to avoid race condition of the following while loop being skipped. |
AhmedPlaymaker | 66:e47333ffc6ca | 181 | while ((pad.check_event(Gamepad::START_PRESSED) == false)&&(pad.check_event(Gamepad::A_PRESSED) == false)&&(_startPressed == false)) { |
AhmedPlaymaker | 67:39b9ba6019b0 | 182 | //Start_Pressed is 1 if start is already pressed during animation in titleScreen(); |
AhmedPlaymaker | 59:c65a2e933c47 | 183 | lcd.printString("Please Press",5,1); //Function used to promt the user to start. |
AhmedPlaymaker | 59:c65a2e933c47 | 184 | lcd.printString("Start",25,3); |
AhmedPlaymaker | 59:c65a2e933c47 | 185 | lcd.printString("to Begin",15,5); |
AhmedPlaymaker | 59:c65a2e933c47 | 186 | lcd.refresh(); |
AhmedPlaymaker | 3:fbb1fa853f09 | 187 | pad.leds_on(); |
AhmedPlaymaker | 3:fbb1fa853f09 | 188 | wait(0.1); |
AhmedPlaymaker | 3:fbb1fa853f09 | 189 | pad.leds_off(); |
AhmedPlaymaker | 3:fbb1fa853f09 | 190 | wait(0.1); |
AhmedPlaymaker | 3:fbb1fa853f09 | 191 | } |
AhmedPlaymaker | 6:3ffab44ed49c | 192 | pad.tone(1000.0,0.1); |
AhmedPlaymaker | 3:fbb1fa853f09 | 193 | lcd.clear(); |
AhmedPlaymaker | 3:fbb1fa853f09 | 194 | pad.leds_off(); |
AhmedPlaymaker | 3:fbb1fa853f09 | 195 | } |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 196 | |
AhmedPlaymaker | 49:441c32f6603e | 197 | void StartScreen::credits(N5110 &lcd) |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 198 | { |
AhmedPlaymaker | 49:441c32f6603e | 199 | lcd.clear(); |
AhmedPlaymaker | 65:2872ca289b49 | 200 | if(showCredits) { |
AhmedPlaymaker | 5:e4df87957a5b | 201 | lcd.printString("Created BY",8,1); |
AhmedPlaymaker | 5:e4df87957a5b | 202 | lcd.printString("Ahmed",24,3); |
AhmedPlaymaker | 5:e4df87957a5b | 203 | lcd.printString("Adamjee",20,4); |
AhmedPlaymaker | 5:e4df87957a5b | 204 | lcd.printString("201161436",15,5); |
AhmedPlaymaker | 5:e4df87957a5b | 205 | lcd.refresh(); |
AhmedPlaymaker | 5:e4df87957a5b | 206 | wait(2); |
AhmedPlaymaker | 5:e4df87957a5b | 207 | } |
AhmedPlaymaker | 3:fbb1fa853f09 | 208 | lcd.clear(); |
AhmedPlaymaker | 3:fbb1fa853f09 | 209 | } |
AhmedPlaymaker | 3:fbb1fa853f09 | 210 | |
AhmedPlaymaker | 63:205f0ca48473 | 211 | 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 | 212 | { |
AhmedPlaymaker | 49:441c32f6603e | 213 | _stats.read(sd); |
AhmedPlaymaker | 49:441c32f6603e | 214 | } |
AhmedPlaymaker | 49:441c32f6603e | 215 | |
AhmedPlaymaker | 67:39b9ba6019b0 | 216 | bool StartScreen::checkBackPressed(Gamepad &pad) |
AhmedPlaymaker | 66:e47333ffc6ca | 217 | { |
AhmedPlaymaker | 66:e47333ffc6ca | 218 | //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 | 66:e47333ffc6ca | 219 | if (pad.check_event(Gamepad::BACK_PRESSED) == true) { |
AhmedPlaymaker | 66:e47333ffc6ca | 220 | pad.tone(1000.0,0.1); |
AhmedPlaymaker | 66:e47333ffc6ca | 221 | _backPressed = true; |
AhmedPlaymaker | 66:e47333ffc6ca | 222 | } else { |
AhmedPlaymaker | 66:e47333ffc6ca | 223 | _backPressed = false; |
AhmedPlaymaker | 66:e47333ffc6ca | 224 | } |
AhmedPlaymaker | 80:51ca38c5dcdf | 225 | return _backPressed; //returns true if back is pressed, returns false otherwise. |
AhmedPlaymaker | 66:e47333ffc6ca | 226 | } |
AhmedPlaymaker | 66:e47333ffc6ca | 227 | |
AhmedPlaymaker | 67:39b9ba6019b0 | 228 | void StartScreen::menu(N5110 &lcd, Gamepad &pad) |
AhmedPlaymaker | 3:fbb1fa853f09 | 229 | { |
AhmedPlaymaker | 7:48ba87cd79b5 | 230 | lcd.clear(); |
AhmedPlaymaker | 52:c2faa96cf293 | 231 | //StartScreen::init(); |
AhmedPlaymaker | 61:f3c402bc2ad0 | 232 | //pad.init(); |
AhmedPlaymaker | 76:7fa91122907f | 233 | while ((pad.check_event(Gamepad::A_PRESSED) == false)&&(pad.check_event(Gamepad::START_PRESSED) == false)) { |
AhmedPlaymaker | 76:7fa91122907f | 234 | //This menu loop won't be skipped unless the player decides to press START/A. |
AhmedPlaymaker | 76:7fa91122907f | 235 | lcd.clear(); |
AhmedPlaymaker | 66:e47333ffc6ca | 236 | StartScreen::mainMenu(lcd, pad); |
AhmedPlaymaker | 76:7fa91122907f | 237 | lcd.refresh(); |
AhmedPlaymaker | 76:7fa91122907f | 238 | |
AhmedPlaymaker | 3:fbb1fa853f09 | 239 | } |
AhmedPlaymaker | 6:3ffab44ed49c | 240 | pad.tone(1000.0,0.1); |
AhmedPlaymaker | 66:e47333ffc6ca | 241 | StartScreen::nextMenu(lcd, pad); //after all main menu operations have been completed, this function allows us to get to the next menu. |
AhmedPlaymaker | 34:89f53ffc81bb | 242 | } |
AhmedPlaymaker | 34:89f53ffc81bb | 243 | |
AhmedPlaymaker | 76:7fa91122907f | 244 | void StartScreen::mainMenu(N5110 &lcd, Gamepad &pad) //Displays the main menu contents, and then allows the user to select the next menu using the selection arrow. |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 245 | { |
AhmedPlaymaker | 67:39b9ba6019b0 | 246 | StartScreen::drawSelectionArrow(lcd, pad); //draws arrow to select menu option. |
AhmedPlaymaker | 67:39b9ba6019b0 | 247 | |
AhmedPlaymaker | 68:b9cfd27987ac | 248 | lcd.printString("Snake vs Block",0,0); |
AhmedPlaymaker | 34:89f53ffc81bb | 249 | lcd.printString("Play",0,2); |
AhmedPlaymaker | 34:89f53ffc81bb | 250 | lcd.printString("Settings",0,3); |
AhmedPlaymaker | 34:89f53ffc81bb | 251 | lcd.printString("Stats",0,4); |
AhmedPlaymaker | 34:89f53ffc81bb | 252 | lcd.printString("Tutorial",0,5); |
AhmedPlaymaker | 34:89f53ffc81bb | 253 | } |
AhmedPlaymaker | 34:89f53ffc81bb | 254 | |
AhmedPlaymaker | 67:39b9ba6019b0 | 255 | void StartScreen::drawSelectionArrow(N5110 &lcd, Gamepad &pad) |
AhmedPlaymaker | 67:39b9ba6019b0 | 256 | { |
AhmedPlaymaker | 76:7fa91122907f | 257 | wait(1/controlSensitivity); |
AhmedPlaymaker | 67:39b9ba6019b0 | 258 | Direction d = pad.get_direction(); |
AhmedPlaymaker | 67:39b9ba6019b0 | 259 | if(((d==N)||(pad.check_event(Gamepad::L_PRESSED) == true))&&(menu_index>16)) { |
AhmedPlaymaker | 67:39b9ba6019b0 | 260 | 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(lcd, pad). |
AhmedPlaymaker | 67:39b9ba6019b0 | 261 | } |
AhmedPlaymaker | 67:39b9ba6019b0 | 262 | if(((d==S)||(pad.check_event(Gamepad::R_PRESSED) == true))&&(menu_index<40)) { |
AhmedPlaymaker | 67:39b9ba6019b0 | 263 | 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(lcd, pad). |
AhmedPlaymaker | 67:39b9ba6019b0 | 264 | } |
AhmedPlaymaker | 76:7fa91122907f | 265 | 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 | 266 | } |
AhmedPlaymaker | 67:39b9ba6019b0 | 267 | |
AhmedPlaymaker | 76:7fa91122907f | 268 | //////////////////////////////DECIDES THE NEXT MENU PAGE////////////////////////////// |
AhmedPlaymaker | 76:7fa91122907f | 269 | |
AhmedPlaymaker | 66:e47333ffc6ca | 270 | void StartScreen::nextMenu(N5110 &lcd, Gamepad &pad) |
AhmedPlaymaker | 55:df0825049171 | 271 | { |
AhmedPlaymaker | 67:39b9ba6019b0 | 272 | 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 | 273 | case 16: |
AhmedPlaymaker | 76:7fa91122907f | 274 | game_mode(lcd, pad); //calls game mode after play has been pressed. |
AhmedPlaymaker | 76:7fa91122907f | 275 | game_speed(lcd, pad); //calls game speed after the game mode has been selected. |
AhmedPlaymaker | 67:39b9ba6019b0 | 276 | return; //This forces us out of the menu class and back into int main(). |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 277 | case 24: |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 278 | float *cs_sc; |
AhmedPlaymaker | 65:2872ca289b49 | 279 | cs_sc = _settings.Implement(lcd, pad, controlSensitivity); |
AhmedPlaymaker | 65:2872ca289b49 | 280 | 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 | 281 | showCredits = cs_sc[1]; //saves the logic in showCredits which decides weather or not to show credits when game starts. |
AhmedPlaymaker | 67:39b9ba6019b0 | 282 | menu(lcd, pad); //to return to main_menu if back is pressed |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 283 | break; |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 284 | case 32: |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 285 | _stats.StatsDisplay(lcd, pad); |
AhmedPlaymaker | 67:39b9ba6019b0 | 286 | menu(lcd, pad); //to return to main_menu if back is pressed |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 287 | break; |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 288 | case 40: |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 289 | _tutorial.Implement(lcd, pad); |
AhmedPlaymaker | 67:39b9ba6019b0 | 290 | menu(lcd, pad); //to return to main_menu if back is pressed |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 291 | break; |
AhmedPlaymaker | 56:142e9fdb77a8 | 292 | } |
AhmedPlaymaker | 3:fbb1fa853f09 | 293 | } |
AhmedPlaymaker | 30:461231877c89 | 294 | |
AhmedPlaymaker | 76:7fa91122907f | 295 | |
AhmedPlaymaker | 76:7fa91122907f | 296 | //////////////////////////////GAME MODE SELECTION////////////////////////////// |
AhmedPlaymaker | 76:7fa91122907f | 297 | |
AhmedPlaymaker | 49:441c32f6603e | 298 | void StartScreen::game_mode(N5110 &lcd, Gamepad &pad) |
AhmedPlaymaker | 4:1fe015b66bb8 | 299 | { |
AhmedPlaymaker | 4:1fe015b66bb8 | 300 | lcd.clear(); |
AhmedPlaymaker | 61:f3c402bc2ad0 | 301 | //pad.init(); |
AhmedPlaymaker | 29:c6358c39a70e | 302 | while ((pad.check_event(Gamepad::A_PRESSED) == false)&&(pad.check_event(Gamepad::START_PRESSED) == false)) { //Change this to if button pressed. |
AhmedPlaymaker | 76:7fa91122907f | 303 | |
AhmedPlaymaker | 76:7fa91122907f | 304 | lcd.clear(); |
AhmedPlaymaker | 76:7fa91122907f | 305 | StartScreen::selectMode(lcd, pad); //displays to the user what are the mode options |
AhmedPlaymaker | 76:7fa91122907f | 306 | lcd.refresh(); |
AhmedPlaymaker | 64:540aa1602372 | 307 | |
AhmedPlaymaker | 67:39b9ba6019b0 | 308 | if (StartScreen::checkBackPressed(pad)) { |
AhmedPlaymaker | 67:39b9ba6019b0 | 309 | break; //if back is pressed, the while loop is escaped. |
AhmedPlaymaker | 67:39b9ba6019b0 | 310 | } |
AhmedPlaymaker | 66:e47333ffc6ca | 311 | |
AhmedPlaymaker | 34:89f53ffc81bb | 312 | } |
AhmedPlaymaker | 58:affb42c56cf8 | 313 | pad.tone(1000.0,0.1); |
AhmedPlaymaker | 76:7fa91122907f | 314 | |
AhmedPlaymaker | 66:e47333ffc6ca | 315 | if(_backPressed) { //if back was pressed in the while loop, the previous menu is called. |
AhmedPlaymaker | 80:51ca38c5dcdf | 316 | StartScreen::menu(lcd, pad); |
AhmedPlaymaker | 34:89f53ffc81bb | 317 | } |
AhmedPlaymaker | 34:89f53ffc81bb | 318 | } |
AhmedPlaymaker | 34:89f53ffc81bb | 319 | |
AhmedPlaymaker | 76:7fa91122907f | 320 | void StartScreen::selectMode(N5110 &lcd, Gamepad &pad) |
AhmedPlaymaker | 42:973bb6036f81 | 321 | { |
AhmedPlaymaker | 76:7fa91122907f | 322 | StartScreen::scrollModeSelection(pad); //the mode is selected by moving joystick in this function. |
AhmedPlaymaker | 56:142e9fdb77a8 | 323 | switch (g_mode) { |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 324 | case 1: |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 325 | lcd.printString("Joystick",18,1); |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 326 | lcd.drawSprite(17,22,13,48,(int *)joystick); //Function used to draw the sprite. |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 327 | lcd.refresh(); |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 328 | break; |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 329 | case 2: |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 330 | lcd.drawSprite(10,22,13,8,(int *)navL); //Function used to draw the sprite. |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 331 | lcd.drawSprite(65,22,13,8,(int *)navR); //Function used to draw the sprite. |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 332 | lcd.printString("Motion Control",1,1); |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 333 | lcd.drawSprite(32,22,12,21,(int *)motionControl); //Function used to draw the sprite. |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 334 | break; |
AhmedPlaymaker | 34:89f53ffc81bb | 335 | } |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 336 | |
AhmedPlaymaker | 4:1fe015b66bb8 | 337 | } |
AhmedPlaymaker | 34:89f53ffc81bb | 338 | |
AhmedPlaymaker | 76:7fa91122907f | 339 | void StartScreen::scrollModeSelection(Gamepad &pad) |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 340 | { |
AhmedPlaymaker | 56:142e9fdb77a8 | 341 | Direction d = pad.get_direction(); |
AhmedPlaymaker | 76:7fa91122907f | 342 | wait(1/controlSensitivity);//to make the joystick selection's speed inversely proportional to controlSensitivity. |
AhmedPlaymaker | 59:c65a2e933c47 | 343 | 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 | 344 | g_mode=2; |
AhmedPlaymaker | 56:142e9fdb77a8 | 345 | } |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 346 | |
AhmedPlaymaker | 59:c65a2e933c47 | 347 | 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 | 348 | g_mode=1; |
AhmedPlaymaker | 56:142e9fdb77a8 | 349 | } |
AhmedPlaymaker | 56:142e9fdb77a8 | 350 | } |
AhmedPlaymaker | 56:142e9fdb77a8 | 351 | |
AhmedPlaymaker | 76:7fa91122907f | 352 | //////////////////////////////INSTRUCTIONS FOR MOTION CONTROL////////////////////////////// |
AhmedPlaymaker | 76:7fa91122907f | 353 | |
AhmedPlaymaker | 58:affb42c56cf8 | 354 | void StartScreen::motionControlInstructions(N5110 &lcd) |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 355 | { |
AhmedPlaymaker | 58:affb42c56cf8 | 356 | lcd.clear(); |
AhmedPlaymaker | 58:affb42c56cf8 | 357 | lcd.printString("While playing the",5,0); //Function used to promt the user to start. |
AhmedPlaymaker | 58:affb42c56cf8 | 358 | lcd.printString("game, press",9,1); |
AhmedPlaymaker | 58:affb42c56cf8 | 359 | lcd.printString("A to centre",8,2); |
AhmedPlaymaker | 58:affb42c56cf8 | 360 | lcd.printString("the snake at",9,3); |
AhmedPlaymaker | 58:affb42c56cf8 | 361 | lcd.printString("prefered angle",0,4); |
AhmedPlaymaker | 58:affb42c56cf8 | 362 | lcd.refresh(); |
AhmedPlaymaker | 58:affb42c56cf8 | 363 | wait(2); |
AhmedPlaymaker | 58:affb42c56cf8 | 364 | } |
AhmedPlaymaker | 58:affb42c56cf8 | 365 | |
AhmedPlaymaker | 76:7fa91122907f | 366 | |
AhmedPlaymaker | 76:7fa91122907f | 367 | //////////////////////////////GAME SPEED SELECTION////////////////////////////// |
AhmedPlaymaker | 76:7fa91122907f | 368 | |
AhmedPlaymaker | 49:441c32f6603e | 369 | void StartScreen::game_speed(N5110 &lcd, Gamepad &pad) |
AhmedPlaymaker | 4:1fe015b66bb8 | 370 | { |
AhmedPlaymaker | 4:1fe015b66bb8 | 371 | lcd.clear(); |
AhmedPlaymaker | 61:f3c402bc2ad0 | 372 | //pad.init(); |
AhmedPlaymaker | 29:c6358c39a70e | 373 | while ((pad.check_event(Gamepad::A_PRESSED) == false)&&(pad.check_event(Gamepad::START_PRESSED) == false)) { //Change this to if button pressed. |
AhmedPlaymaker | 76:7fa91122907f | 374 | |
AhmedPlaymaker | 76:7fa91122907f | 375 | lcd.clear(); |
AhmedPlaymaker | 76:7fa91122907f | 376 | StartScreen::selectSpeed(lcd, pad); //this displays all the speed options and saves the data obtained (fps) for use in main(). |
AhmedPlaymaker | 76:7fa91122907f | 377 | lcd.refresh(); |
AhmedPlaymaker | 67:39b9ba6019b0 | 378 | |
AhmedPlaymaker | 67:39b9ba6019b0 | 379 | if (StartScreen::checkBackPressed(pad)) { |
AhmedPlaymaker | 67:39b9ba6019b0 | 380 | break; //if back is pressed, the while loop is escaped. |
AhmedPlaymaker | 67:39b9ba6019b0 | 381 | } |
AhmedPlaymaker | 35:ce47cde57bd3 | 382 | } |
AhmedPlaymaker | 67:39b9ba6019b0 | 383 | pad.tone(1000.0,0.1); |
AhmedPlaymaker | 64:540aa1602372 | 384 | |
AhmedPlaymaker | 66:e47333ffc6ca | 385 | if(_backPressed) { //if back was pressed in the while loop, the previous menu is called. |
AhmedPlaymaker | 80:51ca38c5dcdf | 386 | StartScreen::menu(lcd, pad); //To go back to Menu if back is pressed. |
AhmedPlaymaker | 64:540aa1602372 | 387 | } |
AhmedPlaymaker | 64:540aa1602372 | 388 | |
AhmedPlaymaker | 35:ce47cde57bd3 | 389 | } |
AhmedPlaymaker | 35:ce47cde57bd3 | 390 | |
AhmedPlaymaker | 76:7fa91122907f | 391 | void StartScreen::selectSpeed(N5110 &lcd, Gamepad &pad) //decrease code size. |
AhmedPlaymaker | 76:7fa91122907f | 392 | { |
AhmedPlaymaker | 76:7fa91122907f | 393 | StartScreen::scrollSpeedSelection(pad); //this swipes through the speed pages, dependent on the joystick input. |
AhmedPlaymaker | 76:7fa91122907f | 394 | lcd.drawSprite(10,22,13,8,(int *)navL); //Function used to draw the sprite. |
AhmedPlaymaker | 76:7fa91122907f | 395 | lcd.drawSprite(65,22,13,8,(int *)navR); //Function used to draw the sprite. |
AhmedPlaymaker | 76:7fa91122907f | 396 | lcd.printString("Game Speed",10,1); |
AhmedPlaymaker | 76:7fa91122907f | 397 | switch (speed_index) { |
AhmedPlaymaker | 76:7fa91122907f | 398 | case 1: |
AhmedPlaymaker | 76:7fa91122907f | 399 | lcd.printString("SNAKE",28,3); |
AhmedPlaymaker | 76:7fa91122907f | 400 | fps = 15; |
AhmedPlaymaker | 76:7fa91122907f | 401 | break; |
AhmedPlaymaker | 76:7fa91122907f | 402 | case 2: |
AhmedPlaymaker | 76:7fa91122907f | 403 | lcd.printString("HUMAN",28,3); |
AhmedPlaymaker | 76:7fa91122907f | 404 | fps = 22; |
AhmedPlaymaker | 76:7fa91122907f | 405 | break; |
AhmedPlaymaker | 76:7fa91122907f | 406 | case 3: |
AhmedPlaymaker | 76:7fa91122907f | 407 | lcd.printString("HORSE",28,3); |
AhmedPlaymaker | 76:7fa91122907f | 408 | fps = 26; |
AhmedPlaymaker | 76:7fa91122907f | 409 | break; |
AhmedPlaymaker | 76:7fa91122907f | 410 | case 4: |
AhmedPlaymaker | 76:7fa91122907f | 411 | lcd.printString("CHEETHA",21,3); |
AhmedPlaymaker | 76:7fa91122907f | 412 | fps = 30; |
AhmedPlaymaker | 76:7fa91122907f | 413 | } |
AhmedPlaymaker | 76:7fa91122907f | 414 | |
AhmedPlaymaker | 76:7fa91122907f | 415 | } |
AhmedPlaymaker | 76:7fa91122907f | 416 | |
AhmedPlaymaker | 76:7fa91122907f | 417 | void StartScreen::scrollSpeedSelection(Gamepad &pad) |
AhmedPlaymaker | 62:ebf6ecf8a6d5 | 418 | { |
AhmedPlaymaker | 35:ce47cde57bd3 | 419 | Direction d = pad.get_direction(); |
AhmedPlaymaker | 76:7fa91122907f | 420 | wait(1/controlSensitivity);//to make the joystick selection's speed inversely proportional to controlSensitivity. |
AhmedPlaymaker | 67:39b9ba6019b0 | 421 | if(((d==E)||(pad.check_event(Gamepad::R_PRESSED) == true))&&(speed_index==4)) { |
AhmedPlaymaker | 67:39b9ba6019b0 | 422 | speed_index=1; |
AhmedPlaymaker | 67:39b9ba6019b0 | 423 | } else if(((d==W)||(pad.check_event(Gamepad::L_PRESSED) == true))&&(speed_index==1)) { |
AhmedPlaymaker | 67:39b9ba6019b0 | 424 | speed_index=4; |
AhmedPlaymaker | 67:39b9ba6019b0 | 425 | } else if(((d==E)||(pad.check_event(Gamepad::R_PRESSED) == true))&&(1<=speed_index<=3)) { |
AhmedPlaymaker | 67:39b9ba6019b0 | 426 | speed_index=speed_index+1; |
AhmedPlaymaker | 67:39b9ba6019b0 | 427 | } else if(((d==W)||(pad.check_event(Gamepad::L_PRESSED) == true))&&(2<=speed_index<=4)) { |
AhmedPlaymaker | 67:39b9ba6019b0 | 428 | speed_index=speed_index-1; |
AhmedPlaymaker | 35:ce47cde57bd3 | 429 | } |
AhmedPlaymaker | 35:ce47cde57bd3 | 430 | } |