Re: Cocoa event handling in fullscreen
Re: Cocoa event handling in fullscreen
- Subject: Re: Cocoa event handling in fullscreen
- From: Christopher Hansen <email@hidden>
- Date: Tue, 19 May 2009 15:10:38 -0700 (PDT)
Is there a way that I can do this without a window? I'm writing a platform independent game, so I want to alter the structure as little as possible. The behavior that we want is to simply start up in full screen, and I'd like to avoid starting up with a blank window before going to fullscreen.
Christopher
________________________________
From: Alexander Spohr <email@hidden>
To: Christopher Hansen <email@hidden>
Cc: email@hidden
Sent: Tuesday, May 19, 2009 3:00:20 PM
Subject: Re: Cocoa event handling in fullscreen
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 (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
_______________________________________________
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