瀏覽代碼

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 年之前
父節點
當前提交
7eb900b54b
共有 1 個文件被更改,包括 1 次插入1 次删除
  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);
             wordEndLength = length - getCursorAdvance(bmChar, prevCharID, ratio);
          }
          }
 
 
-         if (length > mSize.x && wordEnd > start)
+         if (length > mSize.x && wordEnd > start && start != -1)
          {
          {
             mLine.back().mEnd = wordEnd;
             mLine.back().mEnd = wordEnd;
             U32 endCharID = mText.getChar(wordEnd);
             U32 endCharID = mText.getChar(wordEnd);