Scale icons to match font size

This commit is contained in:
brunoherbelin
2020-05-10 14:55:00 +02:00
parent c30b7e872c
commit 570caca852
2 changed files with 5 additions and 5 deletions

View File

@@ -130,7 +130,7 @@ void ImGuiToolkit::Icon(int i, int j)
ImVec2 uv0( static_cast<float>(i) * 0.05, static_cast<float>(j) * 0.05 );
ImVec2 uv1( uv0.x + 0.05, uv0.y + 0.05 );
ImGui::Image((void*)(intptr_t)textureicons, ImVec2(24, 24), uv0, uv1);
ImGui::Image((void*)(intptr_t)textureicons, ImVec2(ImGui::GetTextLineHeightWithSpacing(), ImGui::GetTextLineHeightWithSpacing()), uv0, uv1);
}
bool ImGuiToolkit::ButtonIcon(int i, int j)
@@ -143,7 +143,7 @@ bool ImGuiToolkit::ButtonIcon(int i, int j)
ImVec2 uv1( uv0.x + 0.05, uv0.y + 0.05 );
ImGui::PushID( i*20 + j);
bool ret = ImGui::ImageButton((void*)(intptr_t)textureicons, ImVec2(24,24), uv0, uv1, 3);
bool ret = ImGui::ImageButton((void*)(intptr_t)textureicons, ImVec2(ImGui::GetTextLineHeightWithSpacing(),ImGui::GetTextLineHeightWithSpacing()), uv0, uv1, 3);
ImGui::PopID();
return ret;

View File

@@ -154,8 +154,8 @@ bool UserInterface::Init()
ImGuiToolkit::SetAccentColor(static_cast<ImGuiToolkit::accent_color>(Settings::application.accent_color));
// Load Fonts (using resource manager, NB: a temporary copy of the raw data is necessary)
int base_font_size = int ( Rendering::manager().Height() / 110.f );
// Log::Info("Base font size %d / %f", base_font_size, Rendering::manager().Height() );
int base_font_size = int ( Rendering::manager().Height() / 90.f );
Log::Info("Base font size %d", base_font_size);
ImGuiToolkit::SetFont(ImGuiToolkit::FONT_DEFAULT, "Roboto-Regular", base_font_size);
ImGuiToolkit::SetFont(ImGuiToolkit::FONT_BOLD, "Roboto-Bold", base_font_size);
ImGuiToolkit::SetFont(ImGuiToolkit::FONT_ITALIC, "Roboto-Italic", base_font_size);
@@ -166,7 +166,7 @@ bool UserInterface::Init()
// Style
ImGuiStyle& style = ImGui::GetStyle();
Log::Info("DPI Scale (%.1f,%.1f)", ImGui::GetIO().DisplayFramebufferScale.x, ImGui::GetIO().DisplayFramebufferScale.y);
// Log::Info("DPI Scale (%.1f,%.1f)", ImGui::GetIO().DisplayFramebufferScale.x, ImGui::GetIO().DisplayFramebufferScale.y);
style.WindowPadding.x = 12.f;
style.WindowPadding.y = 6.f;
style.FramePadding.x = 10.f;