ru p2cs > all
-
Автор темы
- #1
после того как я увидел в какой то пасте на юц ужасный ESP Preview я решил сделать свой, который намного лучше сделан.
Код:
enum esp_info_position
{
RIGHT,
CENTER_DOWN,
CENTER_UP
};
struct esp_info_s
{
esp_info_s(const std::string name, const Color color, const int position = RIGHT)
{
f_name = name; f_color = color; f_position = position;
}
std::string f_name;
int f_position;
Color f_color;
};
void EspPreview()
{
static std::vector<esp_info_s> info;
static bool enabled = true;
ImGui::SetNextWindowSize(ImVec2(280, 430));
ImGui::Begin("ESP Preview", &enabled, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_ShowBorders);
{
auto cur_window = ImGui::GetCurrentWindow();
ImVec2 w_pos = cur_window->Pos;
if (Cheat::Visuals.BoxESP)
{
if (Cheat::Visuals.BoxESPType == 0) // outline
{
cur_window->DrawList->AddRect(ImVec2(w_pos.x + 40, w_pos.y + 60), ImVec2(w_pos.x + 200, w_pos.y + 360), Color(Cheat::EspColor[0] * 255, Cheat::EspColor[1] * 255, Cheat::EspColor[2] * 255).GetU32());
}
else if (Cheat::Visuals.BoxESPType == 1) // corners
{
}
else // 3d box // #TODO: proper drawing for 3d box l0l
{
}
}
if (Cheat::Visuals.Info.Health)
{
cur_window->DrawList->AddRectFilled(ImVec2(w_pos.x + 34, w_pos.y + 60), ImVec2(w_pos.x + 37, w_pos.y + 360), Color::Green().GetU32());
}
if (Cheat::Visuals.Info.Name)
info.emplace_back(esp_info_s("name", Color::White(), CENTER_UP));
if (Cheat::Visuals.Info.Weapon)
info.emplace_back(esp_info_s("ak-47", Color::White(), CENTER_DOWN));
if (Cheat::Visuals.Info.Misc)
info.emplace_back(esp_info_s("hk", Color::White(), RIGHT));
for (auto render : info)
{
auto text_size = ImGui::CalcTextSize(render.f_name.c_str());
auto pos = ImVec2(w_pos.x + 205, w_pos.y + 60);
if (render.f_position == CENTER_DOWN)
{
pos = ImVec2(w_pos.x + (240 / 2) - text_size.x / 2, pos.y + 315 - text_size.y);
}
else if (render.f_position == CENTER_UP)
{
pos = ImVec2(w_pos.x + (240 / 2) - text_size.x / 2, pos.y - 5 - text_size.y);
}
cur_window->DrawList->AddText(pos, render.f_color.GetU32(), render.f_name.c_str());
}
}
ImGui::End();
info.clear();
}
Последнее редактирование: