I solved the problem by examining checking to see if the game was in
fullscreen mode, and then changing how the NSPoint was calculated.  It turns
out that everything was slightly offset in fullscreen mode when using
convertScreetToBase:.  Not exactly a solution with an explanation; but at
least it is a solution (code below).

CGPoint point;

if ([[[[GameData sharedGameData] gameController] contentView]
isInFullScreenMode])

{

point = NSPointToCGPoint(mouseloc);

}

else {

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

point = NSPointToCGPoint(translated);

}

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

id hitLayer = [rootLayer hitTest:point];

if (![hitLayer isKindOfClass:[GameObjectLayer class]])

return nil;

else

return hitLayer;


On Sat, Oct 2, 2010 at 6:30 AM, Matt Neuburg <m...@tidbits.com> wrote:

> I'm wondering that too. CALayer's hitTest requires a point in *superlayer*
> coordinates. So I'm wondering if you're getting that wrong (as people often
> do, because it's so surprising), and maybe there's something about how
> you're obtaining mouseloc (your original point) that masks the issue when
> you're not in fullscreen mode. m.
>
_______________________________________________

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