Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Menu/Menu.cpp
- Committer:
- S_Tingle
- Date:
- 2019-05-08
- Revision:
- 17:ce6b54422113
- Parent:
- 16:37d98c281eb3
- Child:
- 18:ba4159ab4da7
File content as of revision 17:ce6b54422113:
#include "Menu.h"
Menu::Menu(){
}
Menu::~Menu(){
}
void Menu::init(){
}
void Menu::main(N5110 &lcd,Gamepad &pad){
play = false;
while (play == false) {
lcd.clear();
lcd.printString("NEW GAME(X)",10,1);
lcd.printString("GAME INFO(Y)",10,2);
lcd.printString("CREDITS(B)",10,3);
lcd.refresh();
newGame(lcd,pad);
wait_ms(1000/60);
}
}
void Menu::newGame(N5110 &lcd,Gamepad &pad){
if (pad.check_event(Gamepad::X_PRESSED) == true){
play = true;
} else if (pad.check_event(Gamepad::Y_PRESSED) == true){
info(lcd,pad);
} else if(pad.check_event(Gamepad::B_PRESSED) == true){
credits(lcd,pad);
} else {
play = false;
}
}
void Menu::info(N5110 &lcd,Gamepad &pad){
while (pad.check_event(Gamepad::L_PRESSED) == false){
lcd.clear();
lcd.printString("MOVE(J-STICK)",5,1);
lcd.printString("TONE:-1 LIFE",5,2);
lcd.printString("5 LIVES",20,3);
lcd.printString("COLLECT COINS",3,4);
lcd.refresh();
if (pad.check_event(Gamepad::X_PRESSED) == true){
}
if (pad.check_event(Gamepad::Y_PRESSED) == true){
}
if (pad.check_event(Gamepad::B_PRESSED) == true){
}
}
}
void Menu::credits(N5110 &lcd,Gamepad &pad){
while (pad.check_event(Gamepad::L_PRESSED) == false){
lcd.clear();
lcd.printString("WRITTEN, DIRECTED AND PRODUCED BY",10,2);
lcd.printString("SPENCER",10,3);
lcd.printString("TINGLE",10,4);
lcd.refresh();
if (pad.check_event(Gamepad::X_PRESSED) == true){
}
if (pad.check_event(Gamepad::Y_PRESSED) == true){
}
if (pad.check_event(Gamepad::B_PRESSED) == true){
}
}
}