Author: jsalmon3
Date: 2007-07-10 06:54:20 +0200 (Tue, 10 Jul 2007)
New Revision: 2706
Modified:
branches/pingus_sdl/src/pixel_buffer.cpp
Log:
Try to load .jpg if .png isn't found
Modified: branches/pingus_sdl/src/pixel_buffer.cpp
===================================================================
--- branches/pingus_sdl/src/pixel_buffer.cpp 2007-07-10 04:15:09 UTC (rev
2705)
+++ branches/pingus_sdl/src/pixel_buffer.cpp 2007-07-10 04:54:20 UTC (rev
2706)
@@ -35,11 +35,14 @@
PixelBuffer::PixelBuffer(const std::string& name_)
{
- std::ostringstream str;
- str << "data/images/" << name_ << ".png";
- std::string name = str.str();
+ std::string name = "data/images/" + name_ + ".png";
surface = IMG_Load(name.c_str());
if (!surface)
+ {
+ std::string name = "data/images/" + name_ + ".jpg";
+ surface = IMG_Load(name.c_str());
+ }
+ if (!surface)
std::cout << "XXXXXX Failed to load: " << name << std::endl;
///else
//std::cout << "Loaded pixelbuffer: " << name << ": " << surface->w << "x"
<< surface->h << std::endl;
@@ -127,7 +130,7 @@
PixelBuffer::operator bool() const
{
- return surface;
+ return surface != NULL;
}
Color
_______________________________________________
pingus-cvs mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/pingus-cvs