Exemplo n.º 1
0
 public NSGameView(Lime.Input input, CGRect frame, GraphicsMode mode)
     : base(frame)
 {
     this.input  = input;
     this.Hidden = true;
     // Avoid of double scaling on high DPI displays
     this.WantsBestResolutionOpenGLSurface = true;
     pixelFormat = SelectPixelFormat(mode, 1, 0);
     if (pixelFormat == null)
     {
         throw new InvalidOperationException(string.Format("Failed to contruct NSOpenGLPixelFormat for GraphicsMode {0}", mode));
     }
     if (openGLContext == null)
     {
         openGLContext = new NSOpenGLContext(pixelFormat, null);
     }
     if (openGLContext == null)
     {
         throw new InvalidOperationException(string.Format("Failed to construct NSOpenGLContext {0}", mode));
     }
     openGLContext.MakeCurrentContext();
     if (platformRenderContext == null)
     {
         platformRenderContext = new Graphics.Platform.OpenGL.PlatformRenderContext();
         PlatformRenderer.Initialize(platformRenderContext);
     }
     swapInterval = true;
 }