当前位置: 首页>>代码示例>>C++>>正文


C++ StepTimer::GetFramesPerSecond方法代码示例

本文整理汇总了C++中dx::StepTimer::GetFramesPerSecond方法的典型用法代码示例。如果您正苦于以下问题:C++ StepTimer::GetFramesPerSecond方法的具体用法?C++ StepTimer::GetFramesPerSecond怎么用?C++ StepTimer::GetFramesPerSecond使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dx::StepTimer的用法示例。


在下文中一共展示了StepTimer::GetFramesPerSecond方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Update

// Updates the text to be displayed.
void SampleFpsTextRenderer::Update(DX::StepTimer const& timer)
{
	// Update display text.
	uint32 fps = timer.GetFramesPerSecond();

	m_text = (fps > 0) ? std::to_wstring(fps) + L" FPS" : L" - FPS";

	ComPtr<IDWriteTextLayout> textLayout;
	DX::ThrowIfFailed(
		m_deviceResources->GetDWriteFactory()->CreateTextLayout(
			m_text.c_str(),
			(uint32) m_text.length(),
			m_textFormat.Get(),
			240.0f, // Max width of the input text.
			50.0f, // Max height of the input text.
			&textLayout
			)
		);

	DX::ThrowIfFailed(
		textLayout.As(&m_textLayout)
		);

	DX::ThrowIfFailed(
		m_textLayout->GetMetrics(&m_textMetrics)
		);
}
开发者ID:terriblememory,项目名称:imgui,代码行数:28,代码来源:SampleFpsTextRenderer.cpp

示例2: Update

// 更新要显示的文本。
void SampleFpsTextRenderer::Update(DX::StepTimer const& timer)
{
	// 更新显示文本。
	uint32 fps = timer.GetFramesPerSecond();

	m_text = (fps > 0) ? std::to_wstring(fps) + L" FPS" : L" - FPS";

	DX::ThrowIfFailed(
		m_deviceResources->GetDWriteFactory()->CreateTextLayout(
			m_text.c_str(),
			(uint32) m_text.length(),
			m_textFormat.Get(),
			240.0f, // 输入文本的最大宽度。
			50.0f, // 输入文本的最大高度。
			&m_textLayout
			)
		);

	DX::ThrowIfFailed(
		m_textLayout->GetMetrics(&m_textMetrics)
		);
}
开发者ID:moso31,项目名称:NewRepo,代码行数:23,代码来源:SampleFpsTextRenderer.cpp


注:本文中的dx::StepTimer::GetFramesPerSecond方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。