- 本帖最后由 eminia 于 2013-3-26 15:15 编辑 *
下面来自《ios5 cocos2d游戏开发实战(第2版)》,第5章内容
项目位置:源代码/CH05_code/ScenesAndLayers03/
原文件:LoadingScene.m
这个静态方法怎么改写C++版本的?
+(id) sceneWithTargetScene:(TargetScenes)targetScene;
{
CCLOG(@"===========================================");
CCLOG(@"%@: %@", NSStringFromSelector(_cmd), self);
// This creates an autorelease object of self (the current class: LoadingScene)
return initWithTargetScene:targetScene] autorelease];
// Note: this does the exact same, it only replaced self with LoadingScene. The above is much more common.
//return initWithTargetScene:targetScene] autorelease];
}
我写成
CCScene * LoadingScene::sceneWithTargetScene(TargetScenes targetScene)
{
return LoadingScene::create()->initWithTargetScene(targetScene);
}
LoadingScene没有create方法,所以报错,但我又找不到其他的写法,
写到这里写不下去了
求大神指教
附件1 是原来的obj-C版本
http://www.baidupcs.com/file/73e5a5476da1586b3eb8e570cf5f499c?fid=3257231700-250528-2660842832&time=1364280726&sign=FDTA-DCb740ccc5511e5e8fedcff06b081203-A8M%2BFYNoYj3qPj1WYogXp86Qmp8%3D&expires=8h
链接是用的百度网盘,不能下载请回我