diff --git a/website/api/api.js b/website/api/api.js index 7c67b70..44835b2 100644 --- a/website/api/api.js +++ b/website/api/api.js @@ -39,10 +39,10 @@ class API { * Validates all the parameters used for the postTest function which it then calls */ validateTest() { - const test = textbox.getLetters(); + const test = screenManager.textbox.getLetters(); const testType = "words"; let testLength = test.length; - let testTime = timer.getTime(); + let testTime = screenManager.timer.getTime(); const testSeed = 0; const quoteId = 0; let wpm; diff --git a/website/screens/endscreen.js b/website/screens/endscreen.js index e69de29..ebf1d29 100644 --- a/website/screens/endscreen.js +++ b/website/screens/endscreen.js @@ -0,0 +1,13 @@ +class EndScreen { + constructor() { + screenManager.textbox = new Textbox(0,0,0,0,0,false,"#000", false, "#000", "#000"); + } + + draw() { + background("#eeeee4"); + textSize(100); + textAlign(CENTER, CENTER); + fill(0); + text("Test Complete\nPress enter to start another test", 0, 0, windowWidth - 100, windowHeight - 100); + } +} \ No newline at end of file diff --git a/website/ui_elements/textbox.js b/website/ui_elements/textbox.js index b57f13c..c44873b 100644 --- a/website/ui_elements/textbox.js +++ b/website/ui_elements/textbox.js @@ -109,8 +109,7 @@ class Textbox { } letterTyped(pKey) { - console.log(pKey); - if (pKey === "Enter" && screenManager.screen.constructor.name === "StartScreen") { + if (pKey === "Enter" && (screenManager.screen.constructor.name === "StartScreen" || screenManager.screen.constructor.name === "EndScreen")) { screenManager.setScreen(new TestScreen()); return; } @@ -146,12 +145,19 @@ class Textbox { draw() { // doesn't render the textbox if it should not be visible to the user. - if (this.visible === false) { + if (!this.visible) { return; } + + noStroke(); + // sets a border if there should be one + if (this.border) { + stroke(this.borderColor); + strokeWeight(1); + } // sets the parameters of what the text should look like; - color(this.textColor); + fill(this.textColor); textSize(23); textAlign(LEFT); // font needs to be monospaced for outputting text to the screen like I do diff --git a/website/ui_elements/timer.js b/website/ui_elements/timer.js index 0d64285..2809e7e 100644 --- a/website/ui_elements/timer.js +++ b/website/ui_elements/timer.js @@ -158,6 +158,7 @@ class Timer { this.time = 0; // Then this function will call all other functions necessary to complete the test // this will likely including changing the screen and interacting with the api + screenManager.setScreen(new EndScreen()); } /**