MCPcopy Index your code
hub / github.com/4ian/GDevelop / loadTileMap

Method loadTileMap

Extensions/TileMap/JsExtension.js:2227–2288  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2225 );
2226
2227 const loadTileMap = () => {
2228 /** @type {TileMapHelper.TileMapManager} */
2229 const manager = TilemapHelper.TileMapManager.getManager(
2230 this._project
2231 );
2232 try {
2233 manager.getOrLoadSimpleTileMap(
2234 tilemapAsJSObject,
2235 this._objectName,
2236 tileSize,
2237 columnCount,
2238 rowCount,
2239 (tileMap) => {
2240 if (this._wasDestroyed) return;
2241 if (!tileMap) {
2242 this._onLoadingError();
2243 console.error('Could not parse tilemap.');
2244 return;
2245 }
2246
2247 this._editableTileMap = tileMap;
2248
2249 manager.getOrLoadSimpleTileMapTextureCache(
2250 (textureName) =>
2251 this._pixiResourcesLoader.getPIXITexture(
2252 this._project,
2253 textureName
2254 ),
2255 atlasImageResourceName,
2256 tileSize,
2257 columnCount,
2258 rowCount,
2259 (
2260 /** @type {TileMapHelper.TileTextureCache | null} */
2261 textureCache
2262 ) => {
2263 if (this._wasDestroyed) return;
2264 this._onLoadingSuccess();
2265 if (!this._editableTileMap) return;
2266
2267 this.width = this._editableTileMap.getWidth();
2268 this.height = this._editableTileMap.getHeight();
2269 TilemapHelper.PixiTileMapHelper.updatePixiTileMap(
2270 this.tileMapPixiObject,
2271 this._editableTileMap,
2272 textureCache,
2273 'all', // No notion of visibility on simple tile maps.
2274 0, // Only one layer is used on simple tile maps.
2275 0,
2276 this._editableTileMap.getDimensionX(),
2277 0,
2278 this._editableTileMap.getDimensionY()
2279 );
2280 }
2281 );
2282 }
2283 );
2284 } catch (error) {

Callers

nothing calls this directly

Calls 12

_onLoadingErrorMethod · 0.95
_onLoadingSuccessMethod · 0.95
errorMethod · 0.65
getWidthMethod · 0.65
getHeightMethod · 0.65
getManagerMethod · 0.45
getPIXITextureMethod · 0.45
updatePixiTileMapMethod · 0.45
getDimensionXMethod · 0.45
getDimensionYMethod · 0.45

Tested by

no test coverage detected