ocornut / imgui

Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies
MIT License
58.2k stars 9.97k forks source link

question: why the widget rendered later isn't on the "top layer"? #7265

Closed gucio321 closed 5 months ago

gucio321 commented 5 months ago

Version/Branch of Dear ImGui:

master (54ef4092a92f777ee6c855b08875e37a4e282b45)

Back-ends:

imgui_impl_sdl2.cpp + imgui_impl_opengl3.cpp

Compiler, OS:

gcc/Fedora linux fc39

Full config/build information:

No response

Details:

My Issue/Question:

Hi!

I'm working on a simple animation system using giu (this project is a wrapper of imgui wrapper :smile:) so my issue origins here.

I want to resize widget. To do so I change its size (its obvious ;-) ) but also I need to move it up to make the animation look well.

(See my code example)

I have noticed a strange behavior. The second button (this one which I'm going to move up) does not overlap the previous widget (which is child with its content)

I'll put screenshot here when I fix screenshots on my laptop xd

My question is: Is this behaviour expected and if so is there a way to make my widget always render on the "top layer"?

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:


                ImGui::PushStyleColor(ImGuiCol_Border, ImVec4{255,0,0,255});
                ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 10);;

                if (ImGui::BeginChild("This guy", ImVec2{220,220})) {
                        ImGui::Button("I'm a button", ImVec2{200,200});
                        ImGui::EndChild();
                }

                auto currentPos = ImGui::GetCursorPos();
                currentPos.y -= 80;
                currentPos.x += 20;
                ImGui::SetCursorPos(currentPos);
                ImGui::Button("I'm another button", ImVec2{200,200});

                ImGui::PopStyleColor();
                ImGui::PopStyleVar();
ocornut commented 5 months ago

Hello, For various technical reasons, the content of child windows BeginChild() are always rendered over the parent window.

gucio321 commented 5 months ago

Can I bypass this somehow?

ocornut commented 5 months ago

No.

gucio321 commented 5 months ago

ok, thank you for your answers!