From 66a64889805a8c8a09bdd88487aa761178e4bcd0 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Tue, 26 Jul 2022 02:06:43 +0200 Subject: [PATCH] Add centered image helper. --- server/TracyImGui.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/TracyImGui.hpp b/server/TracyImGui.hpp index 1fd49544..e8382140 100644 --- a/server/TracyImGui.hpp +++ b/server/TracyImGui.hpp @@ -59,6 +59,12 @@ static constexpr const ImVec4 SyntaxColorsDimmed[] = { return ImGui::GetTextLineHeight() / 15.f; } +[[maybe_unused]] static inline void ImageCentered( ImTextureID user_texture_id, const ImVec2& size ) +{ + ImGui::SetCursorPosX( ( ImGui::GetWindowWidth() - size.x ) * 0.5f ); + ImGui::Image( user_texture_id, size ); +} + [[maybe_unused]] static inline void TextCentered( const char* text ) { const auto tw = ImGui::CalcTextSize( text ).x;