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.
Diff: Menu/Menu.cpp
- Revision:
- 9:fe86ddbf7799
- Parent:
- 8:9d01fd4a63ad
- Child:
- 10:279d3775d52c
--- a/Menu/Menu.cpp Sun May 06 20:17:50 2018 +0000 +++ b/Menu/Menu.cpp Sun May 06 20:49:48 2018 +0000 @@ -13,25 +13,37 @@ void Menu::init() { + _start = false; -/* - bool _start = false; - - int _selection = 1; - - lcd.clear(); - - while (!_start) { + _selection = 1; +} - lcd.printString(" Normal",0,1); - lcd.printString(" Level",0,2); - lcd.printString(" Options",0,3); +void Menu::update() +{ + if (_d == N && _selection > 1) { //checks the menu arrow location + _selection -= 1; + } else if (_d == S && _selection < 3) { + _selection += 1; + } - lcd.printString(" >",0,_selection); - - wait(0.1); - lcd.refresh(); - } - */ + } +void Menu::read_input(Gamepad &pad) +{ + _d = pad.get_direction(); +} + +void Menu::draw(N5110 &lcd) +{ + lcd.printString(" Start",0,1); + lcd.printString(" Level Select",0,2); + lcd.printString(" Difficulty",0,3); + + lcd.printString(" >",0,_selection); +} + +bool Menu::started() +{ + return _start; +}