diff --git a/static/js/gameboy_controller.js b/static/js/gameboy_controller.js index 04d0422b..db9c2897 100644 --- a/static/js/gameboy_controller.js +++ b/static/js/gameboy_controller.js @@ -138,6 +138,7 @@ document.body.onkeydown = function (e) { } } + // game keys setState(e, true); } }; diff --git a/ui/gameview.go b/ui/gameview.go index 5eb44633..f20d595d 100644 --- a/ui/gameview.go +++ b/ui/gameview.go @@ -69,7 +69,8 @@ func (view *GameView) ListenToInputChannel() { for { keysInBinary := <-view.inputChannel for i := 0; i < NumKeys*2; i++ { - view.keyPressed[i] = ((keysInBinary & 1) == 1) + b := ((keysInBinary & 1) == 1) + view.keyPressed[i] = (view.keyPressed[i] && b) || b keysInBinary = keysInBinary >> 1 } }