Adam Baker 201166301
Dependencies: mbed Gamepad N5110
Diff: Menu/Menu.cpp
- Revision:
- 43:11c5d098ce9d
- Parent:
- 41:4b20f909bbcb
diff -r 0dad7c359fa5 -r 11c5d098ce9d Menu/Menu.cpp --- a/Menu/Menu.cpp Wed May 08 16:28:13 2019 +0000 +++ b/Menu/Menu.cpp Wed May 08 22:00:17 2019 +0000 @@ -11,7 +11,9 @@ } -void Menu::init() //initialise Menu variables + +//initialise Menu variables +void Menu::init() { _select = 1; _input = 0; @@ -20,7 +22,8 @@ } -void Menu::title_intro(N5110 &lcd, Gamepad &pad) //runs intro sequence +//runs intro sequence +void Menu::title_intro(N5110 &lcd, Gamepad &pad) { intro_b(lcd, pad); intro_bl(lcd, pad); @@ -33,7 +36,9 @@ intro_block_head(lcd, pad); } -void Menu::intro_b(N5110 &lcd, Gamepad &pad) //display b with note + +//display b with note +void Menu::intro_b(N5110 &lcd, Gamepad &pad) { wait(0.5); @@ -43,7 +48,9 @@ lcd.refresh(); } -void Menu::intro_bl(N5110 &lcd, Gamepad &pad) //display bl with note + +//display bl with note +void Menu::intro_bl(N5110 &lcd, Gamepad &pad) { wait(0.2); @@ -53,7 +60,9 @@ lcd.refresh(); } -void Menu::intro_blo(N5110 &lcd, Gamepad &pad) //display blo with note + +//display blo with note +void Menu::intro_blo(N5110 &lcd, Gamepad &pad) { wait(0.4); @@ -63,7 +72,9 @@ lcd.refresh(); } -void Menu::intro_bloc(N5110 &lcd, Gamepad &pad) //display bloc with note + +//display bloc with note +void Menu::intro_bloc(N5110 &lcd, Gamepad &pad) { wait(0.4); @@ -73,7 +84,9 @@ lcd.refresh(); } -void Menu::intro_block(N5110 &lcd, Gamepad &pad) //display block with note + +//display block with note +void Menu::intro_block(N5110 &lcd, Gamepad &pad) { wait(0.2); @@ -83,7 +96,9 @@ lcd.refresh(); } -void Menu::intro_block_h(N5110 &lcd, Gamepad &pad) //display block h with note + +//display block h with note +void Menu::intro_block_h(N5110 &lcd, Gamepad &pad) { wait(0.4); @@ -93,7 +108,9 @@ lcd.refresh(); } -void Menu::intro_block_he(N5110 &lcd, Gamepad &pad) //display block he with note + +//display block he with note +void Menu::intro_block_he(N5110 &lcd, Gamepad &pad) { wait(0.133); @@ -103,7 +120,9 @@ lcd.refresh(); } -void Menu::intro_block_hea(N5110 &lcd, Gamepad &pad) //display block hea with note + +//display block hea with note +void Menu::intro_block_hea(N5110 &lcd, Gamepad &pad) { wait(0.133); @@ -113,7 +132,9 @@ lcd.refresh(); } -void Menu::intro_block_head(N5110 &lcd, Gamepad &pad) //display block head with note + +//display block head with note +void Menu::intro_block_head(N5110 &lcd, Gamepad &pad) { wait(0.133); @@ -124,7 +145,8 @@ } -int Menu::press_start(N5110 &lcd, Gamepad &pad) //flash start untill start button is pressed +//flash start untill start button is pressed +int Menu::press_start(N5110 &lcd, Gamepad &pad) { if (pad.check_event(Gamepad::START_PRESSED)) { //return 1 when start is pressed @@ -153,8 +175,8 @@ } - -int Menu::select_input_main(Gamepad &pad, N5110 &lcd) //selects input using button and joystick +//selects input using button and joystick and displays main menu +int Menu::select_input_main(Gamepad &pad, N5110 &lcd) { if (pad.check_event(Gamepad::A_PRESSED)) { //if a button pressed, @@ -188,7 +210,9 @@ return _input; } -void Menu::print_main_menu(N5110 &lcd) //prints menu class visuals + +//prints menu class visuals +void Menu::print_main_menu(N5110 &lcd) { lcd.clear(); @@ -213,7 +237,9 @@ } -void Menu::menu_decoration(N5110 &lcd) //displays animated borders for menu pages + +//displays animated borders for menu pages +void Menu::menu_decoration(N5110 &lcd) { _count++; //count increments @@ -233,7 +259,9 @@ } -int Menu::select_input_continue(Gamepad &pad, N5110 &lcd) //selects input using button and joystick + +//selects input using button and joystick +int Menu::select_input_continue(Gamepad &pad, N5110 &lcd) { if (pad.check_event(Gamepad::A_PRESSED)) { //if a button pressed, @@ -267,7 +295,9 @@ return _input; } -void Menu::print_continue_menu(N5110 &lcd) //prints continues menu's visuals + +//prints continues menu's visual +void Menu::print_continue_menu(N5110 &lcd) { lcd.clear(); @@ -289,7 +319,9 @@ } -void Menu::print_highscore(N5110 &lcd, int highscore) //prints highscore menu + +//prints highscore menu +void Menu::print_highscore(N5110 &lcd, int highscore) { lcd.clear(); @@ -307,7 +339,9 @@ } -float Menu::print_settings(Gamepad &pad, N5110 &lcd) //prints settings menu + +//prints settings menu +float Menu::print_settings(Gamepad &pad, N5110 &lcd) { lcd.clear(); @@ -365,6 +399,8 @@ } + + void Menu::BL(int x, int y, N5110 &lcd) //prints BL sprite { @@ -397,6 +433,9 @@ } + + + void Menu::BLO(int x, int y, N5110 &lcd) //prints BLO sprite { @@ -429,6 +468,9 @@ } + + + void Menu::BLOC(int x, int y, N5110 &lcd) //prints BLOC sprite { @@ -461,6 +503,9 @@ } + + + void Menu::BLOCK(int x, int y, N5110 &lcd) //prints BLOCK sprite { @@ -527,6 +572,9 @@ } + + + void Menu::BLOCK_HE(int x, int y, N5110 &lcd) //prints BLOCK HE sprite { @@ -559,6 +607,9 @@ } + + + void Menu::BLOCK_HEA(int x, int y, N5110 &lcd) //prints BLOCK HEA sprite { @@ -591,6 +642,9 @@ } + + + void Menu::BLOCK_HEAD(int x, int y, N5110 &lcd) //prints BLOCK HEAD sprite {