Skip to content

Commit

Permalink
adjusted setting ui to changes of the arcdps options ui
Browse files Browse the repository at this point in the history
  • Loading branch information
knoxfighter committed Sep 25, 2021
1 parent a1287a7 commit 8976245
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Lang.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
BUILD_ENUM_SERIALIZED(
LangKey,
KpWindowName, "Killproof.me",
SettingsWindowName, "Killproof Settings",
MenuName, "Killproof.me",
SubMenuKp, "Killproofs",
SubMenuSettings, "Settings",
Expand Down Expand Up @@ -105,6 +104,7 @@ BUILD_ENUM_SERIALIZED(
SettingsFromWindowName, "from window",
SettingsCofferValue, "Killproofs per coffer",
SettingsHideExtrasMessage, "Hide Unofficial Extras Message",
SettingsKeyNotSetText, "(not set)",

Alignment, "Alignment",
HeaderAlignment, "Header alignment",
Expand Down
10 changes: 8 additions & 2 deletions SettingsUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,20 @@
SettingsUI settingsUI;

void SettingsUI::draw() {
if (ImGui::IsWindowAppearing()) {
if (initialized) {
std::string killproofKey = std::to_string(settings.getKillProofKey());
memset(shortcut, 0, sizeof(shortcut));
killproofKey.copy(shortcut, killproofKey.size());

cofferValue = settings.settings.cofferValue;

initialized = true;
}

ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, {0.f, 0.f});

// Setting to select, which key is used to open the killproofs menu (will also close it)
ImGuiEx::KeyInput(lang.translate(LangKey::SettingsShortcutText).c_str(), "##shortcut", shortcut, sizeof(shortcut), settings.settings.killproofKey);
ImGuiEx::KeyInput(lang.translate(LangKey::SettingsShortcutText).c_str(), "##shortcut", shortcut, sizeof(shortcut), settings.settings.killproofKey, lang.translate(LangKey::SettingsKeyNotSetText).c_str());

ImGui::Checkbox(lang.translate(LangKey::SettingsDisableESCText).c_str(), &settings.settings.disableEscClose);
if (ImGui::InputInt(lang.translate(LangKey::SettingsCofferValue).c_str(), &cofferValue)) {
Expand Down Expand Up @@ -60,4 +64,6 @@ void SettingsUI::draw() {
}
if (ImGui::IsItemHovered())
ImGui::SetTooltip(lang.translate(LangKey::SettingsClearCacheTooltip).c_str());

ImGui::PopStyleVar();
}
1 change: 1 addition & 0 deletions SettingsUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class SettingsUI
{
char shortcut[64]{};
int cofferValue = settings.settings.cofferValue;
bool initialized = false;

public:
SettingsUI() = default;
Expand Down
6 changes: 2 additions & 4 deletions dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,7 @@ uintptr_t mod_combat(cbtevent* ev, ag* src, ag* dst, const char* skillname, uint
}

uintptr_t mod_options() {
ImGuiEx::BeginMenu(lang.translate(LangKey::SettingsWindowName).c_str(), []() {
settingsUI.draw();
});
settingsUI.draw();

return 0;
}
Expand Down Expand Up @@ -347,7 +345,7 @@ void readArcExports() {

uintptr_t mod_imgui(uint32_t not_charsel_or_loading) {
// try {
// ImGui::ShowDemoWindow();
// ImGui::ShowMetricsWindow();
if (!not_charsel_or_loading) return 0;
ShowKillproof();

Expand Down
2 changes: 1 addition & 1 deletion extension
Submodule extension updated 2 files
+13 −8 Widgets.cpp
+1 −1 Widgets.h

0 comments on commit 8976245

Please sign in to comment.