Hey, I want a Window with a green background and a texture in the middle, but my texture wont load, doess anyone know how to fix this?
This is the code:
#include <iostream>
#include <SFML/Graphics.hpp>
using namespace sf;
int main()
{
RenderWindow Window(VideoMode(1000, 700), "MyGame");
Texture texture;
Sprite sprite;
if (!texture.loadFromFile("Bug1.png"))
std::cout << "nicht geladen" << std::endl;
return -1;
sprite.setTexture(texture);
sprite.setScale(0.5f, 0.5f);
sprite.setPosition(450, 320);
while (Window.isOpen())
{
Event event;
while (Window.pollEvent(event))
if (event.type == Event::Closed) Window.close();
}
Window.clear(Color::Green);
Window.draw(sprite);
Window.display();
return 0;
}