mimgui

KyRDa

Активный
Автор темы
105
66
Версия MoonLoader
.026-beta
Как при наведении на вариант Combo выполнять блок?
1693666668832.png
 
Решение
только самостоятельно делать функцию ImGui.Combo
код вырезан, адаптируй его сам
Lua:
---@diagnostic disable-next-line: duplicate-set-field
   function ImGui.Combo(label, v, array)
      local retval = false
      local style = ImGui.GetStyle()

      ImGui.PushStyleColor(ImGui.Col.Header, style.Colors[ImGui.Col.Button])
      ImGui.PushStyleColor(ImGui.Col.HeaderHovered, style.Colors[ImGui.Col.ButtonHovered])
      ImGui.PushStyleColor(ImGui.Col.HeaderActive, style.Colors[ImGui.Col.ButtonActive])
      if ImGui.BeginCombo(label, array[v[0]]) then
         for value, text in pairs(array) do
            if ImGui.Selectable(text, v[0] == value) then
               v[0] = value
               retval = true
            end...

RedHolms

Известный
Проверенный
622
369
только самостоятельно делать функцию ImGui.Combo
код вырезан, адаптируй его сам
Lua:
---@diagnostic disable-next-line: duplicate-set-field
   function ImGui.Combo(label, v, array)
      local retval = false
      local style = ImGui.GetStyle()

      ImGui.PushStyleColor(ImGui.Col.Header, style.Colors[ImGui.Col.Button])
      ImGui.PushStyleColor(ImGui.Col.HeaderHovered, style.Colors[ImGui.Col.ButtonHovered])
      ImGui.PushStyleColor(ImGui.Col.HeaderActive, style.Colors[ImGui.Col.ButtonActive])
      if ImGui.BeginCombo(label, array[v[0]]) then
         for value, text in pairs(array) do
            if ImGui.Selectable(text, v[0] == value) then
               v[0] = value
               retval = true
            end
            
            if ImGui.IsItemHovered() then
                -- ТУТ КОД ПРИ НАВЕДЕНИИ
            end
         end
         ImGui.EndCombo()
      end
      ImGui.PopStyleColor(3)

      if retval then
         ImGuiDataMap:saveValue(v)
      end

      return retval
   end
 
  • Нравится
Реакции: the same, KyRDa и qdIbp

KyRDa

Активный
Автор темы
105
66
только самостоятельно делать функцию ImGui.Combo
код вырезан, адаптируй его сам
Lua:
---@diagnostic disable-next-line: duplicate-set-field
   function ImGui.Combo(label, v, array)
      local retval = false
      local style = ImGui.GetStyle()

      ImGui.PushStyleColor(ImGui.Col.Header, style.Colors[ImGui.Col.Button])
      ImGui.PushStyleColor(ImGui.Col.HeaderHovered, style.Colors[ImGui.Col.ButtonHovered])
      ImGui.PushStyleColor(ImGui.Col.HeaderActive, style.Colors[ImGui.Col.ButtonActive])
      if ImGui.BeginCombo(label, array[v[0]]) then
         for value, text in pairs(array) do
            if ImGui.Selectable(text, v[0] == value) then
               v[0] = value
               retval = true
            end
           
            if ImGui.IsItemHovered() then
                -- ТУТ КОД ПРИ НАВЕДЕНИИ
            end
         end
         ImGui.EndCombo()
      end
      ImGui.PopStyleColor(3)

      if retval then
         ImGuiDataMap:saveValue(v)
      end

      return retval
   end
imguiDataMap?