这篇教程C++ CC_ASSERT函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CC_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ CC_ASSERT函数的具体用法?C++ CC_ASSERT怎么用?C++ CC_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CC_ASSERT函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: CC_ASSERTvoid 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,
示例2: CP_ARBITER_GET_SHAPESNS_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,
示例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,
示例4: logvoid 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,
示例5: CC_ASSERTbool 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,
示例6: CC_ASSERTvoid 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,
示例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,
示例8: VM_GetNibblePortvoid 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,
示例9: onPressStateChangedToNormalvoid 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,
示例10: CC_ASSERTbool 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,
示例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,
示例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,
示例13: posvoid 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,
示例14: CC_ASSERTvoid 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,
示例15: CC_ASSERTbool 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,
示例16: va_startjsval CFBFunctionsJS::callJSFunc(const char* name, const char* format, ...){ int count = (int)strlen(format); jsval* argv = new jsval[count]; va_list insvalist; va_start(insvalist, format); for (int i = 0; i < count; ++i) { switch (format[i]) { case 'j': // jsval argv[i] = va_arg(insvalist, jsval); break; case 'b': // bool argv[i] = BOOLEAN_TO_JSVAL(va_arg(insvalist, int)); break; case 'd': // int argv[i] = INT_TO_JSVAL(va_arg(insvalist, int)); break; case 'f': //float argv[i] = DOUBLE_TO_JSVAL(va_arg(insvalist, double)); break; case 's': // c style string argv[i] = c_string_to_jsval(_cx, va_arg(insvalist, const char*)); break; default: CC_ASSERT(false); } } va_end(insvalist); jsval res; JSAutoCompartment ac(_cx, _go); JS_CallFunctionName(_cx, _go, name, count, argv, &res); auto sc = ScriptingCore::getInstance(); sc->forceGC(_cx, 0, nullptr); return res ;}
开发者ID:FootBallX,项目名称:FootBallXClient,代码行数:40,
示例17: CC_ASSERTstd::vector<std::string> CCNativeKeyValueStorage::getEncryptedKeys() const { CCError* error = nullptr; std::vector<std::string> encryptedKeys; ValueMap params; params["method"] = "CCNativeKeyValueStorage::getEncryptedKeys"; ValueMap&& retParams = CCNdkBridge::callNative(params, &error); if (error || retParams.size() == 0 || not retParams.count("return")) { CCSoomlaUtils::logException(TAG, error); CC_ASSERT(false); return encryptedKeys; } auto& retValue = retParams.at("return").asValueVector(); for (auto value : retValue) { encryptedKeys.push_back(value.asString()); } return encryptedKeys;}
开发者ID:enrevol,项目名称:ee-x,代码行数:22,
示例18: CC_ASSERTvoid PhysicsWorldCallback::rayCastCallbackFunc(cpShape *shape, cpFloat t, cpVect n, RayCastCallbackInfo *info){ if (!PhysicsWorldCallback::continues) { return; } auto it = PhysicsShapeInfo::getMap().find(shape); CC_ASSERT(it != PhysicsShapeInfo::getMap().end()); PhysicsRayCastInfo callbackInfo = { it->second->getShape(), info->p1, info->p2, Point(info->p1.x+(info->p2.x-info->p1.x)*t, info->p1.y+(info->p2.y-info->p1.y)*t), Point(n.x, n.y), (float)t, }; PhysicsWorldCallback::continues = info->func(*info->world, callbackInfo, info->data);}
开发者ID:6520874,项目名称:pipiGame,代码行数:22,
示例19: CC_ASSERTvoid PhysicsWorldCallback::rayCastCallbackFunc(cpShape *shape, cpVect point, cpVect normal, cpFloat alpha, RayCastCallbackInfo *info){ if (!PhysicsWorldCallback::continues) { return; } PhysicsShape *physicsShape = static_cast<PhysicsShape*>(cpShapeGetUserData(shape)); CC_ASSERT(physicsShape != nullptr); PhysicsRayCastInfo callbackInfo = { physicsShape, info->p1, info->p2, PhysicsHelper::cpv2point(point), PhysicsHelper::cpv2point(normal), static_cast<float>(alpha), }; PhysicsWorldCallback::continues = info->func(*info->world, callbackInfo, info->data);}
开发者ID:114393824,项目名称:Cocos2dxShader,代码行数:22,
示例20: CC_ASSERTvoid DealCardsE::excute(CallBackWithVoid callback){ CC_ASSERT(m_position >= 0 || m_position <= 2); if (m_position == 0) { BattleData::GetInstance()->DealTableCard(callback); } else if (m_position == 1 || m_position == 2) { BattleData::GetInstance()->DealPetsCards(m_position - 1, callback); } else if (m_position == 3 || m_position == 4) { BattleData::GetInstance()->ResetPetsCards(m_position - 3, callback); } else { callback(); } //call callback() directly to avoid waiting for animation //callback();}
开发者ID:LeoYangLing,项目名称:Client,代码行数:22,
示例21: CC_ASSERTvoid RenderState::StateBlock::cloneInto(StateBlock* state) const{ CC_ASSERT(state); state->_cullFaceEnabled = _cullFaceEnabled; state->_depthTestEnabled = _depthTestEnabled; state->_depthWriteEnabled = _depthWriteEnabled; state->_depthFunction = _depthFunction; state->_blendEnabled = _blendEnabled; state->_blendSrc = _blendSrc; state->_blendDst = _blendDst; state->_cullFaceSide = _cullFaceSide; state->_frontFace = _frontFace; state->_stencilTestEnabled = _stencilTestEnabled; state->_stencilWrite = _stencilWrite; state->_stencilFunction = _stencilFunction; state->_stencilFunctionRef = _stencilFunctionRef; state->_stencilFunctionMask = _stencilFunctionMask; state->_stencilOpSfail = _stencilOpSfail; state->_stencilOpDpfail = _stencilOpDpfail; state->_stencilOpDppass = _stencilOpDppass; state->_bits = _bits;}
开发者ID:Ratel13,项目名称:Cocos2dGame-v3.7,代码行数:23,
示例22: CC_ASSERTstring EncryptionHandler::singleDecrypt(const string& cryptedMsg){ DES des; des.SetKey(DES_KEY, 8); des.ProduceSubKey(); CC_ASSERT(cryptedMsg.size() <= 8); for (int i = 0; i < cryptedMsg.size(); i++) { des.cryptedmsg[i] = cryptedMsg[i]; } des.Char2Bit(des.cryptedmsg, des.bcryptedmsg, 8); des.Decipher(); char msg[9] = {0}; for (int i = 0; i < 8; i++) { msg[i] = des.decipher[i]; } return string(msg);}
开发者ID:CanFengHome,项目名称:Cocos2dXEffect,代码行数:23,
示例23: CC_ASSERTvoid COxCJ4UILayer::SetJettonValue(int nCount, LONGLONG lJetton[], bool bEnable[]){ if (nCount != CountArray(m_pBtnJetton)) { CC_ASSERT(false); return ; } for (BYTE i = 0; i < nCount; ++i) { if (m_pJettonValue[i]) { char szValue[64] = {0}; snprintf(szValue, 64, "%lld", lJetton[i]); m_pJettonValue[i]->setString(szValue); } if(m_pBtnJetton[i]) { m_pBtnJetton[i]->setEnabled(bEnable[i]); } }}
开发者ID:hantingmeixue,项目名称:Aoyi,代码行数:23,
示例24: getEquippingModel void CCEquippableVG::putEquippingModelToDict(CCDictionary *dict) { EquippingModel equippingModel = (EquippingModel) getEquippingModel()->getValue(); CCString *strEquippingModel; switch (equippingModel) { case kLocal: { strEquippingModel = CCString::create(EQUIPPING_MODEL_LOCAL); break; } case kCategory: { strEquippingModel = CCString::create(EQUIPPING_MODEL_CATEGORY); break; } case kGlobal: { strEquippingModel = CCString::create(EQUIPPING_MODEL_GLOBAL); break; } default: { CC_ASSERT(false); strEquippingModel = CCString::create("ERROR"); } } dict->setObject(strEquippingModel, JSON_EQUIPPABLE_EQUIPPING); }
开发者ID:Andargor,项目名称:cocos2dx-store,代码行数:23,
示例25: codeint CCLuaStack::executeScriptFile(const char* filename){#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) std::string code("require /""); code.append(filename); code.append("/""); return executeString(code.c_str());#else ++m_callFromLua; int nRet = luaL_dofile(m_state, filename); --m_callFromLua; CC_ASSERT(m_callFromLua >= 0); // lua_gc(m_state, LUA_GCCOLLECT, 0); if (nRet != 0) { CCLOG("[LUA ERROR] %s", lua_tostring(m_state, -1)); lua_pop(m_state, 1); return nRet; } return 0;#endif}
开发者ID:ascetic85,项目名称:quick-cocos2d-x-20130509,代码行数:23,
注:本文中的CC_ASSERT函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ CC_BREAK_IF函数代码示例 C++ CCSizeMake函数代码示例 |