mirror of https://github.com/axmolengine/axmol.git
Merge pull request #4555 from 2youyouo2/develop
fixed armature position not right
This commit is contained in:
commit
ec0bdf06af
|
@ -338,6 +338,22 @@ void Armature::updateOffsetPoint()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Armature::setAnchorPoint(const Point& point)
|
||||||
|
{
|
||||||
|
if( ! point.equals(_anchorPoint))
|
||||||
|
{
|
||||||
|
_anchorPoint = point;
|
||||||
|
_anchorPointInPoints = Point(_contentSize.width * _anchorPoint.x - _offsetPoint.x, _contentSize.height * _anchorPoint.y - _offsetPoint.y);
|
||||||
|
_realAnchorPointInPoints = Point(_contentSize.width * _anchorPoint.x, _contentSize.height * _anchorPoint.y);
|
||||||
|
_transformDirty = _inverseDirty = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const Point& Armature::getAnchorPointInPoints() const
|
||||||
|
{
|
||||||
|
return _realAnchorPointInPoints;
|
||||||
|
}
|
||||||
|
|
||||||
void Armature::setAnimation(ArmatureAnimation *animation)
|
void Armature::setAnimation(ArmatureAnimation *animation)
|
||||||
{
|
{
|
||||||
_animation = animation;
|
_animation = animation;
|
||||||
|
|
|
@ -178,6 +178,8 @@ public:
|
||||||
* Set contentsize and Calculate anchor point.
|
* Set contentsize and Calculate anchor point.
|
||||||
*/
|
*/
|
||||||
virtual void updateOffsetPoint();
|
virtual void updateOffsetPoint();
|
||||||
|
virtual void setAnchorPoint(const cocos2d::Point& point) override;
|
||||||
|
virtual const cocos2d::Point& getAnchorPointInPoints() const override;
|
||||||
|
|
||||||
virtual void setAnimation(ArmatureAnimation *animation);
|
virtual void setAnimation(ArmatureAnimation *animation);
|
||||||
virtual ArmatureAnimation *getAnimation() const;
|
virtual ArmatureAnimation *getAnimation() const;
|
||||||
|
@ -265,6 +267,7 @@ protected:
|
||||||
cocos2d::BlendFunc _blendFunc; //! It's required for CCTextureProtocol inheritance
|
cocos2d::BlendFunc _blendFunc; //! It's required for CCTextureProtocol inheritance
|
||||||
|
|
||||||
cocos2d::Point _offsetPoint;
|
cocos2d::Point _offsetPoint;
|
||||||
|
cocos2d::Point _realAnchorPointInPoints;
|
||||||
|
|
||||||
ArmatureAnimation *_animation;
|
ArmatureAnimation *_animation;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue