mirror of https://github.com/axmolengine/axmol.git
Merge branch 'v3' of https://github.com/cocos2d/cocos2d-x into v3_combine_2d
Conflicts: cocos/2d/CCFontFNT.h
This commit is contained in:
commit
89ef6da5b5
|
@ -1,5 +1,7 @@
|
|||
cocos2d-x-3.10 December ? 2015
|
||||
[NEW] Core: Added Application::getVersion() to get the app version.
|
||||
[NEW] UI: Add PageView indicator.
|
||||
[NEW] Label: Add three Overflow type to new label, see release note for more information.
|
||||
|
||||
[REFINE] UI: RichText support new line element.
|
||||
[REFINE] UI: Set focus to Widget when touched.
|
||||
|
|
|
@ -157,6 +157,18 @@ void FontAtlas::addLetterDefinition(char16_t utf16Char, const FontLetterDefiniti
|
|||
_letterDefinitions[utf16Char] = letterDefinition;
|
||||
}
|
||||
|
||||
void FontAtlas::scaleFontLetterDefinition(float scaleFactor)
|
||||
{
|
||||
for (auto&& fontDefinition : _letterDefinitions) {
|
||||
auto& letterDefinition = fontDefinition.second;
|
||||
letterDefinition.width *= scaleFactor;
|
||||
letterDefinition.height *= scaleFactor;
|
||||
letterDefinition.offsetX *= scaleFactor;
|
||||
letterDefinition.offsetY *= scaleFactor;
|
||||
letterDefinition.xAdvance *= scaleFactor;
|
||||
}
|
||||
}
|
||||
|
||||
bool FontAtlas::getLetterDefinitionForChar(char16_t utf16Char, FontLetterDefinition &letterDefinition)
|
||||
{
|
||||
auto outIterator = _letterDefinitions.find(utf16Char);
|
||||
|
|
|
@ -115,6 +115,13 @@ protected:
|
|||
|
||||
void conversionU16TOGB2312(const std::u16string& u16Text, std::unordered_map<unsigned short, unsigned short>& charCodeMap);
|
||||
|
||||
/**
|
||||
* Scale each font letter by scaleFactor.
|
||||
*
|
||||
* @param scaleFactor A float scale factor for scaling font letter info.
|
||||
*/
|
||||
void scaleFontLetterDefinition(float scaleFactor);
|
||||
|
||||
std::unordered_map<ssize_t, Texture2D*> _atlasTextures;
|
||||
std::unordered_map<char16_t, FontLetterDefinition> _letterDefinitions;
|
||||
float _lineHeight;
|
||||
|
|
|
@ -119,6 +119,8 @@ public://@public
|
|||
|
||||
// Character Set defines the letters that actually exist in the font
|
||||
std::set<unsigned int> *_characterSet;
|
||||
//! Font Size
|
||||
int _fontSize;
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
|
@ -225,6 +227,7 @@ BMFontConfiguration::BMFontConfiguration()
|
|||
, _commonHeight(0)
|
||||
, _kerningDictionary(nullptr)
|
||||
, _characterSet(nullptr)
|
||||
, _fontSize(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -539,7 +542,7 @@ void BMFontConfiguration::parseInfoArguments(const char* line)
|
|||
// info face="Script" size=32 bold=0 italic=0 charset="" unicode=1 stretchH=100 smooth=1 aa=1 padding=1,4,3,2 spacing=0,0 outline=0
|
||||
// info face="Cracked" size=36 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=1,1
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
sscanf(strstr(line, "size=") + 5, "%d", &_fontSize);
|
||||
// padding
|
||||
sscanf(strstr(line,"padding=") + 8, "%d,%d,%d,%d", &_padding.top, &_padding.right, &_padding.bottom, &_padding.left);
|
||||
//CCLOG("cocos2d: padding: %d,%d,%d,%d", _padding.left, _padding.top, _padding.right, _padding.bottom);
|
||||
|
@ -647,7 +650,7 @@ FontFNT * FontFNT::create(const std::string& fntFilePath, const Vec2& imageOffse
|
|||
}
|
||||
|
||||
FontFNT *tempFont = new FontFNT(newConf,imageOffset);
|
||||
|
||||
tempFont->setFontSize(newConf->_fontSize);
|
||||
if (!tempFont)
|
||||
{
|
||||
return nullptr;
|
||||
|
@ -716,6 +719,16 @@ int FontFNT::getHorizontalKerningForChars(unsigned short firstChar, unsigned sh
|
|||
return ret;
|
||||
}
|
||||
|
||||
void FontFNT::setFontSize(float fontSize)
|
||||
{
|
||||
_fontSize = fontSize;
|
||||
}
|
||||
|
||||
int FontFNT::getOriginalFontSize()const
|
||||
{
|
||||
return _configuration->_fontSize;
|
||||
}
|
||||
|
||||
FontAtlas * FontFNT::createFontAtlas()
|
||||
{
|
||||
FontAtlas *tempAtlas = new (std::nothrow) FontAtlas(*this);
|
||||
|
@ -734,7 +747,16 @@ FontAtlas * FontFNT::createFontAtlas()
|
|||
return nullptr;
|
||||
|
||||
// common height
|
||||
tempAtlas->setLineHeight(_configuration->_commonHeight);
|
||||
int originalFontSize = _configuration->_fontSize;
|
||||
float originalLineHeight = _configuration->_commonHeight;
|
||||
float factor = 0.0f;
|
||||
if (fabs(_fontSize - originalFontSize) < FLT_EPSILON) {
|
||||
factor = 1.0f;
|
||||
}else {
|
||||
factor = _fontSize / originalFontSize;
|
||||
}
|
||||
|
||||
tempAtlas->setLineHeight(originalLineHeight * factor);
|
||||
|
||||
|
||||
BMFontDef fontDef;
|
||||
|
|
|
@ -46,6 +46,8 @@ public:
|
|||
static void purgeCachedData();
|
||||
virtual int* getHorizontalKerningForTextUTF16(const std::u16string& text, int &outNumLetters) const override;
|
||||
virtual FontAtlas *createFontAtlas() override;
|
||||
void setFontSize(float fontSize);
|
||||
int getOriginalFontSize()const;
|
||||
|
||||
static void reloadBMFontResource(const std::string& fntFilePath);
|
||||
|
||||
|
@ -64,7 +66,8 @@ private:
|
|||
|
||||
BMFontConfiguration * _configuration;
|
||||
Vec2 _imageOffset;
|
||||
|
||||
//User defined font size
|
||||
float _fontSize;
|
||||
};
|
||||
|
||||
/// @endcond
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "base/CCEventListenerCustom.h"
|
||||
#include "base/CCEventDispatcher.h"
|
||||
#include "base/CCEventCustom.h"
|
||||
#include "2d/CCFontFNT.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
@ -472,6 +473,12 @@ void Label::reset()
|
|||
_blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;
|
||||
_isOpacityModifyRGB = false;
|
||||
_insideBounds = true;
|
||||
_enableWrap = true;
|
||||
_bmFontSize = -1;
|
||||
_bmfontScale = 1.0f;
|
||||
_overflow = Overflow::NORMAL;
|
||||
_originalFontSize = 0.0f;
|
||||
|
||||
}
|
||||
|
||||
void Label::updateShaderProgram()
|
||||
|
@ -548,46 +555,37 @@ void Label::setFontAtlas(FontAtlas* atlas,bool distanceFieldEnabled /* = false *
|
|||
|
||||
bool Label::setTTFConfig(const TTFConfig& ttfConfig)
|
||||
{
|
||||
FontAtlas *newAtlas = FontAtlasCache::getFontAtlasTTF(&ttfConfig);
|
||||
|
||||
if (!newAtlas)
|
||||
{
|
||||
reset();
|
||||
return false;
|
||||
}
|
||||
_systemFontDirty = false;
|
||||
|
||||
_currentLabelType = LabelType::TTF;
|
||||
setFontAtlas(newAtlas,ttfConfig.distanceFieldEnabled,true);
|
||||
|
||||
_fontConfig = ttfConfig;
|
||||
if (_fontConfig.outlineSize > 0)
|
||||
{
|
||||
_fontConfig.distanceFieldEnabled = false;
|
||||
_useDistanceField = false;
|
||||
_useA8Shader = false;
|
||||
_currLabelEffect = LabelEffect::OUTLINE;
|
||||
updateShaderProgram();
|
||||
}
|
||||
else
|
||||
{
|
||||
_currLabelEffect = LabelEffect::NORMAL;
|
||||
updateShaderProgram();
|
||||
}
|
||||
|
||||
return true;
|
||||
_originalFontSize = ttfConfig.fontSize;
|
||||
return setTTFConfigInternal(ttfConfig);
|
||||
}
|
||||
|
||||
bool Label::setBMFontFilePath(const std::string& bmfontFilePath, const Vec2& imageOffset /* = Vec2::ZERO */)
|
||||
bool Label::setBMFontFilePath(const std::string& bmfontFilePath, const Vec2& imageOffset, float fontSize)
|
||||
{
|
||||
FontAtlas *newAtlas = FontAtlasCache::getFontAtlasFNT(bmfontFilePath,imageOffset);
|
||||
|
||||
|
||||
if (!newAtlas)
|
||||
{
|
||||
reset();
|
||||
return false;
|
||||
}
|
||||
|
||||
//asign the default fontSize
|
||||
if (fabs(fontSize) < FLT_EPSILON) {
|
||||
FontFNT *bmFont = (FontFNT*)newAtlas->getFont();
|
||||
if (bmFont) {
|
||||
float originalFontSize = bmFont->getOriginalFontSize();
|
||||
if(fabs(_bmFontSize+1) < FLT_EPSILON){
|
||||
_bmFontSize = originalFontSize / CC_CONTENT_SCALE_FACTOR();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(fontSize > 0.0f){
|
||||
_bmFontSize = fontSize;
|
||||
}
|
||||
|
||||
_bmFontPath = bmfontFilePath;
|
||||
|
||||
_currentLabelType = LabelType::BMFONT;
|
||||
setFontAtlas(newAtlas);
|
||||
|
||||
|
@ -631,6 +629,9 @@ void Label::setMaxLineWidth(float maxLineWidth)
|
|||
|
||||
void Label::setDimensions(float width, float height)
|
||||
{
|
||||
if(_overflow == Overflow::RESIZE_HEIGHT){
|
||||
height = 0;
|
||||
}
|
||||
if (height != _labelHeight || width != _labelWidth)
|
||||
{
|
||||
_labelWidth = width;
|
||||
|
@ -640,7 +641,26 @@ void Label::setDimensions(float width, float height)
|
|||
|
||||
_maxLineWidth = width;
|
||||
_contentDirty = true;
|
||||
}
|
||||
|
||||
if(_overflow == Overflow::SHRINK){
|
||||
if (_originalFontSize > 0) {
|
||||
this->restoreFontSize();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Label::restoreFontSize()
|
||||
{
|
||||
if(_currentLabelType == LabelType::TTF){
|
||||
auto ttfConfig = this->getTTFConfig();
|
||||
ttfConfig.fontSize = _originalFontSize;
|
||||
this->setTTFConfigInternal(ttfConfig);
|
||||
}else if(_currentLabelType == LabelType::BMFONT){
|
||||
this->setBMFontSizeInternal(_originalFontSize);
|
||||
}else if(_currentLabelType == LabelType::STRING_TEXTURE){
|
||||
this->setSystemFontSize(_originalFontSize);
|
||||
}
|
||||
}
|
||||
|
||||
void Label::setLineBreakWithoutSpace(bool breakWithoutSpace)
|
||||
|
@ -679,6 +699,8 @@ void Label::updateLabelLetters()
|
|||
uvRect.origin.x = letterDef.U;
|
||||
uvRect.origin.y = letterDef.V;
|
||||
|
||||
auto batchNode = _batchNodes.at(letterDef.textureID);
|
||||
letterSprite->setTextureAtlas(batchNode->getTextureAtlas());
|
||||
letterSprite->setTexture(_fontAtlas->getTexture(letterDef.textureID));
|
||||
if (letterDef.width <= 0.f || letterDef.height <= 0.f)
|
||||
{
|
||||
|
@ -695,61 +717,81 @@ void Label::updateLabelLetters()
|
|||
auto py = letterInfo.positionY - letterDef.height / 2 + _letterOffsetY;
|
||||
letterSprite->setPosition(px, py);
|
||||
|
||||
this->updateLetterSpriteScale(letterSprite);
|
||||
++it;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Label::alignText()
|
||||
bool Label::alignText()
|
||||
{
|
||||
if (_fontAtlas == nullptr || _utf16Text.empty())
|
||||
{
|
||||
setContentSize(Size::ZERO);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
_fontAtlas->prepareLetterDefinitions(_utf16Text);
|
||||
auto& textures = _fontAtlas->getTextures();
|
||||
if (textures.size() > _batchNodes.size())
|
||||
{
|
||||
for (auto index = _batchNodes.size(); index < textures.size(); ++index)
|
||||
bool ret = true;
|
||||
do {
|
||||
_fontAtlas->prepareLetterDefinitions(_utf16Text);
|
||||
auto& textures = _fontAtlas->getTextures();
|
||||
if (textures.size() > _batchNodes.size())
|
||||
{
|
||||
auto batchNode = SpriteBatchNode::createWithTexture(textures.at(index));
|
||||
if (batchNode)
|
||||
for (auto index = _batchNodes.size(); index < textures.size(); ++index)
|
||||
{
|
||||
_isOpacityModifyRGB = batchNode->getTexture()->hasPremultipliedAlpha();
|
||||
_blendFunc = batchNode->getBlendFunc();
|
||||
batchNode->setAnchorPoint(Vec2::ANCHOR_TOP_LEFT);
|
||||
batchNode->setPosition(Vec2::ZERO);
|
||||
_batchNodes.pushBack(batchNode);
|
||||
auto batchNode = SpriteBatchNode::createWithTexture(textures.at(index));
|
||||
if (batchNode)
|
||||
{
|
||||
_isOpacityModifyRGB = batchNode->getTexture()->hasPremultipliedAlpha();
|
||||
_blendFunc = batchNode->getBlendFunc();
|
||||
batchNode->setAnchorPoint(Vec2::ANCHOR_TOP_LEFT);
|
||||
batchNode->setPosition(Vec2::ZERO);
|
||||
_batchNodes.pushBack(batchNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_batchNodes.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
_reusedLetter->setBatchNode(_batchNodes.at(0));
|
||||
if (_batchNodes.empty())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
_reusedLetter->setBatchNode(_batchNodes.at(0));
|
||||
|
||||
_lengthOfString = 0;
|
||||
_textDesiredHeight = 0.f;
|
||||
_linesWidth.clear();
|
||||
if (_maxLineWidth > 0.f && !_lineBreakWithoutSpaces)
|
||||
{
|
||||
multilineTextWrapByWord();
|
||||
}
|
||||
else
|
||||
{
|
||||
multilineTextWrapByChar();
|
||||
}
|
||||
computeAlignmentOffset();
|
||||
|
||||
_lengthOfString = 0;
|
||||
_textDesiredHeight = 0.f;
|
||||
_linesWidth.clear();
|
||||
if (_maxLineWidth > 0.f && !_lineBreakWithoutSpaces)
|
||||
{
|
||||
multilineTextWrapByWord();
|
||||
}
|
||||
else
|
||||
{
|
||||
multilineTextWrapByChar();
|
||||
}
|
||||
computeAlignmentOffset();
|
||||
if(_overflow == Overflow::SHRINK){
|
||||
float fontSize = this->getRenderingFontSize();
|
||||
|
||||
updateQuads();
|
||||
if(fontSize > 0 && isVerticalClamp()){
|
||||
this->shrinkLabelToContentSize(CC_CALLBACK_0(Label::isVerticalClamp, this));
|
||||
}
|
||||
}
|
||||
|
||||
updateLabelLetters();
|
||||
if(!updateQuads()){
|
||||
ret = false;
|
||||
if(!_enableWrap && _overflow == Overflow::SHRINK){
|
||||
this->shrinkLabelToContentSize(CC_CALLBACK_0(Label::isHorizontalClamp, this));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
updateLabelLetters();
|
||||
|
||||
updateColor();
|
||||
}while (0);
|
||||
|
||||
updateColor();
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool Label::computeHorizontalKernings(const std::u16string& stringToRender)
|
||||
|
@ -769,13 +811,15 @@ bool Label::computeHorizontalKernings(const std::u16string& stringToRender)
|
|||
return true;
|
||||
}
|
||||
|
||||
void Label::updateQuads()
|
||||
bool Label::updateQuads()
|
||||
{
|
||||
bool ret = true;
|
||||
for (auto&& batchNode : _batchNodes)
|
||||
{
|
||||
batchNode->getTextureAtlas()->removeAllQuads();
|
||||
}
|
||||
|
||||
bool letterClamp = false;
|
||||
for (int ctr = 0; ctr < _lengthOfString; ++ctr)
|
||||
{
|
||||
if (_lettersInfo[ctr].valid)
|
||||
|
@ -802,16 +846,107 @@ void Label::updateQuads()
|
|||
}
|
||||
}
|
||||
|
||||
if(!_enableWrap){
|
||||
auto px = _lettersInfo[ctr].positionX + letterDef.width/2 + _linesOffsetX[_lettersInfo[ctr].lineIndex];
|
||||
if(_labelWidth > 0.f){
|
||||
if (px > _contentSize.width || px < 0) {
|
||||
if(_overflow == Overflow::CLAMP){
|
||||
_reusedRect.size.width = 0;
|
||||
}else if(_overflow == Overflow::SHRINK){
|
||||
if (letterDef.width > 0
|
||||
&& _contentSize.width > letterDef.width) {
|
||||
letterClamp = true;
|
||||
ret = false;
|
||||
break;
|
||||
}else{
|
||||
//clamp
|
||||
_reusedRect.size.width = 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_reusedRect.size.height > 0.f && _reusedRect.size.width > 0.f)
|
||||
{
|
||||
_reusedLetter->setTextureRect(_reusedRect, false, _reusedRect.size);
|
||||
_reusedLetter->setPosition(_lettersInfo[ctr].positionX + _linesOffsetX[_lettersInfo[ctr].lineIndex], py);
|
||||
float letterPositionX = _lettersInfo[ctr].positionX + _linesOffsetX[_lettersInfo[ctr].lineIndex];
|
||||
_reusedLetter->setPosition(letterPositionX, py);
|
||||
auto index = static_cast<int>(_batchNodes.at(letterDef.textureID)->getTextureAtlas()->getTotalQuads());
|
||||
_lettersInfo[ctr].atlasIndex = index;
|
||||
|
||||
this->updateLetterSpriteScale(_reusedLetter);
|
||||
|
||||
_batchNodes.at(letterDef.textureID)->insertQuadFromSprite(_reusedLetter, index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool Label::setTTFConfigInternal(const TTFConfig& ttfConfig)
|
||||
{
|
||||
FontAtlas *newAtlas = FontAtlasCache::getFontAtlasTTF(&ttfConfig);
|
||||
|
||||
if (!newAtlas)
|
||||
{
|
||||
reset();
|
||||
return false;
|
||||
}
|
||||
_systemFontDirty = false;
|
||||
|
||||
_currentLabelType = LabelType::TTF;
|
||||
setFontAtlas(newAtlas,ttfConfig.distanceFieldEnabled,true);
|
||||
|
||||
_fontConfig = ttfConfig;
|
||||
|
||||
if (_fontConfig.outlineSize > 0)
|
||||
{
|
||||
_fontConfig.distanceFieldEnabled = false;
|
||||
_useDistanceField = false;
|
||||
_useA8Shader = false;
|
||||
_currLabelEffect = LabelEffect::OUTLINE;
|
||||
updateShaderProgram();
|
||||
}
|
||||
else
|
||||
{
|
||||
_currLabelEffect = LabelEffect::NORMAL;
|
||||
updateShaderProgram();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void Label::setBMFontSizeInternal(float fontSize)
|
||||
{
|
||||
if(_currentLabelType == LabelType::BMFONT){
|
||||
this->setBMFontFilePath(_bmFontPath, Vec2::ZERO, fontSize);
|
||||
_contentDirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
void Label::scaleFontSizeDown(float fontSize)
|
||||
{
|
||||
bool shouldUpdateContent = true;
|
||||
if(_currentLabelType == LabelType::TTF){
|
||||
auto ttfConfig = this->getTTFConfig();
|
||||
ttfConfig.fontSize = fontSize;
|
||||
this->setTTFConfigInternal(ttfConfig);
|
||||
}else if(_currentLabelType == LabelType::BMFONT){
|
||||
if (fabs(fontSize) < FLT_EPSILON) {
|
||||
fontSize = 0.1f;
|
||||
shouldUpdateContent = false;
|
||||
}
|
||||
this->setBMFontSizeInternal(fontSize);
|
||||
}else if (_currentLabelType == LabelType::STRING_TEXTURE){
|
||||
this->setSystemFontSize(fontSize);
|
||||
}
|
||||
|
||||
if (shouldUpdateContent) {
|
||||
this->updateContent();
|
||||
}
|
||||
}
|
||||
|
||||
void Label::enableGlow(const Color4B& glowColor)
|
||||
|
@ -1102,6 +1237,7 @@ void Label::updateContent()
|
|||
|
||||
CC_SAFE_RELEASE_NULL(_textSprite);
|
||||
CC_SAFE_RELEASE_NULL(_shadowNode);
|
||||
bool updateFinished = true;
|
||||
|
||||
if (_fontAtlas)
|
||||
{
|
||||
|
@ -1112,7 +1248,7 @@ void Label::updateContent()
|
|||
}
|
||||
|
||||
computeHorizontalKernings(_utf16Text);
|
||||
alignText();
|
||||
updateFinished = alignText();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1123,7 +1259,9 @@ void Label::updateContent()
|
|||
createShadowSpriteForSystemFont(fontDef);
|
||||
}
|
||||
}
|
||||
_contentDirty = false;
|
||||
if(updateFinished){
|
||||
_contentDirty = false;
|
||||
}
|
||||
|
||||
#if CC_LABEL_DEBUG_DRAW
|
||||
_debugDrawNode->clear();
|
||||
|
@ -1138,6 +1276,17 @@ void Label::updateContent()
|
|||
#endif
|
||||
}
|
||||
|
||||
void Label::setBMFontSize(float fontSize)
|
||||
{
|
||||
this->setBMFontSizeInternal(fontSize);
|
||||
_originalFontSize = fontSize;
|
||||
}
|
||||
|
||||
float Label::getBMFontSize()const
|
||||
{
|
||||
return _bmFontSize;
|
||||
}
|
||||
|
||||
void Label::onDrawShadow(GLProgram* glProgram)
|
||||
{
|
||||
if (_currentLabelType == LabelType::TTF)
|
||||
|
@ -1381,6 +1530,7 @@ void Label::setSystemFontSize(float fontSize)
|
|||
if (_systemFontSize != fontSize)
|
||||
{
|
||||
_systemFontSize = fontSize;
|
||||
_originalFontSize = fontSize;
|
||||
_systemFontDirty = true;
|
||||
}
|
||||
}
|
||||
|
@ -1463,21 +1613,21 @@ void Label::setLineHeight(float height)
|
|||
float Label::getLineHeight() const
|
||||
{
|
||||
CCASSERT(_currentLabelType != LabelType::STRING_TEXTURE, "Not supported system font!");
|
||||
return _textSprite ? 0.0f : _lineHeight;
|
||||
return _textSprite ? 0.0f : _lineHeight * _bmfontScale;
|
||||
}
|
||||
|
||||
void Label::setLineSpacing(float height)
|
||||
{
|
||||
if (_lineSpacing != height)
|
||||
{
|
||||
_lineSpacing = height;
|
||||
_contentDirty = true;
|
||||
}
|
||||
if (_lineSpacing != height)
|
||||
{
|
||||
_lineSpacing = height;
|
||||
_contentDirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
float Label::getLineSpacing() const
|
||||
{
|
||||
return _lineSpacing;
|
||||
return _lineSpacing;
|
||||
}
|
||||
|
||||
void Label::setAdditionalKerning(float space)
|
||||
|
@ -1753,4 +1903,99 @@ void Label::setGlobalZOrder(float globalZOrder)
|
|||
}
|
||||
}
|
||||
|
||||
float Label::getRenderingFontSize()const
|
||||
{
|
||||
float fontSize;
|
||||
if (_currentLabelType == LabelType::BMFONT) {
|
||||
fontSize = _bmFontSize;
|
||||
}else if(_currentLabelType == LabelType::TTF){
|
||||
fontSize = this->getTTFConfig().fontSize;
|
||||
}else if(_currentLabelType == LabelType::STRING_TEXTURE){
|
||||
fontSize = _systemFontSize;
|
||||
}else{ //FIXME: find a way to caculate char map font size
|
||||
fontSize = this->getLineHeight();
|
||||
}
|
||||
return fontSize;
|
||||
}
|
||||
|
||||
void Label::enableWrap(bool enable)
|
||||
{
|
||||
if(enable == _enableWrap || _overflow == Overflow::RESIZE_HEIGHT
|
||||
|| _currentLabelType == LabelType::STRING_TEXTURE){
|
||||
return;
|
||||
}
|
||||
|
||||
this->_enableWrap = enable;
|
||||
|
||||
this->rescaleWithOriginalFontSize();
|
||||
|
||||
_contentDirty = true;
|
||||
}
|
||||
|
||||
bool Label::isWrapEnabled()const
|
||||
{
|
||||
return this->_enableWrap;
|
||||
}
|
||||
|
||||
void Label::setOverflow(Overflow overflow)
|
||||
{
|
||||
if(_overflow == overflow){
|
||||
return;
|
||||
}
|
||||
|
||||
if (_currentLabelType == LabelType::CHARMAP) {
|
||||
if (overflow == Overflow::SHRINK) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (_currentLabelType == LabelType::STRING_TEXTURE) {
|
||||
if (overflow == Overflow::CLAMP || overflow == Overflow::SHRINK) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(overflow == Overflow::RESIZE_HEIGHT){
|
||||
this->setDimensions(_labelDimensions.width,0);
|
||||
this->enableWrap(true);
|
||||
}
|
||||
_overflow = overflow;
|
||||
|
||||
this->rescaleWithOriginalFontSize();
|
||||
|
||||
_contentDirty = true;
|
||||
}
|
||||
|
||||
void Label::rescaleWithOriginalFontSize()
|
||||
{
|
||||
auto renderingFontSize = this->getRenderingFontSize();
|
||||
if (_originalFontSize - renderingFontSize >= 1) {
|
||||
this->scaleFontSizeDown(_originalFontSize);
|
||||
}
|
||||
}
|
||||
|
||||
Label::Overflow Label::getOverflow()const
|
||||
{
|
||||
return _overflow;
|
||||
}
|
||||
|
||||
void Label::updateLetterSpriteScale(Sprite* sprite)
|
||||
{
|
||||
if (_currentLabelType == LabelType::BMFONT && _bmFontSize > 0)
|
||||
{
|
||||
sprite->setScale(_bmfontScale);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(fabs(_bmFontSize)<FLT_EPSILON)
|
||||
{
|
||||
sprite->setScale(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprite->setScale(1.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -95,6 +95,23 @@ class EventListenerCustom;
|
|||
class CC_DLL Label : public Node, public LabelProtocol, public BlendProtocol
|
||||
{
|
||||
public:
|
||||
enum class Overflow
|
||||
{
|
||||
//for keep back compatibility
|
||||
NORMAL,
|
||||
/**
|
||||
* In SHRINK mode, the font size will change dynamically to adapt the content size.
|
||||
*/
|
||||
SHRINK,
|
||||
/**
|
||||
*In CLAMP mode, when label content goes out of the bounding box, it will be clipped.
|
||||
*/
|
||||
CLAMP,
|
||||
/**
|
||||
*In RESIZE_HEIGHT mode, you can only change the width of label and the height is changed automatically.
|
||||
*/
|
||||
RESIZE_HEIGHT
|
||||
};
|
||||
/// @name Creators
|
||||
/// @{
|
||||
|
||||
|
@ -221,7 +238,7 @@ public:
|
|||
virtual const TTFConfig& getTTFConfig() const { return _fontConfig;}
|
||||
|
||||
/** Sets a new bitmap font to Label */
|
||||
virtual bool setBMFontFilePath(const std::string& bmfontFilePath, const Vec2& imageOffset = Vec2::ZERO);
|
||||
virtual bool setBMFontFilePath(const std::string& bmfontFilePath, const Vec2& imageOffset = Vec2::ZERO, float fontSize = 0);
|
||||
|
||||
/** Returns the bitmap font used by the Label.*/
|
||||
const std::string& getBMFontFilePath() const { return _bmFontPath;}
|
||||
|
@ -366,12 +383,55 @@ public:
|
|||
*/
|
||||
void setMaxLineWidth(float maxLineWidth);
|
||||
float getMaxLineWidth() { return _maxLineWidth; }
|
||||
/**
|
||||
* Change font size of label type BMFONT
|
||||
* Note: This function only scale the BMFONT letter to mimic the font size change effect.
|
||||
*
|
||||
* @param fontSize The desired font size in float.
|
||||
*/
|
||||
void setBMFontSize(float fontSize);
|
||||
|
||||
/**
|
||||
* Return the user define BMFont size.
|
||||
*
|
||||
* @return The BMFont size in float value.
|
||||
*/
|
||||
float getBMFontSize()const;
|
||||
|
||||
/**
|
||||
* Toggle wrap option of the label.
|
||||
* Note: System font doesn't support manually toggle wrap.
|
||||
*
|
||||
* @param enable Set true to enable wrap and false to disable wrap.
|
||||
*/
|
||||
void enableWrap(bool enable);
|
||||
|
||||
/**
|
||||
* Query the wrap is enabled or not.
|
||||
* Note: System font will always return true.
|
||||
*/
|
||||
bool isWrapEnabled()const;
|
||||
|
||||
/**
|
||||
* Change the label's Overflow type, currently only TTF and BMFont support all the valid Overflow type.
|
||||
* Char Map font supports all the Overflow type except for SHRINK, because we can't measure it's font size.
|
||||
* System font only support Overflow::Normal and Overflow::RESIZE_HEIGHT.
|
||||
*
|
||||
* @param overflow see `Overflow`
|
||||
*/
|
||||
void setOverflow(Overflow overflow);
|
||||
|
||||
/**
|
||||
* Query the label's Overflow type.
|
||||
*
|
||||
* @return see `Overflow`
|
||||
*/
|
||||
Overflow getOverflow()const;
|
||||
/**
|
||||
* Makes the Label exactly this untransformed width.
|
||||
*
|
||||
* The Label's width be used for text align if the value not equal zero.
|
||||
*/
|
||||
*/
|
||||
void setWidth(float width) { setDimensions(width,_labelHeight);}
|
||||
float getWidth() const { return _labelWidth; }
|
||||
|
||||
|
@ -508,21 +568,33 @@ protected:
|
|||
|
||||
bool multilineTextWrapByChar();
|
||||
bool multilineTextWrapByWord();
|
||||
bool multilineTextWrap(std::function<int(const std::u16string&, int, int)> lambda);
|
||||
void shrinkLabelToContentSize(std::function<bool(void)> lambda);
|
||||
bool isHorizontalClamp();
|
||||
bool isVerticalClamp();
|
||||
float getRenderingFontSize()const;
|
||||
void rescaleWithOriginalFontSize();
|
||||
|
||||
void updateLabelLetters();
|
||||
virtual void alignText();
|
||||
virtual bool alignText();
|
||||
void computeAlignmentOffset();
|
||||
bool computeHorizontalKernings(const std::u16string& stringToRender);
|
||||
|
||||
void recordLetterInfo(const cocos2d::Vec2& point, char16_t utf16Char, int letterIndex, int lineIndex);
|
||||
void recordPlaceholderInfo(int letterIndex, char16_t utf16Char);
|
||||
|
||||
void updateQuads();
|
||||
bool updateQuads();
|
||||
|
||||
void createSpriteForSystemFont(const FontDefinition& fontDef);
|
||||
void createShadowSpriteForSystemFont(const FontDefinition& fontDef);
|
||||
|
||||
virtual void updateShaderProgram();
|
||||
void updateBMFontScale();
|
||||
void scaleFontSizeDown(float fontSize);
|
||||
bool setTTFConfigInternal(const TTFConfig& ttfConfig);
|
||||
void setBMFontSizeInternal(float fontSize);
|
||||
void restoreFontSize();
|
||||
void updateLetterSpriteScale(Sprite* sprite);
|
||||
|
||||
void reset();
|
||||
|
||||
|
@ -614,6 +686,12 @@ protected:
|
|||
#if CC_LABEL_DEBUG_DRAW
|
||||
DrawNode* _debugDrawNode;
|
||||
#endif
|
||||
|
||||
bool _enableWrap;
|
||||
float _bmFontSize;
|
||||
float _bmfontScale;
|
||||
Overflow _overflow;
|
||||
float _originalFontSize;
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Label);
|
||||
};
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "base/ccUTF8.h"
|
||||
#include "base/CCDirector.h"
|
||||
#include "2d/CCFontAtlas.h"
|
||||
#include "2d/CCFontFNT.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
@ -71,6 +72,11 @@ void Label::computeAlignmentOffset()
|
|||
}
|
||||
}
|
||||
|
||||
static int getFirstCharLen(const std::u16string& utf16Text, int startIndex, int textLen)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int getFirstWordLen(const std::u16string& utf16Text, int startIndex, int textLen)
|
||||
{
|
||||
auto character = utf16Text[startIndex];
|
||||
|
@ -93,22 +99,36 @@ static int getFirstWordLen(const std::u16string& utf16Text, int startIndex, int
|
|||
return len;
|
||||
}
|
||||
|
||||
bool Label::multilineTextWrapByWord()
|
||||
void Label::updateBMFontScale()
|
||||
{
|
||||
auto font = _fontAtlas->getFont();
|
||||
if (_currentLabelType == LabelType::BMFONT) {
|
||||
FontFNT *bmFont = (FontFNT*)font;
|
||||
float originalFontSize = bmFont->getOriginalFontSize();
|
||||
_bmfontScale = _bmFontSize * CC_CONTENT_SCALE_FACTOR() / originalFontSize;
|
||||
}else{
|
||||
_bmfontScale = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
bool Label::multilineTextWrap(std::function<int(const std::u16string&, int, int)> nextTokenLen)
|
||||
{
|
||||
int textLen = getStringLength();
|
||||
int lineIndex = 0;
|
||||
float nextWordX = 0.f;
|
||||
float nextWordY = 0.f;
|
||||
float nextTokenX = 0.f;
|
||||
float nextTokenY = 0.f;
|
||||
float longestLine = 0.f;
|
||||
float letterRight = 0.f;
|
||||
|
||||
auto contentScaleFactor = CC_CONTENT_SCALE_FACTOR();
|
||||
|
||||
auto contentScaleFactor = CC_CONTENT_SCALE_FACTOR();
|
||||
float lineSpacing = _lineSpacing * contentScaleFactor;
|
||||
float highestY = 0.f;
|
||||
float lowestY = 0.f;
|
||||
FontLetterDefinition letterDef;
|
||||
Vec2 letterPosition;
|
||||
|
||||
this->updateBMFontScale();
|
||||
|
||||
for (int index = 0; index < textLen; )
|
||||
{
|
||||
auto character = _utf16Text[index];
|
||||
|
@ -117,20 +137,20 @@ bool Label::multilineTextWrapByWord()
|
|||
_linesWidth.push_back(letterRight);
|
||||
letterRight = 0.f;
|
||||
lineIndex++;
|
||||
nextWordX = 0.f;
|
||||
nextWordY -= _lineHeight + lineSpacing;
|
||||
nextTokenX = 0.f;
|
||||
nextTokenY -= _lineHeight*_bmfontScale + lineSpacing;
|
||||
recordPlaceholderInfo(index, character);
|
||||
index++;
|
||||
continue;
|
||||
}
|
||||
|
||||
auto wordLen = getFirstWordLen(_utf16Text, index, textLen);
|
||||
float wordHighestY = highestY;;
|
||||
float wordLowestY = lowestY;
|
||||
float wordRight = letterRight;
|
||||
float nextLetterX = nextWordX;
|
||||
|
||||
auto tokenLen = nextTokenLen(_utf16Text, index, textLen);
|
||||
float tokenHighestY = highestY;;
|
||||
float tokenLowestY = lowestY;
|
||||
float tokenRight = letterRight;
|
||||
float nextLetterX = nextTokenX;
|
||||
bool newLine = false;
|
||||
for (int tmp = 0; tmp < wordLen;++tmp)
|
||||
for (int tmp = 0; tmp < tokenLen;++tmp)
|
||||
{
|
||||
int letterIndex = index + tmp;
|
||||
character = _utf16Text[letterIndex];
|
||||
|
@ -145,15 +165,15 @@ bool Label::multilineTextWrapByWord()
|
|||
CCLOG("LabelTextFormatter error:can't find letter definition in font file for letter: %c", character);
|
||||
continue;
|
||||
}
|
||||
|
||||
auto letterX = (nextLetterX + letterDef.offsetX) / contentScaleFactor;
|
||||
if (_maxLineWidth > 0.f && nextWordX > 0.f && letterX + letterDef.width > _maxLineWidth)
|
||||
|
||||
auto letterX = (nextLetterX + letterDef.offsetX * _bmfontScale) / contentScaleFactor;
|
||||
if (_enableWrap && _maxLineWidth > 0.f && nextTokenX > 0.f && letterX + letterDef.width * _bmfontScale > _maxLineWidth)
|
||||
{
|
||||
_linesWidth.push_back(letterRight);
|
||||
letterRight = 0.f;
|
||||
lineIndex++;
|
||||
nextWordX = 0.f;
|
||||
nextWordY -= _lineHeight + lineSpacing;
|
||||
nextTokenX = 0.f;
|
||||
nextTokenY -= (_lineHeight*_bmfontScale + lineSpacing);
|
||||
newLine = true;
|
||||
break;
|
||||
}
|
||||
|
@ -161,42 +181,42 @@ bool Label::multilineTextWrapByWord()
|
|||
{
|
||||
letterPosition.x = letterX;
|
||||
}
|
||||
letterPosition.y = (nextWordY - letterDef.offsetY) / contentScaleFactor;
|
||||
letterPosition.y = (nextTokenY - letterDef.offsetY * _bmfontScale) / contentScaleFactor;
|
||||
recordLetterInfo(letterPosition, character, letterIndex, lineIndex);
|
||||
|
||||
|
||||
if (_horizontalKernings && letterIndex < textLen - 1)
|
||||
nextLetterX += _horizontalKernings[letterIndex + 1];
|
||||
nextLetterX += letterDef.xAdvance + _additionalKerning;
|
||||
|
||||
wordRight = letterPosition.x + letterDef.width;
|
||||
|
||||
if (wordHighestY < letterPosition.y)
|
||||
wordHighestY = letterPosition.y;
|
||||
if (wordLowestY > letterPosition.y - letterDef.height)
|
||||
wordLowestY = letterPosition.y - letterDef.height;
|
||||
nextLetterX += letterDef.xAdvance * _bmfontScale + _additionalKerning;
|
||||
|
||||
tokenRight = letterPosition.x + letterDef.width * _bmfontScale;
|
||||
|
||||
if (tokenHighestY < letterPosition.y)
|
||||
tokenHighestY = letterPosition.y;
|
||||
if (tokenLowestY > letterPosition.y - letterDef.height * _bmfontScale)
|
||||
tokenLowestY = letterPosition.y - letterDef.height * _bmfontScale;
|
||||
}
|
||||
|
||||
if (newLine)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
nextWordX = nextLetterX;
|
||||
letterRight = wordRight;
|
||||
if (highestY < wordHighestY)
|
||||
highestY = wordHighestY;
|
||||
if (lowestY > wordLowestY)
|
||||
lowestY = wordLowestY;
|
||||
|
||||
nextTokenX = nextLetterX;
|
||||
letterRight = tokenRight;
|
||||
if (highestY < tokenHighestY)
|
||||
highestY = tokenHighestY;
|
||||
if (lowestY > tokenLowestY)
|
||||
lowestY = tokenLowestY;
|
||||
if (longestLine < letterRight)
|
||||
longestLine = letterRight;
|
||||
|
||||
index += wordLen;
|
||||
|
||||
index += tokenLen;
|
||||
}
|
||||
|
||||
|
||||
_linesWidth.push_back(letterRight);
|
||||
|
||||
|
||||
_numberOfLines = lineIndex + 1;
|
||||
_textDesiredHeight = (_numberOfLines * _lineHeight) / contentScaleFactor;
|
||||
_textDesiredHeight = (_numberOfLines * _lineHeight * _bmfontScale) / contentScaleFactor;
|
||||
if (_numberOfLines > 1)
|
||||
_textDesiredHeight += (_numberOfLines - 1) * _lineSpacing;
|
||||
Size contentSize(_labelWidth, _labelHeight);
|
||||
|
@ -205,111 +225,100 @@ bool Label::multilineTextWrapByWord()
|
|||
if (_labelHeight <= 0.f)
|
||||
contentSize.height = _textDesiredHeight;
|
||||
setContentSize(contentSize);
|
||||
|
||||
|
||||
_tailoredTopY = contentSize.height;
|
||||
_tailoredBottomY = 0.f;
|
||||
if (highestY > 0.f)
|
||||
_tailoredTopY = contentSize.height + highestY;
|
||||
if (lowestY < -_textDesiredHeight)
|
||||
_tailoredBottomY = _textDesiredHeight + lowestY;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Label::multilineTextWrapByWord()
|
||||
{
|
||||
return multilineTextWrap(std::bind(getFirstWordLen, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
||||
}
|
||||
|
||||
bool Label::multilineTextWrapByChar()
|
||||
{
|
||||
int textLen = getStringLength();
|
||||
int lineIndex = 0;
|
||||
float nextLetterX = 0.f;
|
||||
float nextLetterY = 0.f;
|
||||
float longestLine = 0.f;
|
||||
float letterRight = 0.f;
|
||||
return multilineTextWrap(std::bind(getFirstCharLen, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
||||
}
|
||||
|
||||
auto contentScaleFactor = CC_CONTENT_SCALE_FACTOR();
|
||||
float lineSpacing = _lineSpacing * contentScaleFactor;
|
||||
float highestY = 0.f;
|
||||
float lowestY = 0.f;
|
||||
FontLetterDefinition letterDef;
|
||||
Vec2 letterPosition;
|
||||
|
||||
for (int index = 0; index < textLen; index++)
|
||||
bool Label::isVerticalClamp()
|
||||
{
|
||||
if (_textDesiredHeight > _contentSize.height)
|
||||
{
|
||||
auto character = _utf16Text[index];
|
||||
if (character == '\r')
|
||||
{
|
||||
recordPlaceholderInfo(index, character);
|
||||
continue;
|
||||
}
|
||||
if (character == '\n')
|
||||
{
|
||||
_linesWidth.push_back(letterRight);
|
||||
letterRight = 0.f;
|
||||
lineIndex++;
|
||||
nextLetterX = 0.f;
|
||||
nextLetterY -= _lineHeight + lineSpacing;
|
||||
recordPlaceholderInfo(index, character);
|
||||
continue;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (_fontAtlas->getLetterDefinitionForChar(character, letterDef) == false)
|
||||
bool Label::isHorizontalClamp()
|
||||
{
|
||||
bool letterClamp = false;
|
||||
for (int ctr = 0; ctr < _lengthOfString; ++ctr)
|
||||
{
|
||||
if (_lettersInfo[ctr].valid)
|
||||
{
|
||||
recordPlaceholderInfo(index, character);
|
||||
CCLOG("LabelTextFormatter error:can't find letter definition in font file for letter: %c", character);
|
||||
continue;
|
||||
auto& letterDef = _fontAtlas->_letterDefinitions[_lettersInfo[ctr].utf16Char];
|
||||
|
||||
auto px = _lettersInfo[ctr].positionX + letterDef.width/2;
|
||||
if(_labelWidth > 0.f){
|
||||
if (px > _contentSize.width) {
|
||||
letterClamp = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return letterClamp;
|
||||
}
|
||||
|
||||
auto letterX = (nextLetterX + letterDef.offsetX) / contentScaleFactor;
|
||||
if (_maxLineWidth > 0.f && nextLetterX > 0.f && letterX + letterDef.width > _maxLineWidth)
|
||||
void Label::shrinkLabelToContentSize(std::function<bool(void)> lambda)
|
||||
{
|
||||
float fontSize = this->getRenderingFontSize();
|
||||
|
||||
int i = 0;
|
||||
auto letterDefinition = _fontAtlas->_letterDefinitions;
|
||||
auto tempLetterDefinition = letterDefinition;
|
||||
float originalLineHeight = _lineHeight;
|
||||
bool flag = true;
|
||||
while (lambda()) {
|
||||
++i;
|
||||
float newFontSize = fontSize - i;
|
||||
flag = false;
|
||||
if (newFontSize <= 0) {
|
||||
break;
|
||||
}
|
||||
float scale = newFontSize / fontSize;
|
||||
std::swap(_fontAtlas->_letterDefinitions, tempLetterDefinition);
|
||||
_fontAtlas->scaleFontLetterDefinition(scale);
|
||||
this->setLineHeight(originalLineHeight * scale);
|
||||
if (_maxLineWidth > 0.f && !_lineBreakWithoutSpaces)
|
||||
{
|
||||
_linesWidth.push_back(letterRight);
|
||||
letterRight = 0.f;
|
||||
lineIndex++;
|
||||
nextLetterX = 0.f;
|
||||
nextLetterY -= _lineHeight + lineSpacing;
|
||||
letterPosition.x = letterDef.offsetX / contentScaleFactor;
|
||||
multilineTextWrapByWord();
|
||||
}
|
||||
else
|
||||
{
|
||||
letterPosition.x = letterX;
|
||||
multilineTextWrapByChar();
|
||||
}
|
||||
letterPosition.y = (nextLetterY - letterDef.offsetY) / contentScaleFactor;
|
||||
recordLetterInfo(letterPosition, character, index, lineIndex);
|
||||
|
||||
if (_horizontalKernings && index < textLen - 1)
|
||||
nextLetterX += _horizontalKernings[index + 1];
|
||||
nextLetterX += letterDef.xAdvance + _additionalKerning;
|
||||
|
||||
letterRight = letterPosition.x + letterDef.width;
|
||||
|
||||
if (highestY < letterPosition.y)
|
||||
highestY = letterPosition.y;
|
||||
if (lowestY > letterPosition.y - letterDef.height)
|
||||
lowestY = letterPosition.y - letterDef.height;
|
||||
if (longestLine < letterRight)
|
||||
longestLine = letterRight;
|
||||
computeAlignmentOffset();
|
||||
tempLetterDefinition = letterDefinition;
|
||||
}
|
||||
this->setLineHeight(originalLineHeight);
|
||||
std::swap(_fontAtlas->_letterDefinitions, letterDefinition);
|
||||
|
||||
_linesWidth.push_back(letterRight);
|
||||
|
||||
_numberOfLines = lineIndex + 1;
|
||||
_textDesiredHeight = (_numberOfLines * _lineHeight) / contentScaleFactor;
|
||||
if (_numberOfLines > 1)
|
||||
_textDesiredHeight += (_numberOfLines - 1) * _lineSpacing;
|
||||
Size contentSize(_labelWidth, _labelHeight);
|
||||
if (_labelWidth <= 0.f)
|
||||
contentSize.width = longestLine;
|
||||
if (_labelHeight <= 0.f)
|
||||
contentSize.height = _textDesiredHeight;
|
||||
setContentSize(contentSize);
|
||||
|
||||
_tailoredTopY = contentSize.height;
|
||||
_tailoredBottomY = 0.f;
|
||||
if (highestY > 0.f)
|
||||
_tailoredTopY = contentSize.height + highestY;
|
||||
if (lowestY < -_textDesiredHeight)
|
||||
_tailoredBottomY = _textDesiredHeight + lowestY;
|
||||
|
||||
return true;
|
||||
if (!flag) {
|
||||
if (fontSize - i >= 0) {
|
||||
this->scaleFontSizeDown(fontSize - i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Label::recordLetterInfo(const cocos2d::Vec2& point, char16_t utf16Char, int letterIndex, int lineIndex)
|
||||
|
|
|
@ -139,7 +139,6 @@ ActionTimeline* ActionTimelineCache::createAction(const std::string& filename)
|
|||
std::string path = filename;
|
||||
size_t pos = path.find_last_of('.');
|
||||
std::string suffix = path.substr(pos + 1, path.length());
|
||||
CCLOG("suffix = %s", suffix.c_str());
|
||||
|
||||
ActionTimelineCache* cache = ActionTimelineCache::getInstance();
|
||||
|
||||
|
@ -507,7 +506,6 @@ Timeline* ActionTimelineCache::loadTimelineWithFlatBuffers(const flatbuffers::Ti
|
|||
if(property == "")
|
||||
return nullptr;
|
||||
|
||||
CCLOG("property = %s", property.c_str());
|
||||
|
||||
if(property != "")
|
||||
{
|
||||
|
|
|
@ -264,7 +264,6 @@ Node* CSLoader::createNode(const std::string& filename)
|
|||
std::string path = filename;
|
||||
size_t pos = path.find_last_of('.');
|
||||
std::string suffix = path.substr(pos + 1, path.length());
|
||||
CCLOG("suffix = %s", suffix.c_str());
|
||||
|
||||
CSLoader* load = CSLoader::getInstance();
|
||||
|
||||
|
@ -285,7 +284,6 @@ Node* CSLoader::createNode(const std::string &filename, const ccNodeLoadCallback
|
|||
std::string path = filename;
|
||||
size_t pos = path.find_last_of('.');
|
||||
std::string suffix = path.substr(pos + 1, path.length());
|
||||
CCLOG("suffix = %s", suffix.c_str());
|
||||
|
||||
CSLoader* load = CSLoader::getInstance();
|
||||
|
||||
|
@ -335,7 +333,6 @@ std::string CSLoader::getExtentionName(const std::string& name)
|
|||
ActionTimeline* CSLoader::createTimeline(const std::string &filename)
|
||||
{
|
||||
std::string suffix = getExtentionName(filename);
|
||||
CCLOG("suffix = %s", suffix.c_str());
|
||||
|
||||
ActionTimelineCache* cache = ActionTimelineCache::getInstance();
|
||||
|
||||
|
@ -354,7 +351,6 @@ ActionTimeline* CSLoader::createTimeline(const std::string &filename)
|
|||
ActionTimeline* CSLoader::createTimeline(const Data data, const std::string& filename)
|
||||
{
|
||||
std::string suffix = getExtentionName(filename);
|
||||
CCLOG("suffix = %s", suffix.c_str());
|
||||
|
||||
ActionTimelineCache* cache = ActionTimelineCache::getInstance();
|
||||
|
||||
|
@ -982,7 +978,6 @@ Node* CSLoader::nodeWithFlatBuffersFile(const std::string &fileName, const ccNod
|
|||
// decode plist
|
||||
auto textures = csparsebinary->textures();
|
||||
int textureSize = textures->size();
|
||||
CCLOG("textureSize = %d", textureSize);
|
||||
for (int i = 0; i < textureSize; ++i)
|
||||
{
|
||||
SpriteFrameCache::getInstance()->addSpriteFramesWithFile(textures->Get(i)->c_str());
|
||||
|
@ -1007,7 +1002,6 @@ Node* CSLoader::nodeWithFlatBuffers(const flatbuffers::NodeTree *nodetree, const
|
|||
Node* node = nullptr;
|
||||
|
||||
std::string classname = nodetree->classname()->c_str();
|
||||
CCLOG("classname = %s", classname.c_str());
|
||||
|
||||
auto options = nodetree->options();
|
||||
|
||||
|
@ -1016,7 +1010,6 @@ Node* CSLoader::nodeWithFlatBuffers(const flatbuffers::NodeTree *nodetree, const
|
|||
auto reader = ProjectNodeReader::getInstance();
|
||||
auto projectNodeOptions = (ProjectNodeOptions*)options->data();
|
||||
std::string filePath = projectNodeOptions->fileName()->c_str();
|
||||
CCLOG("filePath = %s", filePath.c_str());
|
||||
|
||||
cocostudio::timeline::ActionTimeline* action = nullptr;
|
||||
if (filePath != "" && FileUtils::getInstance()->isFileExist(filePath))
|
||||
|
@ -1079,7 +1072,6 @@ Node* CSLoader::nodeWithFlatBuffers(const flatbuffers::NodeTree *nodetree, const
|
|||
{
|
||||
_callbackHandlers.pushBack(node);
|
||||
_rootNode = _callbackHandlers.back();
|
||||
CCLOG("after push back _rootNode name = %s", _rootNode->getName().c_str());
|
||||
}
|
||||
/**/
|
||||
// _loadingNodeParentHierarchy.push_back(node);
|
||||
|
@ -1093,12 +1085,10 @@ Node* CSLoader::nodeWithFlatBuffers(const flatbuffers::NodeTree *nodetree, const
|
|||
|
||||
auto children = nodetree->children();
|
||||
int size = children->size();
|
||||
CCLOG("size = %d", size);
|
||||
for (int i = 0; i < size; ++i)
|
||||
{
|
||||
auto subNodeTree = children->Get(i);
|
||||
Node* child = nodeWithFlatBuffers(subNodeTree, callback);
|
||||
CCLOG("child = %p", child);
|
||||
if (child)
|
||||
{
|
||||
PageView* pageView = dynamic_cast<PageView*>(node);
|
||||
|
@ -1356,7 +1346,6 @@ Node* CSLoader::nodeWithFlatBuffersForSimulator(const flatbuffers::NodeTree *nod
|
|||
Node* node = nullptr;
|
||||
|
||||
std::string classname = nodetree->classname()->c_str();
|
||||
CCLOG("classname = %s", classname.c_str());
|
||||
|
||||
auto options = nodetree->options();
|
||||
|
||||
|
@ -1365,7 +1354,6 @@ Node* CSLoader::nodeWithFlatBuffersForSimulator(const flatbuffers::NodeTree *nod
|
|||
auto reader = ProjectNodeReader::getInstance();
|
||||
auto projectNodeOptions = (ProjectNodeOptions*)options->data();
|
||||
std::string filePath = projectNodeOptions->fileName()->c_str();
|
||||
CCLOG("filePath = %s", filePath.c_str());
|
||||
|
||||
cocostudio::timeline::ActionTimeline* action = nullptr;
|
||||
if (filePath != "" && FileUtils::getInstance()->isFileExist(filePath))
|
||||
|
@ -1431,12 +1419,10 @@ Node* CSLoader::nodeWithFlatBuffersForSimulator(const flatbuffers::NodeTree *nod
|
|||
|
||||
auto children = nodetree->children();
|
||||
int size = children->size();
|
||||
CCLOG("size = %d", size);
|
||||
for (int i = 0; i < size; ++i)
|
||||
{
|
||||
auto subNodeTree = children->Get(i);
|
||||
Node* child = nodeWithFlatBuffersForSimulator(subNodeTree);
|
||||
CCLOG("child = %p", child);
|
||||
if (child)
|
||||
{
|
||||
PageView* pageView = dynamic_cast<PageView*>(node);
|
||||
|
|
|
@ -63,7 +63,6 @@ void ActionManagerEx::initWithDictionary(const char* jsonName,const rapidjson::V
|
|||
std::string path = jsonName;
|
||||
ssize_t pos = path.find_last_of("/");
|
||||
std::string fileName = path.substr(pos+1,path.length());
|
||||
CCLOG("filename == %s",fileName.c_str());
|
||||
cocos2d::Vector<ActionObject*> actionList;
|
||||
int actionCount = DICTOOL->getArrayCount_json(dic, "actionlist");
|
||||
for (int i=0; i<actionCount; i++) {
|
||||
|
@ -84,7 +83,6 @@ void ActionManagerEx::initWithDictionary(const char* jsonName,const rapidjson::V
|
|||
std::string path = file;
|
||||
ssize_t pos = path.find_last_of("/");
|
||||
std::string fileName = path.substr(pos+1,path.length());
|
||||
CCLOG("filename == %s",fileName.c_str());
|
||||
cocos2d::Vector<ActionObject*> actionList;
|
||||
|
||||
stExpCocoNode *stChildArray = pCocoNode->GetChildArray(cocoLoader);
|
||||
|
@ -118,7 +116,6 @@ ActionObject* ActionManagerEx::getActionByName(const char* jsonName,const char*
|
|||
std::string path = jsonName;
|
||||
ssize_t pos = path.find_last_of("/");
|
||||
std::string fileName = path.substr(pos+1,path.length());
|
||||
CCLOG("find filename == %s",fileName.c_str());
|
||||
auto iterator = _actionDic.find(fileName);
|
||||
if (iterator == _actionDic.end())
|
||||
{
|
||||
|
|
|
@ -110,7 +110,6 @@ cocos2d::Node* SceneReader::createNodeWithSceneFile(const std::string &fileName,
|
|||
{
|
||||
pCom = createComponent(comName);
|
||||
}
|
||||
CCLOG("classname = %s", comName);
|
||||
if (pCom != nullptr)
|
||||
{
|
||||
data->_rData = nullptr;
|
||||
|
@ -270,7 +269,6 @@ Node* SceneReader::createObject(const rapidjson::Value &dict, cocos2d::Node* par
|
|||
}
|
||||
const char *comName = DICTOOL->getStringValue_json(subDict, "classname");
|
||||
Component *com = this->createComponent(comName);
|
||||
CCLOG("classname = %s", comName);
|
||||
SerData *data = new (std::nothrow) SerData();
|
||||
if (com != nullptr)
|
||||
{
|
||||
|
@ -388,7 +386,6 @@ cocos2d::Node* SceneReader::createObject(CocoLoader *cocoLoader, stExpCocoNode *
|
|||
{
|
||||
pCom = createComponent(comName);
|
||||
}
|
||||
CCLOG("classname = %s", comName);
|
||||
if (pCom != nullptr)
|
||||
{
|
||||
data->_rData = nullptr;
|
||||
|
|
|
@ -378,8 +378,8 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
|
|||
for(UIView* view in subviews)
|
||||
{
|
||||
if([view isKindOfClass:NSClassFromString(@"CCCustomUITextField")] ||
|
||||
[view isKindOfClass:NSClassFromString(@"UISingleLineTextField")] ||
|
||||
[view isKindOfClass:NSClassFromString(@"UIMultilineTextField")])
|
||||
[view isKindOfClass:NSClassFromString(@"CCUISingleLineTextField")] ||
|
||||
[view isKindOfClass:NSClassFromString(@"CCUIMultilineTextField")])
|
||||
{
|
||||
if ([view isFirstResponder])
|
||||
{
|
||||
|
|
|
@ -136,8 +136,9 @@ static void _checkPath()
|
|||
{
|
||||
if (s_resourcePath.empty())
|
||||
{
|
||||
WCHAR *pUtf16ExePath = nullptr;
|
||||
_get_wpgmptr(&pUtf16ExePath);
|
||||
WCHAR utf16Path[CC_MAX_PATH] = { 0 };
|
||||
GetModuleFileNameW(NULL, utf16Path, CC_MAX_PATH - 1);
|
||||
WCHAR *pUtf16ExePath = &(utf16Path[0]);
|
||||
|
||||
// We need only directory part without exe
|
||||
WCHAR *pUtf16DirEnd = wcsrchr(pUtf16ExePath, L'\\');
|
||||
|
|
|
@ -397,7 +397,6 @@ FrameBuffer::FrameBuffer()
|
|||
|
||||
FrameBuffer::~FrameBuffer()
|
||||
{
|
||||
if(!isDefaultFBO())
|
||||
{
|
||||
CC_SAFE_RELEASE_NULL(_rt);
|
||||
CC_SAFE_RELEASE_NULL(_rtDepthStencil);
|
||||
|
@ -407,6 +406,8 @@ FrameBuffer::~FrameBuffer()
|
|||
#if CC_ENABLE_CACHE_TEXTURE_DATA
|
||||
Director::getInstance()->getEventDispatcher()->removeEventListener(_dirtyFBOListener);
|
||||
#endif
|
||||
if (isDefaultFBO())
|
||||
_defaultFBO = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11963,6 +11963,16 @@ getBlendFunc : function (
|
|||
return cc.BlendFunc;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method enableWrap
|
||||
* @param {bool} arg0
|
||||
*/
|
||||
enableWrap : function (
|
||||
bool
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setWidth
|
||||
* @param {float} arg0
|
||||
|
@ -11973,6 +11983,16 @@ float
|
|||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getBMFontSize
|
||||
* @return {float}
|
||||
*/
|
||||
getBMFontSize : function (
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getMaxLineWidth
|
||||
* @return {float}
|
||||
|
@ -12027,11 +12047,13 @@ str
|
|||
* @method setBMFontFilePath
|
||||
* @param {String} arg0
|
||||
* @param {vec2_object} arg1
|
||||
* @param {float} arg2
|
||||
* @return {bool}
|
||||
*/
|
||||
setBMFontFilePath : function (
|
||||
str,
|
||||
vec2
|
||||
vec2,
|
||||
float
|
||||
)
|
||||
{
|
||||
return false;
|
||||
|
@ -12057,6 +12079,16 @@ float
|
|||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setOverflow
|
||||
* @param {cc.Label::Overflow} arg0
|
||||
*/
|
||||
setOverflow : function (
|
||||
overflow
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getLineSpacing
|
||||
* @return {float}
|
||||
|
@ -12245,6 +12277,18 @@ color4b
|
|||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getLetter
|
||||
* @param {int} arg0
|
||||
* @return {cc.Sprite}
|
||||
*/
|
||||
getLetter : function (
|
||||
int
|
||||
)
|
||||
{
|
||||
return cc.Sprite;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setHeight
|
||||
* @param {float} arg0
|
||||
|
@ -12276,15 +12320,13 @@ color4b
|
|||
},
|
||||
|
||||
/**
|
||||
* @method getLetter
|
||||
* @param {int} arg0
|
||||
* @return {cc.Sprite}
|
||||
* @method getOverflow
|
||||
* @return {cc.Label::Overflow}
|
||||
*/
|
||||
getLetter : function (
|
||||
int
|
||||
getOverflow : function (
|
||||
)
|
||||
{
|
||||
return cc.Sprite;
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -12347,6 +12389,16 @@ texthalignment
|
|||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method isWrapEnabled
|
||||
* @return {bool}
|
||||
*/
|
||||
isWrapEnabled : function (
|
||||
)
|
||||
{
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setAlignment
|
||||
* @param {cc.TextHAlignment|cc.TextHAlignment} texthalignment
|
||||
|
@ -12367,6 +12419,16 @@ requestSystemFontRefresh : function (
|
|||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setBMFontSize
|
||||
* @param {float} arg0
|
||||
*/
|
||||
setBMFontSize : function (
|
||||
float
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method createWithBMFont
|
||||
* @param {String} arg0
|
||||
|
|
|
@ -37622,6 +37622,26 @@ bool js_cocos2dx_Label_getBlendFunc(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
JS_ReportError(cx, "js_cocos2dx_Label_getBlendFunc : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_Label_enableWrap(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_enableWrap : Invalid Native Object");
|
||||
if (argc == 1) {
|
||||
bool arg0;
|
||||
arg0 = JS::ToBoolean(args.get(0));
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_enableWrap : Error processing arguments");
|
||||
cobj->enableWrap(arg0);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_Label_enableWrap : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_Label_setWidth(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
@ -37642,6 +37662,24 @@ bool js_cocos2dx_Label_setWidth(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
JS_ReportError(cx, "js_cocos2dx_Label_setWidth : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_Label_getBMFontSize(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getBMFontSize : Invalid Native Object");
|
||||
if (argc == 0) {
|
||||
double ret = cobj->getBMFontSize();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = DOUBLE_TO_JSVAL(ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_Label_getBMFontSize : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_Label_getMaxLineWidth(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
@ -37768,6 +37806,20 @@ bool js_cocos2dx_Label_setBMFontFilePath(JSContext *cx, uint32_t argc, jsval *vp
|
|||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
if (argc == 3) {
|
||||
std::string arg0;
|
||||
cocos2d::Vec2 arg1;
|
||||
double arg2 = 0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
ok &= jsval_to_vector2(cx, args.get(1), &arg1);
|
||||
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_setBMFontFilePath : Error processing arguments");
|
||||
bool ret = cobj->setBMFontFilePath(arg0, arg1, arg2);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = BOOLEAN_TO_JSVAL(ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_Label_setBMFontFilePath : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
|
@ -37812,6 +37864,26 @@ bool js_cocos2dx_Label_setSystemFontSize(JSContext *cx, uint32_t argc, jsval *vp
|
|||
JS_ReportError(cx, "js_cocos2dx_Label_setSystemFontSize : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_Label_setOverflow(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_setOverflow : Invalid Native Object");
|
||||
if (argc == 1) {
|
||||
cocos2d::Label::Overflow arg0;
|
||||
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_setOverflow : Error processing arguments");
|
||||
cobj->setOverflow(arg0);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_Label_setOverflow : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_Label_getLineSpacing(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
@ -38219,6 +38291,35 @@ bool js_cocos2dx_Label_setTextColor(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
JS_ReportError(cx, "js_cocos2dx_Label_setTextColor : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_Label_getLetter(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getLetter : Invalid Native Object");
|
||||
if (argc == 1) {
|
||||
int arg0 = 0;
|
||||
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_getLetter : Error processing arguments");
|
||||
cocos2d::Sprite* ret = cobj->getLetter(arg0);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
do {
|
||||
if (ret) {
|
||||
js_proxy_t *jsProxy = js_get_or_create_proxy<cocos2d::Sprite>(cx, (cocos2d::Sprite*)ret);
|
||||
jsret = OBJECT_TO_JSVAL(jsProxy->obj);
|
||||
} else {
|
||||
jsret = JSVAL_NULL;
|
||||
}
|
||||
} while (0);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_Label_getLetter : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_Label_setHeight(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
@ -38277,33 +38378,22 @@ bool js_cocos2dx_Label_enableGlow(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
JS_ReportError(cx, "js_cocos2dx_Label_enableGlow : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_Label_getLetter(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
bool js_cocos2dx_Label_getOverflow(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getLetter : Invalid Native Object");
|
||||
if (argc == 1) {
|
||||
int arg0 = 0;
|
||||
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_getLetter : Error processing arguments");
|
||||
cocos2d::Sprite* ret = cobj->getLetter(arg0);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getOverflow : Invalid Native Object");
|
||||
if (argc == 0) {
|
||||
int ret = (int)cobj->getOverflow();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
do {
|
||||
if (ret) {
|
||||
js_proxy_t *jsProxy = js_get_or_create_proxy<cocos2d::Sprite>(cx, (cocos2d::Sprite*)ret);
|
||||
jsret = OBJECT_TO_JSVAL(jsProxy->obj);
|
||||
} else {
|
||||
jsret = JSVAL_NULL;
|
||||
}
|
||||
} while (0);
|
||||
jsret = int32_to_jsval(cx, ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_Label_getLetter : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
JS_ReportError(cx, "js_cocos2dx_Label_getOverflow : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_Label_setAdditionalKerning(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
|
@ -38420,6 +38510,24 @@ bool js_cocos2dx_Label_setHorizontalAlignment(JSContext *cx, uint32_t argc, jsva
|
|||
JS_ReportError(cx, "js_cocos2dx_Label_setHorizontalAlignment : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_Label_isWrapEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_isWrapEnabled : Invalid Native Object");
|
||||
if (argc == 0) {
|
||||
bool ret = cobj->isWrapEnabled();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = BOOLEAN_TO_JSVAL(ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_Label_isWrapEnabled : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_Label_setAlignment(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
bool ok = true;
|
||||
|
@ -38475,6 +38583,26 @@ bool js_cocos2dx_Label_requestSystemFontRefresh(JSContext *cx, uint32_t argc, js
|
|||
JS_ReportError(cx, "js_cocos2dx_Label_requestSystemFontRefresh : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_Label_setBMFontSize(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_setBMFontSize : Invalid Native Object");
|
||||
if (argc == 1) {
|
||||
double arg0 = 0;
|
||||
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_setBMFontSize : Error processing arguments");
|
||||
cobj->setBMFontSize(arg0);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_Label_setBMFontSize : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_Label_createWithBMFont(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
@ -38865,7 +38993,9 @@ void js_register_cocos2dx_Label(JSContext *cx, JS::HandleObject global) {
|
|||
JS_FN("disableEffect", js_cocos2dx_Label_disableEffect, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getTextColor", js_cocos2dx_Label_getTextColor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getBlendFunc", js_cocos2dx_Label_getBlendFunc, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("enableWrap", js_cocos2dx_Label_enableWrap, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setWidth", js_cocos2dx_Label_setWidth, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getBMFontSize", js_cocos2dx_Label_getBMFontSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getMaxLineWidth", js_cocos2dx_Label_getMaxLineWidth, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getHorizontalAlignment", js_cocos2dx_Label_getHorizontalAlignment, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setClipMarginEnabled", js_cocos2dx_Label_setClipMarginEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
|
@ -38874,6 +39004,7 @@ void js_register_cocos2dx_Label(JSContext *cx, JS::HandleObject global) {
|
|||
JS_FN("setBMFontFilePath", js_cocos2dx_Label_setBMFontFilePath, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setLineHeight", js_cocos2dx_Label_setLineHeight, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setSystemFontSize", js_cocos2dx_Label_setSystemFontSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setOverflow", js_cocos2dx_Label_setOverflow, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getLineSpacing", js_cocos2dx_Label_getLineSpacing, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("updateContent", js_cocos2dx_Label_updateContent, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getStringLength", js_cocos2dx_Label_getStringLength, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
|
@ -38892,18 +39023,21 @@ void js_register_cocos2dx_Label(JSContext *cx, JS::HandleObject global) {
|
|||
JS_FN("getTTFConfig", js_cocos2dx_Label_getTTFConfig, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getVerticalAlignment", js_cocos2dx_Label_getVerticalAlignment, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setTextColor", js_cocos2dx_Label_setTextColor, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getLetter", js_cocos2dx_Label_getLetter, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setHeight", js_cocos2dx_Label_setHeight, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getWidth", js_cocos2dx_Label_getWidth, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("enableGlow", js_cocos2dx_Label_enableGlow, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getLetter", js_cocos2dx_Label_getLetter, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getOverflow", js_cocos2dx_Label_getOverflow, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setAdditionalKerning", js_cocos2dx_Label_setAdditionalKerning, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getSystemFontSize", js_cocos2dx_Label_getSystemFontSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setBlendFunc", js_cocos2dx_Label_setBlendFunc, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getTextAlignment", js_cocos2dx_Label_getTextAlignment, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getBMFontFilePath", js_cocos2dx_Label_getBMFontFilePath, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setHorizontalAlignment", js_cocos2dx_Label_setHorizontalAlignment, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("isWrapEnabled", js_cocos2dx_Label_isWrapEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setAlignment", js_cocos2dx_Label_setAlignment, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("requestSystemFontRefresh", js_cocos2dx_Label_requestSystemFontRefresh, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setBMFontSize", js_cocos2dx_Label_setBMFontSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("ctor", js_cocos2dx_Label_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FS_END
|
||||
};
|
||||
|
|
|
@ -2221,7 +2221,9 @@ bool js_cocos2dx_Label_getHeight(JSContext *cx, uint32_t argc, jsval *vp);
|
|||
bool js_cocos2dx_Label_disableEffect(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_getTextColor(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_getBlendFunc(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_enableWrap(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_setWidth(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_getBMFontSize(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_getMaxLineWidth(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_getHorizontalAlignment(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_setClipMarginEnabled(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
|
@ -2230,6 +2232,7 @@ bool js_cocos2dx_Label_setSystemFontName(JSContext *cx, uint32_t argc, jsval *vp
|
|||
bool js_cocos2dx_Label_setBMFontFilePath(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_setLineHeight(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_setSystemFontSize(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_setOverflow(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_getLineSpacing(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_updateContent(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_getStringLength(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
|
@ -2248,18 +2251,21 @@ bool js_cocos2dx_Label_getLineHeight(JSContext *cx, uint32_t argc, jsval *vp);
|
|||
bool js_cocos2dx_Label_getTTFConfig(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_getVerticalAlignment(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_setTextColor(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_getLetter(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_setHeight(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_getWidth(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_enableGlow(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_getLetter(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_getOverflow(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_setAdditionalKerning(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_getSystemFontSize(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_getTextAlignment(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_getBMFontFilePath(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_setHorizontalAlignment(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_isWrapEnabled(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_setAlignment(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_requestSystemFontRefresh(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_setBMFontSize(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_createWithBMFont(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_create(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Label_createWithCharMap(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
|
|
|
@ -2526,7 +2526,7 @@ bool js_cocos2dx_ui_Layout_getRenderFile(JSContext *cx, uint32_t argc, jsval *vp
|
|||
if (argc == 0) {
|
||||
cocos2d::ResouceData ret = cobj->getRenderFile();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = resoucedata_to_jsval(cx, ret);
|
||||
#pragma warning NO CONVERSION FROM NATIVE FOR ResouceData;
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
@ -3397,7 +3397,7 @@ bool js_cocos2dx_ui_Button_getDisabledFile(JSContext *cx, uint32_t argc, jsval *
|
|||
if (argc == 0) {
|
||||
cocos2d::ResouceData ret = cobj->getDisabledFile();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = resoucedata_to_jsval(cx, ret);
|
||||
#pragma warning NO CONVERSION FROM NATIVE FOR ResouceData;
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
@ -3471,7 +3471,7 @@ bool js_cocos2dx_ui_Button_getNormalFile(JSContext *cx, uint32_t argc, jsval *vp
|
|||
if (argc == 0) {
|
||||
cocos2d::ResouceData ret = cobj->getNormalFile();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = resoucedata_to_jsval(cx, ret);
|
||||
#pragma warning NO CONVERSION FROM NATIVE FOR ResouceData;
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
@ -3945,7 +3945,7 @@ bool js_cocos2dx_ui_Button_getPressedFile(JSContext *cx, uint32_t argc, jsval *v
|
|||
if (argc == 0) {
|
||||
cocos2d::ResouceData ret = cobj->getPressedFile();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = resoucedata_to_jsval(cx, ret);
|
||||
#pragma warning NO CONVERSION FROM NATIVE FOR ResouceData;
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
@ -4369,7 +4369,7 @@ bool js_cocos2dx_ui_AbstractCheckButton_getBackDisabledFile(JSContext *cx, uint3
|
|||
if (argc == 0) {
|
||||
cocos2d::ResouceData ret = cobj->getBackDisabledFile();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = resoucedata_to_jsval(cx, ret);
|
||||
#pragma warning NO CONVERSION FROM NATIVE FOR ResouceData;
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
@ -4387,7 +4387,7 @@ bool js_cocos2dx_ui_AbstractCheckButton_getCrossDisabeldFile(JSContext *cx, uint
|
|||
if (argc == 0) {
|
||||
cocos2d::ResouceData ret = cobj->getCrossDisabeldFile();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = resoucedata_to_jsval(cx, ret);
|
||||
#pragma warning NO CONVERSION FROM NATIVE FOR ResouceData;
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
@ -4465,7 +4465,7 @@ bool js_cocos2dx_ui_AbstractCheckButton_getCrossNormalFile(JSContext *cx, uint32
|
|||
if (argc == 0) {
|
||||
cocos2d::ResouceData ret = cobj->getCrossNormalFile();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = resoucedata_to_jsval(cx, ret);
|
||||
#pragma warning NO CONVERSION FROM NATIVE FOR ResouceData;
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
@ -4503,7 +4503,7 @@ bool js_cocos2dx_ui_AbstractCheckButton_getBackPressedFile(JSContext *cx, uint32
|
|||
if (argc == 0) {
|
||||
cocos2d::ResouceData ret = cobj->getBackPressedFile();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = resoucedata_to_jsval(cx, ret);
|
||||
#pragma warning NO CONVERSION FROM NATIVE FOR ResouceData;
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
@ -4694,7 +4694,7 @@ bool js_cocos2dx_ui_AbstractCheckButton_getBackNormalFile(JSContext *cx, uint32_
|
|||
if (argc == 0) {
|
||||
cocos2d::ResouceData ret = cobj->getBackNormalFile();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = resoucedata_to_jsval(cx, ret);
|
||||
#pragma warning NO CONVERSION FROM NATIVE FOR ResouceData;
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
@ -6053,7 +6053,7 @@ bool js_cocos2dx_ui_ImageView_getRenderFile(JSContext *cx, uint32_t argc, jsval
|
|||
if (argc == 0) {
|
||||
cocos2d::ResouceData ret = cobj->getRenderFile();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = resoucedata_to_jsval(cx, ret);
|
||||
#pragma warning NO CONVERSION FROM NATIVE FOR ResouceData;
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
@ -7087,7 +7087,7 @@ bool js_cocos2dx_ui_TextAtlas_getRenderFile(JSContext *cx, uint32_t argc, jsval
|
|||
if (argc == 0) {
|
||||
cocos2d::ResouceData ret = cobj->getRenderFile();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = resoucedata_to_jsval(cx, ret);
|
||||
#pragma warning NO CONVERSION FROM NATIVE FOR ResouceData;
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
@ -7412,7 +7412,7 @@ bool js_cocos2dx_ui_LoadingBar_getRenderFile(JSContext *cx, uint32_t argc, jsval
|
|||
if (argc == 0) {
|
||||
cocos2d::ResouceData ret = cobj->getRenderFile();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = resoucedata_to_jsval(cx, ret);
|
||||
#pragma warning NO CONVERSION FROM NATIVE FOR ResouceData;
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
@ -9934,7 +9934,7 @@ bool js_cocos2dx_ui_Slider_getBallNormalFile(JSContext *cx, uint32_t argc, jsval
|
|||
if (argc == 0) {
|
||||
cocos2d::ResouceData ret = cobj->getBallNormalFile();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = resoucedata_to_jsval(cx, ret);
|
||||
#pragma warning NO CONVERSION FROM NATIVE FOR ResouceData;
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
@ -9990,7 +9990,7 @@ bool js_cocos2dx_ui_Slider_getBallPressedFile(JSContext *cx, uint32_t argc, jsva
|
|||
if (argc == 0) {
|
||||
cocos2d::ResouceData ret = cobj->getBallPressedFile();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = resoucedata_to_jsval(cx, ret);
|
||||
#pragma warning NO CONVERSION FROM NATIVE FOR ResouceData;
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
@ -10132,7 +10132,7 @@ bool js_cocos2dx_ui_Slider_getProgressBarFile(JSContext *cx, uint32_t argc, jsva
|
|||
if (argc == 0) {
|
||||
cocos2d::ResouceData ret = cobj->getProgressBarFile();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = resoucedata_to_jsval(cx, ret);
|
||||
#pragma warning NO CONVERSION FROM NATIVE FOR ResouceData;
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
@ -10198,7 +10198,7 @@ bool js_cocos2dx_ui_Slider_getBackFile(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
if (argc == 0) {
|
||||
cocos2d::ResouceData ret = cobj->getBackFile();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = resoucedata_to_jsval(cx, ret);
|
||||
#pragma warning NO CONVERSION FROM NATIVE FOR ResouceData;
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
@ -10274,7 +10274,7 @@ bool js_cocos2dx_ui_Slider_getBallDisabeldFile(JSContext *cx, uint32_t argc, jsv
|
|||
if (argc == 0) {
|
||||
cocos2d::ResouceData ret = cobj->getBallDisabeldFile();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = resoucedata_to_jsval(cx, ret);
|
||||
#pragma warning NO CONVERSION FROM NATIVE FOR ResouceData;
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
@ -12321,7 +12321,7 @@ bool js_cocos2dx_ui_TextBMFont_getRenderFile(JSContext *cx, uint32_t argc, jsval
|
|||
if (argc == 0) {
|
||||
cocos2d::ResouceData ret = cobj->getRenderFile();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = resoucedata_to_jsval(cx, ret);
|
||||
#pragma warning NO CONVERSION FROM NATIVE FOR ResouceData;
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -65,6 +65,15 @@
|
|||
-- @param self
|
||||
-- @return BlendFunc#BlendFunc ret (return value: cc.BlendFunc)
|
||||
|
||||
--------------------------------
|
||||
-- Toggle wrap option of the label.<br>
|
||||
-- Note: System font doesn't support manually toggle wrap.<br>
|
||||
-- param enable Set true to enable wrap and false to disable wrap.
|
||||
-- @function [parent=#Label] enableWrap
|
||||
-- @param self
|
||||
-- @param #bool enable
|
||||
-- @return Label#Label self (return value: cc.Label)
|
||||
|
||||
--------------------------------
|
||||
-- Makes the Label exactly this untransformed width.<br>
|
||||
-- The Label's width be used for text align if the value not equal zero.
|
||||
|
@ -73,6 +82,13 @@
|
|||
-- @param #float width
|
||||
-- @return Label#Label self (return value: cc.Label)
|
||||
|
||||
--------------------------------
|
||||
-- Return the user define BMFont size.<br>
|
||||
-- return The BMFont size in float value.
|
||||
-- @function [parent=#Label] getBMFontSize
|
||||
-- @param self
|
||||
-- @return float#float ret (return value: float)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Label] getMaxLineWidth
|
||||
|
@ -114,6 +130,7 @@
|
|||
-- @param self
|
||||
-- @param #string bmfontFilePath
|
||||
-- @param #vec2_table imageOffset
|
||||
-- @param #float fontSize
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
|
@ -138,6 +155,16 @@
|
|||
-- @param #float fontSize
|
||||
-- @return Label#Label self (return value: cc.Label)
|
||||
|
||||
--------------------------------
|
||||
-- Change the label's Overflow type, currently only TTF and BMFont support all the valid Overflow type.<br>
|
||||
-- Char Map font supports all the Overflow type except for SHRINK, because we can't measure it's font size.<br>
|
||||
-- System font only support Overflow::Normal and Overflow::RESIZE_HEIGHT.<br>
|
||||
-- param overflow see `Overflow`
|
||||
-- @function [parent=#Label] setOverflow
|
||||
-- @param self
|
||||
-- @param #int overflow
|
||||
-- @return Label#Label self (return value: cc.Label)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#Label] getLineSpacing
|
||||
|
@ -270,6 +297,14 @@
|
|||
-- @param #color4b_table color
|
||||
-- @return Label#Label self (return value: cc.Label)
|
||||
|
||||
--------------------------------
|
||||
-- Provides a way to treats each character like a Sprite.<br>
|
||||
-- warning No support system font.
|
||||
-- @function [parent=#Label] getLetter
|
||||
-- @param self
|
||||
-- @param #int lettetIndex
|
||||
-- @return Sprite#Sprite ret (return value: cc.Sprite)
|
||||
|
||||
--------------------------------
|
||||
-- Makes the Label exactly this untransformed height.<br>
|
||||
-- The Label's height be used for text align if the value not equal zero.<br>
|
||||
|
@ -294,12 +329,11 @@
|
|||
-- @return Label#Label self (return value: cc.Label)
|
||||
|
||||
--------------------------------
|
||||
-- Provides a way to treats each character like a Sprite.<br>
|
||||
-- warning No support system font.
|
||||
-- @function [parent=#Label] getLetter
|
||||
-- Query the label's Overflow type.<br>
|
||||
-- return see `Overflow`
|
||||
-- @function [parent=#Label] getOverflow
|
||||
-- @param self
|
||||
-- @param #int lettetIndex
|
||||
-- @return Sprite#Sprite ret (return value: cc.Sprite)
|
||||
-- @return int#int ret (return value: int)
|
||||
|
||||
--------------------------------
|
||||
-- Sets the additional kerning of the Label.<br>
|
||||
|
@ -342,6 +376,13 @@
|
|||
-- @param #int hAlignment
|
||||
-- @return Label#Label self (return value: cc.Label)
|
||||
|
||||
--------------------------------
|
||||
-- Query the wrap is enabled or not.<br>
|
||||
-- Note: System font will always return true.
|
||||
-- @function [parent=#Label] isWrapEnabled
|
||||
-- @param self
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
-- @overload self, int, int
|
||||
-- @overload self, int
|
||||
|
@ -357,6 +398,15 @@
|
|||
-- @param self
|
||||
-- @return Label#Label self (return value: cc.Label)
|
||||
|
||||
--------------------------------
|
||||
-- Change font size of label type BMFONT<br>
|
||||
-- Note: This function only scale the BMFONT letter to mimic the font size change effect.<br>
|
||||
-- param fontSize The desired font size in float.
|
||||
-- @function [parent=#Label] setBMFontSize
|
||||
-- @param self
|
||||
-- @param #float fontSize
|
||||
-- @return Label#Label self (return value: cc.Label)
|
||||
|
||||
--------------------------------
|
||||
-- Allocates and initializes a Label, with a bitmap font file.<br>
|
||||
-- param bmfontPath A bitmap font file, it's a FNT format.<br>
|
||||
|
|
|
@ -51038,6 +51038,56 @@ int lua_cocos2dx_Label_getBlendFunc(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Label_enableWrap(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Label* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.Label",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::Label*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_enableWrap'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
bool arg0;
|
||||
|
||||
ok &= luaval_to_boolean(tolua_S, 2,&arg0, "cc.Label:enableWrap");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_enableWrap'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->enableWrap(arg0);
|
||||
lua_settop(tolua_S, 1);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:enableWrap",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_enableWrap'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Label_setWidth(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -51088,6 +51138,53 @@ int lua_cocos2dx_Label_setWidth(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Label_getBMFontSize(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Label* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.Label",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::Label*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_getBMFontSize'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_getBMFontSize'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
double ret = cobj->getBMFontSize();
|
||||
tolua_pushnumber(tolua_S,(lua_Number)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:getBMFontSize",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_getBMFontSize'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Label_getMaxLineWidth(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -51389,6 +51486,26 @@ int lua_cocos2dx_Label_setBMFontFilePath(lua_State* tolua_S)
|
|||
tolua_pushboolean(tolua_S,(bool)ret);
|
||||
return 1;
|
||||
}
|
||||
if (argc == 3)
|
||||
{
|
||||
std::string arg0;
|
||||
cocos2d::Vec2 arg1;
|
||||
double arg2;
|
||||
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Label:setBMFontFilePath");
|
||||
|
||||
ok &= luaval_to_vec2(tolua_S, 3, &arg1, "cc.Label:setBMFontFilePath");
|
||||
|
||||
ok &= luaval_to_number(tolua_S, 4,&arg2, "cc.Label:setBMFontFilePath");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_setBMFontFilePath'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
bool ret = cobj->setBMFontFilePath(arg0, arg1, arg2);
|
||||
tolua_pushboolean(tolua_S,(bool)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:setBMFontFilePath",argc, 1);
|
||||
return 0;
|
||||
|
||||
|
@ -51546,6 +51663,56 @@ int lua_cocos2dx_Label_setSystemFontSize(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Label_setOverflow(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Label* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.Label",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::Label*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_setOverflow'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
cocos2d::Label::Overflow arg0;
|
||||
|
||||
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.Label:setOverflow");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_setOverflow'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->setOverflow(arg0);
|
||||
lua_settop(tolua_S, 1);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:setOverflow",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_setOverflow'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Label_getLineSpacing(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -52474,6 +52641,56 @@ int lua_cocos2dx_Label_setTextColor(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Label_getLetter(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Label* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.Label",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::Label*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_getLetter'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
int arg0;
|
||||
|
||||
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.Label:getLetter");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_getLetter'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cocos2d::Sprite* ret = cobj->getLetter(arg0);
|
||||
object_to_luaval<cocos2d::Sprite>(tolua_S, "cc.Sprite",(cocos2d::Sprite*)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:getLetter",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_getLetter'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Label_setHeight(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -52621,7 +52838,7 @@ int lua_cocos2dx_Label_enableGlow(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Label_getLetter(lua_State* tolua_S)
|
||||
int lua_cocos2dx_Label_getOverflow(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Label* cobj = nullptr;
|
||||
|
@ -52641,32 +52858,29 @@ int lua_cocos2dx_Label_getLetter(lua_State* tolua_S)
|
|||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_getLetter'", nullptr);
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_getOverflow'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
if (argc == 0)
|
||||
{
|
||||
int arg0;
|
||||
|
||||
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.Label:getLetter");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_getLetter'", nullptr);
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_getOverflow'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cocos2d::Sprite* ret = cobj->getLetter(arg0);
|
||||
object_to_luaval<cocos2d::Sprite>(tolua_S, "cc.Sprite",(cocos2d::Sprite*)ret);
|
||||
int ret = (int)cobj->getOverflow();
|
||||
tolua_pushnumber(tolua_S,(lua_Number)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:getLetter",argc, 1);
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:getOverflow",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_getLetter'.",&tolua_err);
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_getOverflow'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
@ -52962,6 +53176,53 @@ int lua_cocos2dx_Label_setHorizontalAlignment(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Label_isWrapEnabled(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Label* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.Label",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::Label*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_isWrapEnabled'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_isWrapEnabled'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
bool ret = cobj->isWrapEnabled();
|
||||
tolua_pushboolean(tolua_S,(bool)ret);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:isWrapEnabled",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_isWrapEnabled'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Label_setAlignment(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -53068,6 +53329,56 @@ int lua_cocos2dx_Label_requestSystemFontRefresh(lua_State* tolua_S)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Label_setBMFontSize(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Label* cobj = nullptr;
|
||||
bool ok = true;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.Label",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::Label*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_setBMFontSize'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
double arg0;
|
||||
|
||||
ok &= luaval_to_number(tolua_S, 2,&arg0, "cc.Label:setBMFontSize");
|
||||
if(!ok)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_setBMFontSize'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
cobj->setBMFontSize(arg0);
|
||||
lua_settop(tolua_S, 1);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:setBMFontSize",argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_setBMFontSize'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lua_cocos2dx_Label_createWithBMFont(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
|
@ -53400,7 +53711,9 @@ int lua_register_cocos2dx_Label(lua_State* tolua_S)
|
|||
tolua_function(tolua_S,"setTTFConfig",lua_cocos2dx_Label_setTTFConfig);
|
||||
tolua_function(tolua_S,"getTextColor",lua_cocos2dx_Label_getTextColor);
|
||||
tolua_function(tolua_S,"getBlendFunc",lua_cocos2dx_Label_getBlendFunc);
|
||||
tolua_function(tolua_S,"enableWrap",lua_cocos2dx_Label_enableWrap);
|
||||
tolua_function(tolua_S,"setWidth",lua_cocos2dx_Label_setWidth);
|
||||
tolua_function(tolua_S,"getBMFontSize",lua_cocos2dx_Label_getBMFontSize);
|
||||
tolua_function(tolua_S,"getMaxLineWidth",lua_cocos2dx_Label_getMaxLineWidth);
|
||||
tolua_function(tolua_S,"getHorizontalAlignment",lua_cocos2dx_Label_getHorizontalAlignment);
|
||||
tolua_function(tolua_S,"setClipMarginEnabled",lua_cocos2dx_Label_setClipMarginEnabled);
|
||||
|
@ -53410,6 +53723,7 @@ int lua_register_cocos2dx_Label(lua_State* tolua_S)
|
|||
tolua_function(tolua_S,"getFontAtlas",lua_cocos2dx_Label_getFontAtlas);
|
||||
tolua_function(tolua_S,"setLineHeight",lua_cocos2dx_Label_setLineHeight);
|
||||
tolua_function(tolua_S,"setSystemFontSize",lua_cocos2dx_Label_setSystemFontSize);
|
||||
tolua_function(tolua_S,"setOverflow",lua_cocos2dx_Label_setOverflow);
|
||||
tolua_function(tolua_S,"getLineSpacing",lua_cocos2dx_Label_getLineSpacing);
|
||||
tolua_function(tolua_S,"updateContent",lua_cocos2dx_Label_updateContent);
|
||||
tolua_function(tolua_S,"getStringLength",lua_cocos2dx_Label_getStringLength);
|
||||
|
@ -53428,18 +53742,21 @@ int lua_register_cocos2dx_Label(lua_State* tolua_S)
|
|||
tolua_function(tolua_S,"getTTFConfig",lua_cocos2dx_Label_getTTFConfig);
|
||||
tolua_function(tolua_S,"getVerticalAlignment",lua_cocos2dx_Label_getVerticalAlignment);
|
||||
tolua_function(tolua_S,"setTextColor",lua_cocos2dx_Label_setTextColor);
|
||||
tolua_function(tolua_S,"getLetter",lua_cocos2dx_Label_getLetter);
|
||||
tolua_function(tolua_S,"setHeight",lua_cocos2dx_Label_setHeight);
|
||||
tolua_function(tolua_S,"getWidth",lua_cocos2dx_Label_getWidth);
|
||||
tolua_function(tolua_S,"enableGlow",lua_cocos2dx_Label_enableGlow);
|
||||
tolua_function(tolua_S,"getLetter",lua_cocos2dx_Label_getLetter);
|
||||
tolua_function(tolua_S,"getOverflow",lua_cocos2dx_Label_getOverflow);
|
||||
tolua_function(tolua_S,"setAdditionalKerning",lua_cocos2dx_Label_setAdditionalKerning);
|
||||
tolua_function(tolua_S,"getSystemFontSize",lua_cocos2dx_Label_getSystemFontSize);
|
||||
tolua_function(tolua_S,"setBlendFunc",lua_cocos2dx_Label_setBlendFunc);
|
||||
tolua_function(tolua_S,"getTextAlignment",lua_cocos2dx_Label_getTextAlignment);
|
||||
tolua_function(tolua_S,"getBMFontFilePath",lua_cocos2dx_Label_getBMFontFilePath);
|
||||
tolua_function(tolua_S,"setHorizontalAlignment",lua_cocos2dx_Label_setHorizontalAlignment);
|
||||
tolua_function(tolua_S,"isWrapEnabled",lua_cocos2dx_Label_isWrapEnabled);
|
||||
tolua_function(tolua_S,"setAlignment",lua_cocos2dx_Label_setAlignment);
|
||||
tolua_function(tolua_S,"requestSystemFontRefresh",lua_cocos2dx_Label_requestSystemFontRefresh);
|
||||
tolua_function(tolua_S,"setBMFontSize",lua_cocos2dx_Label_setBMFontSize);
|
||||
tolua_function(tolua_S,"createWithBMFont", lua_cocos2dx_Label_createWithBMFont);
|
||||
tolua_function(tolua_S,"create", lua_cocos2dx_Label_create);
|
||||
tolua_function(tolua_S,"createWithCharMap", lua_cocos2dx_Label_createWithCharMap);
|
||||
|
|
|
@ -2146,6 +2146,12 @@ int register_all_cocos2dx(lua_State* tolua_S);
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -232,10 +232,11 @@ void Button::loadTextureNormal(const std::string& normal,TextureResType texType)
|
|||
{
|
||||
_normalFileName = normal;
|
||||
_normalTexType = texType;
|
||||
|
||||
bool textureLoaded = true;
|
||||
if (normal.empty())
|
||||
{
|
||||
_buttonNormalRenderer->init();
|
||||
textureLoaded = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -251,10 +252,10 @@ void Button::loadTextureNormal(const std::string& normal,TextureResType texType)
|
|||
break;
|
||||
}
|
||||
}
|
||||
this->setupNormalTexture();
|
||||
this->setupNormalTexture(textureLoaded);
|
||||
}
|
||||
|
||||
void Button::setupNormalTexture()
|
||||
void Button::setupNormalTexture(bool textureLoaded)
|
||||
{
|
||||
_normalTextureSize = _buttonNormalRenderer->getContentSize();
|
||||
// force update _customSize, fixed issue:
|
||||
|
@ -274,24 +275,25 @@ void Button::setupNormalTexture()
|
|||
{
|
||||
updateContentSizeWithTextureSize(_normalTextureSize);
|
||||
}
|
||||
_normalTextureLoaded = true;
|
||||
_normalTextureLoaded = textureLoaded;
|
||||
_normalTextureAdaptDirty = true;
|
||||
}
|
||||
|
||||
void Button::loadTextureNormal(SpriteFrame* normalSpriteFrame)
|
||||
{
|
||||
_buttonNormalRenderer->initWithSpriteFrame(normalSpriteFrame);
|
||||
this->setupNormalTexture();
|
||||
this->setupNormalTexture(nullptr != normalSpriteFrame);
|
||||
}
|
||||
|
||||
void Button::loadTexturePressed(const std::string& selected,TextureResType texType)
|
||||
{
|
||||
_clickedFileName = selected;
|
||||
_pressedTexType = texType;
|
||||
|
||||
bool textureLoade = true;
|
||||
if (selected.empty())
|
||||
{
|
||||
_buttonClickedRenderer->init();
|
||||
textureLoade = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -307,33 +309,34 @@ void Button::loadTexturePressed(const std::string& selected,TextureResType texTy
|
|||
break;
|
||||
}
|
||||
}
|
||||
this->setupPressedTexture();
|
||||
this->setupPressedTexture(textureLoade);
|
||||
}
|
||||
|
||||
void Button::setupPressedTexture()
|
||||
void Button::setupPressedTexture(bool textureLoaded)
|
||||
{
|
||||
_pressedTextureSize = _buttonClickedRenderer->getContentSize();
|
||||
|
||||
this->updateChildrenDisplayedRGBA();
|
||||
|
||||
_pressedTextureLoaded = true;
|
||||
_pressedTextureLoaded = textureLoaded;
|
||||
_pressedTextureAdaptDirty = true;
|
||||
}
|
||||
|
||||
void Button::loadTexturePressed(SpriteFrame* pressedSpriteFrame)
|
||||
{
|
||||
_buttonClickedRenderer->initWithSpriteFrame(pressedSpriteFrame);
|
||||
this->setupPressedTexture();
|
||||
this->setupPressedTexture(nullptr != pressedSpriteFrame);
|
||||
}
|
||||
|
||||
void Button::loadTextureDisabled(const std::string& disabled,TextureResType texType)
|
||||
{
|
||||
_disabledFileName = disabled;
|
||||
_disabledTexType = texType;
|
||||
|
||||
bool textureLoaded = true;
|
||||
if (disabled.empty())
|
||||
{
|
||||
_buttonDisabledRenderer->init();
|
||||
textureLoaded = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -349,23 +352,23 @@ void Button::loadTextureDisabled(const std::string& disabled,TextureResType texT
|
|||
break;
|
||||
}
|
||||
}
|
||||
this->setupDisabledTexture();
|
||||
this->setupDisabledTexture(textureLoaded);
|
||||
}
|
||||
|
||||
void Button::setupDisabledTexture()
|
||||
void Button::setupDisabledTexture(bool textureLoaded)
|
||||
{
|
||||
_disabledTextureSize = _buttonDisabledRenderer->getContentSize();
|
||||
|
||||
this->updateChildrenDisplayedRGBA();
|
||||
|
||||
_disabledTextureLoaded = true;
|
||||
_disabledTextureLoaded = textureLoaded;
|
||||
_disabledTextureAdaptDirty = true;
|
||||
}
|
||||
|
||||
void Button::loadTextureDisabled(SpriteFrame* disabledSpriteFrame)
|
||||
{
|
||||
_buttonDisabledRenderer->initWithSpriteFrame(disabledSpriteFrame);
|
||||
this->setupDisabledTexture();
|
||||
this->setupDisabledTexture(nullptr != disabledSpriteFrame);
|
||||
}
|
||||
|
||||
void Button::setCapInsets(const Rect &capInsets)
|
||||
|
|
|
@ -322,11 +322,11 @@ protected:
|
|||
virtual void onSizeChanged() override;
|
||||
|
||||
void loadTextureNormal(SpriteFrame* normalSpriteFrame);
|
||||
void setupNormalTexture();
|
||||
void setupNormalTexture(bool textureLoaded);
|
||||
void loadTexturePressed(SpriteFrame* pressedSpriteFrame);
|
||||
void setupPressedTexture();
|
||||
void setupPressedTexture(bool textureLoaded);
|
||||
void loadTextureDisabled(SpriteFrame* disabledSpriteFrame);
|
||||
void setupDisabledTexture();
|
||||
void setupDisabledTexture(bool textureLoaded);
|
||||
|
||||
void normalTextureScaleChangedWithSize();
|
||||
void pressedTextureScaleChangedWithSize();
|
||||
|
|
|
@ -402,6 +402,8 @@
|
|||
"cocos/base/CCScheduler.h",
|
||||
"cocos/base/CCScriptSupport.cpp",
|
||||
"cocos/base/CCScriptSupport.h",
|
||||
"cocos/base/CCStencilStateManager.cpp",
|
||||
"cocos/base/CCStencilStateManager.hpp",
|
||||
"cocos/base/CCTouch.cpp",
|
||||
"cocos/base/CCTouch.h",
|
||||
"cocos/base/CCUserDefault-android.cpp",
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
USING_NS_CC;
|
||||
using namespace ui;
|
||||
using namespace extension;
|
||||
|
||||
enum {
|
||||
kTagTileMap = 1,
|
||||
|
@ -88,6 +89,14 @@ NewLabelTests::NewLabelTests()
|
|||
ADD_TEST_CASE(LabelIssue10688Test);
|
||||
ADD_TEST_CASE(LabelIssue13202Test);
|
||||
ADD_TEST_CASE(LabelIssue9500Test);
|
||||
ADD_TEST_CASE(LabelWrapByWordTest);
|
||||
ADD_TEST_CASE(LabelWrapByCharTest);
|
||||
ADD_TEST_CASE(LabelShrinkByWordTest);
|
||||
ADD_TEST_CASE(LabelShrinkByCharTest);
|
||||
ADD_TEST_CASE(LabelResizeTest);
|
||||
ADD_TEST_CASE(LabelToggleTypeTest);
|
||||
ADD_TEST_CASE(LabelSystemFontTest);
|
||||
ADD_TEST_CASE(LabelCharMapFontTest);
|
||||
};
|
||||
|
||||
LabelFNTColorAndOpacity::LabelFNTColorAndOpacity()
|
||||
|
@ -2003,3 +2012,741 @@ std::string LabelIssue9500Test::subtitle() const
|
|||
{
|
||||
return "Spaces should not be lost if label created with Fingerpop.ttf";
|
||||
}
|
||||
|
||||
ControlStepper *LabelLayoutBaseTest::makeControlStepper()
|
||||
{
|
||||
auto minusSprite = Sprite::create("extensions/stepper-minus.png");
|
||||
auto plusSprite = Sprite::create("extensions/stepper-plus.png");
|
||||
|
||||
return ControlStepper::create(minusSprite, plusSprite);
|
||||
}
|
||||
|
||||
LabelLayoutBaseTest::LabelLayoutBaseTest()
|
||||
{
|
||||
auto size = Director::getInstance()->getVisibleSize();
|
||||
|
||||
this->initTestLabel(size);
|
||||
|
||||
this->initFontSizeChange(size);
|
||||
this->initToggleLabelTypeOption(size);
|
||||
|
||||
this->initWrapOption(size);
|
||||
|
||||
this->initAlignmentOption(size);
|
||||
|
||||
this->initDrawNode(size);
|
||||
|
||||
this->initSliders(size);
|
||||
}
|
||||
|
||||
void LabelLayoutBaseTest::initFontSizeChange(const cocos2d::Size& size)
|
||||
{
|
||||
auto fontSizeLabel = Label::createWithSystemFont("font size:20", "Arial", 10);
|
||||
fontSizeLabel->setName("fontSize");
|
||||
|
||||
ControlStepper *stepper = this->makeControlStepper();
|
||||
stepper->setPosition(size.width * 0.5 - stepper->getContentSize().width / 2,
|
||||
size.height * 0.8);
|
||||
stepper->setValue(20);
|
||||
stepper->addTargetWithActionForControlEvents(this,
|
||||
cccontrol_selector(LabelLayoutBaseTest::valueChanged),
|
||||
Control::EventType::VALUE_CHANGED);
|
||||
this->addChild(stepper);
|
||||
stepper->setName("stepper");
|
||||
stepper->setScale(0.5);
|
||||
|
||||
fontSizeLabel->setPosition(stepper->getPosition() -
|
||||
Vec2(stepper->getContentSize().width/2 + fontSizeLabel->getContentSize().width/2,0));
|
||||
this->addChild(fontSizeLabel);
|
||||
}
|
||||
|
||||
void LabelLayoutBaseTest::initWrapOption(const cocos2d::Size& size)
|
||||
{
|
||||
auto label = Label::createWithSystemFont("Enable Wrap:", "Arial", 10);
|
||||
label->setColor(Color3B::WHITE);
|
||||
label->setPosition(Vec2(size.width * 0.8f - 100, size.height * 0.8f));
|
||||
this->addChild(label);
|
||||
|
||||
CheckBox* checkBox = CheckBox::create("cocosui/check_box_normal.png",
|
||||
"cocosui/check_box_normal_press.png",
|
||||
"cocosui/check_box_active.png",
|
||||
"cocosui/check_box_normal_disable.png",
|
||||
"cocosui/check_box_active_disable.png");
|
||||
checkBox->setPosition(Vec2(size.width * 0.8f - 55, size.height * 0.8f));
|
||||
checkBox->setScale(0.5);
|
||||
checkBox->setSelected(true);
|
||||
checkBox->setName("toggleWrap");
|
||||
|
||||
checkBox->addEventListener([=](Ref* ref, CheckBox::EventType event){
|
||||
if (event == CheckBox::EventType::SELECTED) {
|
||||
_label->enableWrap(true);
|
||||
}else{
|
||||
_label->enableWrap(false);
|
||||
}
|
||||
this->updateDrawNodeSize(_label->getContentSize());
|
||||
});
|
||||
this->addChild(checkBox);
|
||||
}
|
||||
|
||||
void LabelLayoutBaseTest::initToggleLabelTypeOption(const cocos2d::Size& size)
|
||||
{
|
||||
auto label = Label::createWithSystemFont("Toggle Label Type:", "Arial", 10);
|
||||
label->setColor(Color3B::WHITE);
|
||||
label->setPosition(Vec2(size.width * 0.8f + 15, size.height * 0.8f));
|
||||
this->addChild(label);
|
||||
|
||||
CheckBox* checkBox = CheckBox::create("cocosui/check_box_normal.png",
|
||||
"cocosui/check_box_normal_press.png",
|
||||
"cocosui/check_box_active.png",
|
||||
"cocosui/check_box_normal_disable.png",
|
||||
"cocosui/check_box_active_disable.png");
|
||||
checkBox->setPosition(Vec2(size.width * 0.8f + 70, size.height * 0.8f));
|
||||
checkBox->setScale(0.5);
|
||||
checkBox->setName("toggleType");
|
||||
checkBox->setSelected(true);
|
||||
|
||||
auto stepper = (ControlStepper*)this->getChildByName("stepper");
|
||||
|
||||
checkBox->addEventListener([=](Ref* ref, CheckBox::EventType event){
|
||||
float fontSize = stepper->getValue();
|
||||
|
||||
if (event == CheckBox::EventType::SELECTED) {
|
||||
_labelType = 0;
|
||||
auto ttfConfig = _label->getTTFConfig();
|
||||
ttfConfig.fontSize = fontSize;
|
||||
_label->setTTFConfig(ttfConfig);
|
||||
}else{
|
||||
_labelType = 1;
|
||||
_label->setBMFontFilePath("fonts/enligsh-chinese.fnt");
|
||||
_label->setBMFontSize(fontSize);
|
||||
}
|
||||
});
|
||||
this->addChild(checkBox);
|
||||
|
||||
}
|
||||
|
||||
void LabelLayoutBaseTest::initAlignmentOption(const cocos2d::Size& size)
|
||||
{
|
||||
//add text alignment settings
|
||||
MenuItemFont::setFontSize(30);
|
||||
auto menu = Menu::create(
|
||||
MenuItemFont::create("Left", CC_CALLBACK_1(LabelLayoutBaseTest::setAlignmentLeft, this)),
|
||||
MenuItemFont::create("Center", CC_CALLBACK_1(LabelLayoutBaseTest::setAlignmentCenter, this)),
|
||||
MenuItemFont::create("Right", CC_CALLBACK_1(LabelLayoutBaseTest::setAlignmentRight, this)),
|
||||
nullptr);
|
||||
menu->alignItemsVerticallyWithPadding(4);
|
||||
menu->setPosition(Vec2(50, size.height / 2 - 20));
|
||||
this->addChild(menu);
|
||||
|
||||
menu = Menu::create(
|
||||
MenuItemFont::create("Top", CC_CALLBACK_1(LabelLayoutBaseTest::setAlignmentTop, this)),
|
||||
MenuItemFont::create("Middle", CC_CALLBACK_1(LabelLayoutBaseTest::setAlignmentMiddle, this)),
|
||||
MenuItemFont::create("Bottom", CC_CALLBACK_1(LabelLayoutBaseTest::setAlignmentBottom, this)),
|
||||
nullptr);
|
||||
menu->alignItemsVerticallyWithPadding(4);
|
||||
menu->setPosition(Vec2(size.width - 50, size.height / 2 - 20));
|
||||
this->addChild(menu);
|
||||
}
|
||||
|
||||
void LabelLayoutBaseTest::initSliders(const cocos2d::Size& size)
|
||||
{
|
||||
auto slider = ui::Slider::create();
|
||||
slider->setTag(1);
|
||||
slider->setTouchEnabled(true);
|
||||
slider->loadBarTexture("cocosui/sliderTrack.png");
|
||||
slider->loadSlidBallTextures("cocosui/sliderThumb.png", "cocosui/sliderThumb.png", "");
|
||||
slider->loadProgressBarTexture("cocosui/sliderProgress.png");
|
||||
slider->setPosition(Vec2(size.width / 2.0f, size.height * 0.15f + slider->getContentSize().height * 2.0f - 5));
|
||||
slider->setPercent(52);
|
||||
addChild(slider);
|
||||
|
||||
auto slider2 = ui::Slider::create();
|
||||
slider2->setTag(2);
|
||||
slider2->setTouchEnabled(true);
|
||||
slider2->loadBarTexture("cocosui/sliderTrack.png");
|
||||
slider2->loadSlidBallTextures("cocosui/sliderThumb.png", "cocosui/sliderThumb.png", "");
|
||||
slider2->loadProgressBarTexture("cocosui/sliderProgress.png");
|
||||
slider2->setPosition(Vec2(size.width * 0.2f, size.height / 2.0));
|
||||
slider2->setRotation(90);
|
||||
slider2->setPercent(52);
|
||||
addChild(slider2);
|
||||
auto winSize = Director::getInstance()->getVisibleSize();
|
||||
|
||||
slider->addEventListener([=](Ref* ref, Slider::EventType event){
|
||||
float percent = slider->getPercent();
|
||||
auto labelSize = _label->getContentSize();
|
||||
auto drawNodeSize = Size(percent / 100.0 * winSize.width, labelSize.height);
|
||||
if(drawNodeSize.width <=0){
|
||||
drawNodeSize.width = 0.1f;
|
||||
}
|
||||
_label->setDimensions(drawNodeSize.width, drawNodeSize.height);
|
||||
this->updateDrawNodeSize(drawNodeSize);
|
||||
});
|
||||
|
||||
slider2->addEventListener([=](Ref* ref, Slider::EventType event){
|
||||
float percent = slider2->getPercent();
|
||||
auto labelSize = _label->getContentSize();
|
||||
auto drawNodeSize = Size( labelSize.width, percent / 100.0 * winSize.height);
|
||||
if(drawNodeSize.height <= 0){
|
||||
drawNodeSize.height = 0.1f;
|
||||
}
|
||||
_label->setDimensions(drawNodeSize.width, drawNodeSize.height);
|
||||
this->updateDrawNodeSize(drawNodeSize);
|
||||
});
|
||||
}
|
||||
|
||||
void LabelLayoutBaseTest::initTestLabel(const cocos2d::Size& size)
|
||||
{
|
||||
auto center = VisibleRect::center();
|
||||
_label = Label::createWithTTF("五六七八This is a very long sentence一二三四.", "fonts/HKYuanMini.ttf", 20);
|
||||
_label->setDimensions(size.width/2, size.height/2);
|
||||
_label->setPosition(center);
|
||||
_label->setName("Label");
|
||||
_label->setString("五六七八This is a very long sentence一二三.");
|
||||
addChild(_label);
|
||||
_labelType = 0;
|
||||
}
|
||||
|
||||
void LabelLayoutBaseTest::initDrawNode(const cocos2d::Size& size)
|
||||
{
|
||||
_drawNode = DrawNode::create();
|
||||
|
||||
_drawNode->setTag(3);
|
||||
addChild(_drawNode);
|
||||
this->updateDrawNodeSize(_label->getContentSize());
|
||||
}
|
||||
|
||||
|
||||
void LabelLayoutBaseTest::setAlignmentLeft(Ref* sender)
|
||||
{
|
||||
_label->setHorizontalAlignment(TextHAlignment::LEFT);
|
||||
}
|
||||
|
||||
void LabelLayoutBaseTest::setAlignmentCenter(Ref* sender)
|
||||
{
|
||||
_label->setHorizontalAlignment(TextHAlignment::CENTER);
|
||||
}
|
||||
|
||||
void LabelLayoutBaseTest::setAlignmentRight(Ref* sender)
|
||||
{
|
||||
_label->setHorizontalAlignment(TextHAlignment::RIGHT);
|
||||
}
|
||||
|
||||
void LabelLayoutBaseTest::setAlignmentTop(Ref* sender)
|
||||
{
|
||||
_label->setVerticalAlignment(TextVAlignment::TOP);
|
||||
}
|
||||
|
||||
void LabelLayoutBaseTest::setAlignmentMiddle(Ref* sender)
|
||||
{
|
||||
_label->setVerticalAlignment(TextVAlignment::CENTER);
|
||||
}
|
||||
|
||||
void LabelLayoutBaseTest::setAlignmentBottom(Ref* sender)
|
||||
{
|
||||
_label->setVerticalAlignment(TextVAlignment::BOTTOM);
|
||||
}
|
||||
|
||||
|
||||
void LabelLayoutBaseTest::valueChanged(cocos2d::Ref *sender, cocos2d::extension::Control::EventType controlEvent)
|
||||
{
|
||||
ControlStepper* pControl = (ControlStepper*)sender;
|
||||
// Change value of label.
|
||||
auto fontSizeLabel = (Label*)this->getChildByName("fontSize");
|
||||
float fontSize = (float)pControl->getValue();
|
||||
fontSizeLabel->setString(StringUtils::format("font size:%d", (int)fontSize));
|
||||
|
||||
if (_labelType == 0) {
|
||||
auto ttfConfig = _label->getTTFConfig();
|
||||
ttfConfig.fontSize = fontSize;
|
||||
_label->setTTFConfig(ttfConfig);
|
||||
}else if(_labelType == 1){
|
||||
_label->setBMFontSize(fontSize);
|
||||
}
|
||||
this->updateDrawNodeSize(_label->getContentSize());
|
||||
|
||||
//FIXME::When calling getLetter, the label Overflow feature will be invalid.
|
||||
// auto letterSprite = _label->getLetter(1);
|
||||
// auto moveBy = ScaleBy::create(1.0,2.0);
|
||||
// letterSprite->stopAllActions();
|
||||
// letterSprite->runAction(Sequence::create(moveBy, moveBy->clone()->reverse(), nullptr ));
|
||||
//
|
||||
// CCLOG("label line height = %f", _label->getLineHeight());
|
||||
}
|
||||
|
||||
void LabelLayoutBaseTest::updateDrawNodeSize(const cocos2d::Size &drawNodeSize)
|
||||
{
|
||||
auto origin = Director::getInstance()->getWinSize();
|
||||
auto labelSize = _label->getContentSize();
|
||||
|
||||
origin.width = origin.width / 2 - (labelSize.width / 2);
|
||||
origin.height = origin.height / 2 - (labelSize.height / 2);
|
||||
|
||||
Vec2 vertices[4]=
|
||||
{
|
||||
Vec2(origin.width, origin.height),
|
||||
Vec2(drawNodeSize.width + origin.width, origin.height),
|
||||
Vec2(drawNodeSize.width + origin.width, drawNodeSize.height + origin.height),
|
||||
Vec2(origin.width, drawNodeSize.height + origin.height)
|
||||
};
|
||||
_drawNode->clear();
|
||||
_drawNode->drawLine(vertices[0], vertices[1], Color4F(1.0, 1.0, 1.0, 1.0));
|
||||
_drawNode->drawLine(vertices[0], vertices[3], Color4F(1.0, 1.0, 1.0, 1.0));
|
||||
_drawNode->drawLine(vertices[2], vertices[3], Color4F(1.0, 1.0, 1.0, 1.0));
|
||||
_drawNode->drawLine(vertices[1], vertices[2], Color4F(1.0, 1.0, 1.0, 1.0));
|
||||
|
||||
}
|
||||
|
||||
LabelWrapByWordTest::LabelWrapByWordTest()
|
||||
{
|
||||
_label->setLineSpacing(5);
|
||||
_label->setAdditionalKerning(2);
|
||||
_label->setVerticalAlignment(TextVAlignment::CENTER);
|
||||
_label->setOverflow(Label::Overflow::CLAMP);
|
||||
|
||||
}
|
||||
|
||||
std::string LabelWrapByWordTest::title() const
|
||||
{
|
||||
return "Clamp content Test: Word Wrap";
|
||||
}
|
||||
|
||||
std::string LabelWrapByWordTest::subtitle() const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
LabelWrapByCharTest::LabelWrapByCharTest()
|
||||
{
|
||||
_label->setLineBreakWithoutSpace(true);
|
||||
_label->setString("五六七八This \nis a very long sentence一二三四.");
|
||||
_label->setLineSpacing(5);
|
||||
_label->setAdditionalKerning(2);
|
||||
_label->setVerticalAlignment(TextVAlignment::TOP);
|
||||
_label->setOverflow(Label::Overflow::CLAMP);
|
||||
|
||||
}
|
||||
|
||||
std::string LabelWrapByCharTest::title() const
|
||||
{
|
||||
return "Clamp content Test: Char Wrap";
|
||||
}
|
||||
|
||||
std::string LabelWrapByCharTest::subtitle() const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
LabelShrinkByWordTest::LabelShrinkByWordTest()
|
||||
{
|
||||
_label->setLineSpacing(5);
|
||||
_label->setAdditionalKerning(2);
|
||||
_label->setString("This is Hello World hehe I love 一二三");
|
||||
_label->setVerticalAlignment(TextVAlignment::TOP);
|
||||
_label->setOverflow(Label::Overflow::SHRINK);
|
||||
}
|
||||
|
||||
std::string LabelShrinkByWordTest::title() const
|
||||
{
|
||||
return "Shrink content Test: Word Wrap";
|
||||
}
|
||||
|
||||
std::string LabelShrinkByWordTest::subtitle() const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
LabelShrinkByCharTest::LabelShrinkByCharTest()
|
||||
{
|
||||
_label->setLineSpacing(5);
|
||||
_label->setAdditionalKerning(2);
|
||||
_label->setLineBreakWithoutSpace(true);
|
||||
_label->setString("This is Hello World hehe I love 一二三");
|
||||
_label->setVerticalAlignment(TextVAlignment::CENTER);
|
||||
_label->setOverflow(Label::Overflow::SHRINK);
|
||||
}
|
||||
|
||||
std::string LabelShrinkByCharTest::title() const
|
||||
{
|
||||
return "Shrink content Test: Char Wrap";
|
||||
}
|
||||
|
||||
std::string LabelShrinkByCharTest::subtitle() const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
LabelResizeTest::LabelResizeTest()
|
||||
{
|
||||
_label->setLineSpacing(5);
|
||||
_label->setAdditionalKerning(2);
|
||||
_label->setVerticalAlignment(TextVAlignment::TOP);
|
||||
_label->setOverflow(Label::Overflow::RESIZE_HEIGHT);
|
||||
|
||||
|
||||
this->updateDrawNodeSize(_label->getContentSize());
|
||||
|
||||
auto slider1 = (ui::Slider*)this->getChildByTag(1);
|
||||
|
||||
auto slider2 = (ui::Slider*)this->getChildByTag(2);
|
||||
slider2->setVisible(false);
|
||||
|
||||
auto winSize = Director::getInstance()->getVisibleSize();
|
||||
slider1->addEventListener([=](Ref* ref, Slider::EventType event){
|
||||
float percent = slider1->getPercent();
|
||||
auto drawNodeSize = Size(percent / 100.0 * winSize.width,_label->getContentSize().height);
|
||||
if(drawNodeSize.height <= 0){
|
||||
drawNodeSize.height = 0.1f;
|
||||
}
|
||||
_label->setDimensions(drawNodeSize.width, drawNodeSize.height);
|
||||
this->updateDrawNodeSize(drawNodeSize);
|
||||
});
|
||||
|
||||
auto stepper = (ControlStepper*)this->getChildByName("stepper");
|
||||
stepper->setValue(12);
|
||||
|
||||
auto label = Label::createWithSystemFont("Char Line break:", "Arial", 10);
|
||||
label->setColor(Color3B::WHITE);
|
||||
label->setPosition(Vec2(winSize.width * 0.1f, winSize.height * 0.8f));
|
||||
this->addChild(label);
|
||||
|
||||
CheckBox* checkBox = CheckBox::create("cocosui/check_box_normal.png",
|
||||
"cocosui/check_box_normal_press.png",
|
||||
"cocosui/check_box_active.png",
|
||||
"cocosui/check_box_normal_disable.png",
|
||||
"cocosui/check_box_active_disable.png");
|
||||
checkBox->setPosition(Vec2(winSize.width * 0.2f , winSize.height * 0.8f));
|
||||
checkBox->setScale(0.5);
|
||||
checkBox->setSelected(false);
|
||||
checkBox->setName("LineBreak");
|
||||
|
||||
checkBox->addEventListener([=](Ref* ref, CheckBox::EventType event){
|
||||
if (event == CheckBox::EventType::SELECTED) {
|
||||
_label->setLineBreakWithoutSpace(true);
|
||||
}else{
|
||||
_label->setLineBreakWithoutSpace(false);
|
||||
}
|
||||
this->updateDrawNodeSize(_label->getContentSize());
|
||||
});
|
||||
this->addChild(checkBox);
|
||||
|
||||
}
|
||||
|
||||
std::string LabelResizeTest::title() const
|
||||
{
|
||||
return "Resize content Test";
|
||||
}
|
||||
|
||||
std::string LabelResizeTest::subtitle() const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
LabelToggleTypeTest::LabelToggleTypeTest()
|
||||
{
|
||||
_label->setLineSpacing(5);
|
||||
_label->setAdditionalKerning(2);
|
||||
_label->setVerticalAlignment(TextVAlignment::CENTER);
|
||||
_label->setOverflow(Label::Overflow::NORMAL);
|
||||
|
||||
|
||||
this->updateDrawNodeSize(_label->getContentSize());
|
||||
|
||||
auto slider1 = (ui::Slider*)this->getChildByTag(1);
|
||||
|
||||
auto slider2 = (ui::Slider*)this->getChildByTag(2);
|
||||
slider2->setVisible(false);
|
||||
|
||||
auto winSize = Director::getInstance()->getVisibleSize();
|
||||
slider1->addEventListener([=](Ref* ref, Slider::EventType event){
|
||||
float percent = slider1->getPercent();
|
||||
auto drawNodeSize = Size(percent / 100.0 * winSize.width,_label->getContentSize().height);
|
||||
if(drawNodeSize.height <= 0){
|
||||
drawNodeSize.height = 0.1f;
|
||||
}
|
||||
_label->setDimensions(drawNodeSize.width, drawNodeSize.height);
|
||||
this->updateDrawNodeSize(drawNodeSize);
|
||||
});
|
||||
|
||||
auto stepper = (ControlStepper*)this->getChildByName("stepper");
|
||||
stepper->setValue(12);
|
||||
|
||||
auto label = Label::createWithSystemFont("Char Line break:", "Arial", 10);
|
||||
label->setColor(Color3B::WHITE);
|
||||
label->setPosition(Vec2(winSize.width * 0.1f, winSize.height * 0.8f));
|
||||
this->addChild(label);
|
||||
|
||||
CheckBox* checkBox = CheckBox::create("cocosui/check_box_normal.png",
|
||||
"cocosui/check_box_normal_press.png",
|
||||
"cocosui/check_box_active.png",
|
||||
"cocosui/check_box_normal_disable.png",
|
||||
"cocosui/check_box_active_disable.png");
|
||||
checkBox->setPosition(Vec2(winSize.width * 0.2f , winSize.height * 0.8f));
|
||||
checkBox->setScale(0.5);
|
||||
checkBox->setSelected(false);
|
||||
checkBox->setName("LineBreak");
|
||||
|
||||
checkBox->addEventListener([=](Ref* ref, CheckBox::EventType event){
|
||||
if (event == CheckBox::EventType::SELECTED) {
|
||||
_label->setLineBreakWithoutSpace(true);
|
||||
}else{
|
||||
_label->setLineBreakWithoutSpace(false);
|
||||
}
|
||||
this->updateDrawNodeSize(_label->getContentSize());
|
||||
});
|
||||
this->addChild(checkBox);
|
||||
|
||||
this->initToggleCheckboxes();
|
||||
}
|
||||
|
||||
void LabelToggleTypeTest::initToggleCheckboxes()
|
||||
{
|
||||
const float BUTTON_WIDTH = 100;
|
||||
float startPosX = 0;
|
||||
Size winSize = Director::getInstance()->getVisibleSize();
|
||||
|
||||
// Create a radio button group
|
||||
auto radioButtonGroup = RadioButtonGroup::create();
|
||||
this->addChild(radioButtonGroup);
|
||||
|
||||
// Create the radio buttons
|
||||
static const int NUMBER_OF_BUTTONS = 4;
|
||||
startPosX = winSize.width / 2.0f - (NUMBER_OF_BUTTONS - 1 ) * 0.5 * BUTTON_WIDTH - 30;
|
||||
std::vector<std::string> labelTypes = {"Normal", "Clamp", "Shrink", "RESIZE"};
|
||||
|
||||
for(int i = 0; i < NUMBER_OF_BUTTONS; ++i)
|
||||
{
|
||||
|
||||
RadioButton* radioButton = RadioButton::create("cocosui/radio_button_off.png", "cocosui/radio_button_on.png");
|
||||
float posX = startPosX + BUTTON_WIDTH * i;
|
||||
radioButton->setPosition(Vec2(posX, winSize.height / 2.0f + 70));
|
||||
radioButton->setScale(1.2f);
|
||||
radioButton->addEventListener(CC_CALLBACK_2(LabelToggleTypeTest::onChangedRadioButtonSelect, this));
|
||||
radioButton->setTag(i);
|
||||
radioButtonGroup->addRadioButton(radioButton);
|
||||
this->addChild(radioButton);
|
||||
|
||||
auto label = Label::createWithSystemFont(labelTypes.at(i), "Arial", 20);
|
||||
label->setPosition(radioButton->getPosition() + Vec2(50,0));
|
||||
this->addChild(label);
|
||||
}
|
||||
}
|
||||
|
||||
std::string LabelToggleTypeTest::title() const
|
||||
{
|
||||
return "Toggle Label Type Test";
|
||||
}
|
||||
|
||||
std::string LabelToggleTypeTest::subtitle() const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
void LabelToggleTypeTest::onChangedRadioButtonSelect(RadioButton* radioButton, RadioButton::EventType type)
|
||||
{
|
||||
if(radioButton == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case RadioButton::EventType::SELECTED:
|
||||
{
|
||||
switch (radioButton->getTag()) {
|
||||
case 0:
|
||||
_label->setOverflow(Label::Overflow::NORMAL);
|
||||
break;
|
||||
case 1:
|
||||
_label->setOverflow(Label::Overflow::CLAMP);
|
||||
break;
|
||||
case 2:
|
||||
_label->setOverflow(Label::Overflow::SHRINK);
|
||||
break;
|
||||
case 3:
|
||||
_label->setOverflow(Label::Overflow::RESIZE_HEIGHT);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
auto checkbox = (CheckBox*)(this->getChildByName("toggleWrap"));
|
||||
checkbox->setSelected(_label->isWrapEnabled());
|
||||
this->updateDrawNodeSize(_label->getContentSize());
|
||||
}
|
||||
|
||||
LabelSystemFontTest::LabelSystemFontTest()
|
||||
{
|
||||
_label->setLineSpacing(5);
|
||||
_label->setVerticalAlignment(TextVAlignment::CENTER);
|
||||
_label->setOverflow(Label::Overflow::NORMAL);
|
||||
_label->setSystemFontName("Hiragino Sans GB");
|
||||
|
||||
auto stepper = (ControlStepper*)this->getChildByName("stepper");
|
||||
stepper->setEnabled(false);
|
||||
|
||||
auto checkbox = (CheckBox*)(this->getChildByName("toggleType"));
|
||||
checkbox->setEnabled(false);
|
||||
|
||||
this->updateDrawNodeSize(_label->getContentSize());
|
||||
|
||||
auto slider1 = (ui::Slider*)this->getChildByTag(1);
|
||||
|
||||
auto slider2 = (ui::Slider*)this->getChildByTag(2);
|
||||
slider2->setVisible(false);
|
||||
|
||||
auto winSize = Director::getInstance()->getVisibleSize();
|
||||
slider1->addEventListener([=](Ref* ref, Slider::EventType event){
|
||||
float percent = slider1->getPercent();
|
||||
auto drawNodeSize = Size(percent / 100.0 * winSize.width,_label->getContentSize().height);
|
||||
if(drawNodeSize.height <= 0){
|
||||
drawNodeSize.height = 0.1f;
|
||||
}
|
||||
_label->setDimensions(drawNodeSize.width, drawNodeSize.height);
|
||||
this->updateDrawNodeSize(drawNodeSize);
|
||||
});
|
||||
|
||||
|
||||
auto label = Label::createWithSystemFont("char Line break:", "Arial", 10);
|
||||
label->setColor(Color3B::WHITE);
|
||||
label->setPosition(Vec2(winSize.width * 0.1f, winSize.height * 0.8f));
|
||||
this->addChild(label);
|
||||
|
||||
CheckBox* checkBox = CheckBox::create("cocosui/check_box_normal.png",
|
||||
"cocosui/check_box_normal_press.png",
|
||||
"cocosui/check_box_active.png",
|
||||
"cocosui/check_box_normal_disable.png",
|
||||
"cocosui/check_box_active_disable.png");
|
||||
checkBox->setPosition(Vec2(winSize.width * 0.2f , winSize.height * 0.8f));
|
||||
checkBox->setScale(0.5);
|
||||
checkBox->setSelected(false);
|
||||
checkBox->setName("LineBreak");
|
||||
|
||||
checkBox->addEventListener([=](Ref* ref, CheckBox::EventType event){
|
||||
if (event == CheckBox::EventType::SELECTED) {
|
||||
_label->setLineBreakWithoutSpace(true);
|
||||
}else{
|
||||
_label->setLineBreakWithoutSpace(false);
|
||||
}
|
||||
this->updateDrawNodeSize(_label->getContentSize());
|
||||
});
|
||||
this->addChild(checkBox);
|
||||
|
||||
this->initToggleCheckboxes();
|
||||
}
|
||||
|
||||
void LabelSystemFontTest::initToggleCheckboxes()
|
||||
{
|
||||
const float BUTTON_WIDTH = 100;
|
||||
float startPosX = 0;
|
||||
Size winSize = Director::getInstance()->getVisibleSize();
|
||||
|
||||
// Create a radio button group
|
||||
auto radioButtonGroup = RadioButtonGroup::create();
|
||||
this->addChild(radioButtonGroup);
|
||||
|
||||
// Create the radio buttons
|
||||
static const int NUMBER_OF_BUTTONS = 4;
|
||||
startPosX = winSize.width / 2.0f - (NUMBER_OF_BUTTONS - 1 ) * 0.5 * BUTTON_WIDTH - 30;
|
||||
std::vector<std::string> labelTypes = {"Normal", "Clamp", "Shrink", "RESIZE"};
|
||||
|
||||
for(int i = 0; i < NUMBER_OF_BUTTONS; ++i)
|
||||
{
|
||||
|
||||
RadioButton* radioButton = RadioButton::create("cocosui/radio_button_off.png", "cocosui/radio_button_on.png");
|
||||
float posX = startPosX + BUTTON_WIDTH * i;
|
||||
radioButton->setPosition(Vec2(posX, winSize.height / 2.0f + 70));
|
||||
radioButton->setScale(1.2f);
|
||||
radioButton->addEventListener(CC_CALLBACK_2(LabelSystemFontTest::onChangedRadioButtonSelect, this));
|
||||
radioButton->setTag(i);
|
||||
radioButtonGroup->addRadioButton(radioButton);
|
||||
this->addChild(radioButton);
|
||||
|
||||
auto label = Label::createWithSystemFont(labelTypes.at(i), "Arial", 20);
|
||||
label->setPosition(radioButton->getPosition() + Vec2(50,0));
|
||||
this->addChild(label);
|
||||
}
|
||||
}
|
||||
|
||||
std::string LabelSystemFontTest::title() const
|
||||
{
|
||||
return "System Font Test";
|
||||
}
|
||||
|
||||
std::string LabelSystemFontTest::subtitle() const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
void LabelSystemFontTest::onChangedRadioButtonSelect(RadioButton* radioButton, RadioButton::EventType type)
|
||||
{
|
||||
if(radioButton == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case RadioButton::EventType::SELECTED:
|
||||
{
|
||||
switch (radioButton->getTag()) {
|
||||
case 0:
|
||||
_label->setOverflow(Label::Overflow::NORMAL);
|
||||
break;
|
||||
case 1:
|
||||
_label->setOverflow(Label::Overflow::CLAMP);
|
||||
break;
|
||||
case 2:
|
||||
_label->setOverflow(Label::Overflow::SHRINK);
|
||||
break;
|
||||
case 3:
|
||||
_label->setOverflow(Label::Overflow::RESIZE_HEIGHT);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
auto checkbox = (CheckBox*)(this->getChildByName("toggleWrap"));
|
||||
checkbox->setSelected(_label->isWrapEnabled());
|
||||
this->updateDrawNodeSize(_label->getContentSize());
|
||||
}
|
||||
|
||||
LabelCharMapFontTest::LabelCharMapFontTest()
|
||||
{
|
||||
_label->setLineSpacing(5);
|
||||
_label->setVerticalAlignment(TextVAlignment::CENTER);
|
||||
_label->setOverflow(Label::Overflow::NORMAL);
|
||||
_label->setCharMap("fonts/tuffy_bold_italic-charmap.plist");
|
||||
_label->setString("Hello World, This is a char map test.");
|
||||
_label->setScale(0.5f);
|
||||
|
||||
auto stepper = (ControlStepper*)this->getChildByName("stepper");
|
||||
stepper->setEnabled(false);
|
||||
|
||||
auto checkbox = (CheckBox*)(this->getChildByName("toggleType"));
|
||||
checkbox->setEnabled(false);
|
||||
|
||||
this->updateDrawNodeSize(_label->getContentSize());
|
||||
|
||||
}
|
||||
|
||||
|
||||
std::string LabelCharMapFontTest::title() const
|
||||
{
|
||||
return "CharMap Font Test";
|
||||
}
|
||||
|
||||
std::string LabelCharMapFontTest::subtitle() const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "../BaseTest.h"
|
||||
#include "renderer/CCCustomCommand.h"
|
||||
#include "ui/CocosGUI.h"
|
||||
#include "extensions/cocos-ext.h"
|
||||
|
||||
DEFINE_TEST_SUITE(NewLabelTests);
|
||||
|
||||
|
@ -635,4 +636,123 @@ public:
|
|||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
class LabelLayoutBaseTest : public AtlasDemoNew
|
||||
{
|
||||
public:
|
||||
LabelLayoutBaseTest();
|
||||
void updateDrawNodeSize(const cocos2d::Size &drawNodeSize);
|
||||
cocos2d::extension::ControlStepper* makeControlStepper();
|
||||
void valueChanged(cocos2d::Ref* sender, cocos2d::extension::Control::EventType controlEvent);
|
||||
|
||||
protected:
|
||||
void setAlignmentLeft(cocos2d::Ref* sender);
|
||||
void setAlignmentCenter(cocos2d::Ref* sender);
|
||||
void setAlignmentRight(cocos2d::Ref* sender);
|
||||
void setAlignmentTop(cocos2d::Ref* sender);
|
||||
void setAlignmentMiddle(cocos2d::Ref* sender);
|
||||
void setAlignmentBottom(cocos2d::Ref* sender);
|
||||
|
||||
void initWrapOption(const cocos2d::Size& size);
|
||||
void initToggleLabelTypeOption(const cocos2d::Size& size);
|
||||
void initAlignmentOption(const cocos2d::Size& size);
|
||||
void initFontSizeChange(const cocos2d::Size& size);
|
||||
void initSliders(const cocos2d::Size& size);
|
||||
void initTestLabel(const cocos2d::Size& size);
|
||||
void initDrawNode(const cocos2d::Size& size);
|
||||
cocos2d::DrawNode* _drawNode;
|
||||
cocos2d::Label* _label;
|
||||
int _labelType;
|
||||
};
|
||||
|
||||
class LabelWrapByWordTest : public LabelLayoutBaseTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelWrapByWordTest);
|
||||
|
||||
LabelWrapByWordTest();
|
||||
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
class LabelWrapByCharTest : public LabelLayoutBaseTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelWrapByCharTest);
|
||||
|
||||
LabelWrapByCharTest();
|
||||
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
class LabelShrinkByWordTest : public LabelLayoutBaseTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelShrinkByWordTest);
|
||||
|
||||
LabelShrinkByWordTest();
|
||||
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
class LabelShrinkByCharTest : public LabelLayoutBaseTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelShrinkByCharTest);
|
||||
|
||||
LabelShrinkByCharTest();
|
||||
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
class LabelResizeTest : public LabelLayoutBaseTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelResizeTest);
|
||||
|
||||
LabelResizeTest();
|
||||
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
class LabelToggleTypeTest : public LabelLayoutBaseTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelToggleTypeTest);
|
||||
|
||||
LabelToggleTypeTest();
|
||||
void initToggleCheckboxes();
|
||||
void onChangedRadioButtonSelect(cocos2d::ui::RadioButton* radioButton,cocos2d::ui::RadioButton::EventType type);
|
||||
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
class LabelSystemFontTest : public LabelLayoutBaseTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelSystemFontTest);
|
||||
|
||||
LabelSystemFontTest();
|
||||
void initToggleCheckboxes();
|
||||
void onChangedRadioButtonSelect(cocos2d::ui::RadioButton* radioButton,cocos2d::ui::RadioButton::EventType type);
|
||||
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
class LabelCharMapFontTest : public LabelSystemFontTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelCharMapFontTest);
|
||||
|
||||
LabelCharMapFontTest();
|
||||
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,108 @@
|
|||
info face="DFYuanW7-GBK" size=40 bold=1 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=1,1,1,1 spacing=2,2
|
||||
common lineHeight=43 base=34 scaleW=512 scaleH=256 pages=1 packed=0
|
||||
page id=0 file="enligsh-chinese.png"
|
||||
chars count=104
|
||||
char id=32 x=261 y=151 width=0 height=0 xoffset=0 yoffset=37 xadvance=20 page=0 chnl=0 letter="space"
|
||||
char id=33 x=368 y=82 width=10 height=33 xoffset=7 yoffset=4 xadvance=20 page=0 chnl=0 letter="!"
|
||||
char id=34 x=44 y=151 width=14 height=15 xoffset=5 yoffset=0 xadvance=20 page=0 chnl=0 letter="""
|
||||
char id=35 x=419 y=47 width=20 height=33 xoffset=2 yoffset=5 xadvance=20 page=0 chnl=0 letter="#"
|
||||
char id=36 x=231 y=2 width=21 height=39 xoffset=1 yoffset=1 xadvance=20 page=0 chnl=0 letter="$"
|
||||
char id=37 x=480 y=2 width=22 height=33 xoffset=1 yoffset=4 xadvance=20 page=0 chnl=0 letter="%"
|
||||
char id=38 x=74 y=47 width=21 height=33 xoffset=1 yoffset=4 xadvance=20 page=0 chnl=0 letter="&"
|
||||
char id=39 x=60 y=151 width=11 height=14 xoffset=6 yoffset=0 xadvance=20 page=0 chnl=0 letter="'"
|
||||
char id=40 x=10 y=2 width=15 height=40 xoffset=4 yoffset=1 xadvance=20 page=0 chnl=0 letter="("
|
||||
char id=41 x=27 y=2 width=15 height=40 xoffset=4 yoffset=1 xadvance=20 page=0 chnl=0 letter=")"
|
||||
char id=42 x=212 y=117 width=23 height=26 xoffset=0 yoffset=8 xadvance=20 page=0 chnl=0 letter="*"
|
||||
char id=43 x=23 y=151 width=19 height=21 xoffset=2 yoffset=10 xadvance=20 page=0 chnl=0 letter="+"
|
||||
char id=44 x=107 y=151 width=9 height=13 xoffset=7 yoffset=28 xadvance=20 page=0 chnl=0 letter=","
|
||||
char id=45 x=190 y=151 width=19 height=7 xoffset=2 yoffset=17 xadvance=20 page=0 chnl=0 letter="-"
|
||||
char id=46 x=137 y=151 width=9 height=9 xoffset=7 yoffset=28 xadvance=20 page=0 chnl=0 letter="."
|
||||
char id=47 x=254 y=2 width=21 height=39 xoffset=1 yoffset=2 xadvance=20 page=0 chnl=0 letter="/"
|
||||
char id=48 x=176 y=82 width=18 height=33 xoffset=3 yoffset=4 xadvance=20 page=0 chnl=0 letter="0"
|
||||
char id=49 x=355 y=82 width=11 height=33 xoffset=6 yoffset=4 xadvance=20 page=0 chnl=0 letter="1"
|
||||
char id=50 x=196 y=82 width=18 height=33 xoffset=3 yoffset=3 xadvance=20 page=0 chnl=0 letter="2"
|
||||
char id=51 x=216 y=82 width=18 height=33 xoffset=3 yoffset=4 xadvance=20 page=0 chnl=0 letter="3"
|
||||
char id=52 x=441 y=47 width=20 height=33 xoffset=2 yoffset=4 xadvance=20 page=0 chnl=0 letter="4"
|
||||
char id=53 x=236 y=82 width=18 height=33 xoffset=3 yoffset=4 xadvance=20 page=0 chnl=0 letter="5"
|
||||
char id=54 x=256 y=82 width=18 height=33 xoffset=3 yoffset=4 xadvance=20 page=0 chnl=0 letter="6"
|
||||
char id=55 x=276 y=82 width=18 height=33 xoffset=3 yoffset=4 xadvance=20 page=0 chnl=0 letter="7"
|
||||
char id=56 x=296 y=82 width=18 height=33 xoffset=3 yoffset=4 xadvance=20 page=0 chnl=0 letter="8"
|
||||
char id=57 x=316 y=82 width=18 height=33 xoffset=3 yoffset=4 xadvance=20 page=0 chnl=0 letter="9"
|
||||
char id=58 x=495 y=117 width=10 height=24 xoffset=7 yoffset=13 xadvance=20 page=0 chnl=0 letter=":"
|
||||
char id=59 x=200 y=117 width=10 height=28 xoffset=7 yoffset=13 xadvance=20 page=0 chnl=0 letter=";"
|
||||
char id=60 x=47 y=117 width=20 height=31 xoffset=2 yoffset=5 xadvance=20 page=0 chnl=0 letter="<"
|
||||
char id=61 x=86 y=151 width=19 height=13 xoffset=2 yoffset=14 xadvance=20 page=0 chnl=0 letter="="
|
||||
char id=62 x=69 y=117 width=20 height=31 xoffset=2 yoffset=5 xadvance=20 page=0 chnl=0 letter=">"
|
||||
char id=63 x=97 y=47 width=21 height=33 xoffset=1 yoffset=4 xadvance=20 page=0 chnl=0 letter="?"
|
||||
char id=64 x=120 y=47 width=21 height=33 xoffset=1 yoffset=4 xadvance=20 page=0 chnl=0 letter="@"
|
||||
char id=65 x=143 y=47 width=21 height=33 xoffset=1 yoffset=4 xadvance=20 page=0 chnl=0 letter="A"
|
||||
char id=66 x=451 y=82 width=21 height=32 xoffset=1 yoffset=4 xadvance=20 page=0 chnl=0 letter="B"
|
||||
char id=67 x=166 y=47 width=21 height=33 xoffset=1 yoffset=4 xadvance=20 page=0 chnl=0 letter="C"
|
||||
char id=68 x=474 y=82 width=21 height=32 xoffset=1 yoffset=4 xadvance=20 page=0 chnl=0 letter="D"
|
||||
char id=69 x=25 y=117 width=20 height=32 xoffset=2 yoffset=4 xadvance=20 page=0 chnl=0 letter="E"
|
||||
char id=70 x=463 y=47 width=20 height=33 xoffset=2 yoffset=4 xadvance=20 page=0 chnl=0 letter="F"
|
||||
char id=71 x=189 y=47 width=21 height=33 xoffset=1 yoffset=4 xadvance=20 page=0 chnl=0 letter="G"
|
||||
char id=72 x=485 y=47 width=20 height=33 xoffset=2 yoffset=4 xadvance=20 page=0 chnl=0 letter="H"
|
||||
char id=73 x=390 y=82 width=7 height=33 xoffset=8 yoffset=4 xadvance=20 page=0 chnl=0 letter="I"
|
||||
char id=74 x=212 y=47 width=21 height=33 xoffset=1 yoffset=4 xadvance=20 page=0 chnl=0 letter="J"
|
||||
char id=75 x=2 y=82 width=20 height=33 xoffset=2 yoffset=4 xadvance=20 page=0 chnl=0 letter="K"
|
||||
char id=76 x=24 y=82 width=20 height=33 xoffset=2 yoffset=3 xadvance=20 page=0 chnl=0 letter="L"
|
||||
char id=77 x=2 y=47 width=22 height=33 xoffset=1 yoffset=4 xadvance=20 page=0 chnl=0 letter="M"
|
||||
char id=78 x=46 y=82 width=20 height=33 xoffset=2 yoffset=4 xadvance=20 page=0 chnl=0 letter="N"
|
||||
char id=79 x=26 y=47 width=22 height=33 xoffset=1 yoffset=4 xadvance=20 page=0 chnl=0 letter="O"
|
||||
char id=80 x=235 y=47 width=21 height=33 xoffset=1 yoffset=4 xadvance=20 page=0 chnl=0 letter="P"
|
||||
char id=81 x=258 y=47 width=21 height=33 xoffset=1 yoffset=4 xadvance=20 page=0 chnl=0 letter="Q"
|
||||
char id=82 x=281 y=47 width=21 height=33 xoffset=1 yoffset=4 xadvance=20 page=0 chnl=0 letter="R"
|
||||
char id=83 x=304 y=47 width=21 height=33 xoffset=1 yoffset=4 xadvance=20 page=0 chnl=0 letter="S"
|
||||
char id=84 x=50 y=47 width=22 height=33 xoffset=1 yoffset=4 xadvance=20 page=0 chnl=0 letter="T"
|
||||
char id=85 x=68 y=82 width=20 height=33 xoffset=2 yoffset=4 xadvance=20 page=0 chnl=0 letter="U"
|
||||
char id=86 x=327 y=47 width=21 height=33 xoffset=1 yoffset=4 xadvance=20 page=0 chnl=0 letter="V"
|
||||
char id=87 x=350 y=47 width=21 height=33 xoffset=1 yoffset=4 xadvance=20 page=0 chnl=0 letter="W"
|
||||
char id=88 x=373 y=47 width=21 height=33 xoffset=1 yoffset=4 xadvance=20 page=0 chnl=0 letter="X"
|
||||
char id=89 x=396 y=47 width=21 height=33 xoffset=1 yoffset=4 xadvance=20 page=0 chnl=0 letter="Y"
|
||||
char id=90 x=2 y=117 width=21 height=32 xoffset=1 yoffset=4 xadvance=20 page=0 chnl=0 letter="Z"
|
||||
char id=91 x=44 y=2 width=13 height=40 xoffset=5 yoffset=1 xadvance=20 page=0 chnl=0 letter="["
|
||||
char id=92 x=277 y=2 width=21 height=39 xoffset=1 yoffset=2 xadvance=20 page=0 chnl=0 letter="\"
|
||||
char id=93 x=59 y=2 width=13 height=40 xoffset=5 yoffset=1 xadvance=20 page=0 chnl=0 letter="]"
|
||||
char id=94 x=118 y=151 width=17 height=9 xoffset=3 yoffset=2 xadvance=20 page=0 chnl=0 letter="^"
|
||||
char id=95 x=211 y=151 width=23 height=6 xoffset=0 yoffset=37 xadvance=20 page=0 chnl=0 letter="_"
|
||||
char id=96 x=73 y=151 width=11 height=14 xoffset=6 yoffset=0 xadvance=20 page=0 chnl=0 letter="`"
|
||||
char id=97 x=395 y=117 width=19 height=24 xoffset=2 yoffset=13 xadvance=20 page=0 chnl=0 letter="a"
|
||||
char id=98 x=90 y=82 width=20 height=33 xoffset=2 yoffset=4 xadvance=20 page=0 chnl=0 letter="b"
|
||||
char id=99 x=285 y=117 width=20 height=24 xoffset=2 yoffset=13 xadvance=20 page=0 chnl=0 letter="c"
|
||||
char id=100 x=112 y=82 width=20 height=33 xoffset=2 yoffset=4 xadvance=20 page=0 chnl=0 letter="d"
|
||||
char id=101 x=307 y=117 width=20 height=24 xoffset=2 yoffset=13 xadvance=20 page=0 chnl=0 letter="e"
|
||||
char id=102 x=336 y=82 width=17 height=33 xoffset=3 yoffset=4 xadvance=20 page=0 chnl=0 letter="f"
|
||||
char id=103 x=91 y=117 width=22 height=29 xoffset=1 yoffset=13 xadvance=20 page=0 chnl=0 letter="g"
|
||||
char id=104 x=134 y=82 width=19 height=33 xoffset=2 yoffset=4 xadvance=20 page=0 chnl=0 letter="h"
|
||||
char id=105 x=380 y=82 width=8 height=33 xoffset=8 yoffset=4 xadvance=20 page=0 chnl=0 letter="i"
|
||||
char id=106 x=381 y=2 width=13 height=38 xoffset=5 yoffset=4 xadvance=20 page=0 chnl=0 letter="j"
|
||||
char id=107 x=155 y=82 width=19 height=33 xoffset=2 yoffset=4 xadvance=20 page=0 chnl=0 letter="k"
|
||||
char id=108 x=399 y=82 width=7 height=33 xoffset=8 yoffset=4 xadvance=20 page=0 chnl=0 letter="l"
|
||||
char id=109 x=237 y=117 width=22 height=24 xoffset=1 yoffset=13 xadvance=20 page=0 chnl=0 letter="m"
|
||||
char id=110 x=416 y=117 width=19 height=24 xoffset=2 yoffset=13 xadvance=20 page=0 chnl=0 letter="n"
|
||||
char id=111 x=329 y=117 width=20 height=24 xoffset=2 yoffset=13 xadvance=20 page=0 chnl=0 letter="o"
|
||||
char id=112 x=115 y=117 width=20 height=29 xoffset=2 yoffset=13 xadvance=20 page=0 chnl=0 letter="p"
|
||||
char id=113 x=137 y=117 width=20 height=29 xoffset=2 yoffset=13 xadvance=20 page=0 chnl=0 letter="q"
|
||||
char id=114 x=479 y=117 width=14 height=24 xoffset=5 yoffset=13 xadvance=20 page=0 chnl=0 letter="r"
|
||||
char id=115 x=437 y=117 width=19 height=24 xoffset=2 yoffset=13 xadvance=20 page=0 chnl=0 letter="s"
|
||||
char id=116 x=181 y=117 width=17 height=28 xoffset=3 yoffset=8 xadvance=20 page=0 chnl=0 letter="t"
|
||||
char id=117 x=458 y=117 width=19 height=24 xoffset=2 yoffset=13 xadvance=20 page=0 chnl=0 letter="u"
|
||||
char id=118 x=351 y=117 width=20 height=24 xoffset=2 yoffset=13 xadvance=20 page=0 chnl=0 letter="v"
|
||||
char id=119 x=261 y=117 width=22 height=24 xoffset=1 yoffset=13 xadvance=20 page=0 chnl=0 letter="w"
|
||||
char id=120 x=373 y=117 width=20 height=24 xoffset=2 yoffset=13 xadvance=20 page=0 chnl=0 letter="x"
|
||||
char id=121 x=159 y=117 width=20 height=29 xoffset=2 yoffset=13 xadvance=20 page=0 chnl=0 letter="y"
|
||||
char id=122 x=2 y=151 width=19 height=23 xoffset=2 yoffset=13 xadvance=20 page=0 chnl=0 letter="z"
|
||||
char id=123 x=74 y=2 width=13 height=40 xoffset=5 yoffset=1 xadvance=20 page=0 chnl=0 letter="{"
|
||||
char id=124 x=2 y=2 width=6 height=43 xoffset=9 yoffset=0 xadvance=20 page=0 chnl=0 letter="|"
|
||||
char id=125 x=89 y=2 width=13 height=40 xoffset=5 yoffset=1 xadvance=20 page=0 chnl=0 letter="}"
|
||||
char id=126 x=236 y=151 width=23 height=6 xoffset=0 yoffset=0 xadvance=20 page=0 chnl=0 letter="~"
|
||||
char id=19968 x=148 y=151 width=40 height=7 xoffset=2 yoffset=16 xadvance=40 page=0 chnl=0 letter="一"
|
||||
char id=19971 x=300 y=2 width=40 height=38 xoffset=1 yoffset=1 xadvance=40 page=0 chnl=0 letter="七"
|
||||
char id=19977 x=439 y=2 width=39 height=36 xoffset=2 yoffset=3 xadvance=40 page=0 chnl=0 letter="三"
|
||||
char id=20061 x=189 y=2 width=40 height=39 xoffset=2 yoffset=2 xadvance=40 page=0 chnl=0 letter="九"
|
||||
char id=20108 x=408 y=82 width=41 height=32 xoffset=1 yoffset=6 xadvance=40 page=0 chnl=0 letter="二"
|
||||
char id=20116 x=396 y=2 width=41 height=37 xoffset=1 yoffset=2 xadvance=40 page=0 chnl=0 letter="五"
|
||||
char id=20843 x=104 y=2 width=41 height=39 xoffset=1 yoffset=2 xadvance=40 page=0 chnl=0 letter="八"
|
||||
char id=20845 x=147 y=2 width=40 height=39 xoffset=2 yoffset=1 xadvance=40 page=0 chnl=0 letter="六"
|
||||
char id=22235 x=342 y=2 width=37 height=38 xoffset=3 yoffset=3 xadvance=40 page=0 chnl=0 letter="四"
|
Binary file not shown.
After Width: | Height: | Size: 77 KiB |
Loading…
Reference in New Issue