/*
* TextureManager.cs
* Authors: August Zinsser
*
* Copyright Matthew Belmonte 2007
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using System.IO;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
using Nuclex.Fonts;
namespace tAC_Engine
{
//public static enum TextureID { };
///
/// Loads texture content from the content pipeline. Also stores a global resolution setting and automatically
/// prunes large mipmaps from a file according to this setting, allowing client classes to load a texture
/// without worrying about the game's current resolution settings.
/// On files without mipmaps, using this class will return the same data as XNA's ContentManager.
///
public static class TextureManager
{
public enum LevelOfDetail {High, Medium, Low};
private static int mLevelOfDetail = (int)LevelOfDetail.High;
///
/// Maximum mipmap for textures loaded with the TextureManager class
///
public static LevelOfDetail LOD
{
set { mLevelOfDetail = (int)value; }
get { return (LevelOfDetail)mLevelOfDetail; }
}
// Stores all the textures to be referenced within the game. Currently uses strings for key lookups but
// should later be switched to an enum for efficency.
private static Dictionary mTextureDatabase = new Dictionary();
///
/// Loads in the texture2D if it hasn't been done so already and return the reference to it to be used for drawing.
/// Differences in resolution/quality of images should be handled via mipmaps rather than different images.
///
public static Texture2D Load(string assetPath)
{
if (!mTextureDatabase.ContainsKey(assetPath))
{
mTextureDatabase.Add(assetPath, GenericBaseApplication.GameManager.ContentManager.Load(
Directory.GetCurrentDirectory() + "\\" + assetPath));
}
return mTextureDatabase[assetPath];
}
}
}