Wolfgang Müller
Wolfgang Müller

Reputation: 205

CCMenuItemAtlasFont usage

Can anyone please tell me the usage of CCMenuItemAtlasFont? I can't find no examples anywhere on the web and have no idea how to pass the .fnt file. the only public function that seems to make sense is

[[self alloc] initFromString:<#(NSString *)#> charMapFile:<#(NSString *)#> itemWidth:<#(int)#> itemHeight:<#(int)#> startCharMap:<#(char)#> target:<#(id)#> selector:<#(SEL)#>

where charMapFile seems to be the png. but i have no idea thow to use itemWidth or itemHeight for my fontatlas (made with bmpGlyph) has no fixed raster.

thank you!

Upvotes: 1

Views: 362

Answers (1)

YvesLeBorg
YvesLeBorg

Reputation: 9079

Well CCMenuItemAtlasFont uses CCLabelAtlas to generate the text textures. And (from the CCLabelAtlas.h comments:

// CCLabelAtlas versus CCLabel:
// - CCLabelAtlas is MUCH faster than CCLabel
// - CCLabelAtlas "characters" have a fixed height and width
// - CCLabelAtlas "characters" can be anything you want since they are taken from an image file

so i would guess you are cold out of luck for variable width fonts. You need width and height to specify the 'fixed' character font number of points.

Look here for an example with a font file

Upvotes: 2

Related Questions