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 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] Lua-binding: binded ui:WebView and added corresponidng test case
[NEW] MathUtil: added `MathUtil::lerp()`
[NEW] UserDefault: added `UserDefault::setDelegate()`
[NEW] Vec2: added `Vec2::setZero()`
[NEW] Vec3: added `Vec3::lerp()`
[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] 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 */; };
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 */; };
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 */; };
299754F4193EC95400A54AC3 /* 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>"; };
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>"; };
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>"; };
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>"; };
@ -5194,7 +5187,6 @@
2905F9E618CF08D000240AA3 /* ui */ = {
isa = PBXGroup;
children = (
296BF6121A4403380038EC44 /* shaders */,
29CB8F531929D67D00C841D6 /* widgets */,
29CB8F521929D65500C841D6 /* experimental */,
29CB8F511929D64500C841D6 /* base */,
@ -5235,16 +5227,6 @@
name = mac;
sourceTree = "<group>";
};
296BF6121A4403380038EC44 /* shaders */ = {
isa = PBXGroup;
children = (
296BF6131A4403380038EC44 /* ccShader_grayscale.frag */,
296BF6141A44059B0038EC44 /* UIShaders.h */,
296BF6171A4405CB0038EC44 /* UIShaders.cpp */,
);
path = shaders;
sourceTree = "<group>";
};
29CB8F501929D63600C841D6 /* layout */ = {
isa = PBXGroup;
children = (
@ -6903,7 +6885,6 @@
15AE1C1219AAE2C600C27E9E /* CCPhysicsDebugNode.h in Headers */,
B665E3381AA80A6500DDB1C5 /* CCPUOnEmissionObserverTranslator.h in Headers */,
50ABBE951925AB6F00A911A9 /* CCProfiling.h in Headers */,
296BF6151A44059B0038EC44 /* UIShaders.h in Headers */,
B665E2301AA80A6500DDB1C5 /* CCPUBoxColliderTranslator.h in Headers */,
5034CA4B191D591100CE6051 /* ccShader_Label_df_glow.frag in Headers */,
50ABBE4F1925AB6F00A911A9 /* CCEventCustom.h in Headers */,
@ -7448,7 +7429,6 @@
B665E2711AA80A6500DDB1C5 /* CCPUDoFreezeEventHandlerTranslator.h in Headers */,
1A570115180BC8EE0088DEC7 /* CCDrawNode.h in Headers */,
1A57011E180BC90D0088DEC7 /* CCGrabber.h in Headers */,
296BF6161A44059B0038EC44 /* UIShaders.h in Headers */,
1A570122180BC90D0088DEC7 /* CCGrid.h in Headers */,
15AE1AB319AAD40300C27E9E /* b2CircleContact.h in Headers */,
5034CA2E191D591100CE6051 /* ccShader_PositionTextureA8Color.frag in Headers */,
@ -8598,7 +8578,6 @@
B665E3E61AA80A6600DDB1C5 /* CCPUSineForceAffectorTranslator.cpp in Sources */,
15AE1B5119AADA9900C27E9E /* UIPageView.cpp in Sources */,
15AE18EC19AAD35000C27E9E /* CCActionObject.cpp in Sources */,
296BF6181A4405CB0038EC44 /* UIShaders.cpp in Sources */,
B665E2821AA80A6500DDB1C5 /* CCPUDoStopSystemEventHandler.cpp in Sources */,
1A01C68E18F57BE800EFE3A6 /* CCDictionary.cpp in Sources */,
50ABBD381925AB0000A911A9 /* CCAffineTransform.cpp in Sources */,
@ -9075,7 +9054,6 @@
182C5CD71A98F30500C30D34 /* Sprite3DReader.cpp in Sources */,
50ABC0061926664800A911A9 /* CCThread-apple.mm in Sources */,
50ABBEB61925AB6F00A911A9 /* CCUserDefault-android.cpp in Sources */,
296BF6191A4405CB0038EC44 /* UIShaders.cpp in Sources */,
1A57034C180BD09B0088DEC7 /* tinyxml2.cpp in Sources */,
50ABBDB61925AB4100A911A9 /* CCTexture2D.cpp in Sources */,
B665E2871AA80A6500DDB1C5 /* CCPUDoStopSystemEventHandlerTranslator.cpp in Sources */,

View File

@ -42,6 +42,8 @@
1502702E1AD3BDC90089CD03 /* TerrainTest in Resources */ = {isa = PBXBuildFile; fileRef = B603F1B31AC8FBFB00A9579C /* TerrainTest */; };
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 */; };
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 */; };
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 */; };
@ -4378,6 +4380,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
1531B2501AE013DE0075DB94 /* Test.html in Resources */,
1502702E1AD3BDC90089CD03 /* TerrainTest in Resources */,
157B08EC1A90864100B7BEA4 /* Particle3D in Resources */,
15B13E5219F0FD4D008A1ADC /* Manifests in Resources */,
@ -4424,6 +4427,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
1531B2511AE013F00075DB94 /* Test.html in Resources */,
1502702D1AD3BDBC0089CD03 /* TerrainTest in Resources */,
157B08ED1A90865600B7BEA4 /* Particle3D 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="..\storage\local-storage\LocalStorage.cpp" />
<ClCompile Include="..\ui\CocosGUI.cpp" />
<ClCompile Include="..\ui\shaders\UIShaders.cpp" />
<ClCompile Include="..\ui\UIButton.cpp" />
<ClCompile Include="..\ui\UICheckBox.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="..\ui\CocosGUI.h" />
<ClInclude Include="..\ui\GUIExport.h" />
<ClInclude Include="..\ui\shaders\UIShaders.h" />
<ClInclude Include="..\ui\UIButton.h" />
<ClInclude Include="..\ui\UICheckBox.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\Vec3.inl" />
<None Include="..\math\Vec4.inl" />
<None Include="..\ui\shaders\ccShader_grayscale.frag" />
<None Include="cocos2d.def" />
</ItemGroup>
<ItemGroup>

View File

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

View File

@ -472,7 +472,7 @@
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\Keyboard-winrt.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\pch.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\CCCustomCommand.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCGLProgram.h" />
@ -498,7 +498,6 @@
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\storage\local-storage\LocalStorage.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\CocosGUI.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\GUIExport.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\shaders\UIShaders.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UIButton.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UICheckBox.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UIDeprecated.h" />
@ -1028,7 +1027,7 @@
</ForcedIncludeFiles>
</ClCompile>
<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\CCCustomCommand.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCGLProgram.cpp" />
@ -1052,7 +1051,6 @@
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCVertexIndexData.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\storage\local-storage\LocalStorage.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\CocosGUI.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\shaders\UIShaders.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UIButton.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UICheckBox.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UIDeprecated.cpp" />
@ -1190,7 +1188,6 @@
</None>
<None Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\ccShader_Position_uColor.frag" />
<None Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\ccShader_Position_uColor.vert" />
<None Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\shaders\ccShader_grayscale.frag" />
<None Include="$(MSBuildThisFileDirectory)..\..\..\cocos2d.def" />
<None Include="$(MSBuildThisFileDirectory)..\..\..\libcocos2d.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">
<Filter>cocostudio\reader\WidgetReader\ArmatureNodeReader</Filter>
</ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\shaders\UIShaders.h">
<Filter>ui\shaders</Filter>
</ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CCActionTimelineNode.h">
<Filter>cocostudio\TimelineAction</Filter>
</ClInclude>
@ -1743,7 +1740,7 @@
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCTerrain.h">
<Filter>3d</Filter>
</ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\WICImageLoader-win.h">
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\WICImageLoader-winrt.h">
<Filter>platform\winrt</Filter>
</ClInclude>
</ItemGroup>
@ -2818,9 +2815,6 @@
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\WidgetReader\ArmatureNodeReader\ArmatureNodeReader.cpp">
<Filter>cocostudio\reader\WidgetReader\ArmatureNodeReader</Filter>
</ClCompile>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\shaders\UIShaders.cpp">
<Filter>ui\shaders</Filter>
</ClCompile>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\ActionTimeline\CCActionTimelineNode.cpp">
<Filter>cocostudio\TimelineAction</Filter>
</ClCompile>
@ -3318,7 +3312,7 @@
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\CocoStudio.cpp">
<Filter>cocostudio\json</Filter>
</ClCompile>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\WICImageLoader-win.cpp">
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\platform\winrt\WICImageLoader-winrt.cpp">
<Filter>platform\winrt</Filter>
</ClCompile>
</ItemGroup>
@ -3557,9 +3551,6 @@
<Filter Include="cocostudio\reader\WidgetReader\ArmatureNodeReader">
<UniqueIdentifier>{1151b6b3-739f-4cff-add0-6b772fa7d226}</UniqueIdentifier>
</Filter>
<Filter Include="ui\shaders">
<UniqueIdentifier>{10d3def7-52ba-4939-8de7-d9960a752f1e}</UniqueIdentifier>
</Filter>
<Filter Include="base\allocator">
<UniqueIdentifier>{673ca2c5-2183-424e-a2aa-728cd5231b62}</UniqueIdentifier>
</Filter>
@ -3683,9 +3674,6 @@
<None Include="$(MSBuildThisFileDirectory)..\..\..\libcocos2d_wp8.vcxproj.filters">
<Filter>2d</Filter>
</None>
<None Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\shaders\ccShader_grayscale.frag">
<Filter>ui\shaders</Filter>
</None>
<None Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCAnimationCurve.inl">
<Filter>3d</Filter>
</None>

View File

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

View File

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

View File

@ -7,7 +7,7 @@
<PropertyGroup />
<ItemDefinitionGroup>
<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>
<PreprocessorDefinitions>WINRT;_VARIADIC_MAX=10;NOMINMAX;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -142,8 +142,11 @@ Node* findChildByNameRecursively(Node* node, const std::string &childName)
//! called before the action start. It will also set the target.
void Animate3D::startWithTarget(Node *target)
{
bool needReMap = (_target != target);
ActionInterval::startWithTarget(target);
if (needReMap)
{
_boneCurves.clear();
_nodeCurves.clear();
@ -219,8 +222,9 @@ void Animate3D::startWithTarget(Node *target)
{
CCLOG("warning: no animation finde for the skeleton");
}
}
auto runningAction = s_runningAnimates.find(sprite);
auto runningAction = s_runningAnimates.find(target);
if (runningAction != s_runningAnimates.end())
{
//make the running action fade out
@ -229,19 +233,19 @@ void Animate3D::startWithTarget(Node *target)
{
if (_transTime < 0.001f)
{
s_runningAnimates[sprite] = this;
s_runningAnimates[target] = this;
_state = Animate3D::Animate3DState::Running;
_weight = 1.0f;
}
else
{
s_fadeOutAnimates[sprite] = action;
s_fadeOutAnimates[target] = action;
action->_state = Animate3D::Animate3DState::FadeOut;
action->_accTransTime = 0.0f;
action->_weight = 1.0f;
action->_lastTime = 0.f;
s_fadeInAnimates[sprite] = this;
s_fadeInAnimates[target] = this;
_accTransTime = 0.0f;
_state = Animate3D::Animate3DState::FadeIn;
_weight = 0.f;
@ -251,7 +255,12 @@ void Animate3D::startWithTarget(Node *target)
}
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;
_weight = 1.0f;
}
@ -284,9 +293,8 @@ void Animate3D::update(float t)
_accTransTime = _transTime;
_weight = 1.0f;
_state = Animate3D::Animate3DState::Running;
Sprite3D* sprite = static_cast<Sprite3D*>(_target);
s_fadeInAnimates.erase(sprite);
s_runningAnimates[sprite] = this;
s_fadeInAnimates.erase(_target);
s_runningAnimates[_target] = this;
}
}
else if (_state == Animate3D::Animate3DState::FadeOut && _lastTime > 0.f)
@ -299,8 +307,7 @@ void Animate3D::update(float t)
_accTransTime = _transTime;
_weight = 0.0f;
Sprite3D* sprite = static_cast<Sprite3D*>(_target);
s_fadeOutAnimates.erase(sprite);
s_fadeOutAnimates.erase(_target);
}
}
_lastTime = t;

View File

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

View File

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

View File

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

View File

@ -200,7 +200,7 @@ bool TextureCube::init(const std::string& positive_x, const std::string& negativ
Texture2D::PixelFormat 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,
0, // level

View File

@ -1644,6 +1644,7 @@ FrameData *DataReaderHelper::decodeFrame(const rapidjson::Value& json, DataInfo
if (length != 0)
{
frameData->easingParams = new float[length];
frameData->easingParamNumber = length;
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); }
uint8_t scale9Enabled() const { return GetField<uint8_t>(26, 0); }
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 {
return VerifyTableStart(verifier) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 4 /* widgetOptions */) &&
@ -749,6 +757,14 @@ struct ButtonOptions : private flatbuffers::Table {
VerifyField<FlatSize>(verifier, 24 /* scale9Size */) &&
VerifyField<uint8_t>(verifier, 26 /* scale9Enabled */) &&
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();
}
};
@ -769,10 +785,18 @@ struct ButtonOptionsBuilder {
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_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 &operator=(const ButtonOptionsBuilder &);
flatbuffers::Offset<ButtonOptions> Finish() {
auto o = flatbuffers::Offset<ButtonOptions>(fbb_.EndTable(start_, 13));
auto o = flatbuffers::Offset<ButtonOptions>(fbb_.EndTable(start_, 21));
return o;
}
};
@ -790,8 +814,22 @@ inline flatbuffers::Offset<ButtonOptions> CreateButtonOptions(flatbuffers::FlatB
const CapInsets *capInsets = 0,
const FlatSize *scale9Size = 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);
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_capInsets(capInsets);
builder_.add_textColor(textColor);
@ -803,6 +841,8 @@ inline flatbuffers::Offset<ButtonOptions> CreateButtonOptions(flatbuffers::FlatB
builder_.add_pressedData(pressedData);
builder_.add_normalData(normalData);
builder_.add_widgetOptions(widgetOptions);
builder_.add_shadowEnabled(shadowEnabled);
builder_.add_outlineEnabled(outlineEnabled);
builder_.add_displaystate(displaystate);
builder_.add_scale9Enabled(scale9Enabled);
return builder_.Finish();

View File

@ -274,6 +274,14 @@ namespace cocostudio
std::string fontResourcePlistFile = "";
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
const tinyxml2::XMLAttribute* attribute = objectData->FirstAttribute();
while (attribute)
@ -320,6 +328,30 @@ namespace cocostudio
{
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();
}
@ -505,6 +537,64 @@ namespace cocostudio
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();
}
@ -512,6 +602,8 @@ namespace cocostudio
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);
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,
widgetOptions,
@ -538,8 +630,15 @@ namespace cocostudio
&f_capInsets,
&f_scale9Size,
scale9Enabled,
displaystate
);
displaystate,
outlineEnabled,
&f_outlineColor,
outlineSize,
shadowEnabled,
&f_shadowColor,
shadowOffset.width,
shadowOffset.height,
shadowBlurRadius);
return *(Offset<Table>*)(&options);
}
@ -786,6 +885,30 @@ namespace cocostudio
button->setBright(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();
widgetReader->setPropsWithFlatBuffers(node, (Table*)options->widgetOptions());

View File

@ -77,7 +77,7 @@ namespace cocostudio
if(!attribute)
return Vec3::ZERO;
Vec3 ret(Vec3::ZERO);
Vec3 ret;
std::string attriname;
while (attribute)
@ -104,15 +104,222 @@ namespace cocostudio
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,
flatbuffers::FlatBufferBuilder *builder)
{
auto temp = NodeReader::getInstance()->createOptionsWithFlatBuffers(objectData, builder);
auto temp = createOptionsWithFlatBuffersForNode(objectData, builder);
auto nodeOptions = *(Offset<WidgetOptions>*)(&temp);
Vec3 position(Vec3::ZERO);
Vec3 rotation(Vec3::ZERO);
Vec3 scale(Vec3::ZERO);
Vec3 position;
Vec3 rotation;
Vec3 scale;
int cameraMask = 0;
std::string attriname;

View File

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

View File

@ -454,7 +454,7 @@ namespace cocostudio
auto f_outlineColor = options->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());
}
}
@ -465,7 +465,7 @@ namespace cocostudio
auto f_shadowColor = options->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());
}
}

View File

@ -31,7 +31,7 @@ THE SOFTWARE.
#include "renderer/CCTexture2D.h"
#if defined(CC_USE_WIC)
#include "WICImageLoader-win.h"
#include "WICImageLoader-winrt.h"
#endif
// 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.
if (!applicationDidFinishLaunching())
{
return 0;
return 1;
}
auto director = Director::getInstance();
@ -106,7 +106,7 @@ int Application::run()
director = nullptr;
}
glview->release();
return true;
return 0;
}
void Application::setAnimationInterval(double interval)

View File

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

View File

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

View File

@ -169,16 +169,23 @@ void OpenGLESPage::OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Wi
}
#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)
{
bool myAppCanNavigate = false;
if (myAppCanNavigate)
if (m_renderer)
{
m_renderer->QueueBackButtonEvent();
args->Handled = true;
}
else {
// Do nothing. Leave args->Handled set to the current value, false.
}
}
#endif
@ -250,6 +257,15 @@ void OpenGLESPage::RecoverFromLostDevice()
StartRenderLoop();
}
void OpenGLESPage::TerminateApp()
{
{
critical_section::scoped_lock lock(mRenderSurfaceCriticalSection);
DestroyRenderSurface();
}
Windows::UI::Xaml::Application::Current->Exit();
}
void OpenGLESPage::StartRenderLoop()
{
// If the render loop is already running then do not start another thread.
@ -274,8 +290,6 @@ void OpenGLESPage::StartRenderLoop()
GLsizei panelHeight = 0;
GetSwapChainPanelSize(&panelWidth, &panelHeight);
if (m_renderer.get() == nullptr)
{
m_renderer = std::make_shared<Cocos2dRenderer>(panelWidth, panelHeight, m_dpi, m_orientation, dispatcher, swapChainPanel);
@ -316,6 +330,17 @@ void OpenGLESPage::StartRenderLoop()
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)

View File

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

View File

@ -81,9 +81,14 @@ GLViewImpl::GLViewImpl()
, m_width(0)
, m_height(0)
, m_orientation(DisplayOrientations::Landscape)
, m_appShouldExit(false)
{
s_pEglView = this;
_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()
@ -188,6 +193,7 @@ bool GLViewImpl::isOpenGLReady()
void GLViewImpl::end()
{
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
void GLViewImpl::OnBackKeyPress()
{
std::string str;
if(m_delegate)
cocos2d::EventKeyboard::KeyCode cocos2dKey = EventKeyboard::KeyCode::KEY_ESCAPE;
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)
{
OnPointerPressed(args);
@ -221,7 +265,6 @@ void GLViewImpl::OnPointerPressed(PointerEventArgs^ args)
handleTouchesBegin(1, &id, &pt.x, &pt.y);
}
void GLViewImpl::OnPointerWheelChanged(CoreWindow^ sender, PointerEventArgs^ args)
{
float direction = (float)args->CurrentPoint->Properties->MouseWheelDelta;

View File

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

View File

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

View File

@ -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_U_COLOR = "ShaderPosition_uColor";
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_GLOW = "ShaderLabelDFGlow";
const char* GLProgram::SHADER_NAME_LABEL_NORMAL = "ShaderLabelNormal";

View File

@ -179,6 +179,9 @@ public:
static const char* SHADER_NAME_POSITION_U_COLOR;
/**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;
/**Built in shader for ui effects */
static const char* SHADER_NAME_POSITION_GRAYSCALE;
/** @{
Built in shader for label and label with effects.
*/

View File

@ -53,6 +53,7 @@ enum {
kShaderType_PositionLengthTexureColor,
kShaderType_LabelDistanceFieldNormal,
kShaderType_LabelDistanceFieldGlow,
kShaderType_UIGrayScale,
kShaderType_LabelNormal,
kShaderType_LabelOutline,
kShaderType_3DPosition,
@ -208,6 +209,10 @@ void GLProgramCache::loadDefaultGLPrograms()
_programs.insert( std::make_pair(GLProgram::SHADER_NAME_LABEL_DISTANCEFIELD_GLOW, p) );
#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();
loadDefaultGLProgram(p, kShaderType_LabelNormal);
_programs.insert( std::make_pair(GLProgram::SHADER_NAME_LABEL_NORMAL, p) );
@ -440,6 +445,10 @@ void GLProgramCache::loadDefaultGLProgram(GLProgram *p, int type)
p->initWithByteArrays(ccLabel_vert, ccLabelDistanceFieldGlow_frag);
break;
#endif
case kShaderType_UIGrayScale:
p->initWithByteArrays(ccPositionTextureColor_noMVP_vert,
ccPositionTexture_GrayScale_frag);
break;
case kShaderType_LabelNormal:
p->initWithByteArrays(ccLabel_vert, ccLabelNormal_frag);
break;

View File

@ -637,7 +637,12 @@ bool Texture2D::initWithMipmaps(MipmapInfo* mipmaps, int mipmapsNum, PixelFormat
}
#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
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
\nprecision mediump float;\n

View File

@ -66,6 +66,7 @@ NS_CC_BEGIN
#include "ccShader_PositionColorLengthTexture.frag"
#include "ccShader_PositionColorLengthTexture.vert"
#include "ccShader_UI_Gray.frag"
//
#include "ccShader_Label.vert"
#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_vert;
extern CC_DLL const GLchar * ccPositionTexture_GrayScale_frag;
extern CC_DLL const GLchar * ccLabelDistanceFieldNormal_frag;
extern CC_DLL const GLchar * ccLabelDistanceFieldGlow_frag;
extern CC_DLL const GLchar * ccLabelNormal_frag;

View File

@ -58,7 +58,7 @@
-- @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>
-- lua setUniformLocationI32
-- @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
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
#include "ccShader_grayscale.frag"
NS_CC_END
#endif //#ifndef COCOS_SCRIPTING_LUA_BINDINGS_LUA_COCOS2DX_EXPERIMENTAL_WEBVIEW_MANUAL_H
#endif //#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)

View File

@ -26,6 +26,8 @@
#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_manual.hpp"
#include "lua_cocos2dx_experimental_webview_auto.hpp"
#include "lua_cocos2dx_experimental_webview_manual.hpp"
#endif
#include "cocos2d.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)
register_all_cocos2dx_experimental_video(L);
register_all_cocos2dx_experimental_video_manual(L);
register_all_cocos2dx_experimental_webview(L);
register_all_cocos2dx_experimental_webview_manual(L);
#endif
extendEventListenerFocusEvent(L);
}

View File

@ -105,10 +105,12 @@ LOCAL_SRC_FILES += ../manual/spine/lua_cocos2dx_spine_manual.cpp \
../auto/lua_cocos2dx_spine_auto.cpp
#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 \
../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
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 */; };
15C1C2ED19874CBE00A46ACC /* CCLuaObjcBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AACE78E18BC45C200215002 /* CCLuaObjcBridge.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 */; };
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 */; };
@ -351,6 +355,10 @@
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>"; };
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>"; };
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; };
@ -536,6 +544,8 @@
15C1BD191986526C00A46ACC /* ui */ = {
isa = PBXGroup;
children = (
15C9A1101AE4973400C15443 /* lua_cocos2dx_experimental_webview_manual.cpp */,
15C9A1111AE4973400C15443 /* lua_cocos2dx_experimental_webview_manual.hpp */,
15C1C24B1987473200A46ACC /* lua_cocos2dx_experimental_video_manual.cpp */,
15C1C24C1987473200A46ACC /* lua_cocos2dx_experimental_video_manual.hpp */,
15C1BD1A1986526C00A46ACC /* lua_cocos2dx_ui_manual.cpp */,
@ -562,6 +572,8 @@
1AACE74818BC45C200215002 /* auto */ = {
isa = PBXGroup;
children = (
15C9A10C1AE4972500C15443 /* lua_cocos2dx_experimental_webview_auto.cpp */,
15C9A10D1AE4972500C15443 /* lua_cocos2dx_experimental_webview_auto.hpp */,
159552381A25E1C5001E9FC9 /* lua_cocos2dx_csloader_auto.cpp */,
159552391A25E1C5001E9FC9 /* lua_cocos2dx_csloader_auto.hpp */,
3E2BDB0319C5E5FE0055CDCD /* lua_cocos2dx_audioengine_auto.cpp */,
@ -877,7 +889,9 @@
15EFA62C198B3220000C57D3 /* lua_cocos2dx_deprecated.h in Headers */,
155C7E2919A71CE800F08B25 /* lua_cocos2dx_ui_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 */,
15C9A10F1AE4972500C15443 /* lua_cocos2dx_experimental_webview_auto.hpp in Headers */,
15EFA62F198B3220000C57D3 /* lua_cocos2dx_physics_manual.hpp in Headers */,
155C7E0919A71C8500F08B25 /* lua_cocos2dx_extension_manual.h in Headers */,
155C7E1919A71CB500F08B25 /* lua_xml_http_request.h in Headers */,
@ -1064,6 +1078,7 @@
15EFA639198B328B000C57D3 /* tolua_fix.cpp in Sources */,
155C7DFF19A71C5C00F08B25 /* CCBProxy.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 */,
155C7E0719A71C7800F08B25 /* lua_cocos2dx_extension_manual.cpp in Sources */,
15EFA625198B31FB000C57D3 /* LuaOpengl.cpp in Sources */,
@ -1087,6 +1102,7 @@
3E2BDB0519C5E5FE0055CDCD /* lua_cocos2dx_audioengine_auto.cpp in Sources */,
155C7E0B19A71C8D00F08B25 /* lua_cocos2dx_network_manual.cpp in Sources */,
15415AAE19A71A53004F1E71 /* except.c in Sources */,
15C9A10E1AE4972500C15443 /* lua_cocos2dx_experimental_webview_auto.cpp in Sources */,
15415AAA19A71A53004F1E71 /* buffer.c in Sources */,
155C7E2319A71CD500F08B25 /* lua_cocos2dx_experimental_video_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_experimental_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_physics_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\tolua_fix.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" />
</ItemGroup>
<ItemGroup>
@ -107,6 +109,7 @@
<ClInclude Include="..\auto\lua_cocos2dx_csloader_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_webview_auto.hpp" />
<ClInclude Include="..\auto\lua_cocos2dx_extension_auto.hpp" />
<ClInclude Include="..\auto\lua_cocos2dx_physics_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\tolua_fix.h" />
<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" />
</ItemGroup>
<ItemGroup>

View File

@ -267,6 +267,12 @@
<ClCompile Include="..\manual\cocostudio\lua-cocos-studio-conversions.cpp">
<Filter>manual\cocostudio</Filter>
</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>
<ClInclude Include="..\auto\lua_cocos2dx_auto.hpp">
@ -467,6 +473,12 @@
<ClInclude Include="..\manual\cocostudio\lua-cocos-studio-conversions.h">
<Filter>manual\cocostudio</Filter>
</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>
<None Include="..\script\CCBReaderLoad.lua">

View File

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

View File

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

View File

@ -28,7 +28,6 @@
#include "base/CCVector.h"
#include "base/CCDirector.h"
#include "renderer/CCGLProgram.h"
#include "ui/shaders/UIShaders.h"
#include "renderer/ccShaders.h"
NS_CC_BEGIN
@ -879,9 +878,7 @@ namespace ui {
break;
case State::GRAY:
{
auto program = GLProgram::createWithByteArrays(ccPositionTextureColor_noMVP_vert,
ccUIGrayScale_frag);
glState = GLProgramState::getOrCreateWithGLProgram(program);
glState = GLProgramState::getOrCreateWithGLProgramName(GLProgram::SHADER_NAME_POSITION_GRAYSCALE);
}
default:
break;

View File

@ -27,7 +27,7 @@
#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"

View File

@ -34,7 +34,6 @@ THE SOFTWARE.
#include "renderer/CCGLProgram.h"
#include "renderer/CCGLProgramState.h"
#include "renderer/ccShaders.h"
#include "ui/shaders/UIShaders.h"
NS_CC_BEGIN
@ -1169,9 +1168,8 @@ GLProgramState* Widget::getNormalGLProgramState()const
GLProgramState* Widget::getGrayGLProgramState()const
{
auto program = GLProgram::createWithByteArrays(ccPositionTextureColor_noMVP_vert,
ccUIGrayScale_frag);
GLProgramState *glState = GLProgramState::getOrCreateWithGLProgram(program);
GLProgramState *glState = nullptr;
glState = GLProgramState::getOrCreateWithGLProgramName(GLProgram::SHADER_NAME_POSITION_GRAYSCALE);
return glState;
}

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
Particle3D::Particle3D()
: position(Vec3::ZERO)
, color(Vec4::ONE)
: color(Vec4::ONE)
, rt_uv(Vec2::ONE)
, width(1.0f)
, height(1.0f)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1075,6 +1075,7 @@
"cocos/renderer/ccShader_PositionTexture_uColor.vert",
"cocos/renderer/ccShader_Position_uColor.frag",
"cocos/renderer/ccShader_Position_uColor.vert",
"cocos/renderer/ccShader_UI_Gray.frag",
"cocos/renderer/ccShaders.cpp",
"cocos/renderer/ccShaders.h",
"cocos/storage/CMakeLists.txt",
@ -1163,9 +1164,6 @@
"cocos/ui/UIWidget.h",
"cocos/ui/proj.win32/libui.vcxproj",
"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/CONTRIBUTE.md",
"docs/Groups.h",
@ -4855,6 +4853,7 @@
"cocos/scripting/lua-bindings/auto/api/Waves.lua",
"cocos/scripting/lua-bindings/auto/api/Waves3D.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/ZOrderFrame.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_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_webview_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_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_video_auto.cpp",
"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.hpp",
"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/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_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.hpp",
"cocos/scripting/lua-bindings/manual/video/lua_cocos2dx_experimental_video_manual.cpp",
@ -5238,6 +5242,7 @@
"tools/tolua/cocos2dx_csloader.ini",
"tools/tolua/cocos2dx_experimental.ini",
"tools/tolua/cocos2dx_experimental_video.ini",
"tools/tolua/cocos2dx_experimental_webview.ini",
"tools/tolua/cocos2dx_extension.ini",
"tools/tolua/cocos2dx_physics.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()
{
Pause();
@ -137,4 +142,9 @@ void Cocos2dRenderer::QueuePointerEvent(cocos2d::PointerEventType type, Windows:
GLViewImpl::sharedOpenGLView()->QueuePointerEvent(type, args);
}
void Cocos2dRenderer::QueueBackButtonEvent()
{
GLViewImpl::sharedOpenGLView()->QueueBackKeyPress();
}

View File

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

View File

@ -169,16 +169,23 @@ void OpenGLESPage::OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Wi
}
#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)
{
bool myAppCanNavigate = false;
if (myAppCanNavigate)
if (m_renderer)
{
m_renderer->QueueBackButtonEvent();
args->Handled = true;
}
else {
// Do nothing. Leave args->Handled set to the current value, false.
}
}
#endif
@ -250,6 +257,15 @@ void OpenGLESPage::RecoverFromLostDevice()
StartRenderLoop();
}
void OpenGLESPage::TerminateApp()
{
{
critical_section::scoped_lock lock(mRenderSurfaceCriticalSection);
DestroyRenderSurface();
}
Windows::UI::Xaml::Application::Current->Exit();
}
void OpenGLESPage::StartRenderLoop()
{
// If the render loop is already running then do not start another thread.
@ -274,8 +290,6 @@ void OpenGLESPage::StartRenderLoop()
GLsizei panelHeight = 0;
GetSwapChainPanelSize(&panelWidth, &panelHeight);
if (m_renderer.get() == nullptr)
{
m_renderer = std::make_shared<Cocos2dRenderer>(panelWidth, panelHeight, m_dpi, m_orientation, dispatcher, swapChainPanel);
@ -316,6 +330,17 @@ void OpenGLESPage::StartRenderLoop()
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)

View File

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

View File

@ -78,11 +78,6 @@ bool HelloWorld::init()
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();
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)

View File

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

View File

@ -180,10 +180,6 @@ void TestList::runThisTest()
{
//Add close and "Start AutoTest" button.
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::destroyInstance();
Director::getInstance()->end();

View File

@ -91,6 +91,12 @@
<PackageCertificateKeyFile>cpp-tests.Windows_TemporaryKey.pfx</PackageCertificateKeyFile>
<PackageCertificateThumbprint>35C2132BDB64C0DFA54722663D9148FF118E341B</PackageCertificateThumbprint>
</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" />
<ItemDefinitionGroup Condition="'$(Platform)'=='ARM'">
<Link>

View File

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

View File

@ -29,9 +29,6 @@ function UIScene:init()
self._sceneTitle = root:getChildByName("UItest")
local back_label = root:getChildByName("back")--getWidgetByName
back_label:setVisible(false)
local function previousCallback(sender, eventType)
if eventType == ccui.TouchEventType.ended then
cc.Director:getInstance():replaceScene(guiSceneManager.previousUIScene())
@ -711,9 +708,6 @@ function UILoadingBarLeftTest:initExtend()
local root = self._uiLayer:getChildByTag(81)
self._sceneTitle = root:getChildByName("UItest")
local back_label = root:getChildByName("back")
back_label:setVisible(false)
local widgetSize = self._widget:getContentSize()
local alert = ccui.Text:create()
@ -837,9 +831,6 @@ function UILoadingBarRightTest:initExtend()
local root = self._uiLayer:getChildByTag(81)
self._sceneTitle = root:getChildByName("UItest")
local back_label = root:getChildByName("back")
back_label:setVisible(false)
local widgetSize = self._widget:getContentSize()
local alert = ccui.Text:create()
@ -964,9 +955,6 @@ function UILoadingBarLeftScale9Test:initExtend()
local root = self._uiLayer:getChildByTag(81)
self._sceneTitle = root:getChildByName("UItest")
local back_label = root:getChildByName("back")
back_label:setVisible(false)
local widgetSize = self._widget:getContentSize()
local alert = ccui.Text:create()
@ -1093,9 +1081,6 @@ function UILoadingBarRightScale9Test:initExtend()
local root = self._uiLayer:getChildByTag(81)
self._sceneTitle = root:getChildByName("UItest")
local back_label = root:getChildByName("back")
back_label:setVisible(false)
local widgetSize = self._widget:getContentSize()
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 "NewAudioEngineTest/NewAudioEngineTest"
require "CocosStudio3DTest/CocosStudio3DTest"
require "WebViewTest/WebViewTest"
local LINE_SPACE = 40
@ -134,6 +135,7 @@ local _allTests = {
{ isSupported = true, name = "TransitionsTest" , create_func = TransitionsTest },
{ isSupported = true, name = "UserDefaultTest" , create_func= UserDefaultTestMain },
{ isSupported = true, name = "VideoPlayerTest" , create_func= VideoPlayerTestMain },
{ isSupported = true, name = "WebViewTest" , create_func= WebViewTestMain },
{ isSupported = true, name = "XMLHttpRequestTest" , create_func = XMLHttpRequestTestMain },
{ isSupported = true, name = "ZwoptexTest" , create_func = ZwoptexTestMain }
}
@ -196,6 +198,12 @@ function CreateTestMenu()
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:setPosition(cc.p(s.width / 2, (s.height - (index) * LINE_SPACE)))
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_audioengine.ini': ('cocos2dx_audioengine', 'lua_cocos2dx_audioengine_auto'), \
'cocos2dx_csloader.ini' : ('cocos2dx_csloader', 'lua_cocos2dx_csloader_auto'), \
'cocos2dx_experimental_webview.ini' : ('cocos2dx_experimental_webview', 'lua_cocos2dx_experimental_webview_auto'), \
}
target = 'lua'
generator_py = '%s/generator.py' % cxx_generator_root