// Creates and restores Cocos2d-x after DirectX and Angle contexts are created or updated void Cocos2dRenderer::CreateGLResources() { if(!mInitialized) { mInitialized = true; CCEGLView* pEGLView = new CCEGLView(); pEGLView->Create(m_eglDisplay, m_eglContext, m_eglSurface, m_renderTargetSize.Width, m_renderTargetSize.Height); pEGLView->setViewName("Cocos2d-x"); CCApplication::sharedApplication()->run(); pEGLView->SetXamlEventDelegate(m_delegate); pEGLView->SetXamlMessageBoxDelegate(m_messageBoxDelegate); pEGLView->SetXamlEditBoxDelegate(m_editBoxDelegate); } else { ccGLInvalidateStateCache(); CCShaderCache::sharedShaderCache()->reloadDefaultShaders(); ccDrawInit(); CCTextureCache::sharedTextureCache()->reloadAllTextures(); CCNotificationCenter::sharedNotificationCenter()->postNotification(EVENT_COME_TO_FOREGROUND, NULL); CCDirector::sharedDirector()->setGLDefaultValues(); CCDirector::sharedDirector()->resume(); } m_loadingComplete = true; }