Emulator restore touch controls if screen is touched after keyboard has been used (iPad)
@@ -160,6 +160,15 @@ function bindDpad(el) {
});
}
+function bindTouchRestore() {
+ window.addEventListener("touchstart", function(e) {
+ if(!isTouchEnabled) {
+ controller.style.display = "block";
+ isTouchEnabled = true;
+ }
+ })
+}
+
function bindKeyboard() {
window.onkeydown = function(e) {
initSound();
@@ -209,6 +218,7 @@ if (isTouchEnabled) {
bindButton(btnStart, "start");
bindButton(btnSelect, "select");
bindDpad(dpad);
+ bindTouchRestore();
} else {
controller.style.display = "none";
}
