Git Product home page Git Product logo

Comments (16)

TTSKarlsson avatar TTSKarlsson commented on May 29, 2024 1

I'm new with imgui too and am only helping with keeping the stable branch updated, but I felt I could possibly help because I know some things about libGDX.

I tried it out now and I see, it creates its own window instead of integrating into an existing gl/glfw context. I'll see the coming week if I can fork this and create a integrating GlfwWindow if @elect86 hasn't already done something similar by then.

Lwjgl3 uses glfw, so it should work fine in GDX too, but there is more to it than just a a window handle as GlfwWindow also takes it upon itself to manage the glfw lifetime, which it can't be allowed to do if we want it to be possible to integrate it into an existing context.

if you want to try something yourself in the mean, you can get the Lwjgl3Window with

(Gdx.graphics as Lwjgl3Graphics).window

It has a private field Long windowHandle (that you can reach by reflection) that holds the glfw window handle.

from imgui.

elect86 avatar elect86 commented on May 29, 2024 1

Quick info, I'm trying to substitute the all the queries to the windowHandle: Long with others to Gdx.graphics.. I'll see and let you know where I will end up

from imgui.

elect86 avatar elect86 commented on May 29, 2024 1

Ok, it should work now

I tried first to make it work by substituting completely the uno GlfwWindow with single manual calls to Gdx.graphics

Then it was too messy/shitty, I reverted and tried to obtain that damned windowHandle because I had one hope, to init GlfwWindow by that.. because if that worked, than the code impact would have been very minimal (and also the changes to write :D)

It helped a lot @TTSKarlsson tips (also his stackoverflow question)

One last obstacles was that I couldn't retrieve a private field or a package-only method, google helped and I just had to make it accessible before retrieving

I modified then GlfwWindow accordingly to offer a constructor starting from the pure handler..

Another one last obstacles, I discovered I couldn't load the imgui shaders with the simple getSystemResource, I needed the bloody asStream

Packed all the shits together, thanks god worked.. (coz also I didnt have more time)

@Catvert, would be nice if you could spend some time expanding the readme and writing about it, in order to help people seeking the same

from imgui.

TTSKarlsson avatar TTSKarlsson commented on May 29, 2024 1

Nice to see it came to a solution, and clever constructor work there @elect86 ! =)

from imgui.

elect86 avatar elect86 commented on May 29, 2024

Hi Catvert,

are you working on an open source project I may clone and check that out?

from imgui.

Catvert avatar Catvert commented on May 29, 2024

Yes, you can try it with: https://github.com/Catvert/Platform-Creator. Normally, it should have no problem configuring the project.

from imgui.

elect86 avatar elect86 commented on May 29, 2024

Ok, cloned and synced. Can you introduce me a little about structure or point me toward one main class to run?

from imgui.

Catvert avatar Catvert commented on May 29, 2024

Yes of course, after importing it as a gradle project, you should have 4 modules (Platform-Creator, core, desktop and lwjgl3). There are 2 main class, for both backends(lwgl2 -> DesktopLauncher, lwgl3 -> Lwgl3Launcher). The game class is in the core module, PCGame. Thanks you for your help ! :)

from imgui.

Catvert avatar Catvert commented on May 29, 2024

If you're using Intellij Idea, you can open the gradle tool window in View -> Tool Window -> Gradle. With this window, so you can refresh the project to make sure that gradle has downloaded all dependencies.
To create the run configuration, create a new Application configuration then select for the main class DesktopLauncher or Lwgl3Launcher. And for the module, desktop_main or lwjgl3_main.

from imgui.

Catvert avatar Catvert commented on May 29, 2024

Hi, sorry to ask this, but I would like to know if you are working on a wrapper for libGDX? I can help if you want to, I think it might be a good idea given the number of libGDX users. Thank you very much.

from imgui.

TTSKarlsson avatar TTSKarlsson commented on May 29, 2024

@Catvert , What is your error when you use the Lwjgl3Launcher with imgui?

I had to add the same run configuration as in your desktop project

run {
    setWorkingDir(workingDir.absolutePath + "/../")
    ignoreExitValue = true
}

or it wouldn't find the assets. But after that it runs the app under Lwjgl3 just fine.

When you add imgui you'll also need to add maven { url "https://dl.bintray.com/kotlin/kotlin-dev" } to your buildscript repositories because imgui's dependencies still bundles kotlin future runtimes and compiles against the experimental/alpha/beta branch of kotlin. You'll get some warnings as kotlin is explicitly not future compatible.

There is a kotlin-stable branch of imgui, but the other jitpack dependencies has not gotten similar treatment just yet, an open issue about this is pending.

I hope this helps, and please tell us if you get it working or if not. If you don't, and still want to, please create and push a branch to your repo with your attempted code of imgui and I will try to take a look at it as I'm used to the libGDX structure.

from imgui.

Catvert avatar Catvert commented on May 29, 2024

Hi @TTSKarlsson, I have no problem adding Imgui to my project but I can't configure Imgui from imgui.impl.LwjglGL3 because it seems to me that this implementation uses uno-sdk. It is therefore impossible for me to "pass" the libGDX window to the LwjglGL3 init method (which requires a GlfwWindow). Do I need to recreate a new implementation for libGDX based on this one?

from imgui.

elect86 avatar elect86 commented on May 29, 2024

Small update: I pulled libgdx to make Lwjgl3Window.getWindowHandle() as public and avoiding in this way to use reflection to retrieve it.

It's been right now merged by tom, we should change that as soon as the next release comes out.

The first one who remembers that (maybe you can keep an eye on that, @Catvert?) can do that :)

from imgui.

Catvert avatar Catvert commented on May 29, 2024

Wow, your solution works perfectly! Thank you very much, I will explain in the readme how to set up imgui with libGDX :) (I don't speak English very well but I will try to do my best).

from imgui.

Catvert avatar Catvert commented on May 29, 2024

@elect86 Can I create a page in the wiki to explain how to configure imgui with libGDX? I think it might be clearer.

from imgui.

elect86 avatar elect86 commented on May 29, 2024

You are welcome, Catvert :)

Sure, what you think works best. I'm not an english native as well but I might take a look at that if you want, when you are done

from imgui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.