Skip to content

Commit

Permalink
Release held buttons when emulator loses focus
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismaltby committed Dec 3, 2019
1 parent 739a3ce commit 837d73f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions appData/js-emulator/js/other/controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,15 @@ if (isTouchEnabled) {
bindKeyboard();
bindClick();

function resetKeys() {
for (var key in defaultKeys) {
GameBoyKeyUp(key);
}
}

window.addEventListener("focus", resetKeys);
window.addEventListener("blur", resetKeys);

// HTML Gamepad API Support

// Load a key map for gamepad-to-gameboy buttons
Expand Down

0 comments on commit 837d73f

Please sign in to comment.