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.
HighScores Class Reference
HighScores Class. More...
#include <HighScores.h>
Public Member Functions | |
| HighScores () | |
| HighScores Constructor. | |
| ~HighScores () | |
| HighScores Destructor. | |
| void | highscores_run (Gamepad &pad, N5110 &lcd, Banana &banana) |
| Controls the Highscores menu. | |
| void | highscores_new (Gamepad &pad, N5110 &lcd, Banana &banana) |
| Adds a new highscore. | |
| void | highscores_list (Gamepad &pad, N5110 &lcd, Banana &banana) |
| Lists all current highscores. | |
Detailed Description
HighScores Class.
This class is keeping track of any highscores.
- Version:
- 1.0
- Date:
- May 2019
Definition at line 22 of file HighScores.h.
Constructor & Destructor Documentation
| HighScores | ( | ) |
HighScores Constructor.
Builds my default highscores constructor.
This does not have any setup.
Definition at line 10 of file HighScores.cpp.
| ~HighScores | ( | ) |
HighScores Destructor.
Builds my default highscores destructor.
This does not have any setup.
Definition at line 16 of file HighScores.cpp.
Member Function Documentation
Lists all current highscores.
- Parameters:
-
pad The Gamepad class is used. lcd The N5110 class is used. banana The Banana class is used.
- Returns:
- None.
Keeps and prints a list of all highscores.
void HighScores::highscores_list(Gamepad &pad, N5110 &lcd, Banana &banana){ lcd.printString("1st:",0,2); lcd.printString("2nd:",0,3); lcd.printString("3rd:",0,4); lcd.printString("4th:",0,5); char buffer1[14]; // Shows 1st highscore on screen. sprintf(buffer1,"%i",HighScore_1); lcd.printString(buffer1,40,2); char buffer2[14]; // Shows 2nd highscore on screen. sprintf(buffer2,"%i",HighScore_2); lcd.printString(buffer2,40,3); char buffer3[14]; // Shows 3rd highscore on screen. sprintf(buffer3,"%i",HighScore_3); lcd.printString(buffer3,40,4); char buffer4[14]; // Shows 4th highscore on screen. sprintf(buffer4,"%i",HighScore_4); lcd.printString(buffer4,40,5); lcd.refresh(); }
Definition at line 57 of file HighScores.cpp.
Adds a new highscore.
- Parameters:
-
pad The Gamepad class is used. lcd The N5110 class is used. banana The Banana class is used.
- Returns:
- None.
Edits various highscores based on if player has scored a new record.
void HighScores::highscores_new(Gamepad &pad, N5110 &lcd, Banana &banana) { if (score >= HighScore_1) { HighScore_1 = score; } else if (score >= HighScore_2) { HighScore_2 = score; } else if (score >= HighScore_3) { HighScore_3 = score; } else if (score >= HighScore_4) { HighScore_4 = score; } }
Definition at line 41 of file HighScores.cpp.
Controls the Highscores menu.
- Parameters:
-
pad The Gamepad class is used. lcd The N5110 class is used. banana The Banana class is used.
- Returns:
- None.
Prints the High Score Menu.
void HighScores::highscores_run(Gamepad &pad, N5110 &lcd, Banana &banana) { wait_ms(250); while (pad.check_event(Gamepad::BACK_PRESSED) == false) { // Continues to show this screen until BACK button pressed. //printf("High Score State"); lcd.clear(); lcd.printString("High Scores",12,0); highscores_list(pad, lcd, banana); lcd.refresh(); wait_ms(1.0f/24); } }
Definition at line 28 of file HighScores.cpp.
Generated on Tue Jul 12 2022 18:21:51 by
1.7.2