コード例 #1
0
ファイル: GraphicsScene.cpp プロジェクト: HSOFEUP/dune
void
GraphicsScene::mouseReleaseEvent(QMouseEvent* event)
{
  m_move = false;
  sendAction("Pan", "0");
  sendAction("Tilt", "0");
  event->accept();
}
コード例 #2
0
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);
    }
}
コード例 #3
0
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);
	}
}
コード例 #4
0
ファイル: GraphicsScene.cpp プロジェクト: HSOFEUP/dune
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();
}
コード例 #5
0
ファイル: groupchatform.cpp プロジェクト: Artom-Kozincev/qTox
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);
    }
}
コード例 #6
0
//==============================================================================
// 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;
}
コード例 #7
0
QString AsteriskManager::actionSIPshowpeer(QString peer)
{
  QVariantMap headers;
  headers["Peer"] = peer;

  return sendAction("SIPshowpeer", headers);
}
コード例 #8
0
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);
}
コード例 #9
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);
    }
}
コード例 #10
0
QString AsteriskManager::actionDBGet(const QString &family, const QString &key)
{
  QVariantMap headers;
  headers["Family"] = family;
  headers["Key"] = key;
  return sendAction("DBGet",headers);
}
コード例 #11
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)) {
        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);
    }
}
コード例 #12
0
//==============================================================================
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;
}
コード例 #13
0
QString AsteriskManager::actionQueueRemove(QString queue, QString interface)
{
  QVariantMap headers;
  headers["Queue"] = queue;
  headers["Interface"] = interface;

  return sendAction("QueueRemove");
}
コード例 #14
0
QString AsteriskManager::actionConfbridgeKick(uint conference, QString channel)
{
  QVariantMap headers;
  headers["Conference"] = conference;
  headers["Channel"] = channel;

  return sendAction("ConfbridgeKick", headers);
}
コード例 #15
0
QString AsteriskManager::actionPlayDTMF(QString channel, QString digit)
{
  QVariantMap headers;
  headers["Channel"] = channel;
  headers["Digit"] = digit;

  return sendAction("PlayDTMF", headers);
}
コード例 #16
0
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();
}
コード例 #17
0
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);
}
コード例 #18
0
QString AsteriskManager::actionLogin(QString username, QString secret)
{
  QVariantMap headers;
  headers["Username"] = username;

  insertNotEmpty(&headers, "Secret", secret);

  return sendAction("Login", headers);
}
コード例 #19
0
QString AsteriskManager::actionHold(QString channel, boolean hold)
{
    QVariantMap headers;
    headers["Channel"] = channel;

    insertNotEmpty(&headers, "Hold", hold);

    return sendAction("Hold", headers);
}
コード例 #20
0
QString AsteriskManager::actionHangup(QString channel, uint cause)
{
  QVariantMap headers;
  headers["Channel"] = channel;

  insertNotEmpty(&headers, "Cause", cause);

    return sendAction("Hangup", headers);
}
コード例 #21
0
void MLMultiSlider::endGesture()
{
	if(mGestureInProgress)
	{
		isMouseWheelMoving = false;
		sendAction("end_gesture", getTargetPropertyName());
		mGestureInProgress = false;
	}
}
コード例 #22
0
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);
}
コード例 #23
0
QString AsteriskManager::actionQueueStatus(QString queue, QString member)
{
  QVariantMap headers;

  insertNotEmpty(&headers, "Queue", queue);
  insertNotEmpty(&headers, "Member", member);

  return sendAction("QueueStatus", headers);
}
コード例 #24
0
void ComponentMovement::handleEventCharacterHasDied(const EventCharacterHasDied *) {
	dead = true;
	velocity.zero();
	
	dJointSetLMotorParam(lmotor, dParamVel,  velocity.x);
	dJointSetLMotorParam(lmotor, dParamVel2, velocity.y);
	
	ActionChangeAnimation m("dying");
	sendAction(&m);
}
コード例 #25
0
void MLMultiSlider::beginGesture()
{
	if(mGestureInProgress)
	{
		endGesture();
	}
	
	sendAction("begin_gesture", getTargetPropertyName());
	mGestureInProgress = true;
}
コード例 #26
0
ファイル: gameview.cpp プロジェクト: LukasBitter/P2
/**
 * @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);
        }
    }
}
コード例 #27
0
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);
}
コード例 #28
0
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);
}
コード例 #29
0
void center_button_callscreen(ClickRecognizerRef recognizer, Window *window)
{
    if (busy) return;

    if (callEstablished)
    {
        speakerOn = !speakerOn;
        renderActionBar();
    }

    sendAction(1);
}
コード例 #30
0
ファイル: gameview.cpp プロジェクト: LukasBitter/P2
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());
        }
    }
}