Merge branch 'v3' of https://github.com/cocos2d/cocos2d-x into v3_beta0_test

Conflicts:
	tests/cpp-tests/Classes/AppDelegate.cpp
This commit is contained in:
samuele3hu 2015-04-22 10:31:39 +08:00
commit 8d9064b4e4
89 changed files with 2414 additions and 686 deletions

View File

@ -2,11 +2,13 @@ cocos2d-x-3.6 ??
[NEW] 3rd: update chipmunk to v 6.2.2 on Windows 8.1 Universal App [NEW] 3rd: update chipmunk to v 6.2.2 on Windows 8.1 Universal App
[NEW] 3rd: update freetype to v 2.5.5 on Windows 8.1 Universal App [NEW] 3rd: update freetype to v 2.5.5 on Windows 8.1 Universal App
[NEW] Label: added LabelEffect::ALL which can be used in disableEffect(LabelEffect) to disable all effects [NEW] Label: added LabelEffect::ALL which can be used in disableEffect(LabelEffect) to disable all effects
[NEW] Lua-binding: binded ui:WebView and added corresponidng test case
[NEW] MathUtil: added `MathUtil::lerp()` [NEW] MathUtil: added `MathUtil::lerp()`
[NEW] UserDefault: added `UserDefault::setDelegate()` [NEW] UserDefault: added `UserDefault::setDelegate()`
[NEW] Vec2: added `Vec2::setZero()` [NEW] Vec2: added `Vec2::setZero()`
[NEW] Vec3: added `Vec3::lerp()` [NEW] Vec3: added `Vec3::lerp()`
[NEW] WP8: remove WP8 support because Angle don't support WP8 any more [NEW] WP8: remove WP8 support because Angle don't support WP8 any more
[NEW] WP8.1: added back button support
[FIX] JNI: JNI illegal start byte error which causes crashing error on Android 5.0 [FIX] JNI: JNI illegal start byte error which causes crashing error on Android 5.0
[FIX] UI:VideoPlayer: crashed when playing streamed MP4 file on iOS [FIX] UI:VideoPlayer: crashed when playing streamed MP4 file on iOS

View File

@ -1191,10 +1191,6 @@
29394CF519B01DBA00D2DE1A /* UIWebViewImpl-ios.h in Headers */ = {isa = PBXBuildFile; fileRef = 29394CEE19B01DBA00D2DE1A /* UIWebViewImpl-ios.h */; }; 29394CF519B01DBA00D2DE1A /* UIWebViewImpl-ios.h in Headers */ = {isa = PBXBuildFile; fileRef = 29394CEE19B01DBA00D2DE1A /* UIWebViewImpl-ios.h */; };
29394CF619B01DBA00D2DE1A /* UIWebViewImpl-ios.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29394CEF19B01DBA00D2DE1A /* UIWebViewImpl-ios.mm */; }; 29394CF619B01DBA00D2DE1A /* UIWebViewImpl-ios.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29394CEF19B01DBA00D2DE1A /* UIWebViewImpl-ios.mm */; };
29394CF719B01DBA00D2DE1A /* UIWebViewImpl-ios.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29394CEF19B01DBA00D2DE1A /* UIWebViewImpl-ios.mm */; }; 29394CF719B01DBA00D2DE1A /* UIWebViewImpl-ios.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29394CEF19B01DBA00D2DE1A /* UIWebViewImpl-ios.mm */; };
296BF6151A44059B0038EC44 /* UIShaders.h in Headers */ = {isa = PBXBuildFile; fileRef = 296BF6141A44059B0038EC44 /* UIShaders.h */; };
296BF6161A44059B0038EC44 /* UIShaders.h in Headers */ = {isa = PBXBuildFile; fileRef = 296BF6141A44059B0038EC44 /* UIShaders.h */; };
296BF6181A4405CB0038EC44 /* UIShaders.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 296BF6171A4405CB0038EC44 /* UIShaders.cpp */; };
296BF6191A4405CB0038EC44 /* UIShaders.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 296BF6171A4405CB0038EC44 /* UIShaders.cpp */; };
2986667F18B1B246000E39CA /* CCTweenFunction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2986667818B1B079000E39CA /* CCTweenFunction.cpp */; }; 2986667F18B1B246000E39CA /* CCTweenFunction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2986667818B1B079000E39CA /* CCTweenFunction.cpp */; };
299754F4193EC95400A54AC3 /* ObjectFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 299754F2193EC95400A54AC3 /* ObjectFactory.cpp */; }; 299754F4193EC95400A54AC3 /* ObjectFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 299754F2193EC95400A54AC3 /* ObjectFactory.cpp */; };
299754F5193EC95400A54AC3 /* ObjectFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 299754F2193EC95400A54AC3 /* ObjectFactory.cpp */; }; 299754F5193EC95400A54AC3 /* ObjectFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 299754F2193EC95400A54AC3 /* ObjectFactory.cpp */; };
@ -3045,9 +3041,6 @@
29394CEF19B01DBA00D2DE1A /* UIWebViewImpl-ios.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UIWebViewImpl-ios.mm"; sourceTree = "<group>"; }; 29394CEF19B01DBA00D2DE1A /* UIWebViewImpl-ios.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UIWebViewImpl-ios.mm"; sourceTree = "<group>"; };
2958244919873D8E00F9746D /* UIScale9Sprite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIScale9Sprite.cpp; sourceTree = "<group>"; }; 2958244919873D8E00F9746D /* UIScale9Sprite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIScale9Sprite.cpp; sourceTree = "<group>"; };
2958244A19873D8E00F9746D /* UIScale9Sprite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIScale9Sprite.h; sourceTree = "<group>"; }; 2958244A19873D8E00F9746D /* UIScale9Sprite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIScale9Sprite.h; sourceTree = "<group>"; };
296BF6131A4403380038EC44 /* ccShader_grayscale.frag */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = ccShader_grayscale.frag; sourceTree = "<group>"; };
296BF6141A44059B0038EC44 /* UIShaders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIShaders.h; sourceTree = "<group>"; };
296BF6171A4405CB0038EC44 /* UIShaders.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIShaders.cpp; sourceTree = "<group>"; };
2986667818B1B079000E39CA /* CCTweenFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCTweenFunction.cpp; sourceTree = "<group>"; }; 2986667818B1B079000E39CA /* CCTweenFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCTweenFunction.cpp; sourceTree = "<group>"; };
2986667918B1B079000E39CA /* CCTweenFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCTweenFunction.h; sourceTree = "<group>"; }; 2986667918B1B079000E39CA /* CCTweenFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCTweenFunction.h; sourceTree = "<group>"; };
299754F2193EC95400A54AC3 /* ObjectFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ObjectFactory.cpp; path = ../base/ObjectFactory.cpp; sourceTree = "<group>"; }; 299754F2193EC95400A54AC3 /* ObjectFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ObjectFactory.cpp; path = ../base/ObjectFactory.cpp; sourceTree = "<group>"; };
@ -5194,7 +5187,6 @@
2905F9E618CF08D000240AA3 /* ui */ = { 2905F9E618CF08D000240AA3 /* ui */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
296BF6121A4403380038EC44 /* shaders */,
29CB8F531929D67D00C841D6 /* widgets */, 29CB8F531929D67D00C841D6 /* widgets */,
29CB8F521929D65500C841D6 /* experimental */, 29CB8F521929D65500C841D6 /* experimental */,
29CB8F511929D64500C841D6 /* base */, 29CB8F511929D64500C841D6 /* base */,
@ -5235,16 +5227,6 @@
name = mac; name = mac;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
296BF6121A4403380038EC44 /* shaders */ = {
isa = PBXGroup;
children = (
296BF6131A4403380038EC44 /* ccShader_grayscale.frag */,
296BF6141A44059B0038EC44 /* UIShaders.h */,
296BF6171A4405CB0038EC44 /* UIShaders.cpp */,
);
path = shaders;
sourceTree = "<group>";
};
29CB8F501929D63600C841D6 /* layout */ = { 29CB8F501929D63600C841D6 /* layout */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@ -6903,7 +6885,6 @@
15AE1C1219AAE2C600C27E9E /* CCPhysicsDebugNode.h in Headers */, 15AE1C1219AAE2C600C27E9E /* CCPhysicsDebugNode.h in Headers */,
B665E3381AA80A6500DDB1C5 /* CCPUOnEmissionObserverTranslator.h in Headers */, B665E3381AA80A6500DDB1C5 /* CCPUOnEmissionObserverTranslator.h in Headers */,
50ABBE951925AB6F00A911A9 /* CCProfiling.h in Headers */, 50ABBE951925AB6F00A911A9 /* CCProfiling.h in Headers */,
296BF6151A44059B0038EC44 /* UIShaders.h in Headers */,
B665E2301AA80A6500DDB1C5 /* CCPUBoxColliderTranslator.h in Headers */, B665E2301AA80A6500DDB1C5 /* CCPUBoxColliderTranslator.h in Headers */,
5034CA4B191D591100CE6051 /* ccShader_Label_df_glow.frag in Headers */, 5034CA4B191D591100CE6051 /* ccShader_Label_df_glow.frag in Headers */,
50ABBE4F1925AB6F00A911A9 /* CCEventCustom.h in Headers */, 50ABBE4F1925AB6F00A911A9 /* CCEventCustom.h in Headers */,
@ -7448,7 +7429,6 @@
B665E2711AA80A6500DDB1C5 /* CCPUDoFreezeEventHandlerTranslator.h in Headers */, B665E2711AA80A6500DDB1C5 /* CCPUDoFreezeEventHandlerTranslator.h in Headers */,
1A570115180BC8EE0088DEC7 /* CCDrawNode.h in Headers */, 1A570115180BC8EE0088DEC7 /* CCDrawNode.h in Headers */,
1A57011E180BC90D0088DEC7 /* CCGrabber.h in Headers */, 1A57011E180BC90D0088DEC7 /* CCGrabber.h in Headers */,
296BF6161A44059B0038EC44 /* UIShaders.h in Headers */,
1A570122180BC90D0088DEC7 /* CCGrid.h in Headers */, 1A570122180BC90D0088DEC7 /* CCGrid.h in Headers */,
15AE1AB319AAD40300C27E9E /* b2CircleContact.h in Headers */, 15AE1AB319AAD40300C27E9E /* b2CircleContact.h in Headers */,
5034CA2E191D591100CE6051 /* ccShader_PositionTextureA8Color.frag in Headers */, 5034CA2E191D591100CE6051 /* ccShader_PositionTextureA8Color.frag in Headers */,
@ -8598,7 +8578,6 @@
B665E3E61AA80A6600DDB1C5 /* CCPUSineForceAffectorTranslator.cpp in Sources */, B665E3E61AA80A6600DDB1C5 /* CCPUSineForceAffectorTranslator.cpp in Sources */,
15AE1B5119AADA9900C27E9E /* UIPageView.cpp in Sources */, 15AE1B5119AADA9900C27E9E /* UIPageView.cpp in Sources */,
15AE18EC19AAD35000C27E9E /* CCActionObject.cpp in Sources */, 15AE18EC19AAD35000C27E9E /* CCActionObject.cpp in Sources */,
296BF6181A4405CB0038EC44 /* UIShaders.cpp in Sources */,
B665E2821AA80A6500DDB1C5 /* CCPUDoStopSystemEventHandler.cpp in Sources */, B665E2821AA80A6500DDB1C5 /* CCPUDoStopSystemEventHandler.cpp in Sources */,
1A01C68E18F57BE800EFE3A6 /* CCDictionary.cpp in Sources */, 1A01C68E18F57BE800EFE3A6 /* CCDictionary.cpp in Sources */,
50ABBD381925AB0000A911A9 /* CCAffineTransform.cpp in Sources */, 50ABBD381925AB0000A911A9 /* CCAffineTransform.cpp in Sources */,
@ -9075,7 +9054,6 @@
182C5CD71A98F30500C30D34 /* Sprite3DReader.cpp in Sources */, 182C5CD71A98F30500C30D34 /* Sprite3DReader.cpp in Sources */,
50ABC0061926664800A911A9 /* CCThread-apple.mm in Sources */, 50ABC0061926664800A911A9 /* CCThread-apple.mm in Sources */,
50ABBEB61925AB6F00A911A9 /* CCUserDefault-android.cpp in Sources */, 50ABBEB61925AB6F00A911A9 /* CCUserDefault-android.cpp in Sources */,
296BF6191A4405CB0038EC44 /* UIShaders.cpp in Sources */,
1A57034C180BD09B0088DEC7 /* tinyxml2.cpp in Sources */, 1A57034C180BD09B0088DEC7 /* tinyxml2.cpp in Sources */,
50ABBDB61925AB4100A911A9 /* CCTexture2D.cpp in Sources */, 50ABBDB61925AB4100A911A9 /* CCTexture2D.cpp in Sources */,
B665E2871AA80A6500DDB1C5 /* CCPUDoStopSystemEventHandlerTranslator.cpp in Sources */, B665E2871AA80A6500DDB1C5 /* CCPUDoStopSystemEventHandlerTranslator.cpp in Sources */,

View File

@ -42,6 +42,8 @@
1502702E1AD3BDC90089CD03 /* TerrainTest in Resources */ = {isa = PBXBuildFile; fileRef = B603F1B31AC8FBFB00A9579C /* TerrainTest */; }; 1502702E1AD3BDC90089CD03 /* TerrainTest in Resources */ = {isa = PBXBuildFile; fileRef = B603F1B31AC8FBFB00A9579C /* TerrainTest */; };
150F918819DA409E00B89F57 /* lua_test_bindings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 150F918619DA409E00B89F57 /* lua_test_bindings.cpp */; }; 150F918819DA409E00B89F57 /* lua_test_bindings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 150F918619DA409E00B89F57 /* lua_test_bindings.cpp */; };
150F918919DA409F00B89F57 /* lua_test_bindings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 150F918619DA409E00B89F57 /* lua_test_bindings.cpp */; }; 150F918919DA409F00B89F57 /* lua_test_bindings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 150F918619DA409E00B89F57 /* lua_test_bindings.cpp */; };
1531B2501AE013DE0075DB94 /* Test.html in Resources */ = {isa = PBXBuildFile; fileRef = 29AFEF6619ACCAA000F6B10A /* Test.html */; };
1531B2511AE013F00075DB94 /* Test.html in Resources */ = {isa = PBXBuildFile; fileRef = 29AFEF6619ACCAA000F6B10A /* Test.html */; };
15427B79198B879900DC375D /* libluacocos2d iOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 15EFA665198B33EE000C57D3 /* libluacocos2d iOS.a */; }; 15427B79198B879900DC375D /* libluacocos2d iOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 15EFA665198B33EE000C57D3 /* libluacocos2d iOS.a */; };
15427B7A198B87AA00DC375D /* libcocos2d iOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 46A15FBE1807A4F9005B8026 /* libcocos2d iOS.a */; }; 15427B7A198B87AA00DC375D /* libcocos2d iOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 46A15FBE1807A4F9005B8026 /* libcocos2d iOS.a */; };
15427B7D198B880100DC375D /* lua_cocos2dx_controller_manual.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15427B7B198B880100DC375D /* lua_cocos2dx_controller_manual.cpp */; }; 15427B7D198B880100DC375D /* lua_cocos2dx_controller_manual.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15427B7B198B880100DC375D /* lua_cocos2dx_controller_manual.cpp */; };
@ -4378,6 +4380,7 @@
isa = PBXResourcesBuildPhase; isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
1531B2501AE013DE0075DB94 /* Test.html in Resources */,
1502702E1AD3BDC90089CD03 /* TerrainTest in Resources */, 1502702E1AD3BDC90089CD03 /* TerrainTest in Resources */,
157B08EC1A90864100B7BEA4 /* Particle3D in Resources */, 157B08EC1A90864100B7BEA4 /* Particle3D in Resources */,
15B13E5219F0FD4D008A1ADC /* Manifests in Resources */, 15B13E5219F0FD4D008A1ADC /* Manifests in Resources */,
@ -4424,6 +4427,7 @@
isa = PBXResourcesBuildPhase; isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
1531B2511AE013F00075DB94 /* Test.html in Resources */,
1502702D1AD3BDBC0089CD03 /* TerrainTest in Resources */, 1502702D1AD3BDBC0089CD03 /* TerrainTest in Resources */,
157B08ED1A90865600B7BEA4 /* Particle3D in Resources */, 157B08ED1A90865600B7BEA4 /* Particle3D in Resources */,
15B3709A19EE5EED00ABE682 /* Manifests in Resources */, 15B3709A19EE5EED00ABE682 /* Manifests in Resources */,

View File

@ -601,7 +601,6 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
<ClCompile Include="..\renderer\CCVertexIndexData.cpp" /> <ClCompile Include="..\renderer\CCVertexIndexData.cpp" />
<ClCompile Include="..\storage\local-storage\LocalStorage.cpp" /> <ClCompile Include="..\storage\local-storage\LocalStorage.cpp" />
<ClCompile Include="..\ui\CocosGUI.cpp" /> <ClCompile Include="..\ui\CocosGUI.cpp" />
<ClCompile Include="..\ui\shaders\UIShaders.cpp" />
<ClCompile Include="..\ui\UIButton.cpp" /> <ClCompile Include="..\ui\UIButton.cpp" />
<ClCompile Include="..\ui\UICheckBox.cpp" /> <ClCompile Include="..\ui\UICheckBox.cpp" />
<ClCompile Include="..\ui\UIDeprecated.cpp" /> <ClCompile Include="..\ui\UIDeprecated.cpp" />
@ -1176,7 +1175,6 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
<ClInclude Include="..\storage\local-storage\LocalStorage.h" /> <ClInclude Include="..\storage\local-storage\LocalStorage.h" />
<ClInclude Include="..\ui\CocosGUI.h" /> <ClInclude Include="..\ui\CocosGUI.h" />
<ClInclude Include="..\ui\GUIExport.h" /> <ClInclude Include="..\ui\GUIExport.h" />
<ClInclude Include="..\ui\shaders\UIShaders.h" />
<ClInclude Include="..\ui\UIButton.h" /> <ClInclude Include="..\ui\UIButton.h" />
<ClInclude Include="..\ui\UICheckBox.h" /> <ClInclude Include="..\ui\UICheckBox.h" />
<ClInclude Include="..\ui\UIDeprecated.h" /> <ClInclude Include="..\ui\UIDeprecated.h" />
@ -1285,7 +1283,6 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
<None Include="..\math\Vec2.inl" /> <None Include="..\math\Vec2.inl" />
<None Include="..\math\Vec3.inl" /> <None Include="..\math\Vec3.inl" />
<None Include="..\math\Vec4.inl" /> <None Include="..\math\Vec4.inl" />
<None Include="..\ui\shaders\ccShader_grayscale.frag" />
<None Include="cocos2d.def" /> <None Include="cocos2d.def" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -259,9 +259,6 @@
<Filter Include="cocostudio\reader\WidgetReader\ArmatureNodeReader"> <Filter Include="cocostudio\reader\WidgetReader\ArmatureNodeReader">
<UniqueIdentifier>{e1848cce-b225-42c4-bb6e-6430b6da123b}</UniqueIdentifier> <UniqueIdentifier>{e1848cce-b225-42c4-bb6e-6430b6da123b}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="ui\shaders">
<UniqueIdentifier>{e6eaa24a-a21e-4c1d-b6b2-19326d129af2}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\physics\CCPhysicsBody.cpp"> <ClCompile Include="..\physics\CCPhysicsBody.cpp">
@ -1324,9 +1321,6 @@
<ClCompile Include="..\editor-support\cocostudio\WidgetReader\ArmatureNodeReader\ArmatureNodeReader.cpp"> <ClCompile Include="..\editor-support\cocostudio\WidgetReader\ArmatureNodeReader\ArmatureNodeReader.cpp">
<Filter>cocostudio\reader\WidgetReader\ArmatureNodeReader</Filter> <Filter>cocostudio\reader\WidgetReader\ArmatureNodeReader</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\ui\shaders\UIShaders.cpp">
<Filter>ui\shaders</Filter>
</ClCompile>
<ClCompile Include="..\3d\CCFrustum.cpp" /> <ClCompile Include="..\3d\CCFrustum.cpp" />
<ClCompile Include="..\3d\CCPlane.cpp" /> <ClCompile Include="..\3d\CCPlane.cpp" />
<ClCompile Include="..\3d\CCAABB.cpp"> <ClCompile Include="..\3d\CCAABB.cpp">
@ -3042,9 +3036,6 @@
<ClInclude Include="..\editor-support\cocostudio\WidgetReader\ArmatureNodeReader\CSArmatureNode_generated.h"> <ClInclude Include="..\editor-support\cocostudio\WidgetReader\ArmatureNodeReader\CSArmatureNode_generated.h">
<Filter>cocostudio\reader\WidgetReader\ArmatureNodeReader</Filter> <Filter>cocostudio\reader\WidgetReader\ArmatureNodeReader</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\ui\shaders\UIShaders.h">
<Filter>ui\shaders</Filter>
</ClInclude>
<ClInclude Include="..\3d\CCFrustum.h" /> <ClInclude Include="..\3d\CCFrustum.h" />
<ClInclude Include="..\3d\CCPlane.h" /> <ClInclude Include="..\3d\CCPlane.h" />
<ClInclude Include="..\physics\CCPhysicsHelper.h"> <ClInclude Include="..\physics\CCPhysicsHelper.h">
@ -3548,8 +3539,5 @@
<None Include="..\3d\CCAnimationCurve.inl"> <None Include="..\3d\CCAnimationCurve.inl">
<Filter>3d</Filter> <Filter>3d</Filter>
</None> </None>
<None Include="..\ui\shaders\ccShader_grayscale.frag">
<Filter>ui\shaders</Filter>
</None>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -472,7 +472,7 @@
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\Keyboard-winrt.h" /> <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\Keyboard-winrt.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\pch.h" /> <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\pch.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\sha1.h" /> <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\sha1.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\WICImageLoader-win.h" /> <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\WICImageLoader-winrt.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCBatchCommand.h" /> <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCBatchCommand.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCCustomCommand.h" /> <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCCustomCommand.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCGLProgram.h" /> <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCGLProgram.h" />
@ -498,7 +498,6 @@
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\storage\local-storage\LocalStorage.h" /> <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\storage\local-storage\LocalStorage.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\CocosGUI.h" /> <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\CocosGUI.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\GUIExport.h" /> <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\GUIExport.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\shaders\UIShaders.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UIButton.h" /> <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UIButton.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UICheckBox.h" /> <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UICheckBox.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UIDeprecated.h" /> <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UIDeprecated.h" />
@ -1028,7 +1027,7 @@
</ForcedIncludeFiles> </ForcedIncludeFiles>
</ClCompile> </ClCompile>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\sha1.cpp" /> <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\sha1.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\WICImageLoader-win.cpp" /> <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\WICImageLoader-winrt.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCBatchCommand.cpp" /> <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCBatchCommand.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCCustomCommand.cpp" /> <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCCustomCommand.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCGLProgram.cpp" /> <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCGLProgram.cpp" />
@ -1052,7 +1051,6 @@
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCVertexIndexData.cpp" /> <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCVertexIndexData.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\storage\local-storage\LocalStorage.cpp" /> <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\storage\local-storage\LocalStorage.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\CocosGUI.cpp" /> <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\CocosGUI.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\shaders\UIShaders.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UIButton.cpp" /> <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UIButton.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UICheckBox.cpp" /> <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UICheckBox.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UIDeprecated.cpp" /> <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UIDeprecated.cpp" />
@ -1190,7 +1188,6 @@
</None> </None>
<None Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\ccShader_Position_uColor.frag" /> <None Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\ccShader_Position_uColor.frag" />
<None Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\ccShader_Position_uColor.vert" /> <None Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\ccShader_Position_uColor.vert" />
<None Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\shaders\ccShader_grayscale.frag" />
<None Include="$(MSBuildThisFileDirectory)..\..\..\cocos2d.def" /> <None Include="$(MSBuildThisFileDirectory)..\..\..\cocos2d.def" />
<None Include="$(MSBuildThisFileDirectory)..\..\..\libcocos2d.vcxproj.filters" /> <None Include="$(MSBuildThisFileDirectory)..\..\..\libcocos2d.vcxproj.filters" />
<None Include="$(MSBuildThisFileDirectory)..\..\..\libcocos2d_wp8.vcxproj.filters" /> <None Include="$(MSBuildThisFileDirectory)..\..\..\libcocos2d_wp8.vcxproj.filters" />

View File

@ -1225,9 +1225,6 @@
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\WidgetReader\ArmatureNodeReader\ArmatureNodeReader.h"> <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\WidgetReader\ArmatureNodeReader\ArmatureNodeReader.h">
<Filter>cocostudio\reader\WidgetReader\ArmatureNodeReader</Filter> <Filter>cocostudio\reader\WidgetReader\ArmatureNodeReader</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\shaders\UIShaders.h">
<Filter>ui\shaders</Filter>
</ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CCActionTimelineNode.h"> <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CCActionTimelineNode.h">
<Filter>cocostudio\TimelineAction</Filter> <Filter>cocostudio\TimelineAction</Filter>
</ClInclude> </ClInclude>
@ -1743,7 +1740,7 @@
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCTerrain.h"> <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCTerrain.h">
<Filter>3d</Filter> <Filter>3d</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\WICImageLoader-win.h"> <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\WICImageLoader-winrt.h">
<Filter>platform\winrt</Filter> <Filter>platform\winrt</Filter>
</ClInclude> </ClInclude>
</ItemGroup> </ItemGroup>
@ -2818,9 +2815,6 @@
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\WidgetReader\ArmatureNodeReader\ArmatureNodeReader.cpp"> <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\WidgetReader\ArmatureNodeReader\ArmatureNodeReader.cpp">
<Filter>cocostudio\reader\WidgetReader\ArmatureNodeReader</Filter> <Filter>cocostudio\reader\WidgetReader\ArmatureNodeReader</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\shaders\UIShaders.cpp">
<Filter>ui\shaders</Filter>
</ClCompile>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CCActionTimelineNode.cpp"> <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CCActionTimelineNode.cpp">
<Filter>cocostudio\TimelineAction</Filter> <Filter>cocostudio\TimelineAction</Filter>
</ClCompile> </ClCompile>
@ -3318,7 +3312,7 @@
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\CocoStudio.cpp"> <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\CocoStudio.cpp">
<Filter>cocostudio\json</Filter> <Filter>cocostudio\json</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\WICImageLoader-win.cpp"> <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\WICImageLoader-winrt.cpp">
<Filter>platform\winrt</Filter> <Filter>platform\winrt</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>
@ -3557,9 +3551,6 @@
<Filter Include="cocostudio\reader\WidgetReader\ArmatureNodeReader"> <Filter Include="cocostudio\reader\WidgetReader\ArmatureNodeReader">
<UniqueIdentifier>{1151b6b3-739f-4cff-add0-6b772fa7d226}</UniqueIdentifier> <UniqueIdentifier>{1151b6b3-739f-4cff-add0-6b772fa7d226}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="ui\shaders">
<UniqueIdentifier>{10d3def7-52ba-4939-8de7-d9960a752f1e}</UniqueIdentifier>
</Filter>
<Filter Include="base\allocator"> <Filter Include="base\allocator">
<UniqueIdentifier>{673ca2c5-2183-424e-a2aa-728cd5231b62}</UniqueIdentifier> <UniqueIdentifier>{673ca2c5-2183-424e-a2aa-728cd5231b62}</UniqueIdentifier>
</Filter> </Filter>
@ -3683,9 +3674,6 @@
<None Include="$(MSBuildThisFileDirectory)..\..\..\libcocos2d_wp8.vcxproj.filters"> <None Include="$(MSBuildThisFileDirectory)..\..\..\libcocos2d_wp8.vcxproj.filters">
<Filter>2d</Filter> <Filter>2d</Filter>
</None> </None>
<None Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\shaders\ccShader_grayscale.frag">
<Filter>ui\shaders</Filter>
</None>
<None Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCAnimationCurve.inl"> <None Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCAnimationCurve.inl">
<Filter>3d</Filter> <Filter>3d</Filter>
</None> </None>

View File

@ -114,31 +114,41 @@
<GenerateManifest>false</GenerateManifest> <GenerateManifest>false</GenerateManifest>
<IgnoreImportLibrary>false</IgnoreImportLibrary> <IgnoreImportLibrary>false</IgnoreImportLibrary>
<TargetName>libcocos2d_v3.6_Windows_8.1</TargetName> <TargetName>libcocos2d_v3.6_Windows_8.1</TargetName>
<LinkIncremental>
</LinkIncremental>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<GenerateManifest>false</GenerateManifest> <GenerateManifest>false</GenerateManifest>
<IgnoreImportLibrary>false</IgnoreImportLibrary> <IgnoreImportLibrary>false</IgnoreImportLibrary>
<TargetName>libcocos2d_v3.6_Windows_8.1</TargetName> <TargetName>libcocos2d_v3.6_Windows_8.1</TargetName>
<LinkIncremental>
</LinkIncremental>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<GenerateManifest>false</GenerateManifest> <GenerateManifest>false</GenerateManifest>
<IgnoreImportLibrary>false</IgnoreImportLibrary> <IgnoreImportLibrary>false</IgnoreImportLibrary>
<TargetName>libcocos2d_v3.6_Windows_8.1</TargetName> <TargetName>libcocos2d_v3.6_Windows_8.1</TargetName>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<GenerateManifest>false</GenerateManifest> <GenerateManifest>false</GenerateManifest>
<IgnoreImportLibrary>false</IgnoreImportLibrary> <IgnoreImportLibrary>false</IgnoreImportLibrary>
<TargetName>libcocos2d_v3.6_Windows_8.1</TargetName> <TargetName>libcocos2d_v3.6_Windows_8.1</TargetName>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<GenerateManifest>false</GenerateManifest> <GenerateManifest>false</GenerateManifest>
<IgnoreImportLibrary>false</IgnoreImportLibrary> <IgnoreImportLibrary>false</IgnoreImportLibrary>
<TargetName>libcocos2d_v3.6_Windows_8.1</TargetName> <TargetName>libcocos2d_v3.6_Windows_8.1</TargetName>
<LinkIncremental>
</LinkIncremental>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<GenerateManifest>false</GenerateManifest> <GenerateManifest>false</GenerateManifest>
<IgnoreImportLibrary>false</IgnoreImportLibrary> <IgnoreImportLibrary>false</IgnoreImportLibrary>
<TargetName>libcocos2d_v3.6_Windows_8.1</TargetName> <TargetName>libcocos2d_v3.6_Windows_8.1</TargetName>
<LinkIncremental>
</LinkIncremental>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>

View File

@ -96,11 +96,13 @@
<GenerateManifest>false</GenerateManifest> <GenerateManifest>false</GenerateManifest>
<IgnoreImportLibrary>false</IgnoreImportLibrary> <IgnoreImportLibrary>false</IgnoreImportLibrary>
<TargetName>libcocos2d_v3.6_WindowsPhone_8.1</TargetName> <TargetName>libcocos2d_v3.6_WindowsPhone_8.1</TargetName>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<GenerateManifest>false</GenerateManifest> <GenerateManifest>false</GenerateManifest>
<IgnoreImportLibrary>false</IgnoreImportLibrary> <IgnoreImportLibrary>false</IgnoreImportLibrary>
<TargetName>libcocos2d_v3.6_WindowsPhone_8.1</TargetName> <TargetName>libcocos2d_v3.6_WindowsPhone_8.1</TargetName>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>

View File

@ -7,7 +7,7 @@
<PropertyGroup /> <PropertyGroup />
<ItemDefinitionGroup> <ItemDefinitionGroup>
<ClCompile> <ClCompile>
<AdditionalIncludeDirectories>$(EngineRoot)external\$(COCOS2D_PLATFORM)-specific\angle\include;$(EngineRoot)external\freetype2\include\$(COCOS2D_PLATFORM)\freetype;$(EngineRoot)external\curl\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\websockets\include\$(COCOS2D_PLATFORM);$(EngineRoot)cocos\platform\winrt;$(EngineRoot)cocos\platform;$(EngineRoot)cocos\editor-support;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\sqlite3\include;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos;$(EngineRoot)extensions;$(EngineRoot)external;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\unzip;$(EngineRoot)external\tinyxml2;$(EngineRoot);$(EngineRoot)external\ConvertUTF;$(EngineRoot)external\xxhash;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(EngineRoot)external\$(COCOS2D_PLATFORM)-specific\angle\include;$(EngineRoot)external\freetype2\include\$(COCOS2D_PLATFORM)\freetype2;$(EngineRoot)external\curl\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\websockets\include\$(COCOS2D_PLATFORM);$(EngineRoot)cocos\platform\winrt;$(EngineRoot)cocos\platform;$(EngineRoot)cocos\editor-support;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\sqlite3\include;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos;$(EngineRoot)extensions;$(EngineRoot)external;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\unzip;$(EngineRoot)external\tinyxml2;$(EngineRoot);$(EngineRoot)external\ConvertUTF;$(EngineRoot)external\xxhash;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<ClCompile> <ClCompile>
<PreprocessorDefinitions>WINRT;_VARIADIC_MAX=10;NOMINMAX;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WINRT;_VARIADIC_MAX=10;NOMINMAX;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -142,85 +142,89 @@ Node* findChildByNameRecursively(Node* node, const std::string &childName)
//! called before the action start. It will also set the target. //! called before the action start. It will also set the target.
void Animate3D::startWithTarget(Node *target) void Animate3D::startWithTarget(Node *target)
{ {
bool needReMap = (_target != target);
ActionInterval::startWithTarget(target); ActionInterval::startWithTarget(target);
_boneCurves.clear(); if (needReMap)
_nodeCurves.clear();
bool hasCurve = false;
Sprite3D* sprite = dynamic_cast<Sprite3D*>(target);
if(sprite)
{ {
if (_animation) _boneCurves.clear();
_nodeCurves.clear();
bool hasCurve = false;
Sprite3D* sprite = dynamic_cast<Sprite3D*>(target);
if(sprite)
{ {
const std::unordered_map<std::string, Animation3D::Curve*>& boneCurves = _animation->getBoneCurves(); if (_animation)
for (const auto& iter: boneCurves)
{ {
const std::string& boneName = iter.first; const std::unordered_map<std::string, Animation3D::Curve*>& boneCurves = _animation->getBoneCurves();
auto skin = sprite->getSkeleton(); for (const auto& iter: boneCurves)
if(skin)
{ {
auto bone = skin->getBoneByName(boneName); const std::string& boneName = iter.first;
if (bone) auto skin = sprite->getSkeleton();
if(skin)
{ {
auto curve = _animation->getBoneCurveByName(boneName); auto bone = skin->getBoneByName(boneName);
_boneCurves[bone] = curve; if (bone)
hasCurve = true;
}
else
{
Node* node = nullptr;
if (target->getName() == boneName)
node = target;
else
node = findChildByNameRecursively(target, boneName);
if (node)
{ {
auto curve = _animation->getBoneCurveByName(boneName); auto curve = _animation->getBoneCurveByName(boneName);
if (curve) _boneCurves[bone] = curve;
hasCurve = true;
}
else
{
Node* node = nullptr;
if (target->getName() == boneName)
node = target;
else
node = findChildByNameRecursively(target, boneName);
if (node)
{ {
_nodeCurves[node] = curve; auto curve = _animation->getBoneCurveByName(boneName);
hasCurve = true; if (curve)
{
_nodeCurves[node] = curve;
hasCurve = true;
}
} }
} }
} }
} }
} }
} }
} else
else
{
const std::unordered_map<std::string, Animation3D::Curve*>& boneCurves = _animation->getBoneCurves();
for (const auto& iter: boneCurves)
{ {
const std::string& boneName = iter.first; const std::unordered_map<std::string, Animation3D::Curve*>& boneCurves = _animation->getBoneCurves();
Node* node = nullptr; for (const auto& iter: boneCurves)
if (target->getName() == boneName)
node = target;
else
node = findChildByNameRecursively(target, boneName);
if (node)
{ {
auto curve = _animation->getBoneCurveByName(boneName); const std::string& boneName = iter.first;
if (curve) Node* node = nullptr;
if (target->getName() == boneName)
node = target;
else
node = findChildByNameRecursively(target, boneName);
if (node)
{ {
_nodeCurves[node] = curve; auto curve = _animation->getBoneCurveByName(boneName);
hasCurve = true; if (curve)
{
_nodeCurves[node] = curve;
hasCurve = true;
}
} }
} }
}
if (!hasCurve)
{
CCLOG("warning: no animation finde for the skeleton");
} }
} }
if (!hasCurve) auto runningAction = s_runningAnimates.find(target);
{
CCLOG("warning: no animation finde for the skeleton");
}
auto runningAction = s_runningAnimates.find(sprite);
if (runningAction != s_runningAnimates.end()) if (runningAction != s_runningAnimates.end())
{ {
//make the running action fade out //make the running action fade out
@ -229,19 +233,19 @@ void Animate3D::startWithTarget(Node *target)
{ {
if (_transTime < 0.001f) if (_transTime < 0.001f)
{ {
s_runningAnimates[sprite] = this; s_runningAnimates[target] = this;
_state = Animate3D::Animate3DState::Running; _state = Animate3D::Animate3DState::Running;
_weight = 1.0f; _weight = 1.0f;
} }
else else
{ {
s_fadeOutAnimates[sprite] = action; s_fadeOutAnimates[target] = action;
action->_state = Animate3D::Animate3DState::FadeOut; action->_state = Animate3D::Animate3DState::FadeOut;
action->_accTransTime = 0.0f; action->_accTransTime = 0.0f;
action->_weight = 1.0f; action->_weight = 1.0f;
action->_lastTime = 0.f; action->_lastTime = 0.f;
s_fadeInAnimates[sprite] = this; s_fadeInAnimates[target] = this;
_accTransTime = 0.0f; _accTransTime = 0.0f;
_state = Animate3D::Animate3DState::FadeIn; _state = Animate3D::Animate3DState::FadeIn;
_weight = 0.f; _weight = 0.f;
@ -251,7 +255,12 @@ void Animate3D::startWithTarget(Node *target)
} }
else else
{ {
s_runningAnimates[sprite] = this; auto it = s_fadeInAnimates.find(target);
if (it != s_fadeInAnimates.end())
{
s_fadeInAnimates.erase(it);
}
s_runningAnimates[target] = this;
_state = Animate3D::Animate3DState::Running; _state = Animate3D::Animate3DState::Running;
_weight = 1.0f; _weight = 1.0f;
} }
@ -284,9 +293,8 @@ void Animate3D::update(float t)
_accTransTime = _transTime; _accTransTime = _transTime;
_weight = 1.0f; _weight = 1.0f;
_state = Animate3D::Animate3DState::Running; _state = Animate3D::Animate3DState::Running;
Sprite3D* sprite = static_cast<Sprite3D*>(_target); s_fadeInAnimates.erase(_target);
s_fadeInAnimates.erase(sprite); s_runningAnimates[_target] = this;
s_runningAnimates[sprite] = this;
} }
} }
else if (_state == Animate3D::Animate3DState::FadeOut && _lastTime > 0.f) else if (_state == Animate3D::Animate3DState::FadeOut && _lastTime > 0.f)
@ -299,8 +307,7 @@ void Animate3D::update(float t)
_accTransTime = _transTime; _accTransTime = _transTime;
_weight = 0.0f; _weight = 0.0f;
Sprite3D* sprite = static_cast<Sprite3D*>(_target); s_fadeOutAnimates.erase(_target);
s_fadeOutAnimates.erase(sprite);
} }
} }
_lastTime = t; _lastTime = t;

View File

@ -367,7 +367,6 @@ public:
{ {
Vec3Key() Vec3Key()
: _time(0) : _time(0)
, _key(Vec3::ZERO)
{ {
} }

View File

@ -197,7 +197,7 @@ void Bone3D::updateLocalMat()
{ {
if (_blendStates.size()) if (_blendStates.size())
{ {
Vec3 translate(Vec3::ZERO), scale(Vec3::ZERO); Vec3 translate, scale;
Quaternion quat(Quaternion::ZERO); Quaternion quat(Quaternion::ZERO);
float total = 0.f; float total = 0.f;

View File

@ -136,8 +136,7 @@ protected:
float weight; float weight;
void* tag; // void* tag; //
BoneBlendState() BoneBlendState()
: localTranslate(Vec3::ZERO) : localRot(Quaternion::identity())
, localRot(Quaternion::identity())
, localScale(Vec3::ONE) , localScale(Vec3::ONE)
, weight(1.f) , weight(1.f)
, tag(nullptr) , tag(nullptr)

View File

@ -200,7 +200,7 @@ bool TextureCube::init(const std::string& positive_x, const std::string& negativ
Texture2D::PixelFormat ePixelFmt; Texture2D::PixelFormat ePixelFmt;
unsigned char* pData = getImageData(img, ePixelFmt); unsigned char* pData = getImageData(img, ePixelFmt);
if (ePixelFmt == Texture2D::PixelFormat::RGBA8888) if (ePixelFmt == Texture2D::PixelFormat::RGBA8888 || ePixelFmt == Texture2D::PixelFormat::DEFAULT)
{ {
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i,
0, // level 0, // level

View File

@ -1644,6 +1644,7 @@ FrameData *DataReaderHelper::decodeFrame(const rapidjson::Value& json, DataInfo
if (length != 0) if (length != 0)
{ {
frameData->easingParams = new float[length]; frameData->easingParams = new float[length];
frameData->easingParamNumber = length;
for (int i = 0; i < length; i++) for (int i = 0; i < length; i++)
{ {

View File

@ -727,6 +727,14 @@ struct ButtonOptions : private flatbuffers::Table {
const FlatSize *scale9Size() const { return GetStruct<const FlatSize *>(24); } const FlatSize *scale9Size() const { return GetStruct<const FlatSize *>(24); }
uint8_t scale9Enabled() const { return GetField<uint8_t>(26, 0); } uint8_t scale9Enabled() const { return GetField<uint8_t>(26, 0); }
uint8_t displaystate() const { return GetField<uint8_t>(28, 1); } uint8_t displaystate() const { return GetField<uint8_t>(28, 1); }
uint8_t outlineEnabled() const { return GetField<uint8_t>(30, 0); }
const Color *outlineColor() const { return GetStruct<const Color *>(32); }
int32_t outlineSize() const { return GetField<int32_t>(34, 1); }
uint8_t shadowEnabled() const { return GetField<uint8_t>(36, 0); }
const Color *shadowColor() const { return GetStruct<const Color *>(38); }
float shadowOffsetX() const { return GetField<float>(40, 2); }
float shadowOffsetY() const { return GetField<float>(42, -2); }
int32_t shadowBlurRadius() const { return GetField<int32_t>(44, 0); }
bool Verify(flatbuffers::Verifier &verifier) const { bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) && return VerifyTableStart(verifier) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 4 /* widgetOptions */) && VerifyField<flatbuffers::uoffset_t>(verifier, 4 /* widgetOptions */) &&
@ -749,6 +757,14 @@ struct ButtonOptions : private flatbuffers::Table {
VerifyField<FlatSize>(verifier, 24 /* scale9Size */) && VerifyField<FlatSize>(verifier, 24 /* scale9Size */) &&
VerifyField<uint8_t>(verifier, 26 /* scale9Enabled */) && VerifyField<uint8_t>(verifier, 26 /* scale9Enabled */) &&
VerifyField<uint8_t>(verifier, 28 /* displaystate */) && VerifyField<uint8_t>(verifier, 28 /* displaystate */) &&
VerifyField<uint8_t>(verifier, 30 /* outlineEnabled */) &&
VerifyField<Color>(verifier, 32 /* outlineColor */) &&
VerifyField<int32_t>(verifier, 34 /* outlineSize */) &&
VerifyField<uint8_t>(verifier, 36 /* shadowEnabled */) &&
VerifyField<Color>(verifier, 38 /* shadowColor */) &&
VerifyField<float>(verifier, 40 /* shadowOffsetX */) &&
VerifyField<float>(verifier, 42 /* shadowOffsetY */) &&
VerifyField<int32_t>(verifier, 44 /* shadowBlurRadius */) &&
verifier.EndTable(); verifier.EndTable();
} }
}; };
@ -769,10 +785,18 @@ struct ButtonOptionsBuilder {
void add_scale9Size(const FlatSize *scale9Size) { fbb_.AddStruct(24, scale9Size); } void add_scale9Size(const FlatSize *scale9Size) { fbb_.AddStruct(24, scale9Size); }
void add_scale9Enabled(uint8_t scale9Enabled) { fbb_.AddElement<uint8_t>(26, scale9Enabled, 0); } void add_scale9Enabled(uint8_t scale9Enabled) { fbb_.AddElement<uint8_t>(26, scale9Enabled, 0); }
void add_displaystate(uint8_t displaystate) { fbb_.AddElement<uint8_t>(28, displaystate, 1); } void add_displaystate(uint8_t displaystate) { fbb_.AddElement<uint8_t>(28, displaystate, 1); }
void add_outlineEnabled(uint8_t outlineEnabled) { fbb_.AddElement<uint8_t>(30, outlineEnabled, 0); }
void add_outlineColor(const Color *outlineColor) { fbb_.AddStruct(32, outlineColor); }
void add_outlineSize(int32_t outlineSize) { fbb_.AddElement<int32_t>(34, outlineSize, 1); }
void add_shadowEnabled(uint8_t shadowEnabled) { fbb_.AddElement<uint8_t>(36, shadowEnabled, 0); }
void add_shadowColor(const Color *shadowColor) { fbb_.AddStruct(38, shadowColor); }
void add_shadowOffsetX(float shadowOffsetX) { fbb_.AddElement<float>(40, shadowOffsetX, 2); }
void add_shadowOffsetY(float shadowOffsetY) { fbb_.AddElement<float>(42, shadowOffsetY, -2); }
void add_shadowBlurRadius(int32_t shadowBlurRadius) { fbb_.AddElement<int32_t>(44, shadowBlurRadius, 0); }
ButtonOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); } ButtonOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
ButtonOptionsBuilder &operator=(const ButtonOptionsBuilder &); ButtonOptionsBuilder &operator=(const ButtonOptionsBuilder &);
flatbuffers::Offset<ButtonOptions> Finish() { flatbuffers::Offset<ButtonOptions> Finish() {
auto o = flatbuffers::Offset<ButtonOptions>(fbb_.EndTable(start_, 13)); auto o = flatbuffers::Offset<ButtonOptions>(fbb_.EndTable(start_, 21));
return o; return o;
} }
}; };
@ -790,8 +814,22 @@ inline flatbuffers::Offset<ButtonOptions> CreateButtonOptions(flatbuffers::FlatB
const CapInsets *capInsets = 0, const CapInsets *capInsets = 0,
const FlatSize *scale9Size = 0, const FlatSize *scale9Size = 0,
uint8_t scale9Enabled = 0, uint8_t scale9Enabled = 0,
uint8_t displaystate = 1) { uint8_t displaystate = 1,
uint8_t outlineEnabled = 0,
const Color *outlineColor = 0,
int32_t outlineSize = 1,
uint8_t shadowEnabled = 0,
const Color *shadowColor = 0,
float shadowOffsetX = 2,
float shadowOffsetY = -2,
int32_t shadowBlurRadius = 0) {
ButtonOptionsBuilder builder_(_fbb); ButtonOptionsBuilder builder_(_fbb);
builder_.add_shadowBlurRadius(shadowBlurRadius);
builder_.add_shadowOffsetY(shadowOffsetY);
builder_.add_shadowOffsetX(shadowOffsetX);
builder_.add_shadowColor(shadowColor);
builder_.add_outlineSize(outlineSize);
builder_.add_outlineColor(outlineColor);
builder_.add_scale9Size(scale9Size); builder_.add_scale9Size(scale9Size);
builder_.add_capInsets(capInsets); builder_.add_capInsets(capInsets);
builder_.add_textColor(textColor); builder_.add_textColor(textColor);
@ -803,6 +841,8 @@ inline flatbuffers::Offset<ButtonOptions> CreateButtonOptions(flatbuffers::FlatB
builder_.add_pressedData(pressedData); builder_.add_pressedData(pressedData);
builder_.add_normalData(normalData); builder_.add_normalData(normalData);
builder_.add_widgetOptions(widgetOptions); builder_.add_widgetOptions(widgetOptions);
builder_.add_shadowEnabled(shadowEnabled);
builder_.add_outlineEnabled(outlineEnabled);
builder_.add_displaystate(displaystate); builder_.add_displaystate(displaystate);
builder_.add_scale9Enabled(scale9Enabled); builder_.add_scale9Enabled(scale9Enabled);
return builder_.Finish(); return builder_.Finish();

View File

@ -274,6 +274,14 @@ namespace cocostudio
std::string fontResourcePlistFile = ""; std::string fontResourcePlistFile = "";
int fontResourceResourceType = 0; int fontResourceResourceType = 0;
bool outlineEnabled = false;
Color4B outlineColor = Color4B::BLACK;
int outlineSize = 1;
bool shadowEnabled = false;
Color4B shadowColor = Color4B::BLACK;
Size shadowOffset = Size(2, -2);
int shadowBlurRadius = 0;
// attributes // attributes
const tinyxml2::XMLAttribute* attribute = objectData->FirstAttribute(); const tinyxml2::XMLAttribute* attribute = objectData->FirstAttribute();
while (attribute) while (attribute)
@ -320,6 +328,30 @@ namespace cocostudio
{ {
displaystate = (value == "True") ? true : false; displaystate = (value == "True") ? true : false;
} }
else if (name == "OutlineEnabled")
{
outlineEnabled = (value == "True") ? true : false;
}
else if (name == "OutlineSize")
{
outlineSize = atoi(value.c_str());
}
else if (name == "ShadowEnabled")
{
shadowEnabled = (value == "True") ? true : false;
}
else if (name == "ShadowOffsetX")
{
shadowOffset.width = atof(value.c_str());
}
else if (name == "ShadowOffsetY")
{
shadowOffset.height = atof(value.c_str());
}
else if (name == "ShadowBlurRadius")
{
shadowBlurRadius = atoi(value.c_str());
}
attribute = attribute->Next(); attribute = attribute->Next();
} }
@ -505,6 +537,64 @@ namespace cocostudio
attribute = attribute->Next(); attribute = attribute->Next();
} }
} }
else if (name == "OutlineColor")
{
attribute = child->FirstAttribute();
while (attribute)
{
name = attribute->Name();
std::string value = attribute->Value();
if (name == "A")
{
outlineColor.a = atoi(value.c_str());
}
else if (name == "R")
{
outlineColor.r = atoi(value.c_str());
}
else if (name == "G")
{
outlineColor.g = atoi(value.c_str());
}
else if (name == "B")
{
outlineColor.b = atoi(value.c_str());
}
attribute = attribute->Next();
}
}
else if (name == "ShadowColor")
{
attribute = child->FirstAttribute();
while (attribute)
{
name = attribute->Name();
std::string value = attribute->Value();
if (name == "A")
{
shadowColor.a = atoi(value.c_str());
}
else if (name == "R")
{
shadowColor.r = atoi(value.c_str());
}
else if (name == "G")
{
shadowColor.g = atoi(value.c_str());
}
else if (name == "B")
{
shadowColor.b = atoi(value.c_str());
}
attribute = attribute->Next();
}
}
child = child->NextSiblingElement(); child = child->NextSiblingElement();
} }
@ -512,6 +602,8 @@ namespace cocostudio
Color f_textColor(255, textColor.r, textColor.g, textColor.b); Color f_textColor(255, textColor.r, textColor.g, textColor.b);
CapInsets f_capInsets(capInsets.origin.x, capInsets.origin.y, capInsets.size.width, capInsets.size.height); CapInsets f_capInsets(capInsets.origin.x, capInsets.origin.y, capInsets.size.width, capInsets.size.height);
FlatSize f_scale9Size(scale9Size.width, scale9Size.height); FlatSize f_scale9Size(scale9Size.width, scale9Size.height);
flatbuffers::Color f_outlineColor(outlineColor.a, outlineColor.r, outlineColor.g, outlineColor.b);
flatbuffers::Color f_shadowColor(shadowColor.a, shadowColor.r, shadowColor.g, shadowColor.b);
auto options = CreateButtonOptions(*builder, auto options = CreateButtonOptions(*builder,
widgetOptions, widgetOptions,
@ -538,8 +630,15 @@ namespace cocostudio
&f_capInsets, &f_capInsets,
&f_scale9Size, &f_scale9Size,
scale9Enabled, scale9Enabled,
displaystate displaystate,
); outlineEnabled,
&f_outlineColor,
outlineSize,
shadowEnabled,
&f_shadowColor,
shadowOffset.width,
shadowOffset.height,
shadowBlurRadius);
return *(Offset<Table>*)(&options); return *(Offset<Table>*)(&options);
} }
@ -786,6 +885,30 @@ namespace cocostudio
button->setBright(displaystate); button->setBright(displaystate);
button->setEnabled(displaystate); button->setEnabled(displaystate);
bool outlineEnabled = options->outlineEnabled();
if (outlineEnabled)
{
auto f_outlineColor = options->outlineColor();
if (f_outlineColor)
{
Color4B outlineColor(f_outlineColor->r(), f_outlineColor->g(), f_outlineColor->b(), f_outlineColor->a());
auto label = button->getTitleRenderer();
label->enableOutline(outlineColor, options->outlineSize());
}
}
bool shadowEnabled = options->shadowEnabled();
if (shadowEnabled)
{
auto f_shadowColor = options->shadowColor();
if (f_shadowColor)
{
Color4B shadowColor(f_shadowColor->r(), f_shadowColor->g(), f_shadowColor->b(), f_shadowColor->a());
auto label = button->getTitleRenderer();
label->enableShadow(shadowColor, Size(options->shadowOffsetX(), options->shadowOffsetY()), options->shadowBlurRadius());
}
}
auto widgetReader = WidgetReader::getInstance(); auto widgetReader = WidgetReader::getInstance();
widgetReader->setPropsWithFlatBuffers(node, (Table*)options->widgetOptions()); widgetReader->setPropsWithFlatBuffers(node, (Table*)options->widgetOptions());

View File

@ -77,7 +77,7 @@ namespace cocostudio
if(!attribute) if(!attribute)
return Vec3::ZERO; return Vec3::ZERO;
Vec3 ret(Vec3::ZERO); Vec3 ret;
std::string attriname; std::string attriname;
while (attribute) while (attribute)
@ -104,15 +104,222 @@ namespace cocostudio
return ret; return ret;
} }
Offset<Table> Node3DReader::createOptionsWithFlatBuffersForNode(const tinyxml2::XMLElement *objectData,
flatbuffers::FlatBufferBuilder *builder)
{
std::string name = "";
long actionTag = 0;
Vec2 rotationSkew = Vec2::ZERO;
int zOrder = 0;
bool visible = true;
GLubyte alpha = 255;
int tag = 0;
Vec2 position = Vec2::ZERO;
Vec2 scale = Vec2(1.0f, 1.0f);
Vec2 anchorPoint = Vec2::ZERO;
Color4B color(255, 255, 255, 255);
Vec2 size = Vec2::ZERO;
bool flipX = false;
bool flipY = false;
bool ignoreSize = false;
bool touchEnabled = false;
std::string frameEvent = "";
std::string customProperty = "";
bool positionXPercentEnabled = false;
bool positionYPercentEnabled = false;
float positionXPercent = 0;
float positionYPercent = 0;
bool sizeXPercentEnable = false;
bool sizeYPercentEnable = false;
float sizeXPercent = 0;
float sizeYPercent = 0;
bool stretchHorizontalEnabled = false;
bool stretchVerticalEnabled = false;
std::string horizontalEdge;
std::string verticalEdge;
float leftMargin = 0;
float rightMargin = 0;
float topMargin = 0;
float bottomMargin = 0;
// attributes
const tinyxml2::XMLAttribute* attribute = objectData->FirstAttribute();
while (attribute)
{
std::string attriname = attribute->Name();
std::string value = attribute->Value();
if (attriname == "Name")
{
name = value;
}
else if (attriname == "ActionTag")
{
actionTag = atol(value.c_str());
}
else if (attriname == "VisibleForFrame")
{
visible = (value == "True") ? true : false;
}
else if (attriname == "Alpha")
{
alpha = atoi(value.c_str());
}
else if (attriname == "Tag")
{
tag = atoi(value.c_str());
}
else if (attriname == "UserData")
{
customProperty = value;
}
else if (attriname == "FrameEvent")
{
frameEvent = value;
}
attribute = attribute->Next();
}
const tinyxml2::XMLElement* child = objectData->FirstChildElement();
while (child)
{
std::string attriname = child->Name();
if (attriname == "Position3D")
{
attribute = child->FirstAttribute();
while (attribute)
{
attriname = attribute->Name();
std::string value = attribute->Value();
if (attriname == "ValueX")
{
position.x = atof(value.c_str());
}
else if (attriname == "ValueY")
{
position.y = atof(value.c_str());
}
attribute = attribute->Next();
}
}
else if (attriname == "Scale3D")
{
attribute = child->FirstAttribute();
while (attribute)
{
attriname = attribute->Name();
std::string value = attribute->Value();
if (attriname == "ValueX")
{
scale.x = atof(value.c_str());
}
else if (attriname == "ValueY")
{
scale.y = atof(value.c_str());
}
attribute = attribute->Next();
}
}
else if (attriname == "CColor")
{
attribute = child->FirstAttribute();
while (attribute)
{
attriname = attribute->Name();
std::string value = attribute->Value();
if (attriname == "A")
{
color.a = atoi(value.c_str());
}
else if (attriname == "R")
{
color.r = atoi(value.c_str());
}
else if (attriname == "G")
{
color.g = atoi(value.c_str());
}
else if (attriname == "B")
{
color.b = atoi(value.c_str());
}
attribute = attribute->Next();
}
}
child = child->NextSiblingElement();
}
RotationSkew f_rotationskew(rotationSkew.x, rotationSkew.y);
Position f_position(position.x, position.y);
Scale f_scale(scale.x, scale.y);
AnchorPoint f_anchortpoint(anchorPoint.x, anchorPoint.y);
Color f_color(color.a, color.r, color.g, color.b);
FlatSize f_size(size.x, size.y);
auto f_layoutComponent = CreateLayoutComponentTable(*builder,
positionXPercentEnabled,
positionYPercentEnabled,
positionXPercent,
positionYPercent,
sizeXPercentEnable,
sizeYPercentEnable,
sizeXPercent,
sizeYPercent,
stretchHorizontalEnabled,
stretchVerticalEnabled,
builder->CreateString(horizontalEdge),
builder->CreateString(verticalEdge),
leftMargin,
rightMargin,
topMargin,
bottomMargin);
auto options = CreateWidgetOptions(*builder,
builder->CreateString(name),
(int)actionTag,
&f_rotationskew,
zOrder,
visible,
alpha,
tag,
&f_position,
&f_scale,
&f_anchortpoint,
&f_color,
&f_size,
flipX,
flipY,
ignoreSize,
touchEnabled,
builder->CreateString(frameEvent),
builder->CreateString(customProperty),
0,
0,
f_layoutComponent);
return *(Offset<Table>*)(&options);
}
Offset<Table> Node3DReader::createOptionsWithFlatBuffers(const tinyxml2::XMLElement *objectData, Offset<Table> Node3DReader::createOptionsWithFlatBuffers(const tinyxml2::XMLElement *objectData,
flatbuffers::FlatBufferBuilder *builder) flatbuffers::FlatBufferBuilder *builder)
{ {
auto temp = NodeReader::getInstance()->createOptionsWithFlatBuffers(objectData, builder); auto temp = createOptionsWithFlatBuffersForNode(objectData, builder);
auto nodeOptions = *(Offset<WidgetOptions>*)(&temp); auto nodeOptions = *(Offset<WidgetOptions>*)(&temp);
Vec3 position(Vec3::ZERO); Vec3 position;
Vec3 rotation(Vec3::ZERO); Vec3 rotation;
Vec3 scale(Vec3::ZERO); Vec3 scale;
int cameraMask = 0; int cameraMask = 0;
std::string attriname; std::string attriname;

View File

@ -56,7 +56,8 @@ namespace cocostudio
cocos2d::Node* createNodeWithFlatBuffers(const flatbuffers::Table* node3DOptions); cocos2d::Node* createNodeWithFlatBuffers(const flatbuffers::Table* node3DOptions);
protected: protected:
flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffersForNode(const tinyxml2::XMLElement* objectData,
flatbuffers::FlatBufferBuilder* builder);
cocos2d::Vec3 getVec3Attribute(const tinyxml2::XMLAttribute* attribute) const; cocos2d::Vec3 getVec3Attribute(const tinyxml2::XMLAttribute* attribute) const;
}; };
} }

View File

@ -454,7 +454,7 @@ namespace cocostudio
auto f_outlineColor = options->outlineColor(); auto f_outlineColor = options->outlineColor();
if (f_outlineColor) if (f_outlineColor)
{ {
Color4B outlineColor(f_outlineColor->a(), f_outlineColor->r(), f_outlineColor->g(), f_outlineColor->b()); Color4B outlineColor(f_outlineColor->r(), f_outlineColor->g(), f_outlineColor->b(), f_outlineColor->a());
label->enableOutline(outlineColor, options->outlineSize()); label->enableOutline(outlineColor, options->outlineSize());
} }
} }
@ -465,7 +465,7 @@ namespace cocostudio
auto f_shadowColor = options->shadowColor(); auto f_shadowColor = options->shadowColor();
if (f_shadowColor) if (f_shadowColor)
{ {
Color4B shadowColor(f_shadowColor->a(), f_shadowColor->r(), f_shadowColor->g(), f_shadowColor->b()); Color4B shadowColor(f_shadowColor->r(), f_shadowColor->g(), f_shadowColor->b(), f_shadowColor->a());
label->enableShadow(shadowColor, Size(options->shadowOffsetX(), options->shadowOffsetY()), options->shadowBlurRadius()); label->enableShadow(shadowColor, Size(options->shadowOffsetX(), options->shadowOffsetY()), options->shadowBlurRadius());
} }
} }

View File

@ -31,7 +31,7 @@ THE SOFTWARE.
#include "renderer/CCTexture2D.h" #include "renderer/CCTexture2D.h"
#if defined(CC_USE_WIC) #if defined(CC_USE_WIC)
#include "WICImageLoader-win.h" #include "WICImageLoader-winrt.h"
#endif #endif
// premultiply alpha, or the effect will wrong when want to use other pixel format in Texture2D, // premultiply alpha, or the effect will wrong when want to use other pixel format in Texture2D,

View File

@ -73,7 +73,7 @@ int Application::run()
// Initialize instance and cocos2d. // Initialize instance and cocos2d.
if (!applicationDidFinishLaunching()) if (!applicationDidFinishLaunching())
{ {
return 0; return 1;
} }
auto director = Director::getInstance(); auto director = Director::getInstance();
@ -106,7 +106,7 @@ int Application::run()
director = nullptr; director = nullptr;
} }
glview->release(); glview->release();
return true; return 0;
} }
void Application::setAnimationInterval(double interval) void Application::setAnimationInterval(double interval)

View File

@ -84,6 +84,11 @@ void Cocos2dRenderer::Pause()
} }
} }
bool Cocos2dRenderer::AppShouldExit()
{
return GLViewImpl::sharedOpenGLView()->AppShouldExit();
}
void Cocos2dRenderer::DeviceLost() void Cocos2dRenderer::DeviceLost()
{ {
Pause(); Pause();
@ -137,4 +142,9 @@ void Cocos2dRenderer::QueuePointerEvent(cocos2d::PointerEventType type, Windows:
GLViewImpl::sharedOpenGLView()->QueuePointerEvent(type, args); GLViewImpl::sharedOpenGLView()->QueuePointerEvent(type, args);
} }
void Cocos2dRenderer::QueueBackButtonEvent()
{
GLViewImpl::sharedOpenGLView()->QueueBackKeyPress();
}

View File

@ -35,10 +35,12 @@ namespace cocos2d
~Cocos2dRenderer(); ~Cocos2dRenderer();
void Draw(GLsizei width, GLsizei height, float dpi, Windows::Graphics::Display::DisplayOrientations orientation); void Draw(GLsizei width, GLsizei height, float dpi, Windows::Graphics::Display::DisplayOrientations orientation);
void QueuePointerEvent(PointerEventType type, Windows::UI::Core::PointerEventArgs^ args); void QueuePointerEvent(PointerEventType type, Windows::UI::Core::PointerEventArgs^ args);
void QueueBackButtonEvent();
void Pause(); void Pause();
void Resume(); void Resume();
void DeviceLost(); void DeviceLost();
bool AppShouldExit();
private: private:
int m_width; int m_width;

View File

@ -169,16 +169,23 @@ void OpenGLESPage::OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Wi
} }
#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) #if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
/*
We set args->Handled = true to prevent the app from quitting when the back button is pressed.
This is because this back button event happens on the XAML UI thread and not the cocos2d-x UI thread.
We need to give the game developer a chance to decide to exit the app depending on where they
are in their game. They can receive the back button event by listening for the
EventKeyboard::KeyCode::KEY_ESCAPE event.
The default behavior is to exit the app if the EventKeyboard::KeyCode::KEY_ESCAPE event
is not handled by the game.
*/
void OpenGLESPage::OnBackButtonPressed(Object^ sender, BackPressedEventArgs^ args) void OpenGLESPage::OnBackButtonPressed(Object^ sender, BackPressedEventArgs^ args)
{ {
bool myAppCanNavigate = false; if (m_renderer)
if (myAppCanNavigate)
{ {
m_renderer->QueueBackButtonEvent();
args->Handled = true; args->Handled = true;
} }
else {
// Do nothing. Leave args->Handled set to the current value, false.
}
} }
#endif #endif
@ -250,6 +257,15 @@ void OpenGLESPage::RecoverFromLostDevice()
StartRenderLoop(); StartRenderLoop();
} }
void OpenGLESPage::TerminateApp()
{
{
critical_section::scoped_lock lock(mRenderSurfaceCriticalSection);
DestroyRenderSurface();
}
Windows::UI::Xaml::Application::Current->Exit();
}
void OpenGLESPage::StartRenderLoop() void OpenGLESPage::StartRenderLoop()
{ {
// If the render loop is already running then do not start another thread. // If the render loop is already running then do not start another thread.
@ -273,8 +289,6 @@ void OpenGLESPage::StartRenderLoop()
GLsizei panelWidth = 0; GLsizei panelWidth = 0;
GLsizei panelHeight = 0; GLsizei panelHeight = 0;
GetSwapChainPanelSize(&panelWidth, &panelHeight); GetSwapChainPanelSize(&panelWidth, &panelHeight);
if (m_renderer.get() == nullptr) if (m_renderer.get() == nullptr)
{ {
@ -316,6 +330,17 @@ void OpenGLESPage::StartRenderLoop()
return; return;
} }
// run on main UI thread
if (m_renderer->AppShouldExit())
{
swapChainPanel->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, ref new DispatchedHandler([this]()
{
TerminateApp();
}));
return;
}
} }
if (m_renderer) if (m_renderer)

View File

@ -46,6 +46,7 @@ namespace cocos2d
void CreateRenderSurface(); void CreateRenderSurface();
void DestroyRenderSurface(); void DestroyRenderSurface();
void RecoverFromLostDevice(); void RecoverFromLostDevice();
void TerminateApp();
void StartRenderLoop(); void StartRenderLoop();
void StopRenderLoop(); void StopRenderLoop();

View File

@ -81,9 +81,14 @@ GLViewImpl::GLViewImpl()
, m_width(0) , m_width(0)
, m_height(0) , m_height(0)
, m_orientation(DisplayOrientations::Landscape) , m_orientation(DisplayOrientations::Landscape)
, m_appShouldExit(false)
{ {
s_pEglView = this; s_pEglView = this;
_viewName = "cocos2dx"; _viewName = "cocos2dx";
m_backButtonListener = EventListenerKeyboard::create();
m_backButtonListener->onKeyReleased = CC_CALLBACK_2(GLViewImpl::BackButtonListener, this);
Director::getInstance()->getEventDispatcher()->addEventListenerWithFixedPriority(m_backButtonListener, INT_MAX);
} }
GLViewImpl::~GLViewImpl() GLViewImpl::~GLViewImpl()
@ -188,6 +193,7 @@ bool GLViewImpl::isOpenGLReady()
void GLViewImpl::end() void GLViewImpl::end()
{ {
m_windowClosed = true; m_windowClosed = true;
m_appShouldExit = true;
} }
@ -202,13 +208,51 @@ void GLViewImpl::OnResuming(Platform::Object^ sender, Platform::Object^ args)
// user pressed the Back Key on the phone // user pressed the Back Key on the phone
void GLViewImpl::OnBackKeyPress() void GLViewImpl::OnBackKeyPress()
{ {
std::string str; cocos2d::EventKeyboard::KeyCode cocos2dKey = EventKeyboard::KeyCode::KEY_ESCAPE;
if(m_delegate) cocos2d::EventKeyboard event(cocos2dKey, false);
cocos2d::Director::getInstance()->getEventDispatcher()->dispatchEvent(&event);
}
void GLViewImpl::BackButtonListener(EventKeyboard::KeyCode keyCode, Event* event)
{
CCLOG("*********************************************************************");
CCLOG("GLViewImpl::BackButtonListener: Exiting application!");
CCLOG("");
CCLOG("If you want to listen for Windows Phone back button events,");
CCLOG("add a listener for EventKeyboard::KeyCode::KEY_ESCAPE");
CCLOG("Make sure you call stopPropagation() on the Event if you don't");
CCLOG("want your app to exit when the back button is pressed.");
CCLOG("");
CCLOG("For example, add the following to your scene...");
CCLOG("auto listener = EventListenerKeyboard::create();");
CCLOG("listener->onKeyReleased = CC_CALLBACK_2(HelloWorld::onKeyReleased, this);");
CCLOG("getEventDispatcher()->addEventListenerWithFixedPriority(listener, 1);");
CCLOG("");
CCLOG("void HelloWorld::onKeyReleased(EventKeyboard::KeyCode keyCode, Event* event)");
CCLOG("{");
CCLOG(" if (keyCode == EventKeyboard::KeyCode::KEY_ESCAPE)");
CCLOG(" {");
CCLOG(" if (myAppShouldNotQuit) // or whatever logic you want...");
CCLOG(" {");
CCLOG(" event->stopPropagation();");
CCLOG(" }");
CCLOG(" }");
CCLOG("}");
CCLOG("");
CCLOG("You MUST call event->stopPropagation() if you don't want your app to quit!");
CCLOG("*********************************************************************");
if (keyCode == EventKeyboard::KeyCode::KEY_ESCAPE)
{ {
//m_delegate->Invoke(Cocos2dEvent::TerminateApp, stringToPlatformString(str)); Director::getInstance()->end();
} }
} }
bool GLViewImpl::AppShouldExit()
{
return m_appShouldExit;
}
void GLViewImpl::OnPointerPressed(CoreWindow^ sender, PointerEventArgs^ args) void GLViewImpl::OnPointerPressed(CoreWindow^ sender, PointerEventArgs^ args)
{ {
OnPointerPressed(args); OnPointerPressed(args);
@ -221,7 +265,6 @@ void GLViewImpl::OnPointerPressed(PointerEventArgs^ args)
handleTouchesBegin(1, &id, &pt.x, &pt.y); handleTouchesBegin(1, &id, &pt.x, &pt.y);
} }
void GLViewImpl::OnPointerWheelChanged(CoreWindow^ sender, PointerEventArgs^ args) void GLViewImpl::OnPointerWheelChanged(CoreWindow^ sender, PointerEventArgs^ args)
{ {
float direction = (float)args->CurrentPoint->Properties->MouseWheelDelta; float direction = (float)args->CurrentPoint->Properties->MouseWheelDelta;

View File

@ -81,6 +81,8 @@ public:
void OnResuming(Platform::Object^ sender, Platform::Object^ args); void OnResuming(Platform::Object^ sender, Platform::Object^ args);
void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ args); void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ args);
void OnBackKeyPress(); void OnBackKeyPress();
bool AppShouldExit();
void BackButtonListener(cocos2d::EventKeyboard::KeyCode keyCode, cocos2d::Event* event);
void QueueBackKeyPress(); void QueueBackKeyPress();
void QueuePointerEvent(PointerEventType type, Windows::UI::Core::PointerEventArgs^ args); void QueuePointerEvent(PointerEventType type, Windows::UI::Core::PointerEventArgs^ args);
@ -155,6 +157,7 @@ private:
bool m_running; bool m_running;
bool m_initialized; bool m_initialized;
bool m_appShouldExit;
Cocos2dEventDelegate^ m_delegate; Cocos2dEventDelegate^ m_delegate;
Cocos2dMessageBoxDelegate^ m_messageBoxDelegate; Cocos2dMessageBoxDelegate^ m_messageBoxDelegate;
@ -165,6 +168,9 @@ private:
Platform::Agile<Windows::UI::Core::CoreDispatcher> m_dispatcher; Platform::Agile<Windows::UI::Core::CoreDispatcher> m_dispatcher;
Platform::Agile<Windows::UI::Xaml::Controls::Panel> m_panel; Platform::Agile<Windows::UI::Xaml::Controls::Panel> m_panel;
KeyBoardWinRT^ m_keyboard; KeyBoardWinRT^ m_keyboard;
cocos2d::EventListenerKeyboard* m_backButtonListener;
}; };
NS_CC_END NS_CC_END

View File

@ -24,7 +24,7 @@ THE SOFTWARE.
Based upon code from the DirectX Tool Kit by Microsoft Corporation, Based upon code from the DirectX Tool Kit by Microsoft Corporation,
obtained from https://directxtk.codeplex.com obtained from https://directxtk.codeplex.com
****************************************************************************/ ****************************************************************************/
#include "WICImageLoader-win.h" #include "WICImageLoader-winrt.h"
NS_CC_BEGIN NS_CC_BEGIN
@ -53,8 +53,8 @@ static WICConvert g_WICConvert[] =
{ GUID_WICPixelFormat32bppBGR101010, GUID_WICPixelFormat32bppRGBA1010102 }, // DXGI_FORMAT_R10G10B10A2_UNORM { GUID_WICPixelFormat32bppBGR101010, GUID_WICPixelFormat32bppRGBA1010102 }, // DXGI_FORMAT_R10G10B10A2_UNORM
{ GUID_WICPixelFormat24bppBGR, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM { GUID_WICPixelFormat24bppBGR, GUID_WICPixelFormat24bppRGB }, // DXGI_FORMAT_R8G8B8A8_UNORM
{ GUID_WICPixelFormat24bppRGB, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM { GUID_WICPixelFormat24bppRGB, GUID_WICPixelFormat24bppRGB }, // DXGI_FORMAT_R8G8B8A8_UNORM
{ GUID_WICPixelFormat32bppPBGRA, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM { GUID_WICPixelFormat32bppPBGRA, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM
{ GUID_WICPixelFormat32bppPRGBA, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM { GUID_WICPixelFormat32bppPRGBA, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM

View File

@ -6,7 +6,7 @@ Copyright 2012 cocos2d-x.org
Copyright 2013-2014 Chukong Technologies Inc. Copyright 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
@ -58,7 +58,7 @@ const char* GLProgram::SHADER_NAME_POSITION_TEXTURE_U_COLOR = "ShaderPositionTex
const char* GLProgram::SHADER_NAME_POSITION_TEXTURE_A8_COLOR = "ShaderPositionTextureA8Color"; const char* GLProgram::SHADER_NAME_POSITION_TEXTURE_A8_COLOR = "ShaderPositionTextureA8Color";
const char* GLProgram::SHADER_NAME_POSITION_U_COLOR = "ShaderPosition_uColor"; const char* GLProgram::SHADER_NAME_POSITION_U_COLOR = "ShaderPosition_uColor";
const char* GLProgram::SHADER_NAME_POSITION_LENGTH_TEXTURE_COLOR = "ShaderPositionLengthTextureColor"; const char* GLProgram::SHADER_NAME_POSITION_LENGTH_TEXTURE_COLOR = "ShaderPositionLengthTextureColor";
const char* GLProgram::SHADER_NAME_POSITION_GRAYSCALE = "ShaderUIGrayScale";
const char* GLProgram::SHADER_NAME_LABEL_DISTANCEFIELD_NORMAL = "ShaderLabelDFNormal"; const char* GLProgram::SHADER_NAME_LABEL_DISTANCEFIELD_NORMAL = "ShaderLabelDFNormal";
const char* GLProgram::SHADER_NAME_LABEL_DISTANCEFIELD_GLOW = "ShaderLabelDFGlow"; const char* GLProgram::SHADER_NAME_LABEL_DISTANCEFIELD_GLOW = "ShaderLabelDFGlow";
const char* GLProgram::SHADER_NAME_LABEL_NORMAL = "ShaderLabelNormal"; const char* GLProgram::SHADER_NAME_LABEL_NORMAL = "ShaderLabelNormal";
@ -150,15 +150,15 @@ GLProgram::~GLProgram()
{ {
glDeleteShader(_vertShader); glDeleteShader(_vertShader);
} }
if (_fragShader) if (_fragShader)
{ {
glDeleteShader(_fragShader); glDeleteShader(_fragShader);
} }
_vertShader = _fragShader = 0; _vertShader = _fragShader = 0;
if (_program) if (_program)
{ {
GL::deleteProgram(_program); GL::deleteProgram(_program);
} }
@ -218,9 +218,9 @@ bool GLProgram::initWithByteArrays(const GLchar* vShaderByteArray, const GLchar*
{ {
glAttachShader(_program, _fragShader); glAttachShader(_program, _fragShader);
} }
_hashForUniforms.clear(); _hashForUniforms.clear();
CHECK_GL_ERROR_DEBUG(); CHECK_GL_ERROR_DEBUG();
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || defined(WP8_SHADER_COMPILER) #if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || defined(WP8_SHADER_COMPILER)
@ -259,7 +259,7 @@ bool GLProgram::initWithPrecompiledProgramByteArray(const GLchar* vShaderByteArr
CHECK_GL_ERROR_DEBUG(); CHECK_GL_ERROR_DEBUG();
_hashForUniforms.clear(); _hashForUniforms.clear();
CHECK_GL_ERROR_DEBUG(); CHECK_GL_ERROR_DEBUG();
return haveProgram; return haveProgram;
} }
@ -373,13 +373,13 @@ void GLProgram::parseUniforms()
} }
uniform.name = std::string(uniformName); uniform.name = std::string(uniformName);
uniform.location = glGetUniformLocation(_program, uniformName); uniform.location = glGetUniformLocation(_program, uniformName);
GLenum __gl_error_code = glGetError(); GLenum __gl_error_code = glGetError();
if (__gl_error_code != GL_NO_ERROR) if (__gl_error_code != GL_NO_ERROR)
{ {
CCLOG("error: 0x%x", (int)__gl_error_code); CCLOG("error: 0x%x", (int)__gl_error_code);
} }
assert(__gl_error_code == GL_NO_ERROR); assert(__gl_error_code == GL_NO_ERROR);
_userUniforms[uniform.name] = uniform; _userUniforms[uniform.name] = uniform;
} }
} }
@ -422,12 +422,12 @@ std::string GLProgram::getDescription() const
bool GLProgram::compileShader(GLuint * shader, GLenum type, const GLchar* source) bool GLProgram::compileShader(GLuint * shader, GLenum type, const GLchar* source)
{ {
GLint status; GLint status;
if (!source) if (!source)
{ {
return false; return false;
} }
const GLchar *sources[] = { const GLchar *sources[] = {
#if CC_TARGET_PLATFORM == CC_PLATFORM_WINRT #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"), (type == GL_VERTEX_SHADER ? "precision mediump float;\n precision mediump int;\n" : "precision mediump float;\n precision mediump int;\n"),
@ -461,10 +461,10 @@ bool GLProgram::compileShader(GLuint * shader, GLenum type, const GLchar* source
GLsizei length; GLsizei length;
glGetShaderiv(*shader, GL_SHADER_SOURCE_LENGTH, &length); glGetShaderiv(*shader, GL_SHADER_SOURCE_LENGTH, &length);
GLchar* src = (GLchar *)malloc(sizeof(GLchar) * length); GLchar* src = (GLchar *)malloc(sizeof(GLchar) * length);
glGetShaderSource(*shader, length, nullptr, src); glGetShaderSource(*shader, length, nullptr, src);
CCLOG("cocos2d: ERROR: Failed to compile shader:\n%s", src); CCLOG("cocos2d: ERROR: Failed to compile shader:\n%s", src);
if (type == GL_VERTEX_SHADER) if (type == GL_VERTEX_SHADER)
{ {
CCLOG("cocos2d: %s", getVertexShaderLog().c_str()); CCLOG("cocos2d: %s", getVertexShaderLog().c_str());
@ -502,7 +502,7 @@ void GLProgram::updateUniforms()
_builtInUniforms[UNIFORM_MV_MATRIX] = glGetUniformLocation(_program, UNIFORM_NAME_MV_MATRIX); _builtInUniforms[UNIFORM_MV_MATRIX] = glGetUniformLocation(_program, UNIFORM_NAME_MV_MATRIX);
_builtInUniforms[UNIFORM_MVP_MATRIX] = glGetUniformLocation(_program, UNIFORM_NAME_MVP_MATRIX); _builtInUniforms[UNIFORM_MVP_MATRIX] = glGetUniformLocation(_program, UNIFORM_NAME_MVP_MATRIX);
_builtInUniforms[UNIFORM_NORMAL_MATRIX] = glGetUniformLocation(_program, UNIFORM_NAME_NORMAL_MATRIX); _builtInUniforms[UNIFORM_NORMAL_MATRIX] = glGetUniformLocation(_program, UNIFORM_NAME_NORMAL_MATRIX);
_builtInUniforms[UNIFORM_TIME] = glGetUniformLocation(_program, UNIFORM_NAME_TIME); _builtInUniforms[UNIFORM_TIME] = glGetUniformLocation(_program, UNIFORM_NAME_TIME);
_builtInUniforms[UNIFORM_SIN_TIME] = glGetUniformLocation(_program, UNIFORM_NAME_SIN_TIME); _builtInUniforms[UNIFORM_SIN_TIME] = glGetUniformLocation(_program, UNIFORM_NAME_SIN_TIME);
_builtInUniforms[UNIFORM_COS_TIME] = glGetUniformLocation(_program, UNIFORM_NAME_COS_TIME); _builtInUniforms[UNIFORM_COS_TIME] = glGetUniformLocation(_program, UNIFORM_NAME_COS_TIME);
@ -526,7 +526,7 @@ void GLProgram::updateUniforms()
_flags.usesRandom = _builtInUniforms[UNIFORM_RANDOM01] != -1; _flags.usesRandom = _builtInUniforms[UNIFORM_RANDOM01] != -1;
this->use(); this->use();
// Since sample most probably won't change, set it to 0,1,2,3 now. // Since sample most probably won't change, set it to 0,1,2,3 now.
if(_builtInUniforms[UNIFORM_SAMPLER0] != -1) if(_builtInUniforms[UNIFORM_SAMPLER0] != -1)
setUniformLocationWith1i(_builtInUniforms[UNIFORM_SAMPLER0], 0); setUniformLocationWith1i(_builtInUniforms[UNIFORM_SAMPLER0], 0);
@ -567,17 +567,17 @@ bool GLProgram::link()
{ {
glDeleteShader(_vertShader); glDeleteShader(_vertShader);
} }
if (_fragShader) if (_fragShader)
{ {
glDeleteShader(_fragShader); glDeleteShader(_fragShader);
} }
_vertShader = _fragShader = 0; _vertShader = _fragShader = 0;
#if DEBUG || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) #if DEBUG || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
glGetProgramiv(_program, GL_LINK_STATUS, &status); glGetProgramiv(_program, GL_LINK_STATUS, &status);
if (status == GL_FALSE) if (status == GL_FALSE)
{ {
CCLOG("cocos2d: ERROR: Failed to link program: %i", _program); CCLOG("cocos2d: ERROR: Failed to link program: %i", _program);
@ -662,7 +662,7 @@ bool GLProgram::updateUniformLocation(GLint location, const GLvoid* data, unsign
} }
bool updated = true; bool updated = true;
auto element = _hashForUniforms.find(location); auto element = _hashForUniforms.find(location);
if (element == _hashForUniforms.end()) if (element == _hashForUniforms.end())
{ {
@ -696,14 +696,14 @@ GLint GLProgram::getUniformLocationForName(const char* name) const
{ {
CCASSERT(name != nullptr, "Invalid uniform name" ); CCASSERT(name != nullptr, "Invalid uniform name" );
CCASSERT(_program != 0, "Invalid operation. Cannot get uniform location when program is not initialized"); CCASSERT(_program != 0, "Invalid operation. Cannot get uniform location when program is not initialized");
return glGetUniformLocation(_program, name); return glGetUniformLocation(_program, name);
} }
void GLProgram::setUniformLocationWith1i(GLint location, GLint i1) void GLProgram::setUniformLocationWith1i(GLint location, GLint i1)
{ {
bool updated = updateUniformLocation(location, &i1, sizeof(i1)*1); bool updated = updateUniformLocation(location, &i1, sizeof(i1)*1);
if( updated ) if( updated )
{ {
glUniform1i( (GLint)location, i1); glUniform1i( (GLint)location, i1);
@ -714,7 +714,7 @@ void GLProgram::setUniformLocationWith2i(GLint location, GLint i1, GLint i2)
{ {
GLint ints[2] = {i1,i2}; GLint ints[2] = {i1,i2};
bool updated = updateUniformLocation(location, ints, sizeof(ints)); bool updated = updateUniformLocation(location, ints, sizeof(ints));
if( updated ) if( updated )
{ {
glUniform2i( (GLint)location, i1, i2); glUniform2i( (GLint)location, i1, i2);
@ -725,7 +725,7 @@ void GLProgram::setUniformLocationWith3i(GLint location, GLint i1, GLint i2, GLi
{ {
GLint ints[3] = {i1,i2,i3}; GLint ints[3] = {i1,i2,i3};
bool updated = updateUniformLocation(location, ints, sizeof(ints)); bool updated = updateUniformLocation(location, ints, sizeof(ints));
if( updated ) if( updated )
{ {
glUniform3i( (GLint)location, i1, i2, i3); glUniform3i( (GLint)location, i1, i2, i3);
@ -736,7 +736,7 @@ void GLProgram::setUniformLocationWith4i(GLint location, GLint i1, GLint i2, GLi
{ {
GLint ints[4] = {i1,i2,i3,i4}; GLint ints[4] = {i1,i2,i3,i4};
bool updated = updateUniformLocation(location, ints, sizeof(ints)); bool updated = updateUniformLocation(location, ints, sizeof(ints));
if( updated ) if( updated )
{ {
glUniform4i( (GLint)location, i1, i2, i3, i4); glUniform4i( (GLint)location, i1, i2, i3, i4);
@ -746,7 +746,7 @@ void GLProgram::setUniformLocationWith4i(GLint location, GLint i1, GLint i2, GLi
void GLProgram::setUniformLocationWith2iv(GLint location, GLint* ints, unsigned int numberOfArrays) void GLProgram::setUniformLocationWith2iv(GLint location, GLint* ints, unsigned int numberOfArrays)
{ {
bool updated = updateUniformLocation(location, ints, sizeof(int)*2*numberOfArrays); bool updated = updateUniformLocation(location, ints, sizeof(int)*2*numberOfArrays);
if( updated ) if( updated )
{ {
glUniform2iv( (GLint)location, (GLsizei)numberOfArrays, ints ); glUniform2iv( (GLint)location, (GLsizei)numberOfArrays, ints );
@ -756,7 +756,7 @@ void GLProgram::setUniformLocationWith2iv(GLint location, GLint* ints, unsigned
void GLProgram::setUniformLocationWith3iv(GLint location, GLint* ints, unsigned int numberOfArrays) void GLProgram::setUniformLocationWith3iv(GLint location, GLint* ints, unsigned int numberOfArrays)
{ {
bool updated = updateUniformLocation(location, ints, sizeof(int)*3*numberOfArrays); bool updated = updateUniformLocation(location, ints, sizeof(int)*3*numberOfArrays);
if( updated ) if( updated )
{ {
glUniform3iv( (GLint)location, (GLsizei)numberOfArrays, ints ); glUniform3iv( (GLint)location, (GLsizei)numberOfArrays, ints );
@ -766,7 +766,7 @@ void GLProgram::setUniformLocationWith3iv(GLint location, GLint* ints, unsigned
void GLProgram::setUniformLocationWith4iv(GLint location, GLint* ints, unsigned int numberOfArrays) void GLProgram::setUniformLocationWith4iv(GLint location, GLint* ints, unsigned int numberOfArrays)
{ {
bool updated = updateUniformLocation(location, ints, sizeof(int)*4*numberOfArrays); bool updated = updateUniformLocation(location, ints, sizeof(int)*4*numberOfArrays);
if( updated ) if( updated )
{ {
glUniform4iv( (GLint)location, (GLsizei)numberOfArrays, ints ); glUniform4iv( (GLint)location, (GLsizei)numberOfArrays, ints );
@ -859,7 +859,7 @@ void GLProgram::setUniformLocationWith4fv(GLint location, const GLfloat* floats,
void GLProgram::setUniformLocationWithMatrix2fv(GLint location, const GLfloat* matrixArray, unsigned int numberOfMatrices) { void GLProgram::setUniformLocationWithMatrix2fv(GLint location, const GLfloat* matrixArray, unsigned int numberOfMatrices) {
bool updated = updateUniformLocation(location, matrixArray, sizeof(float)*4*numberOfMatrices); bool updated = updateUniformLocation(location, matrixArray, sizeof(float)*4*numberOfMatrices);
if( updated ) if( updated )
{ {
glUniformMatrix2fv( (GLint)location, (GLsizei)numberOfMatrices, GL_FALSE, matrixArray); glUniformMatrix2fv( (GLint)location, (GLsizei)numberOfMatrices, GL_FALSE, matrixArray);
@ -868,7 +868,7 @@ void GLProgram::setUniformLocationWithMatrix2fv(GLint location, const GLfloat* m
void GLProgram::setUniformLocationWithMatrix3fv(GLint location, const GLfloat* matrixArray, unsigned int numberOfMatrices) { void GLProgram::setUniformLocationWithMatrix3fv(GLint location, const GLfloat* matrixArray, unsigned int numberOfMatrices) {
bool updated = updateUniformLocation(location, matrixArray, sizeof(float)*9*numberOfMatrices); bool updated = updateUniformLocation(location, matrixArray, sizeof(float)*9*numberOfMatrices);
if( updated ) if( updated )
{ {
glUniformMatrix3fv( (GLint)location, (GLsizei)numberOfMatrices, GL_FALSE, matrixArray); glUniformMatrix3fv( (GLint)location, (GLsizei)numberOfMatrices, GL_FALSE, matrixArray);
@ -924,12 +924,12 @@ void GLProgram::setUniformsForBuiltins(const Mat4 &matrixMV)
// Cocos2D doesn't store a high precision time value, so this will have to do. // Cocos2D doesn't store a high precision time value, so this will have to do.
// Getting Mach time per frame per shader using time could be extremely expensive. // Getting Mach time per frame per shader using time could be extremely expensive.
float time = _director->getTotalFrames() * _director->getAnimationInterval(); float time = _director->getTotalFrames() * _director->getAnimationInterval();
setUniformLocationWith4f(_builtInUniforms[GLProgram::UNIFORM_TIME], time/10.0, time, time*2, time*4); setUniformLocationWith4f(_builtInUniforms[GLProgram::UNIFORM_TIME], time/10.0, time, time*2, time*4);
setUniformLocationWith4f(_builtInUniforms[GLProgram::UNIFORM_SIN_TIME], time/8.0, time/4.0, time/2.0, sinf(time)); setUniformLocationWith4f(_builtInUniforms[GLProgram::UNIFORM_SIN_TIME], time/8.0, time/4.0, time/2.0, sinf(time));
setUniformLocationWith4f(_builtInUniforms[GLProgram::UNIFORM_COS_TIME], time/8.0, time/4.0, time/2.0, cosf(time)); setUniformLocationWith4f(_builtInUniforms[GLProgram::UNIFORM_COS_TIME], time/8.0, time/4.0, time/2.0, cosf(time));
} }
if(_flags.usesRandom) if(_flags.usesRandom)
setUniformLocationWith4f(_builtInUniforms[GLProgram::UNIFORM_RANDOM01], CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1()); setUniformLocationWith4f(_builtInUniforms[GLProgram::UNIFORM_RANDOM01], CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1());
} }
@ -938,7 +938,7 @@ void GLProgram::reset()
{ {
_vertShader = _fragShader = 0; _vertShader = _fragShader = 0;
memset(_builtInUniforms, 0, sizeof(_builtInUniforms)); memset(_builtInUniforms, 0, sizeof(_builtInUniforms));
// it is already deallocated by android // it is already deallocated by android
//GL::deleteProgram(_program); //GL::deleteProgram(_program);
@ -948,7 +948,7 @@ void GLProgram::reset()
{ {
free(e.second.first); free(e.second.first);
} }
_hashForUniforms.clear(); _hashForUniforms.clear();
} }

View File

@ -4,10 +4,10 @@ Copyright 2012 Goffredo Marocchi
Copyright 2012 Ricardo Quesada Copyright 2012 Ricardo Quesada
Copyright 2012 cocos2d-x.org Copyright 2012 cocos2d-x.org
Copyright 2013-2014 Chukong Technologies Inc. Copyright 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
@ -78,8 +78,8 @@ struct Uniform
/** GLProgram /** GLProgram
Class that implements a glProgram Class that implements a glProgram
@since v2.0.0 @since v2.0.0
*/ */
class CC_DLL GLProgram : public Ref class CC_DLL GLProgram : public Ref
@ -113,7 +113,7 @@ public:
// backward compatibility // backward compatibility
VERTEX_ATTRIB_TEX_COORDS = VERTEX_ATTRIB_TEX_COORD, VERTEX_ATTRIB_TEX_COORDS = VERTEX_ATTRIB_TEX_COORD,
}; };
/**Preallocated uniform handle.*/ /**Preallocated uniform handle.*/
enum enum
{ {
@ -179,6 +179,9 @@ public:
static const char* SHADER_NAME_POSITION_U_COLOR; static const char* SHADER_NAME_POSITION_U_COLOR;
/**Built in shader for draw a sector with 90 degrees with center at bottom left point.*/ /**Built in shader for draw a sector with 90 degrees with center at bottom left point.*/
static const char* SHADER_NAME_POSITION_LENGTH_TEXTURE_COLOR; static const char* SHADER_NAME_POSITION_LENGTH_TEXTURE_COLOR;
/**Built in shader for ui effects */
static const char* SHADER_NAME_POSITION_GRAYSCALE;
/** @{ /** @{
Built in shader for label and label with effects. Built in shader for label and label with effects.
*/ */
@ -192,7 +195,7 @@ public:
/**Built in shader used for 3D, support Position and Texture vertex attribute, with color specified by a uniform.*/ /**Built in shader used for 3D, support Position and Texture vertex attribute, with color specified by a uniform.*/
static const char* SHADER_3D_POSITION_TEXTURE; static const char* SHADER_3D_POSITION_TEXTURE;
/** /**
Built in shader used for 3D, support Position (Skeletal animation by hardware skin) and Texture vertex attribute, Built in shader used for 3D, support Position (Skeletal animation by hardware skin) and Texture vertex attribute,
with color specified by a uniform. with color specified by a uniform.
*/ */
static const char* SHADER_3D_SKINPOSITION_TEXTURE; static const char* SHADER_3D_SKINPOSITION_TEXTURE;
@ -205,7 +208,7 @@ public:
*/ */
static const char* SHADER_3D_POSITION_NORMAL_TEXTURE; static const char* SHADER_3D_POSITION_NORMAL_TEXTURE;
/** /**
Built in shader used for 3D, support Position(skeletal animation by hardware skin), Normal, Texture vertex attribute, Built in shader used for 3D, support Position(skeletal animation by hardware skin), Normal, Texture vertex attribute,
used in lighting. with color specified by a uniform. used in lighting. with color specified by a uniform.
*/ */
static const char* SHADER_3D_SKINPOSITION_NORMAL_TEXTURE; static const char* SHADER_3D_SKINPOSITION_NORMAL_TEXTURE;
@ -217,22 +220,22 @@ public:
Built in shader for particles, support Position, with a color specified by a uniform. Built in shader for particles, support Position, with a color specified by a uniform.
*/ */
static const char* SHADER_3D_PARTICLE_COLOR; static const char* SHADER_3D_PARTICLE_COLOR;
/** /**
Built in shader for skybox Built in shader for skybox
*/ */
static const char* SHADER_3D_SKYBOX; static const char* SHADER_3D_SKYBOX;
/** /**
Built in shader for terrain Built in shader for terrain
*/ */
static const char* SHADER_3D_TERRAIN; static const char* SHADER_3D_TERRAIN;
/** /**
end of built shader types. end of built shader types.
@} @}
*/ */
/** /**
@name Built uniform names @name Built uniform names
@{ @{
@ -329,7 +332,7 @@ public:
/** /**
@} @}
*/ */
/**@{ Get the uniform or vertex attribute by string name in shader, return null if it does not exist.*/ /**@{ Get the uniform or vertex attribute by string name in shader, return null if it does not exist.*/
Uniform* getUniform(const std::string& name); Uniform* getUniform(const std::string& name);
VertexAttrib* getVertexAttrib(const std::string& name); VertexAttrib* getVertexAttrib(const std::string& name);
@ -358,54 +361,54 @@ public:
*/ */
void updateUniforms(); void updateUniforms();
/** calls retrieves the named uniform location for this shader program. */ /** calls retrieves the named uniform location for this shader program. */
GLint getUniformLocationForName(const char* name) const; GLint getUniformLocationForName(const char* name) const;
/** calls glUniform1i only if the values are different than the previous call for this same shader program. /** calls glUniform1i only if the values are different than the previous call for this same shader program.
* @js setUniformLocationI32 * @js setUniformLocationI32
* @lua setUniformLocationI32 * @lua setUniformLocationI32
*/ */
void setUniformLocationWith1i(GLint location, GLint i1); void setUniformLocationWith1i(GLint location, GLint i1);
/** calls glUniform2i only if the values are different than the previous call for this same shader program. */ /** calls glUniform2i only if the values are different than the previous call for this same shader program. */
void setUniformLocationWith2i(GLint location, GLint i1, GLint i2); void setUniformLocationWith2i(GLint location, GLint i1, GLint i2);
/** calls glUniform3i only if the values are different than the previous call for this same shader program. */ /** calls glUniform3i only if the values are different than the previous call for this same shader program. */
void setUniformLocationWith3i(GLint location, GLint i1, GLint i2, GLint i3); void setUniformLocationWith3i(GLint location, GLint i1, GLint i2, GLint i3);
/** calls glUniform4i only if the values are different than the previous call for this same shader program. */ /** calls glUniform4i only if the values are different than the previous call for this same shader program. */
void setUniformLocationWith4i(GLint location, GLint i1, GLint i2, GLint i3, GLint i4); void setUniformLocationWith4i(GLint location, GLint i1, GLint i2, GLint i3, GLint i4);
/** calls glUniform2iv only if the values are different than the previous call for this same shader program. */ /** calls glUniform2iv only if the values are different than the previous call for this same shader program. */
void setUniformLocationWith2iv(GLint location, GLint* ints, unsigned int numberOfArrays); void setUniformLocationWith2iv(GLint location, GLint* ints, unsigned int numberOfArrays);
/** calls glUniform3iv only if the values are different than the previous call for this same shader program. */ /** calls glUniform3iv only if the values are different than the previous call for this same shader program. */
void setUniformLocationWith3iv(GLint location, GLint* ints, unsigned int numberOfArrays); void setUniformLocationWith3iv(GLint location, GLint* ints, unsigned int numberOfArrays);
/** calls glUniform4iv only if the values are different than the previous call for this same shader program. */ /** calls glUniform4iv only if the values are different than the previous call for this same shader program. */
void setUniformLocationWith4iv(GLint location, GLint* ints, unsigned int numberOfArrays); void setUniformLocationWith4iv(GLint location, GLint* ints, unsigned int numberOfArrays);
/** calls glUniform1f only if the values are different than the previous call for this same shader program. /** calls glUniform1f only if the values are different than the previous call for this same shader program.
* In js or lua,please use setUniformLocationF32 * In js or lua,please use setUniformLocationF32
* @js NA * @js NA
*/ */
void setUniformLocationWith1f(GLint location, GLfloat f1); void setUniformLocationWith1f(GLint location, GLfloat f1);
/** calls glUniform2f only if the values are different than the previous call for this same shader program. /** calls glUniform2f only if the values are different than the previous call for this same shader program.
* In js or lua,please use setUniformLocationF32 * In js or lua,please use setUniformLocationF32
* @js NA * @js NA
*/ */
void setUniformLocationWith2f(GLint location, GLfloat f1, GLfloat f2); void setUniformLocationWith2f(GLint location, GLfloat f1, GLfloat f2);
/** calls glUniform3f only if the values are different than the previous call for this same shader program. /** calls glUniform3f only if the values are different than the previous call for this same shader program.
* In js or lua,please use setUniformLocationF32 * In js or lua,please use setUniformLocationF32
* @js NA * @js NA
*/ */
void setUniformLocationWith3f(GLint location, GLfloat f1, GLfloat f2, GLfloat f3); void setUniformLocationWith3f(GLint location, GLfloat f1, GLfloat f2, GLfloat f3);
/** calls glUniform4f only if the values are different than the previous call for this same shader program. /** calls glUniform4f only if the values are different than the previous call for this same shader program.
* In js or lua,please use setUniformLocationF32 * In js or lua,please use setUniformLocationF32
* @js NA * @js NA
*/ */
@ -425,13 +428,13 @@ public:
/** calls glUniformMatrix2fv only if the values are different than the previous call for this same shader program. */ /** calls glUniformMatrix2fv only if the values are different than the previous call for this same shader program. */
void setUniformLocationWithMatrix2fv(GLint location, const GLfloat* matrixArray, unsigned int numberOfMatrices); void setUniformLocationWithMatrix2fv(GLint location, const GLfloat* matrixArray, unsigned int numberOfMatrices);
/** calls glUniformMatrix3fv only if the values are different than the previous call for this same shader program. */ /** calls glUniformMatrix3fv only if the values are different than the previous call for this same shader program. */
void setUniformLocationWithMatrix3fv(GLint location, const GLfloat* matrixArray, unsigned int numberOfMatrices); void setUniformLocationWithMatrix3fv(GLint location, const GLfloat* matrixArray, unsigned int numberOfMatrices);
/** calls glUniformMatrix4fv only if the values are different than the previous call for this same shader program. */ /** calls glUniformMatrix4fv only if the values are different than the previous call for this same shader program. */
void setUniformLocationWithMatrix4fv(GLint location, const GLfloat* matrixArray, unsigned int numberOfMatrices); void setUniformLocationWithMatrix4fv(GLint location, const GLfloat* matrixArray, unsigned int numberOfMatrices);
/** /**
Update the builtin uniforms if they are different than the previous call for this same shader program. Update the builtin uniforms if they are different than the previous call for this same shader program.
*/ */
@ -450,7 +453,7 @@ public:
/** returns the program error log */ /** returns the program error log */
std::string getProgramLog() const; std::string getProgramLog() const;
/** Reload all shaders, this function is designed for android /** Reload all shaders, this function is designed for android
when opengl context lost, so don't call it. when opengl context lost, so don't call it.
*/ */
@ -485,7 +488,7 @@ protected:
void parseUniforms(); void parseUniforms();
/**Compile the shader sources.*/ /**Compile the shader sources.*/
bool compileShader(GLuint * shader, GLenum type, const GLchar* source); bool compileShader(GLuint * shader, GLenum type, const GLchar* source);
/**OpenGL handle for program.*/ /**OpenGL handle for program.*/
GLuint _program; GLuint _program;
/**OpenGL handle for vertex shader.*/ /**OpenGL handle for vertex shader.*/
@ -496,7 +499,7 @@ protected:
GLint _builtInUniforms[UNIFORM_MAX]; GLint _builtInUniforms[UNIFORM_MAX];
/**Indicate whether it has a offline shader compiler or not.*/ /**Indicate whether it has a offline shader compiler or not.*/
bool _hasShaderCompiler; bool _hasShaderCompiler;
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || defined(WP8_SHADER_COMPILER) #if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || defined(WP8_SHADER_COMPILER)
/**Shader ID in precompiled shaders on Windows phone.*/ /**Shader ID in precompiled shaders on Windows phone.*/
std::string _shaderId; std::string _shaderId;

View File

@ -53,6 +53,7 @@ enum {
kShaderType_PositionLengthTexureColor, kShaderType_PositionLengthTexureColor,
kShaderType_LabelDistanceFieldNormal, kShaderType_LabelDistanceFieldNormal,
kShaderType_LabelDistanceFieldGlow, kShaderType_LabelDistanceFieldGlow,
kShaderType_UIGrayScale,
kShaderType_LabelNormal, kShaderType_LabelNormal,
kShaderType_LabelOutline, kShaderType_LabelOutline,
kShaderType_3DPosition, kShaderType_3DPosition,
@ -118,7 +119,7 @@ GLProgramCache::~GLProgramCache()
} }
bool GLProgramCache::init() bool GLProgramCache::init()
{ {
loadDefaultGLPrograms(); loadDefaultGLPrograms();
return true; return true;
} }
@ -150,12 +151,12 @@ void GLProgramCache::loadDefaultGLPrograms()
p = new (std::nothrow) GLProgram(); p = new (std::nothrow) GLProgram();
loadDefaultGLProgram(p, kShaderType_PositionColor); loadDefaultGLProgram(p, kShaderType_PositionColor);
_programs.insert( std::make_pair(GLProgram::SHADER_NAME_POSITION_COLOR, p) ); _programs.insert( std::make_pair(GLProgram::SHADER_NAME_POSITION_COLOR, p) );
// Position, Color, PointSize shader // Position, Color, PointSize shader
p = new (std::nothrow) GLProgram(); p = new (std::nothrow) GLProgram();
loadDefaultGLProgram(p, kShaderType_PositionColorTextureAsPointsize); loadDefaultGLProgram(p, kShaderType_PositionColorTextureAsPointsize);
_programs.insert( std::make_pair(GLProgram::SHADER_NAME_POSITION_COLOR_TEXASPOINTSIZE, p) ); _programs.insert( std::make_pair(GLProgram::SHADER_NAME_POSITION_COLOR_TEXASPOINTSIZE, p) );
// //
// Position, Color shader no MVP // Position, Color shader no MVP
// //
@ -190,7 +191,7 @@ void GLProgramCache::loadDefaultGLPrograms()
p = new (std::nothrow) GLProgram(); p = new (std::nothrow) GLProgram();
loadDefaultGLProgram(p, kShaderType_Position_uColor); loadDefaultGLProgram(p, kShaderType_Position_uColor);
_programs.insert( std::make_pair(GLProgram::SHADER_NAME_POSITION_U_COLOR, p) ); _programs.insert( std::make_pair(GLProgram::SHADER_NAME_POSITION_U_COLOR, p) );
// //
// Position, Legth(TexCoords, Color (used by Draw Node basically ) // Position, Legth(TexCoords, Color (used by Draw Node basically )
// //
@ -208,6 +209,10 @@ void GLProgramCache::loadDefaultGLPrograms()
_programs.insert( std::make_pair(GLProgram::SHADER_NAME_LABEL_DISTANCEFIELD_GLOW, p) ); _programs.insert( std::make_pair(GLProgram::SHADER_NAME_LABEL_DISTANCEFIELD_GLOW, p) );
#endif #endif
p = new (std::nothrow) GLProgram();
loadDefaultGLProgram(p, kShaderType_UIGrayScale);
_programs.insert(std::make_pair(GLProgram::SHADER_NAME_POSITION_GRAYSCALE, p));
p = new (std::nothrow) GLProgram(); p = new (std::nothrow) GLProgram();
loadDefaultGLProgram(p, kShaderType_LabelNormal); loadDefaultGLProgram(p, kShaderType_LabelNormal);
_programs.insert( std::make_pair(GLProgram::SHADER_NAME_LABEL_NORMAL, p) ); _programs.insert( std::make_pair(GLProgram::SHADER_NAME_LABEL_NORMAL, p) );
@ -215,7 +220,7 @@ void GLProgramCache::loadDefaultGLPrograms()
p = new (std::nothrow) GLProgram(); p = new (std::nothrow) GLProgram();
loadDefaultGLProgram(p, kShaderType_LabelOutline); loadDefaultGLProgram(p, kShaderType_LabelOutline);
_programs.insert( std::make_pair(GLProgram::SHADER_NAME_LABEL_OUTLINE, p) ); _programs.insert( std::make_pair(GLProgram::SHADER_NAME_LABEL_OUTLINE, p) );
p = new (std::nothrow) GLProgram(); p = new (std::nothrow) GLProgram();
loadDefaultGLProgram(p, kShaderType_3DPosition); loadDefaultGLProgram(p, kShaderType_3DPosition);
_programs.insert( std::make_pair(GLProgram::SHADER_3D_POSITION, p) ); _programs.insert( std::make_pair(GLProgram::SHADER_3D_POSITION, p) );
@ -223,7 +228,7 @@ void GLProgramCache::loadDefaultGLPrograms()
p = new (std::nothrow) GLProgram(); p = new (std::nothrow) GLProgram();
loadDefaultGLProgram(p, kShaderType_3DPositionTex); loadDefaultGLProgram(p, kShaderType_3DPositionTex);
_programs.insert( std::make_pair(GLProgram::SHADER_3D_POSITION_TEXTURE, p) ); _programs.insert( std::make_pair(GLProgram::SHADER_3D_POSITION_TEXTURE, p) );
p = new (std::nothrow) GLProgram(); p = new (std::nothrow) GLProgram();
loadDefaultGLProgram(p, kShaderType_3DSkinPositionTex); loadDefaultGLProgram(p, kShaderType_3DSkinPositionTex);
_programs.insert(std::make_pair(GLProgram::SHADER_3D_SKINPOSITION_TEXTURE, p)); _programs.insert(std::make_pair(GLProgram::SHADER_3D_SKINPOSITION_TEXTURE, p));
@ -239,19 +244,19 @@ void GLProgramCache::loadDefaultGLPrograms()
p = new GLProgram(); p = new GLProgram();
loadDefaultGLProgram(p, kShaderType_3DSkinPositionNormalTex); loadDefaultGLProgram(p, kShaderType_3DSkinPositionNormalTex);
_programs.insert(std::make_pair(GLProgram::SHADER_3D_SKINPOSITION_NORMAL_TEXTURE, p)); _programs.insert(std::make_pair(GLProgram::SHADER_3D_SKINPOSITION_NORMAL_TEXTURE, p));
p = new GLProgram(); p = new GLProgram();
loadDefaultGLProgram(p, kShaderType_3DParticleColor); loadDefaultGLProgram(p, kShaderType_3DParticleColor);
_programs.insert(std::make_pair(GLProgram::SHADER_3D_PARTICLE_COLOR, p)); _programs.insert(std::make_pair(GLProgram::SHADER_3D_PARTICLE_COLOR, p));
p = new GLProgram(); p = new GLProgram();
loadDefaultGLProgram(p, kShaderType_3DParticleTex); loadDefaultGLProgram(p, kShaderType_3DParticleTex);
_programs.insert(std::make_pair(GLProgram::SHADER_3D_PARTICLE_TEXTURE, p)); _programs.insert(std::make_pair(GLProgram::SHADER_3D_PARTICLE_TEXTURE, p));
p = new GLProgram(); p = new GLProgram();
loadDefaultGLProgram(p, kShaderType_3DSkyBox); loadDefaultGLProgram(p, kShaderType_3DSkyBox);
_programs.insert(std::make_pair(GLProgram::SHADER_3D_SKYBOX, p)); _programs.insert(std::make_pair(GLProgram::SHADER_3D_SKYBOX, p));
p = new GLProgram(); p = new GLProgram();
loadDefaultGLProgram(p, kShaderType_3DTerrain); loadDefaultGLProgram(p, kShaderType_3DTerrain);
_programs.insert(std::make_pair(GLProgram::SHADER_3D_TERRAIN, p)); _programs.insert(std::make_pair(GLProgram::SHADER_3D_TERRAIN, p));
@ -260,25 +265,25 @@ void GLProgramCache::loadDefaultGLPrograms()
void GLProgramCache::reloadDefaultGLPrograms() void GLProgramCache::reloadDefaultGLPrograms()
{ {
// reset all programs and reload them // reset all programs and reload them
// Position Texture Color shader // Position Texture Color shader
GLProgram *p = getGLProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR); GLProgram *p = getGLProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR);
p->reset(); p->reset();
loadDefaultGLProgram(p, kShaderType_PositionTextureColor); loadDefaultGLProgram(p, kShaderType_PositionTextureColor);
// Position Texture Color without MVP shader // Position Texture Color without MVP shader
p = getGLProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP); p = getGLProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP);
p->reset(); p->reset();
loadDefaultGLProgram(p, kShaderType_PositionTextureColor_noMVP); loadDefaultGLProgram(p, kShaderType_PositionTextureColor_noMVP);
// Position Texture Color alpha test // Position Texture Color alpha test
p = getGLProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST); p = getGLProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST);
p->reset(); p->reset();
loadDefaultGLProgram(p, kShaderType_PositionTextureColorAlphaTest); loadDefaultGLProgram(p, kShaderType_PositionTextureColorAlphaTest);
// Position Texture Color alpha test // Position Texture Color alpha test
p = getGLProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST_NO_MV); p = getGLProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST_NO_MV);
p->reset(); p->reset();
loadDefaultGLProgram(p, kShaderType_PositionTextureColorAlphaTestNoMV); loadDefaultGLProgram(p, kShaderType_PositionTextureColorAlphaTestNoMV);
// //
// Position, Color shader // Position, Color shader
@ -286,7 +291,7 @@ void GLProgramCache::reloadDefaultGLPrograms()
p = getGLProgram(GLProgram::SHADER_NAME_POSITION_COLOR); p = getGLProgram(GLProgram::SHADER_NAME_POSITION_COLOR);
p->reset(); p->reset();
loadDefaultGLProgram(p, kShaderType_PositionColor); loadDefaultGLProgram(p, kShaderType_PositionColor);
// Position, Color, PointSize shader // Position, Color, PointSize shader
p = getGLProgram(GLProgram::SHADER_NAME_POSITION_COLOR_TEXASPOINTSIZE); p = getGLProgram(GLProgram::SHADER_NAME_POSITION_COLOR_TEXASPOINTSIZE);
p->reset(); p->reset();
@ -304,28 +309,28 @@ void GLProgramCache::reloadDefaultGLPrograms()
p = getGLProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE); p = getGLProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE);
p->reset(); p->reset();
loadDefaultGLProgram(p, kShaderType_PositionTexture); loadDefaultGLProgram(p, kShaderType_PositionTexture);
// //
// Position, Texture attribs, 1 Color as uniform shader // Position, Texture attribs, 1 Color as uniform shader
// //
p = getGLProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_U_COLOR); p = getGLProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_U_COLOR);
p->reset(); p->reset();
loadDefaultGLProgram(p, kShaderType_PositionTexture_uColor); loadDefaultGLProgram(p, kShaderType_PositionTexture_uColor);
// //
// Position Texture A8 Color shader // Position Texture A8 Color shader
// //
p = getGLProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_A8_COLOR); p = getGLProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_A8_COLOR);
p->reset(); p->reset();
loadDefaultGLProgram(p, kShaderType_PositionTextureA8Color); loadDefaultGLProgram(p, kShaderType_PositionTextureA8Color);
// //
// Position and 1 color passed as a uniform (to simulate glColor4ub ) // Position and 1 color passed as a uniform (to simulate glColor4ub )
// //
p = getGLProgram(GLProgram::SHADER_NAME_POSITION_U_COLOR); p = getGLProgram(GLProgram::SHADER_NAME_POSITION_U_COLOR);
p->reset(); p->reset();
loadDefaultGLProgram(p, kShaderType_Position_uColor); loadDefaultGLProgram(p, kShaderType_Position_uColor);
// //
// Position, Legth(TexCoords, Color (used by Draw Node basically ) // Position, Legth(TexCoords, Color (used by Draw Node basically )
// //
@ -350,19 +355,19 @@ void GLProgramCache::reloadDefaultGLPrograms()
p = getGLProgram(GLProgram::SHADER_NAME_LABEL_OUTLINE); p = getGLProgram(GLProgram::SHADER_NAME_LABEL_OUTLINE);
p->reset(); p->reset();
loadDefaultGLProgram(p, kShaderType_LabelOutline); loadDefaultGLProgram(p, kShaderType_LabelOutline);
p = getGLProgram(GLProgram::SHADER_3D_POSITION); p = getGLProgram(GLProgram::SHADER_3D_POSITION);
p->reset(); p->reset();
loadDefaultGLProgram(p, kShaderType_3DPosition); loadDefaultGLProgram(p, kShaderType_3DPosition);
p = getGLProgram(GLProgram::SHADER_3D_POSITION_TEXTURE); p = getGLProgram(GLProgram::SHADER_3D_POSITION_TEXTURE);
p->reset(); p->reset();
loadDefaultGLProgram(p, kShaderType_3DPositionTex); loadDefaultGLProgram(p, kShaderType_3DPositionTex);
p = getGLProgram(GLProgram::SHADER_3D_SKINPOSITION_TEXTURE); p = getGLProgram(GLProgram::SHADER_3D_SKINPOSITION_TEXTURE);
p->reset(); p->reset();
loadDefaultGLProgram(p, kShaderType_3DSkinPositionTex); loadDefaultGLProgram(p, kShaderType_3DSkinPositionTex);
p = getGLProgram(GLProgram::SHADER_3D_POSITION_NORMAL); p = getGLProgram(GLProgram::SHADER_3D_POSITION_NORMAL);
p->reset(); p->reset();
loadDefaultGLProgram(p, kShaderType_3DPositionNormal); loadDefaultGLProgram(p, kShaderType_3DPositionNormal);
@ -374,19 +379,19 @@ void GLProgramCache::reloadDefaultGLPrograms()
p = getGLProgram(GLProgram::SHADER_3D_SKINPOSITION_NORMAL_TEXTURE); p = getGLProgram(GLProgram::SHADER_3D_SKINPOSITION_NORMAL_TEXTURE);
p->reset(); p->reset();
loadDefaultGLProgram(p, kShaderType_3DSkinPositionNormalTex); loadDefaultGLProgram(p, kShaderType_3DSkinPositionNormalTex);
p = getGLProgram(GLProgram::SHADER_3D_PARTICLE_TEXTURE); p = getGLProgram(GLProgram::SHADER_3D_PARTICLE_TEXTURE);
p->reset(); p->reset();
loadDefaultGLProgram(p, kShaderType_3DParticleTex); loadDefaultGLProgram(p, kShaderType_3DParticleTex);
p = getGLProgram(GLProgram::SHADER_3D_PARTICLE_COLOR); p = getGLProgram(GLProgram::SHADER_3D_PARTICLE_COLOR);
p->reset(); p->reset();
loadDefaultGLProgram(p, kShaderType_3DParticleColor); loadDefaultGLProgram(p, kShaderType_3DParticleColor);
p = getGLProgram(GLProgram::SHADER_3D_SKYBOX); p = getGLProgram(GLProgram::SHADER_3D_SKYBOX);
p->reset(); p->reset();
loadDefaultGLProgram(p, kShaderType_3DSkyBox); loadDefaultGLProgram(p, kShaderType_3DSkyBox);
p = getGLProgram(GLProgram::SHADER_3D_TERRAIN); p = getGLProgram(GLProgram::SHADER_3D_TERRAIN);
p->reset(); p->reset();
loadDefaultGLProgram(p, kShaderType_3DTerrain); loadDefaultGLProgram(p, kShaderType_3DTerrain);
@ -407,7 +412,7 @@ void GLProgramCache::loadDefaultGLProgram(GLProgram *p, int type)
case kShaderType_PositionTextureColorAlphaTestNoMV: case kShaderType_PositionTextureColorAlphaTestNoMV:
p->initWithByteArrays(ccPositionTextureColor_noMVP_vert, ccPositionTextureColorAlphaTest_frag); p->initWithByteArrays(ccPositionTextureColor_noMVP_vert, ccPositionTextureColorAlphaTest_frag);
break; break;
case kShaderType_PositionColor: case kShaderType_PositionColor:
p->initWithByteArrays(ccPositionColor_vert ,ccPositionColor_frag); p->initWithByteArrays(ccPositionColor_vert ,ccPositionColor_frag);
break; break;
case kShaderType_PositionColorTextureAsPointsize: case kShaderType_PositionColorTextureAsPointsize:
@ -440,6 +445,10 @@ void GLProgramCache::loadDefaultGLProgram(GLProgram *p, int type)
p->initWithByteArrays(ccLabel_vert, ccLabelDistanceFieldGlow_frag); p->initWithByteArrays(ccLabel_vert, ccLabelDistanceFieldGlow_frag);
break; break;
#endif #endif
case kShaderType_UIGrayScale:
p->initWithByteArrays(ccPositionTextureColor_noMVP_vert,
ccPositionTexture_GrayScale_frag);
break;
case kShaderType_LabelNormal: case kShaderType_LabelNormal:
p->initWithByteArrays(ccLabel_vert, ccLabelNormal_frag); p->initWithByteArrays(ccLabel_vert, ccLabelNormal_frag);
break; break;
@ -496,10 +505,10 @@ void GLProgramCache::loadDefaultGLProgram(GLProgram *p, int type)
CCLOG("cocos2d: %s:%d, error shader type", __FUNCTION__, __LINE__); CCLOG("cocos2d: %s:%d, error shader type", __FUNCTION__, __LINE__);
return; return;
} }
p->link(); p->link();
p->updateUniforms(); p->updateUniforms();
CHECK_GL_ERROR_DEBUG(); CHECK_GL_ERROR_DEBUG();
} }

View File

@ -637,7 +637,12 @@ bool Texture2D::initWithMipmaps(MipmapInfo* mipmaps, int mipmapsNum, PixelFormat
} }
#endif #endif
CHECK_GL_ERROR_DEBUG(); // clean possible GL error // clean possible GL error
GLenum err = glGetError();
if (err != GL_NO_ERROR)
{
cocos2d::log("OpenGL error 0x%04X in %s %s %d\n", err, __FILE__, __FUNCTION__, __LINE__);
}
// Specify OpenGL texture image // Specify OpenGL texture image
int width = pixelsWide; int width = pixelsWide;

View File

@ -1,4 +1,4 @@
const char* ccUIGrayScale_frag = STRINGIFY( const char* ccPositionTexture_GrayScale_frag = STRINGIFY(
\n#ifdef GL_ES\n \n#ifdef GL_ES\n
\nprecision mediump float;\n \nprecision mediump float;\n

View File

@ -66,6 +66,7 @@ NS_CC_BEGIN
#include "ccShader_PositionColorLengthTexture.frag" #include "ccShader_PositionColorLengthTexture.frag"
#include "ccShader_PositionColorLengthTexture.vert" #include "ccShader_PositionColorLengthTexture.vert"
#include "ccShader_UI_Gray.frag"
// //
#include "ccShader_Label.vert" #include "ccShader_Label.vert"
#include "ccShader_Label_df.frag" #include "ccShader_Label_df.frag"

View File

@ -66,6 +66,8 @@ extern CC_DLL const GLchar * ccPositionTexture_uColor_vert;
extern CC_DLL const GLchar * ccPositionColorLengthTexture_frag; extern CC_DLL const GLchar * ccPositionColorLengthTexture_frag;
extern CC_DLL const GLchar * ccPositionColorLengthTexture_vert; extern CC_DLL const GLchar * ccPositionColorLengthTexture_vert;
extern CC_DLL const GLchar * ccPositionTexture_GrayScale_frag;
extern CC_DLL const GLchar * ccLabelDistanceFieldNormal_frag; extern CC_DLL const GLchar * ccLabelDistanceFieldNormal_frag;
extern CC_DLL const GLchar * ccLabelDistanceFieldGlow_frag; extern CC_DLL const GLchar * ccLabelDistanceFieldGlow_frag;
extern CC_DLL const GLchar * ccLabelNormal_frag; extern CC_DLL const GLchar * ccLabelNormal_frag;

View File

@ -58,7 +58,7 @@
-- @return GLProgram#GLProgram self (return value: cc.GLProgram) -- @return GLProgram#GLProgram self (return value: cc.GLProgram)
-------------------------------- --------------------------------
-- calls glUniform1i only if the values are different than the previous call for this same shader program. <br> -- calls glUniform1i only if the values are different than the previous call for this same shader program.<br>
-- js setUniformLocationI32<br> -- js setUniformLocationI32<br>
-- lua setUniformLocationI32 -- lua setUniformLocationI32
-- @function [parent=#GLProgram] setUniformLocationWith1i -- @function [parent=#GLProgram] setUniformLocationWith1i

View File

@ -0,0 +1,112 @@
--------------------------------
-- @module WebView
-- @extend Widget
-- @parent_module ccexp
--------------------------------
-- Loads the given URL.<br>
-- param url Content URL.
-- @function [parent=#WebView] loadURL
-- @param self
-- @param #string url
-- @return experimental::ui::WebView#experimental::ui::WebView self (return value: cc.experimental::ui::WebView)
--------------------------------
-- Gets whether this WebView has a back history item.<br>
-- return WebView has a back history item.
-- @function [parent=#WebView] canGoBack
-- @param self
-- @return bool#bool ret (return value: bool)
--------------------------------
-- Sets the main page content and base URL.<br>
-- param string The content for the main page.<br>
-- param baseURL The base URL for the content.
-- @function [parent=#WebView] loadHTMLString
-- @param self
-- @param #string string
-- @param #string baseURL
-- @return experimental::ui::WebView#experimental::ui::WebView self (return value: cc.experimental::ui::WebView)
--------------------------------
-- Goes forward in the history.
-- @function [parent=#WebView] goForward
-- @param self
-- @return experimental::ui::WebView#experimental::ui::WebView self (return value: cc.experimental::ui::WebView)
--------------------------------
-- Goes back in the history.
-- @function [parent=#WebView] goBack
-- @param self
-- @return experimental::ui::WebView#experimental::ui::WebView self (return value: cc.experimental::ui::WebView)
--------------------------------
-- Set javascript interface scheme.<br>
-- see WebView::setOnJSCallback()
-- @function [parent=#WebView] setJavascriptInterfaceScheme
-- @param self
-- @param #string scheme
-- @return experimental::ui::WebView#experimental::ui::WebView self (return value: cc.experimental::ui::WebView)
--------------------------------
-- Evaluates JavaScript in the context of the currently displayed page.
-- @function [parent=#WebView] evaluateJS
-- @param self
-- @param #string js
-- @return experimental::ui::WebView#experimental::ui::WebView self (return value: cc.experimental::ui::WebView)
--------------------------------
-- Get the Javascript callback.
-- @function [parent=#WebView] getOnJSCallback
-- @param self
-- @return function#function ret (return value: function)
--------------------------------
-- Reloads the current URL.
-- @function [parent=#WebView] reload
-- @param self
-- @return experimental::ui::WebView#experimental::ui::WebView self (return value: cc.experimental::ui::WebView)
--------------------------------
-- Set WebView should support zooming. The default value is false.
-- @function [parent=#WebView] setScalesPageToFit
-- @param self
-- @param #bool scalesPageToFit
-- @return experimental::ui::WebView#experimental::ui::WebView self (return value: cc.experimental::ui::WebView)
--------------------------------
-- Gets whether this WebView has a forward history item.<br>
-- return WebView has a forward history item.
-- @function [parent=#WebView] canGoForward
-- @param self
-- @return bool#bool ret (return value: bool)
--------------------------------
-- Loads the given fileName.<br>
-- param fileName Content fileName.
-- @function [parent=#WebView] loadFile
-- @param self
-- @param #string fileName
-- @return experimental::ui::WebView#experimental::ui::WebView self (return value: cc.experimental::ui::WebView)
--------------------------------
-- Stops the current load.
-- @function [parent=#WebView] stopLoading
-- @param self
-- @return experimental::ui::WebView#experimental::ui::WebView self (return value: cc.experimental::ui::WebView)
--------------------------------
-- Allocates and initializes a WebView.
-- @function [parent=#WebView] create
-- @param self
-- @return experimental::ui::WebView#experimental::ui::WebView ret (return value: cc.experimental::ui::WebView)
--------------------------------
-- Toggle visibility of WebView.
-- @function [parent=#WebView] setVisible
-- @param self
-- @param #bool visible
-- @return experimental::ui::WebView#experimental::ui::WebView self (return value: cc.experimental::ui::WebView)
return nil

View File

@ -0,0 +1,9 @@
--------------------------------
-- @module ccexp
--------------------------------------------------------
-- the ccexp WebView
-- @field [parent=#ccexp] WebView#WebView WebView preloaded module
return nil

View File

@ -0,0 +1,734 @@
#include "lua_cocos2dx_experimental_webview_auto.hpp"
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
#include "UIWebView.h"
#include "tolua_fix.h"
#include "LuaBasicConversions.h"
int lua_cocos2dx_experimental_webview_WebView_loadURL(lua_State* tolua_S)
{
int argc = 0;
cocos2d::experimental::ui::WebView* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"ccexp.WebView",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::experimental::ui::WebView*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_webview_WebView_loadURL'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
std::string arg0;
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccexp.WebView:loadURL");
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_experimental_webview_WebView_loadURL'", nullptr);
return 0;
}
cobj->loadURL(arg0);
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccexp.WebView:loadURL",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_webview_WebView_loadURL'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_experimental_webview_WebView_canGoBack(lua_State* tolua_S)
{
int argc = 0;
cocos2d::experimental::ui::WebView* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"ccexp.WebView",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::experimental::ui::WebView*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_webview_WebView_canGoBack'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_experimental_webview_WebView_canGoBack'", nullptr);
return 0;
}
bool ret = cobj->canGoBack();
tolua_pushboolean(tolua_S,(bool)ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccexp.WebView:canGoBack",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_webview_WebView_canGoBack'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_experimental_webview_WebView_loadHTMLString(lua_State* tolua_S)
{
int argc = 0;
cocos2d::experimental::ui::WebView* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"ccexp.WebView",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::experimental::ui::WebView*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_webview_WebView_loadHTMLString'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
std::string arg0;
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccexp.WebView:loadHTMLString");
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_experimental_webview_WebView_loadHTMLString'", nullptr);
return 0;
}
cobj->loadHTMLString(arg0);
lua_settop(tolua_S, 1);
return 1;
}
if (argc == 2)
{
std::string arg0;
std::string arg1;
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccexp.WebView:loadHTMLString");
ok &= luaval_to_std_string(tolua_S, 3,&arg1, "ccexp.WebView:loadHTMLString");
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_experimental_webview_WebView_loadHTMLString'", nullptr);
return 0;
}
cobj->loadHTMLString(arg0, arg1);
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccexp.WebView:loadHTMLString",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_webview_WebView_loadHTMLString'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_experimental_webview_WebView_goForward(lua_State* tolua_S)
{
int argc = 0;
cocos2d::experimental::ui::WebView* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"ccexp.WebView",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::experimental::ui::WebView*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_webview_WebView_goForward'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_experimental_webview_WebView_goForward'", nullptr);
return 0;
}
cobj->goForward();
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccexp.WebView:goForward",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_webview_WebView_goForward'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_experimental_webview_WebView_goBack(lua_State* tolua_S)
{
int argc = 0;
cocos2d::experimental::ui::WebView* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"ccexp.WebView",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::experimental::ui::WebView*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_webview_WebView_goBack'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_experimental_webview_WebView_goBack'", nullptr);
return 0;
}
cobj->goBack();
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccexp.WebView:goBack",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_webview_WebView_goBack'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_experimental_webview_WebView_setJavascriptInterfaceScheme(lua_State* tolua_S)
{
int argc = 0;
cocos2d::experimental::ui::WebView* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"ccexp.WebView",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::experimental::ui::WebView*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_webview_WebView_setJavascriptInterfaceScheme'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
std::string arg0;
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccexp.WebView:setJavascriptInterfaceScheme");
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_experimental_webview_WebView_setJavascriptInterfaceScheme'", nullptr);
return 0;
}
cobj->setJavascriptInterfaceScheme(arg0);
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccexp.WebView:setJavascriptInterfaceScheme",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_webview_WebView_setJavascriptInterfaceScheme'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_experimental_webview_WebView_evaluateJS(lua_State* tolua_S)
{
int argc = 0;
cocos2d::experimental::ui::WebView* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"ccexp.WebView",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::experimental::ui::WebView*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_webview_WebView_evaluateJS'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
std::string arg0;
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccexp.WebView:evaluateJS");
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_experimental_webview_WebView_evaluateJS'", nullptr);
return 0;
}
cobj->evaluateJS(arg0);
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccexp.WebView:evaluateJS",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_webview_WebView_evaluateJS'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_experimental_webview_WebView_getOnJSCallback(lua_State* tolua_S)
{
int argc = 0;
cocos2d::experimental::ui::WebView* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"ccexp.WebView",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::experimental::ui::WebView*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_webview_WebView_getOnJSCallback'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_experimental_webview_WebView_getOnJSCallback'", nullptr);
return 0;
}
cocos2d::experimental::ui::WebView::ccWebViewCallback ret = cobj->getOnJSCallback();
#pragma warning NO CONVERSION FROM NATIVE FOR std::function;
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccexp.WebView:getOnJSCallback",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_webview_WebView_getOnJSCallback'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_experimental_webview_WebView_reload(lua_State* tolua_S)
{
int argc = 0;
cocos2d::experimental::ui::WebView* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"ccexp.WebView",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::experimental::ui::WebView*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_webview_WebView_reload'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_experimental_webview_WebView_reload'", nullptr);
return 0;
}
cobj->reload();
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccexp.WebView:reload",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_webview_WebView_reload'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_experimental_webview_WebView_setScalesPageToFit(lua_State* tolua_S)
{
int argc = 0;
cocos2d::experimental::ui::WebView* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"ccexp.WebView",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::experimental::ui::WebView*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_webview_WebView_setScalesPageToFit'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
bool arg0;
ok &= luaval_to_boolean(tolua_S, 2,&arg0, "ccexp.WebView:setScalesPageToFit");
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_experimental_webview_WebView_setScalesPageToFit'", nullptr);
return 0;
}
cobj->setScalesPageToFit(arg0);
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccexp.WebView:setScalesPageToFit",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_webview_WebView_setScalesPageToFit'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_experimental_webview_WebView_canGoForward(lua_State* tolua_S)
{
int argc = 0;
cocos2d::experimental::ui::WebView* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"ccexp.WebView",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::experimental::ui::WebView*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_webview_WebView_canGoForward'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_experimental_webview_WebView_canGoForward'", nullptr);
return 0;
}
bool ret = cobj->canGoForward();
tolua_pushboolean(tolua_S,(bool)ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccexp.WebView:canGoForward",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_webview_WebView_canGoForward'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_experimental_webview_WebView_loadFile(lua_State* tolua_S)
{
int argc = 0;
cocos2d::experimental::ui::WebView* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"ccexp.WebView",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::experimental::ui::WebView*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_webview_WebView_loadFile'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
std::string arg0;
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccexp.WebView:loadFile");
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_experimental_webview_WebView_loadFile'", nullptr);
return 0;
}
cobj->loadFile(arg0);
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccexp.WebView:loadFile",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_webview_WebView_loadFile'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_experimental_webview_WebView_stopLoading(lua_State* tolua_S)
{
int argc = 0;
cocos2d::experimental::ui::WebView* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"ccexp.WebView",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::experimental::ui::WebView*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_webview_WebView_stopLoading'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_experimental_webview_WebView_stopLoading'", nullptr);
return 0;
}
cobj->stopLoading();
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccexp.WebView:stopLoading",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_webview_WebView_stopLoading'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_experimental_webview_WebView_create(lua_State* tolua_S)
{
int argc = 0;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"ccexp.WebView",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_experimental_webview_WebView_create'", nullptr);
return 0;
}
cocos2d::experimental::ui::WebView* ret = cocos2d::experimental::ui::WebView::create();
object_to_luaval<cocos2d::experimental::ui::WebView>(tolua_S, "ccexp.WebView",(cocos2d::experimental::ui::WebView*)ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d\n ", "ccexp.WebView:create",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_webview_WebView_create'.",&tolua_err);
#endif
return 0;
}
static int lua_cocos2dx_experimental_webview_WebView_finalize(lua_State* tolua_S)
{
printf("luabindings: finalizing LUA object (WebView)");
return 0;
}
int lua_register_cocos2dx_experimental_webview_WebView(lua_State* tolua_S)
{
tolua_usertype(tolua_S,"ccexp.WebView");
tolua_cclass(tolua_S,"WebView","ccexp.WebView","ccui.Widget",nullptr);
tolua_beginmodule(tolua_S,"WebView");
tolua_function(tolua_S,"loadURL",lua_cocos2dx_experimental_webview_WebView_loadURL);
tolua_function(tolua_S,"canGoBack",lua_cocos2dx_experimental_webview_WebView_canGoBack);
tolua_function(tolua_S,"loadHTMLString",lua_cocos2dx_experimental_webview_WebView_loadHTMLString);
tolua_function(tolua_S,"goForward",lua_cocos2dx_experimental_webview_WebView_goForward);
tolua_function(tolua_S,"goBack",lua_cocos2dx_experimental_webview_WebView_goBack);
tolua_function(tolua_S,"setJavascriptInterfaceScheme",lua_cocos2dx_experimental_webview_WebView_setJavascriptInterfaceScheme);
tolua_function(tolua_S,"evaluateJS",lua_cocos2dx_experimental_webview_WebView_evaluateJS);
tolua_function(tolua_S,"getOnJSCallback",lua_cocos2dx_experimental_webview_WebView_getOnJSCallback);
tolua_function(tolua_S,"reload",lua_cocos2dx_experimental_webview_WebView_reload);
tolua_function(tolua_S,"setScalesPageToFit",lua_cocos2dx_experimental_webview_WebView_setScalesPageToFit);
tolua_function(tolua_S,"canGoForward",lua_cocos2dx_experimental_webview_WebView_canGoForward);
tolua_function(tolua_S,"loadFile",lua_cocos2dx_experimental_webview_WebView_loadFile);
tolua_function(tolua_S,"stopLoading",lua_cocos2dx_experimental_webview_WebView_stopLoading);
tolua_function(tolua_S,"create", lua_cocos2dx_experimental_webview_WebView_create);
tolua_endmodule(tolua_S);
std::string typeName = typeid(cocos2d::experimental::ui::WebView).name();
g_luaType[typeName] = "ccexp.WebView";
g_typeCast["WebView"] = "ccexp.WebView";
return 1;
}
TOLUA_API int register_all_cocos2dx_experimental_webview(lua_State* tolua_S)
{
tolua_open(tolua_S);
tolua_module(tolua_S,"ccexp",0);
tolua_beginmodule(tolua_S,"ccexp");
lua_register_cocos2dx_experimental_webview_WebView(tolua_S);
tolua_endmodule(tolua_S);
return 1;
}
#endif

View File

@ -0,0 +1,32 @@
#include "base/ccConfig.h"
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
#ifndef __cocos2dx_experimental_webview_h__
#define __cocos2dx_experimental_webview_h__
#ifdef __cplusplus
extern "C" {
#endif
#include "tolua++.h"
#ifdef __cplusplus
}
#endif
int register_all_cocos2dx_experimental_webview(lua_State* tolua_S);
#endif // __cocos2dx_experimental_webview_h__
#endif //#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS)

View File

@ -0,0 +1,190 @@
#include "lua_cocos2dx_experimental_video_manual.hpp"
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
#include "UIWebView.h"
#include "tolua_fix.h"
#include "LuaBasicConversions.h"
#include "CCLuaValue.h"
#include "CCLuaEngine.h"
static int lua_cocos2dx_experimental_WebView_setOnShouldStartLoading(lua_State* L)
{
int argc = 0;
cocos2d::experimental::ui::WebView* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"ccexp.WebView",0,&tolua_err)) goto tolua_lerror;
#endif
self = static_cast<cocos2d::experimental::ui::WebView*>(tolua_tousertype(L,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_experimental_WebView_setOnShouldStartLoading'\n", nullptr);
return 0;
}
#endif
argc = lua_gettop(L) - 1;
if (argc == 1)
{
#if COCOS2D_DEBUG >= 1
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err))
{
goto tolua_lerror;
}
#endif
LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0));
std::function<bool(experimental::ui::WebView *sender, const std::string &url)> callback = [L,handler](experimental::ui::WebView *sender, const std::string &url)->bool{
toluafix_pushusertype_ccobject(L, sender->_ID, &(sender->_luaID), (void*)sender,"ccexp.WebView");
tolua_pushcppstring(L, url);
return LuaEngine::getInstance()->getLuaStack()->executeFunctionByHandler(handler, 2);
};
ScriptHandlerMgr::getInstance()->addCustomHandler((void*)self, handler);
self->setOnShouldStartLoading(callback);
return 0;
}
luaL_error(L, "%s has wrong number of arguments: %d, was expecting %d\n ", "ccexp.WebView:setOnShouldStartLoading",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(L, "#ferror in function 'lua_cocos2dx_experimental_WebView_setOnShouldStartLoading'.", &tolua_err);
#endif
return 0;
}
static int lua_cocos2dx_experimental_WebView_setOnDidFinishLoading(lua_State* L)
{
int argc = 0;
cocos2d::experimental::ui::WebView* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"ccexp.WebView",0,&tolua_err)) goto tolua_lerror;
#endif
self = static_cast<cocos2d::experimental::ui::WebView*>(tolua_tousertype(L,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_experimental_WebView_setOnDidFinishLoading'\n", nullptr);
return 0;
}
#endif
argc = lua_gettop(L) - 1;
if (argc == 1)
{
#if COCOS2D_DEBUG >= 1
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err))
{
goto tolua_lerror;
}
#endif
LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0));
std::function<void(experimental::ui::WebView *sender, const std::string &url)> callback = [L,handler](experimental::ui::WebView *sender, const std::string &url){
toluafix_pushusertype_ccobject(L, sender->_ID, &(sender->_luaID), (void*)sender,"ccexp.WebView");
tolua_pushcppstring(L, url);
LuaEngine::getInstance()->getLuaStack()->executeFunctionByHandler(handler, 2);
};
ScriptHandlerMgr::getInstance()->addCustomHandler((void*)self, handler);
self->setOnDidFinishLoading(callback);
return 0;
}
luaL_error(L, "%s has wrong number of arguments: %d, was expecting %d\n ", "ccexp.WebView:setOnDidFinishLoading",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(L, "#ferror in function 'lua_cocos2dx_experimental_WebView_setOnDidFinishLoading'.", &tolua_err);
#endif
return 0;
}
static int lua_cocos2dx_experimental_WebView_setOnDidFailLoading(lua_State* L)
{
int argc = 0;
cocos2d::experimental::ui::WebView* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"ccexp.WebView",0,&tolua_err)) goto tolua_lerror;
#endif
self = static_cast<cocos2d::experimental::ui::WebView*>(tolua_tousertype(L,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_experimental_WebView_setOnDidFailLoading'\n", nullptr);
return 0;
}
#endif
argc = lua_gettop(L) - 1;
if (argc == 1)
{
#if COCOS2D_DEBUG >= 1
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err))
{
goto tolua_lerror;
}
#endif
LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0));
std::function<void(experimental::ui::WebView *sender, const std::string &url)> callback = [L,handler](experimental::ui::WebView *sender, const std::string &url){
toluafix_pushusertype_ccobject(L, sender->_ID, &(sender->_luaID), (void*)sender,"ccexp.WebView");
tolua_pushcppstring(L, url);
LuaEngine::getInstance()->getLuaStack()->executeFunctionByHandler(handler, 2);
};
ScriptHandlerMgr::getInstance()->addCustomHandler((void*)self, handler);
self->setOnDidFinishLoading(callback);
return 0;
}
luaL_error(L, "%s has wrong number of arguments: %d, was expecting %d\n ", "ccexp.WebView:setOnDidFailLoading",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(L, "#ferror in function 'lua_cocos2dx_experimental_WebView_setOnDidFailLoading'.", &tolua_err);
#endif
return 0;
}
static void extendWebView(lua_State* L)
{
lua_pushstring(L, "ccexp.WebView");
lua_rawget(L, LUA_REGISTRYINDEX);
if (lua_istable(L,-1))
{
tolua_function(L, "setOnShouldStartLoading", lua_cocos2dx_experimental_WebView_setOnShouldStartLoading);
tolua_function(L, "setOnDidFinishLoading", lua_cocos2dx_experimental_WebView_setOnDidFinishLoading);
tolua_function(L, "setOnDidFailLoading", lua_cocos2dx_experimental_WebView_setOnDidFailLoading);
}
lua_pop(L, 1);
}
int register_all_cocos2dx_experimental_webview_manual(lua_State* L)
{
if (nullptr == L)
return 0;
extendWebView(L);
return 0;
}
#endif

View File

@ -21,14 +21,21 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#include "base/ccConfig.h"
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
#include "UIShaders.h" #ifndef COCOS_SCRIPTING_LUA_BINDINGS_LUA_COCOS2DX_EXPERIMENTAL_WEBVIEW_MANUAL_H
#define COCOS_SCRIPTING_LUA_BINDINGS_LUA_COCOS2DX_EXPERIMENTAL_WEBVIEW_MANUAL_H
#define STRINGIFY(A) #A #ifdef __cplusplus
extern "C" {
#endif
#include "tolua++.h"
#ifdef __cplusplus
}
#endif
NS_CC_BEGIN TOLUA_API int register_all_cocos2dx_experimental_webview_manual(lua_State* L);
//include the gray scale shader #endif //#ifndef COCOS_SCRIPTING_LUA_BINDINGS_LUA_COCOS2DX_EXPERIMENTAL_WEBVIEW_MANUAL_H
#include "ccShader_grayscale.frag" #endif //#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
NS_CC_END

View File

@ -26,6 +26,8 @@
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
#include "lua_cocos2dx_experimental_video_auto.hpp" #include "lua_cocos2dx_experimental_video_auto.hpp"
#include "lua_cocos2dx_experimental_video_manual.hpp" #include "lua_cocos2dx_experimental_video_manual.hpp"
#include "lua_cocos2dx_experimental_webview_auto.hpp"
#include "lua_cocos2dx_experimental_webview_manual.hpp"
#endif #endif
#include "cocos2d.h" #include "cocos2d.h"
#include "tolua_fix.h" #include "tolua_fix.h"
@ -1045,6 +1047,8 @@ int register_ui_moudle(lua_State* L)
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
register_all_cocos2dx_experimental_video(L); register_all_cocos2dx_experimental_video(L);
register_all_cocos2dx_experimental_video_manual(L); register_all_cocos2dx_experimental_video_manual(L);
register_all_cocos2dx_experimental_webview(L);
register_all_cocos2dx_experimental_webview_manual(L);
#endif #endif
extendEventListenerFocusEvent(L); extendEventListenerFocusEvent(L);
} }

View File

@ -105,10 +105,12 @@ LOCAL_SRC_FILES += ../manual/spine/lua_cocos2dx_spine_manual.cpp \
../auto/lua_cocos2dx_spine_auto.cpp ../auto/lua_cocos2dx_spine_auto.cpp
#ui #ui
LOCAL_SRC_FILES += ../manual/ui/lua_cocos2dx_experimental_video_manual.cpp \ LOCAL_SRC_FILES += ../manual/ui/lua_cocos2dx_experimental_webview_manual.cpp \
../manual/ui/lua_cocos2dx_experimental_video_manual.cpp \
../manual/ui/lua_cocos2dx_ui_manual.cpp \ ../manual/ui/lua_cocos2dx_ui_manual.cpp \
../auto/lua_cocos2dx_experimental_video_auto.cpp \ ../auto/lua_cocos2dx_experimental_video_auto.cpp \
../auto/lua_cocos2dx_ui_auto.cpp ../auto/lua_cocos2dx_ui_auto.cpp \
../auto/lua_cocos2dx_experimental_webview_auto.cpp
#extension #extension
LOCAL_SRC_FILES += ../manual/extension/lua_cocos2dx_extension_manual.cpp \ LOCAL_SRC_FILES += ../manual/extension/lua_cocos2dx_extension_manual.cpp \

View File

@ -201,6 +201,10 @@
15C1C2EC19874CBE00A46ACC /* LuaBasicConversions.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AACE77F18BC45C200215002 /* LuaBasicConversions.h */; }; 15C1C2EC19874CBE00A46ACC /* LuaBasicConversions.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AACE77F18BC45C200215002 /* LuaBasicConversions.h */; };
15C1C2ED19874CBE00A46ACC /* CCLuaObjcBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AACE78E18BC45C200215002 /* CCLuaObjcBridge.h */; }; 15C1C2ED19874CBE00A46ACC /* CCLuaObjcBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AACE78E18BC45C200215002 /* CCLuaObjcBridge.h */; };
15C1C2EE19874CBE00A46ACC /* tolua_fix.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AACE7B418BC45C200215002 /* tolua_fix.h */; }; 15C1C2EE19874CBE00A46ACC /* tolua_fix.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AACE7B418BC45C200215002 /* tolua_fix.h */; };
15C9A10E1AE4972500C15443 /* lua_cocos2dx_experimental_webview_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15C9A10C1AE4972500C15443 /* lua_cocos2dx_experimental_webview_auto.cpp */; };
15C9A10F1AE4972500C15443 /* lua_cocos2dx_experimental_webview_auto.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 15C9A10D1AE4972500C15443 /* lua_cocos2dx_experimental_webview_auto.hpp */; };
15C9A1121AE4973400C15443 /* lua_cocos2dx_experimental_webview_manual.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15C9A1101AE4973400C15443 /* lua_cocos2dx_experimental_webview_manual.cpp */; };
15C9A1131AE4973400C15443 /* lua_cocos2dx_experimental_webview_manual.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 15C9A1111AE4973400C15443 /* lua_cocos2dx_experimental_webview_manual.hpp */; };
15EFA1F61989E528000C57D3 /* lua_cocos2dx_experimental_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15622967197780DE009C9067 /* lua_cocos2dx_experimental_auto.cpp */; }; 15EFA1F61989E528000C57D3 /* lua_cocos2dx_experimental_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15622967197780DE009C9067 /* lua_cocos2dx_experimental_auto.cpp */; };
15EFA1F71989E582000C57D3 /* lua_cocos2dx_experimental_auto.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 15622968197780DE009C9067 /* lua_cocos2dx_experimental_auto.hpp */; }; 15EFA1F71989E582000C57D3 /* lua_cocos2dx_experimental_auto.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 15622968197780DE009C9067 /* lua_cocos2dx_experimental_auto.hpp */; };
15EFA5D9198B2DAA000C57D3 /* libluajit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1ABCA1F318CD8F540087CE3A /* libluajit.a */; }; 15EFA5D9198B2DAA000C57D3 /* libluajit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1ABCA1F318CD8F540087CE3A /* libluajit.a */; };
@ -351,6 +355,10 @@
15C1C24F198747E400A46ACC /* LuaOpengl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LuaOpengl.cpp; sourceTree = "<group>"; }; 15C1C24F198747E400A46ACC /* LuaOpengl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LuaOpengl.cpp; sourceTree = "<group>"; };
15C1C250198747E400A46ACC /* LuaOpengl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LuaOpengl.h; sourceTree = "<group>"; }; 15C1C250198747E400A46ACC /* LuaOpengl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LuaOpengl.h; sourceTree = "<group>"; };
15C1C2CC198748D200A46ACC /* libluacocos2d Mac.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libluacocos2d Mac.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 15C1C2CC198748D200A46ACC /* libluacocos2d Mac.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libluacocos2d Mac.a"; sourceTree = BUILT_PRODUCTS_DIR; };
15C9A10C1AE4972500C15443 /* lua_cocos2dx_experimental_webview_auto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lua_cocos2dx_experimental_webview_auto.cpp; sourceTree = "<group>"; };
15C9A10D1AE4972500C15443 /* lua_cocos2dx_experimental_webview_auto.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = lua_cocos2dx_experimental_webview_auto.hpp; sourceTree = "<group>"; };
15C9A1101AE4973400C15443 /* lua_cocos2dx_experimental_webview_manual.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lua_cocos2dx_experimental_webview_manual.cpp; sourceTree = "<group>"; };
15C9A1111AE4973400C15443 /* lua_cocos2dx_experimental_webview_manual.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = lua_cocos2dx_experimental_webview_manual.hpp; sourceTree = "<group>"; };
15EFA401198B2AB2000C57D3 /* lua_cocos2dx_coco_studio_manual.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lua_cocos2dx_coco_studio_manual.cpp; sourceTree = "<group>"; }; 15EFA401198B2AB2000C57D3 /* lua_cocos2dx_coco_studio_manual.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lua_cocos2dx_coco_studio_manual.cpp; sourceTree = "<group>"; };
15EFA402198B2AB2000C57D3 /* lua_cocos2dx_coco_studio_manual.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = lua_cocos2dx_coco_studio_manual.hpp; sourceTree = "<group>"; }; 15EFA402198B2AB2000C57D3 /* lua_cocos2dx_coco_studio_manual.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = lua_cocos2dx_coco_studio_manual.hpp; sourceTree = "<group>"; };
15EFA616198B2DAA000C57D3 /* libluacocos2d iOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libluacocos2d iOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 15EFA616198B2DAA000C57D3 /* libluacocos2d iOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libluacocos2d iOS.a"; sourceTree = BUILT_PRODUCTS_DIR; };
@ -536,6 +544,8 @@
15C1BD191986526C00A46ACC /* ui */ = { 15C1BD191986526C00A46ACC /* ui */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
15C9A1101AE4973400C15443 /* lua_cocos2dx_experimental_webview_manual.cpp */,
15C9A1111AE4973400C15443 /* lua_cocos2dx_experimental_webview_manual.hpp */,
15C1C24B1987473200A46ACC /* lua_cocos2dx_experimental_video_manual.cpp */, 15C1C24B1987473200A46ACC /* lua_cocos2dx_experimental_video_manual.cpp */,
15C1C24C1987473200A46ACC /* lua_cocos2dx_experimental_video_manual.hpp */, 15C1C24C1987473200A46ACC /* lua_cocos2dx_experimental_video_manual.hpp */,
15C1BD1A1986526C00A46ACC /* lua_cocos2dx_ui_manual.cpp */, 15C1BD1A1986526C00A46ACC /* lua_cocos2dx_ui_manual.cpp */,
@ -562,6 +572,8 @@
1AACE74818BC45C200215002 /* auto */ = { 1AACE74818BC45C200215002 /* auto */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
15C9A10C1AE4972500C15443 /* lua_cocos2dx_experimental_webview_auto.cpp */,
15C9A10D1AE4972500C15443 /* lua_cocos2dx_experimental_webview_auto.hpp */,
159552381A25E1C5001E9FC9 /* lua_cocos2dx_csloader_auto.cpp */, 159552381A25E1C5001E9FC9 /* lua_cocos2dx_csloader_auto.cpp */,
159552391A25E1C5001E9FC9 /* lua_cocos2dx_csloader_auto.hpp */, 159552391A25E1C5001E9FC9 /* lua_cocos2dx_csloader_auto.hpp */,
3E2BDB0319C5E5FE0055CDCD /* lua_cocos2dx_audioengine_auto.cpp */, 3E2BDB0319C5E5FE0055CDCD /* lua_cocos2dx_audioengine_auto.cpp */,
@ -877,7 +889,9 @@
15EFA62C198B3220000C57D3 /* lua_cocos2dx_deprecated.h in Headers */, 15EFA62C198B3220000C57D3 /* lua_cocos2dx_deprecated.h in Headers */,
155C7E2919A71CE800F08B25 /* lua_cocos2dx_ui_manual.hpp in Headers */, 155C7E2919A71CE800F08B25 /* lua_cocos2dx_ui_manual.hpp in Headers */,
15EFA62D198B3220000C57D3 /* lua_cocos2dx_experimental_manual.hpp in Headers */, 15EFA62D198B3220000C57D3 /* lua_cocos2dx_experimental_manual.hpp in Headers */,
15C9A1131AE4973400C15443 /* lua_cocos2dx_experimental_webview_manual.hpp in Headers */,
15EFA62E198B3220000C57D3 /* lua_cocos2dx_manual.hpp in Headers */, 15EFA62E198B3220000C57D3 /* lua_cocos2dx_manual.hpp in Headers */,
15C9A10F1AE4972500C15443 /* lua_cocos2dx_experimental_webview_auto.hpp in Headers */,
15EFA62F198B3220000C57D3 /* lua_cocos2dx_physics_manual.hpp in Headers */, 15EFA62F198B3220000C57D3 /* lua_cocos2dx_physics_manual.hpp in Headers */,
155C7E0919A71C8500F08B25 /* lua_cocos2dx_extension_manual.h in Headers */, 155C7E0919A71C8500F08B25 /* lua_cocos2dx_extension_manual.h in Headers */,
155C7E1919A71CB500F08B25 /* lua_xml_http_request.h in Headers */, 155C7E1919A71CB500F08B25 /* lua_xml_http_request.h in Headers */,
@ -1064,6 +1078,7 @@
15EFA639198B328B000C57D3 /* tolua_fix.cpp in Sources */, 15EFA639198B328B000C57D3 /* tolua_fix.cpp in Sources */,
155C7DFF19A71C5C00F08B25 /* CCBProxy.cpp in Sources */, 155C7DFF19A71C5C00F08B25 /* CCBProxy.cpp in Sources */,
1595523B1A25E1C5001E9FC9 /* lua_cocos2dx_csloader_auto.cpp in Sources */, 1595523B1A25E1C5001E9FC9 /* lua_cocos2dx_csloader_auto.cpp in Sources */,
15C9A1121AE4973400C15443 /* lua_cocos2dx_experimental_webview_manual.cpp in Sources */,
155C7DF019A71C1E00F08B25 /* lua_cocos2dx_spine_auto.cpp in Sources */, 155C7DF019A71C1E00F08B25 /* lua_cocos2dx_spine_auto.cpp in Sources */,
155C7E0719A71C7800F08B25 /* lua_cocos2dx_extension_manual.cpp in Sources */, 155C7E0719A71C7800F08B25 /* lua_cocos2dx_extension_manual.cpp in Sources */,
15EFA625198B31FB000C57D3 /* LuaOpengl.cpp in Sources */, 15EFA625198B31FB000C57D3 /* LuaOpengl.cpp in Sources */,
@ -1087,6 +1102,7 @@
3E2BDB0519C5E5FE0055CDCD /* lua_cocos2dx_audioengine_auto.cpp in Sources */, 3E2BDB0519C5E5FE0055CDCD /* lua_cocos2dx_audioengine_auto.cpp in Sources */,
155C7E0B19A71C8D00F08B25 /* lua_cocos2dx_network_manual.cpp in Sources */, 155C7E0B19A71C8D00F08B25 /* lua_cocos2dx_network_manual.cpp in Sources */,
15415AAE19A71A53004F1E71 /* except.c in Sources */, 15415AAE19A71A53004F1E71 /* except.c in Sources */,
15C9A10E1AE4972500C15443 /* lua_cocos2dx_experimental_webview_auto.cpp in Sources */,
15415AAA19A71A53004F1E71 /* buffer.c in Sources */, 15415AAA19A71A53004F1E71 /* buffer.c in Sources */,
155C7E2319A71CD500F08B25 /* lua_cocos2dx_experimental_video_manual.cpp in Sources */, 155C7E2319A71CD500F08B25 /* lua_cocos2dx_experimental_video_manual.cpp in Sources */,
155C7DFB19A71C4E00F08B25 /* lua_cocos2dx_coco_studio_manual.cpp in Sources */, 155C7DFB19A71C4E00F08B25 /* lua_cocos2dx_coco_studio_manual.cpp in Sources */,

View File

@ -39,6 +39,7 @@
<ClCompile Include="..\auto\lua_cocos2dx_csloader_auto.cpp" /> <ClCompile Include="..\auto\lua_cocos2dx_csloader_auto.cpp" />
<ClCompile Include="..\auto\lua_cocos2dx_experimental_auto.cpp" /> <ClCompile Include="..\auto\lua_cocos2dx_experimental_auto.cpp" />
<ClCompile Include="..\auto\lua_cocos2dx_experimental_video_auto.cpp" /> <ClCompile Include="..\auto\lua_cocos2dx_experimental_video_auto.cpp" />
<ClCompile Include="..\auto\lua_cocos2dx_experimental_webview_auto.cpp" />
<ClCompile Include="..\auto\lua_cocos2dx_extension_auto.cpp" /> <ClCompile Include="..\auto\lua_cocos2dx_extension_auto.cpp" />
<ClCompile Include="..\auto\lua_cocos2dx_physics_auto.cpp" /> <ClCompile Include="..\auto\lua_cocos2dx_physics_auto.cpp" />
<ClCompile Include="..\auto\lua_cocos2dx_spine_auto.cpp" /> <ClCompile Include="..\auto\lua_cocos2dx_spine_auto.cpp" />
@ -74,6 +75,7 @@
<ClCompile Include="..\manual\spine\lua_cocos2dx_spine_manual.cpp" /> <ClCompile Include="..\manual\spine\lua_cocos2dx_spine_manual.cpp" />
<ClCompile Include="..\manual\tolua_fix.cpp" /> <ClCompile Include="..\manual\tolua_fix.cpp" />
<ClCompile Include="..\manual\ui\lua_cocos2dx_experimental_video_manual.cpp" /> <ClCompile Include="..\manual\ui\lua_cocos2dx_experimental_video_manual.cpp" />
<ClCompile Include="..\manual\ui\lua_cocos2dx_experimental_webview_manual.cpp" />
<ClCompile Include="..\manual\ui\lua_cocos2dx_ui_manual.cpp" /> <ClCompile Include="..\manual\ui\lua_cocos2dx_ui_manual.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -107,6 +109,7 @@
<ClInclude Include="..\auto\lua_cocos2dx_csloader_auto.hpp" /> <ClInclude Include="..\auto\lua_cocos2dx_csloader_auto.hpp" />
<ClInclude Include="..\auto\lua_cocos2dx_experimental_auto.hpp" /> <ClInclude Include="..\auto\lua_cocos2dx_experimental_auto.hpp" />
<ClInclude Include="..\auto\lua_cocos2dx_experimental_video_auto.hpp" /> <ClInclude Include="..\auto\lua_cocos2dx_experimental_video_auto.hpp" />
<ClInclude Include="..\auto\lua_cocos2dx_experimental_webview_auto.hpp" />
<ClInclude Include="..\auto\lua_cocos2dx_extension_auto.hpp" /> <ClInclude Include="..\auto\lua_cocos2dx_extension_auto.hpp" />
<ClInclude Include="..\auto\lua_cocos2dx_physics_auto.hpp" /> <ClInclude Include="..\auto\lua_cocos2dx_physics_auto.hpp" />
<ClInclude Include="..\auto\lua_cocos2dx_spine_auto.hpp" /> <ClInclude Include="..\auto\lua_cocos2dx_spine_auto.hpp" />
@ -142,6 +145,7 @@
<ClInclude Include="..\manual\spine\lua_cocos2dx_spine_manual.hpp" /> <ClInclude Include="..\manual\spine\lua_cocos2dx_spine_manual.hpp" />
<ClInclude Include="..\manual\tolua_fix.h" /> <ClInclude Include="..\manual\tolua_fix.h" />
<ClInclude Include="..\manual\ui\lua_cocos2dx_experimental_video_manual.hpp" /> <ClInclude Include="..\manual\ui\lua_cocos2dx_experimental_video_manual.hpp" />
<ClInclude Include="..\manual\ui\lua_cocos2dx_experimental_webview_manual.hpp" />
<ClInclude Include="..\manual\ui\lua_cocos2dx_ui_manual.hpp" /> <ClInclude Include="..\manual\ui\lua_cocos2dx_ui_manual.hpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -267,6 +267,12 @@
<ClCompile Include="..\manual\cocostudio\lua-cocos-studio-conversions.cpp"> <ClCompile Include="..\manual\cocostudio\lua-cocos-studio-conversions.cpp">
<Filter>manual\cocostudio</Filter> <Filter>manual\cocostudio</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\auto\lua_cocos2dx_experimental_webview_auto.cpp">
<Filter>auto</Filter>
</ClCompile>
<ClCompile Include="..\manual\ui\lua_cocos2dx_experimental_webview_manual.cpp">
<Filter>manual\ui</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\auto\lua_cocos2dx_auto.hpp"> <ClInclude Include="..\auto\lua_cocos2dx_auto.hpp">
@ -467,6 +473,12 @@
<ClInclude Include="..\manual\cocostudio\lua-cocos-studio-conversions.h"> <ClInclude Include="..\manual\cocostudio\lua-cocos-studio-conversions.h">
<Filter>manual\cocostudio</Filter> <Filter>manual\cocostudio</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\auto\lua_cocos2dx_experimental_webview_auto.hpp">
<Filter>auto</Filter>
</ClInclude>
<ClInclude Include="..\manual\ui\lua_cocos2dx_experimental_webview_manual.hpp">
<Filter>manual\ui</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="..\script\CCBReaderLoad.lua"> <None Include="..\script\CCBReaderLoad.lua">

View File

@ -36,7 +36,6 @@ UIWebViewImpl-android.cpp \
UIEditBox/UIEditBox.cpp \ UIEditBox/UIEditBox.cpp \
UIEditBox/UIEditBoxImpl-android.cpp \ UIEditBox/UIEditBoxImpl-android.cpp \
UILayoutComponent.cpp \ UILayoutComponent.cpp \
shaders/UIShaders.cpp \
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../editor-support LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../editor-support

View File

@ -49,7 +49,6 @@ set(COCOS_UI_SRC
ui/UIWidget.cpp ui/UIWidget.cpp
ui/UIEditBox/UIEditBox.cpp ui/UIEditBox/UIEditBox.cpp
ui/UILayoutComponent.cpp ui/UILayoutComponent.cpp
ui/shaders/UIShaders.cpp
${COCOS_UI_SPECIFIC_SRC} ${COCOS_UI_SPECIFIC_SRC}
) )

File diff suppressed because it is too large Load Diff

View File

@ -27,7 +27,7 @@
#include "platform/CCPlatformConfig.h" #include "platform/CCPlatformConfig.h"
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS )
#include "ui/UIWidget.h" #include "ui/UIWidget.h"

View File

@ -34,16 +34,15 @@ THE SOFTWARE.
#include "renderer/CCGLProgram.h" #include "renderer/CCGLProgram.h"
#include "renderer/CCGLProgramState.h" #include "renderer/CCGLProgramState.h"
#include "renderer/ccShaders.h" #include "renderer/ccShaders.h"
#include "ui/shaders/UIShaders.h"
NS_CC_BEGIN NS_CC_BEGIN
namespace ui { namespace ui {
class Widget::FocusNavigationController class Widget::FocusNavigationController
{ {
void enableFocusNavigation(bool flag); void enableFocusNavigation(bool flag);
FocusNavigationController(): FocusNavigationController():
_keyboardListener(nullptr), _keyboardListener(nullptr),
_firstFocusedWidget(nullptr), _firstFocusedWidget(nullptr),
@ -55,12 +54,12 @@ class Widget::FocusNavigationController
~FocusNavigationController(); ~FocusNavigationController();
protected: protected:
void setFirstFocsuedWidget(Widget* widget); void setFirstFocsuedWidget(Widget* widget);
void onKeypadKeyPressed(EventKeyboard::KeyCode, Event*); void onKeypadKeyPressed(EventKeyboard::KeyCode, Event*);
void addKeyboardEventListener(); void addKeyboardEventListener();
void removeKeyboardEventListener(); void removeKeyboardEventListener();
friend class Widget; friend class Widget;
private: private:
EventListenerKeyboard* _keyboardListener ; EventListenerKeyboard* _keyboardListener ;
@ -68,7 +67,7 @@ private:
bool _enableFocusNavigation ; bool _enableFocusNavigation ;
const int _keyboardEventPriority; const int _keyboardEventPriority;
}; };
Widget::FocusNavigationController::~FocusNavigationController() Widget::FocusNavigationController::~FocusNavigationController()
{ {
this->removeKeyboardEventListener(); this->removeKeyboardEventListener();
@ -101,9 +100,9 @@ void Widget::FocusNavigationController::enableFocusNavigation(bool flag)
{ {
if (_enableFocusNavigation == flag) if (_enableFocusNavigation == flag)
return; return;
_enableFocusNavigation = flag; _enableFocusNavigation = flag;
if (flag) if (flag)
this->addKeyboardEventListener(); this->addKeyboardEventListener();
else else
@ -138,7 +137,7 @@ void Widget::FocusNavigationController::removeKeyboardEventListener()
Widget* Widget::_focusedWidget = nullptr; Widget* Widget::_focusedWidget = nullptr;
Widget::FocusNavigationController* Widget::_focusNavigationController = nullptr; Widget::FocusNavigationController* Widget::_focusNavigationController = nullptr;
Widget::Widget(): Widget::Widget():
_usingLayoutComponent(false), _usingLayoutComponent(false),
_unifySize(false), _unifySize(false),
@ -167,7 +166,7 @@ _ccEventCallback(nullptr),
_callbackType(""), _callbackType(""),
_callbackName("") _callbackName("")
{ {
} }
Widget::~Widget() Widget::~Widget()
@ -180,7 +179,7 @@ void Widget::cleanupWidget()
//clean up _touchListener //clean up _touchListener
_eventDispatcher->removeEventListener(_touchListener); _eventDispatcher->removeEventListener(_touchListener);
CC_SAFE_RELEASE_NULL(_touchListener); CC_SAFE_RELEASE_NULL(_touchListener);
//cleanup focused widget and focus navigation controller //cleanup focused widget and focus navigation controller
if (_focusedWidget == this) if (_focusedWidget == this)
{ {
@ -214,7 +213,7 @@ bool Widget::init()
this->setAnchorPoint(Vec2(0.5f, 0.5f)); this->setAnchorPoint(Vec2(0.5f, 0.5f));
ignoreContentAdaptWithSize(true); ignoreContentAdaptWithSize(true);
return true; return true;
} }
return false; return false;
@ -251,11 +250,11 @@ void Widget::setEnabled(bool enabled)
{ {
_enabled = enabled; _enabled = enabled;
} }
void Widget::initRenderer() void Widget::initRenderer()
{ {
} }
LayoutComponent* Widget::getOrCreateLayoutComponent() LayoutComponent* Widget::getOrCreateLayoutComponent()
{ {
auto layoutComponent = this->getComponent(__LAYOUT_COMPONENT_NAME); auto layoutComponent = this->getComponent(__LAYOUT_COMPONENT_NAME);
@ -265,14 +264,14 @@ LayoutComponent* Widget::getOrCreateLayoutComponent()
this->addComponent(component); this->addComponent(component);
layoutComponent = component; layoutComponent = component;
} }
return (LayoutComponent*)layoutComponent; return (LayoutComponent*)layoutComponent;
} }
void Widget::setContentSize(const cocos2d::Size &contentSize) void Widget::setContentSize(const cocos2d::Size &contentSize)
{ {
ProtectedNode::setContentSize(contentSize); ProtectedNode::setContentSize(contentSize);
_customSize = contentSize; _customSize = contentSize;
if (_unifySize) if (_unifySize)
{ {
@ -354,10 +353,10 @@ void Widget::setSizePercent(const Vec2 &percent)
void Widget::updateSizeAndPosition() void Widget::updateSizeAndPosition()
{ {
Size pSize = _parent->getContentSize(); Size pSize = _parent->getContentSize();
updateSizeAndPosition(pSize); updateSizeAndPosition(pSize);
} }
void Widget::updateSizeAndPosition(const cocos2d::Size &parentSize) void Widget::updateSizeAndPosition(const cocos2d::Size &parentSize)
{ {
switch (_sizeType) switch (_sizeType)
@ -402,7 +401,7 @@ void Widget::updateSizeAndPosition(const cocos2d::Size &parentSize)
default: default:
break; break;
} }
//update position & position percent //update position & position percent
Vec2 absPos = getPosition(); Vec2 absPos = getPosition();
switch (_positionType) switch (_positionType)
@ -433,7 +432,7 @@ void Widget::updateSizeAndPosition(const cocos2d::Size &parentSize)
void Widget::setSizeType(SizeType type) void Widget::setSizeType(SizeType type)
{ {
_sizeType = type; _sizeType = type;
if (_usingLayoutComponent) if (_usingLayoutComponent)
{ {
auto component = this->getOrCreateLayoutComponent(); auto component = this->getOrCreateLayoutComponent();
@ -485,7 +484,7 @@ const Size& Widget::getSize() const
{ {
return this->getContentSize(); return this->getContentSize();
} }
const Size& Widget::getCustomSize() const const Size& Widget::getCustomSize() const
{ {
return _customSize; return _customSize;
@ -531,7 +530,7 @@ Size Widget::getVirtualRendererSize() const
{ {
return _contentSize; return _contentSize;
} }
void Widget::updateContentSizeWithTextureSize(const cocos2d::Size &size) void Widget::updateContentSizeWithTextureSize(const cocos2d::Size &size)
{ {
if (_unifySize) if (_unifySize)
@ -656,21 +655,21 @@ void Widget::onPressStateChangedToDisabled()
{ {
} }
void Widget::updateChildrenDisplayedRGBA() void Widget::updateChildrenDisplayedRGBA()
{ {
this->setColor(this->getColor()); this->setColor(this->getColor());
this->setOpacity(this->getOpacity()); this->setOpacity(this->getOpacity());
} }
Widget* Widget::getAncensterWidget(Node* node) Widget* Widget::getAncensterWidget(Node* node)
{ {
if (nullptr == node) if (nullptr == node)
{ {
return nullptr; return nullptr;
} }
Node* parent = node->getParent(); Node* parent = node->getParent();
if (nullptr == parent) if (nullptr == parent)
{ {
@ -686,7 +685,7 @@ Widget* Widget::getAncensterWidget(Node* node)
return this->getAncensterWidget(parent->getParent()); return this->getAncensterWidget(parent->getParent());
} }
} }
bool Widget::isAncestorsVisible(Node* node) bool Widget::isAncestorsVisible(Node* node)
{ {
if (nullptr == node) if (nullptr == node)
@ -694,14 +693,14 @@ bool Widget::isAncestorsVisible(Node* node)
return true; return true;
} }
Node* parent = node->getParent(); Node* parent = node->getParent();
if (parent && !parent->isVisible()) if (parent && !parent->isVisible())
{ {
return false; return false;
} }
return this->isAncestorsVisible(parent); return this->isAncestorsVisible(parent);
} }
bool Widget::isAncestorsEnabled() bool Widget::isAncestorsEnabled()
{ {
Widget* parentWidget = this->getAncensterWidget(this); Widget* parentWidget = this->getAncensterWidget(this);
@ -713,20 +712,20 @@ bool Widget::isAncestorsEnabled()
{ {
return false; return false;
} }
return parentWidget->isAncestorsEnabled(); return parentWidget->isAncestorsEnabled();
} }
void Widget::setPropagateTouchEvents(bool isPropagate) void Widget::setPropagateTouchEvents(bool isPropagate)
{ {
_propagateTouchEvents = isPropagate; _propagateTouchEvents = isPropagate;
} }
bool Widget::isPropagateTouchEvents()const bool Widget::isPropagateTouchEvents()const
{ {
return _propagateTouchEvents; return _propagateTouchEvents;
} }
void Widget::setSwallowTouches(bool swallow) void Widget::setSwallowTouches(bool swallow)
{ {
if (_touchListener) if (_touchListener)
@ -734,7 +733,7 @@ void Widget::setSwallowTouches(bool swallow)
_touchListener->setSwallowTouches(swallow); _touchListener->setSwallowTouches(swallow);
} }
} }
bool Widget::isSwallowTouches()const bool Widget::isSwallowTouches()const
{ {
if (_touchListener) if (_touchListener)
@ -760,7 +759,7 @@ bool Widget::onTouchBegan(Touch *touch, Event *unusedEvent)
return false; return false;
} }
setHighlighted(true); setHighlighted(true);
/* /*
* Propagate touch events to its parents * Propagate touch events to its parents
*/ */
@ -768,11 +767,11 @@ bool Widget::onTouchBegan(Touch *touch, Event *unusedEvent)
{ {
this->propagateTouchEvent(TouchEventType::BEGAN, this, touch); this->propagateTouchEvent(TouchEventType::BEGAN, this, touch);
} }
pushDownEvent(); pushDownEvent();
return true; return true;
} }
void Widget::propagateTouchEvent(cocos2d::ui::Widget::TouchEventType event, cocos2d::ui::Widget *sender, cocos2d::Touch *touch) void Widget::propagateTouchEvent(cocos2d::ui::Widget::TouchEventType event, cocos2d::ui::Widget *sender, cocos2d::Touch *touch)
{ {
Widget* widgetParent = getWidgetParent(); Widget* widgetParent = getWidgetParent();
@ -785,9 +784,9 @@ void Widget::propagateTouchEvent(cocos2d::ui::Widget::TouchEventType event, coco
void Widget::onTouchMoved(Touch *touch, Event *unusedEvent) void Widget::onTouchMoved(Touch *touch, Event *unusedEvent)
{ {
_touchMovePosition = touch->getLocation(); _touchMovePosition = touch->getLocation();
setHighlighted(hitTest(_touchMovePosition)); setHighlighted(hitTest(_touchMovePosition));
/* /*
* Propagate touch events to its parents * Propagate touch events to its parents
*/ */
@ -795,14 +794,14 @@ void Widget::onTouchMoved(Touch *touch, Event *unusedEvent)
{ {
this->propagateTouchEvent(TouchEventType::MOVED, this, touch); this->propagateTouchEvent(TouchEventType::MOVED, this, touch);
} }
moveEvent(); moveEvent();
} }
void Widget::onTouchEnded(Touch *touch, Event *unusedEvent) void Widget::onTouchEnded(Touch *touch, Event *unusedEvent)
{ {
_touchEndPosition = touch->getLocation(); _touchEndPosition = touch->getLocation();
/* /*
* Propagate touch events to its parents * Propagate touch events to its parents
*/ */
@ -810,10 +809,10 @@ void Widget::onTouchEnded(Touch *touch, Event *unusedEvent)
{ {
this->propagateTouchEvent(TouchEventType::ENDED, this, touch); this->propagateTouchEvent(TouchEventType::ENDED, this, touch);
} }
bool highlight = _highlight; bool highlight = _highlight;
setHighlighted(false); setHighlighted(false);
if (highlight) if (highlight)
{ {
releaseUpEvent(); releaseUpEvent();
@ -837,7 +836,7 @@ void Widget::pushDownEvent()
{ {
_touchEventCallback(this, TouchEventType::BEGAN); _touchEventCallback(this, TouchEventType::BEGAN);
} }
if (_touchEventListener && _touchEventSelector) if (_touchEventListener && _touchEventSelector)
{ {
(_touchEventListener->*_touchEventSelector)(this,TOUCH_EVENT_BEGAN); (_touchEventListener->*_touchEventSelector)(this,TOUCH_EVENT_BEGAN);
@ -852,7 +851,7 @@ void Widget::moveEvent()
{ {
_touchEventCallback(this, TouchEventType::MOVED); _touchEventCallback(this, TouchEventType::MOVED);
} }
if (_touchEventListener && _touchEventSelector) if (_touchEventListener && _touchEventSelector)
{ {
(_touchEventListener->*_touchEventSelector)(this,TOUCH_EVENT_MOVED); (_touchEventListener->*_touchEventSelector)(this,TOUCH_EVENT_MOVED);
@ -867,12 +866,12 @@ void Widget::releaseUpEvent()
{ {
_touchEventCallback(this, TouchEventType::ENDED); _touchEventCallback(this, TouchEventType::ENDED);
} }
if (_touchEventListener && _touchEventSelector) if (_touchEventListener && _touchEventSelector)
{ {
(_touchEventListener->*_touchEventSelector)(this,TOUCH_EVENT_ENDED); (_touchEventListener->*_touchEventSelector)(this,TOUCH_EVENT_ENDED);
} }
if (_clickEventListener) { if (_clickEventListener) {
_clickEventListener(this); _clickEventListener(this);
} }
@ -886,7 +885,7 @@ void Widget::cancelUpEvent()
{ {
_touchEventCallback(this, TouchEventType::CANCELED); _touchEventCallback(this, TouchEventType::CANCELED);
} }
if (_touchEventListener && _touchEventSelector) if (_touchEventListener && _touchEventSelector)
{ {
(_touchEventListener->*_touchEventSelector)(this,TOUCH_EVENT_CANCELED); (_touchEventListener->*_touchEventSelector)(this,TOUCH_EVENT_CANCELED);
@ -899,17 +898,17 @@ void Widget::addTouchEventListener(Ref *target, SEL_TouchEvent selector)
_touchEventListener = target; _touchEventListener = target;
_touchEventSelector = selector; _touchEventSelector = selector;
} }
void Widget::addTouchEventListener(const ccWidgetTouchCallback& callback) void Widget::addTouchEventListener(const ccWidgetTouchCallback& callback)
{ {
this->_touchEventCallback = callback; this->_touchEventCallback = callback;
} }
void Widget::addClickEventListener(const ccWidgetClickCallback &callback) void Widget::addClickEventListener(const ccWidgetClickCallback &callback)
{ {
this->_clickEventListener = callback; this->_clickEventListener = callback;
} }
void Widget::addCCSEventListener(const ccWidgetEventCallback &callback) void Widget::addCCSEventListener(const ccWidgetEventCallback &callback)
{ {
this->_ccEventCallback = callback; this->_ccEventCallback = callback;
@ -1122,7 +1121,7 @@ LayoutParameter* Widget::getLayoutParameter()const
{ {
return dynamic_cast<LayoutParameter*>(_layoutParameterDictionary.at((int)_layoutParameterType)); return dynamic_cast<LayoutParameter*>(_layoutParameterDictionary.at((int)_layoutParameterType));
} }
LayoutParameter* Widget::getLayoutParameter(LayoutParameter::Type type) LayoutParameter* Widget::getLayoutParameter(LayoutParameter::Type type)
{ {
return dynamic_cast<LayoutParameter*>(_layoutParameterDictionary.at((int)type)); return dynamic_cast<LayoutParameter*>(_layoutParameterDictionary.at((int)type));
@ -1159,7 +1158,7 @@ void Widget::copyClonedWidgetChildren(Widget* model)
} }
} }
} }
GLProgramState* Widget::getNormalGLProgramState()const GLProgramState* Widget::getNormalGLProgramState()const
{ {
GLProgramState *glState = nullptr; GLProgramState *glState = nullptr;
@ -1169,9 +1168,8 @@ GLProgramState* Widget::getNormalGLProgramState()const
GLProgramState* Widget::getGrayGLProgramState()const GLProgramState* Widget::getGrayGLProgramState()const
{ {
auto program = GLProgram::createWithByteArrays(ccPositionTextureColor_noMVP_vert, GLProgramState *glState = nullptr;
ccUIGrayScale_frag); glState = GLProgramState::getOrCreateWithGLProgramName(GLProgram::SHADER_NAME_POSITION_GRAYSCALE);
GLProgramState *glState = GLProgramState::getOrCreateWithGLProgram(program);
return glState; return glState;
} }
@ -1215,7 +1213,7 @@ void Widget::copyProperties(Widget *widget)
_focused = widget->_focused; _focused = widget->_focused;
_focusEnabled = widget->_focusEnabled; _focusEnabled = widget->_focusEnabled;
_propagateTouchEvents = widget->_propagateTouchEvents; _propagateTouchEvents = widget->_propagateTouchEvents;
copySpecialProperties(widget); copySpecialProperties(widget);
Map<int, LayoutParameter*>& layoutParameterDic = widget->_layoutParameterDictionary; Map<int, LayoutParameter*>& layoutParameterDic = widget->_layoutParameterDictionary;
@ -1224,24 +1222,24 @@ void Widget::copyProperties(Widget *widget)
setLayoutParameter(iter->second->clone()); setLayoutParameter(iter->second->clone());
} }
} }
void Widget::setFlippedX(bool flippedX) void Widget::setFlippedX(bool flippedX)
{ {
float realScale = this->getScaleX(); float realScale = this->getScaleX();
_flippedX = flippedX; _flippedX = flippedX;
this->setScaleX(realScale); this->setScaleX(realScale);
} }
void Widget::setFlippedY(bool flippedY) void Widget::setFlippedY(bool flippedY)
{ {
float realScale = this->getScaleY(); float realScale = this->getScaleY();
_flippedY = flippedY; _flippedY = flippedY;
this->setScaleY(realScale); this->setScaleY(realScale);
} }
void Widget::setScaleX(float scaleX) void Widget::setScaleX(float scaleX)
{ {
if (_flippedX) { if (_flippedX) {
@ -1249,7 +1247,7 @@ void Widget::copyProperties(Widget *widget)
} }
Node::setScaleX(scaleX); Node::setScaleX(scaleX);
} }
void Widget::setScaleY(float scaleY) void Widget::setScaleY(float scaleY)
{ {
if (_flippedY) { if (_flippedY) {
@ -1257,20 +1255,20 @@ void Widget::copyProperties(Widget *widget)
} }
Node::setScaleY(scaleY); Node::setScaleY(scaleY);
} }
void Widget::setScale(float scale) void Widget::setScale(float scale)
{ {
this->setScaleX(scale); this->setScaleX(scale);
this->setScaleY(scale); this->setScaleY(scale);
this->setScaleZ(scale); this->setScaleZ(scale);
} }
void Widget::setScale(float scaleX, float scaleY) void Widget::setScale(float scaleX, float scaleY)
{ {
this->setScaleX(scaleX); this->setScaleX(scaleX);
this->setScaleY(scaleY); this->setScaleY(scaleY);
} }
float Widget::getScaleX()const float Widget::getScaleX()const
{ {
float originalScale = Node::getScaleX(); float originalScale = Node::getScaleX();
@ -1280,7 +1278,7 @@ void Widget::copyProperties(Widget *widget)
} }
return originalScale; return originalScale;
} }
float Widget::getScaleY()const float Widget::getScaleY()const
{ {
float originalScale = Node::getScaleY(); float originalScale = Node::getScaleY();
@ -1290,7 +1288,7 @@ void Widget::copyProperties(Widget *widget)
} }
return originalScale; return originalScale;
} }
float Widget::getScale()const float Widget::getScale()const
{ {
CCASSERT(this->getScaleX() == this->getScaleY(), ""); CCASSERT(this->getScaleX() == this->getScaleY(), "");
@ -1308,11 +1306,11 @@ int Widget::getActionTag()const
{ {
return _actionTag; return _actionTag;
} }
void Widget::setFocused(bool focus) void Widget::setFocused(bool focus)
{ {
_focused = focus; _focused = focus;
//make sure there is only one focusedWidget //make sure there is only one focusedWidget
if (focus) { if (focus) {
_focusedWidget = this; _focusedWidget = this;
@ -1320,7 +1318,7 @@ void Widget::setFocused(bool focus)
_focusNavigationController->setFirstFocsuedWidget(this); _focusNavigationController->setFirstFocsuedWidget(this);
} }
} }
} }
bool Widget::isFocused()const bool Widget::isFocused()const
@ -1344,7 +1342,7 @@ Widget* Widget::findNextFocusedWidget(FocusDirection direction, Widget* current
if (this->isFocused() || dynamic_cast<Layout*>(current)) if (this->isFocused() || dynamic_cast<Layout*>(current))
{ {
Node* parent = this->getParent(); Node* parent = this->getParent();
Layout* layout = dynamic_cast<Layout*>(parent); Layout* layout = dynamic_cast<Layout*>(parent);
if (nullptr == layout) if (nullptr == layout)
{ {
@ -1381,25 +1379,25 @@ void Widget::dispatchFocusEvent(cocos2d::ui::Widget *widgetLoseFocus, cocos2d::u
{ {
widgetLoseFocus = _focusedWidget; widgetLoseFocus = _focusedWidget;
} }
if (widgetGetFocus != widgetLoseFocus) if (widgetGetFocus != widgetLoseFocus)
{ {
if (widgetGetFocus) if (widgetGetFocus)
{ {
widgetGetFocus->onFocusChanged(widgetLoseFocus, widgetGetFocus); widgetGetFocus->onFocusChanged(widgetLoseFocus, widgetGetFocus);
} }
if (widgetLoseFocus) if (widgetLoseFocus)
{ {
widgetLoseFocus->onFocusChanged(widgetLoseFocus, widgetGetFocus); widgetLoseFocus->onFocusChanged(widgetLoseFocus, widgetGetFocus);
} }
EventFocus event(widgetLoseFocus, widgetGetFocus); EventFocus event(widgetLoseFocus, widgetGetFocus);
auto dispatcher = cocos2d::Director::getInstance()->getEventDispatcher(); auto dispatcher = cocos2d::Director::getInstance()->getEventDispatcher();
dispatcher->dispatchEvent(&event); dispatcher->dispatchEvent(&event);
} }
} }
void Widget::requestFocus() void Widget::requestFocus()
@ -1408,10 +1406,10 @@ void Widget::requestFocus()
{ {
return; return;
} }
this->dispatchFocusEvent(_focusedWidget, this); this->dispatchFocusEvent(_focusedWidget, this);
} }
void Widget::onFocusChange(Widget* widgetLostFocus, Widget* widgetGetFocus) void Widget::onFocusChange(Widget* widgetLostFocus, Widget* widgetGetFocus)
{ {
//only change focus when there is indeed a get&lose happens //only change focus when there is indeed a get&lose happens
@ -1419,7 +1417,7 @@ void Widget::onFocusChange(Widget* widgetLostFocus, Widget* widgetGetFocus)
{ {
widgetLostFocus->setFocused(false); widgetLostFocus->setFocused(false);
} }
if (widgetGetFocus) if (widgetGetFocus)
{ {
widgetGetFocus->setFocused(true); widgetGetFocus->setFocused(true);
@ -1448,7 +1446,7 @@ void Widget::enableDpadNavigation(bool enable)
{ {
CC_SAFE_DELETE(_focusNavigationController); CC_SAFE_DELETE(_focusNavigationController);
} }
if (nullptr != _focusNavigationController) if (nullptr != _focusNavigationController)
{ {
_focusNavigationController->enableFocusNavigation(enable); _focusNavigationController->enableFocusNavigation(enable);

View File

@ -1,37 +0,0 @@
/****************************************************************************
Copyright (c) 2013-2014 Chukong Technologies Inc.
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 __UISHADERS_H__
#define __UISHADERS_H__
#include "platform/CCGL.h"
#include "platform/CCPlatformMacros.h"
NS_CC_BEGIN
extern CC_DLL const GLchar * ccUIGrayScale_frag;
NS_CC_END
#endif /* __UISHADERS_H__ */

View File

@ -30,8 +30,7 @@
NS_CC_BEGIN NS_CC_BEGIN
Particle3D::Particle3D() Particle3D::Particle3D()
: position(Vec3::ZERO) : color(Vec4::ONE)
, color(Vec4::ONE)
, rt_uv(Vec2::ONE) , rt_uv(Vec2::ONE)
, width(1.0f) , width(1.0f)
, height(1.0f) , height(1.0f)

View File

@ -36,7 +36,6 @@ const PUBaseForceAffector::ForceApplication PUBaseForceAffector::DEFAULT_FORCE_A
PUBaseForceAffector::PUBaseForceAffector() PUBaseForceAffector::PUBaseForceAffector()
: PUAffector() : PUAffector()
, _forceVector(DEFAULT_FORCE_VECTOR) , _forceVector(DEFAULT_FORCE_VECTOR)
, _scaledVector(Vec3::ZERO)
, _forceApplication(DEFAULT_FORCE_APPL) , _forceApplication(DEFAULT_FORCE_APPL)
{ {
} }

View File

@ -45,7 +45,6 @@ PUBoxCollider::PUBoxCollider() :
_ymax(0.0f), _ymax(0.0f),
_zmin(0.0f), _zmin(0.0f),
_zmax(0.0f), _zmax(0.0f),
_predictedPosition(Vec3::ZERO),
_innerCollision(false) _innerCollision(false)
{ {
} }

View File

@ -72,7 +72,6 @@ _dynParticleAllDimensionsSet(false),
_dynParticleWidthSet(false), _dynParticleWidthSet(false),
_dynParticleHeightSet(false), _dynParticleHeightSet(false),
_dynParticleDepthSet(false), _dynParticleDepthSet(false),
_upVector(Vec3::ZERO),
_remainder(0), _remainder(0),
_durationRemain(0), _durationRemain(0),
_dynDurationSet(false), _dynDurationSet(false),

View File

@ -30,8 +30,6 @@ NS_CC_BEGIN
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
PUFlockCenteringAffector::PUFlockCenteringAffector() PUFlockCenteringAffector::PUFlockCenteringAffector()
: PUAffector(), : PUAffector(),
_sum(Vec3::ZERO),
_average(Vec3::ZERO),
_count(0.0f) _count(0.0f)
{ {
} }

View File

@ -159,7 +159,6 @@ PUForceField::PUForceField(void) :
_worldSize(PUForceFieldCalculationFactory::DEFAULT_WORLDSIZE), _worldSize(PUForceFieldCalculationFactory::DEFAULT_WORLDSIZE),
_forceFieldSize(64), _forceFieldSize(64),
_forceFieldCalculationFactory(0), _forceFieldCalculationFactory(0),
_forceFieldPositionBase(Vec3::ZERO),
_forceFieldType(FF_REALTIME_CALC) _forceFieldType(FF_REALTIME_CALC)
{ {
} }

View File

@ -45,9 +45,7 @@ public:
_frequency(1.0f), _frequency(1.0f),
_amplitude(1.0f), _amplitude(1.0f),
_persistence(1.0f), _persistence(1.0f),
_mapScale(Vec3::ZERO), _worldSize(DEFAULT_WORLDSIZE)
_worldSize(DEFAULT_WORLDSIZE),
_mappedPosition(Vec3::ZERO)
{ {
}; };
virtual ~PUForceFieldCalculationFactory(void){}; virtual ~PUForceFieldCalculationFactory(void){};

View File

@ -45,7 +45,6 @@ const float PUForceFieldAffector::DEFAULT_MOVEMENT_FREQUENCY = 5.0f;
PUForceFieldAffector::PUForceFieldAffector() : PUForceFieldAffector::PUForceFieldAffector() :
_forceFieldType(PUForceField::FF_REALTIME_CALC), _forceFieldType(PUForceField::FF_REALTIME_CALC),
_delta(DEFAULT_DELTA), _delta(DEFAULT_DELTA),
_force(Vec3::ZERO),
_scaleForce(DEFAULT_FORCE), _scaleForce(DEFAULT_FORCE),
_octaves(DEFAULT_OCTAVES), _octaves(DEFAULT_OCTAVES),
_frequency(DEFAULT_FREQUENCY), _frequency(DEFAULT_FREQUENCY),
@ -61,8 +60,6 @@ PUForceFieldAffector::PUForceFieldAffector() :
_movementSet(false), _movementSet(false),
_movementFrequency(DEFAULT_MOVEMENT_FREQUENCY), _movementFrequency(DEFAULT_MOVEMENT_FREQUENCY),
_movementFrequencyCount(0.0f), _movementFrequencyCount(0.0f),
_displacement(Vec3::ZERO),
_basePosition(Vec3::ZERO),
_suppressGeneration(false) _suppressGeneration(false)
{ {
}; };

View File

@ -38,7 +38,6 @@ const float PULineEmitter::DEFAULT_MAX_DEVIATION = 0.0f;
PULineEmitter::PULineEmitter(void) : PULineEmitter::PULineEmitter(void) :
PUEmitter(), PUEmitter(),
_end(DEFAULT_END), _end(DEFAULT_END),
_perpendicular(Vec3::ZERO),
_maxDeviation(DEFAULT_MAX_DEVIATION), _maxDeviation(DEFAULT_MAX_DEVIATION),
_minIncrement(DEFAULT_MIN_INCREMENT), _minIncrement(DEFAULT_MIN_INCREMENT),
_maxIncrement(DEFAULT_MAX_INCREMENT), _maxIncrement(DEFAULT_MAX_INCREMENT),
@ -46,7 +45,6 @@ PULineEmitter::PULineEmitter(void) :
_length(0.0f), _length(0.0f),
_incrementsLeft(true), _incrementsLeft(true),
_first(true), _first(true),
_scaledEnd(Vec3::ZERO),
_scaledMaxDeviation(0.0f), _scaledMaxDeviation(0.0f),
_scaledMinIncrement(0.0f), _scaledMinIncrement(0.0f),
_scaledMaxIncrement(0.0f), _scaledMaxIncrement(0.0f),

View File

@ -37,7 +37,6 @@ PUParticleFollower::PUParticleFollower(void) :
PUAffector(), PUAffector(),
_minDistance(DEFAULT_MIN_DISTANCE), _minDistance(DEFAULT_MIN_DISTANCE),
_maxDistance(DEFAULT_MAX_DISTANCE), _maxDistance(DEFAULT_MAX_DISTANCE),
_positionPreviousParticle(Vec3::ZERO),
_first(false) _first(false)
{ {
} }

View File

@ -109,20 +109,15 @@ void PUParticle3D::process( float timeElapsed )
} }
PUParticle3D::PUParticle3D(): PUParticle3D::PUParticle3D():
//position(Vec3::ZERO),
particleEntityPtr(nullptr), particleEntityPtr(nullptr),
visualData(nullptr), visualData(nullptr),
particleType(PT_VISUAL), particleType(PT_VISUAL),
direction(Vec3::ZERO),
timeToLive(DEFAULT_TTL), timeToLive(DEFAULT_TTL),
totalTimeToLive(DEFAULT_TTL), totalTimeToLive(DEFAULT_TTL),
timeFraction(0.0f), timeFraction(0.0f),
mass(DEFAULT_MASS), mass(DEFAULT_MASS),
eventFlags(0), eventFlags(0),
freezed(false), freezed(false),
originalPosition(Vec3::ZERO),
latestPosition(Vec3::ZERO),
originalDirection(Vec3::ZERO),
originalDirectionLength(0.0f), originalDirectionLength(0.0f),
originalScaledDirectionLength(0.0f), originalScaledDirectionLength(0.0f),
originalVelocity(0.0f), originalVelocity(0.0f),

View File

@ -34,8 +34,7 @@ const Vec3 PUPlaneCollider::DEFAULT_NORMAL(0, 0, 0);
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
PUPlaneCollider::PUPlaneCollider(void) : PUPlaneCollider::PUPlaneCollider(void) :
PUBaseCollider(), PUBaseCollider(),
_normal(DEFAULT_NORMAL), _normal(DEFAULT_NORMAL)
_predictedPosition(Vec3::ZERO)
{ {
} }
PUPlaneCollider::~PUPlaneCollider( void ) PUPlaneCollider::~PUPlaneCollider( void )

View File

@ -35,8 +35,6 @@ PUSlaveEmitter::PUSlaveEmitter(void) :
_masterParticle(0), _masterParticle(0),
_masterTechniqueName(), _masterTechniqueName(),
_masterEmitterName(), _masterEmitterName(),
_masterPosition(Vec3::ZERO),
_masterDirection(Vec3::ZERO),
_masterEmitterNameSet(false) _masterEmitterNameSet(false)
{ {
} }

View File

@ -29,7 +29,6 @@ NS_CC_BEGIN
PUSphere::PUSphere() PUSphere::PUSphere()
: _radius(1.0) : _radius(1.0)
, _center(Vec3::ZERO)
{ {
} }

View File

@ -34,7 +34,6 @@ const float PUSphereCollider::DEFAULT_RADIUS = 100.0f;
PUSphereCollider::PUSphereCollider(void) : PUSphereCollider::PUSphereCollider(void) :
PUBaseCollider(), PUBaseCollider(),
_radius(DEFAULT_RADIUS), _radius(DEFAULT_RADIUS),
_predictedPosition(Vec3::ZERO),
_innerCollision(false) _innerCollision(false)
{ {
} }

View File

@ -34,8 +34,7 @@ const float PUSphereSurfaceEmitter::DEFAULT_RADIUS = 10.0f;
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
PUSphereSurfaceEmitter::PUSphereSurfaceEmitter(void) : PUSphereSurfaceEmitter::PUSphereSurfaceEmitter(void) :
PUEmitter(), PUEmitter(),
_radius(DEFAULT_RADIUS), _radius(DEFAULT_RADIUS)
_randomVector(Vec3::ZERO)
{ {
} }
//----------------------------------------------------------------------- //-----------------------------------------------------------------------

View File

@ -1,5 +1,5 @@
{ {
"version":"v3-deps-42", "version":"v3-deps-43",
"zip_file_size":"74127526", "zip_file_size":"74127526",
"repo_name":"cocos2d-x-3rd-party-libs-bin", "repo_name":"cocos2d-x-3rd-party-libs-bin",
"repo_parent":"https://github.com/cocos2d/", "repo_parent":"https://github.com/cocos2d/",

View File

@ -1075,6 +1075,7 @@
"cocos/renderer/ccShader_PositionTexture_uColor.vert", "cocos/renderer/ccShader_PositionTexture_uColor.vert",
"cocos/renderer/ccShader_Position_uColor.frag", "cocos/renderer/ccShader_Position_uColor.frag",
"cocos/renderer/ccShader_Position_uColor.vert", "cocos/renderer/ccShader_Position_uColor.vert",
"cocos/renderer/ccShader_UI_Gray.frag",
"cocos/renderer/ccShaders.cpp", "cocos/renderer/ccShaders.cpp",
"cocos/renderer/ccShaders.h", "cocos/renderer/ccShaders.h",
"cocos/storage/CMakeLists.txt", "cocos/storage/CMakeLists.txt",
@ -1163,9 +1164,6 @@
"cocos/ui/UIWidget.h", "cocos/ui/UIWidget.h",
"cocos/ui/proj.win32/libui.vcxproj", "cocos/ui/proj.win32/libui.vcxproj",
"cocos/ui/proj.win32/libui.vcxproj.filters", "cocos/ui/proj.win32/libui.vcxproj.filters",
"cocos/ui/shaders/UIShaders.cpp",
"cocos/ui/shaders/UIShaders.h",
"cocos/ui/shaders/ccShader_grayscale.frag",
"docs/CODING_STYLE.md", "docs/CODING_STYLE.md",
"docs/CONTRIBUTE.md", "docs/CONTRIBUTE.md",
"docs/Groups.h", "docs/Groups.h",
@ -4855,6 +4853,7 @@
"cocos/scripting/lua-bindings/auto/api/Waves.lua", "cocos/scripting/lua-bindings/auto/api/Waves.lua",
"cocos/scripting/lua-bindings/auto/api/Waves3D.lua", "cocos/scripting/lua-bindings/auto/api/Waves3D.lua",
"cocos/scripting/lua-bindings/auto/api/WavesTiles3D.lua", "cocos/scripting/lua-bindings/auto/api/WavesTiles3D.lua",
"cocos/scripting/lua-bindings/auto/api/WebView.lua",
"cocos/scripting/lua-bindings/auto/api/Widget.lua", "cocos/scripting/lua-bindings/auto/api/Widget.lua",
"cocos/scripting/lua-bindings/auto/api/ZOrderFrame.lua", "cocos/scripting/lua-bindings/auto/api/ZOrderFrame.lua",
"cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_3d_auto_api.lua", "cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_3d_auto_api.lua",
@ -4866,6 +4865,7 @@
"cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_csloader_auto_api.lua", "cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_csloader_auto_api.lua",
"cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_experimental_auto_api.lua", "cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_experimental_auto_api.lua",
"cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_experimental_video_auto_api.lua", "cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_experimental_video_auto_api.lua",
"cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_experimental_webview_auto_api.lua",
"cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_extension_auto_api.lua", "cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_extension_auto_api.lua",
"cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_physics_auto_api.lua", "cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_physics_auto_api.lua",
"cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_spine_auto_api.lua", "cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_spine_auto_api.lua",
@ -4889,6 +4889,8 @@
"cocos/scripting/lua-bindings/auto/lua_cocos2dx_experimental_auto.hpp", "cocos/scripting/lua-bindings/auto/lua_cocos2dx_experimental_auto.hpp",
"cocos/scripting/lua-bindings/auto/lua_cocos2dx_experimental_video_auto.cpp", "cocos/scripting/lua-bindings/auto/lua_cocos2dx_experimental_video_auto.cpp",
"cocos/scripting/lua-bindings/auto/lua_cocos2dx_experimental_video_auto.hpp", "cocos/scripting/lua-bindings/auto/lua_cocos2dx_experimental_video_auto.hpp",
"cocos/scripting/lua-bindings/auto/lua_cocos2dx_experimental_webview_auto.cpp",
"cocos/scripting/lua-bindings/auto/lua_cocos2dx_experimental_webview_auto.hpp",
"cocos/scripting/lua-bindings/auto/lua_cocos2dx_extension_auto.cpp", "cocos/scripting/lua-bindings/auto/lua_cocos2dx_extension_auto.cpp",
"cocos/scripting/lua-bindings/auto/lua_cocos2dx_extension_auto.hpp", "cocos/scripting/lua-bindings/auto/lua_cocos2dx_extension_auto.hpp",
"cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.cpp", "cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.cpp",
@ -4967,6 +4969,8 @@
"cocos/scripting/lua-bindings/manual/tolua_fix.h", "cocos/scripting/lua-bindings/manual/tolua_fix.h",
"cocos/scripting/lua-bindings/manual/ui/lua_cocos2dx_experimental_video_manual.cpp", "cocos/scripting/lua-bindings/manual/ui/lua_cocos2dx_experimental_video_manual.cpp",
"cocos/scripting/lua-bindings/manual/ui/lua_cocos2dx_experimental_video_manual.hpp", "cocos/scripting/lua-bindings/manual/ui/lua_cocos2dx_experimental_video_manual.hpp",
"cocos/scripting/lua-bindings/manual/ui/lua_cocos2dx_experimental_webview_manual.cpp",
"cocos/scripting/lua-bindings/manual/ui/lua_cocos2dx_experimental_webview_manual.hpp",
"cocos/scripting/lua-bindings/manual/ui/lua_cocos2dx_ui_manual.cpp", "cocos/scripting/lua-bindings/manual/ui/lua_cocos2dx_ui_manual.cpp",
"cocos/scripting/lua-bindings/manual/ui/lua_cocos2dx_ui_manual.hpp", "cocos/scripting/lua-bindings/manual/ui/lua_cocos2dx_ui_manual.hpp",
"cocos/scripting/lua-bindings/manual/video/lua_cocos2dx_experimental_video_manual.cpp", "cocos/scripting/lua-bindings/manual/video/lua_cocos2dx_experimental_video_manual.cpp",
@ -5238,6 +5242,7 @@
"tools/tolua/cocos2dx_csloader.ini", "tools/tolua/cocos2dx_csloader.ini",
"tools/tolua/cocos2dx_experimental.ini", "tools/tolua/cocos2dx_experimental.ini",
"tools/tolua/cocos2dx_experimental_video.ini", "tools/tolua/cocos2dx_experimental_video.ini",
"tools/tolua/cocos2dx_experimental_webview.ini",
"tools/tolua/cocos2dx_extension.ini", "tools/tolua/cocos2dx_extension.ini",
"tools/tolua/cocos2dx_physics.ini", "tools/tolua/cocos2dx_physics.ini",
"tools/tolua/cocos2dx_spine.ini", "tools/tolua/cocos2dx_spine.ini",

View File

@ -84,6 +84,11 @@ void Cocos2dRenderer::Pause()
} }
} }
bool Cocos2dRenderer::AppShouldExit()
{
return GLViewImpl::sharedOpenGLView()->AppShouldExit();
}
void Cocos2dRenderer::DeviceLost() void Cocos2dRenderer::DeviceLost()
{ {
Pause(); Pause();
@ -137,4 +142,9 @@ void Cocos2dRenderer::QueuePointerEvent(cocos2d::PointerEventType type, Windows:
GLViewImpl::sharedOpenGLView()->QueuePointerEvent(type, args); GLViewImpl::sharedOpenGLView()->QueuePointerEvent(type, args);
} }
void Cocos2dRenderer::QueueBackButtonEvent()
{
GLViewImpl::sharedOpenGLView()->QueueBackKeyPress();
}

View File

@ -35,10 +35,12 @@ namespace cocos2d
~Cocos2dRenderer(); ~Cocos2dRenderer();
void Draw(GLsizei width, GLsizei height, float dpi, Windows::Graphics::Display::DisplayOrientations orientation); void Draw(GLsizei width, GLsizei height, float dpi, Windows::Graphics::Display::DisplayOrientations orientation);
void QueuePointerEvent(PointerEventType type, Windows::UI::Core::PointerEventArgs^ args); void QueuePointerEvent(PointerEventType type, Windows::UI::Core::PointerEventArgs^ args);
void QueueBackButtonEvent();
void Pause(); void Pause();
void Resume(); void Resume();
void DeviceLost(); void DeviceLost();
bool AppShouldExit();
private: private:
int m_width; int m_width;

View File

@ -169,16 +169,23 @@ void OpenGLESPage::OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Wi
} }
#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) #if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
/*
We set args->Handled = true to prevent the app from quitting when the back button is pressed.
This is because this back button event happens on the XAML UI thread and not the cocos2d-x UI thread.
We need to give the game developer a chance to decide to exit the app depending on where they
are in their game. They can receive the back button event by listening for the
EventKeyboard::KeyCode::KEY_ESCAPE event.
The default behavior is to exit the app if the EventKeyboard::KeyCode::KEY_ESCAPE event
is not handled by the game.
*/
void OpenGLESPage::OnBackButtonPressed(Object^ sender, BackPressedEventArgs^ args) void OpenGLESPage::OnBackButtonPressed(Object^ sender, BackPressedEventArgs^ args)
{ {
bool myAppCanNavigate = false; if (m_renderer)
if (myAppCanNavigate)
{ {
m_renderer->QueueBackButtonEvent();
args->Handled = true; args->Handled = true;
} }
else {
// Do nothing. Leave args->Handled set to the current value, false.
}
} }
#endif #endif
@ -250,6 +257,15 @@ void OpenGLESPage::RecoverFromLostDevice()
StartRenderLoop(); StartRenderLoop();
} }
void OpenGLESPage::TerminateApp()
{
{
critical_section::scoped_lock lock(mRenderSurfaceCriticalSection);
DestroyRenderSurface();
}
Windows::UI::Xaml::Application::Current->Exit();
}
void OpenGLESPage::StartRenderLoop() void OpenGLESPage::StartRenderLoop()
{ {
// If the render loop is already running then do not start another thread. // If the render loop is already running then do not start another thread.
@ -273,8 +289,6 @@ void OpenGLESPage::StartRenderLoop()
GLsizei panelWidth = 0; GLsizei panelWidth = 0;
GLsizei panelHeight = 0; GLsizei panelHeight = 0;
GetSwapChainPanelSize(&panelWidth, &panelHeight); GetSwapChainPanelSize(&panelWidth, &panelHeight);
if (m_renderer.get() == nullptr) if (m_renderer.get() == nullptr)
{ {
@ -316,6 +330,17 @@ void OpenGLESPage::StartRenderLoop()
return; return;
} }
// run on main UI thread
if (m_renderer->AppShouldExit())
{
swapChainPanel->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, ref new DispatchedHandler([this]()
{
TerminateApp();
}));
return;
}
} }
if (m_renderer) if (m_renderer)

View File

@ -46,6 +46,7 @@ namespace cocos2d
void CreateRenderSurface(); void CreateRenderSurface();
void DestroyRenderSurface(); void DestroyRenderSurface();
void RecoverFromLostDevice(); void RecoverFromLostDevice();
void TerminateApp();
void StartRenderLoop(); void StartRenderLoop();
void StopRenderLoop(); void StopRenderLoop();

View File

@ -78,11 +78,6 @@ bool HelloWorld::init()
void HelloWorld::menuCloseCallback(Ref* sender) void HelloWorld::menuCloseCallback(Ref* sender)
{ {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
MessageBox("You pressed the close button. Windows Store Apps do not implement a close button.","Alert");
return;
#endif
Director::getInstance()->end(); Director::getInstance()->end();
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)

View File

@ -165,12 +165,7 @@ bool AppDelegate::applicationDidFinishLaunching()
fileUtils->setSearchPaths(searchPaths); fileUtils->setSearchPaths(searchPaths);
#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); glview->setDesignResolutionSize(designSize.width, designSize.height, ResolutionPolicy::SHOW_ALL);
#else
glview->setDesignResolutionSize(designSize.width, designSize.height, ResolutionPolicy::SHOW_ALL);
#endif
// Enable Remote Console // Enable Remote Console
auto console = director->getConsole(); auto console = director->getConsole();

View File

@ -180,10 +180,6 @@ void TestList::runThisTest()
{ {
//Add close and "Start AutoTest" button. //Add close and "Start AutoTest" button.
auto closeItem = MenuItemImage::create(s_pathClose, s_pathClose, [](Ref* sender){ auto closeItem = MenuItemImage::create(s_pathClose, s_pathClose, [](Ref* sender){
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
MessageBox("You pressed the close button. Windows Store Apps do not implement a close button.", "Alert");
return;
#endif
TestController::getInstance()->stopAutoTest(); TestController::getInstance()->stopAutoTest();
TestController::destroyInstance(); TestController::destroyInstance();
Director::getInstance()->end(); Director::getInstance()->end();

View File

@ -91,6 +91,12 @@
<PackageCertificateKeyFile>cpp-tests.Windows_TemporaryKey.pfx</PackageCertificateKeyFile> <PackageCertificateKeyFile>cpp-tests.Windows_TemporaryKey.pfx</PackageCertificateKeyFile>
<PackageCertificateThumbprint>35C2132BDB64C0DFA54722663D9148FF118E341B</PackageCertificateThumbprint> <PackageCertificateThumbprint>35C2132BDB64C0DFA54722663D9148FF118E341B</PackageCertificateThumbprint>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<Import Project="..\cpp-tests.Shared\cpp-tests.Shared.vcxitems" Label="Shared" /> <Import Project="..\cpp-tests.Shared\cpp-tests.Shared.vcxitems" Label="Shared" />
<ItemDefinitionGroup Condition="'$(Platform)'=='ARM'"> <ItemDefinitionGroup Condition="'$(Platform)'=='ARM'">
<Link> <Link>

View File

@ -117,6 +117,12 @@
<AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision> <AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision>
<AppxBundlePlatforms>x86</AppxBundlePlatforms> <AppxBundlePlatforms>x86</AppxBundlePlatforms>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Image Include="Assets\Logo.scale-240.png" /> <Image Include="Assets\Logo.scale-240.png" />
<Image Include="Assets\SmallLogo.scale-240.png" /> <Image Include="Assets\SmallLogo.scale-240.png" />

View File

@ -29,9 +29,6 @@ function UIScene:init()
self._sceneTitle = root:getChildByName("UItest") self._sceneTitle = root:getChildByName("UItest")
local back_label = root:getChildByName("back")--getWidgetByName
back_label:setVisible(false)
local function previousCallback(sender, eventType) local function previousCallback(sender, eventType)
if eventType == ccui.TouchEventType.ended then if eventType == ccui.TouchEventType.ended then
cc.Director:getInstance():replaceScene(guiSceneManager.previousUIScene()) cc.Director:getInstance():replaceScene(guiSceneManager.previousUIScene())
@ -711,9 +708,6 @@ function UILoadingBarLeftTest:initExtend()
local root = self._uiLayer:getChildByTag(81) local root = self._uiLayer:getChildByTag(81)
self._sceneTitle = root:getChildByName("UItest") self._sceneTitle = root:getChildByName("UItest")
local back_label = root:getChildByName("back")
back_label:setVisible(false)
local widgetSize = self._widget:getContentSize() local widgetSize = self._widget:getContentSize()
local alert = ccui.Text:create() local alert = ccui.Text:create()
@ -837,9 +831,6 @@ function UILoadingBarRightTest:initExtend()
local root = self._uiLayer:getChildByTag(81) local root = self._uiLayer:getChildByTag(81)
self._sceneTitle = root:getChildByName("UItest") self._sceneTitle = root:getChildByName("UItest")
local back_label = root:getChildByName("back")
back_label:setVisible(false)
local widgetSize = self._widget:getContentSize() local widgetSize = self._widget:getContentSize()
local alert = ccui.Text:create() local alert = ccui.Text:create()
@ -964,9 +955,6 @@ function UILoadingBarLeftScale9Test:initExtend()
local root = self._uiLayer:getChildByTag(81) local root = self._uiLayer:getChildByTag(81)
self._sceneTitle = root:getChildByName("UItest") self._sceneTitle = root:getChildByName("UItest")
local back_label = root:getChildByName("back")
back_label:setVisible(false)
local widgetSize = self._widget:getContentSize() local widgetSize = self._widget:getContentSize()
local alert = ccui.Text:create() local alert = ccui.Text:create()
@ -1093,9 +1081,6 @@ function UILoadingBarRightScale9Test:initExtend()
local root = self._uiLayer:getChildByTag(81) local root = self._uiLayer:getChildByTag(81)
self._sceneTitle = root:getChildByName("UItest") self._sceneTitle = root:getChildByName("UItest")
local back_label = root:getChildByName("back")
back_label:setVisible(false)
local widgetSize = self._widget:getContentSize() local widgetSize = self._widget:getContentSize()
local alert = ccui.Text:create() local alert = ccui.Text:create()

View File

@ -0,0 +1,129 @@
----------------------------------------
----WebViewTest
----------------------------------------
local WebViewTest = class("WebViewTest", function ()
local layer = cc.Layer:create()
return layer
end)
function WebViewTest:ctor()
self:init()
end
function WebViewTest:init()
Helper.initWithLayer(self)
Helper.titleLabel:setString(self:title())
Helper.subtitleLabel:setString(self:subtitle())
local winSize = cc.Director:getInstance():getVisibleSize()
self._webView = ccexp.WebView:create()
self._webView:setPosition(winSize.width / 2, winSize.height / 2 - 40)
self._webView:setContentSize(winSize.width / 2, winSize.height / 2)
self._webView:loadURL("http://www.baidu.com")
self._webView:setScalesPageToFit(true)
self._webView:setOnShouldStartLoading(function(sender, url)
print("onWebViewShouldStartLoading, url is ", url)
return true
end)
self._webView:setOnDidFinishLoading(function(sender, url)
print("onWebViewDidFinishLoading, url is ", url)
end)
self._webView:setOnDidFailLoading(function(sender, url)
print("onWebViewDidFinishLoading, url is ", url)
end)
self:addChild(self._webView)
local urlTextField = ccui.TextField:create("Input a URL here", "Arial", 20)
urlTextField:setPlaceHolderColor(cc.c4b(255, 0, 0, 255))
urlTextField:setPosition(winSize.width/2 - 80, winSize.height/2 + self._webView:getContentSize().height/2 + urlTextField:getContentSize().height/2 + 10)
self:addChild(urlTextField)
local httpLabel = ccui.Text:create("http:// ", "Arial", 20)
httpLabel:setTextColor(cc.c4b(0, 255, 0, 255))
httpLabel:setAnchorPoint(cc.p(1.0,0.5))
local x,y = urlTextField:getPosition()
httpLabel:setPosition( x - urlTextField:getContentSize().width / 2, y)
self:addChild(httpLabel)
local resetBtn = ccui.Button:create("cocosui/animationbuttonnormal.png", "cocosui/animationbuttonpressed.png")
resetBtn:setTitleText("Visit URL")
resetBtn:setPosition(winSize.width / 2 + 80 , winSize.height / 2 + self._webView:getContentSize().height / 2 + resetBtn:getContentSize().height / 2 + 10)
resetBtn:addClickEventListener(function(sender)
if urlTextField:getString() ~= nil then
self._webView:loadURL("http://" .. urlTextField:getString())
end
end)
self:addChild(resetBtn)
local reloadBtn = ccui.Button:create("cocosui/animationbuttonnormal.png", "cocosui/animationbuttonpressed.png")
reloadBtn:setTitleText("Reload")
reloadBtn:setPosition(winSize.width / 2 + self._webView:getContentSize().width / 2 + reloadBtn:getContentSize().width / 2 + 10, winSize.height / 2 + 50)
reloadBtn:addClickEventListener(function(sender)
self._webView:reload()
end)
self:addChild(reloadBtn)
local forwardBtn = ccui.Button:create("cocosui/animationbuttonnormal.png","cocosui/animationbuttonpressed.png")
forwardBtn:setTitleText("Forward")
forwardBtn:setPosition(winSize.width / 2 + self._webView:getContentSize().width / 2 + forwardBtn:getContentSize().width / 2 + 10,winSize.height / 2)
forwardBtn:addClickEventListener(function(sender)
self._webView:goForward()
end)
self:addChild(forwardBtn)
local backBtn = ccui.Button:create("cocosui/animationbuttonnormal.png", "cocosui/animationbuttonpressed.png")
backBtn:setTitleText("Back")
backBtn:setPosition(winSize.width / 2 + self._webView:getContentSize().width/2 + backBtn:getContentSize().width/2 + 10, winSize.height - 50)
backBtn:addClickEventListener(function(sender)
self._webView:goBack()
end)
self:addChild(backBtn)
local loadFileBtn = ccui.Button:create("cocosui/animationbuttonnormal.png", "cocosui/animationbuttonpressed.png")
loadFileBtn:setTitleText("Load FILE")
loadFileBtn:setPosition(winSize.width / 2 - self._webView:getContentSize().width/2 - loadFileBtn:getContentSize().width/2 - 30, winSize.height / 2 + 50)
loadFileBtn:addClickEventListener(function(sender)
self._webView:loadFile("Test.html")
end)
self:addChild(loadFileBtn)
local loadHTMLBtn = ccui.Button:create("cocosui/animationbuttonnormal.png","cocosui/animationbuttonpressed.png")
loadHTMLBtn:setTitleText("Load Data")
loadHTMLBtn:setPosition(winSize.width / 2 - self._webView:getContentSize().width/2 - loadHTMLBtn:getContentSize().width/2 - 30, winSize.height / 2)
loadHTMLBtn:addClickEventListener(function(sender)
self._webView:loadHTMLString("<body style=\"font-size:50px\">Hello World <img src=\"Icon.png\"/> </body>","Images/")
end)
self:addChild(loadHTMLBtn)
local evalJsBtn = ccui.Button:create("cocosui/animationbuttonnormal.png", "cocosui/animationbuttonpressed.png")
evalJsBtn:setTitleText("Evaluate JS")
evalJsBtn:setPosition(winSize.width / 2 - self._webView:getContentSize().width/2 - evalJsBtn:getContentSize().width/2 - 30, winSize.height / 2 - 50)
evalJsBtn:addClickEventListener(function(sender)
self._webView:evaluateJS("alert(\"hello\")")
end)
self:addChild(evalJsBtn)
end
function WebViewTest:title()
return ""
end
function WebViewTest:subtitle()
return ""
end
function WebViewTestMain()
Helper.createFunctionTable =
{
WebViewTest.create,
}
local scene = cc.Scene:create()
scene:addChild(WebViewTest.create())
scene:addChild(CreateBackMenuItem())
return scene
end

View File

@ -58,6 +58,7 @@ require "VideoPlayerTest/VideoPlayerTest"
require "FastTiledMapTest/FastTiledMapTest" require "FastTiledMapTest/FastTiledMapTest"
require "NewAudioEngineTest/NewAudioEngineTest" require "NewAudioEngineTest/NewAudioEngineTest"
require "CocosStudio3DTest/CocosStudio3DTest" require "CocosStudio3DTest/CocosStudio3DTest"
require "WebViewTest/WebViewTest"
local LINE_SPACE = 40 local LINE_SPACE = 40
@ -134,6 +135,7 @@ local _allTests = {
{ isSupported = true, name = "TransitionsTest" , create_func = TransitionsTest }, { isSupported = true, name = "TransitionsTest" , create_func = TransitionsTest },
{ isSupported = true, name = "UserDefaultTest" , create_func= UserDefaultTestMain }, { isSupported = true, name = "UserDefaultTest" , create_func= UserDefaultTestMain },
{ isSupported = true, name = "VideoPlayerTest" , create_func= VideoPlayerTestMain }, { isSupported = true, name = "VideoPlayerTest" , create_func= VideoPlayerTestMain },
{ isSupported = true, name = "WebViewTest" , create_func= WebViewTestMain },
{ isSupported = true, name = "XMLHttpRequestTest" , create_func = XMLHttpRequestTestMain }, { isSupported = true, name = "XMLHttpRequestTest" , create_func = XMLHttpRequestTestMain },
{ isSupported = true, name = "ZwoptexTest" , create_func = ZwoptexTestMain } { isSupported = true, name = "ZwoptexTest" , create_func = ZwoptexTestMain }
} }
@ -196,6 +198,12 @@ function CreateTestMenu()
end end
end end
if obj.name == "WebViewTest" then
if cc.PLATFORM_OS_IPHONE ~= targetPlatform and cc.PLATFORM_OS_ANDROID ~= targetPlatform then
testMenuItem:setEnabled(false)
end
end
testMenuItem:registerScriptTapHandler(menuCallback) testMenuItem:registerScriptTapHandler(menuCallback)
testMenuItem:setPosition(cc.p(s.width / 2, (s.height - (index) * LINE_SPACE))) testMenuItem:setPosition(cc.p(s.width / 2, (s.height - (index) * LINE_SPACE)))
MainMenu:addChild(testMenuItem, index + 10000, index + 10000) MainMenu:addChild(testMenuItem, index + 10000, index + 10000)

@ -1 +1 @@
Subproject commit fd15b0c3e122e87e7447c4107a7f98ce5cfab7c4 Subproject commit f56ddf5c118a2652d0d7eb796872420a69f532af

View File

@ -0,0 +1,62 @@
[cocos2dx_experimental_webview]
# the prefix to be added to the generated functions. You might or might not use this in your own
# templates
prefix = cocos2dx_experimental_webview
# create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`)
# all classes will be embedded in that namespace
target_namespace = ccexp
macro_judgement = #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
android_headers = -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.8/include
android_flags = -D_SIZE_T_DEFINED_
clang_headers = -I%(clangllvmdir)s/lib/clang/3.3/include
clang_flags = -nostdinc -x c++ -std=c++11 -U __SSE__
cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/editor-support -I%(cocosdir)s/cocos/platform/android
cocos_flags = -DANDROID
cxxgenerator_headers =
# extra arguments for clang
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
# what headers to parse
headers = %(cocosdir)s/cocos/ui/UIWebView.h
# what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^Menu*$".
classes = WebView
# what should we skip? in the format ClassName::[function function]
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
# regular expressions, they will not be surrounded by "^$". If you want to skip a whole class, just
# add a single "*" as functions. See bellow for several examples. A special class name is "*", which
# will apply to all class names. This is a convenience wildcard to be able to skip similar named
# functions from all classes.
skip = WebView::[(s|g)etOnShouldStartLoading (s|g)etOnDidFinishLoading (s|g)etOnDidFailLoading setOnJSCallback draw loadData]
rename_functions =
rename_classes =
# for all class names, should we remove something when registering in the target VM?
remove_prefix =
# classes for which there will be no "parent" lookup
classes_have_no_parents =
# base classes which will be skipped when their sub-classes found them.
base_classes_to_skip =
# classes that create no constructor
# Set is special and we will use a hand-written constructor
abstract_classes =
# Determining whether to use script object(js object) to control the lifecycle of native(cpp) object or the other way around. Supported values are 'yes' or 'no'.
script_control_cpp = no

View File

@ -147,6 +147,7 @@ def main():
'cocos2dx_3d.ini': ('cocos2dx_3d', 'lua_cocos2dx_3d_auto'), \ 'cocos2dx_3d.ini': ('cocos2dx_3d', 'lua_cocos2dx_3d_auto'), \
'cocos2dx_audioengine.ini': ('cocos2dx_audioengine', 'lua_cocos2dx_audioengine_auto'), \ 'cocos2dx_audioengine.ini': ('cocos2dx_audioengine', 'lua_cocos2dx_audioengine_auto'), \
'cocos2dx_csloader.ini' : ('cocos2dx_csloader', 'lua_cocos2dx_csloader_auto'), \ 'cocos2dx_csloader.ini' : ('cocos2dx_csloader', 'lua_cocos2dx_csloader_auto'), \
'cocos2dx_experimental_webview.ini' : ('cocos2dx_experimental_webview', 'lua_cocos2dx_experimental_webview_auto'), \
} }
target = 'lua' target = 'lua'
generator_py = '%s/generator.py' % cxx_generator_root generator_py = '%s/generator.py' % cxx_generator_root