mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 12:08:47 +02:00
Merge branch 'master' into navigation
# Conflicts: # imgui_internal.h
This commit is contained in:
@ -1941,6 +1941,41 @@ void ImGui::ShowTestWindow(bool* p_open)
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
bool ImGui::ShowStyleSelector(const char* label)
|
||||
{
|
||||
static int style_idx = 0;
|
||||
if (ImGui::Combo(label, &style_idx, "Classic\0Dark\0Light\0"))
|
||||
{
|
||||
switch (style_idx)
|
||||
{
|
||||
case 0: ImGui::StyleColorsClassic(); break;
|
||||
case 1: ImGui::StyleColorsDark(); break;
|
||||
case 2: ImGui::StyleColorsLight(); break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void ImGui::ShowFontSelector(const char* label)
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
ImFont* font_current = ImGui::GetFont();
|
||||
if (ImGui::BeginCombo(label, font_current->GetDebugName()))
|
||||
{
|
||||
for (int n = 0; n < io.Fonts->Fonts.Size; n++)
|
||||
if (ImGui::Selectable(io.Fonts->Fonts[n]->GetDebugName(), io.Fonts->Fonts[n] == font_current))
|
||||
io.FontDefault = io.Fonts->Fonts[n];
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ShowHelpMarker(
|
||||
"- Load additional fonts with io.Fonts->AddFontFromFileTTF().\n"
|
||||
"- The font atlas is built when calling io.Fonts->GetTexDataAsXXXX() or io.Fonts->Build().\n"
|
||||
"- Read FAQ and documentation in extra_fonts/ for more details.\n"
|
||||
"- If you need to add/remove fonts at runtime (e.g. for DPI change), do it before calling NewFrame().");
|
||||
}
|
||||
|
||||
void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
||||
{
|
||||
// You can pass in a reference ImGuiStyle structure to compare to, revert to and save to (else it compares to an internally stored reference)
|
||||
@ -1957,18 +1992,9 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
||||
|
||||
ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.50f);
|
||||
|
||||
// Default Styles Selector
|
||||
static int style_idx = 0;
|
||||
if (ImGui::Combo("Colors##Selector", &style_idx, "Classic\0Dark\0Light\0"))
|
||||
{
|
||||
switch (style_idx)
|
||||
{
|
||||
case 0: ImGui::StyleColorsClassic(); break;
|
||||
case 1: ImGui::StyleColorsDark(); break;
|
||||
case 2: ImGui::StyleColorsLight(); break;
|
||||
}
|
||||
if (ImGui::ShowStyleSelector("Colors##Selector"))
|
||||
ref_saved_style = style;
|
||||
}
|
||||
ImGui::ShowFontSelector("Fonts##Selector");
|
||||
|
||||
// Simplified Settings
|
||||
if (ImGui::SliderFloat("FrameRounding", &style.FrameRounding, 0.0f, 12.0f, "%.0f"))
|
||||
@ -2088,7 +2114,6 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
||||
}
|
||||
|
||||
bool fonts_opened = ImGui::TreeNode("Fonts", "Fonts (%d)", ImGui::GetIO().Fonts->Fonts.Size);
|
||||
ImGui::SameLine(); ShowHelpMarker("Tip: Load fonts with io.Fonts->AddFontFromFileTTF()\nbefore calling io.Fonts->GetTex* functions.");
|
||||
if (fonts_opened)
|
||||
{
|
||||
ImFontAtlas* atlas = ImGui::GetIO().Fonts;
|
||||
|
Reference in New Issue
Block a user