SFML Webサイトのグラフィックスプライトチュートリアルから直接取られているように
"The loadFromFile function sometimes fails with no obvious reason. First, check the error message printed by SFML in the
standard output (check the console). If the message is unable to open file, make sure that the working directory (which is the
directory any file path will be interpreted relatively to) is what you think it is: when you run the application from the explorer, the
working directory is the executable folder, but when you launch your program from your IDE (Visual Studio, Code::Blocks, ...) the
working directory is sometimes set to the project directory instead. This can generally be changed easily in the project settings."
したがって、画像が最初に正しく命名されていることを確認し、セカンドエンドでは、ワーキングディレクトリの正しいフォルダー、つまり正しいフォルダーにあることを確認してください。
また、テクスチャが空のスプライトを返す代わりにロードに失敗した場合、エラーをコンソールに報告してから例外をスローできます。このようにして、Spriteは正しくロードされないと言われ、プログラムは例外を処理する必要があります。このようにして、ゲーム内のスプライトは、意図的でない限り白いテクスチャーを持つ必要はありません
このようなもの:
sf::Texture texture;
if (!texture.loadFromFile("image.png"))
{
throw std::runtime_error("Could not load image.png");
}