2

I an trying to figure out how ccpSub is implemented. Can someone point out the code for this ?

Basically, I came across this solution for getting the angle between 2 coordinates but its using cocos2d. I dont want the hassle of downloading the whole library just for this one function. Get angle from 2 positions

Unfortunately, I am a bit lost as to how ccpSub is implemented in xcode ? Hope someone could guide me.

Thanks.

Community
  • 1
  • 1
Axil
  • 3,606
  • 10
  • 62
  • 136
  • Whats wrong with the posted answers on the question you linked to which don't use cocos2d? – Wain Jun 03 '13 at 07:23
  • then look it up on github: https://github.com/cocos2d/cocos2d-iphone/blob/develop-v2/cocos2d/Support/CGPointExtension.m – CodeSmile Jun 03 '13 at 07:54

1 Answers1

2
static inline CGPoint
ccpSub(const CGPoint v1, const CGPoint v2)
{
    return ccp(v1.x - v2.x, v1.y - v2.y);
}
Liolik
  • 791
  • 6
  • 12