2022-11-28 11:04:49 +00:00
|
|
|
/**
|
|
|
|
* @file This file provides the functionality for the test
|
|
|
|
* @author Arlo Filley
|
|
|
|
*
|
|
|
|
* TODO:
|
|
|
|
* - provide a button that allows the user to exit the test
|
|
|
|
* - provide a count down to the start of a test
|
|
|
|
* - implement menus to allow the user to control the parameters of a test
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* this class displays the text of the test to the the screen and then takes input from the user
|
|
|
|
* displaying red if it is inaccurate, and green if it is
|
|
|
|
*/
|
2022-10-11 09:45:40 +01:00
|
|
|
class TestScreen {
|
|
|
|
constructor() {
|
2022-11-18 12:27:54 +00:00
|
|
|
this.textbox = new Textbox(100,100,windowWidth - 200,windowHeight,0,true,"#000", false, "#000", "#000", true, true);
|
2022-11-28 11:04:49 +00:00
|
|
|
this.timer = new Timer(0,0,windowWidth,50,0,true,"#fff", true, "#000", "#666", user.time, true);
|
|
|
|
this.timer.start();
|
2022-10-11 09:45:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
draw() {
|
|
|
|
background("#eeeee4");
|
2022-11-11 13:04:13 +00:00
|
|
|
this.textbox.draw();
|
2022-11-28 11:04:49 +00:00
|
|
|
this.timer.draw();
|
|
|
|
this.timer.tick();
|
2022-10-11 09:45:40 +01:00
|
|
|
}
|
2022-11-11 13:04:13 +00:00
|
|
|
|
|
|
|
letterTyped(key) {
|
|
|
|
this.textbox.letterTyped(key);
|
|
|
|
}
|
2022-10-11 09:45:40 +01:00
|
|
|
}
|