【问题标题】:Cocos2d issue with ios5ios5 的 Cocos2d 问题
【发布时间】:2011-12-18 20:07:40
【问题描述】:

我正在尝试编译正在运行的旧代码。

PlayView *layer = [[[PlayView alloc] initWithColor:ccc4(180, 180, 200, 255)] autorelease];

我收到此错误:

无法在参数传递中将“ccCoor4b”转换为“ci”颜色。

谁能帮帮我?

【问题讨论】:

  • PlayView 是 CCLayerColor?此代码应该可以工作,我没有收到错误
  • 你能在这里发布PlayView::initWithColor:和ccc4(...)的声明吗?

标签: iphone ipad cocos2d-iphone


【解决方案1】:

将代码改为:

return [[(CCLayerColor*)[self alloc] initWithColor:color] autorelease];

【讨论】:

    【解决方案2】:

    这行得通!

    PlayView *layer = [[[PlayView alloc] initWithColor:(ccColor4B){180, 180, 200, 255}] autorelease];
    

    你也可以试试这个方法

    ccColor4B c;
    c.r=180,c.g=180,c.b=200,c.a=255; 
    //then use 'c' as ccColor4B object
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多