diff --git a/.VSCodeCounter/2022-11-18_12-24-29/details.md b/.VSCodeCounter/2022-11-18_12-24-29/details.md
deleted file mode 100644
index ed43d2a..0000000
--- a/.VSCodeCounter/2022-11-18_12-24-29/details.md
+++ /dev/null
@@ -1,19 +0,0 @@
-# Details
-
-Date : 2022-11-18 12:24:29
-
-Directory /home/arlo/code/cs_coursework
-
-Total : 4 files, 320 codes, 0 comments, 41 blanks, all 361 lines
-
-[Summary](results.md) / Details / [Diff Summary](diff.md) / [Diff Details](diff-details.md)
-
-## Files
-| filename | language | code | comment | blank | total |
-| :--- | :--- | ---: | ---: | ---: | ---: |
-| [Cargo.toml](/Cargo.toml) | TOML | 9 | 0 | 2 | 11 |
-| [Rocket.toml](/Rocket.toml) | TOML | 25 | 0 | 3 | 28 |
-| [src/main.rs](/src/main.rs) | Rust | 87 | 0 | 10 | 97 |
-| [src/sql.rs](/src/sql.rs) | Rust | 199 | 0 | 26 | 225 |
-
-[Summary](results.md) / Details / [Diff Summary](diff.md) / [Diff Details](diff-details.md)
\ No newline at end of file
diff --git a/.VSCodeCounter/2022-11-18_12-24-29/diff-details.md b/.VSCodeCounter/2022-11-18_12-24-29/diff-details.md
deleted file mode 100644
index 6296cb1..0000000
--- a/.VSCodeCounter/2022-11-18_12-24-29/diff-details.md
+++ /dev/null
@@ -1,15 +0,0 @@
-# Diff Details
-
-Date : 2022-11-18 12:24:29
-
-Directory /home/arlo/code/cs_coursework
-
-Total : 0 files, 0 codes, 0 comments, 0 blanks, all 0 lines
-
-[Summary](results.md) / [Details](details.md) / [Diff Summary](diff.md) / Diff Details
-
-## Files
-| filename | language | code | comment | blank | total |
-| :--- | :--- | ---: | ---: | ---: | ---: |
-
-[Summary](results.md) / [Details](details.md) / [Diff Summary](diff.md) / Diff Details
\ No newline at end of file
diff --git a/.VSCodeCounter/2022-11-18_12-24-29/diff.csv b/.VSCodeCounter/2022-11-18_12-24-29/diff.csv
deleted file mode 100644
index b7d8d75..0000000
--- a/.VSCodeCounter/2022-11-18_12-24-29/diff.csv
+++ /dev/null
@@ -1,2 +0,0 @@
-"filename", "language", "", "comment", "blank", "total"
-"Total", "-", , 0, 0, 0
\ No newline at end of file
diff --git a/.VSCodeCounter/2022-11-18_12-24-29/diff.md b/.VSCodeCounter/2022-11-18_12-24-29/diff.md
deleted file mode 100644
index fbd9480..0000000
--- a/.VSCodeCounter/2022-11-18_12-24-29/diff.md
+++ /dev/null
@@ -1,19 +0,0 @@
-# Diff Summary
-
-Date : 2022-11-18 12:24:29
-
-Directory /home/arlo/code/cs_coursework
-
-Total : 0 files, 0 codes, 0 comments, 0 blanks, all 0 lines
-
-[Summary](results.md) / [Details](details.md) / Diff Summary / [Diff Details](diff-details.md)
-
-## Languages
-| language | files | code | comment | blank | total |
-| :--- | ---: | ---: | ---: | ---: | ---: |
-
-## Directories
-| path | files | code | comment | blank | total |
-| :--- | ---: | ---: | ---: | ---: | ---: |
-
-[Summary](results.md) / [Details](details.md) / Diff Summary / [Diff Details](diff-details.md)
\ No newline at end of file
diff --git a/.VSCodeCounter/2022-11-18_12-24-29/diff.txt b/.VSCodeCounter/2022-11-18_12-24-29/diff.txt
deleted file mode 100644
index b807794..0000000
--- a/.VSCodeCounter/2022-11-18_12-24-29/diff.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-Date : 2022-11-18 12:24:29
-Directory : /home/arlo/code/cs_coursework
-Total : 0 files, 0 codes, 0 comments, 0 blanks, all 0 lines
-
-Languages
-+----------+------------+------------+------------+------------+------------+
-| language | files | code | comment | blank | total |
-+----------+------------+------------+------------+------------+------------+
-+----------+------------+------------+------------+------------+------------+
-
-Directories
-+------+------------+------------+------------+------------+------------+
-| path | files | code | comment | blank | total |
-+------+------------+------------+------------+------------+------------+
-+------+------------+------------+------------+------------+------------+
-
-Files
-+----------+----------+------------+------------+------------+------------+
-| filename | language | code | comment | blank | total |
-+----------+----------+------------+------------+------------+------------+
-| Total | | 0 | 0 | 0 | 0 |
-+----------+----------+------------+------------+------------+------------+
\ No newline at end of file
diff --git a/.VSCodeCounter/2022-11-18_12-24-29/results.csv b/.VSCodeCounter/2022-11-18_12-24-29/results.csv
deleted file mode 100644
index 3cf4b9b..0000000
--- a/.VSCodeCounter/2022-11-18_12-24-29/results.csv
+++ /dev/null
@@ -1,6 +0,0 @@
-"filename", "language", "TOML", "Rust", "comment", "blank", "total"
-"/home/arlo/code/cs_coursework/Cargo.toml", "TOML", 9, 0, 0, 2, 11
-"/home/arlo/code/cs_coursework/Rocket.toml", "TOML", 25, 0, 0, 3, 28
-"/home/arlo/code/cs_coursework/src/main.rs", "Rust", 0, 87, 0, 10, 97
-"/home/arlo/code/cs_coursework/src/sql.rs", "Rust", 0, 199, 0, 26, 225
-"Total", "-", 34, 286, 0, 41, 361
\ No newline at end of file
diff --git a/.VSCodeCounter/2022-11-18_12-24-29/results.json b/.VSCodeCounter/2022-11-18_12-24-29/results.json
deleted file mode 100644
index 56673ba..0000000
--- a/.VSCodeCounter/2022-11-18_12-24-29/results.json
+++ /dev/null
@@ -1 +0,0 @@
-{"file:///home/arlo/code/cs_coursework/Cargo.toml":{"language":"TOML","code":9,"comment":0,"blank":2},"file:///home/arlo/code/cs_coursework/Rocket.toml":{"language":"TOML","code":25,"comment":0,"blank":3},"file:///home/arlo/code/cs_coursework/src/sql.rs":{"language":"Rust","code":199,"comment":0,"blank":26},"file:///home/arlo/code/cs_coursework/src/main.rs":{"language":"Rust","code":87,"comment":0,"blank":10}}
\ No newline at end of file
diff --git a/.VSCodeCounter/2022-11-18_12-24-29/results.md b/.VSCodeCounter/2022-11-18_12-24-29/results.md
deleted file mode 100644
index 4c461ca..0000000
--- a/.VSCodeCounter/2022-11-18_12-24-29/results.md
+++ /dev/null
@@ -1,23 +0,0 @@
-# Summary
-
-Date : 2022-11-18 12:24:29
-
-Directory /home/arlo/code/cs_coursework
-
-Total : 4 files, 320 codes, 0 comments, 41 blanks, all 361 lines
-
-Summary / [Details](details.md) / [Diff Summary](diff.md) / [Diff Details](diff-details.md)
-
-## Languages
-| language | files | code | comment | blank | total |
-| :--- | ---: | ---: | ---: | ---: | ---: |
-| Rust | 2 | 286 | 0 | 36 | 322 |
-| TOML | 2 | 34 | 0 | 5 | 39 |
-
-## Directories
-| path | files | code | comment | blank | total |
-| :--- | ---: | ---: | ---: | ---: | ---: |
-| . | 4 | 320 | 0 | 41 | 361 |
-| src | 2 | 286 | 0 | 36 | 322 |
-
-Summary / [Details](details.md) / [Diff Summary](diff.md) / [Diff Details](diff-details.md)
\ No newline at end of file
diff --git a/.VSCodeCounter/2022-11-18_12-24-29/results.txt b/.VSCodeCounter/2022-11-18_12-24-29/results.txt
deleted file mode 100644
index b072b08..0000000
--- a/.VSCodeCounter/2022-11-18_12-24-29/results.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-Date : 2022-11-18 12:24:29
-Directory : /home/arlo/code/cs_coursework
-Total : 4 files, 320 codes, 0 comments, 41 blanks, all 361 lines
-
-Languages
-+----------+------------+------------+------------+------------+------------+
-| language | files | code | comment | blank | total |
-+----------+------------+------------+------------+------------+------------+
-| Rust | 2 | 286 | 0 | 36 | 322 |
-| TOML | 2 | 34 | 0 | 5 | 39 |
-+----------+------------+------------+------------+------------+------------+
-
-Directories
-+-------------------------------------------+------------+------------+------------+------------+------------+
-| path | files | code | comment | blank | total |
-+-------------------------------------------+------------+------------+------------+------------+------------+
-| . | 4 | 320 | 0 | 41 | 361 |
-| src | 2 | 286 | 0 | 36 | 322 |
-+-------------------------------------------+------------+------------+------------+------------+------------+
-
-Files
-+-------------------------------------------+----------+------------+------------+------------+------------+
-| filename | language | code | comment | blank | total |
-+-------------------------------------------+----------+------------+------------+------------+------------+
-| /home/arlo/code/cs_coursework/Cargo.toml | TOML | 9 | 0 | 2 | 11 |
-| /home/arlo/code/cs_coursework/Rocket.toml | TOML | 25 | 0 | 3 | 28 |
-| /home/arlo/code/cs_coursework/src/main.rs | Rust | 87 | 0 | 10 | 97 |
-| /home/arlo/code/cs_coursework/src/sql.rs | Rust | 199 | 0 | 26 | 225 |
-| Total | | 320 | 0 | 41 | 361 |
-+-------------------------------------------+----------+------------+------------+------------+------------+
\ No newline at end of file
diff --git a/.VSCodeCounter/2022-11-18_12-25-12/details.md b/.VSCodeCounter/2022-11-18_12-25-12/details.md
deleted file mode 100644
index c4bb011..0000000
--- a/.VSCodeCounter/2022-11-18_12-25-12/details.md
+++ /dev/null
@@ -1,19 +0,0 @@
-# Details
-
-Date : 2022-11-18 12:25:12
-
-Directory /home/arlo/code/cs_coursework
-
-Total : 4 files, 315 codes, 5 comments, 41 blanks, all 361 lines
-
-[Summary](results.md) / Details / [Diff Summary](diff.md) / [Diff Details](diff-details.md)
-
-## Files
-| filename | language | code | comment | blank | total |
-| :--- | :--- | ---: | ---: | ---: | ---: |
-| [Cargo.toml](/Cargo.toml) | TOML | 9 | 0 | 2 | 11 |
-| [Rocket.toml](/Rocket.toml) | TOML | 21 | 4 | 3 | 28 |
-| [src/main.rs](/src/main.rs) | Rust | 86 | 1 | 10 | 97 |
-| [src/sql.rs](/src/sql.rs) | Rust | 199 | 0 | 26 | 225 |
-
-[Summary](results.md) / Details / [Diff Summary](diff.md) / [Diff Details](diff-details.md)
\ No newline at end of file
diff --git a/.VSCodeCounter/2022-11-18_12-25-12/diff-details.md b/.VSCodeCounter/2022-11-18_12-25-12/diff-details.md
deleted file mode 100644
index f30d590..0000000
--- a/.VSCodeCounter/2022-11-18_12-25-12/diff-details.md
+++ /dev/null
@@ -1,17 +0,0 @@
-# Diff Details
-
-Date : 2022-11-18 12:25:12
-
-Directory /home/arlo/code/cs_coursework
-
-Total : 2 files, -5 codes, 5 comments, 0 blanks, all 0 lines
-
-[Summary](results.md) / [Details](details.md) / [Diff Summary](diff.md) / Diff Details
-
-## Files
-| filename | language | code | comment | blank | total |
-| :--- | :--- | ---: | ---: | ---: | ---: |
-| [Rocket.toml](/Rocket.toml) | TOML | -4 | 4 | 0 | 0 |
-| [src/main.rs](/src/main.rs) | Rust | -1 | 1 | 0 | 0 |
-
-[Summary](results.md) / [Details](details.md) / [Diff Summary](diff.md) / Diff Details
\ No newline at end of file
diff --git a/.VSCodeCounter/2022-11-18_12-25-12/diff.csv b/.VSCodeCounter/2022-11-18_12-25-12/diff.csv
deleted file mode 100644
index acc5aa4..0000000
--- a/.VSCodeCounter/2022-11-18_12-25-12/diff.csv
+++ /dev/null
@@ -1,4 +0,0 @@
-"filename", "language", "TOML", "Rust", "comment", "blank", "total"
-"/home/arlo/code/cs_coursework/Rocket.toml", "TOML", -4, 0, 4, 0, 0
-"/home/arlo/code/cs_coursework/src/main.rs", "Rust", 0, -1, 1, 0, 0
-"Total", "-", -4, -1, 5, 0, 0
\ No newline at end of file
diff --git a/.VSCodeCounter/2022-11-18_12-25-12/diff.md b/.VSCodeCounter/2022-11-18_12-25-12/diff.md
deleted file mode 100644
index 6e845fd..0000000
--- a/.VSCodeCounter/2022-11-18_12-25-12/diff.md
+++ /dev/null
@@ -1,23 +0,0 @@
-# Diff Summary
-
-Date : 2022-11-18 12:25:12
-
-Directory /home/arlo/code/cs_coursework
-
-Total : 2 files, -5 codes, 5 comments, 0 blanks, all 0 lines
-
-[Summary](results.md) / [Details](details.md) / Diff Summary / [Diff Details](diff-details.md)
-
-## Languages
-| language | files | code | comment | blank | total |
-| :--- | ---: | ---: | ---: | ---: | ---: |
-| Rust | 1 | -1 | 1 | 0 | 0 |
-| TOML | 1 | -4 | 4 | 0 | 0 |
-
-## Directories
-| path | files | code | comment | blank | total |
-| :--- | ---: | ---: | ---: | ---: | ---: |
-| . | 2 | -5 | 5 | 0 | 0 |
-| src | 1 | -1 | 1 | 0 | 0 |
-
-[Summary](results.md) / [Details](details.md) / Diff Summary / [Diff Details](diff-details.md)
\ No newline at end of file
diff --git a/.VSCodeCounter/2022-11-18_12-25-12/diff.txt b/.VSCodeCounter/2022-11-18_12-25-12/diff.txt
deleted file mode 100644
index b239117..0000000
--- a/.VSCodeCounter/2022-11-18_12-25-12/diff.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-Date : 2022-11-18 12:25:12
-Directory : /home/arlo/code/cs_coursework
-Total : 2 files, -5 codes, 5 comments, 0 blanks, all 0 lines
-
-Languages
-+----------+------------+------------+------------+------------+------------+
-| language | files | code | comment | blank | total |
-+----------+------------+------------+------------+------------+------------+
-| Rust | 1 | -1 | 1 | 0 | 0 |
-| TOML | 1 | -4 | 4 | 0 | 0 |
-+----------+------------+------------+------------+------------+------------+
-
-Directories
-+-------------------------------------------+------------+------------+------------+------------+------------+
-| path | files | code | comment | blank | total |
-+-------------------------------------------+------------+------------+------------+------------+------------+
-| . | 2 | -5 | 5 | 0 | 0 |
-| src | 1 | -1 | 1 | 0 | 0 |
-+-------------------------------------------+------------+------------+------------+------------+------------+
-
-Files
-+-------------------------------------------+----------+------------+------------+------------+------------+
-| filename | language | code | comment | blank | total |
-+-------------------------------------------+----------+------------+------------+------------+------------+
-| /home/arlo/code/cs_coursework/Rocket.toml | TOML | -4 | 4 | 0 | 0 |
-| /home/arlo/code/cs_coursework/src/main.rs | Rust | -1 | 1 | 0 | 0 |
-| Total | | -5 | 5 | 0 | 0 |
-+-------------------------------------------+----------+------------+------------+------------+------------+
\ No newline at end of file
diff --git a/.VSCodeCounter/2022-11-18_12-25-12/results.csv b/.VSCodeCounter/2022-11-18_12-25-12/results.csv
deleted file mode 100644
index 78f71e8..0000000
--- a/.VSCodeCounter/2022-11-18_12-25-12/results.csv
+++ /dev/null
@@ -1,6 +0,0 @@
-"filename", "language", "TOML", "Rust", "comment", "blank", "total"
-"/home/arlo/code/cs_coursework/Cargo.toml", "TOML", 9, 0, 0, 2, 11
-"/home/arlo/code/cs_coursework/Rocket.toml", "TOML", 21, 0, 4, 3, 28
-"/home/arlo/code/cs_coursework/src/main.rs", "Rust", 0, 86, 1, 10, 97
-"/home/arlo/code/cs_coursework/src/sql.rs", "Rust", 0, 199, 0, 26, 225
-"Total", "-", 30, 285, 5, 41, 361
\ No newline at end of file
diff --git a/.VSCodeCounter/2022-11-18_12-25-12/results.json b/.VSCodeCounter/2022-11-18_12-25-12/results.json
deleted file mode 100644
index 2b89ba5..0000000
--- a/.VSCodeCounter/2022-11-18_12-25-12/results.json
+++ /dev/null
@@ -1 +0,0 @@
-{"file:///home/arlo/code/cs_coursework/Cargo.toml":{"language":"TOML","code":9,"comment":0,"blank":2},"file:///home/arlo/code/cs_coursework/Rocket.toml":{"language":"TOML","code":21,"comment":4,"blank":3},"file:///home/arlo/code/cs_coursework/src/sql.rs":{"language":"Rust","code":199,"comment":0,"blank":26},"file:///home/arlo/code/cs_coursework/src/main.rs":{"language":"Rust","code":86,"comment":1,"blank":10}}
\ No newline at end of file
diff --git a/.VSCodeCounter/2022-11-18_12-25-12/results.md b/.VSCodeCounter/2022-11-18_12-25-12/results.md
deleted file mode 100644
index 1101149..0000000
--- a/.VSCodeCounter/2022-11-18_12-25-12/results.md
+++ /dev/null
@@ -1,23 +0,0 @@
-# Summary
-
-Date : 2022-11-18 12:25:12
-
-Directory /home/arlo/code/cs_coursework
-
-Total : 4 files, 315 codes, 5 comments, 41 blanks, all 361 lines
-
-Summary / [Details](details.md) / [Diff Summary](diff.md) / [Diff Details](diff-details.md)
-
-## Languages
-| language | files | code | comment | blank | total |
-| :--- | ---: | ---: | ---: | ---: | ---: |
-| Rust | 2 | 285 | 1 | 36 | 322 |
-| TOML | 2 | 30 | 4 | 5 | 39 |
-
-## Directories
-| path | files | code | comment | blank | total |
-| :--- | ---: | ---: | ---: | ---: | ---: |
-| . | 4 | 315 | 5 | 41 | 361 |
-| src | 2 | 285 | 1 | 36 | 322 |
-
-Summary / [Details](details.md) / [Diff Summary](diff.md) / [Diff Details](diff-details.md)
\ No newline at end of file
diff --git a/.VSCodeCounter/2022-11-18_12-25-12/results.txt b/.VSCodeCounter/2022-11-18_12-25-12/results.txt
deleted file mode 100644
index 19f2cc1..0000000
--- a/.VSCodeCounter/2022-11-18_12-25-12/results.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-Date : 2022-11-18 12:25:12
-Directory : /home/arlo/code/cs_coursework
-Total : 4 files, 315 codes, 5 comments, 41 blanks, all 361 lines
-
-Languages
-+----------+------------+------------+------------+------------+------------+
-| language | files | code | comment | blank | total |
-+----------+------------+------------+------------+------------+------------+
-| Rust | 2 | 285 | 1 | 36 | 322 |
-| TOML | 2 | 30 | 4 | 5 | 39 |
-+----------+------------+------------+------------+------------+------------+
-
-Directories
-+-------------------------------------------+------------+------------+------------+------------+------------+
-| path | files | code | comment | blank | total |
-+-------------------------------------------+------------+------------+------------+------------+------------+
-| . | 4 | 315 | 5 | 41 | 361 |
-| src | 2 | 285 | 1 | 36 | 322 |
-+-------------------------------------------+------------+------------+------------+------------+------------+
-
-Files
-+-------------------------------------------+----------+------------+------------+------------+------------+
-| filename | language | code | comment | blank | total |
-+-------------------------------------------+----------+------------+------------+------------+------------+
-| /home/arlo/code/cs_coursework/Cargo.toml | TOML | 9 | 0 | 2 | 11 |
-| /home/arlo/code/cs_coursework/Rocket.toml | TOML | 21 | 4 | 3 | 28 |
-| /home/arlo/code/cs_coursework/src/main.rs | Rust | 86 | 1 | 10 | 97 |
-| /home/arlo/code/cs_coursework/src/sql.rs | Rust | 199 | 0 | 26 | 225 |
-| Total | | 315 | 5 | 41 | 361 |
-+-------------------------------------------+----------+------------+------------+------------+------------+
\ No newline at end of file
diff --git a/website/api/user.js b/website/api/user.js
index f94fa94..f6ee1e0 100644
--- a/website/api/user.js
+++ b/website/api/user.js
@@ -6,5 +6,6 @@ class User {
this.tests;
this.leaderboard;
this.nextTest = `satisfy powerful pleasant bells disastrous mean kited is gusted romantic past taste immolate productive leak close show crabby awake handsails finicky betray long-term incompetent wander show manage toys convey hop constitute number send like off ice aboard well-made vast vacuous tramp seed force divergent flower porter fire untidy soggy fetch`;
+ this.time = 15;
}
}
\ No newline at end of file
diff --git a/website/index.html b/website/index.html
index 18ea90e..1c30299 100644
--- a/website/index.html
+++ b/website/index.html
@@ -22,6 +22,7 @@
+
diff --git a/website/screens/endscreen.js b/website/screens/endscreen.js
index d427411..2a69753 100644
--- a/website/screens/endscreen.js
+++ b/website/screens/endscreen.js
@@ -1,13 +1,6 @@
class EndScreen {
constructor() {
- this.buttons = [
- new Button(0,0,100,30,0,true,"#fff",false,"#000","#000","Sign Up"),
- new Button(110,0,100,30,0,true,"#fff",false,"#000","#000","Login"),
- new Button(220,0,100,30,0,true,"#fff",false,"#000","#000","Logout"),
- new Button(330,0,100,30,0,true,"#fff",false,"#000","#000","Profile"),
- new Button(440,0,100,30,0,true,"#fff",false,"#000","#000","Test"),
- new Button(550,0,140,30,0,true,"#fff",false,"#000","#000","Leaderboard"),
- ]
+ this.menu = new Menu();
}
draw() {
@@ -16,26 +9,10 @@ class EndScreen {
textAlign(CENTER, CENTER);
fill(0);
text("Test Complete\nPress enter to start another test", 0, 0, windowWidth - 100, windowHeight - 100);
-
- for (let i = 0; i < this.buttons.length; i++) {
- this.buttons[i].draw()
- }
- if (this.buttons[0].isPressed()) {
- screenManager.setScreen(new SignUpScreen());
- } else if (this.buttons[1].isPressed()) {
- screenManager.setScreen(new LoginScreen());
- } else if (this.buttons[2].isPressed()) {
- api.logout();
- } else if (this.buttons[3].isPressed()) {
- screenManager.setScreen(new ProfileScreen());
- } else if (this.buttons[4].isPressed()) {
- screenManager.setScreen(new TestScreen())
- } else if (this.buttons[5].isPressed()) {
- screenManager.setScreen(new LeaderboardScreen())
- }
+ this.menu.draw();
}
letterTyped(key) {
- if (key === "ENTER") screenManager.setScreen(new StartScreen());
+ if (key === "Enter") screenManager.setScreen(new TestScreen());
}
}
\ No newline at end of file
diff --git a/website/screens/leaderboardscreen.js b/website/screens/leaderboardscreen.js
index 478f89e..7f4be05 100644
--- a/website/screens/leaderboardscreen.js
+++ b/website/screens/leaderboardscreen.js
@@ -1,13 +1,6 @@
class LeaderboardScreen {
constructor() {
- this.buttons = [
- new Button(0,0,100,30,0,true,"#fff",false,"#000","#000","Sign Up"),
- new Button(110,0,100,30,0,true,"#fff",false,"#000","#000","Login"),
- new Button(220,0,100,30,0,true,"#fff",false,"#000","#000","Logout"),
- new Button(330,0,100,30,0,true,"#fff",false,"#000","#000","Profile"),
- new Button(440,0,100,30,0,true,"#fff",false,"#000","#000","Test"),
- new Button(550,0,140,30,0,true,"#fff",false,"#000","#000","Leaderboard"),
- ];
+ this.menu = new Menu();
api.getLeaderBoard()
}
@@ -17,23 +10,7 @@ class LeaderboardScreen {
textAlign(CENTER, CENTER);
fill("#000");
text("Leaderboard", 0, 100, windowWidth, 120);
- for (let i = 0; i < this.buttons.length; i++) {
- this.buttons[i].draw()
- }
-
- if (this.buttons[0].isPressed()) {
- screenManager.setScreen(new SignUpScreen());
- } else if (this.buttons[1].isPressed()) {
- screenManager.setScreen(new LoginScreen());
- } else if (this.buttons[2].isPressed()) {
- api.logout();
- } else if (this.buttons[3].isPressed()) {
- screenManager.setScreen(new ProfileScreen());
- } else if (this.buttons[4].isPressed()) {
- screenManager.setScreen(new TestScreen())
- } else if (this.buttons[5].isPressed()) {
- screenManager.setScreen(new LeaderboardScreen())
- }
+ this.menu.draw();
textSize(20);
fill("#000");
diff --git a/website/screens/loginscreen.js b/website/screens/loginscreen.js
index b9b9069..4345d5c 100644
--- a/website/screens/loginscreen.js
+++ b/website/screens/loginscreen.js
@@ -54,15 +54,10 @@ class LoginScreen {
false,"#000",
"#00ff00","Login"
),
-
- new Button(0,0,100,30,0,true,"#fff",false,"#000","#000","Sign Up"),
- new Button(110,0,100,30,0,true,"#fff",false,"#000","#000","Login"),
- new Button(220,0,100,30,0,true,"#fff",false,"#000","#000","Logout"),
- new Button(330,0,100,30,0,true,"#fff",false,"#000","#000","Profile"),
- new Button(440,0,100,30,0,true,"#fff",false,"#000","#000","Test"),
- new Button(550,0,140,30,0,true,"#fff",false,"#000","#000","Leaderboard"),
]
+ this.menu = new Menu();
+
this.activeTextBox = 0
// keeps track of which textbox the user last clicked on
}
@@ -99,20 +94,7 @@ class LoginScreen {
)
screenManager.setScreen(new StartScreen());
}
-
- if (this.buttons[3].isPressed()) {
- screenManager.setScreen(new SignUpScreen());
- } else if (this.buttons[4].isPressed()) {
- screenManager.setScreen(new LoginScreen());
- } else if (this.buttons[5].isPressed()) {
- api.logout();
- } else if (this.buttons[6].isPressed()) {
- screenManager.setScreen(new ProfileScreen());
- } else if (this.buttons[7].isPressed()) {
- screenManager.setScreen(new TestScreen())
- } else if (this.buttons[8].isPressed()) {
- screenManager.setScreen(new LeaderboardScreen())
- }
+ this.menu.draw();
}
/**
diff --git a/website/screens/profilescreen.js b/website/screens/profilescreen.js
index 20c8f76..6c0c7bf 100644
--- a/website/screens/profilescreen.js
+++ b/website/screens/profilescreen.js
@@ -1,13 +1,6 @@
class ProfileScreen {
constructor() {
- this.buttons = [
- new Button(0,0,100,30,0,true,"#fff",false,"#000","#000","Sign Up"),
- new Button(110,0,100,30,0,true,"#fff",false,"#000","#000","Login"),
- new Button(220,0,100,30,0,true,"#fff",false,"#000","#000","Logout"),
- new Button(330,0,100,30,0,true,"#fff",false,"#000","#000","Profile"),
- new Button(440,0,100,30,0,true,"#fff",false,"#000","#000","Test"),
- new Button(550,0,140,30,0,true,"#fff",false,"#000","#000","Leaderboard"),
- ];
+ this.menu = new Menu();
api.getUserTests();
}
@@ -18,28 +11,13 @@ class ProfileScreen {
fill("#000");
text("Profile", 0, 100, windowWidth, 120);
- for (let i = 0; i < this.buttons.length; i++) {
- this.buttons[i].draw()
- }
- if (this.buttons[0].isPressed()) {
- screenManager.setScreen(new SignUpScreen());
- } else if (this.buttons[1].isPressed()) {
- screenManager.setScreen(new LoginScreen());
- } else if (this.buttons[2].isPressed()) {
- api.logout();
- } else if (this.buttons[3].isPressed()) {
- screenManager.setScreen(new ProfileScreen());
- } else if (this.buttons[4].isPressed()) {
- screenManager.setScreen(new TestScreen())
- } else if (this.buttons[5].isPressed()) {
- screenManager.setScreen(new LeaderboardScreen())
- }
+ this.menu.draw();
textSize(20);
fill("#000");
if (user.tests != undefined) {
for (let i = 0; i < user.tests.length; i++) {
- text(`Tests ${i+1}: ${user.tests[i].wpm}wpm | Type: ${user.tests[i].test_type} | Time: ${user.tests[i].test_time} | Characters Typed: ${user.tests[i].test_length}`, 0, i*30+300, windowWidth, 30);
+ text(`Test ${i+1}: ${user.tests[i].wpm}wpm | Characters Typed: ${user.tests[i].test_length}`, 0, i*30+300, windowWidth, 30);
}
}
fill("#000");
diff --git a/website/screens/signUpScreen.js b/website/screens/signUpScreen.js
index ab3d16e..ba1e164 100644
--- a/website/screens/signUpScreen.js
+++ b/website/screens/signUpScreen.js
@@ -54,14 +54,10 @@ class SignUpScreen {
false,"#000",
"#00ff00","Sign Up"
),
- new Button(0,0,100,30,0,true,"#fff",false,"#000","#000","Sign Up"),
- new Button(110,0,100,30,0,true,"#fff",false,"#000","#000","Login"),
- new Button(220,0,100,30,0,true,"#fff",false,"#000","#000","Logout"),
- new Button(330,0,100,30,0,true,"#fff",false,"#000","#000","Profile"),
- new Button(440,0,100,30,0,true,"#fff",false,"#000","#000","Test"),
- new Button(550,0,140,30,0,true,"#fff",false,"#000","#000","Leaderboard"),
]
+ this.menu = new Menu();
+
this.activeTextBox = 0
// keeps track of which textbox the user last clicked on
}
@@ -98,19 +94,8 @@ class SignUpScreen {
this.textboxes[1].getWords()
)
screenManager.setScreen(new StartScreen());
- } else if (this.buttons[3].isPressed()) {
- screenManager.setScreen(new SignUpScreen());
- } else if (this.buttons[4].isPressed()) {
- screenManager.setScreen(new LoginScreen());
- } else if (this.buttons[5].isPressed()) {
- api.logout();
- } else if (this.buttons[6].isPressed()) {
- screenManager.setScreen(new ProfileScreen());
- } else if (this.buttons[7].isPressed()) {
- screenManager.setScreen(new TestScreen())
- } else if (this.buttons[8].isPressed()) {
- screenManager.setScreen(new LeaderboardScreen())
- }
+ }
+ this.menu.draw();
}
/**
diff --git a/website/screens/startscreen.js b/website/screens/startscreen.js
index fdbe2e4..ef35c69 100644
--- a/website/screens/startscreen.js
+++ b/website/screens/startscreen.js
@@ -1,13 +1,6 @@
class StartScreen {
constructor() {
- this.buttons = [
- new Button(0,0,100,30,0,true,"#fff",false,"#000","#000","Sign Up"),
- new Button(110,0,100,30,0,true,"#fff",false,"#000","#000","Login"),
- new Button(220,0,100,30,0,true,"#fff",false,"#000","#000","Logout"),
- new Button(330,0,100,30,0,true,"#fff",false,"#000","#000","Profile"),
- new Button(440,0,100,30,0,true,"#fff",false,"#000","#000","Test"),
- new Button(550,0,140,30,0,true,"#fff",false,"#000","#000","Leaderboard"),
- ]
+ this.menu = new Menu();
}
draw() {
@@ -17,22 +10,7 @@ class StartScreen {
fill("#000");
text("Press enter to start test", 0, 0, windowWidth - 100, windowHeight - 100);
- for (let i = 0; i < this.buttons.length; i++) {
- this.buttons[i].draw()
- }
- if (this.buttons[0].isPressed()) {
- screenManager.setScreen(new SignUpScreen());
- } else if (this.buttons[1].isPressed()) {
- screenManager.setScreen(new LoginScreen());
- } else if (this.buttons[2].isPressed()) {
- api.logout();
- } else if (this.buttons[3].isPressed()) {
- screenManager.setScreen(new ProfileScreen());
- } else if (this.buttons[4].isPressed()) {
- screenManager.setScreen(new TestScreen());
- } else if (this.buttons[5].isPressed()) {
- screenManager.setScreen(new LeaderboardScreen())
- }
+ this.menu.draw();
fill("#000");
text(`Logged in as ${user.username}`, windowWidth-400, 15);
diff --git a/website/screens/testscreen.js b/website/screens/testscreen.js
index 6b18dc4..f67fb91 100644
--- a/website/screens/testscreen.js
+++ b/website/screens/testscreen.js
@@ -1,7 +1,7 @@
class TestScreen {
constructor() {
this.textbox = new Textbox(100,100,windowWidth - 200,windowHeight,0,true,"#000", false, "#000", "#000", true, true);
- screenManager.timer = new Timer(0,0,windowWidth,50,0,true,"#fff", true, "#000", "#666", 15, true);
+ screenManager.timer = new Timer(0,0,windowWidth,50,0,true,"#fff", true, "#000", "#666", user.time, true);
screenManager.timer.start();
}
diff --git a/website/ui_elements/menu.js b/website/ui_elements/menu.js
new file mode 100644
index 0000000..b69a103
--- /dev/null
+++ b/website/ui_elements/menu.js
@@ -0,0 +1,35 @@
+class Menu {
+ constructor() {
+ this.buttons = [
+ new Button(0,0,100,30,0,true,"#fff",false,"#000","#000","Sign Up"),
+ new Button(110,0,100,30,0,true,"#fff",false,"#000","#000","Login"),
+ new Button(220,0,100,30,0,true,"#fff",false,"#000","#000","Logout"),
+ new Button(330,0,100,30,0,true,"#fff",false,"#000","#000","Profile"),
+ new Button(440,0,100,30,0,true,"#fff",false,"#000","#000","Test"),
+ new Button(550,0,140,30,0,true,"#fff",false,"#000","#000","Leaderboard"),
+ ]
+ this.timeMenu = new TimeMenu();
+ }
+
+ draw() {
+ for (let i = 0; i < this.buttons.length; i++) {
+ this.buttons[i].draw()
+ }
+
+ if (this.buttons[0].isPressed()) {
+ screenManager.setScreen(new SignUpScreen());
+ } else if (this.buttons[1].isPressed()) {
+ screenManager.setScreen(new LoginScreen());
+ } else if (this.buttons[2].isPressed()) {
+ api.logout();
+ } else if (this.buttons[3].isPressed()) {
+ screenManager.setScreen(new ProfileScreen());
+ } else if (this.buttons[4].isPressed()) {
+ screenManager.setScreen(new TestScreen())
+ } else if (this.buttons[5].isPressed()) {
+ screenManager.setScreen(new LeaderboardScreen())
+ }
+
+ this.timeMenu.draw();
+ }
+}
\ No newline at end of file
diff --git a/website/ui_elements/timemenu.js b/website/ui_elements/timemenu.js
index 2eb52ca..f78a94e 100644
--- a/website/ui_elements/timemenu.js
+++ b/website/ui_elements/timemenu.js
@@ -1,5 +1,41 @@
class TimeMenu {
constructor() {
+ this.buttons = [
+ new Button(660,0,100,30,0,true,"#fff",false,"#000","#000","15s"),
+ new Button(660,30,100,30,0,true,"#fff",false,"#000","#000","30s"),
+ new Button(660,60,100,30,0,true,"#fff",false,"#000","#000","45s"),
+ new Button(660,90,100,30,0,true,"#fff",false,"#000","#000","60s"),
+ ];
+ this.dropdown = false;
+ }
+ draw() {
+ this.buttons[0].draw();
+
+ if (this.dropdown) {
+ for (let i = 0; i < this.buttons.length; i++) {
+ this.buttons[i].draw()
+ if (this.buttons[0].isPressed() && user.time != 15) {
+ user.time = 15;
+ this.dropdown = false;
+ } else if (this.buttons[1].isPressed()) {
+ user.time = 30;
+ this.dropdown = false;
+ } else if (this.buttons[2].isPressed()) {
+ user.time = 45;
+ this.dropdown = false;
+ } else if (this.buttons[3].isPressed()) {
+ user.time = 60;
+ this.dropdown = false;
+ }
+ }
+ }
+
+
+ if (this.buttons[0].isPressed()) {
+ this.dropdown = true;
+ } else if (mouseIsPressed) {
+ this.dropdown = false;
+ }
}
}
\ No newline at end of file
diff --git a/website/ui_elements/timer.js b/website/ui_elements/timer.js
index 2809e7e..422e268 100644
--- a/website/ui_elements/timer.js
+++ b/website/ui_elements/timer.js
@@ -156,6 +156,7 @@ class Timer {
api.validateTest();
this.timeElapsed = 0;
this.time = 0;
+ api.getTest();
// 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());