Refactor flags and add Font Manager to settings editor

Simplified `ExperimentFlags` by removing unused flags and updated
`Controller` to no longer inherit from it. Refactored `FlagsMenu`
to separate flag categories into individual methods for better
organization. Enhanced settings editor with a new "Font Manager"
tab and updated `DrawGeneralSettings` to use the new flag category
methods. Added `DrawFontManager` function for font management.
This commit is contained in:
Justin Scofield
2025-01-05 11:58:45 -05:00
parent 66dc72148d
commit 31217e1c5c
6 changed files with 94 additions and 55 deletions

View File

@@ -749,5 +749,34 @@ void TextWithSeparators(const absl::string_view &text) {
ImGui::Separator();
}
void DrawFontManager() {
ImGuiIO& io = ImGui::GetIO();
ImFontAtlas* atlas = io.Fonts;
static ImFont* current_font = atlas->Fonts[0];
static int current_font_index = 0;
static int font_size = 16;
static bool font_selected = false;
ImGui::Text("Current Font: %s", current_font->GetDebugName());
ImGui::Text("Font Size: %d", font_size);
if (ImGui::BeginCombo("Fonts", current_font->GetDebugName())) {
for (int i = 0; i < atlas->Fonts.Size; i++) {
bool is_selected = (current_font == atlas->Fonts[i]);
if (ImGui::Selectable(atlas->Fonts[i]->GetDebugName(), is_selected)) {
current_font = atlas->Fonts[i];
current_font_index = i;
font_selected = true;
}
if (is_selected) {
ImGui::SetItemDefaultFocus();
}
}
ImGui::EndCombo();
}
ImGui::Separator();
if (ImGui::SliderInt("Font Size", &font_size, 8, 32)) {
current_font->Scale = font_size / 16.0f;
}
}
} // namespace gui
} // namespace yaze

View File

@@ -66,6 +66,8 @@ void DrawDisplaySettings(ImGuiStyle *ref = nullptr);
void TextWithSeparators(const absl::string_view &text);
void DrawFontManager();
static const char *ExampleNames[] = {
"Artichoke", "Arugula", "Asparagus", "Avocado",
"Bamboo Shoots", "Bean Sprouts", "Beans", "Beet",