I'm trying to display a text prompt and a RectangleShape as a behind it that has the same exact size as the aforementioned text,to act as a bouding box,and I came up with a simple formula to do it:
int width = (text.getCharacterSize() * str.size()) + (text.getLetterSpacing() * (str.size() - 1));
With
'str' being the string containing the text displayed (In this case the words "LEVEL SELECT").
And the Rectangle's height simply being the CharacterSize.
And it...sort of works...
As you can see the box isn't quite the size of the text, and I don't know what the right way to do that would be...
My second problem is the text origin, I don't quite understand how that works, and I want to set the origin of the text to always be in the center,so that if I set the texts position to be the middle of the screen, the text will always be centered regardless of it's length.