本文整理汇总了C++中LinkedList::AddBack方法的典型用法代码示例。如果您正苦于以下问题:C++ LinkedList::AddBack方法的具体用法?C++ LinkedList::AddBack怎么用?C++ LinkedList::AddBack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LinkedList
的用法示例。
在下文中一共展示了LinkedList::AddBack方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MakeExplosion
void MakeExplosion(Point ptLocation, int iNumParticles)
{
for (int iTrav = 0 ; iTrav < iNumParticles ; iTrav ++)
{
Particle *pNew = new Particle ;
pNew->ptLocation.dX = ptLocation.dX ;
pNew->ptLocation.dY = ptLocation.dY ;
pNew->ptLocation.dZ = ptLocation.dZ ;
pNew->ptVelocity.dX = 2 * randp() - 1 ;
pNew->ptVelocity.dY = 2 * randp() - 1 ;
pNew->ptVelocity.dZ = 2 * randp() - 1 ;
pNew->ptColor.dX = 0.98 ;
pNew->ptColor.dY = 0.59 + 0.3 * randp() - 0.15 ;
pNew->ptColor.dZ = 0.01 ;
pNew->dAlpha = 0.7 ;
pNew->dMass = 1 ;
pNew->dLife = 4 * randp() + 3 ;
pNew->ptAcceleration = 0 ;
Particles.AddBack(pNew) ;
}
}
示例2: DisplayHandler
void DisplayHandler () // display callback function
{
if (bRotate)
{
fCameraAngle[0] += 1.0 ;
fCameraAngle[2] += 1.0 ;
}
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) ;
glLoadIdentity() ;
SetCamera() ;
if (!bPause)
{
GLfloat fTempX = GLfloat(iLastMouseX) / GLfloat(iWinWidth) ;
GLfloat fTempY = GLfloat(iLastMouseY) / GLfloat(iWinHeight) ;
GLfloat fFixedX = (Player.ptLocation.dX - 8.65) / -17.3 ;
GLfloat fFixedZ = (Player.ptLocation.dZ - 8.65) / -17.3 ;
if (bRightMouseDown)
{
if (!(fFixedX + 0.02 > fTempX && fFixedX - 0.02 < fTempX))
{
if (fFixedX > fTempX)
{
Player.ptLocation.dX += 0.1 ;
if (Player.ptAngle.dZ > -20)
Player.ptAngle.dZ -= 5.0 ;
} else
{
Player.ptLocation.dX -= 0.1 ;
if (Player.ptAngle.dZ < 20)
Player.ptAngle.dZ += 5.0 ;
}
} else
{
if (Player.ptAngle.dZ < 0) Player.ptAngle.dZ += 5.0 ;
else if (Player.ptAngle.dZ > 0) Player.ptAngle.dZ -= 5.0 ;
}
if (!(fFixedZ + 0.1 > fTempY && fFixedZ - 0.02 < fTempY))
{
if (fFixedZ > fTempY)
{
Player.ptLocation.dZ += 0.1 ;
} else
{
Player.ptLocation.dZ -= 0.1 ;
}
}
} else Player.ptAngle.dZ = 0 ;
if (randp() > 0.98) AddPlanet() ;
AddStar() ;
AddStar() ;
AddStar() ;
AddStar() ;
AddStar() ;
AddStar() ;
if (/*!bExplode && */iCount % 15 == 0) SpawnEnemy() ;
if (!bExplode && bAutofire && iCount % 4 == 0) FireShot(&Player, pPlayerShots) ;
iCount ++ ;
}
DisplayStars() ;
DisplayPlanets() ;
DisplayEnemies() ;
DisplayShots(pPlayerShots) ;
DisplayShots(pEnemyShots) ;
if (bExplode && !bPause)
{
if (iCount == 0)
{
printf("Game over\n") ;
MakeExplosion(Player.ptLocation, 1000) ;
}
} else
{
if (iCount % 4)
{
Particle *pNew = new Particle ;
pNew->ptLocation.dX = Player.ptLocation.dX + randp() * 0.5 - 0.25;
pNew->ptLocation.dY = Player.ptLocation.dY + 0.3 * randp() ;
pNew->ptLocation.dZ = Player.ptLocation.dZ - 1.5 + 0.2 * randp() ;
pNew->ptVelocity.dX = 0 ;
pNew->ptVelocity.dY = 0 ;
pNew->ptVelocity.dZ = -0.2 ;
pNew->ptColor.dX = 0.98 ;
pNew->ptColor.dY = 0.59 + 0.3 * randp() - 0.15 ;
pNew->ptColor.dZ = 0.01 ;
pNew->dAlpha = 0.7 ;
pNew->dMass = 1 ;
pNew->dLife = 7 * randp() + 3 ;
pNew->ptAcceleration = 0 ;
Particles.AddBack(pNew) ;
}
//.........这里部分代码省略.........