mirror of
https://github.com/wassname/phaser.git
synced 2026-07-24 13:10:53 +08:00
move 'dirty' flag for Tilemap to a per-layer flag. Fixes #242
This commit is contained in:
+5
-15
@@ -48,11 +48,6 @@ Phaser.Tilemap = function (game, key) {
|
||||
|
||||
this.debugMap = [];
|
||||
|
||||
/**
|
||||
* @property {boolean} dirty - Internal rendering related flag.
|
||||
*/
|
||||
this.dirty = false;
|
||||
|
||||
/**
|
||||
* @property {array} _results - Internal var.
|
||||
* @private
|
||||
@@ -120,14 +115,12 @@ Phaser.Tilemap.prototype = {
|
||||
tileSpacing: 0,
|
||||
format: Phaser.Tilemap.CSV,
|
||||
data: data,
|
||||
indexes: []
|
||||
|
||||
indexes: [],
|
||||
dirty: true
|
||||
});
|
||||
|
||||
this.currentLayer = this.layers.length - 1;
|
||||
|
||||
this.dirty = true;
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -187,10 +180,9 @@ Phaser.Tilemap.prototype = {
|
||||
if (x >= 0 && x < this.layers[layer].width && y >= 0 && y < this.layers[layer].height)
|
||||
{
|
||||
this.layers[layer].data[y][x] = index;
|
||||
this.layers[layer].dirty = true;
|
||||
}
|
||||
|
||||
this.dirty = true;
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -254,10 +246,9 @@ Phaser.Tilemap.prototype = {
|
||||
if (x >= 0 && x < this.layers[layer].width && y >= 0 && y < this.layers[layer].height)
|
||||
{
|
||||
this.layers[layer].data[y][x] = index;
|
||||
this.layers[layer].dirty = true;
|
||||
}
|
||||
|
||||
this.dirty = true;
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -349,8 +340,7 @@ Phaser.Tilemap.prototype = {
|
||||
this.layers[layer].data[ diffY + tileblock[i].y ][ diffX + tileblock[i].x ] = tileblock[i].index;
|
||||
}
|
||||
|
||||
this.dirty = true;
|
||||
|
||||
this.layers[layer].dirty = true;
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -359,7 +359,7 @@ Phaser.TilemapLayer.prototype.updateMapData = function (tilemap, layer) {
|
||||
this.layer = this.tilemap.layers[layer];
|
||||
this.index = layer;
|
||||
this.updateMax();
|
||||
this.tilemap.dirty = true;
|
||||
this.tilemap.layers[layer].dirty = true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -633,7 +633,7 @@ Phaser.TilemapLayer.prototype.updateMax = function () {
|
||||
*/
|
||||
Phaser.TilemapLayer.prototype.render = function () {
|
||||
|
||||
if (this.tilemap && this.tilemap.dirty)
|
||||
if (this.tilemap && this.tilemap.layers[this.index].dirty )
|
||||
{
|
||||
this.dirty = true;
|
||||
}
|
||||
@@ -694,10 +694,10 @@ Phaser.TilemapLayer.prototype.render = function () {
|
||||
|
||||
this.dirty = false;
|
||||
|
||||
if (this.tilemap.dirty)
|
||||
{
|
||||
this.tilemap.dirty = false;
|
||||
}
|
||||
if( this.tilemap.layers[this.index].dirty )
|
||||
{
|
||||
this.tilemap.layers[this.index].dirty = false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user