In this case, problems occur: autolabelLabel: create (hello, fonts3.ttf, 28); the best solution is to store Chinese characters using an external xml document plist document (UTF-8 encoding is required) create document string. xml is as follows :? Xmlversion1.0encodingUTF-8 ?! DOCTYPEplistPUBLIC
In this case, problems will occur: auto label = Label: create (hello, fonts/3.ttf, 28 ); the best solution is to use an external xml document/plist document to store Chinese characters (must be encoded using a UTF-8) to create a document string. xml is as follows :? Xml version = 1.0 encoding = UTF-8? ! DOCTYPE plist PUBLIC-// Apple // D
In this way, problems may occur:
Auto label = Label: create ("hello", "fonts/3.ttf", 28 );
The best solution is to store Chinese characters using external xml documents/plist documents (must be UTF-8 encoded)
The new document string. xml is as follows:
// Apple // dtd plist 1.0 // EN "" http://www.apple.com/DTDs/PropertyList-1.0.dtd ">
Title
20 seconds for a man
New_game
New game
Setting_game
Set
Quit_game
Exit
S
Why is it so difficult ?!
Each key corresponds to a string
In use:
Dictionary * dictionary = Dictionary: createWithContentsOfFile ("string. xml ");
CCString * str = (CCString *) dictionary-> objectForKey ("s"); // the string is obtained here.
Const char * s = str-> getCString (); // type conversion
Auto label = Label: create (s, "fonts/3.ttf", 28 );
It is also used as follows:
TTFConfig ttfConfig ("fonts/3.ttf", 28, GlyphCollection: CUSTOM );
Dictionary * dictionary = Dictionary: createWithContentsOfFile ("fonts/string. xml ");
CCString * str = (CCString *) dictionary-> objectForKey ("s ");
Const char * s = str-> getCString ();
Label * label = Label: createWithTTF (ttfConfig, s, TextHAlignment: CENTER );