/*---------------------------------------------------------------------------------------------------------*/ uint8_t LM35_ioctl( void * const aHandle ,const uint8_t aIoctl_num , void * aIoctl_param1 , void * aIoctl_param2) { switch(aIoctl_num) { #if LM35_CONFIG_NUM_OF_DYNAMIC_INSTANCES > 0 case IOCTL_GET_PARAMS_ARRAY_FUNC : *(const dev_param_t**)aIoctl_param1 = LM35_Dev_Params; *(uint8_t*)aIoctl_param2 = sizeof(LM35_Dev_Params)/sizeof(dev_param_t); //size break; case IOCTL_LM35_SET_SERVER_DEVICE : INSTANCE(aHandle)->adc_server_device = DEV_OPEN((uint8_t*)aIoctl_param1); break; #endif case IOCTL_LM35_GET_CURRENT_TEMPERATURE_mC : if(NULL != INSTANCE(aHandle)->adc_server_device) { DEV_IOCTL(INSTANCE(aHandle)->adc_server_device , IOCTL_ADC_GET_CURRENT_VALUE_mV , aIoctl_param1); *(uint32_t*)aIoctl_param1 = (*(uint32_t*)aIoctl_param1)*100; } break; case IOCTL_DEVICE_START : break; default : return 1; } return 0; }
void GameSet::btn2Handler() { INSTANCE(HelpFacade)->open(INSTANCE(UserData)->getCurrentSceneId()); if(INSTANCE(GuideManager)->getIsGuiding() && INSTANCE(GuideManager)->getCurrentStep() == GuideStep_10011){ INSTANCE(GuideManager)->goToNext(); } }
void vqueuePut(PVPCISTATE pState, PVQUEUE pQueue, PVQUEUEELEM pElem, uint32_t uLen, uint32_t uReserved) { unsigned int i, uOffset, cbReserved = uReserved; Log2(("%s vqueuePut: %s desc_idx=%u acb=%u\n", INSTANCE(pState), QUEUENAME(pState, pQueue), pElem->uIndex, uLen)); for (i = uOffset = 0; i < pElem->nIn && uOffset < uLen - uReserved; i++) { uint32_t cbSegLen = RT_MIN(uLen - cbReserved - uOffset, pElem->aSegsIn[i].cb - cbReserved); if (pElem->aSegsIn[i].pv) { Log2(("%s vqueuePut: %s used_idx=%u seg=%u addr=%p pv=%p cb=%u acb=%u\n", INSTANCE(pState), QUEUENAME(pState, pQueue), pQueue->uNextUsedIndex, i, pElem->aSegsIn[i].addr, pElem->aSegsIn[i].pv, pElem->aSegsIn[i].cb, cbSegLen)); PDMDevHlpPCIPhysWrite(pState->CTX_SUFF(pDevIns), pElem->aSegsIn[i].addr + cbReserved, pElem->aSegsIn[i].pv, cbSegLen); cbReserved = 0; } uOffset += cbSegLen; } Assert((uReserved + uOffset) == uLen || pElem->nIn == 0); Log2(("%s vqueuePut: %s used_idx=%u guest_used_idx=%u id=%u len=%u\n", INSTANCE(pState), QUEUENAME(pState, pQueue), pQueue->uNextUsedIndex, vringReadUsedIndex(pState, &pQueue->VRing), pElem->uIndex, uLen)); vringWriteUsedElem(pState, &pQueue->VRing, pQueue->uNextUsedIndex++, pElem->uIndex, uLen); }
void GamePauseState::InjectKeyDown( const OIS::KeyEvent& evt ) { if (evt.key==OIS::KC_ESCAPE) { INSTANCE(GameStateManager)->ChangeGameState(GameState::GAME_PLAY_STATE); INSTANCE(AudioManager)->soundMgr->playAudio(AudioName::SOUND_MENU_PREVIOUS_SCREEN,false); } }
void BossLottery::rotateComplete() { btn->setEnabled(true); closeBtn->setEnabled(true); INSTANCE(BossAvatarFacade)->showBossMultiple(INSTANCE(FightManager)->getCurrentBossId()); if(result > 1){ INSTANCE(SceneManager)->addToCurrentScene(BossLotteryNotice::create(result), zOrder_notice); } }
bool FightManager::enoughAnger() { if (currentAnger >= getRole()->getSkillCost()) { int skillNum = INSTANCE(UserData)->getSkillNum(); INSTANCE(UserData)->setSkillNum(skillNum + 1); return true; } return false; }
void echoInstanceSet(echoObject *inst, echoPos_t *M, echoObject *obj) { if (inst && echoTypeInstance == inst->type) { ell_4m_INV(INSTANCE(inst)->Mi, M); ELL_4M_COPY(INSTANCE(inst)->M, M); INSTANCE(inst)->obj = obj; } }
void BossLottery::btnHandler() { int cost = INSTANCE(SystemConfigRule)->getBossLotteryCost(); if(times > 1){ if(cost >= INSTANCE(UserData)->getCurrentMoney()){ INSTANCE(MessageBoxFacade)->showMessageBox("元宝不足,是否充值?", INSTANCE(RechargeFacade), callfunc_selector(RechargeFacade::open),"充值"); return; } INSTANCE(UserData)->costCurrentMoney(cost); INSTANCE(MoneyLayerManager)->createReduceMoney(cost); } CCNotificationCenter::sharedNotificationCenter()->postNotification(NoticeUpdateMoney); btn->setEnabled(false); closeBtn->setEnabled(false); int r = INSTANCE(SystemConfigRule)->getWheelMultiple(); result = getMultiple(r); INSTANCE(BossLotteryFacade)->setBossMultiple(result); CCRotateBy *rotate = CCRotateBy::create(4.0f, 3600 + r * 60 - 30); CCEaseInOut *easeInOut = CCEaseInOut::create((CCActionInterval *)rotate->copy()->autorelease(), 1.5f); CCSequence *action = CCSequence::create(easeInOut,CCCallFunc::create(this, callfunc_selector(BossLottery::rotateComplete)),NULL); circle->setRotation(0); circle->runAction(action); costLabel->setString(CCString::createWithFormat("消耗%d元宝",cost)->getCString()); INSTANCE(UserData)->addWheelTimes(1); times++; }
void GuideManager::addExitBtn() { if(exitBtn == NULL){ CCSize winSize = CCDirector::sharedDirector()->getWinSize(); CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("common/common.plist"); exitBtn = INSTANCE(ButtonUtils)->createButton("common_redBtn_1.png", CCSizeMake(140, 50), "退出引导"); INSTANCE(SceneManager)->addToCurrentScene(exitBtn, zOrder_ui); exitBtn->setPosition(ccp(winSize.width - 200, 600)); exitBtn->addTargetWithActionForControlEvents(this, cccontrol_selector(GuideManager::exitGuide), CCControlEventTouchUpInside); } }
//Джх╬╤сап void DisplayManager::AddTime(Real deltaTime) { lifetText->msg->setCaption("Life: "+ConvertToString(INSTANCE(PlayerManager)->lifeNum)); bombText->msg->setCaption("Bomb: "+ConvertToString(INSTANCE(PlayerManager)->bombNum)); scoreText->msg->setCaption("Score: "+ConvertToString(INSTANCE(ScoreManager)->displayScore)); lifetText->node->setVisible(true); bombText->node->setVisible(true); scoreText->node->setVisible(true); }
void GameSet::onEnter() { ADD_TOUCH; CCLayer::onEnter(); setPosition(INSTANCE(GameUtils)->getWindowsCenterPosition()); if(wikiBtn){ INSTANCE(GuideManager)->registerPosition(GuideStep_10011, ccpAdd(wikiBtn->getParent()->convertToWorldSpace(wikiBtn->getPosition()), ccp(0, -20))); } }
void Java_com_duomai_threekingdoms_JniManager_JniCallC (JNIEnv *env, jobject obj, jstring jstr) { string result = JniHelper::jstring2string(jstr); CCLOG("jni-c++函数执行完毕:%s",result.c_str()); if(result == "rechargeVerification"){ INSTANCE(RechargeManager)->rechargeVerification(); }else if(result == "noticeExitGame"){ INSTANCE(MessageBoxFacade)->showMessageBox("是否退出游戏", INSTANCE(NoticeBoxFacade),callfunc_selector(NoticeBoxFacade::exitGame)); } return; }
void PlayMenuState::InjectButtonPressed( const OIS::JoyStickEvent &arg, int button ) { if (button==7) { INSTANCE(PlayerManager)->ResetController(); INSTANCE(GameStateManager)->menuState=MenuState::PAUSE_MENU_STATE; INSTANCE(AudioManager)->soundMgr->playAudio(AudioName::SOUND_MENU_PREVIOUS_SCREEN,true); sceneMgr->setAmbientLight(ColourValue(0.1, 0.1, 0.1)); } INSTANCE(PlayerManager)->InjectButtonPressed(arg,button); levelManager->InjectButtonPressed(arg,button); }
void PlayMenuState::InjectKeyDown( const OIS::KeyEvent& evt ) { if (evt.key==OIS::KC_ESCAPE) { INSTANCE(PlayerManager)->ResetController(); INSTANCE(GameStateManager)->menuState=MenuState::PAUSE_MENU_STATE; INSTANCE(AudioManager)->soundMgr->playAudio(AudioName::SOUND_MENU_PREVIOUS_SCREEN,true); sceneMgr->setAmbientLight(ColourValue(0.1, 0.1, 0.1)); } INSTANCE(PlayerManager)->InjectKeyDown(evt); levelManager->InjectKeyDown(evt); }
/*---------------------------------------------------------------------------------------------------------*/ size_t sw_uart_wrapper_pwrite(const void *aHandle ,const uint8_t *apData , size_t aLength, size_t aOffset) { tx_int_size_t dataLen= (tx_int_size_t)aLength; tx_int_size_t curr_transmit_len; if(INSTANCE(aHandle)->use_task_for_out) { xMessage_t xMessage; uint8_t *pSendData; os_queue_t xQueue = INSTANCE(aHandle)->xQueue; if(NULL == xQueue) return 1; while(dataLen) { curr_transmit_len = dataLen; if ( SW_UART_WRAPPER_CONFIG_MAX_TX_BUFFER_SIZE < curr_transmit_len ) { curr_transmit_len=SW_UART_WRAPPER_CONFIG_MAX_TX_BUFFER_SIZE; } #ifdef SW_UART_WRAPPER_CONFIG_USE_MALLOC xMessage.pData=(uint8_t*)malloc(curr_transmit_len * sizeof(uint8_t)); #endif pSendData=xMessage.pData; memcpy(pSendData,(uint8_t*)apData,curr_transmit_len); xMessage.len=curr_transmit_len; if(OS_QUEUE_SEND_SUCCESS != os_queue_send_infinite_wait( xQueue, ( void * ) &xMessage )) { #ifdef SW_UART_WRAPPER_CONFIG_USE_MALLOC free(pSendData); #endif return 0; } dataLen-=curr_transmit_len; apData += curr_transmit_len; } } else { sw_uart_send_and_wait_for_end(INSTANCE(aHandle), busy_delay,apData,dataLen); } return aLength; }
void GameSet::btn1Handler() { close(); if(INSTANCE(FightManager)->getIsFighting()){ INSTANCE(FightManager)->startGuide(); }else{ INSTANCE(GuideManager)->setIsGuiding(true); INSTANCE(UserData)->setCurrentSceneId(40001); INSTANCE(FightSceneFacade)->openFightScene(); } }
void FightManager::enterFight() { int sceneId = INSTANCE(UserData)->getCurrentSceneId(); selectBossId(); skillNpcVector = INSTANCE(SceneRule)->getSkillNpcId(sceneId); //产生npc Director::getInstance()->getScheduler()->schedule(CC_SCHEDULE_SELECTOR(FightManager::createNpc),this,5.0f,false); //npc动起来把 INSTANCE(NPCManager)->startUpdate(); }
void GuideManager::showStepEffect_10002() { if(effect == NULL){ CCSize winSize = CCDirector::sharedDirector()->getWinSize(); CCAnimation *animation = INSTANCE(AnimationUtils)->getCommonAnimation("guide/guide_effect.plist", "guide_effect"); CCRepeatForever *action = CCRepeatForever::create(CCAnimate::create(animation)); effect = CCSprite::createWithSpriteFrameName("guide_effect_0000.png"); effect->runAction(action); INSTANCE(SceneManager)->addToCurrentScene(effect, zOrder_guide); effect->setPosition(ccp(winSize.width/2 - 100, 200)); effect->setAnchorPoint(ccp(0.5, 0)); } effect->setVisible(true); }
void ModeMenuState::InjectKeyDown( const OIS::KeyEvent& evt ) { switch(evt.key) { case OIS::KC_W: case OIS::KC_UP: if (menuIndex>0) { menuIndex--; INSTANCE(AudioManager)->soundMgr->playAudio(AudioName::SOUND_MENU_MOVE,true); } break; case OIS::KC_S: case OIS::KC_DOWN: if (menuIndex<menuCount-1) { menuIndex++; INSTANCE(AudioManager)->soundMgr->playAudio(AudioName::SOUND_MENU_MOVE,true); } break; case OIS::KC_RETURN: if (menuArray[menuIndex].tag==GameMode::BOSSRUSH_MODE) { INSTANCE(AudioManager)->soundMgr->playAudio(AudioName::SOUND_MENU_INVALID_SELECTION_OR_ACTI,true); } else if (menuArray[menuIndex].tag==GameMode::RANK) { Removed(); INSTANCE(AudioManager)->soundMgr->playAudio(AudioName::SOUND_NEW_LINE_SHOWN,true); INSTANCE(GameStateManager)->menuState=MenuState::RANK_MENU_STATE; } else { Removed();//IMPORTANT: remove must before enter game. INSTANCE(AudioManager)->bgmMgr->stopAudio(AudioName::BGM_ORCHESTRAL_MENU); INSTANCE(AudioManager)->soundMgr->playAudio(AudioName::SOUND_MENUSTART,true); INSTANCE(GameStateManager)->ChangeGameState(GameState::GAME_PLAY_STATE,MenuState::PLAY_MENU_STATE,menuArray[menuIndex].tag); } break; case OIS::KC_ESCAPE: INSTANCE(GameStateManager)->menuState=MenuState::TITLE_MENU_STATE; INSTANCE(AudioManager)->soundMgr->playAudio(AudioName::SOUND_MENU_PREVIOUS_SCREEN,false); Removed(); default: break; } }
void BossLottery::initContent() { CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("ui/fightUI/bossLottery.plist"); circle = CCSprite::createWithSpriteFrameName("bossLottery_bg.png"); addChild(circle); btn = INSTANCE(ButtonUtils)->createButton("bossLottery_btn.png", CCSizeMake(157, 207), ""); btn->setAnchorPoint(ccp(0.51, 0.37)); addChild(btn); btn->setZoomOnTouchDown(false); btn->addTargetWithActionForControlEvents(this, cccontrol_selector(BossLottery::btnHandler), CCControlEventTouchUpInside); CCPoint cP = circle->getAnchorPointInPoints(); for(int i=0;i<36;i++){ BossLotteryLight *light = BossLotteryLight::create(); circle->addChild(light); float t = i*10*3.14f/180; light->setPosition(ccpAdd(cP,ccp(200.0f * sin(t), 200.0f * cos(t)))); array->addObject(light); } lightFlag = 0; getScheduler()->scheduleSelector(schedule_selector(BossLottery::updateLight), this, 0.1f, false); CCLabelTTF *desc = CCLabelTTF::create(); desc->setFontSize(24); desc->setString("击杀将领"); btn->addChild(desc); desc->setColor(ccYELLOW); desc->setPosition(ccpAdd(btn->getAnchorPointInPoints(), ccp(0, 33))); costLabel = CCLabelTTF::create(); costLabel->setFontSize(24); costLabel->setColor(ccGREEN); btn->addChild(costLabel); costLabel->setPosition(ccpAdd(btn->getAnchorPointInPoints(), ccp(0, -34))); costLabel->setString("首次免费"); CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("common/common.plist"); closeBtn = INSTANCE(ButtonUtils)->createButton("common_redBtn_1.png", "common_redBtn_2.png", "common_redBtn_1.png", CCSizeMake(151, 48), "关闭",24,ccYELLOW); addChild(closeBtn); closeBtn->setPosition(ccp(0, -190)); closeBtn->addTargetWithActionForControlEvents(this, cccontrol_selector(BossLottery::close), CCControlEventTouchUpInside); times = 1; }
void print_path_exists(yajl_gen json_gen, char *buffer, const char *title, const char *path, const char *format) { const char *walk; char *outwalk = buffer; struct stat st; const bool exists = (stat(path, &st) == 0); INSTANCE(path); START_COLOR((exists ? "color_good" : "color_bad")); for (walk = format; *walk != '\0'; walk++) { if (*walk != '%') { *(outwalk++) = *walk; continue; } if (strncmp(walk+1, "title", strlen("title")) == 0) { outwalk += sprintf(outwalk, "%s", title); walk += strlen("title"); } else if (strncmp(walk+1, "status", strlen("status")) == 0) { outwalk += sprintf(outwalk, "%s", (exists ? "yes" : "no")); walk += strlen("status"); } } END_COLOR; OUTPUT_FULL_TEXT(buffer); }
/* * Combines ethernet IP addresses and speed (if requested) for displaying * */ void print_eth_info(yajl_gen json_gen, char *buffer, const char *interface, const char *format_up, const char *format_down) { const char *walk; const char *ip_address = get_ip_addr(interface); char *outwalk = buffer; INSTANCE(interface); if (ip_address == NULL) { START_COLOR("color_bad"); outwalk += sprintf(outwalk, "%s", format_down); goto out; } START_COLOR("color_good"); for (walk = format_up; *walk != '\0'; walk++) { if (*walk != '%') { *(outwalk++) = *walk; continue; } if (strncmp(walk+1, "ip", strlen("ip")) == 0) { outwalk += sprintf(outwalk, "%s", ip_address); walk += strlen("ip"); } else if (strncmp(walk+1, "speed", strlen("speed")) == 0) { outwalk += print_eth_speed(outwalk, interface); walk += strlen("speed"); } } out: END_COLOR; OUTPUT_FULL_TEXT(buffer); }
void ComboManager::showCombo(int currentMultiple) { if(layer == NULL){ layer = ComboLayer::create(); INSTANCE(SceneManager)->addToCurrentScene(layer, zOrder_notice); comboLabel = CCLabelBMFont::create("combo", "font/font_combo.fnt"); // comboLabel->setVisible(false); CCSize winSize = CCDirector::sharedDirector()->getWinSize(); comboLabel->setPosition(ccp(winSize.width/2 - 240, 140)); layer->addChild(comboLabel); } currentCombo++; // if(currentCombo == 1){ // comboLabel->setVisible(false); // }else{ // comboLabel->setVisible(true); // } comboLabel->setOpacity(255); comboLabel->setString(CCString::createWithFormat("%d combo(%d)",currentCombo,currentMultiple)->getCString()); comboLabel->stopAllActions(); CCSequence *sequence = CCSequence::create(CCDelayTime::create(0.5),CCFadeOut::create(0.3),CCCallFunc::create(this,callfunc_selector(ComboManager::hideComboLabel)),NULL); comboLabel->runAction(sequence); }
void GuideManager::exitGuide() { if(effect){ effect->removeFromParent(); } if(guideFinger){ guideFinger->removeFromParent(); } if(tips){ tips->removeFromParent(); } setIsGuiding(false); INSTANCE(FightManager)->endGuide(); INSTANCE(NPCManager)->setStop(false); }
void LoadingScene::initContent() { SpriteFrameCache::getInstance()->addSpriteFramesWithFile("ui/loadingScene/loadingScene.plist"); SpriteFrameCache::getInstance()->addSpriteFramesWithFile("ui/loadingScene/loading_fire.plist"); auto role = Sprite::createWithSpriteFrameName("loadingScene_role.png"); addChild(role); role->setPosition(Vec2(240,0)); auto logo = Sprite::createWithSpriteFrameName("loadingScene_logo.png"); addChild(logo); logo->setPosition(Vec2(0,20)); frame = Sprite::createWithSpriteFrameName("loadingScene_frame.png"); addChild(frame); frame->setPosition(Vec2(0,-150)); loadingBar = ProgressTimer::create(Sprite::createWithSpriteFrameName("loadingScene_bar.png")); loadingBar->setType(ProgressTimer::Type::BAR); loadingBar->setBarChangeRate(Vec2::ANCHOR_BOTTOM_RIGHT); loadingBar->setMidpoint(Vec2::ZERO); loadingBar->setPercentage(0.0f); frame->addChild(loadingBar); loadingBar->setPosition(getCenterPosition(frame)); fire = Sprite::createWithSpriteFrameName("loading_fire_0000.png"); fire->setAnchorPoint(Vec2::ANCHOR_MIDDLE_RIGHT); frame->addChild(fire); fire->setPosition(Vec2(50,frame->getContentSize().height/2)); auto animate = Animate::create( INSTANCE(AnimationUtils)->getCommonAnimation("ui/loadingScene/loading_fire.plist","loading_fire",0.07f)); auto repeat = RepeatForever::create(animate); fire->runAction(repeat); }
/*---------------------------------------------------------------------------------------------------------*/ uint8_t sw_uart_wrapper_callback(void * const aHandle ,const uint8_t aCallback_num , void * aCallback_param1, void * aCallback_param2) { switch(aCallback_num) { case CALLBACK_TX_DONE : return SW_UART_WRAPPER_TX_Done(INSTANCE(aHandle),(tx_int_size_t)((size_t)aCallback_param1)); break; case CALLBACK_DATA_RECEIVED : return SW_UART_WRAPPER_Data_Received(INSTANCE(aHandle), (uint8_t *)aCallback_param1,(rx_int_size_t)((size_t)aCallback_param2)); break; default: return 1; } return 0; }
void print_run_watch(yajl_gen json_gen, char *buffer, const char *title, const char *pidfile, const char *format) { bool running = process_runs(pidfile); const char *walk; char *outwalk = buffer; INSTANCE(pidfile); START_COLOR((running ? "color_good" : "color_bad")); for (walk = format; *walk != '\0'; walk++) { if (*walk != '%') { *(outwalk++) = *walk; continue; } if (strncmp(walk+1, "title", strlen("title")) == 0) { outwalk += sprintf(outwalk, "%s", title); walk += strlen("title"); } else if (strncmp(walk+1, "status", strlen("status")) == 0) { outwalk += sprintf(outwalk, "%s", (running ? "yes" : "no")); walk += strlen("status"); } } END_COLOR; OUTPUT_FULL_TEXT(buffer); }
void vqueueSync(PVPCISTATE pState, PVQUEUE pQueue) { Log2(("%s vqueueSync: %s old_used_idx=%u new_used_idx=%u\n", INSTANCE(pState), QUEUENAME(pState, pQueue), vringReadUsedIndex(pState, &pQueue->VRing), pQueue->uNextUsedIndex)); vringWriteUsedIndex(pState, &pQueue->VRing, pQueue->uNextUsedIndex); vqueueNotify(pState, pQueue); }
void PlayMenuState::AddTime( Real deltaTime ) { INSTANCE(BulletManager)->AddTime(deltaTime); INSTANCE(PlayerManager)->AddTime(deltaTime); INSTANCE(PlanetManager)->AddTime(deltaTime); INSTANCE(ItemManager)->AddTime(deltaTime); INSTANCE(ToogleManager)->AddTime(deltaTime); INSTANCE(CollisionManager)->AddTime(deltaTime); INSTANCE(EnemyManager)->AddTime(deltaTime); INSTANCE(ScoreManager)->AddTime(deltaTime); INSTANCE(DisplayManager)->AddTime(deltaTime); levelManager->AddTime(deltaTime); }
void BossLottery::onEnter() { ADD_TOUCH; CCLayer::onEnter(); CCSize winSize = CCDirector::sharedDirector()->getWinSize(); setPosition(ccp(winSize.width/2, winSize.height/2)); INSTANCE(BossLotteryFacade)->setLotteryStatus(true); }