AllenDang / cimgui-go

Auto generated Go wrapper for Dear ImGui via cimgui
MIT License
298 stars 43 forks source link

Setting imgui.ColModalWindowDimBg appears to have no affect. #243

Closed damntourists closed 4 months ago

damntourists commented 5 months ago

I'm finding that I'm unable to set the color/alpha of the overlay for modal windows. Is this a known issue?

imgui.PushStyleColorVec4(imgui.ColModalWindowDimBg, imgui.Vec4{0.8, 0.8, 0.8, 0.8})
gucio321 commented 5 months ago

could you please put some more code also does it work with C++ Dear ImGui?

damntourists commented 5 months ago

Sure, here's where I was using it:

func AddSceneModal() {
    if AddSceneModalOpened {
        imgui.OpenPopupStr(AddSceneModalTitle)
    }

    flags := imgui.WindowFlagsNoMove |
        imgui.WindowFlagsNoSavedSettings |
        imgui.WindowFlagsAlwaysAutoResize

        // No matter what color I use, it doesn't show up. 
        // Even the default color is not present.  
    imgui.PushStyleColorVec4(imgui.ColModalWindowDimBg,
        imgui.Vec4{0.8, 0.8, 0.8, 0.8})

    var inputName string
    if imgui.BeginPopupModalV(AddSceneModalTitle, nil, imgui.WindowFlags(flags)) {
        imgui.SetKeyboardFocusHere()
        if imgui.InputTextWithHint("##AddSceneNameInput", "Name", &inputName,
            imgui.InputTextFlagsEnterReturnsTrue, nil) {
                        // TODO
            AddSceneModalOpened = false
            imgui.CloseCurrentPopup()
        }

        if imgui.Button("Close") {
            imgui.CloseCurrentPopup()
            AddSceneModalOpened = false
        }
        imgui.EndPopup()
    }

    imgui.PopStyleColor()
}

I have not tried this in C++ since it's not a language I'm too familiar with yet. I'll give it a shot in a bit to see if I can replicate in C++ though.

Wieku commented 4 months ago

It's an issue within imgui itself that you could only set it globally (https://github.com/ocornut/imgui/issues/7340)

It's fixed in 1.90.4

damntourists commented 4 months ago

Awesome, thanks for updating this thread! I'll close it out.