axiosengine/axios/Engine/GameServices.cs
Nathan Adams ba49c70a91 Adding mono project
adding game services static class to make it easier to access graphics device
adding axiosengine factory with extension to create texture from list of textures
2014-11-30 11:50:21 -06:00

40 lines
941 B
C#

using Microsoft.Xna.Framework;
namespace Axios.Engine
{
public static class GameServices
{
private static GameServiceContainer container;
private static object lockobj;
public static GameServiceContainer Instance
{
get
{
lock (GameServices.lockobj)
{
if (container == null)
{
container = new GameServiceContainer();
}
}
return container;
}
}
public static T GetService<T>()
{
return (T)Instance.GetService(typeof(T));
}
public static void AddService<T>(T service)
{
Instance.AddService(typeof(T), service);
}
public static void RemoveService<T>()
{
Instance.RemoveService(typeof(T));
}
}
}