本文整理汇总了C++中SoundManager::setListenerPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ SoundManager::setListenerPosition方法的具体用法?C++ SoundManager::setListenerPosition怎么用?C++ SoundManager::setListenerPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SoundManager
的用法示例。
在下文中一共展示了SoundManager::setListenerPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
void PlaySpace::update(float time)
{
if(time > 0.25f)
{
ParticleBudget = 0;
time = 0.25f;
}
else
ParticleBudget = 500;
LastDeltaTime = time;
GameTime += time;
GameFrame += 1;
if(!Player)
TimeSincePlayerDestruction += time;
SoundManager* manager = SoundManager::GetInstance();
manager->setListenerPosition(CameraPos);
if(IsStressTesting)
time = 1.f / 30;
if(!IsStressTesting)
for(int i = 0; i < Systems.UsedLength; ++i)
{
Systems[i]->update(time, this);
}
for(int i = 0; i < Bullets.UsedLength; ++i)
{
if(Bullets[i].canBeDespawned())
Bullets.quickRemove(i--);
}
for(int i = 0; i < Particles.UsedLength; ++i)
{
if(Particles[i].canBeDespawned())
Particles.quickRemove(i--);
}
for(int i = 0; i < Ships.UsedLength; ++i)
{
if(Ships[i]->canBeDespawned())
{
ObjectPointer<Ship>(Ships[i]).destroy(); // Object pointer lets other object pointers know that the object got deleted.
Objects.quickRemove(Objects.findIndex(Ships[i]));
Ships.quickRemove(i--);
}
}
for(PhysicsObject* obj : Objects)
obj->update(time, this);
for(GravitySource& src : GravitySources)
src.update(time, this);
for(Bullet& obj : Bullets)
obj.update(time, this);
// The more particles exist the faster time passes for them, the faster they die
float particleTimeFactor = Max(float(Particles.UsedLength) / SoftMaxParticleCount, 1.0f);
for(Particle& particle : Particles)
particle.update(time * particleTimeFactor, this);
// Physics
for(PhysicsObject* obj : Objects)
applyPhysics(obj, time);
for(Bullet& obj : Bullets)
applyPhysics(&obj, time);
for(Particle& particle : Particles)
applyPhysics(&particle, time * particleTimeFactor);
// Add gravity
for(GravitySource& src : GravitySources)
{
float start = src.Position.X - src.Range*2;
float end = src.Position.X + src.Range*2;
for(auto* obj : Objects)
src.influence(obj, time);
for(auto& obj : Bullets)
src.influence(&obj, time);
for(auto& obj : Particles)
src.influence(&obj, time);
}
for(Bullet& bullet : Bullets)
for(Ship* ship : Ships)
if(ship->Faction != bullet.Faction)
if(ship->Status != Ship::Destroyed)
if(IsIntersecting(bullet.Bounds, ship->Bounds))
ship->onHit(&bullet, this);
if(Player)
{
CameraPos = Player->Position;
Renderer.Context.Camera.Position = CameraPos;
// Will be reset to true before next PlaySpace::update
//.........这里部分代码省略.........