From 2578d1542059ee59536642e741ac79f669de6c18 Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 28 Aug 2013 18:17:05 +0800 Subject: [PATCH] issue #2747: [Best C++ practice] Deprecating Sprite::displayFrame, adding Sprite::getDisplayFrame. --- cocos2dx/actions/CCActionInterval.cpp | 2 +- cocos2dx/sprite_nodes/CCSprite.cpp | 4 ++-- cocos2dx/sprite_nodes/CCSprite.h | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cocos2dx/actions/CCActionInterval.cpp b/cocos2dx/actions/CCActionInterval.cpp index 7f64a56214..e5ad76096b 100644 --- a/cocos2dx/actions/CCActionInterval.cpp +++ b/cocos2dx/actions/CCActionInterval.cpp @@ -2065,7 +2065,7 @@ void Animate::startWithTarget(Node *target) if (_animation->getRestoreOriginalFrame()) { - _origFrame = pSprite->displayFrame(); + _origFrame = pSprite->getDisplayFrame(); _origFrame->retain(); } _nextFrame = 0; diff --git a/cocos2dx/sprite_nodes/CCSprite.cpp b/cocos2dx/sprite_nodes/CCSprite.cpp index 63d2da8f2b..3b4ba1c63d 100644 --- a/cocos2dx/sprite_nodes/CCSprite.cpp +++ b/cocos2dx/sprite_nodes/CCSprite.cpp @@ -1004,7 +1004,7 @@ bool Sprite::isFrameDisplayed(SpriteFrame *frame) const frame->getOffset().equals(_unflippedOffsetPositionFromCenter)); } -SpriteFrame* Sprite::displayFrame(void) +SpriteFrame* Sprite::getDisplayFrame() { return SpriteFrame::createWithTexture(_texture, CC_RECT_POINTS_TO_PIXELS(_rect), @@ -1013,7 +1013,7 @@ SpriteFrame* Sprite::displayFrame(void) CC_SIZE_POINTS_TO_PIXELS(_contentSize)); } -SpriteBatchNode* Sprite::getBatchNode(void) +SpriteBatchNode* Sprite::getBatchNode() { return _batchNode; } diff --git a/cocos2dx/sprite_nodes/CCSprite.h b/cocos2dx/sprite_nodes/CCSprite.h index b13dbf3691..2acbcf28a5 100644 --- a/cocos2dx/sprite_nodes/CCSprite.h +++ b/cocos2dx/sprite_nodes/CCSprite.h @@ -329,10 +329,13 @@ public: */ virtual bool isFrameDisplayed(SpriteFrame *pFrame) const; + /** @deprecated Use getDisplayFrame() instead */ + CC_DEPRECATED_ATTRIBUTE virtual SpriteFrame* displayFrame() { return getDisplayFrame(); }; + /** * Returns the current displayed frame. */ - virtual SpriteFrame* displayFrame(void); + virtual SpriteFrame* getDisplayFrame(); /// @} End of frames methods