mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-11 18:34:58 +01:00
Scale icons to match font size
This commit is contained in:
@@ -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 uv0( static_cast<float>(i) * 0.05, static_cast<float>(j) * 0.05 );
|
||||||
ImVec2 uv1( uv0.x + 0.05, uv0.y + 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)
|
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 );
|
ImVec2 uv1( uv0.x + 0.05, uv0.y + 0.05 );
|
||||||
|
|
||||||
ImGui::PushID( i*20 + j);
|
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();
|
ImGui::PopID();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
@@ -154,8 +154,8 @@ bool UserInterface::Init()
|
|||||||
ImGuiToolkit::SetAccentColor(static_cast<ImGuiToolkit::accent_color>(Settings::application.accent_color));
|
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)
|
// 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 );
|
int base_font_size = int ( Rendering::manager().Height() / 90.f );
|
||||||
// Log::Info("Base font size %d / %f", base_font_size, Rendering::manager().Height() );
|
Log::Info("Base font size %d", base_font_size);
|
||||||
ImGuiToolkit::SetFont(ImGuiToolkit::FONT_DEFAULT, "Roboto-Regular", 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_BOLD, "Roboto-Bold", base_font_size);
|
||||||
ImGuiToolkit::SetFont(ImGuiToolkit::FONT_ITALIC, "Roboto-Italic", base_font_size);
|
ImGuiToolkit::SetFont(ImGuiToolkit::FONT_ITALIC, "Roboto-Italic", base_font_size);
|
||||||
@@ -166,7 +166,7 @@ bool UserInterface::Init()
|
|||||||
// Style
|
// Style
|
||||||
ImGuiStyle& style = ImGui::GetStyle();
|
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.x = 12.f;
|
||||||
style.WindowPadding.y = 6.f;
|
style.WindowPadding.y = 6.f;
|
||||||
style.FramePadding.x = 10.f;
|
style.FramePadding.x = 10.f;
|
||||||
|
|||||||
Reference in New Issue
Block a user