diff --git a/website/index.html b/website/index.html index 456a1ea..24754b5 100644 --- a/website/index.html +++ b/website/index.html @@ -7,7 +7,11 @@ Document - + + + + + diff --git a/website/index.js b/website/index.js index 332497f..57c572a 100644 --- a/website/index.js +++ b/website/index.js @@ -1,22 +1,17 @@ -const url = "http://localhost:8000/api/post_test/" -const data = { - test_type: "words", - test_length: 500, - test_time: 100, - test_seed: 123040004, - quote_id: 0, - wpm: 60, - accuracy: 100, - user_id: 0 +let canvas; +function setup() { + // Creating the canvas + canvas = new Canvas(); + canvas.resize(); + canvas.center(); } -const xhr = new XMLHttpRequest(); -const button = document.getElementById("button"); -button.addEventListener("click", (e) => { - send(); -}); +function draw() { + background(255,100,100); +} -function send() { - xhr.open("POST", url); - xhr.send(JSON.stringify(data)); + +function windowResized() { + canvas.resize(); + canvas.center(); } \ No newline at end of file diff --git a/website/ui_elements/canvas.js b/website/ui_elements/canvas.js new file mode 100644 index 0000000..69ff9ee --- /dev/null +++ b/website/ui_elements/canvas.js @@ -0,0 +1,21 @@ +class Canvas { + constructor() { + this.x = 0; + this.y = 0; + this.canvas = createCanvas(0, 0); + } + + + center() { + this.canvas.position(this.x, this.y); + } + + + resize() { + this.canvas.resize(windowWidth, windowHeight); + } + + disable() { + this.canvas.resize(0, 0); + } +} \ No newline at end of file