Compressed Texture Loading via Configuration

Demonstrates how to load textures by providing a configuration object with multiple compressed formats (ASTC, ETC, PVRTC, S3TC) and a fallback image, allowing Phaser to automatically select the optimal format for the hardware.

Compressed Texture Loading via Configuration, running
800 × 600
GitHub
class Demo extends Phaser.Scene
{
    constructor ()
    {
        super();
    }

    preload ()
    {
        this.load.setBaseURL('https://cdn.phaserfiles.com/v410');
        this.load.texture(
            {
                "key": "labs",
                "url": {
                    "ASTC": "assets/compressed/labs-ASTC-4x4-lRGB.pvr",
                    "ETC": "assets/compressed/labs-ETC2-lRGB.pvr",
                    "PVRTC": "assets/compressed/labs-PVRTC-4BPP-lRGB.pvr",
                    "S3TC": "assets/compressed/labs-S3TC-BC3-lRGB.pvr",
                    "IMG": "assets/compressed/uncompressed/labs.png"
                }
            }
        );
    }

    create ()
    {
        const logo = this.add.image(400, 300, 'labs');

        this.add.text(400, 570, logo.frame.source.compressionAlgorithm).setOrigin(0.5, 0);
    }
}

const config = {
    scale: { mode: Phaser.Scale.FIT },
    type: Phaser.AUTO,
    parent: 'game-container',
    width: 800,
    height: 600,
    backgroundColor: '#2d2d6d',
    scene: Demo
};

const game = new Phaser.Game(config);

More in Textures36 examples