After you scale and image, getContentSize still returns the size of the image before it was scaled. What is the best way to get the current size of an image, even if it has been scaled?
use getContentSizeInPixels instead.getContentSize will always return the width & height in point.Plz reference to Riq’s document RetinaDisplay in cocos2dHope my answer can help you.
Thanks for the response.
I guess I was looking for something more like this:
sprite~~>getContentSize.width * sprite~~>getScaleX() this way I would get the actual width based off the scaling and the original size. I just thought maybe Cocos2d had a way of returning this without me actual calculating it out.
Try Using sprite->boundingBox().size.width always returns the scaled size of a sprite
Masoud Soleimani wrote:
tried, not right…
Ok i have the same problem.
getContentSizeInPixels also returns wrong width.
I use boundingBox() from CCNode and it works. I get scaled width of my CCSprite