mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-16 17:53:14 +02:00
ShowFontAtlas, Demo: optionally use style text color for tint. (#6129)
This commit is contained in:
@ -1024,12 +1024,14 @@ static void ShowDemoWindowWidgets()
|
||||
float my_tex_w = (float)io.Fonts->TexWidth;
|
||||
float my_tex_h = (float)io.Fonts->TexHeight;
|
||||
{
|
||||
static bool use_text_color_for_tint = false;
|
||||
ImGui::Checkbox("Use Text Color for Tint", &use_text_color_for_tint);
|
||||
ImGui::Text("%.0fx%.0f", my_tex_w, my_tex_h);
|
||||
ImVec2 pos = ImGui::GetCursorScreenPos();
|
||||
ImVec2 uv_min = ImVec2(0.0f, 0.0f); // Top-left
|
||||
ImVec2 uv_max = ImVec2(1.0f, 1.0f); // Lower-right
|
||||
ImVec4 tint_col = ImVec4(1.0f, 1.0f, 1.0f, 1.0f); // No tint
|
||||
ImVec4 border_col = ImVec4(1.0f, 1.0f, 1.0f, 0.5f); // 50% opaque white
|
||||
ImVec4 tint_col = use_text_color_for_tint ? ImGui::GetStyleColorVec4(ImGuiCol_Text) : ImVec4(1.0f, 1.0f, 1.0f, 1.0f); // No tint
|
||||
ImVec4 border_col = ImGui::GetStyleColorVec4(ImGuiCol_Border);
|
||||
ImGui::Image(my_tex_id, ImVec2(my_tex_w, my_tex_h), uv_min, uv_max, tint_col, border_col);
|
||||
if (ImGui::IsItemHovered())
|
||||
{
|
||||
|
Reference in New Issue
Block a user