2011-05-19 118 views
0

我在我的項目中使用enableRetinaDisplay,除了使用此代碼時它工作得很好。視網膜顯示Bug? (Cocos2d)

//+++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

我知道這太遲了,但是在搜索谷歌時,我在第一頁上發現了這個問題,所以我會發布這個答案供其他人在未來找到。

在VRope.mm搜索

[[[spriteSheet textureAtlas]質地] pixelsHigh]

,並用替換

[[[spriteSheet textureAtlas]質地] pixelsHigh]/CC_CONTENT_SCALE_FACTOR()

就是這樣。