some more clean up (code review)

This commit is contained in:
carlo morgantini 2013-08-02 16:11:20 -07:00
parent 833a45d1af
commit 73286ad76b
5 changed files with 12 additions and 12 deletions

View File

@ -21,12 +21,12 @@ const char *FontAtlasFactory::glyphNEHE = "!\"#$%&'()*+,-./0123456789:;<=>?@ABC
FontAtlas * FontAtlasFactory::createAtlasFromTTF(const char* tttFilePath, int fontSize, GlyphCollection glyphs, const char *customGlyphs)
FontAtlas * FontAtlasFactory::createAtlasFromTTF(const char* fntFilePath, int fontSize, GlyphCollection glyphs, const char *customGlyphs)
{
FontDefinitionTTF *def = 0;
if ( (glyphs == GlyphCollection::NEHE) || (glyphs == GlyphCollection::ASCII) )
{
def = FontDefinitionTTF::create(tttFilePath, fontSize, getGlyphCollection(glyphs));
def = FontDefinitionTTF::create(fntFilePath, fontSize, getGlyphCollection(glyphs));
}
else
{
@ -43,7 +43,7 @@ FontAtlas * FontAtlasFactory::createAtlasFromTTF(const char* tttFilePath, int fo
return nullptr;
}
def = FontDefinitionTTF::create(tttFilePath, fontSize, customGlyphs);
def = FontDefinitionTTF::create(fntFilePath, fontSize, customGlyphs);
}
}

View File

@ -35,8 +35,8 @@ class CC_DLL FontAtlasFactory
public:
static FontAtlas * createAtlasFromTTF(const char* tttFilePath, int fontSize, GlyphCollection glyphs, const char *customGlyphs = 0);
static FontAtlas * createAtlasFromFNT(const char* tttFilePath);
static FontAtlas * createAtlasFromTTF(const char* fntFilePath, int fontSize, GlyphCollection glyphs, const char *customGlyphs = 0);
static FontAtlas * createAtlasFromFNT(const char* fntFilePath);
private:

View File

@ -31,9 +31,9 @@
NS_CC_BEGIN
Label* Label::createWithTTF( const char* label, const char* tttFilePath, int fontSize, GlyphCollection glyphs, int lineSize, const char *customGlyphs )
Label* Label::createWithTTF( const char* label, const char* fntFilePath, int fontSize, GlyphCollection glyphs, int lineSize, const char *customGlyphs )
{
FontAtlas *tempAtlas = FontAtlasCache::getFontAtlasTTF(tttFilePath, fontSize, glyphs, customGlyphs);
FontAtlas *tempAtlas = FontAtlasCache::getFontAtlasTTF(fntFilePath, fontSize, glyphs, customGlyphs);
if (!tempAtlas)
return nullptr;

View File

@ -43,7 +43,7 @@ class CC_DLL Label : public SpriteBatchNode, public LabelProtocol, public RGBAPr
{
public:
static Label* createWithTTF( const char* label, const char* tttFilePath, int fontSize, GlyphCollection glyphs = GlyphCollection::NEHE, int lineSize = 0, const char *customGlyphs = 0 );
static Label* createWithTTF( const char* label, const char* fntFilePath, int fontSize, GlyphCollection glyphs = GlyphCollection::NEHE, int lineSize = 0, const char *customGlyphs = 0 );
static Label* createWithBMFont( const char* label, const char* bmfontFilePath, int lineSize = 0 );
virtual ~Label();

View File

@ -38,8 +38,8 @@ bool LabelTextFormatter::multilineText(LabelTextFormatProtocol *theLabel)
if (theLabel->getMaxLineWidth())
{
// Step 1: Make multiline
vector<unsigned short> str_whole = cc_utf16_vec_from_utf16_str(theLabel->getUTF8String());
unsigned int stringLength = str_whole.size();
vector<unsigned short> strWhole = cc_utf16_vec_from_utf16_str(theLabel->getUTF8String());
unsigned int stringLength = strWhole.size();
vector<unsigned short> multiline_string;
multiline_string.reserve( stringLength );
@ -74,7 +74,7 @@ bool LabelTextFormatter::multilineText(LabelTextFormatProtocol *theLabel)
if (i >= stringLength)
break;
unsigned short character = str_whole[i];
unsigned short character = strWhole[i];
if (!start_word)
{
@ -106,7 +106,7 @@ bool LabelTextFormatter::multilineText(LabelTextFormatProtocol *theLabel)
if (i >= stringLength)
break;
character = str_whole[i];
character = strWhole[i];
if (!startOfWord)
{