Closed tinhajj closed 4 months ago
The only thing I can add is that the go definition for CalcWordWrapPositionA doesn't match the imgui definition in that text_end is missing in the go definition. Not sure if thats relevant.
The reason for this is because text_end
in cimgui_wrapper.cpp is always set to 0
(aka NULL
) by cmd/codegen
.
In my opinion this isn't ok. GO should pass len(text)
or even user-specified value here. and C will set text-end to text+text_len
(it calculates pointer to text end - its C)
Thanks I tried this out, and CalcWordWrapPositionA now works. But the return value isn't as valuable as I had hoped. Since it gives back a string/single character, where I really need an index to the spot where the word wrap has to happen.
This change also changed the function signature of some text functions like TextUnformatted. Basically it required me to give a text_len param which makes it a little more cumbersome to use.
So it seems like we'd need a way to say that just CalcWordWrapPositionA should have a different return type, and also it should automatically pass a 'good' text_end value to cpp code
Well if you think go should automatically pass the right value there i can do that. In case of return type, i think it's a pointer to the spot where text should be wrapped. You can use pointer arithmetics to find it
I think I re-opened it by missclick (I don't see any comment justifying this re-openal). Let me close this and ping me if I'm wrong :smile:
I'm trying to call CalcWordWrapPositionA on my current font, but it seems to always error Basically just doing something along the lines of this in my draw loop
I get this error File: D:/a/cimgui-go/cimgui-go/cimgui/imgui/imgui_draw.cpp, Line: 3515
I'm not too familiar with C and how it interops with Go so this is a little harder for me to debug. Can I get a sanity check from someone else that something is wrong here and I'm not misusing this api?
Incase its useful I am trying to use this function to implement this: https://github.com/ocornut/imgui/issues/2313