Hello, while I was playing around with cocos2d-x I hit a bug at CGRect::CGRectIntersectsRect(…), inside $cocos2dx_root/cocos2dx/cocoa/CGGeometry.cpp.
Instead of this:
return !(CGRectGetMaxX(rectA) < CGRectGetMinX(rectB)||
CGRectGetMaxX(rectB) < CGRectGetMinX(rectA)||
CGRectGetMaxY(rectA) < CGRectGetMinY(rectB)||
CGRectGetMaxY(rectB) < CGRectGetMinY(rectB)); // <-- bug!
…it should actually be like this:
return !(CGRectGetMaxX(rectA) < CGRectGetMinX(rectB)||
CGRectGetMaxX(rectB) < CGRectGetMinX(rectA)||
CGRectGetMaxY(rectA) < CGRectGetMinY(rectB)||
CGRectGetMaxY(rectB) < CGRectGetMinY(rectA)); // <-- fixed!
Note the last rectA instead of rectB being used for the comparison between maxY and minY Without it, the intersection test will always return true in certain cases where it should really return false instead.