From 4ec8da0a0e0701f8a3ad2889ddcb9fd683b0a80e Mon Sep 17 00:00:00 2001 From: gr1ndy <71841362+gr1ndy@users.noreply.github.com> Date: Wed, 22 Feb 2023 13:28:03 +0200 Subject: [PATCH 1/2] remake watermark --- Osiris/Hacks/Misc.cpp | 68 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 55 insertions(+), 13 deletions(-) diff --git a/Osiris/Hacks/Misc.cpp b/Osiris/Hacks/Misc.cpp index f9e0a74f..b4b6cbe2 100644 --- a/Osiris/Hacks/Misc.cpp +++ b/Osiris/Hacks/Misc.cpp @@ -1646,25 +1646,67 @@ void Misc::recoilCrosshair(ImDrawList* drawList) noexcept void Misc::watermark() noexcept { - if (!config->misc.watermark.enabled) + if (!config->misc.watermark.enabled) return; - if (config->misc.watermark.pos != ImVec2{}) { - ImGui::SetNextWindowPos(config->misc.watermark.pos); - config->misc.watermark.pos = {}; - } + auto draw_list = ImGui::GetForegroundDrawList(); - ImGuiWindowFlags windowFlags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize; - if (!gui->isOpen()) - windowFlags |= ImGuiWindowFlags_NoInputs; + std::string cheatname, username, build, time; + + char* user = getenv("username"); + + cheatname = "osiris "; + //time = memory->globalVars->realtime; // find out a way to get and display the local time - ImGui::SetNextWindowBgAlpha(0.3f); - ImGui::Begin("Watermark", nullptr, windowFlags); + username = user; +#if DEBUG + build = "[beta]"; +#endif + build = "[release]"; - static auto frameRate = 1.0f; - frameRate = 0.9f * frameRate + 0.1f * memory->globalVars->absoluteFrameTime; + // watermark text + auto text = std::string(cheatname + build + " | " + username).c_str(); - ImGui::Text("Osiris | %d fps | %d ms", frameRate != 0.0f ? static_cast(1 / frameRate) : 0, GameData::getNetOutgoingLatency()); + // calc text size + ImVec2 calcText = ImGui::CalcTextSize(text); + + //set window size + ImGui::SetNextWindowSize(ImVec2(calcText.x + 10, calcText.y * 2 - 6)); + + ImGui::Begin("##WIM", NULL, ImGuiWindowFlags_::ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_::ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_::ImGuiWindowFlags_NoBackground); + { + // get window pos + auto p = ImGui::GetWindowPos(); + + // set watermark color + auto bg_clr = + ImColor(0, 0, 0, 150), + line_clr = ImColor(53, 105, 189, 255), + text_clr = ImColor(255, 255, 255, 255), + glow_clr_first = ImColor(53, 105, 189, 125), + glow_clr_second = ImColor(53, 105, 189, 0); + + // draw bg + draw_list->AddRectFilled(p, ImVec2(p.x + calcText.x + 10, p.y + calcText.y * 2 - 6), bg_clr); + + // draw line + draw_list->AddRectFilled(p, ImVec2(p.x + calcText.x + 10, p.y + 2), line_clr); + + // draw text + draw_list->AddText( + ImVec2(p.x + 5, p.y + calcText.y / 2 - 2), + text_clr, + text + ); + + // draw glow + draw_list->AddRectFilledMultiColor(p, ImVec2(p.x + calcText.x + 10, p.y + calcText.y), + glow_clr_first, + glow_clr_first, + glow_clr_second, + glow_clr_second) + ; + } ImGui::End(); } From b128f3937e43e29d8a1aafa76dfe645a5b3ec0a4 Mon Sep 17 00:00:00 2001 From: gr1ndy <71841362+gr1ndy@users.noreply.github.com> Date: Wed, 22 Feb 2023 13:46:01 +0200 Subject: [PATCH 2/2] oopsie --- Osiris/Hacks/Misc.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Osiris/Hacks/Misc.cpp b/Osiris/Hacks/Misc.cpp index b4b6cbe2..d53b2874 100644 --- a/Osiris/Hacks/Misc.cpp +++ b/Osiris/Hacks/Misc.cpp @@ -1672,6 +1672,11 @@ void Misc::watermark() noexcept //set window size ImGui::SetNextWindowSize(ImVec2(calcText.x + 10, calcText.y * 2 - 6)); + + ImGuiWindowFlags windowFlags = ImGuiWindowFlags_::ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_::ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_::ImGuiWindowFlags_NoBackground; + + if (!gui->isOpen()) + windowFlags |= ImGuiWindowFlags_NoInputs; ImGui::Begin("##WIM", NULL, ImGuiWindowFlags_::ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_::ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_::ImGuiWindowFlags_NoBackground); {