#endregion
using System;
+using System.Collections.Generic;
using System.Diagnostics;
using OpenTK.Graphics;
using OpenTK.Input;
/// </summary>
abstract class PlatformFactoryBase : IPlatformFactory
{
+ static readonly object sync = new object();
+ readonly List<IDisposable> Resources = new List<IDisposable>();
+
protected bool IsDisposed;
public PlatformFactoryBase()
{
}
+ #region Protected Members
+
+ protected void RegisterResource(IDisposable resource)
+ {
+ lock (sync)
+ {
+ Resources.Add(resource);
+ }
+ }
+
+ #endregion
+
#region IPlatformFactory Members
public abstract INativeWindow CreateNativeWindow(int x, int y, int width, int height, string title, GraphicsMode mode, GameWindowFlags options, DisplayDevice device);
{
if (manual)
{
+ lock (sync)
+ {
+ foreach (var resource in Resources)
+ {
+ resource.Dispose();
+ }
+ }
}
else
{