I am using SFML 3.0 in Visual Studio 2022. I'm trying to load a background texture for my game menu, but loadFromFile returns false and I get a 'Failed to load image' error in the console.
What i check:
The Working Directory in Visual Studio is set to
$(ProjectDir).The image file is located in
Silent City/Silent City/photos/menu-jimi-hendrix.pngThe file path in the code is
photos/menu-jimi-hendrix.png.I have tried both relative and absolute paths, but it still fails.
The font (loaded from a similar folder structure) works fine.
Log don't showing bug, just when remove
.pngMy Code (
Menu.cpp):if (!backgroundTexture.loadFromFile("photos/menu-jimi-hendrix.png")) { std::cerr << "Error: photos/menu-jimi-hendrix.png not found!" << std::endl; } backgroundSprite.setTexture(backgroundTexture);