diff options
| author | Denis Kasak | 2009-06-30 22:31:29 +0000 | 
|---|---|---|
| committer | Denis Kasak | 2009-06-30 22:31:29 +0000 | 
| commit | 85a5871873499a2965dd5badffd224a7560f9b60 (patch) | |
| tree | 7aa28496618527fcfea89404058088dd5ec8302d | |
| parent | 138d17bbabd5e5639b6aab24f1c2a0b75a9384f7 (diff) | |
| download | scummvm-rg350-85a5871873499a2965dd5badffd224a7560f9b60.tar.gz scummvm-rg350-85a5871873499a2965dd5badffd224a7560f9b60.tar.bz2 scummvm-rg350-85a5871873499a2965dd5badffd224a7560f9b60.zip  | |
Added the Drawable abstract base class and made Sprite inherit from it.
svn-id: r41979
| -rw-r--r-- | engines/draci/sprite.cpp | 12 | ||||
| -rw-r--r-- | engines/draci/sprite.h | 16 | 
2 files changed, 21 insertions, 7 deletions
diff --git a/engines/draci/sprite.cpp b/engines/draci/sprite.cpp index 6e4cb8b6b6..cce3f51cfa 100644 --- a/engines/draci/sprite.cpp +++ b/engines/draci/sprite.cpp @@ -54,7 +54,11 @@ static void transformToRows(byte *img, uint16 width, uint16 height) {   *  Constructor for loading sprites from a raw data buffer, one byte per pixel.   */  Sprite::Sprite(byte *raw_data, uint16 width, uint16 height, uint16 x, uint16 y,  -			   bool columnwise) : _width(width), _height(height), _x(x), _y(y), _data(NULL) { +			   bool columnwise) : _data(NULL) { +	 _width = width; +	 _height = height; +	 _x = x; +	 _y = y;  	_data = new byte[width * height]; @@ -71,8 +75,10 @@ Sprite::Sprite(byte *raw_data, uint16 width, uint16 height, uint16 x, uint16 y,   *	pixel.   */  Sprite::Sprite(byte *sprite_data, uint16 length, uint16 x, uint16 y,  -			   bool columnwise) : _x(x), _y(y), _data(NULL) { - +			   bool columnwise) : _data(NULL) { +	 _x = x; +	 _y = y; +	  	Common::MemoryReadStream reader(sprite_data, length);  	_width = reader.readUint16LE(); diff --git a/engines/draci/sprite.h b/engines/draci/sprite.h index 18ea899641..c9591514e3 100644 --- a/engines/draci/sprite.h +++ b/engines/draci/sprite.h @@ -30,6 +30,17 @@  namespace Draci { +class Drawable { + +public: +	virtual void draw(Surface *surface) const = 0; +	virtual ~Drawable() {}; + +	uint16 _width;	//!< Width of the sprite +	uint16 _height;	//!< Height of the sprite +	uint16 _x, _y;	//!< Sprite coordinates +}; +  /**   *  Represents a Draci Historie sprite. Supplies two constructors; one for   *  loading a sprite from a raw data buffer and one for loading a sprite in @@ -43,7 +54,7 @@ namespace Draci {   *	[height * width bytes] image pixels stored column-wise, one byte per pixel   */ -class Sprite { +class Sprite : public Drawable {  public:  	Sprite(byte *raw_data, uint16 width, uint16 height, uint16 x = 0, uint16 y = 0,  @@ -57,9 +68,6 @@ public:  	void draw(Surface *surface) const;   	byte *_data;	//!< Pointer to a buffer containing raw sprite data (row-wise) -	uint16 _width;	//!< Width of the sprite -	uint16 _height;	//!< Height of the sprite -	uint16 _x, _y;	//!< Sprite coordinates  };  | 
