Looking for a simple GUI library that works with Vulkan on SDL2

IchorDev zxinsworld at gmail.com
Thu Feb 20 06:53:26 UTC 2025


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.


More information about the Digitalmars-d-learn mailing list