Cocoa event handling in fullscreen
Cocoa event handling in fullscreen
- Subject: Cocoa event handling in fullscreen
- From: Christopher Hansen <email@hidden>
- Date: Tue, 19 May 2009 10:53:09 -0700 (PDT)
Hello,
I'm writing a fullscreen game using Cocoa. I need to intercept mouse and key events for my game's usage, but I'd also like to forward them on appropriately if my game code doesn't handle them specifically (e.g., adjusting volume, screen brightness, opening the CD/DVD ROM drive, Command-Q, etc.).
Since my game is fullscreen-only, I don't define any windows, I just subclass NSApplication. I'm planning on providing event handling methods in my application (e.g., mouseDown, keyDown, etc.) and overriding sendEvent to call my application's methods for the event types that I'm interested in and falling back to [super sendEvent:anEvent]; otherwise.
The difficulty I'm having is what I do with key events, for instance, that are not needed specifically by my game code. I've thought of either (a) returning a bool to indicate whether my game code used the event and using [super sendEvent:anEvent]; if it did not or (b) using [self nextResponder] to send it along. The latter, of course, is consistent with the Cocoa event handling guide, but since I'm not using the standard Cocoa UI (windows, menus, etc.) with my fullscreen-only game, I'm not sure it's the right thing to do.
Any help would be appreciated.
Thanks,
Christopher
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden