[Mac] Resource registration moved to the facades

This commit is contained in:
thefiddler 2014-07-23 14:36:09 +02:00
parent ac2ae4a4bb
commit 050a93d4af

View file

@ -43,35 +43,34 @@ namespace OpenTK.Platform.MacOS
internal const float ScrollFactor = 0.1f; internal const float ScrollFactor = 0.1f;
internal static bool ExclusiveFullscreen = false; internal static bool ExclusiveFullscreen = false;
readonly IInputDriver2 InputDriver = new HIDInput(); readonly IInputDriver2 InputDriver;
public MacOSFactory()
{
NSApplication.Initialize();
InputDriver = new HIDInput();
}
#region IPlatformFactory Members #region IPlatformFactory Members
public override INativeWindow CreateNativeWindow(int x, int y, int width, int height, string title, GraphicsMode mode, GameWindowFlags options, DisplayDevice device) public override INativeWindow CreateNativeWindow(int x, int y, int width, int height, string title, GraphicsMode mode, GameWindowFlags options, DisplayDevice device)
{ {
INativeWindow window = new CocoaNativeWindow(x, y, width, height, title, mode, options, device); return new CocoaNativeWindow(x, y, width, height, title, mode, options, device);
RegisterResource(window);
return window;
} }
public override IDisplayDeviceDriver CreateDisplayDeviceDriver() public override IDisplayDeviceDriver CreateDisplayDeviceDriver()
{ {
// Does not implement IDisposable
return new QuartzDisplayDeviceDriver(); return new QuartzDisplayDeviceDriver();
} }
public override IGraphicsContext CreateGLContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags) public override IGraphicsContext CreateGLContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags)
{ {
IGraphicsContext context = new CocoaContext(mode, window, shareContext, major, minor); return new CocoaContext(mode, window, shareContext, major, minor);
RegisterResource(context);
return context;
} }
public override IGraphicsContext CreateGLContext(ContextHandle handle, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags) public override IGraphicsContext CreateGLContext(ContextHandle handle, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags)
{ {
IGraphicsContext context = new CocoaContext(handle, window, shareContext, major, minor); return new CocoaContext(handle, window, shareContext, major, minor);
RegisterResource(context);
return context;
} }
public override GraphicsContext.GetCurrentContextDelegate CreateGetCurrentGraphicsContext() public override GraphicsContext.GetCurrentContextDelegate CreateGetCurrentGraphicsContext()