diff --git a/CocosDenshion/bada/SimpleAudioEngine.cpp b/CocosDenshion/bada/SimpleAudioEngine.cpp index ab95d55269..f222cedb26 100644 --- a/CocosDenshion/bada/SimpleAudioEngine.cpp +++ b/CocosDenshion/bada/SimpleAudioEngine.cpp @@ -450,7 +450,7 @@ unsigned int SimpleAudioEngine::playEffect(const char* pszFilePath, bool bLoop/* if (AUDIOOUT_STATE_PLAYING == p->second->GetState()) { return nRet; // Stop waste a lot of time, so just return. - r = p->second->Stop(); + //r = p->second->Stop(); } if (s_fEffectsVolume > 0.0f) diff --git a/cocos2dx/CCCamera.cpp b/cocos2dx/CCCamera.cpp index 292f8c7ef8..c400b1b4b0 100644 --- a/cocos2dx/CCCamera.cpp +++ b/cocos2dx/CCCamera.cpp @@ -28,6 +28,7 @@ THE SOFTWARE. #include "CCGL.h" #include "CCDrawingPrimitives.h" +#include "CCDirector.h" using namespace std; namespace cocos2d { diff --git a/cocos2dx/CCDirector.cpp b/cocos2dx/CCDirector.cpp index cd1566716d..6aa7001706 100644 --- a/cocos2dx/CCDirector.cpp +++ b/cocos2dx/CCDirector.cpp @@ -156,7 +156,7 @@ CCDirector::~CCDirector(void) void CCDirector::setGLDefaultValues(void) { // This method SHOULD be called only after openGLView_ was initialized - assert(m_pobOpenGLView); + CCAssert(m_pobOpenGLView, "opengl view should not be null"); setAlphaBlending(true); setDepthTest(true); @@ -275,7 +275,7 @@ void CCDirector::calculateDeltaTime(void) void CCDirector::setOpenGLView(CC_GLVIEW *pobOpenGLView) { - assert(pobOpenGLView); + CCAssert(pobOpenGLView, "opengl view should not be null"); if (m_pobOpenGLView != pobOpenGLView) { @@ -494,8 +494,8 @@ void CCDirector::reshapeProjection(const CCSize& newWindowSize) void CCDirector::runWithScene(CCScene *pScene) { - assert(pScene != NULL); - assert(m_pRunningScene == NULL); + CCAssert(pScene != NULL, "running scene should not be null"); + CCAssert(m_pRunningScene == NULL, "m_pRunningScene should be null"); pushScene(pScene); startAnimation(); @@ -503,7 +503,7 @@ void CCDirector::runWithScene(CCScene *pScene) void CCDirector::replaceScene(CCScene *pScene) { - assert(pScene != NULL); + CCAssert(pScene != NULL, "the scene should not be null"); unsigned int index = m_pobScenesStack->count(); @@ -515,7 +515,7 @@ void CCDirector::replaceScene(CCScene *pScene) void CCDirector::pushScene(CCScene *pScene) { - assert(pScene); + CCAssert(pScene, "the scene should not null"); m_bSendCleanupToScene = false; @@ -525,7 +525,7 @@ void CCDirector::pushScene(CCScene *pScene) void CCDirector::popScene(void) { - assert(m_pRunningScene != NULL); + CCAssert(m_pRunningScene != NULL, "running scene should not null"); m_pobScenesStack->removeLastObject(); unsigned int c = m_pobScenesStack->count(); diff --git a/cocos2dx/CCDrawingPrimitives.cpp b/cocos2dx/CCDrawingPrimitives.cpp index 20a2571efd..91bb5e61d5 100644 --- a/cocos2dx/CCDrawingPrimitives.cpp +++ b/cocos2dx/CCDrawingPrimitives.cpp @@ -28,10 +28,10 @@ THE SOFTWARE. #include "ccTypes.h" #include "ccMacros.h" #include "CCGL.h" +#include "CCDirector.h" #include #include -#include "CCGL.h" #ifndef M_PI #define M_PI 3.14159265358979323846 diff --git a/cocos2dx/CCScheduler.cpp b/cocos2dx/CCScheduler.cpp index bee15e2f10..eb879549e8 100644 --- a/cocos2dx/CCScheduler.cpp +++ b/cocos2dx/CCScheduler.cpp @@ -31,8 +31,6 @@ THE SOFTWARE. #include "CCMutableArray.h" #include "CCScriptSupport.h" -#include - using namespace std; namespace cocos2d { @@ -189,7 +187,7 @@ CCScheduler::CCScheduler(void) , m_bCurrentTargetSalvaged(false) , m_pHashForScriptFunctions(NULL) { - assert(pSharedScheduler == NULL); + CCAssert(pSharedScheduler == NULL, ""); } CCScheduler::~CCScheduler(void) @@ -245,8 +243,8 @@ void CCScheduler::removeHashElement(_hashSelectorEntry *pElement) void CCScheduler::scheduleSelector(SEL_SCHEDULE pfnSelector, SelectorProtocol *pTarget, float fInterval, bool bPaused) { - assert(pfnSelector); - assert(pTarget); + CCAssert(pfnSelector, ""); + CCAssert(pTarget, ""); tHashSelectorEntry *pElement = NULL; HASH_FIND_INT(m_pHashForSelectors, &pTarget, pElement); @@ -266,7 +264,7 @@ void CCScheduler::scheduleSelector(SEL_SCHEDULE pfnSelector, SelectorProtocol *p } else { - assert(pElement->paused == bPaused); + CCAssert(pElement->paused == bPaused, ""); } if (pElement->timers == NULL) @@ -297,8 +295,8 @@ void CCScheduler::scheduleSelector(SEL_SCHEDULE pfnSelector, SelectorProtocol *p void CCScheduler::scheduleScriptFunc(const char *pszFuncName, ccTime fInterval, bool bPaused) { - //assert(pfnSelector); - assert(pszFuncName); + //CCAssert(pfnSelector); + CCAssert(pszFuncName, ""); tHashScriptFuncEntry *pElement = NULL; HASH_FIND_INT(m_pHashForScriptFunctions, &pszFuncName, pElement); @@ -315,7 +313,7 @@ void CCScheduler::scheduleScriptFunc(const char *pszFuncName, ccTime fInterval, } else { - assert(pElement->paused == bPaused); + CCAssert(pElement->paused == bPaused, ""); } } @@ -327,8 +325,8 @@ void CCScheduler::unscheduleSelector(SEL_SCHEDULE pfnSelector, SelectorProtocol return; } - //assert(pTarget); - //assert(pfnSelector); + //CCAssert(pTarget); + //CCAssert(pfnSelector); tHashSelectorEntry *pElement = NULL; HASH_FIND_INT(m_pHashForSelectors, &pTarget, pElement); @@ -477,7 +475,7 @@ void CCScheduler::scheduleUpdateForTarget(SelectorProtocol *pTarget, int nPriori if (pHashElement) { #if COCOS2D_DEBUG >= 1 - assert(pHashElement->entry->markedForDeletion); + CCAssert(pHashElement->entry->markedForDeletion); #endif // TODO: check if priority has changed! @@ -620,7 +618,7 @@ void CCScheduler::unscheduleAllSelectorsForTarget(SelectorProtocol *pTarget) void CCScheduler::resumeTarget(SelectorProtocol *pTarget) { - assert(pTarget != NULL); + CCAssert(pTarget != NULL, ""); // custom selectors tHashSelectorEntry *pElement = NULL; @@ -635,14 +633,14 @@ void CCScheduler::resumeTarget(SelectorProtocol *pTarget) HASH_FIND_INT(m_pHashForUpdates, &pTarget, pElementUpdate); if (pElementUpdate) { - assert(pElementUpdate->entry != NULL); + CCAssert(pElementUpdate->entry != NULL, ""); pElementUpdate->entry->paused = false; } } void CCScheduler::pauseTarget(SelectorProtocol *pTarget) { - assert(pTarget != NULL); + CCAssert(pTarget != NULL, ""); // custom selectors tHashSelectorEntry *pElement = NULL; @@ -657,7 +655,7 @@ void CCScheduler::pauseTarget(SelectorProtocol *pTarget) HASH_FIND_INT(m_pHashForUpdates, &pTarget, pElementUpdate); if (pElementUpdate) { - assert(pElementUpdate->entry != NULL); + CCAssert(pElementUpdate->entry != NULL, ""); pElementUpdate->entry->paused = true; } } diff --git a/cocos2dx/actions/CCAction.cpp b/cocos2dx/actions/CCAction.cpp index c749730cc1..2fc53ce441 100644 --- a/cocos2dx/actions/CCAction.cpp +++ b/cocos2dx/actions/CCAction.cpp @@ -137,7 +137,7 @@ CCSpeed * CCSpeed::actionWithAction(CCActionInterval *pAction, float fRate) bool CCSpeed::initWithAction(CCActionInterval *pAction, float fRate) { - assert(pAction != NULL); + CCAssert(pAction != NULL, ""); pAction->retain(); m_pInnerAction = pAction; m_fSpeed = fRate; @@ -235,7 +235,7 @@ CCFollow *CCFollow::actionWithTarget(CCNode *pFollowedNode, const CCRect& rect) bool CCFollow::initWithTarget(CCNode *pFollowedNode) { - assert(pFollowedNode != NULL); + CCAssert(pFollowedNode != NULL, ""); pFollowedNode->retain(); m_pobFollowedNode = pFollowedNode; m_bBoundarySet = false; @@ -249,7 +249,7 @@ bool CCFollow::initWithTarget(CCNode *pFollowedNode) bool CCFollow::initWithTarget(CCNode *pFollowedNode, const CCRect& rect) { - assert(pFollowedNode != NULL); + CCAssert(pFollowedNode != NULL, ""); pFollowedNode->retain(); m_pobFollowedNode = pFollowedNode; m_bBoundarySet = true; diff --git a/cocos2dx/actions/CCActionEase.cpp b/cocos2dx/actions/CCActionEase.cpp index e84fb9aa0c..c03bf33ad0 100644 --- a/cocos2dx/actions/CCActionEase.cpp +++ b/cocos2dx/actions/CCActionEase.cpp @@ -62,7 +62,7 @@ namespace cocos2d { bool CCActionEase::initWithAction(CCActionInterval *pAction) { - assert(pAction != NULL); + CCAssert(pAction != NULL, ""); if (CCActionInterval::initWithDuration(pAction->getDuration())) { @@ -740,7 +740,7 @@ namespace cocos2d { CCActionInterval* CCEaseElastic::reverse(void) { - assert(0); + CCAssert(0, ""); return NULL; } diff --git a/cocos2dx/actions/CCActionGrid.cpp b/cocos2dx/actions/CCActionGrid.cpp index 3937fe7eca..7bc74e414d 100644 --- a/cocos2dx/actions/CCActionGrid.cpp +++ b/cocos2dx/actions/CCActionGrid.cpp @@ -78,7 +78,7 @@ namespace cocos2d } else { - assert(0); + CCAssert(0, ""); } } else @@ -96,7 +96,7 @@ namespace cocos2d CCGridBase* CCGridAction::getGrid(void) { // Abstract class needs implementation - assert(0); + CCAssert(0, ""); return NULL; } diff --git a/cocos2dx/actions/CCActionGrid3D.cpp b/cocos2dx/actions/CCActionGrid3D.cpp index 2185e4784f..60c74f3e3c 100644 --- a/cocos2dx/actions/CCActionGrid3D.cpp +++ b/cocos2dx/actions/CCActionGrid3D.cpp @@ -24,6 +24,7 @@ THE SOFTWARE. ****************************************************************************/ #include "CCActionGrid3D.h" #include "CCPointExtension.h" +#include "CCDirector.h" #include @@ -134,7 +135,7 @@ namespace cocos2d if (gridSize.x != 1 || gridSize.y != 1) { // Grid size must be (1,1) - assert(0); + CCAssert(0, ""); return false; } diff --git a/cocos2dx/actions/CCActionInterval.cpp b/cocos2dx/actions/CCActionInterval.cpp index ac510612b4..5e754c1cd3 100644 --- a/cocos2dx/actions/CCActionInterval.cpp +++ b/cocos2dx/actions/CCActionInterval.cpp @@ -76,7 +76,7 @@ CCObject* CCActionInterval::copyWithZone(CCZone *pZone) else { // action's base class , must be called using __super::copyWithZone(), after overriding from derived class - assert(0); + CCAssert(0, ""); pCopy = new CCActionInterval(); pZone = pNewZone = new CCZone(pCopy); @@ -117,13 +117,13 @@ void CCActionInterval::setAmplitudeRate(CGFloat amp) { CC_UNUSED_PARAM(amp); // Abstract class needs implementation - assert(0); + CCAssert(0, ""); } CGFloat CCActionInterval::getAmplitudeRate(void) { // Abstract class needs implementation - assert(0); + CCAssert(0, ""); return 0; } @@ -198,8 +198,8 @@ CCFiniteTimeAction* CCSequence::actionsWithArray(CCArray *actions) bool CCSequence::initOneTwo(CCFiniteTimeAction *pActionOne, CCFiniteTimeAction *pActionTwo) { - assert(pActionOne != NULL); - assert(pActionTwo != NULL); + CCAssert(pActionOne != NULL, ""); + CCAssert(pActionTwo != NULL, ""); ccTime d = pActionOne->getDuration() + pActionTwo->getDuration(); CCActionInterval::initWithDuration(d); @@ -459,7 +459,7 @@ CCRepeatForever *CCRepeatForever::actionWithAction(CCActionInterval *pAction) bool CCRepeatForever::initWithAction(CCActionInterval *pAction) { - assert(pAction != NULL); + CCAssert(pAction != NULL, ""); pAction->retain(); m_pInnerAction = pAction; return true; @@ -563,8 +563,8 @@ CCSpawn* CCSpawn::actionOneTwo(CCFiniteTimeAction *pAction1, CCFiniteTimeAction bool CCSpawn:: initOneTwo(CCFiniteTimeAction *pAction1, CCFiniteTimeAction *pAction2) { - assert(pAction1 != NULL); - assert(pAction2 != NULL); + CCAssert(pAction1 != NULL, ""); + CCAssert(pAction2 != NULL, ""); bool bRet = false; @@ -1941,8 +1941,8 @@ CCReverseTime* CCReverseTime::actionWithAction(CCFiniteTimeAction *pAction) bool CCReverseTime::initWithAction(CCFiniteTimeAction *pAction) { - assert(pAction != NULL); - assert(pAction != m_pOther); + CCAssert(pAction != NULL, ""); + CCAssert(pAction != m_pOther, ""); if (CCActionInterval::initWithDuration(pAction->getDuration())) { @@ -2030,7 +2030,7 @@ CCAnimate* CCAnimate::actionWithAnimation(CCAnimation *pAnimation) bool CCAnimate::initWithAnimation(CCAnimation *pAnimation) { - assert(pAnimation != NULL); + CCAssert(pAnimation != NULL, ""); return initWithAnimation(pAnimation, true); } @@ -2046,7 +2046,7 @@ CCAnimate* CCAnimate::actionWithAnimation(CCAnimation *pAnimation, bool bRestore bool CCAnimate::initWithAnimation(CCAnimation *pAnimation, bool bRestoreOriginalFrame) { - assert(pAnimation); + CCAssert(pAnimation, ""); if (CCActionInterval::initWithDuration(pAnimation->getFrames()->count() * pAnimation->getDelay())) { @@ -2072,7 +2072,7 @@ CCAnimate* CCAnimate::actionWithDuration(ccTime duration, CCAnimation *pAnimatio bool CCAnimate::initWithDuration(ccTime duration, CCAnimation *pAnimation, bool bRestoreOriginalFrame) { - assert(pAnimation != NULL); + CCAssert(pAnimation != NULL, ""); if (CCActionInterval::initWithDuration(duration)) { diff --git a/cocos2dx/actions/CCActionManager.cpp b/cocos2dx/actions/CCActionManager.cpp index fa990dc0b1..7733a74ebc 100644 --- a/cocos2dx/actions/CCActionManager.cpp +++ b/cocos2dx/actions/CCActionManager.cpp @@ -89,7 +89,7 @@ CCActionManager::CCActionManager(void) m_pCurrentTarget(NULL), m_bCurrentTargetSalvaged(false) { - assert(gSharedManager == NULL); + CCAssert(gSharedManager == NULL, ""); } CCActionManager::~CCActionManager(void) @@ -191,8 +191,8 @@ void CCActionManager::resumeTarget(CCObject *pTarget) void CCActionManager::addAction(CCAction *pAction, CCNode *pTarget, bool paused) { - assert(pAction != NULL); - assert(pTarget != NULL); + CCAssert(pAction != NULL, ""); + CCAssert(pTarget != NULL, ""); tHashElement *pElement = NULL; // we should convert it to CCObject*, because we save it as CCObject* @@ -209,7 +209,7 @@ void CCActionManager::addAction(CCAction *pAction, CCNode *pTarget, bool paused) actionAllocWithHashElement(pElement); - assert(! ccArrayContainsObject(pElement->actions, pAction)); + CCAssert(! ccArrayContainsObject(pElement->actions, pAction), ""); ccArrayAppendObject(pElement->actions, pAction); pAction->startWithTarget(pTarget); @@ -288,8 +288,8 @@ void CCActionManager::removeAction(CCAction *pAction) void CCActionManager::removeActionByTag(unsigned int tag, CCObject *pTarget) { - assert((int)tag != kCCActionTagInvalid); - assert(pTarget != NULL); + CCAssert((int)tag != kCCActionTagInvalid, ""); + CCAssert(pTarget != NULL, ""); tHashElement *pElement = NULL; HASH_FIND_INT(m_pTargets, &pTarget, pElement); @@ -314,7 +314,7 @@ void CCActionManager::removeActionByTag(unsigned int tag, CCObject *pTarget) CCAction* CCActionManager::getActionByTag(unsigned int tag, CCObject *pTarget) { - assert((int)tag != kCCActionTagInvalid); + CCAssert((int)tag != kCCActionTagInvalid, ""); tHashElement *pElement = NULL; HASH_FIND_INT(m_pTargets, &pTarget, pElement); diff --git a/cocos2dx/base_nodes/CCAtlasNode.cpp b/cocos2dx/base_nodes/CCAtlasNode.cpp index e90847f759..b2cfd502a2 100644 --- a/cocos2dx/base_nodes/CCAtlasNode.cpp +++ b/cocos2dx/base_nodes/CCAtlasNode.cpp @@ -26,6 +26,7 @@ THE SOFTWARE. #include "CCAtlasNode.h" #include "CCTextureAtlas.h" +#include "CCDirector.h" namespace cocos2d { @@ -66,7 +67,7 @@ CCAtlasNode * CCAtlasNode::atlasWithTileFile(const char *tile, unsigned int tile bool CCAtlasNode::initWithTileFile(const char *tile, unsigned int tileWidth, unsigned int tileHeight, unsigned int itemsToRender) { - assert(tile != NULL); + CCAssert(tile != NULL, "title should not be null"); m_uItemWidth = (int) (tileWidth * CC_CONTENT_SCALE_FACTOR()); m_uItemHeight = (int) (tileHeight * CC_CONTENT_SCALE_FACTOR()); diff --git a/cocos2dx/base_nodes/CCNode.cpp b/cocos2dx/base_nodes/CCNode.cpp index b5419e512d..8598e2cbed 100644 --- a/cocos2dx/base_nodes/CCNode.cpp +++ b/cocos2dx/base_nodes/CCNode.cpp @@ -718,7 +718,7 @@ void CCNode::reorderChild(CCNode *child, int zOrder) void CCNode::draw() { - //assert(0); + //CCAssert(0); // override me // Only use- this function to draw your staff. // DON'T draw your stuff outside this method diff --git a/cocos2dx/cocoa/CCAutoreleasePool.cpp b/cocos2dx/cocoa/CCAutoreleasePool.cpp index 5974c3fab1..1b09d47d61 100644 --- a/cocos2dx/cocoa/CCAutoreleasePool.cpp +++ b/cocos2dx/cocoa/CCAutoreleasePool.cpp @@ -22,6 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ #include "CCAutoreleasePool.h" +#include "ccMacros.h" namespace cocos2d { @@ -42,7 +43,7 @@ void CCAutoreleasePool::addObject(CCObject* pObject) { m_pManagedObjectArray->addObject(pObject); - assert(pObject->m_uReference > 1); + CCAssert(pObject->m_uReference > 1, "reference count should greager than 1"); pObject->release(); // no ref count, in this case autorelease pool added. } @@ -162,7 +163,7 @@ void CCPoolManager::pop() void CCPoolManager::removeObject(CCObject* pObject) { - assert(m_pCurReleasePool); + CCAssert(m_pCurReleasePool, "current auto release pool should not be null"); m_pCurReleasePool->removeObject(pObject); } @@ -176,9 +177,11 @@ void CCPoolManager::addObject(CCObject* pObject) CCAutoreleasePool* CCPoolManager::getCurReleasePool() { if(!m_pCurReleasePool) + { push(); + } - assert(m_pCurReleasePool); + CCAssert(m_pCurReleasePool, "current auto release pool should not be null"); return m_pCurReleasePool; } diff --git a/cocos2dx/cocoa/CCObject.cpp b/cocos2dx/cocoa/CCObject.cpp index 2c62f01cf7..2664431ff9 100644 --- a/cocos2dx/cocoa/CCObject.cpp +++ b/cocos2dx/cocoa/CCObject.cpp @@ -25,14 +25,14 @@ THE SOFTWARE. #include "CCObject.h" #include "CCAutoreleasePool.h" -#include +#include "ccMacros.h" namespace cocos2d { CCObject* CCCopying::copyWithZone(CCZone *pZone) { CC_UNUSED_PARAM(pZone); - assert(0); - return 0; + CCAssert(0, "not implement"); + return 0; } @@ -64,7 +64,7 @@ CCObject* CCObject::copy() void CCObject::release(void) { - assert(m_uReference > 0); + CCAssert(m_uReference > 0, "reference count should greater than 0"); --m_uReference; if (m_uReference == 0) @@ -75,7 +75,7 @@ void CCObject::release(void) void CCObject::retain(void) { - assert(m_uReference > 0); + CCAssert(m_uReference > 0, "reference count should greater than 0"); ++m_uReference; } diff --git a/cocos2dx/effects/CCGrid.cpp b/cocos2dx/effects/CCGrid.cpp index 99b09d8e1a..853268e1d1 100644 --- a/cocos2dx/effects/CCGrid.cpp +++ b/cocos2dx/effects/CCGrid.cpp @@ -274,17 +274,17 @@ namespace cocos2d void CCGridBase::blit(void) { - assert(0); + CCAssert(0, ""); } void CCGridBase::reuse(void) { - assert(0); + CCAssert(0, ""); } void CCGridBase::calculateVertexPoints(void) { - assert(0); + CCAssert(0, ""); } // implementation of CCGrid3D diff --git a/cocos2dx/include/CCLayer.h b/cocos2dx/include/CCLayer.h index 994e5209aa..1be89afbc4 100755 --- a/cocos2dx/include/CCLayer.h +++ b/cocos2dx/include/CCLayer.h @@ -32,6 +32,7 @@ THE SOFTWARE. #include "CCTouchDelegateProtocol.h" #include "CCAccelerometerDelegate.h" #include "CCKeypadDelegate.h" +#include "CCMutableArray.h" namespace cocos2d { diff --git a/cocos2dx/include/CCMenuItem.h b/cocos2dx/include/CCMenuItem.h index 45bdaa76cd..5842afabd5 100755 --- a/cocos2dx/include/CCMenuItem.h +++ b/cocos2dx/include/CCMenuItem.h @@ -30,6 +30,7 @@ THE SOFTWARE. #include "CCNode.h" #include "CCProtocols.h" #include "selector_protocol.h" +#include "CCMutableArray.h" namespace cocos2d{ diff --git a/cocos2dx/include/CCMutableArray.h b/cocos2dx/include/CCMutableArray.h index d983645dee..abd84cd2a0 100755 --- a/cocos2dx/include/CCMutableArray.h +++ b/cocos2dx/include/CCMutableArray.h @@ -26,8 +26,8 @@ THE SOFTWARE. #define __COCOA_CC_MUTABLE_ARRAY_H__ #include "CCObject.h" +#include "ccMacros.h" #include -#include #include namespace cocos2d { @@ -113,7 +113,7 @@ public: T getObjectAtIndex(unsigned int uIndex) { - assert(uIndex < count()); + CCAssert(uIndex < count(), ""); if (uIndex >= count()) { @@ -155,7 +155,7 @@ public: void insertObjectAtIndex(T pObject, unsigned int uIndex) { - assert(uIndex <= count()); + CCAssert(uIndex <= count(), ""); // make sure the object is not null if (pObject == 0) { diff --git a/cocos2dx/include/CCRibbon.h b/cocos2dx/include/CCRibbon.h index 688266a3d8..d99fe22c01 100755 --- a/cocos2dx/include/CCRibbon.h +++ b/cocos2dx/include/CCRibbon.h @@ -28,6 +28,7 @@ THE SOFTWARE. /*#include */ #include "CCNode.h" #include "CCProtocols.h" +#include "CCMutableArray.h" namespace cocos2d { diff --git a/cocos2dx/include/ccMacros.h b/cocos2dx/include/ccMacros.h index 46cb27ab4b..5fd45528e2 100644 --- a/cocos2dx/include/ccMacros.h +++ b/cocos2dx/include/ccMacros.h @@ -135,7 +135,6 @@ default gl blend src function. Compatible with premultiplied alpha images. On Mac it returns 1; On iPhone it returns 2 if RetinaDisplay is On. Otherwise it returns 1 */ -#include "CCDirector.h" #define CC_CONTENT_SCALE_FACTOR() CCDirector::sharedDirector()->getContentScaleFactor() diff --git a/cocos2dx/label_nodes/CCLabelAtlas.cpp b/cocos2dx/label_nodes/CCLabelAtlas.cpp index f5f57fdf4c..e710322294 100644 --- a/cocos2dx/label_nodes/CCLabelAtlas.cpp +++ b/cocos2dx/label_nodes/CCLabelAtlas.cpp @@ -46,7 +46,7 @@ namespace cocos2d{ bool CCLabelAtlas::initWithString(const char *label, const char *charMapFile, unsigned int itemWidth, unsigned int itemHeight, unsigned char startCharMap) { - assert(label != NULL); + CCAssert(label != NULL, ""); if (CCAtlasNode::initWithTileFile(charMapFile, itemWidth, itemHeight, strlen(label))) { m_cMapStartChar = startCharMap; diff --git a/cocos2dx/label_nodes/CCLabelBMFont.cpp b/cocos2dx/label_nodes/CCLabelBMFont.cpp index 16acc24455..5775b27931 100644 --- a/cocos2dx/label_nodes/CCLabelBMFont.cpp +++ b/cocos2dx/label_nodes/CCLabelBMFont.cpp @@ -102,7 +102,7 @@ namespace cocos2d{ } bool CCBMFontConfiguration::initWithFNTfile(const char *FNTfile) { - assert(FNTfile != NULL && strlen(FNTfile)!=0); + CCAssert(FNTfile != NULL && strlen(FNTfile)!=0, ""); m_pKerningDictionary = NULL; this->parseConfigFile(FNTfile); return true; @@ -395,7 +395,7 @@ namespace cocos2d{ bool CCLabelBMFont::initWithString(const char *theString, const char *fntFile) { - assert(theString != NULL); + CCAssert(theString != NULL, ""); CC_SAFE_RELEASE(m_pConfiguration);// allow re-init m_pConfiguration = FNTConfigLoadFile(fntFile); m_pConfiguration->retain(); diff --git a/cocos2dx/label_nodes/CCLabelTTF.cpp b/cocos2dx/label_nodes/CCLabelTTF.cpp index f491f8b931..295d74b373 100644 --- a/cocos2dx/label_nodes/CCLabelTTF.cpp +++ b/cocos2dx/label_nodes/CCLabelTTF.cpp @@ -23,6 +23,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ #include "CCLabelTTF.h" +#include "CCDirector.h" namespace cocos2d{ // @@ -67,7 +68,7 @@ namespace cocos2d{ bool CCLabelTTF::initWithString(const char *label, const CCSize& dimensions, CCTextAlignment alignment, const char *fontName, float fontSize) { - assert(label != NULL); + CCAssert(label != NULL, ""); if (CCSprite::init()) { m_tDimensions = CCSizeMake( dimensions.width * CC_CONTENT_SCALE_FACTOR(), dimensions.height * CC_CONTENT_SCALE_FACTOR() ); @@ -88,7 +89,7 @@ namespace cocos2d{ } bool CCLabelTTF::initWithString(const char *label, const char *fontName, float fontSize) { - assert(label != NULL); + CCAssert(label != NULL, ""); if (CCSprite::init()) { m_tDimensions = CCSizeZero; diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp index 537cad5059..3f0398d369 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp +++ b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp @@ -665,7 +665,7 @@ CCLayerMultiplex * CCLayerMultiplex::layerWithLayer(CCLayer* layer) } void CCLayerMultiplex::addLayer(CCLayer* layer) { - assert(m_pLayers); + CCAssert(m_pLayers, ""); m_pLayers->addObject(layer); } diff --git a/cocos2dx/menu_nodes/CCMenu.cpp b/cocos2dx/menu_nodes/CCMenu.cpp index d61f0ce1f7..f0cec9d23b 100644 --- a/cocos2dx/menu_nodes/CCMenu.cpp +++ b/cocos2dx/menu_nodes/CCMenu.cpp @@ -357,11 +357,11 @@ namespace cocos2d{ CCNode* pChild = (CCNode*) pObject; if (pChild) { - assert(row < rows.size()); + CCAssert(row < rows.size(), ""); rowColumns = rows[row]; // can not have zero columns on a row - assert(rowColumns); + CCAssert(rowColumns, ""); float tmp = pChild->getContentSize().height; rowHeight = (unsigned int)((rowHeight >= tmp || isnan(tmp)) ? rowHeight : tmp); @@ -380,7 +380,7 @@ namespace cocos2d{ } // check if too many rows/columns for available menu items - assert(! columnsOccupied); + CCAssert(! columnsOccupied, ""); CCSize winSize = CCDirector::sharedDirector()->getWinSize(); @@ -467,11 +467,11 @@ namespace cocos2d{ if (pChild) { // check if too many menu items for the amount of rows/columns - assert(column < columns.size()); + CCAssert(column < columns.size(), ""); columnRows = columns[column]; // can't have zero rows on a column - assert(columnRows); + CCAssert(columnRows, ""); // columnWidth = fmaxf(columnWidth, [item contentSize].width); float tmp = pChild->getContentSize().width; @@ -496,7 +496,7 @@ namespace cocos2d{ } // check if too many rows/columns for available menu items. - assert(! rowsOccupied); + CCAssert(! rowsOccupied, ""); CCSize winSize = CCDirector::sharedDirector()->getWinSize(); diff --git a/cocos2dx/menu_nodes/CCMenuItem.cpp b/cocos2dx/menu_nodes/CCMenuItem.cpp index 640e8e2f5b..77c032688a 100644 --- a/cocos2dx/menu_nodes/CCMenuItem.cpp +++ b/cocos2dx/menu_nodes/CCMenuItem.cpp @@ -498,7 +498,7 @@ namespace cocos2d{ } bool CCMenuItemSprite::initFromNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCNode* disabledSprite, SelectorProtocol* target, SEL_MenuHandler selector) { - assert(normalSprite != NULL); + CCAssert(normalSprite != NULL, ""); CCMenuItem::initWithTarget(target, selector); setNormalImage(normalSprite); setSelectedImage(selectedSprite); diff --git a/cocos2dx/misc_nodes/CCProgressTimer.cpp b/cocos2dx/misc_nodes/CCProgressTimer.cpp index 6ed0fc79dc..dae66441af 100644 --- a/cocos2dx/misc_nodes/CCProgressTimer.cpp +++ b/cocos2dx/misc_nodes/CCProgressTimer.cpp @@ -343,7 +343,7 @@ void CCProgressTimer::updateRadial(void) { m_nVertexDataCount = index + 3; m_pVertexData = new ccV2F_C4B_T2F[m_nVertexDataCount]; - assert(m_pVertexData); + CCAssert(m_pVertexData, ""); updateColor(); } @@ -432,7 +432,7 @@ void CCProgressTimer::updateBar(void) { m_nVertexDataCount = kProgressTextureCoordsCount; m_pVertexData = new ccV2F_C4B_T2F[m_nVertexDataCount]; - assert(m_pVertexData); + CCAssert(m_pVertexData, ""); if (m_eType == kCCProgressTimerTypeHorizontalBarLR) { diff --git a/cocos2dx/misc_nodes/CCRibbon.cpp b/cocos2dx/misc_nodes/CCRibbon.cpp index e052330882..4a48adeb0e 100644 --- a/cocos2dx/misc_nodes/CCRibbon.cpp +++ b/cocos2dx/misc_nodes/CCRibbon.cpp @@ -26,6 +26,7 @@ THE SOFTWARE. #include "CCRibbon.h" #include "CCTextureCache.h" #include "CCPointExtension.h" +#include "CCDirector.h" namespace cocos2d { diff --git a/cocos2dx/particle_nodes/CCParticleSystem.cpp b/cocos2dx/particle_nodes/CCParticleSystem.cpp index bccbc0bf7b..038499c3c3 100644 --- a/cocos2dx/particle_nodes/CCParticleSystem.cpp +++ b/cocos2dx/particle_nodes/CCParticleSystem.cpp @@ -50,6 +50,7 @@ THE SOFTWARE. #include "CCImage.h" #include "platform/platform.h" #include "support/zip_support/ZipUtils.h" +#include "CCDirector.h" // opengl #include "platform/CCGL.h" @@ -291,7 +292,7 @@ bool CCParticleSystem::initWithDictionary(CCDictionary * else { char *textureData = (char*)valueForKey("textureImageData", dictionary); - assert(textureData); + CCAssert(textureData, ""); int dataLen = strlen(textureData); if(dataLen != 0) diff --git a/cocos2dx/particle_nodes/CCParticleSystemQuad.cpp b/cocos2dx/particle_nodes/CCParticleSystemQuad.cpp index b56faa575a..66d0a5caaa 100644 --- a/cocos2dx/particle_nodes/CCParticleSystemQuad.cpp +++ b/cocos2dx/particle_nodes/CCParticleSystemQuad.cpp @@ -29,6 +29,7 @@ THE SOFTWARE. #include "CCParticleSystemQuad.h" #include "CCSpriteFrame.h" +#include "CCDirector.h" namespace cocos2d { diff --git a/cocos2dx/platform/CCFileUtils.cpp b/cocos2dx/platform/CCFileUtils.cpp index 8307bad1de..4e168a5506 100644 --- a/cocos2dx/platform/CCFileUtils.cpp +++ b/cocos2dx/platform/CCFileUtils.cpp @@ -23,6 +23,7 @@ THE SOFTWARE. ****************************************************************************/ #include "CCFileUtils.h" +#include "CCDirector.h" #if (CC_TARGET_PLATFORM != CC_PLATFORM_IOS) && (CC_TARGET_PLATFORM != CC_PLATFORM_AIRPLAY) diff --git a/cocos2dx/platform/ios/EAGLView.mm b/cocos2dx/platform/ios/EAGLView.mm index 3235c214a1..b9a9476732 100755 --- a/cocos2dx/platform/ios/EAGLView.mm +++ b/cocos2dx/platform/ios/EAGLView.mm @@ -146,12 +146,12 @@ static cocos2d::CCTouch *s_pTouches[MAX_TOUCHES]; [self release]; return nil; } + touchesIntergerDict = CFDictionaryCreateMutable(kCFAllocatorDefault, 4, NULL, NULL); + indexBitsUsed = 0x00000000; + + view = self; } - touchesIntergerDict = CFDictionaryCreateMutable(kCFAllocatorDefault, 4, NULL, NULL); - indexBitsUsed = 0x00000000; - - view = self; return self; } @@ -398,30 +398,33 @@ static cocos2d::CCTouch *s_pTouches[MAX_TOUCHES]; cocos2d::CCTouch *pTouch; for (UITouch *touch in touches) { - NSNumber *index = (NSNumber*)CFDictionaryGetValue(touchesIntergerDict, touch); - int unUsedIndex = 0; + NSNumber *index = (NSNumber*)CFDictionaryGetValue(touchesIntergerDict, touch); + int unUsedIndex = 0; - // it is a new touch - if (! index) { - unUsedIndex = [self getUnUsedIndex]; - - // The touches is more than MAX_TOUCHES ? - if (unUsedIndex == -1) { - return; - } - - pTouch = s_pTouches[unUsedIndex] = new cocos2d::CCTouch(); - } - - float x = [touch locationInView: [touch view]].x; - float y = [touch locationInView: [touch view]].y; - pTouch->SetTouchInfo(0, x, y); + // it is a new touch + if (! index) { + unUsedIndex = [self getUnUsedIndex]; + + // The touches is more than MAX_TOUCHES ? + if (unUsedIndex == -1) { + return; + } + + pTouch = s_pTouches[unUsedIndex] = new cocos2d::CCTouch(); + float x = [touch locationInView: [touch view]].x; + float y = [touch locationInView: [touch view]].y; + pTouch->SetTouchInfo(0, x, y); + + CFDictionaryAddValue(touchesIntergerDict, touch, [NSNumber numberWithInt:unUsedIndex]); + + set.addObject(pTouch); + } - CFDictionaryAddValue(touchesIntergerDict, touch, [NSNumber numberWithInt:unUsedIndex]); - - set.addObject(pTouch); } + if (set.count() == 0) + return; + cocos2d::CCDirector::sharedDirector()->getOpenGLView()->touchesBegan(&set); } diff --git a/cocos2dx/platform/win32/CCFileUtils_win32.cpp b/cocos2dx/platform/win32/CCFileUtils_win32.cpp index 98dc525594..dc11d0e0ff 100644 --- a/cocos2dx/platform/win32/CCFileUtils_win32.cpp +++ b/cocos2dx/platform/win32/CCFileUtils_win32.cpp @@ -23,6 +23,7 @@ THE SOFTWARE. ****************************************************************************/ #include "windows.h" +#include "CCDirector.h" using namespace std; diff --git a/cocos2dx/proj.bada/sdk2.0/.cproject b/cocos2dx/proj.bada/sdk2.0/.cproject index 7476c252c5..4d74fdbbd9 100644 --- a/cocos2dx/proj.bada/sdk2.0/.cproject +++ b/cocos2dx/proj.bada/sdk2.0/.cproject @@ -59,10 +59,10 @@ + -