admin 发表于 2023-4-7 21:34:55

021-imGui窗口中的进度条UI控件Progress Bar


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

    交流扣扣群 29817979,9569245


学习目标:
   imGui窗口中的进度条UI控件 Progress Bar
   imGui窗口中的进度条UI接口

ImGui::ProgressBar(
progress2, //要显示的百分比 范围是0-1.0f
ImVec2(300.0f, 22.f),//设置宽度和高度
buf); //buf 要覆盖的格式化字符串




void CDX11::进度条UI控件测试()
{

   static float progress1 = 0.0f;
   static float progress2 = 1.1f;
   static bool animate = true;
   if (animate)
   {
         progress1 += 0.001f;
         if (progress1 >= 1.0f)progress1 = 0.0f;

         progress2 -= 0.001f;
         if (progress2 <= 0.0f)progress2 = 1.1f;

   }

   // Typically we would use ImVec2(-1.0f,0.0f) or ImVec2(-FLT_MIN,0.0f) to use all available width,
   // or ImVec2(width,0.0f) for a specified width. ImVec2(0.0f,0.0f) uses ItemWidth.
   char buf = { 0 };
   sprintf_s(buf, "test=%0.2f", progress1);
   ImGui::ProgressBar(progress1, ImVec2(300.0f,22.0f));   
   ImGui::ProgressBar(progress2, ImVec2(300.0f, 22.f), buf); //buf

   //ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
   ImGui::Text("Progress Bar progress1=%f", progress1);
   ImGui::Text("Progress Bar progress2=%f", progress2);

};





          void CDX11::进度条UI控件测试()
          {
            //0.0f1.0f
             //1111代码块
            {
                  static float progress1 = 0.1f;

            if (progress1 < 1.0f)
            {
                  progress1 = progress1 + 0.001f;
            }
            else
            {
                  progress1 = 0.1f;
            }
            // if (progress1 >= 1.0f) progress1 = 1.0f;
               // Typically we would use ImVec2(-1.0f,0.0f) or ImVec2(-FLT_MIN,0.0f) to use all available width,
               // or ImVec2(width,0.0f) for a specified width. ImVec2(0.0f,0.0f) uses ItemWidth.
            char buf = { 0 };
            sprintf_s(buf, "test=%0.2f", progress1);
            ImGui::ProgressBar(progress1); // 第二个参数 省掉ImVec2(500.0f, 122.0f)


            //ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
            ImGui::Text("Progress Bar progress1=%f", progress1);
          }


             //测试代码块22222
            {
                  //0.0f1.0f
                  static float progress1 = 0.1f;

                  if (progress1 < 1.0f)
                  {
                      progress1 = progress1 + 0.001f;
                  }
                  else
                  {
                      progress1 = 0.1f;
                  }
                  // if (progress1 >= 1.0f) progress1 = 1.0f;
                   // Typically we would use ImVec2(-1.0f,0.0f) or ImVec2(-FLT_MIN,0.0f) to use all available width,
                   // or ImVec2(width,0.0f) for a specified width. ImVec2(0.0f,0.0f) uses ItemWidth.
                  char buf = { 0 }; //ProgressBar的第三个参数overlay 是用来覆盖掉原有的 百分比数字
                  sprintf_s(buf, "<<<<%0.2f%%>>>>>", progress1*100);
                  ImGui::ProgressBar(progress1,ImVec2(-1.0f,0), buf); // 第二个参数 省掉ImVec2(500.0f, 122.0f)


                  //ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
                  ImGui::Text("Progress Bar progress1=%f", progress1);

            }

          };







页: [1]
查看完整版本: 021-imGui窗口中的进度条UI控件Progress Bar