Currently I'm storing integer grid coordinates in CGPoints
using the ccp
macro. Is there anything like ccpi
in Cocos2d for iPhone that stores a pair of integers?
Well, CGPoint is a struct that contains 2 floats. So, if you want to store a pair of integers instead, one way would be to roll your own struct with integers.
struct CGIntegerPoint {
NSInteger x;
NSInteger y;
};
CG_INLINE CGIntegerPoint
CGIntegerPointMake(NSInteger x, NSInteger y)
{
CGIntegerPoint p; p.x = x; p.y = y; return p;
}
With that, you could then define your own "ccpi" macro if you wish:
#define ccpi(__X__,__Y__) CGIntegerPointMake(__X__,__Y__)