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
Fork of el17ajf by
Menus/ScoresMenu/ScoresMenu.cpp
- Committer:
- el17ajf
- Date:
- 2019-04-12
- Revision:
- 28:e09b7ac11dea
- Parent:
- 27:2ed9e3c9f4e9
- Child:
- 29:d59fbe128d1f
File content as of revision 28:e09b7ac11dea:
#include "ScoresMenu.h" #include "Prefs.h" Menus::ScoresMenu::ScoresMenu() { int highscores[3]; int players[3]; players[0] = Prefs::getInstance()->getKey(Prefs::HIGHSCORE1_PLAYER); players[1] = Prefs::getInstance()->getKey(Prefs::HIGHSCORE2_PLAYER); players[2] = Prefs::getInstance()->getKey(Prefs::HIGHSCORE3_PLAYER); highscores[0] = Prefs::getInstance()->getKey(Prefs::HIGHSCORE1); highscores[1] = Prefs::getInstance()->getKey(Prefs::HIGHSCORE2); highscores[2] = Prefs::getInstance()->getKey(Prefs::HIGHSCORE3); for (int i = 0; i < 3; i++) { if (players[i] == Prefs::EMPTY) { sprintf(playersLables[i], "%1d. ---", i + 1); sprintf(highscoresLabels[i], " "); } else { sprintf(playersLables[i], "%1d.PLYR %2d", i + 1, players[i]); sprintf(highscoresLabels[i], " %4dPTS", highscores[i]); } } } void Menus::ScoresMenu::updateAndDraw(UI * ui) { ui->drawTitle("hi scores"); ui->newLine(); for (int i = 0; i < 3; i++) { ui->drawLabel(playersLables[i]); ui->drawLabel(highscoresLabels[i]); } if (ui->drawAndCheckButton("back")) { close(); } }