Skip to content

Commit

Permalink
fix empty texture
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanpopelyshev committed Apr 22, 2020
1 parent 9c8229b commit 5deaa35
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion demo/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ loader.load(function (loader, resources) {
//first parameter means z-layer, which is not used yet
//second parameter is list of textures for layers
stage = new PIXI.Container();
tilemap = new PIXI.tilemap.CompositeRectTileLayer(0, [resources['atlas_image'].texture]);
tilemap = new PIXI.tilemap.CompositeRectTileLayer();
stage.addChild(tilemap);

animate();
Expand Down
6 changes: 6 additions & 0 deletions src/CompositeRectTileLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ namespace pixi_tilemap {
}

setBitmaps(bitmaps: Array<PIXI.Texture>) {
for (let i=0;i<bitmaps.length;i++) {
if (bitmaps[i] && !bitmaps[i].baseTexture) {
throw new Error(`pixi-tilemap cannot use destroyed textures. `+
`Probably, you passed resources['myAtlas'].texture in pixi > 5.2.1, it does not exist there.`);
}
}
let texPerChild = this.texPerChild;
let len1 = this.children.length;
let len2 = Math.ceil(bitmaps.length / texPerChild);
Expand Down

0 comments on commit 5deaa35

Please sign in to comment.