• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Cocoa event handling in fullscreen
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa event handling in fullscreen


  • Subject: Re: Cocoa event handling in fullscreen
  • From: Alexander Spohr <email@hidden>
  • Date: Tue, 19 May 2009 23:00:20 +0200

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


  • Follow-Ups:
    • Re: Cocoa event handling in fullscreen
      • From: Christopher Hansen <email@hidden>
References: 
 >Cocoa event handling in fullscreen (From: Christopher Hansen <email@hidden>)

  • Prev by Date: Re: [OT] Anyone have the a DIRECT phone number for a real person at Apple Legal???
  • Next by Date: Re: iPhone text on UIImage not getting displayed on device.
  • Previous by thread: Cocoa event handling in fullscreen
  • Next by thread: Re: Cocoa event handling in fullscreen
  • Index(es):
    • Date
    • Thread