﻿function keyboardInput(args) {
    var keyDown = function (e) {
        var key = 0;
        if (e.which === 87 || e.which === 119 || e.which === 38)
            key |= moveDirections.Up;

        if (e.which === 83 || e.which === 115 || e.which === 40)
            key |= moveDirections.Down;

        if (e.which === 65 || e.which === 97 || e.which === 37)
            key |= moveDirections.Left;

        if (e.which === 68 || e.which === 100 || e.which === 39)
            key |= moveDirections.Right;

        if (key > 0)
            args.inputChanged({ direction: key });
    };

    (function () {
        document.addEventListener("keydown", keyDown);
    })();
};
@@ -32,24 +32,49 @@
 %0A    var key
+Pressed = 0;%0A%0A    var key
 Down = funct
@@ -86,29 +86,8 @@
 e) %7B
-%0A        var key = 0;
 %0A   
@@ -155,32 +155,39 @@
 %0A            key
+Pressed
  %7C= moveDirectio
@@ -266,32 +266,39 @@
 %0A            key
+Pressed
  %7C= moveDirectio
@@ -378,32 +378,39 @@
 %0A            key
+Pressed
  %7C= moveDirectio
@@ -499,16 +499,23 @@
      key
+Pressed
  %7C= move
@@ -548,16 +548,23 @@
  if (key
+Pressed
  %3E 0)%0A  
@@ -607,16 +607,599 @@
 ion: key
+Pressed %7D);%0A    %7D;%0A%0A%0A    var keyUp = function (e) %7B%0A        if (e.which === 87 %7C%7C e.which === 119 %7C%7C e.which === 38)%0A            keyPressed %5E= moveDirections.Up;%0A%0A        if (e.which === 83 %7C%7C e.which === 115 %7C%7C e.which === 40)%0A            keyPressed %5E= moveDirections.Down;%0A%0A        if (e.which === 65 %7C%7C e.which === 97 %7C%7C e.which === 37)%0A            keyPressed %5E= moveDirections.Left;%0A%0A        if (e.which === 68 %7C%7C e.which === 100 %7C%7C e.which === 39)%0A            keyPressed %5E= moveDirections.Right;%0A%0A        if (keyPressed %3E 0)%0A            args.inputChanged(%7B direction: keyPressed
  %7D);%0A   
@@ -1277,16 +1277,67 @@
 yDown);%0A
+        document.addEventListener(%22keyup%22, keyUp);%0A
     %7D)()

handle mulptiple keys at once