2022-10-11 09:45:40 +01:00
|
|
|
class StartScreen {
|
|
|
|
constructor() {
|
2022-11-11 19:54:52 +00:00
|
|
|
this.buttons = [
|
|
|
|
new Button(0,0,100,30,0,true,"#fff",false,"#000","#000","Sign Up"),
|
|
|
|
new Button(110,0,100,30,0,true,"#fff",false,"#000","#000","Login"),
|
|
|
|
new Button(220,0,100,30,0,true,"#fff",false,"#000","#000","Logout"),
|
2022-11-17 11:48:12 +00:00
|
|
|
new Button(330,0,100,30,0,true,"#fff",false,"#000","#000","Profile")
|
2022-11-11 19:54:52 +00:00
|
|
|
]
|
2022-10-11 09:45:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
draw() {
|
|
|
|
background("#eeeee4");
|
|
|
|
textSize(100);
|
|
|
|
textAlign(CENTER, CENTER);
|
2022-11-11 13:04:13 +00:00
|
|
|
fill("#000");
|
2022-10-11 09:45:40 +01:00
|
|
|
text("Press enter to start test", 0, 0, windowWidth - 100, windowHeight - 100);
|
2022-11-11 13:04:13 +00:00
|
|
|
this.buttons[0].draw();
|
2022-11-11 19:54:52 +00:00
|
|
|
this.buttons[1].draw();
|
|
|
|
this.buttons[2].draw();
|
2022-11-17 11:48:12 +00:00
|
|
|
this.buttons[3].draw();
|
2022-11-11 13:04:13 +00:00
|
|
|
if (this.buttons[0].isPressed()) {
|
|
|
|
screenManager.setScreen(new SignUpScreen());
|
2022-11-11 19:54:52 +00:00
|
|
|
} else if (this.buttons[1].isPressed()) {
|
|
|
|
screenManager.setScreen(new LoginScreen());
|
|
|
|
} else if (this.buttons[2].isPressed()) {
|
|
|
|
api.logout();
|
2022-11-17 11:48:12 +00:00
|
|
|
} else if (this.buttons[3].isPressed()) {
|
|
|
|
screenManager.setScreen(new ProfileScreen());
|
|
|
|
}
|
2022-11-11 19:54:52 +00:00
|
|
|
fill("#000");
|
|
|
|
text(`${user.username}`, windowWidth-100, 15);
|
2022-11-11 13:04:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
letterTyped(key) {
|
|
|
|
if (key === "Enter") {
|
|
|
|
screenManager.setScreen(new TestScreen());
|
|
|
|
}
|
2022-10-11 09:45:40 +01:00
|
|
|
}
|
|
|
|
}
|