imgui
imgui copied to clipboard
LibGdx and ImGui setup
Im trying to get LibGdx setup with ImGui. Currently what im trying to achieve is to use the same window LibGdx creates to render ImGui.
public class MyGdxGame extends ApplicationAdapter {
private ImplGlfw lwjglGlfw;
private ImplGL3 implgl3;
private ImGui imgui = ImGui.INSTANCE;
private Context ctx;
private GlfwWindow window;
long windowHandle;
@Override
public void create () {
//context setup
GL.createCapabilities();
ctx=new Context();
//take windowHandle of libgdx window
windowHandle =((Lwjgl3Graphics) Gdx.graphics).getWindow().getWindowHandle();
window=GlfwWindow.from(windowHandle);
lwjglGlfw=new ImplGlfw(window,true,null);
window.makeContextCurrent();
implgl3=new ImplGL3();
}
However i get an exception thrown on the ImplGlfw constructor.
Exception in thread "main" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.NoSuchMethodError: 'long uno.glfw.GlfwWindow.getHandle()'
at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lwjgl3Application.java:120)
at com.mygdx.game.desktop.DesktopLauncher.main(DesktopLauncher.java:10)
Caused by: java.lang.NoSuchMethodError: 'long uno.glfw.GlfwWindow.getHandle()'
at imgui.impl.glfw.ImplGlfw.<init>(ImplGlfw.kt:77)
at com.mygdx.game.MyGdxGame.create(MyGdxGame.java:62)
at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Window.initializeListener(Lwjgl3Window.java:433)
at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Window.update(Lwjgl3Window.java:381)
at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.loop(Lwjgl3Application.java:138)
at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lwjgl3Application.java:114)
... 1 more
Im currently using uno-sdk 0.7.9, LibGdx 1.9.11 and imgui 1.76
Hi,
this shall suggest the uno
dependency mismatches
is the project public?
I just created a repository, here. You can see that unosdk is locally in there, because for this test i grabbed the latest uno-core-all.jar .
Hello, I created a repository which should solve your issue libgdx_imgui_template_November2020
Hello, I created a repository which should solve your issue libgdx_imgui_template_November2020
i managed to get the correct dependencies for imgui and uno but now kotlin comes in. I admit that i've never used Kotlin and i wanted to add imgui to my java project but it seems i am missing something with kotlin now. At runtime i get this:
Exception in thread "main" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.NoClassDefFoundError: unsigned/ByteKt
at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lwjgl3Application.java:120)
at com.mygdx.game.desktop.DesktopLauncher.main(DesktopLauncher.java:10)
Caused by: java.lang.NoClassDefFoundError: unsigned/ByteKt
at imgui.internal.Generic_helpersKt.hash(generic helpers.kt:148)
at imgui.internal.Generic_helpersKt.hash$default(generic helpers.kt:117)
at imgui.classes.Context.initialize(Context.kt:593)
at imgui.classes.Context.<init>(Context.kt:584)
at imgui.classes.Context.<init>(Context.kt:26)
at imgui.classes.Context.<init>(Context.kt)
at com.mygdx.game.MyGdxGame.create(MyGdxGame.java:30)
at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Window.initializeListener(Lwjgl3Window.java:433)
at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Window.update(Lwjgl3Window.java:381)
at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.loop(Lwjgl3Application.java:138)
at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lwjgl3Application.java:114)
... 1 more
Caused by: java.lang.ClassNotFoundException: unsigned.ByteKt
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 12 more
i updated my example repository here to show you the gradle build file.