Christopher,

you could use an NSView subclass going into fullscreen, then set yourself as the next responder of its window. Just implement mouse/ keyDown for your NSView’s subclass. Call super if you don’t need the event.

        atze




Am 19.05.2009 um 19:53 schrieb Christopher Hansen:

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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/atze%40freeport.de

This email sent to a...@freeport.de

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to