1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Play a little animation when source file cannot be opened.

This commit is contained in:
Bartosz Taudul 2018-08-17 22:23:16 +02:00
parent 841f18885e
commit 07d2aaa1ad
2 changed files with 20 additions and 1 deletions

View File

@ -674,9 +674,9 @@ bool View::DrawImpl()
if( m_showInfo ) DrawInfo(); if( m_showInfo ) DrawInfo();
if( m_textEditorFile ) DrawTextEditor(); if( m_textEditorFile ) DrawTextEditor();
const auto& io = ImGui::GetIO();
if( m_zoomAnim.active ) if( m_zoomAnim.active )
{ {
const auto& io = ImGui::GetIO();
m_zoomAnim.progress += io.DeltaTime * m_zoomAnim.lenMod; m_zoomAnim.progress += io.DeltaTime * m_zoomAnim.lenMod;
if( m_zoomAnim.progress >= 1.f ) if( m_zoomAnim.progress >= 1.f )
{ {
@ -692,6 +692,8 @@ bool View::DrawImpl()
} }
} }
m_callstackBuzzAnim.Update( io.DeltaTime );
return keepOpen; return keepOpen;
} }
@ -5749,6 +5751,13 @@ void View::DrawCallstackWindow()
} }
ImGui::NextColumn(); ImGui::NextColumn();
ImGui::PushTextWrapPos( 0.0f ); ImGui::PushTextWrapPos( 0.0f );
float indentVal = 0.f;
if( m_callstackBuzzAnim.Match( fidx ) )
{
const auto time = m_callstackBuzzAnim.Time();
indentVal = sin( time * 60.f ) * 10.f * time;
ImGui::Indent( indentVal );
}
txt = m_worker.GetString( frame->file ); txt = m_worker.GetString( frame->file );
if( frame->line == 0 ) if( frame->line == 0 )
{ {
@ -5768,6 +5777,14 @@ void View::DrawCallstackWindow()
{ {
SetTextEditorFile( txt, frame->line ); SetTextEditorFile( txt, frame->line );
} }
else
{
m_callstackBuzzAnim.Enable( fidx, 0.5f );
}
}
if( indentVal != 0.f )
{
ImGui::Unindent( indentVal );
} }
ImGui::PopTextWrapPos(); ImGui::PopTextWrapPos();
ImGui::NextColumn(); ImGui::NextColumn();

View File

@ -9,6 +9,7 @@
#include <thread> #include <thread>
#include <vector> #include <vector>
#include "TracyBuzzAnim.hpp"
#include "TracyDecayValue.hpp" #include "TracyDecayValue.hpp"
#include "TracyVector.hpp" #include "TracyVector.hpp"
#include "TracyWorker.hpp" #include "TracyWorker.hpp"
@ -236,6 +237,7 @@ private:
Namespace m_namespace; Namespace m_namespace;
Animation m_zoomAnim; Animation m_zoomAnim;
BuzzAnim<int> m_callstackBuzzAnim;
Vector<const ZoneEvent*> m_zoneInfoStack; Vector<const ZoneEvent*> m_zoneInfoStack;
Vector<const GpuEvent*> m_gpuInfoStack; Vector<const GpuEvent*> m_gpuInfoStack;