2.1.5버전
갤럭시s2(4.0.4)에서 버그가 발생합니다..
이유는
TTFLabel생성시 ""이면 제대로 텍스쳐를 생성을 못하여 Null값으로 들어가는 문제가 있습니다.. 이는 아주 작은
Rawdata를 생성하여 임시로 넣어주어 해결했습니다.
-cocos2d-x 3.x에는 추가된 사항입니다.
static unsigned char cc_2x2_white_image[] = {
// RGBA8888
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF
};
#define CC_2x2_WHITE_IMAGE_KEY "cc_2x2_white_image"
void Sprite::setTexture(Texture2D *texture)
{
// If batchnode, then texture id should be the same
CCASSERT(! _batchNode || texture->getName() == _batchNode->getTexture()->getName(), "CCSprite: Batched sprites should use the same texture as the batchnode");
// accept texture==nil as argument
CCASSERT( !texture || dynamic_cast(texture), "setTexture expects a Texture2D. Invalid argument");
if (NULL == texture)
{
// Gets the texture by key firstly.
texture = TextureCache::getInstance()->textureForKey(CC_2x2_WHITE_IMAGE_KEY);
// If texture wasn't in cache, create it from RAW data.
if (NULL == texture)
{
Image* image = new Image();
bool isOK = image->initWithRawData(cc_2x2_white_image, sizeof(cc_2x2_white_image), 2, 2, 8);
CCAssert(isOK, "The 2x2 empty texture was created unsuccessfully.");
texture = TextureCache::getInstance()->addUIImage(image, CC_2x2_WHITE_IMAGE_KEY);
CC_SAFE_RELEASE(image);
}
}
if (!_batchNode && _texture != texture)
{
CC_SAFE_RETAIN(texture);
CC_SAFE_RELEASE(_texture);
_texture = texture;
updateBlendFunc();
}
}
원본 위치 <http://discuss.cocos2d-x.org/t/cceditbox-crash-on-android-tablet/7670/15>