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;
}