From e8bec588278d4dfb5e5de7d8fb5e7a2eb14dbd5b Mon Sep 17 00:00:00 2001 From: Arlo Filley Date: Fri, 25 Nov 2022 14:49:05 +0000 Subject: [PATCH] added usability changes --- src/main.rs | 4 ++++ website/index.css | 25 +++++++++++++++++++++++++ website/index.html | 6 ++++-- website/index.js | 36 +++++++++++++++++++++++++++++------- 4 files changed, 62 insertions(+), 9 deletions(-) create mode 100644 website/index.css diff --git a/src/main.rs b/src/main.rs index 340536c..3d0d16b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,7 @@ +//! src/main.rs +//! This file launches the web server which hosts the fileserver and the api +//! + pub mod sql; // relevant macros and imports for rocket.rs diff --git a/website/index.css b/website/index.css new file mode 100644 index 0000000..144d829 --- /dev/null +++ b/website/index.css @@ -0,0 +1,25 @@ +/* +Index.css +Description: This file is the stylesheet for the html that the + user will see if they do not have javascript enabled. +Author: Arlo Filley +*/ + +:root { + --background-color: #dde83d; + --text-color: #000000; + --font: Verdana, Geneva, Tahoma, sans-serif; +} + +body { + background-color: var(--background-color); +} + +noscript { + display: block; + text-align: center; + + font-family: var(--font); + color: var(--text-color); + font-size: large; +} \ No newline at end of file diff --git a/website/index.html b/website/index.html index 8d1f912..fceda9e 100644 --- a/website/index.html +++ b/website/index.html @@ -6,6 +6,9 @@ TypeFast + + + @@ -13,7 +16,6 @@ - @@ -40,6 +42,6 @@ - + \ No newline at end of file diff --git a/website/index.js b/website/index.js index bb29d32..91736fe 100644 --- a/website/index.js +++ b/website/index.js @@ -1,11 +1,24 @@ +/** + * @file This files is the root of the website. + * @author Arlo Filley + */ + let canvas, api, screenManager, user; +/** + * loads the any assets before the setup function + * this allows p5.js to acess these assets including: sprites, + * fonts, etc +*/ function preload() { roboto = loadFont('./assets/fonts/RobotoMono-Medium.ttf'); } +/** + * defines variables and sets up the p5.js canvas + * ready to be drawn with using the draw() function +*/ function setup() { - // Creating the canvas canvas = new Canvas(); canvas.resize(); canvas.center(); @@ -17,25 +30,34 @@ function setup() { screenManager.setScreen(new StartScreen()); user = new User(); - // will log the user in if there details are in local storage api.login(); api.getTest(); textFont(roboto); } -// this function is called once per frame and draws all other elements + +/** + * called once per frame. draws all other elements onto the canvas + * mostly will just call the screenManager.draw() method to make + * sure that the correct screen is being drawn +*/ function draw() { screenManager.draw(); } - -// whenever a key is pressed this function is called +/** + * called whenever a key is pressed, the variable key contains the + * key that the user last pressed +*/ function keyPressed() { screenManager.letterTyped(key); } -// This ensures that the canvas is always the correct size and at the center -// of the screen, p5 calls windowResized whenever the browser size is changed. + +/** + * called whenever the user resizes the window. Uses methods from the canvas wrapper class + * to resize and center the canvas such that it displays correctly +*/ function windowResized() { canvas.resize(); canvas.center();