Skip to content

Commit

Permalink
Add notifications and utilize them for the CET bind
Browse files Browse the repository at this point in the history
  • Loading branch information
WSSDude committed Dec 14, 2024
1 parent a2d82d9 commit 29f41ef
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
21 changes: 21 additions & 0 deletions src/overlay/Overlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ void Overlay::PostInitialize()
d3d12.DelayedSetTrapInputInImGui(true);
ClipToCenter(RED4ext::CGameEngine::Get()->unkD0);
}
else
{
const auto cOverlayBindCode = CET::Get().GetBindings().GetBindCodeForModBind(Bindings::GetOverlayToggleModBind());
ImGui::InsertNotification({ImGuiToastType::Info, NOTIFY_DEFAULT_DISMISS, "CET Overlay Bind: %s", VKBindings::GetBindString(cOverlayBindCode).c_str()});
}

m_initialized = true;
}
Expand Down Expand Up @@ -195,6 +200,22 @@ void Overlay::Update()
}
}

// Notifications style setup
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.f); // Disable round borders
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.f); // Disable borders

// Notifications color setup
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0.10f, 0.10f, 0.10f, 1.00f)); // Background color

// Main rendering function
ImGui::RenderNotifications();

//——————————————————————————————— WARNING ———————————————————————————————
// Argument MUST match the amount of ImGui::PushStyleVar() calls
ImGui::PopStyleVar(2);
// Argument MUST match the amount of ImGui::PushStyleColor() calls
ImGui::PopStyleColor(1);

if (!m_enabled)
return;

Expand Down
1 change: 1 addition & 0 deletions src/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
#include "CETVersion.h"
#include "common/Logging.h"
#include "common/FontMaterialDesignIcons.h"
#include "common/ImGuiNotify.hpp"
#include "Options.h"
#include "Paths.h"
#include "PersistentState.h"
Expand Down
2 changes: 1 addition & 1 deletion xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ target("cyber_engine_tweaks")
set_kind("shared")
set_filename("cyber_engine_tweaks.asi")
add_files("src/**.cpp")
add_headerfiles("src/**.h", "build/CETVersion.h")
add_headerfiles("src/**.h", "src/**.hpp", "build/CETVersion.h")
add_includedirs("src/", "build/")
add_syslinks("User32", "Version", "d3d11", "dxgi")
add_packages("spdlog", "nlohmann_json", "minhook", "hopscotch-map", "imgui", "mem", "sol2", "tiltedcore", "sqlite3", "openrestry-luajit", "xbyak", "stb")
Expand Down

0 comments on commit 29f41ef

Please sign in to comment.