Browse Source

TextSprite Zero Size Bug

This fixes a bug that causes an endless loop in the game engine when a
TextSprite set to wrap has a width that is less than the length of a
space.  An additional test is made to ensure that we have started a new
word in the wrapping algorithm.
Peter Robinson 9 years ago
parent
commit
7eb900b54b
1 changed files with 1 additions and 1 deletions
  1. 1 1
      engine/source/2d/sceneobject/TextSprite.cc

+ 1 - 1
engine/source/2d/sceneobject/TextSprite.cc

@@ -645,7 +645,7 @@ void TextSprite::CalculateSpatials(F32 ratio)
             wordEndLength = length - getCursorAdvance(bmChar, prevCharID, ratio);
          }
 
-         if (length > mSize.x && wordEnd > start)
+         if (length > mSize.x && wordEnd > start && start != -1)
          {
             mLine.back().mEnd = wordEnd;
             U32 endCharID = mText.getChar(wordEnd);