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

dkasak13 at users.sourceforge.net dkasak13 at users.sourceforge.net
Sun Jul 26 01:43:22 CEST 2009


Revision: 42788
          http://scummvm.svn.sourceforge.net/scummvm/?rev=42788&view=rev
Author:   dkasak13
Date:     2009-07-25 23:43:21 +0000 (Sat, 25 Jul 2009)

Log Message:
-----------
Handled the '|' char correctly when drawing text (it serves as both a newline and end-of-string marker).

Modified Paths:
--------------
    scummvm/branches/gsoc2009-draci/engines/draci/font.cpp

Modified: scummvm/branches/gsoc2009-draci/engines/draci/font.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/font.cpp	2009-07-25 23:36:24 UTC (rev 42787)
+++ scummvm/branches/gsoc2009-draci/engines/draci/font.cpp	2009-07-25 23:43:21 UTC (rev 42788)
@@ -211,15 +211,24 @@
 	assert(y >= 0);
 
 	int curx = x;
+	int cury = y;
 
 	for (unsigned int i = 0; i < len; ++i) {
+
+		// If we encounter the '|' char (newline and end of string marker),
+		// skip it and go to the start of the next line
+		if (str[i] == '|') {
+			cury += getFontHeight() + 1;
+			curx = x;
+			continue;
+		}
 		
 		// Return early if there's no more space on the screen	
-		if (curx >= dst->w) {
+		if (curx >= dst->w || cury >= dst->h) {
 			return;
 		}		
-			
-		drawChar(dst, str[i], curx, y, markDirty);
+		
+		drawChar(dst, str[i], curx, cury, markDirty);
 		curx += getCharWidth(str[i]) + spacing;
 	}
 }


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