On Thursday, 20 February 2025 at 06:53:26 UTC, IchorDev wrote:
On Wednesday, 19 February 2025 at 15:21:19 UTC, Danny Arends
wrote:
I've tried several different bindings to IMgui, however, none
seem to work and seem abandoned to me (the most recent updated
one 'bindbc-imgui' was updated 3 years ago).
Actually, I have been working on an update to BindBC-ImGui for
a long time. It now directly interfaces with ImGui's C++ API.
It's 99% finished, I just have a few bug bears to sort out
before I release it.
You can clone the most recent version [from
here](https://github.com/ichordev/bindbc-imgui) and use `dub
add-local ./bindbc-imgui 1.0.0` on it so that dub knows where
it is. Then in your dub recipe, add `bindbc-imgui` version
`~>1.0` to `dependencies`, set its sub-configuration to
`static-SDL2-Vulkan`, and add `imgui` to your `libs`.
You will have to build Dear ImGui as a library, including any
backends you want. Here's an example with the SDL2 backend &
clang:
```sh
mkdir build
cd build
clang++ -c -g -fPIC -std=c++11 -I../ -I/path/to/SDL2
-I/usr/local/include/ ../imgui*.cpp \
../backends/imgui_impl_sdl2.cpp
clang++ -fPIC -std=c++11 -shared -o libimgui.so imgui.o
imgui_demo.o imgui_draw.o imgui_tables.o imgui_widgets.o
imgui_impl_sdl2.o -lSDL2
```
I've had weird linker issues when building Dear ImGui as a
static library, so I recommend trying to build it as a shared
library to start off with.
But this got me wondering, what is the state of the art GUI
library in D, when I am using modern OpenGL or Vulkan?
Does anyone have any tips or tricks on how to achieve a basic
GUI ? (without writing yet another GUI library binding from
scratch)
There isn't one, unfortunately. I've done some work on an API
for one, but hit a few snags, so it's not the top of my
priorities right now.
[Fluid](https://code.dlang.org/packages/fluid) looks like a
pretty good option if you want a native D library, but you
would have to write an SDL/Vulkan backend for it, since it only
comes with a Raylib 5 backend. It's more of a serious GUI
library than Dear ImGui though.
Thanks,
Running into some weird linker issues within
bindbc.common.codegen:
```
/usr/bin/ld:
/home/danny/.dub/cache/betterct/~master/build/betterC-debug-gZx8lRyN8EaQ6hq_UuhHCw/betterct.o:(.data._D39TypeInfo_S6bindbc6common7codegen6FnBind6__initZ+0x30): undefined reference to `_D6bindbc6common7codegen6FnBind9__xtoHashFNbNeKxSQBvQBrQBnQBiZm'
/usr/bin/ld:
/home/danny/.dub/cache/betterct/~master/build/betterC-debug-gZx8lRyN8EaQ6hq_UuhHCw/betterct.o:(.data._D39TypeInfo_S6bindbc6common7codegen6FnBind6__initZ+0x38): undefined reference to `_D6bindbc6common7codegen6FnBind11__xopEqualsMxFKxSQBwQBsQBoQBjZb'
```
while the individual components seem to build without issue:
```
Building bindbc-common 1.0.5: building configuration [yesBC]
Building bindbc-loader 1.1.5: building configuration [yesBC]
Building bindbc-imgui ~master: building configuration
[dynamic]
Building bindbc-sdl 1.5.2: building configuration [dynamicBC]
```