ValueVessel::ValueVessel( const VesselOptions& da ): Vessel(da), no_output_value(false) { parse("COMPONENT",mycomp); ActionWithValue* a=dynamic_cast<ActionWithValue*>( getAction() ); plumed_massert(a,"cannot create passable values as base action does not inherit from ActionWithValue"); int numval = getNumericalLabel(); if( numval<0 && a->getNumberOfComponents()==0 ) { // This allows us to make multicolvars pretend to be colvars - this is used in AlphaRMSD etc a->addValueWithDerivatives(); a->setNotPeriodic(); final_value=a->copyOutput( a->getNumberOfComponents()-1 ); } else if( numval<0 ) { no_output_value=true; final_value=new Value(); final_value->setNotPeriodic(); } else { plumed_massert( !a->exists(getAction()->getLabel() + "." + getLabel() ), "you can't create the name multiple times"); a->addComponentWithDerivatives( getLabel() ); a->componentIsNotPeriodic( getLabel() ); final_value=a->copyOutput( a->getNumberOfComponents()-1 ); } }
/// Erase -> Install = Downgrade void MergedTransactionTest::testMergeEraseInstallDowngrade() { auto merged = prepareMergedTransaction( conn, TransactionItemAction::REMOVE, TransactionItemAction::INSTALL, "0.11.0", "0.10.9"); auto items = merged->getItems(); CPPUNIT_ASSERT_EQUAL(1, (int)items.size()); auto item = items.at(0); CPPUNIT_ASSERT_EQUAL(TransactionItemAction::DOWNGRADE, item->getAction()); }
PlayPanel::PlayPanel(QWidget* parent) : QWidget(parent, Qt::Dialog) { cachedTickPosition = -1; cachedTimePosition = -1; cs = 0; setupUi(this); setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint); QSettings settings; restoreGeometry(settings.value("playPanel/geometry").toByteArray()); move(settings.value("playPanel/pos", QPoint(DEFAULT_POS_X, DEFAULT_POS_Y)).toPoint()); setScore(0); playButton->setDefaultAction(getAction("play")); rewindButton->setDefaultAction(getAction("rewind")); metronomeButton->setDefaultAction(getAction("metronome")); loopButton->setDefaultAction(getAction("loop")); loopInButton->setDefaultAction(getAction("loop-in")); loopOutButton->setDefaultAction(getAction("loop-out")); connect(volumeSlider, SIGNAL(valueChanged(double,int)), SLOT(volumeChanged(double,int))); connect(posSlider, SIGNAL(sliderMoved(int)), SLOT(setPos(int))); connect(tempoSlider, SIGNAL(valueChanged(double,int)), SLOT(relTempoChanged(double,int))); connect(seq, SIGNAL(heartBeat(int,int,int)), SLOT(heartBeat(int,int,int))); }
void Character::update() { // First, deal with being generic updates Being::update(); // Update character level if needed. if (mRecalculateLevel) { mRecalculateLevel = false; recalculateLevel(); } // Dead character: don't regenerate anything else if (getAction() == DEAD) return; // Update special recharge for (SpecialMap::iterator it = mSpecials.begin(), it_end = mSpecials.end(); it != it_end; it++) { SpecialValue &s = it->second; if (s.specialInfo->rechargeable && s.currentMana < s.specialInfo->neededMana) { s.currentMana += s.rechargeSpeed; if (s.currentMana >= s.specialInfo->neededMana && s.specialInfo->rechargedCallback.isValid()) { Script *script = ScriptManager::currentState(); script->prepare(s.specialInfo->rechargedCallback); script->push(this); script->push(s.specialInfo->id); script->execute(); } } } if (mSpecialUpdateNeeded) { sendSpecialUpdate(); mSpecialUpdateNeeded = false; } mStatusEffects.clear(); StatusEffects::iterator it = mStatus.begin(); while (it != mStatus.end()) { mStatusEffects[it->first] = it->second.time; it++; } processAttacks(); }
void MergedTransactionTest::testMergeInstallAlter() { auto merged = prepareMergedTransaction( conn, TransactionItemAction::INSTALL, TransactionItemAction::UPGRADE, "1.0.0", "1.0.1"); auto items = merged->getItems(); CPPUNIT_ASSERT_EQUAL(1, (int)items.size()); auto item = items.at(0); CPPUNIT_ASSERT_EQUAL(TransactionItemAction::INSTALL, item->getAction()); auto rpm = std::dynamic_pointer_cast< RPMItem >(item->getItem()); CPPUNIT_ASSERT_EQUAL(std::string("1.0.1"), rpm->getVersion()); }
SpathVessel::SpathVessel( const vesselbase::VesselOptions& da ): FunctionVessel(da), foundoneclose(false) { mymap=dynamic_cast<Mapping*>( getAction() ); plumed_massert( mymap, "SpathVessel can only be used with mappings"); // Retrieve the index of the property in the underlying mapping usetol=true; norm=true; for(unsigned i=0; i<mymap->getFullNumberOfTasks(); ++i) { if( mymap->getTaskCode(i)!=mymap->getPositionInFullTaskList(i) ) error("mismatched tasks and codes"); } }
InstrumentsDialog::InstrumentsDialog(QWidget* parent) : QDialog(parent) { setObjectName("Instruments"); setupUi(this); setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint); QAction* a = getAction("instruments"); connect(a, SIGNAL(triggered()), SLOT(reject())); addAction(a); saveButton->setVisible(false); loadButton->setVisible(false); readSettings(); }
static void populateIconPalette(Palette* p, const IconAction* a) { while (a->subtype != -1) { Icon* ik = new Icon(gscore); ik->setSubtype(a->subtype); Shortcut* s = getShortcut(a->action); QAction* action = getAction(s); QIcon icon(action->icon()); ik->setAction(a->action, icon); p->append(ik, s->help); ++a; } }
void MuseScore::showMasterPalette(const QString& s) { QAction* a = getAction("masterpalette"); if (masterPalette == 0) { masterPalette = new MasterPalette(0); connect(masterPalette, SIGNAL(closed(bool)), a, SLOT(setChecked(bool))); } masterPalette->setVisible(a->isChecked()); if (!s.isEmpty()) masterPalette->selectItem(s); masterPalette->show(); }
/*! @brief Initialises agent by initialising function approximator */ void MRLAgent::initialiseAgent(int numberOfInputs, int numberOfOutputs, int numberOfHiddens, float max_parameter_range){ FunctionApproximator->initialiseApproximator(numberOfInputs, numberOfOutputs, numberOfHiddens,max_parameter_range); expectation_map->initialiseApproximator(numberOfInputs+1, numberOfInputs,numberOfHiddens,1.0); num_inputs = numberOfInputs; num_outputs = numberOfOutputs; num_hidden = numberOfHiddens; //Perform initial observations, values and rewards list setups. Required to offset learning updates. vector<float> dummy_observation(numberOfInputs,0); vector<int> vect(num_outputs,1); getAction(dummy_observation,vect); giveMotivationReward(); }
/* * 平均利得の対戦を行う */ void AverageGameRule::runRule( const std::shared_ptr<Player>& player, const AllPlayer& allPlayers, const spd::param::Parameter& param, int step) { // 近傍の設定 auto phase = NeighborhoodType::GAME; auto neighbors = player->getNeighbors(phase); if (neighbors == nullptr) { neighbors = std::move(param.getNeighborhoodParameter()->getTopology()->getNeighbors( allPlayers, player->getId(), param.getNeighborhoodParameter()->getNeiborhoodRadius(phase))); } double payoffSum = 0.0; int neighborsCount = 0; // 自身の利得行を取得 auto payoffRow = param.getRuntimeParameter()->getPayoffRow(player->getAction()); int startRadius = 0; // 自己対戦がないなら、半径1から if (!param.getRuntimeParameter()->isSelfInteraction()) { startRadius++; } // 近傍対戦 for (int r = startRadius, rMax = neighbors->size(); r < rMax; ++r) { for (auto& opponentWP : *(neighbors->at(r))) { auto opponent = opponentWP.lock(); if (opponent == nullptr) { // 近傍がいない場合終了 throw std::runtime_error("Could not find a neighbor of a player."); } // 対戦者の数を追加 neighborsCount++; payoffSum += payoffRow[static_cast<int>(opponent->getAction())]; } } double payoffAve = payoffSum / neighborsCount; // 利得を加える player->addScore(payoffAve); }
void QtWebKitWebWidget::pageLoadStarted() { m_isLoading = true; m_thumbnail = QPixmap(); if (m_actions.contains(RewindBackAction)) { getAction(RewindBackAction)->setEnabled(getAction(GoBackAction)->isEnabled()); } if (m_actions.contains(RewindForwardAction)) { getAction(RewindForwardAction)->setEnabled(getAction(GoForwardAction)->isEnabled()); } if (m_actions.contains(ReloadOrStopAction)) { QAction *action = getAction(ReloadOrStopAction); ActionsManager::setupLocalAction(action, QLatin1String("Stop")); action->setShortcut(QKeySequence()); action->setEnabled(true); } if (!isPrivate()) { SessionsManager::markSessionModified(); m_historyEntry = HistoryManager::addEntry(getUrl(), m_webView->title(), m_webView->icon(), m_isTyped); m_isTyped = false; } emit loadingChanged(true); emit statusMessageChanged(QString()); }
void DrumTools::drumNoteSelected(int val) { Element* element = drumPalette->element(val); if (element && element->type() == ElementType::CHORD) { Chord* ch = static_cast<Chord*>(element); Note* note = ch->downNote(); int ticks = MScore::defaultPlayDuration; int pitch = note->pitch(); seq->startNote(staff->part()->instrument()->channel(0)->channel(), pitch, 80, ticks, 0.0); int track = (_score->inputState().track() / VOICES) * VOICES + element->track(); _score->inputState().setTrack(track); _score->inputState().setDrumNote(pitch); getAction("voice-1")->setChecked(element->voice() == 0); getAction("voice-2")->setChecked(element->voice() == 1); getAction("voice-3")->setChecked(element->voice() == 2); getAction("voice-4")->setChecked(element->voice() == 3); auto pitchCell = drumPalette->cellAt(val); pitchName->setText(pitchCell->name); } }
void MuseScore::showSynthControl(bool val) { QAction* a = getAction("synth-control"); if (synthControl == 0) { synthControl = new SynthControl(this); synthControl->setScore(cs); connect(synti, SIGNAL(gainChanged(float)), synthControl, SLOT(setGain(float))); connect(synthControl, SIGNAL(gainChanged(float)), synti, SLOT(setGain(float))); connect(synthControl, SIGNAL(closed(bool)), a, SLOT(setChecked(bool))); if (mixer) connect(synthControl, SIGNAL(soundFontChanged()), mixer, SLOT(patchListChanged())); } synthControl->setVisible(val); }
HarmonyCanvas::HarmonyCanvas(QWidget* parent) : QFrame(parent) { setFrameStyle(QFrame::StyledPanel | QFrame::Raised); setAcceptDrops(true); setFocusPolicy(Qt::StrongFocus); extraMag = 3.0; chordDescription = 0; chordList = 0; moveElement = 0; QAction* a = getAction("delete"); addAction(a); connect(a, SIGNAL(triggered()), SLOT(deleteAction())); }
void ToolbarEditor::populateLists(const std::list<const char*>& all, std::list<const char*>* current) { actionList->clear(); availableList->clear(); for (auto i : *current) { QAction* a = getAction(i); QListWidgetItem* item; if (a) item = new QListWidgetItem(a->icon(), QString(i)); else item = new QListWidgetItem(QString(i)); item->setData(Qt::UserRole, QVariant::fromValue((void*)i)); actionList->addItem(item); } for (auto i : all) { bool found = false; for (auto k : *current) { if (strcmp(k, i) == 0) { found = true; break; } } if (!found) { QAction* a = getAction(i); QListWidgetItem* item; if (a) item = new QListWidgetItem(a->icon(), QString(i)); else item = new QListWidgetItem(QString(i)); item->setData(Qt::UserRole, QVariant::fromValue((void*)i)); availableList->addItem(item); } } QListWidgetItem* item = new QListWidgetItem(tr("spacer")); item->setData(Qt::UserRole, QVariant::fromValue((void*)"")); availableList->addItem(item); }
void BridgeVessel::completeNumericalDerivatives(){ unsigned nextra = myOutputAction->getNumberOfDerivatives() - getAction()->getNumberOfDerivatives(); Matrix<double> tmpder( myOutputValues->getNumberOfComponents(), nextra ); ActionWithVessel* vval=dynamic_cast<ActionWithVessel*>( myOutputAction ); for(unsigned i=0;i<nextra;++i){ vval->bridgeVariable=i; getAction()->calculate(); for(int j=0;j<myOutputValues->getNumberOfComponents();++j) tmpder(j,i) = myOutputValues->getOutputQuantity(j); } vval->bridgeVariable=nextra; getAction()->calculate(); plumed_assert( inum==mynumerical_values.size() ); inum=0; // Reset inum now that we have finished calling calculate std::vector<double> base( myOutputValues->getNumberOfComponents() ); for(int j=0;j<myOutputValues->getNumberOfComponents();++j) base[j] = myOutputValues->getOutputQuantity(j); const double delta=sqrt(epsilon); ActionAtomistic* aa=dynamic_cast<ActionAtomistic*>( getAction() ); unsigned nvals=myOutputValues->getNumberOfComponents(); for(unsigned j=0;j<nvals;++j) ( myOutputValues->copyOutput(j) )->clearDerivatives(); if( aa ){ ActionWithArguments* aarg=dynamic_cast<ActionWithArguments*>( getAction() ); plumed_assert( !aarg ); Tensor box=aa->getBox(); unsigned natoms=aa->getNumberOfAtoms(); for(unsigned j=0;j<nvals;++j){ double ref=( myOutputValues->copyOutput(j) )->get(); if( ( myOutputValues->copyOutput(j) )->getNumberOfDerivatives()>0 ){ for(unsigned i=0;i<3*natoms;++i){ double d=( mynumerical_values[i*nvals+j] - ref)/delta; ( myOutputValues->copyOutput(j) )->addDerivative(i,d); } Tensor virial; for(int i=0;i<3;i++) for(int k=0;k<3;k++){ virial(i,k)=( mynumerical_values[ nvals*(3*natoms + 3*i + k) + j ]-ref)/delta; } virial=-matmul(box.transpose(),virial); for(int i=0;i<3;i++) for(int k=0;k<3;k++) ( myOutputValues->copyOutput(j) )->addDerivative(3*natoms+3*k+i,virial(k,i)); } } } else { plumed_merror("not implemented or tested yet"); // unsigned nder=myOutputAction->getNumberOfDerivatives(); // for(unsigned j=0;j<nvals;++j){ // double ref=( myOutputValues->copyOutput(j) )->get(); // for(unsigned i=0;i<nder;++i){ // double d=( mynumerical_values[i*nvals+j] - ref)/delta; // ( myOutputValues->copyOutput(j) )->addDerivative(i,d); // } // } // } } // Add the derivatives wrt to the local quantities we are working with for(unsigned j=0;j<nvals;++j){ unsigned k=0; for(unsigned i=getAction()->getNumberOfDerivatives();i<myOutputAction->getNumberOfDerivatives();++i){ ( myOutputValues->copyOutput(j) )->addDerivative( i, (tmpder(j,k)-base[j])/sqrt(epsilon) ); k++; } } }
void resource::dispatch( const reactive::http::request& request_, const reactive::web::router::parameters& parameters_, reactive::http::response& response_ ) const { // call preDispatch preDispatch(request_, parameters_, response_); if (request_.isGet()) { getAction(request_, parameters_, response_); } else if (request_.isPost()) { postAction(request_, parameters_, response_); } else if (request_.isPut()) { putAction(request_, parameters_, response_); } else if (request_.isDelete()) { deleteAction(request_, parameters_, response_); } else if (request_.isOptions()) { optionsAction(request_, parameters_, response_); } else if (request_.isTrace()) { traceAction(request_, parameters_, response_); } else if (request_.isPatch()) { patchAction(request_, parameters_, response_); } else if (request_.isConnect()) { connectAction(request_, parameters_, response_); } else { response_.setStatusCode(reactive::http::status::METHOD_NOT_ALLOWED); } // call postDispatch postDispatch(request_, parameters_, response_); }
bool Actions::UseItemEx(Player* player, const Position &from_pos, const unsigned char from_stack,const Position &to_pos, const unsigned char to_stack,const unsigned short itemid) { if(canUse(player,from_pos) == TOO_FAR){ player->sendCancel("Too far away."); return false; } Item *item = dynamic_cast<Item*>(game->getThing(from_pos,from_stack,player)); if(!item) return false; if(item->getID() != itemid) return false; if(!item->isUseable()) return false; Action *action = getAction(item); if(action){ if(action->allowFarUse() == false){ if(canUse(player,to_pos) == TOO_FAR){ player->sendCancel("Too far away."); return false; } } else if(canUseFar(player, to_pos, action->blockWalls()) == TOO_FAR){ player->sendCancel("Too far away."); return false; } else if(canUseFar(player, to_pos, action->blockWalls()) == CAN_NOT_THTOW){ player->sendCancel("You cannot throw there."); return false; } Position itempos = game->getThingMapPos(player, from_pos); game->autoCloseTrade(item); PositionEx posFromEx(from_pos,from_stack); PositionEx posToEx(to_pos,to_stack); if(action->executeUse(player,item,posFromEx,posToEx)) return true; } //not found player->sendCancel("You can not use this object."); return false; }
TextLayer::TextLayer(void) { initWithColor( ccc4(32,128,32,255) ); CCNode* node = CCNode::create(); CCActionInterval* effect = getAction(); node->runAction(effect); addChild(node, 0, kTagBackground); CCSprite *bg = CCSprite::create(s_back3); node->addChild(bg, 0); // bg->setAnchorPoint( CCPointZero ); bg->setPosition(VisibleRect::center()); CCSprite* grossini = CCSprite::create(s_pPathSister2); node->addChild(grossini, 1); grossini->setPosition( ccp(VisibleRect::left().x+VisibleRect::getVisibleRect().size.width/3,VisibleRect::center().y) ); CCActionInterval* sc = CCScaleBy::create(2, 5); CCActionInterval* sc_back = sc->reverse(); grossini->runAction( CCRepeatForever::create(CCSequence::create(sc, sc_back, NULL) ) ); CCSprite* tamara = CCSprite::create(s_pPathSister1); node->addChild(tamara, 1); tamara->setPosition( ccp(VisibleRect::left().x+2*VisibleRect::getVisibleRect().size.width/3,VisibleRect::center().y) ); CCActionInterval* sc2 = CCScaleBy::create(2, 5); CCActionInterval* sc2_back = sc2->reverse(); tamara->runAction( CCRepeatForever::create(CCSequence::create(sc2, sc2_back, NULL)) ); CCLabelTTF* label = CCLabelTTF::create((effectsList[actionIdx]).c_str(), "Marker Felt", 32); label->setPosition( ccp(VisibleRect::center().x,VisibleRect::top().y-80) ); addChild(label); label->setTag( kTagLabel ); CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, this, menu_selector(TextLayer::backCallback) ); CCMenuItemImage *item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, this, menu_selector(TextLayer::restartCallback) ); CCMenuItemImage *item3 = CCMenuItemImage::create(s_pPathF1, s_pPathF2, this, menu_selector(TextLayer::nextCallback) ); CCMenu *menu = CCMenu::create(item1, item2, item3, NULL); menu->setPosition(CCPointZero); item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2)); item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); addChild(menu, 1); schedule( schedule_selector(TextLayer::checkAnim) ); }
// this is the regular routine to be used to generate IR for a method void TranslatorSession::translate() { CompilationContext* cc = getCompilationContext(); IRManager* irm = cc->getHIRManager(); assert(irm); irm->getTypeManager().setLazyResolutionMode(flags.lazyResolution); MethodDesc& methodDesc = irm->getMethodDesc(); //create IRBuilder MemoryManager& mm = cc->getCompilationLevelMemoryManager(); TranslatorAction* myAction = (TranslatorAction*)getAction(); IRBuilder* irb = (IRBuilder*)myAction->getIRBuilderAction()->createSession(mm); irb->setCompilationContext(cc); MemoryManager tmpMM("IRBuilder::tmpMM"); irb->init(irm, &flags, tmpMM); JavaTranslator::translateMethod(*cc->getVMCompilationInterface(), methodDesc, *irb); }
void MuseScore::showInspector(bool visible) { QAction* a = getAction("inspector"); if (visible) { if (!inspector) { inspector = new Inspector(); connect(inspector, SIGNAL(inspectorVisible(bool)), a, SLOT(setChecked(bool))); addDockWidget(Qt::RightDockWidgetArea, inspector); } updateInspector(); } if (inspector) inspector->setVisible(visible); a->setChecked(visible); }
/// Downgrade/Upgrade/Obsoleting -> Downgrade/Upgrade = Downgrade/Upgrade/Reinstall void MergedTransactionTest::testMergeAlterAlter() { auto merged = prepareMergedTransaction(conn, TransactionItemAction::DOWNGRADE, TransactionItemAction::UPGRADE, "1.0.0", "1.0.1", TransactionItemAction::DOWNGRADED, "1.0.1"); auto items = merged->getItems(); CPPUNIT_ASSERT_EQUAL(1, (int)items.size()); auto item = items.at(0); CPPUNIT_ASSERT_EQUAL(TransactionItemAction::REINSTALL, item->getAction()); }
double StoreDataVessel::chainRule( const unsigned& ival, const unsigned& ider, const std::vector<double>& df ){ plumed_dbg_assert( getAction()->derivativesAreRequired() && df.size()==vecsize ); // Clear final derivatives array final_derivatives.assign( final_derivatives.size(), 0.0 ); double dfout = 0.0; if(getAction()->lowmem){ plumed_dbg_assert( ival<max_lowmem_stash ); unsigned maxder = getAction()->getNumberOfDerivatives(); unsigned ibuf=ival*(vecsize*maxder) + ider; for(unsigned icomp=0;icomp<vecsize;++icomp){ dfout+=df[icomp]*local_derivatives[ibuf]; ibuf+=maxder; } } else { plumed_dbg_assert( ival<getAction()->getFullNumberOfTasks() ); unsigned ibuf=ival*(vecsize*nspace) + 1 + ider; for(unsigned icomp=0;icomp<vecsize;++icomp){ dfout+=df[icomp]*getBufferElement(ibuf); ibuf+=nspace; } } return dfout; }
bool ShortcutsHandler::removeAction( const QString &id ) { QAction *action = getAction( id ); if (!action) { return false; } else { // This will delete the action. _actions->removeAction(action); return true; } }
bool BridgeVessel::applyForce( std::vector<double>& outforces ){ bool hasforce=false; outforces.assign(outforces.size(),0.0); unsigned ndertot = myOutputAction->getNumberOfDerivatives(); unsigned nextra = ndertot - getAction()->getNumberOfDerivatives(); std::vector<double> forces( ndertot ), eforces( nextra, 0.0 ); for(unsigned i=0;i<myOutputAction->getNumberOfVessels();++i){ if( ( myOutputAction->getPntrToVessel(i) )->applyForce( forces ) ){ hasforce=true; for(unsigned j=0;j<outforces.size();++j) outforces[j]+=forces[j]; for(unsigned j=0;j<nextra;++j) eforces[j]+=forces[ outforces.size()+j ]; } } if(hasforce) myOutputAction->applyBridgeForces( eforces ); return hasforce; }
// returns -1 for lose, 1 for win, 0 for N/A int Caveman::provoke(Caveman& otherCaveman) { getAction(actionHistory.length() ? (actionHistory + "," + otherCaveman.actionHistory) : ""); otherCaveman.getAction(actionHistory.length() ? (otherCaveman.actionHistory + "," + actionHistory) : ""); actionHistory += lastAction == '^' ? 'P' : lastAction; otherCaveman.actionHistory += otherCaveman.lastAction == '^' ? 'P' : otherCaveman.lastAction; maybeSharpen(); otherCaveman.maybeSharpen(); maybePoke(otherCaveman); otherCaveman.maybePoke(*this); if (dead) return -1; if (otherCaveman.dead) return 1; return 0; }
ConvolutionMatrixEditor::~ConvolutionMatrixEditor() { QAction* pWindowAction = getAction(); if (pWindowAction != NULL) { MenuBar* pMenuBar = Service<DesktopServices>()->getMainMenuBar(); if (pMenuBar != NULL) { pMenuBar->removeMenuItem(pWindowAction); } if (Service<DesktopServices>()->getMainWidget() != NULL) { delete pWindowAction; } } }
void MainGameLayer::runDamagedEffect() { if(!isRunningEffect) { isRunningEffect = true; ActionInterval* effect = getAction(); auto repEffect = Repeat::create(effect, 1); auto backToDefault = CallFuncN::create( CC_CALLBACK_1(MainGameLayer::backToDefaultGrid, this) ); runAction(Sequence::create(repEffect, backToDefault, NULL)); // sound Sound::playAlienAttackEffect(); } }
AnnotationImagePalette::~AnnotationImagePalette() { QAction* pWindowAction = getAction(); if (pWindowAction != NULL) { MenuBar* pMenuBar = Service<DesktopServices>()->getMainMenuBar(); if (pMenuBar != NULL) { pMenuBar->removeMenuItem(pWindowAction); } if (Service<DesktopServices>()->getMainWidget() != NULL) { delete pWindowAction; } } }