From d0c97b98e477cfdf46ed7f36fd16c64f7943d551 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Mon, 17 Jan 2005 15:11:19 +0000 Subject: Committing Allegro -> SDL switch, hugely breaking the game. --- src/resources/image.h | 44 ++++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 16 deletions(-) (limited to 'src/resources/image.h') diff --git a/src/resources/image.h b/src/resources/image.h index 0452cd4a..d5c98c5d 100644 --- a/src/resources/image.h +++ b/src/resources/image.h @@ -25,8 +25,7 @@ #define _TMW_IMAGE_H #include "resource.h" -//#include -#include +#include // Forward declarations class SubImage; @@ -41,7 +40,7 @@ class Image : public Resource /** * Constructor. */ - Image(BITMAP *image); + Image(SDL_Surface *image); /** * Destructor. @@ -89,17 +88,17 @@ class Image : public Resource * @return true if the image was blitted properly * false otherwise. */ - virtual bool draw(BITMAP *screen, int x, int y); + virtual bool draw(SDL_Surface *screen, int x, int y); /** * Does a pattern fill on the given area. */ - virtual void drawPattern(BITMAP *screen, int x, int y, int w, int h); + virtual void drawPattern( + SDL_Surface *screen, int x, int y, int w, int h); protected: - //SDL_Rect screenRect; - //SDL_Surface *image; - BITMAP *image; + SDL_Surface *image; + //BITMAP *image; }; /** @@ -112,7 +111,7 @@ class SubImage : public Image * Constructor. */ //SubImage(SDL_Surface *timage, int x, int y, int width, int height); - SubImage(Image *parent, BITMAP *image, + SubImage(Image *parent, SDL_Surface *image, int x, int y, int width, int height); /** @@ -120,21 +119,34 @@ class SubImage : public Image */ ~SubImage(); + /** + * Returns the width of the image. + */ + int getWidth() const; + + /** + * Returns the height of the image. + */ + int getHeight() const; + + /** + * Creates a new image with the desired clipping rectangle. + * @return NULL if creation failed and a valid + * object otherwise. + */ + Image* getSubImage(int x, int y, int width, int height); + /** * Draws the clipped image onto the screen. * @return true if drawing was succesful * false otherwise. */ - bool draw(BITMAP *screen, int x, int y); + bool draw(SDL_Surface *screen, int x, int y); private: Image *parent; + SDL_Rect rect; //BITMAP *image; - //SDL_Rect clipRect; - //SDL_Rect screenRect; - //SDL_Surface *image; - //SDL_Surface *screen; - //unsigned int referenceCount; }; /** @@ -146,7 +158,7 @@ class ScaledImage : public Image /** * Constructor. */ - ScaledImage(Image *parent, BITMAP *image, int width, int height); + ScaledImage(Image *parent, SDL_Surface *image, int width, int height); /** * Destructor. -- cgit v1.2.3-70-g09d2