Untitled
void DrawPlayerCorneredBox(float X, float Y, float W, float H, bool isVisible, const ImU32& color, float thickness, const VisualParams& params) { auto vList = ImGui::GetOverlayDrawList(); float lineW = (W / 3); float lineH = (H / 3); //black outlines auto col = ImGui::GetColorU32(color); //corners vList->AddLine(ImVec2(X, Y - thickness / 2), ImVec2(X, Y + lineH), col, thickness);//top left vList->AddLine(ImVec2(X - thickness / 2, Y), ImVec2(X + lineW, Y), col, thickness); vList->AddLine(ImVec2(X + W - lineW, Y), ImVec2(X + W + thickness / 2, Y), col, thickness);//top right horizontal vList->AddLine(ImVec2(X + W, Y - thickness / 2), ImVec2(X + W, Y + lineH), col, thickness); vList->AddLine(ImVec2(X, Y + H - lineH), ImVec2(X, Y + H + (thickness / 2)), col, thickness);//bot left vList->AddLine(ImVec2(X - thickness / 2, Y + H), ImVec2(X + lineW, Y + H), col, thickness); vList->AddLine(ImVec2(X + W - lineW, Y + H), ImVec2(X + W + thickness / 2, Y + H), col, thickness);//bot right vList->AddLine(ImVec2(X + W, Y + H - lineH), ImVec2(X + W, Y + H + (thickness / 2)), col, thickness); ImU32 boxColor = isVisible ? ImGui::GetColorU32(ImVec4(settings::visualsSettings::boxColorVisible[0], settings::visualsSettings::boxColorVisible[1], settings::visualsSettings::boxColorVisible[2], params.alpha)) : ImGui::GetColorU32(ImVec4(settings::visualsSettings::boxColorNotVisible[0], settings::visualsSettings::boxColorNotVisible[1], settings::visualsSettings::boxColorNotVisible[2], params.alpha)); } void DrawBox(float x, float y, float w, float h, bool isVisible, ImColor color, float thickness, const VisualParams& params) { DrawLine2(ImVec2(x, y), ImVec2(x + w, y), color, thickness); // top DrawLine2(ImVec2(x, y - 1.3f), ImVec2(x, y + h + 1.4f), color, thickness); // left DrawLine2(ImVec2(x + w, y - 1.3f), ImVec2(x + w, y + h + 1.4f), color, thickness); // right DrawLine2(ImVec2(x, y + h), ImVec2(x + w, y + h), color, thickness); // bottom ImU32 boxColor = isVisible ? ImGui::GetColorU32(ImVec4(settings::visualsSettings::boxColorVisible[0], settings::visualsSettings::boxColorVisible[1], settings::visualsSettings::boxColorVisible[2], params.alpha)) : ImGui::GetColorU32(ImVec4(settings::visualsSettings::boxColorNotVisible[0], settings::visualsSettings::boxColorNotVisible[1], settings::visualsSettings::boxColorNotVisible[2], params.alpha)); } vec3_t pos = player.position; if (settings::visualsSettings::boxes) { vec2_t headScreen, feetScreen; vec3_t headPos = pos; headPos.z += 66.f; vec3_t feetPos = pos; if (espw2s(headPos, headScreen) && espw2s(feetPos, feetScreen)) { float height = abs(headScreen.y - feetScreen.y); float width = height * 0.65f; if (height > 0 && width > 0) { ImU32 boxColor = player.isVisible ? ImGui::GetColorU32(ImVec4(settings::visualsSettings::boxColorVisible[0], settings::visualsSettings::boxColorVisible[1], settings::visualsSettings::boxColorVisible[2], params.alpha)) : ImGui::GetColorU32(ImVec4(settings::visualsSettings::boxColorNotVisible[0], settings::visualsSettings::boxColorNotVisible[1], settings::visualsSettings::boxColorNotVisible[2], params.alpha)); if (settings::boxStyles == 0) { DrawBox(headScreen.x - width / 2, headScreen.y, width, height, player.isVisible, boxColor, settings::boxThickness, params); } else if (settings::boxStyles == 1) { DrawPlayerCorneredBox(headScreen.x - width / 2, headScreen.y, width, height, player.isVisible, boxColor, settings::boxThickness, params); } } } }
Leave a Comment