Ejemplo n.º 1
0
        /// <summary>
        /// Returns a texture.
        /// </summary>
        /// <param name="name">The name of the texture.</param>
        /// <param name="r">The rectangle to get the texture from.</param>
        /// <param name="texturePath">The texture path to load a texture from.</param>
        public static Texture2D GetTexture(string name, Rectangle r, string texturePath)
        {
            // -- Temp workaround
            texturePath = texturePath.Replace(@"\", @"|");

            var path = !string.IsNullOrEmpty(texturePath) ? $"{texturePath}|{name}" : name;
            var key  = path + "," + r.X + "," + r.Y + "," + r.Width + "," + r.Height;

            if (!TextureList.ContainsKey(key))
            {
                TextureList.Add(key, TextureRectangle(GetTexture(path), r));
            }
            return(TextureList[key]);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns a texture.
        /// </summary>
        /// <param name="path">The path to the texture.</param>
        public static Texture2D GetTexture(string path)
        {
            // -- Temp workaround
            path = path.Replace(@"\", @"|");

            var key = $"{path},FULL_IMAGE";

            if (!TextureList.ContainsKey(key))
            {
                TextureList.Add(key, new ContentFolder().GetTexture(path));
            }

            return(TextureList[key]);
        }