diff --git a/cocos2dx/include/CCLabelAtlas.h b/cocos2dx/include/CCLabelAtlas.h index 8f48a2b64f..c795cf3611 100644 --- a/cocos2dx/include/CCLabelAtlas.h +++ b/cocos2dx/include/CCLabelAtlas.h @@ -1,6 +1,7 @@ /**************************************************************************** Copyright (c) 2010-2011 cocos2d-x.org Copyright (c) 2008-2010 Ricardo Quesada +Copyright (c) 2011 Zynga Inc. http://www.cocos2d-x.org diff --git a/cocos2dx/include/CCLabelBMFont.h b/cocos2dx/include/CCLabelBMFont.h index 5471eb6a1b..62588ce52b 100644 --- a/cocos2dx/include/CCLabelBMFont.h +++ b/cocos2dx/include/CCLabelBMFont.h @@ -1,6 +1,7 @@ /**************************************************************************** Copyright (c) 2010-2011 cocos2d-x.org Copyright (c) 2008-2010 Ricardo Quesada +Copyright (c) 2011 Zynga Inc. http://www.cocos2d-x.org @@ -179,9 +180,9 @@ namespace cocos2d{ virtual void setAnchorPoint(CCPoint var); virtual CCRGBAProtocol* convertToRGBAProtocol() { return (CCRGBAProtocol*)this; } virtual CCLabelProtocol* convertToLabelProtocol() { return (CCLabelProtocol*)this; } -#if CC_BITMAPFONTATLAS_DEBUG_DRAW +#if CC_LABELBMFONT_DEBUG_DRAW virtual void draw(); -#endif // CC_BITMAPFONTATLAS_DEBUG_DRAW +#endif // CC_LABELBMFONT_DEBUG_DRAW private: char * atlasNameFromFntFile(const char *fntFile); int kerningAmountForFirst(unsigned short first, unsigned short second); diff --git a/cocos2dx/include/CCTextureAtlas.h b/cocos2dx/include/CCTextureAtlas.h index ea9bfce468..869930562e 100644 --- a/cocos2dx/include/CCTextureAtlas.h +++ b/cocos2dx/include/CCTextureAtlas.h @@ -141,6 +141,13 @@ public: */ void drawNumberOfQuads(unsigned int n); + /** draws n quads from an index (offset). + n + start can't be greater than the capacity of the atlas + + @since v1.0 + */ + void drawNumberOfQuads(unsigned int n, unsigned int start); + /** draws all the Atlas's Quads */ void drawQuads(); diff --git a/cocos2dx/include/ccConfig.h b/cocos2dx/include/ccConfig.h index cfc023948e..e5e4f6d6f0 100644 --- a/cocos2dx/include/ccConfig.h +++ b/cocos2dx/include/ccConfig.h @@ -231,13 +231,13 @@ To enable set it to a value different than 0. Disabled by default. */ #define CC_SPRITEBATCHNODE_DEBUG_DRAW 0 -/** @def CC_BITMAPFONTATLAS_DEBUG_DRAW +/** @def CC_LABELBMFONT_DEBUG_DRAW If enabled, all subclasses of BitmapFontAtlas will draw a bounding box Useful for debugging purposes only. It is recommened to leave it disabled. To enable set it to a value different than 0. Disabled by default. */ -#define CC_BITMAPFONTATLAS_DEBUG_DRAW 0 +#define CC_LABELBMFONT_DEBUG_DRAW 0 /** @def CC_LABELATLAS_DEBUG_DRAW If enabled, all subclasses of LabeltAtlas will draw a bounding box diff --git a/cocos2dx/label_nodes/CCLabelAtlas.cpp b/cocos2dx/label_nodes/CCLabelAtlas.cpp index 6321fc4823..5052e69af8 100644 --- a/cocos2dx/label_nodes/CCLabelAtlas.cpp +++ b/cocos2dx/label_nodes/CCLabelAtlas.cpp @@ -1,6 +1,7 @@ /**************************************************************************** Copyright (c) 2010-2011 cocos2d-x.org Copyright (c) 2008-2010 Ricardo Quesada +Copyright (c) 2011 Zynga Inc. http://www.cocos2d-x.org @@ -120,16 +121,17 @@ namespace cocos2d{ //CCLabelAtlas - CCLabelProtocol void CCLabelAtlas::setString(const char *label) { - if (strlen(label) > m_pTextureAtlas->getTotalQuads()) + unsigned int len = strlen(label); + if (len > m_pTextureAtlas->getTotalQuads()) { - m_pTextureAtlas->resizeCapacity(strlen(label)); + m_pTextureAtlas->resizeCapacity(len); } m_sString.clear(); m_sString = label; this->updateAtlasValues(); CCSize s; - s.width = (float)(m_sString.length() * m_uItemWidth); + s.width = (float)(len * m_uItemWidth); s.height = (float)(m_uItemHeight); this->setContentSizeInPixels(s); } @@ -159,7 +161,7 @@ namespace cocos2d{ glBlendFunc( m_tBlendFunc.src, m_tBlendFunc.dst ); } - m_pTextureAtlas->drawNumberOfQuads(m_sString.length()); + m_pTextureAtlas->drawNumberOfQuads(m_sString.length(), 0); if( newBlend ) glBlendFunc(CC_BLEND_SRC, CC_BLEND_DST); diff --git a/cocos2dx/label_nodes/CCLabelBMFont.cpp b/cocos2dx/label_nodes/CCLabelBMFont.cpp index 3636935242..81d2528dc2 100644 --- a/cocos2dx/label_nodes/CCLabelBMFont.cpp +++ b/cocos2dx/label_nodes/CCLabelBMFont.cpp @@ -1,6 +1,7 @@ /**************************************************************************** Copyright (c) 2010-2011 cocos2d-x.org Copyright (c) 2008-2010 Ricardo Quesada +Copyright (c) 2011 Zynga Inc. http://www.cocos2d-x.org @@ -643,7 +644,7 @@ namespace cocos2d{ } //BitmapFontAtlas - Debug draw -#if CC_BITMAPFONTATLAS_DEBUG_DRAW +#if CC_LABELBMFONT_DEBUG_DRAW void CCLabelBMFont::draw() { CCSpriteBatchNode::draw(); @@ -654,6 +655,6 @@ namespace cocos2d{ }; ccDrawPoly(vertices, 4, true); } -#endif // CC_BITMAPFONTATLAS_DEBUG_DRAW +#endif // CC_LABELBMFONT_DEBUG_DRAW } diff --git a/cocos2dx/textures/CCTextureAtlas.cpp b/cocos2dx/textures/CCTextureAtlas.cpp index 8f75651bea..cae335e700 100644 --- a/cocos2dx/textures/CCTextureAtlas.cpp +++ b/cocos2dx/textures/CCTextureAtlas.cpp @@ -405,5 +405,10 @@ void CCTextureAtlas::drawNumberOfQuads(unsigned int n) #endif // CC_USES_VBO } +void CCTextureAtlas::drawNumberOfQuads(unsigned int n, unsigned int start) +{ + +} + }//namespace cocos2d diff --git a/lua/cocos2dx_support/LuaCocos2d.cpp.REMOVED.git-id b/lua/cocos2dx_support/LuaCocos2d.cpp.REMOVED.git-id index b892d69494..314b9c6832 100644 --- a/lua/cocos2dx_support/LuaCocos2d.cpp.REMOVED.git-id +++ b/lua/cocos2dx_support/LuaCocos2d.cpp.REMOVED.git-id @@ -1 +1 @@ -a82799555bac412b3b88dbdf222f8be8b39badb8 \ No newline at end of file +f9eeef82ddc1e3dda52514fcd2d7c424f60c1cd8 \ No newline at end of file