diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..1b16b2c Binary files /dev/null and b/.DS_Store differ diff --git a/.gitignore b/.gitignore index 0e32a45..09f6cb3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /target Cargo.lock -/database/database.sqlite \ No newline at end of file +/database/database.sqlite +/NEA_Screenshots \ No newline at end of file diff --git a/website/index.html b/website/index.html index 92e96f8..7d224c2 100644 --- a/website/index.html +++ b/website/index.html @@ -12,6 +12,8 @@ + + diff --git a/website/index.js b/website/index.js index 61caf6d..62960a8 100644 --- a/website/index.js +++ b/website/index.js @@ -1,6 +1,4 @@ -let canvas; -let api; -let textbox, timer, button; +let canvas, api, screenManager; function setup() { // Creating the canvas @@ -10,27 +8,20 @@ function setup() { frameRate(60); - textbox = new Textbox(400, 200, 700); - timer = new Timer(0, 0, 100, 100, 0, true, '#000', true, '#000','#F3C969', 10, true); - timer.start(); api = new API(); - button = new Button(300, 300, 100, 50, 0, true, '#fff', false, '#000', '#666', 'button'); + screenManager = new ScreenManager(); } // this function is called once per frame and draws all other elements function draw() { background(200); - textbox.draw(); - timer.tick(); - timer.draw(); - button.draw(); - button.isPressed(); + screenManager.draw(); } // whenever a key is pressed this function is called function keyPressed() { - textbox.letterTyped(key); + screenManager.textbox.letterTyped(key); } // This ensures that the canvas is always the correct size and at the center diff --git a/website/screens/screenmanager.js b/website/screens/screenmanager.js new file mode 100644 index 0000000..12a64a2 --- /dev/null +++ b/website/screens/screenmanager.js @@ -0,0 +1,13 @@ +class ScreenManager { + constructor() { + this.textbox = new Textbox(400, 200, 700); + this.timer = new Timer(0, 0, 100, 100, 0, true, '#000', true, '#000','#F3C969', 10, true); + this.button = new Button(300, 300, 100, 50, 0, true, '#fff', false, '#000', '#666', 'button'); + } + + draw() { + this.textbox.draw(); + this.timer.draw(); + this.button.draw(); + } +} \ No newline at end of file