Dear ImGUI for Defold

@britzl is current state of defold sdk enough for adding wrapper to ImGui::Image functions? I have dig docs and code, but cannot find a simple way to do it.

You mean using an image from a loaded texture (atlas or texture set)? I think that’s going to be hard to achieve with the APIs we have available to extensions today.

Loading images and binding new textures will be simpler for sure.

Just wondering what the differences are between this one and:


Is the older one less complete/stable/less platforms?
Im just testing a few gui setups - the one above, Im having a little trouble getting working (very likely me).

The old one by Sven doesn’t have any Lua bindings so you need to write your UI in the extension code. Mine has Lua bindings for a lot of the Dear ImGui components (buttons, checkbox, table, text, text input, tables, nested tree structures, windows etc).

7 Likes

Ahh thanks. Substantial difference :slight_smile:

2 Likes

What about supported platforms? Looks like windows support was added.
It now support all platforms?

Yeah, I think so.

2 Likes

I’ve found it useful to expose ImGuiIO.WantCaptureMouse, and use that value to decide whether to consume input in on_input().
It means we can have window overlays without input being passed through to game content under the windows.
It may not be the right solution for everyone so I haven’t opened a pull request - it’s at https://github.com/DreamRealityInteractive/extension-imgui/commits/want_capture_mouse

5 Likes

Very bad performance in mobile browser. Also when imgui is not visible.

I have imgui(for some debug menu for pc), but do not show that menu in web version. In mobile chrome i have problems with performance.

Removing imgui fixed it.

Could you please open a ticket?

imgui对于中文的支持可能有些问题.
而且新手可能无法解决这方面的问题.

i have a problem im doing this on a mac but i dont know how to make a launch.json file

What is the purpose of a launch.json file?

I’m just checking this and found scrolling doesn’t happen with mouse wheel.

Please report an issue on GitHub.

By the way, have you set up input bindings for the mouse wheel?

I was checking with extension project example itself. Yes i have checked input bindings its there. I will check again if i’m missing something.

I’m getting error with this font_push methods

    imgui.font_push(self.fonts["Regular"])
	imgui.text_colored("Example Text Regular", 1, 1, 1, 1 )
	imgui.font_pop()

Error -

dmengine: upload/imgui/src/imgui/imgui.cpp:6420: void ImGui::SetCurrentFont(ImFont *): Assertion `font && font->IsLoaded()' failed.
INFO:CRASH: Successfully wrote Crashdump to file: /home/vikash/.Defold/_crash
ERROR:CRASH: CALL STACK:

ERROR:CRASH: /home/vikash/Documents/Projects/Defold_Projects/Picnic-Day/build/x86_64-linux/dmengine(+0x301285) [0x55f534ee8285]

This is not happening in example project

script is same as example project even I have checked properly font url

local regular_data, error = sys.load_resource("/Ingame_editor/bundle/fonts/Montserrat-Regular.ttf")
	self.fonts["Regular"] = imgui.font_add_ttf_data(regular_data, #regular_data, fontsize, fontsizebase)
	local bold_data, error = sys.load_resource("/Ingame_editor/bundle/fonts/Montserrat-Bold.ttf")
	self.fonts["Bold"] = imgui.font_add_ttf_data(bold_data, #bold_data, fontsize, fontsizebase)
	local italic_data, error = sys.load_resource("/Ingame_editor/bundle/fonts/Montserrat-Italic.ttf")
	self.fonts["Italic"] = imgui.font_add_ttf_data(italic_data, #italic_data, fontsize, fontsizebase)
	local bolditalic_data, error = sys.load_resource("/Ingame_editor/bundle/fonts/Montserrat-BoldItalic.ttf")
	self.fonts["BoldItalic"] = imgui.font_add_ttf_data(bolditalic_data, #bolditalic_data, fontsize, fontsizebase)

and custom resource path in game.project settings
image

Could you please create a ticket on GitHub and also share an example project?

I’m using imgui with monarch screen manager scene that producing this error and one more issue of having imgui widgets size/padding increases every time while showing/hiding monarch screen.

Here example project -
imgui_test.zip (1.1 MB)

1 Like