admin 发表于 2023-4-7 21:32:12

014-imGui窗口中列表框ListBox






郁金香灬外挂技术
       
        https://www.yjxsoft.com/
       
        本教程视频1920*1080分辩率下观看最佳
        VS2017+win10 64位 环境
        郁金香老师:扣扣 150330575
        欢迎大家参加 郁金香灬技术 游戏安全与外挂的研究学习。
       
        兴趣是我们最好的老师
        成长需要过程与循序渐进        
        兴趣+坚持+时间+优秀的教程会帮助你快速成功
   


学习目标:
    imGui窗口中列表框ListBox
        BeginListBox
        EndListBox
       

   窗口中列表框控件接口
       
          IMGUI_API bool          BeginListBox(
                const char* label,
                // open a framed scrolling region
                const ImVec2& size = ImVec2(0, 0));       
          // only call EndListBox() if BeginListBox() returned true!       
      IMGUI_API void          EndListBox();                                                      

    //简单 常用
    IMGUI_API bool          ListBox(
        const char* label,
        int* current_item,
        const char* const items[],
        int items_count, int height_in_items = -1);
       
        //此接口暂时不了解
    IMGUI_API bool          ListBox(const char* label,
        int* current_item,
        bool (*items_getter)(void* data, int idx, const char** out_text),
        void* data,
        int items_count,
        int height_in_items = -1);
       
       
       

void testListBox()
{
    ImGui::Begin("testListBox");
    // Using the _simplified_ one-liner ListBox() api here
    // See "List boxes" section for examples of how to use the more flexible BeginListBox()/EndListBox() api.
   // IMGUI_DEMO_MARKER("Widgets/Basic/ListBox");
    const char* items[] = { "Apple", "Banana", "Cherry", "Kiwi", "Mango", "Orange", "Pineapple", "Strawberry", "Watermelon" };
    static int item_current = 1;
    ImGui::Text(u8"ListBox示例");
    ImGui::SameLine(); HelpMarker(
      "Using the simplified one-liner ListBox API here.\nRefer to the \"List boxes\" \
section below for an explanation of how to use the more flexible and general BeginListBox/EndListBox API.");


    ImGui::ListBox("##listbox", &item_current, items, IM_ARRAYSIZE(items), 4);
   
    ImGui::End();
}



页: [1]
查看完整版本: 014-imGui窗口中列表框ListBox