ba49c70a91
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
40 lines
941 B
C#
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));
|
|
}
|
|
}
|
|
}
|