INNER CODE UNIT · JavaScript
resolveDeviceResolution
shixiangxi0/Cobweb · clients/phaser/src/main.js:11
function resolveDeviceResolution() {
return Math.max(1, window.devicePixelRatio || 1);
}
function installDefaultTextResolution(resolution) {
const factory = globalThis.Phaser?.GameObjects?.GameObjectFactory?.prototype;
if (!factory || factory.__cobwebTextResolutionPatched) return;
const originalText = factory.text;
if (typeof originalText !== 'function') return;
factory.text = function patchedText(x, y, text, style) {
const nextStyle = style?.resolution == null
? { ...(style ?? {}), resolution }
: style;
return originalText.call(this, x, y, text, nextStyle);
};