2022-11-28 11:04:49 +00:00
|
|
|
/**
|
|
|
|
* @file This file provides a screen class that can be displayed at the end of a test
|
|
|
|
* @author Arlo Filley
|
|
|
|
*
|
|
|
|
* TODO:
|
|
|
|
* - provide the user with the data of the test that they have just
|
|
|
|
* completed, such as their wpm, accuracy, etc.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This class is for a screen that is displayed at the end of a test,
|
|
|
|
* currently it just tells the user to press start to enter another test
|
|
|
|
*/
|
2022-10-11 10:29:40 +01:00
|
|
|
class EndScreen {
|
|
|
|
constructor() {
|
2022-11-18 14:51:05 +00:00
|
|
|
this.menu = new Menu();
|
2022-10-11 10:29:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
draw() {
|
|
|
|
textSize(100);
|
|
|
|
textAlign(CENTER, CENTER);
|
2022-12-01 14:41:14 +00:00
|
|
|
fill(user.colorScheme.text);
|
2022-11-28 11:04:49 +00:00
|
|
|
text("Test Complete", 0, 0, windowWidth - 100, windowHeight / 6);
|
|
|
|
|
|
|
|
textSize(30);
|
|
|
|
text(`${user.lastTest.wpm} words per minute`, windowWidth / 2, 200);
|
|
|
|
text(`${user.lastTest.accuracy}% accuracy`, windowWidth / 2, 240);
|
|
|
|
text(`${user.lastTest.test_length} characters typed`, windowWidth / 2, 280);
|
|
|
|
text(`${user.lastTest.test_time}s`, windowWidth / 2, 320);
|
2022-11-18 14:51:05 +00:00
|
|
|
this.menu.draw();
|
2022-10-11 10:29:40 +01:00
|
|
|
}
|
2022-11-11 19:54:52 +00:00
|
|
|
|
2022-11-18 11:33:25 +00:00
|
|
|
letterTyped(key) {
|
2022-11-18 14:51:05 +00:00
|
|
|
if (key === "Enter") screenManager.setScreen(new TestScreen());
|
2022-11-11 19:54:52 +00:00
|
|
|
}
|
2022-10-11 10:29:40 +01:00
|
|
|
}
|