Skip to content

Commit

Permalink
eureka, finally got multiple configs working
Browse files Browse the repository at this point in the history
  • Loading branch information
g0aty committed Jun 16, 2024
1 parent 6fdf5ec commit 9cea59f
Show file tree
Hide file tree
Showing 5 changed files with 208 additions and 218 deletions.
25 changes: 9 additions & 16 deletions gui/tabs/settings_tab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,29 +58,22 @@ namespace SettingsTab {
ImGui::Dummy(ImVec2(7, 7) * State.dpiScale);
ImGui::Separator();
ImGui::Dummy(ImVec2(7, 7) * State.dpiScale);

static int selectedConfig = 0;
static std::string newConfigName = "";
//if (!GetAllConfigs().empty() &&
//std::find(GetAllConfigs().begin(), GetAllConfigs().end(), State.selectedConfig.c_str()) == GetAllConfigs().end())
//State.selectedConfig = GetAllConfigs()[0];
if (!GetAllConfigs().empty() && CustomListBoxInt("Config", &selectedConfig, GetAllConfigs(), 75.f)) {
State.selectedConfig = GetAllConfigs()[selectedConfig];
State.Save();
}
ImGui::SameLine();
if (ImGui::Button("Load Config"))

InputString("Config Name", &State.selectedConfig);

if (CheckConfigExists(State.selectedConfig) && ImGui::Button("Load Config"))
{
State.Load();
State.Save(); //actually save the selected config
}
ImGui::SameLine();
if (CheckConfigExists(State.selectedConfig)) ImGui::SameLine();
if (ImGui::Button("Save Config"))
{
State.Save();
}

if (InputString("New Config Name", &newConfigName)) {
State.selectedConfig = newConfigName;
if (!CheckConfigExists(State.selectedConfig)) {
ImGui::Text("Config name not found!");
ImGui::SameLine();
}

if (ToggleButton("Adjust by DPI", &State.AdjustByDPI)) {
Expand Down
Loading

0 comments on commit 9cea59f

Please sign in to comment.