Hi all,
I'm currently developing a class which represents a text menu for applications (like a main menu for a game). While doing so, I oriented myself at the sf::Text - class, which is used internally for displaying individual meny entries. It works as intended but when calculation the global bounds of the complete menu, the top-left coordinate of the menu is 0.f, 0.f. Width and height should be the same like the local bounds, which is correct (209, 150 in my example below). The local bounds are correctly calculated and stored as a member inside the class.
I used the same method for calculating the global bounds like sf::Text or sf::Sprite do:
sf::FloatRect TextMenu::getGlobalBounds() const
{
return getTransform().transformRect( getLocalBounds() );
}
... which should return the global coordinates of the menu with all transformations applied.
I have no idea why the global bounds are not correct.
The complete code with minimal example can be found here:
https://github.com/SeriousITGuy/SFML-TextMenuIt is not a deal-breaker as the rest works like intended and is ready to use in my other projects, just wondering why this happens
I plan on posting this class in the wiki once it's completed and therefor it would be good to get rid of this minor issue.