From bc25578c0123d0217556c3fbe06e560246f7272c Mon Sep 17 00:00:00 2001 From: ArloFilley Date: Mon, 10 Oct 2022 14:05:09 +0100 Subject: [PATCH] added basic screenmanager class --- .DS_Store | Bin 0 -> 10244 bytes .gitignore | 3 ++- website/index.html | 2 ++ website/index.js | 17 ++++------------- website/screens/screenmanager.js | 13 +++++++++++++ 5 files changed, 21 insertions(+), 14 deletions(-) create mode 100644 .DS_Store create mode 100644 website/screens/screenmanager.js diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..1b16b2c5fb2ba1b77a16eb38d8c7c78609fc0231 GIT binary patch literal 10244 zcmeGhZEO@pblw)|9vpNFt!<$zmmWkuN+|{8J6x}=P)a}SwefKRW z8L%Vj0VO8P&R}g;FfjH7TxWje6LyZ6irJ zX>SQbZ!#6yQ&hz|ol9`@6=vLEs4iVu#3}*_vI-uT^U^gJLW^$biq97eHMta?EJe4i zCp+*N>;O4Nj+0a59de$0O)isbkPSsp0!v{PY=X_O6>6aaVz3(|Ce5YSyLh}F*o*ii z>#cRKh$M_;?-nP)ra~meQAxQ zi5$H|w)?QH!|IVtrLiA(E_X!Rkm|$- z(y365tlEath}LK*5yf`eU8O8LbC_FLlp{vOR$lm&$CXj_J{5OM3`VwT^1;v$^TS|h ziCangrDNz|sGQ+GJo|~Hf>e|3WH;{fL*yuVlAIuKkaOe%@;Uj2{6wx|-~dd+;F%6H zAP?rk0w{&mum;w`ItW7}G(j^&pbL6Hg}q?G01Uzq9E6AAFdTuS@F+Y1$KhFc4o<+! z@EW`hr{PU_7tX^+@G*P_m*6}29)5t!@GJZV*SV=&0awTsaV1FyRGiO6Mz@l7bOqBCV_=Z zmakg7sdCgcnJ=f^cWh8NkuWZPoJepyCBus^II-!!dwx0?Z-yre*H#Q6Wq_xVEM&Xf z!38{qkTBIn7cEA#PMF5f;$>w#hO59isK2;kr4NHr$a2wTYY+v7_&03yVR#BtT=eb` zqQpUpi>qs}oAUzyclrKBa*6y%u8`~K`?FvU6v91FjvgPz&qjme^ATu;UC!qt4l*P` z2Ltw__aB5|cmPJ=A@u!6(EA^QWAGF_4bNZ%yZ|r4OYjQ3ivE8F-h#K`eK-r};6pbO zzQQ>88LnpdcKvwYhF>Q4?W9p%?Vhpt$DiN!;3xCXR{jww`7cQI_WapTUth%3HAC;l z5z$X>7M?6kk{Exggd^B8_S`$oIlt1gvO??(-fJ1W*`y!2;@Gc>QW>XRj_MuTGooJd zEZ|wdv%np)Ko-*zpzr@RxBvhD4vofB<5|G7z&~LDm{J|74x{Gu%R}ZM=v#XL^KQ&E zQN9rd9T6;?=Xiw9b37vSIo^3YL7IEbbL2uur}85VVhz(B|1-e5|9kiU|M~s@cZ`k1 AoB#j- literal 0 HcmV?d00001 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