Skip to content

Commit

Permalink
add settings panel
Browse files Browse the repository at this point in the history
  • Loading branch information
TTENSHII committed Nov 16, 2023
1 parent 483eb8e commit fce35c2
Showing 1 changed file with 48 additions and 6 deletions.
54 changes: 48 additions & 6 deletions src/GUI/SettingsPanel.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,52 @@
#include <string>
#include "imgui.h"
#include "Imgui.hpp"
#include "XashSettings.hpp"
#include "StyleSettings.hpp"

namespace Xash::GUI
namespace Xash
{
void Imgui::DrawSettingsPanel()
{
ImGui::Text("--------SETTINGS--------");
}
}
namespace GUI
{
static void customTheme()
{
constexpr std::string_view backgroundLabel = "Background Color";
constexpr std::string_view textLabel = "Text Color";
constexpr std::string_view borderLabel = "Border Color";
constexpr std::string_view buttonLabel = "Button Color";
auto &style = Settings::StyleSettings::GetInstance();

Imgui::CustomColorPicker(
backgroundLabel,
[&style]() -> const Vector4 & { return style.GetBackgroundColor(); },
[&style](const Vector4 &color) { style.SetBackgroundColor(color); },
ImGuiCol_WindowBg
);
Imgui::CustomColorPicker(
textLabel, [&style]() -> const Vector4 & { return style.GetTextColor(); },
[&style](const Vector4 &color) { style.SetTextColor(color); },
ImGuiCol_Text
);
Imgui::CustomColorPicker(
borderLabel,
[&style]() -> const Vector4 & { return style.GetBorderColor(); },
[&style](const Vector4 &color) { style.SetBorderColor(color); },
ImGuiCol_Border
);
Imgui::CustomColorPicker(
buttonLabel,
[&style]() -> const Vector4 & { return style.GetButtonColor(); },
[&style](const Vector4 &color) { style.SetButtonColor(color); },
ImGuiCol_Button
);
}

void Imgui::DrawSettingsPanel()
{
if (ImGui::CollapsingHeader("Custom Theme"))
{
customTheme();
}
}
} // namespace GUI
} // namespace Xash

0 comments on commit fce35c2

Please sign in to comment.