From 77c00bc77f6ca577c205ad28693fe4acd26d3150 Mon Sep 17 00:00:00 2001 From: Dale Stammen Date: Mon, 27 Oct 2014 08:32:19 -0700 Subject: [PATCH 01/15] removed use of std::mutex. Now using lock-free concurrent_queue --- cocos/platform/winrt/CCGLViewImpl-winrt.cpp | 11 +++-------- cocos/platform/winrt/CCGLViewImpl-winrt.h | 7 ++++--- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/cocos/platform/winrt/CCGLViewImpl-winrt.cpp b/cocos/platform/winrt/CCGLViewImpl-winrt.cpp index 4526c07091..2447517136 100644 --- a/cocos/platform/winrt/CCGLViewImpl-winrt.cpp +++ b/cocos/platform/winrt/CCGLViewImpl-winrt.cpp @@ -33,6 +33,7 @@ THE SOFTWARE. #include "deprecated/CCNotificationCenter.h" using namespace Platform; +using namespace Concurrency; using namespace Windows::Foundation; using namespace Windows::Foundation::Collections; using namespace Windows::Graphics::Display; @@ -454,33 +455,27 @@ void GLViewImpl::setScissorInPoints(float x , float y , float w , float h) void GLViewImpl::QueueBackKeyPress() { - std::lock_guard guard(mMutex); std::shared_ptr e(new BackButtonEvent()); mInputEvents.push(e); } void GLViewImpl::QueuePointerEvent(PointerEventType type, PointerEventArgs^ args) { - std::lock_guard guard(mMutex); std::shared_ptr e(new PointerEvent(type, args)); mInputEvents.push(e); } void GLViewImpl::QueueEvent(std::shared_ptr& event) { - std::lock_guard guard(mMutex); mInputEvents.push(event); } void GLViewImpl::ProcessEvents() { - std::lock_guard guard(mMutex); - - while (!mInputEvents.empty()) + std::shared_ptr e; + while (mInputEvents.try_pop(e)) { - InputEvent* e = mInputEvents.front().get(); e->execute(); - mInputEvents.pop(); } } diff --git a/cocos/platform/winrt/CCGLViewImpl-winrt.h b/cocos/platform/winrt/CCGLViewImpl-winrt.h index 33eac1cfbe..6cca0524ff 100644 --- a/cocos/platform/winrt/CCGLViewImpl-winrt.h +++ b/cocos/platform/winrt/CCGLViewImpl-winrt.h @@ -33,9 +33,9 @@ THE SOFTWARE. #include +#include #include #include -#include #include #include @@ -156,8 +156,9 @@ private: Cocos2dMessageBoxDelegate^ m_messageBoxDelegate; Cocos2dEditBoxDelegate^ m_editBoxDelegate; - std::queue> mInputEvents; - std::mutex mMutex; + Concurrency::concurrent_queue> mInputEvents; + //std::queue> mInputEvents; + //Concurrency::critical_section m_criticalSection; Platform::Agile m_dispatcher; Platform::Agile m_panel; From 6fb69870f99a086ac19dde8daa0277c93d7377f0 Mon Sep 17 00:00:00 2001 From: Dale Stammen Date: Mon, 27 Oct 2014 10:57:57 -0700 Subject: [PATCH 02/15] fixed compiler warnings for winrt code --- cocos/platform/CCFileUtils.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/cocos/platform/CCFileUtils.cpp b/cocos/platform/CCFileUtils.cpp index e137e32df8..f6038d5774 100644 --- a/cocos/platform/CCFileUtils.cpp +++ b/cocos/platform/CCFileUtils.cpp @@ -543,7 +543,7 @@ static Data getData(const std::string& filename, bool forString) Data ret; unsigned char* buffer = nullptr; - ssize_t size = 0; + size_t size = 0; size_t readsize; const char* mode = nullptr; if (forString) @@ -1062,7 +1062,7 @@ bool FileUtils::createDirectory(const std::string& path) if (!(GetFileAttributesEx(wpath.c_str(), GetFileExInfoStandard, &wfad))) { subpath = ""; - for(int i = 0 ; i < dirs.size() ; ++i) + for(unsigned int i = 0 ; i < dirs.size() ; ++i) { subpath += dirs[i]; if (i > 0 && !isDirectoryExist(subpath)) @@ -1146,7 +1146,7 @@ bool FileUtils::removeDirectory(const std::string& path) bool ret=true; if (search!=INVALID_HANDLE_VALUE) { - bool find=true; + BOOL find=true; while (find) { //. .. @@ -1168,8 +1168,10 @@ bool FileUtils::removeDirectory(const std::string& path) } FindClose(search); } - if (ret) - return RemoveDirectory(wpath.c_str()); + if (ret && RemoveDirectory(wpath.c_str())) + { + return true; + } return false; #elif (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) std::string command = "cmd /c rd /s /q "; From 2eccd58d45c22220b1925503854d748c18f13fb0 Mon Sep 17 00:00:00 2001 From: Dale Stammen Date: Mon, 27 Oct 2014 11:07:00 -0700 Subject: [PATCH 03/15] added DPI support for universal app --- .../win8.1-universal/Cocos2dRenderer.cpp | 27 ++++++++++++------- .../win8.1-universal/Cocos2dRenderer.h | 12 +++++---- .../win8.1-universal/OpenGLESPage.xaml.cpp | 11 +++++--- .../win8.1-universal/OpenGLESPage.xaml.h | 2 ++ cocos/platform/winrt/CCDevice.cpp | 4 +++ cocos/platform/winrt/CCGLViewImpl-winrt.cpp | 3 ++- cocos/platform/winrt/CCGLViewImpl-winrt.h | 14 +++++----- 7 files changed, 48 insertions(+), 25 deletions(-) diff --git a/cocos/platform/win8.1-universal/Cocos2dRenderer.cpp b/cocos/platform/win8.1-universal/Cocos2dRenderer.cpp index e0c02e3ee8..b2f89bdaa0 100644 --- a/cocos/platform/win8.1-universal/Cocos2dRenderer.cpp +++ b/cocos/platform/win8.1-universal/Cocos2dRenderer.cpp @@ -35,14 +35,15 @@ using namespace Windows::Graphics::Display; USING_NS_CC; -Cocos2dRenderer::Cocos2dRenderer(const int width, const int height, CoreDispatcher^ dispatcher, Panel^ panel) - : mApp(nullptr) - , mWidth(width) - , mHeight(height) +Cocos2dRenderer::Cocos2dRenderer(int width, int height, float dpi, CoreDispatcher^ dispatcher, Panel^ panel) + : m_app(nullptr) + , m_width(width) + , m_height(height) + , m_dpi(dpi) , m_dispatcher(dispatcher) , m_panel(panel) { - mApp = new AppDelegate(); + m_app = new AppDelegate(); auto director = cocos2d::Director::getInstance(); GLViewImpl* glview = GLViewImpl::create("Test Cpp"); @@ -55,19 +56,25 @@ Cocos2dRenderer::Cocos2dRenderer(const int width, const int height, CoreDispatch Cocos2dRenderer::~Cocos2dRenderer() { - delete mApp; + delete m_app; } // Draws a basic triangle -void Cocos2dRenderer::Draw(GLsizei width, GLsizei height) +void Cocos2dRenderer::Draw(GLsizei width, GLsizei height, float dpi) { - if (width != mWidth || height != mHeight) + if (width != m_width || height != m_height) { - mWidth = width; - mHeight = height; + m_width = width; + m_height = height; GLViewImpl::sharedOpenGLView()->UpdateForWindowSizeChange(static_cast(width), static_cast(height)); } + if (dpi != m_dpi) + { + m_dpi = dpi; + GLViewImpl::sharedOpenGLView()->UpdateDPI(m_dpi); + } + GLViewImpl::sharedOpenGLView()->ProcessEvents(); GLViewImpl::sharedOpenGLView()->Render(); } diff --git a/cocos/platform/win8.1-universal/Cocos2dRenderer.h b/cocos/platform/win8.1-universal/Cocos2dRenderer.h index 387445f6d5..b8d63d60b1 100644 --- a/cocos/platform/win8.1-universal/Cocos2dRenderer.h +++ b/cocos/platform/win8.1-universal/Cocos2dRenderer.h @@ -29,18 +29,20 @@ namespace cocos2d class Cocos2dRenderer { public: - Cocos2dRenderer(const int width, const int height, Windows::UI::Core::CoreDispatcher^ dispathcer, Windows::UI::Xaml::Controls::Panel^ panel); + Cocos2dRenderer( int width, int height, float dpi, Windows::UI::Core::CoreDispatcher^ dispathcer, Windows::UI::Xaml::Controls::Panel^ panel); ~Cocos2dRenderer(); - void Draw(GLsizei width, GLsizei height); + void Draw(GLsizei width, GLsizei height, float dpi); void QueuePointerEvent(PointerEventType type, Windows::UI::Core::PointerEventArgs^ args); void QueueKeyBoardEvent(Cocos2dKeyEvent type, Windows::UI::Core::KeyEventArgs^ e); private: - int mWidth; - int mHeight; + int m_width; + int m_height; + float m_dpi; + // The AppDelegate for the Cocos2D app - AppDelegate* mApp; + AppDelegate* m_app; Platform::Agile m_dispatcher; Platform::Agile m_panel; }; diff --git a/cocos/platform/win8.1-universal/OpenGLESPage.xaml.cpp b/cocos/platform/win8.1-universal/OpenGLESPage.xaml.cpp index c8ee9afb42..dd3aeeb72a 100644 --- a/cocos/platform/win8.1-universal/OpenGLESPage.xaml.cpp +++ b/cocos/platform/win8.1-universal/OpenGLESPage.xaml.cpp @@ -47,7 +47,8 @@ OpenGLESPage::OpenGLESPage(OpenGLES* openGLES) : mRenderSurface(EGL_NO_SURFACE), mCustomRenderSurfaceSize(0,0), mUseCustomRenderSurfaceSize(false), - m_coreInput(nullptr) + m_coreInput(nullptr), + m_dpi(0.0f) { InitializeComponent(); @@ -238,16 +239,20 @@ void OpenGLESPage::StartRenderLoop() GLsizei panelHeight = 0; GetSwapChainPanelSize(&panelWidth, &panelHeight); + DisplayInformation^ currentDisplayInformation = DisplayInformation::GetForCurrentView(); + + m_dpi = currentDisplayInformation->LogicalDpi; + if (m_renderer.get() == nullptr) { - m_renderer = std::make_shared(panelWidth, panelHeight, dispatcher, swapChainPanel); + m_renderer = std::make_shared(panelWidth, panelHeight, m_dpi, dispatcher, swapChainPanel); } while (action->Status == Windows::Foundation::AsyncStatus::Started) { GetSwapChainPanelSize(&panelWidth, &panelHeight); - m_renderer.get()->Draw(panelWidth, panelHeight); + m_renderer.get()->Draw(panelWidth, panelHeight, m_dpi); // The call to eglSwapBuffers might not be successful (i.e. due to Device Lost) // If the call fails, then we must reinitialize EGL and the GL resources. diff --git a/cocos/platform/win8.1-universal/OpenGLESPage.xaml.h b/cocos/platform/win8.1-universal/OpenGLESPage.xaml.h index d8ddccc63e..9b65e475b3 100644 --- a/cocos/platform/win8.1-universal/OpenGLESPage.xaml.h +++ b/cocos/platform/win8.1-universal/OpenGLESPage.xaml.h @@ -67,5 +67,7 @@ namespace cocos2d void OnPointerPressed(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e); void OnPointerMoved(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e); void OnPointerReleased(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e); + + float m_dpi; }; } diff --git a/cocos/platform/winrt/CCDevice.cpp b/cocos/platform/winrt/CCDevice.cpp index 46b631ea4d..1bde53583a 100644 --- a/cocos/platform/winrt/CCDevice.cpp +++ b/cocos/platform/winrt/CCDevice.cpp @@ -42,8 +42,12 @@ CCFreeTypeFont sFT; int Device::getDPI() { +#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8 static const float dipsPerInch = 96.0f; return floor(DisplayProperties::LogicalDpi / dipsPerInch + 0.5f); // Round to nearest integer. +#else + return cocos2d::GLViewImpl::sharedOpenGLView()->GetDPI(); +#endif } static Accelerometer^ sAccelerometer = nullptr; diff --git a/cocos/platform/winrt/CCGLViewImpl-winrt.cpp b/cocos/platform/winrt/CCGLViewImpl-winrt.cpp index 2447517136..d9ee1f4fe5 100644 --- a/cocos/platform/winrt/CCGLViewImpl-winrt.cpp +++ b/cocos/platform/winrt/CCGLViewImpl-winrt.cpp @@ -108,9 +108,10 @@ bool GLViewImpl::initWithFullScreen(const std::string& viewName) } -bool GLViewImpl::Create(float width, float height, DisplayOrientations orientation) +bool GLViewImpl::Create(float width, float height, float dpi, DisplayOrientations orientation) { m_orientation = orientation; + m_dpi = dpi; UpdateForWindowSizeChange(width, height); return true; } diff --git a/cocos/platform/winrt/CCGLViewImpl-winrt.h b/cocos/platform/winrt/CCGLViewImpl-winrt.h index 6cca0524ff..942a67552d 100644 --- a/cocos/platform/winrt/CCGLViewImpl-winrt.h +++ b/cocos/platform/winrt/CCGLViewImpl-winrt.h @@ -35,8 +35,8 @@ THE SOFTWARE. #include #include #include +#include #include -#include #include NS_CC_BEGIN @@ -61,7 +61,7 @@ public: virtual void setIMEKeyboardState(bool bOpen); virtual void setIMEKeyboardState(bool bOpen, std::string str); - virtual bool Create(float width, float height ,Windows::Graphics::Display::DisplayOrientations orientation); + virtual bool Create(float width, float height, float dpi, Windows::Graphics::Display::DisplayOrientations orientation); void setDispatcher(Windows::UI::Core::CoreDispatcher^ dispatcher); Windows::UI::Core::CoreDispatcher^ getDispatcher() {return m_dispatcher.Get();} @@ -97,8 +97,11 @@ public: void centerWindow(); void UpdateOrientation(Windows::Graphics::Display::DisplayOrientations orientation); - void UpdateForWindowSizeChange(float width, float height); - + void UpdateForWindowSizeChange(float width, float height); + + void SetDPI(float dpi) { m_dpi = dpi; } + float GetDPI() { return m_dpi; } + // static function /** @brief get the shared main open gl window @@ -141,6 +144,7 @@ private: float m_width; float m_height; + float m_dpi; Windows::Graphics::Display::DisplayOrientations m_orientation; Windows::Foundation::Rect m_keyboardRect; @@ -157,8 +161,6 @@ private: Cocos2dEditBoxDelegate^ m_editBoxDelegate; Concurrency::concurrent_queue> mInputEvents; - //std::queue> mInputEvents; - //Concurrency::critical_section m_criticalSection; Platform::Agile m_dispatcher; Platform::Agile m_panel; From b4831621280a45d2ac07f4bb77ebf3b460dc4c4c Mon Sep 17 00:00:00 2001 From: Dale Stammen Date: Mon, 27 Oct 2014 11:07:27 -0700 Subject: [PATCH 04/15] added ignore warning 4756 --- cocos/2d/winrt_8.1_props/cocos2d_winrt_8.1.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos/2d/winrt_8.1_props/cocos2d_winrt_8.1.props b/cocos/2d/winrt_8.1_props/cocos2d_winrt_8.1.props index cd169e5074..9a2f6f4ea3 100644 --- a/cocos/2d/winrt_8.1_props/cocos2d_winrt_8.1.props +++ b/cocos/2d/winrt_8.1_props/cocos2d_winrt_8.1.props @@ -15,7 +15,7 @@ true false OldStyle - 4056;4996;4244;4251; + 4056;4996;4244;4251;4756; libGLESv2.lib;libEGL.lib;ws2_32.lib;libwebsockets.lib;libcurl.lib;libchipmunk.lib;zlib.lib;libpng.lib;libjpeg.lib;libtiff.lib;freetype250.lib;sqlite3.lib;d2d1.lib;d3d11.lib;dxgi.lib;windowscodecs.lib;dwrite.lib;dxguid.lib;xaudio2.lib;mfcore.lib;mfplat.lib;mfreadwrite.lib;mfuuid.lib;%(AdditionalDependencies) From 4dd48d5020b5c2f07dceb95230c3eeb37ebf8b1b Mon Sep 17 00:00:00 2001 From: Dale Stammen Date: Mon, 27 Oct 2014 11:08:22 -0700 Subject: [PATCH 05/15] removed mutex. use concurrent_queue for events --- cocos/platform/wp8/CCGLViewImpl-wp8.cpp | 10 ++-------- cocos/platform/wp8/CCGLViewImpl-wp8.h | 7 ++----- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/cocos/platform/wp8/CCGLViewImpl-wp8.cpp b/cocos/platform/wp8/CCGLViewImpl-wp8.cpp index 3f77cc1f73..6c6835aecc 100644 --- a/cocos/platform/wp8/CCGLViewImpl-wp8.cpp +++ b/cocos/platform/wp8/CCGLViewImpl-wp8.cpp @@ -531,33 +531,27 @@ void GLViewImpl::setScissorInPoints(float x , float y , float w , float h) void GLViewImpl::QueueBackKeyPress() { - std::lock_guard guard(mMutex); std::shared_ptr e(new BackButtonEvent()); mInputEvents.push(e); } void GLViewImpl::QueuePointerEvent(PointerEventType type, PointerEventArgs^ args) { - std::lock_guard guard(mMutex); std::shared_ptr e(new PointerEvent(type, args)); mInputEvents.push(e); } void GLViewImpl::QueueEvent(std::shared_ptr& event) { - std::lock_guard guard(mMutex); mInputEvents.push(event); } void GLViewImpl::ProcessEvents() { - std::lock_guard guard(mMutex); - - while (!mInputEvents.empty()) + std::shared_ptr e; + while (mInputEvents.try_pop(e)) { - InputEvent* e = mInputEvents.front().get(); e->execute(); - mInputEvents.pop(); } } diff --git a/cocos/platform/wp8/CCGLViewImpl-wp8.h b/cocos/platform/wp8/CCGLViewImpl-wp8.h index e48c9ce21d..d734f1cfeb 100644 --- a/cocos/platform/wp8/CCGLViewImpl-wp8.h +++ b/cocos/platform/wp8/CCGLViewImpl-wp8.h @@ -36,8 +36,7 @@ THE SOFTWARE. #include #include -#include -#include +#include #include #include @@ -182,9 +181,7 @@ private: Cocos2dMessageBoxDelegate^ m_messageBoxDelegate; Cocos2dEditBoxDelegate^ m_editBoxDelegate; - std::queue> mInputEvents; - std::mutex mMutex; - + Concurrency::concurrent_queue> mInputEvents; }; NS_CC_END From 6d46ee8f3d083836fe80816157830232742b0bed Mon Sep 17 00:00:00 2001 From: Dale Stammen Date: Mon, 27 Oct 2014 11:09:27 -0700 Subject: [PATCH 06/15] fixed location of renderer filter --- cocos/2d/libcocos2d_wp8.vcxproj.filters | 142 ++++++++++++------------ 1 file changed, 71 insertions(+), 71 deletions(-) diff --git a/cocos/2d/libcocos2d_wp8.vcxproj.filters b/cocos/2d/libcocos2d_wp8.vcxproj.filters index b71852073f..b342af5218 100644 --- a/cocos/2d/libcocos2d_wp8.vcxproj.filters +++ b/cocos/2d/libcocos2d_wp8.vcxproj.filters @@ -53,12 +53,6 @@ {a2fd6c36-9078-45e7-bc11-c235357f565e} - - {c52c9563-bc10-4b77-8bcc-0e061628fae7} - - - {1be811ab-a9b0-44f7-9a37-b7ef7f1ef24a} - {794d19d1-2992-497a-a770-081932fa9242} @@ -236,6 +230,12 @@ {b7fdf4e2-b3be-4b7a-b586-ddab39fb05b7} + + {c52c9563-bc10-4b77-8bcc-0e061628fae7} + + + {1be811ab-a9b0-44f7-9a37-b7ef7f1ef24a} + @@ -782,67 +782,67 @@ platform\winrt - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer @@ -1932,70 +1932,70 @@ platform\winrt - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer - platform\renderer + renderer cocosbuilder\Header Files @@ -2586,70 +2586,70 @@ math - platform\renderer\shaders + renderer\shaders - platform\renderer\shaders + renderer\shaders - platform\renderer\shaders + renderer\shaders - platform\renderer\shaders + renderer\shaders - platform\renderer\shaders + renderer\shaders - platform\renderer\shaders + renderer\shaders - platform\renderer\shaders + renderer\shaders - platform\renderer\shaders + renderer\shaders - platform\renderer\shaders + renderer\shaders - platform\renderer\shaders + renderer\shaders - platform\renderer\shaders + renderer\shaders - platform\renderer\shaders + renderer\shaders - platform\renderer\shaders + renderer\shaders - platform\renderer\shaders + renderer\shaders - platform\renderer\shaders + renderer\shaders - platform\renderer\shaders + renderer\shaders - platform\renderer\shaders + renderer\shaders - platform\renderer\shaders + renderer\shaders - platform\renderer\shaders + renderer\shaders - platform\renderer\shaders + renderer\shaders - platform\renderer\shaders + renderer\shaders - platform\renderer\shaders + renderer\shaders \ No newline at end of file From 510c8caed7311b51f55d042f53b0deb7d591d0d2 Mon Sep 17 00:00:00 2001 From: Dale Stammen Date: Mon, 27 Oct 2014 11:12:54 -0700 Subject: [PATCH 07/15] added DPI support for universal app --- .../win8.1-universal/Cocos2dRenderer.cpp | 4 +-- .../HelloCpp.Shared/Cocos2dRenderer.cpp | 29 ++++++++++++------- .../HelloCpp.Shared/Cocos2dRenderer.h | 12 ++++---- .../HelloCpp.Shared/OpenGLESPage.xaml.cpp | 11 +++++-- .../HelloCpp.Shared/OpenGLESPage.xaml.h | 2 ++ 5 files changed, 37 insertions(+), 21 deletions(-) diff --git a/cocos/platform/win8.1-universal/Cocos2dRenderer.cpp b/cocos/platform/win8.1-universal/Cocos2dRenderer.cpp index b2f89bdaa0..e25f12576e 100644 --- a/cocos/platform/win8.1-universal/Cocos2dRenderer.cpp +++ b/cocos/platform/win8.1-universal/Cocos2dRenderer.cpp @@ -49,7 +49,7 @@ Cocos2dRenderer::Cocos2dRenderer(int width, int height, float dpi, CoreDispatche GLViewImpl* glview = GLViewImpl::create("Test Cpp"); glview->setDispatcher(dispatcher); glview->setPanel(panel); - glview->Create(static_cast(width), static_cast(height), DisplayOrientations::Landscape); + glview->Create(static_cast(width), static_cast(height), dpi, DisplayOrientations::Landscape); director->setOpenGLView(glview); CCApplication::getInstance()->run(); } @@ -72,7 +72,7 @@ void Cocos2dRenderer::Draw(GLsizei width, GLsizei height, float dpi) if (dpi != m_dpi) { m_dpi = dpi; - GLViewImpl::sharedOpenGLView()->UpdateDPI(m_dpi); + GLViewImpl::sharedOpenGLView()->SetDPI(m_dpi); } GLViewImpl::sharedOpenGLView()->ProcessEvents(); diff --git a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/Cocos2dRenderer.cpp b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/Cocos2dRenderer.cpp index e0c02e3ee8..e25f12576e 100644 --- a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/Cocos2dRenderer.cpp +++ b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/Cocos2dRenderer.cpp @@ -35,39 +35,46 @@ using namespace Windows::Graphics::Display; USING_NS_CC; -Cocos2dRenderer::Cocos2dRenderer(const int width, const int height, CoreDispatcher^ dispatcher, Panel^ panel) - : mApp(nullptr) - , mWidth(width) - , mHeight(height) +Cocos2dRenderer::Cocos2dRenderer(int width, int height, float dpi, CoreDispatcher^ dispatcher, Panel^ panel) + : m_app(nullptr) + , m_width(width) + , m_height(height) + , m_dpi(dpi) , m_dispatcher(dispatcher) , m_panel(panel) { - mApp = new AppDelegate(); + m_app = new AppDelegate(); auto director = cocos2d::Director::getInstance(); GLViewImpl* glview = GLViewImpl::create("Test Cpp"); glview->setDispatcher(dispatcher); glview->setPanel(panel); - glview->Create(static_cast(width), static_cast(height), DisplayOrientations::Landscape); + glview->Create(static_cast(width), static_cast(height), dpi, DisplayOrientations::Landscape); director->setOpenGLView(glview); CCApplication::getInstance()->run(); } Cocos2dRenderer::~Cocos2dRenderer() { - delete mApp; + delete m_app; } // Draws a basic triangle -void Cocos2dRenderer::Draw(GLsizei width, GLsizei height) +void Cocos2dRenderer::Draw(GLsizei width, GLsizei height, float dpi) { - if (width != mWidth || height != mHeight) + if (width != m_width || height != m_height) { - mWidth = width; - mHeight = height; + m_width = width; + m_height = height; GLViewImpl::sharedOpenGLView()->UpdateForWindowSizeChange(static_cast(width), static_cast(height)); } + if (dpi != m_dpi) + { + m_dpi = dpi; + GLViewImpl::sharedOpenGLView()->SetDPI(m_dpi); + } + GLViewImpl::sharedOpenGLView()->ProcessEvents(); GLViewImpl::sharedOpenGLView()->Render(); } diff --git a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/Cocos2dRenderer.h b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/Cocos2dRenderer.h index 387445f6d5..b8d63d60b1 100644 --- a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/Cocos2dRenderer.h +++ b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/Cocos2dRenderer.h @@ -29,18 +29,20 @@ namespace cocos2d class Cocos2dRenderer { public: - Cocos2dRenderer(const int width, const int height, Windows::UI::Core::CoreDispatcher^ dispathcer, Windows::UI::Xaml::Controls::Panel^ panel); + Cocos2dRenderer( int width, int height, float dpi, Windows::UI::Core::CoreDispatcher^ dispathcer, Windows::UI::Xaml::Controls::Panel^ panel); ~Cocos2dRenderer(); - void Draw(GLsizei width, GLsizei height); + void Draw(GLsizei width, GLsizei height, float dpi); void QueuePointerEvent(PointerEventType type, Windows::UI::Core::PointerEventArgs^ args); void QueueKeyBoardEvent(Cocos2dKeyEvent type, Windows::UI::Core::KeyEventArgs^ e); private: - int mWidth; - int mHeight; + int m_width; + int m_height; + float m_dpi; + // The AppDelegate for the Cocos2D app - AppDelegate* mApp; + AppDelegate* m_app; Platform::Agile m_dispatcher; Platform::Agile m_panel; }; diff --git a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/OpenGLESPage.xaml.cpp b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/OpenGLESPage.xaml.cpp index c8ee9afb42..dd3aeeb72a 100644 --- a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/OpenGLESPage.xaml.cpp +++ b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/OpenGLESPage.xaml.cpp @@ -47,7 +47,8 @@ OpenGLESPage::OpenGLESPage(OpenGLES* openGLES) : mRenderSurface(EGL_NO_SURFACE), mCustomRenderSurfaceSize(0,0), mUseCustomRenderSurfaceSize(false), - m_coreInput(nullptr) + m_coreInput(nullptr), + m_dpi(0.0f) { InitializeComponent(); @@ -238,16 +239,20 @@ void OpenGLESPage::StartRenderLoop() GLsizei panelHeight = 0; GetSwapChainPanelSize(&panelWidth, &panelHeight); + DisplayInformation^ currentDisplayInformation = DisplayInformation::GetForCurrentView(); + + m_dpi = currentDisplayInformation->LogicalDpi; + if (m_renderer.get() == nullptr) { - m_renderer = std::make_shared(panelWidth, panelHeight, dispatcher, swapChainPanel); + m_renderer = std::make_shared(panelWidth, panelHeight, m_dpi, dispatcher, swapChainPanel); } while (action->Status == Windows::Foundation::AsyncStatus::Started) { GetSwapChainPanelSize(&panelWidth, &panelHeight); - m_renderer.get()->Draw(panelWidth, panelHeight); + m_renderer.get()->Draw(panelWidth, panelHeight, m_dpi); // The call to eglSwapBuffers might not be successful (i.e. due to Device Lost) // If the call fails, then we must reinitialize EGL and the GL resources. diff --git a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/OpenGLESPage.xaml.h b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/OpenGLESPage.xaml.h index d8ddccc63e..9b65e475b3 100644 --- a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/OpenGLESPage.xaml.h +++ b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/OpenGLESPage.xaml.h @@ -67,5 +67,7 @@ namespace cocos2d void OnPointerPressed(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e); void OnPointerMoved(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e); void OnPointerReleased(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e); + + float m_dpi; }; } From 5b69a55121cabaec8ec957dd89fb496901dad5c5 Mon Sep 17 00:00:00 2001 From: Dale Stammen Date: Mon, 27 Oct 2014 11:16:14 -0700 Subject: [PATCH 08/15] added check for WP8_SHADER_COMPILER --- cocos/platform/winrt/CCPrecompiledShaders.cpp | 2 +- cocos/platform/winrt/CCPrecompiledShaders.h | 11 +---------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/cocos/platform/winrt/CCPrecompiledShaders.cpp b/cocos/platform/winrt/CCPrecompiledShaders.cpp index da7c40080b..472c8f248a 100644 --- a/cocos/platform/winrt/CCPrecompiledShaders.cpp +++ b/cocos/platform/winrt/CCPrecompiledShaders.cpp @@ -192,7 +192,7 @@ bool CCPrecompiledShaders::addProgram(GLuint program, const std::string& id) return true; } -#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) +#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) && defined(WP8_SHADER_COMPILER) void CCPrecompiledShaders::savePrecompiledPrograms(Windows::Storage::StorageFolder^ folder) { diff --git a/cocos/platform/winrt/CCPrecompiledShaders.h b/cocos/platform/winrt/CCPrecompiledShaders.h index d1dba0896a..6d8dc289d8 100644 --- a/cocos/platform/winrt/CCPrecompiledShaders.h +++ b/cocos/platform/winrt/CCPrecompiledShaders.h @@ -48,14 +48,6 @@ typedef struct _CompiledProgram int length; } CompiledProgram; -#if 0 - -const unsigned char gKey[] = "hello"; -const unsigned char gProgram[] = "world"; -PrecompiledShader gFoo = {gKey, gProgram, 100}; - -PrecompiledShader shaders[] = {gFoo, gFoo}; -#endif class CC_DLL CCPrecompiledShaders { @@ -63,7 +55,6 @@ public: CCPrecompiledShaders(); virtual ~CCPrecompiledShaders(); - /** @brief Get current precompiled shaders instance. @return Current precompiled shaders instance pointer. @@ -77,7 +68,7 @@ public: bool loadProgram(GLuint program, const GLchar* vShaderByteArray, const GLchar* fShaderByteArray); -#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) +#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) && defined(WP8_SHADER_COMPILER) void savePrecompiledShaders(); #endif From af14b40ba056b585e6e9bf12e3c2ee30663e3244 Mon Sep 17 00:00:00 2001 From: Dale Stammen Date: Mon, 27 Oct 2014 13:40:19 -0700 Subject: [PATCH 09/15] must call DisplayInformation::GetForCurrentView() from main UI thread --- cocos/platform/win8.1-universal/OpenGLESPage.xaml.cpp | 5 +++-- .../HelloCpp.Shared/OpenGLESPage.xaml.cpp | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cocos/platform/win8.1-universal/OpenGLESPage.xaml.cpp b/cocos/platform/win8.1-universal/OpenGLESPage.xaml.cpp index dd3aeeb72a..71f3c692e9 100644 --- a/cocos/platform/win8.1-universal/OpenGLESPage.xaml.cpp +++ b/cocos/platform/win8.1-universal/OpenGLESPage.xaml.cpp @@ -226,6 +226,9 @@ void OpenGLESPage::StartRenderLoop() return; } + DisplayInformation^ currentDisplayInformation = DisplayInformation::GetForCurrentView(); + m_dpi = currentDisplayInformation->LogicalDpi; + auto dispatcher = Windows::UI::Xaml::Window::Current->CoreWindow->Dispatcher; // Create a task for rendering that will be run on a background thread. @@ -239,9 +242,7 @@ void OpenGLESPage::StartRenderLoop() GLsizei panelHeight = 0; GetSwapChainPanelSize(&panelWidth, &panelHeight); - DisplayInformation^ currentDisplayInformation = DisplayInformation::GetForCurrentView(); - m_dpi = currentDisplayInformation->LogicalDpi; if (m_renderer.get() == nullptr) { diff --git a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/OpenGLESPage.xaml.cpp b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/OpenGLESPage.xaml.cpp index dd3aeeb72a..71f3c692e9 100644 --- a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/OpenGLESPage.xaml.cpp +++ b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/OpenGLESPage.xaml.cpp @@ -226,6 +226,9 @@ void OpenGLESPage::StartRenderLoop() return; } + DisplayInformation^ currentDisplayInformation = DisplayInformation::GetForCurrentView(); + m_dpi = currentDisplayInformation->LogicalDpi; + auto dispatcher = Windows::UI::Xaml::Window::Current->CoreWindow->Dispatcher; // Create a task for rendering that will be run on a background thread. @@ -239,9 +242,7 @@ void OpenGLESPage::StartRenderLoop() GLsizei panelHeight = 0; GetSwapChainPanelSize(&panelWidth, &panelHeight); - DisplayInformation^ currentDisplayInformation = DisplayInformation::GetForCurrentView(); - m_dpi = currentDisplayInformation->LogicalDpi; if (m_renderer.get() == nullptr) { From 145156d69830c17ea746713b13211023194291ba Mon Sep 17 00:00:00 2001 From: Dale Stammen Date: Tue, 28 Oct 2014 20:56:49 -0700 Subject: [PATCH 10/15] disabled distanceFieldEnabled for WP8 as the shader crashes some older windows phones --- cocos/2d/CCLabel.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cocos/2d/CCLabel.cpp b/cocos/2d/CCLabel.cpp index 79ec70dfca..cd6bcb43db 100644 --- a/cocos/2d/CCLabel.cpp +++ b/cocos/2d/CCLabel.cpp @@ -395,7 +395,13 @@ void Label::setFontAtlas(FontAtlas* atlas,bool distanceFieldEnabled /* = false * _commonLineHeight = _fontAtlas->getCommonLineHeight(); _contentDirty = true; } +#if CC_TARGET_PLATFORM != CC_PLATFORM_WP8 _useDistanceField = distanceFieldEnabled; +#else + // some older Windows Phones cannot run the ccShader_Label_df.frag program + // so we must disable distance field + _useDistanceField = false; +#endif _useA8Shader = useA8Shader; if (_currentLabelType != LabelType::TTF) From ee83a8a6e0a738609ba331c74cee66845fce235e Mon Sep 17 00:00:00 2001 From: Dale Stammen Date: Tue, 28 Oct 2014 20:57:40 -0700 Subject: [PATCH 11/15] disabled distanceFieldEnabled for WP8 as the shader crashes some older windows phones --- cocos/renderer/CCGLProgramCache.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cocos/renderer/CCGLProgramCache.cpp b/cocos/renderer/CCGLProgramCache.cpp index b81f00975c..7b7e7c6640 100644 --- a/cocos/renderer/CCGLProgramCache.cpp +++ b/cocos/renderer/CCGLProgramCache.cpp @@ -181,6 +181,7 @@ void GLProgramCache::loadDefaultGLPrograms() loadDefaultGLProgram(p, kShaderType_PositionLengthTexureColor); _programs.insert( std::make_pair(GLProgram::SHADER_NAME_POSITION_LENGTH_TEXTURE_COLOR, p) ); +#if CC_TARGET_PLATFORM != CC_PLATFORM_WP8 p = new (std::nothrow) GLProgram(); loadDefaultGLProgram(p, kShaderType_LabelDistanceFieldNormal); _programs.insert( std::make_pair(GLProgram::SHADER_NAME_LABEL_DISTANCEFIELD_NORMAL, p) ); @@ -188,6 +189,7 @@ void GLProgramCache::loadDefaultGLPrograms() p = new (std::nothrow) GLProgram(); loadDefaultGLProgram(p, kShaderType_LabelDistanceFieldGlow); _programs.insert( std::make_pair(GLProgram::SHADER_NAME_LABEL_DISTANCEFIELD_GLOW, p) ); +#endif p = new (std::nothrow) GLProgram(); loadDefaultGLProgram(p, kShaderType_LabelNormal); @@ -293,6 +295,7 @@ void GLProgramCache::reloadDefaultGLPrograms() p->reset(); loadDefaultGLProgram(p, kShaderType_PositionLengthTexureColor); +#if CC_TARGET_PLATFORM != CC_PLATFORM_WP8 p = getGLProgram(GLProgram::SHADER_NAME_LABEL_DISTANCEFIELD_NORMAL); p->reset(); loadDefaultGLProgram(p, kShaderType_LabelDistanceFieldNormal); @@ -300,6 +303,7 @@ void GLProgramCache::reloadDefaultGLPrograms() p = getGLProgram(GLProgram::SHADER_NAME_LABEL_DISTANCEFIELD_GLOW); p->reset(); loadDefaultGLProgram(p, kShaderType_LabelDistanceFieldGlow); +#endif p = getGLProgram(GLProgram::SHADER_NAME_LABEL_NORMAL); p->reset(); @@ -372,12 +376,14 @@ void GLProgramCache::loadDefaultGLProgram(GLProgram *p, int type) case kShaderType_PositionLengthTexureColor: p->initWithByteArrays(ccPositionColorLengthTexture_vert, ccPositionColorLengthTexture_frag); break; +#if CC_TARGET_PLATFORM != CC_PLATFORM_WP8 case kShaderType_LabelDistanceFieldNormal: p->initWithByteArrays(ccLabel_vert, ccLabelDistanceFieldNormal_frag); break; case kShaderType_LabelDistanceFieldGlow: p->initWithByteArrays(ccLabel_vert, ccLabelDistanceFieldGlow_frag); break; +#endif case kShaderType_LabelNormal: p->initWithByteArrays(ccLabel_vert, ccLabelNormal_frag); break; From a8e0987b8d896b0bd577e82408e20c04b4dbf5b5 Mon Sep 17 00:00:00 2001 From: Dale Stammen Date: Tue, 28 Oct 2014 20:59:44 -0700 Subject: [PATCH 12/15] disabled distanceFieldEnabled for WP8 as the shader crashes some older windows phones --- .../platform/wp8/shaders/precompiledshaders.h | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/cocos/platform/wp8/shaders/precompiledshaders.h b/cocos/platform/wp8/shaders/precompiledshaders.h index d93c40f9cf..0bd699de9d 100644 --- a/cocos/platform/wp8/shaders/precompiledshaders.h +++ b/cocos/platform/wp8/shaders/precompiledshaders.h @@ -86,7 +86,7 @@ const unsigned char s_133478C5A874C1E6F59B418CE6C7C39F1AE0F873[] = { 120, 116, 117, 114, 101, 48, 0, 0, 0, 0, 1, 0, 0, 0, 248, 3, 0, 0, 4, 5, 0, 0, 0, 0, - 0, 0, 182, 139, 0, 0, 0, 0, + 0, 0, 235, 143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 11, 95, 74, 206, 145, 124, 32, 219, 67, 19, @@ -456,7 +456,7 @@ const unsigned char s_13E33F532157A58EC77EDE3B3112560A89D272B2[] = { 116, 114, 105, 120, 0, 0, 0, 0, 0, 0, 0, 0, 204, 2, 0, 0, 164, 4, 0, 0, 0, 0, 0, 0, -182, 139, 0, 0, 0, 0, 0, 0, +235, 143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 127, 145, 81, 72, 216, 190, 16, 61, 245, 231, 235, 249, @@ -800,7 +800,7 @@ const unsigned char s_1A69A7CC77C7C8FC62799B0513816EA41FBF3BFE[] = { 116, 67, 111, 108, 111, 114, 0, 0, 0, 0, 3, 0, 0, 0, 208, 7, 0, 0, 4, 5, 0, 0, 0, 0, - 0, 0, 182, 139, 0, 0, 0, 0, + 0, 0, 235, 143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 65, 106, 69, 173, 111, 248, 97, 165, 186, 90, @@ -1462,7 +1462,7 @@ const unsigned char s_2CF9793879165058483EFB4AD6FA9746ECD7DD2A[] = { 99, 111, 108, 111, 114, 0, 0, 0, 0, 16, 0, 0, 0, 236, 16, 0, 0, 124, 10, 0, 0, 0, 0, 0, - 0, 182, 139, 0, 0, 0, 0, 0, + 0, 235, 143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 39, 224, 169, 185, 116, 156, 41, 157, 187, 9, 222, @@ -2430,7 +2430,7 @@ const unsigned char s_53938AB67AD93ABA0DDB87F3C9889304284E011E[] = { 120, 116, 117, 114, 101, 48, 0, 0, 0, 0, 1, 0, 0, 0, 24, 4, 0, 0, 4, 5, 0, 0, 0, 0, - 0, 0, 182, 139, 0, 0, 0, 0, + 0, 0, 235, 143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 200, 5, 103, 205, 248, 30, 69, 65, 32, 117, @@ -2804,7 +2804,7 @@ const unsigned char s_67837675F2BB48C0E926316F505FC1538228E0FA[] = { 86, 80, 77, 97, 116, 114, 105, 120, 0, 0, 0, 0, 0, 0, 0, 0, 16, 4, 0, 0, 48, 5, 0, 0, - 0, 0, 0, 0, 182, 139, 0, 0, + 0, 0, 0, 0, 235, 143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 79, 226, 72, 124, 94, 252, 37, 157, @@ -3968,7 +3968,7 @@ const unsigned char s_77D0755E06AA7AF59FAA6B003CA2363EDEB25C4C[] = { 99, 111, 108, 111, 114, 0, 0, 0, 0, 17, 0, 0, 0, 236, 16, 0, 0, 232, 19, 0, 0, 0, 0, 0, - 0, 182, 139, 0, 0, 0, 0, 0, + 0, 235, 143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 39, 224, 169, 185, 116, 156, 41, 157, 187, 9, 222, @@ -5245,7 +5245,7 @@ const unsigned char s_78250E25D1929D4A842050738140787BE42541C6[] = { 108, 112, 104, 97, 95, 118, 97, 108, 117, 101, 0, 0, 0, 0, 2, 0, 0, 0, 36, 5, 0, 0, 4, 5, - 0, 0, 0, 0, 0, 0, 182, 139, + 0, 0, 0, 0, 0, 0, 235, 143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 100, 113, 175, 29, 164, 71, @@ -5660,7 +5660,7 @@ const unsigned char s_7B67DD242152D35ACC079265FAD9D03DC98182DE[] = { 67, 95, 84, 101, 120, 116, 117, 114, 101, 48, 0, 0, 0, 0, 1, 0, 0, 0, 248, 3, 0, 0, 0, 5, - 0, 0, 0, 0, 0, 0, 182, 139, + 0, 0, 0, 0, 0, 0, 235, 143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 11, 95, 74, 206, 145, 124, @@ -6044,7 +6044,7 @@ const unsigned char s_7CE5EE84ACB6110F7FA29152ECE3344CB6D6620D[] = { 99, 111, 108, 111, 114, 0, 0, 0, 0, 2, 0, 0, 0, 96, 4, 0, 0, 192, 4, 0, 0, 0, 0, 0, - 0, 182, 139, 0, 0, 0, 0, 0, + 0, 235, 143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 157, 116, 105, 89, 118, 135, 249, 239, 42, 226, 184, @@ -6425,7 +6425,7 @@ const unsigned char s_7E1EEF397305D0BC2DCDBA4F2DAFBCBA1534E45C[] = { 117, 95, 99, 111, 108, 111, 114, 0, 0, 0, 0, 1, 0, 0, 0, 52, 3, 0, 0, 40, 4, 0, 0, 0, - 0, 0, 0, 182, 139, 0, 0, 0, + 0, 0, 0, 235, 143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 153, 8, 62, 201, 202, 170, 111, 182, 149, @@ -6759,7 +6759,7 @@ const unsigned char s_847DBFDDA6EC09C57E4ED43012AE2FB5CAC7D8D5[] = { 111, 108, 111, 114, 0, 0, 0, 0, 2, 0, 0, 0, 240, 4, 0, 0, 4, 5, 0, 0, 0, 0, 0, 0, -182, 139, 0, 0, 0, 0, 0, 0, +235, 143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 134, 66, 128, 226, 107, 172, 247, 161, 241, 207, 89, 240, @@ -7176,7 +7176,7 @@ const unsigned char s_92BE325B516F887D2C928EDE20ADF428DB01C038[] = { 95, 118, 97, 108, 117, 101, 0, 0, 0, 0, 2, 0, 0, 0, 36, 5, 0, 0, 0, 5, 0, 0, 0, 0, - 0, 0, 182, 139, 0, 0, 0, 0, + 0, 0, 235, 143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 100, 113, 175, 29, 164, 71, 177, 78, 120, 99, @@ -7744,7 +7744,7 @@ const unsigned char s_93D31E1668075AE4941C53441D7A9D0DE8F76331[] = { 117, 95, 99, 111, 108, 111, 114, 0, 0, 0, 0, 15, 0, 0, 0, 200, 15, 0, 0, 216, 9, 0, 0, 0, - 0, 0, 0, 182, 139, 0, 0, 0, + 0, 0, 0, 235, 143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 136, 158, 207, 210, 174, 144, 71, 116, 248, @@ -9277,7 +9277,7 @@ const unsigned char s_A130FCE93CA2E5D68468367D88D1D7BE357912E5[] = { 99, 111, 108, 111, 114, 0, 0, 0, 0, 3, 0, 0, 0, 96, 4, 0, 0, 192, 13, 0, 0, 0, 0, 0, - 0, 182, 139, 0, 0, 0, 0, 0, + 0, 235, 143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 157, 116, 105, 89, 118, 135, 249, 239, 42, 226, 184, @@ -9954,7 +9954,7 @@ const unsigned char s_A2377A827972A5466DA8637681045D32DA8A817D[] = { 99, 111, 108, 111, 114, 0, 0, 0, 0, 2, 0, 0, 0, 96, 4, 0, 0, 144, 4, 0, 0, 0, 0, 0, - 0, 182, 139, 0, 0, 0, 0, 0, + 0, 235, 143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 157, 116, 105, 89, 118, 135, 249, 239, 42, 226, 184, @@ -10339,7 +10339,7 @@ const unsigned char s_B5E27B4F3CF7236633255B28CBA530D6EE5CED86[] = { 111, 108, 111, 114, 0, 0, 0, 0, 2, 0, 0, 0, 240, 5, 0, 0, 4, 5, 0, 0, 0, 0, 0, 0, -182, 139, 0, 0, 0, 0, 0, 0, +235, 143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 223, 173, 203, 80, 172, 13, 170, 215, 168, 128, 228, 5, @@ -10771,7 +10771,7 @@ const unsigned char s_E2C7CE1244DE9C76688EFA9463B2A130B6A08893[] = { 77, 97, 116, 114, 105, 120, 0, 0, 0, 0, 0, 0, 0, 0, 204, 2, 0, 0, 144, 4, 0, 0, 0, 0, - 0, 0, 182, 139, 0, 0, 0, 0, + 0, 0, 235, 143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 127, 145, 81, 72, 216, 190, 16, 61, 245, 231, @@ -11101,8 +11101,8 @@ const unsigned char s_E2D56227712263272BD5218FEA117CD06180F81B[] = { 117, 95, 112, 111, 105, 110, 116, 83, 105, 122, 101, 0, 0, 0, 0, 2, 0, 0, 0, 204, 2, 0, 0, 208, - 4, 0, 0, 0, 0, 0, 0, 182, -139, 0, 0, 0, 0, 0, 0, 0, + 4, 0, 0, 0, 0, 0, 0, 235, +143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 127, 145, 81, 72, 216, 190, 16, 61, 245, 231, 235, 249, 125, @@ -11452,7 +11452,7 @@ const unsigned char s_F46558C274182079784898CF4968CF431593D5E2[] = { 116, 67, 111, 108, 111, 114, 0, 0, 0, 0, 3, 0, 0, 0, 108, 6, 0, 0, 4, 5, 0, 0, 0, 0, - 0, 0, 182, 139, 0, 0, 0, 0, + 0, 0, 235, 143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 47, 220, 115, 183, 137, 174, 141, 96, 204, 60, @@ -11908,7 +11908,7 @@ const unsigned char s_F6BA4519AF2653A53D57FB5D5508F0D8617105D6[] = { 101, 120, 116, 117, 114, 101, 48, 0, 0, 0, 0, 1, 0, 0, 0, 156, 3, 0, 0, 144, 4, 0, 0, 0, - 0, 0, 0, 182, 139, 0, 0, 0, + 0, 0, 0, 235, 143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 203, 117, 183, 110, 154, 52, 220, 70, 125, From 060779c138fc6dc0f68a19192e6ff66388b226da Mon Sep 17 00:00:00 2001 From: Dale Stammen Date: Tue, 28 Oct 2014 21:01:26 -0700 Subject: [PATCH 13/15] added check for WP8_SHADER_COMPILER --- cocos/platform/winrt/CCDevice.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cocos/platform/winrt/CCDevice.cpp b/cocos/platform/winrt/CCDevice.cpp index 1bde53583a..e3f7edbde5 100644 --- a/cocos/platform/winrt/CCDevice.cpp +++ b/cocos/platform/winrt/CCDevice.cpp @@ -45,6 +45,8 @@ int Device::getDPI() #if CC_TARGET_PLATFORM == CC_PLATFORM_WP8 static const float dipsPerInch = 96.0f; return floor(DisplayProperties::LogicalDpi / dipsPerInch + 0.5f); // Round to nearest integer. +#elif defined WP8_SHADER_COMPILER + return 0; #else return cocos2d::GLViewImpl::sharedOpenGLView()->GetDPI(); #endif From 7794314ef1df97ee7e0984733e07f1e534cb9b4f Mon Sep 17 00:00:00 2001 From: Dale Stammen Date: Tue, 28 Oct 2014 21:02:14 -0700 Subject: [PATCH 14/15] added missing libcocos2d project file --- .../Cocos2dShaderCompiler.sln | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/build/wp8/Cocos2dShaderCompiler/Cocos2dShaderCompiler.sln b/build/wp8/Cocos2dShaderCompiler/Cocos2dShaderCompiler.sln index 481fbd3963..22c9464a6e 100644 --- a/build/wp8/Cocos2dShaderCompiler/Cocos2dShaderCompiler.sln +++ b/build/wp8/Cocos2dShaderCompiler/Cocos2dShaderCompiler.sln @@ -23,8 +23,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libSpine.Shared", "..\..\.. EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libSpine.Windows", "..\..\..\cocos\editor-support\spine\proj.win8.1-universal\libSpine.Windows\libSpine.Windows.vcxproj", "{F3550FE0-C795-44F6-8FEB-093EB68143AE}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d_8_1.Windows", "..\..\..\cocos\2d\libcocos2d_8_1\libcocos2d_8_1\libcocos2d_8_1.Windows\libcocos2d_8_1.Windows.vcxproj", "{9335005F-678E-4E8E-9B84-50037216AEC8}" +EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution + ..\..\..\cocos\2d\libcocos2d_8_1\libcocos2d_8_1\libcocos2d_8_1.Shared\libcocos2d_8_1.Shared.vcxitems*{9335005f-678e-4e8e-9b84-50037216aec8}*SharedItemsImports = 4 ..\..\..\external\Box2D\proj.win8.1-universal\libbox2d.Shared\libbox2d.Shared.vcxitems*{4a3c6ba8-c227-498b-aa21-40bda27b461f}*SharedItemsImports = 9 ..\..\..\cocos\editor-support\spine\proj.win8.1-universal\libSpine.Shared\libSpine.Shared.vcxitems*{adafd00d-a0d6-46ef-9f0b-ea2880bfe1de}*SharedItemsImports = 9 ..\..\..\cocos\2d\libcocos2d_8_1\libcocos2d_8_1\libcocos2d_8_1.Shared\libcocos2d_8_1.Shared.vcxitems*{5d6f020f-7e72-4494-90a0-2df11d235df9}*SharedItemsImports = 9 @@ -82,6 +85,18 @@ Global {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Release|Win32.Build.0 = Release|Win32 {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Release|x64.ActiveCfg = Release|x64 {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Release|x64.Build.0 = Release|x64 + {9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|ARM.ActiveCfg = Debug|ARM + {9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|ARM.Build.0 = Debug|ARM + {9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|Win32.ActiveCfg = Debug|Win32 + {9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|Win32.Build.0 = Debug|Win32 + {9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|x64.ActiveCfg = Debug|x64 + {9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|x64.Build.0 = Debug|x64 + {9335005F-678E-4E8E-9B84-50037216AEC8}.Release|ARM.ActiveCfg = Release|ARM + {9335005F-678E-4E8E-9B84-50037216AEC8}.Release|ARM.Build.0 = Release|ARM + {9335005F-678E-4E8E-9B84-50037216AEC8}.Release|Win32.ActiveCfg = Release|Win32 + {9335005F-678E-4E8E-9B84-50037216AEC8}.Release|Win32.Build.0 = Release|Win32 + {9335005F-678E-4E8E-9B84-50037216AEC8}.Release|x64.ActiveCfg = Release|x64 + {9335005F-678E-4E8E-9B84-50037216AEC8}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -94,5 +109,6 @@ Global {3B26A12D-3A44-47EA-82D2-282660FC844D} = {7CA66464-6A5E-493B-82EF-DBD84F91766F} {ADAFD00D-A0D6-46EF-9F0B-EA2880BFE1DE} = {8F8A69D6-BD64-4BAD-AE20-2D07E7BD57BA} {F3550FE0-C795-44F6-8FEB-093EB68143AE} = {8F8A69D6-BD64-4BAD-AE20-2D07E7BD57BA} + {9335005F-678E-4E8E-9B84-50037216AEC8} = {29321038-F308-421E-B8CA-140BB23D3C6D} EndGlobalSection EndGlobal From fa70e066a12f3e17f8ec7858c42b2b4401b4713a Mon Sep 17 00:00:00 2001 From: Dale Stammen Date: Wed, 29 Oct 2014 09:17:31 -0700 Subject: [PATCH 15/15] enabled FastTileMap test for WP8 --- tests/cpp-tests/Classes/controller.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/cpp-tests/Classes/controller.cpp b/tests/cpp-tests/Classes/controller.cpp index afe5aa48ee..c6776c7797 100644 --- a/tests/cpp-tests/Classes/controller.cpp +++ b/tests/cpp-tests/Classes/controller.cpp @@ -78,9 +78,7 @@ Controller g_aTestNames[] = { { "Node: Sprite", [](){return new SpriteTestScene(); } }, { "Node: Sprite3D", [](){ return new Sprite3DTestScene(); }}, { "Node: TileMap", [](){return new TileMapTestScene(); } }, -#if CC_TARGET_PLATFORM != CC_PLATFORM_WP8 { "Node: FastTileMap", [](){return new TileMapTestSceneNew(); } }, -#endif { "Node: Text Input", [](){return new TextInputTestScene(); } }, { "Node: UI", [](){ return new UITestScene(); }}, { "Mouse", []() { return new MouseTestScene(); } },