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

Author Topic: Text does not render  (Read 1472 times)

0 Members and 1 Guest are viewing this topic.

reDo

  • Full Member
  • ***
  • Posts: 104
    • View Profile
Text does not render
« on: October 17, 2013, 05:29:45 pm »
I switched to new computer with Win 7 64bit(SFML 2.1) from Win XP 32bit(SFML 2.0) and now i cannot render text, I always got only black screen. Here is code:
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <SFML/System.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(800, 600, 32), "");
    window.setFramerateLimit(60);

    while(window.isOpen())
    {
        sf::Event event;
        while(window.pollEvent(event))
        {
            if(event.type == sf::Event::Closed)
                window.close();
            if(event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape)
                window.close();
        }

        sf::Text text;
        text.setString("hello");
        text.setColor(sf::Color::Red);
        window.clear();
        window.draw(text);
        window.display();
    }

    return 0;
}
 

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Text does not render
« Reply #1 on: October 17, 2013, 05:38:11 pm »
How do you expect the text to render if you don't load a font? ;)

The default font got removed a long time ago. :D
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

reDo

  • Full Member
  • ***
  • Posts: 104
    • View Profile
Re: Text does not render
« Reply #2 on: October 17, 2013, 06:32:42 pm »
Oh, I do not know that. I was used to use default but I couldn t find it in 2.1. :D That is the reason why. Thanks