stubma / cocos2dx-better

Better cocos2d-x, without modifying cocos2d-x code. Better UI controls, better utilities, better compatibility

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

label的问题

zcgit opened this issue · comments

static CGFloat getAscent(void* refCon) {
Span& span = (Span)refCon;
NSString* name = [NSString stringWithCString:span.imageName
encoding:NSUTF8StringEncoding];
UIImage* image = [s_imageMap objectForKey:name];
return (span.height != 0 ? span.height : (image.size.height * span.scaleY)) * CC_CONTENT_SCALE_FACTOR();
}

static CGFloat getDescent(void* refCon) {
return 0;
}

static CGFloat getWidth(void* refCon) {
Span& span = (Span)refCon;
NSString* name = [NSString stringWithCString:span.imageName
encoding:NSUTF8StringEncoding];
UIImage* image = [s_imageMap objectForKey:name];
return (span.width != 0 ? span.width : (image.size.width * span.scaleX)) * CC_CONTENT_SCALE_FACTOR();
}

要加上* CC_CONTENT_SCALE_FACTOR()吗?

commented

不用, 系统api自己会处理retina