Skip to content

Commit 29f41ef

Browse files
committed
Add notifications and utilize them for the CET bind
1 parent a2d82d9 commit 29f41ef

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

Diff for: src/overlay/Overlay.cpp

+21
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ void Overlay::PostInitialize()
2020
d3d12.DelayedSetTrapInputInImGui(true);
2121
ClipToCenter(RED4ext::CGameEngine::Get()->unkD0);
2222
}
23+
else
24+
{
25+
const auto cOverlayBindCode = CET::Get().GetBindings().GetBindCodeForModBind(Bindings::GetOverlayToggleModBind());
26+
ImGui::InsertNotification({ImGuiToastType::Info, NOTIFY_DEFAULT_DISMISS, "CET Overlay Bind: %s", VKBindings::GetBindString(cOverlayBindCode).c_str()});
27+
}
2328

2429
m_initialized = true;
2530
}
@@ -195,6 +200,22 @@ void Overlay::Update()
195200
}
196201
}
197202

203+
// Notifications style setup
204+
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.f); // Disable round borders
205+
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.f); // Disable borders
206+
207+
// Notifications color setup
208+
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0.10f, 0.10f, 0.10f, 1.00f)); // Background color
209+
210+
// Main rendering function
211+
ImGui::RenderNotifications();
212+
213+
//——————————————————————————————— WARNING ———————————————————————————————
214+
// Argument MUST match the amount of ImGui::PushStyleVar() calls
215+
ImGui::PopStyleVar(2);
216+
// Argument MUST match the amount of ImGui::PushStyleColor() calls
217+
ImGui::PopStyleColor(1);
218+
198219
if (!m_enabled)
199220
return;
200221

Diff for: src/stdafx.h

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
#include "CETVersion.h"
7171
#include "common/Logging.h"
7272
#include "common/FontMaterialDesignIcons.h"
73+
#include "common/ImGuiNotify.hpp"
7374
#include "Options.h"
7475
#include "Paths.h"
7576
#include "PersistentState.h"

Diff for: xmake.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ target("cyber_engine_tweaks")
6969
set_kind("shared")
7070
set_filename("cyber_engine_tweaks.asi")
7171
add_files("src/**.cpp")
72-
add_headerfiles("src/**.h", "build/CETVersion.h")
72+
add_headerfiles("src/**.h", "src/**.hpp", "build/CETVersion.h")
7373
add_includedirs("src/", "build/")
7474
add_syslinks("User32", "Version", "d3d11", "dxgi")
7575
add_packages("spdlog", "nlohmann_json", "minhook", "hopscotch-map", "imgui", "mem", "sol2", "tiltedcore", "sqlite3", "openrestry-luajit", "xbyak", "stb")

0 commit comments

Comments
 (0)