Retina显示Bug? (cocos2d的)

时间:2011-05-19 19:21:27

标签: cocos2d-iphone

我在项目中使用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上测试它然后它绘制两根绳子而不是一根。我做错了吗?

1 个答案:

答案 0 :(得分:1)

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

在VRope.mm中搜索

[[[spriteSheet textureAtlas] texture] pixelsHigh]

并替换为

[[[spriteSheet textureAtlas] texture] pixelsHigh] / CC_CONTENT_SCALE_FACTOR()

就是这样。

相关问题