Hitting Layers
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