Merge pull request #345 from minggo/iss557

fixed #557: upgrade label_nodes to 1.0.1-rc3
This commit is contained in:
minggo 2011-07-03 20:04:15 -07:00
commit 00ff3dba4d
8 changed files with 28 additions and 11 deletions

View File

@ -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

View File

@ -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);

View File

@ -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();

View File

@ -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

View File

@ -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);

View File

@ -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
}

View File

@ -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

View File

@ -1 +1 @@
a82799555bac412b3b88dbdf222f8be8b39badb8
f9eeef82ddc1e3dda52514fcd2d7c424f60c1cd8