mirror of
https://github.com/giongto35/cloud-game.git
synced 2026-01-23 18:46:11 +00:00
Update bit
This commit is contained in:
parent
5102ac9a41
commit
1e6684044c
2 changed files with 3 additions and 1 deletions
|
|
@ -138,6 +138,7 @@ document.body.onkeydown = function (e) {
|
|||
}
|
||||
}
|
||||
|
||||
// game keys
|
||||
setState(e, true);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue