Disable legacy Phaser HUD on mobile

This commit is contained in:
Admin 2026-09-17 23:19:40 +00:00
parent c6633992cc
commit ca6077d5d6

View File

@ -101,6 +101,8 @@ class GameScene extends Phaser.Scene {
} }
createHud() { createHud() {
this.mobileHudActive = !window.matchMedia('(hover: hover) and (pointer: fine)').matches;
const fixedText = (x, y, text, style = {}) => this.add.text(x, y, text, { const fixedText = (x, y, text, style = {}) => this.add.text(x, y, text, {
fontFamily: 'monospace', fontFamily: 'monospace',
color: '#e8f2f7', color: '#e8f2f7',
@ -163,6 +165,23 @@ class GameScene extends Phaser.Scene {
backgroundColor: '#07101899', backgroundColor: '#07101899',
padding: { x: 8, y: 4 }, padding: { x: 8, y: 4 },
}).setOrigin(0.5, 1); }).setOrigin(0.5, 1);
if (this.mobileHudActive) {
for (const item of [
this.hudGraphics,
this.brandText,
this.speedText,
this.headingText,
this.waveText,
this.combatText,
this.playerHullLabel,
this.enemyHullLabel,
this.status,
this.controlsHint,
]) {
item?.setVisible(false);
}
}
} }
createAnimations() { createAnimations() {