From d8015a3653bb820f7df93660fe7dfa2368690312 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 27 Aug 2023 15:32:04 +0300 Subject: [WGL/P] You can now pause and unpause with the escape key --- Year 2/Computer Graphics with WebGL/Project/spaceship.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Year 2/Computer Graphics with WebGL/Project/spaceship.js b/Year 2/Computer Graphics with WebGL/Project/spaceship.js index 654b451..5b98229 100644 --- a/Year 2/Computer Graphics with WebGL/Project/spaceship.js +++ b/Year 2/Computer Graphics with WebGL/Project/spaceship.js @@ -142,6 +142,9 @@ function mouseInit() { if (isPaused) await canvas.requestPointerLock(); }); + document.addEventListener('keyup', (e) => { + if (e.key === 'Escape') paused.click(); + }); } /* -- cgit v1.3.1-26-gb76a