diff --git a/.DS_Store b/.DS_Store index 1b16b2c..1a42b15 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/src/main.rs b/src/main.rs index 4a39804..6902199 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,8 +6,8 @@ pub mod sql; #[get("/")] fn test() -> String { sql::create_database() - .expect(&format!("couldn't create database")); - format!("Hello world") + .expect("couldn't create database"); + String::from("Hello World!") } #[derive(Deserialize)] @@ -45,5 +45,5 @@ fn rocket() -> Rocket { rocket::build() .mount("/test", routes![test]) // testing only, should return "Hello world" .mount("/api", routes![post_test]) - .mount("/", FileServer::from(relative!("website"))) // hosts the fileserver + .mount("/typing", FileServer::from(relative!("website"))) // hosts the fileserver } \ No newline at end of file diff --git a/website/.DS_Store b/website/.DS_Store new file mode 100644 index 0000000..c2f8851 Binary files /dev/null and b/website/.DS_Store differ diff --git a/website/index.html b/website/index.html index d2facd9..58f4341 100644 --- a/website/index.html +++ b/website/index.html @@ -11,10 +11,11 @@ + + - diff --git a/website/ui_elements/textbox.js b/website/ui_elements/textbox.js index c44873b..dfc1e85 100644 --- a/website/ui_elements/textbox.js +++ b/website/ui_elements/textbox.js @@ -1,4 +1,17 @@ class Textbox { + /** + * Creates a new instance of the Textbox class + * @param {int} pX + * @param {int} pY + * @param {int} pWidth + * @param {int} pHeight + * @param {int} pLayer + * @param {bool} pVisible + * @param {hexcode} pTextColor + * @param {bool} pBorder + * @param {hexcode} pBorderColor + * @param {hexcode} pBackgroundColor + */ constructor(pX, pY, pWidth, pHeight, pLayer, pVisible, pTextColor, pBorder, pBorderColor, pBackgroundColor) { this.x = pX; this.y = pY; @@ -108,13 +121,22 @@ class Textbox { this.letters = pLetters; } + /** + * takes a key and handles it in the textbox + * @param {String} pKey + * @returns + */ letterTyped(pKey) { - if (pKey === "Enter" && (screenManager.screen.constructor.name === "StartScreen" || screenManager.screen.constructor.name === "EndScreen")) { + if (pKey === "Enter" && (screenManager.screen.constructor.name === "StartScreen" /* || screenManager.screen.constructor.name === "EndScreen" */)) { screenManager.setScreen(new TestScreen()); return; } - if (pKey === "Backspace" && this.letters.length > 1) { + if (screenManager.timer.time === 0) { + return; + } + + if (pKey === "Backspace" && this.letters.length > 0) { this.letters.pop(); return; } @@ -143,6 +165,10 @@ class Textbox { this.allowedLetters = pAllowedLetters; } + /** + * draws a Textbox + * @returns + */ draw() { // doesn't render the textbox if it should not be visible to the user. if (!this.visible) { diff --git a/website/ui_elements/timemenu.js b/website/ui_elements/timemenu.js new file mode 100644 index 0000000..2eb52ca --- /dev/null +++ b/website/ui_elements/timemenu.js @@ -0,0 +1,5 @@ +class TimeMenu { + constructor() { + + } +} \ No newline at end of file