phaserjs / phaser

Phaser is a fun, free and fast 2D game framework for making HTML5 games for desktop and mobile web browsers, supporting Canvas and WebGL rendering.
https://phaser.io
MIT License
37.22k stars 7.1k forks source link

TexturePacker MultiPack feature - Loading the Atlas #3577

Closed NemoStein closed 6 years ago

NemoStein commented 6 years ago

TexturePacker offers a MultiPack option that, when packing multiple atlas together, outputs:

Sadly, as I can understand, Phaser3 doesn't support this because it's API expects:

I'd like to be able to call the loader only with a JSON file and it would parse the JSON and find out the paths to the images by itself. Something like this:

this.load.multiatlas('key', 'path/to/atlas.json')

The atlas.json have a structure similar to this:

{
    "textures": [
        {
            "image": "img-0.png",
            ...
        },{
            "image": "img-1.png",
            ...
        },{
            "image": "img-2.png",
            ...
        }
    ]
}

Is it possible? I understand that this would force the JSON to be loaded first than the images later, but without this behavior the feature is useless.

ps: I know that I can pass all my files (images and JSONs) beforehand, but in my case this is unfeasible, since the atlas is build at compile time with a gulp task.

photonstorm commented 6 years ago

This feature request is reliant on #3523 being implemented first before it's possible.

photonstorm commented 6 years ago

Thank you for submitting this feature request. We have implemented this and the feature has been pushed to the master branch. It will be part of the next release. If you get time to build and test it for yourself we would appreciate that.