Engaged in a cocos2d-x of the Chinese display problem, in fact, because the cocos2d-x was originally built in unicode encoding format, but because VS2012 GBK encoding and it does not match, it also does not support Chinese (not supported currently), so garbled characters are generated when the running program contains Chinese characters. Google found a solution to this problem. We can use android to deal with it. Write an XML file in UTF-8 format. Be sure to put it in the Resource Directory. Otherwise, it cannot be found.
<Dict> <key> press1 </key> <string> press the button </string> <key> press2 </key> <string> press the button to move </string> <key> cancel1 </key> <string> release button </string> <key> cancel2 </key> <string> unclick </string> </dict>
Then, take the corresponding value as needed:
/** Use Chinese in the cocos2d-x ** // use CCDictionary to read xml CCDictionary * strings = CCDictionary: createWithContentsOfFile ("fonts/string. xml "); const char * press1 = (CCString *) strings-> objectForKey (" press1 ")-> getCString (); const char * press2 = (CCString *) strings-> objectForKey ("press2")-> getCString (); const char * cancel1 = (CCString *) strings-> objectForKey ("cancel1 ")) -> getCString (); const char * cancel2 = (CCString *) strings-> objectForKey ("cancel2")-> getCString ();