Device info and frame rate display for linux,
fixed timer on linux
This commit is contained in:
parent
66607e2d2f
commit
bddaaf13cf
1 changed files with 53 additions and 36 deletions
|
|
@ -327,10 +327,8 @@ void VulkanExampleBase::renderLoop()
|
|||
fpsTimer += (float)tDiff;
|
||||
if (fpsTimer > 1000.0f)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
std::string windowTitle = getWindowTitle();
|
||||
SetWindowText(window, windowTitle.c_str());
|
||||
#endif
|
||||
fpsTimer = 0.0f;
|
||||
frameCounter = 0.0f;
|
||||
}
|
||||
|
|
@ -348,9 +346,29 @@ void VulkanExampleBase::renderLoop()
|
|||
free(event);
|
||||
}
|
||||
render();
|
||||
frameCounter++;
|
||||
auto tEnd = std::chrono::high_resolution_clock::now();
|
||||
auto tDiff = std::chrono::duration<double, std::milli>(tEnd - tStart).count();
|
||||
frameTimer = tDiff / 1000.0f;
|
||||
// Convert to clamped timer value
|
||||
if (!paused)
|
||||
{
|
||||
timer += timerSpeed * frameTimer;
|
||||
if (timer > 1.0)
|
||||
{
|
||||
timer -= 1.0f;
|
||||
}
|
||||
}
|
||||
fpsTimer += (float)tDiff;
|
||||
if (fpsTimer > 1000.0f)
|
||||
{
|
||||
std::string windowTitle = getWindowTitle();
|
||||
xcb_change_property(connection, XCB_PROP_MODE_REPLACE,
|
||||
window, XCB_ATOM_WM_NAME, XCB_ATOM_STRING, 8,
|
||||
windowTitle.size(), windowTitle.c_str());
|
||||
fpsTimer = 0.0f;
|
||||
frameCounter = 0.0f;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
@ -849,9 +867,10 @@ xcb_window_t VulkanExampleBase::setupWindow()
|
|||
window, (*reply).atom, 4, 32, 1,
|
||||
&(*atom_wm_delete_window).atom);
|
||||
|
||||
std::string windowTitle = getWindowTitle();
|
||||
xcb_change_property(connection, XCB_PROP_MODE_REPLACE,
|
||||
window, XCB_ATOM_WM_NAME, XCB_ATOM_STRING, 8,
|
||||
title.size(), title.c_str());
|
||||
title.size(), windowTitle.c_str());
|
||||
|
||||
free(reply);
|
||||
|
||||
|
|
@ -1134,5 +1153,3 @@ void VulkanExampleBase::setupSwapChain()
|
|||
{
|
||||
swapChain.create(setupCmdBuffer, &width, &height);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue