diff --git a/ANX.Framework/ANX.Framework.csproj b/ANX.Framework/ANX.Framework.csproj
index c51d48ed..86bd0fbe 100644
--- a/ANX.Framework/ANX.Framework.csproj
+++ b/ANX.Framework/ANX.Framework.csproj
@@ -174,6 +174,7 @@
+
diff --git a/ANX.Framework/Graphics/GraphicsDevice.cs b/ANX.Framework/Graphics/GraphicsDevice.cs
index c41f7978..c55e120c 100644
--- a/ANX.Framework/Graphics/GraphicsDevice.cs
+++ b/ANX.Framework/Graphics/GraphicsDevice.cs
@@ -94,6 +94,21 @@ namespace ANX.Framework.Graphics
this.samplerStateCollection = new SamplerStateCollection(this, 8); //TODO: get maximum number of sampler states from capabilities
}
+ ~GraphicsDevice()
+ {
+ this.Dispose(false);
+ }
+
+ public void Clear(ClearOptions options, Color color, float depth, int stencil)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void Clear(ClearOptions options, Vector4 color, float depth, int stencil)
+ {
+ throw new NotImplementedException();
+ }
+
public void Clear(Color color)
{
nativeDevice.Clear(ref color);
@@ -104,6 +119,11 @@ namespace ANX.Framework.Graphics
nativeDevice.Present();
}
+ public void Present(Nullable sourceRectangle, Nullable destinationRectangle, IntPtr overrideWindowHandle)
+ {
+ throw new NotImplementedException();
+ }
+
public void DrawIndexedPrimitives(PrimitiveType primitiveType, int baseVertex, int minVertexIndex, int numVertices, int startIndex, int primitiveCount)
{
nativeDevice.DrawIndexedPrimitives(primitiveType, baseVertex, minVertexIndex, numVertices, startIndex, primitiveCount);
@@ -226,6 +246,11 @@ namespace ANX.Framework.Graphics
throw new NotImplementedException();
}
+ protected virtual void Dispose(Boolean disposeManaged)
+ {
+ throw new NotImplementedException();
+ }
+
public INativeGraphicsDevice NativeDevice
{
get
@@ -455,5 +480,53 @@ namespace ANX.Framework.Graphics
throw new NotImplementedException();
}
}
+
+ protected void raise_Disposing(object sender, EventArgs args)
+ {
+ if (Disposing != null)
+ {
+ Disposing(sender, args);
+ }
+ }
+
+ protected void raise_DeviceResetting(object sender, EventArgs args)
+ {
+ if (DeviceResetting != null)
+ {
+ DeviceResetting(sender, args);
+ }
+ }
+
+ protected void raise_DeviceReset(object sender, EventArgs args)
+ {
+ if (DeviceReset != null)
+ {
+ DeviceReset(sender, args);
+ }
+ }
+
+ protected void raise_DeviceLost(object sender, EventArgs args)
+ {
+ if (DeviceLost != null)
+ {
+ DeviceLost(sender, args);
+ }
+ }
+
+ protected void raise_ResourceCreated(object sender, ResourceCreatedEventArgs args)
+ {
+ if (ResourceCreated != null)
+ {
+ ResourceCreated(sender, args);
+ }
+ }
+
+ protected void raise_ResourceDestroyed(object sender, ResourceDestroyedEventArgs args)
+ {
+ if (ResourceDestroyed != null)
+ {
+ ResourceDestroyed(sender, args);
+ }
+ }
}
}
diff --git a/ANX.Framework/Graphics/IDynamicGraphicsResource.cs b/ANX.Framework/Graphics/IDynamicGraphicsResource.cs
new file mode 100644
index 00000000..1dde1a2a
--- /dev/null
+++ b/ANX.Framework/Graphics/IDynamicGraphicsResource.cs
@@ -0,0 +1,63 @@
+#region Using Statements
+using System;
+
+#endregion // Using Statements
+
+#region License
+
+//
+// This file is part of the ANX.Framework created by the "ANX.Framework developer group".
+//
+// This file is released under the Ms-PL license.
+//
+//
+//
+// Microsoft Public License (Ms-PL)
+//
+// This license governs use of the accompanying software. If you use the software, you accept this license.
+// If you do not accept the license, do not use the software.
+//
+// 1.Definitions
+// The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning
+// here as under U.S. copyright law.
+// A "contribution" is the original software, or any additions or changes to the software.
+// A "contributor" is any person that distributes its contribution under this license.
+// "Licensed patents" are a contributor's patent claims that read directly on its contribution.
+//
+// 2.Grant of Rights
+// (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations
+// in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to
+// reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution
+// or any derivative works that you create.
+// (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in
+// section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed
+// patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution
+// in the software or derivative works of the contribution in the software.
+//
+// 3.Conditions and Limitations
+// (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks.
+// (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your
+// patent license from such contributor to the software ends automatically.
+// (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution
+// notices that are present in the software.
+// (D) If you distribute any portion of the software in source code form, you may do so only under this license by including
+// a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or
+// object code form, you may only do so under a license that complies with this license.
+// (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees,
+// or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the
+// extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a
+// particular purpose and non-infringement.
+
+#endregion // License
+
+namespace ANX.Framework.Graphics
+{
+ internal interface IDynamicGraphicsResource
+ {
+ event EventHandler ContentLost;
+
+ void SetContentLost(bool isContentLost);
+
+ bool IsContentLost { get; }
+ }
+}
diff --git a/ANX.Framework/Graphics/RenderTarget2D.cs b/ANX.Framework/Graphics/RenderTarget2D.cs
index 69b86091..2c43429e 100644
--- a/ANX.Framework/Graphics/RenderTarget2D.cs
+++ b/ANX.Framework/Graphics/RenderTarget2D.cs
@@ -57,7 +57,7 @@ using ANX.Framework.Graphics;
namespace ANX.Framework.Graphics
{
- public class RenderTarget2D : Texture2D
+ public class RenderTarget2D : Texture2D, IDynamicGraphicsResource
{
public event EventHandler ContentLost;
@@ -79,6 +79,11 @@ namespace ANX.Framework.Graphics
throw new NotImplementedException();
}
+ protected virtual void Dispose(Boolean disposeManaged)
+ {
+ throw new NotImplementedException();
+ }
+
public DepthFormat DepthStencilFormat
{
get
@@ -111,6 +116,17 @@ namespace ANX.Framework.Graphics
}
}
+ void IDynamicGraphicsResource.SetContentLost(bool isContentLost)
+ {
+ throw new NotImplementedException();
+ }
+ protected void raise_ContentLost(object sender, EventArgs args)
+ {
+ if (ContentLost != null)
+ {
+ ContentLost(sender, args);
+ }
+ }
}
}
diff --git a/ANX.Framework/Graphics/RenderTargetCube.cs b/ANX.Framework/Graphics/RenderTargetCube.cs
index 73aa0563..e8c6d6c9 100644
--- a/ANX.Framework/Graphics/RenderTargetCube.cs
+++ b/ANX.Framework/Graphics/RenderTargetCube.cs
@@ -57,7 +57,7 @@ using ANX.Framework.Graphics;
namespace ANX.Framework.Graphics
{
- public class RenderTargetCube : TextureCube
+ public class RenderTargetCube : TextureCube, IDynamicGraphicsResource
{
public event EventHandler ContentLost;
@@ -73,6 +73,11 @@ namespace ANX.Framework.Graphics
throw new NotImplementedException();
}
+ protected virtual void Dispose(Boolean disposeManaged)
+ {
+ throw new NotImplementedException();
+ }
+
public DepthFormat DepthStencilFormat
{
get
@@ -105,6 +110,17 @@ namespace ANX.Framework.Graphics
}
}
+ void IDynamicGraphicsResource.SetContentLost(bool isContentLost)
+ {
+ throw new NotImplementedException();
+ }
+ protected void raise_ContentLost(object sender, EventArgs args)
+ {
+ if (ContentLost != null)
+ {
+ ContentLost(sender, args);
+ }
+ }
}
}