Flix01 / imgui

Dear ImGui Addons Branch = plain unmodified dear imgui plus some extra addon.
https://github.com/Flix01/imgui/wiki/ImGui-Addons-Branch-Home
MIT License
396 stars 34 forks source link

Make code build with IMGUI_DISABLE_OBSOLETE_FUNCTIONS #44

Closed tom-seddon closed 6 years ago

tom-seddon commented 6 years ago

ImGui::Begin has different overloads when IMGUI_DISABLE_OBSOLETE_FUNCTIONS is defined. This seemed like an easy fix for imguidock.cpp so I fixed that. I also fixed up imguitoolbar.h, though my code doesn't use that, and I'm working on Windows at the moment, so while it does build as part of my project, it's untested...

Anyway, even if you don't want this specific PR: it would be useful for the addons code to build with IMGUI_DISABLE_OBSOLETE_FUNCTIONS, especially when it looks like it wouldn't be all that much work.

Thanks,

--Tom

Flix01 commented 6 years ago

Yes, good point.

As far as I remember, I've already tried to remove most stuff that was not compatible with IMGUI_DISABLE_OBSOLETE_FUNCTIONS once (I don't remember the precise commit now), but I've left out ImGui::Begin, because it was more difficult to replace (it was not always a simple signature change).

Sooner or later we should replace them all...

Thanks for you PR.

Flix01 commented 6 years ago

These is still an issue with imguitoolbar.h: // Old deprecated version:

const bool dontSkip = inWindowMode || ImGui::Begin(name,NULL,toolbarWindowSize,0,flags);

selection_063 // This PR:

        bool dontSkip;
        if (inWindowMode) {
            dontSkip = true;
        } else {
            ImGui::SetNextWindowSize(toolbarWindowSize, ImGuiCond_FirstUseEver);
            dontSkip = ImGui::Begin(name,NULL,flags);
        }

selection_064

Basically the background is no more transparent.

This is probably related to this issue: https://github.com/ocornut/imgui/issues/1568

I'll see if I can understand how to make the code work exactly the same way... (I knew ImGui::Begin was difficult to port).

Flix01 commented 6 years ago

OK, it seems an easy fix.

Flix01 commented 6 years ago

This works (because the fourth argument of the deprecated Begin was the alpha value):

        if (inWindowMode) {
            dontSkip = true;
        } else {
            ImGui::SetNextWindowSize(toolbarWindowSize, ImGuiCond_FirstUseEver);
            ImGui::SetNextWindowBgAlpha(0.0f);
            dontSkip = ImGui::Begin(name,NULL,flags);
        }

Fixed.

Flix01 commented 6 years ago

Added the same fix to imguidock.cpp (even if I can see no visual changes).