2011-10-31 05:36:24 +00:00
|
|
|
using System;
|
2012-01-16 15:03:28 +00:00
|
|
|
using System.Runtime.InteropServices;
|
2012-08-09 09:45:04 +00:00
|
|
|
using ANX.Framework.NonXNA;
|
2011-10-31 05:36:24 +00:00
|
|
|
|
2012-08-09 09:45:04 +00:00
|
|
|
// 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
|
2011-10-31 05:36:24 +00:00
|
|
|
|
|
|
|
namespace ANX.Framework.Graphics
|
|
|
|
{
|
2012-08-09 09:45:04 +00:00
|
|
|
public abstract class GraphicsResource : IDisposable
|
|
|
|
{
|
|
|
|
public event EventHandler<EventArgs> Disposing;
|
|
|
|
|
|
|
|
public GraphicsResource()
|
|
|
|
{
|
|
|
|
GraphicsResourceTracker.Instance.RegisterTrackedObject(this);
|
|
|
|
}
|
2011-10-31 05:36:24 +00:00
|
|
|
|
2012-08-09 09:45:04 +00:00
|
|
|
~GraphicsResource()
|
|
|
|
{
|
|
|
|
GraphicsResourceTracker.Instance.UnregisterTrackedObject(this);
|
|
|
|
}
|
2011-10-31 05:36:24 +00:00
|
|
|
|
2012-08-09 09:45:04 +00:00
|
|
|
public GraphicsResource(GraphicsDevice device)
|
|
|
|
{
|
|
|
|
this.GraphicsDevice = device;
|
|
|
|
GraphicsResourceTracker.Instance.RegisterTrackedObject(this);
|
|
|
|
}
|
2011-10-31 05:36:24 +00:00
|
|
|
|
2012-08-09 09:45:04 +00:00
|
|
|
public GraphicsDevice GraphicsDevice
|
|
|
|
{
|
|
|
|
get;
|
|
|
|
set;
|
|
|
|
}
|
2011-10-31 05:36:24 +00:00
|
|
|
|
2012-08-09 09:45:04 +00:00
|
|
|
public bool IsDisposed
|
|
|
|
{
|
|
|
|
get;
|
|
|
|
internal set;
|
|
|
|
}
|
2011-10-31 05:36:24 +00:00
|
|
|
|
2012-08-09 09:45:04 +00:00
|
|
|
public string Name
|
|
|
|
{
|
|
|
|
get;
|
|
|
|
set;
|
|
|
|
}
|
2011-10-31 05:36:24 +00:00
|
|
|
|
2012-08-09 09:45:04 +00:00
|
|
|
public object Tag
|
|
|
|
{
|
|
|
|
get;
|
|
|
|
set;
|
|
|
|
}
|
2011-10-31 05:36:24 +00:00
|
|
|
|
2012-08-09 09:45:04 +00:00
|
|
|
public abstract void Dispose();
|
2011-10-31 05:36:24 +00:00
|
|
|
|
2012-08-09 09:45:04 +00:00
|
|
|
protected void raise_Disposing(object sender, EventArgs args)
|
|
|
|
{
|
|
|
|
if (Disposing != null)
|
|
|
|
{
|
|
|
|
Disposing(sender, args);
|
|
|
|
}
|
|
|
|
}
|
2011-10-31 05:36:24 +00:00
|
|
|
|
2012-08-09 09:45:04 +00:00
|
|
|
protected virtual void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged)
|
|
|
|
{
|
|
|
|
}
|
2011-10-31 05:36:24 +00:00
|
|
|
|
2012-08-09 09:45:04 +00:00
|
|
|
public override string ToString()
|
|
|
|
{
|
|
|
|
return base.ToString();
|
|
|
|
}
|
|
|
|
}
|
2011-10-31 05:36:24 +00:00
|
|
|
}
|