# Complex desktop GUI

**URL:** <https://forum.defold.com/t/complex-desktop-gui/65371>\
**Category:** Questions\
**Created:** [May 28, 2020, 7:40pm UTC](https://forum.defold.com/t/complex-desktop-gui/65371 "2020-05-28T19:40:54Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vessyk](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/vessyk/32/19661_2.png) [@Vessyk](https://forum.defold.com/u/Vessyk)\
**Post date:** [May 28, 2020, 7:40pm UTC](https://forum.defold.com/t/complex-desktop-gui/65371/1 "2020-05-28T19:40:54Z")

</div>

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](https://github.com/Immediate-Mode-UI/Nuklear) and [Dear ImGUI](https://github.com/ocornut/imgui) and both systems were acceptable, clean and very powerful. I’ve found that [some attempts](https://forum.defold.com/t/what-is-defolds-focus-moving-forward/63116/4) 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 🙂

---

<div class="post-metadata">

**Author:** ![jhonny.goransson](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/jhonny.goransson/32/3864_2.png) [@jhonny.goransson](https://forum.defold.com/u/jhonny.goransson)\
**Post date:** [May 28, 2020, 7:49pm UTC](https://forum.defold.com/t/complex-desktop-gui/65371/2 "2020-05-28T19:49:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [May 28, 2020, 8:08pm UTC](https://forum.defold.com/t/complex-desktop-gui/65371/3 "2020-05-28T20:08:10Z")

</div>

> [@jhonny.goransson](#):
>
> fiddle with an imgui extension

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

---

<div class="post-metadata">

**Author:** ![AGulev](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/agulev/32/4541_2.png) [@AGulev](https://forum.defold.com/u/AGulev)\
**Post date:** [May 31, 2020, 8:18am UTC](https://forum.defold.com/t/complex-desktop-gui/65371/4 "2020-05-31T08:18:31Z")

</div>

Here is example @sven made:  
[https://github.com/andsve/def-imgui](https://github.com/andsve/def-imgui)

But this example was made with an experimental version of API.  
Now API looks a bit different, that means instead of [DM\_DECLARE\_EXTENSION2](https://github.com/andsve/def-imgui/blob/bd928b4b11a07714a1fe08437f40d89bdbd62a00/imgui/src/def-imgui.cpp#L145) we should use regular [DM\_DECLARE\_EXTENSION](https://defold.com/ref/stable/dmExtension/?q=DM_DECLARE_EXTENSION#DM_DECLARE_EXTENSION) and register PostRenderImgui function using [RegisterCallback function](https://defold.com/ref/stable/dmExtension/?q=DM_DECLARE_EXTENSION#RegisterCallback:callback_type-func) and [CALLBACK\_POST\_RENDER](https://defold.com/ref/stable/dmExtension/?q=DM_DECLARE_EXTENSION#dmExtension::CallbackType) enum

---

<div class="post-metadata">

**Author:** ![37542939](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/37542939/32/18930_2.png) [@37542939](https://forum.defold.com/u/37542939)\
**Post date:** [June 10, 2020, 3:30am UTC](https://forum.defold.com/t/complex-desktop-gui/65371/5 "2020-06-10T03:30:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [June 10, 2020, 6:27am UTC](https://forum.defold.com/t/complex-desktop-gui/65371/6 "2020-06-10T06:27:23Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![selimanac](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/selimanac/32/6397_2.png) [@selimanac](https://forum.defold.com/u/selimanac)\
**Post date:** [June 10, 2020, 8:45am UTC](https://forum.defold.com/t/complex-desktop-gui/65371/7 "2020-06-10T08:45:44Z")

</div>

> [@AGulev](#):
>
> But this example was made with an experimental version of API.  
> Now API looks a bit different, that means instead of [DM\_DECLARE\_EXTENSION2](https://github.com/andsve/def-imgui/blob/bd928b4b11a07714a1fe08437f40d89bdbd62a00/imgui/src/def-imgui.cpp#L145) we should use regular [DM\_DECLARE\_EXTENSION](https://defold.com/ref/stable/dmExtension/?q=DM_DECLARE_EXTENSION#DM_DECLARE_EXTENSION) and register PostRenderImgui function using [RegisterCallback function](https://defold.com/ref/stable/dmExtension/?q=DM_DECLARE_EXTENSION#RegisterCallback:callback_type-func) and [CALLBACK\_POST\_RENDER](https://defold.com/ref/stable/dmExtension/?q=DM_DECLARE_EXTENSION#dmExtension::CallbackType) enum

I made those changes and it works now. It is so nice to see Dear ImGui in Defold 🙂  
Updated:  
[https://github.com/andsve/def-imgui](https://github.com/andsve/def-imgui)

 ![47](https://forum-defold-uploads.b-cdn.net/original/3X/9/5/95684a901cccbc6799b8be84c6483f9cfb953a26.png)

---

<div class="post-metadata">

**Author:** ![37542939](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/37542939/32/18930_2.png) [@37542939](https://forum.defold.com/u/37542939)\
**Post date:** [June 10, 2020, 8:48am UTC](https://forum.defold.com/t/complex-desktop-gui/65371/8 "2020-06-10T08:48:30Z")

</div>

Thank you for quick reply.

---

<div class="post-metadata">

**Author:** ![selimanac](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/selimanac/32/6397_2.png) [@selimanac](https://forum.defold.com/u/selimanac)\
**Post date:** [June 10, 2020, 8:52am UTC](https://forum.defold.com/t/complex-desktop-gui/65371/9 "2020-06-10T08:52:57Z")

</div>

> [@Mathias\_Westerdahl](#):
>
> I suggest you make a pull request to that repo, with some fixes (as @AGulev suggested).

Did it… [RegisterCallback for PostRenderImgui by selimanac · Pull Request #1 · andsve/def-imgui · GitHub](https://github.com/andsve/def-imgui/pull/1)

---

<div class="post-metadata">

**Author:** ![sven](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/sven/32/1086_2.png) [@sven](https://forum.defold.com/u/sven)\
**Post date:** [June 10, 2020, 9:31am UTC](https://forum.defold.com/t/complex-desktop-gui/65371/10 "2020-06-10T09:31:40Z")

</div>

Looking good, merged! 😃

---

<div class="post-metadata">

**Author:** ![37542939](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/37542939/32/18930_2.png) [@37542939](https://forum.defold.com/u/37542939)\
**Post date:** [June 10, 2020, 9:34am UTC](https://forum.defold.com/t/complex-desktop-gui/65371/11 "2020-06-10T09:34:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![selimanac](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/selimanac/32/6397_2.png) [@selimanac](https://forum.defold.com/u/selimanac)\
**Post date:** [June 10, 2020, 10:05am UTC](https://forum.defold.com/t/complex-desktop-gui/65371/12 "2020-06-10T10:05:07Z")

</div>

> [@37542939](#):
>
> 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);

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:

> **[WINGDIAPI not defined](https://community.khronos.org/t/wingdiapi-not-defined/17645)**
>
> I’m trying to run a simple openGL program, but I’m getting the following error as a result of the line #include The error is: Error E2141 c:\\Borland\\Bcc55\\include\\gl\\gl.h 1153: Declaration syntax error Error E2238...

---

<div class="post-metadata">

**Author:** ![37542939](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/37542939/32/18930_2.png) [@37542939](https://forum.defold.com/u/37542939)\
**Post date:** [June 11, 2020, 7:53am UTC](https://forum.defold.com/t/complex-desktop-gui/65371/13 "2020-06-11T07:53:47Z")

</div>

ok, I will try this. thanks.

---

<div class="post-metadata">

**Author:** ![selimanac](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/selimanac/32/6397_2.png) [@selimanac](https://forum.defold.com/u/selimanac)\
**Post date:** [June 11, 2020, 8:05am UTC](https://forum.defold.com/t/complex-desktop-gui/65371/14 "2020-06-11T08:05:01Z")

</div>

> [@37542939](#):
>
> /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);

This error can be fixed by adding:

```c++
#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.
