Keybind List

This is an example script that will display every available keybind and change it's color based on it's current status.

auto tahomabd = render::create_font("C:\\Windows\\Fonts\\TahomaBD.ttf", 12.f);

auto enable_checkbox = menu::add_toggle("keybind list", true);

auto keybind_list_pos = vec2_t(200.f, 200.f);
auto keybind_list_size = vec2_t(160.f, 0.f);

auto was_dragging = false;

void render()
{

    if (!enable_checkbox.get_value())
        return;

    auto binds = cheat::get_binds();

    keybind_list_size.y = (14.f * binds.length()) + 31.f;

    if (render::get_key_state(0x01))
    {

        auto cursor_pos = render::get_cursor_pos();

        if (render::area_contains(keybind_list_pos, keybind_list_size, cursor_pos))
        {
            
            keybind_list_pos = cursor_pos;
            was_dragging = true;

        }
        else if (was_dragging)
            keybind_list_pos = cursor_pos;

    }
    else
        was_dragging = false;

    render::add_rect_filled(keybind_list_pos, keybind_list_size, { 24, 24, 24, 255 }, 6.f);
    render::add_rect(keybind_list_pos, keybind_list_size, { 0, 0, 0, 255 }, 6.f);

    for (uint i = 0; i < binds.length(); i++)
    {

        auto bind = binds[i];
        auto alpha = 255;

        if (!bind.get_enabled())
            alpha = 120;

        auto bind_pos = vec2_t(keybind_list_pos.x + 10.f, keybind_list_pos.y + (9.f + (16.f * i)));

        render::add_text_shadowed(bind_pos, bind.get_name(), { 255, 255, 255, alpha }, tahomabd);

    }

}

Last updated