diff options
Diffstat (limited to 'engines')
-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 }; |