#include <SFML\Graphics.hpp>
#include <iostream>
using namespace std;
#define RENDERHEIGHT 800
#define RENDERWIDTH 400
int main()
{
sf::RenderWindow tetris(sf::VideoMode(RENDERWIDTH, RENDERHEIGHT, 32), "TETRIS");
tetris.setFramerateLimit(60);
tetris.setMouseCursorVisible(false);
sf::Text text;
text.setString("hello");
text.setPosition(0, 0);
text.setCharacterSize(30);
text.setStyle(sf::Text::Bold);
text.setColor(sf::Color::Red);
while(tetris.isOpen())
{
sf::Event event;
while(tetris.pollEvent(event))
{
if (event.type == sf::Event::Closed || event.key.code == sf::Keyboard::Escape)
tetris.close();
}
tetris.draw(text);
tetris.display();
}
return 0;
}
I'm using SFML 2.0. That is my exact code, which compiles, but no text is visible. I've tried setting different positions, loading my own font (which gave me a runtime error), and on top of that, the text constructor won't accept string arguments.
sf::Text text("hello"); does not compile as VS doesn't think the constructor takes string arguments.
Any help?