Add FPSCounter toggle button (Debug only)
This commit is contained in:
parent
bc89b1f1ff
commit
f4a9d6897e
2 changed files with 26 additions and 0 deletions
|
@ -38,6 +38,15 @@
|
||||||
min-height: 6vh;
|
min-height: 6vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.fps-button {
|
||||||
|
position: absolute;
|
||||||
|
left: 5px;
|
||||||
|
top: 5px;
|
||||||
|
width: 90px;
|
||||||
|
height: 40px;
|
||||||
|
z-index: 1489;
|
||||||
|
}
|
||||||
|
|
||||||
.gamepad-buttons {
|
.gamepad-buttons {
|
||||||
opacity: 0.9;
|
opacity: 0.9;
|
||||||
z-index: 1488;
|
z-index: 1488;
|
||||||
|
|
|
@ -50,6 +50,22 @@ function create_control_buttons() {
|
||||||
document.body.appendChild(DivBMain);
|
document.body.appendChild(DivBMain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function create_fps_button() {
|
||||||
|
// Remove in release
|
||||||
|
const keys = [{ key: 'F2', keyCode: 113 }];
|
||||||
|
|
||||||
|
const FPSBtn = document.createElement("div");
|
||||||
|
FPSBtn.className = "fps-button";
|
||||||
|
FPSBtn.id = "buttonF2";
|
||||||
|
document.body.appendChild(FPSBtn);
|
||||||
|
|
||||||
|
for (const key of keys) {
|
||||||
|
const elementId = key.id === undefined ? `button${key.key}` : key.id;
|
||||||
|
console.log(`Setting up the ${elementId} key...`);
|
||||||
|
setupKey(elementId, key.key, key.keyCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function create_dpad_buttons() {
|
function create_dpad_buttons() {
|
||||||
// Скуфting elements
|
// Скуфting elements
|
||||||
const DivDMain = document.createElement("div");
|
const DivDMain = document.createElement("div");
|
||||||
|
@ -266,6 +282,7 @@ function setupKey(id, key, keyCode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener('load', () => {
|
window.addEventListener('load', () => {
|
||||||
|
create_fps_button(); // Remove in release
|
||||||
if (navigator.getGamepads().length == 0) {
|
if (navigator.getGamepads().length == 0) {
|
||||||
create_control_buttons();
|
create_control_buttons();
|
||||||
create_dpad_buttons();
|
create_dpad_buttons();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue