using System.Collections.Generic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; namespace StardustCore.UIUtilities { /// A class that keeps track of a collection of textures that are layered one on top of the others. public class LayeredTexture { public List> textureLayers; public LayeredTexture(List> textures) { this.textureLayers = textures; } /// Adds a new texture as the top layer. public void addTexture(KeyValuePair texture) { this.textureLayers.Add(texture); } /// Adds a new texture at a specific layer depth. public void addTexture(KeyValuePair texture, int index) { this.textureLayers.Insert(index, texture); } public LayeredTexture Copy() { return new LayeredTexture(this.textureLayers); } public void draw(SpriteBatch b, Color color, float layerDepth) { foreach (var texture in this.textureLayers) b.Draw(texture.Value.getTexture(), texture.Key, color); } } }