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.


Topics - ChrisPanov

Pages: [1]
1
Graphics / Unable to open file
« on: January 05, 2018, 01:56:06 am »
Hey everyone,

I'm new to SFML, and just bought that book about game programming with SFML,
but i have some problems.

Here is the code:

#include <SFML/Graphics.hpp>
using namespace sf;
int main()
{

        VideoMode vm(1920, 1080);

        RenderWindow window(vm, "Timber", Style::Fullscreen);

        Texture textureBackground;

        textureBackground.loadFromFile("assets/graphics/background.png");

        Sprite spriteBackground;

        spriteBackground.setTexture(textureBackground);

        spriteBackground.setPosition(0, 0);


        while (window.isOpen())
        {

                if (Keyboard::isKeyPressed(Keyboard::Escape))
                {
                        window.close();
                }

                window.clear();

                window.draw(spriteBackground);

                window.display();

        }

        return 0;
}


 


The thing is that i cant load the background.
This is the message i get: "The requested video mode is not available, switching to a valid mode
w╠їя          8     ". Reason: Unable to open file"

Where am i wrong?

And just to note, i've tried moving the png file everywhere and still no success

Pages: [1]