【问题标题】:Retina Display Bug? (Cocos2d)视网膜显示错误? (Cocos2d)
【发布时间】:2011-05-19 19:21:26
【问题描述】:

我在我的项目中使用enableRetinaDisplay,它运行良好,除非我使用此代码。

//+++VRope
    //create batchnode to render rope segments
    CCSpriteBatchNode *ropeSegmentSprite = [CCSpriteBatchNode batchNodeWithFile:@"rope.png" ];
    [game addChild:ropeSegmentSprite];
    //Create two cgpoints for start and end point of rope
    CGPoint pointA = ccp(73, 330); //Top
    CGPoint pointB = ccp(self.position.x +5, self.position.y +30); //Bottom
    //create vrope using initWithPoints method
    verletRope = [[VRope alloc] initWithPoints:pointA pointB:pointB spriteSheet:ropeSegmentSprite];

此代码不是绘制一张绳索的高分辨率图像,而是绘制两张绳索图像。我知道是视网膜显示器导致了这种情况,因为我在 iphone 3gs 和模拟器上对其进行了测试,它工作得很好……直到我在我的 iphone 4 上对其进行测试,然后它会拉两条绳子而不是一根绳子。我是不是做错了什么?

【问题讨论】:

    标签: cocos2d-iphone


    【解决方案1】:

    我知道为时已晚,但我在搜索谷歌时在第一页发现了这个问题,所以我会发布这个答案供其他人查找。

    在 VRope.mm 中搜索

    [[[spriteSheet textureAtlas] 纹理] 像素高]

    替换为

    [[[spriteSheet textureAtlas] 纹理] 像素高]/CC_CONTENT_SCALE_FACTOR()

    就是这样。

    【讨论】:

      猜你喜欢
      • 2023-04-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-31
      • 1970-01-01
      相关资源
      最近更新 更多