From f6c2f2d3d7238a22c360546233a0306d287472bb Mon Sep 17 00:00:00 2001 From: stitchy Date: Wed, 18 Dec 2024 07:36:41 +0000 Subject: [PATCH] chore: pointer lock --- shader.mjs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/shader.mjs b/shader.mjs index ca398e2..8fd4d86 100644 --- a/shader.mjs +++ b/shader.mjs @@ -170,5 +170,10 @@ document.addEventListener("keydown", function (event) { document.addEventListener("keyup", function (event) { keymap.set(event.key, false); }); +// Request pointer Lock +canvas.addEventListener("click", async () => { + await canvas.requestPointerLock(); +}); + // Update loop draw(gl, program);