From: Elijah Cohen Date: Sat, 18 May 2019 03:02:26 +0000 (-0500) Subject: same input bug X-Git-Url: https://git.eli173.com/?a=commitdiff_plain;h=66e6333cb45f79c2e9e2e74e89eea7086f6773d9;p=pong_br same input bug --- diff --git a/web/input.js b/web/input.js index 7b943f6..e7897a2 100644 --- a/web/input.js +++ b/web/input.js @@ -24,6 +24,7 @@ function keypressHandler(evt, isdn) { keystate = thekey; input = thekey; } + keySender(keystate); } var upKey = function(kc) { @@ -51,13 +52,12 @@ function touchHandler(evt, isdn) { keystate = 'd'; input = 'd'; } - + keySender(keystate); } function keySender(ws) { - if(keystate != 'x') ws.send(keystate); } diff --git a/web/main.js b/web/main.js index 650146f..8acbf5c 100644 --- a/web/main.js +++ b/web/main.js @@ -94,9 +94,6 @@ var main = function() { // starts everything, gets us going, setup ish document.onkeyup = function(e) {keypressHandler(e, false);}; canvas.addEventListener('touchstart', function(e) {touchHandler(e, true);}); canvas.addEventListener('touchend', function(e) {touchHandler(e, false);}); - var interval = setInterval(function(){keySender(theSocket);}, c.MS_PER_FRAME); - - theSocket.onclose = function(e) {clearInterval(interval)}; } window.addEventListener("DOMContentLoaded", e => main());