Listen Android back button in cocos2d-x -


i want track android button in android activity.

i have ready work on button in onkeyreleased() in c++ , when check button in activity methods onbackpressed() , onkeyup() , onkeydown() e.t.c nothing.

please me same.

well have create new event listener keyboard in init of class. because don't know have @ moment, how implement button listener android:

bool yourscene::init() {     if(!layer::init()) return false;     auto listener = eventlistenerkeyboard::create();     listener->onkeyreleased = cc_callback_2(yourscene::onkeyreleased, this);     director::getinstance()->geteventdispatcher()->addeventlistenerwithscenegraphpriority(listener, this);     ........... }  void yourscene::onkeyreleased(eventkeyboard::keycode keycode, event* event) {     if(keycode == eventkeyboard::keycode::key_back)     {         // implement button login here     } } 

Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -