本文整理汇总了C++中Opt::GetSpeedX方法的典型用法代码示例。如果您正苦于以下问题:C++ Opt::GetSpeedX方法的具体用法?C++ Opt::GetSpeedX怎么用?C++ Opt::GetSpeedX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Opt
的用法示例。
在下文中一共展示了Opt::GetSpeedX方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Ret
glm::vec4 Grid::Box( Actor const& Obj, double Dt )const
{
Opt<IMoveComponent> moveC = Obj.Get<IMoveComponent>();
float const MvX = moveC.IsValid() ? Dt * moveC->GetSpeedX() : 0.0f;
float const MvY = moveC.IsValid() ? Dt * moveC->GetSpeedY() : 0.0f;
double const Radius = Obj.Get<ICollisionComponent>()->GetRadius();
Opt<IPositionComponent> const objPositionC = Obj.Get<IPositionComponent>();
double const Ox = objPositionC->GetX() - mMin.x;
double const Oy = objPositionC->GetY() - mMin.y;
glm::vec4 Ret( Ox - Radius,
Oy - Radius,
Ox + Radius,
Oy + Radius );
if( MvX < 0.0 )
{
Ret.x += MvX;
}
else
{
Ret.z += MvX;
}
if( MvY < 0.0 )
{
Ret.y += MvY;
}
else
{
Ret.w += MvY;
}
return Ret;
}
示例2: Update
void ParticleSystem::Update( double DeltaTime )
{
for( auto actor: mScene.GetActorsFromMap( GetType_static() ) )
{
Opt<IEmitterComponent> emitterC = actor->Get<IEmitterComponent>();
if (!emitterC.IsValid())
{
continue;
}
Opt<IPositionComponent> positionC = actor->Get<IPositionComponent>();
if( !positionC.IsValid() )
{
continue;
}
Opt<IMoveComponent> moveC = actor->Get<IMoveComponent>();
glm::vec2 distance(0);
if ( moveC.IsValid() && moveC->IsMoving() && !moveC->IsRooted() )
{
distance = glm::vec2(moveC->GetSpeedX()*DeltaTime, moveC->GetSpeedY()*DeltaTime);
}
emitterC->Update( DeltaTime );
std::vector<int32_t> const& emitted = emitterC->GetEmitTypes();
for( std::vector<int32_t>::const_iterator ie = emitted.begin(), ee = emitted.end(); ie != ee; ++ie )
{
static ParticleEngine& pe( ParticleEngine::Get() );
pe.AddParticle( *ie, glm::vec2( positionC->GetX(), positionC->GetY() ), distance, positionC->GetOrientation() );
}
emitterC->Emitted( emitted );
}
}