1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-22 20:58:34 +01:00

only render visible layers

This commit is contained in:
Ellpeck 2020-04-30 15:57:20 +02:00
parent 36b7a16e24
commit 17a5b3ec74

View file

@ -58,9 +58,11 @@ namespace MLEM.Extended.Tiled {
} }
public void Draw(SpriteBatch batch, RectangleF? frustum = null, DrawDelegate drawFunction = null) { public void Draw(SpriteBatch batch, RectangleF? frustum = null, DrawDelegate drawFunction = null) {
for (var i = 0; i < this.map.TileLayers.Count; i++) for (var i = 0; i < this.map.TileLayers.Count; i++) {
if (this.map.TileLayers[i].IsVisible)
this.DrawLayer(batch, i, frustum, drawFunction); this.DrawLayer(batch, i, frustum, drawFunction);
} }
}
public void DrawLayer(SpriteBatch batch, int layerIndex, RectangleF? frustum = null, DrawDelegate drawFunction = null) { public void DrawLayer(SpriteBatch batch, int layerIndex, RectangleF? frustum = null, DrawDelegate drawFunction = null) {
var frust = frustum ?? new RectangleF(0, 0, float.MaxValue, float.MaxValue); var frust = frustum ?? new RectangleF(0, 0, float.MaxValue, float.MaxValue);