SFML community forums

Help => Graphics => Topic started by: OutlawLee on May 07, 2012, 11:50:14 pm

Title: sf::Text help, formatting the setString
Post by: OutlawLee 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
Title: Re: sf::Text help, formatting the setString
Post by: Tank 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.