I am using SFML to make a small Pokemon style RPG(With a very creative name: Pokamon) In this program I am trying to make a function that sets a Text object's position to be centered(On the X axis, Y axis or Both - Using an enumerator)
But I cannot make it work!
I'm having the main function output the coods of the text after this function, but it outputs the right numbers. but it draws it in the wrong place. I wasn't sure weather to post this here of at the SFML forums, so if nobody can help me I will go and post this over there.
here is the Function that is not working as intended.
for any given set of Coordinates it appearers in the same place every time. Something I've just noticed is that it resets to the first position again after 3 times doing the function, but the Coordinates still don't change
What are width and height variables? Where are they defined? Are you sure that they are correct?
EDIT: Your problem is object.setOrigin call. Remember that object origin is relative to object itself and do not change with its position. Remove all position-based stuff (textRect.left and textRect.top)
Thank you so much, I was so convinced it was the reference that was broken, I didn't pay close attention to anything else. This is something I need to work on because I seem to do it sometimes