space-pew/SpacePew/TextureManager.cs

30 lines
593 B
C#
Raw Normal View History

2015-12-04 10:23:49 +01:00
using System.Collections.Generic;
using Microsoft.Xna.Framework.Graphics;
namespace SpacePew
{
public static class TextureManager
{
private static MainGame _game;
static readonly Dictionary<string, Texture2D> Textures = new Dictionary<string, Texture2D>();
public static void Initialize(MainGame game)
{
_game = game;
}
public static Texture2D LoadTexture(string assetName)
{
if (!Textures.ContainsKey(assetName))
{
var texture = _game.Content.Load<Texture2D>(assetName);
Textures.Add(assetName, texture);
}
return Textures[assetName];
}
}
}