Inochi2D / i2d-imgui

D binding to c-imgui
Boost Software License 1.0
15 stars 10 forks source link

Glfw example / cannot run using glfw #23

Open HuskyNator opened 1 year ago

HuskyNator commented 1 year ago

I tried modifying the provided example to run with GLFW instead of SDL, this required both locally changing the dependencies and import path of the imgui package. (bindbc-glfw is not a stated dependency & line 6399 of imgui.d imports sdl instead of the required glfw, causing multiple undefined identifier GLFWWindow compile errors).

After managing to get the example to compile & run, my code is now throwing an access violation exception upon calling ImGui_ImplGlfw_InitForOpenGL. I'm not aware why this happens, especially since no glfw example is provided. Note I am aware glfw & opengl are properly initializing (I can render properly after glfw initialization).

The modified app.d used is as follows: app.txt

Again, compiling this required adding the line: "bindbc-glfw": "~>1.0.1" to my locally stored bindbc-imgui's dub.json, and modifying imgui.d to import bindbc.glfw after version(USE_GLFW) flags.

LunaTheFoxgirl commented 1 year ago

Currently we don't support GLFW in the version we compile from source.

playmer commented 1 year ago

I can look at this when I update the Imgui version we use in the coming week or two. I'll have to see if I can easily decide what to build based on features, otherwise Luna will be quite irritated with what I come up with.

playmer commented 1 year ago

Sorry I've been a little busier than I expected. But i think I came up with a plan for this that I discussed with Luna a couple of weeks ago. Assuming it doesn't turn out awful, I should have something for PR by the end of the month. (Taking next week off, so I'll be able to devote the ~day I'll need to get this working.

HuskyNator commented 1 year ago

Im not sure how to ask, this might be a dumb question, But if i were to attempt to look at this myself in a fork, what would i need to do first? Im not entirely familiar how bindings like this work yet.

playmer commented 1 year ago

Sorry for the delay, time is hard to find!

This branch has most of what's needed playmer/UpdateAndCleanup

But there's still some work needed to bring it home. I was working on something to prevent us needing to touch up the imgui sources on different platforms. In theory that's not really immediately needed. I think just the first commit on that branch could be used.

The main thing is I didn't get around to testing it with all the platforms, and I didn't write a GLFW example to test it.

Offhand it probably won't work when linking statically currently (and it would be a bad experience anyway due to not being able to detect features in the sdl file. You'd need to link SDL and GLFW). The dub.sdl would need to be touched up for that. I think it should work dynamically. But like I said, I need a glfw example to finish testing on all the platforms and ensuring we can dynamically link to glfw.