Dominaezzz / kotlin-imgui

Kotlin bindings for Dear ImGui
MIT License
83 stars 4 forks source link

Compute size of text in advance. #28

Open Kesanov opened 3 years ago

Kesanov commented 3 years ago

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.

Dominaezzz commented 3 years ago

Did you not find ImGui.calcTextSize()?

Kesanov commented 3 years ago

Nope. Quick search returns nothing.

Dominaezzz commented 3 years ago

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.

Kesanov commented 3 years ago

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

Dominaezzz commented 3 years ago

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)

Kesanov commented 3 years ago
beginTabBar
beginTabItem
beginTooltip
bullet
bulletText
button
calcItemWidth
calcListClipping
captureKeyboardFromApp
captureMouseFromApp
checkbox
checkboxFlags
Dominaezzz commented 3 years ago

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.