1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 12:23:53 +00:00

Disable screen redraw when there are no input events.

This commit is contained in:
Bartosz Taudul 2022-09-27 22:02:08 +02:00
parent 1e7c6e3f49
commit 232fb5aaa4
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -269,6 +269,27 @@ static void DrawContents()
int display_w, display_h;
bptr->NewFrame( display_w, display_h );
static int activeFrames = 3;
auto& inputQueue = ImGui::GetCurrentContext()->InputEventsQueue;
if( !inputQueue.empty() )
{
for( auto& v : inputQueue )
{
if( v.Type != ImGuiInputEventType_MouseViewport )
{
activeFrames = 3;
break;
}
}
}
if( activeFrames == 0 )
{
std::this_thread::sleep_for( std::chrono::milliseconds( 16 ) );
return;
}
activeFrames--;
ImGui::NewFrame();
tracy::MouseFrame();