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 - PyZilla

Pages: [1]
1
Graphics / Re: Problem with SFML graphics loadFromFile
« on: September 15, 2014, 11:28:51 pm »
I feel like dying...

Thanks buddy!

PyZilla

2
Graphics / Problem with SFML graphics loadFromFile
« on: September 15, 2014, 09:25:35 pm »
Hi,

I am trying to display some text on my SFML window, but as the title says, there is an error with loadFromFile. I'm trying to load a font from my project directory. I checked, it's actually the working directory. Despite that, the load fails every time.

I would appreciate the help while I am still trying to figure this out.
#include <Windows.h>
#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
        sf::Font font;
        sf::Text text;

        if(!font.loadFromFile("arial.tff")) {
                OutputDebugStringA("ERR0R\n");
        }

        text.setFont(font);
        text.setString("Success");
        text.setCharacterSize(20);
        text.setColor(sf::Color::White);

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }

        window.clear();
        window.draw(text);
        window.display();
    }

    return 0;
}

Thank you for your help,

PyZilla

Pages: [1]
anything