Cocos2dx - getContentSize与getBoundingBox

cocos2dx 2.x版本

getContentSize()函数

返回的是untransformed size

/**
 * @return The untransformed size of the node.
 */
virtual const CCSize& getContentSize() const;

class CC_DLL CCSize
{
public:
    float width;
    float height;
    ...
}

getBoundingBox 函数
Cocos2dx - getContentSize与getBoundingBox_第1张图片
旋转的情况下会得到一个包围

/** 
 * Returns a "local" axis aligned bounding box of the node.
 * The returned box is relative only to its parent.
 *
 * @note This method returns a temporaty variable, so it can't returns const CCRect&
 * @todo Rename to getBoundingBox() in the future versions.
 * 
 * @return A "local" axis aligned boudning box of the node.
 * @js getBoundingBox
 */
virtual CCRect getBoundingBox(void);

class CC_DLL CCRect
{
public:
    CCPoint origin;
    CCSize  size;
    ...
}

你可能感兴趣的:(Cocos2dx - getContentSize与getBoundingBox)