Ejemplo n.º 1
0
void BasicIOServiceRunner::_runIOService( void ) {
    // Before running the IO service, wait to be told to start.
    {
        boost::unique_lock<boost::mutex> ioStartLock( m_ioStartMutex );
        m_ioStartCondition.wait( ioStartLock );
    }

    // Okay, go!
    preStart();
    m_ioService.run();
}
Ejemplo n.º 2
0
PixmapAnimation* PixmapAnimation::GetPixmapAnimation(QGraphicsItem *parent, const QString &emotion)
{
    PixmapAnimation *pma = new PixmapAnimation();
    pma->setPath(QString("image/system/emotion/%1/").arg(emotion));
    if(pma->valid())
    {
        if(emotion == "no-success")
        {
            pma->moveBy(pma->boundingRect().width()*0.15,
                        pma->boundingRect().height()*0.15);
            pma->setScale(0.7);
        }

        else if(emotion.contains("DoubleSword"))
        {
            pma->moveBy(13, -85);
            pma->setScale(1.3);
        }

        else if(emotion.contains("Fan") || emotion.contains("GudingBlade"))
        {
            pma->moveBy(-30, -80);
            pma->setScale(1.3);
        }

        else if(emotion.contains("/spear"))
        {
            pma->moveBy(-90, -80);
            pma->setScale(1.3);
        }

        pma->moveBy((parent->boundingRect().width() - pma->boundingRect().width())/2,
                    (parent->boundingRect().height() - pma->boundingRect().height())/2);

        pma->setParentItem(parent);
        pma->setZValue(20002.0);
        if(emotion.contains("weapon")){
            pma->hide();
            QTimer::singleShot(750, pma, SLOT(preStart()));
        }
        else
            pma->startTimer(S_DEFAULT_INTERVAL);

        connect(pma, SIGNAL(finished()), pma, SLOT(deleteLater()));
        return pma;
    }
    else
    {
        delete pma;
        return NULL;
    }
}
void CGeneticStrategyCLv2::setMaps( std::vector<CMapPtr> maps )
{
	getFitnesFunctor()->setMaps(maps);
    this->maps = maps;

    size_t mapSize = 2 + maps[0]->width()*maps[0]->height();
    size_t mapSizes = N*M*( mapSize );
    mapBufCL = cl::Buffer( context, CL_MEM_READ_WRITE, mapSizes*4 );
    mapCL = cl::Buffer( context, CL_MEM_READ_ONLY, mapSize*4 );
    mapsBuffer = (int*)malloc( mapSize*4 );
    maps[0]->toIntBuffer( mapsBuffer );
    sizes[2] = mapSize;

    preStart();
}
PixmapAnimation *PixmapAnimation::GetPixmapAnimation(QGraphicsItem *parent, const QString &emotion) {
    PixmapAnimation *pma = new PixmapAnimation(parent);
    pma->setPath(QString("image/system/emotion/%1/").arg(emotion));
    if (pma->valid()) {
        //ÎäÆ÷¶¯»­ÏÔʾλÖÃÍùÓÒϽÇÒÆÒ»µã£¬ÒÔÃâÓë"ɱ"µÄ¶¯»­Î»ÖÃÖصþ
        if (emotion.startsWith("weapon/")) {
            pma->moveBy(30, 50);
        }

        if (emotion == "no-success") {
            pma->moveBy(pma->boundingRect().width() * 0.25,
                        pma->boundingRect().height() * 0.25);
            pma->setScale(0.5);
        } else if (emotion == "success") {
            pma->moveBy(pma->boundingRect().width() * 0.1,
                        pma->boundingRect().height() * 0.1);
            pma->setScale(0.8);
        } else if (emotion.contains("double_sword"))
            pma->moveBy(13, -20);
        else if (emotion.contains("fan") || emotion.contains("guding_blade"))
            pma->moveBy(0, -20);
        else if (emotion.contains("/spear"))
            pma->moveBy(-20, -20);

        pma->moveBy((parent->boundingRect().width() - pma->boundingRect().width()) / 2,
                    (parent->boundingRect().height() - pma->boundingRect().height()) / 2);

        pma->setZValue(20002.0);
        if (emotion.contains("weapon")) {
            pma->hide();
            QTimer::singleShot(300, pma, SLOT(preStart()));
        }
        else {
            if (emotion == "no-success" || emotion == "no-success") {
                pma->startTimer(S_DEFAULT_INTERVAL * 0.7);
            }
            else {
                pma->startTimer(S_DEFAULT_INTERVAL);
            }
        }

        connect(pma, SIGNAL(finished()), pma, SLOT(deleteLater()));
        return pma;
    } else {
        delete pma;
        return NULL;
    }
}
Ejemplo n.º 5
0
void
KGpgTransaction::start()
{
	d->m_inputProcessResult = false;
	d->m_inputProcessDone = (d->m_inputTransaction == Q_NULLPTR);

	setSuccess(TS_OK);
	d->m_idhints.clear();
	d->m_tries = 3;
	if (preStart()) {
		d->m_ownProcessFinished = false;
		if (d->m_inputTransaction != Q_NULLPTR)
			d->m_inputTransaction->start();
#ifdef KGPG_DEBUG_TRANSACTIONS
		qCDebug(KGPG_LOG_TRANSACTIONS) << this << d->m_process->program();
#endif /* KGPG_DEBUG_TRANSACTIONS */
		d->m_process->start();
		emit infoProgress(0, 1);
	} else {
		emit done(d->m_success);
	}
}
Ejemplo n.º 6
0
void ActorCell::start() {
    preStart();
    mailbox_->start();
}