[CCLabel] Apply updateContent() for getStringNumLines() when Label is dirty

This commit is contained in:
toma 2014-09-25 01:46:17 +09:00
parent 14f92759a4
commit d1faf75b58
2 changed files with 10 additions and 1 deletions

View File

@ -1226,6 +1226,15 @@ void Label::computeStringNumLines()
_currNumLines = quantityOfLines; _currNumLines = quantityOfLines;
} }
int Label::getStringNumLines() const {
if (_contentDirty)
{
const_cast<Label*>(this)->updateContent();
}
return _currNumLines;
}
int Label::getStringLength() const int Label::getStringLength() const
{ {
return static_cast<int>(_currentUTF16String.length()); return static_cast<int>(_currentUTF16String.length());

View File

@ -235,7 +235,7 @@ public:
float getAdditionalKerning() const; float getAdditionalKerning() const;
// string related stuff // string related stuff
int getStringNumLines() const { return _currNumLines;} int getStringNumLines() const;
int getStringLength() const; int getStringLength() const;
FontAtlas* getFontAtlas() { return _fontAtlas; } FontAtlas* getFontAtlas() { return _fontAtlas; }