diff --git a/cocos/2d/CCFontAtlas.cpp b/cocos/2d/CCFontAtlas.cpp index 37a8be8b6d..5e1b89a57e 100644 --- a/cocos/2d/CCFontAtlas.cpp +++ b/cocos/2d/CCFontAtlas.cpp @@ -445,6 +445,7 @@ bool FontAtlas::prepareLetterDefinitions(const std::u32string& utf32Text) tempDef.height = tempDef.height / scaleFactor; tempDef.U = tempDef.U / scaleFactor; tempDef.V = tempDef.V / scaleFactor; + tempDef.rotated = false; } else{ if(bitmap) @@ -461,6 +462,7 @@ bool FontAtlas::prepareLetterDefinitions(const std::u32string& utf32Text) tempDef.offsetX = 0; tempDef.offsetY = 0; tempDef.textureID = 0; + tempDef.rotated = false; _currentPageOrigX += 1; } diff --git a/cocos/2d/CCFontAtlas.h b/cocos/2d/CCFontAtlas.h index cb9930cbb3..d24a708d11 100644 --- a/cocos/2d/CCFontAtlas.h +++ b/cocos/2d/CCFontAtlas.h @@ -55,6 +55,7 @@ struct FontLetterDefinition int textureID; bool validDefinition; int xAdvance; + bool rotated; }; class CC_DLL FontAtlas : public Ref diff --git a/cocos/2d/CCFontAtlasCache.cpp b/cocos/2d/CCFontAtlasCache.cpp index 6240c16a3d..f9ab164096 100644 --- a/cocos/2d/CCFontAtlasCache.cpp +++ b/cocos/2d/CCFontAtlasCache.cpp @@ -88,22 +88,53 @@ FontAtlas* FontAtlasCache::getFontAtlasTTF(const _ttfConfig* config) return nullptr; } -FontAtlas* FontAtlasCache::getFontAtlasFNT(const std::string& fontFileName, const Vec2& imageOffset /* = Vec2::ZERO */) +FontAtlas* FontAtlasCache::getFontAtlasFNT(const std::string& fontFileName) { - auto realFontFilename = FileUtils::getInstance()->getNewFilename(fontFileName); // resolves real file path, to prevent storing multiple atlases for the same file. + return getFontAtlasFNT(fontFileName, Rect::ZERO, false); +} + +FontAtlas* FontAtlasCache::getFontAtlasFNT(const std::string& fontFileName, const std::string& subTextureKey) +{ + const auto realFontFilename = FileUtils::getInstance()->getNewFilename(fontFileName); // resolves real file path, to prevent storing multiple atlases for the same file. + std::string atlasName = subTextureKey + " " + realFontFilename; + + const auto it = _atlasMap.find(atlasName); + if (it == _atlasMap.end()) + { + const auto font = FontFNT::create(realFontFilename, subTextureKey); + + if (font) + { + const auto tempAtlas = font->createFontAtlas(); + if (tempAtlas) + { + _atlasMap[atlasName] = tempAtlas; + return _atlasMap[atlasName]; + } + } + } + else + return it->second; + + return nullptr; +} + +FontAtlas* FontAtlasCache::getFontAtlasFNT(const std::string& fontFileName, const Rect& imageRect, bool imageRotated) +{ + const auto realFontFilename = FileUtils::getInstance()->getNewFilename(fontFileName); // resolves real file path, to prevent storing multiple atlases for the same file. char keyPrefix[ATLAS_MAP_KEY_PREFIX_BUFFER_SIZE]; - snprintf(keyPrefix, ATLAS_MAP_KEY_PREFIX_BUFFER_SIZE, "%.2f %.2f ", imageOffset.x, imageOffset.y); + snprintf(keyPrefix, ATLAS_MAP_KEY_PREFIX_BUFFER_SIZE, "%.2f %.2f ", imageRect.origin.x, imageRect.origin.y); std::string atlasName(keyPrefix); atlasName += realFontFilename; - auto it = _atlasMap.find(atlasName); + const auto it = _atlasMap.find(atlasName); if ( it == _atlasMap.end() ) { - auto font = FontFNT::create(realFontFilename, imageOffset); + const auto font = FontFNT::create(realFontFilename, imageRect, imageRotated); if(font) { - auto tempAtlas = font->createFontAtlas(); + const auto tempAtlas = font->createFontAtlas(); if (tempAtlas) { _atlasMap[atlasName] = tempAtlas; @@ -117,9 +148,14 @@ FontAtlas* FontAtlasCache::getFontAtlasFNT(const std::string& fontFileName, cons return nullptr; } +FontAtlas* FontAtlasCache::getFontAtlasFNT(const std::string& fontFileName, const Vec2& imageOffset) +{ + return getFontAtlasFNT(fontFileName, Rect(imageOffset.x, imageOffset.y, 0, 0), false); +} + FontAtlas* FontAtlasCache::getFontAtlasCharMap(const std::string& plistFile) { - std::string atlasName = plistFile; + const std::string& atlasName = plistFile; auto it = _atlasMap.find(atlasName); if ( it == _atlasMap.end() ) @@ -220,10 +256,10 @@ bool FontAtlasCache::releaseFontAtlas(FontAtlas *atlas) return false; } -void FontAtlasCache::reloadFontAtlasFNT(const std::string& fontFileName, const Vec2& imageOffset/* = Vec2::ZERO*/) +void FontAtlasCache::reloadFontAtlasFNT(const std::string& fontFileName, const Rect& imageRect, bool imageRotated) { char keyPrefix[ATLAS_MAP_KEY_PREFIX_BUFFER_SIZE]; - snprintf(keyPrefix, ATLAS_MAP_KEY_PREFIX_BUFFER_SIZE, "%.2f %.2f ", imageOffset.x, imageOffset.y); + snprintf(keyPrefix, ATLAS_MAP_KEY_PREFIX_BUFFER_SIZE, "%.2f %.2f ", imageRect.origin.x, imageRect.origin.y); std::string atlasName(keyPrefix); atlasName += fontFileName; @@ -234,7 +270,7 @@ void FontAtlasCache::reloadFontAtlasFNT(const std::string& fontFileName, const V _atlasMap.erase(it); } FontFNT::reloadBMFontResource(fontFileName); - auto font = FontFNT::create(fontFileName, imageOffset); + auto font = FontFNT::create(fontFileName, imageRect, imageRotated); if (font) { auto tempAtlas = font->createFontAtlas(); @@ -243,7 +279,11 @@ void FontAtlasCache::reloadFontAtlasFNT(const std::string& fontFileName, const V _atlasMap[atlasName] = tempAtlas; } } +} +void FontAtlasCache::reloadFontAtlasFNT(const std::string& fontFileName, const Vec2& imageOffset) +{ + reloadFontAtlasFNT(fontFileName, Rect(imageOffset.x, imageOffset.y, 0, 0), false); } void FontAtlasCache::unloadFontAtlasTTF(const std::string& fontFileName) diff --git a/cocos/2d/CCFontAtlasCache.h b/cocos/2d/CCFontAtlasCache.h index 9ef267651b..2479d80c86 100644 --- a/cocos/2d/CCFontAtlasCache.h +++ b/cocos/2d/CCFontAtlasCache.h @@ -42,7 +42,11 @@ class CC_DLL FontAtlasCache { public: static FontAtlas* getFontAtlasTTF(const _ttfConfig* config); - static FontAtlas* getFontAtlasFNT(const std::string& fontFileName, const Vec2& imageOffset = Vec2::ZERO); + + static FontAtlas* getFontAtlasFNT(const std::string& fontFileName); + static FontAtlas* getFontAtlasFNT(const std::string& fontFileName, const std::string& subTextureKey); + static FontAtlas* getFontAtlasFNT(const std::string& fontFileName, const Rect& imageRect, bool imageRotated); + CC_DEPRECATED_ATTRIBUTE static FontAtlas* getFontAtlasFNT(const std::string& fontFileName, const Vec2& imageOffset); static FontAtlas* getFontAtlasCharMap(const std::string& charMapFile, int itemWidth, int itemHeight, int startCharMap); static FontAtlas* getFontAtlasCharMap(Texture2D* texture, int itemWidth, int itemHeight, int startCharMap); @@ -59,7 +63,9 @@ public: CAUTION : All component use this font texture should be reset font name, though the file name is same! otherwise, it will cause program crash! */ - static void reloadFontAtlasFNT(const std::string& fontFileName, const Vec2& imageOffset = Vec2::ZERO); + static void reloadFontAtlasFNT(const std::string& fontFileName, const Rect& imageRect, bool imageRotated); + + CC_DEPRECATED_ATTRIBUTE static void reloadFontAtlasFNT(const std::string& fontFileName, const Vec2& imageOffset = Vec2::ZERO); /** Unload all texture atlas texture create by special file name. CAUTION : All component use this font texture should be reset font name, though the file name is same! diff --git a/cocos/2d/CCFontCharMap.cpp b/cocos/2d/CCFontCharMap.cpp index ee4f1b796b..10b5a4eb7e 100644 --- a/cocos/2d/CCFontCharMap.cpp +++ b/cocos/2d/CCFontCharMap.cpp @@ -126,6 +126,7 @@ FontAtlas * FontCharMap::createFontAtlas() tempDefinition.width = _itemWidth / contentScaleFactor; tempDefinition.height = _itemHeight / contentScaleFactor; tempDefinition.xAdvance = _itemWidth; + tempDefinition.rotated = false; int charId = _mapStartChar; for (int row = 0; row < itemsPerColumn; ++row) diff --git a/cocos/2d/CCFontFNT.cpp b/cocos/2d/CCFontFNT.cpp index 4724e13450..8d1fc34d1e 100644 --- a/cocos/2d/CCFontFNT.cpp +++ b/cocos/2d/CCFontFNT.cpp @@ -26,6 +26,7 @@ #include "2d/CCFontFNT.h" #include "2d/CCFontAtlas.h" +#include "2d/CCSpriteFrameCache.h" #include "platform/CCFileUtils.h" #include "base/CCConfiguration.h" #include "base/CCDirector.h" @@ -34,8 +35,6 @@ #include "renderer/CCTextureCache.h" #include -#include -#include NS_CC_BEGIN @@ -52,99 +51,6 @@ enum { struct _FontDefHashElement; -/** -@struct BMFontDef -BMFont definition -*/ -typedef struct _BMFontDef { - //! ID of the character - unsigned int charID; - //! origin and size of the font - Rect rect; - //! The X amount the image should be offset when drawing the image (in pixels) - short xOffset; - //! The Y amount the image should be offset when drawing the image (in pixels) - short yOffset; - //! The amount to move the current position after drawing the character (in pixels) - short xAdvance; -} BMFontDef; - -/** @struct BMFontPadding -BMFont padding -@since v0.8.2 -*/ -typedef struct _BMFontPadding { - /// padding left - int left; - /// padding top - int top; - /// padding right - int right; - /// padding bottom - int bottom; -} BMFontPadding; - -/** @brief BMFontConfiguration has parsed configuration of the .fnt file -@since v0.8 -*/ -class CC_DLL BMFontConfiguration : public Ref -{ - // FIXME: Creating a public interface so that the bitmapFontArray[] is accessible -public://@public - // BMFont definitions - std::unordered_map _fontDefDictionary; - - //! FNTConfig: Common Height Should be signed (issue #1343) - int _commonHeight; - //! Padding - BMFontPadding _padding; - //! atlas name - std::string _atlasName; - //! values for kerning - std::unordered_map _kerningDictionary; - - // Character Set defines the letters that actually exist in the font - std::set *_characterSet; - //! Font Size - int _fontSize; -public: - /** - * @js ctor - */ - BMFontConfiguration(); - /** - * @js NA - * @lua NA - */ - virtual ~BMFontConfiguration(); - /** - * @js NA - * @lua NA - */ - std::string description() const; - - /** allocates a BMFontConfiguration with a FNT file */ - static BMFontConfiguration * create(const std::string& FNTfile); - - /** initializes a BitmapFontConfiguration with a FNT file */ - bool initWithFNTfile(const std::string& FNTfile); - - const std::string& getAtlasName() { return _atlasName; } - void setAtlasName(const std::string& atlasName) { _atlasName = atlasName; } - - std::set* getCharacterSet() const; -private: - std::set* parseConfigFile(const std::string& controlFile); - std::set* parseBinaryConfigFile(unsigned char* pData, unsigned long size, const std::string& controlFile); - unsigned int parseCharacterDefinition(const char* line); - void parseInfoArguments(const char* line); - void parseCommonArguments(const char* line); - void parseImageFileName(const char* line, const std::string& fntFile); - void parseKerningEntry(const char* line); - void purgeKerningDictionary(); - void purgeFontDefDictionary(); -}; - // //FNTConfig Cache - free functions // @@ -488,9 +394,10 @@ void BMFontConfiguration::parseImageFileName(const char* line, const std::string int pageId; sscanf(line, "page id=%d", &pageId); CCASSERT(pageId == 0, "LabelBMFont file could not be found"); + // file char fileName[255]; - sscanf(strchr(line,'"') + 1, "%[^\"]", fileName); + sscanf(strstr(line, "file=\"") + 6, "%[^\"]", fileName); _atlasName = FileUtils::getInstance()->fullPathFromRelativeFile(fileName, fntFile); } @@ -603,20 +510,59 @@ void BMFontConfiguration::parseKerningEntry(const char* line) _kerningDictionary[key] = amount; } -FontFNT * FontFNT::create(const std::string& fntFilePath, const Vec2& imageOffset /* = Vec2::ZERO */) +FontFNT * FontFNT::create(const std::string& fntFilePath, const Rect& imageRect, bool imageRotated) { - BMFontConfiguration *newConf = FNTConfigLoadFile(fntFilePath); + const auto newConf = FNTConfigLoadFile(fntFilePath); if (!newConf) return nullptr; + const auto tempFont = new FontFNT(newConf, imageRect, imageRotated); + + if (!tempFont) + { + return nullptr; + } + tempFont->setFontSize((float)newConf->_fontSize); + tempFont->autorelease(); + return tempFont; +} + +FontFNT* FontFNT::create(const std::string& fntFilePath, const std::string& subTextureKey) +{ + const auto newConf = FNTConfigLoadFile(fntFilePath); + if (!newConf) + return nullptr; + + const auto frame = SpriteFrameCache::getInstance()->getSpriteFrameByName(subTextureKey); + if (!frame) + { + return nullptr; + } + auto tempFont = new FontFNT(newConf, frame->getRectInPixels(), frame->isRotated()); + + if (!tempFont) + { + return nullptr; + } + tempFont->setFontSize((float)newConf->_fontSize); + tempFont->autorelease(); + return tempFont; +} + +FontFNT* FontFNT::create(const std::string& fntFilePath) +{ + const auto newConf = FNTConfigLoadFile(fntFilePath); + if (!newConf) + return nullptr; + // add the texture - Texture2D *tempTexture = Director::getInstance()->getTextureCache()->addImage(newConf->getAtlasName()); + const auto tempTexture = Director::getInstance()->getTextureCache()->addImage(newConf->getAtlasName()); if (!tempTexture) { return nullptr; } - - FontFNT *tempFont = new FontFNT(newConf,imageOffset); + FontFNT* tempFont = new FontFNT(newConf); + tempFont->setFontSize((float)newConf->_fontSize); if (!tempFont) { @@ -626,13 +572,26 @@ FontFNT * FontFNT::create(const std::string& fntFilePath, const Vec2& imageOffse return tempFont; } -FontFNT::FontFNT(BMFontConfiguration *theContfig, const Vec2& imageOffset /* = Vec2::ZERO */) -:_configuration(theContfig) -,_imageOffset(CC_POINT_PIXELS_TO_POINTS(imageOffset)) +FontFNT* FontFNT::create(const std::string& fntFilePath, const Vec2& imageOffset) +{ + return create(fntFilePath, Rect(imageOffset.x, imageOffset.y, 0, 0), false); +} + +FontFNT::FontFNT(BMFontConfiguration *theContfig, const Rect& imageRect, bool imageRotated) +: _configuration(theContfig) +, _imageRectInPoints(CC_RECT_PIXELS_TO_POINTS(imageRect)) +, _imageRotated(imageRotated) { _configuration->retain(); } +FontFNT::FontFNT(BMFontConfiguration* theContfig) +: _configuration(theContfig) +, _imageRectInPoints(Rect::ZERO) +, _imageRotated(false) +{ +} + FontFNT::~FontFNT() { _configuration->release(); @@ -722,24 +681,39 @@ FontAtlas * FontFNT::createFontAtlas() } tempAtlas->setLineHeight(originalLineHeight * factor); - + + auto rw = _imageRectInPoints.size.width; + auto rh = _imageRectInPoints.size.height; + + if (_imageRotated) + std::swap(rw, rh); + + const auto left = _imageRectInPoints.origin.x; + const auto right = _imageRectInPoints.origin.x + rw; + const auto top = _imageRectInPoints.origin.y; + for (auto&& e : _configuration->_fontDefDictionary) { BMFontDef& fontDef = e.second; - + FontLetterDefinition tempDefinition; - Rect tempRect; - - tempRect = fontDef.rect; - tempRect = CC_RECT_PIXELS_TO_POINTS(tempRect); + const auto tempRect = CC_RECT_PIXELS_TO_POINTS(fontDef.rect); tempDefinition.offsetX = fontDef.xOffset; tempDefinition.offsetY = fontDef.yOffset; - - tempDefinition.U = tempRect.origin.x + _imageOffset.x; - tempDefinition.V = tempRect.origin.y + _imageOffset.y; - + + if (_imageRotated) + { + tempDefinition.U = right - tempRect.origin.y - tempRect.size.height; + tempDefinition.V = tempRect.origin.x + top; + } + else + { + tempDefinition.U = tempRect.origin.x + left; + tempDefinition.V = tempRect.origin.y + top; + } + tempDefinition.width = tempRect.size.width; tempDefinition.height = tempRect.size.height; @@ -748,6 +722,8 @@ FontAtlas * FontFNT::createFontAtlas() tempDefinition.validDefinition = true; tempDefinition.xAdvance = fontDef.xAdvance; + tempDefinition.rotated = _imageRotated; + // add the new definition if (65535 < fontDef.charID) { CCLOGWARN("Warning: 65535 < fontDef.charID (%u), ignored", fontDef.charID); @@ -783,12 +759,12 @@ void FontFNT::reloadBMFontResource(const std::string& fntFilePath) { s_configurations->erase(fntFilePath); } + ret = BMFontConfiguration::create(fntFilePath); if (ret) { s_configurations->insert(fntFilePath, ret); Director::getInstance()->getTextureCache()->reloadTexture(ret->getAtlasName()); - } } diff --git a/cocos/2d/CCFontFNT.h b/cocos/2d/CCFontFNT.h index d0b932fd4f..83a07f1634 100644 --- a/cocos/2d/CCFontFNT.h +++ b/cocos/2d/CCFontFNT.h @@ -30,43 +30,154 @@ /// @cond DO_NOT_SHOW #include "2d/CCFont.h" +#include +#include NS_CC_BEGIN -class BMFontConfiguration; +/** +@struct BMFontDef +BMFont definition +*/ +typedef struct _BMFontDef { + //! ID of the character + unsigned int charID; + //! origin and size of the font + Rect rect; + //! The X amount the image should be offset when drawing the image (in pixels) + short xOffset; + //! The Y amount the image should be offset when drawing the image (in pixels) + short yOffset; + //! The amount to move the current position after drawing the character (in pixels) + short xAdvance; +} BMFontDef; + +/** @struct BMFontPadding +BMFont padding +@since v0.8.2 +*/ +typedef struct _BMFontPadding { + /// padding left + int left; + /// padding top + int top; + /// padding right + int right; + /// padding bottom + int bottom; +} BMFontPadding; + +/** @brief BMFontConfiguration has parsed configuration of the .fnt file +@since v0.8 +*/ +class CC_DLL BMFontConfiguration : public Ref +{ + // FIXME: Creating a public interface so that the bitmapFontArray[] is accessible +public://@public + // BMFont definitions + std::unordered_map _fontDefDictionary; + + //! FNTConfig: Common Height Should be signed (issue #1343) + int _commonHeight; + + //! Padding + BMFontPadding _padding; + + //! atlas name + std::string _atlasName; + + //! values for kerning + std::unordered_map _kerningDictionary; + + // Character Set defines the letters that actually exist in the font + std::set* _characterSet; + + //! Font Size + int _fontSize; +public: + /** + * @js ctor + */ + BMFontConfiguration(); + /** + * @js NA + * @lua NA + */ + virtual ~BMFontConfiguration(); + /** + * @js NA + * @lua NA + */ + std::string description() const; + + /** allocates a BMFontConfiguration with a FNT file */ + static BMFontConfiguration* create(const std::string& FNTfile); + + /** initializes a BitmapFontConfiguration with a FNT file */ + bool initWithFNTfile(const std::string& FNTfile); + + const std::string& getAtlasName() { return _atlasName; } + void setAtlasName(const std::string& atlasName) { _atlasName = atlasName; } + + std::set* getCharacterSet() const; + +protected: + virtual std::set* parseConfigFile(const std::string& controlFile); + virtual std::set* parseBinaryConfigFile(unsigned char* pData, unsigned long size, const std::string& controlFile); + +private: + unsigned int parseCharacterDefinition(const char* line); + void parseInfoArguments(const char* line); + void parseCommonArguments(const char* line); + void parseImageFileName(const char* line, const std::string& fntFile); + void parseKerningEntry(const char* line); + void purgeKerningDictionary(); + void purgeFontDefDictionary(); +}; class CC_DLL FontFNT : public Font { public: - static FontFNT * create(const std::string& fntFilePath, const Vec2& imageOffset = Vec2::ZERO); + static FontFNT* create(const std::string& fntFilePath, const Rect& imageRect, bool imageRotated); + static FontFNT* create(const std::string& fntFilePath, const std::string& subTextureKey); + static FontFNT* create(const std::string& fntFilePath); + + CC_DEPRECATED_ATTRIBUTE static FontFNT* create(const std::string& fntFilePath, const Vec2& imageOffset = Vec2::ZERO); + /** Purges the cached data. Removes from memory the cached configurations and the atlas name dictionary. */ static void purgeCachedData(); virtual int* getHorizontalKerningForTextUTF32(const std::u32string& text, int &outNumLetters) const override; virtual FontAtlas *createFontAtlas() override; + void setFontSize(float fontSize); + float getFontSize() const { return _fontSize; } + int getOriginalFontSize()const; static void reloadBMFontResource(const std::string& fntFilePath); protected: - FontFNT(BMFontConfiguration *theContfig, const Vec2& imageOffset = Vec2::ZERO); + FontFNT(BMFontConfiguration* theContfig, const Rect& imageRect, bool imageRotated); + FontFNT(BMFontConfiguration* theContfig); + /** * @js NA * @lua NA */ virtual ~FontFNT(); - -private: - + + BMFontConfiguration* _configuration; + int getHorizontalKerningForChars(char32_t firstChar, char32_t secondChar) const; - - BMFontConfiguration * _configuration; - Vec2 _imageOffset; + + Rect _imageRectInPoints; + bool _imageRotated; + //User defined font size float _fontSize; }; diff --git a/cocos/2d/CCLabel.cpp b/cocos/2d/CCLabel.cpp index 43ed0b4469..aa99487826 100644 --- a/cocos/2d/CCLabel.cpp +++ b/cocos/2d/CCLabel.cpp @@ -280,11 +280,11 @@ Label* Label::createWithTTF(const TTFConfig& ttfConfig, const std::string& text, return nullptr; } -Label* Label::createWithBMFont(const std::string& bmfontFilePath, const std::string& text,const TextHAlignment& hAlignment /* = TextHAlignment::LEFT */, int maxLineWidth /* = 0 */, const Vec2& imageOffset /* = Vec2::ZERO */) +Label* Label::createWithBMFont(const std::string& bmfontPath, const std::string& text, const TextHAlignment& hAlignment, int maxLineWidth) { auto ret = new (std::nothrow) Label(hAlignment); - if (ret && ret->setBMFontFilePath(bmfontFilePath,imageOffset)) + if (ret && ret->setBMFontFilePath(bmfontPath)) { ret->setMaxLineWidth(maxLineWidth); ret->setString(text); @@ -292,11 +292,50 @@ Label* Label::createWithBMFont(const std::string& bmfontFilePath, const std::str return ret; } - + delete ret; return nullptr; } +Label* Label::createWithBMFont(const std::string& bmfontPath, const std::string& text, const TextHAlignment& hAlignment, int maxLineWidth, const Rect& imageRect, bool imageRotated) +{ + auto ret = new (std::nothrow) Label(hAlignment); + + if (ret && ret->setBMFontFilePath(bmfontPath, imageRect, imageRotated)) + { + ret->setMaxLineWidth(maxLineWidth); + ret->setString(text); + ret->autorelease(); + + return ret; + } + + delete ret; + return nullptr; +} + +Label* Label::createWithBMFont(const std::string& bmfontPath, const std::string& text, const TextHAlignment& hAlignment, int maxLineWidth, const std::string& subTextureKey) +{ + auto ret = new (std::nothrow) Label(hAlignment); + + if (ret && ret->setBMFontFilePath(bmfontPath, subTextureKey)) + { + ret->setMaxLineWidth(maxLineWidth); + ret->setString(text); + ret->autorelease(); + + return ret; + } + + delete ret; + return nullptr; +} + +Label* Label::createWithBMFont(const std::string& bmfontPath, const std::string& text, const TextHAlignment& hAlignment, int maxLineWidth, const Vec2& imageOffset) +{ + return createWithBMFont(bmfontPath, text, hAlignment, maxLineWidth, Rect(imageOffset.x, imageOffset.y, 0, 0), false); +} + Label* Label::createWithCharMap(const std::string& plistFile) { auto ret = new (std::nothrow) Label(); @@ -521,7 +560,12 @@ void Label::reset() TTFConfig temp; _fontConfig = temp; _outlineSize = 0.f; + _bmFontPath = ""; + _bmSubTextureKey = ""; + _bmRect = Rect::ZERO; + _bmRotated = false; + _systemFontDirty = false; _systemFont = "Helvetica"; _systemFontSize = CC_DEFAULT_FONT_LABEL_SIZE; @@ -780,9 +824,40 @@ bool Label::setTTFConfig(const TTFConfig& ttfConfig) return setTTFConfigInternal(ttfConfig); } -bool Label::setBMFontFilePath(const std::string& bmfontFilePath, const Vec2& imageOffset, float fontSize) +bool Label::setBMFontFilePath(const std::string& bmfontFilePath, float fontSize) { - FontAtlas *newAtlas = FontAtlasCache::getFontAtlasFNT(bmfontFilePath,imageOffset); + FontAtlas* newAtlas = FontAtlasCache::getFontAtlasFNT(bmfontFilePath); + + if (!newAtlas) + { + reset(); + return false; + } + + //assign the default fontSize + if (std::abs(fontSize) < FLT_EPSILON) { + FontFNT* bmFont = (FontFNT*)newAtlas->getFont(); + if (bmFont) { + float originalFontSize = bmFont->getOriginalFontSize(); + _bmFontSize = originalFontSize / CC_CONTENT_SCALE_FACTOR(); + } + } + + if (fontSize > 0.0f) { + _bmFontSize = fontSize; + } + + _bmFontPath = bmfontFilePath; + + _currentLabelType = LabelType::BMFONT; + setFontAtlas(newAtlas); + + return true; +} + +bool Label::setBMFontFilePath(const std::string& bmfontFilePath, const Rect& imageRect, bool imageRotated, float fontSize) +{ + FontAtlas *newAtlas = FontAtlasCache::getFontAtlasFNT(bmfontFilePath, imageRect, imageRotated); if (!newAtlas) { @@ -804,6 +879,8 @@ bool Label::setBMFontFilePath(const std::string& bmfontFilePath, const Vec2& ima } _bmFontPath = bmfontFilePath; + _bmRect = imageRect; + _bmRotated = imageRotated; _currentLabelType = LabelType::BMFONT; setFontAtlas(newAtlas); @@ -811,6 +888,43 @@ bool Label::setBMFontFilePath(const std::string& bmfontFilePath, const Vec2& ima return true; } +bool Label::setBMFontFilePath(const std::string& bmfontFilePath, const std::string& subTextureKey, float fontSize) +{ + FontAtlas* newAtlas = FontAtlasCache::getFontAtlasFNT(bmfontFilePath, subTextureKey); + + if (!newAtlas) + { + reset(); + return false; + } + + //assign the default fontSize + if (std::abs(fontSize) < FLT_EPSILON) { + FontFNT* bmFont = (FontFNT*)newAtlas->getFont(); + if (bmFont) { + float originalFontSize = bmFont->getOriginalFontSize(); + _bmFontSize = originalFontSize / CC_CONTENT_SCALE_FACTOR(); + } + } + + if (fontSize > 0.0f) { + _bmFontSize = fontSize; + } + + _bmFontPath = bmfontFilePath; + _bmSubTextureKey = subTextureKey; + + _currentLabelType = LabelType::BMFONT; + setFontAtlas(newAtlas); + + return true; +} + +bool Label::setBMFontFilePath(const std::string& bmfontFilePath, const Vec2& imageOffset, float fontSize) +{ + return setBMFontFilePath(bmfontFilePath, Rect(imageOffset.x, imageOffset.y, 0, 0), false); +} + void Label::setString(const std::string& text) { if (text.compare(_utf8Text)) @@ -929,7 +1043,7 @@ void Label::updateLabelLetters() } else { - letterSprite->setTextureRect(uvRect, false, uvRect.size); + letterSprite->setTextureRect(uvRect, letterDef.rotated, uvRect.size); letterSprite->setTextureAtlas(_batchNodes.at(letterDef.textureID)->getTextureAtlas()); letterSprite->setAtlasIndex(_lettersInfo[letterIndex].atlasIndex); } @@ -1110,7 +1224,7 @@ bool Label::updateQuads() if (_reusedRect.size.height > 0.f && _reusedRect.size.width > 0.f) { - _reusedLetter->setTextureRect(_reusedRect, false, _reusedRect.size); + _reusedLetter->setTextureRect(_reusedRect, letterDef.rotated, _reusedRect.size); float letterPositionX = _lettersInfo[ctr].positionX + _linesOffsetX[_lettersInfo[ctr].lineIndex]; _reusedLetter->setPosition(letterPositionX, py); auto index = static_cast(_batchNodes.at(letterDef.textureID)->getTextureAtlas()->getTotalQuads()); @@ -1170,8 +1284,16 @@ bool Label::setTTFConfigInternal(const TTFConfig& ttfConfig) void Label::setBMFontSizeInternal(float fontSize) { - if(_currentLabelType == LabelType::BMFONT){ - this->setBMFontFilePath(_bmFontPath, Vec2::ZERO, fontSize); + if(_currentLabelType == LabelType::BMFONT) + { + if (!_bmSubTextureKey.empty()) + { + this->setBMFontFilePath(_bmFontPath, _bmSubTextureKey, fontSize); + } + else + { + this->setBMFontFilePath(_bmFontPath, _bmRect, _bmRotated, fontSize); + } _contentDirty = true; } } @@ -1969,7 +2091,7 @@ Sprite* Label::getLetter(int letterIndex) else { this->updateBMFontScale(); - letter = LabelLetter::createWithTexture(_fontAtlas->getTexture(textureID), uvRect); + letter = LabelLetter::createWithTexture(_fontAtlas->getTexture(textureID), uvRect, letterDef.rotated); letter->setTextureAtlas(_batchNodes.at(textureID)->getTextureAtlas()); letter->setAtlasIndex(letterInfo.atlasIndex); auto px = letterInfo.positionX + _bmfontScale * uvRect.size.width / 2 + _linesOffsetX[letterInfo.lineIndex]; diff --git a/cocos/2d/CCLabel.h b/cocos/2d/CCLabel.h index 5dab114f3e..cbb027d462 100644 --- a/cocos/2d/CCLabel.h +++ b/cocos/2d/CCLabel.h @@ -198,14 +198,58 @@ public: * @param text The initial text. * @param hAlignment Text horizontal alignment. * @param maxLineWidth The max line width. - * @param imageOffset * * @return An automatically released Label object. * @see setBMFontFilePath setMaxLineWidth */ static Label* createWithBMFont(const std::string& bmfontPath, const std::string& text, - const TextHAlignment& hAlignment = TextHAlignment::LEFT, int maxLineWidth = 0, - const Vec2& imageOffset = Vec2::ZERO); + const TextHAlignment& hAlignment = TextHAlignment::LEFT, int maxLineWidth = 0); + + /** + * Allocates and initializes a Label, with a bitmap font file. + * + * @param bmfontPath A bitmap font file, it's a FNT format. + * @param text The initial text. + * @param hAlignment Text horizontal alignment. + * @param maxLineWidth The max line width. + * @param imageRect + * @param imageRotated + * + * @return An automatically released Label object. + * @see setBMFontFilePath setMaxLineWidth + */ + static Label* createWithBMFont(const std::string& bmfontPath, const std::string& text, + const TextHAlignment& hAlignment, int maxLineWidth, const Rect& imageRect, bool imageRotated); + + /** + * Allocates and initializes a Label, with a bitmap font file. + * + * @param bmfontPath A bitmap font file, it's a FNT format. + * @param text The initial text. + * @param hAlignment Text horizontal alignment. + * @param maxLineWidth The max line width. + * @param subTextureKey Name of entry in PLIST texture atlas/sprite sheet + * + * @return An automatically released Label object. + * @see setBMFontFilePath setMaxLineWidth + */ + static Label* createWithBMFont(const std::string& bmfontPath, const std::string& text, + const TextHAlignment& hAlignment, int maxLineWidth, const std::string& subTextureKey); + + /** + * Allocates and initializes a Label, with a bitmap font file. + * + * @param bmfontPath A bitmap font file, it's a FNT format. + * @param text The initial text. + * @param hAlignment Text horizontal alignment. + * @param maxLineWidth The max line width. + * @param imageOffset Offset into larger texture + * + * @return An automatically released Label object. + * @see setBMFontFilePath setMaxLineWidth + */ + CC_DEPRECATED_ATTRIBUTE static Label* createWithBMFont(const std::string& bmfontPath, const std::string& text, + const TextHAlignment& hAlignment, int maxLineWidth, const Vec2& imageOffset); /** * Allocates and initializes a Label, with char map configuration. @@ -259,7 +303,16 @@ 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, float fontSize = 0); + virtual bool setBMFontFilePath(const std::string& bmfontFilePath, float fontSize = 0); + + /** Sets a new bitmap font to Label */ + virtual bool setBMFontFilePath(const std::string& bmfontFilePath, const Rect& imageRect, bool imageRotated, float fontSize = 0); + + /** Sets a new bitmap font to Label */ + virtual bool setBMFontFilePath(const std::string& bmfontFilePath, const std::string& subTextureKey, float fontSize = 0); + + /** Sets a new bitmap font to Label */ + CC_DEPRECATED_ATTRIBUTE virtual bool setBMFontFilePath(const std::string& bmfontFilePath, const Vec2& imageOffset, float fontSize = 0); /** Returns the bitmap font used by the Label.*/ const std::string& getBMFontFilePath() const { return _bmFontPath;} @@ -718,6 +771,10 @@ protected: int _numberOfLines; std::string _bmFontPath; + std::string _bmSubTextureKey; + Rect _bmRect; + bool _bmRotated; + TTFConfig _fontConfig; float _outlineSize; diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp index 9219f95f6f..224bd5e18d 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp @@ -49458,7 +49458,7 @@ int lua_register_cocos2dx_ActionTween(lua_State* tolua_S) return 1; } -int lua_cocos2dx_AtlasNode_updateAtlasValues(lua_State* tolua_S) +int lua_cocos2dx_AtlasNode_getBlendFunc(lua_State* tolua_S) { int argc = 0; cocos2d::AtlasNode* cobj = nullptr; @@ -49478,7 +49478,7 @@ int lua_cocos2dx_AtlasNode_updateAtlasValues(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_AtlasNode_updateAtlasValues'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_AtlasNode_getBlendFunc'", nullptr); return 0; } #endif @@ -49488,19 +49488,19 @@ int lua_cocos2dx_AtlasNode_updateAtlasValues(lua_State* tolua_S) { if(!ok) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_AtlasNode_updateAtlasValues'", nullptr); + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_AtlasNode_getBlendFunc'", nullptr); return 0; } - cobj->updateAtlasValues(); - lua_settop(tolua_S, 1); + const cocos2d::BlendFunc& ret = cobj->getBlendFunc(); + blendfunc_to_luaval(tolua_S, ret); return 1; } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.AtlasNode:updateAtlasValues",argc, 0); + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.AtlasNode:getBlendFunc",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_AtlasNode_updateAtlasValues'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_AtlasNode_getBlendFunc'.",&tolua_err); #endif return 0; @@ -49758,7 +49758,7 @@ int lua_cocos2dx_AtlasNode_getTextureAtlas(lua_State* tolua_S) return 0; } -int lua_cocos2dx_AtlasNode_getBlendFunc(lua_State* tolua_S) +int lua_cocos2dx_AtlasNode_updateAtlasValues(lua_State* tolua_S) { int argc = 0; cocos2d::AtlasNode* cobj = nullptr; @@ -49778,7 +49778,7 @@ int lua_cocos2dx_AtlasNode_getBlendFunc(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_AtlasNode_getBlendFunc'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_AtlasNode_updateAtlasValues'", nullptr); return 0; } #endif @@ -49788,19 +49788,19 @@ int lua_cocos2dx_AtlasNode_getBlendFunc(lua_State* tolua_S) { if(!ok) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_AtlasNode_getBlendFunc'", nullptr); + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_AtlasNode_updateAtlasValues'", nullptr); return 0; } - const cocos2d::BlendFunc& ret = cobj->getBlendFunc(); - blendfunc_to_luaval(tolua_S, ret); + cobj->updateAtlasValues(); + lua_settop(tolua_S, 1); return 1; } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.AtlasNode:getBlendFunc",argc, 0); + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.AtlasNode:updateAtlasValues",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_AtlasNode_getBlendFunc'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_AtlasNode_updateAtlasValues'.",&tolua_err); #endif return 0; @@ -50103,13 +50103,13 @@ int lua_register_cocos2dx_AtlasNode(lua_State* tolua_S) tolua_beginmodule(tolua_S,"AtlasNode"); tolua_function(tolua_S,"new",lua_cocos2dx_AtlasNode_constructor); - tolua_function(tolua_S,"updateAtlasValues",lua_cocos2dx_AtlasNode_updateAtlasValues); + tolua_function(tolua_S,"getBlendFunc",lua_cocos2dx_AtlasNode_getBlendFunc); tolua_function(tolua_S,"initWithTileFile",lua_cocos2dx_AtlasNode_initWithTileFile); tolua_function(tolua_S,"setBlendFunc",lua_cocos2dx_AtlasNode_setBlendFunc); tolua_function(tolua_S,"setTextureAtlas",lua_cocos2dx_AtlasNode_setTextureAtlas); tolua_function(tolua_S,"getTexture",lua_cocos2dx_AtlasNode_getTexture); tolua_function(tolua_S,"getTextureAtlas",lua_cocos2dx_AtlasNode_getTextureAtlas); - tolua_function(tolua_S,"getBlendFunc",lua_cocos2dx_AtlasNode_getBlendFunc); + tolua_function(tolua_S,"updateAtlasValues",lua_cocos2dx_AtlasNode_updateAtlasValues); tolua_function(tolua_S,"setTexture",lua_cocos2dx_AtlasNode_setTexture); tolua_function(tolua_S,"initWithTexture",lua_cocos2dx_AtlasNode_initWithTexture); tolua_function(tolua_S,"getQuadsToDraw",lua_cocos2dx_AtlasNode_getQuadsToDraw); @@ -53282,79 +53282,131 @@ int lua_cocos2dx_Label_setBMFontFilePath(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) + if (!cobj) { tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_setBMFontFilePath'", nullptr); return 0; } #endif - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - std::string arg0; + do{ + if (argc == 3) { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Label:setBMFontFilePath"); - ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Label:setBMFontFilePath"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_setBMFontFilePath'", nullptr); - return 0; + if (!ok) { break; } + cocos2d::Rect arg1; + ok &= luaval_to_rect(tolua_S, 3, &arg1, "cc.Label:setBMFontFilePath"); + + if (!ok) { break; } + bool arg2; + ok &= luaval_to_boolean(tolua_S, 4,&arg2, "cc.Label:setBMFontFilePath"); + + if (!ok) { break; } + bool ret = cobj->setBMFontFilePath(arg0, arg1, arg2); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; } - bool ret = cobj->setBMFontFilePath(arg0); - tolua_pushboolean(tolua_S,(bool)ret); - return 1; - } - if (argc == 2) - { - std::string arg0; - cocos2d::Vec2 arg1; + }while(0); + ok = true; + do{ + if (argc == 4) { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Label:setBMFontFilePath"); - ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Label:setBMFontFilePath"); + if (!ok) { break; } + cocos2d::Rect arg1; + ok &= luaval_to_rect(tolua_S, 3, &arg1, "cc.Label:setBMFontFilePath"); - ok &= luaval_to_vec2(tolua_S, 3, &arg1, "cc.Label:setBMFontFilePath"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_setBMFontFilePath'", nullptr); - return 0; + if (!ok) { break; } + bool arg2; + ok &= luaval_to_boolean(tolua_S, 4,&arg2, "cc.Label:setBMFontFilePath"); + + if (!ok) { break; } + double arg3; + ok &= luaval_to_number(tolua_S, 5,&arg3, "cc.Label:setBMFontFilePath"); + + if (!ok) { break; } + bool ret = cobj->setBMFontFilePath(arg0, arg1, arg2, arg3); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; } - bool ret = cobj->setBMFontFilePath(arg0, arg1); - tolua_pushboolean(tolua_S,(bool)ret); - return 1; - } - if (argc == 3) - { - std::string arg0; - cocos2d::Vec2 arg1; - double arg2; + }while(0); + ok = true; + do{ + if (argc == 1) { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Label:setBMFontFilePath"); - 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; + if (!ok) { break; } + bool ret = cobj->setBMFontFilePath(arg0); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; } - 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); + }while(0); + ok = true; + do{ + if (argc == 2) { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Label:setBMFontFilePath"); + + if (!ok) { break; } + double arg1; + ok &= luaval_to_number(tolua_S, 3,&arg1, "cc.Label:setBMFontFilePath"); + + if (!ok) { break; } + bool ret = cobj->setBMFontFilePath(arg0, arg1); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + }while(0); + ok = true; + do{ + if (argc == 2) { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Label:setBMFontFilePath"); + + if (!ok) { break; } + std::string arg1; + ok &= luaval_to_std_string(tolua_S, 3,&arg1, "cc.Label:setBMFontFilePath"); + + if (!ok) { break; } + bool ret = cobj->setBMFontFilePath(arg0, arg1); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + }while(0); + ok = true; + do{ + if (argc == 3) { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Label:setBMFontFilePath"); + + if (!ok) { break; } + std::string arg1; + ok &= luaval_to_std_string(tolua_S, 3,&arg1, "cc.Label:setBMFontFilePath"); + + if (!ok) { break; } + double arg2; + ok &= luaval_to_number(tolua_S, 4,&arg2, "cc.Label:setBMFontFilePath"); + + if (!ok) { break; } + bool ret = cobj->setBMFontFilePath(arg0, arg1, arg2); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + }while(0); + ok = true; + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:setBMFontFilePath",argc, 2); return 0; #if COCOS2D_DEBUG >= 1 @@ -55708,7 +55760,6 @@ int lua_cocos2dx_Label_createWithBMFont(lua_State* tolua_S) { int argc = 0; bool ok = true; - #if COCOS2D_DEBUG >= 1 tolua_Error tolua_err; #endif @@ -55717,81 +55768,119 @@ int lua_cocos2dx_Label_createWithBMFont(lua_State* tolua_S) if (!tolua_isusertable(tolua_S,1,"cc.Label",0,&tolua_err)) goto tolua_lerror; #endif - argc = lua_gettop(tolua_S) - 1; + argc = lua_gettop(tolua_S)-1; - if (argc == 2) + do { - std::string arg0; - std::string arg1; - ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Label:createWithBMFont"); - ok &= luaval_to_std_string(tolua_S, 3,&arg1, "cc.Label:createWithBMFont"); - if(!ok) + if (argc == 6) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_createWithBMFont'", nullptr); - return 0; + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Label:createWithBMFont"); + if (!ok) { break; } + std::string arg1; + ok &= luaval_to_std_string(tolua_S, 3,&arg1, "cc.Label:createWithBMFont"); + if (!ok) { break; } + cocos2d::TextHAlignment arg2; + ok &= luaval_to_int32(tolua_S, 4,(int *)&arg2, "cc.Label:createWithBMFont"); + if (!ok) { break; } + int arg3; + ok &= luaval_to_int32(tolua_S, 5,(int *)&arg3, "cc.Label:createWithBMFont"); + if (!ok) { break; } + cocos2d::Rect arg4; + ok &= luaval_to_rect(tolua_S, 6, &arg4, "cc.Label:createWithBMFont"); + if (!ok) { break; } + bool arg5; + ok &= luaval_to_boolean(tolua_S, 7,&arg5, "cc.Label:createWithBMFont"); + if (!ok) { break; } + cocos2d::Label* ret = cocos2d::Label::createWithBMFont(arg0, arg1, arg2, arg3, arg4, arg5); + object_to_luaval(tolua_S, "cc.Label",(cocos2d::Label*)ret); + return 1; } - cocos2d::Label* ret = cocos2d::Label::createWithBMFont(arg0, arg1); - object_to_luaval(tolua_S, "cc.Label",(cocos2d::Label*)ret); - return 1; - } - if (argc == 3) + } while (0); + ok = true; + do { - std::string arg0; - std::string arg1; - cocos2d::TextHAlignment arg2; - ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Label:createWithBMFont"); - ok &= luaval_to_std_string(tolua_S, 3,&arg1, "cc.Label:createWithBMFont"); - ok &= luaval_to_int32(tolua_S, 4,(int *)&arg2, "cc.Label:createWithBMFont"); - if(!ok) + if (argc == 2) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_createWithBMFont'", nullptr); - return 0; + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Label:createWithBMFont"); + if (!ok) { break; } + std::string arg1; + ok &= luaval_to_std_string(tolua_S, 3,&arg1, "cc.Label:createWithBMFont"); + if (!ok) { break; } + cocos2d::Label* ret = cocos2d::Label::createWithBMFont(arg0, arg1); + object_to_luaval(tolua_S, "cc.Label",(cocos2d::Label*)ret); + return 1; } - cocos2d::Label* ret = cocos2d::Label::createWithBMFont(arg0, arg1, arg2); - object_to_luaval(tolua_S, "cc.Label",(cocos2d::Label*)ret); - return 1; - } - if (argc == 4) + } while (0); + ok = true; + do { - std::string arg0; - std::string arg1; - cocos2d::TextHAlignment arg2; - int arg3; - ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Label:createWithBMFont"); - ok &= luaval_to_std_string(tolua_S, 3,&arg1, "cc.Label:createWithBMFont"); - ok &= luaval_to_int32(tolua_S, 4,(int *)&arg2, "cc.Label:createWithBMFont"); - ok &= luaval_to_int32(tolua_S, 5,(int *)&arg3, "cc.Label:createWithBMFont"); - if(!ok) + if (argc == 3) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_createWithBMFont'", nullptr); - return 0; + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Label:createWithBMFont"); + if (!ok) { break; } + std::string arg1; + ok &= luaval_to_std_string(tolua_S, 3,&arg1, "cc.Label:createWithBMFont"); + if (!ok) { break; } + cocos2d::TextHAlignment arg2; + ok &= luaval_to_int32(tolua_S, 4,(int *)&arg2, "cc.Label:createWithBMFont"); + if (!ok) { break; } + cocos2d::Label* ret = cocos2d::Label::createWithBMFont(arg0, arg1, arg2); + object_to_luaval(tolua_S, "cc.Label",(cocos2d::Label*)ret); + return 1; } - cocos2d::Label* ret = cocos2d::Label::createWithBMFont(arg0, arg1, arg2, arg3); - object_to_luaval(tolua_S, "cc.Label",(cocos2d::Label*)ret); - return 1; - } - if (argc == 5) + } while (0); + ok = true; + do { - std::string arg0; - std::string arg1; - cocos2d::TextHAlignment arg2; - int arg3; - cocos2d::Vec2 arg4; - ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Label:createWithBMFont"); - ok &= luaval_to_std_string(tolua_S, 3,&arg1, "cc.Label:createWithBMFont"); - ok &= luaval_to_int32(tolua_S, 4,(int *)&arg2, "cc.Label:createWithBMFont"); - ok &= luaval_to_int32(tolua_S, 5,(int *)&arg3, "cc.Label:createWithBMFont"); - ok &= luaval_to_vec2(tolua_S, 6, &arg4, "cc.Label:createWithBMFont"); - if(!ok) + if (argc == 4) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_createWithBMFont'", nullptr); - return 0; + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Label:createWithBMFont"); + if (!ok) { break; } + std::string arg1; + ok &= luaval_to_std_string(tolua_S, 3,&arg1, "cc.Label:createWithBMFont"); + if (!ok) { break; } + cocos2d::TextHAlignment arg2; + ok &= luaval_to_int32(tolua_S, 4,(int *)&arg2, "cc.Label:createWithBMFont"); + if (!ok) { break; } + int arg3; + ok &= luaval_to_int32(tolua_S, 5,(int *)&arg3, "cc.Label:createWithBMFont"); + if (!ok) { break; } + cocos2d::Label* ret = cocos2d::Label::createWithBMFont(arg0, arg1, arg2, arg3); + object_to_luaval(tolua_S, "cc.Label",(cocos2d::Label*)ret); + return 1; } - cocos2d::Label* ret = cocos2d::Label::createWithBMFont(arg0, arg1, arg2, arg3, arg4); - object_to_luaval(tolua_S, "cc.Label",(cocos2d::Label*)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d\n ", "cc.Label:createWithBMFont",argc, 2); + } while (0); + ok = true; + do + { + if (argc == 5) + { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Label:createWithBMFont"); + if (!ok) { break; } + std::string arg1; + ok &= luaval_to_std_string(tolua_S, 3,&arg1, "cc.Label:createWithBMFont"); + if (!ok) { break; } + cocos2d::TextHAlignment arg2; + ok &= luaval_to_int32(tolua_S, 4,(int *)&arg2, "cc.Label:createWithBMFont"); + if (!ok) { break; } + int arg3; + ok &= luaval_to_int32(tolua_S, 5,(int *)&arg3, "cc.Label:createWithBMFont"); + if (!ok) { break; } + std::string arg4; + ok &= luaval_to_std_string(tolua_S, 6,&arg4, "cc.Label:createWithBMFont"); + if (!ok) { break; } + cocos2d::Label* ret = cocos2d::Label::createWithBMFont(arg0, arg1, arg2, arg3, arg4); + object_to_luaval(tolua_S, "cc.Label",(cocos2d::Label*)ret); + return 1; + } + } while (0); + ok = true; + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d", "cc.Label:createWithBMFont",argc, 5); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: @@ -62195,7 +62284,7 @@ int lua_cocos2dx_MotionStreak_reset(lua_State* tolua_S) return 0; } -int lua_cocos2dx_MotionStreak_setTexture(lua_State* tolua_S) +int lua_cocos2dx_MotionStreak_getBlendFunc(lua_State* tolua_S) { int argc = 0; cocos2d::MotionStreak* cobj = nullptr; @@ -62215,32 +62304,29 @@ int lua_cocos2dx_MotionStreak_setTexture(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_MotionStreak_setTexture'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_MotionStreak_getBlendFunc'", nullptr); return 0; } #endif argc = lua_gettop(tolua_S)-1; - if (argc == 1) + if (argc == 0) { - cocos2d::Texture2D* arg0; - - ok &= luaval_to_object(tolua_S, 2, "cc.Texture2D",&arg0, "cc.MotionStreak:setTexture"); if(!ok) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_MotionStreak_setTexture'", nullptr); + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_MotionStreak_getBlendFunc'", nullptr); return 0; } - cobj->setTexture(arg0); - lua_settop(tolua_S, 1); + const cocos2d::BlendFunc& ret = cobj->getBlendFunc(); + blendfunc_to_luaval(tolua_S, ret); return 1; } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.MotionStreak:setTexture",argc, 1); + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.MotionStreak:getBlendFunc",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_MotionStreak_setTexture'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_MotionStreak_getBlendFunc'.",&tolua_err); #endif return 0; @@ -62442,7 +62528,7 @@ int lua_cocos2dx_MotionStreak_setStartingPositionInitialized(lua_State* tolua_S) return 0; } -int lua_cocos2dx_MotionStreak_getBlendFunc(lua_State* tolua_S) +int lua_cocos2dx_MotionStreak_setTexture(lua_State* tolua_S) { int argc = 0; cocos2d::MotionStreak* cobj = nullptr; @@ -62462,29 +62548,32 @@ int lua_cocos2dx_MotionStreak_getBlendFunc(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_MotionStreak_getBlendFunc'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_MotionStreak_setTexture'", nullptr); return 0; } #endif argc = lua_gettop(tolua_S)-1; - if (argc == 0) + if (argc == 1) { + cocos2d::Texture2D* arg0; + + ok &= luaval_to_object(tolua_S, 2, "cc.Texture2D",&arg0, "cc.MotionStreak:setTexture"); if(!ok) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_MotionStreak_getBlendFunc'", nullptr); + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_MotionStreak_setTexture'", nullptr); return 0; } - const cocos2d::BlendFunc& ret = cobj->getBlendFunc(); - blendfunc_to_luaval(tolua_S, ret); + cobj->setTexture(arg0); + lua_settop(tolua_S, 1); return 1; } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.MotionStreak:getBlendFunc",argc, 0); + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.MotionStreak:setTexture",argc, 1); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_MotionStreak_getBlendFunc'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_MotionStreak_setTexture'.",&tolua_err); #endif return 0; @@ -62940,12 +63029,12 @@ int lua_register_cocos2dx_MotionStreak(lua_State* tolua_S) tolua_beginmodule(tolua_S,"MotionStreak"); tolua_function(tolua_S,"new",lua_cocos2dx_MotionStreak_constructor); tolua_function(tolua_S,"reset",lua_cocos2dx_MotionStreak_reset); - tolua_function(tolua_S,"setTexture",lua_cocos2dx_MotionStreak_setTexture); + tolua_function(tolua_S,"getBlendFunc",lua_cocos2dx_MotionStreak_getBlendFunc); tolua_function(tolua_S,"setBlendFunc",lua_cocos2dx_MotionStreak_setBlendFunc); tolua_function(tolua_S,"tintWithColor",lua_cocos2dx_MotionStreak_tintWithColor); tolua_function(tolua_S,"getTexture",lua_cocos2dx_MotionStreak_getTexture); tolua_function(tolua_S,"setStartingPositionInitialized",lua_cocos2dx_MotionStreak_setStartingPositionInitialized); - tolua_function(tolua_S,"getBlendFunc",lua_cocos2dx_MotionStreak_getBlendFunc); + tolua_function(tolua_S,"setTexture",lua_cocos2dx_MotionStreak_setTexture); tolua_function(tolua_S,"isStartingPositionInitialized",lua_cocos2dx_MotionStreak_isStartingPositionInitialized); tolua_function(tolua_S,"isFastMode",lua_cocos2dx_MotionStreak_isFastMode); tolua_function(tolua_S,"getStroke",lua_cocos2dx_MotionStreak_getStroke); @@ -98643,56 +98732,6 @@ int lua_cocos2dx_TMXMapInfo_setTileSize(lua_State* tolua_S) return 0; } -int lua_cocos2dx_TMXMapInfo_initWithTMXFile(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::TMXMapInfo* 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.TMXMapInfo",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::TMXMapInfo*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_TMXMapInfo_initWithTMXFile'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - std::string arg0; - - ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.TMXMapInfo:initWithTMXFile"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_TMXMapInfo_initWithTMXFile'", nullptr); - return 0; - } - bool ret = cobj->initWithTMXFile(arg0); - tolua_pushboolean(tolua_S,(bool)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.TMXMapInfo:initWithTMXFile",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_TMXMapInfo_initWithTMXFile'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_TMXMapInfo_getOrientation(lua_State* tolua_S) { int argc = 0; @@ -99181,49 +99220,52 @@ int lua_cocos2dx_TMXMapInfo_setHexSideLength(lua_State* tolua_S) return 0; } -int lua_cocos2dx_TMXMapInfo_getTilesets(lua_State* tolua_S) +int lua_cocos2dx_TMXMapInfo_initWithTMXFile(lua_State* tolua_S) { int argc = 0; cocos2d::TMXMapInfo* 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.TMXMapInfo",0,&tolua_err)) goto tolua_lerror; #endif + cobj = (cocos2d::TMXMapInfo*)tolua_tousertype(tolua_S,1,0); + #if COCOS2D_DEBUG >= 1 - if (!cobj) + if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_TMXMapInfo_getTilesets'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_TMXMapInfo_initWithTMXFile'", nullptr); return 0; } #endif + argc = lua_gettop(tolua_S)-1; - do{ - if (argc == 0) { - cocos2d::Vector& ret = cobj->getTilesets(); - ccvector_to_luaval(tolua_S, ret); - return 1; + if (argc == 1) + { + std::string arg0; + + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.TMXMapInfo:initWithTMXFile"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_TMXMapInfo_initWithTMXFile'", nullptr); + return 0; } - }while(0); - ok = true; - do{ - if (argc == 0) { - const cocos2d::Vector& ret = cobj->getTilesets(); - ccvector_to_luaval(tolua_S, ret); - return 1; - } - }while(0); - ok = true; - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.TMXMapInfo:getTilesets",argc, 0); + bool ret = cobj->initWithTMXFile(arg0); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.TMXMapInfo:initWithTMXFile",argc, 1); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_TMXMapInfo_getTilesets'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_TMXMapInfo_initWithTMXFile'.",&tolua_err); #endif return 0; @@ -99275,6 +99317,53 @@ int lua_cocos2dx_TMXMapInfo_getParentGID(lua_State* tolua_S) return 0; } +int lua_cocos2dx_TMXMapInfo_getTilesets(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::TMXMapInfo* 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.TMXMapInfo",0,&tolua_err)) goto tolua_lerror; +#endif + cobj = (cocos2d::TMXMapInfo*)tolua_tousertype(tolua_S,1,0); +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_TMXMapInfo_getTilesets'", nullptr); + return 0; + } +#endif + argc = lua_gettop(tolua_S)-1; + do{ + if (argc == 0) { + cocos2d::Vector& ret = cobj->getTilesets(); + ccvector_to_luaval(tolua_S, ret); + return 1; + } + }while(0); + ok = true; + do{ + if (argc == 0) { + const cocos2d::Vector& ret = cobj->getTilesets(); + ccvector_to_luaval(tolua_S, ret); + return 1; + } + }while(0); + ok = true; + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.TMXMapInfo:getTilesets",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_TMXMapInfo_getTilesets'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_TMXMapInfo_setParentElement(lua_State* tolua_S) { int argc = 0; @@ -100522,7 +100611,6 @@ int lua_register_cocos2dx_TMXMapInfo(lua_State* tolua_S) tolua_function(tolua_S,"setCurrentString",lua_cocos2dx_TMXMapInfo_setCurrentString); tolua_function(tolua_S,"getHexSideLength",lua_cocos2dx_TMXMapInfo_getHexSideLength); tolua_function(tolua_S,"setTileSize",lua_cocos2dx_TMXMapInfo_setTileSize); - tolua_function(tolua_S,"initWithTMXFile",lua_cocos2dx_TMXMapInfo_initWithTMXFile); tolua_function(tolua_S,"getOrientation",lua_cocos2dx_TMXMapInfo_getOrientation); tolua_function(tolua_S,"setObjectGroups",lua_cocos2dx_TMXMapInfo_setObjectGroups); tolua_function(tolua_S,"setLayers",lua_cocos2dx_TMXMapInfo_setLayers); @@ -100533,8 +100621,9 @@ int lua_register_cocos2dx_TMXMapInfo(lua_State* tolua_S) tolua_function(tolua_S,"getLayers",lua_cocos2dx_TMXMapInfo_getLayers); tolua_function(tolua_S,"getStaggerAxis",lua_cocos2dx_TMXMapInfo_getStaggerAxis); tolua_function(tolua_S,"setHexSideLength",lua_cocos2dx_TMXMapInfo_setHexSideLength); - tolua_function(tolua_S,"getTilesets",lua_cocos2dx_TMXMapInfo_getTilesets); + tolua_function(tolua_S,"initWithTMXFile",lua_cocos2dx_TMXMapInfo_initWithTMXFile); tolua_function(tolua_S,"getParentGID",lua_cocos2dx_TMXMapInfo_getParentGID); + tolua_function(tolua_S,"getTilesets",lua_cocos2dx_TMXMapInfo_getTilesets); tolua_function(tolua_S,"setParentElement",lua_cocos2dx_TMXMapInfo_setParentElement); tolua_function(tolua_S,"initWithXML",lua_cocos2dx_TMXMapInfo_initWithXML); tolua_function(tolua_S,"setParentGID",lua_cocos2dx_TMXMapInfo_setParentGID); @@ -106056,8 +106145,6 @@ TOLUA_API int register_all_cocos2dx(lua_State* tolua_S) lua_register_cocos2dx_ShakyTiles3D(tolua_S); lua_register_cocos2dx_PageTurn3D(tolua_S); lua_register_cocos2dx_PolygonInfo(tolua_S); - lua_register_cocos2dx_TransitionSlideInL(tolua_S); - lua_register_cocos2dx_TransitionSlideInT(tolua_S); lua_register_cocos2dx_Grid3D(tolua_S); lua_register_cocos2dx_EventListenerController(tolua_S); lua_register_cocos2dx_TransitionProgressInOut(tolua_S); @@ -106097,6 +106184,7 @@ TOLUA_API int register_all_cocos2dx(lua_State* tolua_S) lua_register_cocos2dx_ComponentLua(tolua_S); lua_register_cocos2dx_MotionStreak3D(tolua_S); lua_register_cocos2dx_EaseOut(tolua_S); + lua_register_cocos2dx_TransitionSlideInL(tolua_S); lua_register_cocos2dx_MenuItemFont(tolua_S); lua_register_cocos2dx_TransitionFadeUp(tolua_S); lua_register_cocos2dx_LayerRadialGradient(tolua_S); @@ -106110,6 +106198,7 @@ TOLUA_API int register_all_cocos2dx(lua_State* tolua_S) lua_register_cocos2dx_RotateBy(tolua_S); lua_register_cocos2dx_FileUtils(tolua_S); lua_register_cocos2dx_Sprite(tolua_S); + lua_register_cocos2dx_TransitionSlideInT(tolua_S); lua_register_cocos2dx_ProgressTo(tolua_S); lua_register_cocos2dx_TransitionProgressOutIn(tolua_S); lua_register_cocos2dx_AnimationFrame(tolua_S); diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_extension_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_extension_auto.cpp index ff7773308d..b973fd800e 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_extension_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_extension_auto.cpp @@ -4861,53 +4861,6 @@ int lua_cocos2dx_extension_ControlPotentiometer_getValue(lua_State* tolua_S) return 0; } -int lua_cocos2dx_extension_ControlPotentiometer_getPreviousLocation(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::extension::ControlPotentiometer* 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.ControlPotentiometer",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::extension::ControlPotentiometer*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_extension_ControlPotentiometer_getPreviousLocation'", 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_extension_ControlPotentiometer_getPreviousLocation'", nullptr); - return 0; - } - cocos2d::Vec2 ret = cobj->getPreviousLocation(); - vec2_to_luaval(tolua_S, ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.ControlPotentiometer:getPreviousLocation",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_extension_ControlPotentiometer_getPreviousLocation'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_extension_ControlPotentiometer_distanceBetweenPointAndPoint(lua_State* tolua_S) { int argc = 0; @@ -5011,6 +4964,53 @@ int lua_cocos2dx_extension_ControlPotentiometer_potentiometerEnded(lua_State* to return 0; } +int lua_cocos2dx_extension_ControlPotentiometer_getPreviousLocation(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::extension::ControlPotentiometer* 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.ControlPotentiometer",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::extension::ControlPotentiometer*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_extension_ControlPotentiometer_getPreviousLocation'", 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_extension_ControlPotentiometer_getPreviousLocation'", nullptr); + return 0; + } + cocos2d::Vec2 ret = cobj->getPreviousLocation(); + vec2_to_luaval(tolua_S, ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.ControlPotentiometer:getPreviousLocation",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_extension_ControlPotentiometer_getPreviousLocation'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_extension_ControlPotentiometer_setProgressTimer(lua_State* tolua_S) { int argc = 0; @@ -5364,9 +5364,9 @@ int lua_register_cocos2dx_extension_ControlPotentiometer(lua_State* tolua_S) tolua_function(tolua_S,"getMinimumValue",lua_cocos2dx_extension_ControlPotentiometer_getMinimumValue); tolua_function(tolua_S,"setThumbSprite",lua_cocos2dx_extension_ControlPotentiometer_setThumbSprite); tolua_function(tolua_S,"getValue",lua_cocos2dx_extension_ControlPotentiometer_getValue); - tolua_function(tolua_S,"getPreviousLocation",lua_cocos2dx_extension_ControlPotentiometer_getPreviousLocation); tolua_function(tolua_S,"distanceBetweenPointAndPoint",lua_cocos2dx_extension_ControlPotentiometer_distanceBetweenPointAndPoint); tolua_function(tolua_S,"potentiometerEnded",lua_cocos2dx_extension_ControlPotentiometer_potentiometerEnded); + tolua_function(tolua_S,"getPreviousLocation",lua_cocos2dx_extension_ControlPotentiometer_getPreviousLocation); tolua_function(tolua_S,"setProgressTimer",lua_cocos2dx_extension_ControlPotentiometer_setProgressTimer); tolua_function(tolua_S,"setMinimumValue",lua_cocos2dx_extension_ControlPotentiometer_setMinimumValue); tolua_function(tolua_S,"getThumbSprite",lua_cocos2dx_extension_ControlPotentiometer_getThumbSprite); @@ -5380,56 +5380,6 @@ int lua_register_cocos2dx_extension_ControlPotentiometer(lua_State* tolua_S) return 1; } -int lua_cocos2dx_extension_ControlSlider_setBackgroundSprite(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::extension::ControlSlider* 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.ControlSlider",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::extension::ControlSlider*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_extension_ControlSlider_setBackgroundSprite'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - cocos2d::Sprite* arg0; - - ok &= luaval_to_object(tolua_S, 2, "cc.Sprite",&arg0, "cc.ControlSlider:setBackgroundSprite"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_extension_ControlSlider_setBackgroundSprite'", nullptr); - return 0; - } - cobj->setBackgroundSprite(arg0); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.ControlSlider:setBackgroundSprite",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_extension_ControlSlider_setBackgroundSprite'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_extension_ControlSlider_getMaximumAllowedValue(lua_State* tolua_S) { int argc = 0; @@ -6328,6 +6278,56 @@ int lua_cocos2dx_extension_ControlSlider_setSelectedThumbSprite(lua_State* tolua return 0; } +int lua_cocos2dx_extension_ControlSlider_setBackgroundSprite(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::extension::ControlSlider* 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.ControlSlider",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::extension::ControlSlider*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_extension_ControlSlider_setBackgroundSprite'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + cocos2d::Sprite* arg0; + + ok &= luaval_to_object(tolua_S, 2, "cc.Sprite",&arg0, "cc.ControlSlider:setBackgroundSprite"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_extension_ControlSlider_setBackgroundSprite'", nullptr); + return 0; + } + cobj->setBackgroundSprite(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.ControlSlider:setBackgroundSprite",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_extension_ControlSlider_setBackgroundSprite'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_extension_ControlSlider_setMaximumAllowedValue(lua_State* tolua_S) { int argc = 0; @@ -6532,7 +6532,6 @@ int lua_register_cocos2dx_extension_ControlSlider(lua_State* tolua_S) tolua_beginmodule(tolua_S,"ControlSlider"); tolua_function(tolua_S,"new",lua_cocos2dx_extension_ControlSlider_constructor); - tolua_function(tolua_S,"setBackgroundSprite",lua_cocos2dx_extension_ControlSlider_setBackgroundSprite); tolua_function(tolua_S,"getMaximumAllowedValue",lua_cocos2dx_extension_ControlSlider_getMaximumAllowedValue); tolua_function(tolua_S,"initWithSprites",lua_cocos2dx_extension_ControlSlider_initWithSprites); tolua_function(tolua_S,"getMinimumAllowedValue",lua_cocos2dx_extension_ControlSlider_getMinimumAllowedValue); @@ -6551,6 +6550,7 @@ int lua_register_cocos2dx_extension_ControlSlider(lua_State* tolua_S) tolua_function(tolua_S,"setMinimumAllowedValue",lua_cocos2dx_extension_ControlSlider_setMinimumAllowedValue); tolua_function(tolua_S,"getProgressSprite",lua_cocos2dx_extension_ControlSlider_getProgressSprite); tolua_function(tolua_S,"setSelectedThumbSprite",lua_cocos2dx_extension_ControlSlider_setSelectedThumbSprite); + tolua_function(tolua_S,"setBackgroundSprite",lua_cocos2dx_extension_ControlSlider_setBackgroundSprite); tolua_function(tolua_S,"setMaximumAllowedValue",lua_cocos2dx_extension_ControlSlider_setMaximumAllowedValue); tolua_function(tolua_S,"create", lua_cocos2dx_extension_ControlSlider_create); tolua_endmodule(tolua_S); @@ -10231,56 +10231,6 @@ int lua_cocos2dx_extension_TableView_setVerticalFillOrder(lua_State* tolua_S) return 0; } -int lua_cocos2dx_extension_TableView_scrollViewDidZoom(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::extension::TableView* 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.TableView",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::extension::TableView*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_extension_TableView_scrollViewDidZoom'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - cocos2d::extension::ScrollView* arg0; - - ok &= luaval_to_object(tolua_S, 2, "cc.ScrollView",&arg0, "cc.TableView:scrollViewDidZoom"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_extension_TableView_scrollViewDidZoom'", nullptr); - return 0; - } - cobj->scrollViewDidZoom(arg0); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.TableView:scrollViewDidZoom",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_extension_TableView_scrollViewDidZoom'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_extension_TableView__updateContentSize(lua_State* tolua_S) { int argc = 0; @@ -10589,6 +10539,56 @@ int lua_cocos2dx_extension_TableView_reloadData(lua_State* tolua_S) return 0; } +int lua_cocos2dx_extension_TableView_scrollViewDidZoom(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::extension::TableView* 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.TableView",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::extension::TableView*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_extension_TableView_scrollViewDidZoom'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + cocos2d::extension::ScrollView* arg0; + + ok &= luaval_to_object(tolua_S, 2, "cc.ScrollView",&arg0, "cc.TableView:scrollViewDidZoom"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_extension_TableView_scrollViewDidZoom'", nullptr); + return 0; + } + cobj->scrollViewDidZoom(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.TableView:scrollViewDidZoom",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_extension_TableView_scrollViewDidZoom'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_extension_TableView_insertCellAtIndex(lua_State* tolua_S) { int argc = 0; @@ -10788,13 +10788,13 @@ int lua_register_cocos2dx_extension_TableView(lua_State* tolua_S) tolua_function(tolua_S,"new",lua_cocos2dx_extension_TableView_constructor); tolua_function(tolua_S,"updateCellAtIndex",lua_cocos2dx_extension_TableView_updateCellAtIndex); tolua_function(tolua_S,"setVerticalFillOrder",lua_cocos2dx_extension_TableView_setVerticalFillOrder); - tolua_function(tolua_S,"scrollViewDidZoom",lua_cocos2dx_extension_TableView_scrollViewDidZoom); tolua_function(tolua_S,"_updateContentSize",lua_cocos2dx_extension_TableView__updateContentSize); tolua_function(tolua_S,"getVerticalFillOrder",lua_cocos2dx_extension_TableView_getVerticalFillOrder); tolua_function(tolua_S,"removeCellAtIndex",lua_cocos2dx_extension_TableView_removeCellAtIndex); tolua_function(tolua_S,"initWithViewSize",lua_cocos2dx_extension_TableView_initWithViewSize); tolua_function(tolua_S,"scrollViewDidScroll",lua_cocos2dx_extension_TableView_scrollViewDidScroll); tolua_function(tolua_S,"reloadData",lua_cocos2dx_extension_TableView_reloadData); + tolua_function(tolua_S,"scrollViewDidZoom",lua_cocos2dx_extension_TableView_scrollViewDidZoom); tolua_function(tolua_S,"insertCellAtIndex",lua_cocos2dx_extension_TableView_insertCellAtIndex); tolua_function(tolua_S,"cellAtIndex",lua_cocos2dx_extension_TableView_cellAtIndex); tolua_function(tolua_S,"dequeueCell",lua_cocos2dx_extension_TableView_dequeueCell); diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_studio_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_studio_auto.cpp index e4d7dba95e..29481a4450 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_studio_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_studio_auto.cpp @@ -9530,53 +9530,6 @@ int lua_register_cocos2dx_studio_ArmatureAnimation(lua_State* tolua_S) return 1; } -int lua_cocos2dx_studio_ArmatureDataManager_getAnimationDatas(lua_State* tolua_S) -{ - int argc = 0; - cocostudio::ArmatureDataManager* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"ccs.ArmatureDataManager",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocostudio::ArmatureDataManager*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ArmatureDataManager_getAnimationDatas'", 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_studio_ArmatureDataManager_getAnimationDatas'", nullptr); - return 0; - } - const cocos2d::Map& ret = cobj->getAnimationDatas(); - ccmap_string_key_to_luaval(tolua_S, ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ArmatureDataManager:getAnimationDatas",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ArmatureDataManager_getAnimationDatas'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_studio_ArmatureDataManager_removeAnimationData(lua_State* tolua_S) { int argc = 0; @@ -10350,6 +10303,53 @@ int lua_cocos2dx_studio_ArmatureDataManager_addTextureData(lua_State* tolua_S) return 0; } +int lua_cocos2dx_studio_ArmatureDataManager_getAnimationDatas(lua_State* tolua_S) +{ + int argc = 0; + cocostudio::ArmatureDataManager* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccs.ArmatureDataManager",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocostudio::ArmatureDataManager*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ArmatureDataManager_getAnimationDatas'", 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_studio_ArmatureDataManager_getAnimationDatas'", nullptr); + return 0; + } + const cocos2d::Map& ret = cobj->getAnimationDatas(); + ccmap_string_key_to_luaval(tolua_S, ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ArmatureDataManager:getAnimationDatas",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ArmatureDataManager_getAnimationDatas'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_studio_ArmatureDataManager_isAutoLoadSpriteFile(lua_State* tolua_S) { int argc = 0; @@ -10550,7 +10550,6 @@ int lua_register_cocos2dx_studio_ArmatureDataManager(lua_State* tolua_S) tolua_cclass(tolua_S,"ArmatureDataManager","ccs.ArmatureDataManager","cc.Ref",nullptr); tolua_beginmodule(tolua_S,"ArmatureDataManager"); - tolua_function(tolua_S,"getAnimationDatas",lua_cocos2dx_studio_ArmatureDataManager_getAnimationDatas); tolua_function(tolua_S,"removeAnimationData",lua_cocos2dx_studio_ArmatureDataManager_removeAnimationData); tolua_function(tolua_S,"addArmatureData",lua_cocos2dx_studio_ArmatureDataManager_addArmatureData); tolua_function(tolua_S,"addArmatureFileInfo",lua_cocos2dx_studio_ArmatureDataManager_addArmatureFileInfo); @@ -10565,6 +10564,7 @@ int lua_register_cocos2dx_studio_ArmatureDataManager(lua_State* tolua_S) tolua_function(tolua_S,"getArmatureDatas",lua_cocos2dx_studio_ArmatureDataManager_getArmatureDatas); tolua_function(tolua_S,"removeTextureData",lua_cocos2dx_studio_ArmatureDataManager_removeTextureData); tolua_function(tolua_S,"addTextureData",lua_cocos2dx_studio_ArmatureDataManager_addTextureData); + tolua_function(tolua_S,"getAnimationDatas",lua_cocos2dx_studio_ArmatureDataManager_getAnimationDatas); tolua_function(tolua_S,"isAutoLoadSpriteFile",lua_cocos2dx_studio_ArmatureDataManager_isAutoLoadSpriteFile); tolua_function(tolua_S,"addSpriteFrameFromFile",lua_cocos2dx_studio_ArmatureDataManager_addSpriteFrameFromFile); tolua_function(tolua_S,"destroyInstance", lua_cocos2dx_studio_ArmatureDataManager_destroyInstance); diff --git a/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp b/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp index 0d21487228..2e8d688b7c 100644 --- a/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp +++ b/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp @@ -74,6 +74,8 @@ NewLabelTests::NewLabelTests() ADD_TEST_CASE(LabelFNTHundredLabels); ADD_TEST_CASE(LabelFNTPadding); ADD_TEST_CASE(LabelFNTOffset); + ADD_TEST_CASE(LabelFNTMultiFontAtlasNoRotation); + ADD_TEST_CASE(LabelFNTMultiFontAtlasWithRotation); ADD_TEST_CASE(LabelTTFFontsTestNew); ADD_TEST_CASE(LabelTTFLongLineWrapping); @@ -933,6 +935,57 @@ std::string LabelFNTBounds::subtitle() const return "Testing bounding-box"; } +LabelFNTMultiFontAtlasNoRotation::LabelFNTMultiFontAtlasNoRotation() +{ + auto s = Director::getInstance()->getWinSize(); + + auto label1 = Label::createWithBMFont("fonts/helvetica-32.fnt", "This is Helvetica"); + addChild(label1); + label1->setPosition(Vec2(s.width / 2, s.height / 3 * 2)); + + auto label2 = Label::createWithBMFont("fonts/geneva-32.fnt", "And this is Geneva", TextHAlignment::LEFT, 0, Rect(0, 128, 0, 0), false); + addChild(label2); + label2->setPosition(Vec2(s.width / 2, s.height / 3 * 1)); +} + +std::string LabelFNTMultiFontAtlasNoRotation::title() const +{ + return "New Label + Multi-BM Font Atlas Test1"; +} + +std::string LabelFNTMultiFontAtlasNoRotation::subtitle() const +{ + return "Using 2 .fnt definitions that share the same texture atlas."; +} + +LabelFNTMultiFontAtlasWithRotation::LabelFNTMultiFontAtlasWithRotation() +{ + auto s = Director::getInstance()->getWinSize(); + + auto spriteCache = SpriteFrameCache::getInstance(); + spriteCache->addSpriteFramesWithFile("fonts/bmfont-rotated-test.plist"); + + // Label BMFont + auto label1 = Label::createWithBMFont("fonts/helvetica-regular-32.fnt", "Helvetica with SubTextureKey", TextHAlignment::CENTER, 0, "helvetica-regular-32.png"); + label1->setPosition(Vec2(s.width / 2, s.height / 3 * 2)); + this->addChild(label1); + + const auto frame = spriteCache->getSpriteFrameByName("geneva-regular-32.png"); + auto label2 = Label::createWithBMFont("fonts/geneva-regular-32.fnt", "Geneva with Rect and Rotated", TextHAlignment::CENTER, 0, frame->getRectInPixels(), frame->isRotated()); + label2->setPosition(Vec2(s.width / 2, s.height / 3 * 1)); + this->addChild(label2); +} + +std::string LabelFNTMultiFontAtlasWithRotation::title() const +{ + return "New Label + Multi-BM Font Atlas Test2"; +} + +std::string LabelFNTMultiFontAtlasWithRotation::subtitle() const +{ + return "Using 2 .fnt definitions that share a PLIST texture atlas (rotated)."; +} + LabelTTFLongLineWrapping::LabelTTFLongLineWrapping() { auto size = Director::getInstance()->getWinSize(); diff --git a/tests/cpp-tests/Classes/LabelTest/LabelTestNew.h b/tests/cpp-tests/Classes/LabelTest/LabelTestNew.h index f1bd5621b2..9c416ef1f0 100644 --- a/tests/cpp-tests/Classes/LabelTest/LabelTestNew.h +++ b/tests/cpp-tests/Classes/LabelTest/LabelTestNew.h @@ -223,6 +223,27 @@ public: virtual std::string subtitle() const override; }; +class LabelFNTMultiFontAtlasNoRotation : public AtlasDemoNew +{ +public: + CREATE_FUNC(LabelFNTMultiFontAtlasNoRotation); + + LabelFNTMultiFontAtlasNoRotation(); + virtual std::string title() const override; + virtual std::string subtitle() const override; +}; + + +class LabelFNTMultiFontAtlasWithRotation : public AtlasDemoNew +{ +public: + CREATE_FUNC(LabelFNTMultiFontAtlasWithRotation); + + LabelFNTMultiFontAtlasWithRotation(); + virtual std::string title() const override; + virtual std::string subtitle() const override; +}; + class LabelTTFLongLineWrapping : public AtlasDemoNew { public: diff --git a/tests/cpp-tests/Resources/fonts/bmfont-rotated-test.plist b/tests/cpp-tests/Resources/fonts/bmfont-rotated-test.plist new file mode 100644 index 0000000000..f38a0d3279 --- /dev/null +++ b/tests/cpp-tests/Resources/fonts/bmfont-rotated-test.plist @@ -0,0 +1,56 @@ + + + + + frames + + geneva-regular-32.png + + aliases + + spriteOffset + {-2,3} + spriteSize + {508,122} + spriteSourceSize + {512,128} + textureRect + {{2,2},{508,122}} + textureRotated + + + helvetica-regular-32.png + + aliases + + spriteOffset + {-7,4} + spriteSize + {498,120} + spriteSourceSize + {512,128} + textureRect + {{128,2},{498,120}} + textureRotated + + + + metadata + + format + 3 + pixelFormat + RGBA4444 + premultiplyAlpha + + realTextureFileName + bmfont-rotated-test.png + size + {250,512} + smartupdate + $TexturePacker:SmartUpdate:404120629fe631b449a08b9b19e69a2c:65dfae55236043f04822a4b3d14d288d:b41d4ffccc5285d084f64abded57400d$ + textureFileName + bmfont-rotated-test.png + + + diff --git a/tests/cpp-tests/Resources/fonts/bmfont-rotated-test.png b/tests/cpp-tests/Resources/fonts/bmfont-rotated-test.png new file mode 100644 index 0000000000..874f1d6cd2 Binary files /dev/null and b/tests/cpp-tests/Resources/fonts/bmfont-rotated-test.png differ diff --git a/tests/cpp-tests/Resources/fonts/geneva-regular-32.fnt b/tests/cpp-tests/Resources/fonts/geneva-regular-32.fnt new file mode 100644 index 0000000000..882616e5fa --- /dev/null +++ b/tests/cpp-tests/Resources/fonts/geneva-regular-32.fnt @@ -0,0 +1,99 @@ +info face="Geneva" size=32 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=1,1 +common lineHeight=42 base=32 scaleW=512 scaleH=128 pages=1 packed=0 +page id=0 file="bmfont-rotated-test.png" +chars count=95 +char id=40 x=1 y=1 width=15 height=36 xoffset=1 yoffset=5 xadvance=14 page=0 chnl=0 letter="(" +char id=41 x=17 y=1 width=14 height=36 xoffset=1 yoffset=5 xadvance=14 page=0 chnl=0 letter=")" +char id=106 x=32 y=1 width=13 height=36 xoffset=-3 yoffset=6 xadvance=8 page=0 chnl=0 letter="j" +char id=125 x=46 y=1 width=13 height=36 xoffset=2 yoffset=5 xadvance=14 page=0 chnl=0 letter="}" +char id=91 x=60 y=1 width=13 height=36 xoffset=2 yoffset=5 xadvance=14 page=0 chnl=0 letter="[" +char id=93 x=74 y=1 width=13 height=36 xoffset=1 yoffset=5 xadvance=14 page=0 chnl=0 letter="]" +char id=123 x=88 y=1 width=12 height=36 xoffset=2 yoffset=5 xadvance=14 page=0 chnl=0 letter="{" +char id=81 x=101 y=1 width=28 height=35 xoffset=0 yoffset=6 xadvance=23 page=0 chnl=0 letter="Q" +char id=36 x=130 y=1 width=21 height=34 xoffset=1 yoffset=4 xadvance=21 page=0 chnl=0 letter="$" +char id=100 x=152 y=1 width=21 height=31 xoffset=0 yoffset=5 xadvance=19 page=0 chnl=0 letter="d" +char id=98 x=174 y=1 width=21 height=31 xoffset=1 yoffset=5 xadvance=19 page=0 chnl=0 letter="b" +char id=64 x=196 y=1 width=29 height=30 xoffset=0 yoffset=6 xadvance=27 page=0 chnl=0 letter="@" +char id=79 x=226 y=1 width=26 height=30 xoffset=0 yoffset=6 xadvance=23 page=0 chnl=0 letter="O" +char id=38 x=253 y=1 width=25 height=30 xoffset=0 yoffset=6 xadvance=23 page=0 chnl=0 letter="&" +char id=71 x=279 y=1 width=23 height=30 xoffset=0 yoffset=6 xadvance=21 page=0 chnl=0 letter="G" +char id=67 x=303 y=1 width=23 height=30 xoffset=0 yoffset=6 xadvance=20 page=0 chnl=0 letter="C" +char id=85 x=327 y=1 width=23 height=30 xoffset=0 yoffset=6 xadvance=21 page=0 chnl=0 letter="U" +char id=48 x=351 y=1 width=23 height=30 xoffset=0 yoffset=6 xadvance=21 page=0 chnl=0 letter="0" +char id=83 x=375 y=1 width=22 height=30 xoffset=0 yoffset=6 xadvance=19 page=0 chnl=0 letter="S" +char id=92 x=398 y=1 width=21 height=30 xoffset=-1 yoffset=6 xadvance=17 page=0 chnl=0 letter="\" +char id=47 x=420 y=1 width=21 height=30 xoffset=-1 yoffset=6 xadvance=17 page=0 chnl=0 letter="/" +char id=56 x=442 y=1 width=21 height=30 xoffset=1 yoffset=6 xadvance=21 page=0 chnl=0 letter="8" +char id=57 x=464 y=1 width=21 height=30 xoffset=1 yoffset=6 xadvance=21 page=0 chnl=0 letter="9" +char id=54 x=486 y=1 width=21 height=30 xoffset=1 yoffset=6 xadvance=21 page=0 chnl=0 letter="6" +char id=103 x=1 y=38 width=21 height=30 xoffset=0 yoffset=13 xadvance=19 page=0 chnl=0 letter="g" +char id=51 x=23 y=38 width=20 height=30 xoffset=1 yoffset=6 xadvance=21 page=0 chnl=0 letter="3" +char id=53 x=44 y=38 width=20 height=30 xoffset=2 yoffset=6 xadvance=21 page=0 chnl=0 letter="5" +char id=107 x=65 y=38 width=19 height=30 xoffset=1 yoffset=5 xadvance=17 page=0 chnl=0 letter="k" +char id=104 x=85 y=38 width=19 height=30 xoffset=1 yoffset=5 xadvance=18 page=0 chnl=0 letter="h" +char id=74 x=105 y=38 width=18 height=30 xoffset=-1 yoffset=6 xadvance=15 page=0 chnl=0 letter="J" +char id=102 x=124 y=38 width=16 height=30 xoffset=0 yoffset=5 xadvance=12 page=0 chnl=0 letter="f" +char id=124 x=141 y=38 width=8 height=30 xoffset=1 yoffset=6 xadvance=7 page=0 chnl=0 letter="|" +char id=108 x=150 y=38 width=8 height=30 xoffset=1 yoffset=5 xadvance=7 page=0 chnl=0 letter="l" +char id=87 x=159 y=38 width=32 height=29 xoffset=0 yoffset=6 xadvance=30 page=0 chnl=0 letter="W" +char id=37 x=192 y=38 width=31 height=29 xoffset=0 yoffset=6 xadvance=28 page=0 chnl=0 letter="%" +char id=86 x=224 y=38 width=27 height=29 xoffset=-1 yoffset=6 xadvance=23 page=0 chnl=0 letter="V" +char id=65 x=252 y=38 width=27 height=29 xoffset=-1 yoffset=6 xadvance=23 page=0 chnl=0 letter="A" +char id=77 x=280 y=38 width=25 height=29 xoffset=1 yoffset=6 xadvance=25 page=0 chnl=0 letter="M" +char id=35 x=306 y=38 width=25 height=29 xoffset=-1 yoffset=6 xadvance=21 page=0 chnl=0 letter="#" +char id=84 x=332 y=38 width=24 height=29 xoffset=-1 yoffset=6 xadvance=20 page=0 chnl=0 letter="T" +char id=78 x=357 y=38 width=23 height=29 xoffset=1 yoffset=6 xadvance=22 page=0 chnl=0 letter="N" +char id=89 x=381 y=38 width=23 height=29 xoffset=-1 yoffset=6 xadvance=19 page=0 chnl=0 letter="Y" +char id=88 x=405 y=38 width=23 height=29 xoffset=-1 yoffset=6 xadvance=19 page=0 chnl=0 letter="X" +char id=68 x=429 y=38 width=23 height=29 xoffset=1 yoffset=6 xadvance=22 page=0 chnl=0 letter="D" +char id=75 x=453 y=38 width=23 height=29 xoffset=1 yoffset=6 xadvance=21 page=0 chnl=0 letter="K" +char id=52 x=477 y=38 width=23 height=29 xoffset=0 yoffset=6 xadvance=21 page=0 chnl=0 letter="4" +char id=72 x=1 y=69 width=22 height=29 xoffset=1 yoffset=6 xadvance=22 page=0 chnl=0 letter="H" +char id=121 x=24 y=69 width=22 height=29 xoffset=-1 yoffset=13 xadvance=18 page=0 chnl=0 letter="y" +char id=50 x=47 y=69 width=21 height=29 xoffset=1 yoffset=6 xadvance=21 page=0 chnl=0 letter="2" +char id=82 x=69 y=69 width=21 height=29 xoffset=1 yoffset=6 xadvance=19 page=0 chnl=0 letter="R" +char id=66 x=91 y=69 width=21 height=29 xoffset=1 yoffset=6 xadvance=20 page=0 chnl=0 letter="B" +char id=76 x=113 y=69 width=21 height=29 xoffset=1 yoffset=6 xadvance=18 page=0 chnl=0 letter="L" +char id=55 x=135 y=69 width=21 height=29 xoffset=1 yoffset=6 xadvance=21 page=0 chnl=0 letter="7" +char id=113 x=157 y=69 width=21 height=29 xoffset=0 yoffset=13 xadvance=19 page=0 chnl=0 letter="q" +char id=90 x=179 y=69 width=20 height=29 xoffset=0 yoffset=6 xadvance=18 page=0 chnl=0 letter="Z" +char id=80 x=200 y=69 width=20 height=29 xoffset=1 yoffset=6 xadvance=18 page=0 chnl=0 letter="P" +char id=112 x=221 y=69 width=20 height=29 xoffset=1 yoffset=13 xadvance=19 page=0 chnl=0 letter="p" +char id=63 x=242 y=69 width=19 height=29 xoffset=0 yoffset=6 xadvance=18 page=0 chnl=0 letter="?" +char id=69 x=262 y=69 width=19 height=29 xoffset=1 yoffset=6 xadvance=18 page=0 chnl=0 letter="E" +char id=70 x=282 y=69 width=18 height=29 xoffset=1 yoffset=6 xadvance=17 page=0 chnl=0 letter="F" +char id=49 x=301 y=69 width=13 height=29 xoffset=3 yoffset=6 xadvance=21 page=0 chnl=0 letter="1" +char id=33 x=315 y=69 width=9 height=29 xoffset=1 yoffset=6 xadvance=9 page=0 chnl=0 letter="!" +char id=105 x=325 y=69 width=8 height=29 xoffset=1 yoffset=6 xadvance=7 page=0 chnl=0 letter="i" +char id=73 x=334 y=69 width=8 height=29 xoffset=1 yoffset=6 xadvance=7 page=0 chnl=0 letter="I" +char id=59 x=343 y=69 width=9 height=28 xoffset=1 yoffset=13 xadvance=9 page=0 chnl=0 letter=";" +char id=116 x=353 y=69 width=16 height=27 xoffset=0 yoffset=9 xadvance=14 page=0 chnl=0 letter="t" +char id=111 x=370 y=69 width=21 height=23 xoffset=0 yoffset=13 xadvance=19 page=0 chnl=0 letter="o" +char id=101 x=392 y=69 width=20 height=23 xoffset=0 yoffset=13 xadvance=18 page=0 chnl=0 letter="e" +char id=99 x=413 y=69 width=20 height=23 xoffset=0 yoffset=13 xadvance=17 page=0 chnl=0 letter="c" +char id=97 x=434 y=69 width=20 height=23 xoffset=0 yoffset=13 xadvance=17 page=0 chnl=0 letter="a" +char id=117 x=455 y=69 width=19 height=23 xoffset=1 yoffset=13 xadvance=18 page=0 chnl=0 letter="u" +char id=115 x=475 y=69 width=18 height=23 xoffset=0 yoffset=13 xadvance=16 page=0 chnl=0 letter="s" +char id=109 x=1 y=99 width=29 height=22 xoffset=1 yoffset=13 xadvance=28 page=0 chnl=0 letter="m" +char id=119 x=31 y=99 width=29 height=22 xoffset=-1 yoffset=13 xadvance=24 page=0 chnl=0 letter="w" +char id=62 x=61 y=99 width=23 height=22 xoffset=0 yoffset=13 xadvance=21 page=0 chnl=0 letter=">" +char id=43 x=85 y=99 width=23 height=22 xoffset=0 yoffset=13 xadvance=21 page=0 chnl=0 letter="+" +char id=118 x=109 y=99 width=22 height=22 xoffset=-1 yoffset=13 xadvance=18 page=0 chnl=0 letter="v" +char id=60 x=132 y=99 width=22 height=22 xoffset=1 yoffset=13 xadvance=21 page=0 chnl=0 letter="<" +char id=94 x=155 y=99 width=22 height=22 xoffset=1 yoffset=7 xadvance=21 page=0 chnl=0 letter="^" +char id=110 x=178 y=99 width=19 height=22 xoffset=1 yoffset=13 xadvance=18 page=0 chnl=0 letter="n" +char id=120 x=198 y=99 width=19 height=22 xoffset=0 yoffset=13 xadvance=16 page=0 chnl=0 letter="x" +char id=122 x=218 y=99 width=19 height=22 xoffset=0 yoffset=13 xadvance=17 page=0 chnl=0 letter="z" +char id=114 x=238 y=99 width=15 height=22 xoffset=1 yoffset=13 xadvance=12 page=0 chnl=0 letter="r" +char id=58 x=254 y=99 width=9 height=22 xoffset=1 yoffset=13 xadvance=9 page=0 chnl=0 letter=":" +char id=42 x=264 y=99 width=18 height=18 xoffset=0 yoffset=6 xadvance=16 page=0 chnl=0 letter="*" +char id=34 x=283 y=99 width=16 height=15 xoffset=1 yoffset=5 xadvance=16 page=0 chnl=0 letter=""" +char id=39 x=300 y=99 width=9 height=15 xoffset=1 yoffset=5 xadvance=9 page=0 chnl=0 letter="'" +char id=44 x=310 y=99 width=9 height=15 xoffset=1 yoffset=26 xadvance=9 page=0 chnl=0 letter="," +char id=61 x=320 y=99 width=23 height=13 xoffset=0 yoffset=18 xadvance=21 page=0 chnl=0 letter="=" +char id=126 x=344 y=99 width=23 height=11 xoffset=0 yoffset=19 xadvance=21 page=0 chnl=0 letter="~" +char id=96 x=368 y=99 width=12 height=10 xoffset=4 yoffset=5 xadvance=18 page=0 chnl=0 letter="`" +char id=46 x=381 y=99 width=9 height=9 xoffset=1 yoffset=26 xadvance=9 page=0 chnl=0 letter="." +char id=45 x=391 y=99 width=14 height=8 xoffset=0 yoffset=19 xadvance=12 page=0 chnl=0 letter="-" +char id=95 x=406 y=99 width=25 height=7 xoffset=-1 yoffset=31 xadvance=21 page=0 chnl=0 letter="_" +char id=32 x=432 y=99 width=0 height=0 xoffset=-110 yoffset=152 xadvance=10 page=0 chnl=0 letter="space" diff --git a/tests/cpp-tests/Resources/fonts/helvetica-regular-32.fnt b/tests/cpp-tests/Resources/fonts/helvetica-regular-32.fnt new file mode 100644 index 0000000000..97d1fd77bc --- /dev/null +++ b/tests/cpp-tests/Resources/fonts/helvetica-regular-32.fnt @@ -0,0 +1,99 @@ +info face="Helvetica-Bold" size=32 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=1,1 +common lineHeight=32 base=25 scaleW=512 scaleH=128 pages=1 packed=0 +page id=0 file="bmfont-rotated-test.png" +chars count=95 +char id=125 x=1 y=1 width=15 height=35 xoffset=-1 yoffset=-0 xadvance=12 page=0 chnl=0 letter="}" +char id=41 x=17 y=1 width=14 height=35 xoffset=-1 yoffset=-0 xadvance=10 page=0 chnl=0 letter=")" +char id=123 x=32 y=1 width=14 height=35 xoffset=-1 yoffset=-0 xadvance=12 page=0 chnl=0 letter="{" +char id=93 x=47 y=1 width=13 height=35 xoffset=-1 yoffset=-0 xadvance=10 page=0 chnl=0 letter="]" +char id=40 x=61 y=1 width=13 height=35 xoffset=0 yoffset=-0 xadvance=10 page=0 chnl=0 letter="(" +char id=91 x=75 y=1 width=12 height=35 xoffset=1 yoffset=-0 xadvance=10 page=0 chnl=0 letter="[" +char id=106 x=88 y=1 width=11 height=35 xoffset=-1 yoffset=-0 xadvance=8 page=0 chnl=0 letter="j" +char id=36 x=100 y=1 width=21 height=33 xoffset=-1 yoffset=-1 xadvance=17 page=0 chnl=0 letter="$" +char id=81 x=122 y=1 width=27 height=30 xoffset=0 yoffset=-0 xadvance=24 page=0 chnl=0 letter="Q" +char id=64 x=150 y=1 width=30 height=29 xoffset=2 yoffset=-0 xadvance=31 page=0 chnl=0 letter="@" +char id=79 x=181 y=1 width=27 height=29 xoffset=0 yoffset=-0 xadvance=24 page=0 chnl=0 letter="O" +char id=71 x=209 y=1 width=26 height=29 xoffset=0 yoffset=-0 xadvance=24 page=0 chnl=0 letter="G" +char id=67 x=236 y=1 width=25 height=29 xoffset=0 yoffset=-0 xadvance=23 page=0 chnl=0 letter="C" +char id=83 x=262 y=1 width=24 height=29 xoffset=0 yoffset=-0 xadvance=21 page=0 chnl=0 letter="S" +char id=85 x=287 y=1 width=23 height=29 xoffset=1 yoffset=-0 xadvance=23 page=0 chnl=0 letter="U" +char id=113 x=311 y=1 width=22 height=29 xoffset=-1 yoffset=6 xadvance=19 page=0 chnl=0 letter="q" +char id=112 x=334 y=1 width=22 height=29 xoffset=0 yoffset=6 xadvance=19 page=0 chnl=0 letter="p" +char id=121 x=357 y=1 width=22 height=29 xoffset=-1 yoffset=6 xadvance=17 page=0 chnl=0 letter="y" +char id=103 x=380 y=1 width=21 height=29 xoffset=0 yoffset=6 xadvance=19 page=0 chnl=0 letter="g" +char id=74 x=402 y=1 width=20 height=29 xoffset=-1 yoffset=-0 xadvance=17 page=0 chnl=0 letter="J" +char id=87 x=423 y=1 width=34 height=28 xoffset=-1 yoffset=-0 xadvance=30 page=0 chnl=0 letter="W" +char id=37 x=458 y=1 width=32 height=28 xoffset=-1 yoffset=1 xadvance=28 page=0 chnl=0 letter="%" +char id=77 x=1 y=37 width=27 height=28 xoffset=1 yoffset=-0 xadvance=26 page=0 chnl=0 letter="M" +char id=65 x=29 y=37 width=27 height=28 xoffset=-1 yoffset=-0 xadvance=23 page=0 chnl=0 letter="A" +char id=38 x=57 y=37 width=26 height=28 xoffset=0 yoffset=1 xadvance=23 page=0 chnl=0 letter="&" +char id=88 x=84 y=37 width=25 height=28 xoffset=-1 yoffset=-0 xadvance=21 page=0 chnl=0 letter="X" +char id=75 x=110 y=37 width=25 height=28 xoffset=1 yoffset=-0 xadvance=23 page=0 chnl=0 letter="K" +char id=86 x=136 y=37 width=25 height=28 xoffset=-1 yoffset=-0 xadvance=21 page=0 chnl=0 letter="V" +char id=89 x=162 y=37 width=25 height=28 xoffset=-1 yoffset=-0 xadvance=21 page=0 chnl=0 letter="Y" +char id=68 x=188 y=37 width=24 height=28 xoffset=1 yoffset=-0 xadvance=23 page=0 chnl=0 letter="D" +char id=78 x=213 y=37 width=24 height=28 xoffset=1 yoffset=-0 xadvance=23 page=0 chnl=0 letter="N" +char id=66 x=238 y=37 width=24 height=28 xoffset=1 yoffset=-0 xadvance=23 page=0 chnl=0 letter="B" +char id=82 x=263 y=37 width=24 height=28 xoffset=1 yoffset=-0 xadvance=23 page=0 chnl=0 letter="R" +char id=84 x=288 y=37 width=24 height=28 xoffset=-1 yoffset=-0 xadvance=19 page=0 chnl=0 letter="T" +char id=72 x=313 y=37 width=23 height=28 xoffset=1 yoffset=-0 xadvance=23 page=0 chnl=0 letter="H" +char id=80 x=337 y=37 width=23 height=28 xoffset=1 yoffset=-0 xadvance=21 page=0 chnl=0 letter="P" +char id=90 x=361 y=37 width=23 height=28 xoffset=-1 yoffset=-0 xadvance=19 page=0 chnl=0 letter="Z" +char id=69 x=385 y=37 width=23 height=28 xoffset=1 yoffset=-0 xadvance=21 page=0 chnl=0 letter="E" +char id=98 x=409 y=37 width=22 height=28 xoffset=0 yoffset=1 xadvance=19 page=0 chnl=0 letter="b" +char id=51 x=432 y=37 width=21 height=28 xoffset=-1 yoffset=1 xadvance=17 page=0 chnl=0 letter="3" +char id=56 x=454 y=37 width=21 height=28 xoffset=-1 yoffset=1 xadvance=17 page=0 chnl=0 letter="8" +char id=53 x=476 y=37 width=21 height=28 xoffset=-1 yoffset=1 xadvance=17 page=0 chnl=0 letter="5" +char id=100 x=1 y=66 width=21 height=28 xoffset=0 yoffset=1 xadvance=19 page=0 chnl=0 letter="d" +char id=76 x=23 y=66 width=21 height=28 xoffset=1 yoffset=-0 xadvance=19 page=0 chnl=0 letter="L" +char id=48 x=45 y=66 width=20 height=28 xoffset=0 yoffset=1 xadvance=17 page=0 chnl=0 letter="0" +char id=57 x=66 y=66 width=20 height=28 xoffset=0 yoffset=1 xadvance=17 page=0 chnl=0 letter="9" +char id=54 x=87 y=66 width=20 height=28 xoffset=0 yoffset=1 xadvance=17 page=0 chnl=0 letter="6" +char id=63 x=108 y=66 width=20 height=28 xoffset=1 yoffset=-0 xadvance=19 page=0 chnl=0 letter="?" +char id=92 x=129 y=66 width=17 height=28 xoffset=-3 yoffset=-0 xadvance=8 page=0 chnl=0 letter="\" +char id=47 x=147 y=66 width=17 height=28 xoffset=-3 yoffset=-0 xadvance=8 page=0 chnl=0 letter="/" +char id=102 x=165 y=66 width=15 height=28 xoffset=-1 yoffset=-0 xadvance=10 page=0 chnl=0 letter="f" +char id=124 x=181 y=66 width=9 height=28 xoffset=0 yoffset=-0 xadvance=8 page=0 chnl=0 letter="|" +char id=105 x=191 y=66 width=9 height=28 xoffset=1 yoffset=-0 xadvance=8 page=0 chnl=0 letter="i" +char id=73 x=201 y=66 width=9 height=28 xoffset=1 yoffset=-0 xadvance=8 page=0 chnl=0 letter="I" +char id=108 x=211 y=66 width=9 height=28 xoffset=1 yoffset=-0 xadvance=8 page=0 chnl=0 letter="l" +char id=35 x=221 y=66 width=22 height=27 xoffset=-1 yoffset=1 xadvance=17 page=0 chnl=0 letter="#" +char id=52 x=244 y=66 width=21 height=27 xoffset=-1 yoffset=1 xadvance=17 page=0 chnl=0 letter="4" +char id=55 x=266 y=66 width=21 height=27 xoffset=-1 yoffset=1 xadvance=17 page=0 chnl=0 letter="7" +char id=70 x=288 y=66 width=21 height=27 xoffset=1 yoffset=1 xadvance=19 page=0 chnl=0 letter="F" +char id=104 x=310 y=66 width=20 height=27 xoffset=1 yoffset=1 xadvance=19 page=0 chnl=0 letter="h" +char id=50 x=331 y=66 width=20 height=27 xoffset=0 yoffset=1 xadvance=17 page=0 chnl=0 letter="2" +char id=107 x=352 y=66 width=20 height=27 xoffset=1 yoffset=1 xadvance=17 page=0 chnl=0 letter="k" +char id=49 x=373 y=66 width=15 height=27 xoffset=1 yoffset=1 xadvance=17 page=0 chnl=0 letter="1" +char id=116 x=389 y=66 width=14 height=27 xoffset=-1 yoffset=2 xadvance=10 page=0 chnl=0 letter="t" +char id=33 x=404 y=66 width=10 height=27 xoffset=2 yoffset=1 xadvance=10 page=0 chnl=0 letter="!" +char id=59 x=415 y=66 width=10 height=27 xoffset=2 yoffset=7 xadvance=10 page=0 chnl=0 letter=";" +char id=60 x=426 y=66 width=23 height=23 xoffset=-1 yoffset=6 xadvance=18 page=0 chnl=0 letter="<" +char id=62 x=450 y=66 width=23 height=23 xoffset=-1 yoffset=6 xadvance=18 page=0 chnl=0 letter=">" +char id=111 x=474 y=66 width=22 height=23 xoffset=0 yoffset=6 xadvance=19 page=0 chnl=0 letter="o" +char id=97 x=1 y=95 width=21 height=23 xoffset=-1 yoffset=6 xadvance=17 page=0 chnl=0 letter="a" +char id=101 x=23 y=95 width=21 height=23 xoffset=-1 yoffset=6 xadvance=17 page=0 chnl=0 letter="e" +char id=117 x=45 y=95 width=21 height=23 xoffset=0 yoffset=6 xadvance=19 page=0 chnl=0 letter="u" +char id=115 x=67 y=95 width=20 height=23 xoffset=0 yoffset=6 xadvance=17 page=0 chnl=0 letter="s" +char id=99 x=88 y=95 width=20 height=23 xoffset=0 yoffset=6 xadvance=17 page=0 chnl=0 letter="c" +char id=119 x=109 y=95 width=29 height=22 xoffset=-1 yoffset=6 xadvance=24 page=0 chnl=0 letter="w" +char id=109 x=139 y=95 width=29 height=22 xoffset=1 yoffset=6 xadvance=28 page=0 chnl=0 letter="m" +char id=118 x=169 y=95 width=22 height=22 xoffset=-1 yoffset=6 xadvance=17 page=0 chnl=0 letter="v" +char id=110 x=192 y=95 width=20 height=22 xoffset=1 yoffset=6 xadvance=19 page=0 chnl=0 letter="n" +char id=122 x=213 y=95 width=20 height=22 xoffset=-1 yoffset=6 xadvance=16 page=0 chnl=0 letter="z" +char id=114 x=234 y=95 width=14 height=22 xoffset=1 yoffset=6 xadvance=12 page=0 chnl=0 letter="r" +char id=120 x=249 y=95 width=22 height=21 xoffset=-1 yoffset=7 xadvance=17 page=0 chnl=0 letter="x" +char id=43 x=272 y=95 width=22 height=21 xoffset=0 yoffset=7 xadvance=18 page=0 chnl=0 letter="+" +char id=58 x=295 y=95 width=10 height=21 xoffset=2 yoffset=7 xadvance=10 page=0 chnl=0 letter=":" +char id=94 x=306 y=95 width=20 height=19 xoffset=1 yoffset=-0 xadvance=18 page=0 chnl=0 letter="^" +char id=61 x=327 y=95 width=22 height=17 xoffset=0 yoffset=9 xadvance=18 page=0 chnl=0 letter="=" +char id=42 x=350 y=95 width=16 height=16 xoffset=-1 yoffset=-0 xadvance=12 page=0 chnl=0 letter="*" +char id=34 x=367 y=95 width=15 height=15 xoffset=-1 yoffset=-0 xadvance=15 page=0 chnl=0 letter=""" +char id=44 x=383 y=95 width=10 height=15 xoffset=0 yoffset=19 xadvance=8 page=0 chnl=0 letter="," +char id=39 x=394 y=95 width=9 height=15 xoffset=0 yoffset=-0 xadvance=7 page=0 chnl=0 letter="'" +char id=126 x=404 y=95 width=23 height=13 xoffset=-1 yoffset=11 xadvance=18 page=0 chnl=0 letter="~" +char id=45 x=428 y=95 width=14 height=10 xoffset=-1 yoffset=12 xadvance=10 page=0 chnl=0 letter="-" +char id=96 x=443 y=95 width=12 height=9 xoffset=-2 yoffset=-0 xadvance=10 page=0 chnl=0 letter="`" +char id=46 x=456 y=95 width=9 height=9 xoffset=1 yoffset=19 xadvance=8 page=0 chnl=0 letter="." +char id=95 x=466 y=95 width=22 height=6 xoffset=-1 yoffset=26 xadvance=17 page=0 chnl=0 letter="_" +char id=32 x=489 y=95 width=0 height=0 xoffset=-112 yoffset=145 xadvance=8 page=0 chnl=0 letter="space"