Nabin
Nabin

Reputation: 11776

BitmapFont class does not have getBound(String) method

Previously I used getBound method for BitmapFont class in libgdx, but now, I am unable to use it.

I cannot find the changes in latest version.

Any help is appreciated. Thank you

Upvotes: 0

Views: 295

Answers (1)

friendlyBug
friendlyBug

Reputation: 598

After the API 1.5.6 we have a different way to get the String bound. try this

GlyphLayout layout = new GlyphLayout();
layout.setText(bitmapFont,"text");
float width = layout.width;
float height = layout.height;

and it's not recommended to create new GlyphLayout on each frame, create once and use it.

Upvotes: 2

Related Questions