Added keyboard support for MAC

Refers to https://github.com/cocos2d/cocos2d-x/pull/1323.