void GraphicsScene::mouseReleaseEvent(QMouseEvent* event) { m_move = false; sendAction("Pan", "0"); sendAction("Tilt", "0"); event->accept(); }
void OurEnemyActor::walkingAgent(ACTORid enemyID, EnemyTeam **team, int teamCount) { float origin[3] = {0,0,0}; //敵人位置 float enemyPos[3]; FnActor enemy; enemy.Object(enemyID); enemy.GetPosition(enemyPos); //自己位置 float selfPos[3]; FnActor self; self.Object(aID); self.GetPosition(selfPos); float selfFDir[3], selfUDir[3]; actor.GetDirection(selfFDir,selfUDir); float distance = twoPointDis(selfPos, enemyPos); float flockingPos[3]; flockingPosition(flockingPos, selfPos, enemyPos, team, teamCount); float flockingDis = twoPointDis(flockingPos, origin); float newPos[3]; newPos[0] = flockingPos[0]+selfPos[0]; newPos[1] = flockingPos[1]+selfPos[1]; newPos[2] = flockingPos[2]+selfPos[2]; //先轉向再移動,再轉回來 actorFaceTo(aID, newPos[0], newPos[1], newPos[2]); actor.MoveForward(flockingDis,true); //actor.SetWorldDirection(selfFDir,selfUDir); actorFaceTo(aID, enemyPos[0], enemyPos[1], enemyPos[2]); //actor.SetPosition(newPos); if(distance < AWARE_DISTANCE) { if(distance <= COMBAT_DISTANCE) { sendAction(ourCombatIdleAction); } else { sendAction(ourRunAction); actor.MoveForward(SPEED, TRUE, FALSE, 0.0f, TRUE); } } else { sendAction(ourIdleAction); } }
void Donzo::damaged( int attack_pt, ACTORid attacker, float angle ) { HP -= attack_pt; bloodAdjust(); if( HP < 0 ) sendAction(ourDieAction); else{ if( angle < 180 ) sendAction(ourDamageHAction); else sendAction(ourDamageLAction); } }
void GraphicsScene::wheelEvent(QWheelEvent* event) { if (event->orientation() != Qt::Vertical) return; if (event->delta() > 0) sendAction("Zoom", "1"); else sendAction("Zoom", "-1"); m_zoom_tim->start(1000); event->accept(); }
void GroupChatForm::onSendTriggered() { QString msg = msgEdit->toPlainText(); if (msg.isEmpty()) return; msgEdit->setLastMessage(msg); msgEdit->clear(); if (group->getPeersCount() != 1) { if (msg.startsWith("/me ", Qt::CaseInsensitive)) { msg = msg.right(msg.length() - 4); emit sendAction(group->getGroupId(), msg); } else { emit sendMessage(group->getGroupId(), msg); } } else { if (msg.startsWith("/me ", Qt::CaseInsensitive)) addSelfMessage(msg.right(msg.length() - 4), true, QDateTime::currentDateTime(), true); else addSelfMessage(msg, false, QDateTime::currentDateTime(), true); } }
//============================================================================== // server... void MinosRPCServer::queueResponse( std::string to ) { RPCResponse * m = new RPCResponse( to, id, methodName ); m->args = callArgs.args; // copy vector of pointers sendAction( m ); delete m; }
QString AsteriskManager::actionSIPshowpeer(QString peer) { QVariantMap headers; headers["Peer"] = peer; return sendAction("SIPshowpeer", headers); }
void ShadowPointLight::shadowMap(Action action) { Shader *shader = action.getParameterPointer<Shader>("shader"); glBindFramebuffer(GL_FRAMEBUFFER, fbo); glViewport(0, 0, resolution, resolution); clear(); glm::mat4 projection = glm::perspective(90.0f, 1.0f, nearPlane, farPlane); // FOV = 90 degrees, aspect ratio = resolution / resolution = 1 glm::mat4 transforms[6]; transforms[0] = projection * glm::lookAt(position, position + glm::vec3(1.0f, 0.0f, 0.0f), glm::vec3(0.0f, -1.0f, 0.0f)); transforms[1] = projection * glm::lookAt(position, position + glm::vec3(-1.0f, 0.0f, 0.0f), glm::vec3(0.0f, -1.0f, 0.0f)); transforms[2] = projection * glm::lookAt(position, position + glm::vec3(0.0f, 1.0f, 0.0f), glm::vec3(0.0f, 0.0f, 1.0f)); transforms[3] = projection * glm::lookAt(position, position + glm::vec3(0.0f, -1.0f, 0.0f), glm::vec3(0.0f, 0.0f, -1.0f)); transforms[4] = projection * glm::lookAt(position, position + glm::vec3(0.0f, 0.0f, 1.0f), glm::vec3(0.0f, -1.0f, 0.0f)); transforms[5] = projection * glm::lookAt(position, position + glm::vec3(0.0f, 0.0f, -1.0f), glm::vec3(0.0f, -1.0f, 0.0f)); for (int i = 0; i < 6; ++i) (*shader)["shadowMatrices[" + std::to_string(i) + "]"] = transforms[i]; (*shader)["lightPosition"] = position; (*shader)["farPlane"] = farPlane; Action render("render"); render.setRecursive(true); render.addParameter("shader", shader); sendAction(render, target); glBindFramebuffer(GL_FRAMEBUFFER, 0); }
/*! Handle keyboard events. */ void InputTextWidget::keyPressEvent(QKeyEvent* event) { // Send message on Return if ((event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) && (event->modifiers() == Qt::NoModifier || event->modifiers() == Qt::KeypadModifier)) { // Prevents empty messages if (toPlainText().trimmed().isEmpty()) { return; } if (toPlainText().startsWith("/me ") ) { QString html = toHtml(); html.remove(html.indexOf("/me "), 4); emit sendAction(Smileypack::desmilify(html)); } else { emit sendMessage(Smileypack::desmilify(toHtml())); } // not only clears the text, but also removes undo/redo history clear(); // Override default shortcuts } else if (event == QKeySequence::Copy) { copyPlainText(); } else if (event == QKeySequence::Cut) { cutPlainText(); } else if (event == QKeySequence::Paste) { pastePlainText(); // Normal text writing } else { QTextEdit::keyPressEvent(event); } }
QString AsteriskManager::actionDBGet(const QString &family, const QString &key) { QVariantMap headers; headers["Family"] = family; headers["Key"] = key; return sendAction("DBGet",headers); }
/*! Handle keyboard events. */ void InputTextWidget::keyPressEvent(QKeyEvent* event) { // Send message on Return if ((event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) && (event->modifiers() == Qt::NoModifier || event->modifiers() == Qt::KeypadModifier)) { if (toPlainText().startsWith("/me ") ) { QString html = toHtml(); html.remove(html.indexOf("/me "), 4); emit sendAction(EmoticonMenu::desmile(html)); } else { emit sendMessage(EmoticonMenu::desmile(toHtml())); } clear(); // Override default shortcuts } else if (event == QKeySequence::Copy) { copyPlainText(); } else if (event == QKeySequence::Cut) { cutPlainText(); } else if (event == QKeySequence::Paste) { pastePlainText(); // Normal text writing } else { QTextEdit::keyPressEvent(event); } }
//============================================================================== void MinosRPCClient::queueCall( std::string to ) { RPCRequest * m = new RPCRequest( to, methodName ); m->setNextId(); // only happens if no Id already m->args = callArgs.args; // copy vector of pointers sendAction( m ); delete m; }
QString AsteriskManager::actionQueueRemove(QString queue, QString interface) { QVariantMap headers; headers["Queue"] = queue; headers["Interface"] = interface; return sendAction("QueueRemove"); }
QString AsteriskManager::actionConfbridgeKick(uint conference, QString channel) { QVariantMap headers; headers["Conference"] = conference; headers["Channel"] = channel; return sendAction("ConfbridgeKick", headers); }
QString AsteriskManager::actionPlayDTMF(QString channel, QString digit) { QVariantMap headers; headers["Channel"] = channel; headers["Digit"] = digit; return sendAction("PlayDTMF", headers); }
MotionDetectorWrapper::MotionDetectorWrapper(QObject *parent) : QObject(parent), m_motionDetector(new MotionDetector), m_thread(new QThread), m_showDetection(false) { qRegisterMetaType<cv::Mat>("cv::Mat"); qDebug() << "MotionDetecotWrapper created"; connect(m_motionDetector, SIGNAL(sendAction(QString)), SIGNAL(sendAction(QString))); connect(m_thread, SIGNAL(finished()), m_motionDetector, SLOT(deleteLater())); connect(m_motionDetector, &MotionDetector::showIm, this, &MotionDetectorWrapper::drawIm, Qt::QueuedConnection); m_motionDetector->moveToThread(m_thread); m_thread->start(); }
QString AsteriskManager::actionSetvar(const QString &channel, const QString &variable, const QString &value) { QVariantMap headers; headers["Channel"] = channel; headers["Variable"] = variable; headers["Value"] = value; return sendAction("Setvar",headers); }
QString AsteriskManager::actionLogin(QString username, QString secret) { QVariantMap headers; headers["Username"] = username; insertNotEmpty(&headers, "Secret", secret); return sendAction("Login", headers); }
QString AsteriskManager::actionHold(QString channel, boolean hold) { QVariantMap headers; headers["Channel"] = channel; insertNotEmpty(&headers, "Hold", hold); return sendAction("Hold", headers); }
QString AsteriskManager::actionHangup(QString channel, uint cause) { QVariantMap headers; headers["Channel"] = channel; insertNotEmpty(&headers, "Cause", cause); return sendAction("Hangup", headers); }
void MLMultiSlider::endGesture() { if(mGestureInProgress) { isMouseWheelMoving = false; sendAction("end_gesture", getTargetPropertyName()); mGestureInProgress = false; } }
QString AsteriskManager::actionExtensionState(const QString &exten, const QString &context) { QVariantMap headers; headers["Exten"] = exten; if(!context.isNull() && context.isEmpty()) headers["Context"] = context; return sendAction("ExtensionState", headers); }
QString AsteriskManager::actionQueueStatus(QString queue, QString member) { QVariantMap headers; insertNotEmpty(&headers, "Queue", queue); insertNotEmpty(&headers, "Member", member); return sendAction("QueueStatus", headers); }
void ComponentMovement::handleEventCharacterHasDied(const EventCharacterHasDied *) { dead = true; velocity.zero(); dJointSetLMotorParam(lmotor, dParamVel, velocity.x); dJointSetLMotorParam(lmotor, dParamVel2, velocity.y); ActionChangeAnimation m("dying"); sendAction(&m); }
void MLMultiSlider::beginGesture() { if(mGestureInProgress) { endGesture(); } sendAction("begin_gesture", getTargetPropertyName()); mGestureInProgress = true; }
/** * @brief GameView::sendSquad Action utilisateur demandant l'envoi de squad * @param from Noeud source * @param to Noeud de destination */ void GameView::sendSquad(Node *from, Node *to) { NodeCombat *nodeFromTmp = dynamic_cast <NodeCombat*>(from); int nbRessource = (int)(nodeFromTmp->getRessources()*(ressUi->getPercentToSend()/100)); if(nodeFromTmp != 0) { NodeConnectable *nodeToComba = dynamic_cast <NodeConnectable*>(to); NodeMana *nodeToMana = dynamic_cast <NodeMana*>(to); if(nodeToComba != 0) { sendAction(GA_SEND, nodeFromTmp->getId(), nodeToComba->getId(),nbRessource); } else if(nodeToMana != 0 && nodeFromTmp->getOwner() != 0 && nodeFromTmp->getOwner()->getId() == owner->getId()) { powerUi->addMana(nbRessource); sendAction(GA_MANA_BURN, nodeFromTmp->getId(), 0,nbRessource); } } }
QString AsteriskManager::actionPark(QString channel, QString channel2, uint timeout, QString parkinglot) { QVariantMap headers; headers["Channel"] = channel; headers["Channel2"] = channel2; insertNotEmpty(&headers, "Timeout", timeout); insertNotEmpty(&headers, "Parkinglot", parkinglot); return sendAction("Park", headers); }
QString AsteriskManager::actionQueuePause(QString interface, boolean paused, QString queue, QString reason) { QVariantMap headers; headers["Interface"] = interface; headers["Paused"] = paused; insertNotEmpty(&headers, "Queue", queue); insertNotEmpty(&headers, "Reason", reason); return sendAction("QueuePause", headers); }
void center_button_callscreen(ClickRecognizerRef recognizer, Window *window) { if (busy) return; if (callEstablished) { speakerOn = !speakerOn; renderActionBar(); } sendAction(1); }
void GameView::advance() { scene->advance(); if(!gameFinished && !debugNoWin()) { const Gamer *g = scene->isVictory(); if(g != 0) { gameFinished = true; sendAction(GA_GAME_FINISHED, -1,-1, g->getId()); } } }