Updated for Cocos2d-x 3.1.