Changed implementation of IDisposable to proper way.
This commit is contained in:
parent
e137796b46
commit
3bbbd672be
@ -1,10 +1,12 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using RecrownedAthenaeum.Camera;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@ -14,6 +16,8 @@ namespace RecrownedAthenaeum.ScreenSystem
|
||||
|
||||
public class ScreenManager : IDisposable
|
||||
{
|
||||
bool disposed = false;
|
||||
|
||||
public event FirstScreenChange RequireNextScreenEvent;
|
||||
private GraphicsDeviceManager graphics;
|
||||
private Screen previousScreen;
|
||||
@ -131,7 +135,18 @@ namespace RecrownedAthenaeum.ScreenSystem
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
previousScreenRenderTarget?.Dispose();
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
public virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (disposed) return;
|
||||
if (disposing)
|
||||
{
|
||||
previousScreenRenderTarget?.Dispose();
|
||||
}
|
||||
disposing = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user