当前位置: 首页>>代码示例>>C++>>正文


C++ CCAssert函数代码示例

本文整理汇总了C++中CCAssert函数的典型用法代码示例。如果您正苦于以下问题:C++ CCAssert函数的具体用法?C++ CCAssert怎么用?C++ CCAssert使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了CCAssert函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CCAssert

void CCSkeletonAnimation::setMix (const char* fromAnimation, const char* toAnimation, float duration, int stateIndex) {
	CCAssert(stateIndex >= 0 && stateIndex < (int)states.size(), "stateIndex out of range.");
	AnimationStateData_setMixByName(states[stateIndex]->data, fromAnimation, toAnimation, duration);
}
开发者ID:wjf1616,项目名称:TheMiners,代码行数:4,代码来源:CCSkeletonAnimation.cpp

示例2: CCAssert

float CCParticleSystem::getEndRadiusVar()
{
	CCAssert( m_nEmitterMode == kCCParticleModeRadius, "Particle Mode should be Radius");
	return modeB.endRadiusVar;
}
开发者ID:ccjimmy,项目名称:TweeJump4wp8,代码行数:5,代码来源:CCParticleSystem.cpp

示例3: CCAssert

CCProgressTimer* CCTransitionProgress::progressTimerNodeWithRenderTexture(CCRenderTexture* texture)
{
    CCAssert(false, "override me - abstract class");
    return NULL;
}
开发者ID:anarki1234,项目名称:9miao,代码行数:5,代码来源:CCTransitionProgress.cpp

示例4: CCAssert

void CCObject::retain(void)
{
    CCAssert(m_uReference > 0, "reference count should greater than 0");

    ++m_uReference;
}
开发者ID:pes6pro,项目名称:visva,代码行数:6,代码来源:CCObject.cpp

示例5: CCAssert

void Widget::addChild(CCNode* child, int zOrder, int tag)
{
    CCAssert(dynamic_cast<Widget*>(child) != NULL, "Widget only supports Widgets as children");
    CCNode::addChild(child, zOrder, tag);
    _widgetChildren->addObject(child);
}
开发者ID:fordream,项目名称:quick,代码行数:6,代码来源:UIWidget.cpp

示例6: if

void RSimpleHTMLParser::startElement(void *ctx, const char *name, const char **atts)
{
	//CCLog("[Parser Start]%s", name);

	IRichElement* element = NULL;

	if ( 0 == strcmp(name, "br") )
	{
		element = new REleHTMLBR;
	}
	else if ( 0 == strcmp(name, "u") )
	{
		element = new REleHTMLU;
	}
	else if ( 0 == strcmp(name, "font") )
	{
		element = new REleHTMLFont;
	}
	else if ( 0 == strcmp(name, "table") )
	{
		element = new REleHTMLTable;
	}
	else if ( 0 == strcmp(name, "tr") )
	{
		if ( dynamic_cast<REleHTMLTable*>(m_rCurrentElement) )
		{
			element = new REleHTMLRow(dynamic_cast<REleHTMLTable*>(m_rCurrentElement));
		}
	}
	else if ( 0 == strcmp(name, "td") )
	{
		if ( dynamic_cast<REleHTMLRow*>(m_rCurrentElement) )
		{
			element = new REleHTMLCell(dynamic_cast<REleHTMLRow*>(m_rCurrentElement));
		}
	}
	else if ( 0 == strcmp(name, "a") )
	{
		element = new REleHTMLAnchor;
	}
	else if ( 0 == strcmp(name, "button") )
	{
		element = new REleHTMLButton;
	}
	else if ( 0 == strcmp(name, "img") )
	{
		element = new REleHTMLImg;
	}
	else if ( 0 == strcmp(name, "ccb") )
	{
		element = new REleCCBNode;
	}
	else if ( 0 == strcmp(name, "hr") )
	{
		element = new REleHTMLHR;
	}
	else if ( 0 == strcmp(name, "p") )
	{
		element = new REleHTMLP;
	}
	else if ( 0 == strcmp(name, "node")
		|| 0 == strcmp(name, "root")
		|| 0 == strcmp(name, "body") )
	{
		element = new REleHTMLRoot;
	}

	if ( !element )
	{
		// tag not supported yet!
		element = new REleHTMLNotSupport;
	}
	
	CCAssert(element, "");

	element->parse(this, atts);

	if ( !m_rCurrentElement )
	{
		m_rElements->push_back(element);
	}
	else
	{
		m_rCurrentElement->addChildren(element);
	}

	m_rCurrentElement = element;
}
开发者ID:BackMountainBird,项目名称:cocos2dx-ext,代码行数:88,代码来源:CCRichParser.cpp

示例7: CCAssert

//////////////////////////////////////////////////////////////////////////
// FightScript
//////////////////////////////////////////////////////////////////////////
bool FightScript::isEqual(const FightScript& test)
{
#define BREAK 1
	FightScript testCopy = test;
	// InitChessBoard
	for (int i=0;i<FormationHeroAcountMax;i++)
	{
		if (test.init.myCurBloodNum != init.myCurBloodNum ||
			test.init.myDefaultBloodNum != init.myDefaultBloodNum || 
			test.init.oppositeCurBloodNum != init.oppositeCurBloodNum || 
			test.init.oppositeDefaultBloodNum != init.oppositeDefaultBloodNum 
			)
		{
#if BREAK == 1
			CCAssert(false,"");
#endif
			return false;
		}

		if (test.init.myTeam[i].heroId != init.myTeam[i].heroId ||
			test.init.myTeam[i].hp != init.myTeam[i].hp ||
			test.init.myTeam[i].defaultHp != init.myTeam[i].defaultHp ||
			test.init.myTeam[i].defaultCdTime != init.myTeam[i].defaultCdTime ||
			test.init.myTeam[i].level != init.myTeam[i].level ||
			test.init.myTeam[i].stage != init.myTeam[i].stage ||
			test.init.myTeam[i].profession_id != init.myTeam[i].profession_id ||
			test.init.myTeam[i].summary_equips.size() != init.myTeam[i].summary_equips.size() ||
			test.init.myTeam[i].x_size != init.myTeam[i].x_size ||
			test.init.myTeam[i].hero_type != init.myTeam[i].hero_type ||
			test.init.myTeamUniqueId[i] != init.myTeamUniqueId[i]
		)
		{
#if BREAK == 1
			CCAssert(false,"");
#endif
			return false;
		}
		// ×°±¸
		{
			int equipNum = test.init.myTeam[i].summary_equips.size();
			for (int e = 0;e<equipNum;e++)
			{
				if (test.init.myTeam[i].summary_equips[e].zhuangbei_colour != init.myTeam[i].summary_equips[e].zhuangbei_colour ||
					test.init.myTeam[i].summary_equips[e].zhuangbei_type != init.myTeam[i].summary_equips[e].zhuangbei_type ||
					strcmp(test.init.myTeam[i].summary_equips[e].zhuangbei_pic,init.myTeam[i].summary_equips[e].zhuangbei_pic) != 0)
				{
#if BREAK == 1
					CCAssert(false,"");
#endif
					return false;
				}
			}
		}


		if (test.init.oppositeTeam[i].heroId != init.oppositeTeam[i].heroId ||
			test.init.oppositeTeam[i].hp != init.oppositeTeam[i].hp ||
			test.init.oppositeTeam[i].defaultHp != init.oppositeTeam[i].defaultHp ||
			test.init.oppositeTeam[i].defaultCdTime != init.oppositeTeam[i].defaultCdTime ||
			test.init.oppositeTeam[i].level != init.oppositeTeam[i].level ||
			test.init.oppositeTeam[i].stage != init.oppositeTeam[i].stage ||
			test.init.oppositeTeam[i].profession_id != init.oppositeTeam[i].profession_id||
			test.init.oppositeTeam[i].summary_equips.size() != init.oppositeTeam[i].summary_equips.size() ||
			test.init.oppositeTeam[i].x_size != init.oppositeTeam[i].x_size||
			test.init.oppositeTeam[i].hero_type != init.oppositeTeam[i].hero_type||
			test.init.oppositeUniqueId[i] != init.oppositeUniqueId[i]
		)
		{
#if BREAK == 1
			CCAssert(false,"");
#endif
			return false;
		}
		// ×°±¸
		{
			int equipNum = test.init.oppositeTeam[i].summary_equips.size();
			for (int e = 0;e<equipNum;e++)
			{
				if (test.init.oppositeTeam[i].summary_equips[e].zhuangbei_colour != init.oppositeTeam[i].summary_equips[e].zhuangbei_colour ||
					test.init.oppositeTeam[i].summary_equips[e].zhuangbei_type != init.oppositeTeam[i].summary_equips[e].zhuangbei_type ||
					strcmp(test.init.oppositeTeam[i].summary_equips[e].zhuangbei_pic,init.oppositeTeam[i].summary_equips[e].zhuangbei_pic) != 0)
				{
#if BREAK == 1
					CCAssert(false,"");
#endif
					return false;
				}
			}
		}

	}

	// Step
	int stepNum = stepVec.size();
	if (stepNum != test.stepVec.size())
	{
#if BREAK == 1
//.........这里部分代码省略.........
开发者ID:longguai,项目名称:game-DarkWar,代码行数:101,代码来源:FightScriptDefine.cpp

示例8: startElement

    void startElement(void *ctx, const char *name, const char **atts)
    {
        CC_UNUSED_PARAM(ctx);
        CC_UNUSED_PARAM(atts);
        std::string sName((char*)name);
        if( sName == "dict" )
        {
            m_pCurDict = new CCDictionary();
            if (m_eResultType == SAX_RESULT_DICT && ! m_pRootDict)
            {
				// Because it will call m_pCurDict->release() later, so retain here.
                m_pRootDict = m_pCurDict;
				m_pRootDict->retain();
            }
            m_tState = SAX_DICT;

            CCSAXState preState = SAX_NONE;
            if (! m_tStateStack.empty())
            {
                preState = m_tStateStack.top();
            }

            if (SAX_ARRAY == preState)
            {
                // add the dictionary into the array
                m_pArray->addObject(m_pCurDict);
            }
            else if (SAX_DICT == preState)
            {
                // add the dictionary into the pre dictionary
                CCAssert(! m_tDictStack.empty(), "The state is wrong!");
                CCDictionary* pPreDict = m_tDictStack.top();
                pPreDict->setObject(m_pCurDict, m_sCurKey);
            }

			m_pCurDict->release();

            // record the dict state
            m_tStateStack.push(m_tState);
            m_tDictStack.push(m_pCurDict);
        }
        else if(sName == "key")
        {
            m_tState = SAX_KEY;
        }
        else if(sName == "integer")
        {
            m_tState = SAX_INT;
        }
        else if(sName == "real")
        {
            m_tState = SAX_REAL;
        }
        else if(sName == "string")
        {
            m_tState = SAX_STRING;
        }
        else if (sName == "array")
        {
            m_tState = SAX_ARRAY;
            m_pArray = new CCArray();
            if (m_eResultType == SAX_RESULT_ARRAY && m_pRootArray == NULL)
            {
                m_pRootArray = m_pArray;
                m_pRootArray->retain();
            }
            CCSAXState preState = SAX_NONE;
            if (! m_tStateStack.empty())
            {
                preState = m_tStateStack.top();
            }

            //CCSAXState preState = m_tStateStack.empty() ? SAX_DICT : m_tStateStack.top();
            if (preState == SAX_DICT)
            {
                m_pCurDict->setObject(m_pArray, m_sCurKey);
            }
            else if (preState == SAX_ARRAY)
            {
                CCAssert(! m_tArrayStack.empty(), "The state is worng!");
                CCArray* pPreArray = m_tArrayStack.top();
                pPreArray->addObject(m_pArray);
            }
            m_pArray->release();
            // record the array state
            m_tStateStack.push(m_tState);
            m_tArrayStack.push(m_pArray);
        }
        else
        {
            m_tState = SAX_NONE;
        }
    }
开发者ID:GhostSoar,项目名称:Cocos2dWindows,代码行数:93,代码来源:CCFileUtils.cpp

示例9: CCAssert

void AIActionMove::startWithTarget(CCNode *pTarget){
    AIAction::startWithTarget(pTarget);
    Character *character = dynamic_cast<Character*>(actionOwner);
    CCAssert(character, "Not Character class");
    actionOwnerCharacter = character;
}
开发者ID:killing333,项目名称:Colors,代码行数:6,代码来源:AIAction.cpp

示例10: atoi


//.........这里部分代码省略.........
				modeA.gravity.y = (float)atof(valueForKey("gravityy", dictionary));

				// speed
				modeA.speed = (float)atof(valueForKey("speed", dictionary));
				modeA.speedVar = (float)atof(valueForKey("speedVariance", dictionary));

                const char * pszTmp = NULL;
				// radial acceleration
                pszTmp = valueForKey("radialAcceleration", dictionary);
                modeA.radialAccel = (pszTmp) ? (float)atof(pszTmp) : 0;

                pszTmp = valueForKey("radialAccelVariance", dictionary);
				modeA.radialAccelVar = (pszTmp) ? (float)atof(pszTmp) : 0;

				// tangential acceleration
                pszTmp = valueForKey("tangentialAcceleration", dictionary);
				modeA.tangentialAccel = (pszTmp) ? (float)atof(pszTmp) : 0;

                pszTmp = valueForKey("tangentialAccelVariance", dictionary);
				modeA.tangentialAccelVar = (pszTmp) ? (float)atof(pszTmp) : 0;
			}

			// or Mode B: radius movement
			else if( m_nEmitterMode == kCCParticleModeRadius ) 
			{
				modeB.startRadius = (float)atof(valueForKey("maxRadius", dictionary));
				modeB.startRadiusVar = (float)atof(valueForKey("maxRadiusVariance", dictionary));
				modeB.endRadius = (float)atof(valueForKey("minRadius", dictionary));
				modeB.endRadiusVar = 0;
				modeB.rotatePerSecond = (float)atof(valueForKey("rotatePerSecond", dictionary));
				modeB.rotatePerSecondVar = (float)atof(valueForKey("rotatePerSecondVariance", dictionary));

			} else {
				CCAssert( false, "Invalid emitterType in config file");
				CC_BREAK_IF(true);
			}

			// life span
			m_fLife = (float)atof(valueForKey("particleLifespan", dictionary));
			m_fLifeVar = (float)atof(valueForKey("particleLifespanVariance", dictionary));

			// emission Rate
			m_fEmissionRate = m_uTotalParticles / m_fLife;

			// texture		
			// Try to get the texture from the cache
			char *textureName = (char *)valueForKey("textureFileName", dictionary);
            std::string fullpath = CCFileUtils::fullPathFromRelativeFile(textureName, m_sPlistFile.c_str());

			CCTexture2D *tex = NULL;

            if (strlen(textureName) > 0)
            {
                // set not pop-up message box when load image failed
                bool bNotify = CCFileUtils::getIsPopupNotify();
                CCFileUtils::setIsPopupNotify(false);
                tex = CCTextureCache::sharedTextureCache()->addImage(fullpath.c_str());

                // reset the value of UIImage notify
                CCFileUtils::setIsPopupNotify(bNotify);
            }

			if (tex)
			{
				this->m_pTexture = tex;
			}
开发者ID:ccjimmy,项目名称:TweeJump4wp8,代码行数:67,代码来源:CCParticleSystem.cpp

示例11: CCAssert

void CCActionTween::startWithTarget(CCNode *pTarget)
{
    CCAssert(dynamic_cast<CCActionTweenDelegate*>(pTarget), "target must implement CCActionTweenDelegate");
    CCActionInterval::startWithTarget(pTarget);
    m_fDelta = m_fTo - m_fFrom;
}
开发者ID:csdnnet,项目名称:hiygame,代码行数:6,代码来源:CCActionTween.cpp

示例12: CCAssert

	void CCLabelBMFont::createFontChars()
	{
		int nextFontPositionX = 0;
        int nextFontPositionY = 0;
		unsigned short prev = -1;
		int kerningAmount = 0;

		CCSize tmpSize = CCSizeZero;

        int longestLine = 0;
        unsigned int totalHeight = 0;

        unsigned int quantityOfLines = 1;

		unsigned int stringLen = m_sString.length();

        if (0 == stringLen)
        {
            return;
        }

        for (unsigned int i = 0; i < stringLen - 1; ++i)
        {
            unsigned short c = m_sString[i];
            if (c == '\n')
            {
                quantityOfLines++;
            }
        }

        totalHeight = m_pConfiguration->m_uCommonHeight * quantityOfLines;
        nextFontPositionY = -(m_pConfiguration->m_uCommonHeight - m_pConfiguration->m_uCommonHeight * quantityOfLines);

		for (unsigned int i= 0; i < stringLen; i++)
		{
			unsigned short c = m_sString[i];
			CCAssert( c < kCCBMFontMaxChars, "LabelBMFont: character outside bounds");

            if (c == '\n')
            {
                nextFontPositionX = 0;
                nextFontPositionY -= m_pConfiguration->m_uCommonHeight;
                continue;
            }
            
			kerningAmount = this->kerningAmountForFirst(prev, c);

			const ccBMFontDef& fontDef = m_pConfiguration->m_pBitmapFontArray[c];

			CCRect rect = fontDef.rect;

			CCSprite *fontChar;

			fontChar = (CCSprite*)(this->getChildByTag(i));
			if( ! fontChar )
			{
				fontChar = new CCSprite();
				fontChar->initWithBatchNodeRectInPixels(this, rect);
				this->addChild(fontChar, 0, i);
				fontChar->release();
			}
			else
			{
				// reusing fonts
				fontChar->setTextureRectInPixels(rect, false, rect.size);

				// restore to default in case they were modified
				fontChar->setIsVisible(true);
				fontChar->setOpacity(255);
			}

            float yOffset = (float) (m_pConfiguration->m_uCommonHeight - fontDef.yOffset);
			fontChar->setPositionInPixels( ccp( nextFontPositionX + fontDef.xOffset + fontDef.rect.size.width / 2.0f + kerningAmount,
				                                (float) nextFontPositionY + yOffset - rect.size.height/2.0f ) );		

			//		NSLog(@"position.y: %f", fontChar.position.y);

			// update kerning
			nextFontPositionX += m_pConfiguration->m_pBitmapFontArray[c].xAdvance + kerningAmount;
			prev = c;

			// Apply label properties
			fontChar->setIsOpacityModifyRGB(m_bIsOpacityModifyRGB);
			// Color MUST be set before opacity, since opacity might change color if OpacityModifyRGB is on
			fontChar->setColor(m_tColor);

			// only apply opaccity if it is different than 255 )
			// to prevent modifying the color too (issue #610)
			if( m_cOpacity != 255 )
			{
				fontChar->setOpacity(m_cOpacity);
			}

            if (longestLine < nextFontPositionX)
            {
                longestLine = nextFontPositionX;
            }
		}

        tmpSize.width  = (float) longestLine;
//.........这里部分代码省略.........
开发者ID:BellyWong,项目名称:CuteAPultCocos2D-x,代码行数:101,代码来源:CCLabelBMFont.cpp


注:本文中的CCAssert函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。