C ++, create a list of "ids"

0

This is the code

if (otherpages == 2)
{
    ImGui::Columns(2, nullptr, false);
    ImGui::Checkbox("Enable Medal Changer", &Settings::MedalChanger::enabled);
    static int medal_id = 0;
    ImGui::InputInt("Medal ID", &medal_id);
    if (ImGui::Button("Add") && medal_id != 0) {
        Settings::MedalChanger::medals.insert(Settings::MedalChanger::medals.end(), medal_id);
        medal_id = 0;
    }
    ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1, 1, 1, 1));
    ImGui::ListBoxHeader("Medal List");
    for (int m = 0; m < Settings::MedalChanger::medals.size(); m++) {
        if (ImGui::Selectable(std::to_string(Settings::MedalChanger::medals[m]).c_str())) {
            if (Settings::MedalChanger::equipped_medal == Settings::MedalChanger::medals[m]) {
                Settings::MedalChanger::equipped_medal = 0;
                Settings::MedalChanger::equipped_medal_override = false;
            }
            Settings::MedalChanger::medals.erase(Settings::MedalChanger::medals.begin() + m);
        }
    }
    ImGui::ListBoxFooter();
    ImGui::PopStyleColor();
    ImGui::Checkbox("Equipped Medal Override", &Settings::MedalChanger::equipped_medal_override);
    if (Settings::MedalChanger::equipped_medal_override) {
        static int equipped_medal = 0;
        ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1, 1, 1, 1));
        if (ImGui::Combo("Equipped Medal", &equipped_medal, [](void* data, int idx, const char** out_text)
        {
            *out_text = std::to_string(Settings::MedalChanger::medals[idx]).c_str();
            return true;
        }, nullptr, Settings::MedalChanger::medals.size(), 5)) {
            Settings::MedalChanger::equipped_medal = Settings::MedalChanger::medals[equipped_medal];
        }
        ImGui::PopStyleColor();
    }
    if (ImGui::Button("Apply##Medals")) {
        SendClientHello();
    }

this part of the code, it causes q to add numbers 0, then click on +, 1 I wanted to instead put a list with all the ids.

static int medal_id = 0;
ImGui::InputInt("Medal ID", &medal_id);
if (ImGui::Button("Add") && medal_id != 0) {
    Settings::MedalChanger::medals.insert(Settings::MedalChanger::medals.end(), medal_id);
    
asked by anonymous 17.04.2018 / 20:39

0 answers