how to covert cocos2d to cocos2d-x?

how to covert cocos2d to cocos2d-x?
0.0 0


@ // disable default states

// handle blending
BOOL doBlend;
doBlend = self.source.hasTransparentColors;

BOOL doBlendFunc;
doBlendFunc = (blendFunc_.src = CC_BLEND_DST);

if (!doBlend) {
} else if (doBlendFunc) {
glBlendFunc(blendFunc*.src, blendFunc*.dst);

// transform
CGAffineTransform transform;
transform = CGAffineTransformIdentity;
transform = CGAffineTransformConcat(transform, CGAffineTransformMakeScale(1.0f, –1.0f));
transform = CGAffineTransformConcat(transform, CGAffineTransformMakeTranslation(0.0f, self.contentSize.height));
transform = CGAffineTransformConcat(transform, CGAffineTransformMakeScale(CC_CONTENT_SCALE_FACTOR(), CC_CONTENT_SCALE_FACTOR()));
transform = CGAffineTransformConcat(transform, self.nodeToWorldTransform);

// matrix
VGfloat matrix[9] = {
transform.a, transform.c, transform.tx, // a, c, tx
transform.b, transform.d, transform.ty, // b, d, ty
0, 0, 1, // 0, 0, 1

// draw
[self.source draw];

// clear the transform used for drawing the swf

// apply the transform used for drawing children
[self transformAncestors];

// enable blending
if (!doBlend) {
} else if (doBlendFunc) {

// enable default states

I want to covert cocos2d code to cocos2d-x , what this function can be replaced in cocos2d-x?
please help me ….Thanks


A lot of it is the same. I’ve been converting many Objective-C functions to C*+ between Cocos2d and Cocos2d-x.
I am guessing that this method is in a subclass of CCNode?
[self transformAncestors];
I believe that CCAffineTransform replaces CGAffineTransform in the usage you have above.
My process has been to outline the class in C*+ with empty methods, get the .h and .cpp files ready.

I move the Objective-C code into the .cpp files and comment it out. Moving through line by line, I convert to C++.

Look at this project a lot for clues about the function mapping between Cocos2d and Cocos2d-x


Wish I could be more help!