当前位置: 首页>>代码示例>>C++>>正文


C++ EventQueue::front方法代码示例

本文整理汇总了C++中EventQueue::front方法的典型用法代码示例。如果您正苦于以下问题:C++ EventQueue::front方法的具体用法?C++ EventQueue::front怎么用?C++ EventQueue::front使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EventQueue的用法示例。


在下文中一共展示了EventQueue::front方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: processQueue

void InputService::processQueue(EventQueue& queue)
{
	// Send events which are piled on queue so far
	size_t numEvents = queue.size(); // TODO: Do we have to limit by numEvents?

	while (!queue.empty())
	{
		EventEntry& e = queue.front();

		EventId id = e.eventID;
		Ref<InputEvent> evt = e.event;
		queue.pop_front();

		if (evt && evt->isConsumed())
			continue;

		EventChannel* channel = e.channel;
		if (channel)
		{
			// If channel specified on post : Send to that channel
			channel->send(id, evt);
			continue;
		}

		// When channel not specified: broadcast upward from source channel

		if (evt == NULL)
			continue; // Can't handle event with no channel specified.

		// 1. Broadcast to source channel
		Ref<InputSource> source = evt->getSource();
		if (source && source->hasChannel())
		{
			source->channel()->send(id, evt);
			if (evt->isConsumed() || !evt->isUplinking())
				continue;
		}

		// 2. Broadcast to device channel
		Weak<InputDevice> device = evt->getDevice();
		if (device && device->hasChannel())
		{
			device->channel()->send(id, evt);
			if (evt->isConsumed() || !evt->isUplinking())
				continue;
		}

		// 3. Broadcast to user channel
		Ref<InputUser> user = evt->getUser();

		if (user && user->hasChannel())
		{
			user->channel()->send(id, evt);
			if (evt->isConsumed() || !evt->isUplinking())
				continue;
		}

		// TODO: 4. Broadcast to service channel?
	}
}
开发者ID:noriter,项目名称:nit,代码行数:60,代码来源:InputService.cpp

示例2: ___updateEventQueue

	bool ___updateEventQueue(TimeType t, TimeType & currTime, EventQueue & eventQueue)
	{
		currTime += t;
		if(eventQueue.empty())
			return false;

		
		if(currTime >= eventQueue.front().first)
		{
			eventQueue.front().second();
			eventQueue.pop();
			currTime = 0.0f;
		}
		
		return true;
	
	}
开发者ID:dbabox,项目名称:aomi,代码行数:17,代码来源:NewGameComponentsPrecompiledHeaders.cpp

示例3: eventThread

  void AbstractDevice::eventThread() {
    ADR_GUARD("AbstractDevice::eventThread");
    m_thread_exists = true;
    while (!m_thread_should_die) {
      m_event_mutex.lock();
      while (m_events.empty()) {
        m_events_available.wait(m_event_mutex, 1);
        if (m_thread_should_die) {
          break;
        }
      }
      if (m_thread_should_die) {
        m_event_mutex.unlock();
        break;
      }

      // Make a local copy of the events so they can be processed without
      // leaving the mutex locked.
      EventQueue events = m_events;

      // Queues don't support clear().  o_o
      while (!m_events.empty()) {
        m_events.pop();
      }

      m_event_mutex.unlock();

      // Process the events.
      while (!events.empty()) {
        EventPtr event = events.front();
        events.pop();
        processEvent(event.get());
      }
    }
    m_thread_exists = false;
  }
开发者ID:vancegroup,项目名称:Audiere,代码行数:36,代码来源:device.cpp


注:本文中的EventQueue::front方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。