本文整理汇总了C++中Timer::GetFrameNumber方法的典型用法代码示例。如果您正苦于以下问题:C++ Timer::GetFrameNumber方法的具体用法?C++ Timer::GetFrameNumber怎么用?C++ Timer::GetFrameNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Timer
的用法示例。
在下文中一共展示了Timer::GetFrameNumber方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SelectSprite
void SelectSprite(int iSelection)
{
if (iSelection > MAX_SPRITES)
{
assert(FALSE);
return;
}
float time = float(g_Timer.GetFrameNumber()) / 30;
// Apply animation to the sprite.
// NOTE: If the sprite is already selected, this call is still used
// to apply "wobble" to the sprite.
g_pSprites[iSelection].AnimateBoundingBox(g_rcBig, time, ANIMATION_DURATION );
// Unselect the current selection.
if ((g_Selection != -1) && (g_Selection != iSelection))
{
g_pSprites[ g_Selection ].AnimateBoundingBox(g_rcSmall[ g_Selection ], time, ANIMATION_DURATION );
}
g_Selection = iSelection;
}
示例2: RenderFrame
HRESULT RenderFrame(HWND hwnd)
{
HRESULT hr = S_OK;
if (g_pRT && g_pRT->CheckWindowState() == D2D1_WINDOW_STATE_OCCLUDED)
{
return S_OK; // The render target is occluded.
}
if (!g_pRT)
{
// Create the Direct2D resources.
hr = CreateDrawingResources(hwnd);
}
if (SUCCEEDED(hr))
{
float fTime = float(g_Timer.GetFrameNumber()) / 30;
g_pRT->BeginDraw();
g_pRT->Clear(BACKGROUND_COLOR);
// Update and draw each sprite.
for (DWORD i = 0; i < MAX_SPRITES; i++)
{
Sprite *pSprite = &g_pSprites[i];
if (pSprite)
{
pSprite->Update(g_pRT, fTime);
pSprite->Draw(g_pRT);
}
}
// Reset the transform to the identiy matrix.
g_pRT->SetTransform(D2D1::Matrix3x2F::Identity());
hr = g_pRT->EndDraw();
}
return hr;
}