- Refactored the AddIn-System to allow merged assemblies (for metro, android, etc. later on) - Added empty PsVita Sound and Media System modules - Fixed 2 small missing excludes in the build script - Cleaned the License headers in the shader files - Some other refactorings
70 lines
1.7 KiB
C#
70 lines
1.7 KiB
C#
#region Using Statements
|
|
using System.Collections.Generic;
|
|
using ANX.Framework.Graphics;
|
|
|
|
#endregion
|
|
|
|
// This file is part of the ANX.Framework created by the
|
|
// "ANX.Framework developer group" and released under the Ms-PL license.
|
|
// For details see: http://anxframework.codeplex.com/license
|
|
|
|
namespace ANX.Framework.NonXNA
|
|
{
|
|
public class GraphicsResourceTracker
|
|
{
|
|
#region Private members
|
|
private static GraphicsResourceTracker instance;
|
|
private static List<GraphicsResource> trackedGraphicsResources;
|
|
|
|
#endregion // Private members
|
|
|
|
static GraphicsResourceTracker()
|
|
{
|
|
trackedGraphicsResources = new List<GraphicsResource>();
|
|
}
|
|
|
|
//~GraphicsResourceTracker()
|
|
//{
|
|
// if (trackedGraphicsResources.Count > 0)
|
|
// {
|
|
// throw new Exception("The GraphicsResourceTracker is going to be destroyed but is still tracking some objects.");
|
|
// }
|
|
//}
|
|
|
|
public static GraphicsResourceTracker Instance
|
|
{
|
|
get
|
|
{
|
|
if (instance == null)
|
|
{
|
|
instance = new GraphicsResourceTracker();
|
|
}
|
|
|
|
return instance;
|
|
}
|
|
}
|
|
|
|
public void UpdateGraphicsDeviceReference(GraphicsDevice newGraphicsDevice)
|
|
{
|
|
foreach (GraphicsResource resource in trackedGraphicsResources)
|
|
{
|
|
resource.GraphicsDevice = newGraphicsDevice;
|
|
resource.GraphicsDevice.NativeDevice = newGraphicsDevice.NativeDevice;
|
|
}
|
|
}
|
|
|
|
public void RegisterTrackedObject(GraphicsResource graphicsResource)
|
|
{
|
|
if (trackedGraphicsResources.Contains(graphicsResource) == false)
|
|
{
|
|
trackedGraphicsResources.Add(graphicsResource);
|
|
}
|
|
}
|
|
|
|
public void UnregisterTrackedObject(GraphicsResource graphicsResource)
|
|
{
|
|
trackedGraphicsResources.Remove(graphicsResource);
|
|
}
|
|
}
|
|
}
|