CCRect expects positive size values without encforcing them

Hello,

I’m porting some cocos2d-iphone code to cocos2d-x, and noticed a difference in behaviour relating to CCRect, in particular CCRectContainsPoint. In -iphone, it appears you can do the following:

CCRect cRect = CCRectMake(50, 50, 10, –10)
and then the following will return true:
CCRectContainsPoint(cRect, ccp(55, 45));

But on cocos2d-x, it returns false, as it’s assumed that the size values will both be positive, and thus CCRectGetMinX, MaxX, MinY, MaxY don’t return the actual min & max values.

I guess either this functionality should be supported, or an assert should be thrown in CCRectMake to enforce the expected values. The latter would probably be more optimial, as its easy enough to convert the call to CCRectMake, in this case to (50, 40, 10, 10).

Cheers,
Isaac

Thank you, bug #689 is created for it.