0
0
mirror of https://github.com/wolfpld/tracy.git synced 2026-01-18 17:11:26 +01:00

Add in-line waiting dots drawer.

This commit is contained in:
Bartosz Taudul
2026-01-14 02:14:35 +01:00
parent a991b4fd50
commit 5b568d7bce
3 changed files with 14 additions and 13 deletions

View File

@@ -133,6 +133,18 @@ static constexpr const uint32_t AsmSyntaxColors[] = {
draw->AddCircleFilled( wpos + ImVec2( w * 0.5f + ty, h ), ty * ( 0.15f + 0.2f * ( pow( cos( time * 3.5f - 0.3f ), 16.f ) ) ), 0xFFBBBBBB, 12 );
}
[[maybe_unused]] static inline void DrawWaitingDots( double time, bool windowPos = true )
{
s_wasActive = true;
const auto pos = ( windowPos ? ImGui::GetWindowPos() : ImVec2( 0, 0 ) ) + ImGui::GetCursorPos();
auto draw = ImGui::GetWindowDrawList();
const auto ty = ImGui::GetTextLineHeight();
draw->AddCircleFilled( pos + ImVec2( ty * 0.5f + 0 * ty, ty * 0.675f ), ty * ( 0.15f + 0.2f * ( pow( cos( time * 3.5f + 0.3f ), 16.f ) ) ), 0xFFBBBBBB, 12 );
draw->AddCircleFilled( pos + ImVec2( ty * 0.5f + 1 * ty, ty * 0.675f ), ty * ( 0.15f + 0.2f * ( pow( cos( time * 3.5f ), 16.f ) ) ), 0xFFBBBBBB, 12 );
draw->AddCircleFilled( pos + ImVec2( ty * 0.5f + 2 * ty, ty * 0.675f ), ty * ( 0.15f + 0.2f * ( pow( cos( time * 3.5f - 0.3f ), 16.f ) ) ), 0xFFBBBBBB, 12 );
ImGui::Dummy( ImVec2( ty * 3, ty ) );
}
[[maybe_unused]] static inline bool SmallCheckbox( const char* label, bool* var )
{
ImGui::PushStyleVar( ImGuiStyleVar_FramePadding, ImVec2( 0, 0 ) );

View File

@@ -582,13 +582,7 @@ void TracyLlm::Draw()
if( ImGui::Button( ICON_FA_STOP " Stop" ) ) m_currentJob->stop = true;
if( disabled ) ImGui::EndDisabled();
ImGui::SameLine();
const auto pos = ImGui::GetWindowPos() + ImGui::GetCursorPos();
auto draw = ImGui::GetWindowDrawList();
const auto ty = ImGui::GetTextLineHeight();
draw->AddCircleFilled( pos + ImVec2( ty * 0.5f + 0 * ty, ty * 0.675f ), ty * ( 0.15f + 0.2f * ( pow( cos( s_time * 3.5f + 0.3f ), 16.f ) ) ), 0xFFBBBBBB, 12 );
draw->AddCircleFilled( pos + ImVec2( ty * 0.5f + 1 * ty, ty * 0.675f ), ty * ( 0.15f + 0.2f * ( pow( cos( s_time * 3.5f ), 16.f ) ) ), 0xFFBBBBBB, 12 );
draw->AddCircleFilled( pos + ImVec2( ty * 0.5f + 2 * ty, ty * 0.675f ), ty * ( 0.15f + 0.2f * ( pow( cos( s_time * 3.5f - 0.3f ), 16.f ) ) ), 0xFFBBBBBB, 12 );
ImGui::Dummy( ImVec2( ty * 3, ty ) );
DrawWaitingDots( s_time );
ImGui::SameLine();
if( disabled )
{

View File

@@ -227,12 +227,7 @@ void View::DrawNotificationArea()
if( !m_worker.IsBackgroundDone() )
{
ImGui::SameLine();
const auto pos = ImGui::GetCursorPos();
auto draw = ImGui::GetWindowDrawList();
draw->AddCircleFilled( pos + ImVec2( ty * 0.5f + 0 * ty, ty * 0.675f ), ty * ( 0.15f + 0.2f * ( pow( cos( s_time * 3.5f + 0.3f ), 16.f ) ) ), 0xFFBBBBBB, 12 );
draw->AddCircleFilled( pos + ImVec2( ty * 0.5f + 1 * ty, ty * 0.675f ), ty * ( 0.15f + 0.2f * ( pow( cos( s_time * 3.5f ), 16.f ) ) ), 0xFFBBBBBB, 12 );
draw->AddCircleFilled( pos + ImVec2( ty * 0.5f + 2 * ty, ty * 0.675f ), ty * ( 0.15f + 0.2f * ( pow( cos( s_time * 3.5f - 0.3f ), 16.f ) ) ), 0xFFBBBBBB, 12 );
ImGui::Dummy( ImVec2( ty * 3, ty ) );
DrawWaitingDots( s_time, false );
auto rmin = ImGui::GetItemRectMin();
const auto rmax = ImGui::GetItemRectMax();
if( ImGui::IsMouseHoveringRect( rmin, rmax ) )