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

Author Topic: sf::Text help, formatting the setString  (Read 1750 times)

0 Members and 1 Guest are viewing this topic.

OutlawLee

  • Jr. Member
  • **
  • Posts: 50
  • This is my personal text. Dont read it.
    • View Profile
    • Email
sf::Text help, formatting the setString
« on: May 07, 2012, 11:50:14 pm »
My plan is to add a menu listing feature like:

Code: [Select]
text[id].setString(text[id].getString() +  " >"); obviously doesnt work since i wanted to show you what im trying to do.

the ">" what indicate what option is currently selected.

got this, can i somehow add on the ">" sign on the end of text[id] string ?

example: if the string was "car" it would be "car >".

Code: [Select]
void Option::Set_Option (int id)
{
text[id].setString(text[id].getString());
App.draw(text[id]);
}

thx

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
Re: sf::Text help, formatting the setString
« Reply #1 on: May 08, 2012, 08:15:36 am »
For the sake of simplicity I'd go with a separate sf::Text that you place next to the active menu entry. Use sf::Text::setPosition() for positioning it and sf::Text::getGlobalBounds() to retrieve the position and size of the menu entry you're using as the reference.

 

anything