floooh / oryol-samples

Oryol extension module samples
MIT License
82 stars 16 forks source link

Update use of a few ImGui methods and constants #16

Closed rdroe closed 4 years ago

rdroe commented 4 years ago

Thanks again for Oryol!

I could be doing something wrong, but following the README.md exactly, I get errors during an osx-xcode-debug fips build. Some build error messages are included at end of this text, but I think I found the solution.

It seems that some imgui breaking changes are breaking some of these samples.

https://github.com/rdroe/oryol-samples/tree/imgui-updates gets past my build errors. I have also done quick manual checks of each previously broken demo, and it seems all right in the branch just mentioned.

If I'm right, the relevant ImGui updates are mentioned in the Api Breaking Changes section around https://github.com/ocornut/imgui/blob/62143dff64c8cfb960248b84cf6c4566ffc5a743/imgui.cpp#L374 (with further references mentioned there).

ImGui::IsMouseHoveringAnyWindow() --> ImGui::IsWindowHovered(ImGuiHoveredFlags_AnyWindow) ImGuiSetCond_Once --> ImGuiCond_Once ImGuiSetCond_FirstUserEver --> ImGuiCond_FirstUseEver

Error text

/Users/robertroe/sites/projects-2/oryol-samples/src/ImGuiDemo/ImGuiDemo.cc:62:51: error: use of undeclared identifier 'ImGuiSetCond_FirstUseEver'; did you
      mean 'ImGuiCond_FirstUseEver'?
        ImGui::SetNextWindowSize(ImVec2(200,100), ImGuiSetCond_FirstUseEver);
                                                  ^~~~~~~~~~~~~~~~~~~~~~~~~
                                                  ImGuiCond_FirstUseEver
In file included from /Users/robertroe/sites/projects-2/oryol-samples/src/ImGuiDemo/ImGuiDemo.cc:9:
In file included from /Users/robertroe/sites/projects-2/oryol-imgui/src/IMUI/IMUI.h:14:
In file included from /Users/robertroe/sites/projects-2/oryol-imgui/src/IMUI/imguiWrapper.h:10:
/Users/robertroe/sites/projects-2/fips-imgui/imgui/imgui.h:1189:5: note: 'ImGuiCond_FirstUseEver' declared here
    ImGuiCond_FirstUseEver  = 1 << 2,   // Set the variable if the object/window has no persistently saved data (no entry in .ini file)
    ^
/Users/robertroe/sites/projects-2/oryol-samples/src/ImGuiDemo/ImGuiDemo.cc:70:50: error: use of undeclared identifier 'ImGuiSetCond_FirstUseEver'; did you
      mean 'ImGuiCond_FirstUseEver'?
        ImGui::SetNextWindowPos(ImVec2(460, 20), ImGuiSetCond_FirstUseEver);
                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~
                                                 ImGuiCond_FirstUseEver

Also

/Users/robertroe/sites/projects/oryol-samples/src/OrbViewer/Main.cc:127:17: error: no member named 'IsMouseHoveringAnyWindow' in namespace 'ImGui'
    if (!ImGui::IsMouseHoveringAnyWindow()) {
         ~~~~~~~^
1 error generated.

** BUILD FAILED **

And one more is like the first, but the constant is named ImGuiSetCond_FirstUseEver, needing to change to ImGuiCond_FirstUseEver (but please double-check the branch with all the tests you know of).

floooh commented 4 years ago

That was a recent change in the ImGui API (I think the new flags have been in for quite a while, but the old flags stayed in for backward compatibility, and those have been removed recently).

Thanks a lot for the PR! I just merged that.