-
Автор темы
- #1
its a bit bugged but works (shit code) and not mine i got from discord guy
and just adapted for lwv3.
code :
sorry its my firts topic
and just adapted for lwv3.
code :
C++:
const char* get_state(int key)
{
bool is_hold = key_binds::get().get_key_bind_mode(key) == HOLD;
bool is_toggle = key_binds::get().get_key_bind_mode(key) == TOGGLE;
if (is_toggle)
return "[toggled]";
else if (is_hold)
return "[holding]";
return "";
}
void misc::keybinds()
{
std::string keybinds_name = "keybinds";
ImGui::PushFont(c_menu::get().g_pinfoFont);
int binds_size = 170;
int size_to_add = 0;
int biggest_key_bind = 0;
int prev_biggest_key_bind = 0;
std::vector<float> sizes;
std::vector<float> poses;
std::vector<std::string> binds;
std::vector<std::string> states;
if (key_binds::get().get_key_bind_state(0)) {
binds.push_back("[auto fire]");
states.push_back(get_state(0));
}
if (g_cfg.ragebot.double_tap && g_cfg.ragebot.double_tap_key.key > KEY_NONE && g_cfg.ragebot.double_tap_key.key < KEY_MAX && exploit::get().double_tap_key) {
binds.push_back("[double tap]");
states.push_back(get_state(0));
}
if (key_binds::get().get_key_bind_state(3)) {
binds.push_back("[safe point]");
states.push_back(get_state(3));
}
if (g_ctx.globals.current_weapon != -1 && key_binds::get().get_key_bind_state(4 + g_ctx.globals.current_weapon))
{
binds.push_back("[damage override]");
states.push_back(get_state(4));
}
if (g_cfg.antiaim.hide_shots && g_cfg.antiaim.hide_shots_key.key > KEY_NONE && g_cfg.antiaim.hide_shots_key.key < KEY_MAX && exploit::get().hide_shots_key) {
binds.push_back("[hide shots]");
states.push_back(get_state(0));
}
if (key_binds::get().get_key_bind_state(16)) {
binds.push_back("[flip desync]");
states.push_back(get_state(16));
}
if (key_binds::get().get_key_bind_state(17)) {
binds.push_back("[thirdperson]");
states.push_back(get_state(17));
}
if (key_binds::get().get_key_bind_state(18)) {
binds.push_back("[auto peek]");
states.push_back(get_state(18));
}
if (key_binds::get().get_key_bind_state(20)) {
binds.push_back("[fake duck]");
states.push_back(get_state(20));
}
if (key_binds::get().get_key_bind_state(21)) {
binds.push_back("[slow walk]");
states.push_back(get_state(20));
}
if (key_binds::get().get_key_bind_state(22)) {
binds.push_back("[body aim]");
states.push_back(get_state(22));
}
bool should_draw_binds = !binds.empty();
if (!binds.empty())
{
for (auto i = 0; i < binds.size(); i++)
{
float previous_pos = poses.empty() ? 30 : poses.at(poses.size() - 1);
float add_to_size = sizes.empty() ? 0 : 8;
sizes.push_back(ImGui::CalcTextSize(binds.at(i).c_str()).y / 2 + add_to_size);
poses.push_back(previous_pos + sizes.at(i));
prev_biggest_key_bind = ImGui::CalcTextSize(binds.at(i).c_str()).x + 14 + ImGui::CalcTextSize(states.at(i).c_str()).x + 10;
if (prev_biggest_key_bind > biggest_key_bind)
biggest_key_bind = prev_biggest_key_bind;
}
}
if (!sizes.empty())
{
for (auto i = 0; i < sizes.size(); i++)
size_to_add += sizes.at(i);
size_to_add -= 7;
}
if (should_draw_binds)
binds_size = biggest_key_bind;
ImGui::SetNextWindowPos(ImVec2(600 - (binds_size + 14 + 8), 500));
ImGui::SetNextWindowSize(ImVec2(binds_size + 14, 95 + size_to_add));
ImGui::Begin("Binds", nullptr, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_::ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_::ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_::ImGuiWindowFlags_NoNavFocus | ImGuiWindowFlags_::ImGuiWindowFlags_NoNav);
{
ImDrawList* draw = ImGui::GetWindowDrawList();
ImVec2 pos = ImGui::GetWindowPos();
ImVec2 size = ImGui::GetWindowSize();
draw->AddRectFilled(pos, pos + ImVec2(binds_size + 15, 31), ImColor(33, 35, 40), 5);
draw->AddRectFilled(pos + ImVec2(2, 2), pos + ImVec2(binds_size + 12, 30), ImColor(45, 48, 55), 3);
draw->AddRectFilledMultiColor(pos + ImVec2(2, 2), pos + ImVec2(binds_size + 12, 7), ImColor(45, 48, 55), ImColor(201, 113, 45), ImColor(254, 184, 100), ImColor(254, 184, 100));
draw->AddText(pos + ImVec2(9 + ((binds_size / 2) - ImGui::CalcTextSize(keybinds_name.c_str()).x / 2), 17 - ImGui::CalcTextSize(keybinds_name.c_str()).y / 2), ImColor(214, 217, 225), keybinds_name.c_str());
if (should_draw_binds)
{
draw->AddRectFilled(pos + ImVec2(0, 34), pos + ImVec2(binds_size + 15, 60 + size_to_add - 1), ImColor(33, 35, 40), 5);
draw->AddRectFilled(pos + ImVec2(2, 35), pos + ImVec2(binds_size + 12, 60 + size_to_add - 2), ImColor(45, 48, 55), 3);
for (auto i = 0; i < binds.size(); i++)
{
draw->AddText(pos + ImVec2(9, poses.at(i)), ImColor(214, 217, 225), binds.at(i).c_str());
draw->AddText(pos + ImVec2(size.x - 9 - ImGui::CalcTextSize(states.at(i).c_str()).x, poses.at(i)), ImColor(214, 217, 225), states.at(i).c_str());
}
}
}
ImGui::End();
ImGui::PopFont();
}
Вложения
-
5.8 KB Просмотры: 428
Последнее редактирование модератором: