Remix.run Logo
flohofwoe 5 hours ago

> ImGui has C++ API as first-class citizen

Dear ImGui via the C bindings is actually quite nice and not much less convenient than the C++ API (the only notable difference is that the C API has no overloads and default params).

E.g. here's a control panel UI (from the below ozz-animation sample) with the 'Dear Bindings' approach (using a custom 'ig' prefix)):

https://github.com/floooh/sokol-samples/blob/d8429d701eb7a8c...

Dear ImGui is a bit of an outlier for C++ libraries though, since it is essentially a C API wrapped in a namespace.

OzzAnimation is also fairly trivial to wrap in an (abstracted) C API, for instance I use this in some of the sokol-samples:

https://github.com/floooh/sokol-samples/blob/master/libs/ozz...

Implementation: https://github.com/floooh/sokol-samples/blob/master/libs/ozz...

...used in this sample:

https://github.com/floooh/sokol-samples/blob/master/sapp/shd...

...WASM live version:

https://floooh.github.io/sokol-html5/shdfeatures-sapp.html

TL;DR: quite a few C++ libraries out of the game-dev world are actually quite easy to access from C or languages that can talk to C APIs, mainly because the game-dev world typically uses a very 'orthodox' subset of C++ (no or very restricted C++ stdlib usage, no rtti, no exceptions, ideally no smart pointers in the public API).