void CustomFileDialog::goHome() { if ( getenv( "HOME" ) ) setDir( getenv( "HOME" ) ); else 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(); }
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; }
void Ship::clearShip() { for (auto& it: _bufCells) { it->clearCell(); } _bufCells.clear(); setDir(UNK); }
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")); }
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; } }
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 ); } }
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); }
/*! 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++; }
// ---------------------------------------------------------------------------- // 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(); }
void Ball::reset() { bX=0; bY=0; speed=0; setDir(); }
void CustomFileDialog::bookmarkChosen(int i) { if(i == clearId) { bookmarkList.clear(); bookmarkMenu->clear(); addId = bookmarkMenu->insertItem("Add bookmark"); clearId = bookmarkMenu->insertItem("Clear bookmarks"); bookmarkMenu->insertSeparator(); return; } if(i == addId) { bookmarkList << dirPath(); const char *book_pix[] = {"12 16 3 1", ". c None", "a c #000000", "# c #008080", "............", "............", "........##..", ".......#####", "......#####a", ".....#####a.", "....#####a..", "...#####a...", "..#####a....", ".#####a.....", "aaa##a......", "...#a.......", "...a........", "............", "............", "............"}; bookmarkMenu->insertItem(QIconSet(book_pix), dirPath()); return; } setDir(bookmarkMenu->text(i)); }
void APlayer::treeItemClicked(const QModelIndex &index) { if (m_fsModel->isDir(index)) { setDir(m_fsModel->filePath(index)); } }
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; } }
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); }
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; }
//// // 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; }
ExecutableInfo::ExecutableInfo() : verbose(false) , miMode(false) , silent(false) , stopOnEntry(false) { setDir(getCurrentDirectory()); }
// Functions in shell class // public overrides for functions that are protected in the base class // Write virtual function overries used to decide on static/virtual calls void QUrlInfo_QtDShell::__override_setDir(bool b0, bool static_call) { if (static_call) { QUrlInfo::setDir((bool )b0); } else { setDir((bool )b0); } }
/** * @brief SourceDirectoryWidget::browseButtonAction * Opens a directory selection dialog, the chosen location will be the new source directory. */ void SourceDirectoryWidget::browseButtonAction() { QString dir = QFileDialog::getExistingDirectory(this, tr("Select Directory"), lineedit->text(), QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); if (!dir.isNull()) { setDir(dir); } }
void SymbolDialog::dirSelected (const QString &d) { if (mode() == Q3FileDialog::DirectoryOnly) { blockSignals(TRUE); setDir(basePath); blockSignals(FALSE); return; } if (d.length() < basePath.length()) { blockSignals(TRUE); setDir(basePath); blockSignals(FALSE); } }
bool Guardian::init() { // initFightData(100001); // initViewRes(); // initFightState(); setDir(NONE); return true; }
//FIXME crash on shutdown void KateFileSelector::setActiveDocumentDir() { // kdDebug(13001)<<"KateFileSelector::setActiveDocumentDir()"<<endl; KURL u = mainwin->activeDocumentUrl(); // kdDebug(13001)<<"URL: "<<u.prettyURL()<<endl; if (!u.isEmpty()) setDir( u.upURL() ); // kdDebug(13001)<<"... setActiveDocumentDir() DONE!"<<endl; }
// Set a ray based on two points void CRay::set(const CPos &ptA, const CPos &ptB) { // Create the vector from point A to B CVector vec = ptB - ptA; setOrigin(ptA); // Set the origin setDir(vec); // Set the direction setLength(vec.magnitude()); // Set the length }
ImageExport::ImageExport(QString dirName, QString type, double scale, double quality, double dpi, bool overwrite) { setDir(dirName); setType(type); setScale(scale); setQuality(quality); setDPI(dpi); setOverWrite(overwrite); }
void AudioBrowserScreen::select(int index) { if (listView->isDir(index)) setDir(currDir + "/" + listView->dir(index)); else { emit folderSelected(currDir, false, 0, 0); lower(); } }
bool DirectoryView::qt_invoke( int _id, QUObject* _o ) { switch ( _id - staticMetaObject()->slotOffset() ) { case 0: setDir((const QString&)static_QUType_QString.get(_o+1)); break; case 1: slotFolderSelected((QListViewItem*)static_QUType_ptr.get(_o+1)); break; case 2: openFolder(); break; default: return QListView::qt_invoke( _id, _o ); } return TRUE; }
void EditBookmarkDialog::selectDir() { QFileDialog dlg(this, tr("Select directory"), dir()); dlg.setAcceptMode(QFileDialog::AcceptOpen); dlg.setFileMode(QFileDialog::DirectoryOnly); dlg.setReadOnly(true); if (dlg.exec()) setDir(dlg.selectedFiles()[0]); }
void Robot::resetRobot() { resetSpeeds(); dBodySetLinearVel(chassis->body,0,0,0); dBodySetAngularVel(chassis->body,0,0,0); dBodySetLinearVel(dummy->body,0,0,0); dBodySetAngularVel(dummy->body,0,0,0); dBodySetLinearVel(kicker->box->body,0,0,0); dBodySetAngularVel(kicker->box->body,0,0,0); for (int i=0;i<4;i++) { dBodySetLinearVel(wheels[i]->cyl->body,0,0,0); dBodySetAngularVel(wheels[i]->cyl->body,0,0,0); } float x,y; getXY(x,y); setXY(x,y); if (m_dir==-1) setDir(180); else setDir(0); }
void Slime::update(float ft) { Aware::update(ft); if (this->isDie()) return; //Ïò×ÅÓ¢ÐÛ¿¿Â£ b2Vec2 vec = this->getBody()->GetLinearVelocity(); float heroX = GameManager::getInstance()->hero->getPositionX(); float heroY = GameManager::getInstance()->hero->getPositionY(); //×÷Ó÷¶Î§ if (abs(this->getPosition().x - heroX) > SD_FLOAT("slime_float_sight_distance") || abs(this->getPosition().y - heroY) > SD_FLOAT("slime_float_sight_distance")) { vec.x = 0; vec.y = 0; this->getBody()->SetLinearVelocity(vec); return; } if (heroX < this->getPositionX()) { if (getDir() != DIR_LEFT) { setDir(DIR_LEFT); moveLeft(); } vec.x = -getSpeed(); } else { if (getDir() != DIR_RIGHT) { setDir(DIR_RIGHT); moveRight(); } vec.x = getSpeed(); } this->getBody()->SetLinearVelocity(vec); }