Complex desktop GUI

Hello defolders
So right now Iam going to focus on my dreamy project and I would like to use defold.
The thing is that this “sandbox half game half editor” will be UI heavy. I’ve already worked with Nuklear and Dear ImGUI and both systems were acceptable, clean and very powerful. I’ve found that some attempts were made in past but guessing that was rather test than production ready solution.

Is it possible to use Dear ImGui or Nuklear as GUI in Defold as native extension and make it “production” ready without any potential “unsolvable core” problems?

PS: Everytime I come back to defold Iam having very good time. Glad to see Defold is nicely progressing! Great job :slight_smile:

1 Like

Ping @sven, didn’t you fiddle with an imgui extension at one point?

1 Like

I’ve wanted to do this as well. It would be very useful to be able to use Dear ImGUI in Defold.

6 Likes

Here is example @sven made:

But this example was made with an experimental version of API.
Now API looks a bit different, that means instead of DM_DECLARE_EXTENSION2 we should use regular DM_DECLARE_EXTENSION and register PostRenderImgui function using RegisterCallback function and CALLBACK_POST_RENDER enum

4 Likes

when I compile def-imgui on windows, it happens the error:

/imgui/src/def-imgui.cpp
Line 10: ‘GL/gl.h’ file not found
#include <GL/gl.h>

could someone tell me why, thanks.

The file is named “gl/GL.h” in the SDK, and since we’re building on a case sensitive system (Linux), it cannot find it.

I suggest you make a pull request to that repo, with some fixes (as @AGulev suggested).

2 Likes

I made those changes and it works now. It is so nice to see Dear ImGui in Defold :slight_smile:
Updated:

3 Likes

Thank you for quick reply.

Did it… https://github.com/andsve/def-imgui/pull/1

4 Likes

Looking good, merged! :smiley:

2 Likes

Thank you for hard work. I use your pull and compile it on windows 10, errors still exist:

/imgui/src/def-imgui.cpp
Line 10: In file included from upload/imgui/src/def-imgui.cpp:10:
unknown type name ‘WINGDIAPI’
WINGDIAPI void APIENTRY glAccum (GLenum op, GLfloat value);
^

My editor version is 1.2.169.

This is not the same error. It is related to windows build. I don’t have much time right now but I’m going to try to update the imgui.
I would like to let you know; def-imgui is not a complete imgui binding. It is just a demo. You can’t get callbacks from windows to lua. And you have to create your GUI by using c++. So if you are planning to use it on lua, you have to add bindings.

Also you can try this:

2 Likes

ok, I will try this. thanks.

This error can be fixed by adding:

#if defined(_WIN32) && !defined(WINGDIAPI)
#define WINGDIAPI __declspec(dllimport) // Some Windows OpenGL headers need this
#endif

But there were a other problem. It couldn’t find #include <gl/GL.h> on Windows and Linux. Unfortunately I don’t have time right now to look at it, sorry.