can ccpoint and cpVect interoperate?


#1

Hey all,

I’m moving a project in Objective C to C++ and I need some advice about mixing cpVect and CCPoint.

According to: http://www.cocos2d-x.org/embedded/cocos2d-x/dc/d53/_c_c_point_extension_8h.html I can mix cpVect and CCPoint (orthough it says to avoid).

The existing project I have uses cpVect alot, and this was never a problem in Objective C.

However, now that all classes derive from CCNode, and have a position as CCPoint, all mathematics around vectors doesn’t work. To our base class, I have added a method getCPPosition, which returns a cpVect, and I have a static inline function toCCPoint when setting the position of an object… but this is less than elegant.

Am I missing something about how cpVect and CCPoint should mix? What have others done?

Regards,
Jonathan