mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Conditional framerate limiting on GLFW.
This commit is contained in:
parent
e85457815e
commit
30f1b901a9
@ -13,6 +13,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <thread>
|
||||
|
||||
#include "profiler/TracyConfig.hpp"
|
||||
#include "profiler/TracyImGui.hpp"
|
||||
|
||||
#include "Backend.hpp"
|
||||
@ -25,6 +26,9 @@ static RunQueue* s_mainThreadTasks;
|
||||
static WindowPosition* s_winPos;
|
||||
static bool s_iconified;
|
||||
|
||||
extern tracy::Config s_config;
|
||||
|
||||
|
||||
static void glfw_error_callback( int error, const char* description )
|
||||
{
|
||||
fprintf(stderr, "Error %d: %s\n", error, description);
|
||||
@ -146,10 +150,7 @@ void Backend::Run()
|
||||
{
|
||||
glfwPollEvents();
|
||||
s_redraw();
|
||||
if( !glfwGetWindowAttrib( s_window, GLFW_FOCUSED ) )
|
||||
{
|
||||
std::this_thread::sleep_for( std::chrono::milliseconds( 50 ) );
|
||||
}
|
||||
if( s_config.focusLostLimit && !glfwGetWindowAttrib( s_window, GLFW_FOCUSED ) ) std::this_thread::sleep_for( std::chrono::milliseconds( 50 ) );
|
||||
s_mainThreadTasks->Run();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user