Files
MonoGame.Extended/Source/MonoGame.Extended/Content/ContentManagerExtensions.cs
T
2015-09-18 17:38:28 +10:00

26 lines
907 B
C#

using System.IO;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
namespace MonoGame.Extended.Content
{
public static class ContentManagerExtensions
{
public const string DirectorySeparatorChar = "/";
public static Stream OpenStream(this ContentManager contentManager, string path)
{
return TitleContainer.OpenStream(contentManager.RootDirectory + DirectorySeparatorChar + path);
}
public static GraphicsDevice GetGraphicsDevice(this ContentManager contentManager)
{
// http://konaju.com/?p=21
var serviceProvider = contentManager.ServiceProvider;
var graphicsDeviceService = (IGraphicsDeviceService) serviceProvider.GetService(typeof(IGraphicsDeviceService));
return graphicsDeviceService.GraphicsDevice;
}
}
}