sync code from cocos2dx project

sync code from cocos2dx project