wp8 glview hook solution 1

This commit is contained in:
huangshiwu 2014-08-04 14:17:14 +08:00
parent 372479d812
commit efcb8b9962
11 changed files with 31 additions and 31 deletions

View File

@ -549,7 +549,7 @@ void RenderTexture::onBegin()
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8
Mat4 modifiedProjection = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
modifiedProjection = CCEGLView::sharedOpenGLView()->getReverseOrientationMatrix() * modifiedProjection;
modifiedProjection = GLViewImpl::sharedOpenGLView()->getReverseOrientationMatrix() * modifiedProjection;
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION,modifiedProjection);
#endif

View File

@ -75,7 +75,7 @@ int Application::run()
return 0;
}
GLView::sharedOpenGLView()->Run();
GLViewImpl::sharedOpenGLView()->Run();
return 0;
}

View File

@ -27,7 +27,7 @@ THE SOFTWARE.
#include "CCWinRTUtils.h"
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
#include "platform/wp8/CCGLView.h"
#include "platform/wp8/CCGLViewImpl.h"
#endif
#if defined(VLD_DEBUG_MEMORY)
@ -50,7 +50,7 @@ void MessageBox(const char * pszMsg, const char * pszTitle)
// Show the message dialog
msg->ShowAsync();
#else
GLView::sharedOpenGLView()->ShowMessageBox(title, message);
GLViewImpl::sharedOpenGLView()->ShowMessageBox(title, message);
#endif
}

View File

@ -84,7 +84,7 @@ void Device::setAccelerometerEnabled(bool isEnabled)
acc.timestamp = 0;
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8
auto orientation = GLView::sharedOpenGLView()->getDeviceOrientation();
auto orientation = GLViewImpl::sharedOpenGLView()->getDeviceOrientation();
switch (orientation)
{
@ -115,7 +115,7 @@ void Device::setAccelerometerEnabled(bool isEnabled)
}
#endif
std::shared_ptr<cocos2d::InputEvent> event(new AccelerometerEvent(acc));
cocos2d::GLView::sharedOpenGLView()->QueueEvent(event);
cocos2d::GLViewImpl::sharedOpenGLView()->QueueEvent(event);
});
}
else

View File

@ -57,13 +57,13 @@ void PointerEvent::execute()
switch(m_type)
{
case PointerEventType::PointerPressed:
GLView::sharedOpenGLView()->OnPointerPressed(m_args.Get());
GLViewImpl::sharedOpenGLView()->OnPointerPressed(m_args.Get());
break;
case PointerEventType::PointerMoved:
GLView::sharedOpenGLView()->OnPointerMoved(m_args.Get());
GLViewImpl::sharedOpenGLView()->OnPointerMoved(m_args.Get());
break;
case PointerEventType::PointerReleased:
GLView::sharedOpenGLView()->OnPointerReleased(m_args.Get());
GLViewImpl::sharedOpenGLView()->OnPointerReleased(m_args.Get());
break;
}
}
@ -119,7 +119,7 @@ BackButtonEvent::BackButtonEvent()
void BackButtonEvent::execute()
{
GLView::sharedOpenGLView()->OnBackKeyPress();
GLViewImpl::sharedOpenGLView()->OnBackKeyPress();
}

View File

@ -53,7 +53,7 @@ void Cocos2dRenderer::CreateGLResources()
if(!mInitialized)
{
mInitialized = true;
GLView* glview = GLView::create("Test Cpp");
GLViewImpl* glview = GLViewImpl::create("Test Cpp");
glview->Create(m_eglDisplay, m_eglContext, m_eglSurface, m_renderTargetSize.Width, m_renderTargetSize.Height,m_orientation);
director->setOpenGLView(glview);
CCApplication::getInstance()->run();
@ -102,14 +102,14 @@ IAsyncAction^ Cocos2dRenderer::OnSuspending()
void Cocos2dRenderer::OnUpdateDevice()
{
GLView* glview = GLView::sharedOpenGLView();
glview->UpdateDevice(m_eglDisplay, m_eglContext, m_eglSurface);
//GLView* glview = GLView::sharedOpenGLView();
GLViewImpl::sharedOpenGLView()->UpdateDevice(m_eglDisplay, m_eglContext, m_eglSurface);
}
void Cocos2dRenderer::OnOrientationChanged(Windows::Graphics::Display::DisplayOrientations orientation)
{
DirectXBase::OnOrientationChanged(orientation);
GLView::sharedOpenGLView()->UpdateOrientation(orientation);
GLViewImpl::sharedOpenGLView()->UpdateOrientation(orientation);
}
// return true if eglSwapBuffers was called by OnRender()
@ -117,8 +117,8 @@ bool Cocos2dRenderer::OnRender()
{
if(m_loadingComplete)
{
GLView* glview = GLView::sharedOpenGLView();
glview->Render();
//GLView* glview = GLView::sharedOpenGLView();
GLViewImpl::sharedOpenGLView()->Render();
return true; // eglSwapBuffers was called by glview->Render();
}
return false;
@ -154,7 +154,7 @@ void Cocos2dRenderer::OnCocos2dKeyEvent(Cocos2dKeyEvent event)
void Cocos2dRenderer::SetXamlEventDelegate(PhoneDirect3DXamlAppComponent::Cocos2dEventDelegate^ delegate)
{
m_delegate = delegate;
GLView* eglView = GLView::sharedOpenGLView();
GLViewImpl* eglView = GLViewImpl::sharedOpenGLView();
if(eglView)
{
eglView->SetXamlEventDelegate(delegate);
@ -164,7 +164,7 @@ void Cocos2dRenderer::SetXamlEventDelegate(PhoneDirect3DXamlAppComponent::Cocos2
void Cocos2dRenderer::SetXamlMessageBoxDelegate(PhoneDirect3DXamlAppComponent::Cocos2dMessageBoxDelegate^ delegate)
{
m_messageBoxDelegate = delegate;
GLView* eglView = GLView::sharedOpenGLView();
GLViewImpl* eglView = GLViewImpl::sharedOpenGLView();
if(eglView)
{
eglView->SetXamlMessageBoxDelegate(delegate);
@ -174,7 +174,7 @@ void Cocos2dRenderer::SetXamlMessageBoxDelegate(PhoneDirect3DXamlAppComponent::C
void Cocos2dRenderer::SetXamlEditBoxDelegate(PhoneDirect3DXamlAppComponent::Cocos2dEditBoxDelegate^ delegate)
{
m_editBoxDelegate = delegate;
GLView* eglView = GLView::sharedOpenGLView();
GLViewImpl* eglView = GLViewImpl::sharedOpenGLView();
if(eglView)
{
eglView->SetXamlEditBoxDelegate(delegate);

View File

@ -90,43 +90,43 @@ IAsyncAction^ Direct3DInterop::OnSuspending()
void Direct3DInterop::OnBackKeyPress()
{
cocos2d::GLView::sharedOpenGLView()->QueueBackKeyPress();
cocos2d::GLViewImpl::sharedOpenGLView()->QueueBackKeyPress();
}
// Pointer Event Handlers. We need to queue up pointer events to pass them to the drawing thread
void Direct3DInterop::OnPointerPressed(DrawingSurfaceManipulationHost^ sender, PointerEventArgs^ args)
{
cocos2d::GLView::sharedOpenGLView()->QueuePointerEvent(cocos2d::PointerEventType::PointerPressed, args);
cocos2d::GLViewImpl::sharedOpenGLView()->QueuePointerEvent(cocos2d::PointerEventType::PointerPressed, args);
}
void Direct3DInterop::OnPointerMoved(DrawingSurfaceManipulationHost^ sender, PointerEventArgs^ args)
{
cocos2d::GLView::sharedOpenGLView()->QueuePointerEvent(cocos2d::PointerEventType::PointerMoved, args);
cocos2d::GLViewImpl::sharedOpenGLView()->QueuePointerEvent(cocos2d::PointerEventType::PointerMoved, args);
}
void Direct3DInterop::OnPointerReleased(DrawingSurfaceManipulationHost^ sender, PointerEventArgs^ args)
{
cocos2d::GLView::sharedOpenGLView()->QueuePointerEvent(cocos2d::PointerEventType::PointerReleased, args);
cocos2d::GLViewImpl::sharedOpenGLView()->QueuePointerEvent(cocos2d::PointerEventType::PointerReleased, args);
}
void Direct3DInterop::OnCocos2dKeyEvent(Cocos2dKeyEvent key)
{
std::shared_ptr<cocos2d::InputEvent> e(new cocos2d::KeyboardEvent(key));
cocos2d::GLView::sharedOpenGLView()->QueueEvent(e);
cocos2d::GLViewImpl::sharedOpenGLView()->QueueEvent(e);
}
void Direct3DInterop::OnCocos2dKeyEvent(Cocos2dKeyEvent key, Platform::String^ text)
{
std::shared_ptr<cocos2d::InputEvent> e(new cocos2d::KeyboardEvent(key,text));
cocos2d::GLView::sharedOpenGLView()->QueueEvent(e);
cocos2d::GLViewImpl::sharedOpenGLView()->QueueEvent(e);
}
void Direct3DInterop::OnCocos2dEditboxEvent(Object^ sender, Platform::String^ args, Windows::Foundation::EventHandler<Platform::String^>^ handler)
{
std::shared_ptr<cocos2d::InputEvent> e(new EditBoxEvent(sender, args, handler));
cocos2d::GLView::sharedOpenGLView()->QueueEvent(e);
cocos2d::GLViewImpl::sharedOpenGLView()->QueueEvent(e);
}
@ -150,7 +150,7 @@ HRESULT Direct3DInterop::Draw(_In_ ID3D11Device1* device, _In_ ID3D11DeviceConte
}
#endif // 0
cocos2d::GLView::sharedOpenGLView()->ProcessEvents();
cocos2d::GLViewImpl::sharedOpenGLView()->ProcessEvents();
m_renderer->Render();
RequestAdditionalFrame();
return S_OK;

View File

@ -397,7 +397,7 @@ void GLViewImpl::UpdateWindowSize()
}
}
const Mat4& GLView::getOrientationMatrix() const
const Mat4& GLViewImpl::getOrientationMatrix() const
{
return m_orientationMatrix;
};

View File

@ -89,7 +89,7 @@ void CCEditBoxImplWp8::openKeyboard()
}
});
GLView::sharedOpenGLView()->OpenXamlEditBox(stringToPlatformString(placeHolder), stringToPlatformString(getText()), m_nMaxLength, (int)m_eEditBoxInputMode, (int)m_eEditBoxInputFlag, receiveHandler);
GLViewImpl::sharedOpenGLView()->OpenXamlEditBox(stringToPlatformString(placeHolder), stringToPlatformString(getText()), m_nMaxLength, (int)m_eEditBoxInputMode, (int)m_eEditBoxInputFlag, receiveHandler);
}
bool CCEditBoxImplWp8::initWithSize( const Size& size )

View File

@ -22,7 +22,7 @@ bool AppDelegate::applicationDidFinishLaunching() {
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if(!glview) {
glview = GLView::create("Cpp Empty Test");
glview = GLViewImpl::create("Cpp Empty Test");
director->setOpenGLView(glview);
}

View File

@ -54,7 +54,7 @@ bool AppDelegate::applicationDidFinishLaunching()
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if(!glview) {
glview = GLView::create("Cpp Tests");
glview = GLViewImpl::create("Cpp Tests");
director->setOpenGLView(glview);
}