]> git.eli173.com Git - pong_br/commitdiff
same input bug
authorElijah Cohen <eli@eli173.com>
Sat, 18 May 2019 03:02:26 +0000 (22:02 -0500)
committerElijah Cohen <eli@eli173.com>
Sat, 18 May 2019 03:02:26 +0000 (22:02 -0500)
web/input.js
web/main.js

index 7b943f61744f7951a16cb528c418cd7337c27a3a..e7897a2c833ddc5d168f6ebc1837945f4b1c71ae 100644 (file)
@@ -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);
 }
index 650146f6bbdb00c45128d2de80d000de17070274..8acbf5c8e5828cf14a7fa4e6ab614af58cf0aeb6 100644 (file)
@@ -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());