2022-11-28 11:04:49 +00:00
|
|
|
/**
|
|
|
|
* @file This file provides a menu class to allow the user to easily navigate the site
|
|
|
|
* @author Arlo Filley
|
|
|
|
*
|
|
|
|
* TODO:
|
|
|
|
* - more sensible button names for easier navigation
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* this class provides a menu with all the relevent buttons the user will need,
|
|
|
|
* it also handles when the user presses a button, by creating the correct screen
|
|
|
|
*/
|
2022-11-18 14:51:05 +00:00
|
|
|
class Menu {
|
|
|
|
constructor() {
|
|
|
|
this.buttons = [
|
2023-09-05 08:52:28 +01:00
|
|
|
new Button(0, 0, 200, 50, "Account"),
|
|
|
|
new Button(201, 0, 200, 50, "Test Data"),
|
|
|
|
new Button(402, 0, 200, 50, "Start Test"),
|
|
|
|
new Button(603, 0, 200, 50, "Leaderboard"),
|
|
|
|
new Button(804, 0, 200, 50, "Test Settings")
|
2022-11-18 14:51:05 +00:00
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
draw() {
|
2022-11-28 11:04:49 +00:00
|
|
|
textAlign(CENTER, CENTER);
|
2022-11-18 14:51:05 +00:00
|
|
|
for (let i = 0; i < this.buttons.length; i++) {
|
|
|
|
this.buttons[i].draw()
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.buttons[0].isPressed()) {
|
2022-11-28 11:04:49 +00:00
|
|
|
screenManager.setScreen(new AccountScreen());
|
2022-11-18 14:51:05 +00:00
|
|
|
} else if (this.buttons[1].isPressed()) {
|
|
|
|
screenManager.setScreen(new ProfileScreen());
|
2022-11-28 11:04:49 +00:00
|
|
|
} else if (this.buttons[2].isPressed()) {
|
2022-11-18 14:51:05 +00:00
|
|
|
screenManager.setScreen(new TestScreen())
|
2022-11-28 11:04:49 +00:00
|
|
|
} else if (this.buttons[3].isPressed()) {
|
2022-11-18 14:51:05 +00:00
|
|
|
screenManager.setScreen(new LeaderboardScreen())
|
2022-11-28 11:04:49 +00:00
|
|
|
} else if (this.buttons[4].isPressed()) {
|
|
|
|
screenManager.setScreen(new settingsScreen())
|
2022-11-18 14:51:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|