标签:
bool HelloWorld::init()
{
if ( !Layer::init() )
{
return false;
}
auto listener=EventListenerKeyboard::create();
listener->onKeyReleased = [](EventKeyboard::KeyCode code,Event *e){
log("key code: %d",code);
switch (code) {
case EventKeyboard::KeyCode::KEY_BACKSPACE:
Director::getInstance()->end();
break;
default:
break;
}
};
return true;
}
标签:
原文地址:http://www.cnblogs.com/daochong/p/5229399.html