本文整理汇总了C++中DiceRange::GetMaxValue方法的典型用法代码示例。如果您正苦于以下问题:C++ DiceRange::GetMaxValue方法的具体用法?C++ DiceRange::GetMaxValue怎么用?C++ DiceRange::GetMaxValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DiceRange
的用法示例。
在下文中一共展示了DiceRange::GetMaxValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitParticles
void CParticleJetEffectPainter::InitParticles (const CVector &vInitialPos)
// Init
//
// Make sure particle array is initialized
{
if (m_Particles.GetCount() == 0)
{
// Compute the maximum number of particles that we could ever have
int iNewParticleRate = m_EmitRate.GetMaxValue();
int iParticleLifetime = m_ParticleLifetime.GetMaxValue();
int iMaxParticleCount = Max(0, iParticleLifetime * iNewParticleRate);
// Initialize the array
m_Particles.Init(iMaxParticleCount);
}
}
示例2: Paint
void CParticleJetEffectPainter::Paint (CG32bitImage &Dest, int x, int y, SViewportPaintCtx &Ctx)
// Paint
//
// Paint the effect
{
int iParticleLifetime = m_ParticleLifetime.GetMaxValue();
// Particles move the opposite direction from the shot
int iTrailDirection = Ctx.iRotation;
// If we're using the object center then we paint at the object center.
// Otherwise we paint at the given position.
int xPaint;
int yPaint;
if (m_bUseObjectCenter)
{
if (Ctx.pObj)
Ctx.XForm.Transform(Ctx.pObj->GetPos(), &xPaint, &yPaint);
else
{
// If we don't have an object then we use the viewport center. This
// handles the case where we paint in TransData (where there is
// no object).
xPaint = Ctx.xCenter;
yPaint = Ctx.yCenter;
}
}
else
{
xPaint = x;
yPaint = y;
}
// If we haven't created any particles yet, do it now
if (m_iCurDirection == -1
&& !Ctx.bFade)
{
m_iLastDirection = iTrailDirection;
m_iCurDirection = iTrailDirection;
// Figure out the position where we create particles
CVector vPos;
// If we're using the object center then it means that x,y is where
// we emit particles from. We need to convert from screen coordinates
// to object-relative coordinates.
if (m_bUseObjectCenter)
vPos = CVector((x - xPaint) * g_KlicksPerPixel, (yPaint - y) * g_KlicksPerPixel);
// Initialize last emit position
m_vLastEmitPos = (m_bUseObjectMotion && Ctx.pObj ? Ctx.pObj->GetPos() + vPos : vPos);
// Create particles
CreateNewParticles(Ctx.pObj, m_EmitRate.Roll(), vPos, CalcInitialVel(Ctx.pObj));
}
// Paint with the painter
if (m_pParticlePainter)
{
// If we can get a paint descriptor, use that because it is faster
SParticlePaintDesc Desc;
if (m_pParticlePainter->GetParticlePaintDesc(&Desc))
{
Desc.iMaxLifetime = iParticleLifetime;
m_Particles.Paint(Dest, xPaint, yPaint, Ctx, Desc);
}
// Otherwise, we use the painter for each particle
else
m_Particles.Paint(Dest, xPaint, yPaint, Ctx, m_pParticlePainter);
}
// Update
m_iCurDirection = iTrailDirection;
}