//----------------------------------------------------------------------- bool Window::Update() { SDL_Event event; while ( SDL_PollEvent(&event) ) { switch ( event.type ) { // ќбщие событи¤ case SDL_QUIT: SDL_Quit(); return false; // —обыти¤ мыши case SDL_MOUSEBUTTONUP: eventMouse(GetMouseButton(event.button.button), false, event.button.x, event.button.y); break; case SDL_MOUSEBUTTONDOWN: eventMouse(GetMouseButton(event.button.button), true, event.button.x, event.button.y); break; case SDL_MOUSEMOTION: eventCursor(event.motion.x, event.motion.y, event.motion.xrel, event.motion.yrel); break; case SDL_MOUSEWHEEL: mouseWheel(event.wheel.x, event.button.x, event.button.y); // TODO: ? может не x? break; // —обыти¤ клавиатуры case SDL_KEYDOWN: eventKey((KEYS)(event.key.keysym.sym), L'', true); break; case SDL_KEYUP: eventKey((KEYS)(event.key.keysym.sym), L'', false); break; } // —обыти¤ окна if ( event.type == SDL_WINDOWEVENT ) { switch ( event.window.event ) { // событие изменени¤ размера окна case SDL_WINDOWEVENT_SIZE_CHANGED: if ( m_newWidth != event.window.data1 || m_newHeight != event.window.data2 ) { m_isResize = true; m_newWidth = event.window.data1; m_newHeight = event.window.data2; m_desc.Size.X = m_newWidth; m_desc.Size.Y = m_newHeight; } break; } } } return true; }
void OPCollMatrix::newEvent(const size_t& part, const EEventType& etype, const classKey& ck) { if (lastEvent[part].second.first.second != NONE) { counterData& refCount = counters[counterKey(eventKey(ck,etype), lastEvent[part].second)]; refCount.totalTime += Sim->systemTime - lastEvent[part].first; ++(refCount.count); ++(totalCount); } else ++initialCounter[eventKey(ck,etype)]; lastEvent[part].first = Sim->systemTime; lastEvent[part].second = eventKey(ck, etype); }
void CSynchInvoker::Response(const CFxEventInfo& eventInfo) { const string& id = eventInfo.ID; Key eventKey(id, string()); CLock lock(m_synchronizer); auto it = m_key2Waiter.lower_bound(eventKey); for (; m_key2Waiter.end() != it; ++it) { const Key& key = it->first; if (key.first == id) { break; } IWaiter* pWaiter = it->second; pWaiter->VResponse(eventInfo); } }
void OPCollMatrix::initialise() { lastEvent.resize(Sim->N, lastEventData(Sim->systemTime, eventKey(classKey(0, NONE), NONE))); }