Trying to center horizontally a String...
Here is the code:
void Visuals::DrawTextOnScreenBuffer(char text[256], float size, sf::Color textColor, sf::Color textOutlineColor, float screenX, float screenY, uint16_t xJustification)
{
sf::String textToDisplay(text, Arial, size);
if (xJustification == TextLeft)
{
//do nothing..
}
else if (xJustification == TextCenter)
{
screenX = ( 320 - (textToDisplay.GetCenter / 2) ); //<-ERROR
|
for (float outlineY = screenY - 3; outlineY < screenY + 3; outlineY++)
for (float outlineX = screenX - 3; outlineX < screenX + 3; outlineX++)
{
textToDisplay.SetX(outlineX);
textToDisplay.SetY(outlineY);
textToDisplay.SetColor(textOutlineColor);
App.Draw(textToDisplay);
}
textToDisplay.SetX(screenX);
textToDisplay.SetY(screenY);
textToDisplay.SetColor(textColor);
App.Draw(textToDisplay);
}
Does not compile - see ERROR
Please help, thanks