Skip to content
This repository has been archived by the owner on Jul 25, 2024. It is now read-only.

Compute size of text in advance. #28

Open
Kesanov opened this issue Jun 29, 2021 · 7 comments
Open

Compute size of text in advance. #28

Kesanov opened this issue Jun 29, 2021 · 7 comments

Comments

@Kesanov
Copy link

Kesanov commented Jun 29, 2021

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
Copy link
Owner

Did you not find ImGui.calcTextSize()?

@Kesanov
Copy link
Author

Kesanov commented Jun 30, 2021

Nope. Quick search returns nothing.

@Dominaezzz
Copy link
Owner

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
Copy link
Author

Kesanov commented Jun 30, 2021

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

@Dominaezzz
Copy link
Owner

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
Copy link
Author

Kesanov commented Jul 2, 2021

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

@Dominaezzz
Copy link
Owner

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants