inkyblackness / imgui-go

Go wrapper library for "Dear ImGui" (https://github.com/ocornut/imgui)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Docking?

FryDay opened this issue · comments

Are there any plans to bring in features from the imgui docking branch?

Hello there and thank you for the question!
In an attempt to keep things simple, this wrapper only considers official releases of Dear ImGui. At the moment, docking is only available in a branch, which is sort of a requests-for-comments work-in-progress.
Wrapping will only be possible when the API is stable and part of an official release.

Disappointing but understandable. Thanks!

My fork has a docking branch which provides this: https://github.com/ptxmac/imgui-go/tree/docking - it doesn't do anything special except add the backend flag and use code from imgui's docking branch.

It can be used as a drop-in replacement using a go mod replace.

Just add this to go.mod:

replace github.com/inkyblackness/imgui-go/v4 => github.com/ptxmac/imgui-go/v4 docking

It can be used as a drop-in replacement using a go mod replace.

Hi @ptxmac - I tried your suggestion on this example: https://github.com/inkyblackness/imgui-go-examples/tree/main/cmd/example_glfw_opengl3
and while the example ran fine, draging a window outside the main window didn't undoc it like it does with the C++ version (running from the "docking" branch). Any ideas what I'm doing wrong?

Here's my go.mod:

module github.com/inkyblackness/imgui-go-examples

require (
	github.com/davecgh/go-spew v1.1.1 // indirect
	github.com/go-gl/glfw v0.0.0-20210727001814-0db043d8d5be
	github.com/inkyblackness/imgui-go/v4 v4.3.0
	github.com/veandco/go-sdl2 v0.4.10
)

go 1.16

replace github.com/inkyblackness/imgui-go/v4 => github.com/ptxmac/imgui-go/v4 v4.0.0-20211212131632-938dc09e65b1

imgui can't create new host windows by itself. In the docking branch this is handled by implementing the create/destroy window callbacks like this: https://github.com/ocornut/imgui/blob/docking/backends/imgui_impl_glfw.cpp#L1098

ImGuiPlatformIO doesn't exist on the main branch of imgui, but it's similar to the existing ImGuiIO.
Adding support for that in imgui-go requires a lot of new code similar to how it's done for IO.

See https://github.com/inkyblackness/imgui-go/blob/main/wrapper/IO.cpp and https://github.com/inkyblackness/imgui-go/blob/main/IO.go for inspiration on how that can be done.

quick note, I just rebased my docking branch on the latest main