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

C++ setDir函数代码示例

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

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



在下文中一共展示了setDir函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
开发者ID:npo6ka,项目名称:OPP,代码行数:10,代码来源:ship.cpp


示例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;
}
开发者ID:flair2005,项目名称:GameOfDomes_domeClient,代码行数:30,代码来源:EnemyShip.cpp


示例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"));
}
开发者ID:arunjalota,项目名称:paperman,代码行数:30,代码来源:qpreviewfiledialog.cpp


示例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;
    }

}
开发者ID:ff78,项目名称:son,代码行数:30,代码来源:Guardian.cpp


示例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 );
	}
    }
开发者ID:opieproject,项目名称:qte-opie,代码行数:35,代码来源:qdir.cpp


示例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);
}
开发者ID:NaterGator,项目名称:IMDL-GunnerBot,代码行数:25,代码来源:isrFuncs.c


示例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++;
}
开发者ID:liguangzheng,项目名称:slproject,代码行数:30,代码来源:SLRay.cpp


示例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();
}
开发者ID:Gaerzi,项目名称:SLADE,代码行数:37,代码来源:ArchiveEntryList.cpp


示例9: setDir

void Ball::reset()
{
	bX=0;
	bY=0;
	speed=0;
	setDir();
}
开发者ID:Ceje,项目名称:CSC525-Project-Pong,代码行数:7,代码来源:Ball.cpp


示例10: setDir

void APlayer::treeItemClicked(const QModelIndex &index)
{
	if (m_fsModel->isDir(index))
	{
		setDir(m_fsModel->filePath(index));
	}
}
开发者ID:chemikadze,项目名称:oldschool,代码行数:7,代码来源:aplayer.cpp


示例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;
	}
}
开发者ID:qingnia,项目名称:HuaRongDao,代码行数:16,代码来源:Piece.cpp


示例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);
}
开发者ID:xy124,项目名称:Spill,代码行数:29,代码来源:CAA_DragonFire.cpp


示例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;
}
开发者ID:KRSSG,项目名称:robocupssl_old,代码行数:29,代码来源:robot.cpp


示例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;
}
开发者ID:alicecola31,项目名称:Commander-Genius,代码行数:61,代码来源:CPlayerLevel.cpp


示例15: verbose

ExecutableInfo::ExecutableInfo()
	: verbose(false) 
	, miMode(false)
	, silent(false)
	, stopOnEntry(false)
{
	setDir(getCurrentDirectory());
}
开发者ID:Stretto,项目名称:mago,代码行数:8,代码来源:cmdline.cpp


示例16: setDir

// 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);
    }
}
开发者ID:dreamsxin,项目名称:nawia,代码行数:11,代码来源:QUrlInfo_shell.cpp


示例17: blockSignals

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);
  }
}
开发者ID:DigitalPig,项目名称:qtstalker-qt4,代码行数:17,代码来源:SymbolDialog.cpp


示例18: setDir

bool Guardian::init()
{
//    initFightData(100001);
//    initViewRes();
//    initFightState();
    
    setDir(NONE);
    return true;
}
开发者ID:ff78,项目名称:son,代码行数:9,代码来源:Guardian.cpp


示例19: setDir

//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;
}
开发者ID:Fat-Zer,项目名称:tdebase,代码行数:10,代码来源:katefileselector.cpp


示例20: setOrigin

// 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	
}
开发者ID:88er,项目名称:tutorials,代码行数:10,代码来源:ray.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ setDirection函数代码示例发布时间:2022-05-30
下一篇:
C++ setDimensions函数代码示例发布时间: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