summaryrefslogtreecommitdiff
path: root/src/resources/image.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-07-27 21:55:20 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-07-27 21:55:20 +0000
commitd15d76976b6e57a9f421ab034c6f841051b962f3 (patch)
treeab0c37c90af9f76158b96f195c05be9b221e9f42 /src/resources/image.cpp
parentaa362286c725e17ec88aa46f8f6af9ca90d744b3 (diff)
downloadMana-d15d76976b6e57a9f421ab034c6f841051b962f3.tar.gz
Mana-d15d76976b6e57a9f421ab034c6f841051b962f3.tar.bz2
Mana-d15d76976b6e57a9f421ab034c6f841051b962f3.tar.xz
Mana-d15d76976b6e57a9f421ab034c6f841051b962f3.zip
Committing merging opengl and sdl part 3 by Andrej
Diffstat (limited to 'src/resources/image.cpp')
-rw-r--r--src/resources/image.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/resources/image.cpp b/src/resources/image.cpp
index eb550a3a..2bf4721f 100644
--- a/src/resources/image.cpp
+++ b/src/resources/image.cpp
@@ -34,6 +34,7 @@ Image::Image(SDL_Surface *image):
alpha = 1.0f;
}
+#ifdef USE_OPENGL
Image::Image(GLuint glimage, int width, int height, int texWidth, int texHeight):
glimage(glimage),
width(width),
@@ -44,6 +45,7 @@ Image::Image(GLuint glimage, int width, int height, int texWidth, int texHeight)
// Default to opaque
alpha = 1.0f;
}
+#endif
Image::~Image()
{
@@ -240,9 +242,9 @@ Image* Image::load(void* buffer, unsigned int bufferSize)
return new Image(texture, width, height, realWidth, realHeight);
}
-#endif
-
+#else
return NULL;
+#endif
}
void Image::unload()
@@ -265,9 +267,11 @@ int Image::getWidth() const
return image->w;
}
}
+#ifdef USE_OPENGL
else {
return width;
}
+#endif
return 0;
}
@@ -278,21 +282,27 @@ int Image::getHeight() const
return image->h;
}
}
+#ifdef USE_OPENGL
else {
return height;
}
+#endif
return 0;
}
Image *Image::getSubImage(int x, int y, int width, int height)
{
// Create a new clipped sub-image
- if (useOpenGL) {
- return new SubImage(this, glimage, x, y, width, height, texWidth, texHeight);
+ if (!useOpenGL) {
+ return new SubImage(this, image, x, y, width, height);
}
+#ifdef USE_OPENGL
else {
- return new SubImage(this, image, x, y, width, height);
+ return new SubImage(this, glimage, x, y, width, height, texWidth, texHeight);
}
+#else
+ return NULL;
+#endif
}
bool Image::draw_deprecated(SDL_Surface *screen, int srcX, int srcY, int dstX, int dstY,
@@ -386,7 +396,7 @@ SubImage::SubImage(Image *parent, SDL_Surface *image,
rect.h = height;
}
-//SubImage::SubImage((GLuint*)Image *parent, GLuint glimage,
+#ifdef USE_OPENGL
SubImage::SubImage(Image *parent, GLuint image,
int x, int y, int width, int height, int texWidth, int texHeight):
Image(image, width, height, texWidth, texHeight), parent(parent)
@@ -399,6 +409,7 @@ SubImage::SubImage(Image *parent, GLuint image,
rect.w = width;
rect.h = height;
}
+#endif
SubImage::~SubImage()
{