fix winrt complie error

This commit is contained in:
huangshiwu 2014-08-07 18:38:11 +08:00
parent b7aa046cd2
commit 8ee4340db3
9 changed files with 90 additions and 85 deletions

View File

@ -357,6 +357,7 @@
<ClCompile Include="..\base\ccUtils.cpp" /> <ClCompile Include="..\base\ccUtils.cpp" />
<ClCompile Include="..\base\CCValue.cpp" /> <ClCompile Include="..\base\CCValue.cpp" />
<ClCompile Include="..\base\etc1.cpp" /> <ClCompile Include="..\base\etc1.cpp" />
<ClCompile Include="..\base\pvr.cpp" />
<ClCompile Include="..\base\s3tc.cpp" /> <ClCompile Include="..\base\s3tc.cpp" />
<ClCompile Include="..\base\TGAlib.cpp" /> <ClCompile Include="..\base\TGAlib.cpp" />
<ClCompile Include="..\base\ZipUtils.cpp" /> <ClCompile Include="..\base\ZipUtils.cpp" />
@ -388,7 +389,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" />
@ -397,7 +398,7 @@
<ClCompile Include="..\platform\winrt\CCDevice.cpp" /> <ClCompile Include="..\platform\winrt\CCDevice.cpp" />
<ClCompile Include="..\platform\winrt\CCFileUtilsWinRT.cpp" /> <ClCompile Include="..\platform\winrt\CCFileUtilsWinRT.cpp" />
<ClCompile Include="..\platform\winrt\CCFreeTypeFont.cpp" /> <ClCompile Include="..\platform\winrt\CCFreeTypeFont.cpp" />
<ClCompile Include="..\platform\winrt\CCGLView.cpp" /> <ClCompile Include="..\platform\winrt\CCGLViewImpl.cpp" />
<ClCompile Include="..\platform\winrt\CCPrecompiledShaders.cpp" /> <ClCompile Include="..\platform\winrt\CCPrecompiledShaders.cpp" />
<ClCompile Include="..\platform\winrt\CCPThreadWinRT.cpp" /> <ClCompile Include="..\platform\winrt\CCPThreadWinRT.cpp" />
<ClCompile Include="..\platform\winrt\CCStdC.cpp" /> <ClCompile Include="..\platform\winrt\CCStdC.cpp" />
@ -552,6 +553,7 @@
<ClInclude Include="..\base\CCVector.h" /> <ClInclude Include="..\base\CCVector.h" />
<ClInclude Include="..\base\etc1.h" /> <ClInclude Include="..\base\etc1.h" />
<ClInclude Include="..\base\firePngData.h" /> <ClInclude Include="..\base\firePngData.h" />
<ClInclude Include="..\base\pvr.h" />
<ClInclude Include="..\base\s3tc.h" /> <ClInclude Include="..\base\s3tc.h" />
<ClInclude Include="..\base\TGAlib.h" /> <ClInclude Include="..\base\TGAlib.h" />
<ClInclude Include="..\base\uthash.h" /> <ClInclude Include="..\base\uthash.h" />
@ -595,7 +597,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" />
@ -603,7 +605,7 @@
<ClInclude Include="..\platform\winrt\CCFileUtilsWinRT.h" /> <ClInclude Include="..\platform\winrt\CCFileUtilsWinRT.h" />
<ClInclude Include="..\platform\winrt\CCFreeTypeFont.h" /> <ClInclude Include="..\platform\winrt\CCFreeTypeFont.h" />
<ClInclude Include="..\platform\winrt\CCGL.h" /> <ClInclude Include="..\platform\winrt\CCGL.h" />
<ClInclude Include="..\platform\winrt\CCGLView.h" /> <ClInclude Include="..\platform\winrt\CCGLViewImpl.h" />
<ClInclude Include="..\platform\winrt\CCGL_Angle.h" /> <ClInclude Include="..\platform\winrt\CCGL_Angle.h" />
<ClInclude Include="..\platform\winrt\CCPlatformDefine.h" /> <ClInclude Include="..\platform\winrt\CCPlatformDefine.h" />
<ClInclude Include="..\platform\winrt\CCPrecompiledShaders.h" /> <ClInclude Include="..\platform\winrt\CCPrecompiledShaders.h" />

View File

@ -71,9 +71,6 @@
<ClCompile Include="..\platform\winrt\CCFreeTypeFont.cpp"> <ClCompile Include="..\platform\winrt\CCFreeTypeFont.cpp">
<Filter>platform\winrt</Filter> <Filter>platform\winrt</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\platform\winrt\CCGLView.cpp">
<Filter>platform\winrt</Filter>
</ClCompile>
<ClCompile Include="..\platform\winrt\CCPrecompiledShaders.cpp"> <ClCompile Include="..\platform\winrt\CCPrecompiledShaders.cpp">
<Filter>platform\winrt</Filter> <Filter>platform\winrt</Filter>
</ClCompile> </ClCompile>
@ -98,9 +95,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>
@ -410,9 +404,6 @@
<ClCompile Include="..\base\CCUserDefault.cpp"> <ClCompile Include="..\base\CCUserDefault.cpp">
<Filter>base</Filter> <Filter>base</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\base\CCUserDefaultAndroid.cpp">
<Filter>base</Filter>
</ClCompile>
<ClCompile Include="..\base\ccUTF8.cpp"> <ClCompile Include="..\base\ccUTF8.cpp">
<Filter>base</Filter> <Filter>base</Filter>
</ClCompile> </ClCompile>
@ -581,6 +572,15 @@
<ClCompile Include="..\physics\CCPhysicsWorld.cpp"> <ClCompile Include="..\physics\CCPhysicsWorld.cpp">
<Filter>physics</Filter> <Filter>physics</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\platform\CCGLView.cpp">
<Filter>platform</Filter>
</ClCompile>
<ClCompile Include="..\platform\winrt\CCGLViewImpl.cpp">
<Filter>platform\winrt</Filter>
</ClCompile>
<ClCompile Include="..\base\pvr.cpp">
<Filter>base</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\cocos2d.h" /> <ClInclude Include="..\cocos2d.h" />
@ -600,9 +600,6 @@
<ClInclude Include="..\platform\winrt\CCGL_Angle.h"> <ClInclude Include="..\platform\winrt\CCGL_Angle.h">
<Filter>platform\winrt</Filter> <Filter>platform\winrt</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\platform\winrt\CCGLView.h">
<Filter>platform\winrt</Filter>
</ClInclude>
<ClInclude Include="..\platform\winrt\CCPlatformDefine.h"> <ClInclude Include="..\platform\winrt\CCPlatformDefine.h">
<Filter>platform\winrt</Filter> <Filter>platform\winrt</Filter>
</ClInclude> </ClInclude>
@ -645,9 +642,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>
@ -1185,6 +1179,15 @@
<ClInclude Include="..\physics\CCPhysicsWorld.h"> <ClInclude Include="..\physics\CCPhysicsWorld.h">
<Filter>physics</Filter> <Filter>physics</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\platform\CCGLView.h">
<Filter>platform</Filter>
</ClInclude>
<ClInclude Include="..\platform\winrt\CCGLViewImpl.h">
<Filter>platform\winrt</Filter>
</ClInclude>
<ClInclude Include="..\base\pvr.h">
<Filter>base</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="..\base\CCUserDefault.mm"> <None Include="..\base\CCUserDefault.mm">

View File

@ -945,14 +945,14 @@ bool FileUtils::isAbsolutePath(const std::string& path) const
bool FileUtils::isDirectoryExistInternal(const std::string& dirPath) const bool FileUtils::isDirectoryExistInternal(const std::string& dirPath) const
{ {
#if !((CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)) #if (CC_TARGET_PLATFORM != CC_PLATFORM_WIN32) && (CC_TARGET_PLATFORM != CC_PLATFORM_WP8) && (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT)
struct stat st; struct stat st;
if (stat(dirPath.c_str(), &st) == 0) if (stat(dirPath.c_str(), &st) == 0)
{ {
return S_ISDIR(st.st_mode); return S_ISDIR(st.st_mode);
} }
return false; return false;
#elif (CC_TARGET_PLATFORM != CC_PLATFORM_WIN32) #elif (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
WIN32_FILE_ATTRIBUTE_DATA wfad; WIN32_FILE_ATTRIBUTE_DATA wfad;
if (GetFileAttributesExA(dirPath.c_str(), GetFileExInfoStandard, &wfad)) if (GetFileAttributesExA(dirPath.c_str(), GetFileExInfoStandard, &wfad))
{ {
@ -1037,7 +1037,7 @@ bool FileUtils::createDirectory(const std::string& path)
} }
} }
#if !((CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)) #if (CC_TARGET_PLATFORM != CC_PLATFORM_WIN32) && (CC_TARGET_PLATFORM != CC_PLATFORM_WP8) && (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT)
DIR *dir = NULL; DIR *dir = NULL;
// Create path recursively // Create path recursively
@ -1055,7 +1055,7 @@ bool FileUtils::createDirectory(const std::string& path)
} }
} }
return true; return true;
#elif (CC_TARGET_PLATFORM != CC_PLATFORM_WIN32) #elif (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
WIN32_FILE_ATTRIBUTE_DATA wfad; WIN32_FILE_ATTRIBUTE_DATA wfad;
if (!(GetFileAttributesExA(path.c_str(), GetFileExInfoStandard, &wfad))) if (!(GetFileAttributesExA(path.c_str(), GetFileExInfoStandard, &wfad)))
{ {
@ -1098,7 +1098,7 @@ bool FileUtils::removeDirectory(const std::string& path)
} }
// Remove downloaded files // Remove downloaded files
#if !((CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)) #if (CC_TARGET_PLATFORM != CC_PLATFORM_WIN32) && (CC_TARGET_PLATFORM != CC_PLATFORM_WP8) && (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT)
std::string command = "rm -r "; std::string command = "rm -r ";
// Path may include space. // Path may include space.
command += "\"" + path + "\""; command += "\"" + path + "\"";
@ -1106,7 +1106,7 @@ bool FileUtils::removeDirectory(const std::string& path)
return true; return true;
else else
return false; return false;
#elif (CC_TARGET_PLATFORM != CC_PLATFORM_WIN32) #elif (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
if (RemoveDirectoryA(path.c_str())) if (RemoveDirectoryA(path.c_str()))
{ {
return true; return true;
@ -1126,7 +1126,7 @@ bool FileUtils::removeDirectory(const std::string& path)
bool FileUtils::removeFile(const std::string &path) bool FileUtils::removeFile(const std::string &path)
{ {
// Remove downloaded file // Remove downloaded file
#if !((CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)) #if (CC_TARGET_PLATFORM != CC_PLATFORM_WIN32) && (CC_TARGET_PLATFORM != CC_PLATFORM_WP8) && (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT)
std::string command = "rm -f "; std::string command = "rm -f ";
// Path may include space. // Path may include space.
command += "\"" + path + "\""; command += "\"" + path + "\"";
@ -1134,7 +1134,7 @@ bool FileUtils::removeFile(const std::string &path)
return true; return true;
else else
return false; return false;
#elif (CC_TARGET_PLATFORM != CC_PLATFORM_WIN32) #elif (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
if (DeleteFileA(path.c_str())) if (DeleteFileA(path.c_str()))
{ {
return true; return true;

View File

@ -24,7 +24,7 @@ THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#include "CCApplication.h" #include "CCApplication.h"
#if CC_TARGET_PLATFORM == CC_PLATFORM_WINRT #if CC_TARGET_PLATFORM == CC_PLATFORM_WINRT
#include "platform/winrt/CCGLView.h" #include "platform/winrt/CCGLViewImpl.h"
#else #else
#include "platform/wp8/CCGLViewImpl.h" #include "platform/wp8/CCGLViewImpl.h"
#endif #endif

View File

@ -26,7 +26,7 @@ THE SOFTWARE.
#include "base/CCPlatformConfig.h" #include "base/CCPlatformConfig.h"
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) #if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
#include "CCGLView.h" #include "CCGLViewImpl.h"
#include "base/ccMacros.h" #include "base/ccMacros.h"
#include "base/CCDirector.h" #include "base/CCDirector.h"
#include "base/CCTouch.h" #include "base/CCTouch.h"
@ -54,7 +54,7 @@ using namespace Windows::UI::ViewManagement;
NS_CC_BEGIN NS_CC_BEGIN
static GLView* s_pEglView = NULL; static GLViewImpl* s_pEglView = NULL;
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// impliment GLView // impliment GLView
@ -165,7 +165,7 @@ void WinRTWindow::OnSuspending()
void WinRTWindow::ResizeWindow() void WinRTWindow::ResizeWindow()
{ {
GLView::sharedOpenGLView()->UpdateForWindowSizeChange(); GLViewImpl::sharedOpenGLView()->UpdateForWindowSizeChange();
} }
cocos2d::Vec2 WinRTWindow::GetCCPoint(PointerEventArgs^ args) { cocos2d::Vec2 WinRTWindow::GetCCPoint(PointerEventArgs^ args) {
@ -174,7 +174,7 @@ cocos2d::Vec2 WinRTWindow::GetCCPoint(PointerEventArgs^ args) {
float y = getScaledDPIValue(p->Position.Y); float y = getScaledDPIValue(p->Position.Y);
Vec2 pt(x, y); Vec2 pt(x, y);
float zoomFactor = GLView::sharedOpenGLView()->getFrameZoomFactor(); float zoomFactor = GLViewImpl::sharedOpenGLView()->getFrameZoomFactor();
if(zoomFactor > 0.0f) { if(zoomFactor > 0.0f) {
pt.x /= zoomFactor; pt.x /= zoomFactor;
@ -185,12 +185,12 @@ cocos2d::Vec2 WinRTWindow::GetCCPoint(PointerEventArgs^ args) {
void WinRTWindow::ShowKeyboard(InputPane^ inputPane, InputPaneVisibilityEventArgs^ args) void WinRTWindow::ShowKeyboard(InputPane^ inputPane, InputPaneVisibilityEventArgs^ args)
{ {
GLView::sharedOpenGLView()->ShowKeyboard(args->OccludedRect); GLViewImpl::sharedOpenGLView()->ShowKeyboard(args->OccludedRect);
} }
void WinRTWindow::HideKeyboard(InputPane^ inputPane, InputPaneVisibilityEventArgs^ args) void WinRTWindow::HideKeyboard(InputPane^ inputPane, InputPaneVisibilityEventArgs^ args)
{ {
GLView::sharedOpenGLView()->HideKeyboard(args->OccludedRect); GLViewImpl::sharedOpenGLView()->HideKeyboard(args->OccludedRect);
} }
void WinRTWindow::setIMEKeyboardState(bool bOpen) void WinRTWindow::setIMEKeyboardState(bool bOpen)
@ -268,14 +268,14 @@ void WinRTWindow::OnPointerWheelChanged(CoreWindow^ sender, PointerEventArgs^ ar
float direction = (float)args->CurrentPoint->Properties->MouseWheelDelta; float direction = (float)args->CurrentPoint->Properties->MouseWheelDelta;
int id = 0; int id = 0;
Vec2 p(0.0f,0.0f); Vec2 p(0.0f,0.0f);
GLView::sharedOpenGLView()->handleTouchesBegin(1, &id, &p.x, &p.y); GLViewImpl::sharedOpenGLView()->handleTouchesBegin(1, &id, &p.x, &p.y);
p.y += direction; p.y += direction;
GLView::sharedOpenGLView()->handleTouchesMove(1, &id, &p.x, &p.y); GLViewImpl::sharedOpenGLView()->handleTouchesMove(1, &id, &p.x, &p.y);
GLView::sharedOpenGLView()->handleTouchesEnd(1, &id, &p.x, &p.y); GLViewImpl::sharedOpenGLView()->handleTouchesEnd(1, &id, &p.x, &p.y);
} }
// user pressed the Back Key on the phone // user pressed the Back Key on the phone
void GLView::OnBackKeyPress() void GLViewImpl::OnBackKeyPress()
{ {
#if 0 #if 0
if (m_delegate) if (m_delegate)
@ -287,7 +287,7 @@ void GLView::OnBackKeyPress()
} }
void GLView::OnPointerPressed(PointerEventArgs^ args) void GLViewImpl::OnPointerPressed(PointerEventArgs^ args)
{ {
#if 0 #if 0
int id = args->CurrentPoint->PointerId; int id = args->CurrentPoint->PointerId;
@ -296,7 +296,7 @@ void GLView::OnPointerPressed(PointerEventArgs^ args)
#endif #endif
} }
void GLView::OnPointerMoved(PointerEventArgs^ args) void GLViewImpl::OnPointerMoved(PointerEventArgs^ args)
{ {
#if 0 #if 0
auto currentPoint = args->CurrentPoint; auto currentPoint = args->CurrentPoint;
@ -318,7 +318,7 @@ void GLView::OnPointerMoved(PointerEventArgs^ args)
#endif #endif
} }
void GLView::OnPointerReleased(PointerEventArgs^ args) void GLViewImpl::OnPointerReleased(PointerEventArgs^ args)
{ {
#if 0 #if 0
int id = args->CurrentPoint->PointerId; int id = args->CurrentPoint->PointerId;
@ -334,7 +334,7 @@ void WinRTWindow::OnPointerPressed(CoreWindow^ sender, PointerEventArgs^ args)
{ {
int id = args->CurrentPoint->PointerId; int id = args->CurrentPoint->PointerId;
Vec2 pt = GetCCPoint(args); Vec2 pt = GetCCPoint(args);
GLView::sharedOpenGLView()->handleTouchesBegin(1, &id, &pt.x, &pt.y); GLViewImpl::sharedOpenGLView()->handleTouchesBegin(1, &id, &pt.x, &pt.y);
} }
void WinRTWindow::OnPointerMoved(CoreWindow^ sender, PointerEventArgs^ args) void WinRTWindow::OnPointerMoved(CoreWindow^ sender, PointerEventArgs^ args)
@ -346,7 +346,7 @@ void WinRTWindow::OnPointerMoved(CoreWindow^ sender, PointerEventArgs^ args)
{ {
int id = args->CurrentPoint->PointerId; int id = args->CurrentPoint->PointerId;
Vec2 p = GetCCPoint(args); Vec2 p = GetCCPoint(args);
GLView::sharedOpenGLView()->handleTouchesMove(1, &id, &p.x, &p.y); GLViewImpl::sharedOpenGLView()->handleTouchesMove(1, &id, &p.x, &p.y);
} }
m_lastPoint = currentPoint->Position; m_lastPoint = currentPoint->Position;
m_lastPointValid = true; m_lastPointValid = true;
@ -361,38 +361,38 @@ void WinRTWindow::OnPointerReleased(CoreWindow^ sender, PointerEventArgs^ args)
{ {
int id = args->CurrentPoint->PointerId; int id = args->CurrentPoint->PointerId;
Vec2 pt = GetCCPoint(args); Vec2 pt = GetCCPoint(args);
GLView::sharedOpenGLView()->handleTouchesEnd(1, &id, &pt.x, &pt.y); GLViewImpl::sharedOpenGLView()->handleTouchesEnd(1, &id, &pt.x, &pt.y);
} }
void WinRTWindow::OnWindowSizeChanged(CoreWindow^ sender, WindowSizeChangedEventArgs^ args) void WinRTWindow::OnWindowSizeChanged(CoreWindow^ sender, WindowSizeChangedEventArgs^ args)
{ {
ResizeWindow(); ResizeWindow();
GLView::sharedOpenGLView()->UpdateForWindowSizeChange(); GLViewImpl::sharedOpenGLView()->UpdateForWindowSizeChange();
} }
void WinRTWindow::OnLogicalDpiChanged(Object^ sender) void WinRTWindow::OnLogicalDpiChanged(Object^ sender)
{ {
GLView::sharedOpenGLView()->UpdateForWindowSizeChange(); GLViewImpl::sharedOpenGLView()->UpdateForWindowSizeChange();
} }
void WinRTWindow::OnOrientationChanged(Object^ sender) void WinRTWindow::OnOrientationChanged(Object^ sender)
{ {
ResizeWindow(); ResizeWindow();
GLView::sharedOpenGLView()->UpdateForWindowSizeChange(); GLViewImpl::sharedOpenGLView()->UpdateForWindowSizeChange();
} }
void WinRTWindow::OnDisplayContentsInvalidated(Object^ sender) void WinRTWindow::OnDisplayContentsInvalidated(Object^ sender)
{ {
GLView::sharedOpenGLView()->UpdateForWindowSizeChange(); GLViewImpl::sharedOpenGLView()->UpdateForWindowSizeChange();
} }
void WinRTWindow::OnRendering(Object^ sender, Object^ args) void WinRTWindow::OnRendering(Object^ sender, Object^ args)
{ {
GLView::sharedOpenGLView()->OnRendering(); GLViewImpl::sharedOpenGLView()->OnRendering();
} }
GLView::GLView() GLViewImpl::GLViewImpl()
: m_window(nullptr) : m_window(nullptr)
, m_fFrameZoomFactor(1.0f) , m_fFrameZoomFactor(1.0f)
, m_bSupportTouch(false) , m_bSupportTouch(false)
@ -405,7 +405,7 @@ GLView::GLView()
_viewName = "Cocos2dxWinRT"; _viewName = "Cocos2dxWinRT";
} }
GLView::~GLView() GLViewImpl::~GLViewImpl()
{ {
CC_ASSERT(this == s_pEglView); CC_ASSERT(this == s_pEglView);
s_pEglView = NULL; s_pEglView = NULL;
@ -413,7 +413,7 @@ GLView::~GLView()
// TODO: cleanup // TODO: cleanup
} }
bool GLView::Create(CoreWindow^ window, SwapChainBackgroundPanel^ panel) bool GLViewImpl::Create(CoreWindow^ window, SwapChainBackgroundPanel^ panel)
{ {
bool bRet = false; bool bRet = false;
m_window = window; m_window = window;
@ -426,25 +426,25 @@ bool GLView::Create(CoreWindow^ window, SwapChainBackgroundPanel^ panel)
return bRet; return bRet;
} }
bool GLView::isOpenGLReady() bool GLViewImpl::isOpenGLReady()
{ {
// TODO: need to revisit this // TODO: need to revisit this
return (m_window.Get() != nullptr); return (m_window.Get() != nullptr);
} }
void GLView::end() void GLViewImpl::end()
{ {
// TODO: need to implement // TODO: need to implement
} }
void GLView::swapBuffers() void GLViewImpl::swapBuffers()
{ {
m_winRTWindow->swapBuffers(); m_winRTWindow->swapBuffers();
} }
void GLView::setIMEKeyboardState(bool bOpen) void GLViewImpl::setIMEKeyboardState(bool bOpen)
{ {
if(m_winRTWindow) if(m_winRTWindow)
{ {
@ -453,12 +453,12 @@ void GLView::setIMEKeyboardState(bool bOpen)
} }
void GLView::resize(int width, int height) void GLViewImpl::resize(int width, int height)
{ {
} }
void GLView::setFrameZoomFactor(float fZoomFactor) void GLViewImpl::setFrameZoomFactor(float fZoomFactor)
{ {
m_fFrameZoomFactor = fZoomFactor; m_fFrameZoomFactor = fZoomFactor;
resize((int) (_screenSize.width * fZoomFactor), (int) (_screenSize.height * fZoomFactor)); resize((int) (_screenSize.width * fZoomFactor), (int) (_screenSize.height * fZoomFactor));
@ -467,23 +467,23 @@ void GLView::setFrameZoomFactor(float fZoomFactor)
} }
float GLView::getFrameZoomFactor() float GLViewImpl::getFrameZoomFactor()
{ {
return m_fFrameZoomFactor; return m_fFrameZoomFactor;
} }
void GLView::setFrameSize(float width, float height) void GLViewImpl::setFrameSize(float width, float height)
{ {
// not implemented in WinRT. Window is always full screen // not implemented in WinRT. Window is always full screen
// GLViewProtocol::setFrameSize(width, height); // GLViewProtocol::setFrameSize(width, height);
} }
void GLView::centerWindow() void GLViewImpl::centerWindow()
{ {
// not implemented in WinRT. Window is always full screen // not implemented in WinRT. Window is always full screen
} }
void GLView::OnSuspending() void GLViewImpl::OnSuspending()
{ {
if (m_winRTWindow) if (m_winRTWindow)
{ {
@ -491,12 +491,12 @@ void GLView::OnSuspending()
} }
} }
GLView* GLView::sharedOpenGLView() GLViewImpl* GLViewImpl::sharedOpenGLView()
{ {
return s_pEglView; return s_pEglView;
} }
int GLView::Run() int GLViewImpl::Run()
{ {
m_running = true; m_running = true;
@ -504,7 +504,7 @@ int GLView::Run()
}; };
void GLView::OnRendering() void GLViewImpl::OnRendering()
{ {
if(m_running && m_initialized) if(m_running && m_initialized)
{ {
@ -512,7 +512,7 @@ void GLView::OnRendering()
} }
} }
void GLView::HideKeyboard(Windows::Foundation::Rect r) void GLViewImpl::HideKeyboard(Windows::Foundation::Rect r)
{ {
return; // not implemented return; // not implemented
#if 0 #if 0
@ -532,7 +532,7 @@ void GLView::HideKeyboard(Windows::Foundation::Rect r)
#endif #endif
} }
void GLView::ShowKeyboard(Windows::Foundation::Rect r) void GLViewImpl::ShowKeyboard(Windows::Foundation::Rect r)
{ {
return; // not implemented return; // not implemented
#if 0 #if 0
@ -554,7 +554,7 @@ void GLView::ShowKeyboard(Windows::Foundation::Rect r)
} }
void GLView::UpdateForWindowSizeChange() void GLViewImpl::UpdateForWindowSizeChange()
{ {
float width = ConvertDipsToPixels(m_window->Bounds.Width); float width = ConvertDipsToPixels(m_window->Bounds.Width);
float height = ConvertDipsToPixels(m_window->Bounds.Height); float height = ConvertDipsToPixels(m_window->Bounds.Height);
@ -562,18 +562,18 @@ void GLView::UpdateForWindowSizeChange()
if(!m_initialized) if(!m_initialized)
{ {
m_initialized = true; m_initialized = true;
GLViewProtocol::setFrameSize(width, height); GLView::setFrameSize(width, height);
} }
else else
{ {
setFrameSize(width, height); setFrameSize(width, height);
Size designSize = getDesignResolutionSize(); Size designSize = getDesignResolutionSize();
GLView::sharedOpenGLView()->setDesignResolutionSize(designSize.width, designSize.height, ResolutionPolicy::SHOW_ALL); GLViewImpl::sharedOpenGLView()->setDesignResolutionSize(designSize.width, designSize.height, ResolutionPolicy::SHOW_ALL);
Director::sharedDirector()->setProjection(Director::sharedDirector()->getProjection()); Director::sharedDirector()->setProjection(Director::sharedDirector()->getProjection());
} }
} }
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);

View File

@ -23,8 +23,8 @@ 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 "base/CCPlatformConfig.h" #include "base/CCPlatformConfig.h"
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) #if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
@ -33,7 +33,7 @@ THE SOFTWARE.
#include "CCGL.h" #include "CCGL.h"
#include "platform/CCCommon.h" #include "platform/CCCommon.h"
#include "InputEvent.h" #include "InputEvent.h"
#include "platform/CCGLViewProtocol.h" #include "platform/CCGLView.h"
#include <agile.h> #include <agile.h>
#include <wrl/client.h> #include <wrl/client.h>
@ -46,7 +46,7 @@ THE SOFTWARE.
NS_CC_BEGIN NS_CC_BEGIN
class CCEGL; class CCEGL;
class GLView; class GLViewImpl;
ref class WinRTWindow sealed ref class WinRTWindow sealed
{ {
@ -93,14 +93,14 @@ private:
ESContext m_esContext; ESContext m_esContext;
friend GLView; friend GLViewImpl;
}; };
class CC_DLL GLView : public Ref, public GLViewProtocol class CC_DLL GLViewImpl : public GLView
{ {
public: public:
GLView(); GLViewImpl();
virtual ~GLView(); virtual ~GLViewImpl();
/* override functions */ /* override functions */
virtual bool isOpenGLReady(); virtual bool isOpenGLReady();
@ -114,7 +114,7 @@ public:
void UpdateForWindowSizeChange(); void UpdateForWindowSizeChange();
void OnRendering(); void OnRendering();
void OnSuspending(); void OnSuspending();
void GLView::QueueEvent(std::shared_ptr<InputEvent>& event); void GLViewImpl::QueueEvent(std::shared_ptr<InputEvent>& event);
void OnPointerPressed(Windows::UI::Core::PointerEventArgs^ args); void OnPointerPressed(Windows::UI::Core::PointerEventArgs^ args);
void OnPointerMoved(Windows::UI::Core::PointerEventArgs^ args); void OnPointerMoved(Windows::UI::Core::PointerEventArgs^ args);
@ -148,7 +148,7 @@ public:
/** /**
@brief get the shared main open gl window @brief get the shared main open gl window
*/ */
static GLView* sharedOpenGLView(); static GLViewImpl* sharedOpenGLView();
protected: protected:
@ -169,4 +169,4 @@ NS_CC_END
#endif // (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) #endif // (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
#endif // end of __CC_EGLVIEW_WINRT_H__ #endif // end of __CC_EGLVIEWIMPL_WINRT_H__

View File

@ -24,7 +24,7 @@ THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#include "InputEvent.h" #include "InputEvent.h"
#include "CCGLView.h" #include "CCGLViewImpl.h"
#include "base/CCEventAcceleration.h" #include "base/CCEventAcceleration.h"
NS_CC_BEGIN NS_CC_BEGIN

View File

@ -26,7 +26,7 @@ THE SOFTWARE.
#include "Cocos2dRenderer.h" #include "Cocos2dRenderer.h"
#include "cocos2d.h" #include "cocos2d.h"
#include "CCApplication.h" #include "CCApplication.h"
#include "CCGLView.h" #include "CCGLViewImpl.h"
#include "AppDelegate.h" #include "AppDelegate.h"
#include <ppltasks.h> #include <ppltasks.h>

View File

@ -24,7 +24,7 @@ THE SOFTWARE.
#include "CCEditBoxImplWp8.h" #include "CCEditBoxImplWp8.h"
#include "CCEditBox.h" #include "CCEditBox.h"
#include "CCGLView.h" #include "CCGLViewImpl.h"
#include "base/CCScriptSupport.h" #include "base/CCScriptSupport.h"
#include "base/ccUTF8.h" #include "base/ccUTF8.h"