Cambia colore CCMenuItemFont
-
25-10-2019 - |
Domanda
Come è possibile impostare il colore di un CCMenuItemFont. Ho cercato per ore, tornando 0 risultati validi. Sono tutti superati.
[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];
Soluzione
CCMenuItemFont è derivato da CCMenuItemLabel che ha una proprietà label:
CCMenuItemLabel *play = [CCMenuItemFont itemFromString:@"Play"
target:self selector:@selector(goToLevelSelect:)];
play.color = ccRED;
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow