mirror of https://github.com/axmolengine/axmol.git
add shader files correctly in test.xcodeproj, fix a warning in CCLabelBMFont.cpp,
This commit is contained in:
parent
40ec8a3b3d
commit
203f40a00d
|
@ -44,11 +44,11 @@ http://www.angelcode.com/products/bmfont/ (Free, Windows only)
|
|||
|
||||
NS_CC_BEGIN
|
||||
|
||||
typedef struct _FontDefHashElement
|
||||
{
|
||||
unsigned int key; // key. Font Unicode value
|
||||
ccBMFontDef fontDef; // font definition
|
||||
UT_hash_handle hh;
|
||||
typedef struct _FontDefHashElement
|
||||
{
|
||||
unsigned int key; // key. Font Unicode value
|
||||
ccBMFontDef fontDef; // font definition
|
||||
UT_hash_handle hh;
|
||||
} tFontDefHashElement;
|
||||
|
||||
static int cc_wcslen(const unsigned short* str)
|
||||
|
@ -206,7 +206,7 @@ static void cc_utf8_trim_from(std::vector<unsigned short>* str, int index)
|
|||
* */
|
||||
static bool isspace_unicode(unsigned short ch)
|
||||
{
|
||||
return ch >= 0x0009 && ch <= 0x000D || ch == 0x0020 || ch == 0x0085 || ch == 0x00A0 || ch == 0x1680
|
||||
return (ch >= 0x0009 && ch <= 0x000D) || ch == 0x0020 || ch == 0x0085 || ch == 0x00A0 || ch == 0x1680
|
||||
|| (ch >= 0x2000 && ch <= 0x200A) || ch == 0x2028 || ch == 0x2029 || ch == 0x202F
|
||||
|| ch == 0x205F || ch == 0x3000;
|
||||
}
|
||||
|
@ -437,9 +437,9 @@ CCBMFontConfiguration::~CCBMFontConfiguration()
|
|||
const char* CCBMFontConfiguration::description(void)
|
||||
{
|
||||
char* pBuf = new char[100];
|
||||
sprintf(pBuf, "<CCBMFontConfiguration = %08X | Glphys:%d Kernings:%d | Image = %s>", this,
|
||||
HASH_COUNT(m_pFontDefDictionary),
|
||||
HASH_COUNT(m_pKerningDictionary),
|
||||
sprintf(pBuf, "<CCBMFontConfiguration = %08X | Glphys:%d Kernings:%d | Image = %s>", this,
|
||||
HASH_COUNT(m_pFontDefDictionary),
|
||||
HASH_COUNT(m_pKerningDictionary),
|
||||
m_sAtlasName.c_str());
|
||||
CCString* pRet = new CCString(pBuf);
|
||||
pRet->autorelease();
|
||||
|
@ -458,15 +458,15 @@ void CCBMFontConfiguration::purgeKerningDictionary()
|
|||
}
|
||||
}
|
||||
|
||||
void CCBMFontConfiguration::purgeFontDefDictionary()
|
||||
{
|
||||
tFontDefHashElement *current, *tmp;
|
||||
|
||||
HASH_ITER(hh, m_pFontDefDictionary, current, tmp) {
|
||||
HASH_DEL(m_pFontDefDictionary, current);
|
||||
free(current);
|
||||
}
|
||||
}
|
||||
void CCBMFontConfiguration::purgeFontDefDictionary()
|
||||
{
|
||||
tFontDefHashElement *current, *tmp;
|
||||
|
||||
HASH_ITER(hh, m_pFontDefDictionary, current, tmp) {
|
||||
HASH_DEL(m_pFontDefDictionary, current);
|
||||
free(current);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CCBMFontConfiguration::parseConfigFile(const char *controlFile)
|
||||
|
@ -530,7 +530,7 @@ void CCBMFontConfiguration::parseConfigFile(const char *controlFile)
|
|||
tFontDefHashElement* element = (tFontDefHashElement*)malloc( sizeof(*element) );
|
||||
this->parseCharacterDefinition(line, &element->fontDef);
|
||||
|
||||
element->key = element->fontDef.charID;
|
||||
element->key = element->fontDef.charID;
|
||||
HASH_ADD_INT(m_pFontDefDictionary, key, element);
|
||||
}
|
||||
else if(line.substr(0,strlen("kernings count")) == "kernings count")
|
||||
|
@ -874,19 +874,19 @@ void CCLabelBMFont::createFontChars()
|
|||
continue;
|
||||
}
|
||||
|
||||
tFontDefHashElement *element = NULL;
|
||||
|
||||
// unichar is a short, and an int is needed on HASH_FIND_INT
|
||||
unsigned int key = c;
|
||||
HASH_FIND_INT(m_pConfiguration->m_pFontDefDictionary, &key, element);
|
||||
CCAssert(element, "FontDefinition could not be found!");
|
||||
|
||||
ccBMFontDef fontDef = element->fontDef;
|
||||
|
||||
CCRect rect = fontDef.rect;
|
||||
rect = CC_RECT_PIXELS_TO_POINTS(rect);
|
||||
|
||||
rect.origin.x += m_tImageOffset.x;
|
||||
tFontDefHashElement *element = NULL;
|
||||
|
||||
// unichar is a short, and an int is needed on HASH_FIND_INT
|
||||
unsigned int key = c;
|
||||
HASH_FIND_INT(m_pConfiguration->m_pFontDefDictionary, &key, element);
|
||||
CCAssert(element, "FontDefinition could not be found!");
|
||||
|
||||
ccBMFontDef fontDef = element->fontDef;
|
||||
|
||||
CCRect rect = fontDef.rect;
|
||||
rect = CC_RECT_PIXELS_TO_POINTS(rect);
|
||||
|
||||
rect.origin.x += m_tImageOffset.x;
|
||||
rect.origin.y += m_tImageOffset.y;
|
||||
|
||||
CCSprite *fontChar;
|
||||
|
@ -910,8 +910,8 @@ void CCLabelBMFont::createFontChars()
|
|||
}
|
||||
|
||||
float yOffset = (float)(m_pConfiguration->m_uCommonHeight) - fontDef.yOffset;
|
||||
CCPoint fontPos = ccp( (float)nextFontPositionX + fontDef.xOffset + fontDef.rect.size.width*0.5f + kerningAmount,
|
||||
(float)nextFontPositionY + yOffset - rect.size.height*0.5f * CC_CONTENT_SCALE_FACTOR() );
|
||||
CCPoint fontPos = ccp( (float)nextFontPositionX + fontDef.xOffset + fontDef.rect.size.width*0.5f + kerningAmount,
|
||||
(float)nextFontPositionY + yOffset - rect.size.height*0.5f * CC_CONTENT_SCALE_FACTOR() );
|
||||
fontChar->setPosition(CC_POINT_PIXELS_TO_POINTS(fontPos));
|
||||
|
||||
// update kerning
|
||||
|
|
|
@ -1 +1 @@
|
|||
a323b14305e52267ef68fe90c0198be034c872ee
|
||||
4d9fe2f37bec090c592ed036ff7368a972543c77
|
Loading…
Reference in New Issue