// // KEYBOARD // Keyboard::Keyboard() { setPos(0,0); w = 780; h = 240; kr1.setPos(0, 0); kr1.setKeys("ESC|1|2|3|4|5|6|7|8|9|0|-|BACK|"); kr2.setPos(25, 45); kr2.xpadding_small = 20; kr2.setKeys("TAB|Q|W|E|R|T|Y|U|I|O|P|( )|"); kr3.setPos(40, 90); kr3.xpadding_small = 20; kr3.setKeys("CAPS|A|S|D|F|G|H|J|K|L|;|ENTER|"); kr4.setPos(25, 135); kr4.xpadding_small = 20; kr4.setKeys("SHIFT|Z|X|C|V|B|N|M|,|.|/|SHIFT|"); space.setPos(175, 190); // Animation settings events.clear(); newEvent(0, 200, 0, 1); // intro newEvent(0, -1, 1, 1); // main currentEvent = events[0]; updateDependencyDelays(getDelay()); }
SpikeGraph::SpikeGraph() { x = 0; y = 0; w = 240; h = 105; spikeWidth = 10; scounter = 0; speed = 1 / 4.0; for (int i = 0; i < 12; i++) { newSpike(0, 1, w - (i + 1)*spikeWidth * 2); newSpike(0, -1, w - (i + 1)*spikeWidth * 2); } maskShader.load("shadersGL3/null.vert", "shadersGL3/spike.frag"); tline1 = newTickLine(0, 0, w, 40, 0, COLOR_LINE); tline2 = newTickLine(0, h + 30, w, 40, 0, COLOR_LINE); // Animation settings events.clear(); newEvent(0, 300, 0, 1); // intro newEvent(0, -1, 1, 1); // main currentEvent = events[0]; updateDependencyEvents(); updateDependencyDelays(getDelay()); }
// only accept CTCPs in their simplest form, i.e. one ctcp, from start to // end, no text around it; not as per the 'specs', but makes people happier void CtcpParser::parseSimple(IrcEventRawMessage *e, Message::Type messagetype, QByteArray dequotedMessage, CtcpEvent::CtcpType ctcptype, Message::Flags flags) { if (dequotedMessage.count(XDELIM) != 2 || dequotedMessage[0] != '\001' || dequotedMessage[dequotedMessage.count() -1] != '\001') { displayMsg(e, messagetype, targetDecode(e, dequotedMessage), e->prefix(), e->target(), flags); } else { int spacePos = -1; QString ctcpcmd, ctcpparam; QByteArray ctcp = xdelimDequote(dequotedMessage.mid(1, dequotedMessage.count() - 2)); spacePos = ctcp.indexOf(' '); if (spacePos != -1) { ctcpcmd = targetDecode(e, ctcp.left(spacePos)); ctcpparam = targetDecode(e, ctcp.mid(spacePos + 1)); } else { ctcpcmd = targetDecode(e, ctcp); ctcpparam = QString(); } ctcpcmd = ctcpcmd.toUpper(); // we don't want to block /me messages by the CTCP ignore list if (ctcpcmd == QLatin1String("ACTION") || !coreSession()->ignoreListManager()->ctcpMatch(e->prefix(), e->network()->networkName(), ctcpcmd)) { QUuid uuid = QUuid::createUuid(); _replies.insert(uuid, CtcpReply(coreNetwork(e), nickFromMask(e->prefix()))); CtcpEvent *event = new CtcpEvent(EventManager::CtcpEvent, e->network(), e->prefix(), e->target(), ctcptype, ctcpcmd, ctcpparam, e->timestamp(), uuid); emit newEvent(event); CtcpEvent *flushEvent = new CtcpEvent(EventManager::CtcpEventFlush, e->network(), e->prefix(), e->target(), ctcptype, "INVALID", QString(), e->timestamp(), uuid); emit newEvent(flushEvent); } } }
RobotWindow::RobotWindow(double x, double y, double z) : WindowControl(), platform(x, y, z), robot(5, platform), textLives(), textGameOver(), textFps(), borderland(8, 200), platformColor() { // registra os parêmtros da criação da classe platWidth = x; platHeight = y; platDeep = z; // cria e configura objetos para desenhar os textos textGameOver.setFontStyle(GLUT_BITMAP_TIMES_ROMAN_24); textGameOver.setText("GAME OVER"); textGameOver.setPosition(-0.25, 0.1, -1); textGameOver.setColor(vermelho); textLives.setText("Vidas: %d", robot.getLives()); textLives.setPosition(-0.95, 0.9, -1); textLives.setColor(verde); textFps.setText("FPS: %d", getFps()); textFps.setPosition(-0.95, -0.95, -1); // agenda um evento para garantir ao menos um // glutPostRedisplay() por segundo newEvent(EVENT_POST_REDISPLAY, 1000); setFPS(120); // executa a configuração do ambiente openGL setTitle("SCARA - OpenGL"); configure(); // configura a posicição inicial da câmera robot.configureLookAt(lookAt); // agenda o evento de animação de iniciação do programa cameraRadius = 400; setCameraPosition(180, 90); newEvent(EVENT_RESET, interval); // inicia desenhando o limite espacial do jogo drawCage = true; // define as cores do robô platformColor.setColor(cinzaEscuro); robot.base.setColor(cinzaMaisEscuro); robot.armBase.setColor(amarelo); robot.arm.setColor(cinzaMaisEscuro); robot.clawBase.setColor(amarelo); robot.claw.hand.setColor(vermelho); // configurações iniciais de controles do jogo mouseX = mouseY = 0; mouseButton = 0; mouseState = GLUT_UP; eventFlying = 0; }
void OPMisc::eventUpdate(const IntEvent& eevent, const PairEventData& PDat) { stream(eevent.getdt()); eventUpdate(PDat); newEvent(eevent.getParticle1ID(), eevent.getType(), getClassKey(eevent)); newEvent(eevent.getParticle2ID(), eevent.getType(), getClassKey(eevent)); }
void OPCollMatrix::eventUpdate(const IntEvent& iEvent, const PairEventData&) { newEvent(iEvent.getParticle1ID(), iEvent.getType(), getClassKey(iEvent)); newEvent(iEvent.getParticle2ID(), iEvent.getType(), getClassKey(iEvent)); }
void ofxWidget::addTuioCursor(TUIO::TuioCursor &tuioCursor){ if(cursorIn(tuioCursor)){ yargs.relative_x=getRelativePosition(tuioCursor.getX(),tuioCursor.getY()).x; yargs.relative_y=getRelativePosition(tuioCursor.getX(),tuioCursor.getY()).y; yargs.abs_x=tuioCursor.getX(); yargs.abs_y=tuioCursor.getY(); newEvent(OFX_W_E_POINTER_OVER, yargs); newEvent(OFX_W_E_POINTER_PRESSED, yargs); cursorsIn.insert(tuioCursor.getSessionID()); } }
// // Spacebar // Spacebar::Spacebar() { setPos(0, 0); w = 420; h = 23; r = 4; // Animation settings events.clear(); newEvent(0, 200, 0, 1); // intro newEvent(0, -1, 1, 1); // main newEvent(0, 20, 2, 1); // keypress currentEvent = events[0]; }
// // KeyRow // KeyRow::KeyRow() { setPos(0,0); setKeys("x|x|x"); xpadding_small = 30; xpadding_large = 30; // Animation settings events.clear(); newEvent(0, 300, 0, 1); // intro newEvent(0, -1, 1, 1); // main currentEvent = events[0]; updateDependencyDelays(getDelay()); }
void OPMisc::eventUpdate(const System& eevent, const NEventData& NDat, const double& dt) { stream(dt); eventUpdate(NDat); BOOST_FOREACH(const ParticleEventData& pData, NDat.L1partChanges) newEvent(pData.getParticleID(), pData.getType(), getClassKey(eevent)); BOOST_FOREACH(const PairEventData& pData, NDat.L2partChanges) { newEvent(pData.particle1_.getParticleID(), pData.getType(), getClassKey(eevent)); newEvent(pData.particle2_.getParticleID(), pData.getType(), getClassKey(eevent)); } }
void OPCollMatrix::eventUpdate(const System& sysEvent, const NEventData& SDat, const double&) { for (const ParticleEventData& pData : SDat.L1partChanges) newEvent(pData.getParticleID(), pData.getType(), getClassKey(sysEvent)); for (const PairEventData& pData : SDat.L2partChanges) { newEvent(pData.particle1_.getParticleID(), pData.getType(), getClassKey(sysEvent)); newEvent(pData.particle2_.getParticleID(), pData.getType(), getClassKey(sysEvent)); } }
/** * Requires: * - callRequestEvent * - addCallData (the toTag in the addCallRequest will be a null string) * - addEventVia (at least for via index zero) * - completeCallEvent */ void CallStateEventBuilder_XML::callRequestEvent(int sequenceNumber, const OsTime& timestamp, ///< obtain using getCurTime(OsTime) const UtlString& contact, const UtlString& references, const UtlString& branch_id, int via_count, const bool callerInternal ) { if (builderStateIsOk(CallRequestEvent)) { newEvent(sequenceNumber, timestamp, CallRequestElementStart); mLaterElement.append(ContactElementStart); XmlEscape(mLaterElement, contact); mLaterElement.append(ContactElementEnd); mEndElement = CallRequestElementEnd; } else { assert(false); OsSysLog::add(FAC_SIP, PRI_ERR, "CallStateEventBuilder_XML::callRequestEvent not allowed."); } }
/** * Requires: * - callTransferEvent * - addCallData * - completeCallEvent */ void CallStateEventBuilder_DB::callTransferEvent(int sequenceNumber, const OsTime& timeStamp, const UtlString& contact, const UtlString& refer_to, const UtlString& referred_by, const UtlString& request_uri) { if (builderStateIsOk(CallTransferEvent)) { newEvent(sequenceNumber, timeStamp, CallEventTable, CallTransferType); UtlString nvalue; replaceSingleQuotes(contact, nvalue); mContactElement = "\'" + nvalue + "\',"; replaceSingleQuotes(refer_to, nvalue); mReferElement = "\'" + nvalue + "\',"; replaceSingleQuotes(referred_by, nvalue); mReferElement += "\'" + nvalue + "\',"; replaceSingleQuotes(request_uri, nvalue); mRequestUri = "\'" + nvalue + "\',"; } else { assert(false); Os::Logger::instance().log(FAC_SIP, PRI_ERR, "%s::callEndEvent not allowed.", ModuleName); } }
/** * Requires: * - callFailureEvent * - addCallData * - addEventVia (at least for via index zero) * - completeCallEvent */ void CallStateEventBuilder_DB::callFailureEvent(int sequenceNumber, const OsTime& timestamp, ///< obtain using getCurTime(OsTime) const UtlString& branch_id, int via_count, int statusCode, const UtlString& statusMsg ) { if (builderStateIsOk(CallFailureEvent)) { newEvent(sequenceNumber, timestamp, CallEventTable, CallFailureType); char buffer[256]; snprintf(buffer, 256, "%d,\'%s\',", statusCode, statusMsg.data()); mFailureElement = buffer; UtlString nbranchId; replaceSingleQuotes(branch_id, nbranchId); mBranchId = "\'" + nbranchId + "\',"; snprintf(buffer, 256, "%d", via_count); mViaCount = buffer; } else { assert(false); Os::Logger::instance().log(FAC_SIP, PRI_ERR, "%s::callFailureEvent not allowed.", ModuleName); } }
/** * Requires: * - callSetupEvent * - addCallData * - addEventVia (at least for via index zero) * - completeCallEvent */ void CallStateEventBuilder_DB::callSetupEvent(int sequenceNumber, const OsTime& timestamp, ///< obtain using getCurTime(OsTime) const UtlString& contact, const UtlString& calleeRoute, const UtlString& branch_id, int via_count ) { if (builderStateIsOk(CallSetupEvent)) { newEvent(sequenceNumber, timestamp, CallEventTable, CallSetupType); UtlString ncontact; replaceSingleQuotes(contact, ncontact); mContactElement = "\'" + ncontact + "\',"; UtlString ncalleeRoute; replaceSingleQuotes(calleeRoute, ncalleeRoute); mCalleeRoute = "\'" + ncalleeRoute + "\',"; UtlString nbranchId; replaceSingleQuotes(branch_id, nbranchId); mBranchId = "\'" + nbranchId + "\',"; char buffer[10]; snprintf(buffer, 10, "%d", via_count); mViaCount = buffer; } else { assert(false); Os::Logger::instance().log(FAC_SIP, PRI_ERR, "%s::callSetupEvent not allowed.", ModuleName); } }
void TextEdit::keyPressEvent(QKeyEvent *e) { if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return || e->key() == Qt::Key_F4) { if (e->modifiers() == Qt::AltModifier || e->modifiers() == Qt::ShiftModifier) { // Eat the Alt and Shift Modifiers and 'send' an enter instead e->accept(); QKeyEvent newEvent( e->type(), e->key(), Qt::NoModifier, e->text(), e->isAutoRepeat(), e->count() ); QTextEdit::keyPressEvent(&newEvent); } else if (e->modifiers() == Qt::NoModifier) { e->ignore(); } else { QTextEdit::keyPressEvent(e); } } else { QTextEdit::keyPressEvent(e); } }
void ofxWidget::updateTuioCursor(TUIO::TuioCursor &tuioCursor){ if(cursorsIn.find(tuioCursor.getSessionID())==cursorsIn.end()) return; if(cursorIn(tuioCursor)){ yargs.relative_x=getRelativePosition(tuioCursor.getX(),tuioCursor.getY()).x; yargs.relative_y=getRelativePosition(tuioCursor.getX(),tuioCursor.getY()).y; yargs.abs_x=tuioCursor.getX(); yargs.abs_y=tuioCursor.getY(); newEvent(OFX_W_E_POINTER_OVER, yargs); }else{ yargs.relative_x=getRelativePosition(tuioCursor.getX(),tuioCursor.getY()).x; yargs.relative_y=getRelativePosition(tuioCursor.getX(),tuioCursor.getY()).y; yargs.abs_x=tuioCursor.getX(); yargs.abs_y=tuioCursor.getY(); newEvent(OFX_W_E_POINTER_OUT, yargs); }; }
void CEditValue::SetValue(float value, bool bSendMessage) { char text[100]; if ( m_edit == 0 ) return; text[0] = 0; if ( m_type == EVT_INT ) { sprintf(text, "%d", static_cast<int>(value)); } if ( m_type == EVT_FLOAT ) { sprintf(text, "%.2f", value); } if ( m_type == EVT_100 ) { sprintf(text, "%d%%", static_cast<int>(value*100.0f)); } m_edit->SetText(text); if ( bSendMessage ) { Event newEvent(m_eventType); m_event->AddEvent(newEvent); } }
void StelSkyItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* event) { QPointF pos = event->scenePos(); pos.setY(size().height() - 1 - pos.y()); QMouseEvent newEvent(QEvent::MouseButtonRelease, QPoint(pos.x(), pos.y()), event->button(), event->buttons(), event->modifiers()); StelApp::getInstance().handleClick(&newEvent); }
void OPCollMatrix::eventUpdate(const LocalEvent& localEvent, const NEventData& SDat) { for (const ParticleEventData& pData : SDat.L1partChanges) newEvent(pData.getParticleID(), pData.getType(), getClassKey(localEvent)); for (const PairEventData& pData : SDat.L2partChanges) { newEvent(pData.particle1_.getParticleID(), pData.getType(), getClassKey(localEvent)); newEvent(pData.particle2_.getParticleID(), pData.getType(), getClassKey(localEvent)); } }
void addExternalListener(const char *name, int retSize, NetworkAddress *addr) { Event ev; bool isNewEvent = false; lock.lock(); ExternalEvent *extEvent = findEvent(name); if(!extEvent) { extEvent = newEvent(name, retSize); isNewEvent = true; } extEvent->addExternalListener(addr); if(isNewEvent) extEvent->listenerAddr = ev.addListener(name, eventCallback, 0, false, retSize); else { int prevSize = extEvent->retSize; //If ret size larger than previous (singleEvent) retSize, make enough room if(prevSize < retSize) { extEvent->totRetSize = (extEvent->totRetSize/extEvent->retSize)*retSize; extEvent->totRetSize = retSize; } else extEvent->totRetSize += extEvent->retSize; ev.resizeListener(extEvent->listenerAddr, extEvent->totRetSize); } lock.unlock(); }
void *QueryThread::Entry() { wxCommandEvent newEvent(wxEVT_THREAD_WORKER_SIGNAL, wxID_ANY ); odalpapi::BufferedSocket Socket; // Keeps the thread alive, it will wait for commands instead of the // killing itself/creating itself overhead while (1) { m_Status = QueryThread_Waiting; m_Mutex.Lock(); // Put the thread to sleep and wait for a signal m_Condition->Wait(); // We got signaled to do some work, so lets do it if (m_Status == QueryThread_Exiting) break; m_Status = QueryThread_Running; m_QueryServer->SetSocket(&Socket); m_QueryServer->SetAddress(m_Address, m_Port); m_QueryServer->SetRetries(m_Retries); newEvent.SetId(m_QueryServer->Query(m_ServerTimeout)); newEvent.SetInt(m_ServerIndex); wxPostEvent(m_EventHandler, newEvent); } return NULL; }
void OPCollMatrix::eventUpdate(const GlobalEvent& globEvent, const NEventData& SDat) { BOOST_FOREACH(const ParticleEventData& pData, SDat.L1partChanges) newEvent(pData.getParticle().getID(), pData.getType(), getClassKey(globEvent)); BOOST_FOREACH(const PairEventData& pData, SDat.L2partChanges) { newEvent(pData.particle1_.getParticle().getID(), pData.getType(), getClassKey(globEvent)); newEvent(pData.particle2_.getParticle().getID(), pData.getType(), getClassKey(globEvent)); } }
/** * Requires: * - callFailureEvent * - addCallData * - addEventVia (at least for via index zero) * - completeCallEvent */ void CallStateEventBuilder_XML::callFailureEvent(int sequenceNumber, const OsTime& timestamp, ///< obtain using getCurTime(OsTime) const UtlString& branch_id, int via_count, int statusCode, const UtlString& statusMsg ) { if (builderStateIsOk(CallFailureEvent)) { newEvent(sequenceNumber, timestamp, CallFailureElementStart); mLaterElement.append(Response_Status_Start); char sc[11]; sprintf(sc, "%d", statusCode); mLaterElement.append(sc); mLaterElement.append(StatusEnd_ReasonStart); XmlEscape(mLaterElement, statusMsg); mLaterElement.append(Reason_Response_End); mEndElement = CallFailureElementEnd; } else { assert(false); OsSysLog::add(FAC_SIP, PRI_ERR, "CallStateEventBuilder_XML::callFailureEvent not allowed."); } }
bool CanvasObjectManager::testObjectPriority() { /* This test validate every possible transition to see if the event * always end up changing the currentObject to something of higher priority * */ m_DisableTransition = true; bool success = true; for (int j=0;j<ELEMENT_COUNT;j++) { CanvasObjectManager::Object obj = static_cast<CanvasObjectManager::Object>(j); for (int i=0;i<ELEMENT_COUNT;i++) { CanvasObjectManager::Object next = static_cast<CanvasObjectManager::Object>(i); reset(); initiateInTransition(obj); if(obj!=m_CurrentObject) { qDebug() << "Current object mismatch"; success = false; } Q_ASSERT(obj == m_CurrentObject); const bool overrideObj = newEvent(firstInEvent(next)); if ((OBJ_DEF(next).priority >= OBJ_DEF(obj).priority) != overrideObj && !(obj != CanvasObjectManager::Object::NoObject && OBJ_DEF(obj).outEvent & firstInEvent(next))) { qDebug() << "PRE" << OBJ_DEF(obj).outEvent << firstInEvent(next) << (OBJ_DEF(obj).outEvent&&firstInEvent(next)); qDebug() << "testObjectPriority failed" << (int)next << ((overrideObj)?"override":"doesn't override") << (int)obj << "current priority:" << OBJ_DEF(obj).priority << "next priority" << OBJ_DEF(next).priority << "..." << (int)m_CurrentObject; success = false; } } } qDebug() << "\n\n\ntestObjectPriority" << success; return success; }
void CBOINCListCtrl::PostDrawProgressBarEvent() { if (m_bProgressBarEventPending) return; CDrawProgressBarEvent newEvent(wxEVT_DRAW_PROGRESSBAR, this); AddPendingEvent(newEvent); m_bProgressBarEventPending = true; }
void AnimationManager::update() { std::vector<Animation::Ptr>::iterator i; i = animations.begin(); while( i != animations.end() ) { (*i)->addTime( timeSinceLastFrame ); if( (*i)->isFinished() ) { RefCountedObjectPtr<AnimationEventData> data( new AnimationEventData ); EventPtr event = newEvent( finishEvent ); data->animation = *i; event->data = data; queueEvent( event ); if( (*i)->shouldRemoveWhenFinished() ) { i = animations.erase( i ); continue; } } i++; } }
void StelSkyItem::wheelEvent(QGraphicsSceneWheelEvent *event) { QPointF pos = event->scenePos(); pos.setY(size().height() - 1 - pos.y()); QWheelEvent newEvent(QPoint(pos.x(),pos.y()), event->delta(), event->buttons(), event->modifiers(), event->orientation()); StelApp::getInstance().handleWheel(&newEvent); }
void VolumeSlider::mousePressEvent(QMouseEvent * event) { Qt::MouseButton button = event->button(); if (event->button() == Qt::LeftButton) { int buttons = style()->styleHint(QStyle::SH_Slider_AbsoluteSetButtons); switch(buttons) { case (Qt::LeftButton): button = Qt::LeftButton; break; case (Qt::MidButton): button = Qt::MidButton; break; case (Qt::RightButton): button = Qt::RightButton; break; } } QMouseEvent newEvent(event->type(), event->pos(), button, button, event->modifiers()); QSlider::mousePressEvent(&newEvent); if (newEvent.isAccepted()) event->accept(); }
void CEventSystem::SendEvent(EVENTID eventID, void* pData) { // Push my event into the list. CEvent newEvent(eventID, pData); m_CurrentEvents.push_back(newEvent); }