dearimgui / dear_bindings

C header (and language binding metadata) generator for Dear ImGui
MIT License
221 stars 12 forks source link

Example app/lib for using the .json metadata #40

Open ocornut opened 9 months ago

ocornut commented 9 months ago

It feels that one thing which is lacking in this project is an actual example app/framework for using the JSON output and creating a backend out of it.

It'd be interesting an interesting experiment to confirm confirm that cimgui.h could be regenerated exactly the same from the JSON output.

Ideally that example may be a defactor framework to start working from to create other bindings.

In such scenario, for clarity I imagine the folder structure might be reworked, e.g. examples_app/ vs examples_binding_generator/.

ShironekoBen commented 9 months ago

Yeah, I like that idea. I'd been wondering about doing a C# wrapper as an experiment (and because I occasionally find myself wanting one), so that might make a good test-case.

Ldash4 commented 9 months ago

In case it is useful as a reference, here's a bindings generator that I've written for Odin: https://gitlab.com/L-4/odin-imgui It's reasonably fully featured, and supports both docking and master. This project has been extremely useful! In particular you may be interested in gen_odin.py and imgui/imgui.odin. I can say from experience that we're still a bit away from being able to reconstruct cimgui.h char for char, in particular I've had to reimplement comment alignment, which obviously then isn't the same as in the source.

ocornut commented 9 months ago

(FYI added a wiki page https://github.com/dearimgui/dear_bindings/wiki/Software-using-Dear-Bindings to list this and others as we find them + added link in readme)