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


C++ CC_ASSERT函数代码示例

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


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

示例1: CC_ASSERT

void Viewport::beginZoom(const Vec2& point1, const Vec2& point2)
{
    CC_ASSERT(this->m_TargetNode);
    mZoomFingersDistance = point1.getDistance(point2);
    if (mForceStopScroll || !mMovable) {
        mWSZoomCenter = Vec2(Director::getInstance()->getWinSize().width/2, Director::getInstance()->getWinSize().height/2);
    }
    else {
        mWSZoomCenter = point1.getMidpoint(point2);
    }
    mNSZoomCenter = this->m_TargetNode->convertToNodeSpace(mWSZoomCenter);
    
    mZoomOldScale = this->m_TargetNode->getScale();
    mOperationStartPostition = this->m_TargetNode->getPosition();
    
    if (mBeginZoomHandler) {
        pushValueToLua(mBeginZoomHandler, point1, point2);
    }
}
开发者ID:ourgames,项目名称:nbg,代码行数:19,代码来源:Viewport.cpp

示例2: CP_ARBITER_GET_SHAPES

NS_CC_BEGIN

#if (CC_PHYSICS_ENGINE == CC_PHYSICS_CHIPMUNK)

int PhysicsWorld::collisionBeginCallbackFunc(cpArbiter *arb, struct cpSpace *space, void *data)
{
    PhysicsWorld* world = static_cast<PhysicsWorld*>(data);
    
    CP_ARBITER_GET_SHAPES(arb, a, b);
    
    auto ita = PhysicsShapeInfo::map.find(a);
    auto itb = PhysicsShapeInfo::map.find(b);
    CC_ASSERT(ita != PhysicsShapeInfo::map.end() && itb != PhysicsShapeInfo::map.end());
    
    PhysicsContact* contact = PhysicsContact::create(ita->second->shape, itb->second->shape);
    arb->data = contact;
    
    return world->collisionBeginCallback(*static_cast<PhysicsContact*>(arb->data));
}
开发者ID:nichos1983,项目名称:cocos2d-x,代码行数:19,代码来源:CCPhysicsWorld.cpp

示例3: CC_ASSERT

 void TitleBarLayer::onEnter() {
     CCLayer::onEnter();
     
     Game* game = UserProfile::sharedUserProfile()->findGame(GlobalData::sharedGlobalData()->currentGameId());
     CC_ASSERT(game != NULL);
     const Question& question = game->question();
     const Question::Word& word = question.word(GlobalData::sharedGlobalData()->currentDifficult());
     std::ostringstream oss;
     oss << game->otherPlayerName() << "正在为你绘制" << word.word;
     
     CCLabelTTF* desc = static_cast<CCLabelTTF*>(getChildByTag(kTagDescriptLabel));
     desc->setString(oss.str().c_str());
     
     oss.str("");
     oss << std::setw(2) << std::setfill('0') << (game->turn());
     
     CCLabelTTF* turn = static_cast<CCLabelTTF*>(getChildByTag(kTagTurnLabel));
     turn->setString(oss.str().c_str());
 }
开发者ID:flywingsky,项目名称:drawstory_client,代码行数:19,代码来源:SolvingScene_TitleBarLayer.cpp

示例4: log

void Ref::printLeaks()
{
    // Dump Ref object memory leaks
    if (__refAllocationList.empty())
    {
        log("[memory] All Ref objects successfully cleaned up (no leaks detected).\n");
    }
    else
    {
        log("[memory] WARNING: %d Ref objects still active in memory.\n", (int)__refAllocationList.size());

        for (const auto& ref : __refAllocationList)
        {
            CC_ASSERT(ref);
            const char* type = typeid(*ref).name();
            log("[memory] LEAK: Ref object '%s' still active with reference count %d.\n", (type ? type : ""), ref->getReferenceCount());
        }
    }
}
开发者ID:EricYT,项目名称:cocos2dx_note1,代码行数:19,代码来源:CCRef.cpp

示例5: CC_ASSERT

bool CBackgroundManager::isRoleCanBePlacedOnPos(IGridRole* role, const Point& gridPos, bool lock)
{
    CC_ASSERT(role);
    int width = role->getGridWidth();
    int height = role->getGridHeight();

    Point pt;
    int x, y;
    for (y = 0; y < height; ++y)
    {
        for (x = 0; x < width; ++x)
        {
            pt.x = gridPos.x + x;
            pt.y = gridPos.y + y;
            CLogicGrid* g = getLogicGrid(pt);

            bool condi = (g == nullptr);
            condi = (condi || g->m_locked == true || (g != nullptr && g->m_unit != nullptr && g->m_unit != role));
            if (condi)
            {
                return false;
            }
        }
    }

    if (lock)
    {
        for (y = 0; y < height; ++y)
        {
            for (x = 0; x < width; ++x)
            {
                pt.x = gridPos.x + x;
                pt.y = gridPos.y + y;
                CLogicGrid* g = getLogicGrid(pt);
                
                g->setLock(true);
            }
        }
    }
    
	return true;
}
开发者ID:Gamex,项目名称:GameX,代码行数:42,代码来源:CBackgroundManager.cpp

示例6: CC_ASSERT

void BattleData::PetsPlayCard(int side, int index, bool combine, CallBackWithVoid callback) //positino
{
	CC_ASSERT((side == 0 || side == 1) && (index >=0 && index < 5), "Side, index is wrong");
	if (!m_bPets[side][index] || m_bPets[side][index]->IsDead() || m_bPets[side][index]->moved() || !m_bPets[side][index]->canPlayCard())
	{
		return;
	}
	const ATTRIBUTIONS ccard = m_bPets[side][index]->m_handCard;
	BattlePet * target = GetCurrentTarget(m_bPets[side][index]);
	if (combine)
	{
		std::vector<int> combines = GetCombinePets(side, index);
		const int clength = combines.size();
		int cindex = 0;
		for (int j = 0; j < clength; ++j)
		{
			cindex = combines[j];
			m_bPets[side][cindex]->AttackByCombineSkill(target, clength);
			m_bPets[side][cindex]->m_handCard = ATTRIBUTE_RELATIONS_Empty;
			m_bPets[side][cindex]->moved(1);
		}
	}
	else
	{
		m_bPets[side][index]->AttackBySkill(target);
		m_bPets[side][index]->m_handCard = ATTRIBUTE_RELATIONS_Empty;
		m_bPets[side][index]->moved(1);
	}

	if (ccard != ATTRIBUTE_RELATIONS_ALL)
	{
		m_TableCard = ccard;
		BattleEngine::GetInstance()->dispatchEventWithType(BattleMessage_TableCardUpdate, nullptr);
	}

	PetCarsEvent e(callback);
	e.index = -1;
	e.side = -1;
	BattleEngine::GetInstance()->dispatchEvent(&e);

	SetTarget(m_bPets[side][index]->m_attackSide, -1, true, m_bPets[side][index]);
}
开发者ID:LeoYangLing,项目名称:Client,代码行数:42,代码来源:BattleData.cpp

示例7: switch

	void ScoresController::SetSearchCriteria(ScoresController* self, SearchCriteria::Enum criteria)
	{
		char method_name[256] = "";
		switch (criteria)
		{
		case SearchCriteria::Global:
			strcpy(method_name, "getGlobalScoreSearchList");
			break;
		case SearchCriteria::TwentyFourHour:
			strcpy(method_name, "getTwentyFourHourScoreSearchList");
			break;
		case SearchCriteria::UserCountry:
			strcpy(method_name, "getUserCountryLocationScoreSearchList");
			break;
		case SearchCriteria::BuddyhoodOnly:
			strcpy(method_name, "getBuddiesScoreSearchList");
			break;
		}

		CC_ASSERT(strlen(method_name) > 0);
		
		jobject search_list = NULL;
		JniMethodInfo t;
        if (JniHelper::getStaticMethodInfo(t,
            "com.scoreloop.client.android.core.model.SearchList",
            method_name,
            "()Lcom/scoreloop/client/android/core/model/SearchList;"))
		{
			search_list = t.env->CallStaticObjectMethod(t.classID, t.methodID);
			t.env->DeleteLocalRef(t.classID);
		}

		if (search_list != NULL &&
			JniHelper::getMethodInfo(t,
					"com.scoreloop.client.android.core.controller.ScoresController",
					"setSearchList",
					"(Lcom/scoreloop/client/android/core/model/SearchList;)V"))
		{
			t.env->CallVoidMethod((jobject)self, t.methodID, search_list);
			t.env->DeleteLocalRef(t.classID);
		}
	}
开发者ID:dyip302,项目名称:upSL,代码行数:42,代码来源:jni_scoreloop.cpp

示例8: VM_GetNibblePort

void VM_GetNibblePort(void)
{
    uint8 port, data;

    port = LOBYTE(VM_PopW()) & NIBBLE_PORT_MASK;

    switch (port) {
        case 0: case 1:
            data = HAL_BYTE_PORT0;
            break;
        case 2: case 3:
            data = HAL_BYTE_PORT1;
            break;
        default:
            CC_ASSERT(FALSE, ERROR_ILLOPA);
    }

    if ((port & ((uint8)0x01)) == ((uint8)0x1)) {
        data >>= 4;
    }
开发者ID:christoph2,项目名称:VM-2CB,代码行数:20,代码来源:VM_Ports.c

示例9: onPressStateChangedToNormal

void ButtonEx::updateTexture() {
    int counter = 0;

    if (_normalTextureAdaptDirty && isBright() &&
        _brightStyle == BrightStyle::NORMAL) {
        onPressStateChangedToNormal();
        ++counter;
    }
    if (_pressedTextureAdaptDirty && isBright() &&
        _brightStyle == BrightStyle::HIGHLIGHT) {
        onPressStateChangedToPressed();
        ++counter;
    }
    if (_disabledTextureAdaptDirty && not isBright()) {
        onPressStateChangedToDisabled();
        ++counter;
    }

    CC_ASSERT(counter <= 1);
}
开发者ID:Senspark,项目名称:ee-library,代码行数:20,代码来源:EEButton.cpp

示例10: CC_ASSERT

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    CCDirector* pDirector = CCDirector::sharedDirector();
    CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();

    pDirector->setOpenGLView(pEGLView);
	
    // turn on display FPS
    pDirector->setDisplayStats(true);

    // set FPS. the default value is 1.0/60 if you don't call this
    pDirector->setAnimationInterval(1.0 / 60);

    CC_ASSERT(GameScene::sharedGameScene());

    // run
    pDirector->runWithScene(GameScene::sharedGameScene());

    return true;
}
开发者ID:zhulu-mike,项目名称:CrazyStar,代码行数:20,代码来源:AppDelegate.cpp

示例11: CC_ASSERT

	bool CCScrollLayer::initWithLayers(CCArray* layers, int widthOffset)
	{
		if (!CCLayer::init())
			return false;
		CC_ASSERT(layers && layers->count());
		
		setTouchEnabled(true);
        
		m_bStealTouches = true;
		
		// Set default minimum touch length to scroll.
		m_fMinimumTouchLengthToSlide = 30.0f;
		m_fMinimumTouchLengthToChangePage = 100.0f;
		
		m_fMarginOffset = CCDirector::sharedDirector()->getWinSize().width;
        
		// Show indicator by default.
		m_bShowPagesIndicator = true;
		m_tPagesIndicatorPosition = ccp(0.5f * m_obContentSize.width, ceilf(m_obContentSize.height / 8.0f));
        
		// Set up the starting variables
		m_uCurrentScreen = 0;
        
		// Save offset.
		m_fPagesWidthOffset = (CGFloat)widthOffset;
        
		// Save array of layers.
        // Can't use createWithArray because layer does not implemnt CCCopying
		// m_pLayers = CCArray::createWithArray(layers);
        m_pLayers = CCArray::create();
        m_pLayers->addObjectsFromArray(layers);
		layers->release();
		m_pLayers->retain();
        
        CCSize size = CCDirector::sharedDirector()->getWinSize();
        this->setRectLayer(CCRect(0, 0, size.width, size.height));
        
		updatePages();
        
		return true;
	}
开发者ID:haquangvu,项目名称:TrangQuynh-V2,代码行数:41,代码来源:CCScrollLayer.cpp

示例12: CC_ASSERT

//切换庄家
bool CDanShuangGame::OnSubChangeBanker(const void * pBuffer, WORD wDataSize)
{
	//效验数据
	CC_ASSERT(wDataSize==sizeof(CMD_S_ChangeBanker));
	if (wDataSize!=sizeof(CMD_S_ChangeBanker)) return false;

	//消息处理
	CMD_S_ChangeBanker * pChangeBanker=(CMD_S_ChangeBanker *)pBuffer;

	WORD wPrevBanker = m_wCurrentBanker;	//备份上个庄家

	//自己判断
	if (m_wCurrentBanker == m_pDirector->m_nMeChairID && pChangeBanker->wBankerUser != m_pDirector->m_nMeChairID) 
	{
		m_bMeApplyBanker=false;
	}
	else if (pChangeBanker->wBankerUser == m_pDirector->m_nMeChairID)
	{
		m_bMeApplyBanker=true;
	}

	//庄家信息
	SetBankerInfo(pChangeBanker->wBankerUser, pChangeBanker->lBankerScore);

	//显示图片
	m_pDanShuangGameView->ShowChangeBanker(wPrevBanker != pChangeBanker->wBankerUser);
	m_pDanShuangGameView->SetBankerScore(0, 0);

	//删除上庄列表玩家
	if (m_wCurrentBanker!=INVALID_CHAIR)
	{
		tagApplyUser ApplyUser;
		ApplyUser.wChairID = m_wCurrentBanker;
		m_pDanShuangGameView->CancelApplyBanker(ApplyUser);
	}

	//更新控件
	UpdateButtonControl();

	return true;
}
开发者ID:hantingmeixue,项目名称:Aoyi,代码行数:42,代码来源:DanShuang.cpp

示例13: pos

void CFBMatch::teamPositionAck(int side, const vector<float>& p, int ballPlayerId, unsigned int timeStamp)
{
    auto team = m_teams[side];
    
    int size = team->getPlayerNumber();
    
    if (timeStamp == 0)     // timeStamp为0表示暂停时候的强制同步
    {
        for (int i = 0; i < size; ++i)
        {
            Point pos(p[i * 4], p[i * 4 + 1]);
            Point vec(p[i * 4 + 2], p[i * 4 + 3]);
            auto player = team->getPlayer(i);
            
            player->loseBall();
            player->setPosition(pos);
            player->setMovingVector(vec);
        }
        
        if (ballPlayerId != -1)
        {
            team->getPlayer(ballPlayerId)->gainBall();
        }
    }
    else
    {
        float dt = m_proxy->getDeltaTime(timeStamp);
        
        for (int i = 0; i < size; ++i)
        {
            Point pos(p[i * 4], p[i * 4 + 1]);
            Point vec(p[i * 4 + 2], p[i * 4 + 3]);
            auto player = team->getPlayer(i);

            player->moveFromTo(pos, vec, dt, m_SYNC_TIME);
        }
        
        CC_ASSERT(team == m_teamsInMatch[(int)SIDE::OPP]);
        m_syncTime[(int)SIDE::OPP] = m_SYNC_TIME;
    }
}
开发者ID:FootBallX,项目名称:FootBallXClient,代码行数:41,代码来源:CFBMatch.cpp

示例14: CC_ASSERT

void Live2dXSprite::runAnimation(string name)
{
    map<string, Live2dX_Anims>::iterator iter = m_all_anims.find(name);
    CC_ASSERT(iter != m_all_anims.end());
    m_animNowTime = 0;
    m_nowVertex = m_orginVertex;
    m_animTime = 0;
    
    m_curAnims = &iter->second;
    for (Live2dX_Anims::iterator iter2 = m_curAnims->begin();
         iter2 != m_curAnims->end(); ++iter2)
    {
        float time = iter2->delay+iter2->time;
        if (time > m_animTime)
        {
            m_animTime = time;
        }
    }
    CCTime::gettimeofdayCocos2d(&m_nowTime, NULL);
    m_isAnimation = true;
}
开发者ID:aboduo,项目名称:live2d-x,代码行数:21,代码来源:Live2dXSprite.cpp

示例15: CC_ASSERT

bool DataCenter::loadDamageFactorMap(void)
{
	m_mapDamageFactor.clear();

	std::string str = FileUtils::getInstance()->fullPathForFilename("damage_factor.xml");
	tinyxml2::XMLDocument doc;
	auto data = FileUtils::getInstance()->getDataFromFile(str);
	auto ret = doc.Parse((const char*)data.getBytes(), data.getSize());
	//auto ret = doc.LoadFile(str.c_str());
	if (ret != tinyxml2::XML_NO_ERROR)
	{
		return false;
	}

	const tinyxml2::XMLElement* e_root = nullptr;
	const tinyxml2::XMLElement* e_child_1 = nullptr;
	const tinyxml2::XMLElement* e_child_2 = nullptr;
	float factor = 0.0f;

	e_root = doc.RootElement();
	CC_ASSERT(e_root != nullptr);

	for (e_child_1 = e_root->FirstChildElement();
		e_child_1 != nullptr;
		e_child_1 = e_child_1->NextSiblingElement())
	{
		int armor_type = getCommonType(e_child_1->Value());

		for (e_child_2 = e_child_1->FirstChildElement();
			e_child_2 != nullptr;
			e_child_2 = e_child_2->NextSiblingElement())
		{
			int proj_type = getCommonType(e_child_2->Value());
			e_child_2->QueryFloatText(&factor);
			m_mapDamageFactor[armor_type][proj_type] = factor;
		}
	}

	return true;
}
开发者ID:vgamed,项目名称:Hound,代码行数:40,代码来源:DataCenter.cpp


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