PIXI Controls: Debug enable button

This commit is contained in:
OleSTEEP 2024-02-01 14:35:38 +03:00
parent 03775afea1
commit b5d5cc6c89
3 changed files with 42 additions and 0 deletions

View file

@ -25,6 +25,7 @@ ONSControls.createCanvas = function() {
transparent: true
});
document.body.appendChild(canvas.view);
canvas.view.id = "ControlsCanvas";
canvas.view.style.zIndex = this.options.zIndex;
canvas.view.style.position = "absolute";
canvas.view.style.left = 0;
@ -150,6 +151,19 @@ ONSControls.sendEvent = function(event, button) {
const key = VirtualGamepad.keys.find((element) => element.name == button);
VirtualGamepad.gamepad.buttons[key.code].pressed = event.type == "pointerdown" ? true : false
}
//=============================================================================
// * Fix controls size on empty screen
//=============================================================================
document.addEventListener("deviceready", onCordovaDeviceReady, false);
ONSControls.onCordovaDeviceReady = function () {
console.log("ONSControls - SETUP!!!"); //Remove in release
document.addEventListener("resume", onCordovaResume, false);
};
ONSControls.onCordovaResume = function () {
// TODO: HERE CONTROLS WILL BE UPDATED OR RECREATED
};