cocos2d (库代码升级)编译错误

来源:互联网 发布:the sims 4 mac 编辑:程序博客网 时间:2024/05/20 04:28

(1)有些代码编译时候都有ccColor4B这个错误,这个是由于cocos2d最新库代码升级导致的,按照下面方法就可以顺利编译了?
   在[self alloc]前面加上(CCColorLayer*),如下:
+ (id) layerWithColor:(ccColor4B)color
{
return [[(CCColorLayer*)[self alloc] initWithColor:color] autorelease];
}
在新版本的cocos2d中ColorLayer更新为CCColorLayer了或者是CCLayerColor,两者是一样的 


  

 (2)有个别代码编译提示error: cannot convert 'OFISerializer*' to 'NSInputStream*' in argument passing ,这个如何处理? 
    解决方案为: 把 initWithStream函数 改为 initWithOFISerializer.

例如下面在出错处改成 std::auto_ptr stream(new OFBinarySdbmKeyedWriter(new OFBinaryFileSink([fileName UTF8String]))); OFISerializer *is = (OFISerializer *)stream.get(); OFISerializerOCWrapper *wrapper = [[[OFISerializerOCWrapper alloc] initWithOFISerializer:is] autorelease]; [mDelegate.get() performSelector:mOnSave withObject:wrapper]; 编译通过。。

原创粉丝点击