Rename jscontrols to fps_counter
This commit is contained in:
parent
52588249f1
commit
8236e4d468
6 changed files with 4 additions and 4 deletions
|
@ -1,31 +0,0 @@
|
|||
// by VienDesu! Poring Team 2023
|
||||
|
||||
function create_fps_button() {
|
||||
// Remove in release
|
||||
const FPSBtn = document.createElement("div");
|
||||
FPSBtn.className = "fps-button";
|
||||
FPSBtn.id = "buttonF2";
|
||||
document.body.appendChild(FPSBtn);
|
||||
|
||||
console.log(`Setting up the FPS key...`);
|
||||
|
||||
FPSBtn.addEventListener("pointerdown", (event) => {
|
||||
console.log(`Pointer down for F2`); //Remove in release
|
||||
event.stopImmediatePropagation();
|
||||
event.preventDefault();
|
||||
sendEvent(false, 113);
|
||||
});
|
||||
|
||||
FPSBtn.addEventListener("pointerup", () => {
|
||||
sendEvent(true, 113);
|
||||
});
|
||||
}
|
||||
|
||||
function sendEvent(isUp, keycode) {
|
||||
document.getElementById("GameCanvas").focus();
|
||||
document.dispatchEvent(new KeyboardEvent(isUp ? 'keyup' : 'keydown', { 'key': '', keyCode: keycode }))
|
||||
}
|
||||
|
||||
window.addEventListener('load', () => {
|
||||
create_fps_button(); // Remove in release
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue