Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImPlotPoint getters wrapping #3

Open
sonoro1234 opened this issue Oct 14, 2020 · 6 comments
Open

ImPlotPoint getters wrapping #3

sonoro1234 opened this issue Oct 14, 2020 · 6 comments
Labels
help wanted Extra attention is needed

Comments

@sonoro1234
Copy link
Collaborator

In order to wrap ImPlotPoint *getters returning ImPlotPoint getters https://github.com/cimgui/cimplot/blob/master/generator/cimplot_template.cpp#L9 is done.

Two wrappers are needed for ImPlot_PlotShadedG.

I wonder if there is a simpler way to do it.

@sonoro1234 sonoro1234 added the help wanted Extra attention is needed label Oct 14, 2020
@a1ien
Copy link

a1ien commented Mar 8, 2021

I think return pointer to ImPlotPoint it bad decision. How you plane implement getter_funcX?
Only possible way it's store ImPlotPoint in array and return point to data in this array. If you can do this you totally not need ImPlot_PlotLineG and other function just use ImPlot_PlotLine.
ImPlot_PlotLineG main usage it's crate on fly point. But with this syntax it's impossible.

@a1ien
Copy link

a1ien commented Mar 8, 2021

It's must looks like this.

void *(*getter_funcX)(void* data, int idx, ImPlotPoint *point);
void *(*getter_funcX2)(void* data, int idx, ImPlotPoint *point);

ImPlotPoint Wrapper(void* data, int idx)
{
        ImPlotPoint p;
        getter_funcX(data, idx, &p);
	return p;
}

ImPlotPoint Wrapper2(void* data, int idx)
{
        ImPlotPoint p;
	getter_funcX2(data, idx, &p);
	return p;
}

@sonoro1234
Copy link
Collaborator Author

How you plane implement getter_funcX?

In LuaJIT-ImGui:
https://github.com/sonoro1234/LuaJIT-ImGui/blob/docking_inter/examples/implot_sample.lua#L15

@a1ien
Copy link

a1ien commented Mar 8, 2021

That mean you always allocate dynamic buffer, what gives huge performance impact. And also this api useless for C code. Only for lua.

@sonoro1234
Copy link
Collaborator Author

Working on this

@sonoro1234
Copy link
Collaborator Author

Thanks.
Just pushed changes.

My question was trying to find a way to avoid two wrappers and having only one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants