kotlin-imgui icon indicating copy to clipboard operation
kotlin-imgui copied to clipboard

Compute size of text in advance.

Open Kesanov opened this issue 3 years ago • 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.

Kesanov avatar Jun 29 '21 08:06 Kesanov

Did you not find ImGui.calcTextSize()?

Dominaezzz avatar Jun 29 '21 09:06 Dominaezzz

Nope. Quick search returns nothing.

Kesanov avatar Jun 30 '21 09:06 Kesanov

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.

Dominaezzz avatar Jun 30 '21 09:06 Dominaezzz

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

Kesanov avatar Jun 30 '21 10:06 Kesanov

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)

Dominaezzz avatar Jul 01 '21 18:07 Dominaezzz

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

Kesanov avatar Jul 02 '21 03:07 Kesanov

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.

Dominaezzz avatar Jul 04 '21 09:07 Dominaezzz