dearimgui / dear_bindings

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

Template files #18

Closed rokups closed 1 year ago

rokups commented 2 years ago

I have a couple unrelated observations regarding template files.

While we have to specify --output parameter, it can not be anything owe want, because template hardcodes includes of generates files. #include "cimgui.h" / #include "cimgui_internal.h" could be replaced by a value derived from --output parameter.

We need to implement a template file for each wrapped header. It would make sense to create a default template file that would be used if a specific template does not exist. This would pave the way for generating implot wrapper.

Both template files define LogTextV. Maybe a default template could implement this function and header-specific templates could consume default template as well?

ShironekoBen commented 2 years ago

Yeah, those are all very good points. I'll see about trying out an implementation of a smarter template system that can hopefully address them. Thanks!

ocornut commented 2 years ago

Both template files define LogTextV.

About that specifically, I removed it with 5513ebcf as there's no point presently for use to support older Dear ImGui versions since this is not released and we made other changes (e.g. moving ImDrawIdx) Of course the issue still generally apply in the case we add more to those files.

ShironekoBen commented 1 year ago

I've extended the header template system a bit - there's now a header for .h files (er, if you see what I mean), and also a separate common header that gets applied to everything. It also does some very simple macro expansion that allows it to substitute in the correct header file name so that the .cpp file doesn't reference the wrong thing if you change the output name.

ShironekoBen commented 1 year ago

I'm going to close this for now since we have a (somewhat) better template system. Feel free to reopen or create a new issue if there's something that the new system doesn't support but should!