mirror of https://github.com/axmolengine/axmol.git
issue #4660:remove unnecessary API.
This commit is contained in:
parent
645a9761c8
commit
4692c67b78
|
@ -301,7 +301,7 @@ void Label::reset()
|
||||||
TTFConfig temp;
|
TTFConfig temp;
|
||||||
_fontConfig = temp;
|
_fontConfig = temp;
|
||||||
|
|
||||||
_fontDirty = false;
|
_systemFontDirty = false;
|
||||||
_systemFont = "Helvetica";
|
_systemFont = "Helvetica";
|
||||||
_systemFontSize = 12;
|
_systemFontSize = 12;
|
||||||
|
|
||||||
|
@ -472,6 +472,13 @@ void Label::setString(const std::string& text)
|
||||||
{
|
{
|
||||||
_originalUTF8String = text;
|
_originalUTF8String = text;
|
||||||
_contentDirty = true;
|
_contentDirty = true;
|
||||||
|
|
||||||
|
std::u16string utf16String;
|
||||||
|
if (StringUtils::UTF8ToUTF16(_originalUTF8String, utf16String))
|
||||||
|
{
|
||||||
|
_originalUTF16String = utf16String;
|
||||||
|
_currentUTF16String = utf16String;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Label::setAlignment(TextHAlignment hAlignment,TextVAlignment vAlignment)
|
void Label::setAlignment(TextHAlignment hAlignment,TextVAlignment vAlignment)
|
||||||
|
@ -646,25 +653,6 @@ bool Label::computeHorizontalKernings(const std::u16string& stringToRender)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Label::setOriginalString(const std::u16string& stringToSet)
|
|
||||||
{
|
|
||||||
_originalUTF16String = stringToSet;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Label::setCurrentString(const std::u16string& stringToSet)
|
|
||||||
{
|
|
||||||
_currentUTF16String = stringToSet;
|
|
||||||
computeStringNumLines();
|
|
||||||
|
|
||||||
// compute the advances
|
|
||||||
if (_fontAtlas)
|
|
||||||
{
|
|
||||||
computeHorizontalKernings(stringToSet);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Label::updateQuads()
|
void Label::updateQuads()
|
||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
|
@ -939,11 +927,10 @@ void Label::setFontDefinition(const FontDefinition& textDefinition)
|
||||||
|
|
||||||
void Label::updateContent()
|
void Label::updateContent()
|
||||||
{
|
{
|
||||||
std::u16string utf16String;
|
computeStringNumLines();
|
||||||
if (StringUtils::UTF8ToUTF16(_originalUTF8String, utf16String))
|
if (_fontAtlas)
|
||||||
{
|
{
|
||||||
setCurrentString(utf16String);
|
computeHorizontalKernings(_originalUTF16String);
|
||||||
setOriginalString(utf16String);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_textSprite)
|
if (_textSprite)
|
||||||
|
@ -1019,7 +1006,7 @@ void Label::updateFont()
|
||||||
}
|
}
|
||||||
|
|
||||||
_contentDirty = true;
|
_contentDirty = true;
|
||||||
_fontDirty = false;
|
_systemFontDirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Label::drawTextSprite(Renderer *renderer, bool parentTransformUpdated)
|
void Label::drawTextSprite(Renderer *renderer, bool parentTransformUpdated)
|
||||||
|
@ -1058,7 +1045,7 @@ void Label::visit(Renderer *renderer, const Matrix &parentTransform, bool parent
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_fontDirty)
|
if (_systemFontDirty)
|
||||||
{
|
{
|
||||||
updateFont();
|
updateFont();
|
||||||
}
|
}
|
||||||
|
@ -1119,7 +1106,7 @@ void Label::setSystemFontName(const std::string& systemFont)
|
||||||
if (systemFont != _systemFont)
|
if (systemFont != _systemFont)
|
||||||
{
|
{
|
||||||
_systemFont = systemFont;
|
_systemFont = systemFont;
|
||||||
_fontDirty = true;
|
_systemFontDirty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1128,16 +1115,15 @@ void Label::setSystemFontSize(float fontSize)
|
||||||
if (_systemFontSize != fontSize)
|
if (_systemFontSize != fontSize)
|
||||||
{
|
{
|
||||||
_systemFontSize = fontSize;
|
_systemFontSize = fontSize;
|
||||||
_fontDirty = true;
|
_systemFontDirty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///// PROTOCOL STUFF
|
///// PROTOCOL STUFF
|
||||||
Sprite * Label::getLetter(int letterIndex)
|
Sprite * Label::getLetter(int letterIndex)
|
||||||
{
|
{
|
||||||
if (_fontDirty)
|
if (_systemFontDirty || _currentLabelType == LabelType::STRING_TEXTURE)
|
||||||
{
|
{
|
||||||
updateFont();
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1313,7 +1299,7 @@ std::string Label::getDescription() const
|
||||||
|
|
||||||
const Size& Label::getContentSize() const
|
const Size& Label::getContentSize() const
|
||||||
{
|
{
|
||||||
if (_fontDirty)
|
if (_systemFontDirty)
|
||||||
{
|
{
|
||||||
const_cast<Label*>(this)->updateFont();
|
const_cast<Label*>(this)->updateFont();
|
||||||
}
|
}
|
||||||
|
|
|
@ -287,8 +287,7 @@ protected:
|
||||||
virtual void alignText();
|
virtual void alignText();
|
||||||
|
|
||||||
bool computeHorizontalKernings(const std::u16string& stringToRender);
|
bool computeHorizontalKernings(const std::u16string& stringToRender);
|
||||||
bool setCurrentString(const std::u16string& stringToSet);
|
|
||||||
bool setOriginalString(const std::u16string& stringToSet);
|
|
||||||
void computeStringNumLines();
|
void computeStringNumLines();
|
||||||
|
|
||||||
void updateQuads();
|
void updateQuads();
|
||||||
|
@ -311,7 +310,7 @@ protected:
|
||||||
bool _isOpacityModifyRGB;
|
bool _isOpacityModifyRGB;
|
||||||
bool _contentDirty;
|
bool _contentDirty;
|
||||||
|
|
||||||
bool _fontDirty;
|
bool _systemFontDirty;
|
||||||
std::string _systemFont;
|
std::string _systemFont;
|
||||||
float _systemFontSize;
|
float _systemFontSize;
|
||||||
LabelType _currentLabelType;
|
LabelType _currentLabelType;
|
||||||
|
|
|
@ -34,9 +34,7 @@ NS_CC_BEGIN
|
||||||
|
|
||||||
bool LabelTextFormatter::multilineText(Label *theLabel)
|
bool LabelTextFormatter::multilineText(Label *theLabel)
|
||||||
{
|
{
|
||||||
//int strLen = theLabel->getStringLength();
|
|
||||||
auto limit = theLabel->_limitShowCount;
|
auto limit = theLabel->_limitShowCount;
|
||||||
|
|
||||||
auto strWhole = theLabel->_currentUTF16String;
|
auto strWhole = theLabel->_currentUTF16String;
|
||||||
|
|
||||||
std::vector<char16_t> multiline_string;
|
std::vector<char16_t> multiline_string;
|
||||||
|
@ -175,7 +173,9 @@ bool LabelTextFormatter::multilineText(Label *theLabel)
|
||||||
|
|
||||||
std::u16string strNew(multiline_string.begin(), multiline_string.end());
|
std::u16string strNew(multiline_string.begin(), multiline_string.end());
|
||||||
|
|
||||||
theLabel->setCurrentString(strNew);
|
theLabel->_originalUTF16String = strNew;
|
||||||
|
theLabel->computeStringNumLines();
|
||||||
|
theLabel->computeHorizontalKernings(theLabel->_originalUTF16String);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue