Задать вопрос
@Bikijol

Не отображается изображение sfml c++. Вместо картинок отображается чёрный квадрат, как исправить?

#include <SFML/Graphics.hpp>

using namespace sf;

int main()
{
    RenderWindow window(VideoMode(700,700), "Test");

    Image heroimage;
    heroimage.loadFromFile("images\hero.png");
 
    Texture herotexture;
    herotexture.loadFromImage(heroimage);
 
    Sprite herosprite;
    herosprite.setTexture(herotexture);
    herosprite.setPosition(50, 25);

    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;
}
  • Вопрос задан
  • 100 просмотров
Подписаться 1 Средний 1 комментарий
Ответ пользователя maaGames К ответам на вопрос (2)
maaGames
@maaGames
Погроммирую программы
heroimage.loadFromFile("images\hero.png");
я добавил пробелов для ясности
images \h ero
Ответ написан
Комментировать