Skip to content

[ImPlot support] Ability to provide list of types to use in place of templated parameters #78

@Ristovski

Description

@Ristovski

It seems like the biggest problem with supporting ImPlot is the fact that it doesn't provide explicitly typed functions, but rather relies on C++ templated parameters, i.e.:

// The templated functions are explicitly instantiated in implot_items.cpp.
// They are not intended to be used generically with custom types. You will get
// a linker error if you try! All functions support the following scalar types:
//
// float, double, ImS8, ImU8, ImS16, ImU16, ImS32, ImU32, ImS64, ImU64

...

#define IMPLOT_TMP template <typename T> IMPLOT_API
...
IMPLOT_TMP void PlotLine(const char* label_id, const T* values, int count, double xscale=1, double xstart=0, ImPlotLineFlags flags=0, int offset=0, int stride=sizeof(T));

sadly with dear_bindings as of now, this generates C bindings which have the const T* values templated parameter in their signature, which fails to compile.

@ZimM-LostPolygon Since you showed interest to get ImPlot working, do you have a plan on tackling this?

cimplot seems to do this by generating a function binding for each explicit type:

https://github.com/cimgui/cimplot/blob/439f705b1cfae0e9fbe42c13ab5b45becc47d404/generator/generator.lua#L188

and frankly this seems like the easiest solution. Perhaps this can be implemented under modifiers akin to mod_flatten_templates? Ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions