郁金香灬老师 游戏安全  驱动 逆向调试 C/C++编程  脚本 UE4/UE5

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
热搜: 活动 交友 discuz
课程大纲和价格
官方联系方式2024在线课大纲QQ咨询
查看: 3857|回复: 0

018-imGui窗口中设置UI控件界面颜色样式

[复制链接]

132

主题

29

回帖

34万

积分

管理员

积分
343636
QQ
发表于 2023-4-7 21:33:51 | 显示全部楼层 |阅读模式





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

学习目标:
设置IMGUI界面颜色样式
PushStyleColor
PopStyleColor
ImColor
ImColor::HSV
   
   
   typedef unsigned int        ImU32;  // R G B
   // 32-bit unsigned integer (often used to store packed colors)
   IMGUI_API void          PushStyleColor(ImGuiCol idx, ImU32 col);
           // modify a style color. always use this if you modify the style after NewFrame().
    IMGUI_API void          PushStyleColor(ImGuiCol idx, const ImVec4& col);
       
        //H R G B
        struct ImVec4
{
    float                                                     x, y, z, w;
    constexpr ImVec4()                                        : x(0.0f), y(0.0f), z(0.0f), w(0.0f) { }
    constexpr ImVec4(float _x, float _y, float _z, float _w)  : x(_x), y(_y), z(_z), w(_w) { }
#ifdef IM_VEC4_CLASS_EXTRA
    IM_VEC4_CLASS_EXTRA     // Define additional constructors and implicit cast operators in imconfig.h to convert back and forth between your math types and ImVec4.
#endif
};


   
         // Color buttons, demonstrate using PushID() to add unique identifier in the ID stack, and changing style.
  
        for (int i = 0; i < 8; i++)
        {
            if (i > 0)  ImGui::SameLine();
               
            ImGui::PushID(i);
            ImGui::PushStyleColor(ImGuiCol_Button, (ImVec4)ImColor::HSV(i / 7.0f, 0.6f, 0.6f));
            ImGui::PushStyleColor(ImGuiCol_ButtonHovered, (ImVec4)ImColor::HSV(i / 7.0f, 0.7f, 0.7f));
            ImGui::PushStyleColor(ImGuiCol_ButtonActive, (ImVec4)ImColor::HSV(i / 7.0f, 0.8f, 0.8f));
            static int index = 0;
            if (ImGui::Button("xxxxx"))
            {
                index = i;
                //函数处理case(i)
            }
            ImGui::SameLine();
            ImGui::Text("Button index=%d", index);

            ImGui::PopStyleColor(3);
            ImGui::PopID();
            //H透明度
            //HBGR
            ImGui::PushStyleColor(ImGuiCol_Text, 0xFF0000FF);// (ImVec4)ImColor::HSV(i / 7.0f, 0.6f, 0.6f));
           // ImGui::PushStyleColor(ImGuiCol_ButtonHovered, (ImVec4)ImColor::HSV(i / 7.0f, 0.7f, 0.7f));
            //ImGui::PushStyleColor(ImGuiCol_ButtonActive, (ImVec4)ImColor::HSV(i / 7.0f, 0.8f, 0.8f));
            ImGui::SameLine();
            ImGui::Text("test");
            ImGui::PopStyleColor(1);


           // ImGui::PushID(i);
            ImGui::PushStyleColor(ImGuiCol_Button, (ImVec4)ImColor::HSV(i / 7.0f, 0.6f, 0.6f));
            ImGui::PushStyleColor(ImGuiCol_ButtonHovered, (ImVec4)ImColor::HSV(i / 7.0f, 0.7f, 0.7f));
            ImGui::PushStyleColor(ImGuiCol_ButtonActive, (ImVec4)ImColor::HSV(i / 7.0f, 0.8f, 0.8f));
            static int index2 = 0;
            ImGui::SameLine();
            if (ImGui::Button("3xxxxx##"))
            {
                index2 = index2 +1;
            }
            ImGui::Text("Button index2=%d", index2);
          //ImGui::PopID();
            ImGui::PopStyleColor(3);

        }






游戏安全课程 学员办理咨询联系QQ150330575 手机 139 9636 2600  免费课程 在 www.bilibili.com 搜 郁金香灬老师
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ咨询

QQ|Archiver|手机版|小黑屋|郁金香游戏技术

GMT+8, 2024-5-18 16:21 , Processed in 0.088644 second(s), 22 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表