From aba41086e7692e839d32eb52ac33aa339ad9d1e7 Mon Sep 17 00:00:00 2001 From: OleSTEEP Date: Wed, 14 Feb 2024 20:45:02 +0300 Subject: [PATCH] Scale game window outside cordova --- www.eng/js/plugins/VND_CordovaFixes.js | 26 ++++++++++++-------------- www.rus/js/plugins/VND_CordovaFixes.js | 26 ++++++++++++-------------- 2 files changed, 24 insertions(+), 28 deletions(-) diff --git a/www.eng/js/plugins/VND_CordovaFixes.js b/www.eng/js/plugins/VND_CordovaFixes.js index 798193a..992f18a 100644 --- a/www.eng/js/plugins/VND_CordovaFixes.js +++ b/www.eng/js/plugins/VND_CordovaFixes.js @@ -141,25 +141,23 @@ StreamWebAudio.prototype._onCordovaResume = function () { document.addEventListener("backbutton", function(event){ event.preventDefault(); - }); +}); // ===================== // Scale game canvas // ===================== -document.addEventListener("deviceready", () => { - Graphics._updateRealScale = function () { - if (this._stretchEnabled) { - var h = window.innerWidth / this._width; - var v = window.innerHeight / this._height; - if (h >= 1 && h - 0.01 <= 1) h = 1; - if (v >= 1 && v - 0.01 <= 1) v = 1; - this._realScale = Math.min(h, v); - } else { - this._realScale = this._scale; - } - }; -}) +Graphics._updateRealScale = function () { + if (this._stretchEnabled) { + var h = window.innerWidth / this._width; + var v = window.innerHeight / this._height; + if (h >= 1 && h - 0.01 <= 1) h = 1; + if (v >= 1 && v - 0.01 <= 1) v = 1; + this._realScale = Math.min(h, v); + } else { + this._realScale = this._scale; + } +}; // =========================== // Gamepad tips on default diff --git a/www.rus/js/plugins/VND_CordovaFixes.js b/www.rus/js/plugins/VND_CordovaFixes.js index 21d48e9..eae200f 100644 --- a/www.rus/js/plugins/VND_CordovaFixes.js +++ b/www.rus/js/plugins/VND_CordovaFixes.js @@ -141,25 +141,23 @@ StreamWebAudio.prototype._onCordovaResume = function () { document.addEventListener("backbutton", function(event){ event.preventDefault(); - }); +}); // ===================== // Scale game canvas // ===================== -document.addEventListener("deviceready", () => { - Graphics._updateRealScale = function () { - if (this._stretchEnabled) { - var h = window.innerWidth / this._width; - var v = window.innerHeight / this._height; - if (h >= 1 && h - 0.01 <= 1) h = 1; - if (v >= 1 && v - 0.01 <= 1) v = 1; - this._realScale = Math.min(h, v); - } else { - this._realScale = this._scale; - } - }; -}) +Graphics._updateRealScale = function () { + if (this._stretchEnabled) { + var h = window.innerWidth / this._width; + var v = window.innerHeight / this._height; + if (h >= 1 && h - 0.01 <= 1) h = 1; + if (v >= 1 && v - 0.01 <= 1) v = 1; + this._realScale = Math.min(h, v); + } else { + this._realScale = this._scale; + } +}; // =========================== // Gamepad tips on default