Width Controls Height Scale Mode

Demonstrates the WIDTH_CONTROLS_HEIGHT scale mode, which automatically adjusts the game's height based on the available width while maintaining the aspect ratio.

Width Controls Height Scale Mode, running
800 × 600
GitHub
class Example extends Phaser.Scene
{
    preload ()
    {
        this.load.setBaseURL('https://cdn.phaserfiles.com/v410');
        this.load.image('pic', 'assets/pics/zero-two.png');
    }

    create ()
    {
        this.add.image(0, 0, 'pic').setOrigin(0);
    }
}

const config = {
    type: Phaser.AUTO,
    backgroundColor: '#2dab2d',
    scale: {
        mode: Phaser.Scale.WIDTH_CONTROLS_HEIGHT,
        _parent: 'game-container',
        width: 800,
        height: 600
    },
    scene: Example
};

const game = new Phaser.Game(config);

More in Scalemanager24 examples