aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Kasak2009-07-03 19:02:08 +0000
committerDenis Kasak2009-07-03 19:02:08 +0000
commit63d0fdea68f8f43a84a22d7e8a72eef5a862a20a (patch)
treee34925aae14b6147063d4c9b0943bb541baa6289
parent4465ecf1233726ce70a27b1d03ac49d222961ede (diff)
downloadscummvm-rg350-63d0fdea68f8f43a84a22d7e8a72eef5a862a20a.tar.gz
scummvm-rg350-63d0fdea68f8f43a84a22d7e8a72eef5a862a20a.tar.bz2
scummvm-rg350-63d0fdea68f8f43a84a22d7e8a72eef5a862a20a.zip
Added Sprite::getRect() and Text::getRect().
svn-id: r42074
-rw-r--r--engines/draci/sprite.cpp10
-rw-r--r--engines/draci/sprite.h6
2 files changed, 15 insertions, 1 deletions
diff --git a/engines/draci/sprite.cpp b/engines/draci/sprite.cpp
index b417afc0ed..4461a743f5 100644
--- a/engines/draci/sprite.cpp
+++ b/engines/draci/sprite.cpp
@@ -152,6 +152,10 @@ void Sprite::draw(Surface *surface, bool markDirty) const {
}
}
+Common::Rect Sprite::getRect() const {
+ return Common::Rect(_x, _y, _x + _width, _y + _height);
+}
+
Text::Text(const Common::String &str, Font *font, byte fontColour,
uint x, uint y, uint z, uint spacing) {
uint len = str.size();
@@ -201,7 +205,11 @@ void Text::setSpacing(uint spacing) {
void Text::draw(Surface *surface, bool markDirty) const {
_font->setColour(_colour);
_font->drawString(surface, _text, _length, _x, _y, _spacing);
-}
+}
+
+Common::Rect Text::getRect() const {
+ return Common::Rect(_x, _y, _x + _width, _y + _height);
+}
} // End of namespace Draci
diff --git a/engines/draci/sprite.h b/engines/draci/sprite.h
index 191d20ca9e..6af4e8ca1e 100644
--- a/engines/draci/sprite.h
+++ b/engines/draci/sprite.h
@@ -50,6 +50,8 @@ public:
virtual void setX(uint x) { _x = x; }
virtual void setY(uint y) { _y = y; }
virtual void setZ(uint z) { _z = z; }
+
+ virtual Common::Rect getRect() const = 0;
private:
uint16 _width; //!< Width of the sprite
@@ -88,6 +90,8 @@ public:
void setMirrorOn();
void setMirrorOff();
+
+ virtual Common::Rect getRect() const;
const byte *getBuffer() const { return _data; }
private:
@@ -108,6 +112,8 @@ public:
void draw(Surface *surface, bool markDirty = true) const;
+ virtual Common::Rect getRect() const;
+
private:
byte *_text;
uint _length;