Stephen
Stephen

Reputation: 499

Retina Display Bug? (Cocos2d)

I am using enableRetinaDisplay in my project and it is working very well except when I use this code.

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

Instead of drawing one high-res image of the rope, this code is drawing two rope images. I know that it is the retina display that is causing this because I tested it on an iphone 3gs and the simulator and it works great... until I test it on my iphone 4 then it draws two ropes instead of one. Am I doing something wrong?

Upvotes: 0

Views: 559

Answers (1)

Florin O.
Florin O.

Reputation: 56

I know it's too late but I found this question on the first page when searching google so I'll post this answer for others to find in the future.

In VRope.mm search for

[[[spriteSheet textureAtlas] texture] pixelsHigh]

and replace with

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

That's it.

Upvotes: 1

Related Questions