本文整理汇总了C++中CEntity::getPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ CEntity::getPosition方法的具体用法?C++ CEntity::getPosition怎么用?C++ CEntity::getPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CEntity
的用法示例。
在下文中一共展示了CEntity::getPosition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: process
void CCameraFeedbackNotifier::process(const std::shared_ptr<CMessage>& message) {
//Ambas hacen lo mismo de momento, pero lo dejo separado por si luego queremos poner
//comportamientos distintos en función del daño
switch( message->getMessageType() ) {
case Message::DAMAGED: {
std::shared_ptr<CMessageDamaged> damageMess = std::static_pointer_cast<CMessageDamaged>(message);
CEntity* enemy = damageMess->getEnemy();
if(enemy != NULL)
damaged( enemy->getPosition() );
break;
}
/*case Message::SET_REDUCED_DAMAGE: {
damaged();
break;
}*/
case Message::FLASH: {
std::shared_ptr<CMessageFlash> flashMsg = std::static_pointer_cast<CMessageFlash>(message);
_flashFactor = flashMsg->getFlashFactor();
_flashVisible = true;
_scene->setCompositorVisible(_flashEffect, true);
break;
}
}
} // process
示例2: update
bool CCollisionManager::update()
{
CEntity *entity;
for (entityIter=T_entities.begin(); entityIter!=T_entities.end(); ++entityIter)
{
entity = *entityIter;
/*
Check entities with terrain end make proper response,
all 4 must be checked since we ce be in the corner.
*/
if (entity->isActive())
{
// 1. get logical position
vector2i pos = CConversions::realToLogical(entity->getPosition());
// 2. extract proper planes of nearby block
check(entity,pos+vector2i(0,-1));
check(entity,pos+vector2i(0,1));
check(entity,pos+vector2i(-1,0));
check(entity,pos+vector2i(1,0));
/* ? check(entity,pos+vector2i(1,1));
check(entity,pos+vector2i(1,-1));
check(entity,pos+vector2i(-1,-1));
check(entity,pos+vector2i(-1,1)); ? */
// just clamp entity to the bottom if we are below min level
vector3f ePos = entity->getPosition();
if (ePos[1]<CV_CAMERA_MIN_FPS_Y_POS)
{
ePos[1] = CV_CAMERA_MIN_FPS_Y_POS;
entity->setPosition(ePos);
}
}
}
return true;
}
示例3: selectEntity
//---------------------------------------------------------------------------
bool CRenderWidget::selectEntity(QGraphicsItem *item)
{
if (mSelectionRects.contains(item))
{
return false;
}
clearSelection();
if (!item)
{
return false;
}
QPen dashedPen;
dashedPen.setStyle(Qt::DashLine);
if (!mSelectedItems.contains(item))
{
mSelectedItems.push_back(item);
mSelectionRects.push_back(mScene.addRect(item->pos().x(), item->pos().y(), item->boundingRect().width(), item->boundingRect().height(), dashedPen));
emit itemSelected(item);
CEntity* entity = Globals::getCurrentScene()->getEntityFromGraphicsView(mSelectedItems.first());
if (entity)
{
mOriginalPosition = entity->getPosition();
}
return true;
}
return false;
}