Please Help! Converting Code

Hi,

In the Objective-C .m file, there is this definition at the top of the file.

`interface CCPanZoomControllerScale : CCScaleTo
{
CCPanZoomController *_controller;
CGPoint _point;
}

+(id) actionWithDuration:(ccTime)duration scale:(float)s controller:(CCPanZoomController*)controller point:(CGPoint)pt;
-(id) initWithDuration:(ccTime)duration scale:(float)s controller:(CCPanZoomController*)controller point:(CGPoint)pt;

`end

Here is the implementation for the two methods above:

@implementation CCPanZoomControllerScale

+(id) actionWithDuration:(ccTime)duration
scale:(float)s
controller:(CCPanZoomController*)controller
point:(CGPoint)pt
{
return [[[self alloc] initWithDuration:duration scale:s controller:controller point:pt] autorelease];
}

-(id) initWithDuration:(ccTime)duration
scale:(float)s
controller:(CCPanZoomController*)controller
point:(CGPoint)pt
{
[super initWithDuration:duration scale:s];
*controller = ;
*point = pt;
return self;
}

In the conversion guide, it is recommended that ID be replaced with bool which I did, however I’m not sure in the implementation how to replace this line? Due I just returned true or do I need to return the class CCPanZoomControllerScale?

return [[[self alloc] initWithDuration:duration scale:s controller:controller point:pt] autorelease];

also similar thing for these lines:

[super initWithDuration:duration scale:s];
*controller = ;
*point = pt;
return self;

Any help would be appreciated, thanks. I’ve been trying this for a few days with no luck.

thanks,


CCPanZoomController.h.zip (2.0 KB)


CCPanZoomController.m.zip (4.7 KB)

About CCPanZoomControllerScale::actionWithDuration, you can refer to the source code of CCSprite::spriteWithFile in CCSprite.cpp. You can translate (id) to CCPanZoomControllerScale* here.

Hi

Do anyone have those classes converted to cocos2d-x? I am doing a world select map in my game and I think those classes will be perfect for the layer… if no, I will try to convert, I will tell you all my progress.

Thank you