From 54ea6905a2c4ec73f2436dddcb9fb2d7c4555a86 Mon Sep 17 00:00:00 2001 From: Harrison Date: Thu, 20 Feb 2020 16:07:56 -0500 Subject: [PATCH] added dispose to texture batch --- RecrownedGTK/Graphics/Render/Batch.cs | 18 ----------- RecrownedGTK/Graphics/Render/TextureBatch.cs | 34 ++++++++++++++++++++ 2 files changed, 34 insertions(+), 18 deletions(-) delete mode 100644 RecrownedGTK/Graphics/Render/Batch.cs create mode 100644 RecrownedGTK/Graphics/Render/TextureBatch.cs diff --git a/RecrownedGTK/Graphics/Render/Batch.cs b/RecrownedGTK/Graphics/Render/Batch.cs deleted file mode 100644 index 1d2a17b..0000000 --- a/RecrownedGTK/Graphics/Render/Batch.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -namespace RecrownedGTK.Graphics.Render { - public class Batch { - private bool begun; - public Batch() { - //TODO: Finish this class. - } - public void Begin() { - if (begun) throw new InvalidOperationException("This batch has already been started."); - begun = true; - } - - public void End() { - if (!begun) throw new InvalidOperationException("The batch has not begun."); - begun = false; - } - } -} \ No newline at end of file diff --git a/RecrownedGTK/Graphics/Render/TextureBatch.cs b/RecrownedGTK/Graphics/Render/TextureBatch.cs new file mode 100644 index 0000000..915b93f --- /dev/null +++ b/RecrownedGTK/Graphics/Render/TextureBatch.cs @@ -0,0 +1,34 @@ +using System; +namespace RecrownedGTK.Graphics.Render { + public class TextureBatch : IDisposable { + private bool disposed; + private bool begun; + public TextureBatch() { + //TODO: Finish this class. + } + public void Begin() { + if (begun) throw new InvalidOperationException("This TextureBatch has already been started."); + begun = true; + } + + public void End() { + if (!begun) throw new InvalidOperationException("The TextureBatch has not begun."); + begun = false; + } + protected virtual void Dispose(bool disposing) { + if (disposed) return; + if (disposing) { + } + + disposed = true; + } + public void Dispose() { + Dispose(true); + GC.SuppressFinalize(this); + } + + ~TextureBatch() { + Dispose(false); + } + } +} \ No newline at end of file