[Scummvm-cvs-logs] SF.net SVN: scummvm:[41979] scummvm/branches/gsoc2009-draci/engines/draci
dkasak13 at users.sourceforge.net
dkasak13 at users.sourceforge.net
Wed Jul 1 00:31:30 CEST 2009
Revision: 41979
http://scummvm.svn.sourceforge.net/scummvm/?rev=41979&view=rev
Author: dkasak13
Date: 2009-06-30 22:31:29 +0000 (Tue, 30 Jun 2009)
Log Message:
-----------
Added the Drawable abstract base class and made Sprite inherit from it.
Modified Paths:
--------------
scummvm/branches/gsoc2009-draci/engines/draci/sprite.cpp
scummvm/branches/gsoc2009-draci/engines/draci/sprite.h
Modified: scummvm/branches/gsoc2009-draci/engines/draci/sprite.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/sprite.cpp 2009-06-30 22:20:03 UTC (rev 41978)
+++ scummvm/branches/gsoc2009-draci/engines/draci/sprite.cpp 2009-06-30 22:31:29 UTC (rev 41979)
@@ -54,7 +54,11 @@
* 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 @@
* 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();
Modified: scummvm/branches/gsoc2009-draci/engines/draci/sprite.h
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/sprite.h 2009-06-30 22:20:03 UTC (rev 41978)
+++ scummvm/branches/gsoc2009-draci/engines/draci/sprite.h 2009-06-30 22:31:29 UTC (rev 41979)
@@ -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 @@
* [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 @@
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
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list