[Scummvm-cvs-logs] SF.net SVN: scummvm:[42789] scummvm/branches/gsoc2009-draci/engines/draci

dkasak13 at users.sourceforge.net dkasak13 at users.sourceforge.net
Sun Jul 26 02:04:12 CEST 2009


Revision: 42789
          http://scummvm.svn.sourceforge.net/scummvm/?rev=42789&view=rev
Author:   dkasak13
Date:     2009-07-26 00:04:12 +0000 (Sun, 26 Jul 2009)

Log Message:
-----------
* Removed friend declarations in Drawable for Sprite and Text, and made Drawable's private members protected so they can access them
* Added Text::drawScaled() and altered Text::getRect() so Text instances can be accessed through a Drawable pointer. Scaling text is planned for later because it's not essential.

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-07-25 23:43:21 UTC (rev 42788)
+++ scummvm/branches/gsoc2009-draci/engines/draci/sprite.cpp	2009-07-26 00:04:12 UTC (rev 42789)
@@ -331,7 +331,8 @@
 	_font->drawString(surface, _text, _length, _x, _y, _spacing);
 }
 
-Common::Rect Text::getRect() const {
+// TODO: Handle scaled parameter properly by implementing Text scaling
+Common::Rect Text::getRect(bool scaled) const {
 	return Common::Rect(_x, _y, _x + _width, _y + _height);
 }
 			

Modified: scummvm/branches/gsoc2009-draci/engines/draci/sprite.h
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/sprite.h	2009-07-25 23:43:21 UTC (rev 42788)
+++ scummvm/branches/gsoc2009-draci/engines/draci/sprite.h	2009-07-26 00:04:12 UTC (rev 42789)
@@ -33,9 +33,6 @@
 
 class Drawable {
 
-friend class Sprite;
-friend class Text;
-
 public:
 	virtual void draw(Surface *surface, bool markDirty = true) const = 0;
 	virtual void drawScaled(Surface *surface, bool markDirty = true) const = 0;
@@ -64,7 +61,7 @@
 
 	virtual Common::Rect getRect(bool scaled = true) const = 0;
 	
-private:
+protected:
 	uint _width;		//!< Width of the sprite
 	uint _height;		//!< Height of the sprite
 	uint _scaledWidth; 	//!< Scaled width of the sprite
@@ -124,11 +121,15 @@
 	void setText(const Common::String &str);
 	void setColour(byte fontColour);
 	void setSpacing(uint spacing);
-	
+
 	void draw(Surface *surface, bool markDirty = true) const;
 
-	Common::Rect getRect() const;
+	// TODO: drawScaled just calls draw so Text can be accessed through a Drawable pointer. 
+	// Handle scaling text sometimes (not essential).
 
+	void drawScaled(Surface *surface, bool markDirty = true) const { draw(surface, markDirty); }
+	Common::Rect getRect(bool) const;
+
 private:
 	byte *_text;
 	uint _length;


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