Эксперт
-
Автор темы
- #1
Код:
#include "misc/misc.h"
void c_menu::keys()
{
int pressed_binds = 0;
int text = 0;
int modes = 0;
std::string text = "";
std::string mode = "";
static bool other_bind_pressed = false;
if (key_binds::get().get_key_bind_state(16)) {
text += "Inverter";
text += "\n";
text ++;
switch (vars.antiaim.flip_desync.mode) {
case 0: {
mode += "[holding] ";
}break;
case 1: {
mode += "[toggled] ";
}break;
}
mode += "\n";
modes++;
pressed_binds++;
}
if (pressed_binds > 0 || hooks::menu_open)
other_bind_pressed = true;
else
other_bind_pressed = false;
ImVec2 Pos;
ImVec2 size_menu;
static float alpha_menu = 0.1f;
if (other_bind_pressed)
{
if(alpha_menu < 1.f)
alpha_menu += 0.05f;
}
else
{
if (alpha_menu > 0.1f)
alpha_menu -= 0.05f;
}
if ((vars.menu.keybinds)) {
if ((other_bind_pressed && alpha_menu > 0.1f ) || hooks::menu_open) {
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, alpha_menu);
if (ImGui::Begin("Keybinds", NULL, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoScrollbar))
{
size_menu = ImGui::GetWindowSize();
Pos = ImGui::GetWindowPos();
auto Render = ImGui::GetWindowDrawList();
Render->AddRectFilled({ Pos.x, Pos.y + 20 }, { Pos.x + size_menu.x, Pos.y + size_menu.y - 10 }, ImColor(35, 36, 46, ((int)(alpha_menu * 55))));
Render->AddRectFilled({ Pos.x, Pos.y + 2 }, { Pos.x + size_menu.x, Pos.y + 20 }, ImColor(35, 36, 46, (int)(alpha_menu * 150)));
Render->AddRectFilled({ Pos.x, Pos.y + 20 - 2 }, { Pos.x + size_menu.x, Pos.y + 20 }, ImColor(vars.menu.menu_theme.r(), vars.menu.menu_theme.g(), vars.menu.menu_theme.b(), (int)(alpha_menu * 255)));
ImVec2 size_text = ImGui::CalcTextSize(" key");
ImVec2 size_texts = ImGui::CalcTextSize("key");
ImGui::SetCursorPos({ (200 / 2) - size_text.x , 5 });
ImGui::TextColored(ImVec4(1.f, 1.f, 1.f, alpha_menu), "key");
ImGui::SetCursorPos({ (200 / 2) - size_text.x + size_texts.x, 5 });
ImGui::TextColored(ImVec4(vars.menu.menu_theme.r() / 255.f, vars.menu.menu_theme.g() / 255.f, vars.menu.menu_theme.b() / 255.f, (alpha_menu)), "bind");
if (text > 0) text += "\n";
if (modes > 0) mode += "\n";
ImVec2 size = ImGui::CalcTextSize(spect.c_str());
ImVec2 size2 = ImGui::CalcTextSize(mode.c_str());
ImGui::SetWindowSize(ImVec2(200, 20 + size.y));
ImGui::SetCursorPosY(21);
ImGui::Columns(2, "fart1", false);
ImGui::SetColumnWidth(0, 200 - (size2.x + 8));
ImGui::TextColored(ImVec4(1.f, 1.f, 1.f, alpha_menu), text.c_str());
ImGui::NextColumn();
ImGui::TextColored(ImVec4(1.f, 1.f, 1.f, alpha_menu), mode.c_str());
ImGui::Columns(1);
// ImGui::Separator();
}
ImGui::End();
ImGui::PopStyleVar();
// }
}
}
}
Анимация появления убогая, советую сделать получше