Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Center-aligned texts using sf::string  (Read 2772 times)

0 Members and 1 Guest are viewing this topic.

Sazabi02

  • Newbie
  • *
  • Posts: 10
    • Yahoo Instant Messenger - nojj02
    • View Profile
    • Email
Center-aligned texts using sf::string
« on: January 09, 2009, 01:06:18 pm »
I've been trying so hard to make this work for a button class that I made so that the text would be in the middle but somehow I can't find anyway to do it.

I tried doing:
Code: [Select]

sf::String text;
text.Move( x + buttonWidth / 2 - text.GetRect().GetWidth() / 2, y + buttonHeight / 2 - GetRect().GetHeight());
App.Draw(text);


Can anyone help please? I'm kinda stumped here. Whenever I do that code the bounding rectangle turns out a little bit closer to the top left side instead of being at the center.

 

anything