summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/resources/image.cpp24
-rw-r--r--src/resources/image.h6
2 files changed, 28 insertions, 2 deletions
diff --git a/src/resources/image.cpp b/src/resources/image.cpp
index 408668eb..b3f7140d 100644
--- a/src/resources/image.cpp
+++ b/src/resources/image.cpp
@@ -43,8 +43,19 @@ Image::Image(SDL_Surface *image):
{
mBounds.x = 0;
mBounds.y = 0;
- mBounds.w = mSDLSurface->w;
- mBounds.h = mSDLSurface->h;
+
+ if (mSDLSurface)
+ {
+ mBounds.w = mSDLSurface->w;
+ mBounds.h = mSDLSurface->h;
+ mLoaded = true;
+ }
+ else
+ {
+ logger->log(
+ "Image::Image(SDL_Surface*): Couldn't load invalid Surface!");
+ mLoaded = false;
+ }
}
#ifdef USE_OPENGL
@@ -59,6 +70,15 @@ Image::Image(GLuint glimage, int width, int height, int texWidth, int texHeight)
mBounds.y = 0;
mBounds.w = width;
mBounds.h = height;
+
+ if (mGLImage)
+ mLoaded = true;
+ else
+ {
+ logger->log(
+ "Image::Image(GLuint*, ...): Couldn't load invalid Surface!");
+ mLoaded = false;
+ }
}
#endif
diff --git a/src/resources/image.h b/src/resources/image.h
index 91ecbb54..c97523a9 100644
--- a/src/resources/image.h
+++ b/src/resources/image.h
@@ -93,6 +93,12 @@ class Image : public Resource
virtual void unload();
/**
+ * Tells is the image is loaded
+ */
+ bool isLoaded()
+ { return mLoaded; }
+
+ /**
* Returns the width of the image.
*/
virtual int getWidth() const