Beispiel #1
0
void CCMessageBox(const char * pszMsg, const char * pszTitle)
{

#if defined(VLD_DEBUG_MEMORY)
    VLDReportLeaks();
#endif

    // Create the message dialog and set its content
    Platform::String^ message = ref new Platform::String(CCUtf8ToUnicode(pszMsg, -1).c_str());
    Platform::String^ title = ref new Platform::String(CCUtf8ToUnicode(pszTitle, -1).c_str());
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
    Windows::UI::Popups::MessageDialog^ msg = ref new Windows::UI::Popups::MessageDialog(message, title);
    // Set the command to be invoked when a user presses 'ESC'
    msg->CancelCommandIndex = 1;

    // Show the message dialog
    msg->ShowAsync();
#else

    CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
    if(!pEGLView->ShowMessageBox(title, message))
    {
        ModalLayer *messageBox = ModalLayer::create();
        messageBox->setMessage(pszMsg);
        CCDirector::sharedDirector()->getRunningScene()->addChild(messageBox);
    }
#endif

}