Full Screen Event Handling

Posts: 613
Joined: 2004.09
Post: #1
I am smack dab in the middle of rewriting my OpenGL base code. My previous version was done in Carbon and im moving it to Cocoa. I hit a small bump in the road however.

I am using the Keyup: Keydown: events then calling a processing function to determine what has been hit since the last call. I have a subclassed version of NSView that I am rendering my windowed context into. I can pass that as a first responder and everything works fine. However I am unsure how to give first responder rights to my full screen context. Everything I have found in the documentation is relating to passing first responder to an NSWindow.

I am capturing the full screen with this sudo code.

NSOpenGLPixelFormat *pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs];
fullScreenContext = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:NULL];
[fullScreenContext setFullScreen];
[fullScreenContext makeCurrentContext];

As always thanks in advance everyone.
Quote this message in a reply
Posts: 5,143
Joined: 2002.04
Post: #2
If you use the new Leopard NSView API -[enterFullScreenMode:withOptions:] then everything will just work, but you won't get the benefits of a true full-screen context.

I've found the easiest way to handle events with a true full-screen context is to subclass NSApplication and do the processing in -sendEvent: . See http://onesadcookie.com/svn/GameShell for an example.
Quote this message in a reply
Posts: 13
Joined: 2008.05
Post: #3

maybe you just take a look at my new tutorial, I posted in the contests forum:

please let me know, if this tutorial was helpful to you!

Quote this message in a reply
Posts: 81
Joined: 2007.05
Post: #4
I've made my Cocoa fullscreen transition. I was using the Leopard enterFullScreenMode call before but I've written a Cocoa controller now that goes to the selected resolution. Appears to work. Though, the iShowU video capture program seems to like enterFullScreenMode better for some reason. Tried it with window dragging and multiple monitors. Drag the window to the other monitor then go fullscreen on that monitor. Little more tricky than using main display id. The CGGetDisplaysWithRect is useful to get the display id.

Anyhow, I was reading about Snow Leopard. They suggest there is some kind of resolution free scheme? Something I should be aware of?
Quote this message in a reply
Posts: 5,143
Joined: 2002.04
Post: #5
Resolution independence has existed in various forms of completion since Tiger. You can use Quartz Debug to change the UI resolution to test your app with it.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Cocoa/OpenGL drawing full-screen problem ultitech 5 10,129 Jan 13, 2011 01:11 PM
Last Post: SethWillits
  Full screen mouse events Mister T 17 11,500 Jan 4, 2010 02:55 PM
Last Post: MacMan
  Carbon events in windowed/full screen mode. Help needed. Anton Petrov 1 4,566 Dec 18, 2008 05:35 AM
Last Post: DoG
  Full-screen without OpenGL George Marlin 2 3,889 May 11, 2007 01:38 PM
Last Post: George Marlin
  Event Handling (Keyboard and Mouse) bwalters 6 8,713 Mar 12, 2006 08:17 PM
Last Post: OneSadCookie