本文整理汇总了C++中setDir函数的典型用法代码示例。如果您正苦于以下问题:C++ setDir函数的具体用法?C++ setDir怎么用?C++ setDir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setDir函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setDir
Direction Ship::resetDir() {
if (_bufCells.size() < 2) {
setDir(UNK);
} else {
if (_bufCells.front()->getPosX() == _bufCells.back()->getPosX()) {
setDir(HORIZONTAL);
} else setDir(VERTICAL);
}
return getDir();
}
示例2: getPos
void EnemyShip::updateAI(osg::Vec3f _playerPos, std::list<Projectile>& _missiles, osg::ref_ptr<osg::MatrixTransform> _mSceneTrans, float _dt)
{
//std::cout << "enemypos = " << getPos().x() << ", " << getPos().y() << ", " << getPos().z() << std::endl;
osg::Vec3f diffVec = _playerPos - getPos();
osg::Quat tempQuat = getOrientation();
tempQuat.makeRotate(getDir(), diffVec);
setDir(diffVec / diffVec.length());
if (diffVec.length() > 1000.0f)
translate(getDir()*5.0f);
else {
}
rotate(tempQuat);
tempQuat = getOrientation();
osg::Quat tempQuat2;
tempQuat2.makeRotate(tempQuat * osg::Vec3f(0.0, 1.0, 0.0), getDir());
tempQuat = tempQuat * tempQuat2;
if (attackCooldown <= 0.0) {
std::cout << "Enemy Laser!" << std::endl;
_missiles.push_back(Projectile((std::string)("Laser"), getPos() + tempQuat * osg::Vec3f(0.0, 450.0, 0.0), getDir(), tempQuat, (std::string)("models/skottg.ive"), _mSceneTrans, 50, 4000, false));
attackCooldown = 8.0;
}
else
attackCooldown -= _dt;
}
示例3: QWidget
void QPreviewFileDialog::initDlg()
{
ImageIOSupporter iisup;
QStringList filters;
QString qs;
if(mPreviewMode)
{
QWidget* widget = new QWidget(this);
QVBoxLayout* qvbl = new QVBoxLayout(widget);
mpPreviewCheckBox = new QCheckBox(tr("Show preview"),widget);
connect(mpPreviewCheckBox,SIGNAL(toggled(bool)),
this,SLOT(slotShowPreview(bool)));
mpPixWidget = new QLabel(widget);
mpPixWidget->setMinimumWidth(200);
qvbl->setMargin(5);
qvbl->addWidget(mpPreviewCheckBox);
qvbl->addWidget(mpPixWidget);
qvbl->setStretchFactor (mpPixWidget,1);
mpPixWidget->setPalette(QColor(lightGray));
addLeftWidget(widget);
resize(550,300);
}
mImageFormat =xmlConfig->stringValue("VIEWER_IMAGE_TYPE","ALL_FILES");
filters = iisup.getOrderedOutFilterList(mImageFormat);
setDir(xmlConfig->stringValue("SINGLEFILE_SAVE_PATH"));
setFilters(filters);
setMode(QFileDialog::AnyFile);
setSizeGripEnabled(false);
setViewMode((QFileDialog::ViewMode)xmlConfig->intValue("SINGLEFILE_VIEW_MODE"));
}
示例4: switch
void Guardian::enterState(int nextState)
{
switch (nextState) {
case IDLE:
{
}
break;
case CHASE:
{
setTargetToActor(man);
if (man->getPositionX()>=getPositionX()) {
targetMovePos.x = man->getPositionX() - 110;
}else{
targetMovePos.x = man->getPositionX() + 110;
}
Move2Target(targetMovePos);
}
break;
case SKILL:
{
setDir(man->getFlipX()?LEFT:RIGHT);
}
break;
default:
break;
}
}
示例5: QFileDialog
CustomFileDialog::CustomFileDialog()
: QFileDialog( 0, 0, TRUE )
{
setDir( "/" );
dirView = new DirectoryView( this, 0, TRUE );
dirView->addColumn( "" );
dirView->header()->hide();
::Directory *root = new ::Directory( dirView, "/" );
root->setOpen( TRUE );
dirView->setFixedWidth( 150 );
addLeftWidget( dirView );
QPushButton *p = new QPushButton( this );
p->setPixmap( QPixmap( bookmarks ) );
QToolTip::add( p, tr( "Bookmarks" ) );
bookmarkMenu = new QPopupMenu( this );
connect( bookmarkMenu, SIGNAL( activated( int ) ),
this, SLOT( bookmarkChosen( int ) ) );
addId = bookmarkMenu->insertItem( tr( "Add bookmark" ) );
bookmarkMenu->insertSeparator();
QFile f( ".bookmarks" );
if ( f.open( IO_ReadOnly ) ) {
QDataStream ds( &f );
ds >> bookmarkList;
f.close();
QStringList::Iterator it = bookmarkList.begin();
for ( ; it != bookmarkList.end(); ++it ) {
bookmarkMenu->insertItem( *it );
}
}
示例6: lostBall
void lostBall() {
//Unfortunately we lost track of where the ball was.
//We could try to relocate it, we're going back to seek mode.
setSpeed(0);
clearLCD(LCD);
sendStringToLCD(LCD, "Lost the ball!");
_delay_ms(10);
unsigned dirL = getDirL();
unsigned dirR = getDirR();
setDirL(-1);
setDirR(-1);
setSpeed(EVASIVE_SPEED);
_delay_ms(EVASIVE_REV_DURATION);
setSpeed(0);
_delay_ms(250);
setDir(1);
setSpeed(0);
setDirL(dirL);
setDirR(dirR);
//disableTBDetect();
botState.phoneLooking = false;
setBotMode(MODE_PICKUP);
}
示例7: setDir
/*!
SLRay::SLRay constructor for shadow rays
*/
SLRay::SLRay(SLfloat distToLight,
SLVec3f dirToLight,
SLRay* rayFromHitPoint)
{
origin = rayFromHitPoint->hitPoint;
setDir(dirToLight);
type = SHADOW;
length = distToLight;
lightDist = distToLight;
depth = rayFromHitPoint->depth;
hitPoint = SLVec3f::ZERO;
hitNormal = SLVec3f::ZERO;
hitTexCol = SLCol4f::BLACK;
hitTriangle = -1;
hitNode = 0;
hitMesh = 0;
hitMat = 0;
originNode = rayFromHitPoint->hitNode;
originMesh = rayFromHitPoint->hitMesh;
originTria = rayFromHitPoint->hitTriangle;
originMat = rayFromHitPoint->hitMat;
x = rayFromHitPoint->x;
y = rayFromHitPoint->y;
contrib = 0.0f;
isOutside = rayFromHitPoint->isOutside;
shadowRays++;
}
示例8: getEntry
// ----------------------------------------------------------------------------
// ArchiveEntryList::onListItemActivated
//
// Called when a list item is 'activated' (double-click or enter)
// ----------------------------------------------------------------------------
void ArchiveEntryList::onListItemActivated(wxListEvent& e)
{
// Get item entry
ArchiveEntry* entry = getEntry(e.GetIndex());
// Do nothing if NULL (shouldn't be)
if (!entry)
return;
// If it's a folder, open it
if (entry->getType() == EntryType::folderType())
{
// Get directory to open
ArchiveTreeNode* dir = nullptr;
if (entry == entry_dir_back)
dir = (ArchiveTreeNode*)current_dir->getParent(); // 'Back directory' entry, open current dir's parent
else
dir = archive->getDir(entry->getName(), current_dir);
// Check it exists (really should)
if (!dir)
{
LOG_MESSAGE(1, "Error: Trying to open nonexistant directory");
return;
}
// Set current dir
setDir(dir);
}
else
e.Skip();
}
示例9: setDir
void Ball::reset()
{
bX=0;
bY=0;
speed=0;
setDir();
}
示例10: setDir
void APlayer::treeItemClicked(const QModelIndex &index)
{
if (m_fsModel->isDir(index))
{
setDir(m_fsModel->filePath(index));
}
}
示例11: switch
void Piece::virtualComeBack()
{
switch (getDir())
{
case Dir::Up:
setDir(Dir::Down);
case Dir::Down:
setDir(Dir::Up);
case Dir::Left:
setDir(Dir::Right);
case Dir::Right:
setDir(Dir::Left);
default:
break;
}
}
示例12: dir
void CAA_DragonFire::init(FloatRect dragonRect, bool bOrientation, CGame * pGame, int WormID, int TeamID) {
m_pGame = pGame;
m_WormID = WormID;
m_TeamID = TeamID;
m_bOrientation = bOrientation;
m_pSprite = g_pSpritepool->at(SPRITEID::DRAGONFIRE);
FloatRect FR;
CVec dir(0.0f,0.0f);
setIsSolid(true);
setCanMove(true);
FR = m_pSprite->GetRect();
if (m_bOrientation == OLEFT) {
FR.x = dragonRect.x;
dir.x = -500.0f;
} else {
FR.x = dragonRect.x+dragonRect.w-FR.w;
dir.x = 500.0f;
}
FR.y = dragonRect.y;
if (m_bOrientation == OLEFT)//Physical rect is smaller then sprite ;) --> looks better
FR.y -= 20.0f;
else
FR.w -= 20.0f;
setDir(dir);
setRect(FR);
setHasGravity(false);
initKillTime(1.5f);
}
示例13: step
void Robot::step()
{
if (on)
{
if (firsttime)
{
if (m_dir==-1) setDir(180);
firsttime = false;
}
wheels[0]->step();
wheels[1]->step();
wheels[2]->step();
wheels[3]->step();
kicker->step();
}
else {
if (last_state)
{
wheels[0]->speed = wheels[1]->speed = wheels[2]->speed = wheels[3]->speed = 0;
kicker->setRoller(0);
wheels[0]->step();
wheels[1]->step();
wheels[2]->step();
wheels[3]->step();
kicker->step();
}
}
last_state = on;
}
示例14: StatusBox
////
// Process the stuff of the player when playing in a normal level
void CPlayer::processInLevel()
{
StatusBox();
if (pdie) dieanim();
else
{
inhibitwalking = false;
inhibitfall = false;
// when walking through the exit door don't show keen's sprite past
// the door frame (so it looks like he walks "through" the door)
if(!pfrozentime)
{
if (!level_done)
ProcessInput();
else
ProcessExitLevel();
}
setDir();
if(!level_done)
{
getgoodies();
raygun();
keencicle();
}
if(!pfrozentime)
{
if(!pjumping)
{
Walking();
WalkingAnimation();
}
}
checkSolidDoors();
InertiaAndFriction_X();
if(!level_done)
{
TogglePogo_and_Switches();
JumpAndPogo();
}
// Check collision with other objects
performCollisions();
checkObjSolid();
if(!inhibitfall) Playerfalling();
}
processEvents();
if(pSupportedbyobject)
blockedd = true;
}
示例15: verbose
ExecutableInfo::ExecutableInfo()
: verbose(false)
, miMode(false)
, silent(false)
, stopOnEntry(false)
{
setDir(getCurrentDirectory());
}