tjammer / raylib-ocaml

OCaml bindings for raylib and raygui
https://tjammer.github.io/raylib-ocaml/
MIT License
173 stars 14 forks source link

bindings to raygui? #10

Closed c-cube closed 3 months ago

c-cube commented 3 years ago

are there plans to support raygui? It'd be useful to get a quick GUI running in OCaml…

tjammer commented 3 years ago

There are now :D

I have never used it myself but it does seem nice. I'll look into it

c-cube commented 3 years ago

Awesome. So far I'm impressed by how clean the bindings are :grin:

tjammer commented 3 years ago

clickme Some first things are working! Now to implement an example and see what's missing

tjammer commented 3 years ago

I've added the raygui bindings as an extra package 'raygui', see https://tjammer.github.io/raylib-ocaml/raygui/Raygui/index.html https://github.com/tjammer/raylib-ocaml/blob/master/src/raygui/raygui.mli

I've also ported one example which covers most of the functions https://github.com/tjammer/raylib-ocaml/blob/master/examples/gui/controls_test_suite.ml

clickme

c-cube commented 3 years ago

That looks simply amazing. I'll give it a try when I'm off work. Thank you!!

edit: tried the demo, it works directly. Very nice.

tjammer commented 3 years ago

I'm not sure how to continue with these bindings. They certainly work ok for the time spent, but raygui feels limited compared to https://github.com/ocornut/imgui for instance. This is mainly due to the lack of windows or nesting. And keeping track of all this by hand is tedious.

I thought about dropping raygui bindings and try to bind dear imgui instead when I saw that you (@c-cube ) have started on imgui bindings already. It should be possible to use raylib as a backend as well, see https://github.com/oswjk/imgui-impl-raylib https://github.com/WEREMSOFT/c99-raylib-cimgui-template. What is the state of your imgui bindings right now?

c-cube commented 3 years ago

They're not very usable, sorry. The imgui API is big, my code generation is complicated because I tried to generate ctypes with the multiple layers of code generation (to avoid dynamic linking). You can give it a try, but look at the dune files and tell me if you feel like that's maintainable :-).

I'm not sure where to go with that either. Imgui has a lot of pass-by-reference functions (with small structures or int[2] pairs, this kind of stuff). That's not very idiomatic in OCaml.

danielo515 commented 3 years ago

imgui looks super impressive. I am looking for a GUI lib for ocaml, so I am subscribing to this thread 😄