![](/media/cache/profiles/LinkedIn_0NghoZJ.jpeg.50x50_q85.jpg)
Snake vs Block Game to be run upon K64F.
MenuClasses/StartScreen/StartScreen.cpp@58:affb42c56cf8, 2019-04-28 (annotated)
- Committer:
- AhmedPlaymaker
- Date:
- Sun Apr 28 19:40:50 2019 +0000
- Revision:
- 58:affb42c56cf8
- Parent:
- 57:845781aea5ec
- Child:
- 59:c65a2e933c47
added led feedback for motion control
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AhmedPlaymaker | 3:fbb1fa853f09 | 1 | #include "StartScreen.h" |
AhmedPlaymaker | 5:e4df87957a5b | 2 | Settings settings; |
AhmedPlaymaker | 3:fbb1fa853f09 | 3 | |
AhmedPlaymaker | 3:fbb1fa853f09 | 4 | int sprite[48][84] = { |
AhmedPlaymaker | 6:3ffab44ed49c | 5 | {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 | 6 | {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 | 7 | {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:3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ymaker | 6:3ffab44ed49c | 49 | {1,0,0,0,0,1,1,1,1,1,0,0,1,1,0,0,1,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,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,1}, |
AhmedPlaymaker | 6:3ffab44ed49c | 50 | {1,0,0,0,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,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,1}, |
AhmedPlaymaker | 6:3ffab44ed49c | 51 | {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 | 52 | {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 | 53 | |
AhmedPlaymaker | 4:1fe015b66bb8 | 54 | }; |
AhmedPlaymaker | 3:fbb1fa853f09 | 55 | |
AhmedPlaymaker | 4:1fe015b66bb8 | 56 | int arrow[7][9] = { |
AhmedPlaymaker | 3:fbb1fa853f09 | 57 | {0,0,0,0,1,0,0,0,0}, |
AhmedPlaymaker | 3:fbb1fa853f09 | 58 | {0,0,0,1,1,0,0,0,0}, |
AhmedPlaymaker | 3:fbb1fa853f09 | 59 | {0,0,1,1,1,0,0,0,0}, |
AhmedPlaymaker | 3:fbb1fa853f09 | 60 | {0,1,1,1,1,1,1,1,1}, |
AhmedPlaymaker | 3:fbb1fa853f09 | 61 | {0,0,1,1,1,0,0,0,0}, |
AhmedPlaymaker | 3:fbb1fa853f09 | 62 | {0,0,0,1,1,0,0,0,0}, |
AhmedPlaymaker | 3:fbb1fa853f09 | 63 | {0,0,0,0,1,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 64 | }; |
AhmedPlaymaker | 4:1fe015b66bb8 | 65 | |
AhmedPlaymaker | 56:142e9fdb77a8 | 66 | int motionControl[12][21] = { |
AhmedPlaymaker | 56:142e9fdb77a8 | 67 | {0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0}, |
AhmedPlaymaker | 56:142e9fdb77a8 | 68 | {0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,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,0,1,0,0,0,1,1,1,0,0,0,1,0,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 | {0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0}, |
AhmedPlaymaker | 56:142e9fdb77a8 | 73 | {1,1,1,0,1,0,0,1,1,1,1,1,1,1,0,0,1,0,1,1,1}, |
AhmedPlaymaker | 56:142e9fdb77a8 | 74 | {1,1,0,0,1,0,1,0,0,0,0,0,0,0,1,0,1,0,0,1,1}, |
AhmedPlaymaker | 56:142e9fdb77a8 | 75 | {1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,0,1}, |
AhmedPlaymaker | 56:142e9fdb77a8 | 76 | {0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0}, |
AhmedPlaymaker | 56:142e9fdb77a8 | 77 | {0,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0,1,0,0,0,0}, |
AhmedPlaymaker | 56:142e9fdb77a8 | 78 | {0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 79 | }; |
AhmedPlaymaker | 56:142e9fdb77a8 | 80 | |
AhmedPlaymaker | 57:845781aea5ec | 81 | int joystick[13][48] = { |
AhmedPlaymaker | 57:845781aea5ec | 82 | {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 | 83 | {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 | 84 | {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 | 85 | {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 | 86 | {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 | 87 | {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 | 88 | {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 | 89 | {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 | 90 | {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 | 91 | {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 | 92 | {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 | 93 | {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 | 94 | {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 | 95 | }; |
AhmedPlaymaker | 56:142e9fdb77a8 | 96 | |
AhmedPlaymaker | 4:1fe015b66bb8 | 97 | int navL[13][8] = { |
AhmedPlaymaker | 4:1fe015b66bb8 | 98 | {0,0,0,0,0,0,1,1}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 99 | {0,0,0,0,0,1,1,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 100 | {0,0,0,0,1,1,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 101 | {0,0,0,1,1,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 102 | {0,0,1,1,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 103 | {0,1,1,0,0,0,0,0}, |
AhmedPlaymaker | 56:142e9fdb77a8 | 104 | {1,1,1,1,1,1,1,1}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 105 | {0,1,1,0,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 106 | {0,0,1,1,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 107 | {0,0,0,1,1,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 108 | {0,0,0,0,1,1,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 109 | {0,0,0,0,0,1,1,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 110 | {0,0,0,0,0,0,1,1}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 111 | }; |
AhmedPlaymaker | 3:fbb1fa853f09 | 112 | |
AhmedPlaymaker | 4:1fe015b66bb8 | 113 | int navR[13][8] = { |
AhmedPlaymaker | 4:1fe015b66bb8 | 114 | {1,1,0,0,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 115 | {0,1,1,0,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 116 | {0,0,1,1,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 117 | {0,0,0,1,1,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 118 | {0,0,0,0,1,1,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 119 | {0,0,0,0,0,1,1,0}, |
AhmedPlaymaker | 56:142e9fdb77a8 | 120 | {1,1,1,1,1,1,1,1}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 121 | {0,0,0,0,0,1,1,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 122 | {0,0,0,0,1,1,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 123 | {0,0,0,1,1,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 124 | {0,0,1,1,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 125 | {0,1,1,0,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 126 | {1,1,0,0,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 127 | }; |
AhmedPlaymaker | 16:7b474f873683 | 128 | |
AhmedPlaymaker | 3:fbb1fa853f09 | 129 | StartScreen::StartScreen() |
AhmedPlaymaker | 3:fbb1fa853f09 | 130 | { |
AhmedPlaymaker | 3:fbb1fa853f09 | 131 | |
AhmedPlaymaker | 3:fbb1fa853f09 | 132 | } |
AhmedPlaymaker | 3:fbb1fa853f09 | 133 | |
AhmedPlaymaker | 3:fbb1fa853f09 | 134 | StartScreen::~StartScreen() |
AhmedPlaymaker | 3:fbb1fa853f09 | 135 | { |
AhmedPlaymaker | 58:affb42c56cf8 | 136 | |
AhmedPlaymaker | 3:fbb1fa853f09 | 137 | } |
AhmedPlaymaker | 3:fbb1fa853f09 | 138 | |
AhmedPlaymaker | 30:461231877c89 | 139 | void StartScreen::init() |
AhmedPlaymaker | 30:461231877c89 | 140 | { |
AhmedPlaymaker | 36:dfdd619874ae | 141 | i = 16; //main menu selection arrow position |
AhmedPlaymaker | 56:142e9fdb77a8 | 142 | g_mode = 1; //game mode selection (joystick/motion control). |
AhmedPlaymaker | 47:b448ffd073e7 | 143 | gs = 2; //game speed page selection. |
AhmedPlaymaker | 36:dfdd619874ae | 144 | st = 1; //this is the sr num of settings pages. |
AhmedPlaymaker | 36:dfdd619874ae | 145 | sc = 1; //this helps in wether ot not to show credits to the user. |
AhmedPlaymaker | 36:dfdd619874ae | 146 | cs = 4; //sensitivity of control speed of menu options. |
AhmedPlaymaker | 30:461231877c89 | 147 | } |
AhmedPlaymaker | 3:fbb1fa853f09 | 148 | |
AhmedPlaymaker | 3:fbb1fa853f09 | 149 | void StartScreen::screen_saver(N5110 &lcd, Gamepad &pad) |
AhmedPlaymaker | 3:fbb1fa853f09 | 150 | { |
AhmedPlaymaker | 28:d2c621d67e3b | 151 | //this saves the Theme song I want to play at the start. |
AhmedPlaymaker | 26:3495f7b0ede7 | 152 | int song[18] = {441,494,439,372,392,370,330,246,329,331,370,555,555,495,440,392,392,370}; |
AhmedPlaymaker | 6:3ffab44ed49c | 153 | pad.leds_on(); |
AhmedPlaymaker | 26:3495f7b0ede7 | 154 | |
AhmedPlaymaker | 28:d2c621d67e3b | 155 | for(int ani = -51; ani <= 0; ani+=3) { |
AhmedPlaymaker | 26:3495f7b0ede7 | 156 | lcd.clear(); |
AhmedPlaymaker | 26:3495f7b0ede7 | 157 | lcd.drawSprite(0,ani,48,84,(int *)sprite); //Function used to draw the sprite |
AhmedPlaymaker | 26:3495f7b0ede7 | 158 | lcd.refresh(); |
AhmedPlaymaker | 26:3495f7b0ede7 | 159 | pad.tone(song[(ani+48)/3],0.1); |
AhmedPlaymaker | 26:3495f7b0ede7 | 160 | wait(0.2); |
AhmedPlaymaker | 26:3495f7b0ede7 | 161 | } |
AhmedPlaymaker | 26:3495f7b0ede7 | 162 | |
AhmedPlaymaker | 16:7b474f873683 | 163 | wait(0.3); |
AhmedPlaymaker | 3:fbb1fa853f09 | 164 | pad.leds_off(); |
AhmedPlaymaker | 3:fbb1fa853f09 | 165 | lcd.clear(); |
AhmedPlaymaker | 56:142e9fdb77a8 | 166 | |
AhmedPlaymaker | 56:142e9fdb77a8 | 167 | 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 | 168 | } |
AhmedPlaymaker | 3:fbb1fa853f09 | 169 | |
AhmedPlaymaker | 3:fbb1fa853f09 | 170 | void StartScreen::instruct(N5110 &lcd, Gamepad &pad) |
AhmedPlaymaker | 3:fbb1fa853f09 | 171 | { |
AhmedPlaymaker | 3:fbb1fa853f09 | 172 | lcd.printString("Please Press",5,1); //Function used to promt the user to start. |
AhmedPlaymaker | 3:fbb1fa853f09 | 173 | lcd.printString("Start",25,3); |
AhmedPlaymaker | 3:fbb1fa853f09 | 174 | lcd.printString("to Begin",15,5); |
AhmedPlaymaker | 3:fbb1fa853f09 | 175 | lcd.refresh(); |
AhmedPlaymaker | 30:461231877c89 | 176 | pad.init(); |
AhmedPlaymaker | 3:fbb1fa853f09 | 177 | while ( pad.check_event(Gamepad::START_PRESSED) == false) { |
AhmedPlaymaker | 3:fbb1fa853f09 | 178 | pad.leds_on(); |
AhmedPlaymaker | 3:fbb1fa853f09 | 179 | wait(0.1); |
AhmedPlaymaker | 3:fbb1fa853f09 | 180 | pad.leds_off(); |
AhmedPlaymaker | 3:fbb1fa853f09 | 181 | wait(0.1); |
AhmedPlaymaker | 3:fbb1fa853f09 | 182 | } |
AhmedPlaymaker | 6:3ffab44ed49c | 183 | pad.tone(1000.0,0.1); |
AhmedPlaymaker | 3:fbb1fa853f09 | 184 | lcd.clear(); |
AhmedPlaymaker | 3:fbb1fa853f09 | 185 | pad.leds_off(); |
AhmedPlaymaker | 3:fbb1fa853f09 | 186 | } |
AhmedPlaymaker | 3:fbb1fa853f09 | 187 | |
AhmedPlaymaker | 49:441c32f6603e | 188 | void StartScreen::credits(N5110 &lcd) |
AhmedPlaymaker | 3:fbb1fa853f09 | 189 | { |
AhmedPlaymaker | 49:441c32f6603e | 190 | lcd.clear(); |
AhmedPlaymaker | 49:441c32f6603e | 191 | if(sc) { |
AhmedPlaymaker | 5:e4df87957a5b | 192 | lcd.printString("Created BY",8,1); |
AhmedPlaymaker | 5:e4df87957a5b | 193 | lcd.printString("Ahmed",24,3); |
AhmedPlaymaker | 5:e4df87957a5b | 194 | lcd.printString("Adamjee",20,4); |
AhmedPlaymaker | 5:e4df87957a5b | 195 | lcd.printString("201161436",15,5); |
AhmedPlaymaker | 5:e4df87957a5b | 196 | lcd.refresh(); |
AhmedPlaymaker | 5:e4df87957a5b | 197 | wait(2); |
AhmedPlaymaker | 5:e4df87957a5b | 198 | } |
AhmedPlaymaker | 3:fbb1fa853f09 | 199 | lcd.clear(); |
AhmedPlaymaker | 3:fbb1fa853f09 | 200 | } |
AhmedPlaymaker | 3:fbb1fa853f09 | 201 | |
AhmedPlaymaker | 49:441c32f6603e | 202 | void StartScreen::read_stats(SDFileSystem &sd) |
AhmedPlaymaker | 49:441c32f6603e | 203 | { |
AhmedPlaymaker | 49:441c32f6603e | 204 | _stats.read(sd); |
AhmedPlaymaker | 49:441c32f6603e | 205 | } |
AhmedPlaymaker | 49:441c32f6603e | 206 | |
AhmedPlaymaker | 49:441c32f6603e | 207 | void StartScreen::main_menu(N5110 &lcd, Gamepad &pad) |
AhmedPlaymaker | 3:fbb1fa853f09 | 208 | { |
AhmedPlaymaker | 7:48ba87cd79b5 | 209 | lcd.clear(); |
AhmedPlaymaker | 52:c2faa96cf293 | 210 | //StartScreen::init(); |
AhmedPlaymaker | 32:3a3bdeffdf62 | 211 | pad.init(); |
AhmedPlaymaker | 29:c6358c39a70e | 212 | while ((pad.check_event(Gamepad::A_PRESSED) == false)&&(pad.check_event(Gamepad::START_PRESSED) == false)) { //Change this to if button pressed. |
AhmedPlaymaker | 56:142e9fdb77a8 | 213 | StartScreen::ImplementMenu(lcd, pad); |
AhmedPlaymaker | 3:fbb1fa853f09 | 214 | } |
AhmedPlaymaker | 6:3ffab44ed49c | 215 | pad.tone(1000.0,0.1); |
AhmedPlaymaker | 30:461231877c89 | 216 | wait(1/cs); |
AhmedPlaymaker | 56:142e9fdb77a8 | 217 | StartScreen::NextMenu(lcd, pad); |
AhmedPlaymaker | 34:89f53ffc81bb | 218 | } |
AhmedPlaymaker | 34:89f53ffc81bb | 219 | |
AhmedPlaymaker | 56:142e9fdb77a8 | 220 | void StartScreen::ImplementMenu(N5110 &lcd, Gamepad &pad) |
AhmedPlaymaker | 34:89f53ffc81bb | 221 | { |
AhmedPlaymaker | 34:89f53ffc81bb | 222 | lcd.printString("SnakeVSBlock",5,0); |
AhmedPlaymaker | 34:89f53ffc81bb | 223 | lcd.printString("Play",0,2); |
AhmedPlaymaker | 34:89f53ffc81bb | 224 | lcd.printString("Settings",0,3); |
AhmedPlaymaker | 34:89f53ffc81bb | 225 | lcd.printString("Stats",0,4); |
AhmedPlaymaker | 34:89f53ffc81bb | 226 | lcd.printString("Tutorial",0,5); |
AhmedPlaymaker | 34:89f53ffc81bb | 227 | Direction d = pad.get_direction(); |
AhmedPlaymaker | 34:89f53ffc81bb | 228 | if((d==N)&&(i>16)) { |
AhmedPlaymaker | 34:89f53ffc81bb | 229 | i=i-8; |
AhmedPlaymaker | 34:89f53ffc81bb | 230 | } |
AhmedPlaymaker | 34:89f53ffc81bb | 231 | if((d==S)&&(i<40)) { |
AhmedPlaymaker | 34:89f53ffc81bb | 232 | i=i+8; |
AhmedPlaymaker | 34:89f53ffc81bb | 233 | } |
AhmedPlaymaker | 34:89f53ffc81bb | 234 | lcd.drawSprite(50,i,7,9,(int *)arrow); //Function used to draw the sprite. |
AhmedPlaymaker | 34:89f53ffc81bb | 235 | lcd.refresh(); |
AhmedPlaymaker | 34:89f53ffc81bb | 236 | wait(1/cs); |
AhmedPlaymaker | 34:89f53ffc81bb | 237 | lcd.clear(); |
AhmedPlaymaker | 34:89f53ffc81bb | 238 | } |
AhmedPlaymaker | 34:89f53ffc81bb | 239 | |
AhmedPlaymaker | 56:142e9fdb77a8 | 240 | void StartScreen::NextMenu(N5110 &lcd, Gamepad &pad) |
AhmedPlaymaker | 55:df0825049171 | 241 | { |
AhmedPlaymaker | 55:df0825049171 | 242 | switch (i) { |
AhmedPlaymaker | 55:df0825049171 | 243 | case 16: |
AhmedPlaymaker | 49:441c32f6603e | 244 | game_mode(lcd, pad); |
AhmedPlaymaker | 55:df0825049171 | 245 | break; |
AhmedPlaymaker | 55:df0825049171 | 246 | case 24: |
AhmedPlaymaker | 30:461231877c89 | 247 | float *cs_sc; |
AhmedPlaymaker | 49:441c32f6603e | 248 | cs_sc = settings.Implement(lcd, pad, cs); |
AhmedPlaymaker | 56:142e9fdb77a8 | 249 | cs = cs_sc[0]; //saves the number in cs which controls the control speed of the menu oftions (basically the wait time of between reading joystick input). |
AhmedPlaymaker | 56:142e9fdb77a8 | 250 | sc = cs_sc[1]; //saves the number in sc which decides weather or not to show credits when game starts. |
AhmedPlaymaker | 56:142e9fdb77a8 | 251 | main_menu(lcd, pad); //to return to main_menu if back is pressed |
AhmedPlaymaker | 55:df0825049171 | 252 | break; |
AhmedPlaymaker | 55:df0825049171 | 253 | case 32: |
AhmedPlaymaker | 49:441c32f6603e | 254 | _stats.StatsDisplay(lcd, pad); |
AhmedPlaymaker | 56:142e9fdb77a8 | 255 | main_menu(lcd, pad); //to return to main_menu if back is pressed |
AhmedPlaymaker | 55:df0825049171 | 256 | break; |
AhmedPlaymaker | 55:df0825049171 | 257 | default: |
AhmedPlaymaker | 56:142e9fdb77a8 | 258 | main_menu(lcd, pad); //to return to main_menu if back is pressed |
AhmedPlaymaker | 55:df0825049171 | 259 | break; |
AhmedPlaymaker | 56:142e9fdb77a8 | 260 | } |
AhmedPlaymaker | 3:fbb1fa853f09 | 261 | } |
AhmedPlaymaker | 30:461231877c89 | 262 | |
AhmedPlaymaker | 49:441c32f6603e | 263 | void StartScreen::game_mode(N5110 &lcd, Gamepad &pad) |
AhmedPlaymaker | 4:1fe015b66bb8 | 264 | { |
AhmedPlaymaker | 4:1fe015b66bb8 | 265 | lcd.clear(); |
AhmedPlaymaker | 16:7b474f873683 | 266 | wait(2/cs); |
AhmedPlaymaker | 30:461231877c89 | 267 | pad.init(); |
AhmedPlaymaker | 29:c6358c39a70e | 268 | while ((pad.check_event(Gamepad::A_PRESSED) == false)&&(pad.check_event(Gamepad::START_PRESSED) == false)) { //Change this to if button pressed. |
AhmedPlaymaker | 56:142e9fdb77a8 | 269 | StartScreen::ModeOptions(lcd); //displays to the user what are the mode options |
AhmedPlaymaker | 56:142e9fdb77a8 | 270 | StartScreen::SelectMode(pad); //the mode is selected by moving joystick in this function. |
AhmedPlaymaker | 34:89f53ffc81bb | 271 | if (pad.check_event(Gamepad::BACK_PRESSED) == true) { //This is a very important process, this helps the code to not get stuck in menu loop. |
AhmedPlaymaker | 34:89f53ffc81bb | 272 | pad.tone(1000.0,0.1); |
AhmedPlaymaker | 34:89f53ffc81bb | 273 | back_pressed = 1; |
AhmedPlaymaker | 34:89f53ffc81bb | 274 | break; |
AhmedPlaymaker | 4:1fe015b66bb8 | 275 | } |
AhmedPlaymaker | 58:affb42c56cf8 | 276 | else {back_pressed = 0;} |
AhmedPlaymaker | 34:89f53ffc81bb | 277 | } |
AhmedPlaymaker | 58:affb42c56cf8 | 278 | pad.tone(1000.0,0.1); |
AhmedPlaymaker | 58:affb42c56cf8 | 279 | if (g_mode == 2) { StartScreen::motionControlInstructions(lcd); } |
AhmedPlaymaker | 34:89f53ffc81bb | 280 | if(back_pressed) { |
AhmedPlaymaker | 49:441c32f6603e | 281 | main_menu(lcd, pad); |
AhmedPlaymaker | 34:89f53ffc81bb | 282 | } |
AhmedPlaymaker | 34:89f53ffc81bb | 283 | else { |
AhmedPlaymaker | 34:89f53ffc81bb | 284 | pad.tone(1000.0,0.1); |
AhmedPlaymaker | 29:c6358c39a70e | 285 | lcd.clear(); |
AhmedPlaymaker | 49:441c32f6603e | 286 | game_speed(lcd, pad); |
AhmedPlaymaker | 34:89f53ffc81bb | 287 | } |
AhmedPlaymaker | 34:89f53ffc81bb | 288 | } |
AhmedPlaymaker | 34:89f53ffc81bb | 289 | |
AhmedPlaymaker | 56:142e9fdb77a8 | 290 | void StartScreen::ModeOptions(N5110 &lcd) |
AhmedPlaymaker | 42:973bb6036f81 | 291 | { |
AhmedPlaymaker | 34:89f53ffc81bb | 292 | lcd.clear(); |
AhmedPlaymaker | 56:142e9fdb77a8 | 293 | switch (g_mode) { |
AhmedPlaymaker | 55:df0825049171 | 294 | case 1: |
AhmedPlaymaker | 34:89f53ffc81bb | 295 | lcd.printString("Joystick",18,1); |
AhmedPlaymaker | 57:845781aea5ec | 296 | lcd.drawSprite(17,22,13,48,(int *)joystick); //Function used to draw the sprite. |
AhmedPlaymaker | 26:3495f7b0ede7 | 297 | lcd.refresh(); |
AhmedPlaymaker | 55:df0825049171 | 298 | break; |
AhmedPlaymaker | 55:df0825049171 | 299 | case 2: |
AhmedPlaymaker | 56:142e9fdb77a8 | 300 | lcd.drawSprite(10,22,13,8,(int *)navL); //Function used to draw the sprite. |
AhmedPlaymaker | 56:142e9fdb77a8 | 301 | lcd.drawSprite(65,22,13,8,(int *)navR); //Function used to draw the sprite. |
AhmedPlaymaker | 34:89f53ffc81bb | 302 | lcd.printString("Motion Control",1,1); |
AhmedPlaymaker | 56:142e9fdb77a8 | 303 | lcd.drawSprite(32,22,12,21,(int *)motionControl); //Function used to draw the sprite. |
AhmedPlaymaker | 55:df0825049171 | 304 | break; |
AhmedPlaymaker | 34:89f53ffc81bb | 305 | } |
AhmedPlaymaker | 55:df0825049171 | 306 | |
AhmedPlaymaker | 34:89f53ffc81bb | 307 | lcd.refresh(); |
AhmedPlaymaker | 4:1fe015b66bb8 | 308 | } |
AhmedPlaymaker | 34:89f53ffc81bb | 309 | |
AhmedPlaymaker | 56:142e9fdb77a8 | 310 | void StartScreen::SelectMode(Gamepad &pad) |
AhmedPlaymaker | 56:142e9fdb77a8 | 311 | { |
AhmedPlaymaker | 56:142e9fdb77a8 | 312 | Direction d = pad.get_direction(); |
AhmedPlaymaker | 56:142e9fdb77a8 | 313 | wait(1/cs); |
AhmedPlaymaker | 56:142e9fdb77a8 | 314 | if(((d==E)||(d==W))&&(g_mode==1)) { |
AhmedPlaymaker | 56:142e9fdb77a8 | 315 | g_mode=2; |
AhmedPlaymaker | 56:142e9fdb77a8 | 316 | } |
AhmedPlaymaker | 56:142e9fdb77a8 | 317 | |
AhmedPlaymaker | 56:142e9fdb77a8 | 318 | else if(((d==E)||(d==W))&&(g_mode==2)) { |
AhmedPlaymaker | 56:142e9fdb77a8 | 319 | g_mode=1; |
AhmedPlaymaker | 56:142e9fdb77a8 | 320 | } |
AhmedPlaymaker | 56:142e9fdb77a8 | 321 | } |
AhmedPlaymaker | 56:142e9fdb77a8 | 322 | |
AhmedPlaymaker | 58:affb42c56cf8 | 323 | void StartScreen::motionControlInstructions(N5110 &lcd) |
AhmedPlaymaker | 58:affb42c56cf8 | 324 | { |
AhmedPlaymaker | 58:affb42c56cf8 | 325 | lcd.clear(); |
AhmedPlaymaker | 58:affb42c56cf8 | 326 | lcd.printString("While playing the",5,0); //Function used to promt the user to start. |
AhmedPlaymaker | 58:affb42c56cf8 | 327 | lcd.printString("game, press",9,1); |
AhmedPlaymaker | 58:affb42c56cf8 | 328 | lcd.printString("A to centre",8,2); |
AhmedPlaymaker | 58:affb42c56cf8 | 329 | lcd.printString("the snake at",9,3); |
AhmedPlaymaker | 58:affb42c56cf8 | 330 | lcd.printString("prefered angle",0,4); |
AhmedPlaymaker | 58:affb42c56cf8 | 331 | lcd.refresh(); |
AhmedPlaymaker | 58:affb42c56cf8 | 332 | wait(2); |
AhmedPlaymaker | 58:affb42c56cf8 | 333 | } |
AhmedPlaymaker | 58:affb42c56cf8 | 334 | |
AhmedPlaymaker | 49:441c32f6603e | 335 | void StartScreen::game_speed(N5110 &lcd, Gamepad &pad) |
AhmedPlaymaker | 4:1fe015b66bb8 | 336 | { |
AhmedPlaymaker | 4:1fe015b66bb8 | 337 | lcd.clear(); |
AhmedPlaymaker | 29:c6358c39a70e | 338 | wait(2/cs); |
AhmedPlaymaker | 30:461231877c89 | 339 | pad.init(); |
AhmedPlaymaker | 29:c6358c39a70e | 340 | while ((pad.check_event(Gamepad::A_PRESSED) == false)&&(pad.check_event(Gamepad::START_PRESSED) == false)) { //Change this to if button pressed. |
AhmedPlaymaker | 58:affb42c56cf8 | 341 | StartScreen::selectSpeedPage(pad); |
AhmedPlaymaker | 58:affb42c56cf8 | 342 | StartScreen::showSpeedOptions(lcd); |
AhmedPlaymaker | 35:ce47cde57bd3 | 343 | if (pad.check_event(Gamepad::BACK_PRESSED) == true) { //This is a very important process, this helps the code to not get stuck in menu loop. |
AhmedPlaymaker | 35:ce47cde57bd3 | 344 | pad.tone(1000.0,0.1); |
AhmedPlaymaker | 35:ce47cde57bd3 | 345 | back_pressed = 1; |
AhmedPlaymaker | 35:ce47cde57bd3 | 346 | break; |
AhmedPlaymaker | 4:1fe015b66bb8 | 347 | } |
AhmedPlaymaker | 35:ce47cde57bd3 | 348 | else {back_pressed = 0;} |
AhmedPlaymaker | 35:ce47cde57bd3 | 349 | } |
AhmedPlaymaker | 35:ce47cde57bd3 | 350 | if(back_pressed) { |
AhmedPlaymaker | 49:441c32f6603e | 351 | game_mode(lcd, pad); |
AhmedPlaymaker | 35:ce47cde57bd3 | 352 | } |
AhmedPlaymaker | 35:ce47cde57bd3 | 353 | else { |
AhmedPlaymaker | 35:ce47cde57bd3 | 354 | pad.tone(1000.0,0.1); |
AhmedPlaymaker | 35:ce47cde57bd3 | 355 | lcd.clear(); |
AhmedPlaymaker | 35:ce47cde57bd3 | 356 | wait(1/cs); |
AhmedPlaymaker | 4:1fe015b66bb8 | 357 | } |
AhmedPlaymaker | 35:ce47cde57bd3 | 358 | } |
AhmedPlaymaker | 35:ce47cde57bd3 | 359 | |
AhmedPlaymaker | 58:affb42c56cf8 | 360 | void StartScreen::selectSpeedPage(Gamepad &pad) |
AhmedPlaymaker | 35:ce47cde57bd3 | 361 | { |
AhmedPlaymaker | 35:ce47cde57bd3 | 362 | Direction d = pad.get_direction(); |
AhmedPlaymaker | 5:e4df87957a5b | 363 | wait(1/cs); |
AhmedPlaymaker | 35:ce47cde57bd3 | 364 | if((d==E)&&(gs==4)) { |
AhmedPlaymaker | 35:ce47cde57bd3 | 365 | gs=1; |
AhmedPlaymaker | 35:ce47cde57bd3 | 366 | } |
AhmedPlaymaker | 35:ce47cde57bd3 | 367 | else if((d==W)&&(gs==1)) { |
AhmedPlaymaker | 35:ce47cde57bd3 | 368 | gs=4; |
AhmedPlaymaker | 35:ce47cde57bd3 | 369 | } |
AhmedPlaymaker | 35:ce47cde57bd3 | 370 | else if((d==E)&&(1<=gs<=3)) { |
AhmedPlaymaker | 35:ce47cde57bd3 | 371 | gs=gs+1; |
AhmedPlaymaker | 35:ce47cde57bd3 | 372 | } |
AhmedPlaymaker | 35:ce47cde57bd3 | 373 | else if((d==W)&&(2<=gs<=4)) { |
AhmedPlaymaker | 35:ce47cde57bd3 | 374 | gs=gs-1; |
AhmedPlaymaker | 35:ce47cde57bd3 | 375 | } |
AhmedPlaymaker | 35:ce47cde57bd3 | 376 | } |
AhmedPlaymaker | 35:ce47cde57bd3 | 377 | |
AhmedPlaymaker | 58:affb42c56cf8 | 378 | void StartScreen::showSpeedOptions(N5110 &lcd) |
AhmedPlaymaker | 35:ce47cde57bd3 | 379 | { |
AhmedPlaymaker | 35:ce47cde57bd3 | 380 | lcd.clear(); |
AhmedPlaymaker | 35:ce47cde57bd3 | 381 | lcd.drawSprite(10,22,13,8,(int *)navL); //Function used to draw the sprite. |
AhmedPlaymaker | 35:ce47cde57bd3 | 382 | lcd.drawSprite(65,22,13,8,(int *)navR); //Function used to draw the sprite. |
AhmedPlaymaker | 35:ce47cde57bd3 | 383 | lcd.printString("Game Speed",10,1); |
AhmedPlaymaker | 55:df0825049171 | 384 | switch (gs) { |
AhmedPlaymaker | 55:df0825049171 | 385 | case 1: |
AhmedPlaymaker | 55:df0825049171 | 386 | lcd.printString("SNAIL",28,3); |
AhmedPlaymaker | 35:ce47cde57bd3 | 387 | fps = 12; |
AhmedPlaymaker | 55:df0825049171 | 388 | break; |
AhmedPlaymaker | 55:df0825049171 | 389 | case 2: |
AhmedPlaymaker | 56:142e9fdb77a8 | 390 | lcd.printString("HUMAN",28,3); |
AhmedPlaymaker | 35:ce47cde57bd3 | 391 | fps = 18; |
AhmedPlaymaker | 55:df0825049171 | 392 | break; |
AhmedPlaymaker | 55:df0825049171 | 393 | case 3: |
AhmedPlaymaker | 56:142e9fdb77a8 | 394 | lcd.printString("HORSE",28,3); |
AhmedPlaymaker | 35:ce47cde57bd3 | 395 | fps = 22; |
AhmedPlaymaker | 55:df0825049171 | 396 | break; |
AhmedPlaymaker | 55:df0825049171 | 397 | case 4: |
AhmedPlaymaker | 35:ce47cde57bd3 | 398 | lcd.printString("CHEETHA",21,3); |
AhmedPlaymaker | 35:ce47cde57bd3 | 399 | fps = 27; |
AhmedPlaymaker | 35:ce47cde57bd3 | 400 | } |
AhmedPlaymaker | 55:df0825049171 | 401 | |
AhmedPlaymaker | 21:e41126528cc6 | 402 | lcd.refresh(); |
AhmedPlaymaker | 4:1fe015b66bb8 | 403 | } |