msink / kotlin-libui

Kotlin/Native interop to libui: a portable GUI library
MIT License
651 stars 50 forks source link

Integrate with Jetbrains Compose #40

Open brianguertin opened 3 years ago

brianguertin commented 3 years ago

I noticed in this project's README that you weren't sure about the DSL.

Well, what if we changed the DSL over to Android/Jetbrains Compose? It seems like fun idea because:

I'm just brainstorming, but I'm hoping to have some time to explore this myself, thought the idea was worth sharing.

msink commented 3 years ago

Yes, I do have plans to move in that direction :) When project was created it declared as long-term plan to move in TornadoFX direction, but now - Compose is far more promising, yes.

Maybe as first step - just mimic Compose-UI API as much as possible, on top of libui C API. Later, when compose-runtime and compiler-plugin will support K/N - try to integrate more deeply.

But as always I'm too not sure if I will have time for that, so of course PR's are very welcome :)

brianguertin commented 3 years ago

Yeah, well Jetbrains just announced Kotlin/JS Compose for Web, so they are putting the work in to support multiplatform. I'm hoping to see Jetbrains start an iOS port too, because that would be awesome, and would bring first-class support for Compose on Kotlin/Native. Maybe some day :crossed_fingers:

brianguertin commented 3 years ago

Looks like as of May 28th this is technically possible: https://twitter.com/shikasd_/status/1398445030419877891?s=20

Though, there are no prebuilt artifacts published for native (yet?)

songdehuai commented 2 years ago

Is it possible to use LVLG .https://github.com/lvgl/lvgl

msink commented 2 years ago

LVGL is somewhat similar to compose-ui, yes - both implement all widgets by drawing them on plain canvas (framebuffer). libui uses widgets from native OS API.

Totally different philosophy:

If this project ever will use compose (still possible, but unsure) - it will be low-level compose runtime, and maybe layout framework. But not widgets. Drawing widgets on canvas is out of scope for this project.

e13mort commented 1 year ago

I think Compose is a great way to move.

Dominaezzz commented 1 year ago

Seeing your comment caught my attention and I've started throwing together a POC/MVP. I've managed to start up a window with a single label with compose! I'll quickly port over ktx widgets and make a draft PR in a couple days. It won't be tidy enough to merge as is but at least the bulk of the hard work would be done.

Dominaezzz commented 1 year ago

Made a PR. Take a look and give it a go. Lemme know if you encounter any bugs/crashes.