diff --git a/plugins/microsoftiap/proj.win8.1-universal/microsoftiap.sln b/plugins/microsoftiap/proj.win8.1-universal/microsoftiap.sln
new file mode 100644
index 00000000..b94cd3c5
--- /dev/null
+++ b/plugins/microsoftiap/proj.win8.1-universal/microsoftiap.sln
@@ -0,0 +1,96 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2013
+VisualStudioVersion = 12.0.31101.0
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "microsoftiap", "microsoftiap", "{3F9A194C-ACBB-47F6-B6CB-AED3954FD766}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "microsoftiap.Shared", "microsoftiap\microsoftiap.Shared\microsoftiap.Shared.vcxitems", "{3921BC09-4ECA-41E9-97B4-E0DBF8616776}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "microsoftiap.Windows", "microsoftiap\microsoftiap.Windows\microsoftiap.Windows.vcxproj", "{E6B464CA-8F8B-420A-BC4C-C1F7C1297FA7}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "microsoftiap.WindowsPhone", "microsoftiap\microsoftiap.WindowsPhone\microsoftiap.WindowsPhone.vcxproj", "{0852A95A-5A0D-401E-B815-1B52342C5F9C}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "cocosPluginWinrtBridge", "cocosPluginWinrtBridge", "{F7A9942C-4575-4C37-BD24-31711B0C8FFB}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cocosPluginWinrtBridge.Shared", "..\..\..\protocols\platform\winrt\cocosPluginWinrtBridge\cocosPluginWinrtBridge\cocosPluginWinrtBridge.Shared\cocosPluginWinrtBridge.Shared.vcxitems", "{1B37C3CE-088D-4277-B750-3A1CBEB1884A}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cocosPluginWinrtBridge.Windows", "..\..\..\protocols\platform\winrt\cocosPluginWinrtBridge\cocosPluginWinrtBridge\cocosPluginWinrtBridge.Windows\cocosPluginWinrtBridge.Windows.vcxproj", "{491F4851-92BA-4AC1-9A80-241E1FF13229}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cocosPluginWinrtBridge.WindowsPhone", "..\..\..\protocols\platform\winrt\cocosPluginWinrtBridge\cocosPluginWinrtBridge\cocosPluginWinrtBridge.WindowsPhone\cocosPluginWinrtBridge.WindowsPhone.vcxproj", "{35ACD56C-DEE1-477B-BEC0-C963C7937623}"
+EndProject
+Global
+ GlobalSection(SharedMSBuildProjectFiles) = preSolution
+ microsoftiap\microsoftiap.Shared\microsoftiap.Shared.vcxitems*{3921bc09-4eca-41e9-97b4-e0dbf8616776}*SharedItemsImports = 9
+ microsoftiap\microsoftiap.Shared\microsoftiap.Shared.vcxitems*{e6b464ca-8f8b-420a-bc4c-c1f7c1297fa7}*SharedItemsImports = 4
+ ..\..\..\protocols\platform\winrt\cocosPluginWinrtBridge\cocosPluginWinrtBridge\cocosPluginWinrtBridge.Shared\cocosPluginWinrtBridge.Shared.vcxitems*{491f4851-92ba-4ac1-9a80-241e1ff13229}*SharedItemsImports = 4
+ ..\..\..\protocols\platform\winrt\cocosPluginWinrtBridge\cocosPluginWinrtBridge\cocosPluginWinrtBridge.Shared\cocosPluginWinrtBridge.Shared.vcxitems*{35acd56c-dee1-477b-bec0-c963c7937623}*SharedItemsImports = 4
+ ..\..\..\protocols\platform\winrt\cocosPluginWinrtBridge\cocosPluginWinrtBridge\cocosPluginWinrtBridge.Shared\cocosPluginWinrtBridge.Shared.vcxitems*{1b37c3ce-088d-4277-b750-3a1cbeb1884a}*SharedItemsImports = 9
+ microsoftiap\microsoftiap.Shared\microsoftiap.Shared.vcxitems*{0852a95a-5a0d-401e-b815-1b52342c5f9c}*SharedItemsImports = 4
+ EndGlobalSection
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|ARM = Debug|ARM
+ Debug|Win32 = Debug|Win32
+ Debug|x64 = Debug|x64
+ Release|ARM = Release|ARM
+ Release|Win32 = Release|Win32
+ Release|x64 = Release|x64
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {E6B464CA-8F8B-420A-BC4C-C1F7C1297FA7}.Debug|ARM.ActiveCfg = Debug|ARM
+ {E6B464CA-8F8B-420A-BC4C-C1F7C1297FA7}.Debug|ARM.Build.0 = Debug|ARM
+ {E6B464CA-8F8B-420A-BC4C-C1F7C1297FA7}.Debug|Win32.ActiveCfg = Debug|Win32
+ {E6B464CA-8F8B-420A-BC4C-C1F7C1297FA7}.Debug|Win32.Build.0 = Debug|Win32
+ {E6B464CA-8F8B-420A-BC4C-C1F7C1297FA7}.Debug|x64.ActiveCfg = Debug|x64
+ {E6B464CA-8F8B-420A-BC4C-C1F7C1297FA7}.Debug|x64.Build.0 = Debug|x64
+ {E6B464CA-8F8B-420A-BC4C-C1F7C1297FA7}.Release|ARM.ActiveCfg = Release|ARM
+ {E6B464CA-8F8B-420A-BC4C-C1F7C1297FA7}.Release|ARM.Build.0 = Release|ARM
+ {E6B464CA-8F8B-420A-BC4C-C1F7C1297FA7}.Release|Win32.ActiveCfg = Release|Win32
+ {E6B464CA-8F8B-420A-BC4C-C1F7C1297FA7}.Release|Win32.Build.0 = Release|Win32
+ {E6B464CA-8F8B-420A-BC4C-C1F7C1297FA7}.Release|x64.ActiveCfg = Release|x64
+ {E6B464CA-8F8B-420A-BC4C-C1F7C1297FA7}.Release|x64.Build.0 = Release|x64
+ {0852A95A-5A0D-401E-B815-1B52342C5F9C}.Debug|ARM.ActiveCfg = Debug|ARM
+ {0852A95A-5A0D-401E-B815-1B52342C5F9C}.Debug|ARM.Build.0 = Debug|ARM
+ {0852A95A-5A0D-401E-B815-1B52342C5F9C}.Debug|Win32.ActiveCfg = Debug|Win32
+ {0852A95A-5A0D-401E-B815-1B52342C5F9C}.Debug|Win32.Build.0 = Debug|Win32
+ {0852A95A-5A0D-401E-B815-1B52342C5F9C}.Debug|x64.ActiveCfg = Debug|Win32
+ {0852A95A-5A0D-401E-B815-1B52342C5F9C}.Release|ARM.ActiveCfg = Release|ARM
+ {0852A95A-5A0D-401E-B815-1B52342C5F9C}.Release|ARM.Build.0 = Release|ARM
+ {0852A95A-5A0D-401E-B815-1B52342C5F9C}.Release|Win32.ActiveCfg = Release|Win32
+ {0852A95A-5A0D-401E-B815-1B52342C5F9C}.Release|Win32.Build.0 = Release|Win32
+ {0852A95A-5A0D-401E-B815-1B52342C5F9C}.Release|x64.ActiveCfg = Release|Win32
+ {491F4851-92BA-4AC1-9A80-241E1FF13229}.Debug|ARM.ActiveCfg = Debug|ARM
+ {491F4851-92BA-4AC1-9A80-241E1FF13229}.Debug|ARM.Build.0 = Debug|ARM
+ {491F4851-92BA-4AC1-9A80-241E1FF13229}.Debug|Win32.ActiveCfg = Debug|Win32
+ {491F4851-92BA-4AC1-9A80-241E1FF13229}.Debug|Win32.Build.0 = Debug|Win32
+ {491F4851-92BA-4AC1-9A80-241E1FF13229}.Debug|x64.ActiveCfg = Debug|x64
+ {491F4851-92BA-4AC1-9A80-241E1FF13229}.Debug|x64.Build.0 = Debug|x64
+ {491F4851-92BA-4AC1-9A80-241E1FF13229}.Release|ARM.ActiveCfg = Release|ARM
+ {491F4851-92BA-4AC1-9A80-241E1FF13229}.Release|ARM.Build.0 = Release|ARM
+ {491F4851-92BA-4AC1-9A80-241E1FF13229}.Release|Win32.ActiveCfg = Release|Win32
+ {491F4851-92BA-4AC1-9A80-241E1FF13229}.Release|Win32.Build.0 = Release|Win32
+ {491F4851-92BA-4AC1-9A80-241E1FF13229}.Release|x64.ActiveCfg = Release|x64
+ {491F4851-92BA-4AC1-9A80-241E1FF13229}.Release|x64.Build.0 = Release|x64
+ {35ACD56C-DEE1-477B-BEC0-C963C7937623}.Debug|ARM.ActiveCfg = Debug|ARM
+ {35ACD56C-DEE1-477B-BEC0-C963C7937623}.Debug|ARM.Build.0 = Debug|ARM
+ {35ACD56C-DEE1-477B-BEC0-C963C7937623}.Debug|Win32.ActiveCfg = Debug|Win32
+ {35ACD56C-DEE1-477B-BEC0-C963C7937623}.Debug|Win32.Build.0 = Debug|Win32
+ {35ACD56C-DEE1-477B-BEC0-C963C7937623}.Debug|x64.ActiveCfg = Debug|Win32
+ {35ACD56C-DEE1-477B-BEC0-C963C7937623}.Release|ARM.ActiveCfg = Release|ARM
+ {35ACD56C-DEE1-477B-BEC0-C963C7937623}.Release|ARM.Build.0 = Release|ARM
+ {35ACD56C-DEE1-477B-BEC0-C963C7937623}.Release|Win32.ActiveCfg = Release|Win32
+ {35ACD56C-DEE1-477B-BEC0-C963C7937623}.Release|Win32.Build.0 = Release|Win32
+ {35ACD56C-DEE1-477B-BEC0-C963C7937623}.Release|x64.ActiveCfg = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {3921BC09-4ECA-41E9-97B4-E0DBF8616776} = {3F9A194C-ACBB-47F6-B6CB-AED3954FD766}
+ {E6B464CA-8F8B-420A-BC4C-C1F7C1297FA7} = {3F9A194C-ACBB-47F6-B6CB-AED3954FD766}
+ {0852A95A-5A0D-401E-B815-1B52342C5F9C} = {3F9A194C-ACBB-47F6-B6CB-AED3954FD766}
+ {1B37C3CE-088D-4277-B750-3A1CBEB1884A} = {F7A9942C-4575-4C37-BD24-31711B0C8FFB}
+ {491F4851-92BA-4AC1-9A80-241E1FF13229} = {F7A9942C-4575-4C37-BD24-31711B0C8FFB}
+ {35ACD56C-DEE1-477B-BEC0-C963C7937623} = {F7A9942C-4575-4C37-BD24-31711B0C8FFB}
+ EndGlobalSection
+EndGlobal
diff --git a/plugins/microsoftiap/proj.win8.1-universal/microsoftiap/microsoftiap.Shared/microsoftiap.Shared.vcxitems b/plugins/microsoftiap/proj.win8.1-universal/microsoftiap/microsoftiap.Shared/microsoftiap.Shared.vcxitems
new file mode 100644
index 00000000..44fcae8b
--- /dev/null
+++ b/plugins/microsoftiap/proj.win8.1-universal/microsoftiap/microsoftiap.Shared/microsoftiap.Shared.vcxitems
@@ -0,0 +1,29 @@
+
+
+
+ $(MSBuildAllProjects);$(MSBuildThisFileFullPath)
+ true
+ {3921bc09-4eca-41e9-97b4-e0dbf8616776}
+ microsoftiap
+ microsoftiap.Shared
+ 248F659F-DAC5-46E8-AC09-60EC9FC95053
+
+
+
+ %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory)
+
+
+
+
+
+
+
+
+
+ Create
+
+
+
+
+
+
\ No newline at end of file
diff --git a/plugins/microsoftiap/proj.win8.1-universal/microsoftiap/microsoftiap.Shared/microsoftiap.Shared.vcxitems.filters b/plugins/microsoftiap/proj.win8.1-universal/microsoftiap/microsoftiap.Shared/microsoftiap.Shared.vcxitems.filters
new file mode 100644
index 00000000..bd930bd6
--- /dev/null
+++ b/plugins/microsoftiap/proj.win8.1-universal/microsoftiap/microsoftiap.Shared/microsoftiap.Shared.vcxitems.filters
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+ Create
+
+
+
+
\ No newline at end of file
diff --git a/plugins/microsoftiap/proj.win8.1-universal/microsoftiap/microsoftiap.Shared/pch.cpp b/plugins/microsoftiap/proj.win8.1-universal/microsoftiap/microsoftiap.Shared/pch.cpp
new file mode 100644
index 00000000..bcb5590b
--- /dev/null
+++ b/plugins/microsoftiap/proj.win8.1-universal/microsoftiap/microsoftiap.Shared/pch.cpp
@@ -0,0 +1 @@
+#include "pch.h"
diff --git a/plugins/microsoftiap/proj.win8.1-universal/microsoftiap/microsoftiap.Shared/pch.h b/plugins/microsoftiap/proj.win8.1-universal/microsoftiap/microsoftiap.Shared/pch.h
new file mode 100644
index 00000000..10fe677c
--- /dev/null
+++ b/plugins/microsoftiap/proj.win8.1-universal/microsoftiap/microsoftiap.Shared/pch.h
@@ -0,0 +1,4 @@
+#pragma once
+
+#include
+#include
diff --git a/plugins/microsoftiap/proj.win8.1-universal/microsoftiap/microsoftiap.Shared/plugin.cpp b/plugins/microsoftiap/proj.win8.1-universal/microsoftiap/microsoftiap.Shared/plugin.cpp
new file mode 100644
index 00000000..04a5d977
--- /dev/null
+++ b/plugins/microsoftiap/proj.win8.1-universal/microsoftiap/microsoftiap.Shared/plugin.cpp
@@ -0,0 +1,333 @@
+
+/****************************************************************************
+Copyright (c) 2012-2013 cocos2d-x.org
+Copyright (c) Microsoft Open Technologies, Inc.
+Copyright (c) Microsoft Corporation.
+
+http://www.cocos2d-x.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+****************************************************************************/
+
+#include "pch.h"
+#include "plugin.h"
+
+#include
+#include
+
+using namespace concurrency;
+using namespace Windows::Foundation::Collections;
+using namespace Platform;
+using namespace Windows::ApplicationModel::Store;
+using namespace Windows::Storage;
+using namespace Microsoft::WRL;
+
+using namespace cocosPluginWinrtBridge;
+
+
+#define PRODUCT_KEY "product"
+#define PROXY_STORE_KEY "windows_store_proxy"
+
+namespace microsoftiap {
+
+ [Windows::Foundation::Metadata::WebHostHidden]
+ public ref class microsoftiap sealed : public cocosPluginWinrtBridge::IProtocolIAP{
+ private:
+ bool debugMode;
+ Windows::UI::Core::CoreDispatcher^ dispatcher;
+
+ public:
+ virtual event OnPayResultHandler^ OnPayResult;
+
+ microsoftiap() {
+ debugMode = false;
+ dispatcher = nullptr;
+ }
+
+ /**
+ @brief plug-in info methods(name, version, SDK version)
+ */
+ virtual Platform::String^ getPluginVersion() {
+ return L"0.0.0";
+ }
+
+ virtual Platform::String^ getSDKVersion() {
+ return L"0.0.0";
+ }
+
+ /**
+ @brief switch debug plug-in on/off
+ */
+ virtual void setDebugMode(bool bDebug) {
+ debugMode = bDebug;
+ }
+
+ virtual void callFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ return;
+ }
+
+ virtual Platform::String^ callStringFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ if (funcName == L"getEntitledDurables") {
+ return getEntitledDurables();
+ }
+ if (funcName == L"getUnfulfilledConsumables") {
+ return fetchUnfulfilledConsumables();
+ }
+ return L"";
+
+ }
+
+ virtual int callIntFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ return 0;
+ }
+
+ virtual bool callBoolFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ if (funcName == L"isProductPurchased") {
+ Platform::String^ productName = params->GetAt(0)->getStringValue();
+ return isProductPurchased(productName);
+ }
+ if (funcName == "reportConsumableFulfillment") {
+ // params[0] : productId string
+ // params[1] : transactionId string
+ return reportFulfilledConsumable(params->GetAt(0)->getStringValue(), params->GetAt(1)->getStringValue()) == FulfillmentResult::Succeeded;
+ }
+ return false;
+ }
+
+ virtual float callFloatFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ return 0;
+ }
+
+ virtual void configDeveloperInfo(IMap^ devInfo) {
+ log("configuring developer info");
+ // The path looked up by PROXY_STORE_KEY must use \ to split directories and not /
+ if (debugMode) {
+ loadWindowsStoreProxyFile(devInfo->Lookup(PROXY_STORE_KEY)); // TODO how should this fail if key isn't found?
+ }
+ }
+
+ // checks that the product can in fact be purchased before attempting to buy
+ virtual void payForProduct(IMap^ info) {
+ Platform::String^ product = nullptr;
+ bool foundProduct = false;
+ bool activeProduct;
+ LicenseInformation^ licensingInfo = getLicenseInformation();
+ if (info->HasKey(PRODUCT_KEY)) {
+ product = info->Lookup(PRODUCT_KEY);
+ }
+ activeProduct = licensingInfo->ProductLicenses->Lookup(product)->IsActive;
+ if (product == nullptr) {
+ OnPayResult(PayResultCodeEnum::kPayFail, "product key not found");
+ }
+ else if (activeProduct == true) {
+ OnPayResult(PayResultCodeEnum::kPayFail, "product already purchased");
+ }
+ else {
+ log("purchasing product");
+ purchaseProduct(product);
+ }
+ }
+
+ // waits on async action, then sends result to cocos app
+ void sendResult(Windows::Foundation::IAsyncOperation ^ asyncOp, Platform::String^ product) {
+ auto purchaseTask = create_task(asyncOp);
+ auto wrapperTask = create_task([purchaseTask]() {
+ return purchaseTask;
+ });
+ wrapperTask.then([this, product](task t) {
+ try {
+ PurchaseResults^ purchaseResults = t.get();
+ if (purchaseResults->Status == ProductPurchaseStatus::Succeeded) {
+ OnPayResult(PayResultCodeEnum::kPaySuccess, purchaseResults->ReceiptXml);
+ }
+ else {
+ OnPayResult(PayResultCodeEnum::kPayFail, "product was not purchased");
+ }
+ }
+ catch (Exception^ e) {
+ OnPayResult(PayResultCodeEnum::kPayFail, "product was not purchased");
+ }
+ });
+ }
+
+ LicenseInformation^ getLicenseInformation() {
+ if (debugMode) {
+ return CurrentAppSimulator::LicenseInformation;
+ }
+ else {
+ return CurrentApp::LicenseInformation;
+ }
+ }
+
+ virtual void setDispatcher(Windows::UI::Core::CoreDispatcher^ dispatcher) {
+ this->dispatcher = dispatcher;
+ }
+
+ bool getDebugMode() {
+ return debugMode;
+ }
+
+ bool isProductPurchased(Platform::String^ productName) {
+ LicenseInformation^ licenseInfo = getLicenseInformation();
+ if (licenseInfo->ProductLicenses->HasKey(productName)) {
+ return getLicenseInformation()->ProductLicenses->Lookup(productName)->IsActive;
+ }
+ return false;
+ }
+
+ private:
+ void log(Platform::String^ msg) {
+ if (debugMode) {
+ OutputDebugString(msg->Data());
+ }
+ }
+
+ // requests product purchase on correct thread
+ void purchaseProduct(Platform::String^ product) {
+ dispatcher->RunAsync(
+ Windows::UI::Core::CoreDispatcherPriority::Normal,
+ ref new Windows::UI::Core::DispatchedHandler([this, product]() {
+ try {
+ Windows::Foundation::IAsyncOperation^ asyncOp = nullptr;
+ if (this->getDebugMode()) {
+ asyncOp = CurrentAppSimulator::RequestProductPurchaseAsync(product);
+ }
+ else {
+ asyncOp = CurrentApp::RequestProductPurchaseAsync(product);
+ }
+ this->sendResult(asyncOp, product);
+ }
+ catch (Exception^ e) {
+ this->OnPayResult(PayResultCodeEnum::kPayFail, "product was not purchased");
+ }
+ }));
+
+ }
+
+ void loadWindowsStoreProxyFile(Platform::String^ filePath) {
+ StorageFolder^ installationFolder = Windows::ApplicationModel::Package::Current->InstalledLocation;
+ create_task(installationFolder->GetFileAsync(filePath)).then([this](task currentTask) {
+ StorageFile^ storeProxyFile;
+ try {
+ storeProxyFile = currentTask.get();
+ create_task(CurrentAppSimulator::ReloadSimulatorAsync(storeProxyFile)).then([this] {
+ }).wait();
+ }
+ catch (Platform::Exception^ e) {
+ OutputDebugString(e->Message->Data());
+ }
+ }).wait();
+ }
+
+ FulfillmentResult reportFulfilledConsumable(Platform::String^ productId, Platform::String^ transactionId) {
+ GUID guid;
+ HRESULT hresult = CLSIDFromString((LPWSTR)transactionId->Data(), (LPCLSID)&guid);
+ Platform::Guid transactionIdGuid = Guid(guid);
+ Windows::Foundation::IAsyncOperation^ asyncOp = nullptr;
+ Windows::Foundation::IAsyncAction^ asyncAction = dispatcher->RunAsync(
+ Windows::UI::Core::CoreDispatcherPriority::Normal,
+ ref new Windows::UI::Core::DispatchedHandler([this, &asyncOp, &productId, &transactionIdGuid]() {
+ if (debugMode) {
+ asyncOp = CurrentAppSimulator::ReportConsumableFulfillmentAsync(productId, transactionIdGuid);
+ }
+ else {
+ asyncOp = CurrentApp::ReportConsumableFulfillmentAsync(productId, transactionIdGuid);
+ }
+ }
+ ));
+ FulfillmentResult* result = new FulfillmentResult;
+ create_task(asyncAction).wait();
+ create_task(asyncOp).then([&result](FulfillmentResult r) {
+ *result = r;
+ }).wait();
+ FulfillmentResult ret = *result;
+ delete result;
+ return ret;
+ }
+
+ IVectorView^ unfulfilledConsumables() {
+ Windows::Foundation::IAsyncOperation^>^ asyncOp = nullptr;
+ Windows::Foundation::IAsyncAction^ asyncAction = dispatcher->RunAsync(
+ Windows::UI::Core::CoreDispatcherPriority::Normal,
+ ref new Windows::UI::Core::DispatchedHandler([this, &asyncOp]() {
+ if (debugMode) {
+ asyncOp = CurrentAppSimulator::GetUnfulfilledConsumablesAsync();
+ }
+ else {
+ asyncOp = CurrentApp::GetUnfulfilledConsumablesAsync();
+ }
+ }
+ ));
+ create_task(asyncAction).wait();
+ IVectorView^ consumables = nullptr;
+ create_task(asyncOp).then([&consumables](IVectorView^ result) {
+ consumables = result;
+ }).wait();
+ return consumables;
+ }
+
+ Platform::String^ fetchUnfulfilledConsumables() {
+ IVectorView^ consumables = unfulfilledConsumables();
+ UnfulfilledConsumable^ c;
+ Platform::String^ xmlString = L"";
+ for (unsigned int i = 0; i < consumables->Size; ++i) {
+ c = consumables->GetAt(i);
+ xmlString += L"ProductId + L"\" transaction_id=\"" + c->TransactionId + L"\" />";
+ }
+ return xmlString;
+ }
+
+ Platform::String^ getEntitledDurables() {
+ std::set consumableIds;
+ IVectorView^ consumables = unfulfilledConsumables();
+ for (unsigned int i = 0; i < consumables->Size; ++i) {
+ consumableIds.insert(consumables->GetAt(i)->ProductId);
+ }
+ typedef Windows::Foundation::Collections::IKeyValuePair T_item;
+
+ LicenseInformation^ licenseInformation = getLicenseInformation();
+ Windows::Foundation::Collections::IIterator< T_item ^>^ it = (Windows::Foundation::Collections::IIterator< T_item ^>^)licenseInformation->ProductLicenses->First();
+ Platform::String^ xmlString = L"";
+ while (it->HasCurrent)
+ {
+ T_item^ item = (T_item^)it->Current;
+ if (!consumableIds.count(item->Key) && item->Value->IsActive) {
+ Platform::String^ key = item->Key;
+ xmlString += L"" + key + L"";
+ }
+ it->MoveNext();
+ }
+ xmlString += L"";
+ return xmlString;
+ }
+
+ };
+} // end namespace
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugins/microsoftiap/proj.win8.1-universal/microsoftiap/microsoftiap.Shared/plugin.h b/plugins/microsoftiap/proj.win8.1-universal/microsoftiap/microsoftiap.Shared/plugin.h
new file mode 100644
index 00000000..669fbd1f
--- /dev/null
+++ b/plugins/microsoftiap/proj.win8.1-universal/microsoftiap/microsoftiap.Shared/plugin.h
@@ -0,0 +1,32 @@
+
+/****************************************************************************
+Copyright (c) 2012-2013 cocos2d-x.org
+Copyright (c) Microsoft Open Technologies, Inc.
+Copyright (c) Microsoft Corporation.
+
+http://www.cocos2d-x.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+****************************************************************************/
+
+#pragma once
+
+namespace microsoftiap
+{
+}
diff --git a/plugins/microsoftiap/proj.win8.1-universal/microsoftiap/microsoftiap.Windows/microsoftiap.Windows.vcxproj b/plugins/microsoftiap/proj.win8.1-universal/microsoftiap/microsoftiap.Windows/microsoftiap.Windows.vcxproj
new file mode 100644
index 00000000..9ba00c8d
--- /dev/null
+++ b/plugins/microsoftiap/proj.win8.1-universal/microsoftiap/microsoftiap.Windows/microsoftiap.Windows.vcxproj
@@ -0,0 +1,226 @@
+
+
+
+
+ Debug
+ ARM
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ ARM
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+
+ {491f4851-92ba-4ac1-9a80-241e1ff13229}
+
+
+
+ {e6b464ca-8f8b-420a-bc4c-c1f7c1297fa7}
+ microsoftiap
+ en-US
+ 12.0
+ true
+ Windows Store
+ 8.1
+ CodeSharingWindowsRuntimeComponent
+
+
+
+ DynamicLibrary
+ true
+ v120
+
+
+ DynamicLibrary
+ true
+ v120
+
+
+ DynamicLibrary
+ true
+ v120
+
+
+ DynamicLibrary
+ false
+ true
+ v120
+
+
+ DynamicLibrary
+ false
+ true
+ v120
+
+
+ DynamicLibrary
+ false
+ true
+ v120
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+ false
+
+
+ false
+
+
+ false
+
+
+ false
+
+
+ false
+
+
+
+ Use
+ _WINRT_DLL;%(PreprocessorDefinitions)
+ pch.h
+ $(IntDir)pch.pch
+ $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)
+ /bigobj %(AdditionalOptions)
+ 28204
+ $(MSBuildProjectDirectory)/../../../../../protocols/platform/winrt/winrtInterface/winrtInterface/winrtInterface.Shared;%(AdditionalIncludeDirectories)
+
+
+ Console
+ runtimeobject.lib;%(AdditionalDependencies)
+ false
+
+
+
+
+ Use
+ _WINRT_DLL;NDEBUG;%(PreprocessorDefinitions)
+ pch.h
+ $(IntDir)pch.pch
+ $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)
+ /bigobj %(AdditionalOptions)
+ 28204
+ false
+
+
+ Console
+ runtimeobject.lib;%(AdditionalDependencies)
+ false
+
+
+
+
+
+ Use
+ _WINRT_DLL;%(PreprocessorDefinitions)
+ pch.h
+ $(IntDir)pch.pch
+ $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)
+ /bigobj %(AdditionalOptions)
+ 28204
+ $(MSBuildProjectDirectory)/../../../../../protocols/platform/winrt/winrtInterface/winrtInterface/winrtInterface.Shared;%(AdditionalIncludeDirectories)
+
+
+ Console
+ runtimeobject.lib;%(AdditionalDependencies)
+ false
+
+
+
+
+ Use
+ _WINRT_DLL;NDEBUG;%(PreprocessorDefinitions)
+ pch.h
+ $(IntDir)pch.pch
+ $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)
+ /bigobj %(AdditionalOptions)
+ 28204
+ $(ProjectDir)../../../../../protocols/platform/winrt/winrtInterface/winrtInterface/winrtInterface.Shared;%(AdditionalIncludeDirectories)
+ false
+
+
+ Console
+ runtimeobject.lib;%(AdditionalDependencies)
+ false
+
+
+
+
+
+ Use
+ _WINRT_DLL;%(PreprocessorDefinitions)
+ pch.h
+ $(IntDir)pch.pch
+ $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)
+ /bigobj %(AdditionalOptions)
+ 28204
+ $(MSBuildProjectDirectory)/../../../../../protocols/platform/winrt/winrtInterface/winrtInterface/winrtInterface.Shared;%(AdditionalIncludeDirectories)
+
+
+ Console
+ runtimeobject.lib;%(AdditionalDependencies)
+ false
+
+
+
+
+ Use
+ _WINRT_DLL;NDEBUG;%(PreprocessorDefinitions)
+ pch.h
+ $(IntDir)pch.pch
+ $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)
+ /bigobj %(AdditionalOptions)
+ 28204
+ false
+
+
+ Console
+ runtimeobject.lib;%(AdditionalDependencies)
+ false
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/plugins/microsoftiap/proj.win8.1-universal/microsoftiap/microsoftiap.Windows/microsoftiap.Windows.vcxproj.filters b/plugins/microsoftiap/proj.win8.1-universal/microsoftiap/microsoftiap.Windows/microsoftiap.Windows.vcxproj.filters
new file mode 100644
index 00000000..a7761ab0
--- /dev/null
+++ b/plugins/microsoftiap/proj.win8.1-universal/microsoftiap/microsoftiap.Windows/microsoftiap.Windows.vcxproj.filters
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/plugins/microsoftiap/proj.win8.1-universal/microsoftiap/microsoftiap.WindowsPhone/microsoftiap.WindowsPhone.vcxproj b/plugins/microsoftiap/proj.win8.1-universal/microsoftiap/microsoftiap.WindowsPhone/microsoftiap.WindowsPhone.vcxproj
new file mode 100644
index 00000000..3c930dd4
--- /dev/null
+++ b/plugins/microsoftiap/proj.win8.1-universal/microsoftiap/microsoftiap.WindowsPhone/microsoftiap.WindowsPhone.vcxproj
@@ -0,0 +1,148 @@
+
+
+
+
+ Debug
+ ARM
+
+
+ Debug
+ Win32
+
+
+ Release
+ ARM
+
+
+ Release
+ Win32
+
+
+
+
+ {35acd56c-dee1-477b-bec0-c963c7937623}
+
+
+
+ {0852a95a-5a0d-401e-b815-1b52342c5f9c}
+ microsoftiap
+ en-US
+ 12.0
+ true
+ Windows Phone
+ 8.1
+ CodeSharingWindowsRuntimeComponent
+
+
+
+ DynamicLibrary
+ true
+ v120_wp81
+
+
+ DynamicLibrary
+ true
+ v120_wp81
+
+
+ DynamicLibrary
+ false
+ true
+ v120_wp81
+
+
+ DynamicLibrary
+ false
+ true
+ v120_wp81
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Use
+ _WINRT_DLL;%(PreprocessorDefinitions)
+ pch.h
+ $(IntDir)pch.pch
+ /bigobj %(AdditionalOptions)
+ true
+ $(MSBuildProjectDirectory)/../../../../../protocols/platform/winrt/winrtInterface/winrtInterface/winrtInterface.Shared;%(AdditionalIncludeDirectories)
+
+
+ Console
+ false
+
+
+
+
+ Use
+ _WINRT_DLL;NDEBUG;%(PreprocessorDefinitions)
+ pch.h
+ $(IntDir)pch.pch
+ /bigobj %(AdditionalOptions)
+ true
+ $(MSBuildProjectDirectory)/../../../../../protocols/platform/winrt/winrtInterface/winrtInterface/winrtInterface.Shared;%(AdditionalIncludeDirectories)
+ false
+
+
+ Console
+ false
+
+
+
+
+
+ Use
+ _WINRT_DLL;%(PreprocessorDefinitions)
+ pch.h
+ $(IntDir)pch.pch
+ /bigobj %(AdditionalOptions)
+ true
+ $(MSBuildProjectDirectory)/../../../../../protocols/platform/winrt/winrtInterface/winrtInterface/winrtInterface.Shared;%(AdditionalIncludeDirectories)
+
+
+ Console
+ false
+
+
+
+
+ Use
+ _WINRT_DLL;NDEBUG;%(PreprocessorDefinitions)
+ pch.h
+ $(IntDir)pch.pch
+ /bigobj %(AdditionalOptions)
+ true
+ $(MSBuildProjectDirectory)/../../../../../protocols/platform/winrt/winrtInterface/winrtInterface/winrtInterface.Shared;%(AdditionalIncludeDirectories)
+ false
+
+
+ Console
+ false
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/plugins/microsoftiap/proj.win8.1-universal/microsoftiap/microsoftiap.WindowsPhone/microsoftiap.WindowsPhone.vcxproj.filters b/plugins/microsoftiap/proj.win8.1-universal/microsoftiap/microsoftiap.WindowsPhone/microsoftiap.WindowsPhone.vcxproj.filters
new file mode 100644
index 00000000..a7761ab0
--- /dev/null
+++ b/plugins/microsoftiap/proj.win8.1-universal/microsoftiap/microsoftiap.WindowsPhone/microsoftiap.WindowsPhone.vcxproj.filters
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/protocols/include/PluginFactory.h b/protocols/include/PluginFactory.h
index c331eb87..cad58d0e 100644
--- a/protocols/include/PluginFactory.h
+++ b/protocols/include/PluginFactory.h
@@ -38,12 +38,23 @@ class PluginFactory
/** Destory the instance of PluginFactory */
static void purgeFactory();
+#ifdef CC_TARGET_PLATFORM
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
+ void setDispatcher(Windows::UI::Core::CoreDispatcher^ d);
+#endif
+#endif
+
private:
friend class PluginManager;
PluginFactory(void);
/** create the plugin by name */
PluginProtocol* createPlugin(const char* name);
+#ifdef CC_TARGET_PLATFORM
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
+ Windows::UI::Core::CoreDispatcher^ dispatcher;
+#endif
+#endif
};
}} //namespace cocos2d { namespace plugin {
diff --git a/protocols/platform/winrt/.gitignore b/protocols/platform/winrt/.gitignore
new file mode 100644
index 00000000..f50cfc06
--- /dev/null
+++ b/protocols/platform/winrt/.gitignore
@@ -0,0 +1,2 @@
+winrtInterface.winmd
+winrtInterface_h.h
diff --git a/protocols/platform/winrt/FacebookAgent.cpp b/protocols/platform/winrt/FacebookAgent.cpp
new file mode 100644
index 00000000..87c3b922
--- /dev/null
+++ b/protocols/platform/winrt/FacebookAgent.cpp
@@ -0,0 +1,175 @@
+
+/****************************************************************************
+Copyright (c) 2012-2013 cocos2d-x.org
+Copyright (c) Microsoft Open Technologies, Inc.
+Copyright (c) Microsoft Corporation.
+
+http://www.cocos2d-x.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+****************************************************************************/
+#include "FacebookAgent.h"
+
+using namespace cocos2d::plugin;
+
+class AgentManager;
+ /** Get singleton of FacebookAgent */
+FacebookAgent* FacebookAgent::getInstance(){
+ return nullptr;
+}
+/** Destroy singleton of FacebookAgent */
+void FacebookAgent::destroyInstance(){
+
+}
+
+/**
+@brief log in
+@param cb callback of login
+*/
+void FacebookAgent::login(FBCallback cb){
+}
+
+/**
+@brief log in with specific permissions
+@param permissoins different permissions splited by ','
+@param cb callback of login
+*/
+void FacebookAgent::login(std::string& permissions, FBCallback cb){
+
+}
+
+/**
+@brief log out
+*/
+void FacebookAgent::logout(){
+}
+
+/**
+@brief Check whether the user logined or not
+*/
+bool FacebookAgent::isLoggedIn(){
+ return false;
+}
+/**
+@brief get UserID
+**/
+std::string FacebookAgent::getUserID(){
+ return "";
+}
+/**
+@brief get AccessToken
+*/
+std::string FacebookAgent::getAccessToken(){
+ return "";
+}
+
+/**
+@brief get permissoin list
+*/
+std::string FacebookAgent::getPermissionList(){
+ return "";
+}
+
+/**
+@brief share
+@param info share information
+@param cb callback of share
+*/
+void FacebookAgent::share(FBInfo &info, FBCallback cb){
+}
+/**
+@brief open a dialog of Facebook app
+@param info share information
+@param cb callback of dialog
+*/
+void FacebookAgent::dialog(FBInfo &info, FBCallback cb){
+}
+bool FacebookAgent::canPresentDialogWithParams(FBInfo &info){
+ return false;
+}
+void FacebookAgent::webDialog(FBInfo &info, FBCallback cb){
+}
+
+/**
+@brief open the app request dialog of Facebook app
+@param info share information
+@param cb callback of dialog
+*/
+void FacebookAgent::appRequest(FBInfo &info, FBCallback cb){
+}
+
+/**
+@brief use Facebook Open Graph api
+@param path path of Open Graph api
+@param method HttpMethod
+@param params request parameters
+@param cb callback of request
+*/
+void FacebookAgent::api(std::string &path, int method, FBInfo ¶ms, FBCallback cb){
+}
+
+/**
+@brief Notifies the events system that the app has launched & logs an activatedApp event.
+*/
+void FacebookAgent::activateApp(){
+}
+
+/**
+@brief Log an app event with the specified name, supplied value, and set of parameters.
+*/
+void FacebookAgent::logEvent(std::string& eventName){
+
+}
+
+void FacebookAgent::logEvent(std::string& eventName, float valueToSum){
+
+}
+
+void FacebookAgent::logEvent(std::string& eventName, FBInfo& parameters){
+
+}
+
+void FacebookAgent::logEvent(std::string& eventName, float valueToSum, FBInfo& parameters){
+
+}
+
+/*
+@breif Log an app event for purchase.
+*/
+void FacebookAgent::logPurchase(float mount, std::string currency){
+
+}
+
+void FacebookAgent::logPurchase(float mount, std::string currency, FBInfo &parmeters){
+
+}
+/*
+@breif return the version of Facebook SDK for Cocos
+*/
+std::string FacebookAgent::getSDKVersion(){
+ return "";
+}
+
+FacebookAgent::FBCallback FacebookAgent::getRequestCallback(int index){
+ FBCallback fbcb;
+ return fbcb;
+}
+FacebookAgent::FacebookAgent(){
+
+}
\ No newline at end of file
diff --git a/protocols/platform/winrt/PluginFactory.cpp b/protocols/platform/winrt/PluginFactory.cpp
new file mode 100644
index 00000000..ee4e5296
--- /dev/null
+++ b/protocols/platform/winrt/PluginFactory.cpp
@@ -0,0 +1,251 @@
+
+/****************************************************************************
+Copyright (c) 2012-2013 cocos2d-x.org
+Copyright (c) Microsoft Open Technologies, Inc.
+Copyright (c) Microsoft Corporation.
+
+http://www.cocos2d-x.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+****************************************************************************/
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "PluginFactory.h"
+#include "PluginProtocol.h"
+#include "ProtocolAds.h"
+#include "ProtocolAnalytics.h"
+#include "ProtocolIAP.h"
+#include "ProtocolSocial.h"
+#include "ProtocolShare.h"
+#include "ProtocolUser.h"
+#include "PluginMap.h"
+#include "util.h"
+
+using namespace cocos2d::plugin;
+using namespace ABI::Windows::Foundation;
+using namespace Microsoft::WRL;
+using namespace Microsoft::WRL::Wrappers;
+using namespace cocosPluginWinrtBridge;
+
+typedef HRESULT(WINAPI *DllActivationFactoryPtr)(HSTRING, IActivationFactory **);
+
+static PluginFactory* s_pFactory;
+
+PluginFactory::PluginFactory() {
+}
+
+PluginFactory::~PluginFactory() {
+}
+
+void PluginFactory::setDispatcher(Windows::UI::Core::CoreDispatcher^ d) {
+ dispatcher = d;
+}
+
+PluginFactory* PluginFactory::getInstance() {
+ if (s_pFactory == nullptr) {
+ s_pFactory = new PluginFactory();
+ }
+ return s_pFactory;
+}
+
+void PluginFactory::purgeFactory() {
+ if (s_pFactory != nullptr) {
+ delete s_pFactory;
+ s_pFactory = nullptr;
+ }
+}
+
+PluginProtocol* PluginFactory::createPlugin(const char* name) {
+ std::wstring suffix;
+#if WINAPI_FAMILY==WINAPI_FAMILY_PC_APP
+ suffix = L".Windows.dll";
+#else
+ suffix = L".WindowsPhone.dll";
+#endif
+ std::wstring wname(name, name + strlen(name));
+
+ HMODULE module = LoadPackagedLibrary((wname + suffix).c_str(), 0);
+ if (module == nullptr)
+ {
+ OutputDebugString(L"Failed to load Plugin ");
+ OutputDebugString(wname.c_str());
+ return nullptr;
+ }
+ DllActivationFactoryPtr _DllActivationFactory = (DllActivationFactoryPtr)GetProcAddress(module, "DllGetActivationFactory");
+ if (!_DllActivationFactory)
+ {
+ OutputDebugString(L"Failed to load Plugin ActivationFactory entrypoint");
+ return nullptr;
+ }
+
+ HString Plugin, PluginAnalytics;
+ Plugin.Set((wname + L"." + wname).c_str());
+ ComPtrfactoryPlugin;
+ _DllActivationFactory(Plugin.Get(), factoryPlugin.GetAddressOf());
+
+ if (factoryPlugin.Get() == nullptr)
+ {
+ OutputDebugStringW((L"Plugin failed to implement class " + wname + L"." + wname).c_str());
+ return nullptr;
+ }
+ ComPtr instance;
+ factoryPlugin.Get()->ActivateInstance(instance.GetAddressOf());
+ if (instance.Get() == nullptr)
+ {
+ OutputDebugString(L"Failed to create instance of plugin");
+ return nullptr;
+ }
+
+ Platform::Object^ base = reinterpret_cast(instance.Get());
+ cocosPluginWinrtBridge::IProtocol^ protocol;
+ try {
+ protocol = safe_cast(base);
+ }
+ catch (Platform::Exception^ e) {
+ OutputDebugString(L"Plugin Fails to Implement IProtocol");
+ return nullptr;
+ }
+ // ProtocolIAP
+ try {
+ cocosPluginWinrtBridge::IProtocolIAP^ iap = safe_cast(protocol);
+ ProtocolIAP *out = new ProtocolIAP();
+ PluginMap::mapIProtocol[out] = iap;
+ PluginMap::mapIProtocolIAP[out] = iap;
+ iap->setDispatcher(dispatcher);
+ // register protocol for plugin event
+ iap->OnPayResult += ref new cocosPluginWinrtBridge::OnPayResultHandler([out](cocosPluginWinrtBridge::PayResultCodeEnum ret, Platform::String^ msg) {
+ out->onPayResult((PayResultCode)ret, pluginx::util::PlatformStringToStdString(msg).c_str());
+ });
+ return out;
+ }
+ catch (Platform::Exception^ e) {
+ OutputDebugString(L"Plugin does not implement IProtocolIAP");
+ }
+ // ProtocolAnalytics
+ try {
+ cocosPluginWinrtBridge::IProtocolAnalytics^ analytics = safe_cast(protocol);
+ ProtocolAnalytics *out = new ProtocolAnalytics();
+ PluginMap::mapIProtocol[out] = analytics;
+ PluginMap::mapIProtocolAnalytics[out] = analytics;
+ return out;
+ }
+ catch (Platform::Exception^ e) {
+ OutputDebugString(L"Plugin does not implement IProtocolAnalytics");
+ }
+ // ProtocolSocial
+ try {
+ cocosPluginWinrtBridge::IProtocolSocial^ social = safe_cast(protocol);
+ ProtocolSocial* out = new ProtocolSocial();
+ PluginMap::mapIProtocol[out] = social;
+ PluginMap::mapIProtocolSocial[out] = social;
+ // unfortunately the whole function needs to be here because ProtocolSocial doesn't have an OnResult function in its header
+ social->OnSocialResult += ref new cocosPluginWinrtBridge::SocialResultHandler([out](cocosPluginWinrtBridge::SocialReturnCode retCode) {
+ SocialRetCode cocosRetCode = (SocialRetCode)retCode;
+#pragma warning(suppress: 4996) // getListener is deprecated, but we still need to support it
+ SocialListener* listener = out->getListener();
+ std::function callback = out->getCallback();
+ if (listener != nullptr) {
+ listener->onSocialResult(cocosRetCode, ""); // TODO what should the msg be?
+ }
+ if (callback != nullptr) {
+ callback((int)cocosRetCode, std::string("")); // TODO what should the msg be?
+ }
+ });
+ return out;
+ }
+ catch (Platform::Exception^ e) {
+ OutputDebugString(L"Plugin does not implement IProtocolSocial");
+ }
+ // ProtocolShare
+ try {
+ cocosPluginWinrtBridge::IProtocolShare^ share = safe_cast(protocol);
+ ProtocolShare* out = new ProtocolShare();
+ PluginMap::mapIProtocol[out] = share;
+ PluginMap::mapIProtocolShare[out] = share;
+ share->OnShareResult += ref new cocosPluginWinrtBridge::ShareResultHandler([out](cocosPluginWinrtBridge::ShareResultCodeEnum ret, Platform::String^ msg) {
+ out->onShareResult((ShareResultCode)ret, pluginx::util::PlatformStringToStdString(msg).c_str());
+ });
+ return out;
+ }
+ catch (Platform::Exception^ e) {
+ OutputDebugString(L"Plugin does not implement IProtocolShare");
+ }
+ // ProtocolUser
+ try {
+ cocosPluginWinrtBridge::IProtocolUser^ user = safe_cast(protocol);
+ ProtocolUser* out = new ProtocolUser();
+ PluginMap::mapIProtocol[out] = user;
+ PluginMap::mapIProtocolUser[out] = user;
+ user->OnUserAction += ref new cocosPluginWinrtBridge::UserActionResultHandler([out](cocosPluginWinrtBridge::UserActionResult ret) {
+ UserActionResultCode cocosRetCode = (UserActionResultCode)ret;
+#pragma warning(suppress: 4996) // getListener is deprecated, but we still need to support it
+ UserActionListener* listener = out->getActionListener();
+ std::function callback = out->getCallback();
+ if (listener != nullptr) {
+ listener->onActionResult(out, cocosRetCode, ""); // TODO what should the msg be?
+ }
+ if (callback != nullptr) {
+ callback((int)cocosRetCode, std::string("")); // TODO what should the msg be?
+ }
+ });
+ }
+ catch (Platform::Exception^ e) {
+ OutputDebugString(L"Plugin does not implement IProtocolUser");
+ }
+ // ProtocolAds
+ try {
+ cocosPluginWinrtBridge::IProtocolAds^ ads = safe_cast(protocol);
+ ProtocolAds* out = new ProtocolAds();
+ PluginMap::mapIProtocol[out] = ads;
+ PluginMap::mapIProtocolAds[out] = ads;
+ ads->OnAdsResult += ref new cocosPluginWinrtBridge::AdsResultHandler([out](cocosPluginWinrtBridge::AdsResultCodeEnum result, Platform::String^ msg) {
+#pragma warning(suppress: 4996) // getListener is deprecated, but we still need to support it
+ AdsListener* listener = out->getAdsListener();
+ if (listener != nullptr) {
+ listener->onAdsResult((AdsResultCode)result, pluginx::util::PlatformStringToCharArray(msg));
+ }
+ // TODO is the callback field for this callback or the other one?
+ });
+ ads->OnPlayerGetPoints += ref new cocosPluginWinrtBridge::PlayerGetPointsHandler([out](int points) {
+#pragma warning(suppress: 4996) // getListener is deprecated, but we still need to support it
+ AdsListener* listener = out->getAdsListener();
+ if (listener != nullptr) {
+ listener->onPlayerGetPoints(out, points);
+ }
+ // TODO is the callback field for this callback or the other one?
+
+ });
+ }
+ catch (Platform::Exception^ e) {
+ OutputDebugString(L"Plugin does not implement IProtocolAds");
+ }
+
+ OutputDebugString(L"Plugin Fails to Implement any Protocols");
+ OutputDebugString(L"Protocol Failed to Load ...");
+ return nullptr;
+}
diff --git a/protocols/platform/winrt/PluginMap.cpp b/protocols/platform/winrt/PluginMap.cpp
new file mode 100644
index 00000000..a601723c
--- /dev/null
+++ b/protocols/platform/winrt/PluginMap.cpp
@@ -0,0 +1,40 @@
+
+/****************************************************************************
+Copyright (c) 2012-2013 cocos2d-x.org
+Copyright (c) Microsoft Open Technologies, Inc.
+Copyright (c) Microsoft Corporation.
+
+http://www.cocos2d-x.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+****************************************************************************/
+
+#include "PluginMap.h"
+
+using namespace cocos2d::plugin;
+
+std::unordered_map PluginMap::mapIProtocol;
+std::unordered_map PluginMap::mapIProtocolAnalytics;
+std::unordered_map PluginMap::mapIProtocolIAP;
+std::unordered_map PluginMap::mapIProtocolSocial;
+std::unordered_map PluginMap::mapIProtocolShare;
+std::unordered_map PluginMap::mapIProtocolUser;
+std::unordered_map PluginMap::mapIProtocolAds;
+
+//void PluginMap::addPlugin(st)
diff --git a/protocols/platform/winrt/PluginMap.h b/protocols/platform/winrt/PluginMap.h
new file mode 100644
index 00000000..ae6f5f32
--- /dev/null
+++ b/protocols/platform/winrt/PluginMap.h
@@ -0,0 +1,48 @@
+
+/****************************************************************************
+Copyright (c) 2012-2013 cocos2d-x.org
+Copyright (c) Microsoft Open Technologies, Inc.
+Copyright (c) Microsoft Corporation.
+
+http://www.cocos2d-x.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+****************************************************************************/
+
+#include
+#include
+#include
+
+#include "PluginProtocol.h"
+
+class PluginMap {
+
+public:
+ void addPlugin(std::string name);
+ // TODO should all of the void* be changed to their correct types? we know them
+ static std::unordered_map mapIProtocol;
+ static std::unordered_map mapIProtocolAnalytics;
+ static std::unordered_map mapIProtocolIAP;
+ static std::unordered_map mapIProtocolSocial;
+ static std::unordered_map mapIProtocolShare;
+ static std::unordered_map mapIProtocolUser;
+ static std::unordered_map mapIProtocolAds;
+private:
+ PluginMap(){}
+};
diff --git a/protocols/platform/winrt/PluginParamWinRT.cpp b/protocols/platform/winrt/PluginParamWinRT.cpp
new file mode 100644
index 00000000..89722aab
--- /dev/null
+++ b/protocols/platform/winrt/PluginParamWinRT.cpp
@@ -0,0 +1,62 @@
+
+/****************************************************************************
+Copyright (c) 2012-2013 cocos2d-x.org
+Copyright (c) Microsoft Open Technologies, Inc.
+Copyright (c) Microsoft Corporation.
+
+http://www.cocos2d-x.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+****************************************************************************/
+
+#include "PluginParamWinRT.h"
+
+namespace cocos2d {
+
+ namespace pluginparam {
+
+ void PluginParamWinRT::setCurrentType(cocosPluginWinrtBridge::ParamTypeEnum t) {
+ paramType = t;
+ }
+
+ void PluginParamWinRT::setIntValue(int val) {
+ intValue = val;
+ }
+
+ void PluginParamWinRT::setFloatValue(float val) {
+ floatValue = val;
+ }
+
+ void PluginParamWinRT::setBoolValue(bool val) {
+ boolValue = val;
+ }
+
+ void PluginParamWinRT::setStringValue(Platform::String^ val) {
+ strValue = val;
+ }
+
+ void PluginParamWinRT::setMapValue(IMap^ val) {
+ mapValue = val;
+ }
+
+ void PluginParamWinRT::setStrMapValue(IMap^ val) {
+ strMapValue = val;
+ }
+ }
+}
\ No newline at end of file
diff --git a/protocols/platform/winrt/PluginParamWinRT.h b/protocols/platform/winrt/PluginParamWinRT.h
new file mode 100644
index 00000000..bb6bfffc
--- /dev/null
+++ b/protocols/platform/winrt/PluginParamWinRT.h
@@ -0,0 +1,72 @@
+
+/****************************************************************************
+Copyright (c) 2012-2013 cocos2d-x.org
+Copyright (c) Microsoft Open Technologies, Inc.
+Copyright (c) Microsoft Corporation.
+
+http://www.cocos2d-x.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+****************************************************************************/
+
+#pragma once
+
+#include
+
+#include "PluginParam.h"
+
+using namespace Windows::Foundation::Collections;
+
+namespace cocos2d {
+
+ namespace pluginparam {
+
+ public ref class PluginParamWinRT sealed : public cocosPluginWinrtBridge::IPluginParam{
+
+ public:
+
+ virtual cocosPluginWinrtBridge::ParamTypeEnum getCurrentType() { return paramType; }
+ virtual int getIntValue() { return intValue; }
+ virtual float getFloatValue() { return floatValue; }
+ virtual bool getBoolValue() { return boolValue; }
+ virtual Platform::String^ getStringValue() { return strValue; }
+ virtual IMap^ getMapValue() { return mapValue; }
+ virtual IMap^ getStrMapValue() { return strMapValue; }
+
+ void setCurrentType(cocosPluginWinrtBridge::ParamTypeEnum t);
+ void setIntValue(int val);
+ void setFloatValue(float val);
+ void setBoolValue(bool val);
+ void setStringValue(Platform::String^ val);
+ void setMapValue(IMap^ val);
+ void setStrMapValue(IMap^ val);
+
+ private:
+ cocosPluginWinrtBridge::ParamTypeEnum paramType;
+ int intValue;
+ float floatValue;
+ bool boolValue;
+ Platform::String^ strValue;
+ IMap^ mapValue;
+ IMap^ strMapValue;
+
+ };
+
+ }
+}
diff --git a/protocols/platform/winrt/PluginProtocol.cpp b/protocols/platform/winrt/PluginProtocol.cpp
new file mode 100644
index 00000000..3b932411
--- /dev/null
+++ b/protocols/platform/winrt/PluginProtocol.cpp
@@ -0,0 +1,184 @@
+
+/****************************************************************************
+Copyright (c) 2012-2013 cocos2d-x.org
+Copyright (c) Microsoft Open Technologies, Inc.
+Copyright (c) Microsoft Corporation.
+
+http://www.cocos2d-x.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+****************************************************************************/
+
+#include
+#include
+
+#include "PluginProtocol.h"
+#include "util.h"
+#include "PluginMap.h"
+#include "PluginParamWinRT.h"
+
+using namespace cocos2d::plugin;
+using namespace pluginx;
+using namespace Microsoft::WRL;
+using namespace Microsoft::WRL::Wrappers;
+using namespace cocosPluginWinrtBridge;
+using namespace pluginx::util;
+using namespace Platform::Collections;
+using namespace cocos2d::pluginparam;
+
+PluginProtocol::~PluginProtocol() {
+}
+
+std::string PluginProtocol::getPluginVersion() {
+ return PlatformStringToStdString(PluginMap::mapIProtocol[this]->getPluginVersion());
+}
+
+std::string PluginProtocol::getSDKVersion() {
+ return PlatformStringToStdString(PluginMap::mapIProtocol[this]->getSDKVersion());
+}
+
+void PluginProtocol::setDebugMode(bool bDebug) {
+ PluginMap::mapIProtocol[this]->setDebugMode(bDebug);
+}
+
+void PluginProtocol::callFuncWithParam(const char* funcName, PluginParam* param, ...) {
+ std::vector allParams;
+ if (param != NULL) {
+ allParams.push_back(param);
+ PluginParam* pArg = NULL;
+ va_list argp;
+ va_start(argp, param);
+ while (true) {
+ pArg = va_arg(argp, PluginParam*);
+ if (pArg == NULL) {
+ break;
+ }
+ allParams.push_back(pArg);
+ }
+ va_end(argp);
+ }
+ callFuncWithParam(funcName, allParams);
+}
+
+void PluginProtocol::callFuncWithParam(const char* funcName, std::vector params) {
+ Platform::String^ platFuncName = util::charArrayToPlatformString(funcName);
+ IVector^ platParams = util::stdVectorToPlatformVector(params);
+ PluginMap::mapIProtocol[this]->callFuncWithParam(platFuncName, platParams);
+}
+
+std::string PluginProtocol::callStringFuncWithParam(const char* funcName, PluginParam* param, ...) {
+ std::vector allParams;
+ if (param != NULL) {
+ allParams.push_back(param);
+ PluginParam* pArg = NULL;
+ va_list argp;
+ va_start(argp, param);
+ while (true) {
+ pArg = va_arg(argp, PluginParam*);
+ if (pArg == NULL) {
+ break;
+ }
+ allParams.push_back(pArg);
+ }
+ va_end(argp);
+ }
+ return callStringFuncWithParam(funcName, allParams);
+}
+
+std::string PluginProtocol::callStringFuncWithParam(const char* funcName, std::vector params) {
+ Platform::String^ platFuncName = util::charArrayToPlatformString(funcName);
+ Vector^ platParams = util::stdVectorToPlatformVector(params);
+ return util::PlatformStringToStdString(PluginMap::mapIProtocol[this]->callStringFuncWithParam(platFuncName, platParams));
+}
+
+int PluginProtocol::callIntFuncWithParam(const char* funcName, PluginParam* param, ...) {
+ std::vector allParams;
+ if (param != NULL) {
+ allParams.push_back(param);
+ PluginParam* pArg = NULL;
+ va_list argp;
+ va_start(argp, param);
+ while (true) {
+ pArg = va_arg(argp, PluginParam*);
+ if (pArg == NULL) {
+ break;
+ }
+ allParams.push_back(pArg);
+ }
+ va_end(argp);
+ }
+ return callIntFuncWithParam(funcName, allParams);
+}
+
+int PluginProtocol::callIntFuncWithParam(const char* funcName, std::vector params) {
+ Platform::String^ platFuncName = util::charArrayToPlatformString(funcName);
+ Vector^ platParams = util::stdVectorToPlatformVector(params);
+ return PluginMap::mapIProtocol[this]->callIntFuncWithParam(platFuncName, platParams);
+}
+
+bool PluginProtocol::callBoolFuncWithParam(const char* funcName, PluginParam* param, ...) {
+ std::vector allParams;
+ if (param != NULL) {
+ allParams.push_back(param);
+ PluginParam* pArg = NULL;
+ va_list argp;
+ va_start(argp, param);
+ while (true) {
+ pArg = va_arg(argp, PluginParam*);
+ if (pArg == NULL) {
+ break;
+ }
+ allParams.push_back(pArg);
+ }
+ va_end(argp);
+ }
+ return callBoolFuncWithParam(funcName, allParams);
+}
+
+bool PluginProtocol::callBoolFuncWithParam(const char* funcName, std::vector params) {
+ Platform::String^ platFuncName = util::charArrayToPlatformString(funcName);
+ Vector^ platParams = util::stdVectorToPlatformVector(params);
+ return PluginMap::mapIProtocol[this]->callBoolFuncWithParam(platFuncName, platParams);
+}
+
+float PluginProtocol::callFloatFuncWithParam(const char* funcName, PluginParam* param, ...) {
+ std::vector allParams;
+ if (param != NULL) {
+ allParams.push_back(param);
+ PluginParam* pArg = NULL;
+ va_list argp;
+ va_start(argp, param);
+ while (true) {
+ pArg = va_arg(argp, PluginParam*);
+ if (pArg == NULL) {
+ break;
+ }
+ allParams.push_back(pArg);
+ }
+ va_end(argp);
+ }
+ return callFloatFuncWithParam(funcName, allParams);
+}
+
+float PluginProtocol::callFloatFuncWithParam(const char* funcName, std::vector params) {
+ Platform::String^ platFuncName = util::charArrayToPlatformString(funcName);
+ Vector^ platParams = util::stdVectorToPlatformVector(params);
+ return PluginMap::mapIProtocol[this]->callFloatFuncWithParam(platFuncName, platParams);
+}
+
diff --git a/protocols/platform/winrt/ProtocolAds.cpp b/protocols/platform/winrt/ProtocolAds.cpp
new file mode 100644
index 00000000..f57d4357
--- /dev/null
+++ b/protocols/platform/winrt/ProtocolAds.cpp
@@ -0,0 +1,61 @@
+
+/****************************************************************************
+Copyright (c) 2012-2013 cocos2d-x.org
+Copyright (c) Microsoft Open Technologies, Inc.
+Copyright (c) Microsoft Corporation.
+
+http://www.cocos2d-x.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+****************************************************************************/
+
+#include
+
+#include "ProtocolAds.h"
+#include "util.h"
+#include "PluginMap.h"
+
+using namespace cocos2d::plugin;
+using namespace pluginx;
+
+ProtocolAds::ProtocolAds() {
+ _listener = nullptr;
+ _callback = nullptr;
+}
+
+ProtocolAds::~ProtocolAds() {
+ PluginMap::mapIProtocol.erase(this);
+ PluginMap::mapIProtocolAds.erase(this);
+}
+
+void ProtocolAds::configDeveloperInfo(TAdsDeveloperInfo devInfo) {
+ PluginMap::mapIProtocolAds[this]->configDeveloperInfo(pluginx::util::stdStrMapToPlatformStrMap(&devInfo));
+}
+
+void ProtocolAds::showAds(TAdsInfo info, AdsPos pos){
+ PluginMap::mapIProtocolAds[this]->showAds(pluginx::util::stdStrMapToPlatformStrMap(&info), (cocosPluginWinrtBridge::AdsPosition)pos);
+}
+
+void ProtocolAds::hideAds(TAdsInfo type) {
+ PluginMap::mapIProtocolAds[this]->hideAds(pluginx::util::stdStrMapToPlatformStrMap(&type));
+}
+
+void ProtocolAds::spendPoints(int points) {
+ PluginMap::mapIProtocolAds[this]->spendPoints(points);
+}
diff --git a/protocols/platform/winrt/ProtocolAnalytics.cpp b/protocols/platform/winrt/ProtocolAnalytics.cpp
new file mode 100644
index 00000000..9b253287
--- /dev/null
+++ b/protocols/platform/winrt/ProtocolAnalytics.cpp
@@ -0,0 +1,104 @@
+
+/****************************************************************************
+Copyright (c) 2012-2013 cocos2d-x.org
+Copyright (c) Microsoft Open Technologies, Inc.
+Copyright (c) Microsoft Corporation.
+
+http://www.cocos2d-x.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+****************************************************************************/
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "ProtocolAnalytics.h"
+#include "util.h"
+#include "PluginMap.h"
+
+using namespace cocosPluginWinrtBridge;
+using namespace cocos2d::plugin;
+using namespace pluginx;
+using namespace Microsoft::WRL;
+using namespace pluginx::util;
+using namespace ABI::Windows::Foundation::Collections;
+using namespace Platform::Collections;
+using namespace Platform;
+
+ProtocolAnalytics::ProtocolAnalytics() {
+
+}
+
+ProtocolAnalytics::~ProtocolAnalytics() {
+ PluginMap::mapIProtocol.erase(this);
+ PluginMap::mapIProtocolAnalytics.erase(this);
+}
+
+void ProtocolAnalytics::startSession(const char* appKey) {
+ PluginMap::mapIProtocolAnalytics[this]->startSession(charArrayToPlatformString(appKey));
+}
+
+void ProtocolAnalytics::stopSession() {
+ PluginMap::mapIProtocolAnalytics[this]->stopSession();
+}
+
+void ProtocolAnalytics::setSessionContinueMillis(long millis) {
+ PluginMap::mapIProtocolAnalytics[this]->setSessionContinueMillis(millis);
+}
+
+void ProtocolAnalytics::logError(const char* errorId, const char* message) {
+ PluginMap::mapIProtocolAnalytics[this]->logError(charArrayToPlatformString(errorId), charArrayToPlatformString(message));
+}
+
+void ProtocolAnalytics::logEvent(const char* eventId, LogEventParamMap* paramMap) {
+ if (paramMap)
+ {
+ Map ^pMap = ref new Map();
+ for (auto pair : *paramMap)
+ {
+ pMap->Insert(stdStringToPlatformString(pair.first), stdStringToPlatformString(pair.second));
+ }
+ PluginMap::mapIProtocolAnalytics[this]->logEvent(util::charArrayToPlatformString(eventId), pMap);
+ return;
+ }
+
+ PluginMap::mapIProtocolAnalytics[this]->logEvent(util::charArrayToPlatformString(eventId), nullptr);
+}
+
+void ProtocolAnalytics::logTimedEventBegin(const char* eventId) {
+ PluginMap::mapIProtocolAnalytics[this]->logTimedEventBegin(charArrayToPlatformString(eventId));
+}
+
+void ProtocolAnalytics::logTimedEventEnd(const char* eventId) {
+ PluginMap::mapIProtocolAnalytics[this]->logTimedEventEnd(charArrayToPlatformString(eventId));
+}
+
+void ProtocolAnalytics::setCaptureUncaughtException(bool enabled) {
+ PluginMap::mapIProtocolAnalytics[this]->setCaptureUncaughtException(enabled);
+}
diff --git a/protocols/platform/winrt/ProtocolIAP.cpp b/protocols/platform/winrt/ProtocolIAP.cpp
new file mode 100644
index 00000000..2d227214
--- /dev/null
+++ b/protocols/platform/winrt/ProtocolIAP.cpp
@@ -0,0 +1,72 @@
+
+/****************************************************************************
+Copyright (c) 2012-2013 cocos2d-x.org
+Copyright (c) Microsoft Open Technologies, Inc.
+Copyright (c) Microsoft Corporation.
+
+http://www.cocos2d-x.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+****************************************************************************/
+
+#include "ProtocolIAP.h"
+#include "util.h"
+#include "PluginMap.h"
+
+using namespace cocos2d::plugin;
+using namespace pluginx;
+using namespace cocosPluginWinrtBridge;
+
+ProtocolIAP::ProtocolIAP() {
+ _listener = nullptr;
+ _callback = nullptr;
+}
+
+ProtocolIAP::~ProtocolIAP() {
+ PluginMap::mapIProtocol.erase(this);
+ PluginMap::mapIProtocolIAP.erase(this);
+}
+
+void ProtocolIAP::configDeveloperInfo(TIAPDeveloperInfo devInfo) {
+ PluginMap::mapIProtocolIAP[this]->configDeveloperInfo(util::stdStrMapToPlatformStrMap(&devInfo));
+}
+
+void ProtocolIAP::payForProduct(TProductInfo info) {
+ PluginMap::mapIProtocolIAP[this]->payForProduct(util::stdStrMapToPlatformStrMap(&info));
+}
+
+void ProtocolIAP::payForProduct(TProductInfo info, ProtocolIAPCallback cb) {
+ _callback = cb;
+ payForProduct(info);
+}
+
+void ProtocolIAP::setResultListener(PayResultListener* pListener) {
+ _listener = pListener;
+}
+
+void ProtocolIAP::onPayResult(PayResultCode ret, const char* msg) {
+ if (_listener != nullptr) {
+ std::map empty;
+ _listener->onPayResult(ret, msg, empty); // TODO where does the product info come from?
+ }
+ if (_callback != nullptr) {
+ std::string message(msg);
+ _callback(ret, message);
+ }
+}
diff --git a/protocols/platform/winrt/ProtocolShare.cpp b/protocols/platform/winrt/ProtocolShare.cpp
new file mode 100644
index 00000000..43c55f0a
--- /dev/null
+++ b/protocols/platform/winrt/ProtocolShare.cpp
@@ -0,0 +1,103 @@
+
+/****************************************************************************
+Copyright (c) 2012-2013 cocos2d-x.org
+Copyright (c) Microsoft Open Technologies, Inc.
+Copyright (c) Microsoft Corporation.
+
+http://www.cocos2d-x.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+****************************************************************************/
+
+#include "ProtocolShare.h"
+#include "PluginMap.h"
+#include "util.h"
+
+using namespace cocos2d::plugin;
+
+ProtocolShare::ProtocolShare() {
+ _listener = nullptr;
+ _callback = nullptr;
+}
+
+ProtocolShare::~ProtocolShare() {
+ PluginMap::mapIProtocol.erase(this);
+ PluginMap::mapIProtocolShare.erase(this);
+}
+
+ /**
+ @brief config the share developer info
+ @param devInfo This parameter is the info of developer,
+ different plugin have different format
+ @warning Must invoke this interface before other interfaces.
+ And invoked only once.
+ */
+void ProtocolShare::configDeveloperInfo(TShareDeveloperInfo devInfo) {
+
+}
+
+ /**
+ @brief share information
+ @param info The info of share, contains key:
+ SharedText The text need to share
+ SharedImagePath The full path of image file need to share (optinal)
+ @warning For different plugin, the parameter should have other keys to share.
+ Look at the manual of plugins.
+ */
+void ProtocolShare::share(TShareInfo info) {
+ PluginMap::mapIProtocolShare[this]->share(pluginx::util::stdStrMapToPlatformStrMap(&info));
+}
+
+void ProtocolShare::share(TShareInfo &info, ProtocolShareCallback &cb) {
+ _callback = cb;
+ share(info);
+}
+
+ /**
+ @deprecated
+ @breif set the result listener
+ @param pListener The callback object for share result
+ @wraning Must invoke this interface before share
+ */
+CC_DEPRECATED_ATTRIBUTE void ProtocolShare::setResultListener(ShareResultListener* pListener) {
+ _listener = pListener;
+}
+
+ /**
+ @deprecated
+ @breif get the result listener
+ @return The callback object for share result
+ @wraning Must invoke this interface before share
+ */
+CC_DEPRECATED_ATTRIBUTE ShareResultListener* ProtocolShare::getResultListener() {
+ return _listener;
+}
+
+ /**
+ @brief share result callback
+ */
+void ProtocolShare::onShareResult(ShareResultCode ret, const char* msg) {
+ if (_listener != nullptr) {
+ _listener->onShareResult(ret, msg);
+ }
+ if (_callback != nullptr) {
+ std::string message(msg);
+ _callback(ret, message);
+ }
+}
\ No newline at end of file
diff --git a/protocols/platform/winrt/ProtocolSocial.cpp b/protocols/platform/winrt/ProtocolSocial.cpp
new file mode 100644
index 00000000..2d6b6389
--- /dev/null
+++ b/protocols/platform/winrt/ProtocolSocial.cpp
@@ -0,0 +1,90 @@
+
+/****************************************************************************
+Copyright (c) 2012-2013 cocos2d-x.org
+Copyright (c) Microsoft Open Technologies, Inc.
+Copyright (c) Microsoft Corporation.
+
+http://www.cocos2d-x.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+****************************************************************************/
+
+#include
+
+#include "ProtocolSocial.h"
+#include "util.h"
+#include "PluginMap.h"
+
+using namespace cocos2d::plugin;
+using namespace pluginx;
+
+ProtocolSocial::ProtocolSocial() {
+ _listener = nullptr;
+ _callback = nullptr;
+}
+
+ProtocolSocial::~ProtocolSocial() {
+ PluginMap::mapIProtocol.erase(this);
+ PluginMap::mapIProtocolSocial.erase(this);
+}
+
+/**
+@brief config the share developer info
+@param devInfo This parameter is the info of developer,
+different plugin have different format
+@warning Must invoke this interface before other interfaces.
+And invoked only once.
+*/
+void ProtocolSocial::configDeveloperInfo(TSocialDeveloperInfo devInfo){
+ PluginMap::mapIProtocolSocial[this]->configDeveloperInfo(util::stdStrMapToPlatformStrMap(&devInfo));
+}
+
+/**
+* @brief methods of leaderboard feature
+*/
+void ProtocolSocial::submitScore(const char* leadboardID, long score){
+ Platform::String^ platLeadboardID = pluginx::util::charArrayToPlatformString(leadboardID);
+ int64 platScore = score;
+ PluginMap::mapIProtocolSocial[this]->submitScore(platLeadboardID, platScore);
+}
+
+void ProtocolSocial::submitScore(const char* leadboardID, long score, ProtocolSocialCallback cb){
+ _callback = cb;
+ submitScore(leadboardID, score);
+}
+
+void ProtocolSocial::showLeaderboard(const char* leaderboardID){
+ PluginMap::mapIProtocolSocial[this]->showLeaderBoard(util::charArrayToPlatformString(leaderboardID));
+}
+
+/**
+* @brief methods of achievement feature
+*/
+void ProtocolSocial::unlockAchievement(TAchievementInfo achInfo) {
+ PluginMap::mapIProtocolSocial[this]->unlockAchievement(util::stdStrMapToPlatformStrMap(&achInfo));
+}
+
+void ProtocolSocial::unlockAchievement(TAchievementInfo achInfo, ProtocolSocialCallback cb) {
+ _callback = cb;
+ unlockAchievement(achInfo);
+}
+
+void ProtocolSocial::showAchievements() {
+ PluginMap::mapIProtocolSocial[this]->showAchievements();
+}
diff --git a/protocols/platform/winrt/ProtocolUser.cpp b/protocols/platform/winrt/ProtocolUser.cpp
new file mode 100644
index 00000000..33ffb59f
--- /dev/null
+++ b/protocols/platform/winrt/ProtocolUser.cpp
@@ -0,0 +1,105 @@
+
+/****************************************************************************
+Copyright (c) 2012-2013 cocos2d-x.org
+Copyright (c) Microsoft Open Technologies, Inc.
+Copyright (c) Microsoft Corporation.
+
+http://www.cocos2d-x.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+****************************************************************************/
+
+#include "ProtocolUser.h"
+#include "PluginMap.h"
+#include "util.h"
+
+using namespace cocos2d::plugin;
+
+ProtocolUser::ProtocolUser() {
+ _listener = nullptr;
+ _callback = nullptr;
+}
+
+ProtocolUser::~ProtocolUser() {
+ PluginMap::mapIProtocol.erase(this);
+ PluginMap::mapIProtocolUser.erase(this);
+}
+
+/**
+@brief config the application info
+@param devInfo This parameter is the info of aplication,
+different plugin have different format
+@warning Must invoke this interface before other interfaces.
+And invoked only once.
+*/
+void ProtocolUser::configDeveloperInfo(TUserDeveloperInfo devInfo) {
+ PluginMap::mapIProtocolUser[this]->configDeveloperInfo(pluginx::util::stdStrMapToPlatformStrMap(&devInfo));
+}
+
+/**
+@brief User login
+*/
+void ProtocolUser::login() {
+ PluginMap::mapIProtocolUser[this]->login();
+}
+
+void ProtocolUser::login(ProtocolUserCallback &cb) {
+ _callback = cb;
+ login();
+}
+
+/**
+@brief User logout
+*/
+void ProtocolUser::logout() {
+ PluginMap::mapIProtocolUser[this]->logout();
+}
+
+void ProtocolUser::logout(ProtocolUserCallback &cb) {
+ _callback = cb;
+ logout();
+}
+
+bool ProtocolUser::isLoggedIn() {
+ return PluginMap::mapIProtocolUser[this]->isLoggedIn();
+}
+
+/**
+@brief Get session ID
+@return If user logined, return value is session ID;
+else return value is empty string.
+*/
+std::string ProtocolUser::getSessionID() {
+ Platform::String^ result = PluginMap::mapIProtocolUser[this]->getSessionID();
+ return pluginx::util::PlatformStringToStdString(result);
+}
+
+/**
+@brief get Access Token
+*/
+std::string ProtocolUser::getAccessToken() {
+ Platform::String^ result = PluginMap::mapIProtocolUser[this]->getAccessToken();
+ return pluginx::util::PlatformStringToStdString(result);
+}
+
+
+
+
+
+
diff --git a/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge.sln b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge.sln
new file mode 100644
index 00000000..6245637b
--- /dev/null
+++ b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge.sln
@@ -0,0 +1,60 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2013
+VisualStudioVersion = 12.0.31101.0
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "cocosPluginWinrtBridge", "cocosPluginWinrtBridge", "{BE08F519-6351-45C0-84CD-F609DD2E6793}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cocosPluginWinrtBridge.Shared", "cocosPluginWinrtBridge\cocosPluginWinrtBridge.Shared\cocosPluginWinrtBridge.Shared.vcxitems", "{1B37C3CE-088D-4277-B750-3A1CBEB1884A}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cocosPluginWinrtBridge.Windows", "cocosPluginWinrtBridge\cocosPluginWinrtBridge.Windows\cocosPluginWinrtBridge.Windows.vcxproj", "{491F4851-92BA-4AC1-9A80-241E1FF13229}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cocosPluginWinrtBridge.WindowsPhone", "cocosPluginWinrtBridge\cocosPluginWinrtBridge.WindowsPhone\cocosPluginWinrtBridge.WindowsPhone.vcxproj", "{35ACD56C-DEE1-477B-BEC0-C963C7937623}"
+EndProject
+Global
+ GlobalSection(SharedMSBuildProjectFiles) = preSolution
+ cocosPluginWinrtBridge\cocosPluginWinrtBridge.Shared\cocosPluginWinrtBridge.Shared.vcxitems*{491f4851-92ba-4ac1-9a80-241e1ff13229}*SharedItemsImports = 4
+ cocosPluginWinrtBridge\cocosPluginWinrtBridge.Shared\cocosPluginWinrtBridge.Shared.vcxitems*{35acd56c-dee1-477b-bec0-c963c7937623}*SharedItemsImports = 4
+ cocosPluginWinrtBridge\cocosPluginWinrtBridge.Shared\cocosPluginWinrtBridge.Shared.vcxitems*{1b37c3ce-088d-4277-b750-3a1cbeb1884a}*SharedItemsImports = 9
+ EndGlobalSection
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|ARM = Debug|ARM
+ Debug|Win32 = Debug|Win32
+ Debug|x64 = Debug|x64
+ Release|ARM = Release|ARM
+ Release|Win32 = Release|Win32
+ Release|x64 = Release|x64
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {491F4851-92BA-4AC1-9A80-241E1FF13229}.Debug|ARM.ActiveCfg = Debug|ARM
+ {491F4851-92BA-4AC1-9A80-241E1FF13229}.Debug|ARM.Build.0 = Debug|ARM
+ {491F4851-92BA-4AC1-9A80-241E1FF13229}.Debug|Win32.ActiveCfg = Debug|Win32
+ {491F4851-92BA-4AC1-9A80-241E1FF13229}.Debug|Win32.Build.0 = Debug|Win32
+ {491F4851-92BA-4AC1-9A80-241E1FF13229}.Debug|x64.ActiveCfg = Debug|x64
+ {491F4851-92BA-4AC1-9A80-241E1FF13229}.Debug|x64.Build.0 = Debug|x64
+ {491F4851-92BA-4AC1-9A80-241E1FF13229}.Release|ARM.ActiveCfg = Release|ARM
+ {491F4851-92BA-4AC1-9A80-241E1FF13229}.Release|ARM.Build.0 = Release|ARM
+ {491F4851-92BA-4AC1-9A80-241E1FF13229}.Release|Win32.ActiveCfg = Release|Win32
+ {491F4851-92BA-4AC1-9A80-241E1FF13229}.Release|Win32.Build.0 = Release|Win32
+ {491F4851-92BA-4AC1-9A80-241E1FF13229}.Release|x64.ActiveCfg = Release|x64
+ {491F4851-92BA-4AC1-9A80-241E1FF13229}.Release|x64.Build.0 = Release|x64
+ {35ACD56C-DEE1-477B-BEC0-C963C7937623}.Debug|ARM.ActiveCfg = Debug|ARM
+ {35ACD56C-DEE1-477B-BEC0-C963C7937623}.Debug|ARM.Build.0 = Debug|ARM
+ {35ACD56C-DEE1-477B-BEC0-C963C7937623}.Debug|Win32.ActiveCfg = Debug|Win32
+ {35ACD56C-DEE1-477B-BEC0-C963C7937623}.Debug|Win32.Build.0 = Debug|Win32
+ {35ACD56C-DEE1-477B-BEC0-C963C7937623}.Debug|x64.ActiveCfg = Debug|Win32
+ {35ACD56C-DEE1-477B-BEC0-C963C7937623}.Release|ARM.ActiveCfg = Release|ARM
+ {35ACD56C-DEE1-477B-BEC0-C963C7937623}.Release|ARM.Build.0 = Release|ARM
+ {35ACD56C-DEE1-477B-BEC0-C963C7937623}.Release|Win32.ActiveCfg = Release|Win32
+ {35ACD56C-DEE1-477B-BEC0-C963C7937623}.Release|Win32.Build.0 = Release|Win32
+ {35ACD56C-DEE1-477B-BEC0-C963C7937623}.Release|x64.ActiveCfg = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {1B37C3CE-088D-4277-B750-3A1CBEB1884A} = {BE08F519-6351-45C0-84CD-F609DD2E6793}
+ {491F4851-92BA-4AC1-9A80-241E1FF13229} = {BE08F519-6351-45C0-84CD-F609DD2E6793}
+ {35ACD56C-DEE1-477B-BEC0-C963C7937623} = {BE08F519-6351-45C0-84CD-F609DD2E6793}
+ EndGlobalSection
+EndGlobal
diff --git a/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/IPluginParam.h b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/IPluginParam.h
new file mode 100644
index 00000000..f6ec18e6
--- /dev/null
+++ b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/IPluginParam.h
@@ -0,0 +1,54 @@
+
+/****************************************************************************
+Copyright (c) 2012-2013 cocos2d-x.org
+Copyright (c) Microsoft Open Technologies, Inc.
+Copyright (c) Microsoft Corporation.
+
+http://www.cocos2d-x.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+****************************************************************************/
+
+#pragma once
+
+namespace cocosPluginWinrtBridge {
+
+ // needs to be kept up to date with the ParamType enum in PluginParam.h
+ public enum class ParamTypeEnum {
+ kParamTypeNull = 0,
+ kParamTypeInt,
+ kParamTypeFloat,
+ kParamTypeBool,
+ kParamTypeString,
+ kParamTypeStringMap,
+ kParamTypeMap,
+ };
+
+ public interface class IPluginParam {
+ ParamTypeEnum getCurrentType();
+ int getIntValue();
+ float getFloatValue();
+ bool getBoolValue();
+ Platform::String^ getStringValue();
+ Windows::Foundation::Collections::IMap^ getMapValue();
+ Windows::Foundation::Collections::IMap^ getStrMapValue();
+
+ };
+
+}
diff --git a/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/IProtocol.h b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/IProtocol.h
new file mode 100644
index 00000000..7633eed0
--- /dev/null
+++ b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/IProtocol.h
@@ -0,0 +1,46 @@
+
+
+/****************************************************************************
+Copyright (c) 2012-2013 cocos2d-x.org
+Copyright (c) Microsoft Open Technologies, Inc.
+Copyright (c) Microsoft Corporation.
+
+http://www.cocos2d-x.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+****************************************************************************/
+
+#pragma once
+
+#include "IPluginParam.h"
+
+namespace cocosPluginWinrtBridge {
+
+ public interface class IProtocol {
+ Platform::String^ getPluginVersion();
+ Platform::String^ getSDKVersion();
+ void setDebugMode(bool bDebug);
+ void callFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params);
+ Platform::String^ callStringFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params);
+ int callIntFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params);
+ bool callBoolFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params);
+ float callFloatFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params);
+ };
+
+}
diff --git a/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/IProtocolAds.h b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/IProtocolAds.h
new file mode 100644
index 00000000..67fe7093
--- /dev/null
+++ b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/IProtocolAds.h
@@ -0,0 +1,69 @@
+
+/****************************************************************************
+Copyright (c) 2012-2013 cocos2d-x.org
+Copyright (c) Microsoft Open Technologies, Inc.
+Copyright (c) Microsoft Corporation.
+
+http://www.cocos2d-x.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+****************************************************************************/
+
+#pragma once
+
+#include "IProtocol.h"
+
+namespace cocosPluginWinrtBridge {
+
+ // needs to be kept up to date with the AdsResultCode enum in ProtocolAds.h
+ public enum class AdsResultCodeEnum {
+ kAdsReceived = 0,
+ kAdsShown,
+ kAdsDismissed,
+ kPointsSpendSucceed,
+ kPointsSpendFailed,
+ kNetworkError,
+ kUnknownError
+ };
+
+ // needs to be kept up to date with the AdsPos enum in ProtocolAds.h
+ public enum class AdsPosition {
+ kPosCenter = 0,
+ kPosTop,
+ kPosTopLeft,
+ kPosTopRight,
+ kPosBottom,
+ kPosBottomLeft,
+ kPosBottomRight
+ };
+
+ public delegate void AdsResultHandler(AdsResultCodeEnum result, Platform::String^ msg);
+ public delegate void PlayerGetPointsHandler(int points);
+
+ public interface class IProtocolAds : IProtocol {
+ void configDeveloperInfo(Windows::Foundation::Collections::IMap^ devInfo);
+ void showAds(Windows::Foundation::Collections::IMap^ info, AdsPosition pos);
+ void hideAds(Windows::Foundation::Collections::IMap^ info);
+ void queryPoints(); // TODO what does this do?
+ void spendPoints(int points);
+ event AdsResultHandler^ OnAdsResult;
+ event PlayerGetPointsHandler^ OnPlayerGetPoints;
+ };
+
+}
diff --git a/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/IProtocolAnalytics.h b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/IProtocolAnalytics.h
new file mode 100644
index 00000000..16967e7d
--- /dev/null
+++ b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/IProtocolAnalytics.h
@@ -0,0 +1,44 @@
+
+/****************************************************************************
+Copyright (c) 2012-2013 cocos2d-x.org
+Copyright (c) Microsoft Open Technologies, Inc.
+Copyright (c) Microsoft Corporation.
+
+http://www.cocos2d-x.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+****************************************************************************/
+
+#pragma once
+
+#include "IProtocol.h"
+
+namespace cocosPluginWinrtBridge {
+
+ public interface class IProtocolAnalytics : IProtocol {
+ void startSession(Platform::String^ appKey);
+ void stopSession();
+ void setSessionContinueMillis(int millis);
+ void logError(Platform::String^ errorId, Platform::String^ message);
+ void logEvent(Platform::String^ eventId, Windows::Foundation::Collections::IMap^ paramMap);
+ void logTimedEventBegin(Platform::String^ eventId);
+ void logTimedEventEnd(Platform::String^ eventId);
+ void setCaptureUncaughtException(bool enabled);
+ };
+}
\ No newline at end of file
diff --git a/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/IProtocolIAP.h b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/IProtocolIAP.h
new file mode 100644
index 00000000..3c565cc4
--- /dev/null
+++ b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/IProtocolIAP.h
@@ -0,0 +1,51 @@
+
+/****************************************************************************
+Copyright (c) 2012-2013 cocos2d-x.org
+Copyright (c) Microsoft Open Technologies, Inc.
+Copyright (c) Microsoft Corporation.
+
+http://www.cocos2d-x.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+****************************************************************************/
+#pragma once
+
+#include "IProtocol.h"
+
+namespace cocosPluginWinrtBridge {
+
+ // needs to be kept up to date with the PayResultCode enum in ProtocolIAP.h
+ public enum class PayResultCodeEnum {
+ kPaySuccess = 0,
+ kPayFail,
+ kPayCancel,
+ kPayTimeOut
+ };
+
+ public delegate void OnPayResultHandler(PayResultCodeEnum ret, Platform::String^ msg);
+
+ [Windows::Foundation::Metadata::WebHostHidden]
+ public interface class IProtocolIAP : IProtocol {
+ void configDeveloperInfo(Windows::Foundation::Collections::IMap^ devInfo);
+ void payForProduct(Windows::Foundation::Collections::IMap^ info);
+ void setDispatcher(Windows::UI::Core::CoreDispatcher^ dispatcher);
+ event OnPayResultHandler^ OnPayResult;
+ };
+
+}
\ No newline at end of file
diff --git a/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/IProtocolShare.h b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/IProtocolShare.h
new file mode 100644
index 00000000..d46c9326
--- /dev/null
+++ b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/IProtocolShare.h
@@ -0,0 +1,50 @@
+
+/****************************************************************************
+Copyright (c) 2012-2013 cocos2d-x.org
+Copyright (c) Microsoft Open Technologies, Inc.
+Copyright (c) Microsoft Corporation.
+
+http://www.cocos2d-x.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+****************************************************************************/
+
+#pragma once
+
+#include "IProtocol.h"
+
+namespace cocosPluginWinrtBridge {
+
+ // this should be kept up to date with the ShareResultCode enum in ProtocolShare.h
+ public enum class ShareResultCodeEnum {
+ kShareSuccess = 0,
+ kShareFail,
+ kShareCancel,
+ kShareTimeOut
+ };
+
+ public delegate void ShareResultHandler(ShareResultCodeEnum ret, Platform::String^ msg);
+
+ public interface class IProtocolShare : IProtocol {
+ void configDeveloperInfo(Windows::Foundation::Collections::IMap^ devInfo);
+ void share(Windows::Foundation::Collections::IMap^ info);
+ event ShareResultHandler^ OnShareResult;
+ };
+
+}
diff --git a/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/IProtocolSocial.h b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/IProtocolSocial.h
new file mode 100644
index 00000000..144e029b
--- /dev/null
+++ b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/IProtocolSocial.h
@@ -0,0 +1,53 @@
+
+/****************************************************************************
+Copyright (c) 2012-2013 cocos2d-x.org
+Copyright (c) Microsoft Open Technologies, Inc.
+Copyright (c) Microsoft Corporation.
+
+http://www.cocos2d-x.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+****************************************************************************/
+
+#pragma once
+
+#include "IProtocol.h"
+
+namespace cocosPluginWinrtBridge {
+
+ // needs to be kept up to date with the SocialRetCode enum in ProtocolSocial.h
+ public enum class SocialReturnCode {
+ SCORE_SUBMIT_SUCCESS = 1,
+ SCORE_SUBMIT_FAILED,
+ ACH_UNLOCK_SUCCESS,
+ ACH_UNLOCK_FAILED
+ };
+
+ public delegate void SocialResultHandler(SocialReturnCode retCode);
+
+ public interface class IProtocolSocial : IProtocol {
+ void configDeveloperInfo(Windows::Foundation::Collections::IMap^ devInfo);
+ void submitScore(Platform::String^ leadboardID, int64 score); // TODO make sure that uint64 is compatible with long type
+ void showLeaderBoard(Platform::String^ leaderboardID);
+ void unlockAchievement(Windows::Foundation::Collections::IMap^ achInfo);
+ void showAchievements();
+ event SocialResultHandler^ OnSocialResult;
+ };
+
+}
diff --git a/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/IProtocolUser.h b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/IProtocolUser.h
new file mode 100644
index 00000000..bbc6f6ee
--- /dev/null
+++ b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/IProtocolUser.h
@@ -0,0 +1,53 @@
+
+/****************************************************************************
+Copyright (c) 2012-2013 cocos2d-x.org
+Copyright (c) Microsoft Open Technologies, Inc.
+Copyright (c) Microsoft Corporation.
+
+http://www.cocos2d-x.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+****************************************************************************/
+
+#pragma once
+
+#include "IProtocol.h"
+
+namespace cocosPluginWinrtBridge {
+
+ // needs to be kept up to date with the UserActionResultCode enum in ProtocolUser.h
+ public enum class UserActionResult {
+ kLoginSucceed = 0,
+ kLoginFailed,
+ kLogoutSucceed
+ };
+
+ public delegate void UserActionResultHandler(UserActionResult ret);
+
+ public interface class IProtocolUser : IProtocol {
+ void configDeveloperInfo(Windows::Foundation::Collections::IMap^ devInfo);
+ void login();
+ void logout();
+ bool isLoggedIn();
+ Platform::String^ getSessionID();
+ Platform::String^ getAccessToken();
+ event UserActionResultHandler^ OnUserAction;
+ };
+
+}
\ No newline at end of file
diff --git a/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/PluginParamImpl.cpp b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/PluginParamImpl.cpp
new file mode 100644
index 00000000..2e985503
--- /dev/null
+++ b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/PluginParamImpl.cpp
@@ -0,0 +1,67 @@
+
+/****************************************************************************
+Copyright (c) 2012-2013 cocos2d-x.org
+Copyright (c) Microsoft Open Technologies, Inc.
+Copyright (c) Microsoft Corporation.
+
+http://www.cocos2d-x.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+****************************************************************************/
+
+// Only needed in order to export tne interface classes in winmd, can be
+// deleted if a better way is found.
+
+#include "pch.h"
+#include "IPluginParam.h"
+
+using namespace cocosPluginWinrtBridge;
+
+namespace cocosPluginWinrtBridge {
+ public ref class PluginParamImpl sealed : public cocosPluginWinrtBridge::IPluginParam{
+ public:
+
+ virtual ParamTypeEnum getCurrentType() {
+ return ParamTypeEnum::kParamTypeNull;
+ }
+ virtual int getIntValue() {
+ return 0;
+ }
+
+ virtual float getFloatValue() {
+ return 0;
+ }
+
+ virtual bool getBoolValue() {
+ return false;
+ }
+
+ virtual Platform::String^ getStringValue() {
+ return L"";
+ }
+
+ virtual Windows::Foundation::Collections::IMap^ getMapValue() {
+ return ref new Platform::Collections::Map ;
+ }
+
+ virtual Windows::Foundation::Collections::IMap^ getStrMapValue() {
+ return ref new Platform::Collections::Map ;
+ }
+ };
+}
\ No newline at end of file
diff --git a/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/ProtocolAdsImpl.cpp b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/ProtocolAdsImpl.cpp
new file mode 100644
index 00000000..53151200
--- /dev/null
+++ b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/ProtocolAdsImpl.cpp
@@ -0,0 +1,99 @@
+
+/****************************************************************************
+Copyright (c) 2012-2013 cocos2d-x.org
+Copyright (c) Microsoft Open Technologies, Inc.
+Copyright (c) Microsoft Corporation.
+
+http://www.cocos2d-x.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+****************************************************************************/
+
+// Only needed in order to export tne interface classes in winmd, can be
+// deleted if a better way is found.
+
+#include "pch.h"
+#include "IProtocolAds.h"
+
+using namespace cocosPluginWinrtBridge;
+
+namespace cocosPluginWinrtBridge {
+ public ref class ProtocolAdsImpl sealed : public cocosPluginWinrtBridge::IProtocolAds {
+ public:
+
+ virtual Platform::String^ getPluginVersion() {
+ return L"";
+ }
+
+ virtual Platform::String^ getSDKVersion() {
+ return L"";
+ }
+
+ virtual void setDebugMode(bool bDebug) {
+ return;
+ }
+
+ virtual void callFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ return;
+ }
+
+ virtual Platform::String^ callStringFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ return L"";
+ }
+
+ virtual int callIntFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ return 0;
+ }
+
+ virtual bool callBoolFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ return false;
+ }
+
+ virtual float callFloatFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ return 0;
+ }
+
+ virtual void configDeveloperInfo(Windows::Foundation::Collections::IMap^ devInfo) {
+ return;
+ }
+
+ virtual void showAds(Windows::Foundation::Collections::IMap^ info, AdsPosition pos) {
+ return;
+ }
+
+ virtual void hideAds(Windows::Foundation::Collections::IMap^ info) {
+ return;
+ }
+
+ virtual void queryPoints() {
+ return;
+ }
+
+ virtual void spendPoints(int points) {
+ return;
+ }
+
+ virtual event AdsResultHandler^ OnAdsResult;
+
+ virtual event PlayerGetPointsHandler^ OnPlayerGetPoints;
+
+
+ };
+
+}
diff --git a/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/ProtocolAnalyticsImpl.cpp b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/ProtocolAnalyticsImpl.cpp
new file mode 100644
index 00000000..0835f145
--- /dev/null
+++ b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/ProtocolAnalyticsImpl.cpp
@@ -0,0 +1,106 @@
+
+/****************************************************************************
+Copyright (c) 2012-2013 cocos2d-x.org
+Copyright (c) Microsoft Open Technologies, Inc.
+Copyright (c) Microsoft Corporation.
+
+http://www.cocos2d-x.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+****************************************************************************/
+
+// Only needed in order to export tne interface classes in winmd, can be
+// deleted if a better way is found.
+
+#include "pch.h"
+#include "IProtocolAnalytics.h"
+
+using namespace cocosPluginWinrtBridge;
+
+namespace cocosPluginWinrtBridge {
+ public ref class ProtocolAnalyticsImpl sealed : public cocosPluginWinrtBridge::IProtocolAnalytics {
+ public:
+
+ virtual Platform::String^ getPluginVersion() {
+ return L"";
+ }
+
+ virtual Platform::String^ getSDKVersion() {
+ return L"";
+ }
+
+ virtual void setDebugMode(bool bDebug) {
+ return;
+ }
+
+ virtual void callFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ return;
+ }
+
+ virtual Platform::String^ callStringFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ return L"";
+ }
+
+ virtual int callIntFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ return 0;
+ }
+
+ virtual bool callBoolFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ return false;
+ }
+
+ virtual float callFloatFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ return 0;
+ }
+
+ virtual void startSession(Platform::String^ appKey) {
+ return;
+ }
+
+ virtual void stopSession() {
+ return;
+ }
+
+ virtual void setSessionContinueMillis(int millis) {
+ return;
+ }
+
+ virtual void logError(Platform::String^ errorId, Platform::String^ message) {
+ return;
+ }
+
+ virtual void logEvent(Platform::String^ eventId, Windows::Foundation::Collections::IMap^ paramMap) {
+ return;
+ }
+
+ virtual void logTimedEventBegin(Platform::String^ eventId) {
+ return;
+ }
+
+ virtual void logTimedEventEnd(Platform::String^ eventId) {
+ return;
+ }
+
+ virtual void setCaptureUncaughtException(bool enabled) {
+ return;
+ }
+
+ };
+
+}
diff --git a/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/ProtocolIAPImpl.cpp b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/ProtocolIAPImpl.cpp
new file mode 100644
index 00000000..9fd5d015
--- /dev/null
+++ b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/ProtocolIAPImpl.cpp
@@ -0,0 +1,89 @@
+
+/****************************************************************************
+Copyright (c) 2012-2013 cocos2d-x.org
+Copyright (c) Microsoft Open Technologies, Inc.
+Copyright (c) Microsoft Corporation.
+
+http://www.cocos2d-x.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+****************************************************************************/
+
+// Only needed in order to export tne interface classes in winmd, can be
+// deleted if a better way is found.
+
+#include "pch.h"
+#include "IProtocolIAP.h"
+
+using namespace cocosPluginWinrtBridge;
+
+namespace cocosPluginWinrtBridge {
+ [Windows::Foundation::Metadata::WebHostHidden]
+ public ref class ProtocolIAPImpl sealed : public cocosPluginWinrtBridge::IProtocolIAP {
+ public:
+
+ virtual Platform::String^ getPluginVersion() {
+ return L"";
+ }
+
+ virtual Platform::String^ getSDKVersion() {
+ return L"";
+ }
+
+ virtual void setDebugMode(bool bDebug) {
+ return;
+ }
+
+ virtual void callFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ return;
+ }
+
+ virtual Platform::String^ callStringFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ return L"";
+ }
+
+ virtual int callIntFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ return 0;
+ }
+
+ virtual bool callBoolFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ return false;
+ }
+
+ virtual float callFloatFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ return 0;
+ }
+
+ virtual void configDeveloperInfo(Windows::Foundation::Collections::IMap^ devInfo) {
+ return;
+ }
+
+ virtual void payForProduct(Windows::Foundation::Collections::IMap^ info) {
+ return;
+ }
+
+ virtual void setDispatcher(Windows::UI::Core::CoreDispatcher^ dispatcher) {
+ return;
+ }
+
+ virtual event OnPayResultHandler^ OnPayResult;
+ };
+
+}
+
diff --git a/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/ProtocolImpl.cpp b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/ProtocolImpl.cpp
new file mode 100644
index 00000000..4b150a43
--- /dev/null
+++ b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/ProtocolImpl.cpp
@@ -0,0 +1,72 @@
+
+/****************************************************************************
+Copyright (c) 2012-2013 cocos2d-x.org
+Copyright (c) Microsoft Open Technologies, Inc.
+Copyright (c) Microsoft Corporation.
+
+http://www.cocos2d-x.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+****************************************************************************/
+
+// Only needed in order to export tne interface classes in winmd, can be
+// deleted if a better way is found.
+
+#include "pch.h"
+#include "IProtocol.h"
+
+using namespace cocosPluginWinrtBridge;
+
+namespace cocosPluginWinrtBridge {
+ public ref class ProtocolImpl sealed : public cocosPluginWinrtBridge::IProtocol{
+ public:
+
+ virtual Platform::String^ getPluginVersion() {
+ return L"";
+ }
+
+ virtual Platform::String^ getSDKVersion() {
+ return L"";
+ };
+
+ virtual void setDebugMode(bool bDebug) {
+ return;
+ }
+
+ virtual void callFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ return;
+ }
+
+ virtual Platform::String^ callStringFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ return L"";
+ }
+
+ virtual int callIntFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ return 0;
+ }
+
+ virtual bool callBoolFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ return false;
+ }
+
+ virtual float callFloatFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ return 0;
+ }
+ };
+}
\ No newline at end of file
diff --git a/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/ProtocolShareImpl.cpp b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/ProtocolShareImpl.cpp
new file mode 100644
index 00000000..5aeb63dc
--- /dev/null
+++ b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/ProtocolShareImpl.cpp
@@ -0,0 +1,83 @@
+
+/****************************************************************************
+Copyright (c) 2012-2013 cocos2d-x.org
+Copyright (c) Microsoft Open Technologies, Inc.
+Copyright (c) Microsoft Corporation.
+
+http://www.cocos2d-x.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+****************************************************************************/
+
+// Only needed in order to export tne interface classes in winmd, can be
+// deleted if a better way is found.
+
+#include "pch.h"
+#include "IProtocolShare.h"
+
+using namespace cocosPluginWinrtBridge;
+
+namespace cocosPluginWinrtBridge {
+ public ref class ProtocolShareImpl sealed : public cocosPluginWinrtBridge::IProtocolShare {
+ public:
+
+ virtual Platform::String^ getPluginVersion() {
+ return L"";
+ }
+
+ virtual Platform::String^ getSDKVersion() {
+ return L"";
+ }
+
+ virtual void setDebugMode(bool bDebug) {
+ return;
+ }
+
+ virtual void callFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ return;
+ }
+
+ virtual Platform::String^ callStringFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ return L"";
+ }
+
+ virtual int callIntFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ return 0;
+ }
+
+ virtual bool callBoolFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ return false;
+ }
+
+ virtual float callFloatFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ return 0;
+ }
+
+ virtual void configDeveloperInfo(Windows::Foundation::Collections::IMap^ devInfo) {
+ return;
+ }
+
+ virtual void share(Windows::Foundation::Collections::IMap^ info) {
+ return;
+ }
+
+ virtual event ShareResultHandler^ OnShareResult;
+ };
+
+}
diff --git a/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/ProtocolSocialImpl.cpp b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/ProtocolSocialImpl.cpp
new file mode 100644
index 00000000..f690128e
--- /dev/null
+++ b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/ProtocolSocialImpl.cpp
@@ -0,0 +1,95 @@
+
+/****************************************************************************
+Copyright (c) 2012-2013 cocos2d-x.org
+Copyright (c) Microsoft Open Technologies, Inc.
+Copyright (c) Microsoft Corporation.
+
+http://www.cocos2d-x.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+****************************************************************************/
+
+// Only needed in order to export tne interface classes in winmd, can be
+// deleted if a better way is found.
+
+#include "pch.h"
+#include "IProtocolSocial.h"
+
+using namespace cocosPluginWinrtBridge;
+
+namespace cocosPluginWinrtBridge {
+ public ref class ProtocolSocialImpl sealed : public cocosPluginWinrtBridge::IProtocolSocial {
+ public:
+
+ virtual Platform::String^ getPluginVersion() {
+ return L"";
+ }
+
+ virtual Platform::String^ getSDKVersion() {
+ return L"";
+ }
+
+ virtual void setDebugMode(bool bDebug) {
+ return;
+ }
+
+ virtual void callFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ return;
+ }
+
+ virtual Platform::String^ callStringFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ return L"";
+ }
+
+ virtual int callIntFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ return 0;
+ }
+
+ virtual bool callBoolFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ return false;
+ }
+
+ virtual float callFloatFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ return 0;
+ }
+
+ virtual void configDeveloperInfo(Windows::Foundation::Collections::IMap^ devInfo) {
+ return;
+ }
+
+ virtual void submitScore(Platform::String^ leadboardID, int64 score) {
+ return;
+ }
+
+ virtual void showLeaderBoard(Platform::String^ leaderboardID) {
+ return;
+ }
+
+ virtual void unlockAchievement(Windows::Foundation::Collections::IMap^ achInfo) {
+ return;
+ }
+
+ virtual void showAchievements() {
+ return;
+ }
+
+ virtual event SocialResultHandler^ OnSocialResult;
+
+ };
+}
diff --git a/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/ProtocolUserImpl.cpp b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/ProtocolUserImpl.cpp
new file mode 100644
index 00000000..e905eae0
--- /dev/null
+++ b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/ProtocolUserImpl.cpp
@@ -0,0 +1,99 @@
+
+/****************************************************************************
+Copyright (c) 2012-2013 cocos2d-x.org
+Copyright (c) Microsoft Open Technologies, Inc.
+Copyright (c) Microsoft Corporation.
+
+http://www.cocos2d-x.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+****************************************************************************/
+
+// Only needed in order to export tne interface classes in winmd, can be
+// deleted if a better way is found.
+
+#include "pch.h"
+#include "IProtocolUser.h"
+
+using namespace cocosPluginWinrtBridge;
+
+namespace cocosPluginWinrtBridge {
+ public ref class ProtocolUserImpl sealed : public cocosPluginWinrtBridge::IProtocolUser {
+ public:
+
+ virtual Platform::String^ getPluginVersion() {
+ return L"";
+ }
+
+ virtual Platform::String^ getSDKVersion() {
+ return L"";
+ }
+
+ virtual void setDebugMode(bool bDebug) {
+ return;
+ }
+
+ virtual void callFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ return;
+ }
+
+ virtual Platform::String^ callStringFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ return L"";
+ }
+
+ virtual int callIntFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ return 0;
+ }
+
+ virtual bool callBoolFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ return false;
+ }
+
+ virtual float callFloatFuncWithParam(Platform::String^ funcName, Windows::Foundation::Collections::IVector^ params) {
+ return 0;
+ }
+
+ virtual void configDeveloperInfo(Windows::Foundation::Collections::IMap^ devInfo) {
+ return;
+ }
+
+ virtual void login() {
+ return;
+ }
+
+ virtual void logout() {
+ return;
+ }
+
+ virtual bool isLoggedIn() {
+ return false;
+ }
+
+ virtual Platform::String^ getSessionID() {
+ return L"";
+ }
+
+ virtual Platform::String^ getAccessToken() {
+ return L"";
+ }
+
+ virtual event UserActionResultHandler^ OnUserAction;
+ };
+
+}
diff --git a/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/cocosPluginWinrtBridge.Shared.vcxitems b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/cocosPluginWinrtBridge.Shared.vcxitems
new file mode 100644
index 00000000..9395a9b9
--- /dev/null
+++ b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/cocosPluginWinrtBridge.Shared.vcxitems
@@ -0,0 +1,43 @@
+
+
+
+ $(MSBuildAllProjects);$(MSBuildThisFileFullPath)
+ true
+ {1b37c3ce-088d-4277-b750-3a1cbeb1884a}
+ cocosPluginWinrtBridge
+ cocosPluginWinrtBridge.Shared
+ 248F659F-DAC5-46E8-AC09-60EC9FC95053
+
+
+
+ %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Create
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/cocosPluginWinrtBridge.Shared.vcxitems.filters b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/cocosPluginWinrtBridge.Shared.vcxitems.filters
new file mode 100644
index 00000000..b2a26014
--- /dev/null
+++ b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/cocosPluginWinrtBridge.Shared.vcxitems.filters
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Create
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/pch.cpp b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/pch.cpp
new file mode 100644
index 00000000..bcb5590b
--- /dev/null
+++ b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/pch.cpp
@@ -0,0 +1 @@
+#include "pch.h"
diff --git a/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/pch.h b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/pch.h
new file mode 100644
index 00000000..10fe677c
--- /dev/null
+++ b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Shared/pch.h
@@ -0,0 +1,4 @@
+#pragma once
+
+#include
+#include
diff --git a/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Windows/cocosPluginWinrtBridge.Windows.vcxproj b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Windows/cocosPluginWinrtBridge.Windows.vcxproj
new file mode 100644
index 00000000..3a616920
--- /dev/null
+++ b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Windows/cocosPluginWinrtBridge.Windows.vcxproj
@@ -0,0 +1,239 @@
+
+
+
+
+
+ Debug
+ ARM
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ ARM
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+
+ {491f4851-92ba-4ac1-9a80-241e1ff13229}
+ cocosPluginWinrtBridge
+ en-US
+ 12.0
+ true
+ Windows Store
+ 8.1
+ CodeSharingWindowsRuntimeComponent
+
+
+
+
+
+ DynamicLibrary
+ true
+ v120
+
+
+ DynamicLibrary
+ true
+ v120
+
+
+ DynamicLibrary
+ true
+ v120
+
+
+ DynamicLibrary
+ false
+ true
+ v120
+
+
+ DynamicLibrary
+ false
+ true
+ v120
+
+
+ DynamicLibrary
+ false
+ true
+ v120
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+ false
+
+
+
+ false
+
+
+
+ false
+
+
+
+ false
+
+
+
+ false
+
+
+
+
+ Use
+ _WINRT_DLL;%(PreprocessorDefinitions)
+ pch.h
+ $(IntDir)pch.pch
+ $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)
+ /bigobj %(AdditionalOptions)
+ 28204
+
+
+ Console
+ runtimeobject.lib;%(AdditionalDependencies)
+ false
+
+
+
+
+
+ Use
+ _WINRT_DLL;NDEBUG;%(PreprocessorDefinitions)
+ pch.h
+ $(IntDir)pch.pch
+ $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)
+ /bigobj %(AdditionalOptions)
+ 28204
+
+
+ Console
+ runtimeobject.lib;%(AdditionalDependencies)
+ false
+
+
+
+
+
+ Use
+ _WINRT_DLL;%(PreprocessorDefinitions)
+ pch.h
+ $(IntDir)pch.pch
+ $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)
+ /bigobj %(AdditionalOptions)
+ 28204
+
+
+ Console
+ runtimeobject.lib;%(AdditionalDependencies)
+ false
+
+
+
+
+
+ Use
+ _WINRT_DLL;NDEBUG;%(PreprocessorDefinitions)
+ pch.h
+ $(IntDir)pch.pch
+ $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)
+ /bigobj %(AdditionalOptions)
+ 28204
+
+
+ Console
+ runtimeobject.lib;%(AdditionalDependencies)
+ false
+
+
+
+
+
+ Use
+ _WINRT_DLL;%(PreprocessorDefinitions)
+ pch.h
+ $(IntDir)pch.pch
+ $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)
+ /bigobj %(AdditionalOptions)
+ 28204
+
+
+ Console
+ runtimeobject.lib;%(AdditionalDependencies)
+ false
+
+
+
+
+
+ Use
+ _WINRT_DLL;NDEBUG;%(PreprocessorDefinitions)
+ pch.h
+ $(IntDir)pch.pch
+ $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)
+ /bigobj %(AdditionalOptions)
+ 28204
+
+
+ Console
+ runtimeobject.lib;%(AdditionalDependencies)
+ false
+
+
+
+
+
+
+
+
+
diff --git a/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Windows/cocosPluginWinrtBridge.Windows.vcxproj.filters b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Windows/cocosPluginWinrtBridge.Windows.vcxproj.filters
new file mode 100644
index 00000000..a7761ab0
--- /dev/null
+++ b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.Windows/cocosPluginWinrtBridge.Windows.vcxproj.filters
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.WindowsPhone/cocosPluginWinrtBridge.WindowsPhone.vcxproj b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.WindowsPhone/cocosPluginWinrtBridge.WindowsPhone.vcxproj
new file mode 100644
index 00000000..9831edca
--- /dev/null
+++ b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.WindowsPhone/cocosPluginWinrtBridge.WindowsPhone.vcxproj
@@ -0,0 +1,155 @@
+
+
+
+
+
+ Debug
+ ARM
+
+
+ Debug
+ Win32
+
+
+ Release
+ ARM
+
+
+ Release
+ Win32
+
+
+
+
+ {35acd56c-dee1-477b-bec0-c963c7937623}
+ cocosPluginWinrtBridge
+ en-US
+ 12.0
+ true
+ Windows Phone
+ 8.1
+ CodeSharingWindowsRuntimeComponent
+
+
+
+
+
+ DynamicLibrary
+ true
+ v120_wp81
+
+
+ DynamicLibrary
+ true
+ v120_wp81
+
+
+ DynamicLibrary
+ false
+ true
+ v120_wp81
+
+
+ DynamicLibrary
+ false
+ true
+ v120_wp81
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Use
+ _WINRT_DLL;%(PreprocessorDefinitions)
+ pch.h
+ $(IntDir)pch.pch
+ /bigobj %(AdditionalOptions)
+ true
+
+
+ Console
+ false
+
+
+
+
+
+ Use
+ _WINRT_DLL;NDEBUG;%(PreprocessorDefinitions)
+ pch.h
+ $(IntDir)pch.pch
+ /bigobj %(AdditionalOptions)
+ true
+
+
+ Console
+ false
+
+
+
+
+
+ Use
+ _WINRT_DLL;%(PreprocessorDefinitions)
+ pch.h
+ $(IntDir)pch.pch
+ /bigobj %(AdditionalOptions)
+ true
+
+
+ Console
+ false
+
+
+
+
+
+ Use
+ _WINRT_DLL;NDEBUG;%(PreprocessorDefinitions)
+ pch.h
+ $(IntDir)pch.pch
+ /bigobj %(AdditionalOptions)
+ true
+
+
+ Console
+ false
+
+
+
+
+
+
+
+
diff --git a/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.WindowsPhone/cocosPluginWinrtBridge.WindowsPhone.vcxproj.filters b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.WindowsPhone/cocosPluginWinrtBridge.WindowsPhone.vcxproj.filters
new file mode 100644
index 00000000..a7761ab0
--- /dev/null
+++ b/protocols/platform/winrt/cocosPluginWinrtBridge/cocosPluginWinrtBridge/cocosPluginWinrtBridge.WindowsPhone/cocosPluginWinrtBridge.WindowsPhone.vcxproj.filters
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/protocols/platform/winrt/util.cpp b/protocols/platform/winrt/util.cpp
new file mode 100644
index 00000000..ebfd022e
--- /dev/null
+++ b/protocols/platform/winrt/util.cpp
@@ -0,0 +1,118 @@
+
+/****************************************************************************
+Copyright (c) 2012-2013 cocos2d-x.org
+Copyright (c) Microsoft Open Technologies, Inc.
+Copyright (c) Microsoft Corporation.
+
+http://www.cocos2d-x.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+****************************************************************************/
+
+#include
+
+#include "util.h"
+
+using namespace cocos2d::plugin;
+using namespace Microsoft::WRL;
+using namespace Microsoft::WRL::Wrappers;
+using namespace Platform;
+using namespace cocos2d::pluginparam;
+using namespace Platform::Collections;
+using namespace cocosPluginWinrtBridge;
+
+namespace pluginx {
+ namespace util {
+
+ PluginParamWinRT^ toWinRT(PluginParam* param) {
+ PluginParamWinRT^ ret = ref new PluginParamWinRT();
+ ret->setCurrentType((ParamTypeEnum)param->getCurrentType());
+ if (ret->getCurrentType() == ParamTypeEnum::kParamTypeInt) {
+ ret->setIntValue(param->getIntValue());
+ }
+ else if (ret->getCurrentType() == ParamTypeEnum::kParamTypeFloat) {
+ ret->setFloatValue(param->getFloatValue());
+ }
+ else if (ret->getCurrentType() == ParamTypeEnum::kParamTypeBool) {
+ ret->setBoolValue(param->getBoolValue());
+ }
+ else if (ret->getCurrentType() == ParamTypeEnum::kParamTypeString) {
+ ret->setStringValue(stdStringToPlatformString(param->getStringValue()));
+ }
+ else if (ret->getCurrentType() == ParamTypeEnum::kParamTypeMap) {
+ IMap^ pMap = ref new Platform::Collections::Map();
+ std::map::iterator it;
+ for (it = param->getMapValue().begin(); it != param->getMapValue().end(); ++it) {
+ pMap->Insert(stdStringToPlatformString(it->first), toWinRT(it->second));
+ }
+ ret->setMapValue(pMap);
+ }
+ else if (ret->getCurrentType() == ParamTypeEnum::kParamTypeStringMap) {
+ ret->setStrMapValue(stdStrMapToPlatformStrMap(¶m->getStrMapValue()));
+ }
+
+ return ret;
+ }
+
+ Vector^ stdVectorToPlatformVector(std::vector vec) {
+ Vector^ ret = ref new Vector();
+ std::vector::iterator it;
+ for (it = vec.begin(); it != vec.end(); ++it) {
+ ret->Append(toWinRT(*it));
+ }
+ return ret;
+ }
+
+ Platform::Collections::Map^ stdStrMapToPlatformStrMap(std::map* pMap) {
+ Platform::Collections::Map^ platMap = ref new Platform::Collections::Map();
+ std::map::iterator it;
+ for (it = pMap->begin(); it != pMap->end(); ++it) {
+ Platform::String^ keyStr = util::stdStringToPlatformString(it->first);
+ Platform::String^ valueStr = util::stdStringToPlatformString(it->second);
+ // add to collection
+ platMap->Insert(keyStr, valueStr);
+ }
+ return platMap;
+ }
+
+ String^ stdStringToPlatformString(std::string str) {
+ return ref new String(std::wstring(str.begin(), str.end()).c_str());
+ }
+
+ String^ charArrayToPlatformString(const char *str) {
+ return stdStringToPlatformString(std::string(str));
+ }
+
+ std::string PlatformStringToStdString(String^ str) {
+ const wchar_t *w = str->Data();
+ std::wstring wstr(w, str->Length());
+ return std::string(wstr.begin(), wstr.end());
+ }
+
+ // TODO doesn't work, don't use
+ const char* PlatformStringToCharArray(String^ str) {
+ //const wchar_t *w = str->Data();
+ //std::wstring wstr(w, str->Length());
+ //return std::string(wstr.begin(), wstr.end()).c_str();
+ std::string stdString = PlatformStringToStdString(str);
+ const char* charArray = stdString.c_str();
+ return charArray;
+ }
+ } // end namespace util
+} // end namespace pluginx
diff --git a/protocols/platform/winrt/util.h b/protocols/platform/winrt/util.h
new file mode 100644
index 00000000..77c03736
--- /dev/null
+++ b/protocols/platform/winrt/util.h
@@ -0,0 +1,50 @@
+
+/****************************************************************************
+Copyright (c) 2012-2013 cocos2d-x.org
+Copyright (c) Microsoft Open Technologies, Inc.
+Copyright (c) Microsoft Corporation.
+
+http://www.cocos2d-x.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+****************************************************************************/
+
+#pragma once
+
+#include
+#include
+#include
+#include
+
+#include "PluginParam.h"
+#include "ProtocolAnalytics.h"
+#include "PluginProtocol.h"
+#include "PluginParamWinRT.h"
+
+namespace pluginx {
+ namespace util {
+ Platform::String^ charArrayToPlatformString(const char* chStr);
+ Platform::String^ stdStringToPlatformString(const std::string str);
+ cocos2d::pluginparam::PluginParamWinRT^ toWinRT(cocos2d::plugin::PluginParam* param);
+ Platform::Collections::Vector^ stdVectorToPlatformVector(std::vector vec);
+ const char* PlatformStringToCharArray(Platform::String^);
+ std::string PlatformStringToStdString(Platform::String^);
+ Platform::Collections::Map^ stdStrMapToPlatformStrMap(std::map* pMap);
+ }
+}
diff --git a/protocols/platform/winrt/winrtInterface.idl b/protocols/platform/winrt/winrtInterface.idl
new file mode 100644
index 00000000..7230977b
--- /dev/null
+++ b/protocols/platform/winrt/winrtInterface.idl
@@ -0,0 +1,134 @@
+
+/****************************************************************************
+Copyright (c) 2012-2013 cocos2d-x.org
+Copyright (c) Microsoft Open Technologies, Inc.
+Copyright (c) Microsoft Corporation.
+
+http://www.cocos2d-x.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+****************************************************************************/
+
+import "inspectable.idl";
+import "Windows.Foundation.idl";
+import "Windows.UI.Core.idl";
+
+#define COMPONENT_VERSION 1.0
+
+
+namespace winrtInterface
+{
+
+ interface IPluginParam;
+ [uuid(DEF6D397-BDCA-49AC-B8E4-01626BCB9C51), version(COMPONENT_VERSION)]
+ interface IPluginParam: IInspectable
+ {
+ //HRESULT getCurrentType([out, retval] int* result);
+ }
+
+
+
+ interface IProtocol;
+ [uuid(64b0eac7-f5e7-4787-90a2-940f5297570a), version(COMPONENT_VERSION)]
+ interface IProtocol : IInspectable
+ {
+ HRESULT getPluginVersion([out, retval] HSTRING *value);
+ HRESULT getSDKVersion([out, retval] HSTRING *value);
+ HRESULT setDebugMode([in] boolean bDebug);
+ HRESULT callFuncWithParam([in] HSTRING funcName, [in] Windows.Foundation.Collections.IVector* params);
+ HRESULT callStringFuncWithParam([in] HSTRING funcName, [in] Windows.Foundation.Collections.IVector* params, [out, retval] HSTRING* result);
+ HRESULT callIntFuncWithParam([in] HSTRING funcName, [in] Windows.Foundation.Collections.IVector* params, [out, retval] int* result);
+ HRESULT callBoolFuncWithParam([in] HSTRING funcName, [in] Windows.Foundation.Collections.IVector* params, [out, retval] boolean* result);
+ HRESULT callFloatFuncWithParam([in] HSTRING funcName, [in] Windows.Foundation.Collections.IVector* params, [out, retval] float* result);
+ }
+
+ interface IProtocolAnalytics;
+ [uuid(666997f8-53a1-4c9c-b7c7-e7b3f248e9f5), version(COMPONENT_VERSION)]
+ interface IProtocolAnalytics : IInspectable
+ requires IProtocol
+ {
+ HRESULT startSession([in] HSTRING appKey);
+ HRESULT stopSession();
+ HRESULT setSessionContinueMillis([in] int millis);
+ HRESULT logError([in] HSTRING errorId, [in] HSTRING message);
+ HRESULT logEvent([in] HSTRING eventId, [in] Windows.Foundation.Collections.IMap* paramMap);
+ HRESULT logTimedEventBegin([in] HSTRING eventId);
+ HRESULT logTimedEventEnd([in] HSTRING eventId);
+ HRESULT setCaptureUncaughtException([in] boolean enabled);
+ }
+
+ // enums need to be kept up to date with their c++ implementations
+ [version(COMPONENT_VERSION)]
+ typedef [v1_enum, public] enum IAPProductRequestEnum {
+ RequestSuccess = 0,
+ RequestFail,
+ RequestTimeout
+ } IAPProductRequestEnum;
+
+ [version(COMPONENT_VERSION)]
+ typedef [v1_enum, public] enum PayResultCodeEnum {
+ kPaySuccess = 0,
+ kPayFail,
+ kPayCancel,
+ kPayTimeOut
+ } PayResultCodeEnum;
+
+ typedef Windows.Foundation.Collections.IMap* StringMap;
+ // typedef Windows.Foundation.Collections.IVector* StringMapVector;
+
+ [uuid(FDF08C00-28E1-4D10-975D-46F8411581EA), version(COMPONENT_VERSION)]
+ delegate HRESULT OnPayResultHandler(PayResultCodeEnum ret, HSTRING msg);
+
+ interface IProtocolIAP;
+ [uuid(74436BAA-2B54-487B-AA90-A60C1CFBC70F), version(COMPONENT_VERSION)]
+ interface IProtocolIAP : IInspectable
+ requires IProtocol
+ {
+ [eventadd]
+ HRESULT OnPayResult([in] OnPayResultHandler* eventHandler, [out, retval] EventRegistrationToken* eventCookie);
+ [eventremove]
+ HRESULT OnPayResult([in] EventRegistrationToken eventCookie);
+ HRESULT configDeveloperInfo([in] Windows.Foundation.Collections.IMap* devInfo);
+ HRESULT payForProduct([in] Windows.Foundation.Collections.IMap* info);
+ HRESULT setDispatcher([in] Windows.UI.Core.CoreDispatcher* dispatcher);
+ }
+
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/protocols/proj.win8.1-universal/pluginx.sln b/protocols/proj.win8.1-universal/pluginx.sln
new file mode 100644
index 00000000..1a79807c
--- /dev/null
+++ b/protocols/proj.win8.1-universal/pluginx.sln
@@ -0,0 +1,115 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2013
+VisualStudioVersion = 12.0.31101.0
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "pluginx", "pluginx", "{EEA8E052-42ED-4B3E-9FC2-126F5ED1452A}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pluginx.Shared", "pluginx\pluginx.Shared\pluginx.Shared.vcxitems", "{5419E2CA-4B8F-411D-B6B1-54C415ED17B0}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pluginx.Windows", "pluginx\pluginx.Windows\pluginx.Windows.vcxproj", "{C954925A-1A55-49EE-B1BE-AECCED3F08BF}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pluginx.WindowsPhone", "pluginx\pluginx.WindowsPhone\pluginx.WindowsPhone.vcxproj", "{B9AA6C29-72BC-4607-9F0C-8A68FE84EE0E}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "headers", "headers", "{D45710BF-1204-4331-B24D-F3864F048EA0}"
+ ProjectSection(SolutionItems) = preProject
+ ..\include\AgentManager.h = ..\include\AgentManager.h
+ ..\include\FacebookAgent.h = ..\include\FacebookAgent.h
+ ..\include\iOSIAPAgent.h = ..\include\iOSIAPAgent.h
+ ..\include\PluginFactory.h = ..\include\PluginFactory.h
+ ..\include\PluginManager.h = ..\include\PluginManager.h
+ ..\include\PluginParam.h = ..\include\PluginParam.h
+ ..\include\PluginProtocol.h = ..\include\PluginProtocol.h
+ ..\include\ProtocolAds.h = ..\include\ProtocolAds.h
+ ..\include\ProtocolAnalytics.h = ..\include\ProtocolAnalytics.h
+ ..\include\ProtocolIAP.h = ..\include\ProtocolIAP.h
+ ..\include\ProtocolShare.h = ..\include\ProtocolShare.h
+ ..\include\ProtocolSocial.h = ..\include\ProtocolSocial.h
+ ..\include\ProtocolUser.h = ..\include\ProtocolUser.h
+ EndProjectSection
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "cocosPluginWinrtBridge", "cocosPluginWinrtBridge", "{9E170B4E-A6AC-4ECA-93EE-A8BD2A1D58B6}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cocosPluginWinrtBridge.Shared", "..\platform\winrt\cocosPluginWinrtBridge\cocosPluginWinrtBridge\cocosPluginWinrtBridge.Shared\cocosPluginWinrtBridge.Shared.vcxitems", "{1B37C3CE-088D-4277-B750-3A1CBEB1884A}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cocosPluginWinrtBridge.Windows", "..\platform\winrt\cocosPluginWinrtBridge\cocosPluginWinrtBridge\cocosPluginWinrtBridge.Windows\cocosPluginWinrtBridge.Windows.vcxproj", "{491F4851-92BA-4AC1-9A80-241E1FF13229}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cocosPluginWinrtBridge.WindowsPhone", "..\platform\winrt\cocosPluginWinrtBridge\cocosPluginWinrtBridge\cocosPluginWinrtBridge.WindowsPhone\cocosPluginWinrtBridge.WindowsPhone.vcxproj", "{35ACD56C-DEE1-477B-BEC0-C963C7937623}"
+EndProject
+Global
+ GlobalSection(SharedMSBuildProjectFiles) = preSolution
+ ..\platform\winrt\cocosPluginWinrtBridge\cocosPluginWinrtBridge\cocosPluginWinrtBridge.Shared\cocosPluginWinrtBridge.Shared.vcxitems*{491f4851-92ba-4ac1-9a80-241e1ff13229}*SharedItemsImports = 4
+ ..\platform\winrt\cocosPluginWinrtBridge\cocosPluginWinrtBridge\cocosPluginWinrtBridge.Shared\cocosPluginWinrtBridge.Shared.vcxitems*{35acd56c-dee1-477b-bec0-c963c7937623}*SharedItemsImports = 4
+ ..\platform\winrt\cocosPluginWinrtBridge\cocosPluginWinrtBridge\cocosPluginWinrtBridge.Shared\cocosPluginWinrtBridge.Shared.vcxitems*{1b37c3ce-088d-4277-b750-3a1cbeb1884a}*SharedItemsImports = 9
+ pluginx\pluginx.Shared\pluginx.Shared.vcxitems*{b9aa6c29-72bc-4607-9f0c-8a68fe84ee0e}*SharedItemsImports = 4
+ pluginx\pluginx.Shared\pluginx.Shared.vcxitems*{5419e2ca-4b8f-411d-b6b1-54c415ed17b0}*SharedItemsImports = 9
+ pluginx\pluginx.Shared\pluginx.Shared.vcxitems*{c954925a-1a55-49ee-b1be-aecced3f08bf}*SharedItemsImports = 4
+ EndGlobalSection
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|ARM = Debug|ARM
+ Debug|Win32 = Debug|Win32
+ Debug|x64 = Debug|x64
+ Release|ARM = Release|ARM
+ Release|Win32 = Release|Win32
+ Release|x64 = Release|x64
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {C954925A-1A55-49EE-B1BE-AECCED3F08BF}.Debug|ARM.ActiveCfg = Debug|ARM
+ {C954925A-1A55-49EE-B1BE-AECCED3F08BF}.Debug|ARM.Build.0 = Debug|ARM
+ {C954925A-1A55-49EE-B1BE-AECCED3F08BF}.Debug|Win32.ActiveCfg = Debug|Win32
+ {C954925A-1A55-49EE-B1BE-AECCED3F08BF}.Debug|Win32.Build.0 = Debug|Win32
+ {C954925A-1A55-49EE-B1BE-AECCED3F08BF}.Debug|x64.ActiveCfg = Debug|x64
+ {C954925A-1A55-49EE-B1BE-AECCED3F08BF}.Debug|x64.Build.0 = Debug|x64
+ {C954925A-1A55-49EE-B1BE-AECCED3F08BF}.Release|ARM.ActiveCfg = Release|ARM
+ {C954925A-1A55-49EE-B1BE-AECCED3F08BF}.Release|ARM.Build.0 = Release|ARM
+ {C954925A-1A55-49EE-B1BE-AECCED3F08BF}.Release|Win32.ActiveCfg = Release|Win32
+ {C954925A-1A55-49EE-B1BE-AECCED3F08BF}.Release|Win32.Build.0 = Release|Win32
+ {C954925A-1A55-49EE-B1BE-AECCED3F08BF}.Release|x64.ActiveCfg = Release|x64
+ {C954925A-1A55-49EE-B1BE-AECCED3F08BF}.Release|x64.Build.0 = Release|x64
+ {B9AA6C29-72BC-4607-9F0C-8A68FE84EE0E}.Debug|ARM.ActiveCfg = Debug|ARM
+ {B9AA6C29-72BC-4607-9F0C-8A68FE84EE0E}.Debug|ARM.Build.0 = Debug|ARM
+ {B9AA6C29-72BC-4607-9F0C-8A68FE84EE0E}.Debug|Win32.ActiveCfg = Debug|Win32
+ {B9AA6C29-72BC-4607-9F0C-8A68FE84EE0E}.Debug|Win32.Build.0 = Debug|Win32
+ {B9AA6C29-72BC-4607-9F0C-8A68FE84EE0E}.Debug|x64.ActiveCfg = Debug|Win32
+ {B9AA6C29-72BC-4607-9F0C-8A68FE84EE0E}.Release|ARM.ActiveCfg = Release|ARM
+ {B9AA6C29-72BC-4607-9F0C-8A68FE84EE0E}.Release|ARM.Build.0 = Release|ARM
+ {B9AA6C29-72BC-4607-9F0C-8A68FE84EE0E}.Release|Win32.ActiveCfg = Release|Win32
+ {B9AA6C29-72BC-4607-9F0C-8A68FE84EE0E}.Release|Win32.Build.0 = Release|Win32
+ {B9AA6C29-72BC-4607-9F0C-8A68FE84EE0E}.Release|x64.ActiveCfg = Release|Win32
+ {491F4851-92BA-4AC1-9A80-241E1FF13229}.Debug|ARM.ActiveCfg = Debug|ARM
+ {491F4851-92BA-4AC1-9A80-241E1FF13229}.Debug|ARM.Build.0 = Debug|ARM
+ {491F4851-92BA-4AC1-9A80-241E1FF13229}.Debug|Win32.ActiveCfg = Debug|Win32
+ {491F4851-92BA-4AC1-9A80-241E1FF13229}.Debug|Win32.Build.0 = Debug|Win32
+ {491F4851-92BA-4AC1-9A80-241E1FF13229}.Debug|x64.ActiveCfg = Debug|x64
+ {491F4851-92BA-4AC1-9A80-241E1FF13229}.Debug|x64.Build.0 = Debug|x64
+ {491F4851-92BA-4AC1-9A80-241E1FF13229}.Release|ARM.ActiveCfg = Release|ARM
+ {491F4851-92BA-4AC1-9A80-241E1FF13229}.Release|ARM.Build.0 = Release|ARM
+ {491F4851-92BA-4AC1-9A80-241E1FF13229}.Release|Win32.ActiveCfg = Release|Win32
+ {491F4851-92BA-4AC1-9A80-241E1FF13229}.Release|Win32.Build.0 = Release|Win32
+ {491F4851-92BA-4AC1-9A80-241E1FF13229}.Release|x64.ActiveCfg = Release|x64
+ {491F4851-92BA-4AC1-9A80-241E1FF13229}.Release|x64.Build.0 = Release|x64
+ {35ACD56C-DEE1-477B-BEC0-C963C7937623}.Debug|ARM.ActiveCfg = Debug|ARM
+ {35ACD56C-DEE1-477B-BEC0-C963C7937623}.Debug|ARM.Build.0 = Debug|ARM
+ {35ACD56C-DEE1-477B-BEC0-C963C7937623}.Debug|Win32.ActiveCfg = Debug|Win32
+ {35ACD56C-DEE1-477B-BEC0-C963C7937623}.Debug|Win32.Build.0 = Debug|Win32
+ {35ACD56C-DEE1-477B-BEC0-C963C7937623}.Debug|x64.ActiveCfg = Debug|Win32
+ {35ACD56C-DEE1-477B-BEC0-C963C7937623}.Release|ARM.ActiveCfg = Release|ARM
+ {35ACD56C-DEE1-477B-BEC0-C963C7937623}.Release|ARM.Build.0 = Release|ARM
+ {35ACD56C-DEE1-477B-BEC0-C963C7937623}.Release|Win32.ActiveCfg = Release|Win32
+ {35ACD56C-DEE1-477B-BEC0-C963C7937623}.Release|Win32.Build.0 = Release|Win32
+ {35ACD56C-DEE1-477B-BEC0-C963C7937623}.Release|x64.ActiveCfg = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {5419E2CA-4B8F-411D-B6B1-54C415ED17B0} = {EEA8E052-42ED-4B3E-9FC2-126F5ED1452A}
+ {C954925A-1A55-49EE-B1BE-AECCED3F08BF} = {EEA8E052-42ED-4B3E-9FC2-126F5ED1452A}
+ {B9AA6C29-72BC-4607-9F0C-8A68FE84EE0E} = {EEA8E052-42ED-4B3E-9FC2-126F5ED1452A}
+ {D45710BF-1204-4331-B24D-F3864F048EA0} = {EEA8E052-42ED-4B3E-9FC2-126F5ED1452A}
+ {9E170B4E-A6AC-4ECA-93EE-A8BD2A1D58B6} = {EEA8E052-42ED-4B3E-9FC2-126F5ED1452A}
+ {1B37C3CE-088D-4277-B750-3A1CBEB1884A} = {9E170B4E-A6AC-4ECA-93EE-A8BD2A1D58B6}
+ {491F4851-92BA-4AC1-9A80-241E1FF13229} = {9E170B4E-A6AC-4ECA-93EE-A8BD2A1D58B6}
+ {35ACD56C-DEE1-477B-BEC0-C963C7937623} = {9E170B4E-A6AC-4ECA-93EE-A8BD2A1D58B6}
+ EndGlobalSection
+EndGlobal
diff --git a/protocols/proj.win8.1-universal/pluginx/pluginx.Shared/pluginx.Shared.vcxitems b/protocols/proj.win8.1-universal/pluginx/pluginx.Shared/pluginx.Shared.vcxitems
new file mode 100644
index 00000000..6c59b3bc
--- /dev/null
+++ b/protocols/proj.win8.1-universal/pluginx/pluginx.Shared/pluginx.Shared.vcxitems
@@ -0,0 +1,40 @@
+
+
+
+ $(MSBuildAllProjects);$(MSBuildThisFileFullPath)
+ true
+ {5419e2ca-4b8f-411d-b6b1-54c415ed17b0}
+ pluginx
+ pluginx.Shared
+ 248F659F-DAC5-46E8-AC09-60EC9FC95053
+
+
+
+ %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/protocols/proj.win8.1-universal/pluginx/pluginx.Shared/pluginx.Shared.vcxitems.filters b/protocols/proj.win8.1-universal/pluginx/pluginx.Shared/pluginx.Shared.vcxitems.filters
new file mode 100644
index 00000000..ec36e189
--- /dev/null
+++ b/protocols/proj.win8.1-universal/pluginx/pluginx.Shared/pluginx.Shared.vcxitems.filters
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/protocols/proj.win8.1-universal/pluginx/pluginx.Windows/pluginx.Windows.vcxproj b/protocols/proj.win8.1-universal/pluginx/pluginx.Windows/pluginx.Windows.vcxproj
new file mode 100644
index 00000000..74f51a69
--- /dev/null
+++ b/protocols/proj.win8.1-universal/pluginx/pluginx.Windows/pluginx.Windows.vcxproj
@@ -0,0 +1,253 @@
+
+
+
+
+ Debug
+ ARM
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ ARM
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+
+ {491f4851-92ba-4ac1-9a80-241e1ff13229}
+
+
+
+ {c954925a-1a55-49ee-b1be-aecced3f08bf}
+ pluginx
+ en-US
+ 12.0
+ true
+ Windows Store
+ 8.1
+ CodeSharingStaticLibrary
+
+
+
+ StaticLibrary
+ true
+ v120
+
+
+ StaticLibrary
+ true
+ v120
+
+
+ StaticLibrary
+ true
+ v120
+
+
+ StaticLibrary
+ false
+ true
+ v120
+
+
+ StaticLibrary
+ false
+ true
+ v120
+
+
+ StaticLibrary
+ false
+ true
+ v120
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+ false
+
+
+ false
+
+
+ false
+
+
+ false
+
+
+ false
+
+
+
+ NotUsing
+ true
+ true
+ $(MSBuildProjectDirectory)\..\..\..\include;%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory)
+
+
+ Cdecl
+ false
+ CC_TARGET_PLATFORM=CC_PLATFORM_WINRT;%(PreprocessorDefinitions)
+
+
+ Console
+ false
+ false
+
+
+ /IGNORE:4264 %(AdditionalOptions)
+
+
+
+
+ NotUsing
+ true
+ true
+ $(ProjectDir)\..\..\..\include;%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory)
+
+
+ Cdecl
+ CC_TARGET_PLATFORM=CC_PLATFORM_WINRT;%(PreprocessorDefinitions)
+ false
+
+
+ Console
+ false
+ false
+
+
+ /IGNORE:4264 %(AdditionalOptions)
+ false
+
+
+
+
+ NotUsing
+ true
+ true
+ $(MSBuildProjectDirectory)\..\..\..\include;%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory)
+
+
+ Cdecl
+ true
+ false
+ CC_TARGET_PLATFORM=CC_PLATFORM_WINRT;%(PreprocessorDefinitions)
+
+
+ Console
+ false
+ false
+
+
+ true
+
+
+ /IGNORE:4264 %(AdditionalOptions)
+
+
+
+
+ NotUsing
+ true
+ true
+ $(ProjectDir)../../../platform/winrt/winrtInterface/winrtInterface/winrtInterface.Shared;$(ProjectDir)../../../platform/winrt/winrtInterface/winrtInterface/winrtInterface.Windows;$(ProjectDir)\..\..\..\include;%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory)
+
+
+ Cdecl
+ CC_TARGET_PLATFORM=CC_PLATFORM_WINRT;%(PreprocessorDefinitions)
+ false
+
+
+ Console
+ false
+ false
+
+
+ /IGNORE:4264 %(AdditionalOptions)
+ false
+
+
+
+
+ NotUsing
+ true
+ true
+ $(MSBuildProjectDirectory)\..\..\..\include;%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory)
+
+
+ Cdecl
+ false
+ CC_TARGET_PLATFORM=CC_PLATFORM_WINRT;%(PreprocessorDefinitions)
+
+
+ Console
+ false
+ false
+
+
+ /IGNORE:4264 %(AdditionalOptions)
+
+
+
+
+ NotUsing
+ true
+ true
+ $(ProjectDir)\..\..\..\include;%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory)
+
+
+ Cdecl
+ CC_TARGET_PLATFORM=CC_PLATFORM_WINRT;%(PreprocessorDefinitions)
+ false
+
+
+ Console
+ false
+ false
+
+
+ /IGNORE:4264 %(AdditionalOptions)
+ false
+
+
+
+
+
+
\ No newline at end of file
diff --git a/protocols/proj.win8.1-universal/pluginx/pluginx.Windows/pluginx.Windows.vcxproj.filters b/protocols/proj.win8.1-universal/pluginx/pluginx.Windows/pluginx.Windows.vcxproj.filters
new file mode 100644
index 00000000..a7761ab0
--- /dev/null
+++ b/protocols/proj.win8.1-universal/pluginx/pluginx.Windows/pluginx.Windows.vcxproj.filters
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/protocols/proj.win8.1-universal/pluginx/pluginx.WindowsPhone/pluginx.WindowsPhone.vcxproj b/protocols/proj.win8.1-universal/pluginx/pluginx.WindowsPhone/pluginx.WindowsPhone.vcxproj
new file mode 100644
index 00000000..e547b498
--- /dev/null
+++ b/protocols/proj.win8.1-universal/pluginx/pluginx.WindowsPhone/pluginx.WindowsPhone.vcxproj
@@ -0,0 +1,175 @@
+
+
+
+
+ Debug
+ ARM
+
+
+ Debug
+ Win32
+
+
+ Release
+ ARM
+
+
+ Release
+ Win32
+
+
+
+
+ {35acd56c-dee1-477b-bec0-c963c7937623}
+
+
+
+ {b9aa6c29-72bc-4607-9f0c-8a68fe84ee0e}
+ pluginx
+ en-US
+ 12.0
+ true
+ Windows Phone
+ 8.1
+ CodeSharingStaticLibrary
+
+
+
+ StaticLibrary
+ true
+ v120_wp81
+
+
+ StaticLibrary
+ true
+ v120_wp81
+
+
+ StaticLibrary
+ false
+ true
+ v120_wp81
+
+
+ StaticLibrary
+ false
+ true
+ v120_wp81
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+ false
+
+
+ false
+
+
+ false
+
+
+
+ NotUsing
+ true
+ true
+ $(MSBuildProjectDirectory)\..\..\..\include;%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory)
+
+
+ false
+ CC_TARGET_PLATFORM=CC_PLATFORM_WINRT;%(PreprocessorDefinitions)
+
+
+ Console
+ false
+ false
+
+
+ /IGNORE:4264 %(AdditionalOptions)
+
+
+
+
+ NotUsing
+ true
+ true
+ $(ProjectDir)\..\..\..\include;%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory)
+
+
+ CC_TARGET_PLATFORM=CC_PLATFORM_WINRT;%(PreprocessorDefinitions)
+ false
+
+
+ Console
+ false
+ false
+
+
+ /IGNORE:4264 %(AdditionalOptions)
+ false
+
+
+
+
+ NotUsing
+ true
+ true
+ $(MSBuildProjectDirectory)\..\..\..\include;%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory)
+
+
+ false
+ true
+ CC_TARGET_PLATFORM=CC_PLATFORM_WINRT;%(PreprocessorDefinitions)
+
+
+ Console
+ false
+ false
+
+
+ true
+
+
+ /IGNORE:4264 %(AdditionalOptions)
+
+
+
+
+ NotUsing
+ true
+ true
+ $(ProjectDir)../../../platform/winrt/winrtInterface/winrtInterface/winrtInterface.WindowsPhone/;$(ProjectDir)../../../platform/winrt/winrtInterface/winrtInterface/winrtInterface.Shared/;$(ProjectDir)../../../platform/winrt/winrtInterface/winrtInterface/winrtInterface.WindowsPhone;$(ProjectDir)\..\..\..\include;%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory)
+
+
+ CC_TARGET_PLATFORM=CC_PLATFORM_WINRT;%(PreprocessorDefinitions)
+ false
+
+
+ Console
+ false
+ false
+
+
+ /IGNORE:4264 %(AdditionalOptions)
+ false
+
+
+
+
+
+
\ No newline at end of file
diff --git a/protocols/proj.win8.1-universal/pluginx/pluginx.WindowsPhone/pluginx.WindowsPhone.vcxproj.filters b/protocols/proj.win8.1-universal/pluginx/pluginx.WindowsPhone/pluginx.WindowsPhone.vcxproj.filters
new file mode 100644
index 00000000..a7761ab0
--- /dev/null
+++ b/protocols/proj.win8.1-universal/pluginx/pluginx.WindowsPhone/pluginx.WindowsPhone.vcxproj.filters
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/samples/HelloPlugins/Classes/HelloWorldScene.cpp b/samples/HelloPlugins/Classes/HelloWorldScene.cpp
index 3620296f..78af8376 100644
--- a/samples/HelloPlugins/Classes/HelloWorldScene.cpp
+++ b/samples/HelloPlugins/Classes/HelloWorldScene.cpp
@@ -1,13 +1,13 @@
#include "HelloWorldScene.h"
-#include "TestAdsScene.h"
-#include "TestAnalyticsScene.h"
-#include "TestShareScene.h"
-#include "TestIAPScene.h"
-#include "TestIAPOnlineScene.h"
-#include "TestUserScene.h"
-#include "TestSocialScene.h"
-#include "TestFacebookUserScene.h"
-#include "TestFacebookShare.h"
+#include "TestAds\TestAdsScene.h"
+#include "TestAnalytics\TestAnalyticsScene.h"
+#include "TestShare\TestShareScene.h"
+#include "TestIAP\TestIAPScene.h"
+#include "TestIAPOnline\TestIAPOnlineScene.h"
+#include "TestUser\TestUserScene.h"
+#include "TestSocial\TestSocialScene.h"
+#include "TestFacebookUser\TestFacebookUserScene.h"
+#include "TestFacebookShare\TestFacebookShare.h"
USING_NS_CC;
@@ -17,12 +17,10 @@ std::string g_testCases[] = {
"Test Share",
"Test Facebook User",
"Test Facebook Share",
-#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
"Test IAP",
"Test IAP Online",
"Test User",
"Test Social",
-#endif
};
Scene* HelloWorld::scene()
@@ -89,6 +87,7 @@ void HelloWorld::menuCallback(Ref* pSender)
MenuItemFont *pItem = (MenuItemFont*) pSender;
Scene* newScene = NULL;
switch (pItem->getTag()) {
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
case 0:
newScene = TestAds::scene();
break;
@@ -104,9 +103,11 @@ void HelloWorld::menuCallback(Ref* pSender)
case 4:
newScene = TestFacebookShare::scene();
break;
+#endif
case 5:
newScene = TestIAP::scene();
break;
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
case 6:
newScene = TestIAPOnline::scene();
break;
@@ -116,6 +117,7 @@ void HelloWorld::menuCallback(Ref* pSender)
case 8:
newScene = TestSocial::scene();
break;
+#endif
case 9:
break;
default:
diff --git a/samples/HelloPlugins/Classes/TestIAP/MyPurchase.cpp b/samples/HelloPlugins/Classes/TestIAP/MyPurchase.cpp
index a3eba9bf..9b239458 100644
--- a/samples/HelloPlugins/Classes/TestIAP/MyPurchase.cpp
+++ b/samples/HelloPlugins/Classes/TestIAP/MyPurchase.cpp
@@ -23,9 +23,16 @@ THE SOFTWARE.
****************************************************************************/
#include "MyPurchase.h"
#include "PluginManager.h"
+#include "PluginFactory.h"
#include "cocos2d.h"
#include "Configs.h"
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+ #define PLUGIN_NAME "IAPGooglePlay"
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
+ #define PLUGIN_NAME "microsoftiap"
+#endif
+
using namespace cocos2d::plugin;
using namespace cocos2d;
@@ -33,7 +40,7 @@ MyPurchase* MyPurchase::s_pPurchase = NULL;
MyPurchase::MyPurchase()
: s_pRetListener(NULL)
-, s_pGoogle(NULL)
+, iapPlugin(NULL)
{
}
@@ -73,29 +80,40 @@ void MyPurchase::loadIAPPlugin()
s_pRetListener = new MyPurchaseResult();
}
+ TIAPDeveloperInfo pDevInfo;
+
//Google IAP
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
{
- TIAPDeveloperInfo pGoogleInfo;
- pGoogleInfo["GooglePlayAppKey"] = GOOGLE_APPKEY;
-
- if(pGoogleInfo.empty()) {
+ pDevInfo["GooglePlayAppKey"] = GOOGLE_APPKEY;
+ if(pDevInfo.empty())
+ {
char msg[256] = { 0 };
sprintf(msg, "Google App Key info is empty. PLZ fill your Google App Key info in %s(nearby line %d)", __FILE__, __LINE__);
MessageBox(msg, "Google IAP Warning");
}
- s_pGoogle = dynamic_cast(PluginManager::getInstance()->loadPlugin("IAPGooglePlay"));
- s_pGoogle->configDeveloperInfo(pGoogleInfo);
- s_pGoogle->setResultListener(s_pRetListener);
- s_pGoogle->setDebugMode(true);
}
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
+ // Windows Store IAP
+ {
+ auto factory = plugin::PluginFactory::getInstance();
+ auto dispatcher = cocos2d::GLViewImpl::sharedOpenGLView()->getDispatcher();
+ factory->setDispatcher(dispatcher);
+ pDevInfo["windows_store_proxy"] = "WindowsStoreProxy.xml";
+ }
+#endif
+ iapPlugin = dynamic_cast(PluginManager::getInstance()->loadPlugin(PLUGIN_NAME));
+ iapPlugin->setDebugMode(true);
+ iapPlugin->setResultListener(s_pRetListener);
+ iapPlugin->configDeveloperInfo(pDevInfo);
}
void MyPurchase::unloadIAPPlugin()
{
- if (s_pGoogle)
+ if (iapPlugin)
{
- PluginManager::getInstance()->unloadPlugin("IAPGooglePlay");
- s_pGoogle = NULL;
+ PluginManager::getInstance()->unloadPlugin(PLUGIN_NAME);
+ iapPlugin = NULL;
}
}
@@ -105,7 +123,7 @@ void MyPurchase::payByMode(TProductInfo info, MyPayMode mode)
switch(mode)
{
case eGoogle:
- pIAP = s_pGoogle;
+ pIAP = iapPlugin;
break;
default:
CCLOG("Unsupported IAP");
@@ -117,6 +135,8 @@ void MyPurchase::payByMode(TProductInfo info, MyPayMode mode)
}
}
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+
void MyPurchaseResult::onPayResult(PayResultCode ret, const char* msg, TProductInfo info)
{
char goodInfo[1024] = { 0 };
@@ -126,3 +146,27 @@ void MyPurchaseResult::onPayResult(PayResultCode ret, const char* msg, TProductI
info.find("IAPId")->second.c_str());
MessageBox(goodInfo , msg);
}
+
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
+
+void MyPurchaseResult::onPayResult(PayResultCode ret, const char* msg, TProductInfo info)
+{
+ std::string title;
+ if (ret == PayResultCode::kPaySuccess) {
+ title = "Purchase Success";
+ }
+ else {
+ title = "Purchase Fail";
+ }
+ MessageBox(msg, title.c_str());
+}
+
+void MyPurchase::reportConsumablePurchase(char* productId, char* transactionId) {
+ plugin::PluginParam productIdParam(productId);
+ plugin::PluginParam transactionIdParam(transactionId);
+ bool reportResult = iapPlugin->callBoolFuncWithParam("reportConsumableFulfillment", &productIdParam, &transactionIdParam, NULL);
+ std::string result = reportResult ? "Success" : "Fail";
+ MessageBox(result.c_str(), "consumable fulfillment result");
+
+}
+#endif
\ No newline at end of file
diff --git a/samples/HelloPlugins/Classes/TestIAP/MyPurchase.h b/samples/HelloPlugins/Classes/TestIAP/MyPurchase.h
index a5b25e51..1f2b2bf3 100644
--- a/samples/HelloPlugins/Classes/TestIAP/MyPurchase.h
+++ b/samples/HelloPlugins/Classes/TestIAP/MyPurchase.h
@@ -46,13 +46,17 @@ class MyPurchase
void unloadIAPPlugin();
void loadIAPPlugin();
void payByMode(cocos2d::plugin::TProductInfo info, MyPayMode mode);
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
+ void reportConsumablePurchase(char* productId, char* transactionId);
+ cocos2d::plugin::ProtocolIAP* getPlugin() { return iapPlugin; }
+#endif
private:
MyPurchase();
virtual ~MyPurchase();
static MyPurchase* s_pPurchase;
- cocos2d::plugin::ProtocolIAP* s_pGoogle;
+ cocos2d::plugin::ProtocolIAP* iapPlugin;
MyPurchaseResult* s_pRetListener;
};
diff --git a/samples/HelloPlugins/Classes/TestIAP/TestIAPScene.cpp b/samples/HelloPlugins/Classes/TestIAP/TestIAPScene.cpp
index dd98e9bf..e9e90efa 100644
--- a/samples/HelloPlugins/Classes/TestIAP/TestIAPScene.cpp
+++ b/samples/HelloPlugins/Classes/TestIAP/TestIAPScene.cpp
@@ -70,24 +70,75 @@ bool TestIAP::init()
auto panel = Layout::create();
panel->setAnchorPoint(Vec2(0.5,0.5));
- panel->setPosition(Vec2(origin.x + winSize.width/2, origin.y + winSize.height/2));
+ panel->setPosition(Vec2(origin.x + winSize.width/2, origin.y + winSize.height - 50));
panel->setLayoutType(LayoutType::VERTICAL);
addChild(panel);
- //Google IAP button
- auto btnGoogle = Button::create("btn_normal.png","btn_pressed.png");
- btnGoogle->setTitleText("Google");
- btnGoogle->setScale(2);
- btnGoogle->addClickEventListener([=](Ref* sender){
- //Perform IAP callback
- TProductInfo pInfo;
- MyPurchase::MyPayMode mode = MyPurchase::MyPayMode::eGoogle;
- pInfo["IAPId"] = "android.test.purchased";
- MyPurchase::getInstance()->payByMode(pInfo, mode);
+ LinearLayoutParameter* llp = LinearLayoutParameter::create();
+ llp->setGravity(LinearGravity::CENTER_HORIZONTAL);
+ llp->setMargin(Margin(0, 0, 0, 50));
+ auto purchaseButton = Button::create("btn_normal.png", "btn_pressed.png");
+ purchaseButton->setTitleText("test purchase");
+ purchaseButton->setScale(2);
+ purchaseButton->setLayoutParameter(llp);
+ purchaseButton->addClickEventListener([](Ref* pSender) {
+ MyPurchase::MyPayMode mode = MyPurchase::MyPayMode::eGoogle;
+ std::map productInfo;
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+ productInfo["IAPId"] = "android.test.purchased";
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
+ productInfo["product"] = "feature1";
+#endif
+ MyPurchase::getInstance()->payByMode(productInfo, MyPurchase::MyPayMode::eGoogle);
});
- panel->addChild(btnGoogle);
+ panel->addChild(purchaseButton);
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
+
+ auto purchaseConsumableButton = Button::create("btn_normal.png", "btn_pressed.png");
+ purchaseConsumableButton->setTitleText("test purchase consumable");
+ purchaseConsumableButton->setScale(2);
+ purchaseConsumableButton->setLayoutParameter(llp);
+ purchaseConsumableButton->addClickEventListener([](Ref* pSender) {
+ MyPurchase::MyPayMode mode = MyPurchase::MyPayMode::eGoogle;
+ std::map productInfo;
+ productInfo["product"] = "consumable2";
+ MyPurchase::getInstance()->payByMode(productInfo, MyPurchase::MyPayMode::eGoogle);
+ });
+ panel->addChild(purchaseConsumableButton);
+
+ auto unfulfilledConsumablesButton = Button::create("btn_normal.png", "btn_pressed.png");
+ unfulfilledConsumablesButton->setTitleText("report consumable fulfillment");
+ unfulfilledConsumablesButton->setScale(2);
+ unfulfilledConsumablesButton->setLayoutParameter(llp);
+ unfulfilledConsumablesButton->addClickEventListener([](Ref* pSender) {
+ plugin::PluginParam productIdParam();
+ plugin::PluginParam transactionIdParam();
+ MyPurchase::getInstance()->reportConsumablePurchase("consumable1", "{00000001-0000-0000-0000-000000000000}");
+ });
+ panel->addChild(unfulfilledConsumablesButton);
+
+ auto allUnfulfilledButton = Button::create("btn_normal.png", "btn_pressed.png");
+ allUnfulfilledButton->setTitleText("get unfulfilled consumables");
+ allUnfulfilledButton->setScale(2);
+ allUnfulfilledButton->setLayoutParameter(llp);
+ allUnfulfilledButton->addClickEventListener([](Ref* pSender) {
+ std::string result = MyPurchase::getInstance()->getPlugin()->callStringFuncWithParam("getUnfulfilledConsumables", NULL);
+ MessageBox(result.c_str(), "Unfulfilled consumables result");
+ });
+ panel->addChild(allUnfulfilledButton);
+
+ auto listingItemsButton = Button::create("btn_normal.png", "btn_pressed.png");
+ listingItemsButton->setTitleText("get entitled durables");
+ listingItemsButton->setScale(2);
+ listingItemsButton->setLayoutParameter(llp);
+ listingItemsButton->addClickEventListener([](Ref* pSender) {
+ std::string result = MyPurchase::getInstance()->getPlugin()->callStringFuncWithParam("getEntitledDurables", NULL);
+ MessageBox(result.c_str(), "Product IDs");
+ });
+ panel->addChild(listingItemsButton);
+#endif
return true;
}
diff --git a/samples/HelloPlugins/Classes/TestSocial/TestSocialScene.cpp b/samples/HelloPlugins/Classes/TestSocial/TestSocialScene.cpp
index 1975fd97..e644285c 100644
--- a/samples/HelloPlugins/Classes/TestSocial/TestSocialScene.cpp
+++ b/samples/HelloPlugins/Classes/TestSocial/TestSocialScene.cpp
@@ -100,9 +100,9 @@ bool TestSocial::init()
// create optional menu
// cases item
- _caseItem = MenuItemToggle::createWithCallback(NULL,
- MenuItemFont::create( s_aTestCases[0].c_str() ),
- NULL );
+#if WINDOWS
+ _caseItem = MenuItemToggle::createWithCallback(NULL, MenuItemFont::create( s_aTestCases[0].c_str() ), NULL );
+#endif
int caseLen = sizeof(s_aTestCases) / sizeof(std::string);
for (int i = 1; i < caseLen; ++i)
{
diff --git a/samples/HelloPlugins/proj.win8.1-universal/.gitignore b/samples/HelloPlugins/proj.win8.1-universal/.gitignore
new file mode 100644
index 00000000..bb585df9
--- /dev/null
+++ b/samples/HelloPlugins/proj.win8.1-universal/.gitignore
@@ -0,0 +1,7 @@
+*.g.cpp
+*.g.h
+App.WindowsPhone/Generated Files
+App.Windows/Generated Files
+packages/
+AppPackages/
+*.user
\ No newline at end of file
diff --git a/samples/HelloPlugins/proj.win8.1-universal/App.Shared/App.xaml b/samples/HelloPlugins/proj.win8.1-universal/App.Shared/App.xaml
new file mode 100644
index 00000000..2da0ff79
--- /dev/null
+++ b/samples/HelloPlugins/proj.win8.1-universal/App.Shared/App.xaml
@@ -0,0 +1,13 @@
+
+
+
+
+ cpp_tests
+
+
+
diff --git a/samples/HelloPlugins/proj.win8.1-universal/App.Shared/App.xaml.cpp b/samples/HelloPlugins/proj.win8.1-universal/App.Shared/App.xaml.cpp
new file mode 100644
index 00000000..a4069f4b
--- /dev/null
+++ b/samples/HelloPlugins/proj.win8.1-universal/App.Shared/App.xaml.cpp
@@ -0,0 +1,128 @@
+#include "App.xaml.h"
+#include "OpenGLESPage.xaml.h"
+
+using namespace Platform;
+using namespace Windows::ApplicationModel;
+using namespace Windows::ApplicationModel::Activation;
+using namespace Windows::Foundation;
+using namespace Windows::Foundation::Collections;
+using namespace Windows::UI::Xaml::Media::Animation;
+using namespace Windows::UI::Xaml;
+using namespace Windows::UI::Xaml::Controls;
+using namespace Windows::UI::Xaml::Controls::Primitives;
+using namespace Windows::UI::Xaml::Data;
+using namespace Windows::UI::Xaml::Input;
+using namespace Windows::UI::Xaml::Interop;
+using namespace Windows::UI::Xaml::Media;
+using namespace Windows::UI::Xaml::Navigation;
+using namespace cocos2d;
+
+App::App()
+{
+ InitializeComponent();
+ Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending);
+}
+
+///
+/// Invoked when the application is launched normally by the end user. Other entry points
+/// will be used when the application is launched to open a specific file, to display
+/// search results, and so forth.
+///
+/// Details about the launch request and process.
+void App::OnLaunched(LaunchActivatedEventArgs^ e)
+{
+ auto rootFrame = dynamic_cast(Window::Current->Content);
+
+ // Do not repeat app initialization when the Window already has content,
+ // just ensure that the window is active.
+ if (rootFrame == nullptr)
+ {
+ // Create a Frame to act as the navigation context and associate it with
+ // a SuspensionManager key
+ rootFrame = ref new Frame();
+
+ // TODO: Change this value to a cache size that is appropriate for your application.
+ rootFrame->CacheSize = 1;
+
+ if (e->PreviousExecutionState == ApplicationExecutionState::Terminated)
+ {
+ // TODO: Restore the saved session state only when appropriate, scheduling the
+ // final launch steps after the restore is complete.
+ }
+
+ // Place the frame in the current Window
+ Window::Current->Content = rootFrame;
+ }
+
+ if (rootFrame->Content == nullptr)
+ {
+#if WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP
+ // Removes the turnstile navigation for startup.
+ if (rootFrame->ContentTransitions != nullptr)
+ {
+ _transitions = ref new TransitionCollection();
+ for (auto transition : rootFrame->ContentTransitions)
+ {
+ _transitions->Append(transition);
+ }
+ }
+
+ rootFrame->ContentTransitions = nullptr;
+ _firstNavigatedToken = rootFrame->Navigated += ref new NavigatedEventHandler(this, &App::RootFrame_FirstNavigated);
+#endif
+
+ // When the navigation stack isn't restored navigate to the first page,
+ // configuring the new page by passing required information as a navigation
+ // parameter.
+
+ rootFrame->Content = mPage = ref new OpenGLESPage(&mOpenGLES);
+
+#if 0
+ if (!rootFrame->Navigate(OpenGLESPage::typeid, e->Arguments))
+ {
+ throw ref new FailureException("Failed to create initial page");
+ }
+#endif
+ }
+
+ // Ensure the current window is active
+ Window::Current->Activate();
+}
+
+#if WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP
+///
+/// Restores the content transitions after the app has launched.
+///
+void App::RootFrame_FirstNavigated(Object^ sender, NavigationEventArgs^ e)
+{
+ auto rootFrame = safe_cast(sender);
+
+ TransitionCollection^ newTransitions;
+ if (_transitions == nullptr)
+ {
+ newTransitions = ref new TransitionCollection();
+ newTransitions->Append(ref new NavigationThemeTransition());
+ }
+ else
+ {
+ newTransitions = _transitions;
+ }
+
+ rootFrame->ContentTransitions = newTransitions;
+
+ rootFrame->Navigated -= _firstNavigatedToken;
+}
+#endif
+
+///
+/// Invoked when application execution is being suspended. Application state is saved
+/// without knowing whether the application will be terminated or resumed with the contents
+/// of memory still intact.
+///
+void App::OnSuspending(Object^ sender, SuspendingEventArgs^ e)
+{
+ (void) sender; // Unused parameter
+ (void) e; // Unused parameter
+
+ // TODO: Save application state and stop any background activity
+}
diff --git a/samples/HelloPlugins/proj.win8.1-universal/App.Shared/App.xaml.h b/samples/HelloPlugins/proj.win8.1-universal/App.Shared/App.xaml.h
new file mode 100644
index 00000000..e438eee2
--- /dev/null
+++ b/samples/HelloPlugins/proj.win8.1-universal/App.Shared/App.xaml.h
@@ -0,0 +1,29 @@
+#pragma once
+
+#include "app.g.h"
+#include "OpenGLES.h"
+#include "openglespage.xaml.h"
+
+namespace cocos2d
+{
+ ref class App sealed
+ {
+ public:
+ App();
+ virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) override;
+
+ private:
+
+#if WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP
+ Windows::UI::Xaml::Media::Animation::TransitionCollection^ _transitions;
+ Windows::Foundation::EventRegistrationToken _firstNavigatedToken;
+
+ void RootFrame_FirstNavigated(Platform::Object^ sender, Windows::UI::Xaml::Navigation::NavigationEventArgs^ e);
+#endif
+
+ void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ e);
+
+ OpenGLESPage^ mPage;
+ OpenGLES mOpenGLES;
+ };
+}
diff --git a/samples/HelloPlugins/proj.win8.1-universal/App.Shared/Cocos2dRenderer.cpp b/samples/HelloPlugins/proj.win8.1-universal/App.Shared/Cocos2dRenderer.cpp
new file mode 100644
index 00000000..85212dfd
--- /dev/null
+++ b/samples/HelloPlugins/proj.win8.1-universal/App.Shared/Cocos2dRenderer.cpp
@@ -0,0 +1,158 @@
+/*
+* cocos2d-x http://www.cocos2d-x.org
+*
+* Copyright (c) 2010-2014 - cocos2d-x community
+*
+* Portions Copyright (c) Microsoft Open Technologies, Inc.
+* All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and limitations under the License.
+*/
+
+#include "Cocos2dRenderer.h"
+#include "AppDelegate.h"
+#include "CCGLViewImpl-winrt.h"
+#include "CCApplication.h"
+#include "cocos2d.h"
+#include "renderer/CCTextureCache.h"
+
+// These are used by the shader compilation methods.
+#include
+#include
+#include
+
+using namespace Platform;
+using namespace Windows::UI::Core;
+using namespace Windows::UI::Xaml::Controls;
+using namespace Windows::Graphics::Display;
+
+USING_NS_CC;
+
+
+Cocos2dRenderer::Cocos2dRenderer(int width, int height, float dpi, DisplayOrientations orientation, CoreDispatcher^ dispatcher, Panel^ panel)
+ : m_app(nullptr)
+ , m_width(width)
+ , m_height(height)
+ , m_dpi(dpi)
+ , m_dispatcher(dispatcher)
+ , m_panel(panel)
+ , m_orientation(orientation)
+{
+ m_app = new AppDelegate();
+}
+
+Cocos2dRenderer::~Cocos2dRenderer()
+{
+ delete m_app;
+}
+
+void Cocos2dRenderer::Resume()
+{
+ auto director = cocos2d::Director::getInstance();
+ auto glview = director->getOpenGLView();
+
+ if (!glview)
+ {
+ GLViewImpl* glview = GLViewImpl::create("Test Cpp");
+ glview->setDispatcher(m_dispatcher.Get());
+ glview->setPanel(m_panel.Get());
+ glview->Create(static_cast(m_width), static_cast(m_height), m_dpi, m_orientation);
+ director->setOpenGLView(glview);
+ CCApplication::getInstance()->run();
+ }
+ else
+ {
+ Application::getInstance()->applicationWillEnterForeground();
+ cocos2d::EventCustom foregroundEvent(EVENT_COME_TO_FOREGROUND);
+ cocos2d::Director::getInstance()->getEventDispatcher()->dispatchEvent(&foregroundEvent);
+ }
+}
+
+void Cocos2dRenderer::Pause()
+{
+ if (Director::getInstance()->getOpenGLView()) {
+ Application::getInstance()->applicationDidEnterBackground();
+ cocos2d::EventCustom backgroundEvent(EVENT_COME_TO_BACKGROUND);
+ cocos2d::Director::getInstance()->getEventDispatcher()->dispatchEvent(&backgroundEvent);
+ }
+}
+
+bool Cocos2dRenderer::AppShouldExit()
+{
+ return GLViewImpl::sharedOpenGLView()->AppShouldExit();
+}
+
+void Cocos2dRenderer::DeviceLost()
+{
+ Pause();
+
+ auto director = cocos2d::Director::getInstance();
+ if (director->getOpenGLView()) {
+ cocos2d::GL::invalidateStateCache();
+ cocos2d::GLProgramCache::getInstance()->reloadDefaultGLPrograms();
+ cocos2d::DrawPrimitives::init();
+ cocos2d::VolatileTextureMgr::reloadAllTextures();
+
+ cocos2d::EventCustom recreatedEvent(EVENT_RENDERER_RECREATED);
+ director->getEventDispatcher()->dispatchEvent(&recreatedEvent);
+ director->setGLDefaultValues();
+
+ Application::getInstance()->applicationWillEnterForeground();
+ cocos2d::EventCustom foregroundEvent(EVENT_COME_TO_FOREGROUND);
+ cocos2d::Director::getInstance()->getEventDispatcher()->dispatchEvent(&foregroundEvent);
+ }
+}
+
+
+
+void Cocos2dRenderer::Draw(GLsizei width, GLsizei height, float dpi, DisplayOrientations orientation)
+{
+ auto glView = GLViewImpl::sharedOpenGLView();
+
+ if (orientation != m_orientation)
+ {
+ m_orientation = orientation;
+ glView->UpdateOrientation(orientation);
+ }
+
+ if (width != m_width || height != m_height)
+ {
+ m_width = width;
+ m_height = height;
+ glView->UpdateForWindowSizeChange(static_cast(width), static_cast(height));
+ }
+
+ if (dpi != m_dpi)
+ {
+ m_dpi = dpi;
+ glView->SetDPI(m_dpi);
+ }
+
+ glView->ProcessEvents();
+ glView->Render();
+}
+
+void Cocos2dRenderer::QueuePointerEvent(cocos2d::PointerEventType type, Windows::UI::Core::PointerEventArgs^ args)
+{
+ GLViewImpl::sharedOpenGLView()->QueuePointerEvent(type, args);
+}
+
+void Cocos2dRenderer::QueueBackButtonEvent()
+{
+ GLViewImpl::sharedOpenGLView()->QueueBackKeyPress();
+}
+
+void Cocos2dRenderer::QueueKeyboardEvent(WinRTKeyboardEventType type, Windows::UI::Core::KeyEventArgs^ args)
+{
+ GLViewImpl::sharedOpenGLView()->QueueWinRTKeyboardEvent(type, args);
+}
+
+
+
diff --git a/samples/HelloPlugins/proj.win8.1-universal/App.Shared/Cocos2dRenderer.h b/samples/HelloPlugins/proj.win8.1-universal/App.Shared/Cocos2dRenderer.h
new file mode 100644
index 00000000..b348c500
--- /dev/null
+++ b/samples/HelloPlugins/proj.win8.1-universal/App.Shared/Cocos2dRenderer.h
@@ -0,0 +1,57 @@
+/*
+* cocos2d-x http://www.cocos2d-x.org
+*
+* Copyright (c) 2010-2014 - cocos2d-x community
+*
+* Portions Copyright (c) Microsoft Open Technologies, Inc.
+* All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and limitations under the License.
+*/
+#pragma once
+
+#include
+
+#include "cocos2d.h"
+
+
+class AppDelegate;
+
+namespace cocos2d
+{
+ class Cocos2dRenderer
+ {
+ public:
+ Cocos2dRenderer(int width, int height, float dpi,
+ Windows::Graphics::Display::DisplayOrientations orientation,
+ Windows::UI::Core::CoreDispatcher^ dispathcer, Windows::UI::Xaml::Controls::Panel^ panel);
+ ~Cocos2dRenderer();
+ void Draw(GLsizei width, GLsizei height, float dpi, Windows::Graphics::Display::DisplayOrientations orientation);
+ void QueuePointerEvent(PointerEventType type, Windows::UI::Core::PointerEventArgs^ args);
+ void QueueKeyboardEvent(WinRTKeyboardEventType type, Windows::UI::Core::KeyEventArgs^ args);
+ void QueueBackButtonEvent();
+ void Pause();
+ void Resume();
+ void DeviceLost();
+ bool AppShouldExit();
+
+ private:
+
+ int m_width;
+ int m_height;
+ float m_dpi;
+
+ // The AppDelegate for the Cocos2D app
+ AppDelegate* m_app;
+ Platform::Agile m_dispatcher;
+ Platform::Agile m_panel;
+ Windows::Graphics::Display::DisplayOrientations m_orientation;
+ };
+}
\ No newline at end of file
diff --git a/samples/HelloPlugins/proj.win8.1-universal/App.Shared/HelloPlugins.Shared.vcxitems b/samples/HelloPlugins/proj.win8.1-universal/App.Shared/HelloPlugins.Shared.vcxitems
new file mode 100644
index 00000000..66eaa9d5
--- /dev/null
+++ b/samples/HelloPlugins/proj.win8.1-universal/App.Shared/HelloPlugins.Shared.vcxitems
@@ -0,0 +1,94 @@
+
+
+
+ $(MSBuildAllProjects);$(MSBuildThisFileFullPath)
+ true
+ e956c24b-f04e-47bf-bf00-746681ae1301
+ {a3ad93e4-0b2f-4c58-9181-69bed2e42e3e}
+ HelloPlugins
+
+
+
+ %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory)
+
+
+
+
+ Designer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(MSBuildThisFileDirectory)App.xaml
+
+
+
+
+ $(MSBuildThisFileDirectory)OpenGLESPage.xaml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(MSBuildThisFileDirectory)App.xaml
+
+
+ Create
+
+
+
+ $(MSBuildThisFileDirectory)OpenGLESPage.xaml
+
+
+
+
+
+
+
+ <_CustomResource Include="$(MSBuildThisFileDirectory)..\..\Resources\**\*">
+ Assets\Resources\%(RecursiveDir)%(FileName)%(Extension)
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/samples/HelloPlugins/proj.win8.1-universal/App.Shared/HelloPlugins.Shared.vcxitems.filters b/samples/HelloPlugins/proj.win8.1-universal/App.Shared/HelloPlugins.Shared.vcxitems.filters
new file mode 100644
index 00000000..6e0b7a54
--- /dev/null
+++ b/samples/HelloPlugins/proj.win8.1-universal/App.Shared/HelloPlugins.Shared.vcxitems.filters
@@ -0,0 +1,159 @@
+
+
+
+
+
+
+
+
+
+
+
+ Classes
+
+
+ Classes
+
+
+ Classes\TestAds
+
+
+ Classes\TestAnalytics
+
+
+ Classes\TestFacebookShare
+
+
+ Classes\TestFacebookUser
+
+
+ Classes\TestIAP
+
+
+ Classes\TestIAP
+
+
+ Classes\TestIAPOnline
+
+
+ Classes\TestIAPOnline
+
+
+ Classes\TestShare
+
+
+ Classes\TestShare
+
+
+ Classes\TestSocial
+
+
+ Classes\TestSocial
+
+
+ Classes\TestUser
+
+
+ Classes\TestUser
+
+
+
+
+
+
+
+ {38ad799c-8c3c-44a2-8e41-516c8f62f556}
+
+
+ {b5c6313f-eb03-4dd1-8dea-3b8e020c494b}
+
+
+ {3aca98d7-34aa-4342-8923-fff8496324b5}
+
+
+ {be75d517-9524-46f0-b617-3be41b1ed632}
+
+
+ {4563270d-e20d-4749-9490-0a1e9631ead5}
+
+
+ {29b9f4f0-a1fb-48b4-950d-3afcec68857c}
+
+
+ {3ae9d3cd-b0b0-49b6-a3c2-0be4f02d01ff}
+
+
+ {f5de7efa-d29f-47b0-81ed-b1fcefd6c139}
+
+
+ {659dae6b-70bd-4dc8-bec5-190464087a60}
+
+
+ {f81672de-b692-4d65-9c9d-d1c1cc1db026}
+
+
+
+
+
+
+ Classes
+
+
+ Classes
+
+
+ Classes
+
+
+ Classes
+
+
+ Classes\TestAds
+
+
+ Classes\TestAnalytics
+
+
+ Classes\TestFacebookShare
+
+
+ Classes\TestFacebookUser
+
+
+ Classes\TestIAP
+
+
+ Classes\TestIAP
+
+
+ Classes\TestIAPOnline
+
+
+ Classes\TestIAPOnline
+
+
+ Classes\TestShare
+
+
+ Classes\TestShare
+
+
+ Classes\TestSocial
+
+
+ Classes\TestSocial
+
+
+ Classes\TestUser
+
+
+ Classes\TestUser
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/samples/HelloPlugins/proj.win8.1-universal/App.Shared/OpenGLES.cpp b/samples/HelloPlugins/proj.win8.1-universal/App.Shared/OpenGLES.cpp
new file mode 100644
index 00000000..3afdab08
--- /dev/null
+++ b/samples/HelloPlugins/proj.win8.1-universal/App.Shared/OpenGLES.cpp
@@ -0,0 +1,246 @@
+/*
+* cocos2d-x http://www.cocos2d-x.org
+*
+* Copyright (c) 2010-2014 - cocos2d-x community
+*
+* Portions Copyright (c) Microsoft Open Technologies, Inc.
+* All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and limitations under the License.
+*/
+
+#include "OpenGLES.h"
+using namespace Platform;
+using namespace Windows::UI::Xaml::Controls;
+using namespace Windows::Foundation;
+using namespace Windows::Foundation::Collections;
+
+OpenGLES::OpenGLES() :
+ mEglConfig(nullptr),
+ mEglDisplay(EGL_NO_DISPLAY),
+ mEglContext(EGL_NO_CONTEXT)
+{
+ Initialize();
+}
+
+OpenGLES::~OpenGLES()
+{
+ Cleanup();
+}
+
+void OpenGLES::Initialize()
+{
+ const EGLint configAttributes[] =
+ {
+ EGL_RED_SIZE, 8,
+ EGL_GREEN_SIZE, 8,
+ EGL_BLUE_SIZE, 8,
+ EGL_ALPHA_SIZE, 8,
+ EGL_DEPTH_SIZE, 8,
+ EGL_STENCIL_SIZE, 8,
+ EGL_NONE
+ };
+
+ const EGLint contextAttributes[] =
+ {
+ EGL_CONTEXT_CLIENT_VERSION, 2,
+ EGL_NONE
+ };
+
+ const EGLint defaultDisplayAttributes[] =
+ {
+ // These are the default display attributes, used to request ANGLE's D3D11 renderer.
+ // eglInitialize will only succeed with these attributes if the hardware supports D3D11 Feature Level 10_0+.
+ EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
+
+ // EGL_ANGLE_DISPLAY_ALLOW_RENDER_TO_BACK_BUFFER is an optimization that can have large performance benefits on mobile devices.
+ // Its syntax is subject to change, though. Please update your Visual Studio templates if you experience compilation issues with it.
+ EGL_ANGLE_DISPLAY_ALLOW_RENDER_TO_BACK_BUFFER, EGL_TRUE,
+
+ // EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE is an option that enables ANGLE to automatically call
+ // the IDXGIDevice3::Trim method on behalf of the application when it gets suspended.
+ // Calling IDXGIDevice3::Trim when an application is suspended is a Windows Store application certification requirement.
+ EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE, EGL_TRUE,
+ EGL_NONE,
+ };
+
+ const EGLint fl9_3DisplayAttributes[] =
+ {
+ // These can be used to request ANGLE's D3D11 renderer, with D3D11 Feature Level 9_3.
+ // These attributes are used if the call to eglInitialize fails with the default display attributes.
+ EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
+ EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE, 9,
+ EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE, 3,
+ EGL_ANGLE_DISPLAY_ALLOW_RENDER_TO_BACK_BUFFER, EGL_TRUE,
+ EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE, EGL_TRUE,
+ EGL_NONE,
+ };
+
+ const EGLint warpDisplayAttributes[] =
+ {
+ // These attributes can be used to request D3D11 WARP.
+ // They are used if eglInitialize fails with both the default display attributes and the 9_3 display attributes.
+ EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
+ EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE,
+ EGL_ANGLE_DISPLAY_ALLOW_RENDER_TO_BACK_BUFFER, EGL_TRUE,
+ EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE, EGL_TRUE,
+ EGL_NONE,
+ };
+
+ EGLConfig config = NULL;
+
+ // eglGetPlatformDisplayEXT is an alternative to eglGetDisplay. It allows us to pass in display attributes, used to configure D3D11.
+ PFNEGLGETPLATFORMDISPLAYEXTPROC eglGetPlatformDisplayEXT = reinterpret_cast(eglGetProcAddress("eglGetPlatformDisplayEXT"));
+ if (!eglGetPlatformDisplayEXT)
+ {
+ throw Exception::CreateException(E_FAIL, L"Failed to get function eglGetPlatformDisplayEXT");
+ }
+
+ //
+ // To initialize the display, we make three sets of calls to eglGetPlatformDisplayEXT and eglInitialize, with varying
+ // parameters passed to eglGetPlatformDisplayEXT:
+ // 1) The first calls uses "defaultDisplayAttributes" as a parameter. This corresponds to D3D11 Feature Level 10_0+.
+ // 2) If eglInitialize fails for step 1 (e.g. because 10_0+ isn't supported by the default GPU), then we try again
+ // using "fl9_3DisplayAttributes". This corresponds to D3D11 Feature Level 9_3.
+ // 3) If eglInitialize fails for step 2 (e.g. because 9_3+ isn't supported by the default GPU), then we try again
+ // using "warpDisplayAttributes". This corresponds to D3D11 Feature Level 11_0 on WARP, a D3D11 software rasterizer.
+ //
+ // Note: On Windows Phone, we #ifdef out the first set of calls to eglPlatformDisplayEXT and eglInitialize.
+ // Windows Phones devices only support D3D11 Feature Level 9_3, but the Windows Phone emulator supports 11_0+.
+ // We use this #ifdef to limit the Phone emulator to Feature Level 9_3, making it behave more like
+ // real Windows Phone devices.
+ // If you wish to test Feature Level 10_0+ in the Windows Phone emulator then you should remove this #ifdef.
+ //
+
+#if (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP)
+ // This tries to initialize EGL to D3D11 Feature Level 10_0+. See above comment for details.
+ mEglDisplay = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, defaultDisplayAttributes);
+ if (mEglDisplay == EGL_NO_DISPLAY)
+ {
+ throw Exception::CreateException(E_FAIL, L"Failed to get EGL display");
+ }
+
+ if (eglInitialize(mEglDisplay, NULL, NULL) == EGL_FALSE)
+#endif
+ {
+ // This tries to initialize EGL to D3D11 Feature Level 9_3, if 10_0+ is unavailable (e.g. on Windows Phone, or certain Windows tablets).
+ mEglDisplay = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, fl9_3DisplayAttributes);
+ if (mEglDisplay == EGL_NO_DISPLAY)
+ {
+ throw Exception::CreateException(E_FAIL, L"Failed to get EGL display");
+ }
+
+ if (eglInitialize(mEglDisplay, NULL, NULL) == EGL_FALSE)
+ {
+ // This initializes EGL to D3D11 Feature Level 11_0 on WARP, if 9_3+ is unavailable on the default GPU (e.g. on Surface RT).
+ mEglDisplay = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, warpDisplayAttributes);
+ if (mEglDisplay == EGL_NO_DISPLAY)
+ {
+ throw Exception::CreateException(E_FAIL, L"Failed to get EGL display");
+ }
+
+ if (eglInitialize(mEglDisplay, NULL, NULL) == EGL_FALSE)
+ {
+ // If all of the calls to eglInitialize returned EGL_FALSE then an error has occurred.
+ throw Exception::CreateException(E_FAIL, L"Failed to initialize EGL");
+ }
+ }
+ }
+
+ EGLint numConfigs = 0;
+ if ((eglChooseConfig(mEglDisplay, configAttributes, &mEglConfig, 1, &numConfigs) == EGL_FALSE) || (numConfigs == 0))
+ {
+ throw Exception::CreateException(E_FAIL, L"Failed to choose first EGLConfig");
+ }
+
+ mEglContext = eglCreateContext(mEglDisplay, mEglConfig, EGL_NO_CONTEXT, contextAttributes);
+ if (mEglContext == EGL_NO_CONTEXT)
+ {
+ throw Exception::CreateException(E_FAIL, L"Failed to create EGL context");
+ }
+}
+
+void OpenGLES::Cleanup()
+{
+ if (mEglDisplay != EGL_NO_DISPLAY && mEglContext != EGL_NO_CONTEXT)
+ {
+ eglDestroyContext(mEglDisplay, mEglContext);
+ mEglContext = EGL_NO_CONTEXT;
+ }
+
+ if (mEglDisplay != EGL_NO_DISPLAY)
+ {
+ eglTerminate(mEglDisplay);
+ mEglDisplay = EGL_NO_DISPLAY;
+ }
+}
+
+void OpenGLES::Reset()
+{
+ Cleanup();
+ Initialize();
+}
+
+EGLSurface OpenGLES::CreateSurface(SwapChainPanel^ panel, const Size* renderSurfaceSize)
+{
+ if (!panel)
+ {
+ throw Exception::CreateException(E_INVALIDARG, L"SwapChainPanel parameter is invalid");
+ }
+
+ EGLSurface surface = EGL_NO_SURFACE;
+
+ const EGLint surfaceAttributes[] =
+ {
+ // EGL_ANGLE_SURFACE_RENDER_TO_BACK_BUFFER is part of the same optimization as EGL_ANGLE_DISPLAY_ALLOW_RENDER_TO_BACK_BUFFER (see above).
+ // If you have compilation issues with it then please update your Visual Studio templates.
+ EGL_ANGLE_SURFACE_RENDER_TO_BACK_BUFFER, EGL_TRUE,
+ EGL_NONE
+ };
+
+ // Create a PropertySet and initialize with the EGLNativeWindowType.
+ PropertySet^ surfaceCreationProperties = ref new PropertySet();
+ surfaceCreationProperties->Insert(ref new String(EGLNativeWindowTypeProperty), panel);
+
+ // If a render surface size is specified, add it to the surface creation properties
+ if (renderSurfaceSize != nullptr)
+ {
+ surfaceCreationProperties->Insert(ref new String(EGLRenderSurfaceSizeProperty), PropertyValue::CreateSize(*renderSurfaceSize));
+ }
+
+ surface = eglCreateWindowSurface(mEglDisplay, mEglConfig, reinterpret_cast(surfaceCreationProperties), surfaceAttributes);
+ if (surface == EGL_NO_SURFACE)
+ {
+ throw Exception::CreateException(E_FAIL, L"Failed to create EGL surface");
+ }
+
+ return surface;
+}
+
+void OpenGLES::DestroySurface(const EGLSurface surface)
+{
+ if (mEglDisplay != EGL_NO_DISPLAY && surface != EGL_NO_SURFACE)
+ {
+ eglDestroySurface(mEglDisplay, surface);
+ }
+}
+
+void OpenGLES::MakeCurrent(const EGLSurface surface)
+{
+ if (eglMakeCurrent(mEglDisplay, surface, surface, mEglContext) == EGL_FALSE)
+ {
+ throw Exception::CreateException(E_FAIL, L"Failed to make EGLSurface current");
+ }
+}
+
+EGLBoolean OpenGLES::SwapBuffers(const EGLSurface surface)
+{
+ return (eglSwapBuffers(mEglDisplay, surface));
+}
diff --git a/samples/HelloPlugins/proj.win8.1-universal/App.Shared/OpenGLES.h b/samples/HelloPlugins/proj.win8.1-universal/App.Shared/OpenGLES.h
new file mode 100644
index 00000000..e2e7d7e8
--- /dev/null
+++ b/samples/HelloPlugins/proj.win8.1-universal/App.Shared/OpenGLES.h
@@ -0,0 +1,51 @@
+/*
+* cocos2d-x http://www.cocos2d-x.org
+*
+* Copyright (c) 2010-2014 - cocos2d-x community
+*
+* Portions Copyright (c) Microsoft Open Technologies, Inc.
+* All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and limitations under the License.
+*/
+
+#pragma once
+
+// OpenGL ES includes
+#include
+#include
+
+// EGL includes
+#include
+#include
+#include
+#include
+
+class OpenGLES
+{
+public:
+ OpenGLES();
+ ~OpenGLES();
+
+ EGLSurface CreateSurface(Windows::UI::Xaml::Controls::SwapChainPanel^ panel, const Windows::Foundation::Size* renderSurfaceSize);
+ void DestroySurface(const EGLSurface surface);
+ void MakeCurrent(const EGLSurface surface);
+ EGLBoolean SwapBuffers(const EGLSurface surface);
+ void Reset();
+ void Cleanup();
+
+private:
+ void Initialize();
+
+private:
+ EGLDisplay mEglDisplay;
+ EGLContext mEglContext;
+ EGLConfig mEglConfig;
+};
diff --git a/samples/HelloPlugins/proj.win8.1-universal/App.Shared/OpenGLESPage.xaml b/samples/HelloPlugins/proj.win8.1-universal/App.Shared/OpenGLESPage.xaml
new file mode 100644
index 00000000..e5b62802
--- /dev/null
+++ b/samples/HelloPlugins/proj.win8.1-universal/App.Shared/OpenGLESPage.xaml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
diff --git a/samples/HelloPlugins/proj.win8.1-universal/App.Shared/OpenGLESPage.xaml.cpp b/samples/HelloPlugins/proj.win8.1-universal/App.Shared/OpenGLESPage.xaml.cpp
new file mode 100644
index 00000000..fc4a36bc
--- /dev/null
+++ b/samples/HelloPlugins/proj.win8.1-universal/App.Shared/OpenGLESPage.xaml.cpp
@@ -0,0 +1,418 @@
+/*
+* cocos2d-x http://www.cocos2d-x.org
+*
+* Copyright (c) 2010-2014 - cocos2d-x community
+*
+* Portions Copyright (c) Microsoft Open Technologies, Inc.
+* All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and limitations under the License.
+*/
+
+#include "App.xaml.h"
+#include "OpenGLESPage.xaml.h"
+
+using namespace cocos2d;
+using namespace Platform;
+using namespace Concurrency;
+using namespace Windows::Foundation;
+using namespace Windows::Foundation::Collections;
+using namespace Windows::Graphics::Display;
+using namespace Windows::System::Threading;
+using namespace Windows::UI::Core;
+using namespace Windows::UI::Input;
+using namespace Windows::UI::Xaml;
+using namespace Windows::UI::Xaml::Controls;
+using namespace Windows::UI::Xaml::Controls::Primitives;
+using namespace Windows::UI::Xaml::Data;
+using namespace Windows::UI::Xaml::Input;
+using namespace Windows::UI::Xaml::Media;
+using namespace Windows::UI::Xaml::Navigation;
+
+#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) || _MSC_VER >= 1900
+using namespace Windows::Phone::UI::Input;
+#endif
+
+OpenGLESPage::OpenGLESPage() :
+ OpenGLESPage(nullptr)
+{
+
+}
+
+OpenGLESPage::OpenGLESPage(OpenGLES* openGLES) :
+ mOpenGLES(openGLES),
+ mRenderSurface(EGL_NO_SURFACE),
+ mCustomRenderSurfaceSize(0,0),
+ mUseCustomRenderSurfaceSize(false),
+ m_coreInput(nullptr),
+ m_dpi(0.0f),
+ m_deviceLost(false),
+ m_orientation(DisplayOrientations::Landscape)
+{
+ InitializeComponent();
+
+ Windows::UI::Core::CoreWindow^ window = Windows::UI::Xaml::Window::Current->CoreWindow;
+
+ window->VisibilityChanged +=
+ ref new Windows::Foundation::TypedEventHandler(this, &OpenGLESPage::OnVisibilityChanged);
+
+ window->KeyDown += ref new TypedEventHandler(this, &OpenGLESPage::OnKeyPressed);
+
+ window->KeyUp += ref new TypedEventHandler(this, &OpenGLESPage::OnKeyReleased);
+
+ window->CharacterReceived += ref new TypedEventHandler(this, &OpenGLESPage::OnCharacterReceived);
+
+ swapChainPanel->SizeChanged +=
+ ref new Windows::UI::Xaml::SizeChangedEventHandler(this, &OpenGLESPage::OnSwapChainPanelSizeChanged);
+
+ DisplayInformation^ currentDisplayInformation = DisplayInformation::GetForCurrentView();
+
+ currentDisplayInformation->OrientationChanged +=
+ ref new TypedEventHandler(this, &OpenGLESPage::OnOrientationChanged);
+
+ m_orientation = currentDisplayInformation->CurrentOrientation;
+
+ this->Loaded +=
+ ref new Windows::UI::Xaml::RoutedEventHandler(this, &OpenGLESPage::OnPageLoaded);
+
+ mSwapChainPanelSize = { swapChainPanel->RenderSize.Width, swapChainPanel->RenderSize.Height };
+
+#if _MSC_VER >= 1900
+ if (Windows::Foundation::Metadata::ApiInformation::IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
+ {
+ Windows::UI::ViewManagement::StatusBar::GetForCurrentView()->HideAsync();
+ }
+
+ if (Windows::Foundation::Metadata::ApiInformation::IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
+ {
+ HardwareButtons::BackPressed += ref new EventHandler(this, &OpenGLESPage::OnBackButtonPressed);
+ }
+#else
+#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
+ Windows::UI::ViewManagement::StatusBar::GetForCurrentView()->HideAsync();
+ HardwareButtons::BackPressed += ref new EventHandler(this, &OpenGLESPage::OnBackButtonPressed);
+#else
+ // Disable all pointer visual feedback for better performance when touching.
+ // This is not supported on Windows Phone applications.
+ auto pointerVisualizationSettings = Windows::UI::Input::PointerVisualizationSettings::GetForCurrentView();
+ pointerVisualizationSettings->IsContactFeedbackEnabled = false;
+ pointerVisualizationSettings->IsBarrelButtonFeedbackEnabled = false;
+#endif
+#endif
+
+ // Register our SwapChainPanel to get independent input pointer events
+ auto workItemHandler = ref new WorkItemHandler([this](IAsyncAction ^)
+ {
+ // The CoreIndependentInputSource will raise pointer events for the specified device types on whichever thread it's created on.
+ m_coreInput = swapChainPanel->CreateCoreIndependentInputSource(
+ Windows::UI::Core::CoreInputDeviceTypes::Mouse |
+ Windows::UI::Core::CoreInputDeviceTypes::Touch |
+ Windows::UI::Core::CoreInputDeviceTypes::Pen
+ );
+
+ // Register for pointer events, which will be raised on the background thread.
+ m_coreInput->PointerPressed += ref new TypedEventHandler