本文整理汇总了C++中pushEvent函数的典型用法代码示例。如果您正苦于以下问题:C++ pushEvent函数的具体用法?C++ pushEvent怎么用?C++ pushEvent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pushEvent函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: doGetMouseTargetableHandler
bool UserInputListener::fireMouseButtonReleased( MouseButton p_button )
{
bool result = false;
if ( doHasHandlers() )
{
m_mouse.m_buttons[size_t( p_button )] = false;
m_mouse.m_changed = p_button;
auto current = doGetMouseTargetableHandler( m_mouse.m_position );
if ( current )
{
current->pushEvent( MouseEvent( MouseEventType::eReleased, m_mouse.m_position, p_button ) );
result = true;
m_activeHandler = current;
}
else
{
auto active = m_activeHandler.lock();
if ( active )
{
active->pushEvent( HandlerEvent( HandlerEventType::eDeactivate, current ) );
}
m_activeHandler.reset();
}
}
return result;
}
开发者ID:DragonJoker,项目名称:Castor3D,代码行数:31,代码来源:UserInputListener.cpp
示例2: sizeof
OSStatus GHOST_SystemCarbon::handleWindowEvent(EventRef event)
{
WindowRef windowRef;
GHOST_WindowCarbon *window;
OSStatus err = eventNotHandledErr;
// Check if the event was send to a GHOST window
::GetEventParameter(event, kEventParamDirectObject, typeWindowRef, NULL, sizeof(WindowRef), NULL, &windowRef);
window = (GHOST_WindowCarbon *) ::GetWRefCon(windowRef);
if (!validWindow(window)) {
return err;
}
//if (!getFullScreen()) {
err = noErr;
switch (::GetEventKind(event))
{
case kEventWindowClose:
pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowClose, window) );
break;
case kEventWindowActivated:
m_windowManager->setActiveWindow(window);
window->loadCursor(window->getCursorVisibility(), window->getCursorShape());
pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowActivate, window) );
break;
case kEventWindowDeactivated:
m_windowManager->setWindowInactive(window);
pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowDeactivate, window) );
break;
case kEventWindowUpdate:
//if (getFullScreen()) GHOST_PRINT("GHOST_SystemCarbon::handleWindowEvent(): full-screen update event\n");
pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowUpdate, window) );
break;
case kEventWindowBoundsChanged:
if (!m_ignoreWindowSizedMessages)
{
window->updateDrawingContext();
pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window) );
}
break;
default:
err = eventNotHandledErr;
break;
}
// }
//else {
//window = (GHOST_WindowCarbon*) m_windowManager->getFullScreenWindow();
//GHOST_PRINT("GHOST_SystemCarbon::handleWindowEvent(): full-screen window event, " << window << "\n");
//::RemoveEventFromQueue(::GetMainEventQueue(), event);
//}
return err;
}
开发者ID:danielmarg,项目名称:blender-main,代码行数:53,代码来源:GHOST_SystemCarbon.cpp
示例3: pushEvent
void DInputEventQueue::pushEvent( const DJoyStickEvent& e)
{
if (mEventInforQueue.size() < maxEventCount)
{
pushEvent(e, mTimer.getMilliseconds());
}
}
开发者ID:jiazhipeng03,项目名称:Duel-Engine,代码行数:7,代码来源:DuelInputEventQueue.cpp
示例4: GHOST_WindowSDL
GHOST_IWindow *
GHOST_SystemSDL::createWindow(const STR_String& title,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
bool stereoVisual,
const GHOST_TUns16 numOfAASamples,
const GHOST_TEmbedderWindowID parentWindow
)
{
GHOST_WindowSDL *window= NULL;
window= new GHOST_WindowSDL (this, title, left, top, width, height, state, parentWindow, type, stereoVisual, 1);
if (window) {
if (window->getValid()) {
m_windowManager->addWindow(window);
pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window));
}
else {
delete window;
window= NULL;
}
}
return window;
}
开发者ID:BHCLL,项目名称:blendocv,代码行数:29,代码来源:GHOST_SystemSDL.cpp
示例5: GHOST_Event
bool
GHOST_SystemSDL::generateWindowExposeEvents()
{
vector<GHOST_WindowSDL *>::iterator w_start= m_dirty_windows.begin();
vector<GHOST_WindowSDL *>::const_iterator w_end= m_dirty_windows.end();
bool anyProcessed= false;
for (;w_start != w_end; ++w_start) {
GHOST_Event * g_event= new
GHOST_Event(
getMilliSeconds(),
GHOST_kEventWindowUpdate,
*w_start
);
(*w_start)->validate();
if (g_event) {
printf("Expose events pushed\n");
pushEvent(g_event);
anyProcessed= true;
}
}
m_dirty_windows.clear();
return anyProcessed;
}
开发者ID:BHCLL,项目名称:blendocv,代码行数:27,代码来源:GHOST_SystemSDL.cpp
示例6: KeyboardEvent
bool UserInputListener::fireKeyUp( KeyboardKey p_key, bool p_ctrl, bool p_alt, bool p_shift )
{
bool result = false;
if ( doHasHandlers() )
{
auto active = m_activeHandler.lock();
if ( active )
{
if ( p_key == KeyboardKey::eControl )
{
m_keyboard.m_ctrl = false;
}
if ( p_key == KeyboardKey::eAlt )
{
m_keyboard.m_alt = false;
}
if ( p_key == KeyboardKey::eShift )
{
m_keyboard.m_shift = false;
}
active->pushEvent( KeyboardEvent( KeyboardEventType::eReleased, p_key, m_keyboard.m_ctrl, m_keyboard.m_alt, m_keyboard.m_shift ) );
result = true;
}
}
return result;
}
开发者ID:DragonJoker,项目名称:Castor3D,代码行数:32,代码来源:UserInputListener.cpp
示例7: while
void EventBuffer::pollEvents(sf::Window& window)
{
sf::Event event;
while (window.pollEvent(event))
pushEvent(event);
}
开发者ID:krichard1988,项目名称:Thor,代码行数:7,代码来源:ActionOperations.cpp
示例8: setValue
void Statistics::endFrame() {
setValue(frameDurationCounter, frameTimer.getMilliseconds());
{ // IO
static Util::Timer ioTimer;
static size_t lastBytesRead = 0;
static size_t lastBytesWritten = 0;
const uint64_t duration = ioTimer.getNanoseconds();
// Update every second.
if(duration > 1000000000) {
const size_t bytesRead = Util::Utils::getIOBytesRead();
const size_t bytesWritten = Util::Utils::getIOBytesWritten();
const double MebiPerSecond = 1024.0 * 1024.0 * 1.0e-9 * static_cast<double>(duration);
const double readRate = static_cast<double>(bytesRead - lastBytesRead) / MebiPerSecond;
const double writeRate = static_cast<double>(bytesWritten - lastBytesWritten) / MebiPerSecond;
ioTimer.reset();
lastBytesRead = bytesRead;
lastBytesWritten = bytesWritten;
setValue(ioRateReadCounter, readRate);
setValue(ioRateWriteCounter, writeRate);
}
}
pushEvent(EVENT_TYPE_FRAME_END, 1);
}
开发者ID:MeisterYeti,项目名称:MinSG,代码行数:29,代码来源:Statistics.cpp
示例9: GHOST_WindowCarbon
GHOST_IWindow *GHOST_SystemCarbon::createWindow(
const STR_String& title,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
bool stereoVisual,
const GHOST_TUns16 numOfAASamples,
const GHOST_TEmbedderWindowID parentWindow)
{
GHOST_IWindow *window = 0;
window = new GHOST_WindowCarbon(title, left, top, width, height, state, type);
if (window) {
if (window->getValid()) {
// Store the pointer to the window
GHOST_ASSERT(m_windowManager, "m_windowManager not initialized");
m_windowManager->addWindow(window);
m_windowManager->setActiveWindow(window);
pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window));
}
else {
GHOST_PRINT("GHOST_SystemCarbon::createWindow(): window invalid\n");
delete window;
window = 0;
}
}
else {
GHOST_PRINT("GHOST_SystemCarbon::createWindow(): could not create window\n");
}
return window;
}
开发者ID:danielmarg,项目名称:blender-main,代码行数:35,代码来源:GHOST_SystemCarbon.cpp
示例10: SDL_Delay
void TetrisAI::execute(vector<int> commands) {
for (vector<int>::iterator it = commands.begin(); it != commands.end();
it++) {
SDL_Delay(AI_DELAY);
pushEvent(*it);
}
}
开发者ID:anthemEdge,项目名称:Tetris-SDL2,代码行数:7,代码来源:TetrisAI.cpp
示例11: pushEvent
void QSFMLCanvas::mouseReleaseEvent(QMouseEvent* event) {
sf::Event e;
e.type = sf::Event::MouseButtonReleased;
e.mouseButton.x = event->x();
e.mouseButton.y = event->y();
pushEvent(e);
}
开发者ID:cpp3ds,项目名称:cpp3ds,代码行数:7,代码来源:SFMLWidget.cpp
示例12: pushEvent
void WindowImpl::processSensorEvents()
{
// First update the sensor states
SensorManager::getInstance().update();
for (unsigned int i = 0; i < Sensor::Count; ++i)
{
Sensor::Type sensor = static_cast<Sensor::Type>(i);
// Only process enabled sensors
if (SensorManager::getInstance().isEnabled(sensor))
{
// Copy the previous value of the sensor and get the new one
Vector3f previousValue = m_sensorValue[i];
m_sensorValue[i] = SensorManager::getInstance().getValue(sensor);
// If the value has changed, trigger an event
if (m_sensorValue[i] != previousValue) // @todo use a threshold?
{
Event event;
event.type = Event::SensorChanged;
event.sensor.type = sensor;
event.sensor.x = m_sensorValue[i].x;
event.sensor.y = m_sensorValue[i].y;
event.sensor.z = m_sensorValue[i].z;
pushEvent(event);
}
}
}
}
开发者ID:Sonkun,项目名称:SFML,代码行数:30,代码来源:WindowImpl.cpp
示例13: select
// ######################################################################
bool EyeTrackerUDP::checkForData()
{
int numbytes = 0;
if (isConnected)
{
struct timeval tm;
tm.tv_sec = 0;
tm.tv_usec = 0;
read_fs = master; // copy master
select(sockfd+1, &read_fs, NULL, NULL, &tm);
if (FD_ISSET(sockfd, &read_fs))
{
//ready to read
lasthost_addrlen = sizeof lasthost_addr;
unsigned char msgBuffer[BUFSIZE];
if ( (numbytes = recvfrom(sockfd, msgBuffer, BUFSIZE-1 , 0,
&lasthost_addr,
&lasthost_addrlen)) <= 0)
{
// got error or connection closed by client
if (numbytes == 0)
{
// connection closed
pushEvent("Error::socket closed");
LFATAL("The connection closed");
}
else
pushEvent("Error::recieve");
}
else
{
pushEvent("Received Trigger");
setEyeFlags(msgBuffer[0]);
}
}//end FS_SET == true
}
else
{
pushEvent("Must be conncted to listen");
LFATAL("Must be connected to listen");
}
return (bool)numbytes;
}
开发者ID:ulyssesrr,项目名称:carmen_lcad,代码行数:48,代码来源:EyeTrackerUDP.C
示例14: signalTimeEvent
//--------------------------------------------------------------
/// \brief Signal that time event elapsed
/// \param[in] timeEvent Time event to signal
//--------------------------------------------------------------
void signalTimeEvent(boost::shared_ptr<ITimeEvent> timeEvent)
{
BOOST_ASSERT(!!timeEvent);
boost::shared_ptr<CEventBase> evt(new CEventBase(timeEvent->getId()));
pushEvent(evt);
timeEvent->reset();
}
开发者ID:Yadoms,项目名称:yadoms,代码行数:12,代码来源:EventHandler.hpp
示例15: while
void TaskPool::run(Thread* thread, void* userdata)
{
while (!isStopping && (!tasks.empty() || !isWaiting))
{
Task* task;
tasks.wait_and_pop_front(task);
if (!task) continue;
pushEvent(task, TaskState::Started );
task->run();
pushEvent(task, TaskState::Finished );
}
}
开发者ID:FloodProject,项目名称:flood,代码行数:17,代码来源:Concurrency.cpp
示例16: getName
//-----------------------------------------------------------------------
void ParticleSystem::_pushSystemEvent(EventType eventType)
{
// Create the event
ParticleUniverseEvent evt;
evt.eventType = eventType;
evt.componentType = CT_SYSTEM;
evt.componentName = getName();
evt.technique = 0;
evt.emitter = 0;
pushEvent(evt);
}
开发者ID:Ketzer2002,项目名称:meridian59-engine,代码行数:12,代码来源:ParticleUniverseSystem.cpp
示例17: pushEvent
void MinerManager::startBlockchainMonitoring() {
m_contextGroup.spawn([this] () {
try {
m_blockchainMonitor.waitBlockchainUpdate();
pushEvent(BlockchainUpdatedEvent());
} catch (System::InterruptedException&) {
} catch (std::exception& e) {
m_logger(Logging::ERROR) << "BlockchainMonitor context unexpectedly finished: " << e.what();
}
});
}
开发者ID:RAY-official,项目名称:catalyst,代码行数:11,代码来源:MinerManager.cpp
示例18: getName
//-----------------------------------------------------------------------
void ParticleEmitter::_pushEmitterEvent(EventType eventType)
{
// Create the event
ParticleUniverseEvent evt;
evt.eventType = eventType;
evt.componentType = CT_EMITTER;
evt.componentName = getName();
evt.technique = 0;
evt.emitter = this;
pushEvent(evt);
}
开发者ID:xubingyue,项目名称:particle_universe,代码行数:12,代码来源:ParticleUniverseEmitter.cpp
示例19: switch
void gSDLDC::exec(const gOpcode *o)
{
switch (o->opcode) {
case gOpcode::flush:
pushEvent(EV_FLIP);
eDebug("FLUSH");
break;
default:
gDC::exec(o);
break;
}
}
开发者ID:1198s,项目名称:enigma2,代码行数:12,代码来源:sdl.cpp
示例20: translateQtKey
void QtBackend::keyEvent(QKeyEvent *k, bool pressed) {
int translatedkey = translateQtKey(k->key());
int key = translatedkey;
if (key == -1) {
if (k->key() >= Qt::Key_0 && k->key() <= Qt::Key_9) {
key = k->key();
} else if (k->key() >= Qt::Key_A && k->key() <= Qt::Key_Z) {
key = k->key();
}
}
if (key != -1) {
SomeEvent e;
if (pressed)
e.type = eventspecialkeydown;
else
e.type = eventspecialkeyup;
e.key = key;
pushEvent(e);
downkeys[key] = pressed;
if (translatedkey != -1) return;
}
for (int i = 0; i < k->text().size(); i++) {
// TODO: openc2e probably doesn't like latin1
unsigned char x = k->text().at(i).toLatin1();
if (x > 31) { // Qt helpfully hands us non-text chars for some crazy reason
// We have a Latin-1 key which we can process.
SomeEvent e;
// the engine only handles eventkeydown at present
if (pressed) {
e.type = eventkeydown;
e.key = x;
pushEvent(e);
}
}
}
}
开发者ID:JennaMalkin,项目名称:openc2e,代码行数:38,代码来源:QtBackend.cpp
注:本文中的pushEvent函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论