-1

How to handle back key event in Cocos2dx 3.3 Windows Phone 8 C++? Many thanks

CodeSmile
  • 64,284
  • 20
  • 132
  • 217
Vũ Nguyễn
  • 178
  • 4
  • 10

3 Answers3

0

Use the HardwareButtons.BackPressed event to handle the back key press. Set the Handled property on the event args to true if you want to avoid the default behaviour of closing the app.

Peter Torr - MSFT
  • 11,824
  • 3
  • 18
  • 51
0

I've found the solution with cocos2dx 3.3

In header file .h

virtual void onKeyReleased(cocos2d::EventKeyboard::KeyCode keyCode, cocos2d::Event* event);

And cpp file

void MrGreen::onKeyReleased(EventKeyboard::KeyCode keyCode, cocos2d::Event *event)
{
if (keyCode == EventKeyboard::KeyCode::KEY_ESCAPE)
{

}
}
Vũ Nguyễn
  • 178
  • 4
  • 10