- Started Windows, Metro and Linux Platform-Plugins - Moved the RecordingSample to the Samples folder - Started two samples for using the graphics device in a WinForms and Wpf Editor - Refactorings in the AddIn-System - Moved the Window initialization-code to the Platform modules - Changed the License text in all code files which is now way smaller - Started ProjectConverter tool which converts all the projects and solution to the target configuration - Changed the SupportedPlatform names in the Resource files - Changed the WIN8 define to WINDOWSMETRO which is actually meant - Removed NLog and started our own Logger class - Many more stuff...
71 lines
2.1 KiB
C#
71 lines
2.1 KiB
C#
#region Using Statements
|
|
using System;
|
|
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);
|
|
}
|
|
}
|
|
}
|