我正在尝试将一些 Cocos2d-iphone 代码转换为 Cocos2d-x 代码,并且可以使用一些帮助。在 Cocos2d-iphone 代码中,包含如下定义:
@interface CCPanZoomControllerScale : CCScaleTo {
CCPanZoomController *_controller;
CGPoint _point;
}+(id) actionWithDuration:(ccTime)duration scale:(float)s controller:(CCPanZoomController*)controller point:(CGPoint)pt;
@end
@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];
}
在尝试将此(粗体声明)转换为 C++ 时,我相信它应该是一个静态方法。此外,Cocos2d-x 文档建议返回 bool,因为 id 在 C++ 中不存在。但是在方法实现中,我不确定要返回什么。我只是返回真实吗?
static bool actionWithDuration(ccTime duration, float scale, PanZoomController* controller, CCPoint point){
return true;
}