Hi everyone!
I am using SFML 2.2 and VS 13.
My OS: Win 8.1 x64
I am trying to display some numbers in a window. But my window still stay black
I am trying it with the following code
#include <string>
#include <sstream>
#include <iostream>
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode(800, 600, 32), "Test", sf::Style::Default);
int number = 1000;
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
sf::Font font;
if (!font.loadFromFile("font.ttf"))
{
std::cerr << "error";
}
std::ostringstream oss;
oss << number;
sf::Text text;
text.setFont(font);
text.setString(oss.str());
text.setColor(sf::Color::Red);
text.setPosition(400, 300);
window.clear();
window.draw(text);
window.display();
}
return 0;
}
I am sending this code my friends and he work perfect!
What is my problem?
P.S. Sorry for my english, but i hope you understand me!