Skip to content

Instantly share code, notes, and snippets.

@numo16

numo16/CCUtils.cs

Created Dec 12, 2012
Embed
What would you like to do?
Helper methods for Cocos2d-xna
public class CCUtils
{
public static CCRect CCRectIntersection(CCRect r1, CCRect r2)
{
CCRect intersection = new CCRect(Math.Max(CCRect.CCRectGetMinX(r1), CCRect.CCRectGetMinX(r2)), Math.Max(CCRect.CCRectGetMinY(r1), CCRect.CCRectGetMinY(r2)), 0, 0);
intersection.size.width = Math.Min(CCRect.CCRectGetMaxX(r1), CCRect.CCRectGetMaxX(r2)) -
CCRect.CCRectGetMinX(intersection);
intersection.size.height = Math.Min(CCRect.CCRectGetMaxY(r1), CCRect.CCRectGetMaxY(r2)) -
CCRect.CCRectGetMinY(intersection);
return intersection;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.