using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Revitalize.Framework.Graphics { public class TextureManager { public static Dictionary TextureManagers = new Dictionary(); public Dictionary textures; public TextureManager() { this.textures = new Dictionary(); } public void addTexture(string name, Texture2DExtended texture) { this.textures.Add(name, texture); } /// Returns a Texture2DExtended held by the manager. public Texture2DExtended getTexture(string name) { foreach (var v in this.textures) { if (v.Key == name) return v.Value.Copy(); } throw new Exception("Error, texture name not found!!!"); } public static void addTexture(string managerName, string textureName, Texture2DExtended Texture) { Texture.texture.Name = managerName + '.' + textureName; TextureManagers[managerName].addTexture(textureName, Texture); } } }