Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - chilunliu

Pages: [1]
1
Graphics / Re: SFML 1.6 - RenderWindow doesn't write text to screen
« on: October 18, 2013, 12:32:23 pm »
I see, Thanks for your help Nexus. I appreciate this. Chilun

2
Graphics / Re: SFML 1.6 - RenderWindow doesn't write text to screen
« on: October 16, 2013, 06:32:06 pm »
Hi;

I the tutorial for version 1.6 is very basic for writing text to the screen so I had to adapt my version with the 2.1 tutorial. I followed the example at the bottom of the following page: http://sfml-dev.org/tutorials/1.6/graphics-fonts.php. I've located many different examples, most of them don't have draw calls within loops, just set font, size, colour and feed this into a renderwindow variable, which should at least write something to the screen (based on code I've found online).

Chilun

3
Graphics / SFML 1.6 - RenderWindow doesn't write text to screen
« on: October 16, 2013, 11:02:28 am »
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();

// ---------------------------------------------------------

 

Pages: [1]
anything