Monday, 26 August 2013

Function not working as intended?

Function not working as intended?

First off I'd like to say I'm still a complete novice when it comes to
Programming, and I've already searched for an answer to this problem,
thing is, I'm not sure what's wrong.
I wrote a function to set parameters for an sf::Text object:
void FontParam(sf::Text obj, sf::Font font, std::string text, sf::Color
color, int size, int positionX, int positionY)
{
obj.setCharacterSize(size);
obj.setFont(font);
obj.setColor(color);
obj.setString(text);
obj.setPosition(positionX,positionY);
}
Using:
FontParam(t[0],font_Clubland,"R",sf::Color::White,100,100,100);
and drawing it will not work. Writing it as:
t[0].setFont(font_Clubland);
t[0].setColor(sf::Color::White);
t[0].setPosition(100,100);
t[0].setString("R");
t[0].setCharacterSize(100);
and drawing it will.
Any help or tips are very much appreciated, thanks in advance!

No comments:

Post a Comment