Sprite::~Sprite() { if (_flags & flag_manageResAnim) { ResAnim* rs = _frame.getResAnim(); if (rs) rs->getAtlas()->unload(); } }
void Sprite::changeAnimFrame(const AnimationFrame& frame) { if (_flags & flag_manageResAnim) { ResAnim* rs = _frame.getResAnim(); if (rs) rs->getAtlas()->unload(); rs = frame.getResAnim(); if (rs) rs->getAtlas()->load(); } _frame = frame; setSize(_frame.getSize()); animFrameChanged(_frame); }
void Sprite::copyFrom(const Sprite &src, cloneOptions opt) { VStyleActor::copyFrom(src, opt); _frame = src._frame; _vstyle= src._vstyle; if (getManageResAnim()) { ResAnim *rs = _frame.getResAnim(); if (rs) rs->getAtlas()->load(); } }
void Sprite::changeAnimFrame(const AnimationFrame& frame) { if (_flags & flag_manageResAnim) { ResAnim* rs = _frame.getResAnim(); if (rs) rs->getAtlas()->unload(); rs = frame.getResAnim(); if (rs) rs->getAtlas()->load(); } bool flipX = (_flags & flag_flipX) != 0; bool flipY = (_flags & flag_flipY) != 0; if (flipX || flipY) _frame = frame.getFlipped(flipY, flipX); else _frame = frame; _setSize(_frame.getSize().mult(_localScale)); animFrameChanged(_frame); }
void Sprite::copyFrom(const Sprite& src, cloneOptions opt) { inherited::copyFrom(src, opt); _frame = src._frame; _localScale = src._localScale; animFrameChanged(_frame); _vstyle = src._vstyle; if (getManageResAnim()) { ResAnim* rs = _frame.getResAnim(); if (rs) rs->getAtlas()->load(); } }