add ServicesContainer object to IApplication

This commit is contained in:
Gered 2013-08-22 18:34:52 -04:00
parent eaccf9f875
commit d6809cadb5
3 changed files with 10 additions and 0 deletions

View file

@ -20,6 +20,7 @@ namespace Blarg.GameFramework
public abstract PlatformType Type { get; } public abstract PlatformType Type { get; }
public abstract ILogger Logger { get; } public abstract ILogger Logger { get; }
public ServiceContainer Services { get; private set; }
public abstract IFileSystem FileSystem { get; } public abstract IFileSystem FileSystem { get; }
public abstract IKeyboard Keyboard { get; } public abstract IKeyboard Keyboard { get; }
public abstract IMouse Mouse { get; } public abstract IMouse Mouse { get; }
@ -44,12 +45,15 @@ namespace Blarg.GameFramework
protected void OnInit() protected void OnInit()
{ {
Logger.Info(LOG_TAG, "Initializing application objects."); Logger.Info(LOG_TAG, "Initializing application objects.");
Services = new ServiceContainer();
GraphicsDevice = new GraphicsDevice(); GraphicsDevice = new GraphicsDevice();
} }
protected void OnShutdown() protected void OnShutdown()
{ {
Logger.Info(LOG_TAG, "Shutting down."); Logger.Info(LOG_TAG, "Shutting down.");
Services.Dispose();
Services = null;
} }
protected void OnAppGainFocus() protected void OnAppGainFocus()

View file

@ -13,6 +13,7 @@ namespace Blarg.GameFramework
PlatformType Type { get; } PlatformType Type { get; }
ILogger Logger { get; } ILogger Logger { get; }
ServiceContainer Services { get; }
IFileSystem FileSystem { get; } IFileSystem FileSystem { get; }
IKeyboard Keyboard { get; } IKeyboard Keyboard { get; }
IMouse Mouse { get; } IMouse Mouse { get; }

View file

@ -40,6 +40,11 @@ namespace Blarg.GameFramework
get { return Application.Logger; } get { return Application.Logger; }
} }
public static ServiceContainer Services
{
get { return Application.Services; }
}
public static IFileSystem FileSystem public static IFileSystem FileSystem
{ {
get { return Application.FileSystem; } get { return Application.FileSystem; }