-
Автор темы
- #1
Делал под пивом не ебите мозг почему не через AddRectFilledMulticolor
main.cpp
player_esp.cpp
menu.cpp
еще раз плис много не срите
main.cpp
Код:
fonts[NAME4] = create_font(crypt_str("Verdana"), 12, FW_EXTRALIGHT, FONTFLAG_NONE | FONTFLAG_NONE);
Код:
bool mouse_pointer(Vector2D position, Vector2D size)
{
return hooks::mouse_pos.x > position.x && hooks::mouse_pos.y > position.y && hooks::mouse_pos.x < position.x + size.x && hooks::mouse_pos.y < position.y + size.y;
}
struct keybind {
std::string name = "";
int prev_act = 0;
int mode = 0;
float last_time_update = 0.f;
float alpha = 0.f;
key_bind keyshit;
};
struct sperma {
key_bind& keybind;
int id;
const char* name;
};
void update_keybind(key_bind& keybd, int id) {
if (id >= 4 && id < 12 && g_ctx.globals.current_weapon != -1 && key_binds::get().get_key_bind_state(4 + g_ctx.globals.current_weapon) && !g_ctx.globals.weapon->is_non_aim() ||
id == 2 && misc::get().double_tap_enabled || id == 12 && misc::get().hide_shots_enabled || get_bind_state(keybd, id) > 0) {
keybd.last_time_update = m_globals()->m_realtime;
}
}
void playeresp::keylist() {
if (!g_cfg.misc.keybinds)
return;
std::vector<sperma> keybinds = {
{g_cfg.antiaim.flip_desync, 16, "Anti-aim inverter"},
{g_cfg.antiaim.hide_shots_key, 12, "Hide shot"},
{g_cfg.misc.fakeduck_key, 20, "Fake Duck"},
{g_cfg.misc.slowwalk_key, 21, "Slow walk"},
{g_cfg.ragebot.body_aim_key, 22, "Baim"},
{g_cfg.ragebot.double_tap_key, 2, "Double tap"},
{g_cfg.ragebot.safe_point_key, 3, "Safe points"},
{g_cfg.misc.automatic_peek, 18, "Peek asisit"},
};
for (auto& keybind : keybinds) {
update_keybind(keybind.keybind, keybind.id);
}
const auto time = m_globals()->m_realtime;
constexpr auto anim_speed = 0.2f;
auto size = Vector2D(150.f, 20.f);
bool _click = false;
static bool _dragging = false;
static Vector2D tl(300, 300);
constexpr auto padding = 4.f;
constexpr auto spacing = 4.f;
constexpr auto line_size = 2.f;
auto back_color = Color(0.f, 0.f, 0.f, 0.95f);
auto text_color = Color(1.f, 1.f, 1.f, 0.95f);
auto line_color = Color(0, 255, 255, 255);
auto last_expiration = 0.f;
static int drag_x = 50;
static int drag_y = 50;
if (hooks::menu_open && GetAsyncKeyState(VK_LBUTTON))
_click = true;
Vector2D _mouse_pos = hooks::mouse_pos;
if (hooks::menu_open)
{
if (_dragging && !_click)
_dragging = false;
if (_dragging && _click)
{
tl.x = _mouse_pos.x - drag_x;
tl.y = _mouse_pos.y - drag_y;
}
if (mouse_pointer(Vector2D(tl.x, tl.y), Vector2D(150, 20)))
{
_dragging = true;
drag_x = _mouse_pos.x - tl.x;
drag_y = _mouse_pos.y - tl.y;
}
}
auto pos = Vector2D(tl.x, tl.y);
std::vector<sperma> active;
for (auto &s2 : keybinds) {
auto cal2 = &s2.keybind;
const auto expiration = 1.f - (time - cal2->last_time_update) / anim_speed;
last_expiration = max(last_expiration, expiration);
if (expiration <= 0.f)
continue;
cal2->alpha = expiration * 255.f;
active.push_back(s2);
}
if (active.empty())
return;
line_color.SetAlpha(last_expiration * 255.f);
back_color.SetAlpha(last_expiration * 150.f);
text_color.SetAlpha(last_expiration * 255.f);
if (g_cfg.misc.keybinds) {
switch (g_cfg.misc.keybind_type) {
case 1:
render::get().rect_filled(pos.x, pos.y, size.x, line_size, Color(g_cfg.misc.keybind_color));
break;
case 2:
render::get().gradient(pos.x, pos.y, size.x - 70, line_size, Color(0, 0, 0, 0), Color(g_cfg.misc.keybind_color), GRADIENT_HORIZONTAL);
render::get().gradient(pos.x + 70, pos.y, size.x - 70, line_size, Color(g_cfg.misc.keybind_color), Color(0, 0, 0, 0), GRADIENT_HORIZONTAL);
break;
}
}
render::get().rect_filled(pos.x, pos.y + line_size, size.x, size.y - line_size, back_color);
auto posay = pos + (size / 2.f);
render::get().text(fonts[NAME4], posay.x, posay.y, text_color, HFONT_CENTERED_X | HFONT_CENTERED_Y, crypt_str("keybinding"));
auto draw_pos = Vector2D(padding, size.y + spacing);
auto draw_size = Vector2D(size.x - (padding * 2.f), 0.f);
for (auto& data : active) {
auto mode = data.keybind.mode == 0 ? "[hold]" : "[toggled]";
const auto text_size = Vector2D(render::get().text_width(fonts[NAME4], mode), render::get().text_heigth(fonts[NAME4], mode));
auto govon_pos = pos + draw_pos + draw_size;
text_color.SetAlpha((int)data.keybind.alpha);
render::get().text(fonts[NAME4], pos.x + draw_pos.x, pos.y + draw_pos.y, text_color, HFONT_CENTERED_NONE, data.name);
render::get().text(fonts[NAME4], govon_pos.x - text_size.x, govon_pos.y, text_color, HFONT_CENTERED_NONE, mode);
draw_pos.y += text_size.y + spacing;
}
}
Код:
ImGui::Checkbox("Keybinds", &g_cfg.misc.keybinds);
if (g_cfg.misc.keybinds) {
ImGui::Spacing();
ImGui::Text(crypt_str("Keybinds color"));
ImGui::SameLine();
ImGui::ColorEdit("##keybind_color", &g_cfg.misc.keybind_color, ALPHA);
ImGui::Spacing();
ImGui::Text(crypt_str("Keybinds type"));
ImGui::SameLine();
ImGui::Spacing();
ImGui::Combo("##Type", &g_cfg.misc.keybind_type, "None\0Static line\0Fade line\0");
padding(0, 2);
}
Вложения
-
23.1 KB Просмотры: 697