0
点赞
收藏
分享

微信扫一扫

2.0.4 CCLabelTTF在ios7下不显示的问题(转)

尤克乔乔 2022-09-14 阅读 159

要修改框架lib目录里的 CCImage.mm,就是把浮点值取了个整,之前的浮点形导致绘制失败:

在_initWithString这个方法里把如下代码替换一下就行了:


/
/
// for CCLabelTTF can not show text in ios7
/*
unsigned char* data = new unsigned char[(int)(dim.width * dim.height * 4)];
memset(data, 0, (int)(dim.width * dim.height * 4));

// draw text
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef context = CGBitmapContextCreate(data, dim.width, dim.height, 8, dim.width * 4, colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big);
*/

const int _width = dim.width;
const int _height = dim.height;

unsigned char* data = new unsigned char[(int)(dim.width * dim.height * 4)];
memset(data, 0, (int)(_width * _height * 4));

// draw text
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef context =
CGBitmapContextCreate(data, _width, _height, 8, _width * 4, colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big);

/
/


举报

相关推荐

0 条评论