Merge pull request #9133 from pyrosphere/fix-wp8-back-key

Fix Back Key behaviour and Director::getInstance()->end() on WP8
This commit is contained in:
minggo 2014-11-20 11:11:31 +08:00
commit 9fdd85a1be
1 changed files with 7 additions and 5 deletions

View File

@ -179,6 +179,11 @@ bool GLViewImpl::isOpenGLReady()
void GLViewImpl::end()
{
m_windowClosed = true;
std::string str;
if (m_delegate) {
// Terminate app on Director::getInstance()->end();
m_delegate->Invoke(Cocos2dEvent::TerminateApp, stringToPlatformString(str));
}
}
@ -193,11 +198,8 @@ void GLViewImpl::OnResuming(Platform::Object^ sender, Platform::Object^ args)
// user pressed the Back Key on the phone
void GLViewImpl::OnBackKeyPress()
{
std::string str;
if(m_delegate)
{
m_delegate->Invoke(Cocos2dEvent::TerminateApp, stringToPlatformString(str));
}
EventKeyboard event(EventKeyboard::KeyCode::KEY_ESCAPE, false);
Director::getInstance()->getEventDispatcher()->dispatchEvent(&event);
}
void GLViewImpl::OnPointerPressed(CoreWindow^ sender, PointerEventArgs^ args)