Search code examples
c++cocos2d-x

how to get Origin of image from sprite?


I am using cocos2dx c++ and I am getting width of Picture inside Sprite with

playerSprite->getTextureRect().origin.x;
playerSprite->getTextureRect().origin.y;

Like Width of Sprite is 400 and Width of Picture is 140 . But I want to get X and Y point of Origin of Picture not Sprite . Can Anyone Please Help me.

Picture Link:https://www.dropbox.com/s/kl9eye2gs1onwsq/s1.png?dl=0


Solution

  • I used

    playerSprite->getSpriteFrame()->getOffsetInPixels().x;
    playerSprite->getSpriteFrame()->getOffsetInPixels().y;
    

    to get origin