member variables renaming according cocos2d-x style.

This commit is contained in:
James Chen 2013-07-27 22:31:57 +08:00
parent e66e429bb2
commit fa5c26c5e2
15 changed files with 374 additions and 374 deletions

View File

@ -26,7 +26,7 @@ CCBAnimationManager::CCBAnimationManager()
, _delegate(NULL) , _delegate(NULL)
, _runningSequence(NULL) , _runningSequence(NULL)
, _jsControlled(false) , _jsControlled(false)
, mOwner(NULL) , _owner(NULL)
{ {
init(); init();
} }
@ -42,7 +42,7 @@ bool CCBAnimationManager::init()
_documentCallbackNames = new Array(); _documentCallbackNames = new Array();
_documentCallbackNodes = new Array(); _documentCallbackNodes = new Array();
_keyframeCallbacks = new Array(); _keyframeCallbacks = new Array();
mKeyframeCallFuncs = new Dictionary(); _keyframeCallFuncs = new Dictionary();
_target = NULL; _target = NULL;
_animationCompleteCallbackFunc = NULL; _animationCompleteCallbackFunc = NULL;
@ -76,7 +76,7 @@ CCBAnimationManager::~CCBAnimationManager()
CC_SAFE_RELEASE(_documentCallbackNames); CC_SAFE_RELEASE(_documentCallbackNames);
CC_SAFE_RELEASE(_documentCallbackNodes); CC_SAFE_RELEASE(_documentCallbackNodes);
CC_SAFE_RELEASE(mKeyframeCallFuncs); CC_SAFE_RELEASE(_keyframeCallFuncs);
CC_SAFE_RELEASE(_keyframeCallbacks); CC_SAFE_RELEASE(_keyframeCallbacks);
CC_SAFE_RELEASE(_target); CC_SAFE_RELEASE(_target);
} }
@ -602,7 +602,7 @@ Object* CCBAnimationManager::actionForCallbackChannel(CCBSequenceProperty* chann
if(_jsControlled) { if(_jsControlled) {
String* callbackName = String::createWithFormat("%d:%s", selectorTarget, selectorName.c_str()); String* callbackName = String::createWithFormat("%d:%s", selectorTarget, selectorName.c_str());
CallFunc *callback = ((CallFunc*)(mKeyframeCallFuncs->objectForKey(callbackName->getCString())))->clone(); CallFunc *callback = ((CallFunc*)(_keyframeCallFuncs->objectForKey(callbackName->getCString())))->clone();
if(callback != NULL) { if(callback != NULL) {
actions->addObject(callback); actions->addObject(callback);
@ -615,7 +615,7 @@ Object* CCBAnimationManager::actionForCallbackChannel(CCBSequenceProperty* chann
if(selectorTarget == CCBReader::TargetType::DOCUMENT_ROOT) if(selectorTarget == CCBReader::TargetType::DOCUMENT_ROOT)
target = _rootNode; target = _rootNode;
else if (selectorTarget == CCBReader::TargetType::OWNER) else if (selectorTarget == CCBReader::TargetType::OWNER)
target = mOwner; target = _owner;
if(target != NULL) if(target != NULL)
{ {
@ -859,7 +859,7 @@ void CCBAnimationManager::setAnimationCompletedCallback(Object *target, SEL_Call
} }
void CCBAnimationManager::setCallFunc(CallFunc* callFunc, const std::string &callbackNamed) { void CCBAnimationManager::setCallFunc(CallFunc* callFunc, const std::string &callbackNamed) {
mKeyframeCallFuncs->setObject((Object*)callFunc, callbackNamed); _keyframeCallFuncs->setObject((Object*)callFunc, callbackNamed);
} }
void CCBAnimationManager::sequenceCompleted() void CCBAnimationManager::sequenceCompleted()
@ -915,22 +915,22 @@ CCBSetSpriteFrame* CCBSetSpriteFrame::create(SpriteFrame *pSpriteFrame)
bool CCBSetSpriteFrame::initWithSpriteFrame(SpriteFrame *pSpriteFrame) bool CCBSetSpriteFrame::initWithSpriteFrame(SpriteFrame *pSpriteFrame)
{ {
mSpriteFrame = pSpriteFrame; _spriteFrame = pSpriteFrame;
CC_SAFE_RETAIN(mSpriteFrame); CC_SAFE_RETAIN(_spriteFrame);
return true; return true;
} }
CCBSetSpriteFrame::~CCBSetSpriteFrame() CCBSetSpriteFrame::~CCBSetSpriteFrame()
{ {
CC_SAFE_RELEASE_NULL(mSpriteFrame); CC_SAFE_RELEASE_NULL(_spriteFrame);
} }
CCBSetSpriteFrame* CCBSetSpriteFrame::clone() const CCBSetSpriteFrame* CCBSetSpriteFrame::clone() const
{ {
// no copy constructor // no copy constructor
auto a = new CCBSetSpriteFrame(); auto a = new CCBSetSpriteFrame();
a->initWithSpriteFrame(mSpriteFrame); a->initWithSpriteFrame(_spriteFrame);
a->autorelease(); a->autorelease();
return a; return a;
} }
@ -943,7 +943,7 @@ CCBSetSpriteFrame* CCBSetSpriteFrame::reverse() const
void CCBSetSpriteFrame::update(float time) void CCBSetSpriteFrame::update(float time)
{ {
((Sprite*)_target)->setDisplayFrame(mSpriteFrame); ((Sprite*)_target)->setDisplayFrame(_spriteFrame);
} }
@ -970,10 +970,10 @@ CCBSoundEffect::~CCBSoundEffect()
} }
bool CCBSoundEffect::initWithSoundFile(const std::string &filename, float pitch, float pan, float gain) { bool CCBSoundEffect::initWithSoundFile(const std::string &filename, float pitch, float pan, float gain) {
mSoundFile = filename; _soundFile = filename;
mPitch = pitch; _pitch = pitch;
mPan = pan; _pan = pan;
mGain = gain; _gain = gain;
return true; return true;
} }
@ -981,7 +981,7 @@ CCBSoundEffect* CCBSoundEffect::clone() const
{ {
// no copy constructor // no copy constructor
auto a = new CCBSoundEffect(); auto a = new CCBSoundEffect();
a->initWithSoundFile(mSoundFile, mPitch, mPan, mGain); a->initWithSoundFile(_soundFile, _pitch, _pan, _gain);
a->autorelease(); a->autorelease();
return a; return a;
} }
@ -994,7 +994,7 @@ CCBSoundEffect* CCBSoundEffect::reverse() const
void CCBSoundEffect::update(float time) void CCBSoundEffect::update(float time)
{ {
CocosDenshion::SimpleAudioEngine::getInstance()->playEffect(mSoundFile.c_str()); CocosDenshion::SimpleAudioEngine::getInstance()->playEffect(_soundFile.c_str());
} }
@ -1024,7 +1024,7 @@ bool CCBRotateTo::initWithDuration(float fDuration, float fAngle)
{ {
if (ActionInterval::initWithDuration(fDuration)) if (ActionInterval::initWithDuration(fDuration))
{ {
mDstAngle = fAngle; _dstAngle = fAngle;
return true; return true;
} }
@ -1038,7 +1038,7 @@ CCBRotateTo* CCBRotateTo::clone() const
{ {
// no copy constructor // no copy constructor
auto a = new CCBRotateTo(); auto a = new CCBRotateTo();
a->initWithDuration(_duration, mDstAngle); a->initWithDuration(_duration, _dstAngle);
a->autorelease(); a->autorelease();
return a; return a;
} }
@ -1052,13 +1052,13 @@ CCBRotateTo* CCBRotateTo::reverse() const
void CCBRotateTo::startWithTarget(Node *pNode) void CCBRotateTo::startWithTarget(Node *pNode)
{ {
ActionInterval::startWithTarget(pNode); ActionInterval::startWithTarget(pNode);
mStartAngle = _target->getRotation(); _startAngle = _target->getRotation();
mDiffAngle = mDstAngle - mStartAngle; _diffAngle = _dstAngle - _startAngle;
} }
void CCBRotateTo::update(float time) void CCBRotateTo::update(float time)
{ {
_target->setRotation(mStartAngle + (mDiffAngle * time)) _target->setRotation(_startAngle + (_diffAngle * time))
; ;
} }
@ -1092,7 +1092,7 @@ bool CCBRotateXTo::initWithDuration(float fDuration, float fAngle)
{ {
if (ActionInterval::initWithDuration(fDuration)) if (ActionInterval::initWithDuration(fDuration))
{ {
mDstAngle = fAngle; _dstAngle = fAngle;
return true; return true;
} }
@ -1110,15 +1110,15 @@ void CCBRotateXTo::startWithTarget(Node *pNode)
_target = pNode; _target = pNode;
_elapsed = 0.0f; _elapsed = 0.0f;
_firstTick = true; _firstTick = true;
mStartAngle = _target->getRotationX(); _startAngle = _target->getRotationX();
mDiffAngle = mDstAngle - mStartAngle; _diffAngle = _dstAngle - _startAngle;
} }
CCBRotateXTo* CCBRotateXTo::clone() const CCBRotateXTo* CCBRotateXTo::clone() const
{ {
// no copy constructor // no copy constructor
auto a = new CCBRotateXTo(); auto a = new CCBRotateXTo();
a->initWithDuration(_duration, mDstAngle); a->initWithDuration(_duration, _dstAngle);
a->autorelease(); a->autorelease();
return a; return a;
} }
@ -1131,7 +1131,7 @@ CCBRotateXTo* CCBRotateXTo::reverse() const
void CCBRotateXTo::update(float time) void CCBRotateXTo::update(float time)
{ {
_target->setRotationX(mStartAngle + (mDiffAngle * time)) _target->setRotationX(_startAngle + (_diffAngle * time))
; ;
} }
@ -1165,7 +1165,7 @@ bool CCBRotateYTo::initWithDuration(float fDuration, float fAngle)
{ {
if (ActionInterval::initWithDuration(fDuration)) if (ActionInterval::initWithDuration(fDuration))
{ {
mDstAngle = fAngle; _dstAngle = fAngle;
return true; return true;
} }
@ -1179,7 +1179,7 @@ CCBRotateYTo* CCBRotateYTo::clone() const
{ {
// no copy constructor // no copy constructor
auto a = new CCBRotateYTo(); auto a = new CCBRotateYTo();
a->initWithDuration(_duration, mDstAngle); a->initWithDuration(_duration, _dstAngle);
a->autorelease(); a->autorelease();
return a; return a;
} }
@ -1198,13 +1198,13 @@ void CCBRotateYTo::startWithTarget(Node *pNode)
_target = pNode; _target = pNode;
_elapsed = 0.0f; _elapsed = 0.0f;
_firstTick = true; _firstTick = true;
mStartAngle = _target->getRotationY(); _startAngle = _target->getRotationY();
mDiffAngle = mDstAngle - mStartAngle; _diffAngle = _dstAngle - _startAngle;
} }
void CCBRotateYTo::update(float time) void CCBRotateYTo::update(float time)
{ {
_target->setRotationY(mStartAngle + (mDiffAngle * time)) _target->setRotationY(_startAngle + (_diffAngle * time))
; ;
} }

View File

@ -17,40 +17,13 @@ public:
class CCBAnimationManager : public Object class CCBAnimationManager : public Object
{ {
private:
Array *_sequences;
Dictionary *_nodeSequences;
Dictionary *_baseValues;
int _autoPlaySequenceId;
Node *_rootNode;
Size _rootContainerSize;
CCBAnimationManagerDelegate *_delegate;
CCBSequence *_runningSequence;
Array *_documentOutletNames;
Array *_documentOutletNodes;
Array *_documentCallbackNames;
Array *_documentCallbackNodes;
Array *_keyframeCallbacks;
Dictionary *mKeyframeCallFuncs;
std::string _documentControllerName;
std::string _lastCompletedSequenceName;
SEL_CallFunc _animationCompleteCallbackFunc;
Object *_target;
public: public:
bool _jsControlled; bool _jsControlled;
CCBAnimationManager(); CCBAnimationManager();
~CCBAnimationManager(); ~CCBAnimationManager();
Object *mOwner; Object *_owner;
virtual bool init(); virtual bool init();
@ -125,6 +98,32 @@ private:
ActionInterval* getEaseAction(ActionInterval *pAction, CCBKeyframe::EasingType easingType, float fEasingOpt); ActionInterval* getEaseAction(ActionInterval *pAction, CCBKeyframe::EasingType easingType, float fEasingOpt);
void runAction(Node *pNode, CCBSequenceProperty *pSeqProp, float fTweenDuration); void runAction(Node *pNode, CCBSequenceProperty *pSeqProp, float fTweenDuration);
void sequenceCompleted(); void sequenceCompleted();
private:
Array *_sequences;
Dictionary *_nodeSequences;
Dictionary *_baseValues;
int _autoPlaySequenceId;
Node *_rootNode;
Size _rootContainerSize;
CCBAnimationManagerDelegate *_delegate;
CCBSequence *_runningSequence;
Array *_documentOutletNames;
Array *_documentOutletNodes;
Array *_documentCallbackNames;
Array *_documentCallbackNodes;
Array *_keyframeCallbacks;
Dictionary *_keyframeCallFuncs;
std::string _documentControllerName;
std::string _lastCompletedSequenceName;
SEL_CallFunc _animationCompleteCallbackFunc;
Object *_target;
}; };
class CCBSetSpriteFrame : public ActionInstant class CCBSetSpriteFrame : public ActionInstant
@ -143,7 +142,7 @@ public:
virtual CCBSetSpriteFrame* reverse() const override; virtual CCBSetSpriteFrame* reverse() const override;
private: private:
SpriteFrame *mSpriteFrame; SpriteFrame *_spriteFrame;
}; };
@ -160,8 +159,8 @@ public:
virtual CCBSoundEffect* reverse() const override; virtual CCBSoundEffect* reverse() const override;
private: private:
std::string mSoundFile; std::string _soundFile;
float mPitch, mPan, mGain; float _pitch, _pan, _gain;
}; };
@ -178,9 +177,9 @@ public:
virtual void startWithTarget(Node *pNode) override; virtual void startWithTarget(Node *pNode) override;
private: private:
float mStartAngle; float _startAngle;
float mDstAngle; float _dstAngle;
float mDiffAngle; float _diffAngle;
}; };
@ -197,9 +196,9 @@ public:
virtual void update(float time) override; virtual void update(float time) override;
private: private:
float mStartAngle; float _startAngle;
float mDstAngle; float _dstAngle;
float mDiffAngle; float _diffAngle;
}; };
@ -216,9 +215,9 @@ public:
virtual void update(float time) override; virtual void update(float time) override;
private: private:
float mStartAngle; float _startAngle;
float mDstAngle; float _dstAngle;
float mDiffAngle; float _diffAngle;
}; };

View File

@ -5,57 +5,57 @@ using namespace cocos2d;
NS_CC_EXT_BEGIN NS_CC_EXT_BEGIN
CCBKeyframe::CCBKeyframe() CCBKeyframe::CCBKeyframe()
: mValue(NULL) : _value(NULL)
, mTime(0.0f) , _time(0.0f)
, mEasingType(EasingType::INSTANT) , _easingType(EasingType::INSTANT)
, mEasingOpt(0.0f) , _easingOpt(0.0f)
{} {}
CCBKeyframe::~CCBKeyframe() CCBKeyframe::~CCBKeyframe()
{ {
CC_SAFE_RELEASE_NULL(mValue); CC_SAFE_RELEASE_NULL(_value);
} }
Object* CCBKeyframe::getValue() Object* CCBKeyframe::getValue()
{ {
return mValue; return _value;
} }
void CCBKeyframe::setValue(Object *pValue) void CCBKeyframe::setValue(Object *pValue)
{ {
CC_SAFE_RELEASE(mValue); CC_SAFE_RELEASE(_value);
mValue = pValue; _value = pValue;
CC_SAFE_RETAIN(mValue); CC_SAFE_RETAIN(_value);
} }
float CCBKeyframe::getTime() float CCBKeyframe::getTime()
{ {
return mTime; return _time;
} }
void CCBKeyframe::setTime(float fTime) void CCBKeyframe::setTime(float fTime)
{ {
mTime = fTime; _time = fTime;
} }
CCBKeyframe::EasingType CCBKeyframe::getEasingType() CCBKeyframe::EasingType CCBKeyframe::getEasingType()
{ {
return mEasingType; return _easingType;
} }
void CCBKeyframe::setEasingType(CCBKeyframe::EasingType easingType) void CCBKeyframe::setEasingType(CCBKeyframe::EasingType easingType)
{ {
mEasingType = easingType; _easingType = easingType;
} }
float CCBKeyframe::getEasingOpt() float CCBKeyframe::getEasingOpt()
{ {
return mEasingOpt; return _easingOpt;
} }
void CCBKeyframe::setEasingOpt(float fEasingOpt) void CCBKeyframe::setEasingOpt(float fEasingOpt)
{ {
mEasingOpt = fEasingOpt; _easingOpt = fEasingOpt;
} }
NS_CC_EXT_END NS_CC_EXT_END

View File

@ -48,10 +48,10 @@ public:
void setEasingOpt(float fEasingOpt); void setEasingOpt(float fEasingOpt);
private: private:
Object *mValue; Object *_value;
float mTime; float _time;
EasingType mEasingType; EasingType _easingType;
float mEasingOpt; float _easingOpt;
}; };
NS_CC_EXT_END NS_CC_EXT_END

View File

@ -22,7 +22,7 @@ NS_CC_EXT_BEGIN;
Implementation of CCBFile Implementation of CCBFile
*************************************************************************/ *************************************************************************/
CCBFile::CCBFile():mCCBFileNode(NULL) {} CCBFile::CCBFile():_CCBFileNode(NULL) {}
CCBFile* CCBFile::create() CCBFile* CCBFile::create()
{ {
@ -38,14 +38,14 @@ CCBFile* CCBFile::create()
Node* CCBFile::getCCBFileNode() Node* CCBFile::getCCBFileNode()
{ {
return mCCBFileNode; return _CCBFileNode;
} }
void CCBFile::setCCBFileNode(Node *pNode) void CCBFile::setCCBFileNode(Node *pNode)
{ {
CC_SAFE_RELEASE(mCCBFileNode); CC_SAFE_RELEASE(_CCBFileNode);
mCCBFileNode = pNode; _CCBFileNode = pNode;
CC_SAFE_RETAIN(mCCBFileNode); CC_SAFE_RETAIN(_CCBFileNode);
} }
/************************************************************************* /*************************************************************************
@ -53,111 +53,111 @@ void CCBFile::setCCBFileNode(Node *pNode)
*************************************************************************/ *************************************************************************/
CCBReader::CCBReader(NodeLoaderLibrary * pNodeLoaderLibrary, CCBMemberVariableAssigner * pCCBMemberVariableAssigner, CCBSelectorResolver * pCCBSelectorResolver, NodeLoaderListener * pNodeLoaderListener) CCBReader::CCBReader(NodeLoaderLibrary * pNodeLoaderLibrary, CCBMemberVariableAssigner * pCCBMemberVariableAssigner, CCBSelectorResolver * pCCBSelectorResolver, NodeLoaderListener * pNodeLoaderListener)
: mData(NULL) : _data(NULL)
, mBytes(NULL) , _bytes(NULL)
, mCurrentByte(-1) , _currentByte(-1)
, mCurrentBit(-1) , _currentBit(-1)
, mOwner(NULL) , _owner(NULL)
, mActionManager(NULL) , _actionManager(NULL)
, mActionManagers(NULL) , _actionManagers(NULL)
, mAnimatedProps(NULL) , _animatedProps(NULL)
, mOwnerOutletNodes(NULL) , _ownerOutletNodes(NULL)
, mNodesWithAnimationManagers(NULL) , _nodesWithAnimationManagers(NULL)
, mAnimationManagersForNodes(NULL) , _animationManagersForNodes(NULL)
, mOwnerCallbackNodes(NULL) , _ownerCallbackNodes(NULL)
, hasScriptingOwner(false) , _hasScriptingOwner(false)
{ {
this->mNodeLoaderLibrary = pNodeLoaderLibrary; this->_nodeLoaderLibrary = pNodeLoaderLibrary;
this->mNodeLoaderLibrary->retain(); this->_nodeLoaderLibrary->retain();
this->mCCBMemberVariableAssigner = pCCBMemberVariableAssigner; this->_CCBMemberVariableAssigner = pCCBMemberVariableAssigner;
this->mCCBSelectorResolver = pCCBSelectorResolver; this->_CCBSelectorResolver = pCCBSelectorResolver;
this->mNodeLoaderListener = pNodeLoaderListener; this->_nodeLoaderListener = pNodeLoaderListener;
init(); init();
} }
CCBReader::CCBReader(CCBReader * ccbReader) CCBReader::CCBReader(CCBReader * ccbReader)
: mData(NULL) : _data(NULL)
, mBytes(NULL) , _bytes(NULL)
, mCurrentByte(-1) , _currentByte(-1)
, mCurrentBit(-1) , _currentBit(-1)
, mOwner(NULL) , _owner(NULL)
, mActionManager(NULL) , _actionManager(NULL)
, mActionManagers(NULL) , _actionManagers(NULL)
, mAnimatedProps(NULL) , _animatedProps(NULL)
, mOwnerOutletNodes(NULL) , _ownerOutletNodes(NULL)
, mNodesWithAnimationManagers(NULL) , _nodesWithAnimationManagers(NULL)
, mAnimationManagersForNodes(NULL) , _animationManagersForNodes(NULL)
, mOwnerCallbackNodes(NULL) , _ownerCallbackNodes(NULL)
, hasScriptingOwner(false) , _hasScriptingOwner(false)
{ {
this->mLoadedSpriteSheets = ccbReader->mLoadedSpriteSheets; this->_loadedSpriteSheets = ccbReader->_loadedSpriteSheets;
this->mNodeLoaderLibrary = ccbReader->mNodeLoaderLibrary; this->_nodeLoaderLibrary = ccbReader->_nodeLoaderLibrary;
this->mNodeLoaderLibrary->retain(); this->_nodeLoaderLibrary->retain();
this->mCCBMemberVariableAssigner = ccbReader->mCCBMemberVariableAssigner; this->_CCBMemberVariableAssigner = ccbReader->_CCBMemberVariableAssigner;
this->mCCBSelectorResolver = ccbReader->mCCBSelectorResolver; this->_CCBSelectorResolver = ccbReader->_CCBSelectorResolver;
this->mNodeLoaderListener = ccbReader->mNodeLoaderListener; this->_nodeLoaderListener = ccbReader->_nodeLoaderListener;
this->mOwnerCallbackNames = ccbReader->mOwnerCallbackNames; this->_ownerCallbackNames = ccbReader->_ownerCallbackNames;
this->mOwnerCallbackNodes = ccbReader->mOwnerCallbackNodes; this->_ownerCallbackNodes = ccbReader->_ownerCallbackNodes;
this->mOwnerCallbackNodes->retain(); this->_ownerCallbackNodes->retain();
this->mOwnerOutletNames = ccbReader->mOwnerOutletNames; this->_ownerOutletNames = ccbReader->_ownerOutletNames;
this->mOwnerOutletNodes = ccbReader->mOwnerOutletNodes; this->_ownerOutletNodes = ccbReader->_ownerOutletNodes;
this->mOwnerOutletNodes->retain(); this->_ownerOutletNodes->retain();
this->mCCBRootPath = ccbReader->getCCBRootPath(); this->_CCBRootPath = ccbReader->getCCBRootPath();
init(); init();
} }
CCBReader::CCBReader() CCBReader::CCBReader()
: mData(NULL) : _data(NULL)
, mBytes(NULL) , _bytes(NULL)
, mCurrentByte(-1) , _currentByte(-1)
, mCurrentBit(-1) , _currentBit(-1)
, mOwner(NULL) , _owner(NULL)
, mActionManager(NULL) , _actionManager(NULL)
, mActionManagers(NULL) , _actionManagers(NULL)
, mNodeLoaderLibrary(NULL) , _nodeLoaderLibrary(NULL)
, mNodeLoaderListener(NULL) , _nodeLoaderListener(NULL)
, mCCBMemberVariableAssigner(NULL) , _CCBMemberVariableAssigner(NULL)
, mCCBSelectorResolver(NULL) , _CCBSelectorResolver(NULL)
, mNodesWithAnimationManagers(NULL) , _nodesWithAnimationManagers(NULL)
, mAnimationManagersForNodes(NULL) , _animationManagersForNodes(NULL)
, hasScriptingOwner(false) , _hasScriptingOwner(false)
{ {
init(); init();
} }
CCBReader::~CCBReader() { CCBReader::~CCBReader() {
CC_SAFE_RELEASE_NULL(mOwner); CC_SAFE_RELEASE_NULL(_owner);
CC_SAFE_RELEASE_NULL(mData); CC_SAFE_RELEASE_NULL(_data);
this->mNodeLoaderLibrary->release(); this->_nodeLoaderLibrary->release();
CC_SAFE_RELEASE(mOwnerOutletNodes); CC_SAFE_RELEASE(_ownerOutletNodes);
mOwnerOutletNames.clear(); _ownerOutletNames.clear();
CC_SAFE_RELEASE(mOwnerCallbackNodes); CC_SAFE_RELEASE(_ownerCallbackNodes);
mOwnerCallbackNames.clear(); _ownerCallbackNames.clear();
// Clear string cache. // Clear string cache.
this->mStringCache.clear(); this->_stringCache.clear();
CC_SAFE_RELEASE(mNodesWithAnimationManagers); CC_SAFE_RELEASE(_nodesWithAnimationManagers);
CC_SAFE_RELEASE(mAnimationManagersForNodes); CC_SAFE_RELEASE(_animationManagersForNodes);
setAnimationManager(NULL); setAnimationManager(NULL);
} }
void CCBReader::setCCBRootPath(const char* pCCBRootPath) void CCBReader::setCCBRootPath(const char* ccbRootPath)
{ {
CCASSERT(pCCBRootPath != NULL, ""); CCASSERT(ccbRootPath != NULL, "");
mCCBRootPath = pCCBRootPath; _CCBRootPath = ccbRootPath;
} }
const std::string& CCBReader::getCCBRootPath() const const std::string& CCBReader::getCCBRootPath() const
{ {
return mCCBRootPath; return _CCBRootPath;
} }
bool CCBReader::init() bool CCBReader::init()
@ -168,54 +168,54 @@ bool CCBReader::init()
pActionManager->release(); pActionManager->release();
// Setup resolution scale and container size // Setup resolution scale and container size
mActionManager->setRootContainerSize(Director::getInstance()->getWinSize()); _actionManager->setRootContainerSize(Director::getInstance()->getWinSize());
return true; return true;
} }
CCBAnimationManager* CCBReader::getAnimationManager() CCBAnimationManager* CCBReader::getAnimationManager()
{ {
return mActionManager; return _actionManager;
} }
void CCBReader::setAnimationManager(CCBAnimationManager *pAnimationManager) void CCBReader::setAnimationManager(CCBAnimationManager *pAnimationManager)
{ {
CC_SAFE_RELEASE(mActionManager); CC_SAFE_RELEASE(_actionManager);
mActionManager = pAnimationManager; _actionManager = pAnimationManager;
CC_SAFE_RETAIN(mActionManager); CC_SAFE_RETAIN(_actionManager);
} }
Dictionary* CCBReader::getAnimationManagers() Dictionary* CCBReader::getAnimationManagers()
{ {
return mActionManagers; return _actionManagers;
} }
void CCBReader::setAnimationManagers(Dictionary* x) void CCBReader::setAnimationManagers(Dictionary* x)
{ {
mActionManagers = x; _actionManagers = x;
} }
CCBMemberVariableAssigner * CCBReader::getCCBMemberVariableAssigner() { CCBMemberVariableAssigner * CCBReader::getCCBMemberVariableAssigner() {
return this->mCCBMemberVariableAssigner; return this->_CCBMemberVariableAssigner;
} }
CCBSelectorResolver * CCBReader::getCCBSelectorResolver() { CCBSelectorResolver * CCBReader::getCCBSelectorResolver() {
return this->mCCBSelectorResolver; return this->_CCBSelectorResolver;
} }
set<string>* CCBReader::getAnimatedProperties() set<string>* CCBReader::getAnimatedProperties()
{ {
return mAnimatedProps; return _animatedProps;
} }
set<string>& CCBReader::getLoadedSpriteSheet() set<string>& CCBReader::getLoadedSpriteSheet()
{ {
return mLoadedSpriteSheets; return _loadedSpriteSheets;
} }
Object* CCBReader::getOwner() Object* CCBReader::getOwner()
{ {
return mOwner; return _owner;
} }
Node* CCBReader::readNodeGraphFromFile(const char *pCCBFileName) Node* CCBReader::readNodeGraphFromFile(const char *pCCBFileName)
@ -259,31 +259,31 @@ Node* CCBReader::readNodeGraphFromFile(const char *pCCBFileName, Object *pOwner,
Node* CCBReader::readNodeGraphFromData(Data *pData, Object *pOwner, const Size &parentSize) Node* CCBReader::readNodeGraphFromData(Data *pData, Object *pOwner, const Size &parentSize)
{ {
mData = pData; _data = pData;
CC_SAFE_RETAIN(mData); CC_SAFE_RETAIN(_data);
mBytes = mData->getBytes(); _bytes =_data->getBytes();
mCurrentByte = 0; _currentByte = 0;
mCurrentBit = 0; _currentBit = 0;
mOwner = pOwner; _owner = pOwner;
CC_SAFE_RETAIN(mOwner); CC_SAFE_RETAIN(_owner);
mActionManager->setRootContainerSize(parentSize); _actionManager->setRootContainerSize(parentSize);
mActionManager->mOwner = mOwner; _actionManager->_owner = _owner;
mOwnerOutletNodes = new Array(); _ownerOutletNodes = new Array();
mOwnerCallbackNodes = new Array(); _ownerCallbackNodes = new Array();
Dictionary* animationManagers = Dictionary::create(); Dictionary* animationManagers = Dictionary::create();
Node *pNodeGraph = readFileWithCleanUp(true, animationManagers); Node *pNodeGraph = readFileWithCleanUp(true, animationManagers);
if (pNodeGraph && mActionManager->getAutoPlaySequenceId() != -1 && !_jsControlled) if (pNodeGraph && _actionManager->getAutoPlaySequenceId() != -1 && !_jsControlled)
{ {
// Auto play animations // Auto play animations
mActionManager->runAnimationsForSequenceIdTweenDuration(mActionManager->getAutoPlaySequenceId(), 0); _actionManager->runAnimationsForSequenceIdTweenDuration(_actionManager->getAutoPlaySequenceId(), 0);
} }
// Assign actionManagers to userObject // Assign actionManagers to userObject
if(_jsControlled) { if(_jsControlled) {
mNodesWithAnimationManagers = new Array(); _nodesWithAnimationManagers = new Array();
mAnimationManagersForNodes = new Array(); _animationManagersForNodes = new Array();
} }
DictElement* pElement = NULL; DictElement* pElement = NULL;
@ -295,8 +295,8 @@ Node* CCBReader::readNodeGraphFromData(Data *pData, Object *pOwner, const Size &
if (_jsControlled) if (_jsControlled)
{ {
mNodesWithAnimationManagers->addObject(pNode); _nodesWithAnimationManagers->addObject(pNode);
mAnimationManagersForNodes->addObject(manager); _animationManagersForNodes->addObject(manager);
} }
} }
@ -354,7 +354,7 @@ Node* CCBReader::readFileWithCleanUp(bool bCleanUp, Dictionary* am)
Node *pNode = readNodeGraph(NULL); Node *pNode = readNodeGraph(NULL);
mActionManagers->setObject(mActionManager, intptr_t(pNode)); _actionManagers->setObject(_actionManager, intptr_t(pNode));
if (bCleanUp) if (bCleanUp)
{ {
@ -368,7 +368,7 @@ bool CCBReader::readStringCache() {
int numStrings = this->readInt(false); int numStrings = this->readInt(false);
for(int i = 0; i < numStrings; i++) { for(int i = 0; i < numStrings; i++) {
this->mStringCache.push_back(this->readUTF8()); this->_stringCache.push_back(this->readUTF8());
} }
return true; return true;
@ -377,13 +377,13 @@ bool CCBReader::readStringCache() {
bool CCBReader::readHeader() bool CCBReader::readHeader()
{ {
/* If no bytes loaded, don't crash about it. */ /* If no bytes loaded, don't crash about it. */
if(this->mBytes == NULL) { if(this->_bytes == NULL) {
return false; return false;
} }
/* Read magic bytes */ /* Read magic bytes */
int magicBytes = *((int*)(this->mBytes + this->mCurrentByte)); int magicBytes = *((int*)(this->_bytes + this->_currentByte));
this->mCurrentByte += 4; this->_currentByte += 4;
if(CC_SWAP_INT32_LITTLE_TO_HOST(magicBytes) != 'ccbi') { if(CC_SWAP_INT32_LITTLE_TO_HOST(magicBytes) != 'ccbi') {
return false; return false;
@ -398,15 +398,15 @@ bool CCBReader::readHeader()
// Read JS check // Read JS check
_jsControlled = this->readBool(); _jsControlled = this->readBool();
mActionManager->_jsControlled = _jsControlled; _actionManager->_jsControlled = _jsControlled;
return true; return true;
} }
unsigned char CCBReader::readByte() unsigned char CCBReader::readByte()
{ {
unsigned char byte = this->mBytes[this->mCurrentByte]; unsigned char byte = this->_bytes[this->_currentByte];
this->mCurrentByte++; this->_currentByte++;
return byte; return byte;
} }
@ -425,39 +425,39 @@ std::string CCBReader::readUTF8()
int numBytes = b0 << 8 | b1; int numBytes = b0 << 8 | b1;
char* pStr = (char*)malloc(numBytes+1); char* pStr = (char*)malloc(numBytes+1);
memcpy(pStr, mBytes+mCurrentByte, numBytes); memcpy(pStr, _bytes+_currentByte, numBytes);
pStr[numBytes] = '\0'; pStr[numBytes] = '\0';
ret = pStr; ret = pStr;
free(pStr); free(pStr);
mCurrentByte += numBytes; _currentByte += numBytes;
return ret; return ret;
} }
bool CCBReader::getBit() { bool CCBReader::getBit() {
bool bit; bool bit;
unsigned char byte = *(this->mBytes + this->mCurrentByte); unsigned char byte = *(this->_bytes + this->_currentByte);
if(byte & (1 << this->mCurrentBit)) { if(byte & (1 << this->_currentBit)) {
bit = true; bit = true;
} else { } else {
bit = false; bit = false;
} }
this->mCurrentBit++; this->_currentBit++;
if(this->mCurrentBit >= 8) { if(this->_currentBit >= 8) {
this->mCurrentBit = 0; this->_currentBit = 0;
this->mCurrentByte++; this->_currentByte++;
} }
return bit; return bit;
} }
void CCBReader::alignBits() { void CCBReader::alignBits() {
if(this->mCurrentBit) { if(this->_currentBit) {
this->mCurrentBit = 0; this->_currentBit = 0;
this->mCurrentByte++; this->_currentByte++;
} }
} }
@ -515,7 +515,7 @@ float CCBReader::readFloat()
/* using a memcpy since the compiler isn't /* using a memcpy since the compiler isn't
* doing the float ptr math correctly on device. * doing the float ptr math correctly on device.
* TODO still applies in C++ ? */ * TODO still applies in C++ ? */
unsigned char* pF = (this->mBytes + this->mCurrentByte); unsigned char* pF = (this->_bytes + this->_currentByte);
float f = 0; float f = 0;
// N.B - in order to avoid an unaligned memory access crash on 'memcpy()' the the (void*) casts of the source and // N.B - in order to avoid an unaligned memory access crash on 'memcpy()' the the (void*) casts of the source and
@ -531,7 +531,7 @@ float CCBReader::readFloat()
// http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka3934.html // http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka3934.html
memcpy((void*) &f, (const void*) pF, sizeof(float)); memcpy((void*) &f, (const void*) pF, sizeof(float));
this->mCurrentByte += sizeof(float); this->_currentByte += sizeof(float);
return f; return f;
} }
} }
@ -540,7 +540,7 @@ float CCBReader::readFloat()
std::string CCBReader::readCachedString() std::string CCBReader::readCachedString()
{ {
int n = this->readInt(false); int n = this->readInt(false);
return this->mStringCache[n]; return this->_stringCache[n];
} }
Node * CCBReader::readNodeGraph(Node * pParent) Node * CCBReader::readNodeGraph(Node * pParent)
@ -562,7 +562,7 @@ Node * CCBReader::readNodeGraph(Node * pParent)
memberVarAssignmentName = this->readCachedString(); memberVarAssignmentName = this->readCachedString();
} }
NodeLoader *ccNodeLoader = this->mNodeLoaderLibrary->getNodeLoader(className.c_str()); NodeLoader *ccNodeLoader = this->_nodeLoaderLibrary->getNodeLoader(className.c_str());
if (! ccNodeLoader) if (! ccNodeLoader)
{ {
@ -573,20 +573,20 @@ Node * CCBReader::readNodeGraph(Node * pParent)
Node *node = ccNodeLoader->loadNode(pParent, this); Node *node = ccNodeLoader->loadNode(pParent, this);
// Set root node // Set root node
if (! mActionManager->getRootNode()) if (! _actionManager->getRootNode())
{ {
mActionManager->setRootNode(node); _actionManager->setRootNode(node);
} }
// Assign controller // Assign controller
if(_jsControlled && node == mActionManager->getRootNode()) if(_jsControlled && node == _actionManager->getRootNode())
{ {
mActionManager->setDocumentControllerName(_jsControlledName); _actionManager->setDocumentControllerName(_jsControlledName);
} }
// Read animated properties // Read animated properties
Dictionary *seqs = Dictionary::create(); Dictionary *seqs = Dictionary::create();
mAnimatedProps = new set<string>(); _animatedProps = new set<string>();
int numSequence = readInt(false); int numSequence = readInt(false);
for (int i = 0; i < numSequence; ++i) for (int i = 0; i < numSequence; ++i)
@ -603,7 +603,7 @@ Node * CCBReader::readNodeGraph(Node * pParent)
seqProp->setName(readCachedString().c_str()); seqProp->setName(readCachedString().c_str());
seqProp->setType(readInt(false)); seqProp->setType(readInt(false));
mAnimatedProps->insert(seqProp->getName()); _animatedProps->insert(seqProp->getName());
int numKeyframes = readInt(false); int numKeyframes = readInt(false);
@ -622,7 +622,7 @@ Node * CCBReader::readNodeGraph(Node * pParent)
if (seqs->count() > 0) if (seqs->count() > 0)
{ {
mActionManager->addNode(node, seqs); _actionManager->addNode(node, seqs);
} }
// Read properties // Read properties
@ -643,7 +643,7 @@ Node * CCBReader::readNodeGraph(Node * pParent)
embeddedNode->setVisible(true); embeddedNode->setVisible(true);
//embeddedNode->ignoreAnchorPointForPosition(ccbFileNode->isIgnoreAnchorPointForPosition()); //embeddedNode->ignoreAnchorPointForPosition(ccbFileNode->isIgnoreAnchorPointForPosition());
mActionManager->moveAnimationsFromNode(ccbFileNode, embeddedNode); _actionManager->moveAnimationsFromNode(ccbFileNode, embeddedNode);
ccbFileNode->setCCBFileNode(NULL); ccbFileNode->setCCBFileNode(NULL);
@ -664,11 +664,11 @@ Node * CCBReader::readNodeGraph(Node * pParent)
Object * target = NULL; Object * target = NULL;
if(memberVarAssignmentType == TargetType::DOCUMENT_ROOT) if(memberVarAssignmentType == TargetType::DOCUMENT_ROOT)
{ {
target = mActionManager->getRootNode(); target = _actionManager->getRootNode();
} }
else if(memberVarAssignmentType == TargetType::OWNER) else if(memberVarAssignmentType == TargetType::OWNER)
{ {
target = this->mOwner; target = this->_owner;
} }
if(target != NULL) if(target != NULL)
@ -683,9 +683,9 @@ Node * CCBReader::readNodeGraph(Node * pParent)
assigned = targetAsCCBMemberVariableAssigner->onAssignCCBMemberVariable(target, memberVarAssignmentName.c_str(), node); assigned = targetAsCCBMemberVariableAssigner->onAssignCCBMemberVariable(target, memberVarAssignmentName.c_str(), node);
} }
if(!assigned && this->mCCBMemberVariableAssigner != NULL) if(!assigned && this->_CCBMemberVariableAssigner != NULL)
{ {
assigned = this->mCCBMemberVariableAssigner->onAssignCCBMemberVariable(target, memberVarAssignmentName.c_str(), node); assigned = this->_CCBMemberVariableAssigner->onAssignCCBMemberVariable(target, memberVarAssignmentName.c_str(), node);
} }
} }
} }
@ -694,13 +694,13 @@ Node * CCBReader::readNodeGraph(Node * pParent)
{ {
if(memberVarAssignmentType == TargetType::DOCUMENT_ROOT) if(memberVarAssignmentType == TargetType::DOCUMENT_ROOT)
{ {
mActionManager->addDocumentOutletName(memberVarAssignmentName); _actionManager->addDocumentOutletName(memberVarAssignmentName);
mActionManager->addDocumentOutletNode(node); _actionManager->addDocumentOutletNode(node);
} }
else else
{ {
mOwnerOutletNames.push_back(memberVarAssignmentName); _ownerOutletNames.push_back(memberVarAssignmentName);
mOwnerOutletNodes->addObject(node); _ownerOutletNodes->addObject(node);
} }
} }
} }
@ -724,9 +724,9 @@ Node * CCBReader::readNodeGraph(Node * pParent)
{ {
customAssigned = targetAsCCBMemberVariableAssigner->onAssignCCBCustomProperty(target, pElement->getStrKey(), static_cast<CCBValue*>(pElement->getObject())); customAssigned = targetAsCCBMemberVariableAssigner->onAssignCCBCustomProperty(target, pElement->getStrKey(), static_cast<CCBValue*>(pElement->getObject()));
if(!customAssigned && this->mCCBMemberVariableAssigner != NULL) if(!customAssigned && this->_CCBMemberVariableAssigner != NULL)
{ {
customAssigned = this->mCCBMemberVariableAssigner->onAssignCCBCustomProperty(target, pElement->getStrKey(), static_cast<CCBValue*>(pElement->getObject())); customAssigned = this->_CCBMemberVariableAssigner->onAssignCCBCustomProperty(target, pElement->getStrKey(), static_cast<CCBValue*>(pElement->getObject()));
} }
} }
} }
@ -736,8 +736,8 @@ Node * CCBReader::readNodeGraph(Node * pParent)
#endif // CCB_ENABLE_JAVASCRIPT #endif // CCB_ENABLE_JAVASCRIPT
delete mAnimatedProps; delete _animatedProps;
mAnimatedProps = NULL; _animatedProps = NULL;
/* Read and add children. */ /* Read and add children. */
int numChildren = this->readInt(false); int numChildren = this->readInt(false);
@ -754,8 +754,8 @@ Node * CCBReader::readNodeGraph(Node * pParent)
NodeLoaderListener * nodeAsNodeLoaderListener = dynamic_cast<NodeLoaderListener *>(node); NodeLoaderListener * nodeAsNodeLoaderListener = dynamic_cast<NodeLoaderListener *>(node);
if(nodeAsNodeLoaderListener != NULL) { if(nodeAsNodeLoaderListener != NULL) {
nodeAsNodeLoaderListener->onNodeLoaded(node, ccNodeLoader); nodeAsNodeLoaderListener->onNodeLoaded(node, ccNodeLoader);
} else if(this->mNodeLoaderListener != NULL) { } else if(this->_nodeLoaderListener != NULL) {
this->mNodeLoaderListener->onNodeLoaded(node, ccNodeLoader); this->_nodeLoaderListener->onNodeLoaded(node, ccNodeLoader);
} }
} }
return node; return node;
@ -824,7 +824,7 @@ CCBKeyframe* CCBReader::readKeyframe(PropertyType type)
if (spriteSheet.length() == 0) if (spriteSheet.length() == 0)
{ {
spriteFile = mCCBRootPath + spriteFile; spriteFile = _CCBRootPath + spriteFile;
Texture2D *texture = TextureCache::getInstance()->addImage(spriteFile.c_str()); Texture2D *texture = TextureCache::getInstance()->addImage(spriteFile.c_str());
Rect bounds = Rect(0, 0, texture->getContentSize().width, texture->getContentSize().height); Rect bounds = Rect(0, 0, texture->getContentSize().width, texture->getContentSize().height);
@ -833,14 +833,14 @@ CCBKeyframe* CCBReader::readKeyframe(PropertyType type)
} }
else else
{ {
spriteSheet = mCCBRootPath + spriteSheet; spriteSheet = _CCBRootPath + spriteSheet;
SpriteFrameCache* frameCache = SpriteFrameCache::getInstance(); SpriteFrameCache* frameCache = SpriteFrameCache::getInstance();
// Load the sprite sheet only if it is not loaded // Load the sprite sheet only if it is not loaded
if (mLoadedSpriteSheets.find(spriteSheet) == mLoadedSpriteSheets.end()) if (_loadedSpriteSheets.find(spriteSheet) == _loadedSpriteSheets.end())
{ {
frameCache->addSpriteFramesWithFile(spriteSheet.c_str()); frameCache->addSpriteFramesWithFile(spriteSheet.c_str());
mLoadedSpriteSheets.insert(spriteSheet); _loadedSpriteSheets.insert(spriteSheet);
} }
spriteFrame = frameCache->getSpriteFrameByName(spriteFile.c_str()); spriteFrame = frameCache->getSpriteFrameByName(spriteFile.c_str());
@ -881,7 +881,7 @@ bool CCBReader::readCallbackKeyframesForSeq(CCBSequence* seq)
if(_jsControlled) { if(_jsControlled) {
string callbackIdentifier; string callbackIdentifier;
mActionManager->getKeyframeCallbacks()->addObject(String::createWithFormat("%d:%s",callbackType, callbackName.c_str())); _actionManager->getKeyframeCallbacks()->addObject(String::createWithFormat("%d:%s",callbackType, callbackName.c_str()));
} }
channel->getKeyframes()->addObject(keyframe); channel->getKeyframes()->addObject(keyframe);
@ -933,7 +933,7 @@ Node * CCBReader::readNodeGraph() {
bool CCBReader::readSequences() bool CCBReader::readSequences()
{ {
Array *sequences = mActionManager->getSequences(); Array *sequences = _actionManager->getSequences();
int numSeqs = readInt(false); int numSeqs = readInt(false);
@ -953,7 +953,7 @@ bool CCBReader::readSequences()
sequences->addObject(seq); sequences->addObject(seq);
} }
mActionManager->setAutoPlaySequenceId(readInt(true)); _actionManager->setAutoPlaySequenceId(readInt(true));
return true; return true;
} }
@ -996,27 +996,27 @@ bool CCBReader::isJSControlled() {
} }
void CCBReader::addOwnerCallbackName(std::string name) { void CCBReader::addOwnerCallbackName(std::string name) {
mOwnerCallbackNames.push_back(name); _ownerCallbackNames.push_back(name);
} }
void CCBReader::addOwnerCallbackNode(Node *node) { void CCBReader::addOwnerCallbackNode(Node *node) {
mOwnerCallbackNodes->addObject(node); _ownerCallbackNodes->addObject(node);
} }
void CCBReader::addDocumentCallbackName(std::string name) { void CCBReader::addDocumentCallbackName(std::string name) {
mActionManager->addDocumentCallbackName(name); _actionManager->addDocumentCallbackName(name);
} }
void CCBReader::addDocumentCallbackNode(Node *node) { void CCBReader::addDocumentCallbackNode(Node *node) {
mActionManager->addDocumentCallbackNode(node); _actionManager->addDocumentCallbackNode(node);
} }
Array* CCBReader::getOwnerCallbackNames() { Array* CCBReader::getOwnerCallbackNames() {
Array* pRet = Array::createWithCapacity(mOwnerCallbackNames.size()); Array* pRet = Array::createWithCapacity(_ownerCallbackNames.size());
std::vector<std::string>::iterator it = mOwnerCallbackNames.begin(); std::vector<std::string>::iterator it = _ownerCallbackNames.begin();
for (; it != mOwnerCallbackNames.end(); ++it) for (; it != _ownerCallbackNames.end(); ++it)
{ {
pRet->addObject(String::create(*it)); pRet->addObject(String::create(*it));
} }
@ -1025,13 +1025,13 @@ Array* CCBReader::getOwnerCallbackNames() {
} }
Array* CCBReader::getOwnerCallbackNodes() { Array* CCBReader::getOwnerCallbackNodes() {
return mOwnerCallbackNodes; return _ownerCallbackNodes;
} }
Array* CCBReader::getOwnerOutletNames() { Array* CCBReader::getOwnerOutletNames() {
Array* pRet = Array::createWithCapacity(mOwnerOutletNames.size()); Array* pRet = Array::createWithCapacity(_ownerOutletNames.size());
std::vector<std::string>::iterator it = mOwnerOutletNames.begin(); std::vector<std::string>::iterator it = _ownerOutletNames.begin();
for (; it != mOwnerOutletNames.end(); ++it) for (; it != _ownerOutletNames.end(); ++it)
{ {
pRet->addObject(String::create(*it)); pRet->addObject(String::create(*it));
} }
@ -1039,20 +1039,20 @@ Array* CCBReader::getOwnerOutletNames() {
} }
Array* CCBReader::getOwnerOutletNodes() { Array* CCBReader::getOwnerOutletNodes() {
return mOwnerOutletNodes; return _ownerOutletNodes;
} }
Array* CCBReader::getNodesWithAnimationManagers() { Array* CCBReader::getNodesWithAnimationManagers() {
return mNodesWithAnimationManagers; return _nodesWithAnimationManagers;
} }
Array* CCBReader::getAnimationManagersForNodes() { Array* CCBReader::getAnimationManagersForNodes() {
return mAnimationManagersForNodes; return _animationManagersForNodes;
} }
void CCBReader::addOwnerOutletName(std::string name) void CCBReader::addOwnerOutletName(std::string name)
{ {
mOwnerOutletNames.push_back(name); _ownerOutletNames.push_back(name);
} }
void CCBReader::addOwnerOutletNode(Node *node) void CCBReader::addOwnerOutletNode(Node *node)
@ -1060,7 +1060,7 @@ void CCBReader::addOwnerOutletNode(Node *node)
if (NULL != node) if (NULL != node)
return; return;
mOwnerOutletNodes->addObject(node); _ownerOutletNodes->addObject(node);
} }
/************************************************************************ /************************************************************************

View File

@ -40,7 +40,7 @@ NS_CC_EXT_BEGIN
class CCBFile : public Node class CCBFile : public Node
{ {
private: private:
Node *mCCBFileNode; Node *_CCBFileNode;
public: public:
CCBFile(); CCBFile();
@ -149,7 +149,7 @@ public:
virtual ~CCBReader(); virtual ~CCBReader();
CCBReader(); CCBReader();
void setCCBRootPath(const char* pCCBRootPath); void setCCBRootPath(const char* ccbRootPath);
const std::string& getCCBRootPath() const; const std::string& getCCBRootPath() const;
Node* readNodeGraphFromFile(const char *pCCBFileName); Node* readNodeGraphFromFile(const char *pCCBFileName);
@ -235,38 +235,38 @@ private:
friend class NodeLoader; friend class NodeLoader;
private: private:
Data *mData; Data *_data;
unsigned char *mBytes; unsigned char *_bytes;
int mCurrentByte; int _currentByte;
int mCurrentBit; int _currentBit;
std::vector<std::string> mStringCache; std::vector<std::string> _stringCache;
std::set<std::string> mLoadedSpriteSheets; std::set<std::string> _loadedSpriteSheets;
Object *mOwner; Object *_owner;
CCBAnimationManager *mActionManager; //retain CCBAnimationManager *_actionManager; //retain
Dictionary* mActionManagers; Dictionary* _actionManagers;
std::set<std::string> *mAnimatedProps; std::set<std::string> *_animatedProps;
NodeLoaderLibrary *mNodeLoaderLibrary; NodeLoaderLibrary *_nodeLoaderLibrary;
NodeLoaderListener *mNodeLoaderListener; NodeLoaderListener *_nodeLoaderListener;
CCBMemberVariableAssigner *mCCBMemberVariableAssigner; CCBMemberVariableAssigner *_CCBMemberVariableAssigner;
CCBSelectorResolver *mCCBSelectorResolver; CCBSelectorResolver *_CCBSelectorResolver;
std::vector<std::string> mOwnerOutletNames; std::vector<std::string> _ownerOutletNames;
Array* mOwnerOutletNodes; Array* _ownerOutletNodes;
Array* mNodesWithAnimationManagers; Array* _nodesWithAnimationManagers;
Array* mAnimationManagersForNodes; Array* _animationManagersForNodes;
std::vector<std::string> mOwnerCallbackNames; std::vector<std::string> _ownerCallbackNames;
Array* mOwnerCallbackNodes; Array* _ownerCallbackNodes;
std::string mCCBRootPath; std::string _CCBRootPath;
bool _jsControlled; bool _jsControlled;
bool hasScriptingOwner; bool _hasScriptingOwner;
bool init(); bool init();
}; };

View File

@ -7,8 +7,8 @@ using namespace std;
NS_CC_EXT_BEGIN NS_CC_EXT_BEGIN
CCBSequence::CCBSequence() CCBSequence::CCBSequence()
: mDuration(0.0f) : _duration(0.0f)
, mName("") , _name("")
, mSequenceId(0) , mSequenceId(0)
, mChainedSequenceId(0) , mChainedSequenceId(0)
, mCallbackChannel(NULL) , mCallbackChannel(NULL)
@ -22,22 +22,22 @@ CCBSequence::~CCBSequence() {
float CCBSequence::getDuration() float CCBSequence::getDuration()
{ {
return mDuration; return _duration;
} }
void CCBSequence::setDuration(float fDuration) void CCBSequence::setDuration(float fDuration)
{ {
mDuration = fDuration; _duration = fDuration;
} }
const char* CCBSequence::getName() const char* CCBSequence::getName()
{ {
return mName.c_str(); return _name.c_str();
} }
void CCBSequence::setName(const char *pName) void CCBSequence::setName(const char *pName)
{ {
mName = pName; _name = pName;
} }
int CCBSequence::getSequenceId() int CCBSequence::getSequenceId()

View File

@ -10,14 +10,6 @@ NS_CC_EXT_BEGIN
class CCBSequence : public Object class CCBSequence : public Object
{ {
private:
float mDuration;
std::string mName;
int mSequenceId;
int mChainedSequenceId;
CCBSequenceProperty* mCallbackChannel;
CCBSequenceProperty* mSoundChannel;
public: public:
CCBSequence(); CCBSequence();
~CCBSequence(); ~CCBSequence();
@ -38,6 +30,14 @@ public:
int getChainedSequenceId(); int getChainedSequenceId();
void setChainedSequenceId(int nChainedSequenceId); void setChainedSequenceId(int nChainedSequenceId);
private:
float _duration;
std::string _name;
int mSequenceId;
int mChainedSequenceId;
CCBSequenceProperty* mCallbackChannel;
CCBSequenceProperty* mSoundChannel;
}; };

View File

@ -6,47 +6,47 @@ using namespace std;
NS_CC_EXT_BEGIN NS_CC_EXT_BEGIN
CCBSequenceProperty::CCBSequenceProperty() CCBSequenceProperty::CCBSequenceProperty()
: mName("") : _name("")
, mType(0) , _type(0)
{ {
init(); init();
} }
bool CCBSequenceProperty::init() bool CCBSequenceProperty::init()
{ {
mKeyframes = new Array(); _keyframes = new Array();
return true; return true;
} }
CCBSequenceProperty::~CCBSequenceProperty() CCBSequenceProperty::~CCBSequenceProperty()
{ {
CC_SAFE_RELEASE_NULL(mKeyframes); CC_SAFE_RELEASE_NULL(_keyframes);
} }
const char* CCBSequenceProperty::getName() const char* CCBSequenceProperty::getName()
{ {
return mName.c_str(); return _name.c_str();
} }
void CCBSequenceProperty::setName(const char *pName) void CCBSequenceProperty::setName(const char *pName)
{ {
mName = pName; _name = pName;
} }
int CCBSequenceProperty::getType() int CCBSequenceProperty::getType()
{ {
return mType; return _type;
} }
void CCBSequenceProperty::setType(int type) void CCBSequenceProperty::setType(int type)
{ {
mType = type; _type = type;
} }
Array* CCBSequenceProperty::getKeyframes() Array* CCBSequenceProperty::getKeyframes()
{ {
return mKeyframes; return _keyframes;
} }
NS_CC_EXT_END NS_CC_EXT_END

View File

@ -9,11 +9,6 @@ NS_CC_EXT_BEGIN
class CCBSequenceProperty : public Object class CCBSequenceProperty : public Object
{ {
private:
std::string mName;
int mType;
Array *mKeyframes;
public: public:
CCBSequenceProperty(); CCBSequenceProperty();
~CCBSequenceProperty(); ~CCBSequenceProperty();
@ -27,6 +22,11 @@ public:
void setType(int type); void setType(int type);
Array* getKeyframes(); Array* getKeyframes();
private:
std::string _name;
int _type;
Array *_keyframes;
}; };
NS_CC_EXT_END NS_CC_EXT_END

View File

@ -33,8 +33,8 @@ CCBValue* CCBValue::create(int nValue)
CCBValue *ret = new CCBValue(); CCBValue *ret = new CCBValue();
if (ret) if (ret)
{ {
ret->mValue.nValue = nValue; ret->_value.intValue = nValue;
ret->mType = TYPE_INT; ret->_type = TYPE_INT;
ret->autorelease(); ret->autorelease();
} }
@ -46,8 +46,8 @@ CCBValue* CCBValue::create(float fValue)
CCBValue *ret = new CCBValue(); CCBValue *ret = new CCBValue();
if (ret) if (ret)
{ {
ret->mValue.fValue = fValue; ret->_value.floatValue = fValue;
ret->mType = TYPE_FLOAT; ret->_type = TYPE_FLOAT;
ret->autorelease(); ret->autorelease();
} }
@ -59,8 +59,8 @@ CCBValue* CCBValue::create(bool vValue)
CCBValue *ret = new CCBValue(); CCBValue *ret = new CCBValue();
if (ret) if (ret)
{ {
ret->mValue.nValue = vValue ? 1 : 0; ret->_value.intValue = vValue ? 1 : 0;
ret->mType = TYPE_BOOL; ret->_type = TYPE_BOOL;
ret->autorelease(); ret->autorelease();
} }
@ -72,8 +72,8 @@ CCBValue* CCBValue::create(unsigned char byte)
CCBValue *ret = new CCBValue(); CCBValue *ret = new CCBValue();
if (ret) if (ret)
{ {
ret->mValue.nValue = byte; ret->_value.intValue = byte;
ret->mType = TYPE_UNSIGNED_CHAR; ret->_type = TYPE_UNSIGNED_CHAR;
ret->autorelease(); ret->autorelease();
} }
@ -85,8 +85,8 @@ CCBValue* CCBValue::create(const char *pStringValue)
CCBValue *ret = new CCBValue(); CCBValue *ret = new CCBValue();
if (ret) if (ret)
{ {
ret->_value = pStringValue; ret->_strValue = pStringValue;
ret->mType = TYPE_STRING; ret->_type = TYPE_STRING;
ret->autorelease(); ret->autorelease();
} }
@ -100,7 +100,7 @@ CCBValue* CCBValue::create(Array *pArrValue)
if (ret) if (ret)
{ {
ret->_arrValue = pArrValue; ret->_arrValue = pArrValue;
ret->mType = TYPE_ARRAY; ret->_type = TYPE_ARRAY;
ret->autorelease(); ret->autorelease();
} }
@ -110,35 +110,35 @@ CCBValue* CCBValue::create(Array *pArrValue)
int CCBValue::getIntValue() int CCBValue::getIntValue()
{ {
CCASSERT(mType == TYPE_INT, "The type of CCBValue isn't integer."); CCASSERT(_type == TYPE_INT, "The type of CCBValue isn't integer.");
return mValue.nValue; return _value.intValue;
} }
float CCBValue::getFloatValue() float CCBValue::getFloatValue()
{ {
CCASSERT(mType == TYPE_FLOAT, "The type of CCBValue isn't float."); CCASSERT(_type == TYPE_FLOAT, "The type of CCBValue isn't float.");
return mValue.fValue; return _value.floatValue;
} }
bool CCBValue::getBoolValue() bool CCBValue::getBoolValue()
{ {
CCASSERT(mType == TYPE_BOOL, "The type of CCBValue isn't boolean."); CCASSERT(_type == TYPE_BOOL, "The type of CCBValue isn't boolean.");
return mValue.nValue == 1 ? true : false; return _value.intValue == 1 ? true : false;
} }
unsigned char CCBValue::getByteValue() unsigned char CCBValue::getByteValue()
{ {
CCASSERT(mType == TYPE_UNSIGNED_CHAR, "The type of CCBValue isn't unsigned char."); CCASSERT(_type == TYPE_UNSIGNED_CHAR, "The type of CCBValue isn't unsigned char.");
return (unsigned char)(mValue.nValue); return (unsigned char)(_value.intValue);
} }
Array* CCBValue::getArrayValue() Array* CCBValue::getArrayValue()
{ {
CCASSERT(mType == TYPE_ARRAY, "The type of CCBValue isn't array."); CCASSERT(_type == TYPE_ARRAY, "The type of CCBValue isn't array.");
return _arrValue; return _arrValue;
} }
@ -146,14 +146,14 @@ Array* CCBValue::getArrayValue()
const char* CCBValue::getStringValue() const char* CCBValue::getStringValue()
{ {
CCASSERT(mType == TYPE_STRING, "The type of CCBValue isn't string."); CCASSERT(_type == TYPE_STRING, "The type of CCBValue isn't string.");
return _value.c_str(); return _strValue.c_str();
} }
CCBValue::Type CCBValue::getType() CCBValue::Type CCBValue::getType()
{ {
return mType; return _type;
} }
NS_CC_EXT_END NS_CC_EXT_END

View File

@ -12,13 +12,13 @@ NS_CC_EXT_BEGIN
class Color3BWapper : public Object class Color3BWapper : public Object
{ {
private:
Color3B color;
public: public:
static Color3BWapper* create(const Color3B& color); static Color3BWapper* create(const Color3B& color);
const Color3B& getColor() const; const Color3B& getColor() const;
private:
Color3B color;
}; };
@ -57,13 +57,13 @@ public:
private: private:
union union
{ {
int nValue; int intValue;
float fValue; float floatValue;
} mValue; } _value;
std::string _value; std::string _strValue;
Array* _arrValue; Array* _arrValue;
Type mType; Type _type;
}; };
NS_CC_EXT_END NS_CC_EXT_END

View File

@ -917,22 +917,22 @@ Node * NodeLoader::parsePropTypeCCBFile(Node * pNode, Node * pParent, CCBReader
CC_SAFE_DELETE_ARRAY(pBytes); CC_SAFE_DELETE_ARRAY(pBytes);
data->retain(); data->retain();
reader->mData = data; reader->_data = data;
reader->mBytes = data->getBytes(); reader->_bytes = data->getBytes();
reader->mCurrentByte = 0; reader->_currentByte = 0;
reader->mCurrentBit = 0; reader->_currentBit = 0;
CC_SAFE_RETAIN(pCCBReader->mOwner); CC_SAFE_RETAIN(pCCBReader->_owner);
reader->mOwner = pCCBReader->mOwner; reader->_owner = pCCBReader->_owner;
reader->getAnimationManager()->mOwner = reader->mOwner; reader->getAnimationManager()->_owner = reader->_owner;
// The assignments below are done in the CCBReader constructor. // The assignments below are done in the CCBReader constructor.
// reader->mOwnerOutletNames = pCCBReader->mOwnerOutletNames; // reader->_ownerOutletNames = pCCBReader->_ownerOutletNames;
// reader->mOwnerOutletNodes = pCCBReader->mOwnerOutletNodes; // reader->_ownerOutletNodes = pCCBReader->_ownerOutletNodes;
// reader->mOwnerOutletNodes->retain(); // reader->_ownerOutletNodes->retain();
// reader->mOwnerCallbackNames = pCCBReader->mOwnerCallbackNames; // reader->_ownerCallbackNames = pCCBReader->_ownerCallbackNames;
// reader->mOwnerCallbackNodes = pCCBReader->mOwnerCallbackNodes; // reader->_ownerCallbackNodes = pCCBReader->_ownerCallbackNodes;
// reader->mOwnerCallbackNodes->retain(); // reader->_ownerCallbackNodes->retain();
data->release(); data->release();
@ -944,7 +944,7 @@ Node * NodeLoader::parsePropTypeCCBFile(Node * pNode, Node * pParent, CCBReader
reader->getAnimationManager()->runAnimationsForSequenceIdTweenDuration(reader->getAnimationManager()->getAutoPlaySequenceId(), 0); reader->getAnimationManager()->runAnimationsForSequenceIdTweenDuration(reader->getAnimationManager()->getAutoPlaySequenceId(), 0);
} }
if (reader->isJSControlled() && pCCBReader->isJSControlled() && NULL != reader->mOwner) if (reader->isJSControlled() && pCCBReader->isJSControlled() && NULL != reader->_owner)
{ {
//set variables and callback to owner //set variables and callback to owner
//set callback //set callback

View File

@ -46,15 +46,15 @@ void NodeLoaderLibrary::registerDefaultNodeLoaders() {
void NodeLoaderLibrary::registerNodeLoader(const char * pClassName, NodeLoader * pNodeLoader) { void NodeLoaderLibrary::registerNodeLoader(const char * pClassName, NodeLoader * pNodeLoader) {
pNodeLoader->retain(); pNodeLoader->retain();
this->mNodeLoaders.insert(NodeLoaderMapEntry(pClassName, pNodeLoader)); this->_nodeLoaders.insert(NodeLoaderMapEntry(pClassName, pNodeLoader));
} }
void NodeLoaderLibrary::unregisterNodeLoader(const char * pClassName) { void NodeLoaderLibrary::unregisterNodeLoader(const char * pClassName) {
NodeLoaderMap::iterator ccNodeLoadersIterator = this->mNodeLoaders.find(pClassName); NodeLoaderMap::iterator ccNodeLoadersIterator = this->_nodeLoaders.find(pClassName);
if (ccNodeLoadersIterator != this->mNodeLoaders.end()) if (ccNodeLoadersIterator != this->_nodeLoaders.end())
{ {
ccNodeLoadersIterator->second->release(); ccNodeLoadersIterator->second->release();
mNodeLoaders.erase(ccNodeLoadersIterator); _nodeLoaders.erase(ccNodeLoadersIterator);
} }
else else
{ {
@ -63,18 +63,18 @@ void NodeLoaderLibrary::unregisterNodeLoader(const char * pClassName) {
} }
NodeLoader * NodeLoaderLibrary::getNodeLoader(const char* pClassName) { NodeLoader * NodeLoaderLibrary::getNodeLoader(const char* pClassName) {
NodeLoaderMap::iterator ccNodeLoadersIterator = this->mNodeLoaders.find(pClassName); NodeLoaderMap::iterator ccNodeLoadersIterator = this->_nodeLoaders.find(pClassName);
assert(ccNodeLoadersIterator != this->mNodeLoaders.end()); assert(ccNodeLoadersIterator != this->_nodeLoaders.end());
return ccNodeLoadersIterator->second; return ccNodeLoadersIterator->second;
} }
void NodeLoaderLibrary::purge(bool pReleaseNodeLoaders) { void NodeLoaderLibrary::purge(bool pReleaseNodeLoaders) {
if(pReleaseNodeLoaders) { if(pReleaseNodeLoaders) {
for(NodeLoaderMap::iterator it = this->mNodeLoaders.begin(); it != this->mNodeLoaders.end(); it++) { for(NodeLoaderMap::iterator it = this->_nodeLoaders.begin(); it != this->_nodeLoaders.end(); it++) {
it->second->release(); it->second->release();
} }
} }
this->mNodeLoaders.clear(); this->_nodeLoaders.clear();
} }

View File

@ -11,10 +11,8 @@ class NodeLoader;
typedef std::map<std::string, NodeLoader *> NodeLoaderMap; typedef std::map<std::string, NodeLoader *> NodeLoaderMap;
typedef std::pair<std::string, NodeLoader *> NodeLoaderMapEntry; typedef std::pair<std::string, NodeLoader *> NodeLoaderMapEntry;
class NodeLoaderLibrary : public Object { class NodeLoaderLibrary : public Object
private: {
NodeLoaderMap mNodeLoaders;
public: public:
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(NodeLoaderLibrary, library); CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(NodeLoaderLibrary, library);
@ -45,6 +43,9 @@ public:
CC_DEPRECATED_ATTRIBUTE static void purgeSharedNodeLoaderLibrary() { NodeLoaderLibrary::destroyInstance(); }; CC_DEPRECATED_ATTRIBUTE static void purgeSharedNodeLoaderLibrary() { NodeLoaderLibrary::destroyInstance(); };
CC_DEPRECATED_ATTRIBUTE static NodeLoaderLibrary * newDefaultCCNodeLoaderLibrary() { return NodeLoaderLibrary::newDefaultNodeLoaderLibrary(); }; CC_DEPRECATED_ATTRIBUTE static NodeLoaderLibrary * newDefaultCCNodeLoaderLibrary() { return NodeLoaderLibrary::newDefaultNodeLoaderLibrary(); };
private:
NodeLoaderMap _nodeLoaders;
}; };
NS_CC_EXT_END NS_CC_EXT_END