Add centered button function.

This commit is contained in:
Bartosz Taudul 2024-09-28 01:53:26 +02:00
parent 05d00388ed
commit 293c76625c
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -83,6 +83,13 @@ static constexpr const uint32_t AsmSyntaxColors[] = {
ImGui::TextUnformatted( text );
}
[[maybe_unused]] static inline bool ButtonCentered( const char* text )
{
const auto tw = ImGui::CalcTextSize( text ).x + ImGui::GetStyle().FramePadding.x * 2;
ImGui::SetCursorPosX( ( ImGui::GetWindowWidth() - tw ) * 0.5f );
return ImGui::Button( text );
}
[[maybe_unused]] static inline void TextColoredUnformatted( uint32_t col, const char* text, const char* end = nullptr )
{
ImGui::PushStyleColor( ImGuiCol_Text, col );