Dominaezzz/kotlin-imgui

Compute size of text in advance.

Kesanov opened this issue · 7 comments

I could not find a way to compute the size of a text in advance, without rendering it on screen.

As far as I know, ImGui has a CalcTextSize function that facilitates this functionality.

Did you not find ImGui.calcTextSize()?

Nope. Quick search returns nothing.

It's a generated file, so it's not in the repo. You'll have to rely on auto compete, but it does indeed exist.

Autocomplete doesn't return anything either. I use import com.imgui.*.

Odd, I'm fairly certain it should be there. I'll confirm when I get time.
Are you able to Ctrl+Click on any ImGui functions? What are the functions near ImGui.calcTextSize(), (the functions are sorted)

beginTabBar
beginTabItem
beginTooltip
bullet
bulletText
button
calcItemWidth
calcListClipping
captureKeyboardFromApp
captureMouseFromApp
checkbox
checkboxFlags

Ah it returns Vec2, which I don't handle yet, so it is indeed missing. I had begun work on this in the im_vector branch.

In the meantime you can use the cinterop apis to workaround this.