• Ищем качественного (не новичок) разработчиков Xenforo для этого форума! В идеале, чтобы ты был фулл стек программистом. Если у тебя есть что показать, то свяжись с нами по контактным данным: https://t.me/DREDD

ImGui приколы с Child'ами

I'm watching you
Участник
Участник
Статус
Оффлайн
Регистрация
7 Фев 2020
Сообщения
771
Реакции
241
С такими чайлдами меню отображает только один чайлд.Памагити
C++:
Expand Collapse Copy
namespace render
{
    namespace menu
    {
        extern std::map<int, weapon_type_t> get_weapons(bool need_knife);
        extern std::map<int, const char*> get_groups(bool need_knife = false, bool need_groups = false);
        extern bool selectable_weapons(
            int& selected_item,
            bool only_groups,
            std::string& weaponName,
            std::map<int, const char*> groups,
            std::map<int, weapon_type_t> k_item_names,
            std::vector<int> selected_weapons = { }
        );

        extern bool listbox_group_weapons(
            int& selected_item,
            std::map<int, const char*> groups,
            std::map<int, weapon_type_t> items,
            ImVec2 listbox_size,
            bool show_only_selected = false,
            std::vector<int> selected_weapons = { }
        );

        void aimbot_tab()
        {
            static int definition_index = 7;
            auto settings = &settings::aimbot::m_items[definition_index];

            ImGui::BeginChild("General", ImVec2(200, 400), true);
            {
                auto k_item_names = get_weapons(false);

                const char* setting_types[] =
                {
                    ___("Separately", u8"Separado"),
                    ___("Subgroups", u8"Subgrupos"),
                    ___("For all", u8"Todas"),
                    ___("Groups", u8"Grupos")
                };

                static bool is_settings_visible = false;

                if (ImGui::Combo("##setting_type", &settings::aimbot::setting_type, setting_types, IM_ARRAYSIZE(setting_types)))
                    is_settings_visible = settings::aimbot::setting_type == settings_type_t::groups ? false : true;

                if (settings::aimbot::setting_type != settings_type_t::groups)
                    is_settings_visible = true;

                if (settings::aimbot::setting_type == settings_type_t::for_all)
                {
                    definition_index = 0;
                }
                else if (settings::aimbot::setting_type == settings_type_t::separately || settings::aimbot::setting_type == settings_type_t::subgroups)
                {
                    auto groups = get_groups(false, true);

                    std::string weaponName;
                    if (settings::aimbot::setting_type == settings_type_t::subgroups)
                    {
                        if (groups.count(definition_index) == 0)
                            definition_index = WEAPONTYPE_PISTOL;

                        weaponName = groups[definition_index];
                    }
                    else
                    {
                        if (k_item_names.count(definition_index) == 0)
                            definition_index = WEAPON_AK47;

                        weaponName = k_item_names[definition_index].name;
                    }

                    selectable_weapons(definition_index, settings::aimbot::setting_type == settings_type_t::subgroups, weaponName, groups, k_item_names);
                }
                else if (settings::aimbot::setting_type == settings_type_t::groups)
                {
                    if (definition_index < 0 || definition_index >= settings::aimbot::m_groups.size())
                    {
                        definition_index = 0;
                    }

                    if (settings::aimbot::m_groups.size() > 0)
                    {
                        ImGui::PushItemWidth(ImGui::GetContentRegionAvailWidth() - 70.f);
                        ImGui::Combo("##aimbot.groups", &definition_index, [](void* data, int idx, const char** out_text)
                        {
                            *out_text = settings::aimbot::m_groups[idx].name.c_str();
                            return true;
                        }, nullptr, settings::aimbot::m_groups.size(), 10);
                        ImGui::PopItemWidth();

                        ImGui::SameLine();

                        if (is_settings_visible)
                        {
                            if (ImGui::Button(___("Edit", u8"Editar"), ImVec2(ImGui::GetContentRegionAvailWidth(), 0.f)))
                                is_settings_visible = false;
                        }
                        else
                        {
                            if (ImGui::Button(___("Hide", u8"Ocultar"), ImVec2(ImGui::GetContentRegionAvailWidth(), 0.f)))
                                is_settings_visible = true;
                        }
                    }

                    if (!is_settings_visible)
                    {
                        separator(___("New group", u8"Novo Grupo"));

                        ImGui::Text(___("Name", u8"Èìÿ"));

                        static char group_name[32];
                        ImGui::InputText("##aimbot.group_name", group_name, sizeof(group_name));

                        if (ImGui::Button(___("Create", u8"Criar")))
                        {
                            if (strlen(group_name) == 0)
                                notifies::push(___("Enter the group name", u8"Nome do grupo"), notify_state_s::danger_state);
                            else
                            {
                                settings::aimbot::m_groups.emplace_back(aimbot_group{ std::string(group_name), { } });

                                memset(group_name, 0, sizeof(group_name));
                                notifies::push(___("Group created", u8"Grupo criado"));

                                definition_index = settings::aimbot::m_groups.size() - 1;
                            }
                        }

                        if (settings::aimbot::m_groups.empty())
                            return;

                        separator(___("Current group", u8"Grupo atual"));

                        auto& current_group = settings::aimbot::m_groups[definition_index];

                        static auto weapon_to_select = -1;
                        std::string placeholder = ___("Select weapon", u8"Arma selecionada");

                        const auto groups = get_groups(false, false);

                        if (selectable_weapons(weapon_to_select, false, placeholder, groups, k_item_names, current_group.weapons))
                        {
                            if (std::find(current_group.weapons.begin(), current_group.weapons.end(), weapon_to_select) == current_group.weapons.end())
                                current_group.weapons.emplace_back(weapon_to_select);

                            weapon_to_select = -1;
                        }

                        //ImGui::Text(___("Press for remove weapon", u8"Íàæìèòå äëÿ óäàëåíèÿ"));

                        static int weapon_to_remove = -1;
                        //ImVec2(ImGui::GetContentRegionAvailWidth(), 150.f)
                        if (listbox_group_weapons(weapon_to_remove, groups, k_item_names, ImVec2(0, 150.f), true, current_group.weapons))
                        {
                            current_group.weapons.erase(std::find(current_group.weapons.begin(), current_group.weapons.end(), weapon_to_remove));

                            weapon_to_remove = -1;
                        }

                        if (ImGui::Button(___("Delete", u8"Deletar")))
                        {
                            notifies::push(___("Group removed", u8"Grupo removido"));

                            settings::aimbot::m_groups.erase(settings::aimbot::m_groups.begin() + definition_index);

                            definition_index = 0;
                        }

                        return;
                    }
                }

                checkbox("Enabled", u8"Habilitado", &settings->enabled);
                tooltip("Key to all menu itens.", u8"Chave para todas as funcoes.");

                if (settings::aimbot::setting_type == settings_type_t::separately)
                {
                    switch (definition_index)
                    {
                    case WEAPON_P250:
                    case WEAPON_USP_SILENCER:
                    case WEAPON_GLOCK:
                    case WEAPON_FIVESEVEN:
                    case WEAPON_TEC9:
                    case WEAPON_DEAGLE:
                    case WEAPON_ELITE:
                    case WEAPON_HKP2000:
                    case 201:
                        checkbox("Auto Pistol", u8"Pistola Automatica", &settings->autopistol);
                        tooltip("Pistols shoots constantily if you press to fire.", u8"Pistolas disparam constantemente se voc� pressionar para disparar.");
                    default:
                        break;
                    }
                }
                else if (settings::aimbot::setting_type == settings_type_t::subgroups && (definition_index == WEAPONTYPE_PISTOL || definition_index == 201))
                    checkbox("Auto Pistol", u8"Pistola Automatica", &settings->autopistol);
                else
                    checkbox("Auto Pistol", u8"Pistola Automatica", &settings->autopistol);

                checkbox("Air Check", u8"Air Check", &settings->check_air);
                tooltip("Enabled functions will not work if the enemy is in the air.", u8"As funcoes habilitadas nao vao funcionar se o inimigo estiver no ar.");
                checkbox("Flash Check", u8"Flash Check", &settings->check_flash);
                tooltip("Enabled functions will not work if you are flashed.", u8"As funcoes habilitadas nao vao funcionar se voce estiver cegado.");
                checkbox("Smoke Check", u8"Smoke Check", &settings->check_smoke);
                tooltip("Enabled functions will not work if the enemy are on smoke.", u8"As funcoes habilitadas nao vao funcionar se o inimigo estiver na smoke.");

                if (settings::aimbot::setting_type == settings_type_t::separately)
                {
                    if (utils::is_sniper(definition_index))
                        checkbox("Zoom Check", u8"Zoom Check", &settings->check_zoom);
                }
                else if (settings::aimbot::setting_type == settings_type_t::subgroups)
                {
                    if (definition_index == 240 || definition_index == 209 || definition_index == WEAPONTYPE_SNIPER_RIFLE)
                        checkbox("Zoom Check", u8"Zoom Check", &settings->check_zoom);
                }
                else if (settings::aimbot::setting_type == settings_type_t::groups)
                    checkbox("Zoom Check", u8"Zoom Check", &settings->check_zoom);


                columns(2);
                {
                    checkbox("Auto Wall", u8"Auto Wall", &settings->autowall.enabled);
                    tooltip("Aimbot works through objects.", u8"Aimbot funciona atravas de objetos.");

                    ImGui::NextColumn();

                    ImGui::PushItemWidth(-1);
                    ImGui::SliderIntLeftAligned(___("Min:##autowall", u8"Min:##autowall"), &settings->autowall.min_damage, 1, 100, "%.0f HP");
                    ImGui::PopItemWidth();
                }
                columns(1);

                {
                    checkbox("Backtrack", u8"Backtrack", &settings->backtrack.legit);

                    ImGui::SliderIntLeftAligned(___("Backtrack:", u8"Backtrack:"), &settings->backtrack.ticks, 1, 12, ___("%.0f ticks", u8"%.0f Ticks"));
                    tooltip("Hit old ticks of player.", u8"Hita ticks antigos do jogador.");
                }

                
                if (settings::aimbot::setting_type != 0)
                    return;

                if (!utils::is_connected())
                    return;

                auto weapon = interfaces::local_player->m_hActiveWeapon();
                if (!weapon || !weapon->IsWeapon())
                    return;

                const auto item_definition_index = weapon->m_iItemDefinitionIndex();
                if (k_item_names.count(item_definition_index) == 0)
                    return;

                ImGui::Separator();

                if (ImGui::Button(___("Current", u8"Atual")))
                    definition_index = item_definition_index;
            }ImGui::EndChild();


            ImGui::NextColumn();

            ImGui::BeginChild("LegitBot Settings", ImVec2(200, 400), true);
                {

                    ImGui::PushID("aimbot.other");
                {
                    checkbox("Dynamic FOV", u8"FOV Dinamico", &settings->dynamic_fov);
                    tooltip("Distance-based Aimbot.", u8"Aimbot baseado na distancia do inimigo.");

                    ImGui::SliderFloatLeftAligned(___("FOV:", u8"FOV:"), &settings->fov, 0, 30.f);
                    tooltip("Field of view.", u8"Campo de visao do Aimbot.");

                    ImGui::SliderFloatLeftAligned(___("Smooth:", u8"Smooth:"), &settings->smooth, 0, 15.f);
                    tooltip("Smooth factor.", u8"Velocidade da puxada. Maior = Mais lento");

                    ImGui::SliderIntLeftAligned(___("Hit Chance:", u8"Chance de acerto:"), &settings->min_hitchanse, 0, 100, "%.0f%%");

                }
                ImGui::PopID();

                separator(___("Aimbot Delays", u8"Aimbot Delays"));

                if (!settings->silent.enabled)
                {
                    checkbox("Auto Delay", u8"Delay", &settings->autodelay);
                    ImGui::SliderIntLeftAligned(___("Shot Delay:", u8"Delay do primeiro tiro:"), &settings->shot_delay, 0, 250, "%.0f ms");
                    tooltip("Delay of the first shot after the crosshair is on enemy.", u8"Delay do primeiro tiro depois da mira estar no inimigo.");
                }
                ImGui::SliderIntLeftAligned(___("Target Switch Delay:", u8"Delay de troca de alvo:"), &settings->kill_delay, 0, 1000, "%.0f ms");
                tooltip("Delay of switch to another enemy.", u8"Delay para o aimbot puxar para o proximo inimigo.");

                separator(___("Auto Fire", u8"Auto Fire"));

                columns(2);
                {
                    checkbox("Enabled##trigger", u8"Habilitar##trigger", &settings->trigger.enabled);
                    tooltip("Enable Auto Fire.", u8"Habilita o Trigger.");

                    ImGui::NextColumn();

                    ImGui::PushItemWidth(-1);
                    hotkey("##binds.trigger", &globals::binds::trigger);
                    ImGui::PopItemWidth();

                }
                columns(1);

                bind_button("Back Shot", "Back Shot", globals::binds::back_shot);

                ImGui::SliderIntLeftAligned(___("Reaction time:", u8"Tempo de reacao:"), &settings->trigger.delay, 0, 250, "%.0f ms");
                tooltip("Delay to shoot.", u8"Delay para atirar.");
                ImGui::SliderIntLeftAligned(___("Delay Between Shots:", u8"Delay entre os tiros:"), &settings->trigger.delay_btw_shots, 0, 250, "%.0f ms");
                tooltip("Delay to shoot again.", u8"Delay para atirar novamente.");
                ImGui::SliderIntLeftAligned(___("Hit Chance:", u8"Chance de Acerto:"), &settings->trigger.hitchance, 1, 100, "%.0f%%");

            }ImGui::EndChild();

            ImGui::NextColumn();

            /*static char* rcs_types[] = {
            "Always"
            }; */

            ImGui::BeginChild("Rcs", ImVec2(200, 400), true);
            {
                checkbox("Enabled", u8"Habilitar", &settings->recoil.enabled);
                tooltip("Enable Recoil Control System.", u8"Habilita o controle de recoil.");
                checkbox("Standalone", u8"Standalone", &settings->recoil.standalone);
                checkbox("First Bullet", u8"Primeiro tiro", &settings->recoil.first_bullet);
                checkbox("Humanize", u8"Modo humano", &settings->recoil.humanize);
                tooltip("Humanizer Recoil.", u8"Recoil Humanizado.");

                ImGui::SliderFloatLeftAligned("Pitch:", &settings->recoil.pitch, 0, 2);
                ImGui::SliderFloatLeftAligned("Yaw:", &settings->recoil.yaw, 0, 2);

                separator(___("Hitbox", u8"Hitbox"));

                columns(2);
                {
                    checkbox("Head", u8"Cabeca", &settings->hitboxes.head);

                    checkbox("Hands", u8"Maos", &settings->hitboxes.hands);

                    checkbox("Neck", u8"Pescoco", &settings->hitboxes.neck);

                    checkbox("Legs", u8"Pernas", &settings->hitboxes.legs);

                    checkbox("Body", u8"Corpo", &settings->hitboxes.body);
                }
                columns(1);
            }ImGui::EndChild();
        }
    }
}
1586952957608.png
 
А в чем проблема юзать imgui::sameline и imgui::setcursorpos(Imvec2(x,y)))?
 
А в чем проблема юзать imgui::sameline и imgui::setcursorpos(Imvec2(x,y)))?
Т.к внутри чайлдов хочу сделать другой оттенок нежели в меню.
Других способов кроме как с чайлдами не знаю.
 
Т.к внутри чайлдов хочу сделать другой оттенок нежели в меню.
Других способов кроме как с чайлдами не знаю.
ты не понял,я имею ввиду зачем юзать NextColumn,если можно юзать другое
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Я получаю расположение, где начинать рисовать чайлд, а потом перед его началом задаю это расположение с помощью ImGui::SetNextWindowPos
 
ImGui::Columns задал?Я просто не нашёл в коде
 
ImGui::Columns(3, nullptr, false); в начало попробуй
 
Назад
Сверху Снизу