The question is all I have to say about it. I need to know how to handle the special keypresses like back
, menu
etc. in android NDK. I am using Cocos2dX so if you could give me a Cocos2dX specif answer that would be great.
In cocos2dx, each CCLayer
gets the following methods that can be overriden to add functionality to them:
class CC_DLL CCKeypadDelegate
{
public:
// The back key clicked
virtual void keyBackClicked() {}
// The menu key clicked. only avialble on wophone & android
virtual void keyMenuClicked() {};
};
CCLayer
inherits from CCKeypadDelegate
. And each screen can give implementation to these functions.
In Cocos2d-x You have to do that implement
virtual void keyBackClicked();
and also this
this->setKeyPadEnable(true);
in .cpp class
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With