Skip to main content
Version: Phaser v4.0.0

PCTAtlasFile

A PCT Atlas File is a composite file type that loads a Phaser Compact Texture Atlas (.pct) data file along with all of the texture image files it references. A single PCT file can describe one or multiple atlas pages; each page is declared by a P: record and is loaded as a separate image. Phaser parses the PCT data, extracts the filenames listed in its page records, and automatically queues and loads each texture before adding the complete atlas to the Texture Manager under a single key. The decoded PCT data is also stored in the global Atlas Cache, keyed by the file key.

These are created when you use the Phaser.Loader.LoaderPlugin#atlasPCT method and are not typically created directly.

For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#atlasPCT.

Constructor

new PCTAtlasFile(loader, key, [atlasURL], [path], [baseURL], [atlasXhrSettings], [textureXhrSettings])

Parameters

nametypeoptionaldescription
loaderPhaser.Loader.LoaderPluginNoA reference to the Loader that is responsible for this file.
keystring | Phaser.Types.Loader.FileTypes.PCTAtlasFileConfigNoThe key of the file. Must be unique within both the Loader and the Texture Manager. Or a config object.
atlasURLstringYesThe absolute or relative URL to load the PCT data file from.
pathstringYesOptional path to use when loading the textures defined in the PCT data.
baseURLstringYesOptional Base URL to use when loading the textures defined in the PCT data.
atlasXhrSettingsPhaser.Types.Loader.XHRSettingsObjectYesExtra XHR Settings specifically for the PCT data file.
textureXhrSettingsPhaser.Types.Loader.XHRSettingsObjectYesExtra XHR Settings specifically for the texture files.

Scope: static

Extends

Phaser.Loader.MultiFile

Source: src/loader/filetypes/PCTAtlasFile.js#L64
Since: 4.0.0

Inherited Methods

From Phaser.Loader.MultiFile:


Public Methods

addToCache

<instance> addToCache()

Description:

Adds this file to its target caches upon successful loading and processing. The decoded PCT data is added to the Atlas Cache, and the loaded texture images together with the decoded frame data are added to the Texture Manager as a single multi-source texture.

Source: src/loader/filetypes/PCTAtlasFile.js#L194
Since: 4.0.0


onFileComplete

<instance> onFileComplete(file)

Description:

Called by each File when it finishes loading. When the PCT data file completes, this method inspects its decoded pages array and dynamically creates and queues an ImageFile for every texture page referenced within it. The Loader's baseURL, path, and prefix are temporarily overridden to those specified in the PCTAtlasFile config during this process, then restored afterwards.

Parameters:

nametypeoptionaldescription
filePhaser.Loader.FileNoThe File that has completed processing.

Overrides: Phaser.Loader.MultiFile#onFileComplete

Source: src/loader/filetypes/PCTAtlasFile.js#L132
Since: 4.0.0


Inherited Members

From Phaser.Loader.MultiFile: