void idlewait(Renderer* renderer, Window& window, Callback cb) { EventData e; while (true) { event::wait(e); cb(e); if (e.type() == EventType::Quit) { break; } else if (e.type() == EventType::Window) { auto p = e.acquire<EventType::Window>(); switch (p.getID()) { case SDL_WINDOWEVENT_EXPOSED: if (renderer) { renderer->present(); } else { window.update(); } if (maxmin) { maxmin = true; window.restore(); } break; case SDL_WINDOWEVENT_MAXIMIZED: case SDL_WINDOWEVENT_MINIMIZED: maxmin = true; break; default: break; } } } }
ReturnType KinectComp::SendEvent( const KinectEvent& event ) { EventData<KinectEvent> eventData; eventData.setId("KinectEvent"); eventData.setContentData(event); return mKinectOutputEvent.push(&eventData); }
void EventsWindow::showEvent(const QModelIndex &index) { EventData *data = index.data(EventsModel::EventDataPtr).value<EventData*>(); showEvent(*data); m_modelEventsCursor->setCameraFilter(data->locationCamera()); m_modelEventsCursor->setIndex(index.row()); }
//Process possible events bool BodyChainAgent::HandleEvent(const EventData& data) { bool eventprocessed(false); if(!mActive) return false; //IF - A Monkey attached if(data.GetEventType() == Event_MonkeyAttached) { const MonkeyAttachedEvent& eventdata (static_cast<const MonkeyAttachedEvent&>(data)); //IF - Attached to this agent if(eventdata.GetAgentId() == mId) { //Find branch (bodychain) BodyChain::BodyChainListIterator itr; std::string bodychainid (eventdata.GetBodyChainId()); //LOOP - Find the affected bodychain list for(itr = mParams.bodychainlist.begin();itr != mParams.bodychainlist.end();++itr) { //IF - Found if((*itr)->GetId() == bodychainid) { (*itr)->IncrementAttached(); }//IF }//LOOP }//IF }//ELSE - A Monkey detached else if(data.GetEventType() == Event_MonkeyDetached) { const MonkeyDetachedEvent& eventdata (static_cast<const MonkeyDetachedEvent&>(data)); //IF - Attached to this agent if(eventdata.GetAgentId() == mId) { //Find branch (bodychain) BodyChain::BodyChainListIterator itr; std::string bodychainid (eventdata.GetBodyChainId()); //LOOP - Find the affected bodychain list for(itr = mParams.bodychainlist.begin();itr != mParams.bodychainlist.end();++itr) { //IF - Found if((*itr)->GetId() == bodychainid) { (*itr)->DecrementAttached(); }//IF }//LOOP }//IF }//IF return eventprocessed; }
/*---------------------------------------------------------------------*//** シリアライズ **//*---------------------------------------------------------------------*/ bool StoryManager::serialize(Serializer* ser) const { // 実行中の Act イベント ID を得る u16 evidActing = 0; EventData* evdat = Game::getGame()->getEventSys()->getEventData(); ASSERT(evdat != 0L); for(int imat = 0; imat < evdat->getEventMatterNum(); imat++) { EventMatter* matterWk = evdat->getEventMatter(imat); if((matterWk->getMatterType() == EMTYPE_ACT) && matterWk->isBegin()) // 開始済み ActMatter 判定 { evidActing = matterWk->getEvId(); } } // ストーリーの保存 if(ser->isStructureMode()) // ストラクチャモード { SaveStructure* svst = (SaveStructure*)ser->getStructure(); svst->_gamesvst._storyid = _storyid; // ストーリー ID の書き込み svst->_gamesvst._isPlayedStoryStartupEvent = _isPlayedStoryStartupEvent; // ストーリー開始イベント起動フラグの書き込み svst->_gamesvst._evidActing = evidActing; // 実行中の Act イベント ID の書き込み } else // ダイレクトモード { ser->store(&_storyid); // ストーリー ID の書き込み ser->store(&_isPlayedStoryStartupEvent); // ストーリー開始イベント起動フラグの書き込み ser->store(&evidActing); // 実行中の Act イベント ID の書き込み } // 配置オブジェクトの状態を保存する if(ser->isStructureMode()) // ストラクチャモード { SaveStructure* svst = (SaveStructure*)ser->getStructure(); if(!svst->storePlacementObjData(_listPlaceObj)) { return false; } } else // ダイレクトモード { s32 numPobj = _listPlaceObj->getCount(); ser->store(&numPobj); for(ListIterator<PlacementObj*> it = _listPlaceObj->iterator(); it.has(); it.next()) { const PlacementObj* pobj = it.object(); pobj->serialize(ser); } } // ワールドマップのシリアライズ _wmap->serialize(ser); return true; }
/*---------------------------------------------------------------------*//** 動作停止 **//*---------------------------------------------------------------------*/ void Mcut::stop(ActMatter* owner) { EventData* evdat = owner->getEventSystemRefer()->getEventData(); ASSERT(evdat != 0L); // マターを削除する if(_evid != 0) { evdat->removeMatter(_evid); _evid = 0; } Act::stop(owner); }
bool EventSnooper::handleEvent(EventData const &eventData) { #ifdef _DEBUG if (mOutFile) { fprintf_s(mOutFile, "Event Snoop: Event %p Time: %f Type: %s \n", &eventData, eventData.getTimeStamp(), eventData.getEventType().getStr().c_str()); } DEBUG_MESSAGE("Event Snoop: Event " << &eventData << " Time: " << eventData.getTimeStamp() << " type: " << eventData.getEventType().getStr()); #endif return false; }
/*---------------------------------------------------------------------*//** 動作開始 **//*---------------------------------------------------------------------*/ void ScrEff::play(ActMatter* owner) { EventData* evdat = owner->getEventSystemRefer()->getEventData(); ASSERT(evdat != 0L); // スクリーンエフェクト開始 _evid = evdat->addChildMatter(owner->getEvId(), "SCREFF"); ASSERT(_evid != 0); ScrEffMatter* matter = (ScrEffMatter*)evdat->getMatterFromEvid(_evid); ASSERT(matter != 0L); matter->setting(&_setting); // 動作設定 // イベント開始 EvCause evcause(EventCause::CID_ACT); owner->getEventSystemRefer()->begin(_evid, owner->getBeginParam(), &evcause); Act::play(owner); }
/*---------------------------------------------------------------------*//** 動作開始 **//*---------------------------------------------------------------------*/ void Mcut::play(ActMatter* owner) { EventData* evdat = owner->getEventSystemRefer()->getEventData(); ASSERT(evdat != 0L); // ムービーカット定義開始 _evid = evdat->addChildMatter(owner->getEvId(), "MOVIECUT"); ASSERT(_evid != 0); MovieCutMatter* vfmatter = (MovieCutMatter*)evdat->getMatterFromEvid(_evid); ASSERT(vfmatter != 0L); vfmatter->setting(&_setting); // 動作設定 // イベント開始 EvCause evcause(EventCause::CID_ACT); owner->getEventSystemRefer()->begin(_evid, owner->getBeginParam(), &evcause); Act::play(owner); }
/*---------------------------------------------------------------------*//** 動作停止 **//*---------------------------------------------------------------------*/ void Msg::stop(ActMatter* owner) { EventData* evdat = owner->getEventSystemRefer()->getEventData(); ASSERT(evdat != 0L); // メッセージを終了する TalkMatter* matter = (TalkMatter*)evdat->getMatterFromEvid(_evid); ASSERT(matter != 0L); matter->terminate(); // マターを削除する // evdat->removeMatter(_evid); Act::stop(owner); }
/*---------------------------------------------------------------------*//** ユーザー操作 **//*---------------------------------------------------------------------*/ bool EventMovieFront::operationToEvent(EventOp eop) { EventSys* evsys = Game::getGame()->getEventSys(); ASSERT(evsys != 0L); if((eop == EOP_PAUSE) || (eop == EOP_PLAY)) { evsys->setEventPause(eop == EOP_PAUSE); return true; } bool is = false; // 現在駆動している全ての Act に送信する ActMatter* actm = 0L; EventData* evdat = evsys->getEventData(); ASSERT(evdat != 0L); for(s32 i = 0; i < evdat->getEventMatterNum(); i++) { EventMatter* matter = evdat->getEventMatter(i); if(matter->getMatterType() == EMTYPE_ACT) // ActMatter 判定 { if(((ActMatter*)matter)->isBegin()) // 実行中かどうか判定 { actm = (ActMatter*)matter; switch(eop) { case EOP_SKIP: actm->skip(); // スキップを行う is = true; break; case EOP_ENDWAIT: if(actm->isWaitMovieMsg()) // ムービー台詞待ち中 { actm->doneWaitMovieMsg(); // 台詞待ちを終了する is = true; } break; case EOP_CHECKSKIP: if(actm->checkValidSkip()) { is = true; // 一つでもスキップ可能なら可とする } break; } } } } return is; }
//Process possible events bool CollectableAgent::HandleEvent(const EventData& data) { bool eventprocessed = false; //Collectable receives event of being collected //IF - "Drop Collected event" if(data.GetEventType() == Event_DropCollision) { //Check if this was collected const DropCollidedEvent& theevent = static_cast<const DropCollidedEvent&>(data); //IF - Pointers match if(theevent.GetCollectedAgent() == this && !mCollected) { //Drop collected! //Destroy body mPhysicsManager->DestroyBody(mParams.physicbody); mCollected = true; //Memorize collected //Send event as drop was collected SingletonGameEventMgr::Instance()->QueueEvent( EventDataPointer(new EventData(Event_DropCollected)) ); } }//IF return eventprocessed; }
//during quali and free practice - gap for all laps is calculated to the best session time void DriverData::updateGaps(const EventData &ed) { for (int i = 0; i < lapData.size(); ++i) lapData[i].gap = QString::number((lapData[i].lapTime - ed.getSessionRecords().getFastestLap().getTime()).toDouble()); }
//Events plugin bool StateMachine_MadMonkey::HandleEvent(const EventData& data) { bool eventprocessed(false); //IF - Exists state if(mCurrentState) { //Process overall state change //IF - A branch broke if(data.GetEventType() == Event_BranchBroke) { const BranchBrokeEvent& eventdata (static_cast<const BranchBrokeEvent&>(data)); //IF - The target was this branch if(mTargetBodyChainId == eventdata.GetBodyChainId() && mTargetAgentId == eventdata.GetAgentId()) { //Reset state to search, as this branch is broken to hang mActor->ChangeState("Search"); //Detach from Point mActor->DetachFromPoint(); }//IF } //Forward event to current state return(eventprocessed || mCurrentState->HandleEvent(data)); } //No state defined return eventprocessed; }
bool MainMenuState::handleEvent( const EventData& theevent ) { if(theevent.getEventType() == Event_NewGame) { Game::getInstance()->setNextStateType(State_Loading); m_endState = true; } if(theevent.getEventType() == Event_Credits) { Game::getInstance()->setNextStateType(State_Credits); m_endState = true; } return false; }
EXPORT void Send(string type, EventData data) { EventData::iterator dIter; Sync::DataValue value; Sync::DataItem item; for (dIter = data.begin(); dIter != data.end(); dIter++) { value[dIter->first] = dIter->second; } item[type] = value; Sync::Client::Send(item); }
/*---------------------------------------------------------------------*//** 動作開始 **//*---------------------------------------------------------------------*/ void TexFacial::play(ActMatter* owner) { EventData* evdat = owner->getEventSystemRefer()->getEventData(); ASSERT(evdat != 0L); // スプライト表示 _evid = evdat->addChildMatter(owner->getEvId(), "TEXFACIAL"); ASSERT(_evid != 0); TexFacialMatter* matter = (TexFacialMatter*)evdat->getMatterFromEvid(_evid); ASSERT(matter != 0L); matter->setting(&_setting); // 動作設定 // イベント開始 EvCause evcause(EventCause::CID_ACT); owner->getEventSystemRefer()->begin(_evid, owner->getBeginParam(), &evcause); Game::getGame()->setWaitFrame(); // ゲームへ読み込み負荷のためのウェイトフレーム設定 Act::play(owner); }
/*---------------------------------------------------------------------*//** 動作開始 **//*---------------------------------------------------------------------*/ void Rtmv::play(ActMatter* owner) { EventData* evdat = owner->getEventSystemRefer()->getEventData(); ASSERT(evdat != 0L); // リアルタイムムービーを再生する _evid = evdat->addChildMatter(owner->getEvId(), "RTMOVIE"); ASSERT(_evid != 0); RealtimeMovieMatter* matter = (RealtimeMovieMatter*)evdat->getMatterFromEvid(_evid); ASSERT(matter != 0L); matter->setting(_fileid); // 動作設定 // イベント開始 EvCause evcause(EventCause::CID_ACT); owner->getEventSystemRefer()->begin(_evid, owner->getBeginParam(), &evcause); Game::getGame()->setWaitFrame(); // ゲームへ読み込み負荷のためのウェイトフレーム設定 Act::play(owner); }
void EventTriggerHandler::accept(EventData& event) { if(event.validate(eventSequence.front())) { callback(); } }
virtual void onEvent(const EventData& e) { if (e.type == EventData::Trace) { fprintf(stderr, "TRACE source %d\n", e.sourceId); } else if (e.type == EventData::Untrace) { fprintf(stderr, "UNTRACE source %d\n", e.sourceId); } else if (e.type == EventData::Update) { if (e.serviceType == EventData::ServiceTypeMocap) // Mocap (head I guess fprintf(stderr, "MOCAP source %d type %d device %d\n", e.sourceId, e.type, e.deviceTag); if (e.serviceType == EventData::ServiceTypeWand) // Wand fprintf(stderr, "Wand source %d type %d device %d\n", e.sourceId, e.type, e.deviceTag); fprintf(stderr, " pos(%6.3f %6.3f %6.3f)\n", e.posx, e.posy, e.posz); fprintf(stderr, " rot(%6.3f %6.3f %6.3f %6.3f)\n", e.orx, e.ory, e.orz, e.orw); fprintf(stderr, " flag: %d\n", e.flags); fprintf(stderr, " extra type: %d\n", e.extraDataType); fprintf(stderr, " extra items: %d\n", e.extraDataItems); fprintf(stderr, " extra mask: %d\n", e.extraDataMask); if (e.extraDataItems) { if (e.extraDataType == EventData::ExtraDataFloatArray) { //array of floats float *ptr = (float*)(e.extraData); for (int k=0;k<e.extraDataItems;k++) { fprintf(stderr, " val %2d: [%6.3f]\n", k, ptr[k]); } } else if (e.extraDataType == EventData::ExtraDataVector3Array) { //array of floats float val[3]; //float *ptr = (float*)(e.extraData); for (int k = 0; k < e.extraDataItems; k++) { e.getExtraDataVector3(k, val); fprintf(stderr, " val %2d: [%6.3f, %6.3f, %6.3f]\n", k, val[0], val[1], val[2]); } } } fprintf(stderr, "-----------\n"); } else if (e.type == EventData::Down) { //fprintf(stderr, "EVENT down: %d\n", mButton(e.flags)); } else if (e.type == EventData::Up) { fprintf(stderr, "EVENT up: %d type: %d\n", e.sourceId, e.type); fprintf(stderr, " flag: %d\n", e.flags); fprintf(stderr, " extra: %d\n", e.extraDataType); fprintf(stderr, " items: %d\n", e.extraDataItems); fprintf(stderr, " mask: %d\n", e.extraDataMask); fprintf(stderr, "-----------\n"); } }
void* EpollServer::threadedServe(void *arg) { EpollServer *pes = (EpollServer*) arg; while (true) { while (!pes->_eventQueue.empty()) { EventData eventData = pes->_eventQueue.front(); pes->_ZProcessor->process(eventData.fd(), eventData.buf(), eventData.fromaddr()); pes->_eventQueue.pop(); } } }
EventData* Event::Start(const EventDescription& description) { EventData* result = nullptr; if (EventStorage* storage = Core::storage) { result = &storage->NextEvent(); result->description = &description; result->Start(); if (description.isSampling) { AtomicIncrement(&storage->isSampling); } } return result; }
/*---------------------------------------------------------------------*//** 動作開始 **//*---------------------------------------------------------------------*/ void Msg::play(ActMatter* owner) { EventData* evdat = owner->getEventSystemRefer()->getEventData(); ASSERT(evdat != 0L); // メッセージを表示する _evid = evdat->addChildMatter(owner->getEvId(), "TALK"); ASSERT(_evid != 0); TalkMatter* matter = (TalkMatter*)evdat->getMatterFromEvid(_evid); ASSERT(matter != 0L); matter->setting(&_setting, evdat->getMsgDataSet()); // 動作設定 // イベント開始 EvCause evcause(EventCause::CID_ACT); owner->getEventSystemRefer()->begin(_evid, owner->getBeginParam(), &evcause); Act::play(owner); }
size_t BinnedPdf::FindBin(const EventData& data_) const{ try{ return fHistogram.FindBin(data_.ToRepresentation(fDataRep)); } catch (const DimensionError& e_){ throw RepresentationError(std::string("Representation in compatible with pdf ") + e_.what()); } }
void BinnedPdf::Fill(const EventData& data_, double weight_){ try{ fHistogram.Fill(data_.ToRepresentation(fDataRep), weight_); } catch (const DimensionError& e_){ throw RepresentationError(std::string("Representation in compatible with pdf ") + e_.what()); } }
void Enemy::handleEventId(EventData const &eventMessage) { if(EvtData_To_EnemyUpdateHp::mEventType == eventMessage.getEventType()) { const EvtData_To_EnemyUpdateHp& evtData = static_cast<const EvtData_To_EnemyUpdateHp&>(eventMessage); mHealthPoints -= evtData.mDamage; } else Actor::handleEventId(eventMessage); }
void Event::Stop(EventData& data) { data.Stop(); if (data.description->isSampling) { if (EventStorage* storage = Core::storage) AtomicDecrement(&storage->isSampling); } }
void DriverData::addLap(const EventData &ed) { if (ed.getEventType() == LTPackets::RACE_EVENT) { addRaceLap(ed); } else { addFPQLap(ed); } }
void EventHandler::accept(EventData& event) { if(!complete() && event.validate(eventSequence.front())) { eventSequence.pop(); if(complete()) { callback(); } } }
void EventsWindow::showEvent(const EventData &eventData) { if (!eventData.hasMedia()) return; m_eventViewer->setEvent(eventData); /* Hack to ensure that the video area isn't collapsed */ if (m_videoSplitter->sizes()[1] == 0) m_videoSplitter->setSizes(QList<int>() << m_videoSplitter->sizes()[0] << 1); m_eventViewer->show(); }