• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ setTarget函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中setTarget函数的典型用法代码示例。如果您正苦于以下问题:C++ setTarget函数的具体用法?C++ setTarget怎么用?C++ setTarget使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了setTarget函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: GameObject

Enemy::Enemy(World *world, const std::vector<CL_Point>& wp, float speed, float hitpoints, int value, bool boss, bool alive)
: GameObject(world), wayPoints(wp), speed(speed), defaultSpeed(speed), hitpoints(hitpoints), value(value), boss(boss), alive(alive)
{
	// wenn weniger als zwei Wegpunkte übergeben werden -> Abbruch
	if (wayPoints.size() < 2)
		return;

	// Position auf ersten Wegpunkt setzen
	setPosition(wayPoints[0]);
	wayPoints.erase(wayPoints.begin());

	// Ziel auf zweiten Wegpunkt setzen
	setTarget(wayPoints[0]);
	wayPoints.erase(wayPoints.begin());	
}
开发者ID:chenwenbiao,项目名称:Tower-Defense,代码行数:15,代码来源:enemy.cpp


示例2: BaseLayout

	PropertyFieldColour::PropertyFieldColour(IPropertyObj * obj, const Property * prop, PropertyGroup * _parent)
		: BaseLayout("PropertyFieldColour.layout", _parent->getClient())
		, IPropertyField(obj, prop)
		, mText(nullptr)
		, mField(nullptr)
	{
		assignWidget(mText, "Text");
		assignWidget(mField, "Field");

		mText->setCaption(prop->name.c_wstr());

		setTarget(obj);

		mField->eventMouseButtonPressed += MyGUI::newDelegate(this, &PropertyFieldColour::notifyMouseButtonPressed);
	}
开发者ID:ak4hige,项目名称:myway3d,代码行数:15,代码来源:PropertyFieldColour.cpp


示例3: QString

UIDownloaderAdditions::UIDownloaderAdditions()
{
    /* Prepare instance: */
    if (!m_spInstance)
        m_spInstance = this;

    /* Prepare source/target: */
    const QString &strName = QString("VBoxGuestAdditions_%1.iso").arg(vboxGlobal().vboxVersionStringNormalized());
    const QString &strSource = QString("http://download.virtualbox.org/virtualbox/%1/").arg(vboxGlobal().vboxVersionStringNormalized()) + strName;
    const QString &strTarget = QDir(vboxGlobal().homeFolder()).absoluteFilePath(strName);

    /* Set source/target: */
    setSource(strSource);
    setTarget(strTarget);
}
开发者ID:pombredanne,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:15,代码来源:UIDownloaderAdditions.cpp


示例4: doSetAttackMode

void UnitBase::doMove2Pos(int xPos, int yPos, bool bForced) {
    if(attackMode == CAPTURE || attackMode == HUNT) {
        doSetAttackMode(GUARD);
	}

	if((xPos != destination.x) || (yPos != destination.y)) {
		clearPath();
		findTargetTimer = 0;
	}

	setTarget(NULL);
	setDestination(xPos,yPos);
	setForced(bForced);
	setGuardPoint(xPos,yPos);
}
开发者ID:katlogic,项目名称:dunelegacy,代码行数:15,代码来源:UnitBase.cpp


示例5: CCLOG

void AttackComponent::handleMessage(CCMessage *message)
{
    CCLOG("AttackComponent::handleMessage");
    CCLOG("get message %d",message->getType());

    GameEntity* target;
	switch(message->getType()){
		
		case ATTACK:
            target=(GameEntity*)message->getData();
            if(target){
                setTarget(target);
            }
			attack();
			break;
		case DIE:
            didTargetDie();
			break;
        case SET_ATTACK_TARGET:
            setTarget((GameEntity*)message->getData());
            break;

	}
}
开发者ID:trarck,项目名称:CCISO,代码行数:24,代码来源:AttackComponent.cpp


示例6: LOG

void IDBDatabase::connectionToServerLost(const IDBError& error)
{
    LOG(IndexedDB, "IDBDatabase::connectionToServerLost - %" PRIu64, m_databaseConnectionIdentifier);

    ASSERT(currentThread() == originThreadID());

    m_closePending = true;
    m_closedInServer = true;

    for (auto& transaction : m_activeTransactions.values())
        transaction->connectionClosedFromServer(error);

    auto errorEvent = Event::create(m_eventNames.errorEvent, true, false);
    errorEvent->setTarget(this);

    if (auto* context = scriptExecutionContext())
        context->eventQueue().enqueueEvent(WTFMove(errorEvent));

    auto closeEvent = Event::create(m_eventNames.closeEvent, true, false);
    closeEvent->setTarget(this);

    if (auto* context = scriptExecutionContext())
        context->eventQueue().enqueueEvent(WTFMove(closeEvent));
}
开发者ID:eocanha,项目名称:webkit,代码行数:24,代码来源:IDBDatabase.cpp


示例7: setTarget

void MainWindow::on_pushButton_4_clicked()
{
    //Prediction by Input (Recent selected Number)


    nvInput[0]=1.0; //Constant value = 1
//    nvInput[45]=0.0;
    for(int i=0; i<45;i++)
    {   nvInput[i+1]=0.0;
    }
    //번호 입력
/*
    int number;
    number = ui->spinBox->value();nvInput[number] = 1.0;
    number = ui->spinBox_2->value();nvInput[number] = 1.0;
    number = ui->spinBox_3->value();nvInput[number] = 1.0;
    number = ui->spinBox_4->value();nvInput[number] = 1.0;
    number = ui->spinBox_5->value();nvInput[number] = 1.0;
    number = ui->spinBox_6->value();nvInput[number] = 1.0;
*/
    setTarget(0,0);

    forward();
    QString text="";
    QString temp;
    int rank[45];
    for(int j=0;j<45;j++)
    {
        rank[j]=0;
        for(int k=0;k<45;k++)
        {
            if(j!=k)
            {
                if(nvOutput[j] < nvOutput[k]) rank[j]=rank[j]+1;
            }
        }
    }

    for(int i=0;i<45;i++)
    {
      if(rank[i]==0 || rank[i]==1 || rank[i]==2 || rank[i]==3 || rank[i]==4 || rank[i]==5)
       {temp=QString("%1[%2] \n").arg(i+1).arg(rank[i]).arg(nvOutput[i]);
       text.append(temp);}
    }
    ui->textBrowser->append(text);

}
开发者ID:kirumang,项目名称:Lotto,代码行数:47,代码来源:mainwindow.cpp


示例8: diff

void Guard::update(sf::Time dT, std::vector<Wall> walls)
{
    sf::Vector2f diff(this->getPosition() - _target);

    if(!_atTarget)
    {
        if(!_walking)
        {
            _walking = true;
            _animator.playAnimation("walking", true);
        }

        sf::Vector2f movement(0.f, 0.f);

        float rotation = std::atan2(diff.y, diff.x);
        this->setRotation((rotation * 180/3.124) - 90);

        movement.x = -std::cos(rotation) * _speed;
        movement.y = -std::sin(rotation) * _speed;
        this->move(movement * dT.asSeconds());
    }

    if(abs(diff.x) <= 2 && abs(diff.y) <= 1)
    {
        if(_walking)
        {
            _walking = false;
            _animator.playAnimation("standing");
            _waiting.restart();
            _atTarget = true;
        }

        if(_waiting.getElapsedTime().asSeconds() >= 5)
        {
            setTarget(*_ppIt);
            _ppIt++;

            if(_ppIt == _patrolPoints.end())
                _ppIt = _patrolPoints.begin();

            _atTarget = false;
        }
    }

    _animator.update(dT);
    _animator.animate(*this);
}
开发者ID:fatnic,项目名称:swag,代码行数:47,代码来源:guard.cpp


示例9: receivedData

void UIDownloaderExtensionPack::handleDownloadedObject(UINetworkReply *pReply)
{
    /* Read received data into the buffer: */
    QByteArray receivedData(pReply->readAll());
    /* Serialize that buffer into the file: */
    while (true)
    {
        /* Try to open file for writing: */
        QFile file(target());
        if (file.open(QIODevice::WriteOnly))
        {
            /* Write buffer into the file: */
            file.write(receivedData);
            file.close();

            /* Calc the SHA-256 on the bytes, creating a string: */
            uint8_t abHash[RTSHA256_HASH_SIZE];
            RTSha256(receivedData.constData(), receivedData.length(), abHash);
            char szDigest[RTSHA256_DIGEST_LEN + 1];
            int rc = RTSha256ToString(abHash, szDigest, sizeof(szDigest));
            if (RT_FAILURE(rc))
            {
                AssertRC(rc);
                szDigest[0] = '\0';
            }

            /* Warn the listener about extension-pack was downloaded: */
            emit sigDownloadFinished(source().toString(), target(), &szDigest[0]);
            break;
        }

        /* Warn the user about extension-pack was downloaded but was NOT saved: */
        msgCenter().warnAboutExtentionPackCantBeSaved(GUI_ExtPackName, source().toString(), QDir::toNativeSeparators(target()));

        /* Ask the user for another location for the extension-pack file: */
        QString strTarget = QIFileDialog::getExistingDirectory(QFileInfo(target()).absolutePath(),
                                                               msgCenter().networkManagerOrMainWindowShown(),
                                                               tr("Select folder to save %1 to").arg(GUI_ExtPackName), true);

        /* Check if user had really set a new target: */
        if (!strTarget.isNull())
            setTarget(QDir(strTarget).absoluteFilePath(QFileInfo(target()).fileName()));
        else
            break;
    }
}
开发者ID:ryenus,项目名称:vbox,代码行数:46,代码来源:UIDownloaderExtensionPack.cpp


示例10: PositionFromLine

void ScintillaWrapper::replaceWholeLine(int lineNumber, boost::python::object newContents)
{
	
	int start = PositionFromLine(lineNumber);	
	int end;
	if (GetLineCount() > lineNumber)
	{
		end = PositionFromLine(lineNumber + 1);
	}
	else
	{
		end = GetLength();
	}

	setTarget(start, end);
	ReplaceTarget(newContents);
}
开发者ID:juntalis,项目名称:PythonScript,代码行数:17,代码来源:ScintillaWrapper.cpp


示例11: quitDeviation

void UnitBase::deviate(House* newOwner) {

    if(newOwner->getHouseID() == originalHouseID) {
        quitDeviation();
    } else {
        removeFromSelectionLists();
        setTarget(NULL);
        setGuardPoint(location);
        setDestination(location);
        clearPath();
        doSetAttackMode(GUARD);
        owner = newOwner;

        graphic = pGFXManager->getObjPic(graphicID,getOwner()->getHouseID());
        deviationTimer = DEVIATIONTIME;
    }
}
开发者ID:katlogic,项目名称:dunelegacy,代码行数:17,代码来源:UnitBase.cpp


示例12: printf

void *control_main(){
	do{
		if(rpi_hasReceived && isReady()){
			rpi_hasReceived = 0;

			// printf("-------------------------------\n");
			printf("[RPI] Received: %s\n", input);

			// Split Command
			int result = splitString(input, "<", inputPtr, 2);
			if(result == 2){
				message_size = strlen(inputPtr[1]);
				tempCommand = inputPtr[1];

				// printf("Target: %s\n", inputPtr[0]);
				// printf("Target Length: %d\n", strlen(inputPtr[0]));
				// printf("Target Size: %d\n", sizeof(inputPtr[0]));
				// printf("Message: %s\n", inputPtr[1]);
				// printf("Message Length: %d\n", strlen(inputPtr[1]));
				// printf("Message Size: %d\n", sizeof(inputPtr[1]));
				// printf("-------------------------------\n");

				memset(output, 0, sizeof(output));
				strncpy(output, tempCommand, strlen(tempCommand));

				for(i = 0; i < strlen(inputPtr[0]); i++){
					setTarget((&input[0])[i]);
				}
			}
			// }else{
			// 	memset(output, 0, sizeof(output));
			// 	strncpy(output, "Invalid Command: ", 17);
			// 	strcat(output, input);
			// 	setTarget(sender);
			// }

			//printf("%d:%d:%d\n", arduino_isWriting, bt_isWriting, tcp_isWriting);
		}

		if(tcp_isReconnected){
			tcp_isReconnected = 0;
			onReady();
		}
	}while(1);
}
开发者ID:BhavyaLight,项目名称:Maze-exploring-and-fastest-path-calculating-Robot,代码行数:45,代码来源:controller.c


示例13: SDL_ShowCursor

void EG_ThirdPersonPovCamera::Control(pipeline& m_pipeline, EG_SkyBox& skybox)
{
    float pitchChange = 0.0f;
    float yawChange = 0.0f;
    float forwardSpeed = 0.0f;

	if(mouse_in)
	{
		SDL_ShowCursor(SDL_DISABLE);

		Uint8* state=SDL_GetKeyState(NULL);

        if(state[SDLK_w])
		{
            forwardSpeed = BALL_FORWARD_SPEED;
            pitchChange = -BALL_ROLLING_SPEED;
		}
		if(state[SDLK_s])
		{
            forwardSpeed = -BALL_FORWARD_SPEED;
            pitchChange = BALL_ROLLING_SPEED;
		}

        if(state[SDLK_a])
            yawChange = -BALL_HEADING_SPEED;

		if(state[SDLK_d])
            yawChange = BALL_HEADING_SPEED;





        /// update the character first
        /// When moving backwards invert rotations to match direction of travel.
        /// When we drive backwards, our car actually turn leftwards when we steer rightwards
        m_characterObject.setVelocity(0.0f, 0.0f, forwardSpeed);
        m_characterObject.setAngularVelocity(0.0f, -yawChange, 0.0f);

        updateCharacterObject(0.0f, -yawChange, 0.0f);

        setTarget(m_characterObject.getPosition());
        update(m_pipeline, 0.031f, 0.0f, (forwardSpeed >= 0.0f) ? yawChange : -yawChange, skybox);
    }
}
开发者ID:maestro92,项目名称:Explosion-Generator,代码行数:45,代码来源:EG_ThirdPersonPovCamera.cpp


示例14: m_armMotor

PIDControllerArm::PIDControllerArm(Talon* armMotor,
      AnalogInput* potentiometer,
      ConfigEditor* configEditor,
      float upperLimit,
      float lowerLimit):
      m_armMotor(armMotor),
      m_potentiometer(potentiometer),
      m_configEditor(configEditor),
      m_upperLimit(upperLimit),
      m_lowerLimit(lowerLimit){
   m_potentiometer->SetPIDSourceType(PIDSourceType::kDisplacement);
   m_controller = new PIDController(m_configEditor->getFloat("armP", 4.00), 0.001, 0.00, m_potentiometer, this);
   m_controller->SetTolerance(0.5);
   m_controller->SetPIDSourceType(PIDSourceType::kDisplacement);
   m_controller->SetOutputRange(-0.5, 0.5);
   m_controller->Enable();
   setTarget(1.0);
}
开发者ID:FRCTeamPhoenix,项目名称:Phoenix2016,代码行数:18,代码来源:PIDControllerArm.cpp


示例15: vboxGlobal

UIDownloaderUserManual::UIDownloaderUserManual()
{
    /* Prepare instance: */
    if (!m_spInstance)
        m_spInstance = this;

    /* Compose User Manual filename: */
    QString strUserManualFullFileName = vboxGlobal().helpFile();
    QString strUserManualShortFileName = QFileInfo(strUserManualFullFileName).fileName();

    /* Add sources: */
    addSource(QString("http://download.virtualbox.org/virtualbox/%1/").arg(vboxGlobal().vboxVersionStringNormalized()) + strUserManualShortFileName);
    addSource(QString("http://download.virtualbox.org/virtualbox/") + strUserManualShortFileName);

    /* Set target: */
    QString strUserManualDestination = QDir(vboxGlobal().homeFolder()).absoluteFilePath(strUserManualShortFileName);
    setTarget(strUserManualDestination);
}
开发者ID:jeppeter,项目名称:vbox,代码行数:18,代码来源:UIDownloaderUserManual.cpp


示例16: initialize

/**
 * Creates a new Item object.
 *
 * @param target item target - NULL ALLOWED
 * @param source item source - NULL ALLOWED
 * @param targetParent item target parent - NULL ALLOWED (DEFAULT)
 * @param sourceParent item source parent - NULL ALLOWED (DEFAULT)
 * @param meta item meta data - NULL ALLOWED
 * @param data item data - NULL ALLOWED
 *
 */
Item::Item( Target* target,
            Source* source,
            char* tParent,
            char* sParent,
            Meta*   meta  ,
            ComplexData* data,
            bool moreData) {
    initialize();

    setTarget(target);
    setSource(source);
    setTargetParent(tParent);
    setSourceParent(sParent);
    setMeta(meta);
    setData(data);
    setMoreData(moreData);

}
开发者ID:ruphy,项目名称:kfunambol,代码行数:29,代码来源:Item.cpp


示例17: glGenVertexArrays

bool RenderablePlaneProjection::initialize() {
	glGenVertexArrays(1, &_quad); // generate array
	glGenBuffers(1, &_vertexPositionBuffer); // generate buffer
	
	// Plane program
	if (_shader == nullptr) {
        // Image Plane Program
        RenderEngine& renderEngine = OsEng.renderEngine();
        _shader = renderEngine.buildRenderProgram("Image Plane",
            "${MODULE_BASE}/shaders/imageplane_vs.glsl",
            "${MODULE_BASE}/shaders/imageplane_fs.glsl");
        if (!_shader) return false;
    }

	setTarget(_defaultTarget);
	loadTexture();
	return isReady();
}
开发者ID:EricMyers47,项目名称:OpenSpace,代码行数:18,代码来源:renderableplaneprojection.cpp


示例18: if

void UnitBase::setLocation(int xPos, int yPos) {

	if((xPos == INVALID_POS) && (yPos == INVALID_POS)) {
		ObjectBase::setLocation(xPos, yPos);
	} else if (currentGameMap->tileExists(xPos, yPos)) {
		ObjectBase::setLocation(xPos, yPos);
		realX += TILESIZE/2;
		realY += TILESIZE/2;
		bumpyOffsetX = 0.0f;
		bumpyOffsetY = 0.0f;
	}

	moving = false;
	pickedUp = false;
	setTarget(NULL);

	clearPath();
}
开发者ID:katlogic,项目名称:dunelegacy,代码行数:18,代码来源:UnitBase.cpp


示例19: Deserialize

bool CSettingDependencyCondition::Deserialize(const TiXmlNode *node)
{
  if (!CSettingConditionItem::Deserialize(node))
    return false;

  const TiXmlElement *elem = node->ToElement();
  if (elem == NULL)
    return false;

  m_target = SettingDependencyTargetSetting;
  const char *strTarget = elem->Attribute(SETTING_XML_ATTR_ON);
  if (strTarget != NULL && !setTarget(strTarget))
  {
    CLog::Log(LOGWARNING, "CSettingDependencyCondition: unknown target \"%s\"", strTarget);
    return false;
  }

  if (m_target != SettingDependencyTargetSetting && m_name.empty())
  {
    CLog::Log(LOGWARNING, "CSettingDependencyCondition: missing name for dependency");
    return false;
  }

  if (m_target == SettingDependencyTargetSetting)
  {
    if (m_setting.empty())
    {
      CLog::Log(LOGWARNING, "CSettingDependencyCondition: missing setting for dependency");
      return false;
    }

    m_name = m_setting;
  }

  m_operator = SettingDependencyOperatorEquals;
  const char *strOperator = elem->Attribute(SETTING_XML_ATTR_OPERATOR);
  if (strOperator != NULL && !setOperator(strOperator))
  {
    CLog::Log(LOGWARNING, "CSettingDependencyCondition: unknown operator \"%s\"", strOperator);
    return false;
  }

  return true;
}
开发者ID:Distrotech,项目名称:xbmc,代码行数:44,代码来源:SettingDependency.cpp


示例20: setTarget

// updateObject
// update object by frame...
void CGameCamera::updateObject()
{
	CGameObject::updateObject();

	if ( m_enable && m_targetObject )
	{
		// look target
		setTarget( m_targetObject->getPosition() );
	}
#ifdef GSEDITOR
	else
	{
		if ( getIView()->getActiveCamera() == this )
			m_targetPos = m_camera->getTarget();
	}

	// maybe modify by free animator
	core::vector3df pos = m_camera->getPosition();
	setPosition( pos );	

	if ( getIView()->getActiveCamera() == this )
		m_cameraMesh->setVisible( false );
	else
	{
		m_cameraMesh->setVisible( true );
		m_node = m_cameraMesh;

		core::vector3df rot = m_targetPos - m_position;
		setOrientation( rot );

		m_node = m_camera;
	}
#endif

#ifdef GSGAMEPLAY
	if ( m_camera->getAnimators().size() > 0 )
	{
		m_position = m_camera->getPosition();
		if ( m_targetObject == NULL )
			m_targetPos = m_camera->getTarget();
	}
#endif

}
开发者ID:codeman001,项目名称:gsleveleditor,代码行数:46,代码来源:CGameCamera.cpp



注:本文中的setTarget函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ setTargetBed函数代码示例发布时间:2022-05-30
下一篇:
C++ setTag函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap