почему не отображается изображение sfml? - PullRequest
0 голосов
/ 01 августа 2020

Я пытаюсь установить backgound в своем sfml-приложении, но появляется ошибка Код:

 Image hero_image;
hero_image.loadFromFile("image/main.png");
Texture hero_texture;
hero_texture.loadFromImage((hero_image));

Sprite hero_sprite;
hero_sprite.setTexture(hero_texture);
hero_sprite.setPosition(50,30); 
//main loop
window.draw(hero_sprite);

Ошибка:

Failed to load image "image/main.png". Reason: Unable to open file
Failed to create texture, invalid size (0x0)
...