Backend abstraction + added android support + partial high DPI scaling

This commit is contained in:
AlexandreRouma
2022-02-13 17:25:23 +01:00
parent 9969ce018b
commit e5f3d1672c
36 changed files with 693 additions and 185 deletions

View File

@@ -23,8 +23,11 @@ namespace thememenu {
it = std::find(themeNames.begin(), themeNames.end(), "Dark");
selectedThemeName = "Dark";
}
gui::themeManager.applyTheme(selectedThemeName);
themeId = std::distance(themeNames.begin(), it);
applyTheme();
// Apply scaling
ImGui::GetStyle().ScaleAllSizes(style::uiScale);
themeNamesTxt = "";
for (auto name : themeNames) {
@@ -33,12 +36,16 @@ namespace thememenu {
}
}
void applyTheme() {
gui::themeManager.applyTheme(themeNames[themeId]);
}
void draw(void* ctx) {
float menuWidth = ImGui::GetContentRegionAvailWidth();
ImGui::LeftLabel("Theme");
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
if (ImGui::Combo("##theme_select_combo", &themeId, themeNamesTxt.c_str())) {
gui::themeManager.applyTheme(themeNames[themeId]);
applyTheme();
core::configManager.acquire();
core::configManager.conf["theme"] = themeNames[themeId];
core::configManager.release(true);