diff --git a/.gitignore b/.gitignore index 270f81832d..fff313d6a3 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,7 @@ ipch/ *.opensdf SubmissionInfo Generated Files +AppPackages # Ignore files build by ndk and eclipse libs/ diff --git a/AUTHORS b/AUTHORS index 80b1017f66..e59e2a6ce3 100644 --- a/AUTHORS +++ b/AUTHORS @@ -938,6 +938,7 @@ Developers: Fixed compiling error on WP8. Added method for custom precompiled shader program loading on WP8 Enable screen orientation change handling on WP8 + Enabled GLProgramState restoring on render recreated on WP8 chareice Make `setup.py` work on zsh @@ -1032,6 +1033,21 @@ Developers: coldfog Fix bug that ActionManagerEx::initWithBinary can only load one UI animation + + timur-losev + Fix a bug that GLProgramCache::addGLProgram() can not replace existing program + + TimothyZhang + Fixed a potential memory leak in GLProgram::setGLProgram() + + ahlwong + Fix Label Kerning on Single Characters + + Svenito + Add greater than operator to Vec2 + + liamcindy + update ui button size changed logic Retired Core Developers: WenSheng Yang @@ -1044,9 +1060,6 @@ Retired Core Developers: RongHong Huang (flyingpaper) Author of cocos2d-xna and spent all his time on wp7. - - timur-losev - Fix a bug that GLProgramCache::addGLProgram() can not replace existing program Cocos2d-x can not grow so fast without the active community. Thanks to all developers who report & trace bugs, discuss the engine usage in forum & QQ groups! diff --git a/CHANGELOG b/CHANGELOG index 5f05b96968..db133ad049 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,15 @@ +cocos2d-x-3.3 ?? + [NEW] Vec2: added greater than operator + + [FIX] Cocos console: compile failure on windows if using VS express version + [FIX] GrawNode: drawPoint() may cause crash + [FIX] GLProgramCache: doesn't release old program with the same key before adding a new one + [FIX] GLProgramState: enabled GLProgramState restoring on render recreated on WP8 + [FIX] Label: label shifting when outline feature enabled + [FIX] Label: when applying additionalKerning to a Label that displays a string with only 1 character, the character is shifted + [FIX] Sprite3D: did not create attached sprite from cache + [FIX] WP/WinRT: Windows 8.1 universal app support; `UIEditBox` support + cocos2d-x-3.3-rc0 Oct.21 2014 [NEW] 3d: added light support: direction light, point light, spot light and ambient light [NEW] Added ClippingRectangleNode diff --git a/build/cocos2d-win8.1-universal.sln b/build/cocos2d-win8.1-universal.sln new file mode 100644 index 0000000000..49f4f7a93a --- /dev/null +++ b/build/cocos2d-win8.1-universal.sln @@ -0,0 +1,228 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.30723.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libcocos2d", "libcocos2d", "{B3F299D4-B4CA-4F0B-8BE2-FB328483BC13}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d_8_1.Shared", "..\cocos\2d\libcocos2d_8_1\libcocos2d_8_1\libcocos2d_8_1.Shared\libcocos2d_8_1.Shared.vcxitems", "{5D6F020F-7E72-4494-90A0-2DF11D235DF9}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d_8_1.Windows", "..\cocos\2d\libcocos2d_8_1\libcocos2d_8_1\libcocos2d_8_1.Windows\libcocos2d_8_1.Windows.vcxproj", "{9335005F-678E-4E8E-9B84-50037216AEC8}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d_8_1.WindowsPhone", "..\cocos\2d\libcocos2d_8_1\libcocos2d_8_1\libcocos2d_8_1.WindowsPhone\libcocos2d_8_1.WindowsPhone.vcxproj", "{22F3B9DF-1209-4574-8331-003966F562BF}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "cpp-tests", "cpp-tests", "{572742C5-9322-4548-AB8B-96C3750A1B5D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpp-tests.Shared", "..\tests\cpp-tests\proj.win8.1-universal\cpp-tests.Shared\cpp-tests.Shared.vcxitems", "{BE3A1791-5BCE-4CEA-92CD-0E2D86DDE27A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpp-tests.Windows", "..\tests\cpp-tests\proj.win8.1-universal\cpp-tests.Windows\cpp-tests.Windows.vcxproj", "{F2BAE06B-CAAE-43EE-B21B-57FA48DB04FA}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpp-tests.WindowsPhone", "..\tests\cpp-tests\proj.win8.1-universal\cpp-tests.WindowsPhone\cpp-tests.WindowsPhone.vcxproj", "{15247C71-5289-4913-B88F-E253CC353720}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "External", "External", "{85630454-74EA-4B5B-9B62-0E459B4476CB}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libbox2d", "libbox2d", "{B3D1A3D5-9F54-43AF-9322-230B53242B78}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbox2d.Shared", "..\external\Box2D\proj.win8.1-universal\libbox2d.Shared\libbox2d.Shared.vcxitems", "{4A3C6BA8-C227-498B-AA21-40BDA27B461F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbox2d.Windows", "..\external\Box2D\proj.win8.1-universal\libbox2d.Windows\libbox2d.Windows.vcxproj", "{3B26A12D-3A44-47EA-82D2-282660FC844D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbox2d.WindowsPhone", "..\external\Box2D\proj.win8.1-universal\libbox2d.WindowsPhone\libbox2d.WindowsPhone.vcxproj", "{22F798D8-BFFF-4754-996F-A5395343D5EC}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libSpine", "libSpine", "{6FEB795C-C98C-4C8C-A88B-A35DEE205348}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libSpine.Shared", "..\cocos\editor-support\spine\proj.win8.1-universal\libSpine.Shared\libSpine.Shared.vcxitems", "{ADAFD00D-A0D6-46EF-9F0B-EA2880BFE1DE}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libSpine.Windows", "..\cocos\editor-support\spine\proj.win8.1-universal\libSpine.Windows\libSpine.Windows.vcxproj", "{F3550FE0-C795-44F6-8FEB-093EB68143AE}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libSpine.WindowsPhone", "..\cocos\editor-support\spine\proj.win8.1-universal\libSpine.WindowsPhone\libSpine.WindowsPhone.vcxproj", "{CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "cpp-empty-test", "cpp-empty-test", "{B70EF25E-E352-4020-BCDF-388973E44637}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloCpp.Shared", "..\tests\cpp-empty-test\proj.win8.1-universal\HelloCpp.Shared\HelloCpp.Shared.vcxitems", "{A3AD93E4-0B2F-4C58-9181-69BED2E42E3E}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloCpp.Windows", "..\tests\cpp-empty-test\proj.win8.1-universal\HelloCpp.Windows\HelloCpp.Windows.vcxproj", "{79A8FCDA-4B12-4DD1-B676-FF148D651638}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloCpp.WindowsPhone", "..\tests\cpp-empty-test\proj.win8.1-universal\HelloCpp.WindowsPhone\HelloCpp.WindowsPhone.vcxproj", "{396FE85E-BB05-4B92-BCCB-F89AED4EA41A}" +EndProject +Global + GlobalSection(SharedMSBuildProjectFiles) = preSolution + ..\cocos\2d\libcocos2d_8_1\libcocos2d_8_1\libcocos2d_8_1.Shared\libcocos2d_8_1.Shared.vcxitems*{9335005f-678e-4e8e-9b84-50037216aec8}*SharedItemsImports = 4 + ..\tests\cpp-tests\proj.win8.1-universal\cpp-tests.Shared\cpp-tests.Shared.vcxitems*{15247c71-5289-4913-b88f-e253cc353720}*SharedItemsImports = 4 + ..\tests\cpp-empty-test\proj.win8.1-universal\HelloCpp.Shared\HelloCpp.Shared.vcxitems*{a3ad93e4-0b2f-4c58-9181-69bed2e42e3e}*SharedItemsImports = 9 + ..\cocos\editor-support\spine\proj.win8.1-universal\libSpine.Shared\libSpine.Shared.vcxitems*{cc1da216-a80d-4be4-b309-acb6af313aff}*SharedItemsImports = 4 + ..\external\Box2D\proj.win8.1-universal\libbox2d.Shared\libbox2d.Shared.vcxitems*{4a3c6ba8-c227-498b-aa21-40bda27b461f}*SharedItemsImports = 9 + ..\tests\cpp-empty-test\proj.win8.1-universal\HelloCpp.Shared\HelloCpp.Shared.vcxitems*{79a8fcda-4b12-4dd1-b676-ff148d651638}*SharedItemsImports = 4 + ..\cocos\editor-support\spine\proj.win8.1-universal\libSpine.Shared\libSpine.Shared.vcxitems*{adafd00d-a0d6-46ef-9f0b-ea2880bfe1de}*SharedItemsImports = 9 + ..\tests\cpp-tests\proj.win8.1-universal\cpp-tests.Shared\cpp-tests.Shared.vcxitems*{be3a1791-5bce-4cea-92cd-0e2d86dde27a}*SharedItemsImports = 9 + ..\cocos\2d\libcocos2d_8_1\libcocos2d_8_1\libcocos2d_8_1.Shared\libcocos2d_8_1.Shared.vcxitems*{5d6f020f-7e72-4494-90a0-2df11d235df9}*SharedItemsImports = 9 + ..\external\Box2D\proj.win8.1-universal\libbox2d.Shared\libbox2d.Shared.vcxitems*{3b26a12d-3a44-47ea-82d2-282660fc844d}*SharedItemsImports = 4 + ..\cocos\2d\libcocos2d_8_1\libcocos2d_8_1\libcocos2d_8_1.Shared\libcocos2d_8_1.Shared.vcxitems*{22f3b9df-1209-4574-8331-003966f562bf}*SharedItemsImports = 4 + ..\external\Box2D\proj.win8.1-universal\libbox2d.Shared\libbox2d.Shared.vcxitems*{22f798d8-bfff-4754-996f-a5395343d5ec}*SharedItemsImports = 4 + ..\cocos\editor-support\spine\proj.win8.1-universal\libSpine.Shared\libSpine.Shared.vcxitems*{f3550fe0-c795-44f6-8feb-093eb68143ae}*SharedItemsImports = 4 + ..\tests\cpp-tests\proj.win8.1-universal\cpp-tests.Shared\cpp-tests.Shared.vcxitems*{f2bae06b-caae-43ee-b21b-57fa48db04fa}*SharedItemsImports = 4 + ..\tests\cpp-empty-test\proj.win8.1-universal\HelloCpp.Shared\HelloCpp.Shared.vcxitems*{396fe85e-bb05-4b92-bccb-f89aed4ea41a}*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 + {9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|ARM.ActiveCfg = Debug|ARM + {9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|ARM.Build.0 = Debug|ARM + {9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|Win32.ActiveCfg = Debug|Win32 + {9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|Win32.Build.0 = Debug|Win32 + {9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|x64.ActiveCfg = Debug|x64 + {9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|x64.Build.0 = Debug|x64 + {9335005F-678E-4E8E-9B84-50037216AEC8}.Release|ARM.ActiveCfg = Release|ARM + {9335005F-678E-4E8E-9B84-50037216AEC8}.Release|ARM.Build.0 = Release|ARM + {9335005F-678E-4E8E-9B84-50037216AEC8}.Release|Win32.ActiveCfg = Release|Win32 + {9335005F-678E-4E8E-9B84-50037216AEC8}.Release|Win32.Build.0 = Release|Win32 + {9335005F-678E-4E8E-9B84-50037216AEC8}.Release|x64.ActiveCfg = Release|x64 + {9335005F-678E-4E8E-9B84-50037216AEC8}.Release|x64.Build.0 = Release|x64 + {22F3B9DF-1209-4574-8331-003966F562BF}.Debug|ARM.ActiveCfg = Debug|ARM + {22F3B9DF-1209-4574-8331-003966F562BF}.Debug|ARM.Build.0 = Debug|ARM + {22F3B9DF-1209-4574-8331-003966F562BF}.Debug|Win32.ActiveCfg = Debug|Win32 + {22F3B9DF-1209-4574-8331-003966F562BF}.Debug|Win32.Build.0 = Debug|Win32 + {22F3B9DF-1209-4574-8331-003966F562BF}.Debug|x64.ActiveCfg = Debug|Win32 + {22F3B9DF-1209-4574-8331-003966F562BF}.Release|ARM.ActiveCfg = Release|ARM + {22F3B9DF-1209-4574-8331-003966F562BF}.Release|ARM.Build.0 = Release|ARM + {22F3B9DF-1209-4574-8331-003966F562BF}.Release|Win32.ActiveCfg = Release|Win32 + {22F3B9DF-1209-4574-8331-003966F562BF}.Release|Win32.Build.0 = Release|Win32 + {22F3B9DF-1209-4574-8331-003966F562BF}.Release|x64.ActiveCfg = Release|Win32 + {F2BAE06B-CAAE-43EE-B21B-57FA48DB04FA}.Debug|ARM.ActiveCfg = Debug|ARM + {F2BAE06B-CAAE-43EE-B21B-57FA48DB04FA}.Debug|ARM.Build.0 = Debug|ARM + {F2BAE06B-CAAE-43EE-B21B-57FA48DB04FA}.Debug|ARM.Deploy.0 = Debug|ARM + {F2BAE06B-CAAE-43EE-B21B-57FA48DB04FA}.Debug|Win32.ActiveCfg = Debug|Win32 + {F2BAE06B-CAAE-43EE-B21B-57FA48DB04FA}.Debug|Win32.Build.0 = Debug|Win32 + {F2BAE06B-CAAE-43EE-B21B-57FA48DB04FA}.Debug|Win32.Deploy.0 = Debug|Win32 + {F2BAE06B-CAAE-43EE-B21B-57FA48DB04FA}.Debug|x64.ActiveCfg = Debug|x64 + {F2BAE06B-CAAE-43EE-B21B-57FA48DB04FA}.Debug|x64.Build.0 = Debug|x64 + {F2BAE06B-CAAE-43EE-B21B-57FA48DB04FA}.Debug|x64.Deploy.0 = Debug|x64 + {F2BAE06B-CAAE-43EE-B21B-57FA48DB04FA}.Release|ARM.ActiveCfg = Release|ARM + {F2BAE06B-CAAE-43EE-B21B-57FA48DB04FA}.Release|ARM.Build.0 = Release|ARM + {F2BAE06B-CAAE-43EE-B21B-57FA48DB04FA}.Release|ARM.Deploy.0 = Release|ARM + {F2BAE06B-CAAE-43EE-B21B-57FA48DB04FA}.Release|Win32.ActiveCfg = Release|Win32 + {F2BAE06B-CAAE-43EE-B21B-57FA48DB04FA}.Release|Win32.Build.0 = Release|Win32 + {F2BAE06B-CAAE-43EE-B21B-57FA48DB04FA}.Release|Win32.Deploy.0 = Release|Win32 + {F2BAE06B-CAAE-43EE-B21B-57FA48DB04FA}.Release|x64.ActiveCfg = Release|x64 + {F2BAE06B-CAAE-43EE-B21B-57FA48DB04FA}.Release|x64.Build.0 = Release|x64 + {F2BAE06B-CAAE-43EE-B21B-57FA48DB04FA}.Release|x64.Deploy.0 = Release|x64 + {15247C71-5289-4913-B88F-E253CC353720}.Debug|ARM.ActiveCfg = Debug|ARM + {15247C71-5289-4913-B88F-E253CC353720}.Debug|ARM.Build.0 = Debug|ARM + {15247C71-5289-4913-B88F-E253CC353720}.Debug|ARM.Deploy.0 = Debug|ARM + {15247C71-5289-4913-B88F-E253CC353720}.Debug|Win32.ActiveCfg = Debug|Win32 + {15247C71-5289-4913-B88F-E253CC353720}.Debug|Win32.Build.0 = Debug|Win32 + {15247C71-5289-4913-B88F-E253CC353720}.Debug|Win32.Deploy.0 = Debug|Win32 + {15247C71-5289-4913-B88F-E253CC353720}.Debug|x64.ActiveCfg = Debug|Win32 + {15247C71-5289-4913-B88F-E253CC353720}.Release|ARM.ActiveCfg = Release|ARM + {15247C71-5289-4913-B88F-E253CC353720}.Release|ARM.Build.0 = Release|ARM + {15247C71-5289-4913-B88F-E253CC353720}.Release|ARM.Deploy.0 = Release|ARM + {15247C71-5289-4913-B88F-E253CC353720}.Release|Win32.ActiveCfg = Release|Win32 + {15247C71-5289-4913-B88F-E253CC353720}.Release|Win32.Build.0 = Release|Win32 + {15247C71-5289-4913-B88F-E253CC353720}.Release|Win32.Deploy.0 = Release|Win32 + {15247C71-5289-4913-B88F-E253CC353720}.Release|x64.ActiveCfg = Release|Win32 + {3B26A12D-3A44-47EA-82D2-282660FC844D}.Debug|ARM.ActiveCfg = Debug|ARM + {3B26A12D-3A44-47EA-82D2-282660FC844D}.Debug|ARM.Build.0 = Debug|ARM + {3B26A12D-3A44-47EA-82D2-282660FC844D}.Debug|Win32.ActiveCfg = Debug|Win32 + {3B26A12D-3A44-47EA-82D2-282660FC844D}.Debug|Win32.Build.0 = Debug|Win32 + {3B26A12D-3A44-47EA-82D2-282660FC844D}.Debug|x64.ActiveCfg = Debug|x64 + {3B26A12D-3A44-47EA-82D2-282660FC844D}.Debug|x64.Build.0 = Debug|x64 + {3B26A12D-3A44-47EA-82D2-282660FC844D}.Release|ARM.ActiveCfg = Release|ARM + {3B26A12D-3A44-47EA-82D2-282660FC844D}.Release|ARM.Build.0 = Release|ARM + {3B26A12D-3A44-47EA-82D2-282660FC844D}.Release|Win32.ActiveCfg = Release|Win32 + {3B26A12D-3A44-47EA-82D2-282660FC844D}.Release|Win32.Build.0 = Release|Win32 + {3B26A12D-3A44-47EA-82D2-282660FC844D}.Release|x64.ActiveCfg = Release|x64 + {3B26A12D-3A44-47EA-82D2-282660FC844D}.Release|x64.Build.0 = Release|x64 + {22F798D8-BFFF-4754-996F-A5395343D5EC}.Debug|ARM.ActiveCfg = Debug|ARM + {22F798D8-BFFF-4754-996F-A5395343D5EC}.Debug|ARM.Build.0 = Debug|ARM + {22F798D8-BFFF-4754-996F-A5395343D5EC}.Debug|Win32.ActiveCfg = Debug|Win32 + {22F798D8-BFFF-4754-996F-A5395343D5EC}.Debug|Win32.Build.0 = Debug|Win32 + {22F798D8-BFFF-4754-996F-A5395343D5EC}.Debug|x64.ActiveCfg = Debug|Win32 + {22F798D8-BFFF-4754-996F-A5395343D5EC}.Release|ARM.ActiveCfg = Release|ARM + {22F798D8-BFFF-4754-996F-A5395343D5EC}.Release|ARM.Build.0 = Release|ARM + {22F798D8-BFFF-4754-996F-A5395343D5EC}.Release|Win32.ActiveCfg = Release|Win32 + {22F798D8-BFFF-4754-996F-A5395343D5EC}.Release|Win32.Build.0 = Release|Win32 + {22F798D8-BFFF-4754-996F-A5395343D5EC}.Release|x64.ActiveCfg = Release|Win32 + {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Debug|ARM.ActiveCfg = Debug|ARM + {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Debug|ARM.Build.0 = Debug|ARM + {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Debug|Win32.ActiveCfg = Debug|Win32 + {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Debug|Win32.Build.0 = Debug|Win32 + {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Debug|x64.ActiveCfg = Debug|x64 + {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Debug|x64.Build.0 = Debug|x64 + {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Release|ARM.ActiveCfg = Release|ARM + {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Release|ARM.Build.0 = Release|ARM + {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Release|Win32.ActiveCfg = Release|Win32 + {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Release|Win32.Build.0 = Release|Win32 + {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Release|x64.ActiveCfg = Release|x64 + {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Release|x64.Build.0 = Release|x64 + {CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Debug|ARM.ActiveCfg = Debug|ARM + {CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Debug|ARM.Build.0 = Debug|ARM + {CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Debug|Win32.ActiveCfg = Debug|Win32 + {CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Debug|Win32.Build.0 = Debug|Win32 + {CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Debug|x64.ActiveCfg = Debug|Win32 + {CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Release|ARM.ActiveCfg = Release|ARM + {CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Release|ARM.Build.0 = Release|ARM + {CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Release|Win32.ActiveCfg = Release|Win32 + {CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Release|Win32.Build.0 = Release|Win32 + {CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Release|x64.ActiveCfg = Release|Win32 + {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Debug|ARM.ActiveCfg = Debug|ARM + {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Debug|ARM.Build.0 = Debug|ARM + {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Debug|ARM.Deploy.0 = Debug|ARM + {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Debug|Win32.ActiveCfg = Debug|Win32 + {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Debug|Win32.Build.0 = Debug|Win32 + {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Debug|Win32.Deploy.0 = Debug|Win32 + {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Debug|x64.ActiveCfg = Debug|x64 + {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Debug|x64.Build.0 = Debug|x64 + {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Debug|x64.Deploy.0 = Debug|x64 + {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Release|ARM.ActiveCfg = Release|ARM + {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Release|ARM.Build.0 = Release|ARM + {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Release|ARM.Deploy.0 = Release|ARM + {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Release|Win32.ActiveCfg = Release|Win32 + {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Release|Win32.Build.0 = Release|Win32 + {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Release|Win32.Deploy.0 = Release|Win32 + {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Release|x64.ActiveCfg = Release|x64 + {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Release|x64.Build.0 = Release|x64 + {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Release|x64.Deploy.0 = Release|x64 + {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Debug|ARM.ActiveCfg = Debug|ARM + {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Debug|ARM.Build.0 = Debug|ARM + {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Debug|ARM.Deploy.0 = Debug|ARM + {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Debug|Win32.ActiveCfg = Debug|Win32 + {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Debug|Win32.Build.0 = Debug|Win32 + {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Debug|Win32.Deploy.0 = Debug|Win32 + {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Debug|x64.ActiveCfg = Debug|Win32 + {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Release|ARM.ActiveCfg = Release|ARM + {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Release|ARM.Build.0 = Release|ARM + {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Release|ARM.Deploy.0 = Release|ARM + {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Release|Win32.ActiveCfg = Release|Win32 + {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Release|Win32.Build.0 = Release|Win32 + {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Release|Win32.Deploy.0 = Release|Win32 + {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Release|x64.ActiveCfg = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {5D6F020F-7E72-4494-90A0-2DF11D235DF9} = {B3F299D4-B4CA-4F0B-8BE2-FB328483BC13} + {9335005F-678E-4E8E-9B84-50037216AEC8} = {B3F299D4-B4CA-4F0B-8BE2-FB328483BC13} + {22F3B9DF-1209-4574-8331-003966F562BF} = {B3F299D4-B4CA-4F0B-8BE2-FB328483BC13} + {BE3A1791-5BCE-4CEA-92CD-0E2D86DDE27A} = {572742C5-9322-4548-AB8B-96C3750A1B5D} + {F2BAE06B-CAAE-43EE-B21B-57FA48DB04FA} = {572742C5-9322-4548-AB8B-96C3750A1B5D} + {15247C71-5289-4913-B88F-E253CC353720} = {572742C5-9322-4548-AB8B-96C3750A1B5D} + {B3D1A3D5-9F54-43AF-9322-230B53242B78} = {85630454-74EA-4B5B-9B62-0E459B4476CB} + {4A3C6BA8-C227-498B-AA21-40BDA27B461F} = {B3D1A3D5-9F54-43AF-9322-230B53242B78} + {3B26A12D-3A44-47EA-82D2-282660FC844D} = {B3D1A3D5-9F54-43AF-9322-230B53242B78} + {22F798D8-BFFF-4754-996F-A5395343D5EC} = {B3D1A3D5-9F54-43AF-9322-230B53242B78} + {6FEB795C-C98C-4C8C-A88B-A35DEE205348} = {85630454-74EA-4B5B-9B62-0E459B4476CB} + {ADAFD00D-A0D6-46EF-9F0B-EA2880BFE1DE} = {6FEB795C-C98C-4C8C-A88B-A35DEE205348} + {F3550FE0-C795-44F6-8FEB-093EB68143AE} = {6FEB795C-C98C-4C8C-A88B-A35DEE205348} + {CC1DA216-A80D-4BE4-B309-ACB6AF313AFF} = {6FEB795C-C98C-4C8C-A88B-A35DEE205348} + {A3AD93E4-0B2F-4C58-9181-69BED2E42E3E} = {B70EF25E-E352-4020-BCDF-388973E44637} + {79A8FCDA-4B12-4DD1-B676-FF148D651638} = {B70EF25E-E352-4020-BCDF-388973E44637} + {396FE85E-BB05-4B92-BCCB-F89AED4EA41A} = {B70EF25E-E352-4020-BCDF-388973E44637} + EndGlobalSection +EndGlobal diff --git a/build/wp8/Cocos2dShaderCompiler/Assets/logo.png b/build/wp8/Cocos2dShaderCompiler/Assets/logo.png new file mode 100644 index 0000000000..e26771cb33 Binary files /dev/null and b/build/wp8/Cocos2dShaderCompiler/Assets/logo.png differ diff --git a/build/wp8/Cocos2dShaderCompiler/Assets/smalllogo.png b/build/wp8/Cocos2dShaderCompiler/Assets/smalllogo.png new file mode 100644 index 0000000000..1eb0d9d528 Binary files /dev/null and b/build/wp8/Cocos2dShaderCompiler/Assets/smalllogo.png differ diff --git a/build/wp8/Cocos2dShaderCompiler/Assets/splashscreen.png b/build/wp8/Cocos2dShaderCompiler/Assets/splashscreen.png new file mode 100644 index 0000000000..d8ded7198a Binary files /dev/null and b/build/wp8/Cocos2dShaderCompiler/Assets/splashscreen.png differ diff --git a/build/wp8/Cocos2dShaderCompiler/Assets/storelogo.png b/build/wp8/Cocos2dShaderCompiler/Assets/storelogo.png new file mode 100644 index 0000000000..dcb672712c Binary files /dev/null and b/build/wp8/Cocos2dShaderCompiler/Assets/storelogo.png differ diff --git a/build/wp8/Cocos2dShaderCompiler/Cocos2dShaderCompiler.vcxproj b/build/wp8/Cocos2dShaderCompiler/Cocos2dShaderCompiler.vcxproj index 8d18b52516..da1d0cbfe5 100644 --- a/build/wp8/Cocos2dShaderCompiler/Cocos2dShaderCompiler.vcxproj +++ b/build/wp8/Cocos2dShaderCompiler/Cocos2dShaderCompiler.vcxproj @@ -234,6 +234,7 @@ + @@ -256,6 +257,7 @@ + @@ -287,7 +289,6 @@ - @@ -318,7 +319,6 @@ - @@ -432,6 +432,7 @@ + @@ -454,6 +455,7 @@ + @@ -485,7 +487,6 @@ - @@ -519,7 +520,6 @@ false - diff --git a/build/wp8/Cocos2dShaderCompiler/Cocos2dShaderCompiler.vcxproj.filters b/build/wp8/Cocos2dShaderCompiler/Cocos2dShaderCompiler.vcxproj.filters index e428ea0402..4bb30fa911 100644 --- a/build/wp8/Cocos2dShaderCompiler/Cocos2dShaderCompiler.vcxproj.filters +++ b/build/wp8/Cocos2dShaderCompiler/Cocos2dShaderCompiler.vcxproj.filters @@ -94,9 +94,6 @@ libcoco2d\base - - libcoco2d\base - libcoco2d\base @@ -175,9 +172,6 @@ libcoco2d\base - - libcoco2d\base - libcoco2d\base @@ -583,6 +577,12 @@ libcoco2d\external\unzip + + libcoco2d\2d + + + libcoco2d\2d + @@ -615,9 +615,6 @@ libcoco2d\base - - libcoco2d\base - libcoco2d\base @@ -708,9 +705,6 @@ libcoco2d\base - - libcoco2d\base - libcoco2d\base @@ -1155,6 +1149,12 @@ libcoco2d\external\unzip + + libcoco2d\2d + + + libcoco2d\2d + diff --git a/build/wp8/Cocos2dShaderCompiler/ShaderCompiler.cpp b/build/wp8/Cocos2dShaderCompiler/ShaderCompiler.cpp index d8c1d9a538..6ea1183367 100644 --- a/build/wp8/Cocos2dShaderCompiler/ShaderCompiler.cpp +++ b/build/wp8/Cocos2dShaderCompiler/ShaderCompiler.cpp @@ -28,7 +28,6 @@ THE SOFTWARE. #include "CCPrecompiledShaders.h" using namespace Concurrency; -using namespace DirectX; using namespace Microsoft::WRL; using namespace Windows::Foundation; using namespace Windows::UI::Core; diff --git a/cocos/2d/CCDrawNode.cpp b/cocos/2d/CCDrawNode.cpp index eae022bea6..3edbe0bbac 100644 --- a/cocos/2d/CCDrawNode.cpp +++ b/cocos/2d/CCDrawNode.cpp @@ -346,9 +346,8 @@ void DrawNode::onDraw(const Mat4 &transform, uint32_t flags) // texcood glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_TEX_COORD, 2, GL_FLOAT, GL_FALSE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, texCoords)); } - glBindBuffer(GL_ARRAY_BUFFER, _vbo); + glDrawArrays(GL_TRIANGLES, 0, _bufferCount); - glBindBuffer(GL_ARRAY_BUFFER, 0); CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, _bufferCount); CHECK_GL_ERROR_DEBUG(); @@ -382,9 +381,7 @@ void DrawNode::onDrawGLLine(const Mat4 &transform, uint32_t flags) glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_TEX_COORD, 2, GL_FLOAT, GL_FALSE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, texCoords)); } glLineWidth(2); - glBindBuffer(GL_ARRAY_BUFFER, _vboGLLine); glDrawArrays(GL_LINES, 0, _bufferCountGLLine); - glBindBuffer(GL_ARRAY_BUFFER, 0); CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1,_bufferCountGLLine); CHECK_GL_ERROR_DEBUG(); @@ -399,15 +396,28 @@ void DrawNode::onDrawGLPoint(const Mat4 &transform, uint32_t flags) glProgram->setUniformLocationWith4fv(glProgram->getUniformLocation("u_color"), (GLfloat*) &_pointColor.r, 1); glProgram->setUniformLocationWith1f(glProgram->getUniformLocation("u_pointSize"), _pointSize); - glBindBuffer(GL_ARRAY_BUFFER, _vboGLPoint); - glBufferData(GL_ARRAY_BUFFER, sizeof(V2F_C4B_T2F)*_bufferCapacityGLPoint, _bufferGLPoint, GL_STREAM_DRAW); - - GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION | GL::VERTEX_ATTRIB_FLAG_COLOR); - glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, vertices)); - glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, colors)); + if (_dirtyGLPoint) + { + glBindBuffer(GL_ARRAY_BUFFER, _vboGLPoint); + glBufferData(GL_ARRAY_BUFFER, sizeof(V2F_C4B_T2F)*_bufferCapacityGLPoint, _bufferGLPoint, GL_STREAM_DRAW); + + _dirtyGLPoint = false; + } + + if (Configuration::getInstance()->supportsShareableVAO()) + { + GL::bindVAO(_vaoGLPoint); + } + else + { + glBindBuffer(GL_ARRAY_BUFFER, _vboGLPoint); + GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION | GL::VERTEX_ATTRIB_FLAG_COLOR); + glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, vertices)); + glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, colors)); + glBindBuffer(GL_ARRAY_BUFFER, _vboGLPoint); + } glDrawArrays(GL_POINTS, 0, _bufferCountGLPoint); - glBindBuffer(GL_ARRAY_BUFFER, 0); CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1,_bufferCountGLPoint); CHECK_GL_ERROR_DEBUG(); @@ -415,6 +425,8 @@ void DrawNode::onDrawGLPoint(const Mat4 &transform, uint32_t flags) void DrawNode::drawPoint(const Vec2& position, const float pointSize, const Color4F &color) { + ensureCapacityGLPoint(1); + V2F_C4B_T2F *point = (V2F_C4B_T2F*)(_bufferGLPoint + _bufferCountGLPoint); V2F_C4B_T2F a = {position, Color4B(color), Tex2F(0.0, 0.0) }; *point = a; @@ -423,6 +435,7 @@ void DrawNode::drawPoint(const Vec2& position, const float pointSize, const Colo _pointColor = color; _bufferCountGLPoint += 1; + _dirtyGLPoint = true; } void DrawNode::drawPoints(const Vec2 *position, unsigned int numberOfPoints, const Color4F &color) @@ -440,6 +453,7 @@ void DrawNode::drawPoints(const Vec2 *position, unsigned int numberOfPoints, con _pointColor = color; _bufferCountGLPoint += numberOfPoints; + _dirtyGLPoint = true; } void DrawNode::drawLine(const Vec2 &origin, const Vec2 &destination, const Color4F &color) diff --git a/cocos/2d/CCFontAtlas.cpp b/cocos/2d/CCFontAtlas.cpp index be92cbc4b6..fd8c50c0b7 100644 --- a/cocos/2d/CCFontAtlas.cpp +++ b/cocos/2d/CCFontAtlas.cpp @@ -67,7 +67,7 @@ FontAtlas::FontAtlas(Font &theFont) auto outlineSize = fontTTf->getOutlineSize(); if(outlineSize > 0) { - _commonLineHeight += 2 * outlineSize * CC_CONTENT_SCALE_FACTOR(); + _commonLineHeight += 2 * outlineSize; _currentPageDataSize *= 2; } diff --git a/cocos/2d/CCFontFreeType.cpp b/cocos/2d/CCFontFreeType.cpp index 6a4f639c82..1ee2c1aebc 100644 --- a/cocos/2d/CCFontFreeType.cpp +++ b/cocos/2d/CCFontFreeType.cpp @@ -95,12 +95,12 @@ FT_Library FontFreeType::getFTLibrary() FontFreeType::FontFreeType(bool distanceFieldEnabled /* = false */,int outline /* = 0 */) : _fontRef(nullptr) ,_distanceFieldEnabled(distanceFieldEnabled) -,_outlineSize(outline) +,_outlineSize(0.0f) ,_stroker(nullptr) { - if (_outlineSize > 0) + if (outline > 0) { - _outlineSize *= CC_CONTENT_SCALE_FACTOR(); + _outlineSize = outline * CC_CONTENT_SCALE_FACTOR(); FT_Stroker_New(FontFreeType::getFTLibrary(), &_stroker); FT_Stroker_Set(_stroker, (int)(_outlineSize * 64), @@ -328,8 +328,6 @@ unsigned char* FontFreeType::getGlyphBitmap(unsigned short theChar, long &outWid } } - outRect.origin.x = bbox.xMin >> 6; - outRect.origin.y = - (bbox.yMax >> 6); xAdvance += 2 * _outlineSize; outRect.size.width = blendWidth; outRect.size.height = blendHeight; diff --git a/cocos/2d/CCLabelTextFormatter.cpp b/cocos/2d/CCLabelTextFormatter.cpp index 4532ab0e2c..dfad03f4f2 100644 --- a/cocos/2d/CCLabelTextFormatter.cpp +++ b/cocos/2d/CCLabelTextFormatter.cpp @@ -387,13 +387,16 @@ bool LabelTextFormatter::createStringSprites(Label *theLabel) log("WARNING: can't find letter definition in font file for letter: %c", c); continue; } - - nextFontPositionX += charAdvance + kernings[i] + theLabel->_additionalKerning; + + nextFontPositionX += charAdvance + kernings[i]; if (longestLine < nextFontPositionX) { longestLine = nextFontPositionX; } + + // check longest line before adding additional kerning + nextFontPositionX += theLabel->_additionalKerning; } float lastCharWidth = tempDefinition.width * contentScaleFactor; diff --git a/cocos/2d/CCTextFieldTTF.cpp b/cocos/2d/CCTextFieldTTF.cpp index 98b0f54411..591d62fb20 100644 --- a/cocos/2d/CCTextFieldTTF.cpp +++ b/cocos/2d/CCTextFieldTTF.cpp @@ -195,7 +195,6 @@ void TextFieldTTF::insertText(const char * text, size_t len) if (len > 0) { -#if (CC_TARGET_PLATFORM != CC_PLATFORM_WP8 && CC_TARGET_PLATFORM != CC_PLATFORM_WINRT) if (_delegate && _delegate->onTextFieldInsertText(this, insert.c_str(), len)) { // delegate doesn't want to insert text @@ -206,15 +205,6 @@ void TextFieldTTF::insertText(const char * text, size_t len) std::string sText(_inputText); sText.append(insert); setString(sText); -#else - size_t existlen = _inputText.length(); - if (_delegate && _delegate->onTextFieldInsertText(this, insert.c_str() + existlen, len - existlen)) - { - // delegate doesn't want to insert text - return; - } - setString(insert); -#endif } if ((int)insert.npos == pos) { diff --git a/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems b/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems index 4be2a11b3a..aceead4b72 100644 --- a/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems +++ b/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems @@ -115,7 +115,6 @@ - @@ -146,7 +145,6 @@ - @@ -328,6 +326,7 @@ + @@ -359,6 +358,7 @@ + @@ -397,6 +397,7 @@ + @@ -420,6 +421,7 @@ + @@ -532,7 +534,6 @@ - @@ -559,13 +560,11 @@ false - CompileAsCpp + NotUsing - NotUsing - @@ -709,6 +708,7 @@ + Create @@ -742,7 +742,7 @@ - + @@ -780,6 +780,7 @@ + @@ -803,6 +804,7 @@ + @@ -867,8 +869,13 @@ + + Document + + + \ No newline at end of file diff --git a/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems.filters b/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems.filters index b0806073d1..a01ad4cdf3 100644 --- a/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems.filters +++ b/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems.filters @@ -3,204 +3,6 @@ - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - 3d @@ -261,186 +63,6 @@ 3d - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - cocosbuilder\Header Files @@ -1165,9 +787,6 @@ ui\UIWidgets - - base - platform\winrt @@ -1282,9 +901,6 @@ ui\Layouts - - 2d - extension\AssetsManager @@ -1300,207 +916,399 @@ extension\AssetsManager + + platform\winrt + + + ui\UIWidgets\EditBox + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - - - 2d - 3d @@ -1549,150 +1357,6 @@ 3d - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - - - base - cocosbuilder\Source Files @@ -2086,9 +1750,6 @@ ui\UIWidgets\EditBox - - ui\UIWidgets\EditBox - ui\UIWidgets\ScrollWidget @@ -2279,9 +1940,6 @@ ui\UIWidgets - - base - platform\winrt @@ -2342,9 +2000,6 @@ ui\Layouts - - 2d - extension\AssetsManager @@ -2360,6 +2015,360 @@ extension\AssetsManager + + platform\winrt + + + ui\UIWidgets\EditBox + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + @@ -2686,5 +2695,14 @@ renderer + + renderer + + + 2d + + + 2d + \ No newline at end of file diff --git a/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.WindowsPhone/libcocos2d_8_1.WindowsPhone.vcxproj b/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.WindowsPhone/libcocos2d_8_1.WindowsPhone.vcxproj index a082a15791..547e6b214c 100644 --- a/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.WindowsPhone/libcocos2d_8_1.WindowsPhone.vcxproj +++ b/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.WindowsPhone/libcocos2d_8_1.WindowsPhone.vcxproj @@ -109,7 +109,7 @@ /Zm200 %(AdditionalOptions) pch.h $(EngineRoot)external\wp_8.1-specific\zlib\include;$(EngineRoot)external\freetype2\include\wp_8.1;$(EngineRoot)external\websockets\include\wp_8.1;$(EngineRoot)external\curl\include\wp_8.1;$(EngineRoot)external\tiff\include\wp_8.1;$(EngineRoot)external\jpeg\include\wp_8.1;$(EngineRoot)external\png\include\wp_8.1;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories) - _USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions) + CC_NO_GL_POINTSIZE;_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions) Console @@ -127,7 +127,7 @@ /Zm200 %(AdditionalOptions) pch.h $(EngineRoot)external\wp_8.1-specific\zlib\include;$(EngineRoot)external\freetype2\include\wp_8.1;$(EngineRoot)external\websockets\include\wp_8.1;$(EngineRoot)external\curl\include\wp_8.1;$(EngineRoot)external\tiff\include\wp_8.1;$(EngineRoot)external\jpeg\include\wp_8.1;$(EngineRoot)external\png\include\wp_8.1;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories) - _USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;NDEBUG;%(PreprocessorDefinitions) + CC_NO_GL_POINTSIZE;_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;NDEBUG;%(PreprocessorDefinitions) Console @@ -145,7 +145,7 @@ /Zm200 %(AdditionalOptions) pch.h $(EngineRoot)external\wp_8.1-specific\zlib\include;$(EngineRoot)external\freetype2\include\wp_8.1;$(EngineRoot)external\websockets\include\wp_8.1;$(EngineRoot)external\curl\include\wp_8.1;$(EngineRoot)external\tiff\include\wp_8.1;$(EngineRoot)external\jpeg\include\wp_8.1;$(EngineRoot)external\png\include\wp_8.1;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories) - _USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions) + CC_NO_GL_POINTSIZE;_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions) Console @@ -163,7 +163,7 @@ /Zm200 %(AdditionalOptions) pch.h $(EngineRoot)external\wp_8.1-specific\zlib\include;$(EngineRoot)external\freetype2\include\wp_8.1;$(EngineRoot)external\websockets\include\wp_8.1;$(EngineRoot)external\curl\include\wp_8.1;$(EngineRoot)external\tiff\include\wp_8.1;$(EngineRoot)external\jpeg\include\wp_8.1;$(EngineRoot)external\png\include\wp_8.1;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories) - _USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;NDEBUG;%(PreprocessorDefinitions) + CC_NO_GL_POINTSIZE;_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;NDEBUG;%(PreprocessorDefinitions) Console diff --git a/cocos/3d/CCSprite3D.h b/cocos/3d/CCSprite3D.h index f1621d6d1b..3b08d9bf9e 100644 --- a/cocos/3d/CCSprite3D.h +++ b/cocos/3d/CCSprite3D.h @@ -69,7 +69,7 @@ public: /**get mesh*/ Mesh* getMesh() const { return _meshes.at(0); } - /** get Mesh Count */ + /** get mesh count */ ssize_t getMeshCount() const { return _meshes.size(); } /**get skin*/ diff --git a/cocos/base/CCDirector.cpp b/cocos/base/CCDirector.cpp index 4ff32be3ab..227dfe2796 100644 --- a/cocos/base/CCDirector.cpp +++ b/cocos/base/CCDirector.cpp @@ -155,9 +155,8 @@ bool Director::init(void) _renderer = new (std::nothrow) Renderer; -#if (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT) _console = new (std::nothrow) Console; -#endif + return true; } @@ -181,9 +180,8 @@ Director::~Director(void) delete _renderer; -#if (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT) delete _console; -#endif + CC_SAFE_RELEASE(_eventDispatcher); diff --git a/cocos/editor-support/cocostudio/CCComAudio.cpp b/cocos/editor-support/cocostudio/CCComAudio.cpp index b06e20daf9..fccc541c87 100644 --- a/cocos/editor-support/cocostudio/CCComAudio.cpp +++ b/cocos/editor-support/cocostudio/CCComAudio.cpp @@ -128,8 +128,7 @@ bool ComAudio::serialize(void* r) } if (strcmp(className, "CCBackgroundAudio") == 0) { -#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) - // no MP3 support for CC_PLATFORM_WP8 +#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) std::string::size_type pos = filePath.find(".mp3"); if (pos == filePath.npos) { diff --git a/cocos/editor-support/spine/proj.win8.1-universal/libSpine.Shared/libSpine.Shared.vcxitems b/cocos/editor-support/spine/proj.win8.1-universal/libSpine.Shared/libSpine.Shared.vcxitems index 9a1fd46146..88cb6a4ae6 100644 --- a/cocos/editor-support/spine/proj.win8.1-universal/libSpine.Shared/libSpine.Shared.vcxitems +++ b/cocos/editor-support/spine/proj.win8.1-universal/libSpine.Shared/libSpine.Shared.vcxitems @@ -133,7 +133,4 @@ - - - \ No newline at end of file diff --git a/cocos/editor-support/spine/proj.win8.1-universal/libSpine.Shared/libSpine.Shared.vcxitems.filters b/cocos/editor-support/spine/proj.win8.1-universal/libSpine.Shared/libSpine.Shared.vcxitems.filters index 06321d9f79..e89ddb9cf3 100644 --- a/cocos/editor-support/spine/proj.win8.1-universal/libSpine.Shared/libSpine.Shared.vcxitems.filters +++ b/cocos/editor-support/spine/proj.win8.1-universal/libSpine.Shared/libSpine.Shared.vcxitems.filters @@ -65,7 +65,4 @@ - - - \ No newline at end of file diff --git a/cocos/math/Vec2.h b/cocos/math/Vec2.h index 78aac69b95..79b034d582 100644 --- a/cocos/math/Vec2.h +++ b/cocos/math/Vec2.h @@ -418,6 +418,15 @@ public: * @return True if this vector is less than the given vector, false otherwise. */ inline bool operator<(const Vec2& v) const; + + /** + * Determines if this vector is greater than the given vector. + * + * @param v The vector to compare against. + * + * @return True if this vector is greater than the given vector, false otherwise. + */ + inline bool operator>(const Vec2& v) const; /** * Determines if this vector is equal to the given vector. diff --git a/cocos/math/Vec2.inl b/cocos/math/Vec2.inl index 329208b1e5..4cfbe7d27c 100644 --- a/cocos/math/Vec2.inl +++ b/cocos/math/Vec2.inl @@ -82,6 +82,15 @@ inline bool Vec2::operator<(const Vec2& v) const return x < v.x; } +inline bool Vec2::operator>(const Vec2& v) const +{ + if (x == v.x) + { + return y > v.y; + } + return x > v.x; +} + inline bool Vec2::operator==(const Vec2& v) const { return x==v.x && y==v.y; diff --git a/cocos/platform/win8.1-universal/Cocos2dRenderer.cpp b/cocos/platform/win8.1-universal/Cocos2dRenderer.cpp new file mode 100644 index 0000000000..e0c02e3ee8 --- /dev/null +++ b/cocos/platform/win8.1-universal/Cocos2dRenderer.cpp @@ -0,0 +1,85 @@ +/* +* 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" + +// 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(const int width, const int height, CoreDispatcher^ dispatcher, Panel^ panel) + : mApp(nullptr) + , mWidth(width) + , mHeight(height) + , m_dispatcher(dispatcher) + , m_panel(panel) +{ + mApp = new AppDelegate(); + auto director = cocos2d::Director::getInstance(); + + GLViewImpl* glview = GLViewImpl::create("Test Cpp"); + glview->setDispatcher(dispatcher); + glview->setPanel(panel); + glview->Create(static_cast(width), static_cast(height), DisplayOrientations::Landscape); + director->setOpenGLView(glview); + CCApplication::getInstance()->run(); +} + +Cocos2dRenderer::~Cocos2dRenderer() +{ + delete mApp; +} + +// Draws a basic triangle +void Cocos2dRenderer::Draw(GLsizei width, GLsizei height) +{ + if (width != mWidth || height != mHeight) + { + mWidth = width; + mHeight = height; + GLViewImpl::sharedOpenGLView()->UpdateForWindowSizeChange(static_cast(width), static_cast(height)); + } + + GLViewImpl::sharedOpenGLView()->ProcessEvents(); + GLViewImpl::sharedOpenGLView()->Render(); +} + +void Cocos2dRenderer::QueuePointerEvent(cocos2d::PointerEventType type, Windows::UI::Core::PointerEventArgs^ args) +{ + GLViewImpl::sharedOpenGLView()->QueuePointerEvent(type, args); +} + +void Cocos2dRenderer::QueueKeyBoardEvent(cocos2d::Cocos2dKeyEvent type, Windows::UI::Core::KeyEventArgs^ e) +{ + //GLViewImpl::sharedOpenGLView()->QueuePointerEvent(type, e); +} + + diff --git a/cocos/platform/win8.1-universal/Cocos2dRenderer.h b/cocos/platform/win8.1-universal/Cocos2dRenderer.h new file mode 100644 index 0000000000..387445f6d5 --- /dev/null +++ b/cocos/platform/win8.1-universal/Cocos2dRenderer.h @@ -0,0 +1,47 @@ +/* +* 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(const int width, const int height, Windows::UI::Core::CoreDispatcher^ dispathcer, Windows::UI::Xaml::Controls::Panel^ panel); + ~Cocos2dRenderer(); + void Draw(GLsizei width, GLsizei height); + void QueuePointerEvent(PointerEventType type, Windows::UI::Core::PointerEventArgs^ args); + void QueueKeyBoardEvent(Cocos2dKeyEvent type, Windows::UI::Core::KeyEventArgs^ e); + + private: + + int mWidth; + int mHeight; + // The AppDelegate for the Cocos2D app + AppDelegate* mApp; + Platform::Agile m_dispatcher; + Platform::Agile m_panel; + }; +} \ No newline at end of file diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/OpenGLES.cpp b/cocos/platform/win8.1-universal/OpenGLES.cpp similarity index 83% rename from tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/OpenGLES.cpp rename to cocos/platform/win8.1-universal/OpenGLES.cpp index 793b91d83f..943b0856fc 100644 --- a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/OpenGLES.cpp +++ b/cocos/platform/win8.1-universal/OpenGLES.cpp @@ -1,5 +1,22 @@ -#include "pch.h" +/* +* 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; @@ -36,8 +53,13 @@ void OpenGLES::Initialize() // This can be used to configure D3D11. For example, EGL_PLATFORM_ANGLE_TYPE_D3D11_FL9_3_ANGLE could be used. // This would ask the graphics card to use D3D11 Feature Level 9_3 instead of Feature Level 11_0+. // On Windows Phone, this would allow the Phone Emulator to act more like the GPUs that are available on real Phone devices. +#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) + EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_FL9_3_ANGLE, + EGL_NONE, +#else EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, EGL_NONE, +#endif }; const EGLint contextAttributes[] = diff --git a/cocos/platform/win8.1-universal/OpenGLES.h b/cocos/platform/win8.1-universal/OpenGLES.h new file mode 100644 index 0000000000..ce9f2a9cdf --- /dev/null +++ b/cocos/platform/win8.1-universal/OpenGLES.h @@ -0,0 +1,52 @@ +/* +* 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(); + +private: + void Initialize(); + void Cleanup(); + +private: + EGLDisplay mEglDisplay; + EGLContext mEglContext; + EGLConfig mEglConfig; +}; diff --git a/cocos/platform/win8.1-universal/OpenGLESPage.xaml b/cocos/platform/win8.1-universal/OpenGLESPage.xaml new file mode 100644 index 0000000000..e5b62802a5 --- /dev/null +++ b/cocos/platform/win8.1-universal/OpenGLESPage.xaml @@ -0,0 +1,28 @@ + + + + + + + + + + + diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Windows/OpenGLESPage.xaml.cpp b/cocos/platform/win8.1-universal/OpenGLESPage.xaml.cpp similarity index 59% rename from tests/cpp-tests/proj.win8.1-universal/cpp-tests.Windows/OpenGLESPage.xaml.cpp rename to cocos/platform/win8.1-universal/OpenGLESPage.xaml.cpp index 29392e8af4..c8ee9afb42 100644 --- a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Windows/OpenGLESPage.xaml.cpp +++ b/cocos/platform/win8.1-universal/OpenGLESPage.xaml.cpp @@ -1,10 +1,40 @@ -#include "pch.h" +/* +* 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 cpp_tests; +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; OpenGLESPage::OpenGLESPage() : OpenGLESPage(nullptr) @@ -16,7 +46,8 @@ OpenGLESPage::OpenGLESPage(OpenGLES* openGLES) : mOpenGLES(openGLES), mRenderSurface(EGL_NO_SURFACE), mCustomRenderSurfaceSize(0,0), - mUseCustomRenderSurfaceSize(false) + mUseCustomRenderSurfaceSize(false), + m_coreInput(nullptr) { InitializeComponent(); @@ -31,7 +62,11 @@ OpenGLESPage::OpenGLESPage(OpenGLES* openGLES) : this->Loaded += ref new Windows::UI::Xaml::RoutedEventHandler(this, &OpenGLESPage::OnPageLoaded); -#if !(WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) + mSwapChainPanelSize = { swapChainPanel->RenderSize.Width, swapChainPanel->RenderSize.Height }; + +#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) + Windows::UI::ViewManagement::StatusBar::GetForCurrentView()->HideAsync(); +#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(); @@ -39,7 +74,28 @@ OpenGLESPage::OpenGLESPage(OpenGLES* openGLES) : pointerVisualizationSettings->IsBarrelButtonFeedbackEnabled = false; #endif - mSwapChainPanelSize = { swapChainPanel->RenderSize.Width, swapChainPanel->RenderSize.Height }; + // 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(this, &OpenGLESPage::OnPointerPressed); + m_coreInput->PointerMoved += ref new TypedEventHandler(this, &OpenGLESPage::OnPointerMoved); + m_coreInput->PointerReleased += ref new TypedEventHandler(this, &OpenGLESPage::OnPointerReleased); + + // Begin processing input messages as they're delivered. + m_coreInput->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessUntilQuit); + }); + + // Run task on a dedicated high priority background thread. + m_inputLoopWorker = ThreadPool::RunAsync(workItemHandler, WorkItemPriority::High, WorkItemOptions::TimeSliced); + } OpenGLESPage::~OpenGLESPage() @@ -55,6 +111,32 @@ void OpenGLESPage::OnPageLoaded(Platform::Object^ sender, Windows::UI::Xaml::Rou StartRenderLoop(); } +void OpenGLESPage::OnPointerPressed(Object^ sender, PointerEventArgs^ e) +{ + if (m_renderer) + { + m_renderer->QueuePointerEvent(PointerEventType::PointerPressed, e); + } +} + +void OpenGLESPage::OnPointerMoved(Object^ sender, PointerEventArgs^ e) +{ + if (m_renderer) + { + m_renderer->QueuePointerEvent(PointerEventType::PointerMoved, e); + } +} + +void OpenGLESPage::OnPointerReleased(Object^ sender, PointerEventArgs^ e) +{ + if (m_renderer) + { + m_renderer->QueuePointerEvent(PointerEventType::PointerReleased, e); + } +} + + + void OpenGLESPage::OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args) { if (args->Visible && mRenderSurface != EGL_NO_SURFACE) @@ -143,21 +225,29 @@ void OpenGLESPage::StartRenderLoop() return; } + auto dispatcher = Windows::UI::Xaml::Window::Current->CoreWindow->Dispatcher; + // Create a task for rendering that will be run on a background thread. - auto workItemHandler = ref new Windows::System::Threading::WorkItemHandler([this](Windows::Foundation::IAsyncAction ^ action) + auto workItemHandler = ref new Windows::System::Threading::WorkItemHandler([this, dispatcher](Windows::Foundation::IAsyncAction ^ action) { critical_section::scoped_lock lock(mRenderSurfaceCriticalSection); mOpenGLES->MakeCurrent(mRenderSurface); - HelloTriangleRenderer renderer; + + GLsizei panelWidth = 0; + GLsizei panelHeight = 0; + GetSwapChainPanelSize(&panelWidth, &panelHeight); + + if (m_renderer.get() == nullptr) + { + m_renderer = std::make_shared(panelWidth, panelHeight, dispatcher, swapChainPanel); + } while (action->Status == Windows::Foundation::AsyncStatus::Started) { - GLsizei panelWidth = 0; - GLsizei panelHeight = 0; - + GetSwapChainPanelSize(&panelWidth, &panelHeight); - renderer.Draw(panelWidth, panelHeight); + m_renderer.get()->Draw(panelWidth, panelHeight); // The call to eglSwapBuffers might not be successful (i.e. due to Device Lost) // If the call fails, then we must reinitialize EGL and the GL resources. @@ -165,6 +255,7 @@ void OpenGLESPage::StartRenderLoop() { // XAML objects like the SwapChainPanel must only be manipulated on the UI thread. swapChainPanel->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::High, ref new Windows::UI::Core::DispatchedHandler([=]() + //swapChainPanel->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::High, ref new Windows::UI::Core::DispatchedHandler([=]() { RecoverFromLostDevice(); }, CallbackContext::Any)); diff --git a/cocos/platform/win8.1-universal/OpenGLESPage.xaml.h b/cocos/platform/win8.1-universal/OpenGLESPage.xaml.h new file mode 100644 index 0000000000..d8ddccc63e --- /dev/null +++ b/cocos/platform/win8.1-universal/OpenGLESPage.xaml.h @@ -0,0 +1,71 @@ +/* +* 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 "OpenGLES.h" +#include "OpenGLESPage.g.h" +#include + +#include "Cocos2dRenderer.h" + +namespace cocos2d +{ + public ref class OpenGLESPage sealed + { + public: + OpenGLESPage(); + virtual ~OpenGLESPage(); + + internal: + OpenGLESPage(OpenGLES* openGLES); + + private: + void OnPageLoaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); + void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args); + void OnSwapChainPanelSizeChanged(Platform::Object^ sender, Windows::UI::Xaml::SizeChangedEventArgs^ e); + void GetSwapChainPanelSize(GLsizei* width, GLsizei* height); + void CreateRenderSurface(); + void DestroyRenderSurface(); + void RecoverFromLostDevice(); + void StartRenderLoop(); + void StopRenderLoop(); + + OpenGLES* mOpenGLES; + std::shared_ptr m_renderer; + + Windows::Foundation::Size mSwapChainPanelSize; + Concurrency::critical_section mSwapChainPanelSizeCriticalSection; + + Windows::Foundation::Size mCustomRenderSurfaceSize; + bool mUseCustomRenderSurfaceSize; + + EGLSurface mRenderSurface; // This surface is associated with a swapChainPanel on the page + Concurrency::critical_section mRenderSurfaceCriticalSection; + Windows::Foundation::IAsyncAction^ mRenderLoopWorker; + + // Track user input on a background worker thread. + Windows::Foundation::IAsyncAction^ m_inputLoopWorker; + Windows::UI::Core::CoreIndependentInputSource^ m_coreInput; + + // Independent input handling functions. + void OnPointerPressed(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e); + void OnPointerMoved(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e); + void OnPointerReleased(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e); + }; +} diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/pch.cpp b/cocos/platform/win8.1-universal/pch.cpp similarity index 100% rename from tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/pch.cpp rename to cocos/platform/win8.1-universal/pch.cpp diff --git a/cocos/platform/win8.1-universal/pch.h b/cocos/platform/win8.1-universal/pch.h new file mode 100644 index 0000000000..2e511d964f --- /dev/null +++ b/cocos/platform/win8.1-universal/pch.h @@ -0,0 +1,14 @@ +// +// pch.h +// Header for standard system include files. +// + +#pragma once + +#include +#include + +#include "cocos2d.h" +#include "cocos-ext.h" + + diff --git a/cocos/platform/winrt/CCCommon.cpp b/cocos/platform/winrt/CCCommon.cpp index 4c8c2c6663..f38615b3ab 100644 --- a/cocos/platform/winrt/CCCommon.cpp +++ b/cocos/platform/winrt/CCCommon.cpp @@ -26,7 +26,7 @@ THE SOFTWARE. #include "platform/CCStdC.h" #include "CCWinRTUtils.h" -#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) +#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || defined(WP8_SHADER_COMPILER) #include "platform/wp8/CCGLViewImpl-wp8.h" #endif @@ -42,17 +42,9 @@ void MessageBox(const char * pszMsg, const char * pszTitle) // Create the message dialog and set its content Platform::String^ message = ref new Platform::String(CCUtf8ToUnicode(pszMsg, -1).c_str()); Platform::String^ title = ref new Platform::String(CCUtf8ToUnicode(pszTitle, -1).c_str()); -#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) - Windows::UI::Popups::MessageDialog^ msg = ref new Windows::UI::Popups::MessageDialog(message, title); - // Set the command to be invoked when a user presses 'ESC' - msg->CancelCommandIndex = 1; - - // Show the message dialog - msg->ShowAsync(); -#else +#ifndef WP8_SHADER_COMPILER GLViewImpl::sharedOpenGLView()->ShowMessageBox(title, message); #endif - } diff --git a/cocos/platform/winrt/CCDevice.cpp b/cocos/platform/winrt/CCDevice.cpp index 2fd9823ef6..46b631ea4d 100644 --- a/cocos/platform/winrt/CCDevice.cpp +++ b/cocos/platform/winrt/CCDevice.cpp @@ -51,6 +51,7 @@ static Accelerometer^ sAccelerometer = nullptr; void Device::setAccelerometerEnabled(bool isEnabled) { +#ifndef WP8_SHADER_COMPILER static Windows::Foundation::EventRegistrationToken sToken; static bool sEnabled = false; @@ -91,7 +92,6 @@ void Device::setAccelerometerEnabled(bool isEnabled) acc.z = reading->AccelerationZ; acc.timestamp = 0; -#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8 auto orientation = GLViewImpl::sharedOpenGLView()->getDeviceOrientation(); switch (orientation) @@ -121,14 +121,12 @@ void Device::setAccelerometerEnabled(bool isEnabled) acc.y = reading->AccelerationY; break; } -#endif -#ifndef WP8_SHADER_COMPILER std::shared_ptr event(new AccelerometerEvent(acc)); cocos2d::GLViewImpl::sharedOpenGLView()->QueueEvent(event); -#endif }); } +#endif } void Device::setAccelerometerInterval(float interval) diff --git a/cocos/platform/winrt/CCGLViewImpl-winrt.cpp b/cocos/platform/winrt/CCGLViewImpl-winrt.cpp index d5ecc8e138..4526c07091 100644 --- a/cocos/platform/winrt/CCGLViewImpl-winrt.cpp +++ b/cocos/platform/winrt/CCGLViewImpl-winrt.cpp @@ -24,7 +24,6 @@ THE SOFTWARE. ****************************************************************************/ #include "CCGLViewImpl-winrt.h" -#include "deprecated/CCSet.h" #include "base/ccMacros.h" #include "base/CCDirector.h" #include "base/CCTouch.h" @@ -40,7 +39,9 @@ using namespace Windows::Graphics::Display; using namespace Windows::UI::Input; using namespace Windows::UI::Core; using namespace Windows::UI::Xaml; +using namespace Windows::UI::Xaml::Controls; using namespace Windows::UI::Xaml::Media; +using namespace Windows::UI::Xaml::Input; using namespace Windows::System; using namespace Windows::UI::ViewManagement; using namespace Windows::ApplicationModel; @@ -48,7 +49,6 @@ using namespace Windows::ApplicationModel::Core; using namespace Windows::ApplicationModel::Activation; using namespace Platform; using namespace Microsoft::WRL; -using namespace PhoneDirect3DXamlAppComponent; NS_CC_BEGIN @@ -79,8 +79,6 @@ GLViewImpl::GLViewImpl() , m_windowVisible(true) , m_width(0) , m_height(0) - , m_delegate(nullptr) - , m_messageBoxDelegate(nullptr) , m_orientation(DisplayOrientations::Landscape) { s_pEglView = this; @@ -116,6 +114,16 @@ bool GLViewImpl::Create(float width, float height, DisplayOrientations orientati return true; } +void GLViewImpl::setDispatcher(Windows::UI::Core::CoreDispatcher^ dispatcher) +{ + m_dispatcher = dispatcher; +} + +void GLViewImpl::setPanel(Windows::UI::Xaml::Controls::Panel^ panel) +{ + m_panel = panel; +} + void GLViewImpl::setIMEKeyboardState(bool bOpen) @@ -124,44 +132,55 @@ void GLViewImpl::setIMEKeyboardState(bool bOpen) setIMEKeyboardState(bOpen, str); } +bool GLViewImpl::ShowMessageBox(Platform::String^ title, Platform::String^ message) +{ + if (m_dispatcher.Get()) + { + m_dispatcher.Get()->RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, ref new Windows::UI::Core::DispatchedHandler([title, message]() + { + // Show the message dialog + auto msg = ref new Windows::UI::Popups::MessageDialog(message, title); + // Set the command to be invoked when a user presses 'ESC' + msg->CancelCommandIndex = 1; + msg->ShowAsync(); + })); + + return true; + } + return false; +} + void GLViewImpl::setIMEKeyboardState(bool bOpen, std::string str) { - if(m_delegate) + if(bOpen) { - if(bOpen) + if (m_keyboard == nullptr) { - m_delegate->Invoke(Cocos2dEvent::ShowKeyboard, stringToPlatformString(str)); + m_keyboard = ref new KeyBoardWinRT(m_dispatcher.Get(), m_panel.Get()); } - else + m_keyboard->ShowKeyboard(PlatformStringFromString(str)); + } + else + { + if (m_keyboard != nullptr) { - m_delegate->Invoke(Cocos2dEvent::HideKeyboard, stringToPlatformString(str)); + m_keyboard->HideKeyboard(PlatformStringFromString(str)); } + m_keyboard = nullptr; } } -Platform::String^ GLViewImpl::stringToPlatformString(std::string strSrc) -{ - // to wide char - int strLen = MultiByteToWideChar(CP_UTF8, 0, strSrc.c_str(), -1, NULL, 0); - wchar_t* wstr = new wchar_t[strLen + 1]; - memset(wstr, 0, strLen + 1); - MultiByteToWideChar(CP_UTF8, 0, strSrc.c_str(), -1, wstr, strLen); - Platform::String^ strDst = ref new Platform::String(wstr); - delete[] wstr; - return strDst; -} + void GLViewImpl::swapBuffers() { - //eglSwapBuffers(m_eglDisplay, m_eglSurface); + } bool GLViewImpl::isOpenGLReady() { return true; - // TODO: need to revisit this - //return (m_eglDisplay && m_orientation != DisplayOrientations::None); } void GLViewImpl::end() @@ -184,7 +203,7 @@ void GLViewImpl::OnBackKeyPress() std::string str; if(m_delegate) { - m_delegate->Invoke(Cocos2dEvent::TerminateApp, stringToPlatformString(str)); + //m_delegate->Invoke(Cocos2dEvent::TerminateApp, stringToPlatformString(str)); } } @@ -308,30 +327,6 @@ void GLViewImpl::OnRendering() } } - - -bool GLViewImpl::ShowMessageBox(Platform::String^ title, Platform::String^ message) -{ - if(m_messageBoxDelegate) - { - m_messageBoxDelegate->Invoke(title, message); - return true; - } - return false; -} - -bool GLViewImpl::OpenXamlEditBox(Platform::String^ strPlaceHolder, Platform::String^ strText, int maxLength, int inputMode, int inputFlag, Windows::Foundation::EventHandler^ receiveHandler) -{ - if(m_editBoxDelegate) - { - m_editBoxDelegate->Invoke(strPlaceHolder, strText, maxLength, inputMode, inputFlag, receiveHandler); - return true; - } - return false; -} - - - // called by orientation change from WP8 XAML void GLViewImpl::UpdateOrientation(DisplayOrientations orientation) { @@ -345,9 +340,12 @@ void GLViewImpl::UpdateOrientation(DisplayOrientations orientation) // called by size change from WP8 XAML void GLViewImpl::UpdateForWindowSizeChange(float width, float height) { - m_width = width; - m_height = height; - UpdateWindowSize(); + if (width != m_width || height != m_height) + { + m_width = width; + m_height = height; + UpdateWindowSize(); + } } #if 0 @@ -371,18 +369,9 @@ void GLViewImpl::UpdateWindowSize() { float width, height; - if(m_orientation == DisplayOrientations::Landscape || m_orientation == DisplayOrientations::LandscapeFlipped) - { - width = m_height; - height = m_width; - } - else - { - width = m_width; - height = m_height; - } + width = m_width; + height = m_height; - UpdateOrientationMatrix(); //CCSize designSize = getDesignResolutionSize(); if(!m_initialized) @@ -403,45 +392,15 @@ void GLViewImpl::UpdateWindowSize() } } -const Mat4& GLViewImpl::getOrientationMatrix() const -{ - return m_orientationMatrix; -}; - - -void GLViewImpl::UpdateOrientationMatrix() -{ - kmMat4Identity(&m_orientationMatrix); - kmMat4Identity(&m_reverseOrientationMatrix); - switch(m_orientation) - { - case Windows::Graphics::Display::DisplayOrientations::PortraitFlipped: - kmMat4RotationZ(&m_orientationMatrix, static_cast(M_PI)); - kmMat4RotationZ(&m_reverseOrientationMatrix, static_cast(-M_PI)); - break; - - case Windows::Graphics::Display::DisplayOrientations::Landscape: - kmMat4RotationZ(&m_orientationMatrix, static_cast(-M_PI_2)); - kmMat4RotationZ(&m_reverseOrientationMatrix, static_cast(M_PI_2)); - break; - - case Windows::Graphics::Display::DisplayOrientations::LandscapeFlipped: - kmMat4RotationZ(&m_orientationMatrix, static_cast(M_PI_2)); - kmMat4RotationZ(&m_reverseOrientationMatrix, static_cast(-M_PI_2)); - break; - - default: - break; - } -} - cocos2d::Vec2 GLViewImpl::TransformToOrientation(Windows::Foundation::Point p) { cocos2d::Vec2 returnValue; float x = p.X; float y = p.Y; + returnValue = Vec2(x, y); +#if 0 switch (m_orientation) { case DisplayOrientations::Portrait: @@ -458,6 +417,7 @@ cocos2d::Vec2 GLViewImpl::TransformToOrientation(Windows::Foundation::Point p) returnValue = Vec2(m_height - y, x); break; } +#endif float zoomFactor = GLViewImpl::sharedOpenGLView()->getFrameZoomFactor(); if(zoomFactor > 0.0f) { @@ -473,48 +433,23 @@ cocos2d::Vec2 GLViewImpl::TransformToOrientation(Windows::Foundation::Point p) Vec2 GLViewImpl::GetPoint(PointerEventArgs^ args) { return TransformToOrientation(args->CurrentPoint->Position); - } void GLViewImpl::setViewPortInPoints(float x , float y , float w , float h) { - switch(m_orientation) - { - case DisplayOrientations::Landscape: - case DisplayOrientations::LandscapeFlipped: - glViewport((GLint)(y * _scaleY + _viewPortRect.origin.y), - (GLint)(x * _scaleX + _viewPortRect.origin.x), - (GLsizei)(h * _scaleY), - (GLsizei)(w * _scaleX)); - break; - - default: - glViewport((GLint)(x * _scaleX + _viewPortRect.origin.x), - (GLint)(y * _scaleY + _viewPortRect.origin.y), - (GLsizei)(w * _scaleX), - (GLsizei)(h * _scaleY)); - } + glViewport((GLint) (x * _scaleX + _viewPortRect.origin.x), + (GLint) (y * _scaleY + _viewPortRect.origin.y), + (GLsizei) (w * _scaleX), + (GLsizei) (h * _scaleY)); } void GLViewImpl::setScissorInPoints(float x , float y , float w , float h) { - switch(m_orientation) - { - case DisplayOrientations::Landscape: - case DisplayOrientations::LandscapeFlipped: - glScissor((GLint)(y * _scaleX + _viewPortRect.origin.y), - (GLint)((_viewPortRect.size.width - ((x + w) * _scaleX)) + _viewPortRect.origin.x), - (GLsizei)(h * _scaleY), - (GLsizei)(w * _scaleX)); - break; - - default: - glScissor((GLint)(x * _scaleX + _viewPortRect.origin.x), - (GLint)(y * _scaleY + _viewPortRect.origin.y), - (GLsizei)(w * _scaleX), - (GLsizei)(h * _scaleY)); - } + glScissor((GLint) (x * _scaleX + _viewPortRect.origin.x), + (GLint) (y * _scaleY + _viewPortRect.origin.y), + (GLsizei) (w * _scaleX), + (GLsizei) (h * _scaleY)); } void GLViewImpl::QueueBackKeyPress() diff --git a/cocos/platform/winrt/CCGLViewImpl-winrt.h b/cocos/platform/winrt/CCGLViewImpl-winrt.h index e30672fb2a..33eac1cfbe 100644 --- a/cocos/platform/winrt/CCGLViewImpl-winrt.h +++ b/cocos/platform/winrt/CCGLViewImpl-winrt.h @@ -33,21 +33,16 @@ THE SOFTWARE. #include - +#include #include -#include #include #include - -#include -#include - +#include NS_CC_BEGIN class GLViewImpl; - class CC_DLL GLViewImpl : public GLView { public: @@ -59,20 +54,20 @@ public: virtual void swapBuffers(); virtual void setViewPortInPoints(float x , float y , float w , float h); virtual void setScissorInPoints(float x , float y , float w , float h); - const Mat4& getOrientationMatrix() const; - const Mat4& getReverseOrientationMatrix () const {return m_reverseOrientationMatrix;}; Windows::Graphics::Display::DisplayOrientations getDeviceOrientation() {return m_orientation;}; Size getRenerTargetSize() const { return Size(m_width, m_height); } virtual void setIMEKeyboardState(bool bOpen); virtual void setIMEKeyboardState(bool bOpen, std::string str); - Platform::String^ stringToPlatformString(std::string strSrc); - void ShowKeyboard(Windows::Foundation::Rect r); - void HideKeyboard(Windows::Foundation::Rect r); - // WP8 XAML app - virtual bool Create(float width, float height, Windows::Graphics::Display::DisplayOrientations orientation); + virtual bool Create(float width, float height ,Windows::Graphics::Display::DisplayOrientations orientation); + + void setDispatcher(Windows::UI::Core::CoreDispatcher^ dispatcher); + Windows::UI::Core::CoreDispatcher^ getDispatcher() {return m_dispatcher.Get();} + + void setPanel(Windows::UI::Xaml::Controls::Panel^ panel); + Windows::UI::Xaml::Controls::Panel^ getPanel() {return m_panel.Get();} void OnPointerPressed(Windows::UI::Core::PointerEventArgs^ args); void OnPointerMoved(Windows::UI::Core::PointerEventArgs^ args); @@ -89,14 +84,9 @@ public: void QueueBackKeyPress(); void QueuePointerEvent(PointerEventType type, Windows::UI::Core::PointerEventArgs^ args); - void GLViewImpl::QueueEvent(std::shared_ptr& event); - - void SetXamlEventDelegate(PhoneDirect3DXamlAppComponent::Cocos2dEventDelegate^ delegate) { m_delegate = delegate; }; - void SetXamlMessageBoxDelegate(PhoneDirect3DXamlAppComponent::Cocos2dMessageBoxDelegate^ delegate) { m_messageBoxDelegate = delegate; }; - void SetXamlEditBoxDelegate(PhoneDirect3DXamlAppComponent::Cocos2dEditBoxDelegate^ delegate) { m_editBoxDelegate = delegate; }; + void QueueEvent(std::shared_ptr& event); bool ShowMessageBox(Platform::String^ title, Platform::String^ message); - bool OpenXamlEditBox(Platform::String^ strPlaceHolder, Platform::String^ strText, int maxLength, int inputMode, int inputFlag, Windows::Foundation::EventHandler^ receiveHandler); int Run(); void Render(); @@ -116,9 +106,6 @@ public: static GLViewImpl* sharedOpenGLView(); void ProcessEvents(); - void AddPointerEvent(PointerEventType type, Windows::UI::Core::PointerEventArgs^ args); - - protected: GLViewImpl(); @@ -144,8 +131,7 @@ private: void OnRendering(); void UpdateWindowSize(); - void UpdateOrientationMatrix(); - + cocos2d::Vec2 TransformToOrientation(Windows::Foundation::Point point); cocos2d::Vec2 GetPoint(Windows::UI::Core::PointerEventArgs^ args); @@ -162,20 +148,20 @@ private: bool m_lastPointValid; bool m_windowClosed; bool m_windowVisible; - Mat4 m_orientationMatrix; - Mat4 m_reverseOrientationMatrix; - bool m_running; bool m_initialized; - PhoneDirect3DXamlAppComponent::Cocos2dEventDelegate^ m_delegate; - PhoneDirect3DXamlAppComponent::Cocos2dMessageBoxDelegate^ m_messageBoxDelegate; - PhoneDirect3DXamlAppComponent::Cocos2dEditBoxDelegate^ m_editBoxDelegate; + Cocos2dEventDelegate^ m_delegate; + Cocos2dMessageBoxDelegate^ m_messageBoxDelegate; + Cocos2dEditBoxDelegate^ m_editBoxDelegate; std::queue> mInputEvents; std::mutex mMutex; + Platform::Agile m_dispatcher; + Platform::Agile m_panel; + KeyBoardWinRT^ m_keyboard; }; NS_CC_END diff --git a/cocos/platform/winrt/CCWinRTUtils.cpp b/cocos/platform/winrt/CCWinRTUtils.cpp index c4fb52b0b9..0771dc35ed 100644 --- a/cocos/platform/winrt/CCWinRTUtils.cpp +++ b/cocos/platform/winrt/CCWinRTUtils.cpp @@ -32,6 +32,11 @@ THE SOFTWARE. #include #include +#if CC_TARGET_PLATFORM != CC_PLATFORM_WP8 +using namespace Windows::UI::Xaml; +using namespace Windows::UI::Xaml::Controls; +#endif + NS_CC_BEGIN using namespace Windows::Graphics::Display; @@ -153,6 +158,103 @@ std::string CC_DLL getDeviceIPAddresses() return result.str(); } +#if CC_TARGET_PLATFORM != CC_PLATFORM_WP8 +Platform::Object^ findXamlElement(Platform::Object^ parent, Platform::String^ name) +{ + if (parent == nullptr || name == nullptr || name->Length() == 0) + { + return nullptr; + } + + FrameworkElement^ element = dynamic_cast(parent); + if (element == nullptr) + { + return nullptr; + } + + if (element->Name == name) + { + return element; + } + + Panel^ panel = dynamic_cast(element); + if (panel == nullptr) + { + return nullptr; + } + + int count = panel->Children->Size; + for (int i = 0; i < count; i++) + { + auto result = findXamlElement(panel->Children->GetAt(i), name); + if (result != nullptr) + { + return result; + } + } + + return nullptr; +} + + +bool removeXamlElement(Platform::Object^ parent, Platform::Object^ element) +{ + Panel^ panel = dynamic_cast(parent); + if (panel == nullptr) + { + return false; + } + + UIElement^ uiElement = dynamic_cast(element); + if (uiElement == nullptr) + { + return false; + } + + unsigned int index; + if (!panel->Children->IndexOf(uiElement, &index)) + { + return false; + } + + panel->Children->RemoveAt(index); + + return true; +} + +bool replaceXamlElement(Platform::Object^ parent, Platform::Object^ add, Platform::Object^ remove) +{ + Panel^ panel = dynamic_cast(parent); + if (panel == nullptr) + { + return false; + } + + UIElement^ addElement = dynamic_cast(add); + if (addElement == nullptr) + { + return false; + } + + UIElement^ removeElement = dynamic_cast(remove); + if (removeElement == nullptr) + { + return false; + } + + unsigned int index; + if (!panel->Children->IndexOf(removeElement, &index)) + { + return false; + } + + panel->Children->RemoveAt(index); + panel->Children->InsertAt(index, addElement); + + return true; +} +#endif + diff --git a/cocos/platform/winrt/CCWinRTUtils.h b/cocos/platform/winrt/CCWinRTUtils.h index 7d06c9d04f..19a229a233 100644 --- a/cocos/platform/winrt/CCWinRTUtils.h +++ b/cocos/platform/winrt/CCWinRTUtils.h @@ -40,6 +40,12 @@ NS_CC_BEGIN std::wstring CC_DLL CCUtf8ToUnicode(const char * pszUtf8Str, unsigned len = -1); std::string CC_DLL CCUnicodeToUtf8(const wchar_t* pwszStr); +#if CC_TARGET_PLATFORM != CC_PLATFORM_WP8 +Platform::Object^ findXamlElement(Platform::Object^ parent, Platform::String^ name); +bool removeXamlElement(Platform::Object^ parent, Platform::Object^ element); +bool replaceXamlElement(Platform::Object^ parent, Platform::Object^ add, Platform::Object^ remove); +#endif + std::string PlatformStringToString(Platform::String^ s); Platform::String^ PlatformStringFromString(const std::string& s); diff --git a/cocos/platform/winrt/InputEvent.cpp b/cocos/platform/winrt/InputEvent.cpp index 1c647538a0..4a443d3dca 100644 --- a/cocos/platform/winrt/InputEvent.cpp +++ b/cocos/platform/winrt/InputEvent.cpp @@ -24,6 +24,7 @@ THE SOFTWARE. ****************************************************************************/ #include "InputEvent.h" +#include "CCWinRTUtils.h" #if CC_TARGET_PLATFORM == CC_PLATFORM_WP8 #include "CCGLViewImpl-wp8.h" @@ -35,9 +36,6 @@ THE SOFTWARE. NS_CC_BEGIN -using namespace PhoneDirect3DXamlAppComponent; - - AccelerometerEvent::AccelerometerEvent(const Acceleration& event) : m_event(event) { @@ -92,9 +90,11 @@ void KeyboardEvent::execute() { case Cocos2dKeyEvent::Text: { - char szUtf8[256] = { 0 }; - int nLen = WideCharToMultiByte(CP_UTF8, 0, (LPCWSTR) m_text.Get()->Data(), -1, szUtf8, sizeof(szUtf8), NULL, NULL); - IMEDispatcher::sharedDispatcher()->dispatchInsertText(szUtf8, nLen - 1); + std::wstring w(m_text.Get()->Data()); + std::u16string s16(w.begin(),w.end()); + std::string utf8String; + StringUtils::UTF16ToUTF8(s16, utf8String); + IMEDispatcher::sharedDispatcher()->dispatchInsertText(utf8String.c_str(), utf8String.size()); break; } @@ -108,7 +108,6 @@ void KeyboardEvent::execute() IMEDispatcher::sharedDispatcher()->dispatchDeleteBackward(); break; case Cocos2dKeyEvent::Enter: - //SetFocus(false); IMEDispatcher::sharedDispatcher()->dispatchInsertText("\n", 1); break; default: @@ -133,12 +132,27 @@ CustomInputEvent::CustomInputEvent(const std::function& fun) : m_fun(fun) { } + void CustomInputEvent::execute() { m_fun(); } +UIEditBoxEvent::UIEditBoxEvent(Platform::Object^ sender, Platform::String^ text, Windows::Foundation::EventHandler^ handle) + : m_sender(sender) + , m_text(text) + , m_handler(handle) +{ +} + +void UIEditBoxEvent::execute() +{ + if (m_handler.Get()) + { + m_handler.Get()->Invoke(m_sender.Get(), m_text.Get()); + } +} NS_CC_END diff --git a/cocos/platform/winrt/InputEvent.h b/cocos/platform/winrt/InputEvent.h index ed22daf21f..017c3b92fa 100644 --- a/cocos/platform/winrt/InputEvent.h +++ b/cocos/platform/winrt/InputEvent.h @@ -30,17 +30,13 @@ THE SOFTWARE. #include "InputEventTypes.h" #include - -namespace PhoneDirect3DXamlAppComponent -{ - public delegate void Cocos2dEventDelegate(Cocos2dEvent event, Platform::String^ text); - public delegate void Cocos2dMessageBoxDelegate(Platform::String^ title, Platform::String^ text); - public delegate void Cocos2dEditBoxDelegate(Platform::String^ strPlaceHolder, Platform::String^ strText, int maxLength, int inputMode, int inputFlag, Windows::Foundation::EventHandler^ receiveHandler); - public delegate void Cocos2dOpenURLDelegate(Platform::String^ url); -} - NS_CC_BEGIN +public delegate void Cocos2dEventDelegate(Cocos2dEvent event, Platform::String^ text); +public delegate void Cocos2dMessageBoxDelegate(Platform::String^ title, Platform::String^ text); +public delegate void Cocos2dEditBoxDelegate(Platform::String^ strPlaceHolder, Platform::String^ strText, int maxLength, int inputMode, int inputFlag, Windows::Foundation::EventHandler^ receiveHandler); +public delegate void Cocos2dOpenURLDelegate(Platform::String^ url); + enum PointerEventType { PointerPressed, @@ -83,12 +79,12 @@ class CC_DLL KeyboardEvent : public InputEvent { public: - KeyboardEvent(PhoneDirect3DXamlAppComponent::Cocos2dKeyEvent type); - KeyboardEvent(PhoneDirect3DXamlAppComponent::Cocos2dKeyEvent type, Platform::String^ text); + KeyboardEvent(Cocos2dKeyEvent type); + KeyboardEvent(Cocos2dKeyEvent type, Platform::String^ text); virtual void execute(); private: - PhoneDirect3DXamlAppComponent::Cocos2dKeyEvent m_type; + Cocos2dKeyEvent m_type; Platform::Agile m_text; }; @@ -108,6 +104,19 @@ private: std::function m_fun; }; +class UIEditBoxEvent : public cocos2d::InputEvent +{ +public: + UIEditBoxEvent(Platform::Object^ sender, Platform::String^ text, Windows::Foundation::EventHandler^ handle); + + virtual void execute(); + +private: + Platform::Agile m_sender; + Platform::Agile m_text; + Platform::Agile^> m_handler; +}; + NS_CC_END #endif // #ifndef __INPUT_EVENT__ diff --git a/cocos/platform/winrt/InputEventTypes.h b/cocos/platform/winrt/InputEventTypes.h index 6d6f41bc94..a50aaff73a 100644 --- a/cocos/platform/winrt/InputEventTypes.h +++ b/cocos/platform/winrt/InputEventTypes.h @@ -27,8 +27,8 @@ THE SOFTWARE. #define __INPUT_EVENT_TYPES__ -namespace PhoneDirect3DXamlAppComponent -{ +NS_CC_BEGIN + public enum class Cocos2dEvent { @@ -46,7 +46,8 @@ public enum class Cocos2dKeyEvent : int Enter }; -} +NS_CC_END + #endif // #ifndef __INPUT_EVENT_TYPES__ diff --git a/cocos/platform/winrt/Keyboard-winrt.cpp b/cocos/platform/winrt/Keyboard-winrt.cpp new file mode 100644 index 0000000000..24c347aed9 --- /dev/null +++ b/cocos/platform/winrt/Keyboard-winrt.cpp @@ -0,0 +1,157 @@ +/**************************************************************************** +Copyright (c) 2010-2012 cocos2d-x.org +Copyright (c) 2013-2014 Chukong Technologies Inc. + +* Portions Copyright (c) Microsoft Open Technologies, Inc. +* All Rights Reserved +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 "Keyboard-winrt.h" + +using namespace cocos2d; +using namespace Platform; +using namespace Concurrency; +using namespace Windows::System; +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::Input; + +NS_CC_BEGIN + +KeyBoardWinRT::KeyBoardWinRT() +{ + +} + +KeyBoardWinRT::~KeyBoardWinRT() +{ + +} + +KeyBoardWinRT::KeyBoardWinRT(Windows::UI::Core::CoreDispatcher^ dispatcher, Windows::UI::Xaml::Controls::Panel^ panel) + : m_dispatcher(dispatcher) + , m_panel(panel) +{ + +} + +void KeyBoardWinRT::ShowKeyboard(Platform::String^ text) +{ + if (m_dispatcher.Get() && m_panel.Get()) + { + // run on main UI thread + m_dispatcher.Get()->RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, ref new DispatchedHandler([this, text]() + { + if (m_textBox == nullptr) + { + m_textBox = ref new TextBox(); + m_textBox->Opacity = 0.0; + m_textBox->Width = 1; + m_textBox->Height = 1; + m_textBox->AddHandler(UIElement::KeyDownEvent, ref new KeyEventHandler(this, &KeyBoardWinRT::OnKeyPressed), true); + m_textBox->AddHandler(UIElement::KeyUpEvent, ref new KeyEventHandler(this, &KeyBoardWinRT::OnKeyReleased), true); + m_textBox->TextChanged += ref new TextChangedEventHandler(this, &KeyBoardWinRT::OnTextChanged); +#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) + // Need to use InputScopeNameValue::Search to prevent auto-capitalize + m_textBox->InputScope = ref new InputScope(); + auto n = m_textBox->InputScope->Names; + n->Append(ref new InputScopeName(InputScopeNameValue::Search)); +#endif + m_panel.Get()->Children->Append(m_textBox); + } + m_textBox->SelectionLength = 0; + m_textBox->SelectionStart = 32768; + m_textBox->Focus(FocusState::Programmatic); + })); + } +} + +void KeyBoardWinRT::HideKeyboard(Platform::String^ text) +{ + if (m_dispatcher.Get() && m_panel.Get()) + { + // run on main UI thread + m_dispatcher.Get()->RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, ref new DispatchedHandler([this, text]() + { + if (m_textBox != nullptr) + { + unsigned int index; + if (m_panel->Children->IndexOf(m_textBox, &index)) + { + m_panel->Children->RemoveAt(index); + } + } + m_textBox = nullptr; + })); + } +} + +void KeyBoardWinRT::QueueKeyEvent(Cocos2dKeyEvent key) +{ + std::shared_ptr e(new cocos2d::KeyboardEvent(key)); + cocos2d::GLViewImpl::sharedOpenGLView()->QueueEvent(e); +} + +void KeyBoardWinRT::OnKeyPressed(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ args) +{ + switch (args->Key) + { + case VirtualKey::Escape: + QueueKeyEvent(Cocos2dKeyEvent::Escape); + args->Handled = true; + break; + case VirtualKey::Back: + QueueKeyEvent(Cocos2dKeyEvent::Back); + args->Handled = true; + break; + case VirtualKey::Enter: + QueueKeyEvent(Cocos2dKeyEvent::Enter); + args->Handled = true; + break; + default: + + break; + } +} + +void KeyBoardWinRT::OnTextChanged(Platform::Object^ sender, TextChangedEventArgs^ args) +{ + auto text = m_textBox->Text; + if (text) + { + std::shared_ptr e(new cocos2d::KeyboardEvent(Cocos2dKeyEvent::Text, text)); + cocos2d::GLViewImpl::sharedOpenGLView()->QueueEvent(e); + m_textBox->Text = L""; + } +} + + +void KeyBoardWinRT::OnKeyReleased(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ args) +{ + //m_textBox->Text = L""; +} + +NS_CC_END + diff --git a/cocos/platform/winrt/Keyboard-winrt.h b/cocos/platform/winrt/Keyboard-winrt.h new file mode 100644 index 0000000000..b12bc3ce33 --- /dev/null +++ b/cocos/platform/winrt/Keyboard-winrt.h @@ -0,0 +1,58 @@ +/**************************************************************************** +Copyright (c) 2010-2012 cocos2d-x.org +Copyright (c) 2013-2014 Chukong Technologies Inc. + +* Portions Copyright (c) Microsoft Open Technologies, Inc. +* All Rights Reserved +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 + +NS_CC_BEGIN + +ref class KeyBoardWinRT sealed +{ +public: + KeyBoardWinRT(); + virtual ~KeyBoardWinRT(); + + void ShowKeyboard(Platform::String^ text); + void HideKeyboard(Platform::String^ text); + +internal: + KeyBoardWinRT(Windows::UI::Core::CoreDispatcher^ dispatcher, Windows::UI::Xaml::Controls::Panel^ panel); + +private: + + void QueueKeyEvent(Cocos2dKeyEvent key); + void OnKeyPressed(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ args); + void OnKeyReleased(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ args); + void OnTextChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::TextChangedEventArgs^ args); + + Platform::Agile m_dispatcher; + Platform::Agile m_panel; + Windows::UI::Xaml::Controls::TextBox^ m_textBox; +}; + +NS_CC_END diff --git a/cocos/platform/wp8-xaml/cpp/Cocos2dRenderer.cpp b/cocos/platform/wp8-xaml/cpp/Cocos2dRenderer.cpp index d0d5a5f61c..c3cd6ca388 100644 --- a/cocos/platform/wp8-xaml/cpp/Cocos2dRenderer.cpp +++ b/cocos/platform/wp8-xaml/cpp/Cocos2dRenderer.cpp @@ -35,7 +35,6 @@ using namespace DirectX; using namespace Microsoft::WRL; using namespace Windows::Foundation; using namespace Windows::UI::Core; -using namespace PhoneDirect3DXamlAppComponent; USING_NS_CC; @@ -151,7 +150,7 @@ void Cocos2dRenderer::OnCocos2dKeyEvent(Cocos2dKeyEvent event) } -void Cocos2dRenderer::SetXamlEventDelegate(PhoneDirect3DXamlAppComponent::Cocos2dEventDelegate^ delegate) +void Cocos2dRenderer::SetXamlEventDelegate(Cocos2dEventDelegate^ delegate) { m_delegate = delegate; GLViewImpl* eglView = GLViewImpl::sharedOpenGLView(); @@ -161,7 +160,7 @@ void Cocos2dRenderer::SetXamlEventDelegate(PhoneDirect3DXamlAppComponent::Cocos2 } } -void Cocos2dRenderer::SetXamlMessageBoxDelegate(PhoneDirect3DXamlAppComponent::Cocos2dMessageBoxDelegate^ delegate) +void Cocos2dRenderer::SetXamlMessageBoxDelegate(Cocos2dMessageBoxDelegate^ delegate) { m_messageBoxDelegate = delegate; GLViewImpl* eglView = GLViewImpl::sharedOpenGLView(); @@ -171,7 +170,7 @@ void Cocos2dRenderer::SetXamlMessageBoxDelegate(PhoneDirect3DXamlAppComponent::C } } -void Cocos2dRenderer::SetXamlEditBoxDelegate(PhoneDirect3DXamlAppComponent::Cocos2dEditBoxDelegate^ delegate) +void Cocos2dRenderer::SetXamlEditBoxDelegate(Cocos2dEditBoxDelegate^ delegate) { m_editBoxDelegate = delegate; GLViewImpl* eglView = GLViewImpl::sharedOpenGLView(); @@ -181,7 +180,7 @@ void Cocos2dRenderer::SetXamlEditBoxDelegate(PhoneDirect3DXamlAppComponent::Coco } } -void Cocos2dRenderer::SetXamlOpenURLDelegate(PhoneDirect3DXamlAppComponent::Cocos2dOpenURLDelegate^ delegate) +void Cocos2dRenderer::SetXamlOpenURLDelegate(Cocos2dOpenURLDelegate^ delegate) { m_openURLDelegate = delegate; Application* app = Application::getInstance(); diff --git a/cocos/platform/wp8-xaml/cpp/Cocos2dRenderer.h b/cocos/platform/wp8-xaml/cpp/Cocos2dRenderer.h index 55e84b12cb..b1799312c0 100644 --- a/cocos/platform/wp8-xaml/cpp/Cocos2dRenderer.h +++ b/cocos/platform/wp8-xaml/cpp/Cocos2dRenderer.h @@ -41,11 +41,11 @@ public: void OnBackButton(); void OnKeyPressed(Platform::String^ text); - void OnCocos2dKeyEvent(PhoneDirect3DXamlAppComponent::Cocos2dKeyEvent event); - void SetXamlEventDelegate(PhoneDirect3DXamlAppComponent::Cocos2dEventDelegate^ delegate); - void SetXamlMessageBoxDelegate(PhoneDirect3DXamlAppComponent::Cocos2dMessageBoxDelegate^ delegate); - void SetXamlEditBoxDelegate(PhoneDirect3DXamlAppComponent::Cocos2dEditBoxDelegate^ delegate); - void SetXamlOpenURLDelegate(PhoneDirect3DXamlAppComponent::Cocos2dOpenURLDelegate^ delegate); + void OnCocos2dKeyEvent(cocos2d::Cocos2dKeyEvent event); + void SetXamlEventDelegate(cocos2d::Cocos2dEventDelegate^ delegate); + void SetXamlMessageBoxDelegate(cocos2d::Cocos2dMessageBoxDelegate^ delegate); + void SetXamlEditBoxDelegate(cocos2d::Cocos2dEditBoxDelegate^ delegate); + void SetXamlOpenURLDelegate(cocos2d::Cocos2dOpenURLDelegate^ delegate); Windows::Foundation::IAsyncAction^ OnSuspending(); void Connect(); @@ -59,10 +59,10 @@ private: bool m_loadingComplete; bool mInitialized; - PhoneDirect3DXamlAppComponent::Cocos2dEventDelegate^ m_delegate; - PhoneDirect3DXamlAppComponent::Cocos2dMessageBoxDelegate^ m_messageBoxDelegate; - PhoneDirect3DXamlAppComponent::Cocos2dEditBoxDelegate^ m_editBoxDelegate; - PhoneDirect3DXamlAppComponent::Cocos2dOpenURLDelegate^ m_openURLDelegate; + cocos2d::Cocos2dEventDelegate^ m_delegate; + cocos2d::Cocos2dMessageBoxDelegate^ m_messageBoxDelegate; + cocos2d::Cocos2dEditBoxDelegate^ m_editBoxDelegate; + cocos2d::Cocos2dOpenURLDelegate^ m_openURLDelegate; // The AppDelegate for the Cocos2D app AppDelegate* mApp; diff --git a/cocos/platform/wp8-xaml/cpp/Direct3DContentProvider.cpp b/cocos/platform/wp8-xaml/cpp/Direct3DContentProvider.cpp index 323d0b556d..7bfdf80366 100644 --- a/cocos/platform/wp8-xaml/cpp/Direct3DContentProvider.cpp +++ b/cocos/platform/wp8-xaml/cpp/Direct3DContentProvider.cpp @@ -26,7 +26,7 @@ THE SOFTWARE. #include "Direct3DContentProvider.h" #include "Direct3DInterop.h" -using namespace PhoneDirect3DXamlAppComponent; +using namespace cocos2d; Direct3DContentProvider::Direct3DContentProvider(Direct3DInterop^ controller) : m_controller(controller) diff --git a/cocos/platform/wp8-xaml/cpp/Direct3DContentProvider.h b/cocos/platform/wp8-xaml/cpp/Direct3DContentProvider.h index 7a9d941074..830496c1f4 100644 --- a/cocos/platform/wp8-xaml/cpp/Direct3DContentProvider.h +++ b/cocos/platform/wp8-xaml/cpp/Direct3DContentProvider.h @@ -37,7 +37,7 @@ class Direct3DContentProvider : public Microsoft::WRL::RuntimeClass< IDrawingSurfaceBackgroundContentProviderNative> { public: - Direct3DContentProvider(PhoneDirect3DXamlAppComponent::Direct3DInterop^ controller); + Direct3DContentProvider(cocos2d::Direct3DInterop^ controller); // IDrawingSurfaceContentProviderNative HRESULT STDMETHODCALLTYPE Connect(_In_ IDrawingSurfaceRuntimeHostNative* host, _In_ ID3D11Device1* device); @@ -47,6 +47,6 @@ public: HRESULT STDMETHODCALLTYPE Draw(_In_ ID3D11Device1* device, _In_ ID3D11DeviceContext1* context, _In_ ID3D11RenderTargetView* renderTargetView); private: - PhoneDirect3DXamlAppComponent::Direct3DInterop^ m_controller; + cocos2d::Direct3DInterop^ m_controller; Microsoft::WRL::ComPtr m_host; }; diff --git a/cocos/platform/wp8-xaml/cpp/Direct3DInterop.cpp b/cocos/platform/wp8-xaml/cpp/Direct3DInterop.cpp index e43b246088..53c14cdfaa 100644 --- a/cocos/platform/wp8-xaml/cpp/Direct3DInterop.cpp +++ b/cocos/platform/wp8-xaml/cpp/Direct3DInterop.cpp @@ -35,9 +35,8 @@ using namespace Windows::Phone::Graphics::Interop; using namespace Windows::Phone::Input::Interop; using namespace Windows::Graphics::Display; using namespace DirectX; -using namespace PhoneDirect3DXamlAppComponent; -namespace PhoneDirect3DXamlAppComponent +namespace cocos2d { Direct3DInterop::Direct3DInterop(Windows::Graphics::Display::DisplayOrientations orientation) diff --git a/cocos/platform/wp8-xaml/cpp/Direct3DInterop.h b/cocos/platform/wp8-xaml/cpp/Direct3DInterop.h index 6324dca1e9..ff87c60ca3 100644 --- a/cocos/platform/wp8-xaml/cpp/Direct3DInterop.h +++ b/cocos/platform/wp8-xaml/cpp/Direct3DInterop.h @@ -34,7 +34,7 @@ THE SOFTWARE. #include -namespace PhoneDirect3DXamlAppComponent +namespace cocos2d { public delegate void RequestAdditionalFrameHandler(); diff --git a/cocos/platform/wp8-xaml/cpp/EditBoxEvent.cpp b/cocos/platform/wp8-xaml/cpp/EditBoxEvent.cpp index 992dfe2d60..8837b68be9 100644 --- a/cocos/platform/wp8-xaml/cpp/EditBoxEvent.cpp +++ b/cocos/platform/wp8-xaml/cpp/EditBoxEvent.cpp @@ -26,9 +26,9 @@ THE SOFTWARE. using namespace Platform; -namespace PhoneDirect3DXamlAppComponent +namespace cocos2d { - EditBoxEvent::EditBoxEvent( Object^ sender, Platform::String^ arg, Windows::Foundation::EventHandler^ handle ): + EditBoxEvent::EditBoxEvent( Platform::Object^ sender, Platform::String^ arg, Windows::Foundation::EventHandler^ handle ): m_sender(sender), m_args(arg), m_handler(handle) diff --git a/cocos/platform/wp8-xaml/cpp/EditBoxEvent.h b/cocos/platform/wp8-xaml/cpp/EditBoxEvent.h index e9a7105baf..ddf206e034 100644 --- a/cocos/platform/wp8-xaml/cpp/EditBoxEvent.h +++ b/cocos/platform/wp8-xaml/cpp/EditBoxEvent.h @@ -29,7 +29,7 @@ THE SOFTWARE. #include -namespace PhoneDirect3DXamlAppComponent +namespace cocos2d { class EditBoxEvent : public cocos2d::InputEvent { diff --git a/cocos/platform/wp8-xaml/xaml/App.xaml b/cocos/platform/wp8-xaml/xaml/App.xaml index 02706a5450..4e5975de2a 100644 --- a/cocos/platform/wp8-xaml/xaml/App.xaml +++ b/cocos/platform/wp8-xaml/xaml/App.xaml @@ -1,5 +1,5 @@  - + diff --git a/cocos/platform/wp8-xaml/xaml/App.xaml.cs b/cocos/platform/wp8-xaml/xaml/App.xaml.cs index c97119aec5..3553e5f82f 100644 --- a/cocos/platform/wp8-xaml/xaml/App.xaml.cs +++ b/cocos/platform/wp8-xaml/xaml/App.xaml.cs @@ -7,9 +7,8 @@ using System.Windows.Navigation; using Microsoft.Phone.Controls; using Microsoft.Phone.Shell; using System.IO.IsolatedStorage; -using PhoneDirect3DXamlAppInterop.Resources; -namespace PhoneDirect3DXamlAppInterop +namespace cocos2d { public partial class App : Application { diff --git a/cocos/platform/wp8-xaml/xaml/EditBox.xaml b/cocos/platform/wp8-xaml/xaml/EditBox.xaml index 8a179c3ab4..a1259d3268 100644 --- a/cocos/platform/wp8-xaml/xaml/EditBox.xaml +++ b/cocos/platform/wp8-xaml/xaml/EditBox.xaml @@ -1,4 +1,4 @@ - 0) + { + m_d3dInterop.OnCocos2dKeyEvent(Cocos2dKeyEvent.Text, m_textBox.Text); + m_textBox.Text = ""; + } } // Called by the Cocos2d-x C++ engine to display a MessageBox @@ -181,7 +182,6 @@ namespace PhoneDirect3DXamlAppInterop m_textBox.TextChanged += OnTextChanged; DrawingSurfaceBackground.Children.Add(m_textBox); } - m_textBox.Text = text; m_textBox.SelectionLength = 0; m_textBox.SelectionStart = int.MaxValue; m_textBox.Focus(); diff --git a/cocos/platform/wp8/CCGLViewImpl-wp8.cpp b/cocos/platform/wp8/CCGLViewImpl-wp8.cpp index 1f4ef9d887..3f77cc1f73 100644 --- a/cocos/platform/wp8/CCGLViewImpl-wp8.cpp +++ b/cocos/platform/wp8/CCGLViewImpl-wp8.cpp @@ -49,7 +49,6 @@ using namespace Windows::ApplicationModel::Activation; using namespace Windows::Phone::UI::Core; using namespace Platform; using namespace Microsoft::WRL; -using namespace PhoneDirect3DXamlAppComponent; NS_CC_BEGIN diff --git a/cocos/platform/wp8/CCGLViewImpl-wp8.h b/cocos/platform/wp8/CCGLViewImpl-wp8.h index 706bbd7e3a..e48c9ce21d 100644 --- a/cocos/platform/wp8/CCGLViewImpl-wp8.h +++ b/cocos/platform/wp8/CCGLViewImpl-wp8.h @@ -95,9 +95,9 @@ public: void QueuePointerEvent(PointerEventType type, Windows::UI::Core::PointerEventArgs^ args); void GLViewImpl::QueueEvent(std::shared_ptr& event); - void SetXamlEventDelegate(PhoneDirect3DXamlAppComponent::Cocos2dEventDelegate^ delegate) { m_delegate = delegate; }; - void SetXamlMessageBoxDelegate(PhoneDirect3DXamlAppComponent::Cocos2dMessageBoxDelegate^ delegate) { m_messageBoxDelegate = delegate; }; - void SetXamlEditBoxDelegate(PhoneDirect3DXamlAppComponent::Cocos2dEditBoxDelegate^ delegate) { m_editBoxDelegate = delegate; }; + void SetXamlEventDelegate(Cocos2dEventDelegate^ delegate) { m_delegate = delegate; }; + void SetXamlMessageBoxDelegate(Cocos2dMessageBoxDelegate^ delegate) { m_messageBoxDelegate = delegate; }; + void SetXamlEditBoxDelegate(Cocos2dEditBoxDelegate^ delegate) { m_editBoxDelegate = delegate; }; bool ShowMessageBox(Platform::String^ title, Platform::String^ message); bool OpenXamlEditBox(Platform::String^ strPlaceHolder, Platform::String^ strText, int maxLength, int inputMode, int inputFlag, Windows::Foundation::EventHandler^ receiveHandler); @@ -178,9 +178,9 @@ private: EGLDisplay m_eglDisplay; EGLContext m_eglContext; EGLSurface m_eglSurface; - PhoneDirect3DXamlAppComponent::Cocos2dEventDelegate^ m_delegate; - PhoneDirect3DXamlAppComponent::Cocos2dMessageBoxDelegate^ m_messageBoxDelegate; - PhoneDirect3DXamlAppComponent::Cocos2dEditBoxDelegate^ m_editBoxDelegate; + Cocos2dEventDelegate^ m_delegate; + Cocos2dMessageBoxDelegate^ m_messageBoxDelegate; + Cocos2dEditBoxDelegate^ m_editBoxDelegate; std::queue> mInputEvents; std::mutex mMutex; diff --git a/cocos/platform/wp8/shaders/precompiledshaders.h b/cocos/platform/wp8/shaders/precompiledshaders.h index a0a02c61c8..d93c40f9cf 100644 --- a/cocos/platform/wp8/shaders/precompiledshaders.h +++ b/cocos/platform/wp8/shaders/precompiledshaders.h @@ -69,7 +69,7 @@ const unsigned char s_133478C5A874C1E6F59B418CE6C7C39F1AE0F873[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 0, 92, 139, 0, 0, -242, 141, 0, 0, 12, 0, 0, 0, +241, 141, 0, 0, 12, 0, 0, 0, 67, 67, 95, 77, 86, 80, 77, 97, 116, 114, 105, 120, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, @@ -86,7 +86,7 @@ const unsigned char s_133478C5A874C1E6F59B418CE6C7C39F1AE0F873[] = { 120, 116, 117, 114, 101, 48, 0, 0, 0, 0, 1, 0, 0, 0, 248, 3, 0, 0, 4, 5, 0, 0, 0, 0, - 0, 0, 63, 88, 0, 0, 0, 0, + 0, 0, 182, 139, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 11, 95, 74, 206, 145, 124, 32, 219, 67, 19, @@ -447,7 +447,7 @@ const unsigned char s_13E33F532157A58EC77EDE3B3112560A89D272B2[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 92, 139, 0, 0, -242, 141, 0, 0, 10, 0, 0, 0, +241, 141, 0, 0, 10, 0, 0, 0, 67, 67, 95, 80, 77, 97, 116, 114, 105, 120, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 4, 0, @@ -456,7 +456,7 @@ const unsigned char s_13E33F532157A58EC77EDE3B3112560A89D272B2[] = { 116, 114, 105, 120, 0, 0, 0, 0, 0, 0, 0, 0, 204, 2, 0, 0, 164, 4, 0, 0, 0, 0, 0, 0, - 63, 88, 0, 0, 0, 0, 0, 0, +182, 139, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 127, 145, 81, 72, 216, 190, 16, 61, 245, 231, 235, 249, @@ -767,7 +767,7 @@ const unsigned char s_1A69A7CC77C7C8FC62799B0513816EA41FBF3BFE[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 4, 0, 0, 0, 92, 139, 0, 0, -242, 141, 0, 0, 12, 0, 0, 0, +241, 141, 0, 0, 12, 0, 0, 0, 67, 67, 95, 77, 86, 80, 77, 97, 116, 114, 105, 120, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, @@ -800,7 +800,7 @@ const unsigned char s_1A69A7CC77C7C8FC62799B0513816EA41FBF3BFE[] = { 116, 67, 111, 108, 111, 114, 0, 0, 0, 0, 3, 0, 0, 0, 208, 7, 0, 0, 4, 5, 0, 0, 0, 0, - 0, 0, 63, 88, 0, 0, 0, 0, + 0, 0, 182, 139, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 65, 106, 69, 173, 111, 248, 97, 165, 186, 90, @@ -1284,28 +1284,28 @@ const unsigned char s_2CF9793879165058483EFB4AD6FA9746ECD7DD2A[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 17, 0, 0, 0, 92, 139, 0, - 0, 242, 141, 0, 0, 11, 0, 0, + 0, 241, 141, 0, 0, 11, 0, 0, 0, 67, 67, 95, 77, 86, 77, 97, 116, 114, 105, 120, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 4, 0, 0, 0, 91, 139, 0, 0, -242, 141, 0, 0, 15, 0, 0, 0, +241, 141, 0, 0, 15, 0, 0, 0, 67, 67, 95, 78, 111, 114, 109, 97, 108, 77, 97, 116, 114, 105, 120, 0, 0, 0, 0, 255, 255, 255, 255, 4, 0, 0, 0, 3, 0, 0, 0, 92, -139, 0, 0, 242, 141, 0, 0, 10, +139, 0, 0, 241, 141, 0, 0, 10, 0, 0, 0, 67, 67, 95, 80, 77, 97, 116, 114, 105, 120, 0, 0, 0, 0, 255, 255, 255, 255, 7, 0, 0, 0, 4, 0, 0, 0, 81, 139, 0, - 0, 242, 141, 0, 0, 26, 0, 0, + 0, 241, 141, 0, 0, 26, 0, 0, 0, 117, 95, 80, 111, 105, 110, 116, 76, 105, 103, 104, 116, 83, 111, 117, 114, 99, 101, 80, 111, 115, 105, 116, 105, 111, 110, 1, 0, 0, 0, 255, 255, 255, 255, 11, 0, 0, 0, 1, - 0, 0, 0, 81, 139, 0, 0, 242, + 0, 0, 0, 81, 139, 0, 0, 241, 141, 0, 0, 25, 0, 0, 0, 117, 95, 83, 112, 111, 116, 76, 105, 103, 104, 116, 83, 111, 117, 114, 99, 101, @@ -1462,7 +1462,7 @@ const unsigned char s_2CF9793879165058483EFB4AD6FA9746ECD7DD2A[] = { 99, 111, 108, 111, 114, 0, 0, 0, 0, 16, 0, 0, 0, 236, 16, 0, 0, 124, 10, 0, 0, 0, 0, 0, - 0, 63, 88, 0, 0, 0, 0, 0, + 0, 182, 139, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 39, 224, 169, 185, 116, 156, 41, 157, 187, 9, 222, @@ -2413,7 +2413,7 @@ const unsigned char s_53938AB67AD93ABA0DDB87F3C9889304284E011E[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 0, 92, 139, 0, 0, -242, 141, 0, 0, 12, 0, 0, 0, +241, 141, 0, 0, 12, 0, 0, 0, 67, 67, 95, 77, 86, 80, 77, 97, 116, 114, 105, 120, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, @@ -2430,7 +2430,7 @@ const unsigned char s_53938AB67AD93ABA0DDB87F3C9889304284E011E[] = { 120, 116, 117, 114, 101, 48, 0, 0, 0, 0, 1, 0, 0, 0, 24, 4, 0, 0, 4, 5, 0, 0, 0, 0, - 0, 0, 63, 88, 0, 0, 0, 0, + 0, 0, 182, 139, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 200, 5, 103, 205, 248, 30, 69, 65, 32, 117, @@ -2795,7 +2795,7 @@ const unsigned char s_67837675F2BB48C0E926316F505FC1538228E0FA[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 92, 139, 0, 0, -242, 141, 0, 0, 12, 0, 0, 0, +241, 141, 0, 0, 12, 0, 0, 0, 67, 67, 95, 77, 86, 80, 77, 97, 116, 114, 105, 120, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, @@ -2804,7 +2804,7 @@ const unsigned char s_67837675F2BB48C0E926316F505FC1538228E0FA[] = { 86, 80, 77, 97, 116, 114, 105, 120, 0, 0, 0, 0, 0, 0, 0, 0, 16, 4, 0, 0, 48, 5, 0, 0, - 0, 0, 0, 0, 63, 88, 0, 0, + 0, 0, 0, 0, 182, 139, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 79, 226, 72, 124, 94, 252, 37, 157, @@ -3177,35 +3177,35 @@ const unsigned char s_77D0755E06AA7AF59FAA6B003CA2363EDEB25C4C[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 18, 0, 0, 0, 92, 139, - 0, 0, 242, 141, 0, 0, 11, 0, + 0, 0, 241, 141, 0, 0, 11, 0, 0, 0, 67, 67, 95, 77, 86, 77, 97, 116, 114, 105, 120, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 4, 0, 0, 0, 91, 139, 0, - 0, 242, 141, 0, 0, 15, 0, 0, + 0, 241, 141, 0, 0, 15, 0, 0, 0, 67, 67, 95, 78, 111, 114, 109, 97, 108, 77, 97, 116, 114, 105, 120, 0, 0, 0, 0, 255, 255, 255, 255, 4, 0, 0, 0, 3, 0, 0, 0, - 92, 139, 0, 0, 242, 141, 0, 0, + 92, 139, 0, 0, 241, 141, 0, 0, 10, 0, 0, 0, 67, 67, 95, 80, 77, 97, 116, 114, 105, 120, 0, 0, 0, 0, 255, 255, 255, 255, 7, 0, 0, 0, 4, 0, 0, 0, 81, 139, - 0, 0, 242, 141, 0, 0, 26, 0, + 0, 0, 241, 141, 0, 0, 26, 0, 0, 0, 117, 95, 80, 111, 105, 110, 116, 76, 105, 103, 104, 116, 83, 111, 117, 114, 99, 101, 80, 111, 115, 105, 116, 105, 111, 110, 1, 0, 0, 0, 255, 255, 255, 255, 11, 0, 0, 0, 1, 0, 0, 0, 81, 139, 0, 0, -242, 141, 0, 0, 25, 0, 0, 0, +241, 141, 0, 0, 25, 0, 0, 0, 117, 95, 83, 112, 111, 116, 76, 105, 103, 104, 116, 83, 111, 117, 114, 99, 101, 80, 111, 115, 105, 116, 105, 111, 110, 1, 0, 0, 0, 255, 255, 255, 255, 12, 0, 0, 0, 1, 0, 0, - 0, 82, 139, 0, 0, 242, 141, 0, + 0, 82, 139, 0, 0, 241, 141, 0, 0, 15, 0, 0, 0, 117, 95, 109, 97, 116, 114, 105, 120, 80, 97, 108, 101, 116, 116, 101, 180, 0, 0, 0, @@ -3968,7 +3968,7 @@ const unsigned char s_77D0755E06AA7AF59FAA6B003CA2363EDEB25C4C[] = { 99, 111, 108, 111, 114, 0, 0, 0, 0, 17, 0, 0, 0, 236, 16, 0, 0, 232, 19, 0, 0, 0, 0, 0, - 0, 63, 88, 0, 0, 0, 0, 0, + 0, 182, 139, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 39, 224, 169, 185, 116, 156, 41, 157, 187, 9, 222, @@ -5220,7 +5220,7 @@ const unsigned char s_78250E25D1929D4A842050738140787BE42541C6[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 3, 0, 0, 0, 92, 139, 0, 0, -242, 141, 0, 0, 12, 0, 0, 0, +241, 141, 0, 0, 12, 0, 0, 0, 67, 67, 95, 77, 86, 80, 77, 97, 116, 114, 105, 120, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, @@ -5245,7 +5245,7 @@ const unsigned char s_78250E25D1929D4A842050738140787BE42541C6[] = { 108, 112, 104, 97, 95, 118, 97, 108, 117, 101, 0, 0, 0, 0, 2, 0, 0, 0, 36, 5, 0, 0, 4, 5, - 0, 0, 0, 0, 0, 0, 63, 88, + 0, 0, 0, 0, 0, 0, 182, 139, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 100, 113, 175, 29, 164, 71, @@ -5644,7 +5644,7 @@ const unsigned char s_7B67DD242152D35ACC079265FAD9D03DC98182DE[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 0, 92, 139, 0, 0, -242, 141, 0, 0, 10, 0, 0, 0, +241, 141, 0, 0, 10, 0, 0, 0, 67, 67, 95, 80, 77, 97, 116, 114, 105, 120, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 4, 0, @@ -5660,7 +5660,7 @@ const unsigned char s_7B67DD242152D35ACC079265FAD9D03DC98182DE[] = { 67, 95, 84, 101, 120, 116, 117, 114, 101, 48, 0, 0, 0, 0, 1, 0, 0, 0, 248, 3, 0, 0, 0, 5, - 0, 0, 0, 0, 0, 0, 63, 88, + 0, 0, 0, 0, 0, 0, 182, 139, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 11, 95, 74, 206, 145, 124, @@ -6020,7 +6020,7 @@ const unsigned char s_7CE5EE84ACB6110F7FA29152ECE3344CB6D6620D[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 3, 0, 0, 0, 92, 139, 0, - 0, 242, 141, 0, 0, 12, 0, 0, + 0, 241, 141, 0, 0, 12, 0, 0, 0, 67, 67, 95, 77, 86, 80, 77, 97, 116, 114, 105, 120, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, @@ -6044,7 +6044,7 @@ const unsigned char s_7CE5EE84ACB6110F7FA29152ECE3344CB6D6620D[] = { 99, 111, 108, 111, 114, 0, 0, 0, 0, 2, 0, 0, 0, 96, 4, 0, 0, 192, 4, 0, 0, 0, 0, 0, - 0, 63, 88, 0, 0, 0, 0, 0, + 0, 182, 139, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 157, 116, 105, 89, 118, 135, 249, 239, 42, 226, 184, @@ -6409,7 +6409,7 @@ const unsigned char s_7E1EEF397305D0BC2DCDBA4F2DAFBCBA1534E45C[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 92, 139, 0, - 0, 242, 141, 0, 0, 12, 0, 0, + 0, 241, 141, 0, 0, 12, 0, 0, 0, 67, 67, 95, 77, 86, 80, 77, 97, 116, 114, 105, 120, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, @@ -6425,7 +6425,7 @@ const unsigned char s_7E1EEF397305D0BC2DCDBA4F2DAFBCBA1534E45C[] = { 117, 95, 99, 111, 108, 111, 114, 0, 0, 0, 0, 1, 0, 0, 0, 52, 3, 0, 0, 40, 4, 0, 0, 0, - 0, 0, 0, 63, 88, 0, 0, 0, + 0, 0, 0, 182, 139, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 153, 8, 62, 201, 202, 170, 111, 182, 149, @@ -6734,7 +6734,7 @@ const unsigned char s_847DBFDDA6EC09C57E4ED43012AE2FB5CAC7D8D5[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 3, 0, 0, 0, 92, 139, 0, 0, -242, 141, 0, 0, 12, 0, 0, 0, +241, 141, 0, 0, 12, 0, 0, 0, 67, 67, 95, 77, 86, 80, 77, 97, 116, 114, 105, 120, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, @@ -6759,7 +6759,7 @@ const unsigned char s_847DBFDDA6EC09C57E4ED43012AE2FB5CAC7D8D5[] = { 111, 108, 111, 114, 0, 0, 0, 0, 2, 0, 0, 0, 240, 4, 0, 0, 4, 5, 0, 0, 0, 0, 0, 0, - 63, 88, 0, 0, 0, 0, 0, 0, +182, 139, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 134, 66, 128, 226, 107, 172, 247, 161, 241, 207, 89, 240, @@ -7151,7 +7151,7 @@ const unsigned char s_92BE325B516F887D2C928EDE20ADF428DB01C038[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 3, 0, 0, 0, 92, 139, 0, 0, -242, 141, 0, 0, 10, 0, 0, 0, +241, 141, 0, 0, 10, 0, 0, 0, 67, 67, 95, 80, 77, 97, 116, 114, 105, 120, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 4, 0, @@ -7176,7 +7176,7 @@ const unsigned char s_92BE325B516F887D2C928EDE20ADF428DB01C038[] = { 95, 118, 97, 108, 117, 101, 0, 0, 0, 0, 2, 0, 0, 0, 36, 5, 0, 0, 0, 5, 0, 0, 0, 0, - 0, 0, 63, 88, 0, 0, 0, 0, + 0, 0, 182, 139, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 100, 113, 175, 29, 164, 71, 177, 78, 120, 99, @@ -7574,28 +7574,28 @@ const unsigned char s_93D31E1668075AE4941C53441D7A9D0DE8F76331[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 92, 139, 0, - 0, 242, 141, 0, 0, 11, 0, 0, + 0, 241, 141, 0, 0, 11, 0, 0, 0, 67, 67, 95, 77, 86, 77, 97, 116, 114, 105, 120, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 4, 0, 0, 0, 91, 139, 0, 0, -242, 141, 0, 0, 15, 0, 0, 0, +241, 141, 0, 0, 15, 0, 0, 0, 67, 67, 95, 78, 111, 114, 109, 97, 108, 77, 97, 116, 114, 105, 120, 0, 0, 0, 0, 255, 255, 255, 255, 4, 0, 0, 0, 3, 0, 0, 0, 92, -139, 0, 0, 242, 141, 0, 0, 10, +139, 0, 0, 241, 141, 0, 0, 10, 0, 0, 0, 67, 67, 95, 80, 77, 97, 116, 114, 105, 120, 0, 0, 0, 0, 255, 255, 255, 255, 7, 0, 0, 0, 4, 0, 0, 0, 81, 139, 0, - 0, 242, 141, 0, 0, 26, 0, 0, + 0, 241, 141, 0, 0, 26, 0, 0, 0, 117, 95, 80, 111, 105, 110, 116, 76, 105, 103, 104, 116, 83, 111, 117, 114, 99, 101, 80, 111, 115, 105, 116, 105, 111, 110, 1, 0, 0, 0, 255, 255, 255, 255, 11, 0, 0, 0, 1, - 0, 0, 0, 81, 139, 0, 0, 242, + 0, 0, 0, 81, 139, 0, 0, 241, 141, 0, 0, 25, 0, 0, 0, 117, 95, 83, 112, 111, 116, 76, 105, 103, 104, 116, 83, 111, 117, 114, 99, 101, @@ -7744,7 +7744,7 @@ const unsigned char s_93D31E1668075AE4941C53441D7A9D0DE8F76331[] = { 117, 95, 99, 111, 108, 111, 114, 0, 0, 0, 0, 15, 0, 0, 0, 200, 15, 0, 0, 216, 9, 0, 0, 0, - 0, 0, 0, 63, 88, 0, 0, 0, + 0, 0, 0, 182, 139, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 136, 158, 207, 210, 174, 144, 71, 116, 248, @@ -8640,12 +8640,12 @@ const unsigned char s_A130FCE93CA2E5D68468367D88D1D7BE357912E5[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 4, 0, 0, 0, 92, 139, - 0, 0, 242, 141, 0, 0, 12, 0, + 0, 0, 241, 141, 0, 0, 12, 0, 0, 0, 67, 67, 95, 77, 86, 80, 77, 97, 116, 114, 105, 120, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 4, 0, 0, 0, 82, 139, - 0, 0, 242, 141, 0, 0, 15, 0, + 0, 0, 241, 141, 0, 0, 15, 0, 0, 0, 117, 95, 109, 97, 116, 114, 105, 120, 80, 97, 108, 101, 116, 116, 101, 180, 0, 0, 0, 255, 255, 255, @@ -9277,7 +9277,7 @@ const unsigned char s_A130FCE93CA2E5D68468367D88D1D7BE357912E5[] = { 99, 111, 108, 111, 114, 0, 0, 0, 0, 3, 0, 0, 0, 96, 4, 0, 0, 192, 13, 0, 0, 0, 0, 0, - 0, 63, 88, 0, 0, 0, 0, 0, + 0, 182, 139, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 157, 116, 105, 89, 118, 135, 249, 239, 42, 226, 184, @@ -9930,7 +9930,7 @@ const unsigned char s_A2377A827972A5466DA8637681045D32DA8A817D[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 3, 0, 0, 0, 92, 139, 0, - 0, 242, 141, 0, 0, 12, 0, 0, + 0, 241, 141, 0, 0, 12, 0, 0, 0, 67, 67, 95, 77, 86, 80, 77, 97, 116, 114, 105, 120, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, @@ -9954,7 +9954,7 @@ const unsigned char s_A2377A827972A5466DA8637681045D32DA8A817D[] = { 99, 111, 108, 111, 114, 0, 0, 0, 0, 2, 0, 0, 0, 96, 4, 0, 0, 144, 4, 0, 0, 0, 0, 0, - 0, 63, 88, 0, 0, 0, 0, 0, + 0, 182, 139, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 157, 116, 105, 89, 118, 135, 249, 239, 42, 226, 184, @@ -10314,7 +10314,7 @@ const unsigned char s_B5E27B4F3CF7236633255B28CBA530D6EE5CED86[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 3, 0, 0, 0, 92, 139, 0, 0, -242, 141, 0, 0, 12, 0, 0, 0, +241, 141, 0, 0, 12, 0, 0, 0, 67, 67, 95, 77, 86, 80, 77, 97, 116, 114, 105, 120, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, @@ -10339,7 +10339,7 @@ const unsigned char s_B5E27B4F3CF7236633255B28CBA530D6EE5CED86[] = { 111, 108, 111, 114, 0, 0, 0, 0, 2, 0, 0, 0, 240, 5, 0, 0, 4, 5, 0, 0, 0, 0, 0, 0, - 63, 88, 0, 0, 0, 0, 0, 0, +182, 139, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 223, 173, 203, 80, 172, 13, 170, 215, 168, 128, 228, 5, @@ -10761,7 +10761,7 @@ const unsigned char s_E2C7CE1244DE9C76688EFA9463B2A130B6A08893[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 92, 139, 0, 0, 242, 141, + 0, 0, 92, 139, 0, 0, 241, 141, 0, 0, 12, 0, 0, 0, 67, 67, 95, 77, 86, 80, 77, 97, 116, 114, 105, 120, 0, 0, 0, 0, 255, 255, @@ -10771,7 +10771,7 @@ const unsigned char s_E2C7CE1244DE9C76688EFA9463B2A130B6A08893[] = { 77, 97, 116, 114, 105, 120, 0, 0, 0, 0, 0, 0, 0, 0, 204, 2, 0, 0, 144, 4, 0, 0, 0, 0, - 0, 0, 63, 88, 0, 0, 0, 0, + 0, 0, 182, 139, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 127, 145, 81, 72, 216, 190, 16, 61, 245, 231, @@ -11077,17 +11077,17 @@ const unsigned char s_E2D56227712263272BD5218FEA117CD06180F81B[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, - 0, 0, 0, 92, 139, 0, 0, 242, + 0, 0, 0, 92, 139, 0, 0, 241, 141, 0, 0, 12, 0, 0, 0, 67, 67, 95, 77, 86, 80, 77, 97, 116, 114, 105, 120, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 4, - 0, 0, 0, 82, 139, 0, 0, 242, + 0, 0, 0, 82, 139, 0, 0, 241, 141, 0, 0, 7, 0, 0, 0, 117, 95, 99, 111, 108, 111, 114, 0, 0, 0, 0, 255, 255, 255, 255, 4, 0, 0, 0, 1, 0, 0, 0, 6, 20, - 0, 0, 242, 141, 0, 0, 11, 0, + 0, 0, 241, 141, 0, 0, 11, 0, 0, 0, 117, 95, 112, 111, 105, 110, 116, 83, 105, 122, 101, 0, 0, 0, 0, 255, 255, 255, 255, 5, 0, 0, @@ -11101,8 +11101,8 @@ const unsigned char s_E2D56227712263272BD5218FEA117CD06180F81B[] = { 117, 95, 112, 111, 105, 110, 116, 83, 105, 122, 101, 0, 0, 0, 0, 2, 0, 0, 0, 204, 2, 0, 0, 208, - 4, 0, 0, 0, 0, 0, 0, 63, - 88, 0, 0, 0, 0, 0, 0, 0, + 4, 0, 0, 0, 0, 0, 0, 182, +139, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 127, 145, 81, 72, 216, 190, 16, 61, 245, 231, 235, 249, 125, @@ -11419,7 +11419,7 @@ const unsigned char s_F46558C274182079784898CF4968CF431593D5E2[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 4, 0, 0, 0, 92, 139, 0, 0, -242, 141, 0, 0, 12, 0, 0, 0, +241, 141, 0, 0, 12, 0, 0, 0, 67, 67, 95, 77, 86, 80, 77, 97, 116, 114, 105, 120, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, @@ -11452,7 +11452,7 @@ const unsigned char s_F46558C274182079784898CF4968CF431593D5E2[] = { 116, 67, 111, 108, 111, 114, 0, 0, 0, 0, 3, 0, 0, 0, 108, 6, 0, 0, 4, 5, 0, 0, 0, 0, - 0, 0, 63, 88, 0, 0, 0, 0, + 0, 0, 182, 139, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 47, 220, 115, 183, 137, 174, 141, 96, 204, 60, @@ -11891,7 +11891,7 @@ const unsigned char s_F6BA4519AF2653A53D57FB5D5508F0D8617105D6[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 0, 92, 139, 0, - 0, 242, 141, 0, 0, 12, 0, 0, + 0, 241, 141, 0, 0, 12, 0, 0, 0, 67, 67, 95, 77, 86, 80, 77, 97, 116, 114, 105, 120, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, @@ -11908,7 +11908,7 @@ const unsigned char s_F6BA4519AF2653A53D57FB5D5508F0D8617105D6[] = { 101, 120, 116, 117, 114, 101, 48, 0, 0, 0, 0, 1, 0, 0, 0, 156, 3, 0, 0, 144, 4, 0, 0, 0, - 0, 0, 0, 63, 88, 0, 0, 0, + 0, 0, 0, 182, 139, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 203, 117, 183, 110, 154, 52, 220, 70, 125, diff --git a/cocos/renderer/CCGLProgram.cpp b/cocos/renderer/CCGLProgram.cpp index e484aceea4..6aa05848ca 100644 --- a/cocos/renderer/CCGLProgram.cpp +++ b/cocos/renderer/CCGLProgram.cpp @@ -45,13 +45,6 @@ THE SOFTWARE. NS_CC_BEGIN -typedef struct _hashUniformEntry -{ - GLvoid* value; // value - unsigned int location; // Key - UT_hash_handle hh; // hash entry -} tHashUniformEntry; - const char* GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR = "ShaderPositionTextureColor"; const char* GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP = "ShaderPositionTextureColor_noMVP"; const char* GLProgram::SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST = "ShaderPositionTextureColorAlphaTest"; @@ -136,7 +129,6 @@ GLProgram::GLProgram() : _program(0) , _vertShader(0) , _fragShader(0) -, _hashForUniforms(nullptr) , _flags() { memset(_builtInUniforms, 0, sizeof(_builtInUniforms)); @@ -163,15 +155,11 @@ GLProgram::~GLProgram() GL::deleteProgram(_program); } - tHashUniformEntry *current_element, *tmp; - - // Purge uniform hash - HASH_ITER(hh, _hashForUniforms, current_element, tmp) + for (auto e : _hashForUniforms) { - HASH_DEL(_hashForUniforms, current_element); - free(current_element->value); - free(current_element); + free(e.second); } + _hashForUniforms.clear(); } bool GLProgram::initWithByteArrays(const GLchar* vShaderByteArray, const GLchar* fShaderByteArray) @@ -222,7 +210,8 @@ bool GLProgram::initWithByteArrays(const GLchar* vShaderByteArray, const GLchar* { glAttachShader(_program, _fragShader); } - _hashForUniforms = nullptr; + + _hashForUniforms.clear(); CHECK_GL_ERROR_DEBUG(); @@ -260,7 +249,7 @@ bool GLProgram::initWithPrecompiledProgramByteArray(const GLchar* vShaderByteArr haveProgram = CCPrecompiledShaders::getInstance()->loadProgram(_program, vShaderByteArray, fShaderByteArray); CHECK_GL_ERROR_DEBUG(); - _hashForUniforms = nullptr; + _hashForUniforms.clear(); CHECK_GL_ERROR_DEBUG(); @@ -418,7 +407,9 @@ bool GLProgram::compileShader(GLuint * shader, GLenum type, const GLchar* source } const GLchar *sources[] = { -#if (CC_TARGET_PLATFORM != CC_PLATFORM_WIN32 && CC_TARGET_PLATFORM != CC_PLATFORM_LINUX && CC_TARGET_PLATFORM != CC_PLATFORM_MAC) +#if CC_TARGET_PLATFORM == CC_PLATFORM_WINRT + (type == GL_VERTEX_SHADER ? "precision mediump float;\n precision mediump int;\n" : "precision mediump float;\n precision mediump int;\n"), +#elif (CC_TARGET_PLATFORM != CC_PLATFORM_WIN32 && CC_TARGET_PLATFORM != CC_PLATFORM_LINUX && CC_TARGET_PLATFORM != CC_PLATFORM_MAC) (type == GL_VERTEX_SHADER ? "precision highp float;\n precision highp int;\n" : "precision mediump float;\n precision mediump int;\n"), #endif "uniform mat4 CC_PMatrix;\n" @@ -562,7 +553,7 @@ bool GLProgram::link() _vertShader = _fragShader = 0; -#if DEBUG || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) +#if DEBUG || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) glGetProgramiv(_program, GL_LINK_STATUS, &status); if (status == GL_FALSE) @@ -631,31 +622,23 @@ bool GLProgram::updateUniformLocation(GLint location, const GLvoid* data, unsign } bool updated = true; - tHashUniformEntry *element = nullptr; - HASH_FIND_INT(_hashForUniforms, &location, element); - - if (! element) + + auto element = _hashForUniforms.find(location); + if (element == _hashForUniforms.end()) { - element = (tHashUniformEntry*)malloc( sizeof(*element) ); - - // key - element->location = location; - - // value - element->value = malloc( bytes ); - memcpy(element->value, data, bytes ); - - HASH_ADD_INT(_hashForUniforms, location, element); + GLvoid* value = malloc(bytes); + memcpy(value, data, bytes ); + _hashForUniforms.insert(std::make_pair(location, value)); } else { - if (memcmp(element->value, data, bytes) == 0) + if (memcmp(element->second, data, bytes) == 0) { updated = false; } else { - memcpy(element->value, data, bytes); + memcpy(element->second, data, bytes); } } @@ -921,17 +904,12 @@ void GLProgram::reset() //GL::deleteProgram(_program); _program = 0; - - tHashUniformEntry *current_element, *tmp; - - // Purge uniform hash - HASH_ITER(hh, _hashForUniforms, current_element, tmp) + for (auto e: _hashForUniforms) { - HASH_DEL(_hashForUniforms, current_element); - free(current_element->value); - free(current_element); + free(e.second); } - _hashForUniforms = nullptr; + + _hashForUniforms.clear(); } NS_CC_END diff --git a/cocos/renderer/CCGLProgram.h b/cocos/renderer/CCGLProgram.h index fcb7670829..5f422722ad 100644 --- a/cocos/renderer/CCGLProgram.h +++ b/cocos/renderer/CCGLProgram.h @@ -45,7 +45,6 @@ NS_CC_BEGIN * @{ */ -struct _hashUniformEntry; class GLProgram; typedef void (*GLInfoFunction)(GLuint program, GLenum pname, GLint* params); @@ -340,7 +339,6 @@ protected: GLuint _vertShader; GLuint _fragShader; GLint _builtInUniforms[UNIFORM_MAX]; - struct _hashUniformEntry* _hashForUniforms; bool _hasShaderCompiler; #if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || defined(WP8_SHADER_COMPILER) @@ -360,6 +358,7 @@ protected: std::unordered_map _userUniforms; std::unordered_map _vertexAttribs; + std::unordered_map _hashForUniforms; }; NS_CC_END diff --git a/cocos/renderer/CCGLProgramCache.cpp b/cocos/renderer/CCGLProgramCache.cpp index b81f00975c..defb6080bb 100644 --- a/cocos/renderer/CCGLProgramCache.cpp +++ b/cocos/renderer/CCGLProgramCache.cpp @@ -432,9 +432,16 @@ GLProgram* GLProgramCache::getGLProgram(const std::string &key) void GLProgramCache::addGLProgram(GLProgram* program, const std::string &key) { + // release old one + auto prev = getProgram(key); + if( prev == program ) + return; + + _programs.erase(key); + CC_SAFE_RELEASE_NULL(prev); + if (program) - program->retain(); - + program->retain(); _programs[key] = program; } diff --git a/cocos/renderer/CCGLProgramState.cpp b/cocos/renderer/CCGLProgramState.cpp index 8955adddc3..7025992f61 100644 --- a/cocos/renderer/CCGLProgramState.cpp +++ b/cocos/renderer/CCGLProgramState.cpp @@ -279,7 +279,7 @@ GLProgramState::GLProgramState() , _textureUnitIndex(1) , _uniformAttributeValueDirty(true) { -#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) +#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WP8) /** listen the event that renderer was recreated on Android/WP8 */ CCLOG("create rendererRecreatedListener for GLProgramState"); _backToForegroundlistener = EventListenerCustom::create(EVENT_RENDERER_RECREATED, [this](EventCustom*) { _uniformAttributeValueDirty = true; }); @@ -289,7 +289,7 @@ GLProgramState::GLProgramState() GLProgramState::~GLProgramState() { -#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) +#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WP8) Director::getInstance()->getEventDispatcher()->removeEventListener(_backToForegroundlistener); #endif diff --git a/cocos/renderer/CCGLProgramState.h b/cocos/renderer/CCGLProgramState.h index cab3640e65..d741504a32 100644 --- a/cocos/renderer/CCGLProgramState.h +++ b/cocos/renderer/CCGLProgramState.h @@ -217,8 +217,8 @@ protected: int _textureUnitIndex; uint32_t _vertexAttribsFlags; GLProgram *_glprogram; - -#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) + +#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WP8) EventListenerCustom* _backToForegroundlistener; #endif }; diff --git a/cocos/renderer/ccShader_Position_uColor-no-gl_PointSize.vert b/cocos/renderer/ccShader_Position_uColor-no-gl_PointSize.vert new file mode 100644 index 0000000000..a1408d12ca --- /dev/null +++ b/cocos/renderer/ccShader_Position_uColor-no-gl_PointSize.vert @@ -0,0 +1,43 @@ +/* + * cocos2d for iPhone: http://www.cocos2d-iphone.org + * + * Copyright (c) 2011 Ricardo Quesada + * Copyright (c) 2012 Zynga Inc. + * + * 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. + */ + +const char* ccPosition_uColor_vert = STRINGIFY( + +attribute vec4 a_position; +uniform vec4 u_color; +uniform float u_pointSize; + +\n#ifdef GL_ES\n +varying lowp vec4 v_fragmentColor; +\n#else\n +varying vec4 v_fragmentColor; +\n#endif\n + +void main() +{ + gl_Position = CC_MVPMatrix * a_position; + v_fragmentColor = u_color; +} +); diff --git a/cocos/renderer/ccShaders.cpp b/cocos/renderer/ccShaders.cpp index 25f5f3ce71..1d66670420 100644 --- a/cocos/renderer/ccShaders.cpp +++ b/cocos/renderer/ccShaders.cpp @@ -31,7 +31,12 @@ THE SOFTWARE. NS_CC_BEGIN // #include "ccShader_Position_uColor.frag" + +#ifdef CC_NO_GL_POINTSIZE +#include "ccShader_Position_uColor-no-gl_PointSize.vert" +#else #include "ccShader_Position_uColor.vert" +#endif // #include "ccShader_PositionColor.frag" diff --git a/cocos/scripting/lua-bindings/auto/api/Sprite3D.lua b/cocos/scripting/lua-bindings/auto/api/Sprite3D.lua index 5e49c2da7d..9af5be0a63 100644 --- a/cocos/scripting/lua-bindings/auto/api/Sprite3D.lua +++ b/cocos/scripting/lua-bindings/auto/api/Sprite3D.lua @@ -47,10 +47,10 @@ -- @return BlendFunc#BlendFunc ret (return value: cc.BlendFunc) -------------------------------- --- --- @function [parent=#Sprite3D] setCullFace +-- get mesh count +-- @function [parent=#Sprite3D] getMeshCount -- @param self --- @param #unsigned int cullFace +-- @return long#long ret (return value: long) -------------------------------- -- remove attach node @@ -58,6 +58,12 @@ -- @param self -- @param #string boneName +-------------------------------- +-- +-- @function [parent=#Sprite3D] setCullFace +-- @param self +-- @param #unsigned int cullFace + -------------------------------- -- get SubMeshState by index -- @function [parent=#Sprite3D] getMeshByIndex diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.cpp index 9b06965efa..4e5e2095a1 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.cpp @@ -670,7 +670,7 @@ int lua_cocos2dx_3d_Sprite3D_getBlendFunc(lua_State* tolua_S) return 0; } -int lua_cocos2dx_3d_Sprite3D_setCullFace(lua_State* tolua_S) +int lua_cocos2dx_3d_Sprite3D_getMeshCount(lua_State* tolua_S) { int argc = 0; cocos2d::Sprite3D* cobj = nullptr; @@ -690,28 +690,26 @@ int lua_cocos2dx_3d_Sprite3D_setCullFace(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Sprite3D_setCullFace'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Sprite3D_getMeshCount'", nullptr); return 0; } #endif argc = lua_gettop(tolua_S)-1; - if (argc == 1) + if (argc == 0) { - unsigned int arg0; - - ok &= luaval_to_uint32(tolua_S, 2,&arg0, "cc.Sprite3D:setCullFace"); if(!ok) return 0; - cobj->setCullFace(arg0); - return 0; + ssize_t ret = cobj->getMeshCount(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite3D:setCullFace",argc, 1); + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite3D:getMeshCount",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Sprite3D_setCullFace'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Sprite3D_getMeshCount'.",&tolua_err); #endif return 0; @@ -762,6 +760,52 @@ int lua_cocos2dx_3d_Sprite3D_removeAttachNode(lua_State* tolua_S) return 0; } +int lua_cocos2dx_3d_Sprite3D_setCullFace(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite3D* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite3D",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Sprite3D*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Sprite3D_setCullFace'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + unsigned int arg0; + + ok &= luaval_to_uint32(tolua_S, 2,&arg0, "cc.Sprite3D:setCullFace"); + if(!ok) + return 0; + cobj->setCullFace(arg0); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite3D:setCullFace",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Sprite3D_setCullFace'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_3d_Sprite3D_getMeshByIndex(lua_State* tolua_S) { int argc = 0; @@ -1017,8 +1061,9 @@ int lua_register_cocos2dx_3d_Sprite3D(lua_State* tolua_S) tolua_function(tolua_S,"getMesh",lua_cocos2dx_3d_Sprite3D_getMesh); tolua_function(tolua_S,"setLightMask",lua_cocos2dx_3d_Sprite3D_setLightMask); tolua_function(tolua_S,"getBlendFunc",lua_cocos2dx_3d_Sprite3D_getBlendFunc); - tolua_function(tolua_S,"setCullFace",lua_cocos2dx_3d_Sprite3D_setCullFace); + tolua_function(tolua_S,"getMeshCount",lua_cocos2dx_3d_Sprite3D_getMeshCount); tolua_function(tolua_S,"removeAttachNode",lua_cocos2dx_3d_Sprite3D_removeAttachNode); + tolua_function(tolua_S,"setCullFace",lua_cocos2dx_3d_Sprite3D_setCullFace); tolua_function(tolua_S,"getMeshByIndex",lua_cocos2dx_3d_Sprite3D_getMeshByIndex); tolua_function(tolua_S,"getMeshByName",lua_cocos2dx_3d_Sprite3D_getMeshByName); tolua_function(tolua_S,"getSkeleton",lua_cocos2dx_3d_Sprite3D_getSkeleton); diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.hpp index 2a79697214..8386ff1b3a 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.hpp @@ -59,6 +59,7 @@ int register_all_cocos2dx_3d(lua_State* tolua_S); + #endif // __cocos2dx_3d_h__ diff --git a/cocos/scripting/lua-bindings/manual/LuaBasicConversions.cpp b/cocos/scripting/lua-bindings/manual/LuaBasicConversions.cpp index e8f82d9faa..634baf4e97 100644 --- a/cocos/scripting/lua-bindings/manual/LuaBasicConversions.cpp +++ b/cocos/scripting/lua-bindings/manual/LuaBasicConversions.cpp @@ -2922,7 +2922,7 @@ void ccvector_std_string_to_luaval(lua_State* L, const std::vector& int index = 1; - for (const std::string value : inValue) + for (const std::string& value : inValue) { lua_pushnumber(L, (lua_Number)index); lua_pushstring(L, value.c_str()); diff --git a/cocos/ui/UIButton.cpp b/cocos/ui/UIButton.cpp index 93b16c8bce..a5c66f1802 100644 --- a/cocos/ui/UIButton.cpp +++ b/cocos/ui/UIButton.cpp @@ -194,16 +194,7 @@ void Button::ignoreContentAdaptWithSize(bool ignore) { if (_unifySize) { - if (_scale9Enabled) - { - ProtectedNode::setContentSize(_customSize); - } - else - { - Size s = getVirtualRendererSize(); - ProtectedNode::setContentSize(s); - } - onSizeChanged(); + this->updateContentSize(); return; } if (!_scale9Enabled || (_scale9Enabled && !ignore)) @@ -249,7 +240,17 @@ void Button::loadTextureNormal(const std::string& normal,TextureResType texType) updateFlippedY(); this->updateChildrenDisplayedRGBA(); - updateContentSizeWithTextureSize(_normalTextureSize); + if (_unifySize ) + { + if (!_scale9Enabled) + { + updateContentSizeWithTextureSize(this->getNormalSize()); + } + } + else + { + updateContentSizeWithTextureSize(_normalTextureSize); + } _normalTextureLoaded = true; _normalTextureAdaptDirty = true; } @@ -434,7 +435,15 @@ void Button::onPressStateChangedToNormal() _buttonClickedRenderer->setScale(_pressedTextureScaleXInSize, _pressedTextureScaleYInSize); _titleRenderer->stopAllActions(); - _titleRenderer->runAction(zoomAction->clone()); + if (_unifySize) + { + Action *zoomTitleAction = ScaleTo::create(ZOOM_ACTION_TIME_STEP, 1, 1); + _titleRenderer->runAction(zoomTitleAction); + } + else + { + _titleRenderer->runAction(zoomAction->clone()); + } } } else @@ -449,8 +458,16 @@ void Button::onPressStateChangedToNormal() _buttonNormalRenderer->setScale(_normalTextureScaleXInSize, _normalTextureScaleYInSize); _titleRenderer->stopAllActions(); - _titleRenderer->setScaleX(_normalTextureScaleXInSize); - _titleRenderer->setScaleY(_normalTextureScaleYInSize); + if (_unifySize) + { + _titleRenderer->setScaleX(1.0f); + _titleRenderer->setScaleY(1.0f); + } + else + { + _titleRenderer->setScaleX(_normalTextureScaleXInSize); + _titleRenderer->setScaleY(_normalTextureScaleYInSize); + } } } } @@ -474,6 +491,15 @@ void Button::onPressStateChangedToPressed() _titleRenderer->stopAllActions(); //we must call zoomAction->clone here _titleRenderer->runAction(zoomAction->clone()); + if (_unifySize) + { + Action *zoomTitleAction = ScaleTo::create(ZOOM_ACTION_TIME_STEP, 1 + _zoomScale, 1 + _zoomScale); + _titleRenderer->runAction(zoomTitleAction); + } + else + { + _titleRenderer->runAction(zoomAction->clone()); + } } } else @@ -491,8 +517,16 @@ void Button::onPressStateChangedToPressed() _buttonNormalRenderer->setScale(_normalTextureScaleXInSize +_zoomScale, _normalTextureScaleYInSize + _zoomScale); _titleRenderer->stopAllActions(); - _titleRenderer->setScaleX(_normalTextureScaleXInSize + _zoomScale); - _titleRenderer->setScaleY(_normalTextureScaleYInSize + _zoomScale); + if (_unifySize) + { + _titleRenderer->setScaleX(1.0f + _zoomScale); + _titleRenderer->setScaleY(1.0f + _zoomScale); + } + else + { + _titleRenderer->setScaleX(_normalTextureScaleXInSize + _zoomScale); + _titleRenderer->setScaleY(_normalTextureScaleYInSize + _zoomScale); + } } } } @@ -532,9 +566,23 @@ void Button::updateTitleLocation() void Button::updateContentSize() { - if (_ignoreSize) { - this->setContentSize(getVirtualRendererSize()); - } + if (_unifySize) + { + if (_scale9Enabled) + { + ProtectedNode::setContentSize(_customSize); + } + else + { + Size s = getNormalSize(); + ProtectedNode::setContentSize(s); + } + onSizeChanged(); + return; + } + if (_ignoreSize) { + this->setContentSize(getVirtualRendererSize()); + } } void Button::onSizeChanged() @@ -567,6 +615,10 @@ void Button::adaptRenderers() Size Button::getVirtualRendererSize() const { + if (_unifySize) + { + return this->getNormalSize(); + } Size titleSize = _titleRenderer->getContentSize(); if (!_normalTextureLoaded && _titleRenderer->getString().size() > 0) { return titleSize; @@ -596,11 +648,8 @@ Node* Button::getVirtualRenderer() void Button::normalTextureScaleChangedWithSize() { - if (_unifySize) - { - _buttonNormalRenderer->setPreferredSize(_contentSize); - } - else if (_ignoreSize) + + if (_ignoreSize && !_unifySize) { if (!_scale9Enabled) { @@ -638,11 +687,8 @@ void Button::normalTextureScaleChangedWithSize() void Button::pressedTextureScaleChangedWithSize() { - if (_unifySize) - { - _buttonClickedRenderer->setPreferredSize(_contentSize); - } - else if (_ignoreSize) + + if (_ignoreSize && !_unifySize) { if (!_scale9Enabled) { @@ -679,11 +725,8 @@ void Button::pressedTextureScaleChangedWithSize() void Button::disabledTextureScaleChangedWithSize() { - if (_unifySize) - { - _buttonDisableRenderer->setPreferredSize(_contentSize); - } - else if (_ignoreSize) + + if (_ignoreSize && !_unifySize) { if (!_scale9Enabled) { @@ -784,9 +827,11 @@ void Button::setTitleFontName(const std::string& fontName) { _titleRenderer->requestSystemFontRefresh(); } + _titleRenderer->setSystemFontSize(_fontSize); _type = FontType::SYSTEM; } _fontName = fontName; + this->updateContentSize(); } Label* Button::getTitleRenderer()const @@ -829,6 +874,24 @@ void Button::copySpecialProperties(Widget *widget) setPressedActionEnabled(button->_pressedActionEnabled); setZoomScale(button->_zoomScale); } + +} +Size Button::getNormalSize() const +{ + Size titleSize; + if (_titleRenderer != nullptr) + { + titleSize = _titleRenderer->getContentSize(); + } + Size imageSize; + if (_buttonNormalRenderer != nullptr) + { + imageSize = _buttonNormalRenderer->getContentSize(); + } + float width = titleSize.width > imageSize.width ? titleSize.width : imageSize.width; + float height = titleSize.height > imageSize.height ? titleSize.height : imageSize.height; + + return Size(width,height); } } diff --git a/cocos/ui/UIButton.h b/cocos/ui/UIButton.h index 8f1c1b3bfa..f5dc86a759 100644 --- a/cocos/ui/UIButton.h +++ b/cocos/ui/UIButton.h @@ -234,6 +234,7 @@ protected: virtual Widget* createCloneInstance() override; virtual void copySpecialProperties(Widget* model) override; + virtual Size getNormalSize() const; protected: Scale9Sprite* _buttonNormalRenderer; Scale9Sprite* _buttonClickedRenderer; diff --git a/cocos/ui/UIEditBox/UIEditBoxImpl-stub.cpp b/cocos/ui/UIEditBox/UIEditBoxImpl-stub.cpp index 7e3899672c..ebe0a7eac7 100644 --- a/cocos/ui/UIEditBox/UIEditBoxImpl-stub.cpp +++ b/cocos/ui/UIEditBox/UIEditBoxImpl-stub.cpp @@ -1,6 +1,6 @@ #include "UIEditBox.h" -#if (CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID ) && (CC_TARGET_PLATFORM != CC_PLATFORM_IOS ) && (CC_TARGET_PLATFORM != CC_PLATFORM_WIN32) && (CC_TARGET_PLATFORM != CC_PLATFORM_MAC) && (CC_TARGET_PLATFORM != CC_PLATFORM_TIZEN) +#if (CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID ) && (CC_TARGET_PLATFORM != CC_PLATFORM_IOS ) && (CC_TARGET_PLATFORM != CC_PLATFORM_WIN32) && (CC_TARGET_PLATFORM != CC_PLATFORM_MAC) && (CC_TARGET_PLATFORM != CC_PLATFORM_TIZEN) && (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT) && (CC_TARGET_PLATFORM != CC_PLATFORM_WP8) NS_CC_BEGIN diff --git a/cocos/ui/UIEditBox/UIEditBoxImpl-winrt.cpp b/cocos/ui/UIEditBox/UIEditBoxImpl-winrt.cpp new file mode 100644 index 0000000000..0086e7eab0 --- /dev/null +++ b/cocos/ui/UIEditBox/UIEditBoxImpl-winrt.cpp @@ -0,0 +1,583 @@ +/**************************************************************************** +Copyright (c) 2014 cocos2d-x.org + +http://www.cocos2d-x.org + +* Portions Copyright (c) Microsoft Open Technologies, Inc. +* All Rights Reserved + +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 "platform/CCPlatformConfig.h" +#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) + +#include "UIEditBoxImpl-winrt.h" +#include "UIEditBox.h" +#include "CCGLViewImpl-winrt.h" +#include "base/CCScriptSupport.h" +#include "base/ccUTF8.h" +#include "2d/CCLabel.h" +#include "CCWinRTUtils.h" + +using namespace Platform; +using namespace Concurrency; +using namespace Windows::System; +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::Input; +using namespace Windows::Foundation; +using namespace Windows::UI::ViewManagement; + +NS_CC_BEGIN + +namespace ui { + +EditBoxWinRT::EditBoxWinRT() +{ + +} + +EditBoxWinRT::~EditBoxWinRT() +{ + +} + +EditBoxWinRT::EditBoxWinRT(Platform::String^ strPlaceHolder, Platform::String^ strText, int maxLength, EditBox::InputMode inputMode, EditBox::InputFlag inputFlag, Windows::Foundation::EventHandler^ receiveHandler) +{ + m_dispatcher = cocos2d::GLViewImpl::sharedOpenGLView()->getDispatcher(); + m_panel = cocos2d::GLViewImpl::sharedOpenGLView()->getPanel(); + m_strText = strText; + m_strPlaceholder = strPlaceHolder; + m_inputMode = inputMode; + m_inputFlag = inputFlag; + m_receiveHandler = receiveHandler; + m_maxLength = maxLength; +} + + +void EditBoxWinRT::OpenXamlEditBox(Platform::String^ strText) +{ + if (m_dispatcher.Get() == nullptr || m_panel.Get() == nullptr) + { + return; + } + + // must create XAML element on main UI thread + m_dispatcher.Get()->RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, ref new DispatchedHandler([this, strText]() + { + critical_section::scoped_lock lock(m_criticalSection); + m_strText = strText; + auto item = findXamlElement(m_panel.Get(), "cocos2d_editbox"); + if (item != nullptr) + { + Controls::Button^ button = dynamic_cast(item); + if (button) + { + m_flyout = dynamic_cast(button->Flyout); + if (m_flyout) + { + if (m_inputFlag == EditBox::InputFlag::PASSWORD) + { + SetupPasswordBox(); + } + else + { + SetupTextBox(); + } + + auto doneButton = findXamlElement(m_flyout->Content, "cocos2d_editbox_done"); + if (doneButton != nullptr) + { + m_doneButton = dynamic_cast(doneButton); + m_doneToken = m_doneButton->Click += ref new RoutedEventHandler(this, &EditBoxWinRT::Done); + } + + auto cancelButton = findXamlElement(m_flyout->Content, "cocos2d_editbox_cancel"); + if (cancelButton != nullptr) + { + m_cancelButton = dynamic_cast(cancelButton); + m_cancelToken = m_cancelButton->Click += ref new RoutedEventHandler(this, &EditBoxWinRT::Cancel); + } + } + } + + if (m_flyout) + { + auto inputPane = InputPane::GetForCurrentView(); + m_hideKeyboardToken = inputPane->Hiding += ref new TypedEventHandler(this, &EditBoxWinRT::HideKeyboard); + + m_closedToken = m_flyout->Closed += ref new EventHandler(this, &EditBoxWinRT::Closed); + m_flyout->ShowAt(m_panel.Get()); + } + } + })); +} + +void EditBoxWinRT::Closed(Platform::Object^ sender, Platform::Object^ e) +{ + critical_section::scoped_lock lock(m_criticalSection); + RemoveControls(); +} + +void EditBoxWinRT::Done(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) +{ + QueueText(); + HideFlyout(); +} + +void EditBoxWinRT::Cancel(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) +{ + HideFlyout(); +} + +void EditBoxWinRT::HideKeyboard(Windows::UI::ViewManagement::InputPane^ inputPane, Windows::UI::ViewManagement::InputPaneVisibilityEventArgs^ args) +{ + // we don't want to hide the flyout when the user hide the keyboard + //HideFlyout(); +} + +void EditBoxWinRT::HideFlyout() +{ + critical_section::scoped_lock lock(m_criticalSection); + if (m_flyout) + { + m_flyout->Hide(); + } +} + +void EditBoxWinRT::RemoveControls() +{ + if (m_dispatcher.Get() && m_panel.Get()) + { + // run on main UI thread + m_dispatcher.Get()->RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, ref new DispatchedHandler([this]() + { + critical_section::scoped_lock lock(m_criticalSection); + + if (m_doneButton != nullptr) + { + m_doneButton->Click -= m_doneToken; + m_doneButton = nullptr; + } + + if (m_cancelButton != nullptr) + { + m_cancelButton->Click -= m_cancelToken; + m_cancelButton = nullptr; + } + + m_textBox = nullptr; + m_passwordBox = nullptr; + + if (m_flyout != nullptr) + { + m_flyout->Closed -= m_closedToken; + m_flyout = nullptr; + } + + auto inputPane = InputPane::GetForCurrentView(); + inputPane->Hiding -= m_hideKeyboardToken; + })); + } +} + +void EditBoxWinRT::RemoveTextBox() +{ + auto g = findXamlElement(m_flyout->Content, "cocos2d_editbox_grid"); + auto grid = dynamic_cast(g); + auto box = findXamlElement(m_flyout->Content, "cocos2d_editbox_textbox"); + + if (box) + { + removeXamlElement(grid, box); + } +} + +void EditBoxWinRT::SetupTextBox() +{ + RemoveTextBox(); + m_textBox = ref new TextBox; + m_textBox->Text = m_strText; + m_textBox->Name = "cocos2d_editbox_textbox"; + m_textBox->MinWidth = 200; + m_textBox->PlaceholderText = m_strPlaceholder; + m_textBox->Select(m_textBox->Text->Length(), 0); + m_textBox->MaxLength = m_maxLength < 0 ? 0 : m_maxLength; + SetInputScope(m_textBox, m_inputMode); + auto g = findXamlElement(m_flyout->Content, "cocos2d_editbox_grid"); + auto grid = dynamic_cast(g); + grid->Children->InsertAt(0, m_textBox); +} + +void EditBoxWinRT::SetupPasswordBox() +{ + RemoveTextBox(); + m_passwordBox = ref new PasswordBox(); + m_passwordBox->Password = m_strText; + m_passwordBox->MinWidth = 200; + m_passwordBox->Name = "cocos2d_editbox_textbox"; + m_passwordBox->SelectAll(); + m_passwordBox->PlaceholderText = m_strPlaceholder; + m_passwordBox->MaxLength = m_maxLength < 0 ? 0 : m_maxLength; + auto g = findXamlElement(m_flyout->Content, "cocos2d_editbox_grid"); + auto grid = dynamic_cast(g); + grid->Children->InsertAt(0, m_passwordBox); +} + + + +void EditBoxWinRT::SetInputScope(TextBox^ box, EditBox::InputMode inputMode) +{ + // TextBox.SetInputScope + InputScope^ inputScope = ref new InputScope(); + InputScopeName^ name = ref new InputScopeName(); + + switch (inputMode) + { + case EditBox::InputMode::ANY: + name->NameValue = InputScopeNameValue::Default; + break; + case EditBox::InputMode::EMAIL_ADDRESS: + name->NameValue = InputScopeNameValue::EmailSmtpAddress; + break; + case EditBox::InputMode::NUMERIC: + name->NameValue = InputScopeNameValue::Number; + break; + case EditBox::InputMode::PHONE_NUMBER: + name->NameValue = InputScopeNameValue::TelephoneNumber; + break; + case EditBox::InputMode::URL: + name->NameValue = InputScopeNameValue::Url; + break; + case EditBox::InputMode::DECIMAL: + name->NameValue = InputScopeNameValue::Number; + break; + case EditBox::InputMode::SINGLE_LINE: + name->NameValue = InputScopeNameValue::Default; + break; + default: + name->NameValue = InputScopeNameValue::Default; + break; + } + + box->InputScope = nullptr; + inputScope->Names->Append(name); + box->InputScope = inputScope; +} + +void EditBoxWinRT::QueueText() +{ + critical_section::scoped_lock lock(m_criticalSection); + if ((m_passwordBox == nullptr) && (m_textBox == nullptr)) + { + return; + } + + m_strText = m_inputFlag == EditBox::InputFlag::PASSWORD ? m_passwordBox->Password : m_textBox->Text; + std::shared_ptr e(new UIEditBoxEvent(this, m_strText, m_receiveHandler)); + cocos2d::GLViewImpl::sharedOpenGLView()->QueueEvent(e); +} + + + +EditBoxImpl* __createSystemEditBox(EditBox* pEditBox) +{ + return new UIEditBoxImplWinrt(pEditBox); +} + +UIEditBoxImplWinrt::UIEditBoxImplWinrt( EditBox* pEditText ) + : EditBoxImpl(pEditText) + , m_pLabel(NULL) + , m_pLabelPlaceHolder(NULL) + , m_eEditBoxInputMode(EditBox::InputMode::SINGLE_LINE) + , m_eEditBoxInputFlag(EditBox::InputFlag::INTIAL_CAPS_ALL_CHARACTERS) + , m_eKeyboardReturnType(EditBox::KeyboardReturnType::DEFAULT) + , m_colText(Color3B::WHITE) + , m_colPlaceHolder(Color3B::GRAY) + , m_nMaxLength(-1) +{ + +} + +UIEditBoxImplWinrt::~UIEditBoxImplWinrt() +{ + +} + +void UIEditBoxImplWinrt::openKeyboard() +{ + if (_delegate != NULL) + { + _delegate->editBoxEditingDidBegin(_editBox); + } + + EditBox* pEditBox = this->getEditBox(); + if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler()) + { + CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "began",pEditBox); + ScriptEvent event(kCommonEvent,(void*)&data); + ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event); + } + + std::string placeHolder = m_pLabelPlaceHolder->getString(); + if (placeHolder.length() == 0) + placeHolder = "Enter value"; + + char pText[100]= {0}; + std::string text = getText(); + if (text.length()) + strncpy(pText, text.c_str(), 100); + + + if (!m_editBoxWinrt) + { + Windows::Foundation::EventHandler^ receiveHandler = ref new Windows::Foundation::EventHandler( + [this](Platform::Object^ sender, Platform::String^ arg) + { + setText(PlatformStringTostring(arg).c_str()); + if (_delegate != NULL) { + _delegate->editBoxTextChanged(_editBox, getText()); + _delegate->editBoxEditingDidEnd(_editBox); + _delegate->editBoxReturn(_editBox); + } + }); + + m_editBoxWinrt = ref new EditBoxWinRT(stringToPlatformString(placeHolder), stringToPlatformString(getText()), m_nMaxLength, m_eEditBoxInputMode, m_eEditBoxInputFlag, receiveHandler); + } + + m_editBoxWinrt->OpenXamlEditBox(stringToPlatformString(getText())); +} + +bool UIEditBoxImplWinrt::initWithSize( const Size& size ) +{ + //! int fontSize = getFontSizeAccordingHeightJni(size.height-12); + m_pLabel = Label::createWithSystemFont("", "", size.height-12); + // align the text vertically center + m_pLabel->setAnchorPoint(Vec2(0.0f, 0.5f)); + m_pLabel->setPosition(Vec2(5.0, size.height / 2.0f)); + m_pLabel->setColor(m_colText); + _editBox->addChild(m_pLabel); + + m_pLabelPlaceHolder = Label::createWithSystemFont("", "", size.height-12); + // align the text vertically center + m_pLabelPlaceHolder->setAnchorPoint(Vec2(0.0f, 0.5f)); + m_pLabelPlaceHolder->setPosition(Vec2(5.0f, size.height / 2.0f)); + m_pLabelPlaceHolder->setVisible(false); + m_pLabelPlaceHolder->setColor(m_colPlaceHolder); + _editBox->addChild(m_pLabelPlaceHolder); + + m_EditSize = size; + return true; +} + +void UIEditBoxImplWinrt::setFont( const char* pFontName, int fontSize ) +{ + if(m_pLabel != NULL) { + m_pLabel->setSystemFontName(pFontName); + m_pLabel->setSystemFontSize(fontSize); + } + + if(m_pLabelPlaceHolder != NULL) { + m_pLabelPlaceHolder->setSystemFontName(pFontName); + m_pLabelPlaceHolder->setSystemFontSize(fontSize); + } +} + +void UIEditBoxImplWinrt::setFontColor( const Color3B& color ) +{ + m_colText = color; + m_pLabel->setColor(color); +} + +void UIEditBoxImplWinrt::setPlaceholderFont( const char* pFontName, int fontSize ) +{ + if(m_pLabelPlaceHolder != NULL) { + m_pLabelPlaceHolder->setSystemFontName(pFontName); + m_pLabelPlaceHolder->setSystemFontSize(fontSize); + } +} + +void UIEditBoxImplWinrt::setPlaceholderFontColor( const Color3B& color ) +{ + m_colPlaceHolder = color; + m_pLabelPlaceHolder->setColor(color); +} + +void UIEditBoxImplWinrt::setInputMode( EditBox::InputMode inputMode ) +{ + m_eEditBoxInputMode = inputMode; +} + +void UIEditBoxImplWinrt::setInputFlag(EditBox::InputFlag inputFlag ) +{ + m_eEditBoxInputFlag = inputFlag; +} + +void UIEditBoxImplWinrt::setMaxLength( int maxLength ) +{ + m_nMaxLength = maxLength; +} + +int UIEditBoxImplWinrt::getMaxLength() +{ + return m_nMaxLength; +} + +void UIEditBoxImplWinrt::setReturnType( EditBox::KeyboardReturnType returnType ) +{ + m_eKeyboardReturnType = returnType; +} + +bool UIEditBoxImplWinrt::isEditing() +{ + return false; +} + +void UIEditBoxImplWinrt::setText( const char* pText ) +{ + if (pText != NULL) + { + m_strText = pText; + + if (m_strText.length() > 0) + { + m_pLabelPlaceHolder->setVisible(false); + + std::string strToShow; + + if (EditBox::InputFlag::PASSWORD == m_eEditBoxInputFlag) + { + long length = cc_utf8_strlen(m_strText.c_str(), -1); + for (long i = 0; i < length; i++) + { + strToShow.append("*"); + } + } + else + { + strToShow = m_strText; + } + + //! std::string strWithEllipsis = getStringWithEllipsisJni(strToShow.c_str(), m_EditSize.width, m_EditSize.height-12); + //! m_pLabel->setString(strWithEllipsis.c_str()); + m_pLabel->setString(strToShow.c_str()); + } + else + { + m_pLabelPlaceHolder->setVisible(true); + m_pLabel->setString(""); + } + + } +} + +const char* UIEditBoxImplWinrt::getText( void ) +{ + return m_strText.c_str(); +} + +void UIEditBoxImplWinrt::setPlaceHolder( const char* pText ) +{ + if (pText != NULL) + { + m_strPlaceHolder = pText; + if (m_strPlaceHolder.length() > 0 && m_strText.length() == 0) + { + m_pLabelPlaceHolder->setVisible(true); + } + + m_pLabelPlaceHolder->setString(m_strPlaceHolder.c_str()); + } +} + +void UIEditBoxImplWinrt::setPosition( const Vec2& pos ) +{ + +} + +void UIEditBoxImplWinrt::setVisible( bool visible ) +{ + +} + +void UIEditBoxImplWinrt::setContentSize( const Size& size ) +{ + +} + +void UIEditBoxImplWinrt::setAnchorPoint( const Vec2& anchorPoint ) +{ + +} + +void UIEditBoxImplWinrt::visit( void ) +{ + +} + +void UIEditBoxImplWinrt::doAnimationWhenKeyboardMove( float duration, float distance ) +{ + +} + +void UIEditBoxImplWinrt::closeKeyboard() +{ + +} + +void UIEditBoxImplWinrt::onEnter( void ) +{ + +} + +Platform::String^ UIEditBoxImplWinrt::stringToPlatformString( std::string strSrc ) +{ + // to wide char + int nStrLen = MultiByteToWideChar(CP_UTF8, 0, strSrc.c_str(), -1, NULL, 0); + wchar_t* pWStr = new wchar_t[nStrLen + 1]; + memset(pWStr, 0, nStrLen + 1); + MultiByteToWideChar(CP_UTF8, 0, strSrc.c_str(), -1, pWStr, nStrLen); + Platform::String^ strDst = ref new Platform::String(pWStr); + delete[] pWStr; + return strDst; +} + +std::string UIEditBoxImplWinrt::PlatformStringTostring( Platform::String^ strSrc ) +{ + const wchar_t* pWStr = strSrc->Data(); + int nStrLen = WideCharToMultiByte(CP_UTF8, 0, pWStr, -1, NULL, 0, NULL, NULL); + char* pStr = new char[nStrLen + 1]; + memset(pStr, 0, nStrLen + 1); + WideCharToMultiByte(CP_UTF8, 0, pWStr, -1, pStr, nStrLen, NULL, NULL); ; + + std::string strDst = std::string(pStr); + + delete[] pStr; + return strDst; +} + +} + +NS_CC_END + +#endif // WP8 diff --git a/cocos/ui/UIEditBox/UIEditBoxImpl-winrt.h b/cocos/ui/UIEditBox/UIEditBoxImpl-winrt.h new file mode 100644 index 0000000000..68cb26e739 --- /dev/null +++ b/cocos/ui/UIEditBox/UIEditBoxImpl-winrt.h @@ -0,0 +1,146 @@ +/**************************************************************************** +Copyright (c) 2014 cocos2d-x.org + +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. +****************************************************************************/ +#ifndef __UIEditBoxIMPLWINRT_H__ +#define __UIEditBoxIMPLWINRT_H__ + +#include "platform/CCPlatformConfig.h" +#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) + +#include "UIEditBoxImpl.h" + +NS_CC_BEGIN + +namespace ui { + class EditBox; + + ref class EditBoxWinRT sealed + { + public: + EditBoxWinRT(); + virtual ~EditBoxWinRT(); + internal: + + EditBoxWinRT(Platform::String^ strPlaceHolder, Platform::String^ strText, int maxLength, EditBox::InputMode inputMode, EditBox::InputFlag inputFlag, Windows::Foundation::EventHandler^ receiveHandler); + void OpenXamlEditBox(Platform::String^ strText); + + private: + Windows::UI::Xaml::Controls::Control^ CreateTextBox(int maxLength); + Windows::UI::Xaml::Controls::Control^ CreatePasswordBox(int maxLength); + void SetInputScope(Windows::UI::Xaml::Controls::TextBox^ box, EditBox::InputMode inputMode); + + void EditBoxWinRT::SetupTextBox(); + void EditBoxWinRT::SetupPasswordBox(); + void EditBoxWinRT::RemoveTextBox(); + void RemoveControls(); + void QueueText(); + + void Done(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); + void Cancel(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); + void Closed(Platform::Object^ sender, Platform::Object^ e); + void HideKeyboard(Windows::UI::ViewManagement::InputPane^ inputPane, Windows::UI::ViewManagement::InputPaneVisibilityEventArgs^ args); + void HideFlyout(); + + Platform::Agile m_dispatcher; + Platform::Agile m_panel; + Windows::Foundation::EventHandler^ m_receiveHandler; + + Windows::UI::Xaml::Controls::TextBox^ m_textBox; + Windows::UI::Xaml::Controls::PasswordBox^ m_passwordBox; + Windows::UI::Xaml::Controls::Flyout^ m_flyout; + Windows::UI::Xaml::Controls::Button^ m_doneButton; + Windows::UI::Xaml::Controls::Button^ m_cancelButton; + + Windows::Foundation::EventRegistrationToken m_doneToken; + Windows::Foundation::EventRegistrationToken m_cancelToken; + Windows::Foundation::EventRegistrationToken m_closedToken; + Windows::Foundation::EventRegistrationToken m_hideKeyboardToken; + + Concurrency::critical_section m_criticalSection; + + Platform::String^ m_strText; + Platform::String^ m_strPlaceholder; + EditBox::InputMode m_inputMode; + EditBox::InputFlag m_inputFlag; + int m_maxLength; + }; + + class CC_GUI_DLL UIEditBoxImplWinrt : public EditBoxImpl + { + public: + UIEditBoxImplWinrt(EditBox* pEditText); + virtual ~UIEditBoxImplWinrt(); + + virtual bool initWithSize(const Size& size); + virtual void setFont(const char* pFontName, int fontSize); + virtual void setFontColor(const Color3B& color); + virtual void setPlaceholderFont(const char* pFontName, int fontSize); + virtual void setPlaceholderFontColor(const Color3B& color); + virtual void setInputMode(EditBox::InputMode inputMode); + virtual void setInputFlag(EditBox::InputFlag inputFlag); + virtual void setMaxLength(int maxLength); + virtual int getMaxLength(); + virtual void setReturnType(EditBox::KeyboardReturnType returnType); + virtual bool isEditing(); + + virtual void setText(const char* pText); + virtual const char* getText(void); + virtual void setPlaceHolder(const char* pText); + virtual void setPosition(const Vec2& pos); + virtual void setVisible(bool visible); + virtual void setContentSize(const Size& size); + virtual void setAnchorPoint(const Vec2& anchorPoint); + virtual void visit(void); + virtual void doAnimationWhenKeyboardMove(float duration, float distance); + virtual void openKeyboard(); + virtual void closeKeyboard(); + virtual void onEnter(void); + private: + Platform::String^ stringToPlatformString(std::string strSrc); + std::string PlatformStringTostring(Platform::String^ strSrc); + private: + + EditBoxWinRT^ m_editBoxWinrt; + + Label* m_pLabel; + Label* m_pLabelPlaceHolder; + EditBox::InputMode m_eEditBoxInputMode; + EditBox::InputFlag m_eEditBoxInputFlag; + (EditBox::KeyboardReturnType m_eKeyboardReturnType; + + std::string m_strText; + std::string m_strPlaceHolder; + + Color3B m_colText; + Color3B m_colPlaceHolder; + + int m_nMaxLength; + Size m_EditSize; + }; +} + +NS_CC_END + +#endif //CC_PLATFORM_WINRT + +#endif diff --git a/templates/cocos2dx_files.json b/templates/cocos2dx_files.json index c05eade91e..93c78241af 100644 --- a/templates/cocos2dx_files.json +++ b/templates/cocos2dx_files.json @@ -7,6 +7,7 @@ "README.md", "build/android-build.py", "build/cocos2d-win32.vc2012.sln", + "build/cocos2d-win8.1-universal.sln", "build/cocos2d-wp8.sln", "build/cocos2d_libs.xcodeproj/project.pbxproj", "build/cocos2d_tests.xcodeproj/project.pbxproj", @@ -31,6 +32,10 @@ "build/wp8/Cocos2dShaderCompiler/App.xaml", "build/wp8/Cocos2dShaderCompiler/App.xaml.cpp", "build/wp8/Cocos2dShaderCompiler/App.xaml.h", + "build/wp8/Cocos2dShaderCompiler/Assets/logo.png", + "build/wp8/Cocos2dShaderCompiler/Assets/smalllogo.png", + "build/wp8/Cocos2dShaderCompiler/Assets/splashscreen.png", + "build/wp8/Cocos2dShaderCompiler/Assets/storelogo.png", "build/wp8/Cocos2dShaderCompiler/Cocos2dShaderCompiler.sln", "build/wp8/Cocos2dShaderCompiler/Cocos2dShaderCompiler.vcxproj", "build/wp8/Cocos2dShaderCompiler/Cocos2dShaderCompiler.vcxproj.filters", @@ -911,6 +916,15 @@ "cocos/platform/win32/CCStdC-win32.cpp", "cocos/platform/win32/CCStdC-win32.h", "cocos/platform/win32/compat/stdint.h", + "cocos/platform/win8.1-universal/Cocos2dRenderer.cpp", + "cocos/platform/win8.1-universal/Cocos2dRenderer.h", + "cocos/platform/win8.1-universal/OpenGLES.cpp", + "cocos/platform/win8.1-universal/OpenGLES.h", + "cocos/platform/win8.1-universal/OpenGLESPage.xaml", + "cocos/platform/win8.1-universal/OpenGLESPage.xaml.cpp", + "cocos/platform/win8.1-universal/OpenGLESPage.xaml.h", + "cocos/platform/win8.1-universal/pch.cpp", + "cocos/platform/win8.1-universal/pch.h", "cocos/platform/winrt/CCApplication.cpp", "cocos/platform/winrt/CCApplication.h", "cocos/platform/winrt/CCCommon.cpp", @@ -941,6 +955,8 @@ "cocos/platform/winrt/InputEvent.cpp", "cocos/platform/winrt/InputEvent.h", "cocos/platform/winrt/InputEventTypes.h", + "cocos/platform/winrt/Keyboard-winrt.cpp", + "cocos/platform/winrt/Keyboard-winrt.h", "cocos/platform/winrt/inet_ntop_winrt.cpp", "cocos/platform/winrt/inet_ntop_winrt.h", "cocos/platform/winrt/pch.cpp", @@ -1044,6 +1060,7 @@ "cocos/renderer/ccShader_PositionTextureColor_noMVP.vert", "cocos/renderer/ccShader_PositionTexture_uColor.frag", "cocos/renderer/ccShader_PositionTexture_uColor.vert", + "cocos/renderer/ccShader_Position_uColor-no-gl_PointSize.vert", "cocos/renderer/ccShader_Position_uColor.frag", "cocos/renderer/ccShader_Position_uColor.vert", "cocos/renderer/ccShaders.cpp", @@ -1076,6 +1093,8 @@ "cocos/ui/UIEditBox/UIEditBoxImpl-stub.cpp", "cocos/ui/UIEditBox/UIEditBoxImpl-win32.cpp", "cocos/ui/UIEditBox/UIEditBoxImpl-win32.h", + "cocos/ui/UIEditBox/UIEditBoxImpl-winrt.cpp", + "cocos/ui/UIEditBox/UIEditBoxImpl-winrt.h", "cocos/ui/UIEditBox/UIEditBoxImpl-wp8.cpp", "cocos/ui/UIEditBox/UIEditBoxImpl-wp8.h", "cocos/ui/UIEditBox/UIEditBoxImpl.h", diff --git a/templates/cpp-template-default/proj.win32/HelloCpp.vcxproj.filters b/templates/cpp-template-default/proj.win32/HelloCpp.vcxproj.filters index 4b0292cd30..45ba4a127f 100644 --- a/templates/cpp-template-default/proj.win32/HelloCpp.vcxproj.filters +++ b/templates/cpp-template-default/proj.win32/HelloCpp.vcxproj.filters @@ -15,10 +15,10 @@ win32 - + src - + src @@ -26,10 +26,10 @@ win32 - + src - + src diff --git a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/App.xaml b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/App.xaml new file mode 100644 index 0000000000..2da0ff79d0 --- /dev/null +++ b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/App.xaml @@ -0,0 +1,13 @@ + + + + + cpp_tests + + + diff --git a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/App.xaml.cpp b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/App.xaml.cpp new file mode 100644 index 0000000000..f4365b88c5 --- /dev/null +++ b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/App.xaml.cpp @@ -0,0 +1,21 @@ +#include "App.xaml.h" +#include "OpenGLESPage.xaml.h" + +using namespace cocos2d; + +App::App() +{ + InitializeComponent(); +} + +void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) +{ + if (mPage == nullptr) + { + mPage = ref new OpenGLESPage(&mOpenGLES); + } + + // Place the page in the current window and ensure that it is active. + Windows::UI::Xaml::Window::Current->Content = mPage; + Windows::UI::Xaml::Window::Current->Activate(); +} diff --git a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/App.xaml.h b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/App.xaml.h new file mode 100644 index 0000000000..1309c610d7 --- /dev/null +++ b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/App.xaml.h @@ -0,0 +1,19 @@ +#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: + OpenGLESPage^ mPage; + OpenGLES mOpenGLES; + }; +} diff --git a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/Cocos2dRenderer.cpp b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/Cocos2dRenderer.cpp new file mode 100644 index 0000000000..e0c02e3ee8 --- /dev/null +++ b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/Cocos2dRenderer.cpp @@ -0,0 +1,85 @@ +/* +* 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" + +// 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(const int width, const int height, CoreDispatcher^ dispatcher, Panel^ panel) + : mApp(nullptr) + , mWidth(width) + , mHeight(height) + , m_dispatcher(dispatcher) + , m_panel(panel) +{ + mApp = new AppDelegate(); + auto director = cocos2d::Director::getInstance(); + + GLViewImpl* glview = GLViewImpl::create("Test Cpp"); + glview->setDispatcher(dispatcher); + glview->setPanel(panel); + glview->Create(static_cast(width), static_cast(height), DisplayOrientations::Landscape); + director->setOpenGLView(glview); + CCApplication::getInstance()->run(); +} + +Cocos2dRenderer::~Cocos2dRenderer() +{ + delete mApp; +} + +// Draws a basic triangle +void Cocos2dRenderer::Draw(GLsizei width, GLsizei height) +{ + if (width != mWidth || height != mHeight) + { + mWidth = width; + mHeight = height; + GLViewImpl::sharedOpenGLView()->UpdateForWindowSizeChange(static_cast(width), static_cast(height)); + } + + GLViewImpl::sharedOpenGLView()->ProcessEvents(); + GLViewImpl::sharedOpenGLView()->Render(); +} + +void Cocos2dRenderer::QueuePointerEvent(cocos2d::PointerEventType type, Windows::UI::Core::PointerEventArgs^ args) +{ + GLViewImpl::sharedOpenGLView()->QueuePointerEvent(type, args); +} + +void Cocos2dRenderer::QueueKeyBoardEvent(cocos2d::Cocos2dKeyEvent type, Windows::UI::Core::KeyEventArgs^ e) +{ + //GLViewImpl::sharedOpenGLView()->QueuePointerEvent(type, e); +} + + diff --git a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/Cocos2dRenderer.h b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/Cocos2dRenderer.h new file mode 100644 index 0000000000..387445f6d5 --- /dev/null +++ b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/Cocos2dRenderer.h @@ -0,0 +1,47 @@ +/* +* 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(const int width, const int height, Windows::UI::Core::CoreDispatcher^ dispathcer, Windows::UI::Xaml::Controls::Panel^ panel); + ~Cocos2dRenderer(); + void Draw(GLsizei width, GLsizei height); + void QueuePointerEvent(PointerEventType type, Windows::UI::Core::PointerEventArgs^ args); + void QueueKeyBoardEvent(Cocos2dKeyEvent type, Windows::UI::Core::KeyEventArgs^ e); + + private: + + int mWidth; + int mHeight; + // The AppDelegate for the Cocos2D app + AppDelegate* mApp; + Platform::Agile m_dispatcher; + Platform::Agile m_panel; + }; +} \ No newline at end of file diff --git a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/HelloCpp.Shared.vcxitems b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/HelloCpp.Shared.vcxitems new file mode 100644 index 0000000000..466b128576 --- /dev/null +++ b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/HelloCpp.Shared.vcxitems @@ -0,0 +1,62 @@ + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + true + e956c24b-f04e-47bf-bf00-746681ae1301 + {a3ad93e4-0b2f-4c58-9181-69bed2e42e3e} + HelloCpp + + + + %(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/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/HelloCpp.Shared.vcxitems.filters b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/HelloCpp.Shared.vcxitems.filters new file mode 100644 index 0000000000..5d1f7e30da --- /dev/null +++ b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/HelloCpp.Shared.vcxitems.filters @@ -0,0 +1,42 @@ + + + + + + + + + Classes + + + Classes + + + + + + + + + + + {38ad799c-8c3c-44a2-8e41-516c8f62f556} + + + + + Classes + + + Classes + + + Classes + + + + + + + + \ No newline at end of file diff --git a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/OpenGLES.cpp b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/OpenGLES.cpp new file mode 100644 index 0000000000..943b0856fc --- /dev/null +++ b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/OpenGLES.cpp @@ -0,0 +1,175 @@ +/* +* 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 displayAttributes[] = + { + // This can be used to configure D3D11. For example, EGL_PLATFORM_ANGLE_TYPE_D3D11_FL9_3_ANGLE could be used. + // This would ask the graphics card to use D3D11 Feature Level 9_3 instead of Feature Level 11_0+. + // On Windows Phone, this would allow the Phone Emulator to act more like the GPUs that are available on real Phone devices. +#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) + EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_FL9_3_ANGLE, + EGL_NONE, +#else + EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, + EGL_NONE, +#endif + }; + + const EGLint contextAttributes[] = + { + EGL_CONTEXT_CLIENT_VERSION, 2, + EGL_NONE + }; + + // eglGetPlatformDisplayEXT is an alternative to eglGetDisplay. It allows us to pass in 'displayAttributes' to configure D3D11. + PFNEGLGETPLATFORMDISPLAYEXTPROC eglGetPlatformDisplayEXT = reinterpret_cast(eglGetProcAddress("eglGetPlatformDisplayEXT")); + if (!eglGetPlatformDisplayEXT) + { + throw Exception::CreateException(E_FAIL, L"Failed to get function eglGetPlatformDisplayEXT"); + } + + mEglDisplay = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, displayAttributes); + if (mEglDisplay == EGL_NO_DISPLAY) + { + throw Exception::CreateException(E_FAIL, L"Failed to get default EGL display"); + } + + if (eglInitialize(mEglDisplay, NULL, NULL) == EGL_FALSE) + { + throw Exception::CreateException(E_FAIL, L"Failed to initialize EGL"); + } + + EGLint numConfigs = 0; + if (eglGetConfigs(mEglDisplay, NULL, 0, &numConfigs) == EGL_FALSE) + { + throw Exception::CreateException(E_FAIL, L"Failed to get EGLConfig count"); + } + + if (eglChooseConfig(mEglDisplay, configAttributes, &mEglConfig, 1, &numConfigs) == EGL_FALSE) + { + 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; + + // 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), NULL); + 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/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/OpenGLES.h b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/OpenGLES.h new file mode 100644 index 0000000000..ce9f2a9cdf --- /dev/null +++ b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/OpenGLES.h @@ -0,0 +1,52 @@ +/* +* 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(); + +private: + void Initialize(); + void Cleanup(); + +private: + EGLDisplay mEglDisplay; + EGLContext mEglContext; + EGLConfig mEglConfig; +}; diff --git a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/OpenGLESPage.xaml b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/OpenGLESPage.xaml new file mode 100644 index 0000000000..e5b62802a5 --- /dev/null +++ b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/OpenGLESPage.xaml @@ -0,0 +1,28 @@ + + + + + + + + + + + diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/OpenGLESPage.xaml.cpp b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/OpenGLESPage.xaml.cpp similarity index 58% rename from tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/OpenGLESPage.xaml.cpp rename to templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/OpenGLESPage.xaml.cpp index abd0e9b475..c8ee9afb42 100644 --- a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/OpenGLESPage.xaml.cpp +++ b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/OpenGLESPage.xaml.cpp @@ -1,10 +1,40 @@ -#include "pch.h" +/* +* 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 cpp_tests; +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; OpenGLESPage::OpenGLESPage() : OpenGLESPage(nullptr) @@ -16,7 +46,8 @@ OpenGLESPage::OpenGLESPage(OpenGLES* openGLES) : mOpenGLES(openGLES), mRenderSurface(EGL_NO_SURFACE), mCustomRenderSurfaceSize(0,0), - mUseCustomRenderSurfaceSize(false) + mUseCustomRenderSurfaceSize(false), + m_coreInput(nullptr) { InitializeComponent(); @@ -31,7 +62,11 @@ OpenGLESPage::OpenGLESPage(OpenGLES* openGLES) : this->Loaded += ref new Windows::UI::Xaml::RoutedEventHandler(this, &OpenGLESPage::OnPageLoaded); -#if !(WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) + mSwapChainPanelSize = { swapChainPanel->RenderSize.Width, swapChainPanel->RenderSize.Height }; + +#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) + Windows::UI::ViewManagement::StatusBar::GetForCurrentView()->HideAsync(); +#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(); @@ -39,7 +74,28 @@ OpenGLESPage::OpenGLESPage(OpenGLES* openGLES) : pointerVisualizationSettings->IsBarrelButtonFeedbackEnabled = false; #endif - mSwapChainPanelSize = { swapChainPanel->RenderSize.Width, swapChainPanel->RenderSize.Height }; + // 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(this, &OpenGLESPage::OnPointerPressed); + m_coreInput->PointerMoved += ref new TypedEventHandler(this, &OpenGLESPage::OnPointerMoved); + m_coreInput->PointerReleased += ref new TypedEventHandler(this, &OpenGLESPage::OnPointerReleased); + + // Begin processing input messages as they're delivered. + m_coreInput->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessUntilQuit); + }); + + // Run task on a dedicated high priority background thread. + m_inputLoopWorker = ThreadPool::RunAsync(workItemHandler, WorkItemPriority::High, WorkItemOptions::TimeSliced); + } OpenGLESPage::~OpenGLESPage() @@ -55,6 +111,32 @@ void OpenGLESPage::OnPageLoaded(Platform::Object^ sender, Windows::UI::Xaml::Rou StartRenderLoop(); } +void OpenGLESPage::OnPointerPressed(Object^ sender, PointerEventArgs^ e) +{ + if (m_renderer) + { + m_renderer->QueuePointerEvent(PointerEventType::PointerPressed, e); + } +} + +void OpenGLESPage::OnPointerMoved(Object^ sender, PointerEventArgs^ e) +{ + if (m_renderer) + { + m_renderer->QueuePointerEvent(PointerEventType::PointerMoved, e); + } +} + +void OpenGLESPage::OnPointerReleased(Object^ sender, PointerEventArgs^ e) +{ + if (m_renderer) + { + m_renderer->QueuePointerEvent(PointerEventType::PointerReleased, e); + } +} + + + void OpenGLESPage::OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args) { if (args->Visible && mRenderSurface != EGL_NO_SURFACE) @@ -101,7 +183,7 @@ void OpenGLESPage::CreateRenderSurface() // The render surface will be automatically scaled to fit the entire window. Using a // smaller sized render surface can result in a performance gain. // - //mCustomRenderSurfaceSize = Size(340, 400); + //mCustomRenderSurfaceSize = Size(800, 600); //mUseCustomRenderSurfaceSize = true; mRenderSurface = mOpenGLES->CreateSurface(swapChainPanel, mUseCustomRenderSurfaceSize ? &mCustomRenderSurfaceSize : nullptr); @@ -143,21 +225,29 @@ void OpenGLESPage::StartRenderLoop() return; } + auto dispatcher = Windows::UI::Xaml::Window::Current->CoreWindow->Dispatcher; + // Create a task for rendering that will be run on a background thread. - auto workItemHandler = ref new Windows::System::Threading::WorkItemHandler([this](Windows::Foundation::IAsyncAction ^ action) + auto workItemHandler = ref new Windows::System::Threading::WorkItemHandler([this, dispatcher](Windows::Foundation::IAsyncAction ^ action) { critical_section::scoped_lock lock(mRenderSurfaceCriticalSection); mOpenGLES->MakeCurrent(mRenderSurface); - HelloTriangleRenderer renderer; + + GLsizei panelWidth = 0; + GLsizei panelHeight = 0; + GetSwapChainPanelSize(&panelWidth, &panelHeight); + + if (m_renderer.get() == nullptr) + { + m_renderer = std::make_shared(panelWidth, panelHeight, dispatcher, swapChainPanel); + } while (action->Status == Windows::Foundation::AsyncStatus::Started) { - GLsizei panelWidth = 0; - GLsizei panelHeight = 0; - + GetSwapChainPanelSize(&panelWidth, &panelHeight); - renderer.Draw(panelWidth, panelHeight); + m_renderer.get()->Draw(panelWidth, panelHeight); // The call to eglSwapBuffers might not be successful (i.e. due to Device Lost) // If the call fails, then we must reinitialize EGL and the GL resources. @@ -165,6 +255,7 @@ void OpenGLESPage::StartRenderLoop() { // XAML objects like the SwapChainPanel must only be manipulated on the UI thread. swapChainPanel->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::High, ref new Windows::UI::Core::DispatchedHandler([=]() + //swapChainPanel->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::High, ref new Windows::UI::Core::DispatchedHandler([=]() { RecoverFromLostDevice(); }, CallbackContext::Any)); diff --git a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/OpenGLESPage.xaml.h b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/OpenGLESPage.xaml.h new file mode 100644 index 0000000000..d8ddccc63e --- /dev/null +++ b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/OpenGLESPage.xaml.h @@ -0,0 +1,71 @@ +/* +* 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 "OpenGLES.h" +#include "OpenGLESPage.g.h" +#include + +#include "Cocos2dRenderer.h" + +namespace cocos2d +{ + public ref class OpenGLESPage sealed + { + public: + OpenGLESPage(); + virtual ~OpenGLESPage(); + + internal: + OpenGLESPage(OpenGLES* openGLES); + + private: + void OnPageLoaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); + void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args); + void OnSwapChainPanelSizeChanged(Platform::Object^ sender, Windows::UI::Xaml::SizeChangedEventArgs^ e); + void GetSwapChainPanelSize(GLsizei* width, GLsizei* height); + void CreateRenderSurface(); + void DestroyRenderSurface(); + void RecoverFromLostDevice(); + void StartRenderLoop(); + void StopRenderLoop(); + + OpenGLES* mOpenGLES; + std::shared_ptr m_renderer; + + Windows::Foundation::Size mSwapChainPanelSize; + Concurrency::critical_section mSwapChainPanelSizeCriticalSection; + + Windows::Foundation::Size mCustomRenderSurfaceSize; + bool mUseCustomRenderSurfaceSize; + + EGLSurface mRenderSurface; // This surface is associated with a swapChainPanel on the page + Concurrency::critical_section mRenderSurfaceCriticalSection; + Windows::Foundation::IAsyncAction^ mRenderLoopWorker; + + // Track user input on a background worker thread. + Windows::Foundation::IAsyncAction^ m_inputLoopWorker; + Windows::UI::Core::CoreIndependentInputSource^ m_coreInput; + + // Independent input handling functions. + void OnPointerPressed(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e); + void OnPointerMoved(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e); + void OnPointerReleased(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e); + }; +} diff --git a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/pch.cpp b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/pch.cpp new file mode 100644 index 0000000000..bcb5590be1 --- /dev/null +++ b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/pch.cpp @@ -0,0 +1 @@ +#include "pch.h" diff --git a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/pch.h b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/pch.h new file mode 100644 index 0000000000..2e511d964f --- /dev/null +++ b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Shared/pch.h @@ -0,0 +1,14 @@ +// +// pch.h +// Header for standard system include files. +// + +#pragma once + +#include +#include + +#include "cocos2d.h" +#include "cocos-ext.h" + + diff --git a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Windows/Assets/Logo.scale-100.png b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Windows/Assets/Logo.scale-100.png new file mode 100644 index 0000000000..e26771cb33 Binary files /dev/null and b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Windows/Assets/Logo.scale-100.png differ diff --git a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Windows/Assets/SmallLogo.scale-100.png b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Windows/Assets/SmallLogo.scale-100.png new file mode 100644 index 0000000000..1eb0d9d528 Binary files /dev/null and b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Windows/Assets/SmallLogo.scale-100.png differ diff --git a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Windows/Assets/SplashScreen.scale-100.png b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Windows/Assets/SplashScreen.scale-100.png new file mode 100644 index 0000000000..d8ded7198a Binary files /dev/null and b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Windows/Assets/SplashScreen.scale-100.png differ diff --git a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Windows/Assets/StoreLogo.scale-100.png b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Windows/Assets/StoreLogo.scale-100.png new file mode 100644 index 0000000000..dcb672712c Binary files /dev/null and b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Windows/Assets/StoreLogo.scale-100.png differ diff --git a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Windows/HelloCpp.Windows.vcxproj b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Windows/HelloCpp.Windows.vcxproj new file mode 100644 index 0000000000..9426841b54 --- /dev/null +++ b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Windows/HelloCpp.Windows.vcxproj @@ -0,0 +1,192 @@ + + + + + Debug + ARM + + + Debug + Win32 + + + Debug + x64 + + + Release + ARM + + + Release + Win32 + + + Release + x64 + + + + {79a8fcda-4b12-4dd1-b676-ff148d651638} + cocos2d + en-US + 12.0 + true + Windows Store + 8.1 + + + + Application + true + v120 + + + Application + true + v120 + + + Application + true + v120 + + + Application + false + true + v120 + + + Application + false + true + v120 + + + Application + false + true + v120 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + HelloCpp.Windows_TemporaryKey.pfx + True + x86 + + + + /bigobj /Zm200 %(AdditionalOptions) + 4453;28204;4756;%(DisableSpecificWarnings) + pch.h + ../../Classes;%(AdditionalIncludeDirectories) + + + + + /bigobj /Zm200 %(AdditionalOptions) + 4453;28204;4756;%(DisableSpecificWarnings) + pch.h + ../../Classes;%(AdditionalIncludeDirectories) + + + + + /bigobj /Zm200 %(AdditionalOptions) + 4453;28204;4756;%(DisableSpecificWarnings) + pch.h + ../../Classes;%(AdditionalIncludeDirectories) + + + + + /bigobj /Zm200 %(AdditionalOptions) + 4453;28204;4756;%(DisableSpecificWarnings) + pch.h + ../../Classes;%(AdditionalIncludeDirectories) + + + + + /bigobj /Zm200 %(AdditionalOptions) + 4453;28204;4756;%(DisableSpecificWarnings) + pch.h + ../../Classes;%(AdditionalIncludeDirectories) + + + + + /bigobj /Zm200 %(AdditionalOptions) + 4453;28204;4756;%(DisableSpecificWarnings) + pch.h + ../../Classes;%(AdditionalIncludeDirectories) + + + + + Designer + + + + + + + + + + + + {9335005f-678e-4e8e-9b84-50037216aec8} + + + {f3550fe0-c795-44f6-8feb-093eb68143ae} + + + {3b26a12d-3a44-47ea-82d2-282660fc844d} + + + + + + \ No newline at end of file diff --git a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Windows/HelloCpp.Windows.vcxproj.filters b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Windows/HelloCpp.Windows.vcxproj.filters new file mode 100644 index 0000000000..3cdafaeec0 --- /dev/null +++ b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Windows/HelloCpp.Windows.vcxproj.filters @@ -0,0 +1,29 @@ + + + + + {1a9fa652-867e-41d2-8588-962f108d2d8f} + bmp;fbx;gif;jpg;jpeg;tga;tiff;tif;png + + + + + + + + + + + Assets + + + Assets + + + Assets + + + Assets + + + \ No newline at end of file diff --git a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Windows/HelloCpp.Windows_TemporaryKey.pfx b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Windows/HelloCpp.Windows_TemporaryKey.pfx new file mode 100644 index 0000000000..5ad010651a Binary files /dev/null and b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Windows/HelloCpp.Windows_TemporaryKey.pfx differ diff --git a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Windows/Package.appxmanifest b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Windows/Package.appxmanifest new file mode 100644 index 0000000000..6418109719 --- /dev/null +++ b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.Windows/Package.appxmanifest @@ -0,0 +1,30 @@ + + + + + HelloCpp.Windows + dalestam + Assets\StoreLogo.png + + + 6.3.0 + 6.3.0 + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.WindowsPhone/Assets/Logo.scale-240.png b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.WindowsPhone/Assets/Logo.scale-240.png new file mode 100644 index 0000000000..76921ca997 Binary files /dev/null and b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.WindowsPhone/Assets/Logo.scale-240.png differ diff --git a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.WindowsPhone/Assets/SmallLogo.scale-240.png b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.WindowsPhone/Assets/SmallLogo.scale-240.png new file mode 100644 index 0000000000..316630124f Binary files /dev/null and b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.WindowsPhone/Assets/SmallLogo.scale-240.png differ diff --git a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.WindowsPhone/Assets/SplashScreen.scale-240.png b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.WindowsPhone/Assets/SplashScreen.scale-240.png new file mode 100644 index 0000000000..b0b6bc08e5 Binary files /dev/null and b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.WindowsPhone/Assets/SplashScreen.scale-240.png differ diff --git a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.WindowsPhone/Assets/Square71x71Logo.scale-240.png b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.WindowsPhone/Assets/Square71x71Logo.scale-240.png new file mode 100644 index 0000000000..cfa54bee03 Binary files /dev/null and b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.WindowsPhone/Assets/Square71x71Logo.scale-240.png differ diff --git a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.WindowsPhone/Assets/StoreLogo.scale-240.png b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.WindowsPhone/Assets/StoreLogo.scale-240.png new file mode 100644 index 0000000000..47e084b593 Binary files /dev/null and b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.WindowsPhone/Assets/StoreLogo.scale-240.png differ diff --git a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.WindowsPhone/Assets/WideLogo.scale-240.png b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.WindowsPhone/Assets/WideLogo.scale-240.png new file mode 100644 index 0000000000..6249d29db0 Binary files /dev/null and b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.WindowsPhone/Assets/WideLogo.scale-240.png differ diff --git a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.WindowsPhone/HelloCpp.WindowsPhone.vcxproj b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.WindowsPhone/HelloCpp.WindowsPhone.vcxproj new file mode 100644 index 0000000000..7e8ae34bb4 --- /dev/null +++ b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.WindowsPhone/HelloCpp.WindowsPhone.vcxproj @@ -0,0 +1,144 @@ + + + + + Debug + ARM + + + Debug + Win32 + + + Release + ARM + + + Release + Win32 + + + + {396fe85e-bb05-4b92-bccb-f89aed4ea41a} + cocos2d + en-US + 12.0 + true + Windows Phone + 8.1 + + + + Application + true + v120_wp81 + + + Application + true + v120_wp81 + + + Application + false + true + v120_wp81 + + + Application + false + true + v120_wp81 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + True + arm + + + + /bigobj /Zm200 %(AdditionalOptions) + 4453;28204;4756;%(DisableSpecificWarnings) + pch.h + ../../Classes;%(AdditionalIncludeDirectories) + + + + + /bigobj /Zm200 %(AdditionalOptions) + 4453;28204;4756;%(DisableSpecificWarnings) + pch.h + ../../Classes;%(AdditionalIncludeDirectories) + + + + + /bigobj /Zm200 %(AdditionalOptions) + 4453;28204;4756;%(DisableSpecificWarnings) + pch.h + ../../Classes;%(AdditionalIncludeDirectories) + + + + + /bigobj /Zm200 %(AdditionalOptions) + 4453;28204;4756;%(DisableSpecificWarnings) + pch.h + ../../Classes;%(AdditionalIncludeDirectories) + + + + + Designer + + + + + + + + + + + + + {22f3b9df-1209-4574-8331-003966f562bf} + + + {cc1da216-a80d-4be4-b309-acb6af313aff} + + + {22f798d8-bfff-4754-996f-a5395343d5ec} + + + + + + \ No newline at end of file diff --git a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.WindowsPhone/HelloCpp.WindowsPhone.vcxproj.filters b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.WindowsPhone/HelloCpp.WindowsPhone.vcxproj.filters new file mode 100644 index 0000000000..eb71f325ca --- /dev/null +++ b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.WindowsPhone/HelloCpp.WindowsPhone.vcxproj.filters @@ -0,0 +1,30 @@ + + + + + {c8beb60d-689b-4aaa-9749-99bd3e2dcf75} + bmp;fbx;gif;jpg;jpeg;tga;tiff;tif;png + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + + + + \ No newline at end of file diff --git a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.WindowsPhone/Package.appxmanifest b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.WindowsPhone/Package.appxmanifest new file mode 100644 index 0000000000..eb4bab30a4 --- /dev/null +++ b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.WindowsPhone/Package.appxmanifest @@ -0,0 +1,33 @@ + + + + + + HelloCpp.WindowsPhone + dalestam + Assets\StoreLogo.png + + + 6.3.1 + 6.3.1 + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.sln b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.sln new file mode 100644 index 0000000000..d0d8a4e3d5 --- /dev/null +++ b/templates/cpp-template-default/proj.win8.1-universal/HelloCpp.sln @@ -0,0 +1,181 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.30723.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "HelloCpp", "HelloCpp", "{36AFDE04-D127-4D84-9730-D84E3E51EAA7}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloCpp.Shared", "HelloCpp.Shared\HelloCpp.Shared.vcxitems", "{A3AD93E4-0B2F-4C58-9181-69BED2E42E3E}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloCpp.Windows", "HelloCpp.Windows\HelloCpp.Windows.vcxproj", "{79A8FCDA-4B12-4DD1-B676-FF148D651638}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloCpp.WindowsPhone", "HelloCpp.WindowsPhone\HelloCpp.WindowsPhone.vcxproj", "{396FE85E-BB05-4B92-BCCB-F89AED4EA41A}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libcocos2d", "libcocos2d", "{80DA05C1-6532-4D2A-8606-EF02079B1373}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "External", "External", "{F13CB4F7-BEE5-4368-A815-A971797387D8}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libbox2d", "libbox2d", "{626C3EB8-F53B-41D0-BEA8-44EACAA1228C}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libSpine", "libSpine", "{D0E32B77-3B4F-44F8-AEBC-12EE8BBF1783}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbox2d.Shared", "..\cocos2d\external\Box2D\proj.win8.1-universal\libbox2d.Shared\libbox2d.Shared.vcxitems", "{4A3C6BA8-C227-498B-AA21-40BDA27B461F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbox2d.Windows", "..\cocos2d\external\Box2D\proj.win8.1-universal\libbox2d.Windows\libbox2d.Windows.vcxproj", "{3B26A12D-3A44-47EA-82D2-282660FC844D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbox2d.WindowsPhone", "..\cocos2d\external\Box2D\proj.win8.1-universal\libbox2d.WindowsPhone\libbox2d.WindowsPhone.vcxproj", "{22F798D8-BFFF-4754-996F-A5395343D5EC}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libSpine.Shared", "..\cocos2d\cocos\editor-support\spine\proj.win8.1-universal\libSpine.Shared\libSpine.Shared.vcxitems", "{ADAFD00D-A0D6-46EF-9F0B-EA2880BFE1DE}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libSpine.Windows", "..\cocos2d\cocos\editor-support\spine\proj.win8.1-universal\libSpine.Windows\libSpine.Windows.vcxproj", "{F3550FE0-C795-44F6-8FEB-093EB68143AE}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libSpine.WindowsPhone", "..\cocos2d\cocos\editor-support\spine\proj.win8.1-universal\libSpine.WindowsPhone\libSpine.WindowsPhone.vcxproj", "{CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d_8_1.Shared", "..\cocos2d\cocos\2d\libcocos2d_8_1\libcocos2d_8_1\libcocos2d_8_1.Shared\libcocos2d_8_1.Shared.vcxitems", "{5D6F020F-7E72-4494-90A0-2DF11D235DF9}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d_8_1.Windows", "..\cocos2d\cocos\2d\libcocos2d_8_1\libcocos2d_8_1\libcocos2d_8_1.Windows\libcocos2d_8_1.Windows.vcxproj", "{9335005F-678E-4E8E-9B84-50037216AEC8}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d_8_1.WindowsPhone", "..\cocos2d\cocos\2d\libcocos2d_8_1\libcocos2d_8_1\libcocos2d_8_1.WindowsPhone\libcocos2d_8_1.WindowsPhone.vcxproj", "{22F3B9DF-1209-4574-8331-003966F562BF}" +EndProject +Global + GlobalSection(SharedMSBuildProjectFiles) = preSolution + ..\cocos2d\cocos\2d\libcocos2d_8_1\libcocos2d_8_1\libcocos2d_8_1.Shared\libcocos2d_8_1.Shared.vcxitems*{9335005f-678e-4e8e-9b84-50037216aec8}*SharedItemsImports = 4 + HelloCpp.Shared\HelloCpp.Shared.vcxitems*{a3ad93e4-0b2f-4c58-9181-69bed2e42e3e}*SharedItemsImports = 9 + ..\cocos2d\cocos\editor-support\spine\proj.win8.1-universal\libSpine.Shared\libSpine.Shared.vcxitems*{cc1da216-a80d-4be4-b309-acb6af313aff}*SharedItemsImports = 4 + ..\cocos2d\external\Box2D\proj.win8.1-universal\libbox2d.Shared\libbox2d.Shared.vcxitems*{4a3c6ba8-c227-498b-aa21-40bda27b461f}*SharedItemsImports = 9 + HelloCpp.Shared\HelloCpp.Shared.vcxitems*{79a8fcda-4b12-4dd1-b676-ff148d651638}*SharedItemsImports = 4 + ..\cocos2d\cocos\editor-support\spine\proj.win8.1-universal\libSpine.Shared\libSpine.Shared.vcxitems*{adafd00d-a0d6-46ef-9f0b-ea2880bfe1de}*SharedItemsImports = 9 + ..\cocos2d\cocos\2d\libcocos2d_8_1\libcocos2d_8_1\libcocos2d_8_1.Shared\libcocos2d_8_1.Shared.vcxitems*{5d6f020f-7e72-4494-90a0-2df11d235df9}*SharedItemsImports = 9 + ..\cocos2d\external\Box2D\proj.win8.1-universal\libbox2d.Shared\libbox2d.Shared.vcxitems*{3b26a12d-3a44-47ea-82d2-282660fc844d}*SharedItemsImports = 4 + ..\cocos2d\cocos\2d\libcocos2d_8_1\libcocos2d_8_1\libcocos2d_8_1.Shared\libcocos2d_8_1.Shared.vcxitems*{22f3b9df-1209-4574-8331-003966f562bf}*SharedItemsImports = 4 + ..\cocos2d\external\Box2D\proj.win8.1-universal\libbox2d.Shared\libbox2d.Shared.vcxitems*{22f798d8-bfff-4754-996f-a5395343d5ec}*SharedItemsImports = 4 + ..\cocos2d\cocos\editor-support\spine\proj.win8.1-universal\libSpine.Shared\libSpine.Shared.vcxitems*{f3550fe0-c795-44f6-8feb-093eb68143ae}*SharedItemsImports = 4 + HelloCpp.Shared\HelloCpp.Shared.vcxitems*{396fe85e-bb05-4b92-bccb-f89aed4ea41a}*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 + {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Debug|ARM.ActiveCfg = Debug|ARM + {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Debug|ARM.Build.0 = Debug|ARM + {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Debug|ARM.Deploy.0 = Debug|ARM + {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Debug|Win32.ActiveCfg = Debug|Win32 + {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Debug|Win32.Build.0 = Debug|Win32 + {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Debug|Win32.Deploy.0 = Debug|Win32 + {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Debug|x64.ActiveCfg = Debug|x64 + {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Debug|x64.Build.0 = Debug|x64 + {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Debug|x64.Deploy.0 = Debug|x64 + {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Release|ARM.ActiveCfg = Release|ARM + {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Release|ARM.Build.0 = Release|ARM + {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Release|ARM.Deploy.0 = Release|ARM + {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Release|Win32.ActiveCfg = Release|Win32 + {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Release|Win32.Build.0 = Release|Win32 + {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Release|Win32.Deploy.0 = Release|Win32 + {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Release|x64.ActiveCfg = Release|x64 + {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Release|x64.Build.0 = Release|x64 + {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Release|x64.Deploy.0 = Release|x64 + {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Debug|ARM.ActiveCfg = Debug|ARM + {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Debug|ARM.Build.0 = Debug|ARM + {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Debug|ARM.Deploy.0 = Debug|ARM + {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Debug|Win32.ActiveCfg = Debug|Win32 + {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Debug|Win32.Build.0 = Debug|Win32 + {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Debug|Win32.Deploy.0 = Debug|Win32 + {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Debug|x64.ActiveCfg = Debug|Win32 + {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Release|ARM.ActiveCfg = Release|ARM + {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Release|ARM.Build.0 = Release|ARM + {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Release|ARM.Deploy.0 = Release|ARM + {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Release|Win32.ActiveCfg = Release|Win32 + {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Release|Win32.Build.0 = Release|Win32 + {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Release|Win32.Deploy.0 = Release|Win32 + {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Release|x64.ActiveCfg = Release|Win32 + {3B26A12D-3A44-47EA-82D2-282660FC844D}.Debug|ARM.ActiveCfg = Debug|ARM + {3B26A12D-3A44-47EA-82D2-282660FC844D}.Debug|ARM.Build.0 = Debug|ARM + {3B26A12D-3A44-47EA-82D2-282660FC844D}.Debug|Win32.ActiveCfg = Debug|Win32 + {3B26A12D-3A44-47EA-82D2-282660FC844D}.Debug|Win32.Build.0 = Debug|Win32 + {3B26A12D-3A44-47EA-82D2-282660FC844D}.Debug|x64.ActiveCfg = Debug|x64 + {3B26A12D-3A44-47EA-82D2-282660FC844D}.Debug|x64.Build.0 = Debug|x64 + {3B26A12D-3A44-47EA-82D2-282660FC844D}.Release|ARM.ActiveCfg = Release|ARM + {3B26A12D-3A44-47EA-82D2-282660FC844D}.Release|ARM.Build.0 = Release|ARM + {3B26A12D-3A44-47EA-82D2-282660FC844D}.Release|Win32.ActiveCfg = Release|Win32 + {3B26A12D-3A44-47EA-82D2-282660FC844D}.Release|Win32.Build.0 = Release|Win32 + {3B26A12D-3A44-47EA-82D2-282660FC844D}.Release|x64.ActiveCfg = Release|x64 + {3B26A12D-3A44-47EA-82D2-282660FC844D}.Release|x64.Build.0 = Release|x64 + {22F798D8-BFFF-4754-996F-A5395343D5EC}.Debug|ARM.ActiveCfg = Debug|ARM + {22F798D8-BFFF-4754-996F-A5395343D5EC}.Debug|ARM.Build.0 = Debug|ARM + {22F798D8-BFFF-4754-996F-A5395343D5EC}.Debug|Win32.ActiveCfg = Debug|Win32 + {22F798D8-BFFF-4754-996F-A5395343D5EC}.Debug|Win32.Build.0 = Debug|Win32 + {22F798D8-BFFF-4754-996F-A5395343D5EC}.Debug|x64.ActiveCfg = Debug|Win32 + {22F798D8-BFFF-4754-996F-A5395343D5EC}.Release|ARM.ActiveCfg = Release|ARM + {22F798D8-BFFF-4754-996F-A5395343D5EC}.Release|ARM.Build.0 = Release|ARM + {22F798D8-BFFF-4754-996F-A5395343D5EC}.Release|Win32.ActiveCfg = Release|Win32 + {22F798D8-BFFF-4754-996F-A5395343D5EC}.Release|Win32.Build.0 = Release|Win32 + {22F798D8-BFFF-4754-996F-A5395343D5EC}.Release|x64.ActiveCfg = Release|Win32 + {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Debug|ARM.ActiveCfg = Debug|ARM + {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Debug|ARM.Build.0 = Debug|ARM + {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Debug|Win32.ActiveCfg = Debug|Win32 + {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Debug|Win32.Build.0 = Debug|Win32 + {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Debug|x64.ActiveCfg = Debug|x64 + {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Debug|x64.Build.0 = Debug|x64 + {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Release|ARM.ActiveCfg = Release|ARM + {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Release|ARM.Build.0 = Release|ARM + {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Release|Win32.ActiveCfg = Release|Win32 + {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Release|Win32.Build.0 = Release|Win32 + {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Release|x64.ActiveCfg = Release|x64 + {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Release|x64.Build.0 = Release|x64 + {CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Debug|ARM.ActiveCfg = Debug|ARM + {CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Debug|ARM.Build.0 = Debug|ARM + {CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Debug|Win32.ActiveCfg = Debug|Win32 + {CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Debug|Win32.Build.0 = Debug|Win32 + {CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Debug|x64.ActiveCfg = Debug|Win32 + {CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Release|ARM.ActiveCfg = Release|ARM + {CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Release|ARM.Build.0 = Release|ARM + {CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Release|Win32.ActiveCfg = Release|Win32 + {CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Release|Win32.Build.0 = Release|Win32 + {CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Release|x64.ActiveCfg = Release|Win32 + {9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|ARM.ActiveCfg = Debug|ARM + {9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|ARM.Build.0 = Debug|ARM + {9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|Win32.ActiveCfg = Debug|Win32 + {9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|Win32.Build.0 = Debug|Win32 + {9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|x64.ActiveCfg = Debug|x64 + {9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|x64.Build.0 = Debug|x64 + {9335005F-678E-4E8E-9B84-50037216AEC8}.Release|ARM.ActiveCfg = Release|ARM + {9335005F-678E-4E8E-9B84-50037216AEC8}.Release|ARM.Build.0 = Release|ARM + {9335005F-678E-4E8E-9B84-50037216AEC8}.Release|Win32.ActiveCfg = Release|Win32 + {9335005F-678E-4E8E-9B84-50037216AEC8}.Release|Win32.Build.0 = Release|Win32 + {9335005F-678E-4E8E-9B84-50037216AEC8}.Release|x64.ActiveCfg = Release|x64 + {9335005F-678E-4E8E-9B84-50037216AEC8}.Release|x64.Build.0 = Release|x64 + {22F3B9DF-1209-4574-8331-003966F562BF}.Debug|ARM.ActiveCfg = Debug|ARM + {22F3B9DF-1209-4574-8331-003966F562BF}.Debug|ARM.Build.0 = Debug|ARM + {22F3B9DF-1209-4574-8331-003966F562BF}.Debug|Win32.ActiveCfg = Debug|Win32 + {22F3B9DF-1209-4574-8331-003966F562BF}.Debug|Win32.Build.0 = Debug|Win32 + {22F3B9DF-1209-4574-8331-003966F562BF}.Debug|x64.ActiveCfg = Debug|Win32 + {22F3B9DF-1209-4574-8331-003966F562BF}.Release|ARM.ActiveCfg = Release|ARM + {22F3B9DF-1209-4574-8331-003966F562BF}.Release|ARM.Build.0 = Release|ARM + {22F3B9DF-1209-4574-8331-003966F562BF}.Release|Win32.ActiveCfg = Release|Win32 + {22F3B9DF-1209-4574-8331-003966F562BF}.Release|Win32.Build.0 = Release|Win32 + {22F3B9DF-1209-4574-8331-003966F562BF}.Release|x64.ActiveCfg = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {A3AD93E4-0B2F-4C58-9181-69BED2E42E3E} = {36AFDE04-D127-4D84-9730-D84E3E51EAA7} + {79A8FCDA-4B12-4DD1-B676-FF148D651638} = {36AFDE04-D127-4D84-9730-D84E3E51EAA7} + {396FE85E-BB05-4B92-BCCB-F89AED4EA41A} = {36AFDE04-D127-4D84-9730-D84E3E51EAA7} + {626C3EB8-F53B-41D0-BEA8-44EACAA1228C} = {F13CB4F7-BEE5-4368-A815-A971797387D8} + {D0E32B77-3B4F-44F8-AEBC-12EE8BBF1783} = {F13CB4F7-BEE5-4368-A815-A971797387D8} + {4A3C6BA8-C227-498B-AA21-40BDA27B461F} = {626C3EB8-F53B-41D0-BEA8-44EACAA1228C} + {3B26A12D-3A44-47EA-82D2-282660FC844D} = {626C3EB8-F53B-41D0-BEA8-44EACAA1228C} + {22F798D8-BFFF-4754-996F-A5395343D5EC} = {626C3EB8-F53B-41D0-BEA8-44EACAA1228C} + {ADAFD00D-A0D6-46EF-9F0B-EA2880BFE1DE} = {D0E32B77-3B4F-44F8-AEBC-12EE8BBF1783} + {F3550FE0-C795-44F6-8FEB-093EB68143AE} = {D0E32B77-3B4F-44F8-AEBC-12EE8BBF1783} + {CC1DA216-A80D-4BE4-B309-ACB6AF313AFF} = {D0E32B77-3B4F-44F8-AEBC-12EE8BBF1783} + {5D6F020F-7E72-4494-90A0-2DF11D235DF9} = {80DA05C1-6532-4D2A-8606-EF02079B1373} + {9335005F-678E-4E8E-9B84-50037216AEC8} = {80DA05C1-6532-4D2A-8606-EF02079B1373} + {22F3B9DF-1209-4574-8331-003966F562BF} = {80DA05C1-6532-4D2A-8606-EF02079B1373} + EndGlobalSection +EndGlobal diff --git a/templates/cpp-template-default/proj.wp8-xaml/App/App.xaml b/templates/cpp-template-default/proj.wp8-xaml/App/App.xaml index 02706a5450..4e5975de2a 100644 --- a/templates/cpp-template-default/proj.wp8-xaml/App/App.xaml +++ b/templates/cpp-template-default/proj.wp8-xaml/App/App.xaml @@ -1,5 +1,5 @@  - + diff --git a/templates/cpp-template-default/proj.wp8-xaml/App/App.xaml.cs b/templates/cpp-template-default/proj.wp8-xaml/App/App.xaml.cs index c97119aec5..3553e5f82f 100644 --- a/templates/cpp-template-default/proj.wp8-xaml/App/App.xaml.cs +++ b/templates/cpp-template-default/proj.wp8-xaml/App/App.xaml.cs @@ -7,9 +7,8 @@ using System.Windows.Navigation; using Microsoft.Phone.Controls; using Microsoft.Phone.Shell; using System.IO.IsolatedStorage; -using PhoneDirect3DXamlAppInterop.Resources; -namespace PhoneDirect3DXamlAppInterop +namespace cocos2d { public partial class App : Application { diff --git a/templates/cpp-template-default/proj.wp8-xaml/App/EditBox.xaml b/templates/cpp-template-default/proj.wp8-xaml/App/EditBox.xaml index 8a179c3ab4..a1259d3268 100644 --- a/templates/cpp-template-default/proj.wp8-xaml/App/EditBox.xaml +++ b/templates/cpp-template-default/proj.wp8-xaml/App/EditBox.xaml @@ -1,4 +1,4 @@ -{C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} Library Properties - PhoneDirect3DXamlAppInterop - PhoneDirect3DXamlAppInterop + cocos2d + HelloCpp WindowsPhone v8.0 $(TargetFrameworkVersion) @@ -19,9 +19,9 @@ true true - PhoneDirect3DXamlAppInterop_$(Configuration)_$(Platform).xap + HelloCpp_$(Configuration)_$(Platform).xap Properties\AppManifest.xml - PhoneDirect3DXamlAppInterop.App + cocos2d.App true 11.0 true diff --git a/templates/cpp-template-default/proj.wp8-xaml/App/LocalizedStrings.cs b/templates/cpp-template-default/proj.wp8-xaml/App/LocalizedStrings.cs index a7c1f23777..4c0d4ba292 100644 --- a/templates/cpp-template-default/proj.wp8-xaml/App/LocalizedStrings.cs +++ b/templates/cpp-template-default/proj.wp8-xaml/App/LocalizedStrings.cs @@ -1,6 +1,6 @@ -using PhoneDirect3DXamlAppInterop.Resources; +using cocos2d.Resources; -namespace PhoneDirect3DXamlAppInterop +namespace cocos2d { /// /// Provides access to string resources. diff --git a/templates/cpp-template-default/proj.wp8-xaml/App/MainPage.xaml b/templates/cpp-template-default/proj.wp8-xaml/App/MainPage.xaml index 53fca91bdb..fa08ba79d6 100644 --- a/templates/cpp-template-default/proj.wp8-xaml/App/MainPage.xaml +++ b/templates/cpp-template-default/proj.wp8-xaml/App/MainPage.xaml @@ -1,5 +1,5 @@  0) + { + m_d3dInterop.OnCocos2dKeyEvent(Cocos2dKeyEvent.Text, m_textBox.Text); + m_textBox.Text = ""; + } } // Called by the Cocos2d-x C++ engine to display a MessageBox @@ -181,7 +182,6 @@ namespace PhoneDirect3DXamlAppInterop m_textBox.TextChanged += OnTextChanged; DrawingSurfaceBackground.Children.Add(m_textBox); } - m_textBox.Text = text; m_textBox.SelectionLength = 0; m_textBox.SelectionStart = int.MaxValue; m_textBox.Focus(); diff --git a/templates/cpp-template-default/proj.wp8-xaml/App/Properties/AssemblyInfo.cs b/templates/cpp-template-default/proj.wp8-xaml/App/Properties/AssemblyInfo.cs index 1b6c5d6478..c5921e1749 100644 --- a/templates/cpp-template-default/proj.wp8-xaml/App/Properties/AssemblyInfo.cs +++ b/templates/cpp-template-default/proj.wp8-xaml/App/Properties/AssemblyInfo.cs @@ -6,11 +6,11 @@ using System.Resources; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("PhoneDirect3DXamlAppInterop")] +[assembly: AssemblyTitle("cocos2d")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("PhoneDirect3DXamlAppInterop")] +[assembly: AssemblyProduct("cocos2d")] [assembly: AssemblyCopyright("Copyright © 2012")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/templates/cpp-template-default/proj.wp8-xaml/App/Properties/WMAppManifest.xml b/templates/cpp-template-default/proj.wp8-xaml/App/Properties/WMAppManifest.xml index 8622bf45fc..4c40163d98 100644 --- a/templates/cpp-template-default/proj.wp8-xaml/App/Properties/WMAppManifest.xml +++ b/templates/cpp-template-default/proj.wp8-xaml/App/Properties/WMAppManifest.xml @@ -1,30 +1,35 @@  - + Assets\ApplicationIcon.png - - - - - + + + + + - + - + Assets\Tiles\FlipCycleTileSmall.png 0 Assets\Tiles\FlipCycleTileMedium.png - PhoneDirect3DXamlAppInterop - - - - - + HelloCpp + + + + + + + + + + diff --git a/templates/cpp-template-default/proj.wp8-xaml/App/Resources/AppResources.Designer.cs b/templates/cpp-template-default/proj.wp8-xaml/App/Resources/AppResources.Designer.cs index bf26a41d6e..733f693ea6 100644 --- a/templates/cpp-template-default/proj.wp8-xaml/App/Resources/AppResources.Designer.cs +++ b/templates/cpp-template-default/proj.wp8-xaml/App/Resources/AppResources.Designer.cs @@ -8,7 +8,8 @@ // //------------------------------------------------------------------------------ -namespace PhoneDirect3DXamlAppInterop.Resources { +namespace cocos2d.Resources +{ using System; diff --git a/templates/cpp-template-default/proj.wp8-xaml/AppComponent/HelloCppComponent.vcxproj b/templates/cpp-template-default/proj.wp8-xaml/AppComponent/HelloCppComponent.vcxproj index 001e96c4c4..a5da28a426 100644 --- a/templates/cpp-template-default/proj.wp8-xaml/AppComponent/HelloCppComponent.vcxproj +++ b/templates/cpp-template-default/proj.wp8-xaml/AppComponent/HelloCppComponent.vcxproj @@ -20,7 +20,7 @@ {60ec6889-c3c4-45ad-a006-47d9ee689212} - PhoneDirect3DXamlAppComponent + cocos2d en-US 11.0 true diff --git a/templates/cpp-template-default/proj.wp8-xaml/AppComponent/src/Cocos2dRenderer.cpp b/templates/cpp-template-default/proj.wp8-xaml/AppComponent/src/Cocos2dRenderer.cpp index d0d5a5f61c..c3cd6ca388 100644 --- a/templates/cpp-template-default/proj.wp8-xaml/AppComponent/src/Cocos2dRenderer.cpp +++ b/templates/cpp-template-default/proj.wp8-xaml/AppComponent/src/Cocos2dRenderer.cpp @@ -35,7 +35,6 @@ using namespace DirectX; using namespace Microsoft::WRL; using namespace Windows::Foundation; using namespace Windows::UI::Core; -using namespace PhoneDirect3DXamlAppComponent; USING_NS_CC; @@ -151,7 +150,7 @@ void Cocos2dRenderer::OnCocos2dKeyEvent(Cocos2dKeyEvent event) } -void Cocos2dRenderer::SetXamlEventDelegate(PhoneDirect3DXamlAppComponent::Cocos2dEventDelegate^ delegate) +void Cocos2dRenderer::SetXamlEventDelegate(Cocos2dEventDelegate^ delegate) { m_delegate = delegate; GLViewImpl* eglView = GLViewImpl::sharedOpenGLView(); @@ -161,7 +160,7 @@ void Cocos2dRenderer::SetXamlEventDelegate(PhoneDirect3DXamlAppComponent::Cocos2 } } -void Cocos2dRenderer::SetXamlMessageBoxDelegate(PhoneDirect3DXamlAppComponent::Cocos2dMessageBoxDelegate^ delegate) +void Cocos2dRenderer::SetXamlMessageBoxDelegate(Cocos2dMessageBoxDelegate^ delegate) { m_messageBoxDelegate = delegate; GLViewImpl* eglView = GLViewImpl::sharedOpenGLView(); @@ -171,7 +170,7 @@ void Cocos2dRenderer::SetXamlMessageBoxDelegate(PhoneDirect3DXamlAppComponent::C } } -void Cocos2dRenderer::SetXamlEditBoxDelegate(PhoneDirect3DXamlAppComponent::Cocos2dEditBoxDelegate^ delegate) +void Cocos2dRenderer::SetXamlEditBoxDelegate(Cocos2dEditBoxDelegate^ delegate) { m_editBoxDelegate = delegate; GLViewImpl* eglView = GLViewImpl::sharedOpenGLView(); @@ -181,7 +180,7 @@ void Cocos2dRenderer::SetXamlEditBoxDelegate(PhoneDirect3DXamlAppComponent::Coco } } -void Cocos2dRenderer::SetXamlOpenURLDelegate(PhoneDirect3DXamlAppComponent::Cocos2dOpenURLDelegate^ delegate) +void Cocos2dRenderer::SetXamlOpenURLDelegate(Cocos2dOpenURLDelegate^ delegate) { m_openURLDelegate = delegate; Application* app = Application::getInstance(); diff --git a/templates/cpp-template-default/proj.wp8-xaml/AppComponent/src/Cocos2dRenderer.h b/templates/cpp-template-default/proj.wp8-xaml/AppComponent/src/Cocos2dRenderer.h index 55e84b12cb..b1799312c0 100644 --- a/templates/cpp-template-default/proj.wp8-xaml/AppComponent/src/Cocos2dRenderer.h +++ b/templates/cpp-template-default/proj.wp8-xaml/AppComponent/src/Cocos2dRenderer.h @@ -41,11 +41,11 @@ public: void OnBackButton(); void OnKeyPressed(Platform::String^ text); - void OnCocos2dKeyEvent(PhoneDirect3DXamlAppComponent::Cocos2dKeyEvent event); - void SetXamlEventDelegate(PhoneDirect3DXamlAppComponent::Cocos2dEventDelegate^ delegate); - void SetXamlMessageBoxDelegate(PhoneDirect3DXamlAppComponent::Cocos2dMessageBoxDelegate^ delegate); - void SetXamlEditBoxDelegate(PhoneDirect3DXamlAppComponent::Cocos2dEditBoxDelegate^ delegate); - void SetXamlOpenURLDelegate(PhoneDirect3DXamlAppComponent::Cocos2dOpenURLDelegate^ delegate); + void OnCocos2dKeyEvent(cocos2d::Cocos2dKeyEvent event); + void SetXamlEventDelegate(cocos2d::Cocos2dEventDelegate^ delegate); + void SetXamlMessageBoxDelegate(cocos2d::Cocos2dMessageBoxDelegate^ delegate); + void SetXamlEditBoxDelegate(cocos2d::Cocos2dEditBoxDelegate^ delegate); + void SetXamlOpenURLDelegate(cocos2d::Cocos2dOpenURLDelegate^ delegate); Windows::Foundation::IAsyncAction^ OnSuspending(); void Connect(); @@ -59,10 +59,10 @@ private: bool m_loadingComplete; bool mInitialized; - PhoneDirect3DXamlAppComponent::Cocos2dEventDelegate^ m_delegate; - PhoneDirect3DXamlAppComponent::Cocos2dMessageBoxDelegate^ m_messageBoxDelegate; - PhoneDirect3DXamlAppComponent::Cocos2dEditBoxDelegate^ m_editBoxDelegate; - PhoneDirect3DXamlAppComponent::Cocos2dOpenURLDelegate^ m_openURLDelegate; + cocos2d::Cocos2dEventDelegate^ m_delegate; + cocos2d::Cocos2dMessageBoxDelegate^ m_messageBoxDelegate; + cocos2d::Cocos2dEditBoxDelegate^ m_editBoxDelegate; + cocos2d::Cocos2dOpenURLDelegate^ m_openURLDelegate; // The AppDelegate for the Cocos2D app AppDelegate* mApp; diff --git a/templates/cpp-template-default/proj.wp8-xaml/AppComponent/src/Direct3DContentProvider.cpp b/templates/cpp-template-default/proj.wp8-xaml/AppComponent/src/Direct3DContentProvider.cpp index 323d0b556d..7bfdf80366 100644 --- a/templates/cpp-template-default/proj.wp8-xaml/AppComponent/src/Direct3DContentProvider.cpp +++ b/templates/cpp-template-default/proj.wp8-xaml/AppComponent/src/Direct3DContentProvider.cpp @@ -26,7 +26,7 @@ THE SOFTWARE. #include "Direct3DContentProvider.h" #include "Direct3DInterop.h" -using namespace PhoneDirect3DXamlAppComponent; +using namespace cocos2d; Direct3DContentProvider::Direct3DContentProvider(Direct3DInterop^ controller) : m_controller(controller) diff --git a/templates/cpp-template-default/proj.wp8-xaml/AppComponent/src/Direct3DContentProvider.h b/templates/cpp-template-default/proj.wp8-xaml/AppComponent/src/Direct3DContentProvider.h index 7a9d941074..830496c1f4 100644 --- a/templates/cpp-template-default/proj.wp8-xaml/AppComponent/src/Direct3DContentProvider.h +++ b/templates/cpp-template-default/proj.wp8-xaml/AppComponent/src/Direct3DContentProvider.h @@ -37,7 +37,7 @@ class Direct3DContentProvider : public Microsoft::WRL::RuntimeClass< IDrawingSurfaceBackgroundContentProviderNative> { public: - Direct3DContentProvider(PhoneDirect3DXamlAppComponent::Direct3DInterop^ controller); + Direct3DContentProvider(cocos2d::Direct3DInterop^ controller); // IDrawingSurfaceContentProviderNative HRESULT STDMETHODCALLTYPE Connect(_In_ IDrawingSurfaceRuntimeHostNative* host, _In_ ID3D11Device1* device); @@ -47,6 +47,6 @@ public: HRESULT STDMETHODCALLTYPE Draw(_In_ ID3D11Device1* device, _In_ ID3D11DeviceContext1* context, _In_ ID3D11RenderTargetView* renderTargetView); private: - PhoneDirect3DXamlAppComponent::Direct3DInterop^ m_controller; + cocos2d::Direct3DInterop^ m_controller; Microsoft::WRL::ComPtr m_host; }; diff --git a/templates/cpp-template-default/proj.wp8-xaml/AppComponent/src/Direct3DInterop.cpp b/templates/cpp-template-default/proj.wp8-xaml/AppComponent/src/Direct3DInterop.cpp index e43b246088..53c14cdfaa 100644 --- a/templates/cpp-template-default/proj.wp8-xaml/AppComponent/src/Direct3DInterop.cpp +++ b/templates/cpp-template-default/proj.wp8-xaml/AppComponent/src/Direct3DInterop.cpp @@ -35,9 +35,8 @@ using namespace Windows::Phone::Graphics::Interop; using namespace Windows::Phone::Input::Interop; using namespace Windows::Graphics::Display; using namespace DirectX; -using namespace PhoneDirect3DXamlAppComponent; -namespace PhoneDirect3DXamlAppComponent +namespace cocos2d { Direct3DInterop::Direct3DInterop(Windows::Graphics::Display::DisplayOrientations orientation) diff --git a/templates/cpp-template-default/proj.wp8-xaml/AppComponent/src/Direct3DInterop.h b/templates/cpp-template-default/proj.wp8-xaml/AppComponent/src/Direct3DInterop.h index 6324dca1e9..ff87c60ca3 100644 --- a/templates/cpp-template-default/proj.wp8-xaml/AppComponent/src/Direct3DInterop.h +++ b/templates/cpp-template-default/proj.wp8-xaml/AppComponent/src/Direct3DInterop.h @@ -34,7 +34,7 @@ THE SOFTWARE. #include -namespace PhoneDirect3DXamlAppComponent +namespace cocos2d { public delegate void RequestAdditionalFrameHandler(); diff --git a/templates/cpp-template-default/proj.wp8-xaml/AppComponent/src/EditBoxEvent.cpp b/templates/cpp-template-default/proj.wp8-xaml/AppComponent/src/EditBoxEvent.cpp index 992dfe2d60..8837b68be9 100644 --- a/templates/cpp-template-default/proj.wp8-xaml/AppComponent/src/EditBoxEvent.cpp +++ b/templates/cpp-template-default/proj.wp8-xaml/AppComponent/src/EditBoxEvent.cpp @@ -26,9 +26,9 @@ THE SOFTWARE. using namespace Platform; -namespace PhoneDirect3DXamlAppComponent +namespace cocos2d { - EditBoxEvent::EditBoxEvent( Object^ sender, Platform::String^ arg, Windows::Foundation::EventHandler^ handle ): + EditBoxEvent::EditBoxEvent( Platform::Object^ sender, Platform::String^ arg, Windows::Foundation::EventHandler^ handle ): m_sender(sender), m_args(arg), m_handler(handle) diff --git a/templates/cpp-template-default/proj.wp8-xaml/AppComponent/src/EditBoxEvent.h b/templates/cpp-template-default/proj.wp8-xaml/AppComponent/src/EditBoxEvent.h index e9a7105baf..ddf206e034 100644 --- a/templates/cpp-template-default/proj.wp8-xaml/AppComponent/src/EditBoxEvent.h +++ b/templates/cpp-template-default/proj.wp8-xaml/AppComponent/src/EditBoxEvent.h @@ -29,7 +29,7 @@ THE SOFTWARE. #include -namespace PhoneDirect3DXamlAppComponent +namespace cocos2d { class EditBoxEvent : public cocos2d::InputEvent { diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.win32/HelloLua.vcxproj b/templates/lua-template-default/frameworks/runtime-src/proj.win32/HelloLua.vcxproj index cc1da377f0..f7df1afe6e 100644 --- a/templates/lua-template-default/frameworks/runtime-src/proj.win32/HelloLua.vcxproj +++ b/templates/lua-template-default/frameworks/runtime-src/proj.win32/HelloLua.vcxproj @@ -1,4 +1,4 @@ - + @@ -68,7 +68,7 @@ - $(ProjectDir)..\Classes;$(EngineRoot)cocos\scripting\lua-bindings\auto;$(EngineRoot)cocos\scripting\lua-bindings\manual;$(EngineRoot)cocos\audio\include;$(EngineRoot)external\lua\lua;$(EngineRoot)external\lua\tolua;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)extensions;$(EngineRoot);%(AdditionalIncludeDirectories) + $(ProjectDir)..\Classes;$(EngineRoot)cocos\scripting\lua-bindings\auto;$(EngineRoot)cocos\scripting\lua-bindings\manual;$(EngineRoot)cocos\audio\include;$(EngineRoot)external;$(EngineRoot)external\lua\lua;$(EngineRoot)external\lua\tolua;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)extensions;$(EngineRoot);%(AdditionalIncludeDirectories) Level3 @@ -106,14 +106,10 @@ - xcopy "$(ProjectDir)..\..\cocos2d-x\cocos\scripting\lua-bindings\script\cocos2d" "$(ProjectDir)..\..\..\" /e /Y -xcopy "$(ProjectDir)..\..\cocos2d-x\cocos\scripting\lua-bindings\script\cocosdenshion" "$(ProjectDir)..\..\..\" /e /Y -xcopy "$(ProjectDir)..\..\cocos2d-x\cocos\scripting\lua-bindings\script\cocosbuilder" "$(ProjectDir)..\..\..\" /e /Y -xcopy "$(ProjectDir)..\..\cocos2d-x\cocos\scripting\lua-bindings\script\cocostudio" "$(ProjectDir)..\..\..\" /e /Y -xcopy "$(ProjectDir)..\..\cocos2d-x\cocos\scripting\lua-bindings\script\extension" "$(ProjectDir)..\..\..\" /e /Y -xcopy "$(ProjectDir)..\..\cocos2d-x\cocos\scripting\lua-bindings\script\network" "$(ProjectDir)..\..\..\" /e /Y -xcopy "$(ProjectDir)..\..\cocos2d-x\cocos\scripting\lua-bindings\script\ui" "$(ProjectDir)..\..\..\" /e /Y - copy files + + + + @@ -122,7 +118,7 @@ xcopy "$(ProjectDir)..\..\cocos2d-x\cocos\scripting\lua-bindings\script\ui" "$(P - $(ProjectDir)..\Classes;$(EngineRoot)cocos\scripting\lua-bindings\auto;$(EngineRoot)cocos\scripting\lua-bindings\manual;$(EngineRoot)cocos\audio\include;$(EngineRoot)external\lua\lua;$(EngineRoot)external\lua\tolua;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)extensions;$(EngineRoot);%(AdditionalIncludeDirectories) + $(ProjectDir)..\Classes;$(EngineRoot)cocos\scripting\lua-bindings\auto;$(EngineRoot)cocos\scripting\lua-bindings\manual;$(EngineRoot)cocos\audio\include;$(EngineRoot)external;$(EngineRoot)external\lua\lua;$(EngineRoot)external\lua\tolua;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)extensions;$(EngineRoot);%(AdditionalIncludeDirectories) Level3 @@ -159,14 +155,10 @@ xcopy "$(ProjectDir)..\..\cocos2d-x\cocos\scripting\lua-bindings\script\ui" "$(P - xcopy "$(ProjectDir)..\..\cocos2d-x\cocos\scripting\lua-bindings\script\cocos2d" "$(ProjectDir)..\..\..\" /e /Y -xcopy "$(ProjectDir)..\..\cocos2d-x\cocos\scripting\lua-bindings\script\cocosdenshion" "$(ProjectDir)..\..\..\" /e /Y -xcopy "$(ProjectDir)..\..\cocos2d-x\cocos\scripting\lua-bindings\script\cocosbuilder" "$(ProjectDir)..\..\..\" /e /Y -xcopy "$(ProjectDir)..\..\cocos2d-x\cocos\scripting\lua-bindings\script\cocostudio" "$(ProjectDir)..\..\..\" /e /Y -xcopy "$(ProjectDir)..\..\cocos2d-x\cocos\scripting\lua-bindings\script\extension" "$(ProjectDir)..\..\..\" /e /Y -xcopy "$(ProjectDir)..\..\cocos2d-x\cocos\scripting\lua-bindings\script\network" "$(ProjectDir)..\..\..\" /e /Y -xcopy "$(ProjectDir)..\..\cocos2d-x\cocos\scripting\lua-bindings\script\ui" "$(ProjectDir)..\..\..\" /e /Y - copy files + + + + @@ -202,4 +194,4 @@ xcopy "$(ProjectDir)..\..\cocos2d-x\cocos\scripting\lua-bindings\script\ui" "$(P - + \ No newline at end of file diff --git a/tests/cpp-empty-test/proj-wp8-xaml/cpp-empty-test/LocalizedStrings.cs b/tests/cpp-empty-test/proj-wp8-xaml/cpp-empty-test/LocalizedStrings.cs index a7c1f23777..4c0d4ba292 100644 --- a/tests/cpp-empty-test/proj-wp8-xaml/cpp-empty-test/LocalizedStrings.cs +++ b/tests/cpp-empty-test/proj-wp8-xaml/cpp-empty-test/LocalizedStrings.cs @@ -1,6 +1,6 @@ -using PhoneDirect3DXamlAppInterop.Resources; +using cocos2d.Resources; -namespace PhoneDirect3DXamlAppInterop +namespace cocos2d { /// /// Provides access to string resources. diff --git a/tests/cpp-empty-test/proj-wp8-xaml/cpp-empty-test/Properties/AssemblyInfo.cs b/tests/cpp-empty-test/proj-wp8-xaml/cpp-empty-test/Properties/AssemblyInfo.cs index 1b6c5d6478..c5921e1749 100644 --- a/tests/cpp-empty-test/proj-wp8-xaml/cpp-empty-test/Properties/AssemblyInfo.cs +++ b/tests/cpp-empty-test/proj-wp8-xaml/cpp-empty-test/Properties/AssemblyInfo.cs @@ -6,11 +6,11 @@ using System.Resources; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("PhoneDirect3DXamlAppInterop")] +[assembly: AssemblyTitle("cocos2d")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("PhoneDirect3DXamlAppInterop")] +[assembly: AssemblyProduct("cocos2d")] [assembly: AssemblyCopyright("Copyright © 2012")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/tests/cpp-empty-test/proj-wp8-xaml/cpp-empty-test/Properties/WMAppManifest.xml b/tests/cpp-empty-test/proj-wp8-xaml/cpp-empty-test/Properties/WMAppManifest.xml index e2147a3eeb..19fddcbe1d 100644 --- a/tests/cpp-empty-test/proj-wp8-xaml/cpp-empty-test/Properties/WMAppManifest.xml +++ b/tests/cpp-empty-test/proj-wp8-xaml/cpp-empty-test/Properties/WMAppManifest.xml @@ -1,30 +1,35 @@  - + Assets\ApplicationIcon.png - - - - - + + + + + - + - + Assets\Tiles\FlipCycleTileSmall.png 0 Assets\Tiles\FlipCycleTileMedium.png - PhoneDirect3DXamlAppInterop - - - - - + cpp-empty-test + + + + + + + + + + diff --git a/tests/cpp-empty-test/proj-wp8-xaml/cpp-empty-test/Resources/AppResources.Designer.cs b/tests/cpp-empty-test/proj-wp8-xaml/cpp-empty-test/Resources/AppResources.Designer.cs index daa745fe09..efb4f0a46c 100644 --- a/tests/cpp-empty-test/proj-wp8-xaml/cpp-empty-test/Resources/AppResources.Designer.cs +++ b/tests/cpp-empty-test/proj-wp8-xaml/cpp-empty-test/Resources/AppResources.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace PhoneDirect3DXamlAppInterop.Resources { +namespace cocos2d.Resources { using System; @@ -39,7 +39,7 @@ namespace PhoneDirect3DXamlAppInterop.Resources { public static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PhoneDirect3DXamlAppInterop.Resources.AppResources", typeof(AppResources).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("cocos2d.Resources.AppResources", typeof(AppResources).Assembly); resourceMan = temp; } return resourceMan; diff --git a/tests/cpp-empty-test/proj-wp8-xaml/cpp-empty-test/cpp-empty-test.csproj b/tests/cpp-empty-test/proj-wp8-xaml/cpp-empty-test/cpp-empty-test.csproj index f744a086b5..c2d094717f 100644 --- a/tests/cpp-empty-test/proj-wp8-xaml/cpp-empty-test/cpp-empty-test.csproj +++ b/tests/cpp-empty-test/proj-wp8-xaml/cpp-empty-test/cpp-empty-test.csproj @@ -9,8 +9,8 @@ {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} Library Properties - PhoneDirect3DXamlAppInterop - PhoneDirect3DXamlAppInterop + cocos2d + cpp-empty-test WindowsPhone v8.0 $(TargetFrameworkVersion) @@ -19,9 +19,9 @@ true true - PhoneDirect3DXamlAppInterop_$(Configuration)_$(Platform).xap + cpp-empty-test_$(Configuration)_$(Platform).xap Properties\AppManifest.xml - PhoneDirect3DXamlAppInterop.App + cocos2d.App true 11.0 true diff --git a/tests/cpp-empty-test/proj-wp8-xaml/cpp-empty-testComponent/cpp-empty-testComponent.vcxproj b/tests/cpp-empty-test/proj-wp8-xaml/cpp-empty-testComponent/cpp-empty-testComponent.vcxproj index 17bf7f73e5..59257abbd7 100644 --- a/tests/cpp-empty-test/proj-wp8-xaml/cpp-empty-testComponent/cpp-empty-testComponent.vcxproj +++ b/tests/cpp-empty-test/proj-wp8-xaml/cpp-empty-testComponent/cpp-empty-testComponent.vcxproj @@ -20,7 +20,7 @@ {f5d665f8-ae19-4f3f-99a7-230a1e8305d2} - PhoneDirect3DXamlAppComponent + cocos2d en-US 11.0 true diff --git a/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Shared/App.xaml b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Shared/App.xaml new file mode 100644 index 0000000000..c423584a2e --- /dev/null +++ b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Shared/App.xaml @@ -0,0 +1,13 @@ + + + + + HelloCpp + + + diff --git a/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Shared/App.xaml.cpp b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Shared/App.xaml.cpp new file mode 100644 index 0000000000..f4365b88c5 --- /dev/null +++ b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Shared/App.xaml.cpp @@ -0,0 +1,21 @@ +#include "App.xaml.h" +#include "OpenGLESPage.xaml.h" + +using namespace cocos2d; + +App::App() +{ + InitializeComponent(); +} + +void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) +{ + if (mPage == nullptr) + { + mPage = ref new OpenGLESPage(&mOpenGLES); + } + + // Place the page in the current window and ensure that it is active. + Windows::UI::Xaml::Window::Current->Content = mPage; + Windows::UI::Xaml::Window::Current->Activate(); +} diff --git a/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Shared/App.xaml.h b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Shared/App.xaml.h new file mode 100644 index 0000000000..1309c610d7 --- /dev/null +++ b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Shared/App.xaml.h @@ -0,0 +1,19 @@ +#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: + OpenGLESPage^ mPage; + OpenGLES mOpenGLES; + }; +} diff --git a/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Shared/HelloCpp.Shared.vcxitems b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Shared/HelloCpp.Shared.vcxitems new file mode 100644 index 0000000000..f5282cc2e7 --- /dev/null +++ b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Shared/HelloCpp.Shared.vcxitems @@ -0,0 +1,63 @@ + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + true + e956c24b-f04e-47bf-bf00-746681ae1301 + {a3ad93e4-0b2f-4c58-9181-69bed2e42e3e} + cocos2d + + + + %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) + + + + + Designer + + + + + $(MSBuildThisFileDirectory)..\..\..\..\cocos\platform\win8.1-universal\OpenGLESPage.xaml + + + Create + + + + + $(MSBuildThisFileDirectory)App.xaml + + + + + $(MSBuildThisFileDirectory)..\..\..\..\cocos\platform\win8.1-universal\OpenGLESPage.xaml + + + + + + + $(MSBuildThisFileDirectory)App.xaml + + + + + + + + + + <_CustomResource Include="$(MSBuildThisFileDirectory)..\..\Resources\**\*"> + Assets\Resources\%(RecursiveDir)%(FileName)%(Extension) + true + + + + + + + + + \ No newline at end of file diff --git a/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Shared/HelloCpp.Shared.vcxitems.filters b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Shared/HelloCpp.Shared.vcxitems.filters new file mode 100644 index 0000000000..b94069d87c --- /dev/null +++ b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Shared/HelloCpp.Shared.vcxitems.filters @@ -0,0 +1,43 @@ + + + + + + + Classes + + + Classes + + + + + + + + + + + + {38ad799c-8c3c-44a2-8e41-516c8f62f556} + + + + + Classes + + + Classes + + + Classes + + + + + + + + + + \ No newline at end of file diff --git a/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Windows/Assets/Logo.scale-100.png b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Windows/Assets/Logo.scale-100.png new file mode 100644 index 0000000000..e26771cb33 Binary files /dev/null and b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Windows/Assets/Logo.scale-100.png differ diff --git a/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Windows/Assets/SmallLogo.scale-100.png b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Windows/Assets/SmallLogo.scale-100.png new file mode 100644 index 0000000000..1eb0d9d528 Binary files /dev/null and b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Windows/Assets/SmallLogo.scale-100.png differ diff --git a/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Windows/Assets/SplashScreen.scale-100.png b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Windows/Assets/SplashScreen.scale-100.png new file mode 100644 index 0000000000..d8ded7198a Binary files /dev/null and b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Windows/Assets/SplashScreen.scale-100.png differ diff --git a/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Windows/Assets/StoreLogo.scale-100.png b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Windows/Assets/StoreLogo.scale-100.png new file mode 100644 index 0000000000..dcb672712c Binary files /dev/null and b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Windows/Assets/StoreLogo.scale-100.png differ diff --git a/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Windows/HelloCpp.Windows.vcxproj b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Windows/HelloCpp.Windows.vcxproj new file mode 100644 index 0000000000..0e6958580e --- /dev/null +++ b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Windows/HelloCpp.Windows.vcxproj @@ -0,0 +1,264 @@ + + + + + Debug + ARM + + + Debug + Win32 + + + Debug + x64 + + + Release + ARM + + + Release + Win32 + + + Release + x64 + + + + {79a8fcda-4b12-4dd1-b676-ff148d651638} + cocos2d + en-US + 12.0 + true + Windows Store + 8.1 + + + + Application + true + v120 + + + Application + true + v120 + + + Application + true + v120 + + + Application + false + true + v120 + + + Application + false + true + v120 + + + Application + false + true + v120 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + HelloCpp.Windows_TemporaryKey.pfx + True + x86 + + + + /bigobj /Zm200 %(AdditionalOptions) + 4453;28204;4756;%(DisableSpecificWarnings) + pch.h + ../../Classes;$(EngineRoot)cocos\platform\win8.1-universal;%(AdditionalIncludeDirectories) + + + echo "Copying Windows 8.1 Universal App CPP template files" +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLESPage.xaml" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLESPage.xaml.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLESPage.xaml.h" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLES.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLES.h" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\Cocos2dRenderer.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\Cocos2dRenderer.h" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\pch.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\pch.h" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq + + + + + /bigobj /Zm200 %(AdditionalOptions) + 4453;28204;4756;%(DisableSpecificWarnings) + pch.h + ../../Classes;$(EngineRoot)cocos\platform\win8.1-universal;%(AdditionalIncludeDirectories) + + + echo "Copying Windows 8.1 Universal App CPP template files" +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLESPage.xaml" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLESPage.xaml.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLESPage.xaml.h" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLES.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLES.h" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\Cocos2dRenderer.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\Cocos2dRenderer.h" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\pch.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\pch.h" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq + + + + + /bigobj /Zm200 %(AdditionalOptions) + 4453;28204;4756;%(DisableSpecificWarnings) + pch.h + ../../Classes;$(EngineRoot)cocos\platform\win8.1-universal;%(AdditionalIncludeDirectories) + + + echo "Copying Windows 8.1 Universal App CPP template files" +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLESPage.xaml" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLESPage.xaml.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLESPage.xaml.h" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLES.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLES.h" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\Cocos2dRenderer.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\Cocos2dRenderer.h" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\pch.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\pch.h" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq + + + + + /bigobj /Zm200 %(AdditionalOptions) + 4453;28204;4756;%(DisableSpecificWarnings) + pch.h + ../../Classes;$(EngineRoot)cocos\platform\win8.1-universal;%(AdditionalIncludeDirectories) + + + echo "Copying Windows 8.1 Universal App CPP template files" +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLESPage.xaml" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLESPage.xaml.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLESPage.xaml.h" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLES.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLES.h" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\Cocos2dRenderer.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\Cocos2dRenderer.h" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\pch.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\pch.h" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq + + + + + /bigobj /Zm200 %(AdditionalOptions) + 4453;28204;4756;%(DisableSpecificWarnings) + pch.h + ../../Classes;$(EngineRoot)cocos\platform\win8.1-universal;%(AdditionalIncludeDirectories) + + + echo "Copying Windows 8.1 Universal App CPP template files" +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLESPage.xaml" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLESPage.xaml.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLESPage.xaml.h" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLES.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLES.h" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\Cocos2dRenderer.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\Cocos2dRenderer.h" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\pch.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\pch.h" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq + + + + + /bigobj /Zm200 %(AdditionalOptions) + 4453;28204;4756;%(DisableSpecificWarnings) + pch.h + ../../Classes;$(EngineRoot)cocos\platform\win8.1-universal;%(AdditionalIncludeDirectories) + + + echo "Copying Windows 8.1 Universal App CPP template files" +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLESPage.xaml" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLESPage.xaml.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLESPage.xaml.h" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLES.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLES.h" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\Cocos2dRenderer.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\Cocos2dRenderer.h" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\pch.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq +xcopy "$(EngineRoot)cocos\platform\win8.1-universal\pch.h" "$(EngineRoot)templates\cpp-template-default\proj.win8.1-universal\HelloCpp.Shared\*" /eiycq + + + + + Designer + + + + + + + + + + + + {9335005f-678e-4e8e-9b84-50037216aec8} + + + {f3550fe0-c795-44f6-8feb-093eb68143ae} + + + {3b26a12d-3a44-47ea-82d2-282660fc844d} + + + + + + \ No newline at end of file diff --git a/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Windows/HelloCpp.Windows.vcxproj.filters b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Windows/HelloCpp.Windows.vcxproj.filters new file mode 100644 index 0000000000..3cdafaeec0 --- /dev/null +++ b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Windows/HelloCpp.Windows.vcxproj.filters @@ -0,0 +1,29 @@ + + + + + {1a9fa652-867e-41d2-8588-962f108d2d8f} + bmp;fbx;gif;jpg;jpeg;tga;tiff;tif;png + + + + + + + + + + + Assets + + + Assets + + + Assets + + + Assets + + + \ No newline at end of file diff --git a/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Windows/HelloCpp.Windows_TemporaryKey.pfx b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Windows/HelloCpp.Windows_TemporaryKey.pfx new file mode 100644 index 0000000000..5ad010651a Binary files /dev/null and b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Windows/HelloCpp.Windows_TemporaryKey.pfx differ diff --git a/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Windows/Package.appxmanifest b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Windows/Package.appxmanifest new file mode 100644 index 0000000000..6418109719 --- /dev/null +++ b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.Windows/Package.appxmanifest @@ -0,0 +1,30 @@ + + + + + HelloCpp.Windows + dalestam + Assets\StoreLogo.png + + + 6.3.0 + 6.3.0 + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.WindowsPhone/Assets/Logo.scale-240.png b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.WindowsPhone/Assets/Logo.scale-240.png new file mode 100644 index 0000000000..76921ca997 Binary files /dev/null and b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.WindowsPhone/Assets/Logo.scale-240.png differ diff --git a/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.WindowsPhone/Assets/SmallLogo.scale-240.png b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.WindowsPhone/Assets/SmallLogo.scale-240.png new file mode 100644 index 0000000000..316630124f Binary files /dev/null and b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.WindowsPhone/Assets/SmallLogo.scale-240.png differ diff --git a/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.WindowsPhone/Assets/SplashScreen.scale-240.png b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.WindowsPhone/Assets/SplashScreen.scale-240.png new file mode 100644 index 0000000000..b0b6bc08e5 Binary files /dev/null and b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.WindowsPhone/Assets/SplashScreen.scale-240.png differ diff --git a/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.WindowsPhone/Assets/Square71x71Logo.scale-240.png b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.WindowsPhone/Assets/Square71x71Logo.scale-240.png new file mode 100644 index 0000000000..cfa54bee03 Binary files /dev/null and b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.WindowsPhone/Assets/Square71x71Logo.scale-240.png differ diff --git a/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.WindowsPhone/Assets/StoreLogo.scale-240.png b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.WindowsPhone/Assets/StoreLogo.scale-240.png new file mode 100644 index 0000000000..47e084b593 Binary files /dev/null and b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.WindowsPhone/Assets/StoreLogo.scale-240.png differ diff --git a/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.WindowsPhone/Assets/WideLogo.scale-240.png b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.WindowsPhone/Assets/WideLogo.scale-240.png new file mode 100644 index 0000000000..6249d29db0 Binary files /dev/null and b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.WindowsPhone/Assets/WideLogo.scale-240.png differ diff --git a/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.WindowsPhone/HelloCpp.WindowsPhone.vcxproj b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.WindowsPhone/HelloCpp.WindowsPhone.vcxproj new file mode 100644 index 0000000000..897cf401d5 --- /dev/null +++ b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.WindowsPhone/HelloCpp.WindowsPhone.vcxproj @@ -0,0 +1,144 @@ + + + + + Debug + ARM + + + Debug + Win32 + + + Release + ARM + + + Release + Win32 + + + + {396fe85e-bb05-4b92-bccb-f89aed4ea41a} + cocos2d + en-US + 12.0 + true + Windows Phone + 8.1 + + + + Application + true + v120_wp81 + + + Application + true + v120_wp81 + + + Application + false + true + v120_wp81 + + + Application + false + true + v120_wp81 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + True + arm + + + + /bigobj /Zm200 %(AdditionalOptions) + 4453;28204;4756;%(DisableSpecificWarnings) + pch.h + ../../Classes;$(EngineRoot)cocos\platform\win8.1-universal;%(AdditionalIncludeDirectories) + + + + + /bigobj /Zm200 %(AdditionalOptions) + 4453;28204;4756;%(DisableSpecificWarnings) + pch.h + ../../Classes;$(EngineRoot)cocos\platform\win8.1-universal;%(AdditionalIncludeDirectories) + + + + + /bigobj /Zm200 %(AdditionalOptions) + 4453;28204;4756;%(DisableSpecificWarnings) + pch.h + ../../Classes;$(EngineRoot)cocos\platform\win8.1-universal;%(AdditionalIncludeDirectories) + + + + + /bigobj /Zm200 %(AdditionalOptions) + 4453;28204;4756;%(DisableSpecificWarnings) + pch.h + ../../Classes;$(EngineRoot)cocos\platform\win8.1-universal;%(AdditionalIncludeDirectories) + + + + + Designer + + + + + + + + + + + + + {22f3b9df-1209-4574-8331-003966f562bf} + + + {cc1da216-a80d-4be4-b309-acb6af313aff} + + + {22f798d8-bfff-4754-996f-a5395343d5ec} + + + + + + \ No newline at end of file diff --git a/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.WindowsPhone/HelloCpp.WindowsPhone.vcxproj.filters b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.WindowsPhone/HelloCpp.WindowsPhone.vcxproj.filters new file mode 100644 index 0000000000..eb71f325ca --- /dev/null +++ b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.WindowsPhone/HelloCpp.WindowsPhone.vcxproj.filters @@ -0,0 +1,30 @@ + + + + + {c8beb60d-689b-4aaa-9749-99bd3e2dcf75} + bmp;fbx;gif;jpg;jpeg;tga;tiff;tif;png + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + + + + \ No newline at end of file diff --git a/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.WindowsPhone/Package.appxmanifest b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.WindowsPhone/Package.appxmanifest new file mode 100644 index 0000000000..eb4bab30a4 --- /dev/null +++ b/tests/cpp-empty-test/proj.win8.1-universal/HelloCpp.WindowsPhone/Package.appxmanifest @@ -0,0 +1,33 @@ + + + + + + HelloCpp.WindowsPhone + dalestam + Assets\StoreLogo.png + + + 6.3.1 + 6.3.1 + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/cpp-tests/Classes/AppDelegate.cpp b/tests/cpp-tests/Classes/AppDelegate.cpp index 1d07655c0a..6a6479a148 100644 --- a/tests/cpp-tests/Classes/AppDelegate.cpp +++ b/tests/cpp-tests/Classes/AppDelegate.cpp @@ -116,7 +116,7 @@ bool AppDelegate::applicationDidFinishLaunching() fileUtils->setSearchPaths(searchPaths); -#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) +#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) // a bug in DirectX 11 level9-x on the device prevents ResolutionPolicy::NO_BORDER from working correctly glview->setDesignResolutionSize(designSize.width, designSize.height, ResolutionPolicy::SHOW_ALL); #else diff --git a/tests/cpp-tests/Classes/CocosDenshionTest/CocosDenshionTest.cpp b/tests/cpp-tests/Classes/CocosDenshionTest/CocosDenshionTest.cpp index 65681042a1..c139d0c917 100644 --- a/tests/cpp-tests/Classes/CocosDenshionTest/CocosDenshionTest.cpp +++ b/tests/cpp-tests/Classes/CocosDenshionTest/CocosDenshionTest.cpp @@ -13,7 +13,7 @@ #if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) #define MUSIC_FILE "music.mid" -#elif (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) +#elif (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) #define MUSIC_FILE "background.wav" #elif (CC_TARGET_PLATFORM == CC_PLATFORM_BLACKBERRY || CC_TARGET_PLATFORM == CC_PLATFORM_LINUX ) #define MUSIC_FILE "background.ogg" diff --git a/tests/cpp-tests/Classes/DrawPrimitivesTest/DrawPrimitivesTest.cpp b/tests/cpp-tests/Classes/DrawPrimitivesTest/DrawPrimitivesTest.cpp index af4e47a407..b213915745 100644 --- a/tests/cpp-tests/Classes/DrawPrimitivesTest/DrawPrimitivesTest.cpp +++ b/tests/cpp-tests/Classes/DrawPrimitivesTest/DrawPrimitivesTest.cpp @@ -375,6 +375,10 @@ DrawNodeTest::DrawNodeTest() // Draw triangle draw->drawTriangle(Vec2(10, 10), Vec2(70, 30), Vec2(100, 140), Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 0.5)); + + for (int i = 0; i < 100; i++) { + draw->drawPoint(Vec2(i*7, 5), 5, Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 1)); + } } string DrawNodeTest::title() const diff --git a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp index 8e79b5b1f3..a282f2c15c 100644 --- a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp +++ b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp @@ -1259,7 +1259,7 @@ void Sprite3DWithOBBPerfromanceTest::addNewOBBWithCoords(Vec2 p) void Sprite3DWithOBBPerfromanceTest::onTouchesBegan(const std::vector& touches, Event* event) { - for (auto touch: touches) + for (const auto& touch: touches) { auto location = touch->getLocationInView(); auto obbSize = _obb.size(); @@ -1287,7 +1287,7 @@ void Sprite3DWithOBBPerfromanceTest::onTouchesEnded(const std::vector& t void Sprite3DWithOBBPerfromanceTest::onTouchesMoved(const std::vector& touches, Event* event) { - for (auto touch: touches) + for (const auto& touch: touches) { auto location = touch->getLocation(); auto obbSize = _obb.size(); @@ -1447,8 +1447,7 @@ void Sprite3DWithOBBPerfromanceTest::calculateRayByLocationInView(Ray* ray, cons { auto dir = Director::getInstance(); auto view = dir->getWinSize(); - Mat4 mat = dir->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); - mat = dir->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION); + Mat4 mat = dir->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION); Vec3 src = Vec3(location.x, location.y, -1); Vec3 nearPoint; diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CocosGUIScene.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CocosGUIScene.cpp index d49c7897fd..e4d73f8725 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CocosGUIScene.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CocosGUIScene.cpp @@ -44,7 +44,7 @@ g_guisTests[] = } }, #endif - #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) { "EditBox Test", [](Ref* sender) diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISceneManager.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISceneManager.cpp index c00944cd14..967e3f1a81 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISceneManager.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISceneManager.cpp @@ -25,7 +25,7 @@ #include "UIWebViewTest/UIWebViewTest.h" #endif #include "UIScale9SpriteTest.h" -#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) #include "UIEditBoxTest.h" #endif @@ -45,7 +45,7 @@ static const char* s_testArray[] = "UIButtonIgnoreContentSizeTest", "UIButtonTitleEffectTest", -#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) "UIEditBoxTest", #endif "UICheckBoxTest", @@ -412,7 +412,7 @@ Scene *UISceneManager::currentUIScene() return UIS9Flip::sceneWithTitle(s_testArray[_currentUISceneId]); case kUIS9ChangeAnchorPoint: return UIS9ChangeAnchorPoint::sceneWithTitle(s_testArray[_currentUISceneId]); -#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) case kUIEditBoxTest: return UIEditBoxTest::sceneWithTitle(s_testArray[_currentUISceneId]); #endif diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISceneManager.h b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISceneManager.h index cc49fb4f40..66ab43958f 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISceneManager.h +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISceneManager.h @@ -41,7 +41,7 @@ enum kUIButtonTextOnly, kUIButtonIgnoreContentSizeTest, kUIButtonTitleEffectTest, -#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) kUIEditBoxTest, #endif kUICheckBoxTest, diff --git a/tests/cpp-tests/Classes/controller.cpp b/tests/cpp-tests/Classes/controller.cpp index 2a20d6a19d..afe5aa48ee 100644 --- a/tests/cpp-tests/Classes/controller.cpp +++ b/tests/cpp-tests/Classes/controller.cpp @@ -48,13 +48,8 @@ Controller g_aTestNames[] = { { "Chipmunk", []() { return new ChipmunkAccelTouchTestScene(); } }, { "Click and Move", [](){return new ClickAndMoveTestScene(); } }, { "Configuration", []() { return new ConfigurationTestScene(); } }, -#if (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT) { "Console", []() { return new ConsoleTestScene(); } }, - -#endif -#if (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT) { "Curl", []() { return new CurlTestScene(); } }, -#endif { "Current Language", []() { return new CurrentLanguageTestScene(); } }, { "EventDispatcher", []() { return new EventDispatcherTestScene(); } }, { "Effects - Advanced", []() { return new EffectAdvanceScene(); } }, diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/App.xaml b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/App.xaml index e7d31aea9d..2da0ff79d0 100644 --- a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/App.xaml +++ b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/App.xaml @@ -1,8 +1,8 @@  diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/App.xaml.cpp b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/App.xaml.cpp index ecdc3bc361..f4365b88c5 100644 --- a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/App.xaml.cpp +++ b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/App.xaml.cpp @@ -1,7 +1,7 @@ -#include "pch.h" +#include "App.xaml.h" #include "OpenGLESPage.xaml.h" -using namespace cpp_tests; +using namespace cocos2d; App::App() { diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/App.xaml.h b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/App.xaml.h index 135590b547..1309c610d7 100644 --- a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/App.xaml.h +++ b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/App.xaml.h @@ -4,7 +4,7 @@ #include "OpenGLES.h" #include "openglespage.xaml.h" -namespace cpp_tests +namespace cocos2d { ref class App sealed { diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/HelloTriangleRenderer.cpp b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/HelloTriangleRenderer.cpp deleted file mode 100644 index 2e6700d0bc..0000000000 --- a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/HelloTriangleRenderer.cpp +++ /dev/null @@ -1,161 +0,0 @@ -// Based on Hello_Triangle.c from -// Book: OpenGL(R) ES 2.0 Programming Guide -// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner -// ISBN-10: 0321502795 -// ISBN-13: 9780321502797 -// Publisher: Addison-Wesley Professional -// URLs: http://safari.informit.com/9780321563835 -// http://www.opengles-book.com - -// -// This file is used by the template to render a basic scene using GL. -// - -#include "pch.h" -#include "HelloTriangleRenderer.h" - -// These are used by the shader compilation methods. -#include -#include -#include - -using namespace Platform; - -using namespace cpp_tests; - -#define STRING(s) #s - -GLuint CompileShader(GLenum type, const std::string &source) -{ - GLuint shader = glCreateShader(type); - - const char *sourceArray[1] = { source.c_str() }; - glShaderSource(shader, 1, sourceArray, NULL); - glCompileShader(shader); - - GLint compileResult; - glGetShaderiv(shader, GL_COMPILE_STATUS, &compileResult); - - if (compileResult == 0) - { - GLint infoLogLength; - glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLogLength); - - std::vector infoLog(infoLogLength); - glGetShaderInfoLog(shader, (GLsizei)infoLog.size(), NULL, infoLog.data()); - - std::wstring errorMessage = std::wstring(L"Shader compilation failed: "); - errorMessage += std::wstring(infoLog.begin(), infoLog.end()); - - throw Exception::CreateException(E_FAIL, ref new Platform::String(errorMessage.c_str())); - } - - return shader; -} - -GLuint CompileProgram(const std::string &vsSource, const std::string &fsSource) -{ - GLuint program = glCreateProgram(); - - if (program == 0) - { - throw Exception::CreateException(E_FAIL, L"Program creation failed"); - } - - GLuint vs = CompileShader(GL_VERTEX_SHADER, vsSource); - GLuint fs = CompileShader(GL_FRAGMENT_SHADER, fsSource); - - if (vs == 0 || fs == 0) - { - glDeleteShader(fs); - glDeleteShader(vs); - glDeleteProgram(program); - return 0; - } - - glAttachShader(program, vs); - glDeleteShader(vs); - - glAttachShader(program, fs); - glDeleteShader(fs); - - glLinkProgram(program); - - GLint linkStatus; - glGetProgramiv(program, GL_LINK_STATUS, &linkStatus); - - if (linkStatus == 0) - { - GLint infoLogLength; - glGetProgramiv(program, GL_INFO_LOG_LENGTH, &infoLogLength); - - std::vector infoLog(infoLogLength); - glGetProgramInfoLog(program, (GLsizei)infoLog.size(), NULL, infoLog.data()); - - std::wstring errorMessage = std::wstring(L"Program link failed: "); - errorMessage += std::wstring(infoLog.begin(), infoLog.end()); - - throw Exception::CreateException(E_FAIL, ref new Platform::String(errorMessage.c_str())); - } - - return program; -} - -HelloTriangleRenderer::HelloTriangleRenderer() : - mProgram(0) -{ - // Vertex Shader source - const std::string vs = STRING - ( - attribute vec4 vPosition; - void main() - { - gl_Position = vPosition; - } - ); - - // Fragment Shader source - const std::string fs = STRING - ( - precision mediump float; - void main() - { - gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); - } - ); - - // CompileProgram will throw if it fails, so we don't need to check for success. - mProgram = CompileProgram(vs, fs); -} - -HelloTriangleRenderer::~HelloTriangleRenderer() -{ - if (mProgram != 0) - { - glDeleteProgram(mProgram); - mProgram = 0; - } -} - -// Draws a basic triangle -void HelloTriangleRenderer::Draw(GLsizei width, GLsizei height) -{ - glViewport(0, 0, width, height); - - GLfloat vertices[] = - { - 0.0f, 0.5f, 0.0f, - -0.5f, -0.5f, 0.0f, - 0.5f, -0.5f, 0.0f, - }; - - glClear(GL_COLOR_BUFFER_BIT); - - glUseProgram(mProgram); - - glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, vertices); - glEnableVertexAttribArray(0); - - glDrawArrays(GL_TRIANGLES, 0, 3); -} - diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/HelloTriangleRenderer.h b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/HelloTriangleRenderer.h deleted file mode 100644 index 410f5a2a54..0000000000 --- a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/HelloTriangleRenderer.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include "pch.h" - -namespace cpp_tests -{ - class HelloTriangleRenderer - { - public: - HelloTriangleRenderer(); - ~HelloTriangleRenderer(); - void Draw(GLsizei width, GLsizei height); - - private: - GLuint mProgram; - }; -} \ No newline at end of file diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/OpenGLES.h b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/OpenGLES.h deleted file mode 100644 index 2190e23c57..0000000000 --- a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/OpenGLES.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -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(); - -private: - void Initialize(); - void Cleanup(); - -private: - EGLDisplay mEglDisplay; - EGLContext mEglContext; - EGLConfig mEglConfig; -}; diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/cpp-tests.Shared.vcxitems b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/cpp-tests.Shared.vcxitems index 581da1b3de..3e22b9eb51 100644 --- a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/cpp-tests.Shared.vcxitems +++ b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/cpp-tests.Shared.vcxitems @@ -4,7 +4,7 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) true {be3a1791-5bce-4cea-92cd-0e2d86dde27a} - cpp_tests + cocos2d cpp-tests.Shared f6ae64be-127a-4f7d-ad15-53a0fddb7f41 @@ -14,6 +14,17 @@ + + Designer + + + + + $(MSBuildThisFileDirectory)..\..\..\..\cocos\platform\win8.1-universal\OpenGLESPage.xaml + + + Create + @@ -194,7 +205,15 @@ - + + $(MSBuildThisFileDirectory)App.xaml + + + + + $(MSBuildThisFileDirectory)..\..\..\..\cocos\platform\win8.1-universal\OpenGLESPage.xaml + + @@ -443,30 +462,26 @@ - - - - Create - - - - - $(MSBuildThisFileDirectory)App.xaml - - - $(MSBuildThisFileDirectory)App.xaml - - - - - Designer - - + + + + + <_CustomResource Include="$(MSBuildThisFileDirectory)..\..\Resources\**\*"> + Assets\Resources\%(RecursiveDir)%(FileName)%(Extension) + true + + + + + + + + \ No newline at end of file diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/cpp-tests.Shared.vcxitems.filters b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/cpp-tests.Shared.vcxitems.filters index 46fafd09d3..af02131873 100644 --- a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/cpp-tests.Shared.vcxitems.filters +++ b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/cpp-tests.Shared.vcxitems.filters @@ -1,9 +1,8 @@  - + - - - + + Classes\ActionManagerTest @@ -16,9 +15,6 @@ Classes - - Classes - Classes @@ -748,11 +744,15 @@ Classes\ExtensionsTest\AssetsManagerExTest + + + + + + Classes\UITest\CocostudioGUISceneTest\UITextFieldTest + - - - Classes\ActionManagerTest @@ -1272,9 +1272,6 @@ Classes\UITest\CocostudioGUISceneTest\UITextFieldTest - - Classes\UITest\CocostudioGUISceneTest\UITextFieldTest - Classes\UITest\CocostudioGUISceneTest\UITextTest @@ -1293,16 +1290,14 @@ Classes\ExtensionsTest\AssetsManagerExTest + + + + - - - - - - {f391ec0c-7b86-4c69-a813-4408c0c29d10} @@ -1647,4 +1642,10 @@ {2c5dd382-6534-4369-b33c-6b18995e6576} + + + + + + \ No newline at end of file diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/pch.h b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/pch.h deleted file mode 100644 index 4bdade37c9..0000000000 --- a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/pch.h +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include - -// OpenGL ES includes -#include -#include - -// EGL includes -#include -#include -#include -#include - -#include "OpenGLES.h" -#include "HelloTriangleRenderer.h" -#include "App.xaml.h" - -#include "cocos2d.h" -#include "cocos-ext.h" \ No newline at end of file diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Windows/Assets/logo.png b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Windows/Assets/logo.png new file mode 100644 index 0000000000..e26771cb33 Binary files /dev/null and b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Windows/Assets/logo.png differ diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Windows/Assets/smalllogo.png b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Windows/Assets/smalllogo.png new file mode 100644 index 0000000000..1eb0d9d528 Binary files /dev/null and b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Windows/Assets/smalllogo.png differ diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Windows/Assets/splashscreen.png b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Windows/Assets/splashscreen.png new file mode 100644 index 0000000000..d8ded7198a Binary files /dev/null and b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Windows/Assets/splashscreen.png differ diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Windows/Assets/storelogo.png b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Windows/Assets/storelogo.png new file mode 100644 index 0000000000..dcb672712c Binary files /dev/null and b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Windows/Assets/storelogo.png differ diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Windows/OpenGLESPage.xaml b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Windows/OpenGLESPage.xaml deleted file mode 100644 index 47d2da5797..0000000000 --- a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Windows/OpenGLESPage.xaml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Windows/OpenGLESPage.xaml.h b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Windows/OpenGLESPage.xaml.h deleted file mode 100644 index 3d9bd57996..0000000000 --- a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Windows/OpenGLESPage.xaml.h +++ /dev/null @@ -1,39 +0,0 @@ -#pragma once - -#include "OpenGLESPage.g.h" - -namespace cpp_tests -{ - public ref class OpenGLESPage sealed - { - public: - OpenGLESPage(); - virtual ~OpenGLESPage(); - - internal: - OpenGLESPage(OpenGLES* openGLES); - - private: - void OnPageLoaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); - void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args); - void OnSwapChainPanelSizeChanged(Platform::Object^ sender, Windows::UI::Xaml::SizeChangedEventArgs^ e); - void GetSwapChainPanelSize(GLsizei* width, GLsizei* height); - void CreateRenderSurface(); - void DestroyRenderSurface(); - void RecoverFromLostDevice(); - void StartRenderLoop(); - void StopRenderLoop(); - - OpenGLES* mOpenGLES; - - Windows::Foundation::Size mSwapChainPanelSize; - Concurrency::critical_section mSwapChainPanelSizeCriticalSection; - - Windows::Foundation::Size mCustomRenderSurfaceSize; - bool mUseCustomRenderSurfaceSize; - - EGLSurface mRenderSurface; // This surface is associated with a swapChainPanel on the page - Concurrency::critical_section mRenderSurfaceCriticalSection; - Windows::Foundation::IAsyncAction^ mRenderLoopWorker; - }; -} diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Windows/Package.appxmanifest b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Windows/Package.appxmanifest index c33b43b0d4..de82696e65 100644 --- a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Windows/Package.appxmanifest +++ b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Windows/Package.appxmanifest @@ -1,39 +1,32 @@  - - - - + + cpp-tests.Windows dalestam Assets\StoreLogo.png - 6.3.0 6.3.0 - - + - - - - - - + + + + + + + + + + + + + diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Windows/cpp-tests.Windows.vcxproj b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Windows/cpp-tests.Windows.vcxproj index df1b1bffab..7dc8e25af2 100644 --- a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Windows/cpp-tests.Windows.vcxproj +++ b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Windows/cpp-tests.Windows.vcxproj @@ -28,7 +28,7 @@ {f2bae06b-caae-43ee-b21b-57fa48db04fa} - cpp_tests + cocos2d en-US 12.0 true @@ -99,11 +99,13 @@ pch.h $(IntDir)pch.pch - ../../Classes;%(AdditionalIncludeDirectories) + ../../Classes;$(EngineRoot)cocos\platform\win8.1-universal;%(AdditionalIncludeDirectories) /bigobj /Zm200 %(AdditionalOptions) 4453;28204;%(DisableSpecificWarnings) pch.h pch.h + CC_ENABLE_CHIPMUNK_INTEGRATION=1;COCOS2D_DEBUG=1;%(PreprocessorDefinitions) + CC_ENABLE_CHIPMUNK_INTEGRATION=1;%(PreprocessorDefinitions) @@ -114,11 +116,13 @@ pch.h $(IntDir)pch.pch - ../../Classes;%(AdditionalIncludeDirectories) + ../../Classes;$(EngineRoot)cocos\platform\win8.1-universal;%(AdditionalIncludeDirectories) /bigobj /Zm200 %(AdditionalOptions) 4453;28204;%(DisableSpecificWarnings) pch.h pch.h + CC_ENABLE_CHIPMUNK_INTEGRATION=1;COCOS2D_DEBUG=1;%(PreprocessorDefinitions) + CC_ENABLE_CHIPMUNK_INTEGRATION=1;%(PreprocessorDefinitions) @@ -129,11 +133,13 @@ pch.h $(IntDir)pch.pch - ../../Classes;%(AdditionalIncludeDirectories) + ../../Classes;$(EngineRoot)cocos\platform\win8.1-universal;%(AdditionalIncludeDirectories) /bigobj /Zm200 %(AdditionalOptions) 4453;28204;%(DisableSpecificWarnings) pch.h pch.h + CC_ENABLE_CHIPMUNK_INTEGRATION=1;COCOS2D_DEBUG=1;%(PreprocessorDefinitions) + CC_ENABLE_CHIPMUNK_INTEGRATION=1;%(PreprocessorDefinitions) @@ -148,19 +154,6 @@ - - - - - - OpenGLESPage.xaml - - - - - OpenGLESPage.xaml - - {9335005f-678e-4e8e-9b84-50037216aec8} diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Windows/cpp-tests.Windows.vcxproj.filters b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Windows/cpp-tests.Windows.vcxproj.filters index 1605ce7930..c6285c8d61 100644 --- a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Windows/cpp-tests.Windows.vcxproj.filters +++ b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Windows/cpp-tests.Windows.vcxproj.filters @@ -5,9 +5,6 @@ 3744285b-cd16-4f7f-b639-92c82877e0e1 bmp;fbx;gif;jpg;jpeg;tga;tiff;tif;png - - dll; - Assets @@ -21,19 +18,16 @@ Assets - - - - - - - - - + + + + + + \ No newline at end of file diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/Assets/logo.scale-240.png b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/Assets/logo.scale-240.png new file mode 100644 index 0000000000..76921ca997 Binary files /dev/null and b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/Assets/logo.scale-240.png differ diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/Assets/smallLogo.scale-240.png b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/Assets/smallLogo.scale-240.png new file mode 100644 index 0000000000..316630124f Binary files /dev/null and b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/Assets/smallLogo.scale-240.png differ diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/Assets/splashscreen.scale-240.png b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/Assets/splashscreen.scale-240.png new file mode 100644 index 0000000000..b0b6bc08e5 Binary files /dev/null and b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/Assets/splashscreen.scale-240.png differ diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/Assets/square71x71logo.scale-240.png b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/Assets/square71x71logo.scale-240.png new file mode 100644 index 0000000000..cfa54bee03 Binary files /dev/null and b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/Assets/square71x71logo.scale-240.png differ diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/Assets/storeLogo.scale-240.png b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/Assets/storeLogo.scale-240.png new file mode 100644 index 0000000000..47e084b593 Binary files /dev/null and b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/Assets/storeLogo.scale-240.png differ diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/Assets/wideLogo.scale-240.png b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/Assets/wideLogo.scale-240.png new file mode 100644 index 0000000000..6249d29db0 Binary files /dev/null and b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/Assets/wideLogo.scale-240.png differ diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/OpenGLESPage.xaml b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/OpenGLESPage.xaml deleted file mode 100644 index 47d2da5797..0000000000 --- a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/OpenGLESPage.xaml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/OpenGLESPage.xaml.h b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/OpenGLESPage.xaml.h deleted file mode 100644 index 3d9bd57996..0000000000 --- a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/OpenGLESPage.xaml.h +++ /dev/null @@ -1,39 +0,0 @@ -#pragma once - -#include "OpenGLESPage.g.h" - -namespace cpp_tests -{ - public ref class OpenGLESPage sealed - { - public: - OpenGLESPage(); - virtual ~OpenGLESPage(); - - internal: - OpenGLESPage(OpenGLES* openGLES); - - private: - void OnPageLoaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); - void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args); - void OnSwapChainPanelSizeChanged(Platform::Object^ sender, Windows::UI::Xaml::SizeChangedEventArgs^ e); - void GetSwapChainPanelSize(GLsizei* width, GLsizei* height); - void CreateRenderSurface(); - void DestroyRenderSurface(); - void RecoverFromLostDevice(); - void StartRenderLoop(); - void StopRenderLoop(); - - OpenGLES* mOpenGLES; - - Windows::Foundation::Size mSwapChainPanelSize; - Concurrency::critical_section mSwapChainPanelSizeCriticalSection; - - Windows::Foundation::Size mCustomRenderSurfaceSize; - bool mUseCustomRenderSurfaceSize; - - EGLSurface mRenderSurface; // This surface is associated with a swapChainPanel on the page - Concurrency::critical_section mRenderSurfaceCriticalSection; - Windows::Foundation::IAsyncAction^ mRenderLoopWorker; - }; -} diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/Package.appxmanifest b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/Package.appxmanifest index 3fa1ac495c..e819a6cfa1 100644 --- a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/Package.appxmanifest +++ b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/Package.appxmanifest @@ -1,42 +1,32 @@  - - - - - + + cpp-tests.WindowsPhone dalestam Assets\StoreLogo.png - 6.3.1 6.3.1 - - + - - - - - - - + + + + + + + + + + + + diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/cpp-tests.WindowsPhone.vcxproj b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/cpp-tests.WindowsPhone.vcxproj index 5485f28228..581f8bcb6b 100644 --- a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/cpp-tests.WindowsPhone.vcxproj +++ b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/cpp-tests.WindowsPhone.vcxproj @@ -20,7 +20,7 @@ {15247c71-5289-4913-b88f-e253cc353720} - cpp_tests + cocos2d en-US 12.0 true @@ -76,13 +76,17 @@ false - ../../Classes;%(AdditionalIncludeDirectories) + ../../Classes;$(EngineRoot)cocos\platform\win8.1-universal;%(AdditionalIncludeDirectories) /Zm200 %(AdditionalOptions) /Zm200 %(AdditionalOptions) pch.h pch.h 4056;4996;%(DisableSpecificWarnings) 4056;4996;%(DisableSpecificWarnings) + CC_ENABLE_CHIPMUNK_INTEGRATION=1;%(PreprocessorDefinitions) + CC_ENABLE_CHIPMUNK_INTEGRATION=1;COCOS2D_DEBUG=1;%(PreprocessorDefinitions) + Use + Use @@ -92,13 +96,17 @@ false - ../../Classes;%(AdditionalIncludeDirectories) + ../../Classes;$(EngineRoot)cocos\platform\win8.1-universal;%(AdditionalIncludeDirectories) /Zm200 %(AdditionalOptions) /Zm200 %(AdditionalOptions) pch.h pch.h 4056;4996;%(DisableSpecificWarnings) 4056;4996;%(DisableSpecificWarnings) + CC_ENABLE_CHIPMUNK_INTEGRATION=1;%(PreprocessorDefinitions) + CC_ENABLE_CHIPMUNK_INTEGRATION=1;COCOS2D_DEBUG=1;%(PreprocessorDefinitions) + Use + Use @@ -118,19 +126,6 @@ Designer - - - - - - OpenGLESPage.xaml - - - - - OpenGLESPage.xaml - - {22f3b9df-1209-4574-8331-003966f562bf} diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/cpp-tests.WindowsPhone.vcxproj.filters b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/cpp-tests.WindowsPhone.vcxproj.filters index a91455b91f..b978e2a74f 100644 --- a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/cpp-tests.WindowsPhone.vcxproj.filters +++ b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.WindowsPhone/cpp-tests.WindowsPhone.vcxproj.filters @@ -5,18 +5,6 @@ $guid2$ bmp;fbx;gif;jpg;jpeg;tga;tiff;tif;png - - dll; - - - - - - - - - - diff --git a/tests/cpp-tests/proj.wp8-xaml/cpp-tests/LocalizedStrings.cs b/tests/cpp-tests/proj.wp8-xaml/cpp-tests/LocalizedStrings.cs index a7c1f23777..4c0d4ba292 100644 --- a/tests/cpp-tests/proj.wp8-xaml/cpp-tests/LocalizedStrings.cs +++ b/tests/cpp-tests/proj.wp8-xaml/cpp-tests/LocalizedStrings.cs @@ -1,6 +1,6 @@ -using PhoneDirect3DXamlAppInterop.Resources; +using cocos2d.Resources; -namespace PhoneDirect3DXamlAppInterop +namespace cocos2d { /// /// Provides access to string resources. diff --git a/tests/cpp-tests/proj.wp8-xaml/cpp-tests/Properties/AssemblyInfo.cs b/tests/cpp-tests/proj.wp8-xaml/cpp-tests/Properties/AssemblyInfo.cs index 1b6c5d6478..c5921e1749 100644 --- a/tests/cpp-tests/proj.wp8-xaml/cpp-tests/Properties/AssemblyInfo.cs +++ b/tests/cpp-tests/proj.wp8-xaml/cpp-tests/Properties/AssemblyInfo.cs @@ -6,11 +6,11 @@ using System.Resources; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("PhoneDirect3DXamlAppInterop")] +[assembly: AssemblyTitle("cocos2d")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("PhoneDirect3DXamlAppInterop")] +[assembly: AssemblyProduct("cocos2d")] [assembly: AssemblyCopyright("Copyright © 2012")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/tests/cpp-tests/proj.wp8-xaml/cpp-tests/Properties/WMAppManifest.xml b/tests/cpp-tests/proj.wp8-xaml/cpp-tests/Properties/WMAppManifest.xml index 33ee5c4b57..2c57048df9 100644 --- a/tests/cpp-tests/proj.wp8-xaml/cpp-tests/Properties/WMAppManifest.xml +++ b/tests/cpp-tests/proj.wp8-xaml/cpp-tests/Properties/WMAppManifest.xml @@ -1,7 +1,7 @@  - + Assets\ApplicationIcon.png @@ -11,10 +11,10 @@ - + - + Assets\Tiles\FlipCycleTileSmall.png 0 diff --git a/tests/cpp-tests/proj.wp8-xaml/cpp-tests/Resources/AppResources.Designer.cs b/tests/cpp-tests/proj.wp8-xaml/cpp-tests/Resources/AppResources.Designer.cs index daa745fe09..997d9d472b 100644 --- a/tests/cpp-tests/proj.wp8-xaml/cpp-tests/Resources/AppResources.Designer.cs +++ b/tests/cpp-tests/proj.wp8-xaml/cpp-tests/Resources/AppResources.Designer.cs @@ -8,7 +8,8 @@ // //------------------------------------------------------------------------------ -namespace PhoneDirect3DXamlAppInterop.Resources { +namespace cocos2d.Resources +{ using System; @@ -39,7 +40,7 @@ namespace PhoneDirect3DXamlAppInterop.Resources { public static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PhoneDirect3DXamlAppInterop.Resources.AppResources", typeof(AppResources).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("cocos2d.Resources.AppResources", typeof(AppResources).Assembly); resourceMan = temp; } return resourceMan; diff --git a/tests/cpp-tests/proj.wp8-xaml/cpp-tests/cpp-tests.csproj b/tests/cpp-tests/proj.wp8-xaml/cpp-tests/cpp-tests.csproj index 203e3e5187..9cd3486c02 100644 --- a/tests/cpp-tests/proj.wp8-xaml/cpp-tests/cpp-tests.csproj +++ b/tests/cpp-tests/proj.wp8-xaml/cpp-tests/cpp-tests.csproj @@ -9,8 +9,8 @@ {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} Library Properties - PhoneDirect3DXamlAppInterop - PhoneDirect3DXamlAppInterop + cocos2d + cpp-tests WindowsPhone v8.0 $(TargetFrameworkVersion) @@ -19,9 +19,9 @@ true true - PhoneDirect3DXamlAppInterop_$(Configuration)_$(Platform).xap + cpp-tests_$(Configuration)_$(Platform).xap Properties\AppManifest.xml - PhoneDirect3DXamlAppInterop.App + cocos2d.App true 11.0 true diff --git a/tests/cpp-tests/proj.wp8-xaml/cpp-testsComponent/cpp-testsComponent.vcxproj b/tests/cpp-tests/proj.wp8-xaml/cpp-testsComponent/cpp-testsComponent.vcxproj index d7cd694fdf..112cdec6b3 100644 --- a/tests/cpp-tests/proj.wp8-xaml/cpp-testsComponent/cpp-testsComponent.vcxproj +++ b/tests/cpp-tests/proj.wp8-xaml/cpp-testsComponent/cpp-testsComponent.vcxproj @@ -20,7 +20,7 @@ {86b2c23c-3a6c-4c4e-ab0e-16a8cc1523e9} - PhoneDirect3DXamlAppComponent + cocos2d en-US 11.0 true diff --git a/tests/lua-empty-test/project/proj.win32/lua-empty-test.vcxproj b/tests/lua-empty-test/project/proj.win32/lua-empty-test.vcxproj index e089f85d8c..d19e7d77ec 100644 --- a/tests/lua-empty-test/project/proj.win32/lua-empty-test.vcxproj +++ b/tests/lua-empty-test/project/proj.win32/lua-empty-test.vcxproj @@ -1,4 +1,4 @@ - + @@ -108,10 +108,8 @@ MachineX86 - xcopy "$(ProjectDir)..\..\..\..\cocos\scripting\lua-bindings\script\cocos2d" "$(ProjectDir)..\..\" /e /Y -xcopy "$(ProjectDir)..\..\..\..\cocos\scripting\lua-bindings\script\cocosdenshion" "$(ProjectDir)..\..\" /e /Y -xcopy "$(ProjectDir)..\..\..\..\cocos\scripting\lua-bindings\script\network" "$(ProjectDir)..\..\" /e /Y -xcopy "$(ProjectDir)..\..\..\..\external\lua\luasocket\*.lua" "$(ProjectDir)..\..\" /e /Y + if not exist "$(ProjectDir)..\..\src\cocos" mkdir "$(ProjectDir)..\..\src\cocos" +xcopy "$(ProjectDir)..\..\..\..\cocos\scripting\lua-bindings\script" "$(ProjectDir)..\..\src\cocos" /e /Y @@ -162,10 +160,8 @@ xcopy "$(ProjectDir)..\..\..\..\external\lua\luasocket\*.lua" "$(ProjectDir)..\. - xcopy "$(ProjectDir)..\..\..\..\cocos\scripting\lua-bindings\script\cocos2d" "$(ProjectDir)..\..\" /e /Y -xcopy "$(ProjectDir)..\..\..\..\cocos\scripting\lua-bindings\script\cocosdenshion" "$(ProjectDir)..\..\" /e /Y -xcopy "$(ProjectDir)..\..\..\..\cocos\scripting\lua-bindings\script\network" "$(ProjectDir)..\..\" /e /Y -xcopy "$(ProjectDir)..\..\..\..\external\lua\luasocket\*.lua" "$(ProjectDir)..\..\" /e /Y + if not exist "$(ProjectDir)..\..\src\cocos" mkdir "$(ProjectDir)..\..\src\cocos" +xcopy "$(ProjectDir)..\..\..\..\cocos\scripting\lua-bindings\script" "$(ProjectDir)..\..\src\cocos" /e /Y @@ -185,4 +181,4 @@ xcopy "$(ProjectDir)..\..\..\..\external\lua\luasocket\*.lua" "$(ProjectDir)..\. - + \ No newline at end of file diff --git a/tests/lua-tests/src/BillBoardTest/BillBoardTest.lua b/tests/lua-tests/src/BillBoardTest/BillBoardTest.lua index ee20cd68d1..cc175b9797 100644 --- a/tests/lua-tests/src/BillBoardTest/BillBoardTest.lua +++ b/tests/lua-tests/src/BillBoardTest/BillBoardTest.lua @@ -119,6 +119,22 @@ function BillBoardTest:init() layer:runAction( cc.RepeatForever:create( cc.RotateBy:create( math.random(), cc.vec3(0.0, 45.0, 0.0) ) ) ) end + local billboard = cc.BillBoard:create("Images/Icon.png") + billboard:setScale(0.2) + billboard:setPosition3D(cc.vec3(0.0, 30.0, 0.0)) + + local billboard2 = cc.BillBoard:create("Images/r2.png") + billboard2:setPosition3D(cc.vec3(0.0, 0.0, 100.0)) + billboard:addChild(billboard2) + table.insert(self._billboards, billboard) + table.insert(self._billboards, billboard2) + + local sprite3d = cc.Sprite3D:create("Sprite3DTest/orc.c3t") + sprite3d:setScale(2.0) + sprite3d:addChild(billboard) + sprite3d:runAction( cc.RepeatForever:create( cc.RotateBy:create( 10.0, cc.vec3(0.0, 360.0, 0.0) ) ) ) + self._layerBillBorad:addChild(sprite3d) + self:addNewBillBoradWithCoords(cc.vec3(20,5,0)) self:addNewBillBoradWithCoords(cc.vec3(60,5,0)) self:addNewBillBoradWithCoords(cc.vec3(100,5,0)) diff --git a/tests/lua-tests/src/CocoStudioTest/CocoStudioGUITest/CocoStudioGUITest.lua b/tests/lua-tests/src/CocoStudioTest/CocoStudioGUITest/CocoStudioGUITest.lua index 11f9ce3ed8..fe09c31ac9 100644 --- a/tests/lua-tests/src/CocoStudioTest/CocoStudioGUITest/CocoStudioGUITest.lua +++ b/tests/lua-tests/src/CocoStudioTest/CocoStudioGUITest/CocoStudioGUITest.lua @@ -1113,7 +1113,7 @@ function UILoadingBarRightScale9Test:initExtend() loadingBar:setScale9Enabled(true) loadingBar:setCapInsets(cc.rect(0, 0, 0, 0)) loadingBar:setContentSize(cc.size(300, 30)) - loadingBar:setDirection(ccui.LoadingBarDirection.LEFT) + loadingBar:setDirection(ccui.LoadingBarDirection.RIGHT) loadingBar:setPercent(0) loadingBar:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 + loadingBar:getContentSize().height / 4.0)) @@ -1349,7 +1349,8 @@ function UITextAreaTest:initExtend() self._uiLayer:addChild(alert) local textArea = ccui.Text:create() - textArea:setTextAreaSize(cc.size(280, 150)) + textArea:ignoreContentAdaptWithSize(false) + textArea:setContentSize(cc.size(280, 150)) textArea:setTextHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER) textArea:setString("TextArea widget can line wrap") textArea:setFontName("AmericanTypewriter") diff --git a/tests/lua-tests/src/Texture2dTest/Texture2dTest.lua b/tests/lua-tests/src/Texture2dTest/Texture2dTest.lua index c54fc74691..11a9679067 100644 --- a/tests/lua-tests/src/Texture2dTest/Texture2dTest.lua +++ b/tests/lua-tests/src/Texture2dTest/Texture2dTest.lua @@ -1178,13 +1178,18 @@ local function TextureDrawAtPoint() local ret = createTestLayer("Texture2D: drawAtPoint", "draws 2 textures using drawAtPoint") - local function draw() - -- TextureDemo:draw() + local function draw(transform, transformUpdated) + local director = cc.Director:getInstance() + assert(nil ~= director, "Director is null when seting matrix stack") + director:pushMatrix(cc.MATRIX_STACK_TYPE.MODELVIEW) + director:loadMatrix(cc.MATRIX_STACK_TYPE.MODELVIEW, transform) local s = cc.Director:getInstance():getWinSize() - + m_pTex1:drawAtPoint(cc.p(s.width/2-50, s.height/2 - 50)) m_pTex2F:drawAtPoint(cc.p(s.width/2+50, s.height/2 - 50)) + + director:popMatrix(cc.MATRIX_STACK_TYPE.MODELVIEW) end m_pTex1 = cc.Director:getInstance():getTextureCache():addImage("Images/grossinis_sister1.png") @@ -1192,6 +1197,13 @@ local function TextureDrawAtPoint() m_pTex1:retain() m_pTex2F:retain() + + local glNode = gl.glNodeCreate() + glNode:setContentSize(cc.size(256, 256)) + glNode:setAnchorPoint(cc.p(0, 0)) + glNode:registerScriptDrawHandler(draw) + ret:addChild(glNode) + local function onNodeEvent(event) if event == "exit" then m_pTex1:release() @@ -1207,10 +1219,15 @@ end -- TextureDrawInRect local function TextureDrawInRect() + local m_pTex1 = nil + local m_pTex2F = nil local ret = createTestLayer("Texture2D: drawInRect", "draws 2 textures using drawInRect") - local function draw() - -- TextureDemo:draw() + local function draw(transform, transformUpdated) + local director = cc.Director:getInstance() + assert(nullptr ~= director, "Director is null when seting matrix stack") + director:pushMatrix(cc.MATRIX_STACK_TYPE.MODELVIEW) + director:loadMatrix(cc.MATRIX_STACK_TYPE.MODELVIEW, transform) local s = cc.Director:getInstance():getWinSize() @@ -1221,11 +1238,18 @@ local function TextureDrawInRect() m_pTex2F:drawInRect(rect2) end - local m_pTex1 = cc.Director:getInstance():getTextureCache():addImage("Images/grossinis_sister1.png") - local m_pTex2F = cc.Director:getInstance():getTextureCache():addImage("Images/grossinis_sister2.png") + m_pTex1 = cc.Director:getInstance():getTextureCache():addImage("Images/grossinis_sister1.png") + m_pTex2F = cc.Director:getInstance():getTextureCache():addImage("Images/grossinis_sister2.png") m_pTex1:retain() m_pTex2F:retain() + + local glNode = gl.glNodeCreate() + glNode:setContentSize(cc.size(256, 256)) + glNode:setAnchorPoint(cc.p(0, 0)) + glNode:registerScriptDrawHandler(draw) + ret:addChild(glNode) + local function onNodeEvent(event) if event == "exit" then m_pTex1:release()