From 17a5b3ec74c2d58f3f55190a65660586bbee91f1 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Thu, 30 Apr 2020 15:57:20 +0200 Subject: [PATCH] only render visible layers --- MLEM.Extended/Tiled/IndividualTiledMapRenderer.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/MLEM.Extended/Tiled/IndividualTiledMapRenderer.cs b/MLEM.Extended/Tiled/IndividualTiledMapRenderer.cs index 17e4d1f..d844edc 100644 --- a/MLEM.Extended/Tiled/IndividualTiledMapRenderer.cs +++ b/MLEM.Extended/Tiled/IndividualTiledMapRenderer.cs @@ -58,8 +58,10 @@ namespace MLEM.Extended.Tiled { } public void Draw(SpriteBatch batch, RectangleF? frustum = null, DrawDelegate drawFunction = null) { - for (var i = 0; i < this.map.TileLayers.Count; i++) - this.DrawLayer(batch, i, frustum, drawFunction); + for (var i = 0; i < this.map.TileLayers.Count; i++) { + if (this.map.TileLayers[i].IsVisible) + this.DrawLayer(batch, i, frustum, drawFunction); + } } public void DrawLayer(SpriteBatch batch, int layerIndex, RectangleF? frustum = null, DrawDelegate drawFunction = null) {