Dear SFML-Community,
i started a topic ealier, where i searched for help with a strange problem. The "Solution" of my last topic was, that i updated to sfml 2.0.
So here's my problem now in sfml 2.0:
I have a class called "Position" with an sfml-Image as member. Declared as following:
class Position
{
private:
sf::Image CaptchaImage;
[...]
}
The constructor of the Class:
Position::Position(const char* Filename)
{
CaptchaImage.create(IMAGE_WIDTH, IMAGE_HEIGHT, sf::Color(0, 0, 0)); //Create an empty Image
if(!CaptchaImage.loadFromFile(Filename)); //Load the file into our Image
{
std::cout << "I couldnt read the image from " << Filename << std::endl;
exit(12);
}
}
So in my main.cpp I create an Instance of class Position:
Position Position("cb.bmp");
And guess what? I get the same output as in sfml 1.6:
"I couldnt read the image from cb.bmp".
This is the output I do, NOT the output that the loadFromFile() does.
So loadFromFile() fails loading the image and is not giving any Reason.
The Image IS compatible with SFML because if I do the following in the main.cpp:
sf::Image image;
if(!image.loadFromFile("cb.bmp"))
std::cout << "Failed";
else
std::cout << "Success";
It works fine!! Is this just me or is this kind of strange? I can post more code if needed.
Many thanks in advance,
Luapina
Edit:
Even IN THE SAME project but in the main.cpp the following code works:
sf::Image image;
if(!image.loadFromFile("cb.bmp"))
std::cout << "Failed";
else
std::cout << "Success";