CCMenuItemFont color change

。_饼干妹妹 提交于 2019-12-19 10:27:55

问题


How can I set the color of a CCMenuItemFont. I've been searching for hours, returning 0 valid results. They're all outdated.

[CCMenuItemFont setFontName:@"Futura"]; 
    [CCMenuItemFont setFontSize:40];
    CCMenuItem *Play = [CCMenuItemFont itemFromString:@"Play" target:self selector:@selector(goToLevelSelect:)]; 

    CCMenu *menuPlay = [CCMenu menuWithItems: Play, nil]; 
    menuPlay.position = ccp(50,100);
    [menuPlay alignItemsVerticallyWithPadding:10];
    [self addChild:menuPlay]; 

回答1:


CCMenuItemFont is derived from CCMenuItemLabel which has a label property:

CCMenuItemLabel *play = [CCMenuItemFont itemFromString:@"Play" 
                         target:self selector:@selector(goToLevelSelect:)];
play.color = ccRED;


来源:https://stackoverflow.com/questions/9303291/ccmenuitemfont-color-change

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!