本文整理汇总了C++中setTarget函数的典型用法代码示例。如果您正苦于以下问题:C++ setTarget函数的具体用法?C++ setTarget怎么用?C++ setTarget使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setTarget函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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());
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
}
示例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));
}
示例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);
}
示例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);
}
示例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;
}
}
示例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);
}
示例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;
}
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}