diff options
[WGL/P] You can now pause and unpause with the escape key
1 files changed, 3 insertions, 0 deletions
| -rw-r--r-- | Year 2/Computer Graphics with WebGL/Project/spaceship.js | 3 |
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(); + }); } /* |
