Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a key to toggle GUI #755

Merged
merged 1 commit into from
Apr 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/mods/Graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ void Graphics::on_config_save(utility::Config& cfg) {
}
}

void Graphics::on_frame() {
if (m_disable_gui_key->is_key_down_once()) {
m_disable_gui->toggle();
}
}

void Graphics::on_draw_ui() {
ImGui::SetNextItemOpen(false, ImGuiCond_::ImGuiCond_FirstUseEver);
if (!ImGui::CollapsingHeader(get_name().data())) {
Expand Down Expand Up @@ -56,6 +62,7 @@ void Graphics::on_draw_ui() {
ImGui::SetNextItemOpen(true, ImGuiCond_::ImGuiCond_Once);
if (ImGui::TreeNode("GUI Options")) {
m_disable_gui->draw("Hide GUI");
m_disable_gui_key->draw("Hide GUI key");
ImGui::TreePop();
}
}
Expand Down Expand Up @@ -343,4 +350,4 @@ void Graphics::set_vertical_fov(bool enable) {
m_old_fov = hfov;
set_fov_method->call(sdk::get_thread_context(), camera, vfov);
}
}
}
3 changes: 3 additions & 0 deletions src/mods/Graphics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class Graphics : public Mod {
void on_config_load(const utility::Config& cfg) override;
void on_config_save(utility::Config& cfg) override;

void on_frame() override;
void on_draw_ui() override;
void on_present() override;

Expand Down Expand Up @@ -41,6 +42,7 @@ class Graphics : public Mod {
const ModSlider::Ptr m_ultrawide_fov_multiplier{ ModSlider::create(generate_name("UltrawideFOVMultiplier"), 0.01f, 3.0f, 0.5f) };
const ModToggle::Ptr m_disable_gui{ ModToggle::create(generate_name("DisableGUI"), false) };
const ModToggle::Ptr m_force_render_res_to_window{ ModToggle::create(generate_name("ForceRenderResToWindow"), false) };
const ModKey::Ptr m_disable_gui_key{ ModKey::create(generate_name("DisableGUIKey")) };

#ifdef RE4
const ModToggle::Ptr m_scope_tweaks{ ModToggle::create(generate_name("ScopeTweaks"), false) };
Expand All @@ -57,6 +59,7 @@ class Graphics : public Mod {
*m_ultrawide_fov_multiplier,
*m_disable_gui,
*m_force_render_res_to_window,
*m_disable_gui_key,

#ifdef RE4
*m_scope_tweaks,
Expand Down