mirror of https://github.com/axmolengine/axmol.git
Merge pull request #7657 from huangshiwu/v3_wp8glviewhookpr
V3 wp8glviewhookpr
This commit is contained in:
commit
1bad9ddbc2
|
@ -555,7 +555,7 @@ void RenderTexture::onBegin()
|
||||||
|
|
||||||
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8
|
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8
|
||||||
Mat4 modifiedProjection = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
|
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);
|
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION,modifiedProjection);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -574,7 +574,7 @@ void RenderTexture::onBegin()
|
||||||
{
|
{
|
||||||
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8
|
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8
|
||||||
Mat4 modifiedProjection = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
|
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);
|
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION, modifiedProjection);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -316,7 +316,7 @@
|
||||||
<ClCompile Include="..\physics\chipmunk\CCPhysicsShapeInfo_chipmunk.cpp" />
|
<ClCompile Include="..\physics\chipmunk\CCPhysicsShapeInfo_chipmunk.cpp" />
|
||||||
<ClCompile Include="..\physics\chipmunk\CCPhysicsWorldInfo_chipmunk.cpp" />
|
<ClCompile Include="..\physics\chipmunk\CCPhysicsWorldInfo_chipmunk.cpp" />
|
||||||
<ClCompile Include="..\platform\CCFileUtils.cpp" />
|
<ClCompile Include="..\platform\CCFileUtils.cpp" />
|
||||||
<ClCompile Include="..\platform\CCGLViewProtocol.cpp" />
|
<ClCompile Include="..\platform\CCGLView.cpp" />
|
||||||
<ClCompile Include="..\platform\CCImage.cpp" />
|
<ClCompile Include="..\platform\CCImage.cpp" />
|
||||||
<ClCompile Include="..\platform\CCSAXParser.cpp" />
|
<ClCompile Include="..\platform\CCSAXParser.cpp" />
|
||||||
<ClCompile Include="..\platform\CCThread.cpp" />
|
<ClCompile Include="..\platform\CCThread.cpp" />
|
||||||
|
@ -332,7 +332,7 @@
|
||||||
<ClCompile Include="..\platform\winrt\inet_ntop_winrt.cpp" />
|
<ClCompile Include="..\platform\winrt\inet_ntop_winrt.cpp" />
|
||||||
<ClCompile Include="..\platform\winrt\InputEvent.cpp" />
|
<ClCompile Include="..\platform\winrt\InputEvent.cpp" />
|
||||||
<ClCompile Include="..\platform\winrt\sha1.cpp" />
|
<ClCompile Include="..\platform\winrt\sha1.cpp" />
|
||||||
<ClCompile Include="..\platform\wp8\CCGLView.cpp" />
|
<ClCompile Include="..\platform\wp8\CCGLViewImpl.cpp" />
|
||||||
<ClCompile Include="..\platform\wp8\Direct3DBase.cpp" />
|
<ClCompile Include="..\platform\wp8\Direct3DBase.cpp" />
|
||||||
<ClCompile Include="..\platform\wp8\DirectXBase.cpp" />
|
<ClCompile Include="..\platform\wp8\DirectXBase.cpp" />
|
||||||
<ClCompile Include="..\platform\wp8\pch.cpp">
|
<ClCompile Include="..\platform\wp8\pch.cpp">
|
||||||
|
@ -534,7 +534,7 @@
|
||||||
<ClInclude Include="..\platform\CCCommon.h" />
|
<ClInclude Include="..\platform\CCCommon.h" />
|
||||||
<ClInclude Include="..\platform\CCDevice.h" />
|
<ClInclude Include="..\platform\CCDevice.h" />
|
||||||
<ClInclude Include="..\platform\CCFileUtils.h" />
|
<ClInclude Include="..\platform\CCFileUtils.h" />
|
||||||
<ClInclude Include="..\platform\CCGLViewProtocol.h" />
|
<ClInclude Include="..\platform\CCGLView.h" />
|
||||||
<ClInclude Include="..\platform\CCImage.h" />
|
<ClInclude Include="..\platform\CCImage.h" />
|
||||||
<ClInclude Include="..\platform\CCSAXParser.h" />
|
<ClInclude Include="..\platform\CCSAXParser.h" />
|
||||||
<ClInclude Include="..\platform\CCThread.h" />
|
<ClInclude Include="..\platform\CCThread.h" />
|
||||||
|
@ -553,7 +553,7 @@
|
||||||
<ClInclude Include="..\platform\winrt\InputEvent.h" />
|
<ClInclude Include="..\platform\winrt\InputEvent.h" />
|
||||||
<ClInclude Include="..\platform\winrt\InputEventTypes.h" />
|
<ClInclude Include="..\platform\winrt\InputEventTypes.h" />
|
||||||
<ClInclude Include="..\platform\winrt\sha1.h" />
|
<ClInclude Include="..\platform\winrt\sha1.h" />
|
||||||
<ClInclude Include="..\platform\wp8\CCGLView.h" />
|
<ClInclude Include="..\platform\wp8\CCGLViewImpl.h" />
|
||||||
<ClInclude Include="..\platform\wp8\Direct3DBase.h" />
|
<ClInclude Include="..\platform\wp8\Direct3DBase.h" />
|
||||||
<ClInclude Include="..\platform\wp8\DirectXBase.h" />
|
<ClInclude Include="..\platform\wp8\DirectXBase.h" />
|
||||||
<ClInclude Include="..\platform\wp8\pch.h" />
|
<ClInclude Include="..\platform\wp8\pch.h" />
|
||||||
|
|
|
@ -514,9 +514,6 @@
|
||||||
<ClCompile Include="..\platform\CCFileUtils.cpp">
|
<ClCompile Include="..\platform\CCFileUtils.cpp">
|
||||||
<Filter>platform</Filter>
|
<Filter>platform</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\platform\CCGLViewProtocol.cpp">
|
|
||||||
<Filter>platform</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\platform\CCImage.cpp">
|
<ClCompile Include="..\platform\CCImage.cpp">
|
||||||
<Filter>platform</Filter>
|
<Filter>platform</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -526,9 +523,6 @@
|
||||||
<ClCompile Include="..\platform\CCThread.cpp">
|
<ClCompile Include="..\platform\CCThread.cpp">
|
||||||
<Filter>platform</Filter>
|
<Filter>platform</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\platform\wp8\CCGLView.cpp">
|
|
||||||
<Filter>platform\wp8</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\platform\wp8\Direct3DBase.cpp">
|
<ClCompile Include="..\platform\wp8\Direct3DBase.cpp">
|
||||||
<Filter>platform\wp8</Filter>
|
<Filter>platform\wp8</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -614,6 +608,12 @@
|
||||||
<ClCompile Include="CCFastTMXTiledMap.cpp">
|
<ClCompile Include="CCFastTMXTiledMap.cpp">
|
||||||
<Filter>2d</Filter>
|
<Filter>2d</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\platform\CCGLView.cpp">
|
||||||
|
<Filter>platform</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\platform\wp8\CCGLViewImpl.cpp">
|
||||||
|
<Filter>platform\wp8</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="CCProtectedNode.cpp">
|
<ClCompile Include="CCProtectedNode.cpp">
|
||||||
<Filter>2d</Filter>
|
<Filter>2d</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -1141,9 +1141,6 @@
|
||||||
<ClInclude Include="..\platform\CCFileUtils.h">
|
<ClInclude Include="..\platform\CCFileUtils.h">
|
||||||
<Filter>platform</Filter>
|
<Filter>platform</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\platform\CCGLViewProtocol.h">
|
|
||||||
<Filter>platform</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\platform\CCImage.h">
|
<ClInclude Include="..\platform\CCImage.h">
|
||||||
<Filter>platform</Filter>
|
<Filter>platform</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -1156,9 +1153,6 @@
|
||||||
<ClInclude Include="..\platform\wp8\DirectXBase.h">
|
<ClInclude Include="..\platform\wp8\DirectXBase.h">
|
||||||
<Filter>platform\wp8</Filter>
|
<Filter>platform\wp8</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\platform\wp8\CCGLView.h">
|
|
||||||
<Filter>platform\wp8</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\platform\wp8\Direct3DBase.h">
|
<ClInclude Include="..\platform\wp8\Direct3DBase.h">
|
||||||
<Filter>platform\wp8</Filter>
|
<Filter>platform\wp8</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -1259,6 +1253,12 @@
|
||||||
<ClInclude Include="CCFastTMXTiledMap.h">
|
<ClInclude Include="CCFastTMXTiledMap.h">
|
||||||
<Filter>2d</Filter>
|
<Filter>2d</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\platform\CCGLView.h">
|
||||||
|
<Filter>platform</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\platform\wp8\CCGLViewImpl.h">
|
||||||
|
<Filter>platform\wp8</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="CCProtectedNode.h">
|
<ClInclude Include="CCProtectedNode.h">
|
||||||
<Filter>2d</Filter>
|
<Filter>2d</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|
|
@ -61,6 +61,7 @@ THE SOFTWARE.
|
||||||
#include "base/CCNS.h"
|
#include "base/CCNS.h"
|
||||||
#include "math/CCMath.h"
|
#include "math/CCMath.h"
|
||||||
#include "CCApplication.h"
|
#include "CCApplication.h"
|
||||||
|
#include "CCGLViewImpl.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Position of the FPS
|
Position of the FPS
|
||||||
|
|
|
@ -51,7 +51,7 @@ NS_CC_BEGIN
|
||||||
/* Forward declarations. */
|
/* Forward declarations. */
|
||||||
class LabelAtlas;
|
class LabelAtlas;
|
||||||
class Scene;
|
class Scene;
|
||||||
class GLView;
|
//class GLView;
|
||||||
class DirectorDelegate;
|
class DirectorDelegate;
|
||||||
class Node;
|
class Node;
|
||||||
class Scheduler;
|
class Scheduler;
|
||||||
|
|
|
@ -131,6 +131,11 @@ public:
|
||||||
virtual void* getEAGLView() const { return nullptr; }
|
virtual void* getEAGLView() const { return nullptr; }
|
||||||
#endif /* (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) */
|
#endif /* (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) */
|
||||||
|
|
||||||
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
|
||||||
|
virtual Size getRenerTargetSize() const = 0;
|
||||||
|
virtual const Mat4& getOrientationMatrix() const = 0;
|
||||||
|
virtual const Mat4& getReverseOrientationMatrix() const = 0;
|
||||||
|
#endif
|
||||||
/**
|
/**
|
||||||
* Get the visible area size of opengl viewport.
|
* Get the visible area size of opengl viewport.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -26,7 +26,7 @@ THE SOFTWARE.
|
||||||
#if CC_TARGET_PLATFORM == CC_PLATFORM_WINRT
|
#if CC_TARGET_PLATFORM == CC_PLATFORM_WINRT
|
||||||
#include "platform/winrt/CCGLView.h"
|
#include "platform/winrt/CCGLView.h"
|
||||||
#else
|
#else
|
||||||
#include "platform/wp8/CCGLView.h"
|
#include "platform/wp8/CCGLViewImpl.h"
|
||||||
#endif
|
#endif
|
||||||
#include "base/CCDirector.h"
|
#include "base/CCDirector.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -75,7 +75,7 @@ int Application::run()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLView::sharedOpenGLView()->Run();
|
GLViewImpl::sharedOpenGLView()->Run();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ THE SOFTWARE.
|
||||||
#include "CCWinRTUtils.h"
|
#include "CCWinRTUtils.h"
|
||||||
|
|
||||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
|
||||||
#include "platform/wp8/CCGLView.h"
|
#include "platform/wp8/CCGLViewImpl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(VLD_DEBUG_MEMORY)
|
#if defined(VLD_DEBUG_MEMORY)
|
||||||
|
@ -50,7 +50,7 @@ void MessageBox(const char * pszMsg, const char * pszTitle)
|
||||||
// Show the message dialog
|
// Show the message dialog
|
||||||
msg->ShowAsync();
|
msg->ShowAsync();
|
||||||
#else
|
#else
|
||||||
GLView::sharedOpenGLView()->ShowMessageBox(title, message);
|
GLViewImpl::sharedOpenGLView()->ShowMessageBox(title, message);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ void Device::setAccelerometerEnabled(bool isEnabled)
|
||||||
acc.timestamp = 0;
|
acc.timestamp = 0;
|
||||||
|
|
||||||
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8
|
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8
|
||||||
auto orientation = GLView::sharedOpenGLView()->getDeviceOrientation();
|
auto orientation = GLViewImpl::sharedOpenGLView()->getDeviceOrientation();
|
||||||
|
|
||||||
switch (orientation)
|
switch (orientation)
|
||||||
{
|
{
|
||||||
|
@ -115,7 +115,7 @@ void Device::setAccelerometerEnabled(bool isEnabled)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
std::shared_ptr<cocos2d::InputEvent> event(new AccelerometerEvent(acc));
|
std::shared_ptr<cocos2d::InputEvent> event(new AccelerometerEvent(acc));
|
||||||
cocos2d::GLView::sharedOpenGLView()->QueueEvent(event);
|
cocos2d::GLViewImpl::sharedOpenGLView()->QueueEvent(event);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -57,13 +57,13 @@ void PointerEvent::execute()
|
||||||
switch(m_type)
|
switch(m_type)
|
||||||
{
|
{
|
||||||
case PointerEventType::PointerPressed:
|
case PointerEventType::PointerPressed:
|
||||||
GLView::sharedOpenGLView()->OnPointerPressed(m_args.Get());
|
GLViewImpl::sharedOpenGLView()->OnPointerPressed(m_args.Get());
|
||||||
break;
|
break;
|
||||||
case PointerEventType::PointerMoved:
|
case PointerEventType::PointerMoved:
|
||||||
GLView::sharedOpenGLView()->OnPointerMoved(m_args.Get());
|
GLViewImpl::sharedOpenGLView()->OnPointerMoved(m_args.Get());
|
||||||
break;
|
break;
|
||||||
case PointerEventType::PointerReleased:
|
case PointerEventType::PointerReleased:
|
||||||
GLView::sharedOpenGLView()->OnPointerReleased(m_args.Get());
|
GLViewImpl::sharedOpenGLView()->OnPointerReleased(m_args.Get());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ BackButtonEvent::BackButtonEvent()
|
||||||
|
|
||||||
void BackButtonEvent::execute()
|
void BackButtonEvent::execute()
|
||||||
{
|
{
|
||||||
GLView::sharedOpenGLView()->OnBackKeyPress();
|
GLViewImpl::sharedOpenGLView()->OnBackKeyPress();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ void Cocos2dRenderer::CreateGLResources()
|
||||||
if(!mInitialized)
|
if(!mInitialized)
|
||||||
{
|
{
|
||||||
mInitialized = true;
|
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);
|
glview->Create(m_eglDisplay, m_eglContext, m_eglSurface, m_renderTargetSize.Width, m_renderTargetSize.Height,m_orientation);
|
||||||
director->setOpenGLView(glview);
|
director->setOpenGLView(glview);
|
||||||
CCApplication::getInstance()->run();
|
CCApplication::getInstance()->run();
|
||||||
|
@ -102,14 +102,14 @@ IAsyncAction^ Cocos2dRenderer::OnSuspending()
|
||||||
|
|
||||||
void Cocos2dRenderer::OnUpdateDevice()
|
void Cocos2dRenderer::OnUpdateDevice()
|
||||||
{
|
{
|
||||||
GLView* glview = GLView::sharedOpenGLView();
|
//GLView* glview = GLView::sharedOpenGLView();
|
||||||
glview->UpdateDevice(m_eglDisplay, m_eglContext, m_eglSurface);
|
GLViewImpl::sharedOpenGLView()->UpdateDevice(m_eglDisplay, m_eglContext, m_eglSurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Cocos2dRenderer::OnOrientationChanged(Windows::Graphics::Display::DisplayOrientations orientation)
|
void Cocos2dRenderer::OnOrientationChanged(Windows::Graphics::Display::DisplayOrientations orientation)
|
||||||
{
|
{
|
||||||
DirectXBase::OnOrientationChanged(orientation);
|
DirectXBase::OnOrientationChanged(orientation);
|
||||||
GLView::sharedOpenGLView()->UpdateOrientation(orientation);
|
GLViewImpl::sharedOpenGLView()->UpdateOrientation(orientation);
|
||||||
}
|
}
|
||||||
|
|
||||||
// return true if eglSwapBuffers was called by OnRender()
|
// return true if eglSwapBuffers was called by OnRender()
|
||||||
|
@ -117,8 +117,8 @@ bool Cocos2dRenderer::OnRender()
|
||||||
{
|
{
|
||||||
if(m_loadingComplete)
|
if(m_loadingComplete)
|
||||||
{
|
{
|
||||||
GLView* glview = GLView::sharedOpenGLView();
|
//GLView* glview = GLView::sharedOpenGLView();
|
||||||
glview->Render();
|
GLViewImpl::sharedOpenGLView()->Render();
|
||||||
return true; // eglSwapBuffers was called by glview->Render();
|
return true; // eglSwapBuffers was called by glview->Render();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -154,7 +154,7 @@ void Cocos2dRenderer::OnCocos2dKeyEvent(Cocos2dKeyEvent event)
|
||||||
void Cocos2dRenderer::SetXamlEventDelegate(PhoneDirect3DXamlAppComponent::Cocos2dEventDelegate^ delegate)
|
void Cocos2dRenderer::SetXamlEventDelegate(PhoneDirect3DXamlAppComponent::Cocos2dEventDelegate^ delegate)
|
||||||
{
|
{
|
||||||
m_delegate = delegate;
|
m_delegate = delegate;
|
||||||
GLView* eglView = GLView::sharedOpenGLView();
|
GLViewImpl* eglView = GLViewImpl::sharedOpenGLView();
|
||||||
if(eglView)
|
if(eglView)
|
||||||
{
|
{
|
||||||
eglView->SetXamlEventDelegate(delegate);
|
eglView->SetXamlEventDelegate(delegate);
|
||||||
|
@ -164,7 +164,7 @@ void Cocos2dRenderer::SetXamlEventDelegate(PhoneDirect3DXamlAppComponent::Cocos2
|
||||||
void Cocos2dRenderer::SetXamlMessageBoxDelegate(PhoneDirect3DXamlAppComponent::Cocos2dMessageBoxDelegate^ delegate)
|
void Cocos2dRenderer::SetXamlMessageBoxDelegate(PhoneDirect3DXamlAppComponent::Cocos2dMessageBoxDelegate^ delegate)
|
||||||
{
|
{
|
||||||
m_messageBoxDelegate = delegate;
|
m_messageBoxDelegate = delegate;
|
||||||
GLView* eglView = GLView::sharedOpenGLView();
|
GLViewImpl* eglView = GLViewImpl::sharedOpenGLView();
|
||||||
if(eglView)
|
if(eglView)
|
||||||
{
|
{
|
||||||
eglView->SetXamlMessageBoxDelegate(delegate);
|
eglView->SetXamlMessageBoxDelegate(delegate);
|
||||||
|
@ -174,7 +174,7 @@ void Cocos2dRenderer::SetXamlMessageBoxDelegate(PhoneDirect3DXamlAppComponent::C
|
||||||
void Cocos2dRenderer::SetXamlEditBoxDelegate(PhoneDirect3DXamlAppComponent::Cocos2dEditBoxDelegate^ delegate)
|
void Cocos2dRenderer::SetXamlEditBoxDelegate(PhoneDirect3DXamlAppComponent::Cocos2dEditBoxDelegate^ delegate)
|
||||||
{
|
{
|
||||||
m_editBoxDelegate = delegate;
|
m_editBoxDelegate = delegate;
|
||||||
GLView* eglView = GLView::sharedOpenGLView();
|
GLViewImpl* eglView = GLViewImpl::sharedOpenGLView();
|
||||||
if(eglView)
|
if(eglView)
|
||||||
{
|
{
|
||||||
eglView->SetXamlEditBoxDelegate(delegate);
|
eglView->SetXamlEditBoxDelegate(delegate);
|
||||||
|
|
|
@ -90,43 +90,43 @@ IAsyncAction^ Direct3DInterop::OnSuspending()
|
||||||
|
|
||||||
void Direct3DInterop::OnBackKeyPress()
|
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
|
// Pointer Event Handlers. We need to queue up pointer events to pass them to the drawing thread
|
||||||
void Direct3DInterop::OnPointerPressed(DrawingSurfaceManipulationHost^ sender, PointerEventArgs^ args)
|
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)
|
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)
|
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)
|
void Direct3DInterop::OnCocos2dKeyEvent(Cocos2dKeyEvent key)
|
||||||
{
|
{
|
||||||
std::shared_ptr<cocos2d::InputEvent> e(new cocos2d::KeyboardEvent(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)
|
void Direct3DInterop::OnCocos2dKeyEvent(Cocos2dKeyEvent key, Platform::String^ text)
|
||||||
{
|
{
|
||||||
std::shared_ptr<cocos2d::InputEvent> e(new cocos2d::KeyboardEvent(key,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)
|
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));
|
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
|
#endif // 0
|
||||||
|
|
||||||
cocos2d::GLView::sharedOpenGLView()->ProcessEvents();
|
cocos2d::GLViewImpl::sharedOpenGLView()->ProcessEvents();
|
||||||
m_renderer->Render();
|
m_renderer->Render();
|
||||||
RequestAdditionalFrame();
|
RequestAdditionalFrame();
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
|
@ -23,7 +23,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "CCGLView.h"
|
#include "CCGLViewImpl.h"
|
||||||
#include "deprecated/CCSet.h"
|
#include "deprecated/CCSet.h"
|
||||||
#include "base/ccMacros.h"
|
#include "base/ccMacros.h"
|
||||||
#include "base/CCDirector.h"
|
#include "base/CCDirector.h"
|
||||||
|
@ -54,11 +54,11 @@ using namespace PhoneDirect3DXamlAppComponent;
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
|
||||||
static GLView* s_pEglView = NULL;
|
static GLViewImpl* s_pEglView = NULL;
|
||||||
|
|
||||||
GLView* GLView::create(const std::string& viewName)
|
GLViewImpl* GLViewImpl::create(const std::string& viewName)
|
||||||
{
|
{
|
||||||
auto ret = new GLView;
|
auto ret = new GLViewImpl;
|
||||||
if(ret && ret->initWithFullScreen(viewName))
|
if(ret && ret->initWithFullScreen(viewName))
|
||||||
{
|
{
|
||||||
ret->autorelease();
|
ret->autorelease();
|
||||||
|
@ -69,7 +69,7 @@ GLView* GLView::create(const std::string& viewName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GLView::GLView()
|
GLViewImpl::GLViewImpl()
|
||||||
: _frameZoomFactor(1.0f)
|
: _frameZoomFactor(1.0f)
|
||||||
, _supportTouch(true)
|
, _supportTouch(true)
|
||||||
, _isRetina(false)
|
, _isRetina(false)
|
||||||
|
@ -91,7 +91,7 @@ GLView::GLView()
|
||||||
_viewName = "cocos2dx";
|
_viewName = "cocos2dx";
|
||||||
}
|
}
|
||||||
|
|
||||||
GLView::~GLView()
|
GLViewImpl::~GLViewImpl()
|
||||||
{
|
{
|
||||||
CC_ASSERT(this == s_pEglView);
|
CC_ASSERT(this == s_pEglView);
|
||||||
s_pEglView = NULL;
|
s_pEglView = NULL;
|
||||||
|
@ -99,7 +99,7 @@ GLView::~GLView()
|
||||||
// TODO: cleanup
|
// TODO: cleanup
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GLView::initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor)
|
bool GLViewImpl::initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor)
|
||||||
{
|
{
|
||||||
setViewName(viewName);
|
setViewName(viewName);
|
||||||
setFrameSize(rect.size.width, rect.size.height);
|
setFrameSize(rect.size.width, rect.size.height);
|
||||||
|
@ -107,13 +107,13 @@ bool GLView::initWithRect(const std::string& viewName, Rect rect, float frameZoo
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GLView::initWithFullScreen(const std::string& viewName)
|
bool GLViewImpl::initWithFullScreen(const std::string& viewName)
|
||||||
{
|
{
|
||||||
return initWithRect(viewName, Rect(0, 0, m_width, m_height), 1.0f);
|
return initWithRect(viewName, Rect(0, 0, m_width, m_height), 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool GLView::Create(EGLDisplay eglDisplay, EGLContext eglContext, EGLSurface eglSurface, float width, float height, DisplayOrientations orientation)
|
bool GLViewImpl::Create(EGLDisplay eglDisplay, EGLContext eglContext, EGLSurface eglSurface, float width, float height, DisplayOrientations orientation)
|
||||||
{
|
{
|
||||||
m_orientation = orientation;
|
m_orientation = orientation;
|
||||||
m_eglDisplay = eglDisplay;
|
m_eglDisplay = eglDisplay;
|
||||||
|
@ -123,7 +123,7 @@ bool GLView::Create(EGLDisplay eglDisplay, EGLContext eglContext, EGLSurface egl
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLView::UpdateDevice(EGLDisplay eglDisplay, EGLContext eglContext, EGLSurface eglSurface)
|
void GLViewImpl::UpdateDevice(EGLDisplay eglDisplay, EGLContext eglContext, EGLSurface eglSurface)
|
||||||
{
|
{
|
||||||
m_eglDisplay = eglDisplay;
|
m_eglDisplay = eglDisplay;
|
||||||
m_eglContext = eglContext;
|
m_eglContext = eglContext;
|
||||||
|
@ -132,7 +132,7 @@ void GLView::UpdateDevice(EGLDisplay eglDisplay, EGLContext eglContext, EGLSurfa
|
||||||
//UpdateForWindowSizeChange(width, height);
|
//UpdateForWindowSizeChange(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLView::setIMEKeyboardState(bool bOpen)
|
void GLViewImpl::setIMEKeyboardState(bool bOpen)
|
||||||
{
|
{
|
||||||
if(m_delegate)
|
if(m_delegate)
|
||||||
{
|
{
|
||||||
|
@ -147,34 +147,34 @@ void GLView::setIMEKeyboardState(bool bOpen)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLView::swapBuffers()
|
void GLViewImpl::swapBuffers()
|
||||||
{
|
{
|
||||||
eglSwapBuffers(m_eglDisplay, m_eglSurface);
|
eglSwapBuffers(m_eglDisplay, m_eglSurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool GLView::isOpenGLReady()
|
bool GLViewImpl::isOpenGLReady()
|
||||||
{
|
{
|
||||||
// TODO: need to revisit this
|
// TODO: need to revisit this
|
||||||
return (m_eglDisplay && m_orientation != DisplayOrientations::None);
|
return (m_eglDisplay && m_orientation != DisplayOrientations::None);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLView::end()
|
void GLViewImpl::end()
|
||||||
{
|
{
|
||||||
m_windowClosed = true;
|
m_windowClosed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GLView::OnSuspending(Platform::Object^ sender, SuspendingEventArgs^ args)
|
void GLViewImpl::OnSuspending(Platform::Object^ sender, SuspendingEventArgs^ args)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLView::OnResuming(Platform::Object^ sender, Platform::Object^ args)
|
void GLViewImpl::OnResuming(Platform::Object^ sender, Platform::Object^ args)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// user pressed the Back Key on the phone
|
// user pressed the Back Key on the phone
|
||||||
void GLView::OnBackKeyPress()
|
void GLViewImpl::OnBackKeyPress()
|
||||||
{
|
{
|
||||||
if(m_delegate)
|
if(m_delegate)
|
||||||
{
|
{
|
||||||
|
@ -182,12 +182,12 @@ void GLView::OnBackKeyPress()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLView::OnPointerPressed(CoreWindow^ sender, PointerEventArgs^ args)
|
void GLViewImpl::OnPointerPressed(CoreWindow^ sender, PointerEventArgs^ args)
|
||||||
{
|
{
|
||||||
OnPointerPressed(args);
|
OnPointerPressed(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLView::OnPointerPressed(PointerEventArgs^ args)
|
void GLViewImpl::OnPointerPressed(PointerEventArgs^ args)
|
||||||
{
|
{
|
||||||
int id = args->CurrentPoint->PointerId;
|
int id = args->CurrentPoint->PointerId;
|
||||||
Vec2 pt = GetPoint(args);
|
Vec2 pt = GetPoint(args);
|
||||||
|
@ -195,7 +195,7 @@ void GLView::OnPointerPressed(PointerEventArgs^ args)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GLView::OnPointerWheelChanged(CoreWindow^ sender, PointerEventArgs^ args)
|
void GLViewImpl::OnPointerWheelChanged(CoreWindow^ sender, PointerEventArgs^ args)
|
||||||
{
|
{
|
||||||
float direction = (float)args->CurrentPoint->Properties->MouseWheelDelta;
|
float direction = (float)args->CurrentPoint->Properties->MouseWheelDelta;
|
||||||
int id = 0;
|
int id = 0;
|
||||||
|
@ -206,22 +206,22 @@ void GLView::OnPointerWheelChanged(CoreWindow^ sender, PointerEventArgs^ args)
|
||||||
handleTouchesEnd(1, &id, &p.x, &p.y);
|
handleTouchesEnd(1, &id, &p.x, &p.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLView::OnVisibilityChanged(CoreWindow^ sender, VisibilityChangedEventArgs^ args)
|
void GLViewImpl::OnVisibilityChanged(CoreWindow^ sender, VisibilityChangedEventArgs^ args)
|
||||||
{
|
{
|
||||||
m_windowVisible = args->Visible;
|
m_windowVisible = args->Visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLView::OnWindowClosed(CoreWindow^ sender, CoreWindowEventArgs^ args)
|
void GLViewImpl::OnWindowClosed(CoreWindow^ sender, CoreWindowEventArgs^ args)
|
||||||
{
|
{
|
||||||
m_windowClosed = true;
|
m_windowClosed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLView::OnPointerMoved(CoreWindow^ sender, PointerEventArgs^ args)
|
void GLViewImpl::OnPointerMoved(CoreWindow^ sender, PointerEventArgs^ args)
|
||||||
{
|
{
|
||||||
OnPointerMoved(args);
|
OnPointerMoved(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLView::OnPointerMoved( PointerEventArgs^ args)
|
void GLViewImpl::OnPointerMoved( PointerEventArgs^ args)
|
||||||
{
|
{
|
||||||
auto currentPoint = args->CurrentPoint;
|
auto currentPoint = args->CurrentPoint;
|
||||||
if (currentPoint->IsInContact)
|
if (currentPoint->IsInContact)
|
||||||
|
@ -241,12 +241,12 @@ void GLView::OnPointerMoved( PointerEventArgs^ args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLView::OnPointerReleased(CoreWindow^ sender, PointerEventArgs^ args)
|
void GLViewImpl::OnPointerReleased(CoreWindow^ sender, PointerEventArgs^ args)
|
||||||
{
|
{
|
||||||
OnPointerReleased(args);
|
OnPointerReleased(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLView::OnPointerReleased(PointerEventArgs^ args)
|
void GLViewImpl::OnPointerReleased(PointerEventArgs^ args)
|
||||||
{
|
{
|
||||||
int id = args->CurrentPoint->PointerId;
|
int id = args->CurrentPoint->PointerId;
|
||||||
Vec2 pt = GetPoint(args);
|
Vec2 pt = GetPoint(args);
|
||||||
|
@ -255,46 +255,46 @@ void GLView::OnPointerReleased(PointerEventArgs^ args)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void GLView::resize(int width, int height)
|
void GLViewImpl::resize(int width, int height)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLView::setFrameZoomFactor(float fZoomFactor)
|
void GLViewImpl::setFrameZoomFactor(float fZoomFactor)
|
||||||
{
|
{
|
||||||
_frameZoomFactor = fZoomFactor;
|
_frameZoomFactor = fZoomFactor;
|
||||||
Director::getInstance()->setProjection(Director::getInstance()->getProjection());
|
Director::getInstance()->setProjection(Director::getInstance()->getProjection());
|
||||||
//resize(m_obScreenSize.width * fZoomFactor, m_obScreenSize.height * fZoomFactor);
|
//resize(m_obScreenSize.width * fZoomFactor, m_obScreenSize.height * fZoomFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
float GLView::getFrameZoomFactor()
|
float GLViewImpl::getFrameZoomFactor()
|
||||||
{
|
{
|
||||||
return _frameZoomFactor;
|
return _frameZoomFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLView::centerWindow()
|
void GLViewImpl::centerWindow()
|
||||||
{
|
{
|
||||||
// not implemented in WinRT. Window is always full screen
|
// not implemented in WinRT. Window is always full screen
|
||||||
}
|
}
|
||||||
|
|
||||||
GLView* GLView::sharedOpenGLView()
|
GLViewImpl* GLViewImpl::sharedOpenGLView()
|
||||||
{
|
{
|
||||||
return s_pEglView;
|
return s_pEglView;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GLView::Run()
|
int GLViewImpl::Run()
|
||||||
{
|
{
|
||||||
// XAML version does not have a run loop
|
// XAML version does not have a run loop
|
||||||
m_running = true;
|
m_running = true;
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
void GLView::Render()
|
void GLViewImpl::Render()
|
||||||
{
|
{
|
||||||
OnRendering();
|
OnRendering();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLView::OnRendering()
|
void GLViewImpl::OnRendering()
|
||||||
{
|
{
|
||||||
if(m_running && m_initialized)
|
if(m_running && m_initialized)
|
||||||
{
|
{
|
||||||
|
@ -304,7 +304,7 @@ void GLView::OnRendering()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool GLView::ShowMessageBox(Platform::String^ title, Platform::String^ message)
|
bool GLViewImpl::ShowMessageBox(Platform::String^ title, Platform::String^ message)
|
||||||
{
|
{
|
||||||
if(m_messageBoxDelegate)
|
if(m_messageBoxDelegate)
|
||||||
{
|
{
|
||||||
|
@ -314,7 +314,7 @@ bool GLView::ShowMessageBox(Platform::String^ title, Platform::String^ message)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GLView::OpenXamlEditBox(Platform::String^ strPlaceHolder, Platform::String^ strText, int maxLength, int inputMode, int inputFlag, Windows::Foundation::EventHandler<Platform::String^>^ receiveHandler)
|
bool GLViewImpl::OpenXamlEditBox(Platform::String^ strPlaceHolder, Platform::String^ strText, int maxLength, int inputMode, int inputFlag, Windows::Foundation::EventHandler<Platform::String^>^ receiveHandler)
|
||||||
{
|
{
|
||||||
if(m_editBoxDelegate)
|
if(m_editBoxDelegate)
|
||||||
{
|
{
|
||||||
|
@ -327,7 +327,7 @@ bool GLView::OpenXamlEditBox(Platform::String^ strPlaceHolder, Platform::String^
|
||||||
|
|
||||||
|
|
||||||
// called by orientation change from WP8 XAML
|
// called by orientation change from WP8 XAML
|
||||||
void GLView::UpdateOrientation(DisplayOrientations orientation)
|
void GLViewImpl::UpdateOrientation(DisplayOrientations orientation)
|
||||||
{
|
{
|
||||||
if(m_orientation != orientation)
|
if(m_orientation != orientation)
|
||||||
{
|
{
|
||||||
|
@ -337,7 +337,7 @@ void GLView::UpdateOrientation(DisplayOrientations orientation)
|
||||||
}
|
}
|
||||||
|
|
||||||
// called by size change from WP8 XAML
|
// called by size change from WP8 XAML
|
||||||
void GLView::UpdateForWindowSizeChange(float width, float height)
|
void GLViewImpl::UpdateForWindowSizeChange(float width, float height)
|
||||||
{
|
{
|
||||||
m_width = width;
|
m_width = width;
|
||||||
m_height = height;
|
m_height = height;
|
||||||
|
@ -361,7 +361,7 @@ void GLViewEventHandler::OnGLFWWindowSizeFunCallback(GLFWwindow *windows, int wi
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void GLView::UpdateWindowSize()
|
void GLViewImpl::UpdateWindowSize()
|
||||||
{
|
{
|
||||||
float width, height;
|
float width, height;
|
||||||
|
|
||||||
|
@ -382,7 +382,7 @@ void GLView::UpdateWindowSize()
|
||||||
if(!m_initialized)
|
if(!m_initialized)
|
||||||
{
|
{
|
||||||
m_initialized = true;
|
m_initialized = true;
|
||||||
GLViewProtocol::setFrameSize(width, height);
|
GLView::setFrameSize(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto view = Director::getInstance()->getOpenGLView();
|
auto view = Director::getInstance()->getOpenGLView();
|
||||||
|
@ -397,13 +397,13 @@ void GLView::UpdateWindowSize()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const Mat4& GLView::getOrientationMatrix() const
|
const Mat4& GLViewImpl::getOrientationMatrix() const
|
||||||
{
|
{
|
||||||
return m_orientationMatrix;
|
return m_orientationMatrix;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void GLView::UpdateOrientationMatrix()
|
void GLViewImpl::UpdateOrientationMatrix()
|
||||||
{
|
{
|
||||||
kmMat4Identity(&m_orientationMatrix);
|
kmMat4Identity(&m_orientationMatrix);
|
||||||
kmMat4Identity(&m_reverseOrientationMatrix);
|
kmMat4Identity(&m_reverseOrientationMatrix);
|
||||||
|
@ -429,7 +429,7 @@ void GLView::UpdateOrientationMatrix()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cocos2d::Vec2 GLView::TransformToOrientation(Windows::Foundation::Point p)
|
cocos2d::Vec2 GLViewImpl::TransformToOrientation(Windows::Foundation::Point p)
|
||||||
{
|
{
|
||||||
cocos2d::Vec2 returnValue;
|
cocos2d::Vec2 returnValue;
|
||||||
|
|
||||||
|
@ -453,7 +453,7 @@ cocos2d::Vec2 GLView::TransformToOrientation(Windows::Foundation::Point p)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
float zoomFactor = GLView::sharedOpenGLView()->getFrameZoomFactor();
|
float zoomFactor = GLViewImpl::sharedOpenGLView()->getFrameZoomFactor();
|
||||||
if(zoomFactor > 0.0f) {
|
if(zoomFactor > 0.0f) {
|
||||||
returnValue.x /= zoomFactor;
|
returnValue.x /= zoomFactor;
|
||||||
returnValue.y /= zoomFactor;
|
returnValue.y /= zoomFactor;
|
||||||
|
@ -464,14 +464,14 @@ cocos2d::Vec2 GLView::TransformToOrientation(Windows::Foundation::Point p)
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec2 GLView::GetPoint(PointerEventArgs^ args) {
|
Vec2 GLViewImpl::GetPoint(PointerEventArgs^ args) {
|
||||||
|
|
||||||
return TransformToOrientation(args->CurrentPoint->Position);
|
return TransformToOrientation(args->CurrentPoint->Position);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GLView::setViewPortInPoints(float x , float y , float w , float h)
|
void GLViewImpl::setViewPortInPoints(float x , float y , float w , float h)
|
||||||
{
|
{
|
||||||
switch(m_orientation)
|
switch(m_orientation)
|
||||||
{
|
{
|
||||||
|
@ -491,7 +491,7 @@ void GLView::setViewPortInPoints(float x , float y , float w , float h)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLView::setScissorInPoints(float x , float y , float w , float h)
|
void GLViewImpl::setScissorInPoints(float x , float y , float w , float h)
|
||||||
{
|
{
|
||||||
switch(m_orientation)
|
switch(m_orientation)
|
||||||
{
|
{
|
||||||
|
@ -511,27 +511,27 @@ void GLView::setScissorInPoints(float x , float y , float w , float h)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLView::QueueBackKeyPress()
|
void GLViewImpl::QueueBackKeyPress()
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> guard(mMutex);
|
std::lock_guard<std::mutex> guard(mMutex);
|
||||||
std::shared_ptr<BackButtonEvent> e(new BackButtonEvent());
|
std::shared_ptr<BackButtonEvent> e(new BackButtonEvent());
|
||||||
mInputEvents.push(e);
|
mInputEvents.push(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLView::QueuePointerEvent(PointerEventType type, PointerEventArgs^ args)
|
void GLViewImpl::QueuePointerEvent(PointerEventType type, PointerEventArgs^ args)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> guard(mMutex);
|
std::lock_guard<std::mutex> guard(mMutex);
|
||||||
std::shared_ptr<PointerEvent> e(new PointerEvent(type, args));
|
std::shared_ptr<PointerEvent> e(new PointerEvent(type, args));
|
||||||
mInputEvents.push(e);
|
mInputEvents.push(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLView::QueueEvent(std::shared_ptr<InputEvent>& event)
|
void GLViewImpl::QueueEvent(std::shared_ptr<InputEvent>& event)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> guard(mMutex);
|
std::lock_guard<std::mutex> guard(mMutex);
|
||||||
mInputEvents.push(event);
|
mInputEvents.push(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLView::ProcessEvents()
|
void GLViewImpl::ProcessEvents()
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> guard(mMutex);
|
std::lock_guard<std::mutex> guard(mMutex);
|
||||||
|
|
|
@ -23,12 +23,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef __CC_EGLVIEW_WINRT_H__
|
#ifndef __CC_EGLVIEWIMPL_WINRT_H__
|
||||||
#define __CC_EGLVIEW_WINRT_H__
|
#define __CC_EGLVIEWIMPL_WINRT_H__
|
||||||
|
|
||||||
#include "CCStdC.h"
|
#include "CCStdC.h"
|
||||||
#include "platform/CCCommon.h"
|
#include "platform/CCCommon.h"
|
||||||
#include "platform/CCGLViewProtocol.h"
|
#include "platform/CCGLView.h"
|
||||||
#include "InputEvent.h"
|
#include "InputEvent.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,13 +47,13 @@ THE SOFTWARE.
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
|
||||||
class GLView;
|
class GLViewImpl;
|
||||||
|
|
||||||
|
|
||||||
class CC_DLL GLView : public Ref, public GLViewProtocol
|
class CC_DLL GLViewImpl : public GLView
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static GLView* create(const std::string& viewName);
|
static GLViewImpl* create(const std::string& viewName);
|
||||||
|
|
||||||
/* override functions */
|
/* override functions */
|
||||||
virtual bool isOpenGLReady();
|
virtual bool isOpenGLReady();
|
||||||
|
@ -91,7 +91,7 @@ public:
|
||||||
|
|
||||||
void QueueBackKeyPress();
|
void QueueBackKeyPress();
|
||||||
void QueuePointerEvent(PointerEventType type, Windows::UI::Core::PointerEventArgs^ args);
|
void QueuePointerEvent(PointerEventType type, Windows::UI::Core::PointerEventArgs^ args);
|
||||||
void GLView::QueueEvent(std::shared_ptr<InputEvent>& event);
|
void GLViewImpl::QueueEvent(std::shared_ptr<InputEvent>& event);
|
||||||
|
|
||||||
void SetXamlEventDelegate(PhoneDirect3DXamlAppComponent::Cocos2dEventDelegate^ delegate) { m_delegate = delegate; };
|
void SetXamlEventDelegate(PhoneDirect3DXamlAppComponent::Cocos2dEventDelegate^ delegate) { m_delegate = delegate; };
|
||||||
void SetXamlMessageBoxDelegate(PhoneDirect3DXamlAppComponent::Cocos2dMessageBoxDelegate^ delegate) { m_messageBoxDelegate = delegate; };
|
void SetXamlMessageBoxDelegate(PhoneDirect3DXamlAppComponent::Cocos2dMessageBoxDelegate^ delegate) { m_messageBoxDelegate = delegate; };
|
||||||
|
@ -115,7 +115,7 @@ public:
|
||||||
/**
|
/**
|
||||||
@brief get the shared main open gl window
|
@brief get the shared main open gl window
|
||||||
*/
|
*/
|
||||||
static GLView* sharedOpenGLView();
|
static GLViewImpl* sharedOpenGLView();
|
||||||
|
|
||||||
void ProcessEvents();
|
void ProcessEvents();
|
||||||
void AddPointerEvent(PointerEventType type, Windows::UI::Core::PointerEventArgs^ args);
|
void AddPointerEvent(PointerEventType type, Windows::UI::Core::PointerEventArgs^ args);
|
||||||
|
@ -123,8 +123,8 @@ public:
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
GLView();
|
GLViewImpl();
|
||||||
virtual ~GLView();
|
virtual ~GLViewImpl();
|
||||||
|
|
||||||
bool initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor);
|
bool initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor);
|
||||||
bool initWithFullScreen(const std::string& viewName);
|
bool initWithFullScreen(const std::string& viewName);
|
||||||
|
@ -142,7 +142,7 @@ protected:
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(GLView);
|
CC_DISALLOW_COPY_AND_ASSIGN(GLViewImpl);
|
||||||
|
|
||||||
void OnRendering();
|
void OnRendering();
|
||||||
void UpdateWindowSize();
|
void UpdateWindowSize();
|
||||||
|
@ -187,4 +187,4 @@ private:
|
||||||
|
|
||||||
NS_CC_END
|
NS_CC_END
|
||||||
|
|
||||||
#endif // end of __CC_EGLVIEW_WINRT_H__
|
#endif // end of __CC_EGLVIEWIMPL_WINRT_H__
|
|
@ -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 )
|
bool CCEditBoxImplWp8::initWithSize( const Size& size )
|
||||||
|
|
Loading…
Reference in New Issue