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

Pages: [1]
1
Graphics / Re: Textures not loading, and I tried EVERYTHING
« on: December 08, 2020, 03:08:32 am »
I get the usual unhandled exception error with the random symbols in the console, the usual error you get when the compiler can't recognize the texture file.

2
Graphics / Textures not loading, and I tried EVERYTHING
« on: December 08, 2020, 01:04:16 am »
Yes, I included the file type (png), yes I tried making a sprite, yes I have it in the same folder as the "Source.cpp" file. I am getting so frustrated as I have wasted the past hour or so trying to figure out why it is doing this. I am thinking it might be the way I linked the project? The thing is, though, every other type of code works with these project settings, EXCEPT adding textures.
Any ideas?
Thanks.

#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <SFML/System.hpp>

int main()
{
        sf::RenderWindow window(sf::VideoMode(800, 800), "Good");
        sf::Texture texture;
        texture.loadFromFile("sfml logo.png");
        sf::Sprite sprite;
        sprite.setTexture(texture);
        sprite.setColor(sf::Color::Red);

        while (window.isOpen())
        {
                sf::Event ev;
                while (window.pollEvent(ev))
                {
                        if (ev.type == sf::Event::Closed)
                        {
                                window.close();
                        }
                }
                window.clear();
                window.draw(sprite);
                window.display();
        }
}
 

Pages: [1]