Hi all;
I'm trying to write some text in a pong game I'm trying to work through. Here is the code (does compile fine, using SFML 1.6 - please don't kill me, this is what i have to work with atm). For some unknown reason to me, I cannot see any text on the window when trying to feed the text to the renderwindow function. Can anyone advise on why this is the case and how I can remedy this problem?
Thank you
Chilun
// RESET BALL TO MIDDLE OF SCREEN AND RESET TIMER TO 0
GetSprite().SetPosition(Game::SCREEN_WIDTH/2, Game::SCREEN_HEIGHT/2);
_angle = (float)sf::Randomizer::Random(0,360);
_velocity = 220.0f;
_elapsedTimeSinceStart = 0.0f;
// ------------------------------------- DRAW TEXT TO SCREEN
// declare and load font file (.ttf)
sf::Font font;
font.LoadFromFile("PLANE.ttf", 100);
// create text object
sf::String text("YOU LOSE", font, 100);
// set colour
text.SetColor(sf::Color::Yellow);
text.SetSize(10.f);
text.SetPosition(0, 10);
// draw to screen
sf::RenderWindow window;
window.Draw(text);
//update window
window.Display();
// ---------------------------------------------------------