cocos2d-x helper function.