diff options
author | Galin Simeonov <gts@volconst.com> | 2021-09-29 13:07:50 +0300 |
---|---|---|
committer | Galin Simeonov <gts@volconst.com> | 2021-09-29 13:07:50 +0300 |
commit | 8e5e48dd820a0b936f725a51150f9bd8922f8844 (patch) | |
tree | eca6c4a6085136100d6bfa777a517a0c9eb4c7ba | |
parent | 6cb941f7a2b627a0b2c348bfd5a4b898a751a8fc (diff) | |
download | snek-8e5e48dd820a0b936f725a51150f9bd8922f8844.tar.gz |
some touch screen support
-rw-r--r-- | snek.js | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -106,6 +106,12 @@ function initialise() context=canvas.getContext("2d"); canvas.addEventListener('mousemove', e => { cursor.x=e.offsetX; cursor.y=e.offsetY; }); + canvas.addEventListener('touchmove', e => + { + cursor.x=e.changedTouches[0].clientX; + cursor.y=e.changedTouches[0].clientY; + + }); mice=[]; mice.push(createMouse(200,100,1,normalMouseSpeed,normalMouseSize)); |