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:
@@ -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
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user