mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-22 10:49:02 +00:00
(ems) add menu toggle button
This commit is contained in:
parent
ec6eb0ccad
commit
2c01ffcdb9
@ -94,6 +94,9 @@
|
||||
<button class="btn btn-primary disabled" id="btnFullscreen" onclick="Module.requestFullScreen()" title="Fullscreen">
|
||||
<span class="fa fa-desktop" id="icnAdd"></span> <span class="sr-only">Fullscreen</span>
|
||||
</button>
|
||||
<button class="btn btn-primary" id="btnMenu" onclick="keyPress(112);">
|
||||
<span class="fa fa-bars" id="btnMenu"></span> <span class="sr-only">Menu</span>
|
||||
</button>
|
||||
</li>
|
||||
</div>
|
||||
</ul>
|
||||
|
@ -337,3 +337,40 @@ $(function() {
|
||||
//$('#dropdownMenu1').text(localStorage.getItem("core"));
|
||||
});
|
||||
});
|
||||
|
||||
function keyPress(k)
|
||||
{
|
||||
kp(k, "keydown");
|
||||
setInterval(function(){kp(k, "keyup")}, 1000);
|
||||
}
|
||||
|
||||
kp = function(k, event) {
|
||||
var oEvent = document.createEvent('KeyboardEvent');
|
||||
|
||||
// Chromium Hack
|
||||
Object.defineProperty(oEvent, 'keyCode', {
|
||||
get : function() {
|
||||
return this.keyCodeVal;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(oEvent, 'which', {
|
||||
get : function() {
|
||||
return this.keyCodeVal;
|
||||
}
|
||||
});
|
||||
|
||||
if (oEvent.initKeyboardEvent) {
|
||||
oEvent.initKeyboardEvent(event, true, true, document.defaultView, false, false, false, false, k, k);
|
||||
} else {
|
||||
oEvent.initKeyEvent(event, true, true, document.defaultView, false, false, false, false, k, 0);
|
||||
}
|
||||
|
||||
oEvent.keyCodeVal = k;
|
||||
|
||||
if (oEvent.keyCode !== k) {
|
||||
alert("keyCode mismatch " + oEvent.keyCode + "(" + oEvent.which + ")");
|
||||
}
|
||||
|
||||
document.dispatchEvent(oEvent);
|
||||
document.getElementById('canvas').focus();
|
||||
}
|
Loading…
Reference in New Issue
Block a user