Disable legacy Phaser HUD on mobile
This commit is contained in:
parent
c6633992cc
commit
ca6077d5d6
@ -101,6 +101,8 @@ class GameScene extends Phaser.Scene {
|
||||
}
|
||||
|
||||
createHud() {
|
||||
this.mobileHudActive = !window.matchMedia('(hover: hover) and (pointer: fine)').matches;
|
||||
|
||||
const fixedText = (x, y, text, style = {}) => this.add.text(x, y, text, {
|
||||
fontFamily: 'monospace',
|
||||
color: '#e8f2f7',
|
||||
@ -163,6 +165,23 @@ class GameScene extends Phaser.Scene {
|
||||
backgroundColor: '#07101899',
|
||||
padding: { x: 8, y: 4 },
|
||||
}).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() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user