How to display a image in SFML?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
17 views
Good time of day.
Tell me how to upload the image that she displayed in the console?

In the project Assembly created the BACKGROUND folder and uploaded there picture.
Gave it a right way, but still a black consol.

What am I doing wrong?
Thanks in advance!

#include #include using namespace sf; int main() { RenderWindow window(VideoMode(1279, 295), "); Image heroimage; heroimage.loadFromFile("BACKGROUND/normal_back.png"); Texture herotexture; herotexture.loadFromImage(heroimage); Sprite herosprite; herosprite.setTexture(herotexture); while (window.isOpen()) { Event Event; while (window.pollEvent(event)) { if (event.type == Event::Closed) window.close(); } window.clear(); window.draw(herosprite); window.display(); } return 0; }


PS Even if I throw the picture into the folder, just near the file .cpp and indicate the title of the image, the console displays a black screen
by | 17 views

1 Answer

0 like 0 dislike
I'd first checked that the methods loadFromFile and return loadFromImage. Were you able at all to upload the image and create texture. Well, the absolute path would be pointed out.
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
asked Jun 4, 2019 by slayez
0 like 0 dislike
1 answer
asked May 2, 2019 by N1smo191
0 like 0 dislike
1 answer
asked Apr 9, 2019 by rafamont
110,608 questions
257,187 answers
0 comments
40,796 users