本文整理汇总了C++中Timer::GetElapsedTimeInSec方法的典型用法代码示例。如果您正苦于以下问题:C++ Timer::GetElapsedTimeInSec方法的具体用法?C++ Timer::GetElapsedTimeInSec怎么用?C++ Timer::GetElapsedTimeInSec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Timer
的用法示例。
在下文中一共展示了Timer::GetElapsedTimeInSec方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: flip
void GSFrame::flip(draw_context_t)
{
++m_frames;
static Timer fps_t;
if (fps_t.GetElapsedTimeInSec() >= 0.5)
{
std::string title = fmt::format("FPS: %.2f", (double)m_frames / fps_t.GetElapsedTimeInSec());
if (!m_title_message.empty())
title += " | " + m_title_message;
if (!Emu.GetTitle().empty())
title += " | " + Emu.GetTitle();
if (!Emu.GetTitleID().empty())
title += " | [" + Emu.GetTitleID() + "]";
// can freeze on exit
SetTitle(wxString(title.c_str(), wxConvUTF8));
m_frames = 0;
fps_t.Start();
}
}
示例2: Flip
void GLGSFrame::Flip()
{
if(!canvas) return;
canvas->SetCurrent();
static Timer fps_t;
canvas->SwapBuffers();
m_frames++;
if(fps_t.GetElapsedTimeInSec() >= 0.5)
{
SetTitle(wxString::Format("FPS: %.2f", (double)m_frames / fps_t.GetElapsedTimeInSec()));
m_frames = 0;
fps_t.Start();
}
}
示例3: Flip
void GLGSFrame::Flip(void* context)
{
if (!canvas) return;
canvas->SetCurrent(*(wxGLContext*)context);
static Timer fps_t;
canvas->SwapBuffers();
m_frames++;
const std::string sub_title = Emu.GetTitle() + (Emu.GetTitleID().length() ? " [" + Emu.GetTitleID() + "] | " : " | ");
if (fps_t.GetElapsedTimeInSec() >= 0.5)
{
// can freeze on exit
SetTitle(wxString(sub_title.c_str(), wxConvUTF8) + wxString::Format("FPS: %.2f", (double)m_frames / fps_t.GetElapsedTimeInSec()));
m_frames = 0;
fps_t.Start();
}
}