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

Pages: [1]
1
Graphics / Re: ERRORs with loadFromfile
« on: August 31, 2015, 02:42:48 pm »
You're probably mixing Debug with Release (or compiler versions/flags).
Make sure the configuration of SFML and your project is consistent.

And please use [code=cpp] [/code] in future posts.


problem solved, thanks! I'm so careless as to make such a mistake...

2
Graphics / ERRORs with loadFromfile
« on: August 31, 2015, 02:06:08 pm »
the code is as follow:
when I build and run the project in vs2010, the consol flapped rapidly full of gibberish and my speaker started to beep... what's wrong with it?
I run it by step and found it stopped at the "loadfromfile" line.
#include <SFML/Graphics.hpp>


int main()
{
    sf::RenderWindow window(sf::VideoMode(800, 600), "SFML works!", sf::Style::Close);

        sf::Texture txr;
        if(!txr.loadFromFile("tank1.png"))
                return -1;
        sf::Sprite spr;
        spr.setTexture(txr);
       
    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }

        window.clear();

                window.draw(spr);

        window.display();
    }

    return 0;
}
 

Pages: [1]