commit 999c213eb3690688d4bc0232e82bebc825058e7b parent 3548c3a47bf257b9d882410f80460f3f9b9abf8d Author: Yuval Langer <yuvallangerontheroad@gmail.com> Date: Mon, 23 Oct 2023 09:56:25 +0300 Both touch and mouse input work now. HUZZAH! Diffstat:
M | main.scm | | | 17 | ++++++++++------- |
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/main.scm b/main.scm @@ -100,10 +100,13 @@ (%inline "window.requestAnimationFrame" (callback loop)) -(%inline ".addEventListener" - canvas - "mousemove" - (callback (lambda (e) - (set! cursor - (cons (.offsetX e) - (.offsetY e)))))) +(for-each (lambda (event-name) + (%inline ".addEventListener" + canvas + event-name + (callback (lambda (e) + (set! cursor + (cons (.offsetX e) + (.offsetY e))))))) + '("pointerdown" + "pointermove"))