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
Diff: Menu/Menu.cpp
- Revision:
- 13:bcf6bb69c597
- Parent:
- 12:ebaefda53dd0
- Child:
- 14:9861fe85c803
--- a/Menu/Menu.cpp Mon Apr 01 18:06:55 2019 +0000 +++ b/Menu/Menu.cpp Wed Apr 03 13:42:58 2019 +0000 @@ -1,9 +1,9 @@ #include "Menu.h" State _fsm[3] = { - {0,{0,1,0,1}}, + {0,{0,1,0,0}}, {1,{1,1,0,2}}, - {2,{2,1,2,1}} + {2,{2,1,2,0}} }; Menu::Menu() {} @@ -17,7 +17,8 @@ void Menu::run(N5110 &lcd, Gamepad &gamepad) { set_input(gamepad.check_event(Gamepad::START_PRESSED), - gamepad.check_event(Gamepad::BACK_PRESSED)); + gamepad.check_event(Gamepad::BACK_PRESSED), + gamepad.check_event(Gamepad::X_PRESSED)); _output = _fsm[_state].output; output(lcd, gamepad); _state = _fsm[_state].next_state[_menu_input]; @@ -33,14 +34,14 @@ } } -void Menu::set_input(bool start, bool back) { - if (!start && !back) { +void Menu::set_input(bool start, bool back, bool x) { + if (!start && !back && !x) { _menu_input = 0; } else if (!start && back) { _menu_input = 1; } else if (start && !back) { _menu_input = 2; - } else { + } else if (x) { _menu_input = 3; } } @@ -49,8 +50,18 @@ _controller.run_game_engine(lcd, gamepad); } -void Menu::display_controls(N5110 &lcd, Gamepad &gamepad) {} +void Menu::display_controls(N5110 &lcd, Gamepad &gamepad) { + lcd.printString("JOYSTICK:",0,0); + lcd.printString("-Move left",0,1); + lcd.printString("-Move right",0,2); + lcd.printString("-Duck",0,3); + lcd.printString("A:",0,4); + lcd.printString("-Jump (back)",0,5); +} void Menu::display_menu(N5110 &lcd, Gamepad &gamepad) { - _controller.init(); + _controller.init(); + lcd.printString("Menu",30,0); + lcd.printString("START- Play!",0,1); + lcd.printString("X- Controls",0,2); } \ No newline at end of file