partial void goFullScreen(NSButton sender) { isInFullScreenMode = true; // Pause the non-fullscreen view openGLView.StopAnimation(); RectangleF mainDisplayRect; RectangleF viewRect; // Create a screen-sized window on the display you want to take over // Note, mainDisplayRect has a non-zero origin if the key window is on a secondary display mainDisplayRect = NSScreen.MainScreen.Frame; fullScreenWindow = new NSWindow(mainDisplayRect, NSWindowStyle.Borderless, NSBackingStore.Buffered, true); // Set the window level to be above the menu bar fullScreenWindow.Level = NSWindowLevel.MainMenu + 1; // Perform any other window configuration you desire fullScreenWindow.IsOpaque = true; fullScreenWindow.HidesOnDeactivate = true; // Create a view with a double-buffered OpenGL context and attach it to the window // By specifying the non-fullscreen context as the shareContext, we automatically inherit the // OpenGL objects (textures, etc) it has defined viewRect = new RectangleF(0, 0, mainDisplayRect.Size.Width, mainDisplayRect.Size.Height); fullScreenView = new MyOpenGLView(viewRect, openGLView.OpenGLContext); fullScreenWindow.ContentView = fullScreenView; // Show the window fullScreenWindow.MakeKeyAndOrderFront(this); // Set the scene with the full-screen viewport and viewing transformation Scene.setViewportRect(viewRect); // Assign the view's MainController to self fullScreenView.MainController = this; if (!isAnimating) { // Mark the view as needing drawing to initalize its contents fullScreenView.NeedsDisplay = true; } else { // Start playing the animation fullScreenView.StartAnimation(); } }
partial void goFullScreen (NSButton sender) { isInFullScreenMode = true; // Pause the non-fullscreen view openGLView.StopAnimation (); RectangleF mainDisplayRect; RectangleF viewRect; // Create a screen-sized window on the display you want to take over // Note, mainDisplayRect has a non-zero origin if the key window is on a secondary display mainDisplayRect = NSScreen.MainScreen.Frame; fullScreenWindow = new NSWindow (mainDisplayRect, NSWindowStyle.Borderless, NSBackingStore.Buffered, true); // Set the window level to be above the menu bar fullScreenWindow.Level = NSWindowLevel.MainMenu + 1; // Perform any other window configuration you desire fullScreenWindow.IsOpaque = true; fullScreenWindow.HidesOnDeactivate = true; // Create a view with a double-buffered OpenGL context and attach it to the window // By specifying the non-fullscreen context as the shareContext, we automatically inherit the // OpenGL objects (textures, etc) it has defined viewRect = new RectangleF (0, 0, mainDisplayRect.Size.Width, mainDisplayRect.Size.Height); fullScreenView = new MyOpenGLView (viewRect, openGLView.OpenGLContext); fullScreenWindow.ContentView = fullScreenView; // Show the window fullScreenWindow.MakeKeyAndOrderFront (this); // Set the scene with the full-screen viewport and viewing transformation Scene.setViewportRect (viewRect); // Assign the view's MainController to self fullScreenView.MainController = this; if (!isAnimating) { // Mark the view as needing drawing to initalize its contents fullScreenView.NeedsDisplay = true; } else { // Start playing the animation fullScreenView.StartAnimation (); } }
partial void GoFullScreen(Id sender) { this.isInFullScreenMode = true; // Pause the non-fullscreen view this.openGLView.StopAnimation (); // Mac OS X 10.6 and later offer a simplified mechanism to create full-screen contexts NSRect mainDisplayRect, viewRect; // Create a screen-sized window on the display you want to take over // Note, mainDisplayRect has a non-zero origin if the key window is on a secondary display mainDisplayRect = NSScreen.MainScreen.Frame; this.fullScreenWindow = new NSWindow (mainDisplayRect, NSWindowStyleMask.NSBorderlessWindowMask, NSBackingStoreType.NSBackingStoreBuffered, true); // Set the window level to be above the menu bar this.fullScreenWindow.Level = NSWindow.NSMainMenuWindowLevel + 1; // Perform any other window configuration you desire this.fullScreenWindow.IsOpaque = true; this.fullScreenWindow.HidesOnDeactivate = true; // Create a view with a double-buffered OpenGL context and attach it to the window // By specifying the non-fullscreen context as the shareContext, we automatically inherit the OpenGL objects (textures, etc) it has defined viewRect = new NSRect (0, 0, mainDisplayRect.size.width, mainDisplayRect.size.height); this.fullScreenView = new MyOpenGLView (viewRect, this.openGLView.OpenGLContext); this.fullScreenWindow.ContentView = this.fullScreenView; // Set the scene with the full-screen viewport and viewing transformation this.scene.SetViewportRect (viewRect); // Assign the view's MainController to self this.fullScreenView.MainController = this; // Show the window this.fullScreenWindow.MakeKeyAndOrderFront (this); if (!this.isAnimating) { // Mark the view as needing drawing to initalize its contents this.fullScreenView.NeedsDisplay = true; } else { // Start playing the animation this.fullScreenView.StartAnimation (); } }