• 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
Hitting Layers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Hitting Layers


  • Subject: Hitting Layers
  • From: Curious Yogurt <email@hidden>
  • Date: Thu, 30 Sep 2010 20:53:56 -0700

I'm working on a game using core animation that depends on hitting CA
layers.  This works great as long as the user is not in fullscreen mode;
when in fullscreen, hits are still registered, but they do not correspond to
the objects.  Any ideas what might be going wrong?  Here is my code for
detecting the hit:

-(GameObjectLayer *)chipLayerHit:(NSPoint)mouseloc

{

NSPoint translated = [[gameController window] convertScreenToBase:mouseloc];

CGPoint point = NSPointToCGPoint(translated);

 CALayer *rootLayer = [[[gameController window] contentView] layer];

id hitLayer = [rootLayer hitTest:point];

if (![hitLayer isKindOfClass:[GameObjectLayer class]]) return nil;

else return hitLayer;

}


GameObjectLayer is, ultimately, a CALayer.  I'm looking for just hits on
GameObjectLayer objects, not on other sorts of objects that are floating
around.  I'm wondering whether I need to modify the first line of the method
(NSPoint translated = [[gameController window] convertScreenToBase:mouseloc];)
when in fullscreen mode?


Thanks,


Ravi Coyne
_______________________________________________

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

  • Prev by Date: Re: portable app
  • Next by Date: Continuously running daemon process CFConstantStringRefs build up over time
  • Previous by thread: Is there any other way of enumerating windows and getting their positions except Accessibility API?
  • Next by thread: Continuously running daemon process CFConstantStringRefs build up over time
  • Index(es):
    • Date
    • Thread