本文整理汇总了C++中Stopwatch::msF方法的典型用法代码示例。如果您正苦于以下问题:C++ Stopwatch::msF方法的具体用法?C++ Stopwatch::msF怎么用?C++ Stopwatch::msF使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stopwatch
的用法示例。
在下文中一共展示了Stopwatch::msF方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawScene
/// <summary>
/// シーンを描画します。
/// </summary>
/// <returns>
/// なし
/// </returns>
void drawScene() const
{
if (!m_current)
{
return;
}
if (m_transitionState == TransitionState::Active || !m_transitionTimeMillisec)
{
m_current->draw();
}
const double elapsed = m_stopwatch.msF();
if (m_transitionState == TransitionState::FadeIn)
{
m_current->drawFadeIn(elapsed / m_transitionTimeMillisec);
}
else if (m_transitionState == TransitionState::FadeOut)
{
m_current->drawFadeOut(elapsed / m_transitionTimeMillisec);
}
else if (m_transitionState == TransitionState::FadeInOut)
{
m_current->drawFadeOut(elapsed / m_transitionTimeMillisec);
if (m_next)
{
m_next->drawFadeIn(elapsed / m_transitionTimeMillisec);
}
}
}
示例2: updateSingle
bool updateSingle()
{
double elapsed = m_stopwatch.msF();
if (m_transitionState == TransitionState::FadeOut && elapsed >= m_transitionTimeMillisec)
{
m_current = nullptr;
m_current = m_factories[m_nextState]();
if (hasError())
{
return false;
}
m_currentState = m_nextState;
m_transitionState = TransitionState::FadeIn;
m_stopwatch.restart();
elapsed = 0.0;
}
if (m_transitionState == TransitionState::FadeIn && elapsed >= m_transitionTimeMillisec)
{
m_stopwatch.reset();
m_transitionState = TransitionState::Active;
}
switch (m_transitionState)
{
case TransitionState::FadeIn:
assert(m_transitionTimeMillisec);
m_current->updateFadeIn(elapsed / m_transitionTimeMillisec);
return !hasError();
case TransitionState::Active:
m_current->update();
return !hasError();
case TransitionState::FadeOut:
assert(m_transitionTimeMillisec);
m_current->updateFadeOut(elapsed / m_transitionTimeMillisec);
return !hasError();
default:
return false;
}
}
示例3: updateCross
bool updateCross()
{
const double elapsed = m_stopwatch.msF();
if (m_transitionState == TransitionState::FadeInOut)
{
if (elapsed >= m_transitionTimeMillisec)
{
m_current = m_next;
m_next = nullptr;
m_stopwatch.reset();
m_transitionState = TransitionState::Active;
}
}
if (m_transitionState == TransitionState::Active)
{
m_current->update();
return !hasError();
}
else
{
assert(m_transitionTimeMillisec);
const double t = elapsed / m_transitionTimeMillisec;
m_current->updateFadeOut(t);
if (hasError())
{
return false;
}
m_next->updateFadeIn(t);
return !hasError();
}
}