diff --git a/.travis.yml b/.travis.yml index 1739a0557d..1bccfbf9d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,4 +37,4 @@ before_install: # whitelist branches: only: - - v3.8 + - v3 diff --git a/AUTHORS b/AUTHORS index 53eb9bed07..331a7f56a7 100644 --- a/AUTHORS +++ b/AUTHORS @@ -412,6 +412,7 @@ Developers: UI: Added ScrollViewBar for displaying a scroll bar at the side of ScrollView UI: Added RadioButton widget UI: Refined scroll event dispatching for ScrollView + platform: Fixed Android app occasionally freeze issue caused by Cocos2dxRenderer.nativeOnResume() is not called when the activity is resumed Sam Clegg (sbc100) Author of Native Client port. @@ -1157,7 +1158,10 @@ Developers: perminovVS Optimize Vec3 and Vec2 Added `UserDefault::setDelegate()` + FileUtils: Added FileUtils::getSuitableFOpen() for convert utf8 to locale, for specific platform platform: Correct all usage of unicode version winapi in FileUtils for win32 + FileUtils: Added FileUtils::getFileExtension for getting file's extension name + utils: Made utils::captureScreen saving file in another thread to improve the performance qiutaoleo Added a feature to check case characters for filename on windows diff --git a/CHANGELOG b/CHANGELOG index cda46bc560..e6c0c7f48e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,5 @@ -cocos2d-x-3.8 rc0 ?? +cocos2d-x-3.8 final September.6 2015 +cocos2d-x-3.8 rc0 August.26 2015 cocos2d-x-3.8 beta0 August.14 2015 [HIGHLIGHT] 3D: Added 3d physics collider @@ -7,7 +8,7 @@ cocos2d-x-3.8 beta0 August.14 2015 [HIGHLIGHT] FileUtils: Added a set of file writing APIs: writeStringToFile, writeDataToFile, writeValueMapToFile, writeValueVectorToFile [HIGHLIGHT] UI: Refined UI system [HIGHLIGHT] UI: Added RadioButton widget (JSB/Lua ready) - [HIGHLIGHT] UI: Reimplemented and enhanced EditBox on Android + [HIGHLIGHT] UI: Reimplemented and enhanced EditBox on Android: display cursor; support copy, cut, paste and select actions; support multi-line input; pretty adjustment when virtual keyboard shown [HIGHLIGHT] JS: Bound new AudioEngine in JSB [HIGHLIGHT] JS: Merged JSB test project into cocos2d test project [HIGHLIGHT] network: Upgrade SocketIO support to v1.x @@ -27,6 +28,7 @@ cocos2d-x-3.8 beta0 August.14 2015 [NEW] audio: AudioEngine supported audio preloading [NEW] UserDefault: Supported removing key pairs from UserDefault [NEW] spine: Supported Spine runtime 2.3 (Both native and web engine) + [NEW] JS: Added auto binding for BlendFuncFrame [NEW] console: Supported new portrait projects from templates [NEW] console: Moved the framework-compile tools into cocos2d-console [NEW] framework: Support generate prebuilt libs of engine with debug mode @@ -35,6 +37,10 @@ cocos2d-x-3.8 beta0 August.14 2015 [REFINE] 3D: Supported composite 2D/3D scene by moving UI and camera far away [REFINE] 3D: Improved Particle3D performance [REFINE] 3D: Made SkyBox not transparent + [REFINE] 3D: Enable depth write for SkyBox + [REFINE] 3D: Enable depth write for transparent object + [REFINE] 3D: Set depth test function of Skybox brush to always + [REFINE] renderer: Enabled blending all the time for 2D render queue [REFINE] Director: Made types to handle time consistent by modifing setAnimationInterval argument from double to float [REFINE] Sprite: Made Sprite::setTexture accept nullptr as parameter [REFINE] TextureCache: Made addImageAsync function thread safe @@ -52,6 +58,7 @@ cocos2d-x-3.8 beta0 August.14 2015 [REFINE] studio: Avoid CSLoader from openning csb file multiple times with fopen [REFINE] studio: Added BlendFrame support to Skeleton Animation [REFINE] studio: Enabled blendfunc cascade to the skin of BoneNode + [REFINE] studio: Update reader with parse logic for valid attribute of SkyBox [REFINE] FileUtils: Remove old path while adding existing search path [REFINE] Device: Implemented Device::getDPI for Mac [REFINE] network: Refine NSLog in HttpAsynConnection in release mode @@ -92,6 +99,7 @@ cocos2d-x-3.8 beta0 August.14 2015 [FIX] renderer: Fixed shader issue by reloading shader when light number changed [FIX] Scheduler: Fixed timer's delta time is error when interval equals to zero [FIX] Scheduler: Fixed Pause/Resume act incorrectly + [FIX] Scheduler: Fixed the callback will be executed multiple times if the value of delay parameter equal zero [FIX] Node: Fixed issue that euler angle is NaN when update Euler angle from quaternion and asin value is not between -1 and 1 by accident [FIX] Scene: Fixed bug that can't add custom member to Scene subclass [FIX] Sprite: Fixed some warnings and a related bug in CCSprite @@ -131,6 +139,9 @@ cocos2d-x-3.8 beta0 August.14 2015 [FIX] UI: Fixed EditBox input maxLength for Chinese character issue on iOS [FIX] UI: Fixed EditBox turning black when soft keyboard hiding [FIX] UI: Fixed scrollview innerContainer initial position error + [FIX] UI: Fixed issue that Slider create function is not taking account of res type (TextureResType) + [FIX] Scale9Sprite: Fixed Scale9Sprite default capInset bug + [FIX] Scale9Sprite: Fixed issue that Scale9Sprite draw extra 1 pixel when creating from spritesheet [FIX] studio: Removed "using namespace cocos2d" from CCFrame.h [FIX] studio: Fixed the SkyBox display error while parsed from editor files [FIX] studio: Fixed userCamera flag error while parsing old version exported files @@ -138,6 +149,8 @@ cocos2d-x-3.8 beta0 August.14 2015 [FIX] studio: Fixed crash when loading cocostudio json files with null or empty fontName [FIX] studio: Fixed bug that setColor works on a whole armature, but not on an individual bone [FIX] studio: Fixed object size error while data is error + [FIX] studio: Fixed issue that bone's color and opacity cannot cascade to bone + [FIX] studio: Fixed issue that bone can be see by other cameras [FIX] ClippingNode: Removed CCClippingRectangleNode transform error support [FIX] spine: Fixed the position of debug draw of bones is incorrect [FIX] spine: Fixed memory leak caused by SkeletonRenderer::initialize @@ -174,6 +187,7 @@ cocos2d-x-3.8 beta0 August.14 2015 [FIX] platform: Removed unneeded protocol for AppController on iOS [FIX] platform: Fixed link errors in release mode on win32 [FIX] platform: Fixed Windows 10 UWP and WP8.1 app certification issue + [FIX] platform: Fixed Android app occasionally freeze issue caused by Cocos2dxRenderer.nativeOnResume() is not called when the activity is resumed [FIX] web: Fixed a bug that VideoPlayer remove event throw error [FIX] web: Fixed Armature position error in studio JSON parser [FIX] web: Fixed default clearColor error in director @@ -187,6 +201,9 @@ cocos2d-x-3.8 beta0 August.14 2015 [FIX] web: Fixed logic issue in Menu's _onTouchCancelled function [FIX] web: Fixed MenuItem crash when normal image is null [FIX] web: Fixed CCTouch's startPoint unset issue + [FIX] web: Fixed incomplete fadeout effects + [FIX] web: Fixed issue that return value of cc.screen.fullScreen is not boolean + [FIX] web: Fixed a bug that SkeletonNode is not drawing children [TEST] 3D: Avoid to trigger touch event multiple times in Physics3D Test and Physics3D Constraint Test [TEST] 3D: Fixed Sprite3D test background to foreground bug diff --git a/docs/CONTRIBUTE.md b/CONTRIBUTING.md similarity index 100% rename from docs/CONTRIBUTE.md rename to CONTRIBUTING.md diff --git a/README.md b/README.md index a9881ea68e..0b82c061ac 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@ cocos2d-x | |iOS|Mac|Linux|Win32|Android|Win8.1-Universal| | ----|----|----- | ---|----|------|---| -|v3|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v3/node=ios)](http://45.56.80.45:8080/job/daily-build-v3/node=ios)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v3/node=mac)](http://45.56.80.45:8080/job/daily-build-v3/node=mac)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v3/node=linux)](http://45.56.80.45:8080/job/daily-build-v3/node=linux)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v3/node=win32)](http://45.56.80.45:8080/job/daily-build-v3/node=win32)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v3/node=android)](http://45.56.80.45:8080/job/daily-build-v3/node=android)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v3/node=windows-universal)](http://45.56.80.45:8080/job/daily-build-v3/node=windows-universal)| -|v4|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v4/node=ios)](http://45.56.80.45:8080/job/daily-build-v4/node=ios)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v4/node=mac)](http://45.56.80.45:8080/job/daily-build-v4/node=mac)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v4/node=linux)](http://45.56.80.45:8080/job/daily-build-v4/node=linux)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v4/node=win32)](http://45.56.80.45:8080/job/daily-build-v4/node=win32)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v4/node=android)](http://45.56.80.45:8080/job/daily-build-v4/node=android)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v4/node=windows-universal)](http://45.56.80.45:8080/job/daily-build-v4/node=windows-universal)| +|v3|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v3/node=ios)](http://45.56.80.45:8080/job/daily-build-v3/node=ios)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v3/node=mac)](http://45.56.80.45:8080/job/daily-build-v3/node=mac)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v3/node=linux)](http://45.56.80.45:8080/job/daily-build-v3/node=linux)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v3/node=win32_bak)](http://45.56.80.45:8080/job/daily-build-v3/node=win32_bak)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v3/node=android)](http://45.56.80.45:8080/job/daily-build-v3/node=android)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v3/node=windows-universal_bak)](http://45.56.80.45:8080/job/daily-build-v3/node=windows-universal_bak)| +|v4|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v4/node=ios)](http://45.56.80.45:8080/job/daily-build-v4/node=ios)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v4/node=mac)](http://45.56.80.45:8080/job/daily-build-v4/node=mac)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v4/node=linux)](http://45.56.80.45:8080/job/daily-build-v4/node=linux)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v4/node=win32_bak)](http://45.56.80.45:8080/job/daily-build-v4/node=win32_bak)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v4/node=android)](http://45.56.80.45:8080/job/daily-build-v4/node=android)|[![Build Status](http://45.56.80.45:8080/buildStatus/icon?job=daily-build-v4/node=windows-universal_bak)](http://45.56.80.45:8080/job/daily-build-v4/node=windows-universal_bak)| diff --git a/build/cocos2d-win32.sln b/build/cocos2d-win32.sln index f689a11290..b08c7a3b98 100644 --- a/build/cocos2d-win32.sln +++ b/build/cocos2d-win32.sln @@ -31,6 +31,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libjscocos2d", "..\cocos\sc EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "js-tests", "..\tests\js-tests\project\proj.win32\js-tests.vcxproj", "{D0F06A44-A245-4D13-A498-0120C203B539}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "performance-tests", "..\tests\performance-tests\proj.win32\performance-tests.vcxproj", "{2778C02D-DDD0-4A92-A6AA-C3E2B7EDE3FF}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|ARM = Debug|ARM @@ -111,6 +113,12 @@ Global {D0F06A44-A245-4D13-A498-0120C203B539}.Release|ARM.ActiveCfg = Release|Win32 {D0F06A44-A245-4D13-A498-0120C203B539}.Release|Win32.ActiveCfg = Release|Win32 {D0F06A44-A245-4D13-A498-0120C203B539}.Release|Win32.Build.0 = Release|Win32 + {2778C02D-DDD0-4A92-A6AA-C3E2B7EDE3FF}.Debug|ARM.ActiveCfg = Debug|Win32 + {2778C02D-DDD0-4A92-A6AA-C3E2B7EDE3FF}.Debug|Win32.ActiveCfg = Debug|Win32 + {2778C02D-DDD0-4A92-A6AA-C3E2B7EDE3FF}.Debug|Win32.Build.0 = Debug|Win32 + {2778C02D-DDD0-4A92-A6AA-C3E2B7EDE3FF}.Release|ARM.ActiveCfg = Release|Win32 + {2778C02D-DDD0-4A92-A6AA-C3E2B7EDE3FF}.Release|Win32.ActiveCfg = Release|Win32 + {2778C02D-DDD0-4A92-A6AA-C3E2B7EDE3FF}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/build/cocos2d_libs.xcodeproj/project.pbxproj b/build/cocos2d_libs.xcodeproj/project.pbxproj index 07192a1712..759d59cf59 100644 --- a/build/cocos2d_libs.xcodeproj/project.pbxproj +++ b/build/cocos2d_libs.xcodeproj/project.pbxproj @@ -1219,6 +1219,17 @@ 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 */; }; + 2980F0221BA9A5550059E678 /* CCUIEditBoxIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 2980F0171BA9A5550059E678 /* CCUIEditBoxIOS.h */; }; + 2980F0231BA9A5550059E678 /* CCUIEditBoxIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2980F0181BA9A5550059E678 /* CCUIEditBoxIOS.mm */; }; + 2980F0241BA9A5550059E678 /* CCUIMultilineTextField.h in Headers */ = {isa = PBXBuildFile; fileRef = 2980F0191BA9A5550059E678 /* CCUIMultilineTextField.h */; }; + 2980F0251BA9A5550059E678 /* CCUIMultilineTextField.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2980F01A1BA9A5550059E678 /* CCUIMultilineTextField.mm */; }; + 2980F0261BA9A5550059E678 /* CCUISingleLineTextField.h in Headers */ = {isa = PBXBuildFile; fileRef = 2980F01B1BA9A5550059E678 /* CCUISingleLineTextField.h */; }; + 2980F0271BA9A5550059E678 /* CCUISingleLineTextField.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2980F01C1BA9A5550059E678 /* CCUISingleLineTextField.mm */; }; + 2980F0281BA9A5550059E678 /* CCUITextInput.h in Headers */ = {isa = PBXBuildFile; fileRef = 2980F01D1BA9A5550059E678 /* CCUITextInput.h */; }; + 2980F0291BA9A5550059E678 /* UITextField+CCUITextInput.h in Headers */ = {isa = PBXBuildFile; fileRef = 2980F01E1BA9A5550059E678 /* UITextField+CCUITextInput.h */; }; + 2980F02A1BA9A5550059E678 /* UITextField+CCUITextInput.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2980F01F1BA9A5550059E678 /* UITextField+CCUITextInput.mm */; }; + 2980F02B1BA9A5550059E678 /* UITextView+CCUITextInput.h in Headers */ = {isa = PBXBuildFile; fileRef = 2980F0201BA9A5550059E678 /* UITextView+CCUITextInput.h */; }; + 2980F02C1BA9A5550059E678 /* UITextView+CCUITextInput.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2980F0211BA9A5550059E678 /* UITextView+CCUITextInput.mm */; }; 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 */; }; @@ -1310,6 +1321,10 @@ 38F526411A48363B000DB7F7 /* ArmatureNodeReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 38F5263C1A48363B000DB7F7 /* ArmatureNodeReader.h */; }; 38F526421A48363B000DB7F7 /* CSArmatureNode_generated.h in Headers */ = {isa = PBXBuildFile; fileRef = 38F5263D1A48363B000DB7F7 /* CSArmatureNode_generated.h */; }; 38F526431A48363B000DB7F7 /* CSArmatureNode_generated.h in Headers */ = {isa = PBXBuildFile; fileRef = 38F5263D1A48363B000DB7F7 /* CSArmatureNode_generated.h */; }; + 3E2A09C21BAA91B70086B878 /* CCMotionStreak3D.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E2A09C01BAA91B70086B878 /* CCMotionStreak3D.cpp */; }; + 3E2A09C31BAA91B70086B878 /* CCMotionStreak3D.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E2A09C01BAA91B70086B878 /* CCMotionStreak3D.cpp */; }; + 3E2A09C41BAA91B70086B878 /* CCMotionStreak3D.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E2A09C11BAA91B70086B878 /* CCMotionStreak3D.h */; }; + 3E2A09C51BAA91B70086B878 /* CCMotionStreak3D.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E2A09C11BAA91B70086B878 /* CCMotionStreak3D.h */; }; 3E2BDADE19C030ED0055CDCD /* AudioEngine.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E2BDADD19C030ED0055CDCD /* AudioEngine.h */; }; 3E2BDAEC19C0436F0055CDCD /* AudioEngine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E2BDAEB19C0436F0055CDCD /* AudioEngine.cpp */; }; 3E2F27A619CFBFE100E7C490 /* AudioEngine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E2BDAEB19C0436F0055CDCD /* AudioEngine.cpp */; }; @@ -1479,12 +1494,6 @@ 507003221B69735300E83DDD /* HttpConnection-winrt.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 507003191B69735200E83DDD /* HttpConnection-winrt.cpp */; }; 507003231B69735300E83DDD /* HttpConnection-winrt.h in Headers */ = {isa = PBXBuildFile; fileRef = 5070031A1B69735200E83DDD /* HttpConnection-winrt.h */; }; 507003241B69735300E83DDD /* HttpConnection-winrt.h in Headers */ = {isa = PBXBuildFile; fileRef = 5070031A1B69735200E83DDD /* HttpConnection-winrt.h */; }; - 5070032A1B69826F00E83DDD /* CCDownloaderImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 507003281B69826F00E83DDD /* CCDownloaderImpl.cpp */; }; - 5070032B1B69826F00E83DDD /* CCDownloaderImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 507003281B69826F00E83DDD /* CCDownloaderImpl.cpp */; }; - 5070032C1B69826F00E83DDD /* CCDownloaderImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 507003291B69826F00E83DDD /* CCDownloaderImpl.h */; }; - 5070032D1B69826F00E83DDD /* CCDownloaderImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 507003291B69826F00E83DDD /* CCDownloaderImpl.h */; }; - 5070032F1B69898400E83DDD /* CCIDownloaderImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 5070032E1B69898400E83DDD /* CCIDownloaderImpl.h */; }; - 507003301B69898400E83DDD /* CCIDownloaderImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 5070032E1B69898400E83DDD /* CCIDownloaderImpl.h */; }; 5091A7A319BFABA800AC8789 /* CCPlatformDefine.h in Headers */ = {isa = PBXBuildFile; fileRef = 5091A7A219BFABA800AC8789 /* CCPlatformDefine.h */; }; 50ABBD381925AB0000A911A9 /* CCAffineTransform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50ABBD1B1925AB0000A911A9 /* CCAffineTransform.cpp */; }; 50ABBD391925AB0000A911A9 /* CCAffineTransform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50ABBD1B1925AB0000A911A9 /* CCAffineTransform.cpp */; }; @@ -1871,11 +1880,39 @@ 85505F0E1B60E3DB003F2CD4 /* SkeletonNodeReader.h in Headers */ = {isa = PBXBuildFile; fileRef = C50306741B60B5B2001E6D43 /* SkeletonNodeReader.h */; }; 85B3743A1B204B9400C488D6 /* clipper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 85B374381B204B9400C488D6 /* clipper.cpp */; }; 85B3743B1B204B9400C488D6 /* clipper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 85B374381B204B9400C488D6 /* clipper.cpp */; }; - 943CF4541B7DB10F00B6303F /* GameNode3DReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 943CF4521B7DB10F00B6303F /* GameNode3DReader.cpp */; }; - 943CF4551B7DB10F00B6303F /* GameNode3DReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 943CF4521B7DB10F00B6303F /* GameNode3DReader.cpp */; }; - 943CF4561B7DB10F00B6303F /* GameNode3DReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 943CF4531B7DB10F00B6303F /* GameNode3DReader.h */; }; - 943CF4571B7DB10F00B6303F /* GameNode3DReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 943CF4531B7DB10F00B6303F /* GameNode3DReader.h */; }; + A045F6D61BA81577005076C7 /* CCTextureCube.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A045F6D41BA81577005076C7 /* CCTextureCube.cpp */; }; + A045F6D71BA81577005076C7 /* CCTextureCube.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A045F6D41BA81577005076C7 /* CCTextureCube.cpp */; }; + A045F6D81BA81577005076C7 /* CCTextureCube.h in Headers */ = {isa = PBXBuildFile; fileRef = A045F6D51BA81577005076C7 /* CCTextureCube.h */; }; + A045F6D91BA81577005076C7 /* CCTextureCube.h in Headers */ = {isa = PBXBuildFile; fileRef = A045F6D51BA81577005076C7 /* CCTextureCube.h */; }; + A045F6DC1BA816A1005076C7 /* CCCameraBackgroundBrush.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A045F6DA1BA816A1005076C7 /* CCCameraBackgroundBrush.cpp */; }; + A045F6DD1BA816A1005076C7 /* CCCameraBackgroundBrush.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A045F6DA1BA816A1005076C7 /* CCCameraBackgroundBrush.cpp */; }; + A045F6DE1BA816A1005076C7 /* CCCameraBackgroundBrush.h in Headers */ = {isa = PBXBuildFile; fileRef = A045F6DB1BA816A1005076C7 /* CCCameraBackgroundBrush.h */; }; + A045F6DF1BA816A1005076C7 /* CCCameraBackgroundBrush.h in Headers */ = {isa = PBXBuildFile; fileRef = A045F6DB1BA816A1005076C7 /* CCCameraBackgroundBrush.h */; }; + A045F6E41BA8170A005076C7 /* CCComponentPhysics2d.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A045F6E01BA8170A005076C7 /* CCComponentPhysics2d.cpp */; }; + A045F6E51BA8170A005076C7 /* CCComponentPhysics2d.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A045F6E01BA8170A005076C7 /* CCComponentPhysics2d.cpp */; }; + A045F6E61BA8170A005076C7 /* CCComponentPhysics2d.h in Headers */ = {isa = PBXBuildFile; fileRef = A045F6E11BA8170A005076C7 /* CCComponentPhysics2d.h */; }; + A045F6E71BA8170A005076C7 /* CCComponentPhysics2d.h in Headers */ = {isa = PBXBuildFile; fileRef = A045F6E11BA8170A005076C7 /* CCComponentPhysics2d.h */; }; + A045F6E81BA8170A005076C7 /* CCPhysicsManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A045F6E21BA8170A005076C7 /* CCPhysicsManager.cpp */; }; + A045F6E91BA8170A005076C7 /* CCPhysicsManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A045F6E21BA8170A005076C7 /* CCPhysicsManager.cpp */; }; + A045F6EA1BA8170A005076C7 /* CCPhysicsManager.h in Headers */ = {isa = PBXBuildFile; fileRef = A045F6E31BA8170A005076C7 /* CCPhysicsManager.h */; }; + A045F6EB1BA8170A005076C7 /* CCPhysicsManager.h in Headers */ = {isa = PBXBuildFile; fileRef = A045F6E31BA8170A005076C7 /* CCPhysicsManager.h */; }; + A045F6EF1BA81821005076C7 /* GameNode3DReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A045F6ED1BA81821005076C7 /* GameNode3DReader.cpp */; }; + A045F6F01BA81821005076C7 /* GameNode3DReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A045F6ED1BA81821005076C7 /* GameNode3DReader.cpp */; }; + A045F6F11BA81821005076C7 /* GameNode3DReader.h in Headers */ = {isa = PBXBuildFile; fileRef = A045F6EE1BA81821005076C7 /* GameNode3DReader.h */; }; + A045F6F21BA81821005076C7 /* GameNode3DReader.h in Headers */ = {isa = PBXBuildFile; fileRef = A045F6EE1BA81821005076C7 /* GameNode3DReader.h */; }; + A0534A651B872FFD006B03E5 /* CCDownloader-apple.h in Headers */ = {isa = PBXBuildFile; fileRef = A0534A631B872FFD006B03E5 /* CCDownloader-apple.h */; }; + A0534A661B872FFD006B03E5 /* CCDownloader-apple.h in Headers */ = {isa = PBXBuildFile; fileRef = A0534A631B872FFD006B03E5 /* CCDownloader-apple.h */; }; + A0534A671B872FFD006B03E5 /* CCDownloader-apple.mm in Sources */ = {isa = PBXBuildFile; fileRef = A0534A641B872FFD006B03E5 /* CCDownloader-apple.mm */; }; + A0534A681B872FFD006B03E5 /* CCDownloader-apple.mm in Sources */ = {isa = PBXBuildFile; fileRef = A0534A641B872FFD006B03E5 /* CCDownloader-apple.mm */; }; + A0534A6A1B87306E006B03E5 /* CCIDownloaderImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = A0534A691B87306E006B03E5 /* CCIDownloaderImpl.h */; }; + A0534A6B1B87306E006B03E5 /* CCIDownloaderImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = A0534A691B87306E006B03E5 /* CCIDownloaderImpl.h */; }; + A05DCF9D1B90584E00EE040B /* CCDownloader-curl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A05DCF9B1B90584E00EE040B /* CCDownloader-curl.cpp */; }; + A05DCF9E1B90584E00EE040B /* CCDownloader-curl.h in Headers */ = {isa = PBXBuildFile; fileRef = A05DCF9C1B90584E00EE040B /* CCDownloader-curl.h */; }; A07A4CAF1783777C0073F6A7 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1551A342158F2AB200E66CFE /* Foundation.framework */; }; + A0E749F71BA8FD7F001A8332 /* UIEditBoxImpl-common.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0E749F51BA8FD7F001A8332 /* UIEditBoxImpl-common.cpp */; }; + A0E749F81BA8FD7F001A8332 /* UIEditBoxImpl-common.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0E749F51BA8FD7F001A8332 /* UIEditBoxImpl-common.cpp */; }; + A0E749F91BA8FD7F001A8332 /* UIEditBoxImpl-common.h in Headers */ = {isa = PBXBuildFile; fileRef = A0E749F61BA8FD7F001A8332 /* UIEditBoxImpl-common.h */; }; + A0E749FA1BA8FD7F001A8332 /* UIEditBoxImpl-common.h in Headers */ = {isa = PBXBuildFile; fileRef = A0E749F61BA8FD7F001A8332 /* UIEditBoxImpl-common.h */; }; B2165EEA19921124000BE3E6 /* CCPrimitiveCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B257B45E198A353E00D9A687 /* CCPrimitiveCommand.cpp */; }; B217703C1977ECB4009EE11B /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B217703B1977ECB4009EE11B /* IOKit.framework */; }; B21770401977ECE6009EE11B /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B217703F1977ECE6009EE11B /* OpenGL.framework */; }; @@ -2059,18 +2096,10 @@ B60C5BD519AC68B10056FBDE /* CCBillBoard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B60C5BD219AC68B10056FBDE /* CCBillBoard.cpp */; }; B60C5BD619AC68B10056FBDE /* CCBillBoard.h in Headers */ = {isa = PBXBuildFile; fileRef = B60C5BD319AC68B10056FBDE /* CCBillBoard.h */; }; B60C5BD719AC68B10056FBDE /* CCBillBoard.h in Headers */ = {isa = PBXBuildFile; fileRef = B60C5BD319AC68B10056FBDE /* CCBillBoard.h */; }; - B62305641B8ABA6600F0745D /* CCTextureCube.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B62305621B8ABA6600F0745D /* CCTextureCube.cpp */; }; - B62305651B8ABA6600F0745D /* CCTextureCube.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B62305621B8ABA6600F0745D /* CCTextureCube.cpp */; }; - B62305661B8ABA6600F0745D /* CCTextureCube.h in Headers */ = {isa = PBXBuildFile; fileRef = B62305631B8ABA6600F0745D /* CCTextureCube.h */; }; - B62305671B8ABA6600F0745D /* CCTextureCube.h in Headers */ = {isa = PBXBuildFile; fileRef = B62305631B8ABA6600F0745D /* CCTextureCube.h */; }; B63990CC1A490AFE00B07923 /* CCAsyncTaskPool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B63990CA1A490AFE00B07923 /* CCAsyncTaskPool.cpp */; }; B63990CD1A490AFE00B07923 /* CCAsyncTaskPool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B63990CA1A490AFE00B07923 /* CCAsyncTaskPool.cpp */; }; B63990CE1A490AFE00B07923 /* CCAsyncTaskPool.h in Headers */ = {isa = PBXBuildFile; fileRef = B63990CB1A490AFE00B07923 /* CCAsyncTaskPool.h */; }; B63990CF1A490AFE00B07923 /* CCAsyncTaskPool.h in Headers */ = {isa = PBXBuildFile; fileRef = B63990CB1A490AFE00B07923 /* CCAsyncTaskPool.h */; }; - B64073311B8FFA60005495CE /* CCMotionStreak3D.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B640732F1B8FFA60005495CE /* CCMotionStreak3D.cpp */; }; - B64073321B8FFA60005495CE /* CCMotionStreak3D.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B640732F1B8FFA60005495CE /* CCMotionStreak3D.cpp */; }; - B64073331B8FFA60005495CE /* CCMotionStreak3D.h in Headers */ = {isa = PBXBuildFile; fileRef = B64073301B8FFA60005495CE /* CCMotionStreak3D.h */; }; - B64073341B8FFA60005495CE /* CCMotionStreak3D.h in Headers */ = {isa = PBXBuildFile; fileRef = B64073301B8FFA60005495CE /* CCMotionStreak3D.h */; }; B665E1F21AA80A6500DDB1C5 /* CCPUAffector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B665E0CC1AA80A6500DDB1C5 /* CCPUAffector.cpp */; }; B665E1F31AA80A6500DDB1C5 /* CCPUAffector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B665E0CC1AA80A6500DDB1C5 /* CCPUAffector.cpp */; }; B665E1F41AA80A6500DDB1C5 /* CCPUAffector.h in Headers */ = {isa = PBXBuildFile; fileRef = B665E0CD1AA80A6500DDB1C5 /* CCPUAffector.h */; }; @@ -3607,10 +3636,6 @@ B6DD2FF61B04825B00E47F5F /* fastlz.c in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2FA51B04825B00E47F5F /* fastlz.c */; }; B6DD2FF71B04825B00E47F5F /* fastlz.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2FA61B04825B00E47F5F /* fastlz.h */; }; B6DD2FF81B04825B00E47F5F /* fastlz.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2FA61B04825B00E47F5F /* fastlz.h */; }; - B6DD36D51B8564EC0044745A /* CCCameraBackgroundBrush.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD36D31B8564EC0044745A /* CCCameraBackgroundBrush.cpp */; }; - B6DD36D61B8564EC0044745A /* CCCameraBackgroundBrush.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD36D31B8564EC0044745A /* CCCameraBackgroundBrush.cpp */; }; - B6DD36D71B8564EC0044745A /* CCCameraBackgroundBrush.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD36D41B8564EC0044745A /* CCCameraBackgroundBrush.h */; }; - B6DD36D81B8564EC0044745A /* CCCameraBackgroundBrush.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD36D41B8564EC0044745A /* CCCameraBackgroundBrush.h */; }; C50306691B60B583001E6D43 /* CCBoneNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C50306631B60B583001E6D43 /* CCBoneNode.cpp */; }; C503066A1B60B583001E6D43 /* CCBoneNode.h in Headers */ = {isa = PBXBuildFile; fileRef = C50306641B60B583001E6D43 /* CCBoneNode.h */; }; C503066B1B60B583001E6D43 /* CCSkeletonNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C50306651B60B583001E6D43 /* CCSkeletonNode.cpp */; }; @@ -4108,6 +4133,17 @@ 29394CEF19B01DBA00D2DE1A /* UIWebViewImpl-ios.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UIWebViewImpl-ios.mm"; sourceTree = ""; }; 2958244919873D8E00F9746D /* UIScale9Sprite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIScale9Sprite.cpp; sourceTree = ""; }; 2958244A19873D8E00F9746D /* UIScale9Sprite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIScale9Sprite.h; sourceTree = ""; }; + 2980F0171BA9A5550059E678 /* CCUIEditBoxIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCUIEditBoxIOS.h; sourceTree = ""; }; + 2980F0181BA9A5550059E678 /* CCUIEditBoxIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CCUIEditBoxIOS.mm; sourceTree = ""; }; + 2980F0191BA9A5550059E678 /* CCUIMultilineTextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCUIMultilineTextField.h; sourceTree = ""; }; + 2980F01A1BA9A5550059E678 /* CCUIMultilineTextField.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CCUIMultilineTextField.mm; sourceTree = ""; }; + 2980F01B1BA9A5550059E678 /* CCUISingleLineTextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCUISingleLineTextField.h; sourceTree = ""; }; + 2980F01C1BA9A5550059E678 /* CCUISingleLineTextField.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CCUISingleLineTextField.mm; sourceTree = ""; }; + 2980F01D1BA9A5550059E678 /* CCUITextInput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCUITextInput.h; sourceTree = ""; }; + 2980F01E1BA9A5550059E678 /* UITextField+CCUITextInput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITextField+CCUITextInput.h"; sourceTree = ""; }; + 2980F01F1BA9A5550059E678 /* UITextField+CCUITextInput.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UITextField+CCUITextInput.mm"; sourceTree = ""; }; + 2980F0201BA9A5550059E678 /* UITextView+CCUITextInput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITextView+CCUITextInput.h"; sourceTree = ""; }; + 2980F0211BA9A5550059E678 /* UITextView+CCUITextInput.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UITextView+CCUITextInput.mm"; sourceTree = ""; }; 2986667818B1B079000E39CA /* CCTweenFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCTweenFunction.cpp; sourceTree = ""; }; 2986667918B1B079000E39CA /* CCTweenFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCTweenFunction.h; sourceTree = ""; }; 299754F2193EC95400A54AC3 /* ObjectFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ObjectFactory.cpp; path = ../base/ObjectFactory.cpp; sourceTree = ""; }; @@ -4173,6 +4209,8 @@ 38F5263B1A48363B000DB7F7 /* ArmatureNodeReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ArmatureNodeReader.cpp; sourceTree = ""; }; 38F5263C1A48363B000DB7F7 /* ArmatureNodeReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArmatureNodeReader.h; sourceTree = ""; }; 38F5263D1A48363B000DB7F7 /* CSArmatureNode_generated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSArmatureNode_generated.h; sourceTree = ""; }; + 3E2A09C01BAA91B70086B878 /* CCMotionStreak3D.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCMotionStreak3D.cpp; sourceTree = ""; }; + 3E2A09C11BAA91B70086B878 /* CCMotionStreak3D.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCMotionStreak3D.h; sourceTree = ""; }; 3E2BDADD19C030ED0055CDCD /* AudioEngine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioEngine.h; sourceTree = ""; }; 3E2BDAEB19C0436F0055CDCD /* AudioEngine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AudioEngine.cpp; sourceTree = ""; }; 3E6176551960F89B00DE83F5 /* CCController-iOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = "CCController-iOS.mm"; path = "../base/CCController-iOS.mm"; sourceTree = ""; }; @@ -4426,9 +4464,6 @@ 507003181B69735200E83DDD /* HttpClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HttpClient.cpp; sourceTree = ""; }; 507003191B69735200E83DDD /* HttpConnection-winrt.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "HttpConnection-winrt.cpp"; sourceTree = ""; }; 5070031A1B69735200E83DDD /* HttpConnection-winrt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "HttpConnection-winrt.h"; sourceTree = ""; }; - 507003281B69826F00E83DDD /* CCDownloaderImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCDownloaderImpl.cpp; sourceTree = ""; }; - 507003291B69826F00E83DDD /* CCDownloaderImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCDownloaderImpl.h; sourceTree = ""; }; - 5070032E1B69898400E83DDD /* CCIDownloaderImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCIDownloaderImpl.h; sourceTree = ""; }; 5091A7A219BFABA800AC8789 /* CCPlatformDefine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCPlatformDefine.h; sourceTree = ""; }; 50ABBD1B1925AB0000A911A9 /* CCAffineTransform.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCAffineTransform.cpp; sourceTree = ""; }; 50ABBD1C1925AB0000A911A9 /* CCAffineTransform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCAffineTransform.h; sourceTree = ""; }; @@ -4664,9 +4699,24 @@ 5E9F61251A3FFE3D0038DE01 /* CCPlane.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCPlane.h; sourceTree = ""; }; 8525E3A11B291E42008EE815 /* clipper.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = clipper.hpp; sourceTree = ""; }; 85B374381B204B9400C488D6 /* clipper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = clipper.cpp; sourceTree = ""; }; - 943CF4521B7DB10F00B6303F /* GameNode3DReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GameNode3DReader.cpp; sourceTree = ""; }; - 943CF4531B7DB10F00B6303F /* GameNode3DReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GameNode3DReader.h; sourceTree = ""; }; + A045F6D41BA81577005076C7 /* CCTextureCube.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCTextureCube.cpp; sourceTree = ""; }; + A045F6D51BA81577005076C7 /* CCTextureCube.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCTextureCube.h; sourceTree = ""; }; + A045F6DA1BA816A1005076C7 /* CCCameraBackgroundBrush.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCCameraBackgroundBrush.cpp; sourceTree = ""; }; + A045F6DB1BA816A1005076C7 /* CCCameraBackgroundBrush.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCCameraBackgroundBrush.h; sourceTree = ""; }; + A045F6E01BA8170A005076C7 /* CCComponentPhysics2d.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCComponentPhysics2d.cpp; sourceTree = ""; }; + A045F6E11BA8170A005076C7 /* CCComponentPhysics2d.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCComponentPhysics2d.h; sourceTree = ""; }; + A045F6E21BA8170A005076C7 /* CCPhysicsManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCPhysicsManager.cpp; sourceTree = ""; }; + A045F6E31BA8170A005076C7 /* CCPhysicsManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCPhysicsManager.h; sourceTree = ""; }; + A045F6ED1BA81821005076C7 /* GameNode3DReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GameNode3DReader.cpp; sourceTree = ""; }; + A045F6EE1BA81821005076C7 /* GameNode3DReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GameNode3DReader.h; sourceTree = ""; }; + A0534A631B872FFD006B03E5 /* CCDownloader-apple.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CCDownloader-apple.h"; sourceTree = ""; }; + A0534A641B872FFD006B03E5 /* CCDownloader-apple.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "CCDownloader-apple.mm"; sourceTree = ""; }; + A0534A691B87306E006B03E5 /* CCIDownloaderImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCIDownloaderImpl.h; sourceTree = ""; }; + A05DCF9B1B90584E00EE040B /* CCDownloader-curl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "CCDownloader-curl.cpp"; sourceTree = ""; }; + A05DCF9C1B90584E00EE040B /* CCDownloader-curl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CCDownloader-curl.h"; sourceTree = ""; }; A07A4D641783777C0073F6A7 /* libcocos2d iOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libcocos2d iOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + A0E749F51BA8FD7F001A8332 /* UIEditBoxImpl-common.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "UIEditBoxImpl-common.cpp"; sourceTree = ""; }; + A0E749F61BA8FD7F001A8332 /* UIEditBoxImpl-common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIEditBoxImpl-common.h"; sourceTree = ""; }; B20564AA1A6E5744001C1B6E /* ccShader_PositionColorTextureAsPointsize.vert */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = ccShader_PositionColorTextureAsPointsize.vert; sourceTree = ""; }; B217703B1977ECB4009EE11B /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; }; B217703D1977ECC1009EE11B /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; @@ -4775,12 +4825,8 @@ B603F1B21AC8F1FD00A9579C /* ccShader_3D_Terrain.vert */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = ccShader_3D_Terrain.vert; sourceTree = ""; }; B60C5BD219AC68B10056FBDE /* CCBillBoard.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCBillBoard.cpp; sourceTree = ""; }; B60C5BD319AC68B10056FBDE /* CCBillBoard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCBillBoard.h; sourceTree = ""; }; - B62305621B8ABA6600F0745D /* CCTextureCube.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCTextureCube.cpp; sourceTree = ""; }; - B62305631B8ABA6600F0745D /* CCTextureCube.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCTextureCube.h; sourceTree = ""; }; B63990CA1A490AFE00B07923 /* CCAsyncTaskPool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CCAsyncTaskPool.cpp; path = ../base/CCAsyncTaskPool.cpp; sourceTree = ""; }; B63990CB1A490AFE00B07923 /* CCAsyncTaskPool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCAsyncTaskPool.h; path = ../base/CCAsyncTaskPool.h; sourceTree = ""; }; - B640732F1B8FFA60005495CE /* CCMotionStreak3D.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCMotionStreak3D.cpp; sourceTree = ""; }; - B64073301B8FFA60005495CE /* CCMotionStreak3D.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCMotionStreak3D.h; sourceTree = ""; }; B665E0CC1AA80A6500DDB1C5 /* CCPUAffector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CCPUAffector.cpp; path = Particle3D/PU/CCPUAffector.cpp; sourceTree = ""; }; B665E0CD1AA80A6500DDB1C5 /* CCPUAffector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCPUAffector.h; path = Particle3D/PU/CCPUAffector.h; sourceTree = ""; }; B665E0CE1AA80A6500DDB1C5 /* CCPUAffectorManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CCPUAffectorManager.cpp; path = Particle3D/PU/CCPUAffectorManager.cpp; sourceTree = ""; }; @@ -5556,8 +5602,6 @@ B6DD2FA31B04825B00E47F5F /* DetourTileCacheBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetourTileCacheBuilder.h; sourceTree = ""; }; B6DD2FA51B04825B00E47F5F /* fastlz.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fastlz.c; sourceTree = ""; }; B6DD2FA61B04825B00E47F5F /* fastlz.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fastlz.h; sourceTree = ""; }; - B6DD36D31B8564EC0044745A /* CCCameraBackgroundBrush.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCCameraBackgroundBrush.cpp; sourceTree = ""; }; - B6DD36D41B8564EC0044745A /* CCCameraBackgroundBrush.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCCameraBackgroundBrush.h; sourceTree = ""; }; C50306631B60B583001E6D43 /* CCBoneNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCBoneNode.cpp; sourceTree = ""; }; C50306641B60B583001E6D43 /* CCBoneNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCBoneNode.h; sourceTree = ""; }; C50306651B60B583001E6D43 /* CCSkeletonNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCSkeletonNode.cpp; sourceTree = ""; }; @@ -6822,6 +6866,9 @@ 292DB12E19B4574100A80320 /* UIEditBox */ = { isa = PBXGroup; children = ( + 2980F0161BA9A5550059E678 /* iOS */, + A0E749F51BA8FD7F001A8332 /* UIEditBoxImpl-common.cpp */, + A0E749F61BA8FD7F001A8332 /* UIEditBoxImpl-common.h */, 50ED2BDC19BEAF7900A0AB90 /* UIEditBoxImpl-win32.h */, 50ED2BDE19BEAF7900A0AB90 /* UIEditBoxImpl-win32.cpp */, 292DB12F19B4574100A80320 /* UIEditBox.cpp */, @@ -6848,6 +6895,24 @@ name = mac; sourceTree = ""; }; + 2980F0161BA9A5550059E678 /* iOS */ = { + isa = PBXGroup; + children = ( + 2980F0171BA9A5550059E678 /* CCUIEditBoxIOS.h */, + 2980F0181BA9A5550059E678 /* CCUIEditBoxIOS.mm */, + 2980F0191BA9A5550059E678 /* CCUIMultilineTextField.h */, + 2980F01A1BA9A5550059E678 /* CCUIMultilineTextField.mm */, + 2980F01B1BA9A5550059E678 /* CCUISingleLineTextField.h */, + 2980F01C1BA9A5550059E678 /* CCUISingleLineTextField.mm */, + 2980F01D1BA9A5550059E678 /* CCUITextInput.h */, + 2980F01E1BA9A5550059E678 /* UITextField+CCUITextInput.h */, + 2980F01F1BA9A5550059E678 /* UITextField+CCUITextInput.mm */, + 2980F0201BA9A5550059E678 /* UITextView+CCUITextInput.h */, + 2980F0211BA9A5550059E678 /* UITextView+CCUITextInput.mm */, + ); + path = iOS; + sourceTree = ""; + }; 29CB8F501929D63600C841D6 /* layout */ = { isa = PBXGroup; children = ( @@ -7339,10 +7404,10 @@ 46A169A11807B037005B8026 /* 2d */ = { isa = PBXGroup; children = ( - B6DD36D31B8564EC0044745A /* CCCameraBackgroundBrush.cpp */, - B6DD36D41B8564EC0044745A /* CCCameraBackgroundBrush.h */, 3EACC99C19F5014D00EB3C5E /* CCCamera.cpp */, 3EACC99D19F5014D00EB3C5E /* CCCamera.h */, + A045F6DA1BA816A1005076C7 /* CCCameraBackgroundBrush.cpp */, + A045F6DB1BA816A1005076C7 /* CCCameraBackgroundBrush.h */, 3EACC99E19F5014D00EB3C5E /* CCLight.cpp */, 3EACC99F19F5014D00EB3C5E /* CCLight.h */, 1A9DCA02180E6955007A3AD4 /* CCGLBufferedNode.cpp */, @@ -7368,6 +7433,10 @@ 46A170611807CE7A005B8026 /* physics */ = { isa = PBXGroup; children = ( + A045F6E01BA8170A005076C7 /* CCComponentPhysics2d.cpp */, + A045F6E11BA8170A005076C7 /* CCComponentPhysics2d.h */, + A045F6E21BA8170A005076C7 /* CCPhysicsManager.cpp */, + A045F6E31BA8170A005076C7 /* CCPhysicsManager.h */, ED74D7681A5B8A2600157FD4 /* CCPhysicsHelper.h */, 46A1706E1807CE7A005B8026 /* CCPhysicsBody.cpp */, 46A1706F1807CE7A005B8026 /* CCPhysicsBody.h */, @@ -7436,11 +7505,11 @@ 500DC89819105D41007B91BF /* renderer */ = { isa = PBXGroup; children = ( - B62305621B8ABA6600F0745D /* CCTextureCube.cpp */, - B62305631B8ABA6600F0745D /* CCTextureCube.h */, + 5034CA5D191D591900CE6051 /* shaders */, + A045F6D41BA81577005076C7 /* CCTextureCube.cpp */, + A045F6D51BA81577005076C7 /* CCTextureCube.h */, B240C5E71B09DFB000137F50 /* CCFrameBuffer.cpp */, B240C5E81B09DFB000137F50 /* CCFrameBuffer.h */, - 5034CA5D191D591900CE6051 /* shaders */, B276EF5B1988D1D500CD400F /* CCVertexIndexData.h */, B276EF5C1988D1D500CD400F /* CCVertexIndexData.cpp */, B276EF5D1988D1D500CD400F /* CCVertexIndexBuffer.h */, @@ -7571,9 +7640,11 @@ 50693C621B6BF2BC005C5820 /* Downloader */ = { isa = PBXGroup; children = ( - 507003281B69826F00E83DDD /* CCDownloaderImpl.cpp */, - 507003291B69826F00E83DDD /* CCDownloaderImpl.h */, - 5070032E1B69898400E83DDD /* CCIDownloaderImpl.h */, + A05DCF9B1B90584E00EE040B /* CCDownloader-curl.cpp */, + A05DCF9C1B90584E00EE040B /* CCDownloader-curl.h */, + A0534A691B87306E006B03E5 /* CCIDownloaderImpl.h */, + A0534A631B872FFD006B03E5 /* CCDownloader-apple.h */, + A0534A641B872FFD006B03E5 /* CCDownloader-apple.mm */, 50693C5C1B6BF2AE005C5820 /* CCDownloader.cpp */, 50693C5D1B6BF2AE005C5820 /* CCDownloader.h */, ); @@ -7700,7 +7771,7 @@ 50FCEB6818C72017004AD434 /* WidgetReader */ = { isa = PBXGroup; children = ( - 943CF4511B7DB10F00B6303F /* GameNode3DReader */, + A045F6EC1BA81821005076C7 /* GameNode3DReader */, C503066F1B60B590001E6D43 /* SkeletonReader */, 18956BAF1A9DFBEC006E9155 /* Particle3DReader */, 182C5CE21A9D70C000C30D34 /* UserCameraReader */, @@ -7865,11 +7936,11 @@ path = ../external/clipper; sourceTree = ""; }; - 943CF4511B7DB10F00B6303F /* GameNode3DReader */ = { + A045F6EC1BA81821005076C7 /* GameNode3DReader */ = { isa = PBXGroup; children = ( - 943CF4521B7DB10F00B6303F /* GameNode3DReader.cpp */, - 943CF4531B7DB10F00B6303F /* GameNode3DReader.h */, + A045F6ED1BA81821005076C7 /* GameNode3DReader.cpp */, + A045F6EE1BA81821005076C7 /* GameNode3DReader.h */, ); path = GameNode3DReader; sourceTree = ""; @@ -7877,8 +7948,8 @@ B29594B81926D61F003EEF37 /* 3d */ = { isa = PBXGroup; children = ( - B640732F1B8FFA60005495CE /* CCMotionStreak3D.cpp */, - B64073301B8FFA60005495CE /* CCMotionStreak3D.h */, + 3E2A09C01BAA91B70086B878 /* CCMotionStreak3D.cpp */, + 3E2A09C11BAA91B70086B878 /* CCMotionStreak3D.h */, B603F1A61AC8EA0900A9579C /* CCTerrain.cpp */, B603F1A71AC8EA0900A9579C /* CCTerrain.h */, B6D38B861AC3AFAC00043997 /* CCSkybox.cpp */, @@ -9102,6 +9173,7 @@ B29A7DE519EE1B7700872B35 /* SkeletonAnimation.h in Headers */, 50ABBE871925AB6F00A911A9 /* ccMacros.h in Headers */, B665E32C1AA80A6500DDB1C5 /* CCPUOnCountObserver.h in Headers */, + 3E2A09C41BAA91B70086B878 /* CCMotionStreak3D.h in Headers */, 15B3708A19EE414C00ABE682 /* Manifest.h in Headers */, 50ABBE731925AB6F00A911A9 /* CCEventListenerMouse.h in Headers */, 1A570063180BC5A10088DEC7 /* CCAction.h in Headers */, @@ -9324,6 +9396,7 @@ B665E4201AA80A6600DDB1C5 /* CCPUTextureRotatorTranslator.h in Headers */, 15AE1BC119AADFFB00C27E9E /* cocos-ext.h in Headers */, 1A5701BF180BCB5A0088DEC7 /* CCLabelAtlas.h in Headers */, + A045F6DE1BA816A1005076C7 /* CCCameraBackgroundBrush.h in Headers */, 50ABBED91925AB6F00A911A9 /* ZipUtils.h in Headers */, 50643BDB19BFAF4400EF68ED /* CCStdC.h in Headers */, 1A5701C3180BCB5A0088DEC7 /* CCLabelBMFont.h in Headers */, @@ -9346,17 +9419,14 @@ 15AE1BDD19AAE01E00C27E9E /* CCControlUtils.h in Headers */, B6CAB3271AF9AA1A00B9B856 /* btGImpactBvh.h in Headers */, 15AE198D19AAD36E00C27E9E /* CheckBoxReader.h in Headers */, - B6DD36D71B8564EC0044745A /* CCCameraBackgroundBrush.h in Headers */, B29A7E0919EE1B7700872B35 /* AttachmentLoader.h in Headers */, 1A01C68818F57BE800EFE3A6 /* CCBool.h in Headers */, B29A7E3319EE1B7700872B35 /* SlotData.h in Headers */, B665E2741AA80A6500DDB1C5 /* CCPUDoPlacementParticleEventHandler.h in Headers */, B6CAB2FF1AF9AA1A00B9B856 /* btTriangleIndexVertexArray.h in Headers */, - 5070032C1B69826F00E83DDD /* CCDownloaderImpl.h in Headers */, 15AE18E519AAD35000C27E9E /* CCActionFrame.h in Headers */, 50ABBEAD1925AB6F00A911A9 /* ccTypes.h in Headers */, 1A087AEA1860400400196EF5 /* edtaa3func.h in Headers */, - B64073331B8FFA60005495CE /* CCMotionStreak3D.h in Headers */, B6CAB43D1AF9AA1A00B9B856 /* btGpuDefines.h in Headers */, 15AE181C19AAD2F700C27E9E /* CCBundle3D.h in Headers */, 15AE189919AAD33D00C27E9E /* CCMenuItemLoader.h in Headers */, @@ -9452,7 +9522,6 @@ B665E43C1AA80A6600DDB1C5 /* CCPUVortexAffectorTranslator.h in Headers */, 15AE191C19AAD35000C27E9E /* CCTransformHelp.h in Headers */, 5034CA2F191D591100CE6051 /* ccShader_PositionTexture.vert in Headers */, - B62305661B8ABA6600F0745D /* CCTextureCube.h in Headers */, B665E4241AA80A6600DDB1C5 /* CCPUTranslateManager.h in Headers */, 15AE1C1219AAE2C600C27E9E /* CCPhysicsDebugNode.h in Headers */, B665E3381AA80A6500DDB1C5 /* CCPUOnEmissionObserverTranslator.h in Headers */, @@ -9482,6 +9551,7 @@ B6CAB4F91AF9AA1A00B9B856 /* btAlignedObjectArray.h in Headers */, 5034CA49191D591100CE6051 /* ccShader_Label_df.frag in Headers */, 292DB14119B4574100A80320 /* UIEditBoxImpl.h in Headers */, + A045F6D81BA81577005076C7 /* CCTextureCube.h in Headers */, B29A7DD919EE1B7700872B35 /* SkeletonRenderer.h in Headers */, B6DD2FC11B04825B00E47F5F /* DetourMath.h in Headers */, 50CB247919D9C5A100687767 /* AudioEngine-inl.h in Headers */, @@ -9498,6 +9568,7 @@ B6CAB2231AF9AA1A00B9B856 /* btCollisionConfiguration.h in Headers */, B6CAB2191AF9AA1A00B9B856 /* btBox2dBox2dCollisionAlgorithm.h in Headers */, 5034CA3D191D591100CE6051 /* ccShader_PositionColor.frag in Headers */, + A0534A6A1B87306E006B03E5 /* CCIDownloaderImpl.h in Headers */, 15AE18FB19AAD35000C27E9E /* CCColliderDetector.h in Headers */, 1A570280180BCC900088DEC7 /* CCSprite.h in Headers */, 292DB14719B4574100A80320 /* UIEditBoxImpl-ios.h in Headers */, @@ -9594,7 +9665,6 @@ 15AE187D19AAD33D00C27E9E /* CCBFileLoader.h in Headers */, 15AE181219AAD2F700C27E9E /* CCAnimation3D.h in Headers */, 182C5CD81A98F30500C30D34 /* Sprite3DReader.h in Headers */, - 943CF4561B7DB10F00B6303F /* GameNode3DReader.h in Headers */, 1A5702F0180BCE750088DEC7 /* CCTMXLayer.h in Headers */, 501216961AC47393009A4BEA /* CCPass.h in Headers */, 50ABC01B1926664800A911A9 /* CCSAXParser.h in Headers */, @@ -9619,6 +9689,7 @@ B6CAB23F1AF9AA1A00B9B856 /* btConvex2dConvex2dAlgorithm.h in Headers */, 382384381A259126002C4610 /* ProjectNodeReader.h in Headers */, 15FB20991AE7C57D00C31518 /* sweep.h in Headers */, + A045F6F11BA81821005076C7 /* GameNode3DReader.h in Headers */, B665E3C41AA80A6600DDB1C5 /* CCPUScaleAffectorTranslator.h in Headers */, B6CAB2631AF9AA1A00B9B856 /* btManifoldResult.h in Headers */, 15AE191019AAD35000C27E9E /* CCInputDelegate.h in Headers */, @@ -9785,6 +9856,7 @@ 15AE1A3519AAD3D500C27E9E /* b2EdgeShape.h in Headers */, B6CAB3151AF9AA1A00B9B856 /* btBoxCollision.h in Headers */, 50643BD919BFAF4400EF68ED /* CCApplication.h in Headers */, + A045F6E61BA8170A005076C7 /* CCComponentPhysics2d.h in Headers */, B665E3581AA80A6500DDB1C5 /* CCPUOnQuotaObserverTranslator.h in Headers */, B6CAB2371AF9AA1A00B9B856 /* btCompoundCollisionAlgorithm.h in Headers */, B665E3DC1AA80A6600DDB1C5 /* CCPUScriptTranslator.h in Headers */, @@ -9811,6 +9883,7 @@ 15AE1B9C19AADFDF00C27E9E /* UIRelativeBox.h in Headers */, B665E3341AA80A6500DDB1C5 /* CCPUOnEmissionObserver.h in Headers */, 15AE1A7519AAD40300C27E9E /* b2EdgeAndCircleContact.h in Headers */, + A05DCF9E1B90584E00EE040B /* CCDownloader-curl.h in Headers */, B665E2881AA80A6500DDB1C5 /* CCPUDoStopSystemEventHandlerTranslator.h in Headers */, B665E2441AA80A6500DDB1C5 /* CCPUCollisionAvoidanceAffector.h in Headers */, B665E2281AA80A6500DDB1C5 /* CCPUBillboardChain.h in Headers */, @@ -9830,12 +9903,12 @@ B665E2F81AA80A6500DDB1C5 /* CCPUListener.h in Headers */, B6CAB3F91AF9AA1A00B9B856 /* btMultiBody.h in Headers */, 15AE1BDB19AAE01E00C27E9E /* CCControlSwitch.h in Headers */, - 5070032F1B69898400E83DDD /* CCIDownloaderImpl.h in Headers */, B24AA987195A675C007B4522 /* CCFastTMXLayer.h in Headers */, 15AE188F19AAD33D00C27E9E /* CCLabelTTFLoader.h in Headers */, 50ABBEBD1925AB6F00A911A9 /* ccUtils.h in Headers */, C50306761B60B5B2001E6D43 /* BoneNodeReader.h in Headers */, B6CAB4171AF9AA1A00B9B856 /* btMultiBodySolverConstraint.h in Headers */, + A0534A651B872FFD006B03E5 /* CCDownloader-apple.h in Headers */, 15AE19A119AAD39600C27E9E /* TextAtlasReader.h in Headers */, 50ABC0231926664800A911A9 /* CCGLViewImpl-desktop.h in Headers */, 382384231A2590DA002C4610 /* GameMapReader.h in Headers */, @@ -9894,6 +9967,7 @@ 50ABBE2F1925AB6F00A911A9 /* ccConfig.h in Headers */, 15AE188019AAD33D00C27E9E /* CCBMemberVariableAssigner.h in Headers */, 1AAF5851180E40B9000584C8 /* LocalStorage.h in Headers */, + A0E749F91BA8FD7F001A8332 /* UIEditBoxImpl-common.h in Headers */, 1A01C69018F57BE800EFE3A6 /* CCDictionary.h in Headers */, B6CAB4ED1AF9AA1A00B9B856 /* vectormath2bullet.h in Headers */, 1A9DCA29180E6955007A3AD4 /* CCGLBufferedNode.h in Headers */, @@ -9954,6 +10028,7 @@ B6CAB5331AF9AA1A00B9B856 /* btTransformUtil.h in Headers */, B6DD2FEF1B04825B00E47F5F /* DetourTileCache.h in Headers */, 50ABBECD1925AB6F00A911A9 /* s3tc.h in Headers */, + A045F6EA1BA8170A005076C7 /* CCPhysicsManager.h in Headers */, B6CAB3651AF9AA1A00B9B856 /* btContinuousConvexCollision.h in Headers */, 15AE1BD119AAE01E00C27E9E /* CCControlHuePicker.h in Headers */, B5CE6DC01B3BF2B1002B0419 /* UIAbstractCheckButton.h in Headers */, @@ -9982,8 +10057,10 @@ files = ( 503DD8F01926736A00CD74DD /* CCStdC-ios.h in Headers */, 15AE1A9A19AAD40300C27E9E /* b2Math.h in Headers */, + 2980F0281BA9A5550059E678 /* CCUITextInput.h in Headers */, B6CAB3221AF9AA1A00B9B856 /* btGenericPoolAllocator.h in Headers */, B665E3851AA80A6500DDB1C5 /* CCPUPathFollower.h in Headers */, + 2980F0291BA9A5550059E678 /* UITextField+CCUITextInput.h in Headers */, 46A170FF1807CECB005B8026 /* CCPhysicsContact.h in Headers */, B6CAB37E1AF9AA1A00B9B856 /* btGjkPairDetector.h in Headers */, B6CAB3101AF9AA1A00B9B856 /* btTriangleShape.h in Headers */, @@ -10045,6 +10122,7 @@ B6CAB3BA1AF9AA1A00B9B856 /* btGeneric6DofConstraint.h in Headers */, B6CAB2F81AF9AA1A00B9B856 /* btTriangleBuffer.h in Headers */, 15AE1A4A19AAD3D500C27E9E /* b2CircleShape.h in Headers */, + A0E749FA1BA8FD7F001A8332 /* UIEditBoxImpl-common.h in Headers */, B6CAB2A61AF9AA1A00B9B856 /* btConvexHullShape.h in Headers */, 50ABBE861925AB6F00A911A9 /* ccFPSImages.h in Headers */, B6CAB2BE1AF9AA1A00B9B856 /* btCylinderShape.h in Headers */, @@ -10087,6 +10165,7 @@ 15AE19B919AAD39700C27E9E /* TextFieldReader.h in Headers */, 15AE181319AAD2F700C27E9E /* CCAnimation3D.h in Headers */, 50ABBEC21925AB6F00A911A9 /* CCValue.h in Headers */, + 2980F0241BA9A5550059E678 /* CCUIMultilineTextField.h in Headers */, B6CAB4FE1AF9AA1A00B9B856 /* btConvexHull.h in Headers */, 50ABBECA1925AB6F00A911A9 /* firePngData.h in Headers */, B257B4511989D5E800D9A687 /* CCPrimitive.h in Headers */, @@ -10109,6 +10188,7 @@ 15AE18D819AAD33D00C27E9E /* CCScrollViewLoader.h in Headers */, B6CAB4B41AF9AA1A00B9B856 /* SpuContactManifoldCollisionAlgorithm.h in Headers */, 15AE18DB19AAD33D00C27E9E /* CocosBuilder.h in Headers */, + A045F6F21BA81821005076C7 /* GameNode3DReader.h in Headers */, B6CAB2601AF9AA1A00B9B856 /* btInternalEdgeUtility.h in Headers */, B665E1F51AA80A6500DDB1C5 /* CCPUAffector.h in Headers */, 15AE1ACD19AAD40300C27E9E /* b2PrismaticJoint.h in Headers */, @@ -10134,7 +10214,6 @@ B665E4311AA80A6600DDB1C5 /* CCPUVelocityMatchingAffectorTranslator.h in Headers */, B6CAB2C21AF9AA1A00B9B856 /* btEmptyShape.h in Headers */, B665E3C51AA80A6600DDB1C5 /* CCPUScaleAffectorTranslator.h in Headers */, - 507003301B69898400E83DDD /* CCIDownloaderImpl.h in Headers */, B6DD2FF81B04825B00E47F5F /* fastlz.h in Headers */, B665E4351AA80A6600DDB1C5 /* CCPUVertexEmitter.h in Headers */, B665E2451AA80A6500DDB1C5 /* CCPUCollisionAvoidanceAffector.h in Headers */, @@ -10143,6 +10222,7 @@ 50ABBE501925AB6F00A911A9 /* CCEventCustom.h in Headers */, 15AE1AD719AAD40300C27E9E /* b2WheelJoint.h in Headers */, B665E3311AA80A6500DDB1C5 /* CCPUOnCountObserverTranslator.h in Headers */, + A0534A661B872FFD006B03E5 /* CCDownloader-apple.h in Headers */, B240C5EC1B09DFB000137F50 /* CCFrameBuffer.h in Headers */, B6CAB41C1AF9AA1A00B9B856 /* btDantzigLCP.h in Headers */, B665E2051AA80A6500DDB1C5 /* CCPUAlignAffectorTranslator.h in Headers */, @@ -10156,6 +10236,7 @@ B665E3A91AA80A6500DDB1C5 /* CCPURandomiser.h in Headers */, 15AE19AF19AAD39700C27E9E /* PageViewReader.h in Headers */, B6CAB29A1AF9AA1A00B9B856 /* btConcaveShape.h in Headers */, + 3E2A09C51BAA91B70086B878 /* CCMotionStreak3D.h in Headers */, B6CAB2AE1AF9AA1A00B9B856 /* btConvexPointCloudShape.h in Headers */, B29A7DD419EE1B7700872B35 /* Skin.h in Headers */, B6CAB2221AF9AA1A00B9B856 /* btBoxBoxDetector.h in Headers */, @@ -10304,7 +10385,6 @@ 1A5701A4180BCB590088DEC7 /* CCFontAtlas.h in Headers */, B6CAB4C41AF9AA1A00B9B856 /* Box.h in Headers */, 15AE1C0219AAE01E00C27E9E /* CCScrollView.h in Headers */, - B62305671B8ABA6600F0745D /* CCTextureCube.h in Headers */, 1A5701A8180BCB590088DEC7 /* CCFontAtlasCache.h in Headers */, B665E3E51AA80A6600DDB1C5 /* CCPUSineForceAffector.h in Headers */, 182C5CE81A9D725400C30D34 /* UserCameraReader.h in Headers */, @@ -10445,6 +10525,7 @@ 15AE1A9C19AAD40300C27E9E /* b2Settings.h in Headers */, 1A5701FA180BCBAD0088DEC7 /* CCMenu.h in Headers */, 15AE18BA19AAD33D00C27E9E /* CCControlButtonLoader.h in Headers */, + A045F6EB1BA8170A005076C7 /* CCPhysicsManager.h in Headers */, 1A5701FE180BCBAD0088DEC7 /* CCMenuItem.h in Headers */, 50ABC00C1926664800A911A9 /* CCDevice.h in Headers */, 1A570205180BCBD40088DEC7 /* CCClippingNode.h in Headers */, @@ -10511,6 +10592,7 @@ 1A570230180BCC1A0088DEC7 /* CCParticleSystemQuad.h in Headers */, 382383F31A258FA7002C4610 /* idl.h in Headers */, 29394CF119B01DBA00D2DE1A /* UIWebView.h in Headers */, + 2980F0261BA9A5550059E678 /* CCUISingleLineTextField.h in Headers */, B6CAB4EC1AF9AA1A00B9B856 /* TrbStateVec.h in Headers */, 15AE18B419AAD33D00C27E9E /* CCBSelectorResolver.h in Headers */, B24AA988195A675C007B4522 /* CCFastTMXLayer.h in Headers */, @@ -10541,6 +10623,7 @@ B6CAB20E1AF9AA1A00B9B856 /* btQuantizedBvh.h in Headers */, B665E2591AA80A6500DDB1C5 /* CCPUDoAffectorEventHandlerTranslator.h in Headers */, B665E1F91AA80A6500DDB1C5 /* CCPUAffectorManager.h in Headers */, + 2980F0221BA9A5550059E678 /* CCUIEditBoxIOS.h in Headers */, B665E2351AA80A6500DDB1C5 /* CCPUBoxEmitter.h in Headers */, B6CAB36C1AF9AA1A00B9B856 /* btConvexPenetrationDepthSolver.h in Headers */, B6CAB4281AF9AA1A00B9B856 /* btSolveProjectedGaussSeidel.h in Headers */, @@ -10557,7 +10640,6 @@ 15AE1B7F19AADA9A00C27E9E /* UIText.h in Headers */, B29A7E3419EE1B7700872B35 /* SlotData.h in Headers */, B6CAAFF91AF9A9E100B9B856 /* CCPhysics3DShape.h in Headers */, - B64073341B8FFA60005495CE /* CCMotionStreak3D.h in Headers */, B665E3D51AA80A6600DDB1C5 /* CCPUScriptLexer.h in Headers */, 50ABBE701925AB6F00A911A9 /* CCEventListenerKeyboard.h in Headers */, 15AE18B619AAD33D00C27E9E /* CCBSequence.h in Headers */, @@ -10588,6 +10670,7 @@ 15AE18D119AAD33D00C27E9E /* CCNodeLoaderLibrary.h in Headers */, 15AE1AC319AAD40300C27E9E /* b2DistanceJoint.h in Headers */, B6CAB5261AF9AA1A00B9B856 /* btQuickprof.h in Headers */, + 2980F02B1BA9A5550059E678 /* UITextView+CCUITextInput.h in Headers */, 50ABBE741925AB6F00A911A9 /* CCEventListenerMouse.h in Headers */, D0FD03581A3B51AA00825BB5 /* CCAllocatorMutex.h in Headers */, B29A7E1219EE1B7700872B35 /* EventData.h in Headers */, @@ -10637,6 +10720,7 @@ B6CAB3A21AF9AA1A00B9B856 /* btKinematicCharacterController.h in Headers */, 1A570313180BCF190088DEC7 /* CCComponentContainer.h in Headers */, B6CAB5381AF9AA1A00B9B856 /* btVector3.h in Headers */, + A045F6D91BA81577005076C7 /* CCTextureCube.h in Headers */, B6CAB4DC1AF9AA1A00B9B856 /* SpuMinkowskiPenetrationDepthSolver.h in Headers */, B665E2F51AA80A6500DDB1C5 /* CCPULineEmitterTranslator.h in Headers */, 1A087AEB1860400400196EF5 /* edtaa3func.h in Headers */, @@ -10779,7 +10863,6 @@ 1ABA68B11888D700007D1BB4 /* CCFontCharMap.h in Headers */, 15AE1ACF19AAD40300C27E9E /* b2PulleyJoint.h in Headers */, D0FD03601A3B51AA00825BB5 /* CCAllocatorStrategyPool.h in Headers */, - 943CF4571B7DB10F00B6303F /* GameNode3DReader.h in Headers */, 15AE198019AAD35700C27E9E /* CCTimeLine.h in Headers */, 38B8E2E419E671D2002D7CE7 /* UILayoutComponent.h in Headers */, B6CAB2481AF9AA1A00B9B856 /* btConvexConvexAlgorithm.h in Headers */, @@ -10829,7 +10912,6 @@ B29A7DDA19EE1B7700872B35 /* SkeletonRenderer.h in Headers */, 15AE194119AAD35100C27E9E /* CCBone.h in Headers */, D0FD035A1A3B51AA00825BB5 /* CCAllocatorStrategyDefault.h in Headers */, - B6DD36D81B8564EC0044745A /* CCCameraBackgroundBrush.h in Headers */, 50ABBD471925AB0000A911A9 /* CCVertex.h in Headers */, B6CAB4D81AF9AA1A00B9B856 /* SpuLocalSupport.h in Headers */, B6CAB2921AF9AA1A00B9B856 /* btCollisionShape.h in Headers */, @@ -10843,6 +10925,7 @@ 15AE195A19AAD35100C27E9E /* CCProcessBase.h in Headers */, 15AE193D19AAD35100C27E9E /* CCArmatureDefine.h in Headers */, B6CAB37A1AF9AA1A00B9B856 /* btGjkEpaPenetrationDepthSolver.h in Headers */, + A045F6E71BA8170A005076C7 /* CCComponentPhysics2d.h in Headers */, B6CAB21A1AF9AA1A00B9B856 /* btBox2dBox2dCollisionAlgorithm.h in Headers */, 382384041A259005002C4610 /* CSParseBinary_generated.h in Headers */, B6CAB5401AF9AA1A00B9B856 /* cl_platform.h in Headers */, @@ -10937,10 +11020,10 @@ 15AE1B9719AADAA100C27E9E /* UIVideoPlayer.h in Headers */, 15AE18BE19AAD33D00C27E9E /* CCLabelBMFontLoader.h in Headers */, 50ABC00A1926664800A911A9 /* CCCommon.h in Headers */, + A045F6DF1BA816A1005076C7 /* CCCameraBackgroundBrush.h in Headers */, 15AE19AD19AAD39700C27E9E /* LoadingBarReader.h in Headers */, 15FB209E1AE7C57D00C31518 /* sweep_context.h in Headers */, 50ABBE5C1925AB6F00A911A9 /* CCEventKeyboard.h in Headers */, - 5070032D1B69826F00E83DDD /* CCDownloaderImpl.h in Headers */, B665E2191AA80A6500DDB1C5 /* CCPUBeamRender.h in Headers */, B6CAB3F41AF9AA1A00B9B856 /* btSimpleDynamicsWorld.h in Headers */, 5E9F612D1A3FFE3D0038DE01 /* CCPlane.h in Headers */, @@ -10970,6 +11053,7 @@ 50ABBEB21925AB6F00A911A9 /* CCUserDefault.h in Headers */, 15AE198B19AAD36A00C27E9E /* ButtonReader.h in Headers */, B6CAB2FC1AF9AA1A00B9B856 /* btTriangleCallback.h in Headers */, + A0534A6B1B87306E006B03E5 /* CCIDownloaderImpl.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -11061,7 +11145,6 @@ B6CAB2811AF9AA1A00B9B856 /* btBoxShape.cpp in Sources */, 50ABBE311925AB6F00A911A9 /* CCConfiguration.cpp in Sources */, B665E3821AA80A6500DDB1C5 /* CCPUPathFollower.cpp in Sources */, - B6DD36D51B8564EC0044745A /* CCCameraBackgroundBrush.cpp in Sources */, 1A01C6A418F58F7500EFE3A6 /* CCNotificationCenter.cpp in Sources */, 15AE1A5D19AAD40300C27E9E /* b2Body.cpp in Sources */, 15AE1BDA19AAE01E00C27E9E /* CCControlSwitch.cpp in Sources */, @@ -11133,6 +11216,7 @@ B665E2621AA80A6500DDB1C5 /* CCPUDoExpireEventHandler.cpp in Sources */, B665E4161AA80A6600DDB1C5 /* CCPUTextureAnimatorTranslator.cpp in Sources */, B665E41E1AA80A6600DDB1C5 /* CCPUTextureRotatorTranslator.cpp in Sources */, + A045F6E81BA8170A005076C7 /* CCPhysicsManager.cpp in Sources */, 15AE189819AAD33D00C27E9E /* CCMenuItemLoader.cpp in Sources */, 15AE1A5719AAD40300C27E9E /* b2Settings.cpp in Sources */, 50ABBE271925AB6F00A911A9 /* CCAutoreleasePool.cpp in Sources */, @@ -11183,7 +11267,6 @@ 1A57006D180BC5A10088DEC7 /* CCActionEase.cpp in Sources */, 15AE1A5019AAD40300C27E9E /* b2BlockAllocator.cpp in Sources */, B665E20E1AA80A6500DDB1C5 /* CCPUBaseForceAffector.cpp in Sources */, - B62305641B8ABA6600F0745D /* CCTextureCube.cpp in Sources */, B6CAB25D1AF9AA1A00B9B856 /* btInternalEdgeUtility.cpp in Sources */, 15AE1A8219AAD40300C27E9E /* b2GearJoint.cpp in Sources */, 1A570071180BC5A10088DEC7 /* CCActionGrid.cpp in Sources */, @@ -11250,6 +11333,7 @@ B6CAB3B31AF9AA1A00B9B856 /* btGearConstraint.cpp in Sources */, B6CAB4031AF9AA1A00B9B856 /* btMultiBodyDynamicsWorld.cpp in Sources */, B665E3F21AA80A6600DDB1C5 /* CCPUSlaveEmitter.cpp in Sources */, + A045F6D61BA81577005076C7 /* CCTextureCube.cpp in Sources */, 50ABBE651925AB6F00A911A9 /* CCEventListenerCustom.cpp in Sources */, D0FD034B1A3B51AA00825BB5 /* CCAllocatorDiagnostics.cpp in Sources */, B6CAB3E11AF9AA1A00B9B856 /* btUniversalConstraint.cpp in Sources */, @@ -11261,7 +11345,6 @@ 50ABBED71925AB6F00A911A9 /* ZipUtils.cpp in Sources */, B665E3B61AA80A6500DDB1C5 /* CCPURibbonTrail.cpp in Sources */, B6CAAFF61AF9A9E100B9B856 /* CCPhysics3DShape.cpp in Sources */, - 943CF4541B7DB10F00B6303F /* GameNode3DReader.cpp in Sources */, B6CAB3071AF9AA1A00B9B856 /* btTriangleMesh.cpp in Sources */, B29A7E1319EE1B7700872B35 /* Bone.c in Sources */, B677B0C91B18492D006762CB /* CCNavMesh.cpp in Sources */, @@ -11290,6 +11373,7 @@ 15AE1B6D19AADA9900C27E9E /* UIHelper.cpp in Sources */, 15AE1A8A19AAD40300C27E9E /* b2PulleyJoint.cpp in Sources */, 29394CF219B01DBA00D2DE1A /* UIWebView.mm in Sources */, + A0534A671B872FFD006B03E5 /* CCDownloader-apple.mm in Sources */, B665E2B21AA80A6500DDB1C5 /* CCPUForceField.cpp in Sources */, 15AE1BD419AAE01E00C27E9E /* CCControlSaturationBrightnessPicker.cpp in Sources */, 38B8E2E119E671D2002D7CE7 /* UILayoutComponent.cpp in Sources */, @@ -11436,7 +11520,10 @@ 1A570214180BCBF40088DEC7 /* CCRenderTexture.cpp in Sources */, B665E3FE1AA80A6600DDB1C5 /* CCPUSphereCollider.cpp in Sources */, B6CAB3591AF9AA1A00B9B856 /* gim_memory.cpp in Sources */, + A045F6DC1BA816A1005076C7 /* CCCameraBackgroundBrush.cpp in Sources */, B665E25A1AA80A6500DDB1C5 /* CCPUDoEnableComponentEventHandler.cpp in Sources */, + A0E749F71BA8FD7F001A8332 /* UIEditBoxImpl-common.cpp in Sources */, + A045F6E41BA8170A005076C7 /* CCComponentPhysics2d.cpp in Sources */, B6DD2FB31B04825B00E47F5F /* RecastDump.cpp in Sources */, B6CAB2BB1AF9AA1A00B9B856 /* btCylinderShape.cpp in Sources */, 15AE1BD019AAE01E00C27E9E /* CCControlHuePicker.cpp in Sources */, @@ -11507,6 +11594,7 @@ B6CAB3731AF9AA1A00B9B856 /* btGjkEpa2.cpp in Sources */, 50ABBE791925AB6F00A911A9 /* CCEventMouse.cpp in Sources */, 15AE1A2E19AAD3D500C27E9E /* b2TimeOfImpact.cpp in Sources */, + A05DCF9D1B90584E00EE040B /* CCDownloader-curl.cpp in Sources */, B6CAB2FD1AF9AA1A00B9B856 /* btTriangleIndexVertexArray.cpp in Sources */, 50ABC0111926664800A911A9 /* CCGLView.cpp in Sources */, 50ABBE3D1925AB6F00A911A9 /* CCDataVisitor.cpp in Sources */, @@ -11532,7 +11620,6 @@ 15AE182019AAD2F700C27E9E /* CCBundleReader.cpp in Sources */, B665E2421AA80A6500DDB1C5 /* CCPUCollisionAvoidanceAffector.cpp in Sources */, 15AE1AD819AAD41000C27E9E /* b2Rope.cpp in Sources */, - B64073311B8FFA60005495CE /* CCMotionStreak3D.cpp in Sources */, B6D38B8A1AC3AFAC00043997 /* CCSkybox.cpp in Sources */, B665E3521AA80A6500DDB1C5 /* CCPUOnQuotaObserver.cpp in Sources */, B29A7DC719EE1B7700872B35 /* SkeletonRenderer.cpp in Sources */, @@ -11617,6 +11704,7 @@ B6CAB2491AF9AA1A00B9B856 /* btConvexPlaneCollisionAlgorithm.cpp in Sources */, B665E35A1AA80A6500DDB1C5 /* CCPUOnRandomObserver.cpp in Sources */, B6CAB2891AF9AA1A00B9B856 /* btCapsuleShape.cpp in Sources */, + 3E2A09C21BAA91B70086B878 /* CCMotionStreak3D.cpp in Sources */, B6CAB42F1AF9AA1A00B9B856 /* btWheelInfo.cpp in Sources */, B29A7DFB19EE1B7700872B35 /* spine-cocos2dx.cpp in Sources */, B6CAB3391AF9AA1A00B9B856 /* btTriangleShapeEx.cpp in Sources */, @@ -11689,6 +11777,7 @@ 826294341AAF003E00CB7CF7 /* HttpClient-apple.mm in Sources */, 15AE1A6E19AAD40300C27E9E /* b2CircleContact.cpp in Sources */, 15AE1A6619AAD40300C27E9E /* b2World.cpp in Sources */, + A045F6EF1BA81821005076C7 /* GameNode3DReader.cpp in Sources */, 50ABBD8F1925AB4100A911A9 /* CCGLProgramCache.cpp in Sources */, 50ABBD441925AB0000A911A9 /* CCVertex.cpp in Sources */, B276EF611988D1D500CD400F /* CCVertexIndexData.cpp in Sources */, @@ -11748,7 +11837,6 @@ 15AE188119AAD33D00C27E9E /* CCBReader.cpp in Sources */, 501216A01AC473AD009A4BEA /* CCMaterial.cpp in Sources */, 50ABBDB91925AB4100A911A9 /* CCTextureAtlas.cpp in Sources */, - 5070032A1B69826F00E83DDD /* CCDownloaderImpl.cpp in Sources */, 15AE1BE419AAE01E00C27E9E /* CCTableView.cpp in Sources */, 15AE1A3219AAD3D500C27E9E /* b2CircleShape.cpp in Sources */, 15AE180819AAD2F700C27E9E /* CCAABB.cpp in Sources */, @@ -12038,7 +12126,6 @@ 15AE1A3C19AAD3D500C27E9E /* b2CollideCircle.cpp in Sources */, 501216951AC47393009A4BEA /* CCPass.cpp in Sources */, 50ABBE6E1925AB6F00A911A9 /* CCEventListenerKeyboard.cpp in Sources */, - B62305651B8ABA6600F0745D /* CCTextureCube.cpp in Sources */, B665E2CB1AA80A6500DDB1C5 /* CCPUGravityAffectorTranslator.cpp in Sources */, 15AE18D719AAD33D00C27E9E /* CCScrollViewLoader.cpp in Sources */, 50CB247C19D9C5A100687767 /* AudioEngine-inl.mm in Sources */, @@ -12051,7 +12138,6 @@ 15AE1A4119AAD3D500C27E9E /* b2Distance.cpp in Sources */, 50ABBE4E1925AB6F00A911A9 /* CCEventCustom.cpp in Sources */, B6CAB2761AF9AA1A00B9B856 /* btUnionFind.cpp in Sources */, - 943CF4551B7DB10F00B6303F /* GameNode3DReader.cpp in Sources */, 15AE1BF519AAE01E00C27E9E /* CCControlSlider.cpp in Sources */, 15AE181719AAD2F700C27E9E /* CCAttachNode.cpp in Sources */, B68779051A8CA82E00643ABF /* CCParticleSystem3D.cpp in Sources */, @@ -12060,6 +12146,7 @@ B6CAB3261AF9AA1A00B9B856 /* btGImpactBvh.cpp in Sources */, 15AE18B919AAD33D00C27E9E /* CCControlButtonLoader.cpp in Sources */, B6CAB4041AF9AA1A00B9B856 /* btMultiBodyDynamicsWorld.cpp in Sources */, + A045F6E91BA8170A005076C7 /* CCPhysicsManager.cpp in Sources */, 50ABBE761925AB6F00A911A9 /* CCEventListenerTouch.cpp in Sources */, 15AE1AD219AAD40300C27E9E /* b2RopeJoint.cpp in Sources */, B29A7DCC19EE1B7700872B35 /* Skeleton.c in Sources */, @@ -12074,7 +12161,6 @@ 3EACC9A519F5014D00EB3C5E /* CCLight.cpp in Sources */, 15AE1B7A19AADA9A00C27E9E /* UIScrollView.cpp in Sources */, 1A570076180BC5A10088DEC7 /* CCActionGrid3D.cpp in Sources */, - B6DD36D61B8564EC0044745A /* CCCameraBackgroundBrush.cpp in Sources */, B6CAB38C1AF9AA1A00B9B856 /* btPolyhedralContactClipping.cpp in Sources */, B6CAB3A41AF9AA1A00B9B856 /* btConeTwistConstraint.cpp in Sources */, 15AE19B219AAD39700C27E9E /* SliderReader.cpp in Sources */, @@ -12117,8 +12203,10 @@ B6CAB2521AF9AA1A00B9B856 /* btEmptyCollisionAlgorithm.cpp in Sources */, B665E2D31AA80A6500DDB1C5 /* CCPUInterParticleColliderTranslator.cpp in Sources */, B665E3331AA80A6500DDB1C5 /* CCPUOnEmissionObserver.cpp in Sources */, + A045F6E51BA8170A005076C7 /* CCComponentPhysics2d.cpp in Sources */, 1A570082180BC5A10088DEC7 /* CCActionManager.cpp in Sources */, 507003201B69735200E83DDD /* HttpClient.cpp in Sources */, + A0534A681B872FFD006B03E5 /* CCDownloader-apple.mm in Sources */, B665E22F1AA80A6500DDB1C5 /* CCPUBoxColliderTranslator.cpp in Sources */, 1A570086180BC5A10088DEC7 /* CCActionPageTurn3D.cpp in Sources */, 15AE1AB819AAD40300C27E9E /* b2EdgeAndCircleContact.cpp in Sources */, @@ -12205,6 +12293,7 @@ 1A5701B2180BCB590088DEC7 /* CCFontFNT.cpp in Sources */, B68778F91A8CA82E00643ABF /* CCParticle3DAffector.cpp in Sources */, B665E2271AA80A6500DDB1C5 /* CCPUBillboardChain.cpp in Sources */, + A045F6F01BA81821005076C7 /* GameNode3DReader.cpp in Sources */, 1A5701B6180BCB590088DEC7 /* CCFontFreeType.cpp in Sources */, B665E40F1AA80A6600DDB1C5 /* CCPUTechniqueTranslator.cpp in Sources */, 292DB16019B461CA00A80320 /* ExtensionDeprecated.cpp in Sources */, @@ -12222,6 +12311,7 @@ 15AE1B7219AADA9A00C27E9E /* UIListView.cpp in Sources */, 1A5701BE180BCB5A0088DEC7 /* CCLabelAtlas.cpp in Sources */, 15FB20751AE7BF8600C31518 /* CCAutoPolygon.cpp in Sources */, + A0E749F81BA8FD7F001A8332 /* UIEditBoxImpl-common.cpp in Sources */, B6CAB2021AF9AA1A00B9B856 /* btMultiSapBroadphase.cpp in Sources */, 15AE1A3D19AAD3D500C27E9E /* b2CollideEdge.cpp in Sources */, 1A5701C2180BCB5A0088DEC7 /* CCLabelBMFont.cpp in Sources */, @@ -12281,6 +12371,7 @@ B29A7E2E19EE1B7700872B35 /* Slot.c in Sources */, B665E2471AA80A6500DDB1C5 /* CCPUCollisionAvoidanceAffectorTranslator.cpp in Sources */, 50ABC01E1926664800A911A9 /* CCThread.cpp in Sources */, + 2980F0271BA9A5550059E678 /* CCUISingleLineTextField.mm in Sources */, B29A7DF419EE1B7700872B35 /* AttachmentLoader.c in Sources */, 1A5701EB180BCB8C0088DEC7 /* CCTransitionPageTurn.cpp in Sources */, 15AE1A9D19AAD40300C27E9E /* b2StackAllocator.cpp in Sources */, @@ -12381,10 +12472,10 @@ 1A570287180BCC900088DEC7 /* CCSpriteFrame.cpp in Sources */, 507003221B69735300E83DDD /* HttpConnection-winrt.cpp in Sources */, B6CAB3AA1AF9AA1A00B9B856 /* btContactConstraint.cpp in Sources */, + 2980F02A1BA9A5550059E678 /* UITextField+CCUITextInput.mm in Sources */, B665E2431AA80A6500DDB1C5 /* CCPUCollisionAvoidanceAffector.cpp in Sources */, B6CAB23E1AF9AA1A00B9B856 /* btConvex2dConvex2dAlgorithm.cpp in Sources */, B665E3EB1AA80A6600DDB1C5 /* CCPUSlaveBehaviour.cpp in Sources */, - 5070032B1B69826F00E83DDD /* CCDownloaderImpl.cpp in Sources */, B665E2771AA80A6500DDB1C5 /* CCPUDoPlacementParticleEventHandlerTranslator.cpp in Sources */, 15AE193E19AAD35100C27E9E /* CCBatchNode.cpp in Sources */, 15AE185919AAD31200C27E9E /* CDAudioManager.m in Sources */, @@ -12414,6 +12505,7 @@ B6CAB3741AF9AA1A00B9B856 /* btGjkEpa2.cpp in Sources */, B665E3DB1AA80A6600DDB1C5 /* CCPUScriptTranslator.cpp in Sources */, B665E33B1AA80A6500DDB1C5 /* CCPUOnEventFlagObserver.cpp in Sources */, + 3E2A09C31BAA91B70086B878 /* CCMotionStreak3D.cpp in Sources */, 1A5702F3180BCE750088DEC7 /* CCTMXObjectGroup.cpp in Sources */, 382384221A2590DA002C4610 /* GameMapReader.cpp in Sources */, 15AE1BAF19AADFDF00C27E9E /* UILayoutManager.cpp in Sources */, @@ -12496,6 +12588,7 @@ 50ABBD881925AB4100A911A9 /* CCCustomCommand.cpp in Sources */, B6CAB4301AF9AA1A00B9B856 /* btWheelInfo.cpp in Sources */, 15AE19B019AAD39700C27E9E /* ScrollViewReader.cpp in Sources */, + 2980F02C1BA9A5550059E678 /* UITextView+CCUITextInput.mm in Sources */, 85505F061B60E3B6003F2CD4 /* CCSkeletonNode.cpp in Sources */, 50ABBE941925AB6F00A911A9 /* CCProfiling.cpp in Sources */, 5012169B1AC473A3009A4BEA /* CCTechnique.cpp in Sources */, @@ -12527,7 +12620,7 @@ 50ABBEB01925AB6F00A911A9 /* CCUserDefault.cpp in Sources */, B6CAB3E21AF9AA1A00B9B856 /* btUniversalConstraint.cpp in Sources */, 50ABBE521925AB6F00A911A9 /* CCEventDispatcher.cpp in Sources */, - B64073321B8FFA60005495CE /* CCMotionStreak3D.cpp in Sources */, + A045F6D71BA81577005076C7 /* CCTextureCube.cpp in Sources */, B6CAB3821AF9AA1A00B9B856 /* btMinkowskiPenetrationDepthSolver.cpp in Sources */, B6CAB3641AF9AA1A00B9B856 /* btContinuousConvexCollision.cpp in Sources */, 52B47A2F1A5349A3004E4C60 /* HttpAsynConnection-apple.m in Sources */, @@ -12609,6 +12702,7 @@ B665E3131AA80A6500DDB1C5 /* CCPUObserverManager.cpp in Sources */, 50CB248019D9C5A100687767 /* AudioPlayer.mm in Sources */, 50ABBE9A1925AB6F00A911A9 /* CCRef.cpp in Sources */, + 2980F0251BA9A5550059E678 /* CCUIMultilineTextField.mm in Sources */, 85B3743B1B204B9400C488D6 /* clipper.cpp in Sources */, 15AE18BF19AAD33D00C27E9E /* CCLabelTTFLoader.cpp in Sources */, B6CAB27E1AF9AA1A00B9B856 /* btBox2dShape.cpp in Sources */, @@ -12627,6 +12721,7 @@ B665E4371AA80A6600DDB1C5 /* CCPUVortexAffector.cpp in Sources */, B665E2F31AA80A6500DDB1C5 /* CCPULineEmitterTranslator.cpp in Sources */, B665E3731AA80A6500DDB1C5 /* CCPUParticleFollower.cpp in Sources */, + A045F6DD1BA816A1005076C7 /* CCCameraBackgroundBrush.cpp in Sources */, B665E41F1AA80A6600DDB1C5 /* CCPUTextureRotatorTranslator.cpp in Sources */, 503DD8E51926736A00CD74DD /* CCDirectorCaller-ios.mm in Sources */, 5070031C1B69735200E83DDD /* HttpClient-android.cpp in Sources */, @@ -12670,6 +12765,7 @@ 15AE183519AAD2F700C27E9E /* CCObjLoader.cpp in Sources */, D0FD034C1A3B51AA00825BB5 /* CCAllocatorDiagnostics.cpp in Sources */, B665E31F1AA80A6500DDB1C5 /* CCPUOnClearObserverTranslator.cpp in Sources */, + 2980F0231BA9A5550059E678 /* CCUIEditBoxIOS.mm in Sources */, B665E4331AA80A6600DDB1C5 /* CCPUVertexEmitter.cpp in Sources */, B677B0DA1B18492D006762CB /* CCNavMeshUtils.cpp in Sources */, B665E3C71AA80A6600DDB1C5 /* CCPUScaleVelocityAffector.cpp in Sources */, diff --git a/build/cocos2d_tests.xcodeproj/project.pbxproj b/build/cocos2d_tests.xcodeproj/project.pbxproj index 469cfaf294..7cd2fb0d3d 100644 --- a/build/cocos2d_tests.xcodeproj/project.pbxproj +++ b/build/cocos2d_tests.xcodeproj/project.pbxproj @@ -219,8 +219,6 @@ 1A1645A9191B6283008C7C7F /* ccs-res in Resources */ = {isa = PBXBuildFile; fileRef = 1A221C9B191771E300FD2BE4 /* ccs-res */; }; 1A221C9C191771E300FD2BE4 /* ccs-res in Resources */ = {isa = PBXBuildFile; fileRef = 1A221C9B191771E300FD2BE4 /* ccs-res */; }; 1A221C9D191771E400FD2BE4 /* ccs-res in Resources */ = {isa = PBXBuildFile; fileRef = 1A221C9B191771E300FD2BE4 /* ccs-res */; }; - 1A97AC001A1DC3E30076D9CC /* PerformanceMathTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A97ABFE1A1DC3E30076D9CC /* PerformanceMathTest.cpp */; }; - 1A97AC011A1DC3E30076D9CC /* PerformanceMathTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A97ABFE1A1DC3E30076D9CC /* PerformanceMathTest.cpp */; }; 1AAF534D180E2F4E000584C8 /* libcocos2d Mac.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 46A15FB01807A4F9005B8026 /* libcocos2d Mac.a */; }; 1AAF5400180E39D4000584C8 /* libcocos2d iOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 46A15FBE1807A4F9005B8026 /* libcocos2d iOS.a */; }; 1ABCA28718CD91510087CE3A /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C64822165F391E007D4F18 /* Cocoa.framework */; }; @@ -442,30 +440,6 @@ 1AC35C2218CECF0C00F37B72 /* ParallaxTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35ABC18CECF0C00F37B72 /* ParallaxTest.cpp */; }; 1AC35C2318CECF0C00F37B72 /* ParticleTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35ABF18CECF0C00F37B72 /* ParticleTest.cpp */; }; 1AC35C2418CECF0C00F37B72 /* ParticleTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35ABF18CECF0C00F37B72 /* ParticleTest.cpp */; }; - 1AC35C2518CECF0C00F37B72 /* PerformanceAllocTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35AC218CECF0C00F37B72 /* PerformanceAllocTest.cpp */; }; - 1AC35C2618CECF0C00F37B72 /* PerformanceAllocTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35AC218CECF0C00F37B72 /* PerformanceAllocTest.cpp */; }; - 1AC35C2718CECF0C00F37B72 /* PerformanceContainerTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35AC418CECF0C00F37B72 /* PerformanceContainerTest.cpp */; }; - 1AC35C2818CECF0C00F37B72 /* PerformanceContainerTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35AC418CECF0C00F37B72 /* PerformanceContainerTest.cpp */; }; - 1AC35C2918CECF0C00F37B72 /* PerformanceEventDispatcherTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35AC618CECF0C00F37B72 /* PerformanceEventDispatcherTest.cpp */; }; - 1AC35C2A18CECF0C00F37B72 /* PerformanceEventDispatcherTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35AC618CECF0C00F37B72 /* PerformanceEventDispatcherTest.cpp */; }; - 1AC35C2B18CECF0C00F37B72 /* PerformanceLabelTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35AC818CECF0C00F37B72 /* PerformanceLabelTest.cpp */; }; - 1AC35C2C18CECF0C00F37B72 /* PerformanceLabelTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35AC818CECF0C00F37B72 /* PerformanceLabelTest.cpp */; }; - 1AC35C2D18CECF0C00F37B72 /* PerformanceNodeChildrenTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35ACA18CECF0C00F37B72 /* PerformanceNodeChildrenTest.cpp */; }; - 1AC35C2E18CECF0C00F37B72 /* PerformanceNodeChildrenTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35ACA18CECF0C00F37B72 /* PerformanceNodeChildrenTest.cpp */; }; - 1AC35C2F18CECF0C00F37B72 /* PerformanceParticleTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35ACC18CECF0C00F37B72 /* PerformanceParticleTest.cpp */; }; - 1AC35C3018CECF0C00F37B72 /* PerformanceParticleTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35ACC18CECF0C00F37B72 /* PerformanceParticleTest.cpp */; }; - 1AC35C3118CECF0C00F37B72 /* PerformanceRendererTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35ACE18CECF0C00F37B72 /* PerformanceRendererTest.cpp */; }; - 1AC35C3218CECF0C00F37B72 /* PerformanceRendererTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35ACE18CECF0C00F37B72 /* PerformanceRendererTest.cpp */; }; - 1AC35C3318CECF0C00F37B72 /* PerformanceScenarioTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35AD018CECF0C00F37B72 /* PerformanceScenarioTest.cpp */; }; - 1AC35C3418CECF0C00F37B72 /* PerformanceScenarioTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35AD018CECF0C00F37B72 /* PerformanceScenarioTest.cpp */; }; - 1AC35C3518CECF0C00F37B72 /* PerformanceSpriteTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35AD218CECF0C00F37B72 /* PerformanceSpriteTest.cpp */; }; - 1AC35C3618CECF0C00F37B72 /* PerformanceSpriteTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35AD218CECF0C00F37B72 /* PerformanceSpriteTest.cpp */; }; - 1AC35C3718CECF0C00F37B72 /* PerformanceTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35AD418CECF0C00F37B72 /* PerformanceTest.cpp */; }; - 1AC35C3818CECF0C00F37B72 /* PerformanceTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35AD418CECF0C00F37B72 /* PerformanceTest.cpp */; }; - 1AC35C3918CECF0C00F37B72 /* PerformanceTextureTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35AD618CECF0C00F37B72 /* PerformanceTextureTest.cpp */; }; - 1AC35C3A18CECF0C00F37B72 /* PerformanceTextureTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35AD618CECF0C00F37B72 /* PerformanceTextureTest.cpp */; }; - 1AC35C3B18CECF0C00F37B72 /* PerformanceTouchesTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35AD818CECF0C00F37B72 /* PerformanceTouchesTest.cpp */; }; - 1AC35C3C18CECF0C00F37B72 /* PerformanceTouchesTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35AD818CECF0C00F37B72 /* PerformanceTouchesTest.cpp */; }; 1AC35C3D18CECF0C00F37B72 /* PhysicsTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35ADB18CECF0C00F37B72 /* PhysicsTest.cpp */; }; 1AC35C3E18CECF0C00F37B72 /* PhysicsTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35ADB18CECF0C00F37B72 /* PhysicsTest.cpp */; }; 1AC35C3F18CECF0C00F37B72 /* ReleasePoolTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35ADE18CECF0C00F37B72 /* ReleasePoolTest.cpp */; }; @@ -687,8 +661,6 @@ 1AC35DF418CEE65B00F37B72 /* effect1.raw in Resources */ = {isa = PBXBuildFile; fileRef = 1AC35CB518CED84500F37B72 /* effect1.raw */; }; 1AC35DF718CEE65B00F37B72 /* effect1.wav in Resources */ = {isa = PBXBuildFile; fileRef = 1AC35CB618CED84500F37B72 /* effect1.wav */; }; 1AC35DF818CEE65B00F37B72 /* pew-pew-lei.wav in Resources */ = {isa = PBXBuildFile; fileRef = 1AC35CC418CED84500F37B72 /* pew-pew-lei.wav */; }; - 1AF152D918FD252A00A52F3D /* PerformanceCallbackTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AF152D718FD252A00A52F3D /* PerformanceCallbackTest.cpp */; }; - 1AF152DA18FD252A00A52F3D /* PerformanceCallbackTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AF152D718FD252A00A52F3D /* PerformanceCallbackTest.cpp */; }; 1F33634F18E37E840074764D /* RefPtrTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1F33634D18E37E840074764D /* RefPtrTest.cpp */; }; 1F33635018E37E840074764D /* RefPtrTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1F33634D18E37E840074764D /* RefPtrTest.cpp */; }; 29080D1C191B574B0066F8DF /* UITest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29080D1A191B574B0066F8DF /* UITest.cpp */; }; @@ -917,8 +889,6 @@ B609E67419C18DAD003D0074 /* BillBoardTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B609E67119C18DAD003D0074 /* BillBoardTest.cpp */; }; B61E90CB1B12B74B00BE69EA /* NavMesh in Resources */ = {isa = PBXBuildFile; fileRef = B61E90CA1B12B74B00BE69EA /* NavMesh */; }; B61E90CC1B12B74B00BE69EA /* NavMesh in Resources */ = {isa = PBXBuildFile; fileRef = B61E90CA1B12B74B00BE69EA /* NavMesh */; }; - B6337DF71ABA9B44005AEF24 /* PerformanceParticle3DTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6337DF51ABA9B44005AEF24 /* PerformanceParticle3DTest.cpp */; }; - B6337DF81ABA9B44005AEF24 /* PerformanceParticle3DTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6337DF51ABA9B44005AEF24 /* PerformanceParticle3DTest.cpp */; }; B639932E1A490EC700B07923 /* Particle3DTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B639932C1A490EC700B07923 /* Particle3DTest.cpp */; }; B639932F1A490EC700B07923 /* Particle3DTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B639932C1A490EC700B07923 /* Particle3DTest.cpp */; }; B63993311A49359F00B07923 /* Particle3D in Resources */ = {isa = PBXBuildFile; fileRef = B63993301A49359F00B07923 /* Particle3D */; }; @@ -951,6 +921,107 @@ ED545A781B68A1B800C3958E /* libiconv.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = ED545A721B68A1AC00C3958E /* libiconv.dylib */; }; ED545A791B68A1B900C3958E /* libiconv.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = ED545A721B68A1AC00C3958E /* libiconv.dylib */; }; EDCC747F17C455FD007B692C /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EDCC747E17C455FD007B692C /* IOKit.framework */; }; + FA94B0A31B8EF69A0074B261 /* libiconv.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = ED545A721B68A1AC00C3958E /* libiconv.dylib */; }; + FA94B0A41B8EF69A0074B261 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52B47A331A534B2B004E4C60 /* Security.framework */; }; + FA94B0A51B8EF69A0074B261 /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3EA0FB65191B933000B170C8 /* MediaPlayer.framework */; }; + FA94B0A61B8EF69A0074B261 /* libcocos2d iOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 46A15FBE1807A4F9005B8026 /* libcocos2d iOS.a */; }; + FA94B0A71B8EF69A0074B261 /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D60AE43317F7FFE100757E4B /* CoreMotion.framework */; }; + FA94B0A81B8EF69A0074B261 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C6482E165F399D007D4F18 /* libz.dylib */; }; + FA94B0A91B8EF69A0074B261 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C64832165F3AFD007D4F18 /* Foundation.framework */; }; + FA94B0AA1B8EF69A0074B261 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C6482C165F3988007D4F18 /* AudioToolbox.framework */; }; + FA94B0AB1B8EF69A0074B261 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C64828165F396B007D4F18 /* OpenAL.framework */; }; + FA94B0AC1B8EF69A0074B261 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C64826165F394E007D4F18 /* QuartzCore.framework */; }; + FA94B0AD1B8EF69A0074B261 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A07A52BB1783AEB80073F6A7 /* CoreGraphics.framework */; }; + FA94B0AE1B8EF69A0074B261 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A07A52B91783AE900073F6A7 /* OpenGLES.framework */; }; + FA94B0AF1B8EF69A0074B261 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A07A52B71783AE6D0073F6A7 /* UIKit.framework */; }; + FA94B0B01B8EF69A0074B261 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A07A52C11783B01F0073F6A7 /* AVFoundation.framework */; }; + FA94B1B81B8EF76D0074B261 /* libiconv.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = ED545A6C1B68A18300C3958E /* libiconv.dylib */; }; + FA94B1B91B8EF76D0074B261 /* libcocos2d Mac.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 46A15FB01807A4F9005B8026 /* libcocos2d Mac.a */; }; + FA94B1BA1B8EF76D0074B261 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 826294421AAF071500CB7CF7 /* Security.framework */; }; + FA94B1BB1B8EF76D0074B261 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EDCC747E17C455FD007B692C /* IOKit.framework */; }; + FA94B1BC1B8EF76D0074B261 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C6482E165F399D007D4F18 /* libz.dylib */; }; + FA94B1BD1B8EF76D0074B261 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C64832165F3AFD007D4F18 /* Foundation.framework */; }; + FA94B1BE1B8EF76D0074B261 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C6482C165F3988007D4F18 /* AudioToolbox.framework */; }; + FA94B1BF1B8EF76D0074B261 /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C6482A165F3979007D4F18 /* ApplicationServices.framework */; }; + FA94B1C01B8EF76D0074B261 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C64828165F396B007D4F18 /* OpenAL.framework */; }; + FA94B1C11B8EF76D0074B261 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C64826165F394E007D4F18 /* QuartzCore.framework */; }; + FA94B1C21B8EF76D0074B261 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C64824165F3934007D4F18 /* OpenGL.framework */; }; + FA94B1C31B8EF76D0074B261 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C64822165F391E007D4F18 /* Cocoa.framework */; }; + FA94B1CE1B8EF7BB0074B261 /* AppDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA94B1CA1B8EF7BB0074B261 /* AppDelegate.cpp */; }; + FA94B1CF1B8EF7BB0074B261 /* AppDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA94B1CA1B8EF7BB0074B261 /* AppDelegate.cpp */; }; + FA94B1ED1B8EF8250074B261 /* AppController.mm in Sources */ = {isa = PBXBuildFile; fileRef = FA94B1D51B8EF8250074B261 /* AppController.mm */; }; + FA94B1EE1B8EF8250074B261 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FA94B1D61B8EF8250074B261 /* Default-568h@2x.png */; }; + FA94B1EF1B8EF8250074B261 /* Default-667h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FA94B1D71B8EF8250074B261 /* Default-667h@2x.png */; }; + FA94B1F01B8EF8250074B261 /* Default-736h@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = FA94B1D81B8EF8250074B261 /* Default-736h@3x.png */; }; + FA94B1F11B8EF8250074B261 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = FA94B1D91B8EF8250074B261 /* Default.png */; }; + FA94B1F21B8EF8250074B261 /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FA94B1DA1B8EF8250074B261 /* Default@2x.png */; }; + FA94B1F31B8EF8250074B261 /* Icon-100.png in Resources */ = {isa = PBXBuildFile; fileRef = FA94B1DB1B8EF8250074B261 /* Icon-100.png */; }; + FA94B1F41B8EF8250074B261 /* Icon-114.png in Resources */ = {isa = PBXBuildFile; fileRef = FA94B1DC1B8EF8250074B261 /* Icon-114.png */; }; + FA94B1F51B8EF8250074B261 /* Icon-120.png in Resources */ = {isa = PBXBuildFile; fileRef = FA94B1DD1B8EF8250074B261 /* Icon-120.png */; }; + FA94B1F61B8EF8250074B261 /* Icon-144.png in Resources */ = {isa = PBXBuildFile; fileRef = FA94B1DE1B8EF8250074B261 /* Icon-144.png */; }; + FA94B1F71B8EF8250074B261 /* Icon-152.png in Resources */ = {isa = PBXBuildFile; fileRef = FA94B1DF1B8EF8250074B261 /* Icon-152.png */; }; + FA94B1F81B8EF8250074B261 /* Icon-29.png in Resources */ = {isa = PBXBuildFile; fileRef = FA94B1E01B8EF8250074B261 /* Icon-29.png */; }; + FA94B1F91B8EF8250074B261 /* Icon-40.png in Resources */ = {isa = PBXBuildFile; fileRef = FA94B1E11B8EF8250074B261 /* Icon-40.png */; }; + FA94B1FA1B8EF8250074B261 /* Icon-50.png in Resources */ = {isa = PBXBuildFile; fileRef = FA94B1E21B8EF8250074B261 /* Icon-50.png */; }; + FA94B1FB1B8EF8250074B261 /* Icon-57.png in Resources */ = {isa = PBXBuildFile; fileRef = FA94B1E31B8EF8250074B261 /* Icon-57.png */; }; + FA94B1FC1B8EF8250074B261 /* Icon-58.png in Resources */ = {isa = PBXBuildFile; fileRef = FA94B1E41B8EF8250074B261 /* Icon-58.png */; }; + FA94B1FD1B8EF8250074B261 /* Icon-72.png in Resources */ = {isa = PBXBuildFile; fileRef = FA94B1E51B8EF8250074B261 /* Icon-72.png */; }; + FA94B1FE1B8EF8250074B261 /* Icon-76.png in Resources */ = {isa = PBXBuildFile; fileRef = FA94B1E61B8EF8250074B261 /* Icon-76.png */; }; + FA94B1FF1B8EF8250074B261 /* Icon-80.png in Resources */ = {isa = PBXBuildFile; fileRef = FA94B1E71B8EF8250074B261 /* Icon-80.png */; }; + FA94B2001B8EF8250074B261 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = FA94B1E81B8EF8250074B261 /* Info.plist */; }; + FA94B2011B8EF8250074B261 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = FA94B1E91B8EF8250074B261 /* main.m */; }; + FA94B2021B8EF8250074B261 /* RootViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = FA94B1EC1B8EF8250074B261 /* RootViewController.mm */; }; + FA94B2081B8EF8430074B261 /* Icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = FA94B2041B8EF8430074B261 /* Icon.icns */; }; + FA94B2091B8EF8430074B261 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = FA94B2051B8EF8430074B261 /* Info.plist */; }; + FA94B20A1B8EF8430074B261 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA94B2061B8EF8430074B261 /* main.cpp */; }; + FA94B2261B8EF9C50074B261 /* CloseNormal.png in Resources */ = {isa = PBXBuildFile; fileRef = FA94B2211B8EF9C50074B261 /* CloseNormal.png */; }; + FA94B2271B8EF9C50074B261 /* CloseNormal.png in Resources */ = {isa = PBXBuildFile; fileRef = FA94B2211B8EF9C50074B261 /* CloseNormal.png */; }; + FA94B2281B8EF9C50074B261 /* CloseSelected.png in Resources */ = {isa = PBXBuildFile; fileRef = FA94B2221B8EF9C50074B261 /* CloseSelected.png */; }; + FA94B2291B8EF9C50074B261 /* CloseSelected.png in Resources */ = {isa = PBXBuildFile; fileRef = FA94B2221B8EF9C50074B261 /* CloseSelected.png */; }; + FA94B2351B8F02880074B261 /* Profile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA94B2331B8F02880074B261 /* Profile.cpp */; }; + FA94B2361B8F02880074B261 /* Profile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA94B2331B8F02880074B261 /* Profile.cpp */; }; + FA94B23A1B9045160074B261 /* PerformanceAllocTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA94B2381B9045160074B261 /* PerformanceAllocTest.cpp */; }; + FA94B23B1B9045160074B261 /* PerformanceAllocTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA94B2381B9045160074B261 /* PerformanceAllocTest.cpp */; }; + FA94B2421B90497E0074B261 /* BaseTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA94B23C1B90497E0074B261 /* BaseTest.cpp */; }; + FA94B2431B90497E0074B261 /* BaseTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA94B23C1B90497E0074B261 /* BaseTest.cpp */; }; + FA94B2441B90497E0074B261 /* controller.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA94B23E1B90497E0074B261 /* controller.cpp */; }; + FA94B2451B90497E0074B261 /* controller.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA94B23E1B90497E0074B261 /* controller.cpp */; }; + FA94B24B1B9059540074B261 /* VisibleRect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA94B2491B9059540074B261 /* VisibleRect.cpp */; }; + FA94B24C1B9059540074B261 /* VisibleRect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA94B2491B9059540074B261 /* VisibleRect.cpp */; }; + FA94B24E1B93EF7B0074B261 /* Images in Resources */ = {isa = PBXBuildFile; fileRef = FA94B24D1B93EF7B0074B261 /* Images */; }; + FA94B24F1B93EF7B0074B261 /* Images in Resources */ = {isa = PBXBuildFile; fileRef = FA94B24D1B93EF7B0074B261 /* Images */; }; + FADE786B1B942DE30061590D /* fonts in Resources */ = {isa = PBXBuildFile; fileRef = FADE786A1B942DE30061590D /* fonts */; }; + FADE786C1B942DE30061590D /* fonts in Resources */ = {isa = PBXBuildFile; fileRef = FADE786A1B942DE30061590D /* fonts */; }; + FADE786F1B9451540061590D /* PerformanceNodeChildrenTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADE786D1B9451540061590D /* PerformanceNodeChildrenTest.cpp */; }; + FADE78701B9451540061590D /* PerformanceNodeChildrenTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADE786D1B9451540061590D /* PerformanceNodeChildrenTest.cpp */; }; + FADE78731B9572990061590D /* PerformanceParticleTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADE78711B9572990061590D /* PerformanceParticleTest.cpp */; }; + FADE78741B9572990061590D /* PerformanceParticleTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADE78711B9572990061590D /* PerformanceParticleTest.cpp */; }; + FADE78761B95740D0061590D /* fps_images.png in Resources */ = {isa = PBXBuildFile; fileRef = FADE78751B95740D0061590D /* fps_images.png */; }; + FADE78771B95740D0061590D /* fps_images.png in Resources */ = {isa = PBXBuildFile; fileRef = FADE78751B95740D0061590D /* fps_images.png */; }; + FADE78861B96C4780061590D /* PerformanceParticle3DTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADE78841B96C4780061590D /* PerformanceParticle3DTest.cpp */; }; + FADE78871B96C4780061590D /* PerformanceParticle3DTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADE78841B96C4780061590D /* PerformanceParticle3DTest.cpp */; }; + FADE78891B96C51C0061590D /* Particle3D in Resources */ = {isa = PBXBuildFile; fileRef = FADE78881B96C51C0061590D /* Particle3D */; }; + FADE788A1B96C51C0061590D /* Particle3D in Resources */ = {isa = PBXBuildFile; fileRef = FADE78881B96C51C0061590D /* Particle3D */; }; + FADE788D1B96D0710061590D /* PerformanceSpriteTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADE788B1B96D0710061590D /* PerformanceSpriteTest.cpp */; }; + FADE788E1B96D0710061590D /* PerformanceSpriteTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADE788B1B96D0710061590D /* PerformanceSpriteTest.cpp */; }; + FADE78911B9C363D0061590D /* PerformanceTextureTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADE788F1B9C363D0061590D /* PerformanceTextureTest.cpp */; }; + FADE78921B9C363D0061590D /* PerformanceTextureTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADE788F1B9C363D0061590D /* PerformanceTextureTest.cpp */; }; + FADE78951B9C42E80061590D /* PerformanceLabelTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADE78931B9C42E80061590D /* PerformanceLabelTest.cpp */; }; + FADE78961B9C42E80061590D /* PerformanceLabelTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADE78931B9C42E80061590D /* PerformanceLabelTest.cpp */; }; + FADE78991B9D5C640061590D /* PerformanceEventDispatcherTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADE78971B9D5C640061590D /* PerformanceEventDispatcherTest.cpp */; }; + FADE789A1B9D5C640061590D /* PerformanceEventDispatcherTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADE78971B9D5C640061590D /* PerformanceEventDispatcherTest.cpp */; }; + FADE78A61B9E86100061590D /* PerformanceScenarioTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADE78A41B9E86100061590D /* PerformanceScenarioTest.cpp */; }; + FADE78A71B9E86100061590D /* PerformanceScenarioTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADE78A41B9E86100061590D /* PerformanceScenarioTest.cpp */; }; + FADE78AD1B9E88420061590D /* Particles in Resources */ = {isa = PBXBuildFile; fileRef = FADE78AB1B9E88420061590D /* Particles */; }; + FADE78AE1B9E88420061590D /* Particles in Resources */ = {isa = PBXBuildFile; fileRef = FADE78AB1B9E88420061590D /* Particles */; }; + FADE78AF1B9E88420061590D /* TileMaps in Resources */ = {isa = PBXBuildFile; fileRef = FADE78AC1B9E88420061590D /* TileMaps */; }; + FADE78B01B9E88420061590D /* TileMaps in Resources */ = {isa = PBXBuildFile; fileRef = FADE78AC1B9E88420061590D /* TileMaps */; }; + FADE78B31B9EC0290061590D /* PerformanceCallbackTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADE78B11B9EC0290061590D /* PerformanceCallbackTest.cpp */; }; + FADE78B41B9EC0290061590D /* PerformanceCallbackTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADE78B11B9EC0290061590D /* PerformanceCallbackTest.cpp */; }; + FADE78B71B9EC6160061590D /* PerformanceMathTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADE78B51B9EC6160061590D /* PerformanceMathTest.cpp */; }; + FADE78B81B9EC6160061590D /* PerformanceMathTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADE78B51B9EC6160061590D /* PerformanceMathTest.cpp */; }; + FADE78FD1B9ECB7F0061590D /* PerformanceContainerTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADE78FB1B9ECB7F0061590D /* PerformanceContainerTest.cpp */; }; + FADE78FE1B9ECB7F0061590D /* PerformanceContainerTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FADE78FB1B9ECB7F0061590D /* PerformanceContainerTest.cpp */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -1199,6 +1270,20 @@ remoteGlobalIDString = A07A517F1783A1D20073F6A7; remoteInfo = "Test cpp iOS"; }; + FA94AF981B8EF69A0074B261 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 46A15F9C1807A4F8005B8026 /* cocos2d_libs.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = A07A4C241783777C0073F6A7; + remoteInfo = "cocos2dx iOS"; + }; + FA94B0C21B8EF76D0074B261 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 46A15F9C1807A4F8005B8026 /* cocos2d_libs.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = 1551A33E158F2AB200E66CFE; + remoteInfo = "cocos2dx Mac"; + }; /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ @@ -1304,8 +1389,6 @@ 1A0EE41318CDF775004CD58F /* cpp-empty-test iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "cpp-empty-test iOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 1A0EE47E18CDF799004CD58F /* lua-empty-test iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "lua-empty-test iOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 1A221C9B191771E300FD2BE4 /* ccs-res */ = {isa = PBXFileReference; lastKnownFileType = folder; name = "ccs-res"; path = "../tests/cpp-tests/Resources/ccs-res"; sourceTree = ""; }; - 1A97ABFE1A1DC3E30076D9CC /* PerformanceMathTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerformanceMathTest.cpp; sourceTree = ""; }; - 1A97ABFF1A1DC3E30076D9CC /* PerformanceMathTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerformanceMathTest.h; sourceTree = ""; }; 1A9F808C177E98A600D9A1CB /* libcurl.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libcurl.dylib; path = usr/lib/libcurl.dylib; sourceTree = SDKROOT; }; 1ABCA27618CD90A40087CE3A /* cocos2d_lua_bindings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = cocos2d_lua_bindings.xcodeproj; path = "../cocos/scripting/lua-bindings/proj.ios_mac/cocos2d_lua_bindings.xcodeproj"; sourceTree = ""; }; 1ABCA28618CD91510087CE3A /* lua-tests Mac.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "lua-tests Mac.app"; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -1591,30 +1674,6 @@ 1AC35ABD18CECF0C00F37B72 /* ParallaxTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParallaxTest.h; sourceTree = ""; }; 1AC35ABF18CECF0C00F37B72 /* ParticleTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ParticleTest.cpp; sourceTree = ""; }; 1AC35AC018CECF0C00F37B72 /* ParticleTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParticleTest.h; sourceTree = ""; }; - 1AC35AC218CECF0C00F37B72 /* PerformanceAllocTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerformanceAllocTest.cpp; sourceTree = ""; }; - 1AC35AC318CECF0C00F37B72 /* PerformanceAllocTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerformanceAllocTest.h; sourceTree = ""; }; - 1AC35AC418CECF0C00F37B72 /* PerformanceContainerTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerformanceContainerTest.cpp; sourceTree = ""; }; - 1AC35AC518CECF0C00F37B72 /* PerformanceContainerTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerformanceContainerTest.h; sourceTree = ""; }; - 1AC35AC618CECF0C00F37B72 /* PerformanceEventDispatcherTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerformanceEventDispatcherTest.cpp; sourceTree = ""; }; - 1AC35AC718CECF0C00F37B72 /* PerformanceEventDispatcherTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerformanceEventDispatcherTest.h; sourceTree = ""; }; - 1AC35AC818CECF0C00F37B72 /* PerformanceLabelTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerformanceLabelTest.cpp; sourceTree = ""; }; - 1AC35AC918CECF0C00F37B72 /* PerformanceLabelTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerformanceLabelTest.h; sourceTree = ""; }; - 1AC35ACA18CECF0C00F37B72 /* PerformanceNodeChildrenTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerformanceNodeChildrenTest.cpp; sourceTree = ""; }; - 1AC35ACB18CECF0C00F37B72 /* PerformanceNodeChildrenTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerformanceNodeChildrenTest.h; sourceTree = ""; }; - 1AC35ACC18CECF0C00F37B72 /* PerformanceParticleTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerformanceParticleTest.cpp; sourceTree = ""; }; - 1AC35ACD18CECF0C00F37B72 /* PerformanceParticleTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerformanceParticleTest.h; sourceTree = ""; }; - 1AC35ACE18CECF0C00F37B72 /* PerformanceRendererTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerformanceRendererTest.cpp; sourceTree = ""; }; - 1AC35ACF18CECF0C00F37B72 /* PerformanceRendererTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerformanceRendererTest.h; sourceTree = ""; }; - 1AC35AD018CECF0C00F37B72 /* PerformanceScenarioTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerformanceScenarioTest.cpp; sourceTree = ""; }; - 1AC35AD118CECF0C00F37B72 /* PerformanceScenarioTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerformanceScenarioTest.h; sourceTree = ""; }; - 1AC35AD218CECF0C00F37B72 /* PerformanceSpriteTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerformanceSpriteTest.cpp; sourceTree = ""; }; - 1AC35AD318CECF0C00F37B72 /* PerformanceSpriteTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerformanceSpriteTest.h; sourceTree = ""; }; - 1AC35AD418CECF0C00F37B72 /* PerformanceTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerformanceTest.cpp; sourceTree = ""; }; - 1AC35AD518CECF0C00F37B72 /* PerformanceTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerformanceTest.h; sourceTree = ""; }; - 1AC35AD618CECF0C00F37B72 /* PerformanceTextureTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerformanceTextureTest.cpp; sourceTree = ""; }; - 1AC35AD718CECF0C00F37B72 /* PerformanceTextureTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerformanceTextureTest.h; sourceTree = ""; }; - 1AC35AD818CECF0C00F37B72 /* PerformanceTouchesTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerformanceTouchesTest.cpp; sourceTree = ""; }; - 1AC35AD918CECF0C00F37B72 /* PerformanceTouchesTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerformanceTouchesTest.h; sourceTree = ""; }; 1AC35ADB18CECF0C00F37B72 /* PhysicsTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PhysicsTest.cpp; sourceTree = ""; }; 1AC35ADC18CECF0C00F37B72 /* PhysicsTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PhysicsTest.h; sourceTree = ""; }; 1AC35ADE18CECF0C00F37B72 /* ReleasePoolTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ReleasePoolTest.cpp; sourceTree = ""; }; @@ -1776,8 +1835,6 @@ 1AC35DAE18CEE5DA00F37B72 /* LuaObjectCBridgeTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LuaObjectCBridgeTest.h; sourceTree = ""; }; 1AC35DAF18CEE5DA00F37B72 /* LuaObjectCBridgeTest.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LuaObjectCBridgeTest.mm; sourceTree = ""; }; 1AC35DB018CEE5DA00F37B72 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = ""; }; - 1AF152D718FD252A00A52F3D /* PerformanceCallbackTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerformanceCallbackTest.cpp; sourceTree = ""; }; - 1AF152D818FD252A00A52F3D /* PerformanceCallbackTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerformanceCallbackTest.h; sourceTree = ""; }; 1D6058910D05DD3D006BFB54 /* cpp-tests Mac.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "cpp-tests Mac.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 1F33634D18E37E840074764D /* RefPtrTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RefPtrTest.cpp; sourceTree = ""; }; 1F33634E18E37E840074764D /* RefPtrTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RefPtrTest.h; sourceTree = ""; }; @@ -1992,8 +2049,6 @@ B609E67119C18DAD003D0074 /* BillBoardTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BillBoardTest.cpp; path = BillBoardTest/BillBoardTest.cpp; sourceTree = ""; }; B609E67219C18DAD003D0074 /* BillBoardTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BillBoardTest.h; path = BillBoardTest/BillBoardTest.h; sourceTree = ""; }; B61E90CA1B12B74B00BE69EA /* NavMesh */ = {isa = PBXFileReference; lastKnownFileType = folder; name = NavMesh; path = "../tests/cpp-tests/Resources/NavMesh"; sourceTree = ""; }; - B6337DF51ABA9B44005AEF24 /* PerformanceParticle3DTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerformanceParticle3DTest.cpp; sourceTree = ""; }; - B6337DF61ABA9B44005AEF24 /* PerformanceParticle3DTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerformanceParticle3DTest.h; sourceTree = ""; }; B639932C1A490EC700B07923 /* Particle3DTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Particle3DTest.cpp; path = Particle3DTest/Particle3DTest.cpp; sourceTree = ""; }; B639932D1A490EC700B07923 /* Particle3DTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Particle3DTest.h; path = Particle3DTest/Particle3DTest.h; sourceTree = ""; }; B63993301A49359F00B07923 /* Particle3D */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Particle3D; path = "../tests/cpp-tests/Resources/Particle3D"; sourceTree = ""; }; @@ -2012,6 +2067,82 @@ ED545A6C1B68A18300C3958E /* libiconv.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libiconv.dylib; path = usr/lib/libiconv.dylib; sourceTree = SDKROOT; }; ED545A721B68A1AC00C3958E /* libiconv.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libiconv.dylib; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk/usr/lib/libiconv.dylib; sourceTree = DEVELOPER_DIR; }; EDCC747E17C455FD007B692C /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; }; + FA94B0B41B8EF69A0074B261 /* performance-tests iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "performance-tests iOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + FA94B1C71B8EF76D0074B261 /* performance-tests Mac.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "performance-tests Mac.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + FA94B1CA1B8EF7BB0074B261 /* AppDelegate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AppDelegate.cpp; sourceTree = ""; }; + FA94B1CB1B8EF7BB0074B261 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + FA94B1D41B8EF8250074B261 /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppController.h; sourceTree = ""; }; + FA94B1D51B8EF8250074B261 /* AppController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AppController.mm; sourceTree = ""; }; + FA94B1D61B8EF8250074B261 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; + FA94B1D71B8EF8250074B261 /* Default-667h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-667h@2x.png"; sourceTree = ""; }; + FA94B1D81B8EF8250074B261 /* Default-736h@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-736h@3x.png"; sourceTree = ""; }; + FA94B1D91B8EF8250074B261 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = ""; }; + FA94B1DA1B8EF8250074B261 /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = ""; }; + FA94B1DB1B8EF8250074B261 /* Icon-100.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-100.png"; sourceTree = ""; }; + FA94B1DC1B8EF8250074B261 /* Icon-114.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-114.png"; sourceTree = ""; }; + FA94B1DD1B8EF8250074B261 /* Icon-120.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-120.png"; sourceTree = ""; }; + FA94B1DE1B8EF8250074B261 /* Icon-144.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-144.png"; sourceTree = ""; }; + FA94B1DF1B8EF8250074B261 /* Icon-152.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-152.png"; sourceTree = ""; }; + FA94B1E01B8EF8250074B261 /* Icon-29.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-29.png"; sourceTree = ""; }; + FA94B1E11B8EF8250074B261 /* Icon-40.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-40.png"; sourceTree = ""; }; + FA94B1E21B8EF8250074B261 /* Icon-50.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-50.png"; sourceTree = ""; }; + FA94B1E31B8EF8250074B261 /* Icon-57.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-57.png"; sourceTree = ""; }; + FA94B1E41B8EF8250074B261 /* Icon-58.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-58.png"; sourceTree = ""; }; + FA94B1E51B8EF8250074B261 /* Icon-72.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-72.png"; sourceTree = ""; }; + FA94B1E61B8EF8250074B261 /* Icon-76.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-76.png"; sourceTree = ""; }; + FA94B1E71B8EF8250074B261 /* Icon-80.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-80.png"; sourceTree = ""; }; + FA94B1E81B8EF8250074B261 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + FA94B1E91B8EF8250074B261 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + FA94B1EA1B8EF8250074B261 /* Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Prefix.pch; sourceTree = ""; }; + FA94B1EB1B8EF8250074B261 /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = ""; }; + FA94B1EC1B8EF8250074B261 /* RootViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RootViewController.mm; sourceTree = ""; }; + FA94B2041B8EF8430074B261 /* Icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Icon.icns; sourceTree = ""; }; + FA94B2051B8EF8430074B261 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + FA94B2061B8EF8430074B261 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = ""; }; + FA94B2071B8EF8430074B261 /* Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Prefix.pch; sourceTree = ""; }; + FA94B2211B8EF9C50074B261 /* CloseNormal.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = CloseNormal.png; path = "../tests/performance-tests/Resources/CloseNormal.png"; sourceTree = ""; }; + FA94B2221B8EF9C50074B261 /* CloseSelected.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = CloseSelected.png; path = "../tests/performance-tests/Resources/CloseSelected.png"; sourceTree = ""; }; + FA94B2331B8F02880074B261 /* Profile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Profile.cpp; sourceTree = ""; }; + FA94B2341B8F02880074B261 /* Profile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Profile.h; sourceTree = ""; }; + FA94B2381B9045160074B261 /* PerformanceAllocTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerformanceAllocTest.cpp; sourceTree = ""; }; + FA94B2391B9045160074B261 /* PerformanceAllocTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerformanceAllocTest.h; sourceTree = ""; }; + FA94B23C1B90497E0074B261 /* BaseTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BaseTest.cpp; sourceTree = ""; }; + FA94B23D1B90497E0074B261 /* BaseTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseTest.h; sourceTree = ""; }; + FA94B23E1B90497E0074B261 /* controller.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = controller.cpp; sourceTree = ""; }; + FA94B23F1B90497E0074B261 /* controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = controller.h; sourceTree = ""; }; + FA94B2411B90497E0074B261 /* testBasic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = testBasic.h; sourceTree = ""; }; + FA94B2481B904E290074B261 /* tests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tests.h; sourceTree = ""; }; + FA94B2491B9059540074B261 /* VisibleRect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VisibleRect.cpp; sourceTree = ""; }; + FA94B24A1B9059540074B261 /* VisibleRect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VisibleRect.h; sourceTree = ""; }; + FA94B24D1B93EF7B0074B261 /* Images */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Images; path = "../tests/performance-tests/Resources/Images"; sourceTree = ""; }; + FADE786A1B942DE30061590D /* fonts */ = {isa = PBXFileReference; lastKnownFileType = folder; name = fonts; path = "../tests/performance-tests/Resources/fonts"; sourceTree = ""; }; + FADE786D1B9451540061590D /* PerformanceNodeChildrenTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerformanceNodeChildrenTest.cpp; sourceTree = ""; }; + FADE786E1B9451540061590D /* PerformanceNodeChildrenTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerformanceNodeChildrenTest.h; sourceTree = ""; }; + FADE78711B9572990061590D /* PerformanceParticleTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerformanceParticleTest.cpp; sourceTree = ""; }; + FADE78721B9572990061590D /* PerformanceParticleTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerformanceParticleTest.h; sourceTree = ""; }; + FADE78751B95740D0061590D /* fps_images.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = fps_images.png; path = "../tests/performance-tests/Resources/fps_images.png"; sourceTree = ""; }; + FADE78841B96C4780061590D /* PerformanceParticle3DTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerformanceParticle3DTest.cpp; sourceTree = ""; }; + FADE78851B96C4780061590D /* PerformanceParticle3DTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerformanceParticle3DTest.h; sourceTree = ""; }; + FADE78881B96C51C0061590D /* Particle3D */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Particle3D; path = "../tests/performance-tests/Resources/Particle3D"; sourceTree = ""; }; + FADE788B1B96D0710061590D /* PerformanceSpriteTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerformanceSpriteTest.cpp; sourceTree = ""; }; + FADE788C1B96D0710061590D /* PerformanceSpriteTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerformanceSpriteTest.h; sourceTree = ""; }; + FADE788F1B9C363D0061590D /* PerformanceTextureTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerformanceTextureTest.cpp; sourceTree = ""; }; + FADE78901B9C363D0061590D /* PerformanceTextureTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerformanceTextureTest.h; sourceTree = ""; }; + FADE78931B9C42E80061590D /* PerformanceLabelTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerformanceLabelTest.cpp; sourceTree = ""; }; + FADE78941B9C42E80061590D /* PerformanceLabelTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerformanceLabelTest.h; sourceTree = ""; }; + FADE78971B9D5C640061590D /* PerformanceEventDispatcherTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerformanceEventDispatcherTest.cpp; sourceTree = ""; }; + FADE78981B9D5C640061590D /* PerformanceEventDispatcherTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerformanceEventDispatcherTest.h; sourceTree = ""; }; + FADE78A41B9E86100061590D /* PerformanceScenarioTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerformanceScenarioTest.cpp; sourceTree = ""; }; + FADE78A51B9E86100061590D /* PerformanceScenarioTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerformanceScenarioTest.h; sourceTree = ""; }; + FADE78AB1B9E88420061590D /* Particles */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Particles; path = "../tests/performance-tests/Resources/Particles"; sourceTree = ""; }; + FADE78AC1B9E88420061590D /* TileMaps */ = {isa = PBXFileReference; lastKnownFileType = folder; name = TileMaps; path = "../tests/performance-tests/Resources/TileMaps"; sourceTree = ""; }; + FADE78B11B9EC0290061590D /* PerformanceCallbackTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerformanceCallbackTest.cpp; sourceTree = ""; }; + FADE78B21B9EC0290061590D /* PerformanceCallbackTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerformanceCallbackTest.h; sourceTree = ""; }; + FADE78B51B9EC6160061590D /* PerformanceMathTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerformanceMathTest.cpp; sourceTree = ""; }; + FADE78B61B9EC6160061590D /* PerformanceMathTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerformanceMathTest.h; sourceTree = ""; }; + FADE78FB1B9ECB7F0061590D /* PerformanceContainerTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerformanceContainerTest.cpp; sourceTree = ""; }; + FADE78FC1B9ECB7F0061590D /* PerformanceContainerTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerformanceContainerTest.h; sourceTree = ""; }; + FADE79081B9FCD400061590D /* testResource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = testResource.h; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -2262,6 +2393,46 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + FA94B0A21B8EF69A0074B261 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + FA94B0A31B8EF69A0074B261 /* libiconv.dylib in Frameworks */, + FA94B0A41B8EF69A0074B261 /* Security.framework in Frameworks */, + FA94B0A51B8EF69A0074B261 /* MediaPlayer.framework in Frameworks */, + FA94B0A61B8EF69A0074B261 /* libcocos2d iOS.a in Frameworks */, + FA94B0A71B8EF69A0074B261 /* CoreMotion.framework in Frameworks */, + FA94B0A81B8EF69A0074B261 /* libz.dylib in Frameworks */, + FA94B0A91B8EF69A0074B261 /* Foundation.framework in Frameworks */, + FA94B0AA1B8EF69A0074B261 /* AudioToolbox.framework in Frameworks */, + FA94B0AB1B8EF69A0074B261 /* OpenAL.framework in Frameworks */, + FA94B0AC1B8EF69A0074B261 /* QuartzCore.framework in Frameworks */, + FA94B0AD1B8EF69A0074B261 /* CoreGraphics.framework in Frameworks */, + FA94B0AE1B8EF69A0074B261 /* OpenGLES.framework in Frameworks */, + FA94B0AF1B8EF69A0074B261 /* UIKit.framework in Frameworks */, + FA94B0B01B8EF69A0074B261 /* AVFoundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + FA94B1B71B8EF76D0074B261 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + FA94B1B81B8EF76D0074B261 /* libiconv.dylib in Frameworks */, + FA94B1B91B8EF76D0074B261 /* libcocos2d Mac.a in Frameworks */, + FA94B1BA1B8EF76D0074B261 /* Security.framework in Frameworks */, + FA94B1BB1B8EF76D0074B261 /* IOKit.framework in Frameworks */, + FA94B1BC1B8EF76D0074B261 /* libz.dylib in Frameworks */, + FA94B1BD1B8EF76D0074B261 /* Foundation.framework in Frameworks */, + FA94B1BE1B8EF76D0074B261 /* AudioToolbox.framework in Frameworks */, + FA94B1BF1B8EF76D0074B261 /* ApplicationServices.framework in Frameworks */, + FA94B1C01B8EF76D0074B261 /* OpenAL.framework in Frameworks */, + FA94B1C11B8EF76D0074B261 /* QuartzCore.framework in Frameworks */, + FA94B1C21B8EF76D0074B261 /* OpenGL.framework in Frameworks */, + FA94B1C31B8EF76D0074B261 /* Cocoa.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -2452,6 +2623,8 @@ 15CBA063196EE56C005877BB /* lua-game-controller-test iOS.app */, 185663941B4155D4009EF2AE /* js-tests Mac.app */, 185663ED1B4155DD009EF2AE /* js-tests iOS.app */, + FA94B0B41B8EF69A0074B261 /* performance-tests iOS.app */, + FA94B1C71B8EF76D0074B261 /* performance-tests Mac.app */, ); name = Products; sourceTree = ""; @@ -2621,7 +2794,6 @@ 1AC35AB818CECF0C00F37B72 /* NodeTest */, 1AC35ABB18CECF0C00F37B72 /* ParallaxTest */, 1AC35ABE18CECF0C00F37B72 /* ParticleTest */, - 1AC35AC118CECF0C00F37B72 /* PerformanceTest */, 1AC35ADA18CECF0C00F37B72 /* PhysicsTest */, 1AC35ADD18CECF0C00F37B72 /* ReleasePoolTest */, 1AC35AE018CECF0C00F37B72 /* RenderTextureTest */, @@ -3343,43 +3515,6 @@ path = ParticleTest; sourceTree = ""; }; - 1AC35AC118CECF0C00F37B72 /* PerformanceTest */ = { - isa = PBXGroup; - children = ( - B6337DF51ABA9B44005AEF24 /* PerformanceParticle3DTest.cpp */, - B6337DF61ABA9B44005AEF24 /* PerformanceParticle3DTest.h */, - 1AC35AC218CECF0C00F37B72 /* PerformanceAllocTest.cpp */, - 1AC35AC318CECF0C00F37B72 /* PerformanceAllocTest.h */, - 1AF152D718FD252A00A52F3D /* PerformanceCallbackTest.cpp */, - 1AF152D818FD252A00A52F3D /* PerformanceCallbackTest.h */, - 1AC35AC418CECF0C00F37B72 /* PerformanceContainerTest.cpp */, - 1AC35AC518CECF0C00F37B72 /* PerformanceContainerTest.h */, - 1AC35AC618CECF0C00F37B72 /* PerformanceEventDispatcherTest.cpp */, - 1AC35AC718CECF0C00F37B72 /* PerformanceEventDispatcherTest.h */, - 1AC35AC818CECF0C00F37B72 /* PerformanceLabelTest.cpp */, - 1AC35AC918CECF0C00F37B72 /* PerformanceLabelTest.h */, - 1A97ABFE1A1DC3E30076D9CC /* PerformanceMathTest.cpp */, - 1A97ABFF1A1DC3E30076D9CC /* PerformanceMathTest.h */, - 1AC35ACA18CECF0C00F37B72 /* PerformanceNodeChildrenTest.cpp */, - 1AC35ACB18CECF0C00F37B72 /* PerformanceNodeChildrenTest.h */, - 1AC35ACC18CECF0C00F37B72 /* PerformanceParticleTest.cpp */, - 1AC35ACD18CECF0C00F37B72 /* PerformanceParticleTest.h */, - 1AC35ACE18CECF0C00F37B72 /* PerformanceRendererTest.cpp */, - 1AC35ACF18CECF0C00F37B72 /* PerformanceRendererTest.h */, - 1AC35AD018CECF0C00F37B72 /* PerformanceScenarioTest.cpp */, - 1AC35AD118CECF0C00F37B72 /* PerformanceScenarioTest.h */, - 1AC35AD218CECF0C00F37B72 /* PerformanceSpriteTest.cpp */, - 1AC35AD318CECF0C00F37B72 /* PerformanceSpriteTest.h */, - 1AC35AD418CECF0C00F37B72 /* PerformanceTest.cpp */, - 1AC35AD518CECF0C00F37B72 /* PerformanceTest.h */, - 1AC35AD618CECF0C00F37B72 /* PerformanceTextureTest.cpp */, - 1AC35AD718CECF0C00F37B72 /* PerformanceTextureTest.h */, - 1AC35AD818CECF0C00F37B72 /* PerformanceTouchesTest.cpp */, - 1AC35AD918CECF0C00F37B72 /* PerformanceTouchesTest.h */, - ); - path = PerformanceTest; - sourceTree = ""; - }; 1AC35ADA18CECF0C00F37B72 /* PhysicsTest */ = { isa = PBXGroup; children = ( @@ -3839,6 +3974,7 @@ 1AC3592118CECEFF00F37B72 /* cpp-tests */, 1AC35D2418CEDE5600F37B72 /* lua-empty-test */, 1AC35D7118CEE4AE00F37B72 /* lua-tests */, + FA94B0B81B8EF73D0074B261 /* performance-tests */, ); name = tests; sourceTree = ""; @@ -4483,6 +4619,130 @@ name = AllocatorTest; sourceTree = ""; }; + FA94B0B81B8EF73D0074B261 /* performance-tests */ = { + isa = PBXGroup; + children = ( + FA94B2201B8EF9A90074B261 /* Resources */, + FA94B2031B8EF8430074B261 /* proj.mac */, + FA94B1D31B8EF8250074B261 /* proj.ios */, + FA94B1C91B8EF7BB0074B261 /* Classes */, + ); + name = "performance-tests"; + sourceTree = ""; + }; + FA94B1C91B8EF7BB0074B261 /* Classes */ = { + isa = PBXGroup; + children = ( + FA94B2371B9045160074B261 /* tests */, + FA94B2331B8F02880074B261 /* Profile.cpp */, + FA94B2341B8F02880074B261 /* Profile.h */, + FA94B1CA1B8EF7BB0074B261 /* AppDelegate.cpp */, + FA94B1CB1B8EF7BB0074B261 /* AppDelegate.h */, + ); + name = Classes; + path = "../tests/performance-tests/Classes"; + sourceTree = ""; + }; + FA94B1D31B8EF8250074B261 /* proj.ios */ = { + isa = PBXGroup; + children = ( + FA94B1D41B8EF8250074B261 /* AppController.h */, + FA94B1D51B8EF8250074B261 /* AppController.mm */, + FA94B1D61B8EF8250074B261 /* Default-568h@2x.png */, + FA94B1D71B8EF8250074B261 /* Default-667h@2x.png */, + FA94B1D81B8EF8250074B261 /* Default-736h@3x.png */, + FA94B1D91B8EF8250074B261 /* Default.png */, + FA94B1DA1B8EF8250074B261 /* Default@2x.png */, + FA94B1DB1B8EF8250074B261 /* Icon-100.png */, + FA94B1DC1B8EF8250074B261 /* Icon-114.png */, + FA94B1DD1B8EF8250074B261 /* Icon-120.png */, + FA94B1DE1B8EF8250074B261 /* Icon-144.png */, + FA94B1DF1B8EF8250074B261 /* Icon-152.png */, + FA94B1E01B8EF8250074B261 /* Icon-29.png */, + FA94B1E11B8EF8250074B261 /* Icon-40.png */, + FA94B1E21B8EF8250074B261 /* Icon-50.png */, + FA94B1E31B8EF8250074B261 /* Icon-57.png */, + FA94B1E41B8EF8250074B261 /* Icon-58.png */, + FA94B1E51B8EF8250074B261 /* Icon-72.png */, + FA94B1E61B8EF8250074B261 /* Icon-76.png */, + FA94B1E71B8EF8250074B261 /* Icon-80.png */, + FA94B1E81B8EF8250074B261 /* Info.plist */, + FA94B1E91B8EF8250074B261 /* main.m */, + FA94B1EA1B8EF8250074B261 /* Prefix.pch */, + FA94B1EB1B8EF8250074B261 /* RootViewController.h */, + FA94B1EC1B8EF8250074B261 /* RootViewController.mm */, + ); + name = proj.ios; + path = "../tests/performance-tests/proj.ios"; + sourceTree = ""; + }; + FA94B2031B8EF8430074B261 /* proj.mac */ = { + isa = PBXGroup; + children = ( + FA94B2041B8EF8430074B261 /* Icon.icns */, + FA94B2051B8EF8430074B261 /* Info.plist */, + FA94B2061B8EF8430074B261 /* main.cpp */, + FA94B2071B8EF8430074B261 /* Prefix.pch */, + ); + name = proj.mac; + path = "../tests/performance-tests/proj.mac"; + sourceTree = ""; + }; + FA94B2201B8EF9A90074B261 /* Resources */ = { + isa = PBXGroup; + children = ( + FADE78AB1B9E88420061590D /* Particles */, + FADE78AC1B9E88420061590D /* TileMaps */, + FADE78881B96C51C0061590D /* Particle3D */, + FADE78751B95740D0061590D /* fps_images.png */, + FADE786A1B942DE30061590D /* fonts */, + FA94B24D1B93EF7B0074B261 /* Images */, + FA94B2211B8EF9C50074B261 /* CloseNormal.png */, + FA94B2221B8EF9C50074B261 /* CloseSelected.png */, + ); + name = Resources; + sourceTree = ""; + }; + FA94B2371B9045160074B261 /* tests */ = { + isa = PBXGroup; + children = ( + FADE79081B9FCD400061590D /* testResource.h */, + FA94B2491B9059540074B261 /* VisibleRect.cpp */, + FA94B24A1B9059540074B261 /* VisibleRect.h */, + FA94B2481B904E290074B261 /* tests.h */, + FA94B23C1B90497E0074B261 /* BaseTest.cpp */, + FA94B23D1B90497E0074B261 /* BaseTest.h */, + FA94B23E1B90497E0074B261 /* controller.cpp */, + FA94B23F1B90497E0074B261 /* controller.h */, + FA94B2411B90497E0074B261 /* testBasic.h */, + FA94B2381B9045160074B261 /* PerformanceAllocTest.cpp */, + FA94B2391B9045160074B261 /* PerformanceAllocTest.h */, + FADE78B11B9EC0290061590D /* PerformanceCallbackTest.cpp */, + FADE78B21B9EC0290061590D /* PerformanceCallbackTest.h */, + FADE78FB1B9ECB7F0061590D /* PerformanceContainerTest.cpp */, + FADE78FC1B9ECB7F0061590D /* PerformanceContainerTest.h */, + FADE78971B9D5C640061590D /* PerformanceEventDispatcherTest.cpp */, + FADE78981B9D5C640061590D /* PerformanceEventDispatcherTest.h */, + FADE78931B9C42E80061590D /* PerformanceLabelTest.cpp */, + FADE78941B9C42E80061590D /* PerformanceLabelTest.h */, + FADE78B51B9EC6160061590D /* PerformanceMathTest.cpp */, + FADE78B61B9EC6160061590D /* PerformanceMathTest.h */, + FADE786D1B9451540061590D /* PerformanceNodeChildrenTest.cpp */, + FADE786E1B9451540061590D /* PerformanceNodeChildrenTest.h */, + FADE78711B9572990061590D /* PerformanceParticleTest.cpp */, + FADE78721B9572990061590D /* PerformanceParticleTest.h */, + FADE78841B96C4780061590D /* PerformanceParticle3DTest.cpp */, + FADE78851B96C4780061590D /* PerformanceParticle3DTest.h */, + FADE78A41B9E86100061590D /* PerformanceScenarioTest.cpp */, + FADE78A51B9E86100061590D /* PerformanceScenarioTest.h */, + FADE788B1B96D0710061590D /* PerformanceSpriteTest.cpp */, + FADE788C1B96D0710061590D /* PerformanceSpriteTest.h */, + FADE788F1B9C363D0061590D /* PerformanceTextureTest.cpp */, + FADE78901B9C363D0061590D /* PerformanceTextureTest.h */, + ); + path = tests; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -4718,6 +4978,42 @@ productReference = A07A52291783A1D20073F6A7 /* cpp-tests iOS.app */; productType = "com.apple.product-type.application"; }; + FA94AF961B8EF69A0074B261 /* performance-tests iOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = FA94B0B11B8EF69A0074B261 /* Build configuration list for PBXNativeTarget "performance-tests iOS" */; + buildPhases = ( + FA94AF991B8EF69A0074B261 /* Resources */, + FA94AFD31B8EF69A0074B261 /* Sources */, + FA94B0A21B8EF69A0074B261 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + FA94AF971B8EF69A0074B261 /* PBXTargetDependency */, + ); + name = "performance-tests iOS"; + productName = iphone; + productReference = FA94B0B41B8EF69A0074B261 /* performance-tests iOS.app */; + productType = "com.apple.product-type.application"; + }; + FA94B0C01B8EF76D0074B261 /* performance-tests Mac */ = { + isa = PBXNativeTarget; + buildConfigurationList = FA94B1C41B8EF76D0074B261 /* Build configuration list for PBXNativeTarget "performance-tests Mac" */; + buildPhases = ( + FA94B0C31B8EF76D0074B261 /* Resources */, + FA94B0EC1B8EF76D0074B261 /* Sources */, + FA94B1B71B8EF76D0074B261 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + FA94B0C11B8EF76D0074B261 /* PBXTargetDependency */, + ); + name = "performance-tests Mac"; + productName = iphone; + productReference = FA94B1C71B8EF76D0074B261 /* performance-tests Mac.app */; + productType = "com.apple.product-type.application"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -4767,6 +5063,7 @@ 1ABCA28518CD91510087CE3A /* lua-tests Mac */, 1A0EE2B818CDF733004CD58F /* lua-empty-test Mac */, 1856634B1B4155D3009EF2AE /* js-tests Mac */, + FA94B0C01B8EF76D0074B261 /* performance-tests Mac */, A07A517B1783A1CC0073F6A7 /* build all tests iOS */, A07A517F1783A1D20073F6A7 /* cpp-tests iOS */, 1A0EE31818CDF775004CD58F /* cpp-empty-test iOS */, @@ -4775,6 +5072,7 @@ 3E6176FF1960FAED00DE83F5 /* game-controller-test IOS */, 15CBA015196EE56C005877BB /* lua-game-controller-test iOS */, 185663961B4155DD009EF2AE /* js-tests iOS */, + FA94AF961B8EF69A0074B261 /* performance-tests iOS */, ); }; /* End PBXProject section */ @@ -5200,6 +5498,57 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + FA94AF991B8EF69A0074B261 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + FA94B24F1B93EF7B0074B261 /* Images in Resources */, + FA94B1F51B8EF8250074B261 /* Icon-120.png in Resources */, + FA94B1FA1B8EF8250074B261 /* Icon-50.png in Resources */, + FA94B1FF1B8EF8250074B261 /* Icon-80.png in Resources */, + FA94B1EE1B8EF8250074B261 /* Default-568h@2x.png in Resources */, + FA94B1EF1B8EF8250074B261 /* Default-667h@2x.png in Resources */, + FA94B1FB1B8EF8250074B261 /* Icon-57.png in Resources */, + FA94B1F71B8EF8250074B261 /* Icon-152.png in Resources */, + FA94B1F21B8EF8250074B261 /* Default@2x.png in Resources */, + FA94B1F01B8EF8250074B261 /* Default-736h@3x.png in Resources */, + FADE786C1B942DE30061590D /* fonts in Resources */, + FA94B2001B8EF8250074B261 /* Info.plist in Resources */, + FADE78AE1B9E88420061590D /* Particles in Resources */, + FA94B1F41B8EF8250074B261 /* Icon-114.png in Resources */, + FA94B1F81B8EF8250074B261 /* Icon-29.png in Resources */, + FADE78B01B9E88420061590D /* TileMaps in Resources */, + FA94B1F91B8EF8250074B261 /* Icon-40.png in Resources */, + FA94B1F31B8EF8250074B261 /* Icon-100.png in Resources */, + FA94B1FE1B8EF8250074B261 /* Icon-76.png in Resources */, + FA94B1F61B8EF8250074B261 /* Icon-144.png in Resources */, + FA94B1FD1B8EF8250074B261 /* Icon-72.png in Resources */, + FA94B2271B8EF9C50074B261 /* CloseNormal.png in Resources */, + FA94B1F11B8EF8250074B261 /* Default.png in Resources */, + FA94B1FC1B8EF8250074B261 /* Icon-58.png in Resources */, + FA94B2291B8EF9C50074B261 /* CloseSelected.png in Resources */, + FADE788A1B96C51C0061590D /* Particle3D in Resources */, + FADE78771B95740D0061590D /* fps_images.png in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + FA94B0C31B8EF76D0074B261 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + FA94B24E1B93EF7B0074B261 /* Images in Resources */, + FA94B2091B8EF8430074B261 /* Info.plist in Resources */, + FA94B2261B8EF9C50074B261 /* CloseNormal.png in Resources */, + FADE78AD1B9E88420061590D /* Particles in Resources */, + FADE786B1B942DE30061590D /* fonts in Resources */, + FADE78AF1B9E88420061590D /* TileMaps in Resources */, + FA94B2081B8EF8430074B261 /* Icon.icns in Resources */, + FADE78891B96C51C0061590D /* Particle3D in Resources */, + FADE78761B95740D0061590D /* fps_images.png in Resources */, + FA94B2281B8EF9C50074B261 /* CloseSelected.png in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ @@ -5464,7 +5813,6 @@ 850F8A241B5F3A4F00780603 /* Bug-12847.cpp in Sources */, A5030C3519D059DA000E78E7 /* OpenURLTest.cpp in Sources */, 29080D1C191B574B0066F8DF /* UITest.cpp in Sources */, - 1AC35C3118CECF0C00F37B72 /* PerformanceRendererTest.cpp in Sources */, 1AC35C4518CECF0C00F37B72 /* SceneTest.cpp in Sources */, 1AC35B6F18CECF0C00F37B72 /* MenuTestLayer.cpp in Sources */, 59620E8F1921E5CF002021B6 /* Bug-Child.cpp in Sources */, @@ -5488,7 +5836,6 @@ 5046AB4A1AF2A8D80060550B /* MaterialSystemTest.cpp in Sources */, B603F1AF1AC8EA4E00A9579C /* TerrainTest.cpp in Sources */, 29080DC7191B595E0066F8DF /* UISceneManager.cpp in Sources */, - 1AC35C2F18CECF0C00F37B72 /* PerformanceParticleTest.cpp in Sources */, 1AC35B4918CECF0C00F37B72 /* Bug-914.cpp in Sources */, 1AC35B6318CECF0C00F37B72 /* EffectsAdvancedTest.cpp in Sources */, B6CAB54E1AF9AA6C00B9B856 /* Physics3DTest.cpp in Sources */, @@ -5504,7 +5851,6 @@ 1AC35B6118CECF0C00F37B72 /* DrawPrimitivesTest.cpp in Sources */, 1AC35C1718CECF0C00F37B72 /* MotionStreakTest.cpp in Sources */, 1AC35C0518CECF0C00F37B72 /* FontTest.cpp in Sources */, - 1AC35C3718CECF0C00F37B72 /* PerformanceTest.cpp in Sources */, 29080D99191B595E0066F8DF /* CustomImageViewReader.cpp in Sources */, 29080DD1191B595E0066F8DF /* UISliderTest_Editor.cpp in Sources */, 1AC35B2718CECF0C00F37B72 /* ActionsTest.cpp in Sources */, @@ -5521,7 +5867,6 @@ 29080DD5191B595E0066F8DF /* UITextAtlasTest_Editor.cpp in Sources */, 1AC35BFF18CECF0C00F37B72 /* CustomTableViewCell.cpp in Sources */, 29080DDF191B595E0066F8DF /* UITextTest.cpp in Sources */, - 1AC35C2718CECF0C00F37B72 /* PerformanceContainerTest.cpp in Sources */, 1AC35BEF18CECF0C00F37B72 /* CCControlSwitchTest.cpp in Sources */, 29080D91191B595E0066F8DF /* CustomGUIScene.cpp in Sources */, 3E9E75D0199324CB005B7047 /* Camera3DTest.cpp in Sources */, @@ -5539,14 +5884,12 @@ 1AC35B5D18CECF0C00F37B72 /* CurrentLanguageTest.cpp in Sources */, 1AC35B3B18CECF0C00F37B72 /* Bug-350.cpp in Sources */, 1AC35C4718CECF0C00F37B72 /* SchedulerTest.cpp in Sources */, - 1AF152D918FD252A00A52F3D /* PerformanceCallbackTest.cpp in Sources */, 29080DA3191B595E0066F8DF /* UIButtonTest.cpp in Sources */, 1AC35C5518CECF0C00F37B72 /* Texture2dTest.cpp in Sources */, 1AC35C0718CECF0C00F37B72 /* MouseTest.cpp in Sources */, 182C5CBA1A95B2FD00C30D34 /* CocosStudio3DTest.cpp in Sources */, 1AC35C5D18CECF0C00F37B72 /* Ball.cpp in Sources */, 1AC35B7B18CECF0C00F37B72 /* GameOverScene.cpp in Sources */, - B6337DF71ABA9B44005AEF24 /* PerformanceParticle3DTest.cpp in Sources */, 1AC35BF318CECF0C00F37B72 /* ExtensionsTest.cpp in Sources */, 1AC35B3518CECF0C00F37B72 /* TestEntries.cpp in Sources */, 1AC35B2D18CECF0C00F37B72 /* Box2dTest.cpp in Sources */, @@ -5567,7 +5910,6 @@ 29080D8D191B595E0066F8DF /* CocosGUIScene.cpp in Sources */, 5EBEECB01995247000429821 /* DrawNode3D.cpp in Sources */, 1AC35BED18CECF0C00F37B72 /* CCControlStepperTest.cpp in Sources */, - 1AC35C3318CECF0C00F37B72 /* PerformanceScenarioTest.cpp in Sources */, 1AC35C5918CECF0C00F37B72 /* TextureAtlasEncryptionTest.cpp in Sources */, 29080DA9191B595E0066F8DF /* UICheckBoxTest_Editor.cpp in Sources */, 1AC35B5518CECF0C00F37B72 /* ConfigurationTest.cpp in Sources */, @@ -5575,7 +5917,6 @@ 1AC35C5B18CECF0C00F37B72 /* TileMapTest.cpp in Sources */, 1AC35B4718CECF0C00F37B72 /* Bug-899.cpp in Sources */, 1AC35C1B18CECF0C00F37B72 /* NewEventDispatcherTest.cpp in Sources */, - 1AC35C2D18CECF0C00F37B72 /* PerformanceNodeChildrenTest.cpp in Sources */, 29080DC5191B595E0066F8DF /* UIScene_Editor.cpp in Sources */, 1AC35BDD18CECF0C00F37B72 /* acts.cpp in Sources */, 1AC35B7518CECF0C00F37B72 /* ArmatureScene.cpp in Sources */, @@ -5606,7 +5947,6 @@ 1AC35C3F18CECF0C00F37B72 /* ReleasePoolTest.cpp in Sources */, 1AC35C5718CECF0C00F37B72 /* TextureCacheTest.cpp in Sources */, 1AC35B6D18CECF0C00F37B72 /* HelloCocosBuilderLayer.cpp in Sources */, - 1AC35C2B18CECF0C00F37B72 /* PerformanceLabelTest.cpp in Sources */, 1AC35C0118CECF0C00F37B72 /* TableViewTestScene.cpp in Sources */, 1AC35C4B18CECF0C00F37B72 /* ShaderTest2.cpp in Sources */, 38FA2E73194AEBE100FF2BE4 /* ActionTimelineTestScene.cpp in Sources */, @@ -5615,23 +5955,17 @@ 29080DC9191B595E0066F8DF /* UISceneManager_Editor.cpp in Sources */, 1AC35B3F18CECF0C00F37B72 /* Bug-458.cpp in Sources */, 3E2F27B919CFF4AF00E7C490 /* NewAudioEngineTest.cpp in Sources */, - 1A97AC001A1DC3E30076D9CC /* PerformanceMathTest.cpp in Sources */, - 1AC35C3918CECF0C00F37B72 /* PerformanceTextureTest.cpp in Sources */, 1AC35B5318CECF0C00F37B72 /* CocosDenshionTest.cpp in Sources */, 29080DD3191B595E0066F8DF /* UITextAtlasTest.cpp in Sources */, 1AC35B7F18CECF0C00F37B72 /* ProjectileController.cpp in Sources */, 29080DB5191B595E0066F8DF /* UIListViewTest.cpp in Sources */, - 1AC35C2518CECF0C00F37B72 /* PerformanceAllocTest.cpp in Sources */, 29080DAB191B595E0066F8DF /* UIFocusTest.cpp in Sources */, 29080DD9191B595E0066F8DF /* UITextBMFontTest_Editor.cpp in Sources */, 1AC35B5918CECF0C00F37B72 /* controller.cpp in Sources */, - 1AC35C2918CECF0C00F37B72 /* PerformanceEventDispatcherTest.cpp in Sources */, 1AC35CA618CECF1E00F37B72 /* main.cpp in Sources */, 1AC35BE918CECF0C00F37B72 /* CCControlSceneManager.cpp in Sources */, 1AC35B7318CECF0C00F37B72 /* TimelineCallbackTestLayer.cpp in Sources */, 1AC35BFB18CECF0C00F37B72 /* NotificationCenterTest.cpp in Sources */, - 1AC35C3518CECF0C00F37B72 /* PerformanceSpriteTest.cpp in Sources */, - 1AC35C3B18CECF0C00F37B72 /* PerformanceTouchesTest.cpp in Sources */, 29080D8F191B595E0066F8DF /* CocoStudioGUITest.cpp in Sources */, 1AC35B3D18CECF0C00F37B72 /* Bug-422.cpp in Sources */, 1AC35BF518CECF0C00F37B72 /* HttpClientTest.cpp in Sources */, @@ -5687,7 +6021,6 @@ 1AC35B3818CECF0C00F37B72 /* Bug-1159.cpp in Sources */, 29080DBA191B595E0066F8DF /* UILoadingBarTest.cpp in Sources */, 29080D9C191B595E0066F8DF /* CustomParticleWidget.cpp in Sources */, - 1AC35C3218CECF0C00F37B72 /* PerformanceRendererTest.cpp in Sources */, 1AC35C4618CECF0C00F37B72 /* SceneTest.cpp in Sources */, 29080D9A191B595E0066F8DF /* CustomImageViewReader.cpp in Sources */, 29080DD6191B595E0066F8DF /* UITextAtlasTest_Editor.cpp in Sources */, @@ -5702,13 +6035,11 @@ 1AC35C6818CECF0C00F37B72 /* UserDefaultTest.cpp in Sources */, 29080D1D191B574B0066F8DF /* UITest.cpp in Sources */, 3E9E75D1199324CB005B7047 /* Camera3DTest.cpp in Sources */, - 1AF152DA18FD252A00A52F3D /* PerformanceCallbackTest.cpp in Sources */, 29080DA0191B595E0066F8DF /* CustomReader.cpp in Sources */, 1AC35C2218CECF0C00F37B72 /* ParallaxTest.cpp in Sources */, 1AC35C6C18CECF0C00F37B72 /* ZwoptexTest.cpp in Sources */, 1AC35C7118CECF0C00F37B72 /* VibrateTest.cpp in Sources */, 1AC35B7818CECF0C00F37B72 /* ComponentsTestScene.cpp in Sources */, - 1AC35C3018CECF0C00F37B72 /* PerformanceParticleTest.cpp in Sources */, 1AC35B4A18CECF0C00F37B72 /* Bug-914.cpp in Sources */, 1AC35B6418CECF0C00F37B72 /* EffectsAdvancedTest.cpp in Sources */, 1AC35C6018CECF0C00F37B72 /* Paddle.cpp in Sources */, @@ -5728,7 +6059,6 @@ 1AC35C1818CECF0C00F37B72 /* MotionStreakTest.cpp in Sources */, D0FD03651A3B546400825BB5 /* AllocatorTest.cpp in Sources */, 1AC35C0618CECF0C00F37B72 /* FontTest.cpp in Sources */, - 1AC35C3818CECF0C00F37B72 /* PerformanceTest.cpp in Sources */, 1F33635018E37E840074764D /* RefPtrTest.cpp in Sources */, 292CF01519A1965E00E8E6A0 /* UIEditBoxTest.cpp in Sources */, 1AC35B2818CECF0C00F37B72 /* ActionsTest.cpp in Sources */, @@ -5745,7 +6075,6 @@ 1AC35B5C18CECF0C00F37B72 /* CurlTest.cpp in Sources */, 1AC35C0018CECF0C00F37B72 /* CustomTableViewCell.cpp in Sources */, 29080D92191B595E0066F8DF /* CustomGUIScene.cpp in Sources */, - 1AC35C2818CECF0C00F37B72 /* PerformanceContainerTest.cpp in Sources */, 1AC35BF018CECF0C00F37B72 /* CCControlSwitchTest.cpp in Sources */, 1AC35B2C18CECF0C00F37B72 /* BaseTest.cpp in Sources */, 1AC35B7E18CECF0C00F37B72 /* PlayerController.cpp in Sources */, @@ -5776,7 +6105,6 @@ 1AC35C0A18CECF0C00F37B72 /* IntervalTest.cpp in Sources */, 29080DD0191B595E0066F8DF /* UISliderTest.cpp in Sources */, 1AC35BEE18CECF0C00F37B72 /* CCControlStepperTest.cpp in Sources */, - 1AC35C3418CECF0C00F37B72 /* PerformanceScenarioTest.cpp in Sources */, 29080DA4191B595E0066F8DF /* UIButtonTest.cpp in Sources */, 1AC35C5A18CECF0C00F37B72 /* TextureAtlasEncryptionTest.cpp in Sources */, 1AC35B5618CECF0C00F37B72 /* ConfigurationTest.cpp in Sources */, @@ -5787,7 +6115,6 @@ 3EA0FB72191C844400B170C8 /* UIVideoPlayerTest.cpp in Sources */, 1AC35B4818CECF0C00F37B72 /* Bug-899.cpp in Sources */, 1AC35C1C18CECF0C00F37B72 /* NewEventDispatcherTest.cpp in Sources */, - 1AC35C2E18CECF0C00F37B72 /* PerformanceNodeChildrenTest.cpp in Sources */, 29080DCE191B595E0066F8DF /* UIScrollViewTest_Editor.cpp in Sources */, 1AC35BDE18CECF0C00F37B72 /* acts.cpp in Sources */, 1AC35B7618CECF0C00F37B72 /* ArmatureScene.cpp in Sources */, @@ -5807,7 +6134,6 @@ 1AC35C3E18CECF0C00F37B72 /* PhysicsTest.cpp in Sources */, 3825CC4A1A2C982A00C92EA8 /* CustomRootNode.cpp in Sources */, 29080DC6191B595E0066F8DF /* UIScene_Editor.cpp in Sources */, - B6337DF81ABA9B44005AEF24 /* PerformanceParticle3DTest.cpp in Sources */, 29080DB2191B595E0066F8DF /* UILayoutTest.cpp in Sources */, 1AC35B6A18CECF0C00F37B72 /* ButtonTestLayer.cpp in Sources */, 29080DB6191B595E0066F8DF /* UIListViewTest.cpp in Sources */, @@ -5821,11 +6147,9 @@ 1AC35C6A18CECF0C00F37B72 /* VisibleRect.cpp in Sources */, 1AC35C4018CECF0C00F37B72 /* ReleasePoolTest.cpp in Sources */, 50921EB01B746D5F00C085CC /* DownloaderTest.cpp in Sources */, - 1A97AC011A1DC3E30076D9CC /* PerformanceMathTest.cpp in Sources */, 1AC35C5818CECF0C00F37B72 /* TextureCacheTest.cpp in Sources */, 1AC35B6E18CECF0C00F37B72 /* HelloCocosBuilderLayer.cpp in Sources */, 29080D96191B595E0066F8DF /* CustomParticleWidgetTest.cpp in Sources */, - 1AC35C2C18CECF0C00F37B72 /* PerformanceLabelTest.cpp in Sources */, 29080DE0191B595E0066F8DF /* UITextTest.cpp in Sources */, 29080DC0191B595E0066F8DF /* UIPageViewTest_Editor.cpp in Sources */, 1AC35C0218CECF0C00F37B72 /* TableViewTestScene.cpp in Sources */, @@ -5833,15 +6157,12 @@ 1AC35C6618CECF0C00F37B72 /* UnitTest.cpp in Sources */, 290E94B6196FC16900694919 /* CocostudioParserTest.cpp in Sources */, 1AC35B4018CECF0C00F37B72 /* Bug-458.cpp in Sources */, - 1AC35C3A18CECF0C00F37B72 /* PerformanceTextureTest.cpp in Sources */, 29080DC4191B595E0066F8DF /* UIScene.cpp in Sources */, 1AC35B5418CECF0C00F37B72 /* CocosDenshionTest.cpp in Sources */, 1AC35B8018CECF0C00F37B72 /* ProjectileController.cpp in Sources */, - 1AC35C2618CECF0C00F37B72 /* PerformanceAllocTest.cpp in Sources */, 3825CC4E1A2C982A00C92EA8 /* CustomWidgetCallbackBindTest.cpp in Sources */, 3E92EA831921A1400094CD21 /* Sprite3DTest.cpp in Sources */, 1AC35B5A18CECF0C00F37B72 /* controller.cpp in Sources */, - 1AC35C2A18CECF0C00F37B72 /* PerformanceEventDispatcherTest.cpp in Sources */, 1AC35BEA18CECF0C00F37B72 /* CCControlSceneManager.cpp in Sources */, 182C5CBB1A95B30500C30D34 /* CocosStudio3DTest.cpp in Sources */, 1AC35B7418CECF0C00F37B72 /* TimelineCallbackTestLayer.cpp in Sources */, @@ -5849,10 +6170,8 @@ 29080D9E191B595E0066F8DF /* CustomParticleWidgetReader.cpp in Sources */, 1AC35BFC18CECF0C00F37B72 /* NotificationCenterTest.cpp in Sources */, 29FBBBFF196A9ECD00E65826 /* CocostudioParserJsonTest.cpp in Sources */, - 1AC35C3618CECF0C00F37B72 /* PerformanceSpriteTest.cpp in Sources */, B6DD2FFD1B04979C00E47F5F /* NavMeshTest.cpp in Sources */, B6C039DA19C95D83007207DC /* LightTest.cpp in Sources */, - 1AC35C3C18CECF0C00F37B72 /* PerformanceTouchesTest.cpp in Sources */, 29080DA2191B595E0066F8DF /* GUIEditorTest.cpp in Sources */, 29080D94191B595E0066F8DF /* CustomImageTest.cpp in Sources */, 1AC35B3E18CECF0C00F37B72 /* Bug-422.cpp in Sources */, @@ -5865,6 +6184,58 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + FA94AFD31B8EF69A0074B261 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + FADE78921B9C363D0061590D /* PerformanceTextureTest.cpp in Sources */, + FADE78B41B9EC0290061590D /* PerformanceCallbackTest.cpp in Sources */, + FA94B2451B90497E0074B261 /* controller.cpp in Sources */, + FADE788E1B96D0710061590D /* PerformanceSpriteTest.cpp in Sources */, + FA94B2431B90497E0074B261 /* BaseTest.cpp in Sources */, + FADE78B81B9EC6160061590D /* PerformanceMathTest.cpp in Sources */, + FA94B23B1B9045160074B261 /* PerformanceAllocTest.cpp in Sources */, + FADE78741B9572990061590D /* PerformanceParticleTest.cpp in Sources */, + FADE789A1B9D5C640061590D /* PerformanceEventDispatcherTest.cpp in Sources */, + FA94B1ED1B8EF8250074B261 /* AppController.mm in Sources */, + FADE78A71B9E86100061590D /* PerformanceScenarioTest.cpp in Sources */, + FA94B24C1B9059540074B261 /* VisibleRect.cpp in Sources */, + FADE78701B9451540061590D /* PerformanceNodeChildrenTest.cpp in Sources */, + FADE78871B96C4780061590D /* PerformanceParticle3DTest.cpp in Sources */, + FADE78FE1B9ECB7F0061590D /* PerformanceContainerTest.cpp in Sources */, + FA94B2361B8F02880074B261 /* Profile.cpp in Sources */, + FADE78961B9C42E80061590D /* PerformanceLabelTest.cpp in Sources */, + FA94B2021B8EF8250074B261 /* RootViewController.mm in Sources */, + FA94B2011B8EF8250074B261 /* main.m in Sources */, + FA94B1CF1B8EF7BB0074B261 /* AppDelegate.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + FA94B0EC1B8EF76D0074B261 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + FA94B2421B90497E0074B261 /* BaseTest.cpp in Sources */, + FADE78861B96C4780061590D /* PerformanceParticle3DTest.cpp in Sources */, + FADE78911B9C363D0061590D /* PerformanceTextureTest.cpp in Sources */, + FADE786F1B9451540061590D /* PerformanceNodeChildrenTest.cpp in Sources */, + FA94B2351B8F02880074B261 /* Profile.cpp in Sources */, + FADE788D1B96D0710061590D /* PerformanceSpriteTest.cpp in Sources */, + FA94B1CE1B8EF7BB0074B261 /* AppDelegate.cpp in Sources */, + FA94B24B1B9059540074B261 /* VisibleRect.cpp in Sources */, + FADE78FD1B9ECB7F0061590D /* PerformanceContainerTest.cpp in Sources */, + FA94B20A1B8EF8430074B261 /* main.cpp in Sources */, + FADE78A61B9E86100061590D /* PerformanceScenarioTest.cpp in Sources */, + FA94B23A1B9045160074B261 /* PerformanceAllocTest.cpp in Sources */, + FADE78B31B9EC0290061590D /* PerformanceCallbackTest.cpp in Sources */, + FADE78991B9D5C640061590D /* PerformanceEventDispatcherTest.cpp in Sources */, + FADE78731B9572990061590D /* PerformanceParticleTest.cpp in Sources */, + FA94B2441B90497E0074B261 /* controller.cpp in Sources */, + FADE78B71B9EC6160061590D /* PerformanceMathTest.cpp in Sources */, + FADE78951B9C42E80061590D /* PerformanceLabelTest.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ @@ -6013,6 +6384,16 @@ target = A07A517F1783A1D20073F6A7 /* cpp-tests iOS */; targetProxy = A07A526C1783AB980073F6A7 /* PBXContainerItemProxy */; }; + FA94AF971B8EF69A0074B261 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "cocos2dx iOS"; + targetProxy = FA94AF981B8EF69A0074B261 /* PBXContainerItemProxy */; + }; + FA94B0C11B8EF76D0074B261 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "cocos2dx Mac"; + targetProxy = FA94B0C21B8EF76D0074B261 /* PBXContainerItemProxy */; + }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ @@ -6808,6 +7189,102 @@ }; name = Release; }; + FA94B0B21B8EF69A0074B261 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + ENABLE_BITCODE = NO; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "../tests/cpp-tests/proj.ios/Prefix.pch"; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + CC_TARGET_OS_IPHONE, + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + INFOPLIST_FILE = "$(SRCROOT)/../tests/performance-tests/proj.ios/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(SRCROOT)/../external/curl/prebuilt/ios", + ); + PRODUCT_BUNDLE_IDENTIFIER = "org.cocos2d-x.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = "performance-tests iOS"; + PROVISIONING_PROFILE = ""; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../cocos/platform/ios $(SRCROOT)/../cocos/platform/ios/Simulation $(SRCROOT)/../external/curl/include/ios"; + VALID_ARCHS = "arm64 armv7"; + }; + name = Debug; + }; + FA94B0B31B8EF69A0074B261 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + ENABLE_BITCODE = NO; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "../tests/cpp-tests/proj.ios/Prefix.pch"; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + CC_TARGET_OS_IPHONE, + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + INFOPLIST_FILE = "$(SRCROOT)/../tests/performance-tests/proj.ios/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(SRCROOT)/../external/curl/prebuilt/ios", + ); + PRODUCT_BUNDLE_IDENTIFIER = "org.cocos2d-x.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = "performance-tests iOS"; + PROVISIONING_PROFILE = ""; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../cocos/platform/ios $(SRCROOT)/../cocos/platform/ios/Simulation $(SRCROOT)/../external/curl/include/ios"; + VALIDATE_PRODUCT = YES; + VALID_ARCHS = "arm64 armv7"; + }; + name = Release; + }; + FA94B1C51B8EF76D0074B261 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "../tests/cpp-tests/proj.mac/Prefix.pch"; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + CC_TARGET_OS_MAC, + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + INFOPLIST_FILE = "$(SRCROOT)/../tests/performance-tests/proj.mac/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocos2d-x.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = "performance-tests Mac"; + USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../cocos/platform/mac $(SRCROOT)/../external/glfw3/include/mac"; + }; + name = Debug; + }; + FA94B1C61B8EF76D0074B261 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "../tests/cpp-tests/proj.mac/Prefix.pch"; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + CC_TARGET_OS_MAC, + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + INFOPLIST_FILE = "$(SRCROOT)/../tests/performance-tests/proj.mac/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocos2d-x.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = "performance-tests Mac"; + USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../cocos/platform/mac $(SRCROOT)/../external/glfw3/include/mac"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -6946,6 +7423,24 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Debug; }; + FA94B0B11B8EF69A0074B261 /* Build configuration list for PBXNativeTarget "performance-tests iOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FA94B0B21B8EF69A0074B261 /* Debug */, + FA94B0B31B8EF69A0074B261 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + FA94B1C41B8EF76D0074B261 /* Build configuration list for PBXNativeTarget "performance-tests Mac" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FA94B1C51B8EF76D0074B261 /* Debug */, + FA94B1C61B8EF76D0074B261 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; /* End XCConfigurationList section */ }; rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; diff --git a/build/cocos2d_tests.xcodeproj/xcshareddata/xcschemes/performance-tests Mac.xcscheme b/build/cocos2d_tests.xcodeproj/xcshareddata/xcschemes/performance-tests Mac.xcscheme new file mode 100644 index 0000000000..eb3c439626 --- /dev/null +++ b/build/cocos2d_tests.xcodeproj/xcshareddata/xcschemes/performance-tests Mac.xcscheme @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/cocos2d_tests.xcodeproj/xcshareddata/xcschemes/performance-tests iOS.xcscheme b/build/cocos2d_tests.xcodeproj/xcshareddata/xcschemes/performance-tests iOS.xcscheme new file mode 100644 index 0000000000..44c85bacdc --- /dev/null +++ b/build/cocos2d_tests.xcodeproj/xcshareddata/xcschemes/performance-tests iOS.xcscheme @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cocos/2d/CCAction.cpp b/cocos/2d/CCAction.cpp index 589f3884eb..9c6d6a51a3 100644 --- a/cocos/2d/CCAction.cpp +++ b/cocos/2d/CCAction.cpp @@ -42,6 +42,10 @@ Action::Action() ,_tag(Action::INVALID_TAG) ,_flags(0) { +#if CC_ENABLE_SCRIPT_BINDING + ScriptEngineProtocol* engine = ScriptEngineManager::getInstance()->getScriptEngine(); + _scriptType = engine != nullptr ? engine->getScriptType() : kScriptTypeNone; +#endif } Action::~Action() diff --git a/cocos/2d/CCAction.h b/cocos/2d/CCAction.h index 68c9e9e19a..89733af0b8 100644 --- a/cocos/2d/CCAction.h +++ b/cocos/2d/CCAction.h @@ -30,10 +30,16 @@ THE SOFTWARE. #include "base/CCRef.h" #include "math/CCGeometry.h" +#include "base/CCScriptSupport.h" NS_CC_BEGIN class Node; + +enum { + kActionUpdate +}; + /** * @addtogroup actions * @{ @@ -172,6 +178,9 @@ protected: /** The action flag field. To categorize action into certain groups.*/ unsigned int _flags; +#if CC_ENABLE_SCRIPT_BINDING + ccScriptType _scriptType; ///< type of script binding, lua or javascript +#endif private: CC_DISALLOW_COPY_AND_ASSIGN(Action); }; @@ -221,7 +230,6 @@ CC_CONSTRUCTOR_ACCESS: protected: //! Duration in seconds. float _duration; - private: CC_DISALLOW_COPY_AND_ASSIGN(FiniteTimeAction); }; diff --git a/cocos/2d/CCActionCamera.cpp b/cocos/2d/CCActionCamera.cpp index 5bc37224e7..926644477f 100644 --- a/cocos/2d/CCActionCamera.cpp +++ b/cocos/2d/CCActionCamera.cpp @@ -116,7 +116,7 @@ void ActionCamera::updateTransform() } // FIXME: Using the AdditionalTransform is a complete hack. - // This should be done by multipliying the lookup-Matrix with the Node's MV matrix + // This should be done by multiplying the lookup-Matrix with the Node's MV matrix // And then setting the result as the new MV matrix // But that operation needs to be done after all the 'updates'. // So the Director should emit an 'director_after_update' event. diff --git a/cocos/2d/CCActionInstant.cpp b/cocos/2d/CCActionInstant.cpp index 7bcc16dc22..b81b7055ab 100644 --- a/cocos/2d/CCActionInstant.cpp +++ b/cocos/2d/CCActionInstant.cpp @@ -47,7 +47,15 @@ bool ActionInstant::isDone() const void ActionInstant::step(float dt) { CC_UNUSED_PARAM(dt); - update(1); + float updateDt = 1; +#if CC_ENABLE_SCRIPT_BINDING + if (_scriptType == kScriptTypeJavascript) + { + if (ScriptEngineManager::sendActionEventToJS(this, kActionUpdate, (void *)&updateDt)) + return; + } +#endif + update(updateDt); } void ActionInstant::update(float time) { diff --git a/cocos/2d/CCActionInterval.cpp b/cocos/2d/CCActionInterval.cpp index 9c9eec5bc8..7aeef85468 100644 --- a/cocos/2d/CCActionInterval.cpp +++ b/cocos/2d/CCActionInterval.cpp @@ -37,6 +37,7 @@ THE SOFTWARE. #include "base/CCEventCustom.h" #include "base/CCEventDispatcher.h" #include "platform/CCStdC.h" +#include "base/CCScriptSupport.h" NS_CC_BEGIN @@ -105,6 +106,18 @@ bool ActionInterval::initWithDuration(float d) return true; } +bool ActionInterval::sendUpdateEventToScript(float dt, Action *actionObject) +{ +#if CC_ENABLE_SCRIPT_BINDING + if (_scriptType == kScriptTypeJavascript) + { + if (ScriptEngineManager::sendActionEventToJS(actionObject, kActionUpdate, (void *)&dt)) + return true; + } +#endif + return false; +} + bool ActionInterval::isDone() const { return _elapsed >= _duration; @@ -122,12 +135,16 @@ void ActionInterval::step(float dt) _elapsed += dt; } - this->update(MAX (0, // needed for rewind. elapsed could be negative - MIN(1, _elapsed / - MAX(_duration, FLT_EPSILON) // division by 0 - ) - ) - ); + + float updateDt = MAX (0, // needed for rewind. elapsed could be negative + MIN(1, _elapsed / + MAX(_duration, FLT_EPSILON) // division by 0 + ) + ); + + if (sendUpdateEventToScript(updateDt, this)) return; + + this->update(updateDt); } void ActionInterval::setAmplitudeRate(float amp) @@ -323,13 +340,15 @@ void Sequence::update(float t) if( _last == -1 ) { // action[0] was skipped, execute it. _actions[0]->startWithTarget(_target); - _actions[0]->update(1.0f); + if (!(sendUpdateEventToScript(1.0f, _actions[0]))) + _actions[0]->update(1.0f); _actions[0]->stop(); } else if( _last == 0 ) { // switching to action 1. stop action 0. - _actions[0]->update(1.0f); + if (!(sendUpdateEventToScript(1.0f, _actions[0]))) + _actions[0]->update(1.0f); _actions[0]->stop(); } } @@ -339,7 +358,8 @@ void Sequence::update(float t) // FIXME: Bug. this case doesn't contemplate when _last==-1, found=0 and in "reverse mode" // since it will require a hack to know if an action is on reverse mode or not. // "step" should be overriden, and the "reverseMode" value propagated to inner Sequences. - _actions[1]->update(0); + if (!(sendUpdateEventToScript(0, _actions[1]))) + _actions[1]->update(0); _actions[1]->stop(); } // Last action found and it is done. @@ -353,8 +373,8 @@ void Sequence::update(float t) { _actions[found]->startWithTarget(_target); } - - _actions[found]->update(new_t); + if (!(sendUpdateEventToScript(new_t, _actions[found]))) + _actions[found]->update(new_t); _last = found; } @@ -436,8 +456,8 @@ void Repeat::update(float dt) { while (dt > _nextDt && _total < _times) { - - _innerAction->update(1.0f); + if (!(sendUpdateEventToScript(1.0f, _innerAction))) + _innerAction->update(1.0f); _total++; _innerAction->stop(); @@ -456,19 +476,22 @@ void Repeat::update(float dt) { if (_total == _times) { - _innerAction->update(1); + if (!(sendUpdateEventToScript(1, _innerAction))) + _innerAction->update(1); _innerAction->stop(); } else { // issue #390 prevent jerk, use right update - _innerAction->update(dt - (_nextDt - _innerAction->getDuration()/_duration)); + if (!(sendUpdateEventToScript(dt - (_nextDt - _innerAction->getDuration()/_duration), _innerAction))) + _innerAction->update(dt - (_nextDt - _innerAction->getDuration()/_duration)); } } } else { - _innerAction->update(fmodf(dt * _times,1.0f)); + if (!(sendUpdateEventToScript(fmodf(dt * _times,1.0f), _innerAction))) + _innerAction->update(fmodf(dt * _times,1.0f)); } } @@ -710,11 +733,13 @@ void Spawn::update(float time) { if (_one) { - _one->update(time); + if (!(sendUpdateEventToScript(time, _one))) + _one->update(time); } if (_two) { - _two->update(time); + if (!(sendUpdateEventToScript(time, _two))) + _two->update(time); } } @@ -2241,7 +2266,8 @@ void ReverseTime::update(float time) { if (_other) { - _other->update(1 - time); + if (!(sendUpdateEventToScript(1 - time, _other))) + _other->update(1 - time); } } @@ -2502,7 +2528,8 @@ void TargetedAction::stop() void TargetedAction::update(float time) { - _action->update(time); + if (!(sendUpdateEventToScript(time, _action))) + _action->update(time); } bool TargetedAction::isDone(void) const diff --git a/cocos/2d/CCActionInterval.h b/cocos/2d/CCActionInterval.h index b424c6be36..816ef56bd8 100644 --- a/cocos/2d/CCActionInterval.h +++ b/cocos/2d/CCActionInterval.h @@ -112,6 +112,9 @@ CC_CONSTRUCTOR_ACCESS: protected: float _elapsed; bool _firstTick; + +protected: + bool sendUpdateEventToScript(float dt, Action *actionObject); }; /** @class Sequence diff --git a/cocos/2d/CCAutoPolygon.h b/cocos/2d/CCAutoPolygon.h index d00a2deabf..fa1c98b10d 100644 --- a/cocos/2d/CCAutoPolygon.h +++ b/cocos/2d/CCAutoPolygon.h @@ -144,12 +144,13 @@ public: /** * trace all the points along the outline of the image, * @warning must create AutoPolygon with filename to use this function - * @param rect a texture rect for specify an area of the image, use Rect::Zero for the size of the image, default to Rect::Zero + * @param rect a texture rect for specify an area of the image * @param threshold the value when alpha is greater than this value will be counted as opaque, default to 0.0 * @return a vector of vec2 of all the points found in clockwise order * @code * auto ap = AutoPolygon("grossini.png"); - * std::vector points = ap.trace();//default to size of the image and threshold 0.0 + * auto rect = Rect(100, 100, 200, 200); + * std::vector points = ap.trace(rect);//default threshold is 0.0 * @endcode */ std::vector trace(const cocos2d::Rect& rect, const float& threshold = 0.0); diff --git a/cocos/2d/CCCameraBackgroundBrush.cpp b/cocos/2d/CCCameraBackgroundBrush.cpp index e8d6d668f4..d5886888db 100644 --- a/cocos/2d/CCCameraBackgroundBrush.cpp +++ b/cocos/2d/CCCameraBackgroundBrush.cpp @@ -308,6 +308,9 @@ void CameraBackgroundSkyBoxBrush::drawBackground(Camera* camera) glEnable(GL_DEPTH_TEST); RenderState::StateBlock::_defaultState->setDepthTest(true); + glDepthMask(GL_TRUE); + RenderState::StateBlock::_defaultState->setDepthWrite(true); + glDepthFunc(GL_ALWAYS); RenderState::StateBlock::_defaultState->setDepthFunction(RenderState::DEPTH_ALWAYS); diff --git a/cocos/2d/CCComponentContainer.cpp b/cocos/2d/CCComponentContainer.cpp index 963e73369d..c5801c8985 100644 --- a/cocos/2d/CCComponentContainer.cpp +++ b/cocos/2d/CCComponentContainer.cpp @@ -29,46 +29,46 @@ THE SOFTWARE. NS_CC_BEGIN -ComponentContainer::ComponentContainer(Node *node) -: _components(nullptr) -, _owner(node) +ComponentContainer::ComponentContainer(Node* node) +: _owner(node) { } -ComponentContainer::~ComponentContainer(void) -{ - CC_SAFE_DELETE(_components); +ComponentContainer::~ComponentContainer() +{ } Component* ComponentContainer::get(const std::string& name) const { Component* ret = nullptr; - do { - CC_BREAK_IF(nullptr == _components); - ret = _components->at(name); - - } while (0); + + auto it = _componentMap.find(name); + if (it != _componentMap.end()) + { + ret = it->second; + } + return ret; } bool ComponentContainer::add(Component *com) { bool ret = false; - CCASSERT(com != nullptr, "Argument must be non-nil"); + CCASSERT(com != nullptr, "Component must be non-nil"); CCASSERT(com->getOwner() == nullptr, "Component already added. It can't be added again"); do { - if (_components == nullptr) + auto typeName = typeid(*com).name(); + if (_components.find(typeName) != _components.end()) { - _components = new (std::nothrow) Map(); + CCASSERT(true,"ComponentContainer already have this kind of component"); + break; } - Component *component = _components->at(com->getName()); - - CCASSERT(component == nullptr, "Component already added. It can't be added again"); - CC_BREAK_IF(component); com->setOwner(_owner); - _components->insert(com->getName(), com); + _components.insert(typeName, com); + _componentMap[com->getName()] = com; com->onAdd(); + ret = true; } while(0); return ret; @@ -79,18 +79,13 @@ bool ComponentContainer::remove(const std::string& name) bool ret = false; do { - CC_BREAK_IF(!_components); - - auto iter = _components->find(name); - CC_BREAK_IF(iter == _components->end()); - - auto com = iter->second; - com->onRemove(); - com->setOwner(nullptr); - - _components->erase(iter); + auto iter = _componentMap.find(name); + CC_BREAK_IF(iter == _componentMap.end()); + remove(iter->second); + ret = true; } while(0); + return ret; } @@ -99,51 +94,45 @@ bool ComponentContainer::remove(Component *com) bool ret = false; do { - CC_BREAK_IF(!_components); - - for (auto iter = _components->begin(); iter != _components->end(); ++iter) + auto iter = _components.find(typeid(*com).name()); + if (iter != _components.end()) { - if (iter->second == com) - { - com->onRemove(); - com->setOwner(nullptr); - _components->erase(iter); - break; - } + _componentMap.erase(com->getName()); + + com->onRemove(); + com->setOwner(nullptr); + _components.erase(iter); } + ret = true; } while(0); + return ret; } void ComponentContainer::removeAll() { - if (_components != nullptr) + if (!_componentMap.empty()) { - for (auto iter = _components->begin(); iter != _components->end(); ++iter) + for (auto iter = _components.begin(); iter != _components.end(); ++iter) { iter->second->onRemove(); iter->second->setOwner(nullptr); } - _components->clear(); - CC_SAFE_DELETE(_components); - + _components.clear(); + _componentMap.clear(); _owner->unscheduleUpdate(); } } -void ComponentContainer::alloc(void) -{ - _components = new (std::nothrow) Map(); -} - void ComponentContainer::visit(float delta) { - if (_components != nullptr) + if (!_components.empty()) { CC_SAFE_RETAIN(_owner); - for (auto iter = _components->begin(); iter != _components->end(); ++iter) + auto iterEnd = _components.end(); + for (auto iter = _components.begin(); iter != iterEnd; ++iter) { iter->second->update(delta); } @@ -151,21 +140,17 @@ void ComponentContainer::visit(float delta) } } -bool ComponentContainer::isEmpty() const -{ - return (_components == nullptr || _components->empty()); -} - void ComponentContainer::onEnter() { - for (auto iter = _components->begin(); iter != _components->end(); ++iter) + for (auto iter = _components.begin(); iter != _components.end(); ++iter) { iter->second->onEnter(); } } + void ComponentContainer::onExit() { - for (auto iter = _components->begin(); iter != _components->end(); ++iter) + for (auto iter = _components.begin(); iter != _components.end(); ++iter) { iter->second->onExit(); } diff --git a/cocos/2d/CCComponentContainer.h b/cocos/2d/CCComponentContainer.h index 357e082eb3..565ccd9210 100644 --- a/cocos/2d/CCComponentContainer.h +++ b/cocos/2d/CCComponentContainer.h @@ -41,14 +41,28 @@ protected: /** * @js ctor */ - ComponentContainer(Node *pNode); + ComponentContainer(Node* node); public: /** * @js NA * @lua NA */ - virtual ~ComponentContainer(void); + virtual ~ComponentContainer(); + + template + T* getComponent() const + { + auto typeName = typeid(T).name(); + auto iter = _components.find(typeName); + if (iter != _components.end()) + { + return static_cast(iter->second); + } + + return nullptr; + } + /** * @js getComponent */ @@ -62,14 +76,11 @@ public: virtual void onEnter(); virtual void onExit(); -public: - bool isEmpty() const; + bool isEmpty() const { return _componentMap.empty(); } private: - void alloc(void); - -private: - Map* _components; + Map _components; + std::unordered_map _componentMap; Node *_owner; friend class Node; diff --git a/cocos/2d/CCGrid.h b/cocos/2d/CCGrid.h index de3fcf5540..f0a2eb345d 100644 --- a/cocos/2d/CCGrid.h +++ b/cocos/2d/CCGrid.h @@ -63,7 +63,7 @@ public: @param gridSize the size of the grid. @param texture The texture used for grab. @param flipped whether or not the grab texture should be flip by Y or not. - @param rect The effct grid rect. + @param rect The effective grid rect. */ bool initWithSize(const Size& gridSize); bool initWithSize(const Size& gridSize, const Rect& rect); @@ -155,7 +155,7 @@ class CC_DLL Grid3D : public GridBase public: /** create one Grid. */ static Grid3D* create(const Size& gridSize); - /** craete one Grid. */ + /** create one Grid. */ static Grid3D* create(const Size& gridSize, const Rect& rect); /** create one Grid. */ static Grid3D* create(const Size& gridSize, Texture2D *texture, bool flipped); @@ -197,7 +197,7 @@ public: */ void setVertex(const Vec2& pos, const Vec3& vertex); /**@{ - Implementations for interfaces in base calss. + Implementations for interfaces in base class. */ virtual void beforeBlit() override; virtual void afterBlit() override; @@ -275,7 +275,7 @@ public: void setTile(const Vec2& pos, const Quad3& coords); /**@{ - Implementations for interfaces in base calss. + Implementations for interfaces in base class. */ virtual void blit() override; virtual void reuse() override; diff --git a/cocos/2d/CCLayer.cpp b/cocos/2d/CCLayer.cpp index 8eaf23c10c..ca839dbb9c 100644 --- a/cocos/2d/CCLayer.cpp +++ b/cocos/2d/CCLayer.cpp @@ -44,10 +44,6 @@ THE SOFTWARE. #include "deprecated/CCString.h" -#if CC_USE_PHYSICS -#include "physics/CCPhysicsBody.h" -#endif - NS_CC_BEGIN // Layer diff --git a/cocos/2d/CCLayer.h b/cocos/2d/CCLayer.h index d437853543..9dd0034980 100644 --- a/cocos/2d/CCLayer.h +++ b/cocos/2d/CCLayer.h @@ -84,7 +84,7 @@ public: */ /** Callback function for touch began. * - * @param touch Touch infomation. + * @param touch Touch information. * @param unused_event Event information. * @return if return false, onTouchMoved, onTouchEnded, onTouchCancelled will never called. * @js NA @@ -92,21 +92,21 @@ public: virtual bool onTouchBegan(Touch *touch, Event *unused_event); /** Callback function for touch moved. * - * @param touch Touch infomation. + * @param touch Touch information. * @param unused_event Event information. * @js NA */ virtual void onTouchMoved(Touch *touch, Event *unused_event); /** Callback function for touch ended. * - * @param touch Touch infomation. + * @param touch Touch information. * @param unused_event Event information. * @js NA */ virtual void onTouchEnded(Touch *touch, Event *unused_event); /** Callback function for touch cancelled. * - * @param touch Touch infomation. + * @param touch Touch information. * @param unused_event Event information. * @js NA */ @@ -149,7 +149,7 @@ public: /* Callback function should not be deprecated, it will generate lots of warnings. Since 'setAccelerometerEnabled' was deprecated, it will make warnings if developer overrides onAcceleration and invokes setAccelerometerEnabled(true) instead of using EventDispatcher::addEventListenerWithXXX. */ - /** Callback funtion for acceleration. + /** Callback function for acceleration. * @param acc Acceleration information. * @param unused_event Event information. * @js NA @@ -297,19 +297,19 @@ public: // virtual GLubyte getOpacity() const override { return Layer::getOpacity(); } virtual GLubyte getDisplayedOpacity() const override { return Layer::getDisplayedOpacity(); } - virtual void setOpacity(GLubyte opacity) override { return Layer::setOpacity(opacity); } - virtual void updateDisplayedOpacity(GLubyte parentOpacity) override { return Layer::updateDisplayedOpacity(parentOpacity); } + virtual void setOpacity(GLubyte opacity) override { Layer::setOpacity(opacity); } + virtual void updateDisplayedOpacity(GLubyte parentOpacity) override { Layer::updateDisplayedOpacity(parentOpacity); } virtual bool isCascadeOpacityEnabled() const override { return Layer::isCascadeOpacityEnabled(); } - virtual void setCascadeOpacityEnabled(bool cascadeOpacityEnabled) override { return Layer::setCascadeOpacityEnabled(cascadeOpacityEnabled); } + virtual void setCascadeOpacityEnabled(bool cascadeOpacityEnabled) override { Layer::setCascadeOpacityEnabled(cascadeOpacityEnabled); } virtual const Color3B& getColor() const override { return Layer::getColor(); } virtual const Color3B& getDisplayedColor() const override { return Layer::getDisplayedColor(); } - virtual void setColor(const Color3B& color) override { return Layer::setColor(color); } - virtual void updateDisplayedColor(const Color3B& parentColor) override { return Layer::updateDisplayedColor(parentColor); } + virtual void setColor(const Color3B& color) override { Layer::setColor(color); } + virtual void updateDisplayedColor(const Color3B& parentColor) override { Layer::updateDisplayedColor(parentColor); } virtual bool isCascadeColorEnabled() const override { return Layer::isCascadeOpacityEnabled(); } - virtual void setCascadeColorEnabled(bool cascadeColorEnabled) override { return Layer::setCascadeColorEnabled(cascadeColorEnabled); } + virtual void setCascadeColorEnabled(bool cascadeColorEnabled) override { Layer::setCascadeColorEnabled(cascadeColorEnabled); } - virtual void setOpacityModifyRGB(bool bValue) override { return Layer::setOpacityModifyRGB(bValue); } + virtual void setOpacityModifyRGB(bool bValue) override { Layer::setOpacityModifyRGB(bValue); } virtual bool isOpacityModifyRGB() const override { return Layer::isOpacityModifyRGB(); } CC_CONSTRUCTOR_ACCESS: diff --git a/cocos/2d/CCMenuItem.cpp b/cocos/2d/CCMenuItem.cpp index 669b271200..b4695d01d3 100644 --- a/cocos/2d/CCMenuItem.cpp +++ b/cocos/2d/CCMenuItem.cpp @@ -39,12 +39,8 @@ static int _globalFontSize = kItemSize; static std::string _globalFontName = "Marker Felt"; static bool _globalFontNameRelease = false; -const unsigned int kCurrentItem = 0xc0c05001; const unsigned int kZoomActionTag = 0xc0c05002; -const unsigned int kNormalTag = 0x1; -const unsigned int kSelectedTag = 0x2; -const unsigned int kDisableTag = 0x3; // // MenuItem // @@ -462,7 +458,7 @@ void MenuItemSprite::setNormalImage(Node* image) { if (image) { - addChild(image, 0, kNormalTag); + addChild(image); image->setAnchorPoint(Vec2(0, 0)); } @@ -483,7 +479,7 @@ void MenuItemSprite::setSelectedImage(Node* image) { if (image) { - addChild(image, 0, kSelectedTag); + addChild(image); image->setAnchorPoint(Vec2(0, 0)); } @@ -503,7 +499,7 @@ void MenuItemSprite::setDisabledImage(Node* image) { if (image) { - addChild(image, 0, kDisableTag); + addChild(image); image->setAnchorPoint(Vec2(0, 0)); } @@ -912,17 +908,16 @@ void MenuItemToggle::setSelectedIndex(unsigned int index) if( index != _selectedIndex && _subItems.size() > 0 ) { _selectedIndex = index; - MenuItem *currentItem = (MenuItem*)getChildByTag(kCurrentItem); - if( currentItem ) + if (_selectedItem) { - currentItem->removeFromParentAndCleanup(false); + _selectedItem->removeFromParentAndCleanup(false); } - MenuItem* item = _subItems.at(_selectedIndex); - this->addChild(item, 0, kCurrentItem); - Size s = item->getContentSize(); + _selectedItem = _subItems.at(_selectedIndex); + this->addChild(_selectedItem); + Size s = _selectedItem->getContentSize(); this->setContentSize(s); - item->setPosition(s.width/2, s.height/2); + _selectedItem->setPosition(s.width / 2, s.height / 2); } } diff --git a/cocos/2d/CCMenuItem.h b/cocos/2d/CCMenuItem.h index 2092f3e6da..021c5c75cc 100644 --- a/cocos/2d/CCMenuItem.h +++ b/cocos/2d/CCMenuItem.h @@ -556,6 +556,7 @@ CC_CONSTRUCTOR_ACCESS: */ MenuItemToggle() : _selectedIndex(0) + , _selectedItem(nullptr) {} /** * @js NA @@ -578,6 +579,8 @@ CC_CONSTRUCTOR_ACCESS: protected: /** Returns the selected item. */ unsigned int _selectedIndex; + MenuItem* _selectedItem; + /** Array that contains the subitems. You can add/remove items in runtime, and you can replace the array with a new one. @since v0.7.2 */ diff --git a/cocos/2d/CCNode.cpp b/cocos/2d/CCNode.cpp index 6a9dc68a0f..161713d5c5 100644 --- a/cocos/2d/CCNode.cpp +++ b/cocos/2d/CCNode.cpp @@ -41,19 +41,12 @@ THE SOFTWARE. #include "2d/CCActionManager.h" #include "2d/CCScene.h" #include "2d/CCComponent.h" -#include "2d/CCComponentContainer.h" #include "renderer/CCGLProgram.h" #include "renderer/CCGLProgramState.h" #include "renderer/CCMaterial.h" #include "math/TransformUtils.h" - #include "deprecated/CCString.h" -#if CC_USE_PHYSICS -#include "physics/CCPhysicsBody.h" -#include "physics/CCPhysicsWorld.h" -#endif - #if CC_NODE_RENDER_SUBPIXEL #define RENDER_IN_SUBPIXEL @@ -118,17 +111,6 @@ Node::Node(void) , _updateScriptHandler(0) #endif , _componentContainer(nullptr) -#if CC_USE_PHYSICS -, _physicsBody(nullptr) -, _physicsScaleStartX(1.0f) -, _physicsScaleStartY(1.0f) -, _physicsRotation(0.0f) -, _physicsTransformDirty(true) -, _updateTransformFromPhysics(true) -, _physicsWorld(nullptr) -, _physicsBodyAssociatedWith(0) -, _physicsRotationOffset(0.0f) -#endif , _displayedOpacity(255) , _realOpacity(255) , _displayedColor(Color3B::WHITE) @@ -194,11 +176,6 @@ Node::~Node() CC_SAFE_DELETE(_componentContainer); -#if CC_USE_PHYSICS - setPhysicsBody(nullptr); - -#endif - stopAllActions(); unscheduleAllCallbacks(); CC_SAFE_RELEASE_NULL(_actionManager); @@ -259,13 +236,6 @@ void Node::setSkewX(float skewX) if (_skewX == skewX) return; -#if CC_USE_PHYSICS - if (_physicsBody != nullptr) - { - CCLOG("Node WARNING: PhysicsBody doesn't support setSkewX"); - } -#endif - _skewX = skewX; _transformUpdated = _transformDirty = _inverseDirty = true; } @@ -280,13 +250,6 @@ void Node::setSkewY(float skewY) if (_skewY == skewY) return; -#if CC_USE_PHYSICS - if (_physicsBody != nullptr) - { - CCLOG("Node WARNING: PhysicsBody doesn't support setSkewY"); - } -#endif - _skewY = skewY; _transformUpdated = _transformDirty = _inverseDirty = true; } @@ -336,12 +299,6 @@ void Node::setRotation(float rotation) _rotationZ_X = _rotationZ_Y = rotation; _transformUpdated = _transformDirty = _inverseDirty = true; -#if CC_USE_PHYSICS - if (_physicsWorld && _physicsBodyAssociatedWith > 0) - { - _physicsWorld->_updateBodyTransform = true; - } -#endif updateRotationQuat(); } @@ -367,13 +324,6 @@ void Node::setRotation3D(const Vec3& rotation) _rotationZ_Y = _rotationZ_X = rotation.z; updateRotationQuat(); - -#if CC_USE_PHYSICS - if (_physicsBody != nullptr) - { - CCLOG("Node WARNING: PhysicsBody doesn't support setRotation3D"); - } -#endif } Vec3 Node::getRotation3D() const @@ -429,13 +379,6 @@ void Node::setRotationSkewX(float rotationX) if (_rotationZ_X == rotationX) return; -#if CC_USE_PHYSICS - if (_physicsBody != nullptr) - { - CCLOG("Node WARNING: PhysicsBody doesn't support setRotationSkewX"); - } -#endif - _rotationZ_X = rotationX; _transformUpdated = _transformDirty = _inverseDirty = true; @@ -452,13 +395,6 @@ void Node::setRotationSkewY(float rotationY) if (_rotationZ_Y == rotationY) return; -#if CC_USE_PHYSICS - if (_physicsBody != nullptr) - { - CCLOG("Node WARNING: PhysicsBody doesn't support setRotationSkewY"); - } -#endif - _rotationZ_Y = rotationY; _transformUpdated = _transformDirty = _inverseDirty = true; @@ -480,12 +416,6 @@ void Node::setScale(float scale) _scaleX = _scaleY = _scaleZ = scale; _transformUpdated = _transformDirty = _inverseDirty = true; -#if CC_USE_PHYSICS - if (_physicsWorld && _physicsBodyAssociatedWith > 0) - { - _physicsWorld->_updateBodyTransform = true; - } -#endif } /// scaleX getter @@ -503,12 +433,6 @@ void Node::setScale(float scaleX,float scaleY) _scaleX = scaleX; _scaleY = scaleY; _transformUpdated = _transformDirty = _inverseDirty = true; -#if CC_USE_PHYSICS - if (_physicsWorld && _physicsBodyAssociatedWith > 0) - { - _physicsWorld->_updateBodyTransform = true; - } -#endif } /// scaleX setter @@ -519,12 +443,6 @@ void Node::setScaleX(float scaleX) _scaleX = scaleX; _transformUpdated = _transformDirty = _inverseDirty = true; -#if CC_USE_PHYSICS - if (_physicsWorld && _physicsBodyAssociatedWith > 0) - { - _physicsWorld->_updateBodyTransform = true; - } -#endif } /// scaleY getter @@ -539,13 +457,6 @@ void Node::setScaleZ(float scaleZ) if (_scaleZ == scaleZ) return; -#if CC_USE_PHYSICS - if (_physicsBody != nullptr) - { - CCLOG("Node WARNING: PhysicsBody doesn't support setScaleZ"); - } -#endif - _scaleZ = scaleZ; _transformUpdated = _transformDirty = _inverseDirty = true; } @@ -564,12 +475,6 @@ void Node::setScaleY(float scaleY) _scaleY = scaleY; _transformUpdated = _transformDirty = _inverseDirty = true; -#if CC_USE_PHYSICS - if (_physicsWorld && _physicsBodyAssociatedWith > 0) - { - _physicsWorld->_updateBodyTransform = true; - } -#endif } @@ -601,12 +506,6 @@ void Node::setPosition(float x, float y) _transformUpdated = _transformDirty = _inverseDirty = true; _usingNormalizedPosition = false; -#if CC_USE_PHYSICS - if (_physicsWorld && _physicsBodyAssociatedWith > 0) - { - _physicsWorld->_updateBodyTransform = true; - } -#endif } void Node::setPosition3D(const Vec3& position) @@ -671,12 +570,6 @@ void Node::setNormalizedPosition(const Vec2& position) _usingNormalizedPosition = true; _normalizedPositionDirty = true; _transformUpdated = _transformDirty = _inverseDirty = true; -#if CC_USE_PHYSICS - if (_physicsWorld && _physicsBodyAssociatedWith > 0) - { - _physicsWorld->_updateBodyTransform = true; - } -#endif } ssize_t Node::getChildrenCount() const @@ -893,7 +786,7 @@ Node* Node::getChildByTag(int tag) const Node* Node::getChildByName(const std::string& name) const { - CCASSERT(name.length() != 0, "Invalid name"); + CCASSERT(!name.empty(), "Invalid name"); std::hash h; size_t hash = h(name); @@ -909,7 +802,7 @@ Node* Node::getChildByName(const std::string& name) const void Node::enumerateChildren(const std::string &name, std::function callback) const { - CCASSERT(name.length() != 0, "Invalid name"); + CCASSERT(!name.empty(), "Invalid name"); CCASSERT(callback != nullptr, "Invalid callback function"); size_t length = name.length(); @@ -1059,24 +952,6 @@ void Node::addChildHelper(Node* child, int localZOrder, int tag, const std::stri child->setParent(this); child->setOrderOfArrival(s_globalOrderOfArrival++); -#if CC_USE_PHYSICS - _physicsBodyAssociatedWith += child->_physicsBodyAssociatedWith; - auto parentNode = this; - while (parentNode->_parent) - { - parentNode = parentNode->_parent; - parentNode->_physicsBodyAssociatedWith += child->_physicsBodyAssociatedWith; - } - - auto scene = dynamic_cast(parentNode); - - // Recursive add children with which have physics body. - if (scene && scene->getPhysicsWorld()) - { - scene->addChildToPhysicsWorld(child); - } -#endif - if( _running ) { child->onEnter(); @@ -1158,7 +1033,7 @@ void Node::removeChildByTag(int tag, bool cleanup/* = true */) void Node::removeChildByName(const std::string &name, bool cleanup) { - CCASSERT(name.length() != 0, "Invalid name"); + CCASSERT(!name.empty(), "Invalid name"); Node *child = this->getChildByName(name); @@ -1177,21 +1052,6 @@ void Node::removeAllChildren() this->removeAllChildrenWithCleanup(true); } -#if CC_USE_PHYSICS -void Node::removeFromPhysicsWorld() -{ - if (_physicsBody != nullptr) - { - _physicsBody->removeFromWorld(); - } - - for (auto child : _children) - { - child->removeFromPhysicsWorld(); - } -} -#endif - void Node::removeAllChildrenWithCleanup(bool cleanup) { // not using detachChild improves speed here @@ -1206,10 +1066,6 @@ void Node::removeAllChildrenWithCleanup(bool cleanup) child->onExit(); } -#if CC_USE_PHYSICS - child->removeFromPhysicsWorld(); -#endif - if (cleanup) { child->cleanup(); @@ -1231,10 +1087,6 @@ void Node::detachChild(Node *child, ssize_t childIndex, bool doCleanup) child->onExitTransitionDidStart(); child->onExit(); } - -#if CC_USE_PHYSICS - child->removeFromPhysicsWorld(); -#endif // If you don't do cleanup, the child's actions will not get removed and the // its scheduledSelectors_ dict will not get released! @@ -1297,12 +1149,6 @@ void Node::visit() uint32_t Node::processParentFlags(const Mat4& parentTransform, uint32_t parentFlags) { -#if CC_USE_PHYSICS - if (_physicsBody && _updateTransformFromPhysics) - { - updateTransformFromPhysics(parentTransform, parentFlags); - } -#endif if(_usingNormalizedPosition) { CCASSERT(_parent, "setNormalizedPosition() doesn't work with orphan nodes"); @@ -1330,15 +1176,8 @@ uint32_t Node::processParentFlags(const Mat4& parentTransform, uint32_t parentFl if(flags & FLAGS_DIRTY_MASK) _modelViewTransform = this->transform(parentTransform); -#if CC_USE_PHYSICS - if (_updateTransformFromPhysics) { - _transformUpdated = false; - _contentSizeDirty = false; - } -#else _transformUpdated = false; _contentSizeDirty = false; -#endif return flags; } @@ -1813,7 +1652,7 @@ const Mat4& Node::getNodeToParentTransform() const Vec2 anchorPoint(_anchorPointInPoints.x * _scaleX, _anchorPointInPoints.y * _scaleY); - // caculate real position + // calculate real position if (! needsSkewMatrix && !_anchorPointInPoints.isZero()) { x += -anchorPoint.x; @@ -2065,120 +1904,6 @@ void Node::removeAllComponents() _componentContainer->removeAll(); } -#if CC_USE_PHYSICS - -// MARK: Physics - -void Node::setPhysicsBody(PhysicsBody* body) -{ - if (_physicsBody == body) - { - return; - } - - if (_physicsBody) - { - _physicsBody->removeFromWorld(); - _physicsBody->_node = nullptr; - _physicsBody->release(); - _physicsBody = nullptr; - - _physicsBodyAssociatedWith--; - auto parentNode = this; - while (parentNode->_parent) - { - parentNode = parentNode->_parent; - parentNode->_physicsBodyAssociatedWith--; - } - } - - if (body) - { - if (body->getNode()) - { - body->getNode()->setPhysicsBody(nullptr); - } - - body->_node = this; - body->retain(); - - _physicsBody = body; - _physicsScaleStartX = _scaleX; - _physicsScaleStartY = _scaleY; - _physicsRotationOffset = _rotationZ_X; - - _physicsBodyAssociatedWith++; - auto parentNode = this; - while (parentNode->_parent) - { - parentNode = parentNode->_parent; - parentNode->_physicsBodyAssociatedWith++; - } - - auto scene = dynamic_cast(parentNode); - if (scene && scene->getPhysicsWorld()) - { - _physicsTransformDirty = true; - scene->getPhysicsWorld()->addBody(body); - } - } -} - -void Node::updatePhysicsBodyTransform(const Mat4& parentTransform, uint32_t parentFlags, float parentScaleX, float parentScaleY) -{ - _updateTransformFromPhysics = false; - auto flags = processParentFlags(parentTransform, parentFlags); - _updateTransformFromPhysics = true; - auto scaleX = parentScaleX * _scaleX; - auto scaleY = parentScaleY * _scaleY; - - if (_parent) - { - _physicsRotation = _parent->_physicsRotation + _rotationZ_X; - } - if (_physicsBody && ((flags & FLAGS_DIRTY_MASK) || _physicsTransformDirty)) - { - _physicsTransformDirty = false; - - Vec3 vec3(_contentSize.width * 0.5f, _contentSize.height * 0.5f, 0); - Vec3 ret; - _modelViewTransform.transformPoint(vec3, &ret); - _physicsBody->setPosition(Vec2(ret.x, ret.y)); - - parentTransform.getInversed().transformPoint(&ret); - _offsetX = ret.x - _position.x; - _offsetY = ret.y - _position.y; - - _physicsBody->setScale(scaleX / _physicsScaleStartX, scaleY / _physicsScaleStartY); - _physicsBody->setRotation(_physicsRotation - _physicsRotationOffset); - } - - for (auto node : _children) - { - node->updatePhysicsBodyTransform(_modelViewTransform, flags, scaleX, scaleY); - } -} - -void Node::updateTransformFromPhysics(const Mat4& parentTransform, uint32_t parentFlags) -{ - auto& newPosition = _physicsBody->getPosition(); - auto& recordedPosition = _physicsBody->_recordedPosition; - auto updateBodyTransform = _physicsWorld->_updateBodyTransform; - if (parentFlags || recordedPosition.x != newPosition.x || recordedPosition.y != newPosition.y) - { - recordedPosition = newPosition; - Vec3 vec3(newPosition.x, newPosition.y, 0); - Vec3 ret; - parentTransform.getInversed().transformPoint(vec3, &ret); - setPosition(ret.x - _offsetX, ret.y - _offsetY); - } - _physicsRotation = _physicsBody->getRotation(); - setRotation(_physicsRotation - _parent->_physicsRotation + _physicsRotationOffset); - _physicsWorld->_updateBodyTransform = updateBodyTransform; -} - -#endif //CC_USE_PHYSICS - // MARK: Opacity and Color GLubyte Node::getOpacity(void) const diff --git a/cocos/2d/CCNode.h b/cocos/2d/CCNode.h index 2240eed040..6ada12dd1d 100644 --- a/cocos/2d/CCNode.h +++ b/cocos/2d/CCNode.h @@ -35,6 +35,8 @@ #include "base/CCScriptSupport.h" #include "math/CCAffineTransform.h" #include "math/CCMath.h" +#include "2d/CCComponentContainer.h" +#include "2d/CCComponent.h" NS_CC_BEGIN @@ -53,10 +55,6 @@ class Director; class GLProgram; class GLProgramState; class Material; -#if CC_USE_PHYSICS -class PhysicsBody; -class PhysicsWorld; -#endif class Camera; /** @@ -1560,7 +1558,6 @@ public: virtual Mat4 getWorldToNodeTransform() const; virtual AffineTransform getWorldToNodeAffineTransform() const; - /** @deprecated Use getWorldToNodeTransform() instead */ CC_DEPRECATED_ATTRIBUTE inline virtual AffineTransform worldToNodeTransform() const { return getWorldToNodeAffineTransform(); } @@ -1644,6 +1641,22 @@ public: * @return The Component by name. */ Component* getComponent(const std::string& name); + + /** + * Get a component by the type T. + * @lua NA + * @js NA + * + * @return The component that match the type T. + */ + template + T* getComponent() const + { + if (_componentContainer) + return _componentContainer->getComponent(); + else + return nullptr; + } /** * Adds a component. @@ -1673,39 +1686,6 @@ public: */ virtual void removeAllComponents(); /// @} end of component functions - - -#if CC_USE_PHYSICS - /** - * Set the PhysicsBody that let the sprite effect with physics. - * @note This method will set anchor point to Vec2::ANCHOR_MIDDLE if body not null, and you cann't change anchor point if node has a physics body. - * - * @param body A given physics body. - */ - void setPhysicsBody(PhysicsBody* body); - - /** - * Get the PhysicsBody the sprite have. - * - * @return The PhysicsBody the sprite have. - */ - PhysicsBody* getPhysicsBody() const { return _physicsBody; } - - /** - * Remove this node from physics world. it will remove all the physics bodies in it's children too. - */ - void removeFromPhysicsWorld(); - - /** - * Update the transform matrix from physics. - */ - void updateTransformFromPhysics(const Mat4& parentTransform, uint32_t parentFlags); - - /** - * Update physics body transform matrix. - */ - virtual void updatePhysicsBodyTransform(const Mat4& parentTransform, uint32_t parentFlags, float parentScaleX, float parentScaleY); -#endif // overrides virtual GLubyte getOpacity() const; @@ -1863,22 +1843,6 @@ protected: #endif ComponentContainer *_componentContainer; ///< Dictionary of components - -#if CC_USE_PHYSICS - PhysicsBody* _physicsBody; ///< the physicsBody the node have - float _physicsScaleStartX; ///< the scale x value when setPhysicsBody - float _physicsScaleStartY; ///< the scale y value when setPhysicsBody - float _physicsRotation; - bool _physicsTransformDirty; - bool _updateTransformFromPhysics; - - PhysicsWorld* _physicsWorld; /** The PhysicsWorld associated with the node.*/ - int _physicsBodyAssociatedWith; /** The count of PhysicsBody associated with the node and children.*/ - float _physicsRotationOffset; /** Record the rotation value when invoke Node::setPhysicsBody.*/ - - float _offsetX; - float _offsetY; -#endif // opacity controls GLubyte _displayedOpacity; @@ -1900,10 +1864,6 @@ protected: private: CC_DISALLOW_COPY_AND_ASSIGN(Node); - -#if CC_USE_PHYSICS - friend class Scene; -#endif //CC_USTPS }; diff --git a/cocos/2d/CCParticleSystem.cpp b/cocos/2d/CCParticleSystem.cpp index 8d423f8eda..0979bd162f 100644 --- a/cocos/2d/CCParticleSystem.cpp +++ b/cocos/2d/CCParticleSystem.cpp @@ -211,7 +211,7 @@ bool ParticleSystem::initWithDictionary(ValueMap& dictionary, const std::string& _duration = dictionary["duration"].asFloat(); // blend function - if (_configName.length()>0) + if (!_configName.empty()) { _blendFunc.src = dictionary["blendFuncSource"].asFloat(); } @@ -289,7 +289,7 @@ bool ParticleSystem::initWithDictionary(ValueMap& dictionary, const std::string& // or Mode B: radius movement else if (_emitterMode == Mode::RADIUS) { - if (_configName.length()>0) + if (!_configName.empty()) { modeB.startRadius = dictionary["maxRadius"].asInt(); } @@ -298,7 +298,7 @@ bool ParticleSystem::initWithDictionary(ValueMap& dictionary, const std::string& modeB.startRadius = dictionary["maxRadius"].asFloat(); } modeB.startRadiusVar = dictionary["maxRadiusVariance"].asFloat(); - if (_configName.length()>0) + if (!_configName.empty()) { modeB.endRadius = dictionary["minRadius"].asInt(); } @@ -316,7 +316,7 @@ bool ParticleSystem::initWithDictionary(ValueMap& dictionary, const std::string& modeB.endRadiusVar = 0.0f; } - if (_configName.length()>0) + if (!_configName.empty()) { modeB.rotatePerSecond = dictionary["rotatePerSecond"].asInt(); } diff --git a/cocos/2d/CCProtectedNode.cpp b/cocos/2d/CCProtectedNode.cpp index 1b831bd9f5..c248846047 100644 --- a/cocos/2d/CCProtectedNode.cpp +++ b/cocos/2d/CCProtectedNode.cpp @@ -29,10 +29,6 @@ #include "CCProtectedNode.h" #include "base/CCDirector.h" - -#if CC_USE_PHYSICS -#include "physics/CCPhysicsBody.h" -#endif #include "2d/CCScene.h" NS_CC_BEGIN @@ -108,19 +104,6 @@ void ProtectedNode::addProtectedChild(Node *child, int zOrder, int tag) child->setParent(this); child->setOrderOfArrival(s_globalOrderOfArrival++); -#if CC_USE_PHYSICS - // Recursive add children with which have physics body. - for (Node* node = this; node != nullptr; node = node->getParent()) - { - Scene* scene = dynamic_cast(node); - if (scene != nullptr && scene->getPhysicsWorld() != nullptr) - { - scene->addChildToPhysicsWorld(child); - break; - } - } -#endif - if( _running ) { child->onEnter(); @@ -178,13 +161,6 @@ void ProtectedNode::removeProtectedChild(cocos2d::Node *child, bool cleanup) child->onExit(); } -#if CC_USE_PHYSICS - if (child->getPhysicsBody() != nullptr) - { - child->getPhysicsBody()->removeFromWorld(); - } - -#endif // If you don't do cleanup, the child's actions will not get removed and the // its scheduledSelectors_ dict will not get released! if (cleanup) @@ -218,13 +194,6 @@ void ProtectedNode::removeAllProtectedChildrenWithCleanup(bool cleanup) child->onExit(); } -#if CC_USE_PHYSICS - if (child->getPhysicsBody() != nullptr) - { - child->getPhysicsBody()->removeFromWorld(); - } -#endif - if (cleanup) { child->cleanup(); diff --git a/cocos/2d/CCScene.cpp b/cocos/2d/CCScene.cpp index 9dc81e8a2a..a2dee0aa9f 100644 --- a/cocos/2d/CCScene.cpp +++ b/cocos/2d/CCScene.cpp @@ -35,7 +35,7 @@ THE SOFTWARE. #include "deprecated/CCString.h" #if CC_USE_PHYSICS -#include "physics/CCPhysicsWorld.h" +#include "physics/CCPhysicsManager.h" #endif #if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION @@ -50,9 +50,6 @@ THE SOFTWARE. NS_CC_BEGIN Scene::Scene() -#if CC_USE_PHYSICS -: _physicsWorld(nullptr) -#endif { #if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION _physics3DWorld = nullptr; @@ -61,6 +58,9 @@ Scene::Scene() #if CC_USE_NAVMESH _navMesh = nullptr; _navMeshDebugCamera = nullptr; +#endif +#if CC_USE_PHYSICS + _physicsManager = nullptr; #endif _ignoreAnchorPointForPosition = true; setAnchorPoint(Vec2(0.5f, 0.5f)); @@ -79,9 +79,6 @@ Scene::Scene() Scene::~Scene() { -#if CC_USE_PHYSICS - CC_SAFE_DELETE(_physicsWorld); -#endif #if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION CC_SAFE_RELEASE(_physics3DWorld); CC_SAFE_RELEASE(_physics3dDebugCamera); @@ -91,6 +88,10 @@ Scene::~Scene() #endif Director::getInstance()->getEventDispatcher()->removeEventListener(_event); CC_SAFE_RELEASE(_event); + +#if CC_USE_PHYSICS + delete _physicsManager; +#endif } #if CC_USE_NAVMESH @@ -260,21 +261,6 @@ void Scene::setNavMeshDebugCamera(Camera *camera) #endif #if (CC_USE_PHYSICS || (CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION)) -void Scene::addChild(Node* child, int zOrder, int tag) -{ - Node::addChild(child, zOrder, tag); -#if CC_USE_PHYSICS - addChildToPhysicsWorld(child); -#endif -} - -void Scene::addChild(Node* child, int zOrder, const std::string &name) -{ - Node::addChild(child, zOrder, name); -#if CC_USE_PHYSICS - addChildToPhysicsWorld(child); -#endif -} Scene* Scene::createWithPhysics() { @@ -293,6 +279,9 @@ Scene* Scene::createWithPhysics() bool Scene::initWithPhysics() { + _physicsManager = new (std::nothrow) PhysicsManager(this); + _physicsWorld = _physicsManager->getPhysicsWorld(); + bool ret = false; do { @@ -300,9 +289,6 @@ bool Scene::initWithPhysics() CC_BREAK_IF( ! (director = Director::getInstance()) ); this->setContentSize(director->getWinSize()); -#if CC_USE_PHYSICS - CC_BREAK_IF(! (_physicsWorld = PhysicsWorld::construct(*this))); -#endif #if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION Physics3DWorldDes info; @@ -316,43 +302,16 @@ bool Scene::initWithPhysics() return ret; } -void Scene::addChildToPhysicsWorld(Node* child) -{ -#if CC_USE_PHYSICS - if (_physicsWorld) - { - std::function addToPhysicsWorldFunc = nullptr; - addToPhysicsWorldFunc = [this, &addToPhysicsWorldFunc](Node* node) -> void - { - node->_physicsWorld = _physicsWorld; - - if (node->getPhysicsBody()) - { - _physicsWorld->addBody(node->getPhysicsBody()); - } - - auto& children = node->getChildren(); - for( const auto &n : children) { - addToPhysicsWorldFunc(n); - } - }; - - addToPhysicsWorldFunc(child); - } -#endif -} - #endif #if (CC_USE_PHYSICS || (CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION) || CC_USE_NAVMESH) void Scene::stepPhysicsAndNavigation(float deltaTime) { #if CC_USE_PHYSICS - if (_physicsWorld && _physicsWorld->isAutoStep()) - { - _physicsWorld->update(deltaTime, false); - } + if (_physicsManager) + _physicsManager->update(deltaTime); #endif + #if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION if (_physics3DWorld) { diff --git a/cocos/2d/CCScene.h b/cocos/2d/CCScene.h index ae154083e4..6047977074 100644 --- a/cocos/2d/CCScene.h +++ b/cocos/2d/CCScene.h @@ -40,6 +40,7 @@ class EventListenerCustom; class EventCustom; #if CC_USE_PHYSICS class PhysicsWorld; +class PhysicsManager; #endif #if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION class Physics3DWorld; @@ -145,15 +146,21 @@ private: #if (CC_USE_PHYSICS || (CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION)) public: - virtual void addChild(Node* child, int zOrder, int tag) override; - virtual void addChild(Node* child, int zOrder, const std::string &name) override; #if CC_USE_PHYSICS /** Get the physics world of the scene. * @return The physics world of the scene. * @js NA */ - inline PhysicsWorld* getPhysicsWorld() { return _physicsWorld; } + inline PhysicsWorld* getPhysicsWorld() const { return _physicsWorld; } + + /** + * Get the `PhysicsManager` belongs to this `Scene`. + * + * @return PhysicsManager of the scene. + * @js NA + */ + PhysicsManager* getPhysicsManager() const { return _physicsManager; } #endif #if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION @@ -183,6 +190,7 @@ protected: #if CC_USE_PHYSICS PhysicsWorld* _physicsWorld; + PhysicsManager* _physicsManager; #endif #if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION @@ -203,8 +211,8 @@ public: void setNavMeshDebugCamera(Camera *camera); protected: - NavMesh* _navMesh; - Camera * _navMeshDebugCamera; + NavMesh* _navMesh; + Camera * _navMeshDebugCamera; #endif #if (CC_USE_PHYSICS || (CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION) || CC_USE_NAVMESH) diff --git a/cocos/2d/CCSprite.cpp b/cocos/2d/CCSprite.cpp index 08836f66c8..7974561baa 100644 --- a/cocos/2d/CCSprite.cpp +++ b/cocos/2d/CCSprite.cpp @@ -289,7 +289,8 @@ Sprite::Sprite(void) , _insideBounds(true) { #if CC_SPRITE_DEBUG_DRAW - debugDraw(true); + _debugDrawNode = DrawNode::create(); + addChild(_debugDrawNode); #endif //CC_SPRITE_DEBUG_DRAW } @@ -429,51 +430,6 @@ void Sprite::setTextureRect(const Rect& rect, bool rotated, const Size& untrimme _polyInfo.setQuad(&_quad); } -void Sprite::debugDraw(bool on) -{ - if (_batchNode) { - log("Sprite doesn't support debug draw when using SpriteBatchNode"); - return ; - } - DrawNode* draw = getChildByName("debugDraw"); - if(on) - { - if(!draw) - { - draw = DrawNode::create(); - draw->setName("debugDraw"); - addChild(draw); - } - draw->setVisible(true); - draw->clear(); - //draw lines - auto last = _polyInfo.triangles.indexCount/3; - auto _indices = _polyInfo.triangles.indices; - auto _verts = _polyInfo.triangles.verts; - for(ssize_t i = 0; i < last; i++) - { - //draw 3 lines - Vec3 from =_verts[_indices[i*3]].vertices; - Vec3 to = _verts[_indices[i*3+1]].vertices; - draw->drawLine(Vec2(from.x, from.y), Vec2(to.x,to.y), Color4F::GREEN); - - from =_verts[_indices[i*3+1]].vertices; - to = _verts[_indices[i*3+2]].vertices; - draw->drawLine(Vec2(from.x, from.y), Vec2(to.x,to.y), Color4F::GREEN); - - from =_verts[_indices[i*3+2]].vertices; - to = _verts[_indices[i*3]].vertices; - draw->drawLine(Vec2(from.x, from.y), Vec2(to.x,to.y), Color4F::GREEN); - } - } - else - { - if(draw) - draw->setVisible(false); - } -} - - // override this method to generate "double scale" sprites void Sprite::setVertexRect(const Rect& rect) { @@ -685,6 +641,28 @@ void Sprite::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) { _trianglesCommand.init(_globalZOrder, _texture->getName(), getGLProgramState(), _blendFunc, _polyInfo.triangles, transform, flags); renderer->addCommand(&_trianglesCommand); + +#if CC_SPRITE_DEBUG_DRAW + _debugDrawNode->clear(); + auto count = _polyInfo.triangles.indexCount/3; + auto indices = _polyInfo.triangles.indices; + auto verts = _polyInfo.triangles.verts; + for(ssize_t i = 0; i < count; i++) + { + //draw 3 lines + Vec3 from =verts[indices[i*3]].vertices; + Vec3 to = verts[indices[i*3+1]].vertices; + _debugDrawNode->drawLine(Vec2(from.x, from.y), Vec2(to.x,to.y), Color4F::WHITE); + + from =verts[indices[i*3+1]].vertices; + to = verts[indices[i*3+2]].vertices; + _debugDrawNode->drawLine(Vec2(from.x, from.y), Vec2(to.x,to.y), Color4F::WHITE); + + from =verts[indices[i*3+2]].vertices; + to = verts[indices[i*3]].vertices; + _debugDrawNode->drawLine(Vec2(from.x, from.y), Vec2(to.x,to.y), Color4F::WHITE); + } +#endif //CC_SPRITE_DEBUG_DRAW } } @@ -1129,7 +1107,7 @@ void Sprite::updateBlendFunc(void) { CCASSERT(! _batchNode, "CCSprite: updateBlendFunc doesn't work when the sprite is rendered using a SpriteBatchNode"); - // it is possible to have an untextured spritec + // it is possible to have an untextured sprite if (! _texture || ! _texture->hasPremultipliedAlpha()) { _blendFunc = BlendFunc::ALPHA_NON_PREMULTIPLIED; diff --git a/cocos/2d/CCSprite.h b/cocos/2d/CCSprite.h index 9c65c09ec0..8405437811 100644 --- a/cocos/2d/CCSprite.h +++ b/cocos/2d/CCSprite.h @@ -563,8 +563,6 @@ CC_CONSTRUCTOR_ACCESS: * @lua init */ virtual bool initWithFile(const std::string& filename, const Rect& rect); - - void debugDraw(bool on); /** * returns a copy of the polygon information associated with this sprite @@ -609,8 +607,9 @@ protected: Texture2D* _texture; /// Texture2D object that is used to render the sprite SpriteFrame* _spriteFrame; TrianglesCommand _trianglesCommand; /// - - +#if CC_SPRITE_DEBUG_DRAW + DrawNode *_debugDrawNode; +#endif //CC_SPRITE_DEBUG_DRAW // // Shared data // diff --git a/cocos/2d/CCSpriteBatchNode.cpp b/cocos/2d/CCSpriteBatchNode.cpp index fc927aa342..96a78e6d83 100644 --- a/cocos/2d/CCSpriteBatchNode.cpp +++ b/cocos/2d/CCSpriteBatchNode.cpp @@ -367,13 +367,6 @@ void SpriteBatchNode::draw(Renderer *renderer, const Mat4 &transform, uint32_t f for (const auto &child : _children) { -#if CC_USE_PHYSICS - auto physicsBody = child->getPhysicsBody(); - if (physicsBody) - { - child->updateTransformFromPhysics(transform, flags); - } -#endif child->updateTransform(); } diff --git a/cocos/2d/CCSpriteFrame.cpp b/cocos/2d/CCSpriteFrame.cpp index 62e5403c81..4e6849ab2c 100644 --- a/cocos/2d/CCSpriteFrame.cpp +++ b/cocos/2d/CCSpriteFrame.cpp @@ -188,7 +188,7 @@ Texture2D* SpriteFrame::getTexture() return _texture; } - if( _textureFilename.length() > 0 ) { + if( !_textureFilename.empty()) { return Director::getInstance()->getTextureCache()->addImage(_textureFilename.c_str()); } // no texture or texture filename diff --git a/cocos/2d/CCSpriteFrameCache.cpp b/cocos/2d/CCSpriteFrameCache.cpp index c9d918aa43..3588ad2b7c 100644 --- a/cocos/2d/CCSpriteFrameCache.cpp +++ b/cocos/2d/CCSpriteFrameCache.cpp @@ -131,7 +131,7 @@ void SpriteFrameCache::addSpriteFramesWithDictionary(ValueMap& dictionary, Textu // check ow/oh if(!ow || !oh) { - CCLOGWARN("cocos2d: WARNING: originalWidth/Height not found on the SpriteFrame. AnchorPoint won't work as expected. Regenrate the .plist"); + CCLOGWARN("cocos2d: WARNING: originalWidth/Height not found on the SpriteFrame. AnchorPoint won't work as expected. Regenerate the .plist"); } // abs ow/oh ow = abs(ow); diff --git a/cocos/2d/CCTextFieldTTF.cpp b/cocos/2d/CCTextFieldTTF.cpp index 31bd5ba1e4..8b9d5f86a8 100644 --- a/cocos/2d/CCTextFieldTTF.cpp +++ b/cocos/2d/CCTextFieldTTF.cpp @@ -259,7 +259,7 @@ const std::string& TextFieldTTF::getContentText() void TextFieldTTF::setTextColor(const Color4B &color) { _colorText = color; - if (_inputText.length() > 0) { + if (!_inputText.empty()) { Label::setTextColor(_colorText); } } @@ -284,7 +284,7 @@ void TextFieldTTF::setColorSpaceHolder(const Color3B& color) _colorSpaceHolder.g = color.g; _colorSpaceHolder.b = color.b; _colorSpaceHolder.a = 255; - if (0 == _inputText.length()) + if (_inputText.empty()) { Label::setTextColor(_colorSpaceHolder); } @@ -293,7 +293,7 @@ void TextFieldTTF::setColorSpaceHolder(const Color3B& color) void TextFieldTTF::setColorSpaceHolder(const Color4B& color) { _colorSpaceHolder = color; - if (0 == _inputText.length()) { + if (_inputText.empty()) { Label::setTextColor(_colorSpaceHolder); } } @@ -309,7 +309,7 @@ void TextFieldTTF::setString(const std::string &text) std::string displayText; size_t length; - if (text.length()>0) + if (!text.empty()) { _inputText = text; displayText = _inputText; @@ -330,7 +330,7 @@ void TextFieldTTF::setString(const std::string &text) } // if there is no input text, display placeholder instead - if (0 == _inputText.length()) + if (_inputText.empty()) { Label::setTextColor(_colorSpaceHolder); Label::setString(_placeHolder); @@ -352,7 +352,7 @@ const std::string& TextFieldTTF::getString() const void TextFieldTTF::setPlaceHolder(const std::string& text) { _placeHolder = text; - if (0 == _inputText.length()) + if (_inputText.empty()) { Label::setTextColor(_colorSpaceHolder); Label::setString(_placeHolder); diff --git a/cocos/2d/libcocos2d.vcxproj b/cocos/2d/libcocos2d.vcxproj index 6124f85637..d07599135b 100644 --- a/cocos/2d/libcocos2d.vcxproj +++ b/cocos/2d/libcocos2d.vcxproj @@ -575,8 +575,8 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.* + - @@ -588,9 +588,11 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.* + + @@ -1181,6 +1183,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.* + @@ -1197,10 +1200,12 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.* + + diff --git a/cocos/2d/libcocos2d.vcxproj.filters b/cocos/2d/libcocos2d.vcxproj.filters index 2a66d054f6..3a2021637e 100644 --- a/cocos/2d/libcocos2d.vcxproj.filters +++ b/cocos/2d/libcocos2d.vcxproj.filters @@ -285,6 +285,9 @@ + + physics + physics @@ -294,6 +297,9 @@ physics + + physics + physics @@ -1928,17 +1934,20 @@ network\Source Files - - network\Source Files - 2d renderer + + network + + + physics + physics @@ -1948,6 +1957,9 @@ physics + + physics + physics @@ -3777,6 +3789,9 @@ renderer + + network\Header Files + diff --git a/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems b/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems index 100ac7b0bd..9acbdb5b28 100644 --- a/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems +++ b/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems @@ -455,7 +455,7 @@ - + @@ -469,10 +469,12 @@ + + @@ -1061,7 +1063,7 @@ - + @@ -1073,9 +1075,11 @@ + + @@ -1283,4 +1287,4 @@ - \ No newline at end of file + diff --git a/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems.filters b/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems.filters index c66a6ec506..cb369136fc 100644 --- a/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems.filters +++ b/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems.filters @@ -213,6 +213,12 @@ physics + + physics + + + physics + cocostudio @@ -1858,7 +1864,7 @@ network\Header Files - + network\Header Files @@ -2060,6 +2066,12 @@ physics + + physics + + + physics + cocostudio\action @@ -3564,7 +3576,7 @@ network\Source Files - + network\Source Files @@ -3969,4 +3981,4 @@ - \ No newline at end of file + diff --git a/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Windows/libcocos2d_8_1.Windows.vcxproj b/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Windows/libcocos2d_8_1.Windows.vcxproj index a834e12594..50933fe0eb 100644 --- a/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Windows/libcocos2d_8_1.Windows.vcxproj +++ b/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Windows/libcocos2d_8_1.Windows.vcxproj @@ -119,40 +119,40 @@ false false - libcocos2d_v3.8_Windows_8.1 + libcocos2d_v3.9_Windows_8.1 false false - libcocos2d_v3.8_Windows_8.1 + libcocos2d_v3.9_Windows_8.1 false false - libcocos2d_v3.8_Windows_8.1 + libcocos2d_v3.9_Windows_8.1 false false false - libcocos2d_v3.8_Windows_8.1 + libcocos2d_v3.9_Windows_8.1 false false false - libcocos2d_v3.8_Windows_8.1 + libcocos2d_v3.9_Windows_8.1 false false - libcocos2d_v3.8_Windows_8.1 + libcocos2d_v3.9_Windows_8.1 diff --git a/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.WindowsPhone/libcocos2d_8_1.WindowsPhone.vcxproj b/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.WindowsPhone/libcocos2d_8_1.WindowsPhone.vcxproj index 36897d70d2..022d9a1540 100644 --- a/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.WindowsPhone/libcocos2d_8_1.WindowsPhone.vcxproj +++ b/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.WindowsPhone/libcocos2d_8_1.WindowsPhone.vcxproj @@ -91,23 +91,23 @@ false false - libcocos2d_v3.8_WindowsPhone_8.1 + libcocos2d_v3.9_WindowsPhone_8.1 false false - libcocos2d_v3.8_WindowsPhone_8.1 + libcocos2d_v3.9_WindowsPhone_8.1 false false - libcocos2d_v3.8_WindowsPhone_8.1 + libcocos2d_v3.9_WindowsPhone_8.1 false false false - libcocos2d_v3.8_WindowsPhone_8.1 + libcocos2d_v3.9_WindowsPhone_8.1 false diff --git a/cocos/2d/libcocos2d_win10/libcocos2d.vcxproj b/cocos/2d/libcocos2d_win10/libcocos2d.vcxproj index ff127810f2..ad54fe8425 100644 --- a/cocos/2d/libcocos2d_win10/libcocos2d.vcxproj +++ b/cocos/2d/libcocos2d_win10/libcocos2d.vcxproj @@ -565,9 +565,11 @@ + + @@ -1179,10 +1181,12 @@ + + @@ -1503,34 +1507,34 @@ false false - libcocos2d_v3.8_Windows_10.0 + libcocos2d_v3.9_Windows_10.0 false false - libcocos2d_v3.8_Windows_10.0 + libcocos2d_v3.9_Windows_10.0 false false false - libcocos2d_v3.8_Windows_10.0 + libcocos2d_v3.9_Windows_10.0 false false false - libcocos2d_v3.8_Windows_10.0 + libcocos2d_v3.9_Windows_10.0 false false - libcocos2d_v3.8_Windows_10.0 + libcocos2d_v3.9_Windows_10.0 false false - libcocos2d_v3.8_Windows_10.0 + libcocos2d_v3.9_Windows_10.0 diff --git a/cocos/2d/libcocos2d_win10/libcocos2d.vcxproj.filters b/cocos/2d/libcocos2d_win10/libcocos2d.vcxproj.filters index ecf6c1b2d4..d2e1c62e5a 100644 --- a/cocos/2d/libcocos2d_win10/libcocos2d.vcxproj.filters +++ b/cocos/2d/libcocos2d_win10/libcocos2d.vcxproj.filters @@ -1578,6 +1578,9 @@ network + + physics + physics @@ -1587,6 +1590,9 @@ physics + + physics + physics @@ -3389,6 +3395,9 @@ network + + physics + physics @@ -3401,6 +3410,9 @@ physics + + physics + physics diff --git a/cocos/3d/CCAABB.h b/cocos/3d/CCAABB.h index a06da15bb4..6faaeb4ecb 100644 --- a/cocos/3d/CCAABB.h +++ b/cocos/3d/CCAABB.h @@ -36,7 +36,7 @@ NS_CC_BEGIN */ /** - * Axis Aligned Bounding Box (AABB), usually caculate some rough but fast collision detection. + * Axis Aligned Bounding Box (AABB), usually calculate some rough but fast collision detection. */ class CC_DLL AABB { diff --git a/cocos/3d/CCAnimate3D.cpp b/cocos/3d/CCAnimate3D.cpp index 25656c6a43..325c9437a7 100644 --- a/cocos/3d/CCAnimate3D.cpp +++ b/cocos/3d/CCAnimate3D.cpp @@ -224,7 +224,7 @@ void Animate3D::startWithTarget(Node *target) if (!hasCurve) { - CCLOG("warning: no animation finde for the skeleton"); + CCLOG("warning: no animation found for the skeleton"); } } diff --git a/cocos/3d/CCAnimate3D.h b/cocos/3d/CCAnimate3D.h index 87cab15ea6..80be79f74c 100644 --- a/cocos/3d/CCAnimate3D.h +++ b/cocos/3d/CCAnimate3D.h @@ -41,7 +41,7 @@ class EventCustom; enum class Animate3DQuality { - QUALITY_NONE = 0, // it'll be ignore the curve-evaluating(the animation looks like stop), just acculate transition time. + QUALITY_NONE = 0, // it'll be ignore the curve-evaluating(the animation looks like stop), just accumulate transition time. QUALITY_LOW, // low animation quality, it'll be more efficient. QUALITY_HIGH, // high animation quality. }; @@ -161,7 +161,7 @@ protected: float _last; //last time 0 - 1, used to generate sub Animate3D bool _playReverse; // is playing reverse static float _transTime; //transition time from one animate3d to another - float _accTransTime; // acculate transition time + float _accTransTime; // accumulate transition time float _lastTime; // last t (0 - 1) float _originInterval;// save origin interval time float _frameRate; diff --git a/cocos/3d/CCAnimationCurve.h b/cocos/3d/CCAnimationCurve.h index c6af3a2fb6..78aa46bd5a 100644 --- a/cocos/3d/CCAnimationCurve.h +++ b/cocos/3d/CCAnimationCurve.h @@ -66,7 +66,7 @@ public: static AnimationCurve* create(float* keytime, float* value, int count); /** - * evalute value of time + * evaluate value of time * @param time Time to be estimated * @param dst Estimated value of that time * @param type EvaluateType diff --git a/cocos/3d/CCBillBoard.h b/cocos/3d/CCBillBoard.h index a10a37ed1a..45d3cdcf75 100644 --- a/cocos/3d/CCBillBoard.h +++ b/cocos/3d/CCBillBoard.h @@ -111,7 +111,7 @@ CC_CONSTRUCTOR_ACCESS: protected: /** - * calculate a model matrix which keep orignal translate & scaling but always face to the camera + * calculate a model matrix which keep original translate & scaling but always face to the camera */ bool calculateBillbaordTransform(); diff --git a/cocos/3d/CCBundle3D.cpp b/cocos/3d/CCBundle3D.cpp index d8fcada512..8be4e25243 100644 --- a/cocos/3d/CCBundle3D.cpp +++ b/cocos/3d/CCBundle3D.cpp @@ -1261,7 +1261,7 @@ bool Bundle3D::loadSkinDataJson(SkinData* skindata) skindata->inverseBindPoseMatrices.push_back(mat_bind_pos); } - // set root bone infomation + // set root bone information const rapidjson::Value& skin_data_1 = skin_data_array[1]; // parent and child relationship map @@ -1815,7 +1815,7 @@ NodeData* Bundle3D::parseNodesRecursivelyBinary(bool& skeleton, bool singleSprit bool skeleton_; if (_binaryReader.read(&skeleton_, 1, 1) != 1) { - CCLOG("warning: Failed to read is sleleton"); + CCLOG("warning: Failed to read is skeleton"); return nullptr; } if (skeleton_) diff --git a/cocos/3d/CCBundleReader.h b/cocos/3d/CCBundleReader.h index a4c80071a8..cade992888 100644 --- a/cocos/3d/CCBundleReader.h +++ b/cocos/3d/CCBundleReader.h @@ -48,12 +48,12 @@ class BundleReader: public cocos2d::Ref { public: /** - * Structor + * Constructor */ BundleReader(); /** - * inicial + * Destructor */ ~BundleReader(); @@ -163,7 +163,7 @@ inline bool BundleReader::readArray(unsigned int *length, std::vector *values } /** -* specalization for char +* specialization for char */ template<> inline bool BundleReader::read(char *ptr) @@ -180,7 +180,7 @@ inline bool BundleReader::read(char *ptr) } /** -* specalization for std::string +* specialization for std::string */ template<> inline bool BundleReader::read(std::string *ptr) diff --git a/cocos/3d/CCMesh.cpp b/cocos/3d/CCMesh.cpp index 8239f9085f..f3c5274239 100644 --- a/cocos/3d/CCMesh.cpp +++ b/cocos/3d/CCMesh.cpp @@ -350,15 +350,16 @@ void Mesh::draw(Renderer* renderer, float globalZOrder, const Mat4& transform, u flags); - if (isTransparent && !forceDepthWrite) - _material->getStateBlock()->setDepthWrite(false); - else +// if (isTransparent && !forceDepthWrite) +// _material->getStateBlock()->setDepthWrite(false); +// else _material->getStateBlock()->setDepthWrite(true); _meshCommand.setSkipBatching(isTransparent); _meshCommand.setTransparent(isTransparent); _meshCommand.set3D(!_force2DQueue); + _material->getStateBlock()->setBlend(_force2DQueue || isTransparent); // set default uniforms for Mesh // 'u_color' and others @@ -408,7 +409,7 @@ void Mesh::setGLProgramState(GLProgramState* glProgramState) auto material = Material::createWithGLStateProgram(glProgramState); setMaterial(material); - // Was the texture set before teh GLProgramState ? Set it + // Was the texture set before the GLProgramState ? Set it if (_texture) setTexture(_texture); diff --git a/cocos/3d/CCMesh.h b/cocos/3d/CCMesh.h index 5df31d3776..bb2714eb7c 100644 --- a/cocos/3d/CCMesh.h +++ b/cocos/3d/CCMesh.h @@ -59,7 +59,7 @@ class CC_DLL Mesh : public Ref friend class Sprite3D; public: typedef std::vector IndexArray; - /**create mesh from positions, normals, and so on, sigle SubMesh*/ + /**create mesh from positions, normals, and so on, single SubMesh*/ static Mesh* create(const std::vector& positions, const std::vector& normals, const std::vector& texs, const IndexArray& indices); /**create mesh with vertex attributes*/ CC_DEPRECATED_ATTRIBUTE static Mesh* create(const std::vector& vertices, int perVertexSizeInFloat, const IndexArray& indices, int numIndex, const std::vector& attribs, int attribCount){ return create(vertices, perVertexSizeInFloat, indices, attribs); } diff --git a/cocos/3d/CCMeshSkin.h b/cocos/3d/CCMeshSkin.h index 1339ca17dc..640f894890 100644 --- a/cocos/3d/CCMeshSkin.h +++ b/cocos/3d/CCMeshSkin.h @@ -97,7 +97,7 @@ protected: std::vector _invBindPoses; //inverse bind pose of bone Bone3D* _rootBone; - Skeleton3D* _skeleton; //skeleton the skin refered + Skeleton3D* _skeleton; //skeleton the skin referred // Pointer to the array of palette matrices. // This array is passed to the vertex shader as a uniform. diff --git a/cocos/3d/CCOBB.h b/cocos/3d/CCOBB.h index 5c83ab6460..7ea82fd2a3 100644 --- a/cocos/3d/CCOBB.h +++ b/cocos/3d/CCOBB.h @@ -35,8 +35,8 @@ NS_CC_BEGIN */ /** - * Oritened Bounding Box(OBB) - * @brief the OBB is similar to the AABB but the bounding box has the same direction as Sprite3D. so it's collistion detection more precise than AABB + * Oriented Bounding Box(OBB) + * @brief the OBB is similar to the AABB but the bounding box has the same direction as Sprite3D. so it's collision detection more precise than AABB * @js NA */ class CC_DLL OBB @@ -119,7 +119,7 @@ protected: void getInterval(const OBB& box, const Vec3& axis, float &min, float &max) const; /* - * Get the edege of x y z axis direction + * Get the edge of x y z axis direction */ Vec3 getEdgeDirection(int index) const; @@ -131,7 +131,7 @@ protected: public: Vec3 _center; // obb center Vec3 _xAxis; // x axis of obb, unit vector - Vec3 _yAxis; // y axis of obb, unit vecotr + Vec3 _yAxis; // y axis of obb, unit vector Vec3 _zAxis; // z axis of obb, unit vector Vec3 _extentX; // _xAxis * _extents.x Vec3 _extentY; // _yAxis * _extents.y diff --git a/cocos/3d/CCSkeleton3D.h b/cocos/3d/CCSkeleton3D.h index c7aab26e44..93bdcb6983 100644 --- a/cocos/3d/CCSkeleton3D.h +++ b/cocos/3d/CCSkeleton3D.h @@ -38,7 +38,7 @@ NS_CC_BEGIN */ /** - * @brief Defines a basic hierachial structure of transformation spaces. + * @brief Defines a basic hierarchical structure of transformation spaces. * @lua NA */ class CC_DLL Bone3D : public Ref @@ -57,7 +57,7 @@ public: /**update own world matrix and children's*/ void updateWorldMat(); - /**get wrod matrix*/ + /**get world matrix*/ const Mat4& getWorldMat(); /**get bone name*/ diff --git a/cocos/3d/CCSkybox.h b/cocos/3d/CCSkybox.h index c26a65f778..d3b02d1bc1 100644 --- a/cocos/3d/CCSkybox.h +++ b/cocos/3d/CCSkybox.h @@ -40,7 +40,7 @@ NS_CC_BEGIN class TextureCube; /** -* Sky box technology usually used to simulate infinity sky, mountains and other phenomena. +* Sky box technology is usually used to simulate infinity sky, mountains and other phenomena. */ class CC_DLL Skybox : public Node { @@ -49,7 +49,7 @@ public: /** create skybox from 6 textures. @param positive_x texture for the right side of the texture cube face. - @param negative_x texture for the up side of the texture cube face. + @param negative_x texture for the left side of the texture cube face. @param positive_y texture for the top side of the texture cube face @param negative_y texture for the bottom side of the texture cube face @param positive_z texture for the forward side of the texture cube face. diff --git a/cocos/3d/CCSprite3D.h b/cocos/3d/CCSprite3D.h index e51cb37540..8464be430f 100644 --- a/cocos/3d/CCSprite3D.h +++ b/cocos/3d/CCSprite3D.h @@ -51,7 +51,7 @@ class Texture2D; class MeshSkin; class AttachNode; struct NodeData; -/** @brief Sprite3D: A sprite can be loaded from 3D model files, .obj, .c3t, .c3b, then can be drawed as sprite */ +/** @brief Sprite3D: A sprite can be loaded from 3D model files, .obj, .c3t, .c3b, then can be drawn as sprite */ class CC_DLL Sprite3D : public Node, public BlendProtocol { public: @@ -70,7 +70,7 @@ public: /** create 3d sprite asynchronously * If the 3d model was previously loaded, it will create a new 3d sprite and the callback will be called at once. - * Otherwise it will load the model file in a new thread, and when the 3d sprite is loaded, the callback will be called with the created Sprite3D and a userdefined parameter. + * Otherwise it will load the model file in a new thread, and when the 3d sprite is loaded, the callback will be called with the created Sprite3D and a user-defined parameter. * The callback will be called from the main thread, so it is safe to create any cocos2d object from the callback. * @param modelPath model to be loaded * @param callback callback after loading @@ -124,12 +124,12 @@ public: // overrides /** set GLProgramState, you should bind attributes by yourself */ virtual void setGLProgramState(GLProgramState *glProgramState) override; - /** just rember bind attributes */ + /** just remember bind attributes */ virtual void setGLProgram(GLProgram *glprogram) override; /* * Get AABB - * If the sprite has animation, it can't be calculated accuratly, + * If the sprite has animation, it can't be calculated accurately, * because bone can drive the vertices, we just use the origin vertices * to calculate the AABB. */ @@ -161,7 +161,7 @@ public: /** * Returns 2d bounding-box - * Note: the bouding-box is just get from the AABB which as Z=0, so that is not very accurate. + * Note: the bounding-box is just get from the AABB which as Z=0, so that is not very accurate. */ virtual Rect getBoundingBox() const override; @@ -332,7 +332,7 @@ protected: static Sprite3DCache* _cacheInstance; - std::unordered_map _spriteDatas; //cached sprite datas + std::unordered_map _spriteDatas; //cached sprite data }; // end of 3d group diff --git a/cocos/3d/CCTerrain.cpp b/cocos/3d/CCTerrain.cpp index 461a3eb5ba..fdf4a43240 100644 --- a/cocos/3d/CCTerrain.cpp +++ b/cocos/3d/CCTerrain.cpp @@ -924,7 +924,7 @@ void Terrain::reload() void Terrain::Chunk::finish() { - //genearate two VBO ,the first for vertices, we just setup datas once ,won't changed at all + //generate two VBO ,the first for vertices, we just setup datas once ,won't changed at all //the second vbo for the indices, because we use level of detail technique to each chunk, so we will modified frequently glGenBuffers(1,&_vbo); @@ -939,7 +939,7 @@ void Terrain::Chunk::finish() for(int i =0;i<4;i++) { int step = 1<<_currentLod; - //reserve the indices size, the first part is the core part of the chunk, the second part & thid part is for fix crack + //reserve the indices size, the first part is the core part of the chunk, the second part & third part is for fix crack int indicesAmount =(_terrain->_chunkSize.width/step+1)*(_terrain->_chunkSize.height/step+1)*6+(_terrain->_chunkSize.height/step)*6 +(_terrain->_chunkSize.width/step)*6; _lod[i]._indices.reserve(indicesAmount); diff --git a/cocos/3d/CCTerrain.h b/cocos/3d/CCTerrain.h index d681090687..2220fecbd5 100644 --- a/cocos/3d/CCTerrain.h +++ b/cocos/3d/CCTerrain.h @@ -44,7 +44,7 @@ NS_CC_BEGIN */ /** - * the maximum amount of the chunkes + * the maximum amount of the chunks **/ #define MAX_CHUNKES 256 @@ -70,12 +70,12 @@ NS_CC_BEGIN * via the chunkSize property in TerrainData. * * Chunks are managed under the QuadTree.As DE FACTO terminal Node of the QuadTree; - * let us cull chunks efficientlly to reduce drawCall amount And reduce the VBOs'Size that pass to the GPU. + * let us cull chunks efficiently to reduce drawCall amount And reduce the VBOs'Size that pass to the GPU. * * Level of detail (LOD) is supported using a technique that is similar to texture mipmapping -- called GeoMapping. * A distance-to-camera based test used to decide * the appropriate LOD for a terrain chunk. The number of LOD levels is 0 by default (which - * means only the base level is used),the maxium number of LOD levels is 4. Of course ,you can hack the value individually. + * means only the base level is used),the maximum number of LOD levels is 4. Of course ,you can hack the value individually. * * Finally, when LOD is enabled, cracks can begin to appear between terrain Chunks of * different LOD levels. An acceptable solution might be to simply reduce the lower LOD(high detail,smooth) chunks border, @@ -136,7 +136,7 @@ public: /**constructor, this constructor construct a terrain which have 3 detailmaps, 1 alpha map*/ TerrainData(const char* heightMapsrc, const char * alphamap, const DetailMap& detail1,const DetailMap& detail2, const DetailMap& detail3, const Size & chunksize = Size(32,32), float mapHeight = 2, float mapScale = 0.1); /** - *deterimine the chunk size,chunk is the minimal subdivision of the Terrain + *determine the chunk size,chunk is the minimal subdivision of the Terrain */ Size _chunkSize; /**height Map source path*/ @@ -285,7 +285,7 @@ private: QuadTree * _tr; QuadTree * _bl; QuadTree * _br; - /**A flag present current quadTree node whether a terminal node,the terminal node is de facto the chunck*/ + /**A flag present current quadTree node whether a terminal node,the terminal node is de facto the chunk*/ bool _isTerminal; Chunk * _chunk; int _posX; @@ -336,7 +336,7 @@ public: **/ float getHeight(Vec2 pos, Vec3*Normal = nullptr) const; - /**get the normal of the specified pistion in terrain + /**get the normal of the specified position in terrain * @return the normal vector of the specified position of the terrain. * @note the fast normal calculation may not get precise normal vector. **/ @@ -348,7 +348,7 @@ public: **/ void setDrawWire(bool boolValue); /** - * Set threshold distance of each LOD level,must equal or gereater than the chunk size + * Set threshold distance of each LOD level,must equal or greater than the chunk size * @Note when invoke initHeightMap, the LOD distance will be automatic calculated. */ void setLODDistance(float lod1, float lod2, float lod3); @@ -374,7 +374,7 @@ public: /** * Ray-Terrain intersection. * @param ray to hit the terrain - * @param intersectionPoint hit point if hitted + * @param intersectionPoint hit point if hit * @return true if hit, false otherwise */ bool getIntersectionPoint(const Ray & ray, Vec3 & intersectionPoint) const; @@ -395,12 +395,12 @@ public: void resetHeightMap(const char * heightMap); /** - * get the terrain's mininal height. + * get the terrain's minimal height. */ float getMinHeight(); /** - * get the terrain's maximum height. + * get the terrain's maximal height. */ float getMaxHeight(); @@ -440,7 +440,7 @@ protected: /** * recursively set each chunk's LOD - * @param cameraPos the camera postion in world space + * @param cameraPos the camera position in world space **/ void setChunksLOD(Vec3 cameraPos); @@ -458,7 +458,7 @@ protected: virtual void onEnter() override; /** - * cache all unifrom loactions in GLSL. + * cache all uniform locations in GLSL. **/ void cacheUniformAttribLocation(); diff --git a/cocos/Android.mk b/cocos/Android.mk index d2049c1e68..7a5dad7ec7 100644 --- a/cocos/Android.mk +++ b/cocos/Android.mk @@ -200,6 +200,8 @@ physics/CCPhysicsContact.cpp \ physics/CCPhysicsJoint.cpp \ physics/CCPhysicsShape.cpp \ physics/CCPhysicsWorld.cpp \ +physics/CCComponentPhysics2d.cpp \ +physics/CCPhysicsManager.cpp \ physics3d/CCPhysics3D.cpp \ physics3d/CCPhysics3DWorld.cpp \ physics3d/CCPhysics3DComponent.cpp \ diff --git a/cocos/audio/apple/AudioEngine-inl.mm b/cocos/audio/apple/AudioEngine-inl.mm index 6829fb98cc..5515e7119e 100644 --- a/cocos/audio/apple/AudioEngine-inl.mm +++ b/cocos/audio/apple/AudioEngine-inl.mm @@ -75,7 +75,7 @@ void AudioEngineInterruptionListenerCallback(void* user_data, UInt32 interruptio { if ([[[UIDevice currentDevice] systemVersion] intValue] > 5) { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleInterruption:) name:AVAudioSessionInterruptionNotification object:[AVAudioSession sharedInstance]]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleInterruption:) name:UIApplicationDidBecomeActiveNotification object:[AVAudioSession sharedInstance]]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleInterruption:) name:UIApplicationDidBecomeActiveNotification object:nil]; } else { AudioSessionInitialize(NULL, NULL, AudioEngineInterruptionListenerCallback, self); diff --git a/cocos/audio/mac/CDAudioManager.h b/cocos/audio/mac/CDAudioManager.h index af0ab4a98a..a7971f9251 100644 --- a/cocos/audio/mac/CDAudioManager.h +++ b/cocos/audio/mac/CDAudioManager.h @@ -90,7 +90,7 @@ typedef enum { @since v0.99 */ @interface CDLongAudioSource : NSObject { - AVAudioPlayer *audioSourcePlayer; + CCAudioPlayer *audioSourcePlayer; NSString *audioSourceFilePath; NSInteger numberOfLoops; float volume; @@ -106,7 +106,7 @@ typedef enum { @protected tLongAudioSourceState state; } -@property (readonly) AVAudioPlayer *audioSourcePlayer; +@property (readonly) CCAudioPlayer *audioSourcePlayer; @property (readonly) NSString *audioSourceFilePath; @property (readwrite, nonatomic) NSInteger numberOfLoops; @property (readwrite, nonatomic) float volume; @@ -196,13 +196,13 @@ typedef enum { /** Call if you want to use built in resign behavior but need to do some additional audio processing on become active. */ - (void) applicationDidBecomeActive; -//New AVAudioPlayer API +//New CCAudioPlayer API /** Loads the data from the specified file path to the channel's audio source */ -(CDLongAudioSource*) audioSourceLoad:(NSString*) filePath channel:(tAudioSourceChannel) channel; /** Retrieves the audio source for the specified channel */ -(CDLongAudioSource*) audioSourceForChannel:(tAudioSourceChannel) channel; -//Legacy AVAudioPlayer API +//Legacy CCAudioPlayer API /** Plays music in background. The music can be looped or not It is recommended to use .aac files as background music since they are decoded by the device (hardware). */ diff --git a/cocos/audio/mac/CDAudioManager.m b/cocos/audio/mac/CDAudioManager.m index b5365af68c..2c36961393 100644 --- a/cocos/audio/mac/CDAudioManager.m +++ b/cocos/audio/mac/CDAudioManager.m @@ -66,12 +66,12 @@ NSString * const kCDN_AudioManagerInitialised = @"kCDN_AudioManagerInitialised"; //New file if (state != kLAS_Init) { [audioSourceFilePath release];//Release old file path - [audioSourcePlayer release];//Release old AVAudioPlayer, they can't be reused + [audioSourcePlayer release];//Release old CCAudioPlayer, they can't be reused } audioSourceFilePath = [filePath copy]; NSError *error = nil; NSString *path = [CDUtilities fullPathFromRelativePath:audioSourceFilePath]; - audioSourcePlayer = [(AVAudioPlayer*)[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:&error]; + audioSourcePlayer = [(CCAudioPlayer*)[CCAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:&error]; if (error == nil) { [audioSourcePlayer prepareToPlay]; audioSourcePlayer.delegate = self; @@ -190,12 +190,12 @@ NSString * const kCDN_AudioManagerInitialised = @"kCDN_AudioManagerInitialised"; numberOfLoops = loopCount; } -- (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag { +- (void)audioPlayerDidFinishPlaying:(CCAudioPlayer *)player successfully:(BOOL)flag { CDLOGINFO(@"Denshion::CDLongAudioSource - audio player finished"); #if TARGET_IPHONE_SIMULATOR CDLOGINFO(@"Denshion::CDLongAudioSource - workaround for OpenAL clobbered audio issue"); //This is a workaround for an issue in all simulators (tested to 3.1.2). Problem is - //that OpenAL audio playback is clobbered when an AVAudioPlayer stops. Workaround + //that OpenAL audio playback is clobbered when an CCAudioPlayer stops. Workaround //is to keep the player playing on an endless loop with 0 volume and then when //it is played again reset the volume and set loop count appropriately. //NB: this workaround is not foolproof but it is good enough for most situations. @@ -208,11 +208,11 @@ NSString * const kCDN_AudioManagerInitialised = @"kCDN_AudioManagerInitialised"; } } --(void)audioPlayerBeginInterruption:(AVAudioPlayer *)player { +-(void)audioPlayerBeginInterruption:(CCAudioPlayer *)player { CDLOGINFO(@"Denshion::CDLongAudioSource - audio player interrupted"); } --(void)audioPlayerEndInterruption:(AVAudioPlayer *)player { +-(void)audioPlayerEndInterruption:(CCAudioPlayer *)player { CDLOGINFO(@"Denshion::CDLongAudioSource - audio player resumed"); if (self.backgroundMusic) { //Check if background music can play as rules may have changed during diff --git a/cocos/audio/mac/CDXMacOSXSupport.h b/cocos/audio/mac/CDXMacOSXSupport.h index ccab5531e7..eaa97f2e34 100644 --- a/cocos/audio/mac/CDXMacOSXSupport.h +++ b/cocos/audio/mac/CDXMacOSXSupport.h @@ -23,13 +23,13 @@ */ /** - A set of proxy classes to allow iOS audio code to run on MacOS X. AVAudioPlayer is implemented using NSSound. + A set of proxy classes to allow iOS audio code to run on MacOS X. CCAudioPlayer is implemented using NSSound. AVAudioSession is a "do nothing" class as it isn't really relevant on MacOS X. Limitations: - AVAudioPlayer numberOfLoops not correctly supported. Looping is either on or off, can not specify a specific number of loops. - AVAudioPlayer panning not supported. - AVAudioPlayer metering not supported. + CCAudioPlayer numberOfLoops not correctly supported. Looping is either on or off, can not specify a specific number of loops. + CCAudioPlayer panning not supported. + CCAudioPlayer metering not supported. AVAudioSession nothing is supported, not applicable to MacOS X. */ @@ -60,7 +60,7 @@ extern OSStatus AudioSessionGetProperty(UInt32 inID, UInt32 *ioDataSize, void *o @protocol AVAudioPlayerDelegate; /* This class is available with iPhone 2.2 or later */ -@interface AVAudioPlayer : NSObject { +@interface CCAudioPlayer : NSObject { // properties id delegate; @@ -137,24 +137,24 @@ extern OSStatus AudioSessionGetProperty(UInt32 inID, UInt32 *ioDataSize, void *o @end -/* A protocol for delegates of AVAudioPlayer */ +/* A protocol for delegates of CCAudioPlayer */ @protocol AVAudioPlayerDelegate @optional /* audioPlayerDidFinishPlaying:successfully: is called when a sound has finished playing. This method is NOT called if the player is stopped due to an interruption. */ -- (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag; +- (void)audioPlayerDidFinishPlaying:(CCAudioPlayer *)player successfully:(BOOL)flag; /* if an error occurs while decoding it will be reported to the delegate. */ -- (void)audioPlayerDecodeErrorDidOccur:(AVAudioPlayer *)player error:(NSError *)error; +- (void)audioPlayerDecodeErrorDidOccur:(CCAudioPlayer *)player error:(NSError *)error; /* audioPlayerBeginInterruption: is called when the audio session has been interrupted while the player was playing. The player will have been paused. */ -- (void)audioPlayerBeginInterruption:(AVAudioPlayer *)player; +- (void)audioPlayerBeginInterruption:(CCAudioPlayer *)player; /* audioPlayerEndInterruption:withFlags: is called when the audio session interruption has ended and this player had been interrupted while playing. */ /* Currently the only flag is AVAudioSessionInterruptionFlags_ShouldResume. */ -- (void)audioPlayerEndInterruption:(AVAudioPlayer *)player withFlags:(NSUInteger)flags; +- (void)audioPlayerEndInterruption:(CCAudioPlayer *)player withFlags:(NSUInteger)flags; /* audioPlayerEndInterruption: is called when the preferred method, audioPlayerEndInterruption:withFlags:, is not implemented. */ -- (void)audioPlayerEndInterruption:(AVAudioPlayer *)player; +- (void)audioPlayerEndInterruption:(CCAudioPlayer *)player; @end diff --git a/cocos/audio/mac/CDXMacOSXSupport.mm b/cocos/audio/mac/CDXMacOSXSupport.mm index 57fb53a715..98605d342d 100644 --- a/cocos/audio/mac/CDXMacOSXSupport.mm +++ b/cocos/audio/mac/CDXMacOSXSupport.mm @@ -42,7 +42,7 @@ OSStatus AudioSessionGetProperty(UInt32 inID, UInt32 *ioDataSize, void *outData) return 0; } -@implementation AVAudioPlayer +@implementation CCAudioPlayer @synthesize delegate, numberOfChannels, pan, deviceCurrentTime, url, data; diff --git a/cocos/audio/mac/CocosDenshion.h b/cocos/audio/mac/CocosDenshion.h index 2e40c2eaae..ccd571c0c0 100644 --- a/cocos/audio/mac/CocosDenshion.h +++ b/cocos/audio/mac/CocosDenshion.h @@ -41,12 +41,12 @@ Requirements: - Frameworks: OpenAL, AudioToolbox, AVFoundation @par CDAudioManager -CDAudioManager is basically a thin wrapper around an AVAudioPlayer object used for playing +CDAudioManager is basically a thin wrapper around an CCAudioPlayer object used for playing background music and a CDSoundEngine object used for playing sound effects. It manages the audio session for you deals with audio session interruption. It is fairly low level and it is expected you have some understanding of the underlying technologies. For example, for many use cases regarding background music it is expected you will work directly with the -backgroundMusic AVAudioPlayer which is exposed as a property. +backgroundMusic CCAudioPlayer which is exposed as a property. Requirements: - Firmware: OS 2.2 or greater diff --git a/cocos/base/CCConsole.cpp b/cocos/base/CCConsole.cpp index 9433a37714..f400881811 100644 --- a/cocos/base/CCConsole.cpp +++ b/cocos/base/CCConsole.cpp @@ -404,7 +404,7 @@ bool Console::listenOnTCP(int port) setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, (const char*)&on, sizeof(on)); // bind address - if (_bindAddress.length() > 0) + if (!_bindAddress.empty()) { if (res->ai_family == AF_INET) { @@ -533,7 +533,7 @@ void Console::commandFileUtils(int fd, const std::string &args) { FileUtils::getInstance()->purgeCachedEntries(); } - else if( args.length()==0) + else if( args.empty()) { sched->performFunctionInCocosThread( std::bind(&printFileUtils, fd) ); } @@ -555,7 +555,7 @@ void Console::commandConfig(int fd, const std::string& args) void Console::commandResolution(int fd, const std::string& args) { - if(args.length()==0) { + if(args.empty()) { auto director = Director::getInstance(); Size points = director->getWinSize(); Size pixels = director->getWinSizeInPixels(); @@ -598,7 +598,7 @@ void Console::commandProjection(int fd, const std::string& args) auto director = Director::getInstance(); Scheduler *sched = director->getScheduler(); - if(args.length()==0) + if(args.empty()) { char buf[20]; auto proj = director->getProjection(); @@ -648,7 +648,7 @@ void Console::commandTextures(int fd, const std::string& args) } ); } - else if(args.length()==0) + else if(args.empty()) { sched->performFunctionInCocosThread( [=](){ mydprintf(fd, "%s", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str()); diff --git a/cocos/base/CCDirector.cpp b/cocos/base/CCDirector.cpp index d4fc458a74..86a4498fd2 100644 --- a/cocos/base/CCDirector.cpp +++ b/cocos/base/CCDirector.cpp @@ -61,7 +61,6 @@ THE SOFTWARE. #include "base/CCConfiguration.h" #include "base/CCAsyncTaskPool.h" #include "platform/CCApplication.h" -//#include "platform/CCGLViewImpl.h" #if CC_ENABLE_SCRIPT_BINDING #include "CCScriptSupport.h" @@ -1252,8 +1251,18 @@ void Director::setContentScaleFactor(float scaleFactor) void Director::setNotificationNode(Node *node) { - CC_SAFE_RELEASE(_notificationNode); - _notificationNode = node; + if (_notificationNode != nullptr){ + _notificationNode->onExitTransitionDidStart(); + _notificationNode->onExit(); + _notificationNode->cleanup(); + } + CC_SAFE_RELEASE(_notificationNode); + + _notificationNode = node; + if (node == nullptr) + return; + _notificationNode->onEnter(); + _notificationNode->onEnterTransitionDidFinish(); CC_SAFE_RETAIN(_notificationNode); } diff --git a/cocos/base/CCDirector.h b/cocos/base/CCDirector.h index 8085bc4157..14f35e2fa3 100644 --- a/cocos/base/CCDirector.h +++ b/cocos/base/CCDirector.h @@ -154,12 +154,12 @@ public: /** Gets the FPS value. */ inline float getAnimationInterval() { return _animationInterval; } - /** Sets the FPS value. FPS = 1/internal. */ + /** Sets the FPS value. FPS = 1/interval. */ virtual void setAnimationInterval(float interval) = 0; - /** Whether or not to display the FPS on the bottom-left corner. */ + /** Whether or not displaying the FPS on the bottom-left corner of the screen. */ inline bool isDisplayStats() { return _displayStats; } - /** Display the FPS on the bottom-left corner. */ + /** Display the FPS on the bottom-left corner of the screen. */ inline void setDisplayStats(bool displayStats) { _displayStats = displayStats; } /** Get seconds per frame. */ @@ -260,8 +260,8 @@ public: Vec2 convertToUI(const Vec2& point); /** - * Gets the distance between camera and near clipping frane. - * It is correct for default camera that near clipping frane is the same as screen. + * Gets the distance between camera and near clipping frame. + * It is correct for default camera that near clipping frame is same as the screen. */ float getZEye() const; diff --git a/cocos/base/CCEventDispatcher.cpp b/cocos/base/CCEventDispatcher.cpp index affbf4d8df..946dcdfce7 100644 --- a/cocos/base/CCEventDispatcher.cpp +++ b/cocos/base/CCEventDispatcher.cpp @@ -841,8 +841,13 @@ void EventDispatcher::dispatchTouchEventToListeners(EventListenerVector* listene } Camera::_visitingCamera = camera; + auto cameraFlag = (unsigned short)camera->getCameraFlag(); for (auto& l : sceneListeners) { + if (0 == (l->getAssociatedNode()->getCameraMask() & cameraFlag)) + { + continue; + } if (onEvent(l)) { shouldStopPropagation = true; diff --git a/cocos/base/CCEventListenerMouse.cpp b/cocos/base/CCEventListenerMouse.cpp index de25349faf..c0b139907a 100644 --- a/cocos/base/CCEventListenerMouse.cpp +++ b/cocos/base/CCEventListenerMouse.cpp @@ -82,19 +82,19 @@ bool EventListenerMouse::init() { case EventMouse::MouseEventType::MOUSE_DOWN: if(onMouseDown != nullptr) - onMouseDown(event); + onMouseDown(mouseEvent); break; case EventMouse::MouseEventType::MOUSE_UP: if(onMouseUp != nullptr) - onMouseUp(event); + onMouseUp(mouseEvent); break; case EventMouse::MouseEventType::MOUSE_MOVE: if(onMouseMove != nullptr) - onMouseMove(event); + onMouseMove(mouseEvent); break; case EventMouse::MouseEventType::MOUSE_SCROLL: if(onMouseScroll != nullptr) - onMouseScroll(event); + onMouseScroll(mouseEvent); break; default: break; diff --git a/cocos/base/CCEventListenerMouse.h b/cocos/base/CCEventListenerMouse.h index 49a185d719..90985804f9 100644 --- a/cocos/base/CCEventListenerMouse.h +++ b/cocos/base/CCEventListenerMouse.h @@ -57,10 +57,10 @@ public: virtual EventListenerMouse* clone() override; virtual bool checkAvailable() override; - std::function onMouseDown; - std::function onMouseUp; - std::function onMouseMove; - std::function onMouseScroll; + std::function onMouseDown; + std::function onMouseUp; + std::function onMouseMove; + std::function onMouseScroll; CC_CONSTRUCTOR_ACCESS: EventListenerMouse(); diff --git a/cocos/base/CCMap.h b/cocos/base/CCMap.h index 1c8c53ef0a..8144a9d90e 100644 --- a/cocos/base/CCMap.h +++ b/cocos/base/CCMap.h @@ -274,9 +274,9 @@ public: void insert(const K& key, V object) { CCASSERT(object != nullptr, "Object is nullptr!"); + object->retain(); erase(key); _data.insert(std::make_pair(key, object)); - object->retain(); } /** @@ -308,7 +308,6 @@ public: _data.erase(iter); return 1; } - return 0; } diff --git a/cocos/base/CCScheduler.cpp b/cocos/base/CCScheduler.cpp index 0acc1d3b93..7977dfff65 100644 --- a/cocos/base/CCScheduler.cpp +++ b/cocos/base/CCScheduler.cpp @@ -130,19 +130,15 @@ void Timer::update(float dt) trigger(interval); _elapsed -= interval; _timesExecuted += 1; - if (_elapsed <= 0.f) + + if (!_runForever && _timesExecuted > _repeat) { + cancel(); break; } - if (_runForever) + if (_elapsed <= 0.f) { - continue; - } - - if (_timesExecuted > _repeat) - { //unschedule timer - cancel(); break; } } diff --git a/cocos/base/CCScriptSupport.cpp b/cocos/base/CCScriptSupport.cpp index 6de27bb537..048676e536 100644 --- a/cocos/base/CCScriptSupport.cpp +++ b/cocos/base/CCScriptSupport.cpp @@ -163,6 +163,18 @@ void ScriptEngineManager::destroyInstance() } } +bool ScriptEngineManager::sendActionEventToJS(Action* actionObject, int eventType, void* param) +{ + auto scriptEngine = getInstance()->getScriptEngine(); + + ActionObjectScriptData data(actionObject,(int*)&eventType, param); + ScriptEvent scriptEvent(kScriptActionEvent,(void*)&data); + if (scriptEngine->sendEvent(&scriptEvent)) + return true; + + return false; +} + bool ScriptEngineManager::sendNodeEventToJS(Node* node, int action) { auto scriptEngine = getInstance()->getScriptEngine(); diff --git a/cocos/base/CCScriptSupport.h b/cocos/base/CCScriptSupport.h index 203060c50b..ca0ad7a75e 100644 --- a/cocos/base/CCScriptSupport.h +++ b/cocos/base/CCScriptSupport.h @@ -51,6 +51,7 @@ class Layer; class MenuItem; class CallFunc; class Acceleration; +class Action; enum ccScriptType { kScriptTypeNone = 0, @@ -259,7 +260,8 @@ enum ScriptEventType kControlEvent, kCommonEvent, kComponentEvent, - kRestartGame + kRestartGame, + kScriptActionEvent }; /** @@ -296,6 +298,48 @@ struct BasicScriptData } }; +/** + * For Lua, Wrapper the script data that should be used to find the handler corresponding to the Lua function by the nativeobject pointer and store the value pointer which would be converted concretely by the different events,then the converted data would be passed into the Lua stack. + * @js NA + */ +struct ActionObjectScriptData +{ + /** + * For Lua, nativeobject is used to get handler corresponding to the Lua function. + * + * @js NA + * @lua NA + */ + void* nativeObject; + + /** + * A pointer point to the value data which event action + * + * @js NA + * @lua NA + */ + int* eventType; + + /** + * A pointer point to the value data which would be converted by different events. + * + * @js NA + * @lua NA + */ + void* param; + + /** + * Constructor of BasicScriptData. + * + * @js NA + * @lua NA + */ + ActionObjectScriptData(void* inObject,int* inValue = nullptr, void* inParam = nullptr) + : nativeObject(inObject),eventType(inValue), param(inParam) + { + } +}; + /** * For Lua, the SchedulerScriptData is used to find the Lua function pointer by the handler, then call the Lua function by push the elapse into the Lua stack as a parameter when scheduler update event is triggered. * @js NA @@ -770,6 +814,13 @@ public: * @js NA */ static void destroyInstance(); + /** + * + * + * @lua NA + * @js NA + */ + static bool sendActionEventToJS(Action* actionObject, int eventType, void* param); /** * * diff --git a/cocos/cocos2d.cpp b/cocos/cocos2d.cpp index f9c868609f..ccc0f8a29a 100644 --- a/cocos/cocos2d.cpp +++ b/cocos/cocos2d.cpp @@ -31,7 +31,7 @@ NS_CC_BEGIN CC_DLL const char* cocos2dVersion() { - return "cocos2d-x-3.8-github"; + return "cocos2d-x-3.8"; } NS_CC_END diff --git a/cocos/cocos2d.h b/cocos/cocos2d.h index 5e0c3d43bc..73aa40a2b6 100644 --- a/cocos/cocos2d.h +++ b/cocos/cocos2d.h @@ -29,8 +29,8 @@ THE SOFTWARE. #define __COCOS2D_H__ // 0x00 HI ME LO -// 00 03 07 00 -#define COCOS2D_VERSION 0x00030700 +// 00 03 08 00 +#define COCOS2D_VERSION 0x00030800 // // all cocos2d include files @@ -186,6 +186,8 @@ THE SOFTWARE. #include "physics/CCPhysicsJoint.h" #include "physics/CCPhysicsShape.h" #include "physics/CCPhysicsWorld.h" +#include "physics/CCComponentPhysics2d.h" +#include "physics/CCPhysicsManager.h" // platform #include "platform/CCCommon.h" diff --git a/cocos/deprecated/CCDictionary.cpp b/cocos/deprecated/CCDictionary.cpp index 59f57e8490..5e24ccc73b 100644 --- a/cocos/deprecated/CCDictionary.cpp +++ b/cocos/deprecated/CCDictionary.cpp @@ -217,7 +217,7 @@ const __String* __Dictionary::valueForKey(intptr_t key) void __Dictionary::setObject(Ref* pObject, const std::string& key) { - CCASSERT(key.length() > 0 && pObject != nullptr, "Invalid Argument!"); + CCASSERT(!key.empty() && pObject != nullptr, "Invalid Argument!"); if (_dictType == kDictUnknown) { _dictType = kDictStr; @@ -276,7 +276,7 @@ void __Dictionary::removeObjectForKey(const std::string& key) } CCASSERT(_dictType == kDictStr, "this dictionary doesn't use string as its key"); - CCASSERT(key.length() > 0, "Invalid Argument!"); + CCASSERT(!key.empty(), "Invalid Argument!"); DictElement *pElement = nullptr; HASH_FIND_STR(_elements, key.c_str(), pElement); removeObjectForElememt(pElement); diff --git a/cocos/deprecated/CCString.cpp b/cocos/deprecated/CCString.cpp index 38d153b95f..a44867cdf8 100644 --- a/cocos/deprecated/CCString.cpp +++ b/cocos/deprecated/CCString.cpp @@ -196,7 +196,7 @@ __Array* __String::componentsSeparatedByString(const char *delimiter) strTmp = strTmp.substr(cutAt + 1); } - if(strTmp.length() > 0) + if(!strTmp.empty()) { result->addObject(__String::create(strTmp)); } diff --git a/cocos/editor-support/cocosbuilder/CCBAnimationManager.cpp b/cocos/editor-support/cocosbuilder/CCBAnimationManager.cpp index 9b80686720..f3d0806fe7 100644 --- a/cocos/editor-support/cocosbuilder/CCBAnimationManager.cpp +++ b/cocos/editor-support/cocosbuilder/CCBAnimationManager.cpp @@ -663,7 +663,7 @@ Sequence* CCBAnimationManager::actionForCallbackChannel(CCBSequenceProperty* ch if(target != nullptr) { - if(selectorName.length() > 0) + if(!selectorName.empty()) { SEL_CallFuncN selCallFunc = 0; diff --git a/cocos/editor-support/cocosbuilder/CCBReader.cpp b/cocos/editor-support/cocosbuilder/CCBReader.cpp index 6b7d9c8f8a..68ce5c10c8 100644 --- a/cocos/editor-support/cocosbuilder/CCBReader.cpp +++ b/cocos/editor-support/cocosbuilder/CCBReader.cpp @@ -796,7 +796,7 @@ CCBKeyframe* CCBReader::readKeyframe(PropertyType type) SpriteFrame* spriteFrame; - if (spriteSheet.length() == 0) + if (spriteSheet.empty()) { spriteFile = _CCBRootPath + spriteFile; diff --git a/cocos/editor-support/cocosbuilder/CCNodeLoader.cpp b/cocos/editor-support/cocosbuilder/CCNodeLoader.cpp index d1febae816..4f763bed43 100644 --- a/cocos/editor-support/cocosbuilder/CCNodeLoader.cpp +++ b/cocos/editor-support/cocosbuilder/CCNodeLoader.cpp @@ -575,9 +575,9 @@ SpriteFrame * NodeLoader::parsePropTypeSpriteFrame(Node * pNode, Node * pParent, std::string spriteFile = ccbReader->readCachedString(); SpriteFrame *spriteFrame = nullptr; - if (spriteFile.length() != 0) + if (!spriteFile.empty()) { - if (spriteSheet.length() == 0) + if (spriteSheet.empty()) { spriteFile = ccbReader->getCCBRootPath() + spriteFile; Texture2D * texture = Director::getInstance()->getTextureCache()->addImage(spriteFile.c_str()); @@ -623,7 +623,7 @@ Animation * NodeLoader::parsePropTypeAnimation(Node * pNode, Node * pParent, CCB animation = CCBReader::lastPathComponent(animation.c_str()); animationFile = CCBReader::lastPathComponent(animationFile.c_str()); - if (animation.length() > 0) + if (!animation.empty()) { AnimationCache * animationCache = AnimationCache::getInstance(); animationCache->addAnimationsWithFile(animationFile.c_str()); @@ -636,7 +636,7 @@ Animation * NodeLoader::parsePropTypeAnimation(Node * pNode, Node * pParent, CCB Texture2D * NodeLoader::parsePropTypeTexture(Node * pNode, Node * pParent, CCBReader * ccbReader) { std::string spriteFile = ccbReader->getCCBRootPath() + ccbReader->readCachedString(); - if (spriteFile.length() > 0) + if (!spriteFile.empty()) { return Director::getInstance()->getTextureCache()->addImage(spriteFile.c_str()); } @@ -775,7 +775,7 @@ BlockData * NodeLoader::parsePropTypeBlock(Node * pNode, Node * pParent, CCBRead if(target != nullptr) { - if(selectorName.length() > 0) + if(!selectorName.empty()) { SEL_MenuHandler selMenuHandler = 0; @@ -856,7 +856,7 @@ BlockControlData * NodeLoader::parsePropTypeBlockControl(Node * pNode, Node * pP if(target != nullptr) { - if(selectorName.length() > 0) + if(!selectorName.empty()) { Control::Handler selControlHandler = 0; diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCBoneNode.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CCBoneNode.cpp index e3fa31a5cc..56a55e73a3 100644 --- a/cocos/editor-support/cocostudio/ActionTimeline/CCBoneNode.cpp +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCBoneNode.cpp @@ -588,6 +588,12 @@ bool BoneNode::isPointOnRack(const cocos2d::Vec2& bonePoint) void BoneNode::batchBoneDrawToSkeleton(BoneNode* bone) const { + bool visibleByCamera = bone->isVisitableByVisitingCamera(); + if (!visibleByCamera) + { + return; + } + cocos2d::Vec3 vpos[4]; for (int i = 0; i < 4; i++) { diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.cpp index 869947a38e..60efaaabfb 100644 --- a/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.cpp +++ b/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.cpp @@ -265,7 +265,7 @@ Node* CSLoader::createNode(const std::string& filename) CCLOG("suffix = %s", suffix.c_str()); CSLoader* load = CSLoader::getInstance(); - + if (suffix == "csb") { return load->createNodeWithFlatBuffersFile(filename); @@ -274,7 +274,7 @@ Node* CSLoader::createNode(const std::string& filename) { return load->createNodeFromJson(filename); } - + return nullptr; } @@ -286,7 +286,7 @@ Node* CSLoader::createNode(const std::string &filename, const ccNodeLoadCallback CCLOG("suffix = %s", suffix.c_str()); CSLoader* load = CSLoader::getInstance(); - + if (suffix == "csb") { return load->createNodeWithFlatBuffersFile(filename, callback); @@ -295,6 +295,30 @@ Node* CSLoader::createNode(const std::string &filename, const ccNodeLoadCallback return nullptr; } +Node* CSLoader::createNodeWithVisibleSize(const std::string& filename) +{ + auto node = createNode(filename); + if (node != nullptr) + { + Size frameSize = Director::getInstance()->getVisibleSize(); + node->setContentSize(frameSize); + ui::Helper::doLayout(node); + } + return node; +} + +Node* CSLoader::createNodeWithVisibleSize(const std::string &filename, const ccNodeLoadCallback &callback) +{ + auto node = createNode(filename, callback); + if (node != nullptr) + { + Size frameSize = Director::getInstance()->getVisibleSize(); + node->setContentSize(frameSize); + ui::Helper::doLayout(node); + } + return node; +} + std::string CSLoader::getExtentionName(const std::string& name) { std::string result = ""; @@ -551,7 +575,7 @@ void CSLoader::initNode(Node* node, const rapidjson::Value& json) GLubyte red = (GLubyte)DICTOOL->getIntValue_json(json, RED, 255); GLubyte green = (GLubyte)DICTOOL->getIntValue_json(json, GREEN, 255); GLubyte blue = (GLubyte)DICTOOL->getIntValue_json(json, BLUE, 255); - int zorder = DICTOOL->getIntValue_json(json, ZORDER); + int zorder = DICTOOL->getIntValue_json(json, ZORDER); int tag = DICTOOL->getIntValue_json(json, TAG); int actionTag = DICTOOL->getIntValue_json(json, ACTION_TAG); bool visible = DICTOOL->getBooleanValue_json(json, VISIBLE); diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.h b/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.h index 76817ca6c7..bb2cfe516b 100644 --- a/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.h +++ b/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.h @@ -81,6 +81,8 @@ public: static cocos2d::Node* createNode(const std::string& filename, const ccNodeLoadCallback& callback); static cocos2d::Node* createNode(const Data data); static cocos2d::Node* createNode(const Data data, const ccNodeLoadCallback &callback); + static cocos2d::Node* createNodeWithVisibleSize(const std::string& filename); + static cocos2d::Node* createNodeWithVisibleSize(const std::string& filename, const ccNodeLoadCallback& callback); static cocostudio::timeline::ActionTimeline* createTimeline(const std::string& filename); static cocostudio::timeline::ActionTimeline* createTimeline(const Data data, const std::string& filename); diff --git a/cocos/editor-support/cocostudio/CCArmature.cpp b/cocos/editor-support/cocostudio/CCArmature.cpp index cfbed59a52..701d2ec8a9 100644 --- a/cocos/editor-support/cocostudio/CCArmature.cpp +++ b/cocos/editor-support/cocostudio/CCArmature.cpp @@ -212,7 +212,7 @@ Bone *Armature::createBone(const std::string& boneName) Bone *bone = nullptr; - if( parentName.length() != 0 ) + if( !parentName.empty()) { createBone(parentName.c_str()); bone = Bone::create(boneName); diff --git a/cocos/editor-support/cocostudio/CCComExtensionData.cpp b/cocos/editor-support/cocostudio/CCComExtensionData.cpp index 2d438493ce..1ef5d9d861 100644 --- a/cocos/editor-support/cocostudio/CCComExtensionData.cpp +++ b/cocos/editor-support/cocostudio/CCComExtensionData.cpp @@ -80,7 +80,6 @@ namespace cocostudio void ComExtensionData::onRemove() { - CC_SAFE_RELEASE_NULL(_timelineData); } void ComExtensionData::setActionTag(int actionTag) diff --git a/cocos/editor-support/cocostudio/CCDataReaderHelper.cpp b/cocos/editor-support/cocostudio/CCDataReaderHelper.cpp index 4d645dbf44..db2b87cdf9 100644 --- a/cocos/editor-support/cocostudio/CCDataReaderHelper.cpp +++ b/cocos/editor-support/cocostudio/CCDataReaderHelper.cpp @@ -809,7 +809,7 @@ MovementData *DataReaderHelper::decodeMovement(tinyxml2::XMLElement *movementXML tinyxml2::XMLElement *parentXml = nullptr; - if (parentName.length() != 0) + if (!parentName.empty()) { parentXml = movementXML->FirstChildElement(BONE); diff --git a/cocos/editor-support/cocostudio/CCDisplayFactory.cpp b/cocos/editor-support/cocostudio/CCDisplayFactory.cpp index 43c483c919..90934aefc8 100644 --- a/cocos/editor-support/cocostudio/CCDisplayFactory.cpp +++ b/cocos/editor-support/cocostudio/CCDisplayFactory.cpp @@ -151,7 +151,7 @@ void DisplayFactory::createSpriteDisplay(Bone *bone, DecorativeDisplay *decoDisp } //! create display - if(textureName.length() == 0) + if(textureName.empty()) { skin = Skin::create(); } diff --git a/cocos/editor-support/cocostudio/CCDisplayManager.cpp b/cocos/editor-support/cocostudio/CCDisplayManager.cpp index b294572549..5a749f68d4 100644 --- a/cocos/editor-support/cocostudio/CCDisplayManager.cpp +++ b/cocos/editor-support/cocostudio/CCDisplayManager.cpp @@ -383,10 +383,12 @@ bool DisplayManager::containPoint(Vec2 &point) Vec2 outPoint; Sprite *sprite = (Sprite *)_currentDecoDisplay->getDisplay(); - sprite = (Sprite *)sprite->getChildByTag(0); - - ret = CC_SPRITE_CONTAIN_POINT_WITH_RETURN(sprite, point, outPoint); + Sprite *child = (Sprite *)sprite->getChildByTag(0); + if(nullptr != child) + sprite = child; + if (nullptr != sprite) + ret = CC_SPRITE_CONTAIN_POINT_WITH_RETURN(sprite, point, outPoint); } break; diff --git a/cocos/editor-support/cocostudio/CCTween.cpp b/cocos/editor-support/cocostudio/CCTween.cpp index 8ca0024762..f6bb49020f 100644 --- a/cocos/editor-support/cocostudio/CCTween.cpp +++ b/cocos/editor-support/cocostudio/CCTween.cpp @@ -345,9 +345,9 @@ void Tween::arriveKeyFrame(FrameData *keyFrameData) Armature *childAramture = _bone->getChildArmature(); if(childAramture) { - if(keyFrameData->strMovement.length() != 0) + if(!keyFrameData->strMovement.empty()) { - childAramture->getAnimation()->play(keyFrameData->strMovement.c_str()); + childAramture->getAnimation()->play(keyFrameData->strMovement); } } } @@ -450,7 +450,7 @@ float Tween::updateFrameData(float currentPercent) to = frames.at(_toIndex); //! Guaranteed to trigger frame event - if(from->strEvent.length() != 0 && !_animation->isIgnoreFrameEvent()) + if(!from->strEvent.empty() && !_animation->isIgnoreFrameEvent()) { _animation->frameEvent(_bone, from->strEvent.c_str(), from->frameID, playedTime); } diff --git a/cocos/editor-support/cocostudio/CSParse3DBinary_generated.h b/cocos/editor-support/cocostudio/CSParse3DBinary_generated.h index e8ef83081d..70dcda6f98 100644 --- a/cocos/editor-support/cocostudio/CSParse3DBinary_generated.h +++ b/cocos/editor-support/cocostudio/CSParse3DBinary_generated.h @@ -43,6 +43,7 @@ struct EventFrame; struct IntFrame; struct BoolFrame; struct InnerActionFrame; +struct EasingData; struct RotationSkew; struct Position; struct Scale; @@ -51,7 +52,9 @@ struct Color; struct ColorVector; struct FlatSize; struct CapInsets; +struct BlendFunc; struct ResourceData; +struct BlendFrame; } // namespace flatbuffers namespace flatbuffers { @@ -60,6 +63,7 @@ struct Node3DOption; struct Sprite3DOptions; struct Particle3DOptions; struct UserCameraOptions; +struct GameNode3DOption; struct Vector2; struct Vector3; @@ -93,92 +97,6 @@ MANUALLY_ALIGNED_STRUCT(4) Vector3 { }; STRUCT_END(Vector3, 12); -struct GameNode3DOption : private flatbuffers::Table { - const flatbuffers::String *name() const { return GetPointer(4); } - int32_t skyBoxMask() const { return GetField(6, 0); } - uint8_t skyBoxEnabled() const { return GetField(8, 0); } - const ResourceData *leftFileData() const { return GetPointer(10); } - const ResourceData *rightFileData() const { return GetPointer(12); } - const ResourceData *upFileData() const { return GetPointer(14); } - const ResourceData *downFileData() const { return GetPointer(16); } - const ResourceData *forwardFileData() const { return GetPointer(18); } - const ResourceData *backFileData() const { return GetPointer(20); } - const flatbuffers::String *frameEvent() const { return GetPointer(22); } - const flatbuffers::String *customProperty() const { return GetPointer(24); } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, 4 /* nodeOptions */) && - verifier.Verify(name()) && - VerifyField(verifier, 6 /* skyBoxMask */) && - VerifyField(verifier, 8 /* skyBoxEnabled */) && - VerifyField(verifier, 10 /* leftFileData */) && - verifier.VerifyTable(leftFileData()) && - VerifyField(verifier, 12 /* rightFileData */) && - verifier.VerifyTable(rightFileData()) && - VerifyField(verifier, 14 /* upFileData */) && - verifier.VerifyTable(upFileData()) && - VerifyField(verifier, 16 /* downFileData */) && - verifier.VerifyTable(downFileData()) && - VerifyField(verifier, 18 /* forwardFileData */) && - verifier.VerifyTable(forwardFileData()) && - VerifyField(verifier, 20 /* backFileData */) && - verifier.VerifyTable(backFileData()) && - VerifyField(verifier, 22 /* frameEvent */) && - verifier.Verify(frameEvent()) && - VerifyField(verifier, 24 /* customProperty */) && - verifier.Verify(customProperty()) && - verifier.EndTable(); - } -}; - -struct GameNode3DOptionBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_name(flatbuffers::Offset name) { fbb_.AddOffset(4, name); } - void add_skyBoxMask(int32_t skyBoxMask) { fbb_.AddElement(6, skyBoxMask, 0); } - void add_skyboxEnabled(uint8_t skyBoxEnabled) { fbb_.AddElement(8, skyBoxEnabled, 0); } - void add_leftFileData(flatbuffers::Offset leftFileData) { fbb_.AddOffset(10, leftFileData); } - void add_rightFileData(flatbuffers::Offset rightFileData) { fbb_.AddOffset(12, rightFileData); } - void add_upFileData(flatbuffers::Offset upFileData) { fbb_.AddOffset(14, upFileData); } - void add_downFileData(flatbuffers::Offset downFileData) { fbb_.AddOffset(16, downFileData); } - void add_forwardFileData(flatbuffers::Offset forwardFileData) { fbb_.AddOffset(18, forwardFileData); } - void add_backFileData(flatbuffers::Offset backFileData) { fbb_.AddOffset(20, backFileData); } - void add_frameEvent(flatbuffers::Offset frameEvent) { fbb_.AddOffset(22, frameEvent); } - void add_customProperty(flatbuffers::Offset customProperty) { fbb_.AddOffset(24, customProperty); } - GameNode3DOptionBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); } - flatbuffers::Offset Finish() { - auto o = flatbuffers::Offset(fbb_.EndTable(start_, 11)); - return o; - } -}; - -inline flatbuffers::Offset CreateGameNode3DOption(flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset name = 0, - int32_t skyBoxMask = 0, - uint8_t skyBoxEnabled = 0, - flatbuffers::Offset leftFileData = 0, - flatbuffers::Offset rightFileData = 0, - flatbuffers::Offset upFileData = 0, - flatbuffers::Offset downFileData = 0, - flatbuffers::Offset forwardFileData = 0, - flatbuffers::Offset backFileData = 0, - flatbuffers::Offset frameEvent = 0, - flatbuffers::Offset customProperty = 0) { - GameNode3DOptionBuilder builder_(_fbb); - builder_.add_customProperty(customProperty); - builder_.add_frameEvent(frameEvent); - builder_.add_backFileData(backFileData); - builder_.add_forwardFileData(forwardFileData); - builder_.add_downFileData(downFileData); - builder_.add_upFileData(upFileData); - builder_.add_rightFileData(rightFileData); - builder_.add_leftFileData(leftFileData); - builder_.add_skyboxEnabled(skyBoxEnabled); - builder_.add_skyBoxMask(skyBoxMask); - builder_.add_name(name); - return builder_.Finish(); -} - struct Node3DOption : private flatbuffers::Table { const flatbuffers::WidgetOptions *nodeOptions() const { return GetPointer(4); } const Vector3 *position3D() const { return GetStruct(6); } @@ -232,6 +150,7 @@ struct Sprite3DOptions : private flatbuffers::Table { const Node3DOption *node3DOption() const { return GetPointer(4); } const flatbuffers::ResourceData *fileData() const { return GetPointer(6); } uint8_t runAction() const { return GetField(8, 0); } + uint8_t isFlipped() const { return GetField(10, 0); } bool Verify(flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && VerifyField(verifier, 4 /* node3DOption */) && @@ -239,6 +158,7 @@ struct Sprite3DOptions : private flatbuffers::Table { VerifyField(verifier, 6 /* fileData */) && verifier.VerifyTable(fileData()) && VerifyField(verifier, 8 /* runAction */) && + VerifyField(verifier, 10 /* isFlipped */) && verifier.EndTable(); } }; @@ -249,10 +169,11 @@ struct Sprite3DOptionsBuilder { void add_node3DOption(flatbuffers::Offset node3DOption) { fbb_.AddOffset(4, node3DOption); } void add_fileData(flatbuffers::Offset fileData) { fbb_.AddOffset(6, fileData); } void add_runAction(uint8_t runAction) { fbb_.AddElement(8, runAction, 0); } + void add_isFlipped(uint8_t isFlipped) { fbb_.AddElement(10, isFlipped, 0); } Sprite3DOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); } Sprite3DOptionsBuilder &operator=(const Sprite3DOptionsBuilder &); flatbuffers::Offset Finish() { - auto o = flatbuffers::Offset(fbb_.EndTable(start_, 3)); + auto o = flatbuffers::Offset(fbb_.EndTable(start_, 4)); return o; } }; @@ -260,10 +181,12 @@ struct Sprite3DOptionsBuilder { inline flatbuffers::Offset CreateSprite3DOptions(flatbuffers::FlatBufferBuilder &_fbb, flatbuffers::Offset node3DOption = 0, flatbuffers::Offset fileData = 0, - uint8_t runAction = 0) { + uint8_t runAction = 0, + uint8_t isFlipped = 0) { Sprite3DOptionsBuilder builder_(_fbb); builder_.add_fileData(fileData); builder_.add_node3DOption(node3DOption); + builder_.add_isFlipped(isFlipped); builder_.add_runAction(runAction); return builder_.Finish(); } @@ -310,12 +233,12 @@ struct UserCameraOptions : private flatbuffers::Table { float farClip() const { return GetField(10, 1000); } int32_t cameraFlag() const { return GetField(12, 0); } uint8_t skyBoxEnabled() const { return GetField(14, 0); } - const ResourceData *leftFileData() const { return GetPointer(16); } - const ResourceData *rightFileData() const { return GetPointer(18); } - const ResourceData *upFileData() const { return GetPointer(20); } - const ResourceData *downFileData() const { return GetPointer(22); } - const ResourceData *forwardFileData() const { return GetPointer(24); } - const ResourceData *backFileData() const { return GetPointer(26); } + const flatbuffers::ResourceData *leftFileData() const { return GetPointer(16); } + const flatbuffers::ResourceData *rightFileData() const { return GetPointer(18); } + const flatbuffers::ResourceData *upFileData() const { return GetPointer(20); } + const flatbuffers::ResourceData *downFileData() const { return GetPointer(22); } + const flatbuffers::ResourceData *forwardFileData() const { return GetPointer(24); } + const flatbuffers::ResourceData *backFileData() const { return GetPointer(26); } bool Verify(flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && VerifyField(verifier, 4 /* node3DOption */) && @@ -349,13 +272,13 @@ struct UserCameraOptionsBuilder { void add_nearClip(float nearClip) { fbb_.AddElement(8, nearClip, 1); } void add_farClip(float farClip) { fbb_.AddElement(10, farClip, 1000); } void add_cameraFlag(int32_t cameraFlag) { fbb_.AddElement(12, cameraFlag, 0); } - void add_skyboxEnabled(uint8_t skyBoxEnabled) { fbb_.AddElement(14, skyBoxEnabled, 0); } - void add_leftFileData(flatbuffers::Offset leftFileData) { fbb_.AddOffset(16, leftFileData); } - void add_rightFileData(flatbuffers::Offset rightFileData) { fbb_.AddOffset(18, rightFileData); } - void add_upFileData(flatbuffers::Offset upFileData) { fbb_.AddOffset(20, upFileData); } - void add_downFileData(flatbuffers::Offset downFileData) { fbb_.AddOffset(22, downFileData); } - void add_forwardFileData(flatbuffers::Offset forwardFileData) { fbb_.AddOffset(24, forwardFileData); } - void add_backFileData(flatbuffers::Offset backFileData) { fbb_.AddOffset(26, backFileData); } + void add_skyBoxEnabled(uint8_t skyBoxEnabled) { fbb_.AddElement(14, skyBoxEnabled, 0); } + void add_leftFileData(flatbuffers::Offset leftFileData) { fbb_.AddOffset(16, leftFileData); } + void add_rightFileData(flatbuffers::Offset rightFileData) { fbb_.AddOffset(18, rightFileData); } + void add_upFileData(flatbuffers::Offset upFileData) { fbb_.AddOffset(20, upFileData); } + void add_downFileData(flatbuffers::Offset downFileData) { fbb_.AddOffset(22, downFileData); } + void add_forwardFileData(flatbuffers::Offset forwardFileData) { fbb_.AddOffset(24, forwardFileData); } + void add_backFileData(flatbuffers::Offset backFileData) { fbb_.AddOffset(26, backFileData); } UserCameraOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); } UserCameraOptionsBuilder &operator=(const UserCameraOptionsBuilder &); flatbuffers::Offset Finish() { @@ -371,12 +294,12 @@ inline flatbuffers::Offset CreateUserCameraOptions(flatbuffer float farClip = 1000, int32_t cameraFlag = 0, uint8_t skyBoxEnabled = 0, - flatbuffers::Offset leftFileData = 0, - flatbuffers::Offset rightFileData = 0, - flatbuffers::Offset upFileData = 0, - flatbuffers::Offset downFileData = 0, - flatbuffers::Offset forwardFileData = 0, - flatbuffers::Offset backFileData = 0) { + flatbuffers::Offset leftFileData = 0, + flatbuffers::Offset rightFileData = 0, + flatbuffers::Offset upFileData = 0, + flatbuffers::Offset downFileData = 0, + flatbuffers::Offset forwardFileData = 0, + flatbuffers::Offset backFileData = 0) { UserCameraOptionsBuilder builder_(_fbb); builder_.add_backFileData(backFileData); builder_.add_forwardFileData(forwardFileData); @@ -384,12 +307,99 @@ inline flatbuffers::Offset CreateUserCameraOptions(flatbuffer builder_.add_upFileData(upFileData); builder_.add_rightFileData(rightFileData); builder_.add_leftFileData(leftFileData); - builder_.add_skyboxEnabled(skyBoxEnabled); builder_.add_cameraFlag(cameraFlag); builder_.add_farClip(farClip); builder_.add_nearClip(nearClip); builder_.add_fov(fov); builder_.add_node3DOption(node3DOption); + builder_.add_skyBoxEnabled(skyBoxEnabled); + return builder_.Finish(); +} + +struct GameNode3DOption : private flatbuffers::Table { + const flatbuffers::String *name() const { return GetPointer(4); } + int32_t skyBoxMask() const { return GetField(6, 0); } + uint8_t skyBoxEnabled() const { return GetField(8, 0); } + const flatbuffers::ResourceData *leftFileData() const { return GetPointer(10); } + const flatbuffers::ResourceData *rightFileData() const { return GetPointer(12); } + const flatbuffers::ResourceData *upFileData() const { return GetPointer(14); } + const flatbuffers::ResourceData *downFileData() const { return GetPointer(16); } + const flatbuffers::ResourceData *forwardFileData() const { return GetPointer(18); } + const flatbuffers::ResourceData *backFileData() const { return GetPointer(20); } + const flatbuffers::String *frameEvent() const { return GetPointer(22); } + const flatbuffers::String *customProperty() const { return GetPointer(24); } + bool Verify(flatbuffers::Verifier &verifier) const { + return VerifyTableStart(verifier) && + VerifyField(verifier, 4 /* name */) && + verifier.Verify(name()) && + VerifyField(verifier, 6 /* skyBoxMask */) && + VerifyField(verifier, 8 /* skyBoxEnabled */) && + VerifyField(verifier, 10 /* leftFileData */) && + verifier.VerifyTable(leftFileData()) && + VerifyField(verifier, 12 /* rightFileData */) && + verifier.VerifyTable(rightFileData()) && + VerifyField(verifier, 14 /* upFileData */) && + verifier.VerifyTable(upFileData()) && + VerifyField(verifier, 16 /* downFileData */) && + verifier.VerifyTable(downFileData()) && + VerifyField(verifier, 18 /* forwardFileData */) && + verifier.VerifyTable(forwardFileData()) && + VerifyField(verifier, 20 /* backFileData */) && + verifier.VerifyTable(backFileData()) && + VerifyField(verifier, 22 /* frameEvent */) && + verifier.Verify(frameEvent()) && + VerifyField(verifier, 24 /* customProperty */) && + verifier.Verify(customProperty()) && + verifier.EndTable(); + } +}; + +struct GameNode3DOptionBuilder { + flatbuffers::FlatBufferBuilder &fbb_; + flatbuffers::uoffset_t start_; + void add_name(flatbuffers::Offset name) { fbb_.AddOffset(4, name); } + void add_skyBoxMask(int32_t skyBoxMask) { fbb_.AddElement(6, skyBoxMask, 0); } + void add_skyBoxEnabled(uint8_t skyBoxEnabled) { fbb_.AddElement(8, skyBoxEnabled, 0); } + void add_leftFileData(flatbuffers::Offset leftFileData) { fbb_.AddOffset(10, leftFileData); } + void add_rightFileData(flatbuffers::Offset rightFileData) { fbb_.AddOffset(12, rightFileData); } + void add_upFileData(flatbuffers::Offset upFileData) { fbb_.AddOffset(14, upFileData); } + void add_downFileData(flatbuffers::Offset downFileData) { fbb_.AddOffset(16, downFileData); } + void add_forwardFileData(flatbuffers::Offset forwardFileData) { fbb_.AddOffset(18, forwardFileData); } + void add_backFileData(flatbuffers::Offset backFileData) { fbb_.AddOffset(20, backFileData); } + void add_frameEvent(flatbuffers::Offset frameEvent) { fbb_.AddOffset(22, frameEvent); } + void add_customProperty(flatbuffers::Offset customProperty) { fbb_.AddOffset(24, customProperty); } + GameNode3DOptionBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); } + GameNode3DOptionBuilder &operator=(const GameNode3DOptionBuilder &); + flatbuffers::Offset Finish() { + auto o = flatbuffers::Offset(fbb_.EndTable(start_, 11)); + return o; + } +}; + +inline flatbuffers::Offset CreateGameNode3DOption(flatbuffers::FlatBufferBuilder &_fbb, + flatbuffers::Offset name = 0, + int32_t skyBoxMask = 0, + uint8_t skyBoxEnabled = 0, + flatbuffers::Offset leftFileData = 0, + flatbuffers::Offset rightFileData = 0, + flatbuffers::Offset upFileData = 0, + flatbuffers::Offset downFileData = 0, + flatbuffers::Offset forwardFileData = 0, + flatbuffers::Offset backFileData = 0, + flatbuffers::Offset frameEvent = 0, + flatbuffers::Offset customProperty = 0) { + GameNode3DOptionBuilder builder_(_fbb); + builder_.add_customProperty(customProperty); + builder_.add_frameEvent(frameEvent); + builder_.add_backFileData(backFileData); + builder_.add_forwardFileData(forwardFileData); + builder_.add_downFileData(downFileData); + builder_.add_upFileData(upFileData); + builder_.add_rightFileData(rightFileData); + builder_.add_leftFileData(leftFileData); + builder_.add_skyBoxMask(skyBoxMask); + builder_.add_name(name); + builder_.add_skyBoxEnabled(skyBoxEnabled); return builder_.Finish(); } diff --git a/cocos/editor-support/cocostudio/WidgetReader/Sprite3DReader/Sprite3DReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/Sprite3DReader/Sprite3DReader.cpp index 48ea48db4c..b9a7e588e8 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/Sprite3DReader/Sprite3DReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/Sprite3DReader/Sprite3DReader.cpp @@ -109,6 +109,7 @@ namespace cocostudio bool runAction = false; std::string path; int resourceType = 0; + bool isFlipped = false; std::string attriname; const tinyxml2::XMLAttribute* attribute = objectData->FirstAttribute(); @@ -120,7 +121,10 @@ namespace cocostudio if(attriname == "RunAction3D") { runAction = value == "True" ? true : false; - break; + } + else if (attriname == "IsFlipped") + { + isFlipped = value == "True" ? true : false; } attribute = attribute->Next(); @@ -170,7 +174,8 @@ namespace cocostudio builder->CreateString(path), builder->CreateString(""), resourceType), - runAction + runAction, + isFlipped ); return *(Offset*)(&options); @@ -184,6 +189,7 @@ namespace cocostudio auto options = (Sprite3DOptions*)sprite3DOptions; bool runAction = options->runAction() != 0; + bool isFlipped = options->isFlipped() != 0; auto fileData = options->fileData(); std::string path = fileData->path()->c_str(); @@ -213,6 +219,11 @@ namespace cocostudio { sprite3D->setColor(Color3B(red, green, blue)); } + if (isFlipped) + { + sprite3D->setCullFaceEnabled(true); + sprite3D->setCullFace(GL_FRONT); + } auto node3DReader = Node3DReader::getInstance(); node3DReader->setPropsWithFlatBuffers(sprite3D, (Table*)(options->node3DOption())); @@ -230,7 +241,7 @@ namespace cocostudio { ret->initWithFile(path); } - + setPropsWithFlatBuffers(ret, sprite3DOptions); return ret; diff --git a/cocos/editor-support/cocostudio/WidgetReader/TextReader/TextReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/TextReader/TextReader.cpp index 173aeac4f9..962ad2b66f 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/TextReader/TextReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/TextReader/TextReader.cpp @@ -400,54 +400,33 @@ namespace cocostudio bool touchScaleEnabled = options->touchScaleEnable() != 0; label->setTouchScaleChangeEnabled(touchScaleEnabled); - std::string text = options->text()->c_str(); - label->setString(text); - int fontSize = options->fontSize(); label->setFontSize(fontSize); - - std::string fontName = options->fontName()->c_str(); - label->setFontName(fontName); - + Size areaSize = Size(options->areaWidth(), options->areaHeight()); if (!areaSize.equals(Size::ZERO)) { label->setTextAreaSize(areaSize); } + + auto resourceData = options->fontResource(); + std::string path = resourceData->path()->c_str(); + if (!path.empty() && FileUtils::getInstance()->isFileExist(path)) + { + label->setFontName(path); + } + else + { + std::string fontName = options->fontName()->c_str(); + label->setFontName(fontName); + } TextHAlignment h_alignment = (TextHAlignment)options->hAlignment(); label->setTextHorizontalAlignment(h_alignment); - + TextVAlignment v_alignment = (TextVAlignment)options->vAlignment(); label->setTextVerticalAlignment((TextVAlignment)v_alignment); - - bool fileExist = false; - std::string errorFilePath = ""; - auto resourceData = options->fontResource(); - std::string path = resourceData->path()->c_str(); - if (path != "") - { - if (FileUtils::getInstance()->isFileExist(path)) - { - fileExist = true; - } - else - { - errorFilePath = path; - fileExist = false; - } - if (fileExist) - { - label->setFontName(path); - } - //else - //{ - // auto alert = Label::create(); - // alert->setString(__String::createWithFormat("%s missed", errorFilePath.c_str())->getCString()); - // label->addChild(alert); - //} - } - + bool outlineEnabled = options->outlineEnabled() != 0; if (outlineEnabled) { @@ -470,6 +449,9 @@ namespace cocostudio } } + std::string text = options->text()->c_str(); + label->setString(text); + // Save node color before set widget properties auto oldColor = node->getColor(); @@ -494,7 +476,6 @@ namespace cocostudio Size contentSize(widgetOptions->size()->width(), widgetOptions->size()->height()); label->setContentSize(contentSize); } - } Node* TextReader::createNodeWithFlatBuffers(const flatbuffers::Table *textOptions) diff --git a/cocos/network/Android.mk b/cocos/network/Android.mk index 9f599ce89a..835af9b73b 100644 --- a/cocos/network/Android.mk +++ b/cocos/network/Android.mk @@ -9,7 +9,7 @@ LOCAL_SRC_FILES := HttpClient-android.cpp \ SocketIO.cpp \ WebSocket.cpp \ CCDownloader.cpp \ -CCDownloaderImpl.cpp +CCDownloader-android.cpp LOCAL_EXPORT_C_INCLUDES := diff --git a/cocos/network/CCDownloader-android.cpp b/cocos/network/CCDownloader-android.cpp new file mode 100644 index 0000000000..bc2db212bb --- /dev/null +++ b/cocos/network/CCDownloader-android.cpp @@ -0,0 +1,248 @@ +/**************************************************************************** + Copyright (c) 2015 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. + ****************************************************************************/ + +#include "network/CCDownloader-android.h" + +#include "network/CCDownloader.h" +#include "platform/android/jni/JniHelper.h" + +#define JCLS_DOWNLOADER "org/cocos2dx/lib/Cocos2dxDownloader" +#define JCLS_TASK "com/loopj/android/http/RequestHandle" +#define JARG_STR "Ljava/lang/String;" +#define JARG_DOWNLOADER "L" JCLS_DOWNLOADER ";" +#define JARG_TASK "L" JCLS_TASK ";" + +using namespace std; + +static bool _registerNativeMethods(JNIEnv* env); + +unordered_map sDownloaderMap; + +namespace cocos2d { namespace network { + + static int sTaskCounter; + static int sDownloaderCounter; + + struct DownloadTaskAndroid : public IDownloadTask + { + DownloadTaskAndroid() + :id(++sTaskCounter) + { + DLLOG("Construct DownloadTaskAndroid: %p", this); + } + virtual ~DownloadTaskAndroid() + { + + DLLOG("Destruct DownloadTaskAndroid: %p", this); + } + + int id; + shared_ptr task; // reference to DownloadTask, when task finish, release + }; + + DownloaderAndroid::DownloaderAndroid(const DownloaderHints& hints) + : _id(++sDownloaderCounter) + , _impl(nullptr) + { + // use local static variable make sure native methods registered once + static bool _registered = _registerNativeMethods(JniHelper::getEnv()); + DLLOG("Construct DownloaderAndroid: %p", this); + JniMethodInfo methodInfo; + if (JniHelper::getStaticMethodInfo(methodInfo, + JCLS_DOWNLOADER, + "createDownloader", + "(II" JARG_STR ")" JARG_DOWNLOADER)) + { + jobject jStr = methodInfo.env->NewStringUTF(hints.tempFileNameSuffix.c_str()); + jobject jObj = methodInfo.env->CallStaticObjectMethod( + methodInfo.classID, + methodInfo.methodID, + _id, + hints.timeoutInSeconds, + jStr + ); + _impl = methodInfo.env->NewGlobalRef(jObj); + DLLOG("android downloader: jObj: %p, _impl: %p", jObj, _impl); + sDownloaderMap.insert(make_pair(_id, this)); + methodInfo.env->DeleteLocalRef(jStr); + methodInfo.env->DeleteLocalRef(jObj); + methodInfo.env->DeleteLocalRef(methodInfo.classID); + } + } + + DownloaderAndroid::~DownloaderAndroid() + { + if(_impl != nullptr) + { + JniMethodInfo methodInfo; + if (JniHelper::getStaticMethodInfo(methodInfo, + JCLS_DOWNLOADER, + "cancelAllRequests", + "(" JARG_DOWNLOADER ")V")) + { + methodInfo.env->CallStaticVoidMethod( + methodInfo.classID, + methodInfo.methodID, + _impl + ); + methodInfo.env->DeleteLocalRef(methodInfo.classID); + } + sDownloaderMap.erase(_id); + JniHelper::getEnv()->DeleteGlobalRef(_impl); + } + DLLOG("Destruct DownloaderAndroid: %p", this); + } + + IDownloadTask *DownloaderAndroid::createCoTask(std::shared_ptr& task) + { + DownloadTaskAndroid *coTask = new DownloadTaskAndroid; + coTask->task = task; + + JniMethodInfo methodInfo; + if (JniHelper::getStaticMethodInfo(methodInfo, + JCLS_DOWNLOADER, + "createTask", + "(" JARG_DOWNLOADER "I" JARG_STR JARG_STR")V")) + { + jstring jstrURL = methodInfo.env->NewStringUTF(task->requestURL.c_str()); + jstring jstrPath= methodInfo.env->NewStringUTF(task->storagePath.c_str()); + methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, _impl, coTask->id, jstrURL, jstrPath); + methodInfo.env->DeleteLocalRef(jstrURL); + methodInfo.env->DeleteLocalRef(jstrPath); + methodInfo.env->DeleteLocalRef(methodInfo.classID); + } + + DLLOG("DownloaderAndroid::createCoTask id: %d", coTask->id); + _taskMap.insert(make_pair(coTask->id, coTask)); + return coTask; + } + + void DownloaderAndroid::_onProcess(int taskId, int64_t dl, int64_t dlNow, int64_t dlTotal) + { + DLLOG("DownloaderAndroid::onProgress(taskId: %d, dl: %lld, dlnow: %lld, dltotal: %lld)", taskId, dl, dlNow, dlTotal); + auto iter = _taskMap.find(taskId); + if (_taskMap.end() == iter) + { + DLLOG("DownloaderAndroid::onProgress can't find task with id: %d", taskId); + return; + } + DownloadTaskAndroid *coTask = iter->second; + function transferDataToBuffer; + onTaskProgress(*coTask->task, dl, dlNow, dlTotal, transferDataToBuffer); + } + + void DownloaderAndroid::_onFinish(int taskId, int errCode, const char *errStr, vector& data) + { + DLLOG("DownloaderAndroid::_onFinish(taskId: %d, errCode: %d, errStr: %s)", taskId, errCode, (errStr)?errStr:"null"); + auto iter = _taskMap.find(taskId); + if (_taskMap.end() == iter) + { + DLLOG("DownloaderAndroid::_onFinish can't find task with id: %d", taskId); + return; + } + DownloadTaskAndroid *coTask = iter->second; + string str = (errStr ? errStr : ""); + onTaskFinish(*coTask->task, + errStr ? DownloadTask::ERROR_IMPL_INTERNAL : DownloadTask::ERROR_NO_ERROR, + errCode, + str, + data + ); + coTask->task.reset(); + _taskMap.erase(iter); + } + } +} // namespace cocos2d::network + +static void _nativeOnProgress(JNIEnv *env, jclass clazz, jint id, jint taskId, jlong dl, jlong dlnow, jlong dltotal) +{ + DLLOG("_nativeOnProgress(id: %d, taskId: %d, dl: %lld, dlnow: %lld, dltotal: %lld)", id, taskId, dl, dlnow, dltotal); + auto iter = sDownloaderMap.find(id); + if (sDownloaderMap.end() == iter) + { + DLLOG("_nativeOnProgress can't find downloader by key: %p for task: %d", clazz, id); + return; + } + cocos2d::network::DownloaderAndroid *downloader = iter->second; + downloader->_onProcess((int)taskId, (int64_t)dl, (int64_t)dlnow, (int64_t)dltotal); +} + +static void _nativeOnFinish(JNIEnv *env, jclass clazz, jint id, jint taskId, jint errCode, jstring errStr, jbyteArray data) +{ + DLLOG("_nativeOnFinish(id: %d, taskId: %d)", id, taskId); + auto iter = sDownloaderMap.find(id); + if (sDownloaderMap.end() == iter) + { + DLLOG("_nativeOnFinish can't find downloader id: %d for task: %d", id, taskId); + return; + } + cocos2d::network::DownloaderAndroid *downloader = iter->second; + vector buf; + if (errStr) + { + // failure + const char *nativeErrStr = env->GetStringUTFChars(errStr, JNI_FALSE); + downloader->_onFinish((int)taskId, (int)errCode, nativeErrStr, buf); + env->ReleaseStringUTFChars(errStr, nativeErrStr); + return; + } + + // success + if (data) + { + int len = env->GetArrayLength(data); + if (len) + { + buf.reserve(len); + buf.resize(len); + env->GetByteArrayRegion(data, 0, len, reinterpret_cast(buf.data())); + } + } + downloader->_onFinish((int)taskId, (int)errCode, nullptr, buf); +} + +static JNINativeMethod sMethodTable[] = { + { "nativeOnProgress", "(IIJJJ)V", (void*)_nativeOnProgress }, + { "nativeOnFinish", "(III" JARG_STR "[B)V", (void*)_nativeOnFinish }, +}; + +static bool _registerNativeMethods(JNIEnv* env) +{ + jclass clazz = env->FindClass(JCLS_DOWNLOADER); + if (clazz == NULL) + { + DLLOG("_registerNativeMethods: can't find java class:%s", JARG_DOWNLOADER); + return false; + } + if (JNI_OK != env->RegisterNatives(clazz, sMethodTable, sizeof(sMethodTable) / sizeof(sMethodTable[0]))) + { + DLLOG("_registerNativeMethods: failed"); + if (env->ExceptionCheck()) + { + env->ExceptionClear(); + } + return false; + } + return true; +} \ No newline at end of file diff --git a/cocos/network/CCDownloader-android.h b/cocos/network/CCDownloader-android.h new file mode 100644 index 0000000000..75f5a3a74e --- /dev/null +++ b/cocos/network/CCDownloader-android.h @@ -0,0 +1,54 @@ +/**************************************************************************** + Copyright (c) 2015 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. + ****************************************************************************/ + +#pragma once + +#include "network/CCIDownloaderImpl.h" + +class _jobject; + +namespace cocos2d { namespace network + { + class DownloadTaskAndroid; + class DownloaderHints; + + class DownloaderAndroid : public IDownloaderImpl + { + public: + DownloaderAndroid(const DownloaderHints& hints); + virtual ~DownloaderAndroid(); + + virtual IDownloadTask *createCoTask(std::shared_ptr& task) override; + + // designed called by internal + void _onProcess(int taskId, int64_t dl, int64_t dlNow, int64_t dlTotal); + void _onFinish(int taskId, int errCode, const char *errStr, std::vector& data); + protected: + int _id; + _jobject* _impl; + std::unordered_map _taskMap; + }; + + }} // namespace cocos2d::network + diff --git a/cocos/network/CCDownloader-apple.h b/cocos/network/CCDownloader-apple.h new file mode 100644 index 0000000000..7f59d0c52d --- /dev/null +++ b/cocos/network/CCDownloader-apple.h @@ -0,0 +1,44 @@ +/**************************************************************************** + Copyright (c) 2015 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. + ****************************************************************************/ + +#pragma once + +#include "network/CCIDownloaderImpl.h" + +namespace cocos2d { namespace network +{ + class DownloaderHints; + class DownloaderApple : public IDownloaderImpl + { + public: + DownloaderApple(const DownloaderHints& hints); + virtual ~DownloaderApple(); + + virtual IDownloadTask *createCoTask(std::shared_ptr& task) override; + + private: + void* _impl; + }; +}} // namespace cocos2d::network + diff --git a/cocos/network/CCDownloader-apple.mm b/cocos/network/CCDownloader-apple.mm new file mode 100644 index 0000000000..5b5045e2a8 --- /dev/null +++ b/cocos/network/CCDownloader-apple.mm @@ -0,0 +1,555 @@ +/**************************************************************************** + Copyright (c) 2015 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. + ****************************************************************************/ + +#include "network/CCDownloader-apple.h" + +#include "network/CCDownloader.h" + +//////////////////////////////////////////////////////////////////////////////// +// OC Classes Declaration +#import + +// this wrapper used to wrap C++ class DownloadTask into NSMutableDictionary +@interface DownloadTaskWrapper : NSObject +{ + std::shared_ptr _task; + NSMutableArray *_dataArray; +} +// temp vars for dataTask: didReceivedData callback +@property (nonatomic) int64_t bytesReceived; +@property (nonatomic) int64_t totalBytesReceived; + +-(id)init:(std::shared_ptr&)t; +-(const cocos2d::network::DownloadTask *)get; +-(void) addData:(NSData*) data; +-(int64_t) transferDataToBuffer:(void*)buffer lengthOfBuffer:(int64_t)len; + +@end + +@interface DownloaderAppleImpl : NSObject +{ + const cocos2d::network::DownloaderApple *_outer; + cocos2d::network::DownloaderHints _hints; +} +@property (nonatomic, strong) NSURLSession *downloadSession; +@property (nonatomic, strong) NSMutableDictionary *taskDict; // ocTask: DownloadTaskWrapper + +-(id)init:(const cocos2d::network::DownloaderApple *)o hints:(const cocos2d::network::DownloaderHints&) hints; +-(const cocos2d::network::DownloaderHints&)getHints; +-(NSURLSessionDataTask *)createDataTask:(std::shared_ptr&) task; +-(NSURLSessionDownloadTask *)createFileTask:(std::shared_ptr&) task; +-(void)doDestory; + +@end + +//////////////////////////////////////////////////////////////////////////////// +// C++ Classes Implementation + +namespace cocos2d { namespace network { + + struct DownloadTaskApple : public IDownloadTask + { + DownloadTaskApple() + : dataTask(nil) + , downloadTask(nil) + { + DLLOG("Construct DownloadTaskApple %p", this); + } + + virtual ~DownloadTaskApple() + { + DLLOG("Destruct DownloadTaskApple %p", this); + } + + NSURLSessionDataTask *dataTask; + NSURLSessionDownloadTask *downloadTask; + }; +#define DeclareDownloaderImplVar DownloaderAppleImpl *impl = (__bridge DownloaderAppleImpl *)_impl + // the _impl's type is id, we should convert it to subclass before call it's methods + DownloaderApple::DownloaderApple(const DownloaderHints& hints) + : _impl(nil) + { + DLLOG("Construct DownloaderApple %p", this); + _impl = (__bridge void*)[[DownloaderAppleImpl alloc] init: this hints:hints]; + } + + DownloaderApple::~DownloaderApple() + { + DeclareDownloaderImplVar; + [impl doDestory]; + DLLOG("Destruct DownloaderApple %p", this); + } + IDownloadTask *DownloaderApple::createCoTask(std::shared_ptr& task) + { + DownloadTaskApple* coTask = new DownloadTaskApple(); + DeclareDownloaderImplVar; + if (task->storagePath.length()) + { + coTask->downloadTask = [impl createFileTask:task]; + } + else + { + coTask->dataTask = [impl createDataTask:task]; + } + return coTask; + } +}} // namespace cocos2d::network + +//////////////////////////////////////////////////////////////////////////////// +// OC Classes Implementation +@implementation DownloadTaskWrapper + +- (id)init: (std::shared_ptr&)t +{ + DLLOG("Construct DonloadTaskWrapper %p", self); + _dataArray = [NSMutableArray arrayWithCapacity:8]; + [_dataArray retain]; + _task = t; + return self; +} + +-(const cocos2d::network::DownloadTask *)get +{ + return _task.get(); +} + +-(void) addData:(NSData*) data +{ + [_dataArray addObject:data]; + self.bytesReceived += data.length; + self.totalBytesReceived += data.length; +} + +-(int64_t) transferDataToBuffer:(void*)buffer lengthOfBuffer:(int64_t)len +{ + int64_t bytesReceived = 0; + int receivedDataObject = 0; + + __block char *p = (char *)buffer; + for (NSData* data in _dataArray) + { + // check + if (bytesReceived + data.length > len) + { + break; + } + + // copy data + [data enumerateByteRangesUsingBlock:^(const void *bytes, + NSRange byteRange, + BOOL *stop) + { + memcpy(p, bytes, byteRange.length); + p += byteRange.length; + *stop = NO; + }]; + + // accumulate + bytesReceived += data.length; + ++receivedDataObject; + } + + // remove receivedNSDataObject from dataArray + [_dataArray removeObjectsInRange:NSMakeRange(0, receivedDataObject)]; + self.bytesReceived -= bytesReceived; + return bytesReceived; +} + +-(void)dealloc +{ + [_dataArray release]; + [super dealloc]; + DLLOG("Destruct DownloadTaskWrapper %p", self); +} + +@end + +@implementation DownloaderAppleImpl + +- (id)init: (const cocos2d::network::DownloaderApple*)o hints:(const cocos2d::network::DownloaderHints&) hints +{ + DLLOG("Construct DownloaderAppleImpl %p", self); + // save outer task ref + _outer = o; + _hints = hints; + + // create task dictionary + self.taskDict = [NSMutableDictionary dictionary]; + + // create download session + NSURLSessionConfiguration *defaultConfig = [NSURLSessionConfiguration defaultSessionConfiguration]; + self.downloadSession = [NSURLSession sessionWithConfiguration:defaultConfig delegate:self delegateQueue:[NSOperationQueue mainQueue]]; +// self.downloadSession.sessionDescription = kCurrentSession; + return self; +} + +-(const cocos2d::network::DownloaderHints&)getHints +{ + return _hints; +} + +-(NSURLSessionDataTask *)createDataTask:(std::shared_ptr&) task +{ + const char *urlStr = task->requestURL.c_str(); + DLLOG("DownloaderAppleImpl createDataTask: %s", urlStr); + NSURL *url = [NSURL URLWithString:[NSString stringWithUTF8String:urlStr]]; + NSURLRequest *request = nil; + if (_hints.timeoutInSeconds > 0) + { + request = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:(NSTimeInterval)_hints.timeoutInSeconds]; + } + else + { + request = [NSURLRequest requestWithURL:url]; + } + NSURLSessionDataTask *ocTask = [self.downloadSession dataTaskWithRequest:request]; + [self.taskDict setObject:[[DownloadTaskWrapper alloc] init:task] forKey:ocTask]; + [ocTask resume]; + return ocTask; +}; + +-(NSURLSessionDownloadTask *)createFileTask:(std::shared_ptr&) task +{ + const char *urlStr = task->requestURL.c_str(); + DLLOG("DownloaderAppleImpl createDataTask: %s", urlStr); + NSURL *url = [NSURL URLWithString:[NSString stringWithUTF8String:urlStr]]; + NSURLRequest *request = nil; + if (_hints.timeoutInSeconds > 0) + { + request = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:(NSTimeInterval)_hints.timeoutInSeconds]; + } + else + { + request = [NSURLRequest requestWithURL:url]; + } + NSString *tempFilePath = [NSString stringWithFormat:@"%s%s", task->storagePath.c_str(), _hints.tempFileNameSuffix.c_str()]; + NSData *resumeData = [NSData dataWithContentsOfFile:tempFilePath]; + NSURLSessionDownloadTask *ocTask = nil; + if (resumeData) + { + ocTask = [self.downloadSession downloadTaskWithResumeData:resumeData]; + } + else + { + ocTask = [self.downloadSession downloadTaskWithRequest:request]; + } + [self.taskDict setObject:[[DownloadTaskWrapper alloc] init:task] forKey:ocTask]; + [ocTask resume]; + return ocTask; +}; + +-(void)doDestory +{ + // cancel all download task + NSEnumerator * enumeratorKey = [self.taskDict keyEnumerator]; + for (NSURLSessionDownloadTask *task in enumeratorKey) + { + DownloadTaskWrapper *wrapper = [self.taskDict objectForKey:task]; + NSString *tempFilePath = [NSString stringWithFormat:@"%s%s", [wrapper get]->storagePath.c_str(), _hints.tempFileNameSuffix.c_str()]; + NSString *tempFileDir = [tempFilePath stringByDeletingLastPathComponent]; + NSFileManager *fileManager = [NSFileManager defaultManager]; + BOOL isDir = false; + if ([fileManager fileExistsAtPath:tempFileDir isDirectory:&isDir]) + { + if (NO == isDir) + { + // TODO: the directory is a file, not a directory, how to echo to developer? + continue; + } + } + else + { + NSURL *tempFileURL = [NSURL fileURLWithPath:tempFileDir]; + if (NO == [fileManager createDirectoryAtURL:tempFileURL withIntermediateDirectories:YES attributes:nil error:nil]) + { + // create directory failed + continue; + } + } + [task cancelByProducingResumeData:^(NSData *resumeData) { + if (resumeData) + { + [resumeData writeToFile:tempFilePath atomically:YES]; + } + }]; + } + _outer = nullptr; + + [self.downloadSession invalidateAndCancel]; + [self release]; +} + +-(void)dealloc +{ + [super dealloc]; + DLLOG("Destruct DownloaderAppleImpl %p", self); +} +#pragma mark - NSURLSessionTaskDelegate methods + +//@optional + +/* An HTTP request is attempting to perform a redirection to a different + * URL. You must invoke the completion routine to allow the + * redirection, allow the redirection with a modified request, or + * pass nil to the completionHandler to cause the body of the redirection + * response to be delivered as the payload of this request. The default + * is to follow redirections. + * + * For tasks in background sessions, redirections will always be followed and this method will not be called. + */ +//- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task +//willPerformHTTPRedirection:(NSHTTPURLResponse *)response +// newRequest:(NSURLRequest *)request +// completionHandler:(void (^)(NSURLRequest *))completionHandler; + +/* The task has received a request specific authentication challenge. + * If this delegate is not implemented, the session specific authentication challenge + * will *NOT* be called and the behavior will be the same as using the default handling + * disposition. + */ +//- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task +//didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge +// completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler; + +/* Sent if a task requires a new, unopened body stream. This may be + * necessary when authentication has failed for any request that + * involves a body stream. + */ +//- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task +// needNewBodyStream:(void (^)(NSInputStream *bodyStream))completionHandler; + +/* Sent periodically to notify the delegate of upload progress. This + * information is also available as properties of the task. + */ +//- (void)URLSession:(NSURLSession *)session task :(NSURLSessionTask *)task +// didSendBodyData:(int64_t)bytesSent +// totalBytesSent:(int64_t)totalBytesSent +// totalBytesExpectedToSend:(int64_t)totalBytesExpectedToSend; + +/* Sent as the last message related to a specific task. Error may be + * nil, which implies that no error occurred and this task is complete. + */ +- (void)URLSession:(NSURLSession *)session task :(NSURLSessionTask *)task + didCompleteWithError:(NSError *)error +{ + DLLOG("DownloaderAppleImpl task: \"%s\" didCompleteWithError: %d errDesc: %s" + , [task.originalRequest.URL.absoluteString cStringUsingEncoding:NSUTF8StringEncoding] + , (error ? (int)error.code: 0) + , [error.localizedDescription cStringUsingEncoding:NSUTF8StringEncoding]); + + // clean wrapper C++ object + DownloadTaskWrapper *wrapper = [self.taskDict objectForKey:task]; + + // if no error, callback has been called in finish task + if (_outer && error) + { + std::vector buf; // just a placeholder + _outer->onTaskFinish(*[wrapper get], + cocos2d::network::DownloadTask::ERROR_IMPL_INTERNAL, + (int)error.code, + [error.localizedDescription cStringUsingEncoding:NSUTF8StringEncoding], + buf); + } + [self.taskDict removeObjectForKey:task]; + [wrapper release]; +} + +#pragma mark - NSURLSessionDataDelegate methods +//@optional +/* The task has received a response and no further messages will be + * received until the completion block is called. The disposition + * allows you to cancel a request or to turn a data task into a + * download task. This delegate message is optional - if you do not + * implement it, you can get the response as a property of the task. + * + * This method will not be called for background upload tasks (which cannot be converted to download tasks). + */ +//- (void)URLSession:(NSURLSession *)session dataTask :(NSURLSessionDataTask *)dataTask +// didReceiveResponse:(NSURLResponse *)response +// completionHandler:(void (^)(NSURLSessionResponseDisposition disposition))completionHandler +//{ +// DLLOG("DownloaderAppleImpl dataTask: response:%s", [response.description cStringUsingEncoding:NSUTF8StringEncoding]); +// completionHandler(NSURLSessionResponseAllow); +//} + +/* Notification that a data task has become a download task. No + * future messages will be sent to the data task. + */ +//- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask +//didBecomeDownloadTask:(NSURLSessionDownloadTask *)downloadTask; + +/* Sent when data is available for the delegate to consume. It is + * assumed that the delegate will retain and not copy the data. As + * the data may be discontiguous, you should use + * [NSData enumerateByteRangesUsingBlock:] to access it. + */ +- (void)URLSession:(NSURLSession *)session dataTask :(NSURLSessionDataTask *)dataTask + didReceiveData:(NSData *)data +{ + DLLOG("DownloaderAppleImpl dataTask: \"%s\" didReceiveDataLen %d", + [dataTask.originalRequest.URL.absoluteString cStringUsingEncoding:NSUTF8StringEncoding], + (int)data.length); + if (nullptr == _outer) + { + return; + } + DownloadTaskWrapper *wrapper = [self.taskDict objectForKey:dataTask]; + [wrapper addData:data]; + + std::function transferDataToBuffer = + [wrapper](void *buffer, int64_t bufLen)->int64_t + { + return [wrapper transferDataToBuffer:buffer lengthOfBuffer: bufLen]; + }; + + _outer->onTaskProgress(*[wrapper get], + wrapper.bytesReceived, + wrapper.totalBytesReceived, + dataTask.countOfBytesExpectedToReceive, + transferDataToBuffer); +} + +/* Invoke the completion routine with a valid NSCachedURLResponse to + * allow the resulting data to be cached, or pass nil to prevent + * caching. Note that there is no guarantee that caching will be + * attempted for a given resource, and you should not rely on this + * message to receive the resource data. + */ +//- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask +// willCacheResponse:(NSCachedURLResponse *)proposedResponse +// completionHandler:(void (^)(NSCachedURLResponse *cachedResponse))completionHandler; + +#pragma mark - NSURLSessionDownloadDelegate methods + +/* Sent when a download task that has completed a download. The delegate should + * copy or move the file at the given location to a new location as it will be + * removed when the delegate message returns. URLSession:task:didCompleteWithError: will + * still be called. + */ +- (void)URLSession:(NSURLSession *)session downloadTask :(NSURLSessionDownloadTask *)downloadTask + didFinishDownloadingToURL:(NSURL *)location +{ + DLLOG("DownloaderAppleImpl downloadTask: \"%s\" didFinishDownloadingToURL %s", + [downloadTask.originalRequest.URL.absoluteString cStringUsingEncoding:NSUTF8StringEncoding], + [location.absoluteString cStringUsingEncoding:NSUTF8StringEncoding]); + if (nullptr == _outer) + { + return; + } + + DownloadTaskWrapper *wrapper = [self.taskDict objectForKey:downloadTask]; + const char * storagePath = [wrapper get]->storagePath.c_str(); + NSString *destPath = [NSString stringWithUTF8String:storagePath]; + NSFileManager *fileManager = [NSFileManager defaultManager]; + NSURL *destURL = nil; + + do + { + if ([destPath hasPrefix:@"file://"]) + { + break; + } + + if ('/' == [destPath characterAtIndex:0]) + { + // absolute path, need add prefix + NSString *prefix = @"file://"; + destURL = [NSURL URLWithString:[prefix stringByAppendingString: destPath]]; + break; + } + + // relative path, store to user domain default + NSArray *URLs = [fileManager URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask]; + NSURL *documentsDirectory = URLs[0]; + destURL = [documentsDirectory URLByAppendingPathComponent:destPath]; + } while (0); + + // Make sure we overwrite anything that's already there + [fileManager removeItemAtURL:destURL error:NULL]; + + // copy file to dest location + int errorCode = cocos2d::network::DownloadTask::ERROR_NO_ERROR; + int errorCodeInternal = 0; + std::string errorString; + + NSError *error = nil; + if ([fileManager copyItemAtURL:location toURL:destURL error:&error]) + { + // success, remove temp file if it exist + if (_hints.tempFileNameSuffix.length()) + { + NSString *tempStr = [[destURL absoluteString] stringByAppendingFormat:@"%s", _hints.tempFileNameSuffix.c_str()]; + NSURL *tempDestUrl = [NSURL URLWithString:tempStr]; + [fileManager removeItemAtURL:tempDestUrl error:NULL]; + } + } + else + { + errorCode = cocos2d::network::DownloadTask::ERROR_FILE_OP_FAILED; + if (error) + { + errorCodeInternal = (int)error.code; + errorString = [error.localizedDescription cStringUsingEncoding:NSUTF8StringEncoding]; + } + } + + std::vector buf; // just a placeholder + _outer->onTaskFinish(*[wrapper get], errorCode, errorCodeInternal, errorString, buf); +} + +// @optional +/* Sent periodically to notify the delegate of download progress. */ +- (void)URLSession:(NSURLSession *)session downloadTask :(NSURLSessionDownloadTask *)downloadTask + didWriteData:(int64_t)bytesWritten + totalBytesWritten:(int64_t)totalBytesWritten + totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite +{ +// NSLog(@"DownloaderAppleImpl downloadTask: \"%@\" received: %lld total: %lld", downloadTask.originalRequest.URL, totalBytesWritten, totalBytesExpectedToWrite); + + if (nullptr == _outer) + { + return; + } + + DownloadTaskWrapper *wrapper = [self.taskDict objectForKey:downloadTask]; + + std::function transferDataToBuffer; // just a placeholder + _outer->onTaskProgress(*[wrapper get], bytesWritten, totalBytesWritten, totalBytesExpectedToWrite, transferDataToBuffer); +} + +/* Sent when a download has been resumed. If a download failed with an + * error, the -userInfo dictionary of the error will contain an + * NSURLSessionDownloadTaskResumeData key, whose value is the resume + * data. + */ +- (void)URLSession:(NSURLSession *)session downloadTask :(NSURLSessionDownloadTask *)downloadTask + didResumeAtOffset:(int64_t)fileOffset + expectedTotalBytes:(int64_t)expectedTotalBytes +{ + NSLog(@"[TODO]DownloaderAppleImpl downloadTask: \"%@\" didResumeAtOffset: %lld", downloadTask.originalRequest.URL, fileOffset); + // 下载失败 +// self.downloadFail([self getDownloadRespose:XZDownloadFail identifier:self.identifier progress:0.00 downloadUrl:nil downloadSaveFileUrl:nil downloadData:nil downloadResult:@"下载失败"]); +} + +@end diff --git a/cocos/network/CCDownloader-curl.cpp b/cocos/network/CCDownloader-curl.cpp new file mode 100644 index 0000000000..60fc160daf --- /dev/null +++ b/cocos/network/CCDownloader-curl.cpp @@ -0,0 +1,854 @@ +/**************************************************************************** + Copyright (c) 2015 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. + ****************************************************************************/ + +#include "network/CCDownloader-curl.h" + +#include + +#include + +#include "base/CCDirector.h" +#include "base/CCScheduler.h" +#include "platform/CCFileUtils.h" +#include "network/CCDownloader.h" + +// **NOTE** +// In the file: +// member function with suffix "Proc" designed called in DownloaderCURL::_threadProc +// member function without suffix designed called in main thread + +namespace cocos2d { namespace network { + using namespace std; + +//////////////////////////////////////////////////////////////////////////////// +// Implementation DownloadTaskCURL + + class DownloadTaskCURL : public IDownloadTask + { + static int _sSerialId; + + // if more than one task write to one file, cause file broken + // so use a set to check this situation + static set _sStoragePathSet; + public: + int serialId; + + DownloadTaskCURL() + : serialId(_sSerialId++) + , _fp(nullptr) + { + _initInternal(); + DLLOG("Construct DownloadTaskCURL %p", this); + } + + virtual ~DownloadTaskCURL() + { + // if task destoried unnormally, we should release WritenFileName stored in set. + // Normally, this action should done when task finished. + if (_tempFileName.length() && _sStoragePathSet.end() != _sStoragePathSet.find(_tempFileName)) + { + DownloadTaskCURL::_sStoragePathSet.erase(_tempFileName); + } + if (_fp) + { + fclose(_fp); + _fp = nullptr; + } + DLLOG("Destruct DownloadTaskCURL %p", this); + } + + bool init(const string& filename, const string& tempSuffix) + { + if (0 == filename.length()) + { + // data task + _buf.reserve(CURL_MAX_WRITE_SIZE); + return true; + } + + // file task + _fileName = filename; + _tempFileName = filename; + _tempFileName.append(tempSuffix); + + if (_sStoragePathSet.end() != _sStoragePathSet.find(_tempFileName)) + { + // there is another task uses this storate path + _errCode = DownloadTask::ERROR_FILE_OP_FAILED; + _errCodeInternal = 0; + _errDescription = "More than one download file task write to same file:"; + _errDescription.append(_tempFileName); + return false; + } + _sStoragePathSet.insert(_tempFileName); + + // open temp file handle for write + bool ret = false; + do + { + string dir; + unsigned long found = _tempFileName.find_last_of("/\\"); + if (found == string::npos) + { + _errCode = DownloadTask::ERROR_INVALID_PARAMS; + _errCodeInternal = 0; + _errDescription = "Can't find dirname in storagePath."; + break; + } + + // ensure directory is exist + auto util = FileUtils::getInstance(); + dir = _tempFileName.substr(0, found+1); + if (false == util->isDirectoryExist(dir)) + { + if (false == util->createDirectory(dir)) + { + _errCode = DownloadTask::ERROR_FILE_OP_FAILED; + _errCodeInternal = 0; + _errDescription = "Can't create dir:"; + _errDescription.append(dir); + break; + } + } + + // open file + _fp = fopen(util->getSuitableFOpen(_tempFileName).c_str(), "ab"); + if (nullptr == _fp) + { + _errCode = DownloadTask::ERROR_FILE_OP_FAILED; + _errCodeInternal = 0; + _errDescription = "Can't open file:"; + _errDescription.append(_tempFileName); + } + ret = true; + } while (0); + + return ret; + } + + void initProc() + { + lock_guard lock(_mutex); + _initInternal(); + } + + void setErrorProc(int code, int codeInternal, const char *desc) + { + lock_guard lock(_mutex); + _errCode = code; + _errCodeInternal = codeInternal; + _errDescription = desc; + } + + size_t writeDataProc(unsigned char *buffer, size_t size, size_t count) + { + lock_guard lock(_mutex); + size_t ret = 0; + if (_fp) + { + ret = fwrite(buffer, size, count, _fp); + } + else + { + ret = size * count; + auto cap = _buf.capacity(); + auto bufSize = _buf.size(); + if (cap < bufSize + ret) + { + _buf.reserve(bufSize * 2); + } + _buf.insert(_buf.end() , buffer, buffer + ret); + } + if (ret) + { + _bytesReceived += ret; + _totalBytesReceived += ret; + } + return ret; + } + + private: + friend class DownloaderCURL; + + // for lock object instance + mutex _mutex; + + // header info + bool _acceptRanges; + bool _headerAchieved; + int64_t _totalBytesExpected; + + string _header; // temp buffer for receive header string, only used in thread proc + + // progress + int64_t _bytesReceived; + int64_t _totalBytesReceived; + + // error + int _errCode; + int _errCodeInternal; + string _errDescription; + + // for saving data + string _fileName; + string _tempFileName; + vector _buf; + FILE* _fp; + + void _initInternal() + { + _acceptRanges = (false); + _headerAchieved = (false); + _bytesReceived = (0); + _totalBytesReceived = (0); + _totalBytesExpected = (0); + _errCode = (DownloadTask::ERROR_NO_ERROR); + _errCodeInternal = (CURLE_OK); + _header.resize(0); + _header.reserve(384); // pre alloc header string buffer + } + }; + int DownloadTaskCURL::_sSerialId; + set DownloadTaskCURL::_sStoragePathSet; + + typedef pair< shared_ptr, DownloadTaskCURL *> TaskWrapper; + +//////////////////////////////////////////////////////////////////////////////// +// Implementation DownloaderCURL::Impl + // This class shared by DownloaderCURL and work thread. + class DownloaderCURL::Impl : public enable_shared_from_this + { + public: + DownloaderHints hints; + + Impl() +// : _thread(nullptr) + { + DLLOG("Construct DownloaderCURL::Impl %p", this); + } + + ~Impl() + { + DLLOG("Destruct DownloaderCURL::Impl %p %d", this, _thread.joinable()); + } + + void addTask(std::shared_ptr task, DownloadTaskCURL* coTask) + { + if (DownloadTask::ERROR_NO_ERROR == coTask->_errCode) + { + lock_guard lock(_requestMutex); + _requestQueue.push_back(make_pair(task, coTask)); + } + else + { + lock_guard lock(_finishedMutex); + _finishedQueue.push_back(make_pair(task, coTask)); + } + } + + void run() + { + lock_guard lock(_threadMutex); + if (false == _thread.joinable()) + { + thread newThread(&DownloaderCURL::Impl::_threadProc, this); + _thread.swap(newThread); + } + } + + void stop() + { + lock_guard lock(_threadMutex); + if (_thread.joinable()) + { + _thread.detach(); + } + } + + bool stoped() + { + lock_guard lock(_threadMutex); + return false == _thread.joinable() ? true : false; + } + + void getProcessTasks(vector& outList) + { + lock_guard lock(_processMutex); + outList.reserve(_processSet.size()); + outList.insert(outList.end(), _processSet.begin(), _processSet.end()); + } + + void getFinishedTasks(vector& outList) + { + lock_guard lock(_finishedMutex); + outList.reserve(_finishedQueue.size()); + outList.insert(outList.end(), _finishedQueue.begin(), _finishedQueue.end()); + _finishedQueue.clear(); + } + + private: + static size_t _outputHeaderCallbackProc(void *buffer, size_t size, size_t count, void *userdata) + { + int strLen = int(size * count); + DLLOG(" _outputHeaderCallbackProc: %.*s", strLen, buffer); + DownloadTaskCURL& coTask = *((DownloadTaskCURL*)(userdata)); + coTask._header.append((const char *)buffer, strLen); + return strLen; + } + + static size_t _outputDataCallbackProc(void *buffer, size_t size, size_t count, void *userdata) + { +// DLLOG(" _outputDataCallbackProc: size(%ld), count(%ld)", size, count); + DownloadTaskCURL *coTask = (DownloadTaskCURL*)userdata; + + // If your callback function returns CURL_WRITEFUNC_PAUSE it will cause this transfer to become paused. + return coTask->writeDataProc((unsigned char *)buffer, size, count); + } + + // this function designed call in work thread + // the curl handle destroyed in _threadProc + // handle inited for get header + void _initCurlHandleProc(CURL *handle, TaskWrapper& wrapper, bool forContent = false) + { + const DownloadTask& task = *wrapper.first; + const DownloadTaskCURL* coTask = wrapper.second; + + // set url + curl_easy_setopt(handle, CURLOPT_URL, task.requestURL.c_str()); + + // set write func + if (forContent) + { + curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, DownloaderCURL::Impl::_outputDataCallbackProc); + } + else + { + curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, DownloaderCURL::Impl::_outputHeaderCallbackProc); + } + curl_easy_setopt(handle, CURLOPT_WRITEDATA, coTask); + + curl_easy_setopt(handle, CURLOPT_NOPROGRESS, true); +// curl_easy_setopt(handle, CURLOPT_XFERINFOFUNCTION, DownloaderCURL::Impl::_progressCallbackProc); +// curl_easy_setopt(handle, CURLOPT_XFERINFODATA, coTask); + + curl_easy_setopt(handle, CURLOPT_FAILONERROR, true); + curl_easy_setopt(handle, CURLOPT_NOSIGNAL, 1L); + + if (forContent) + { + /** if server acceptRanges and local has part of file, we continue to download **/ + if (coTask->_acceptRanges && coTask->_totalBytesReceived > 0) + { + curl_easy_setopt(handle, CURLOPT_RESUME_FROM_LARGE,(curl_off_t)coTask->_totalBytesReceived); + } + } + else + { + // get header options + curl_easy_setopt(handle, CURLOPT_HEADER, 1); + curl_easy_setopt(handle, CURLOPT_NOBODY, 1); + } + +// if (!sProxy.empty()) +// { +// curl_easy_setopt(curl, CURLOPT_PROXY, sProxy.c_str()); +// } + if (hints.timeoutInSeconds) + { + curl_easy_setopt(handle, CURLOPT_CONNECTTIMEOUT, hints.timeoutInSeconds); + } + + static const long LOW_SPEED_LIMIT = 1; + static const long LOW_SPEED_TIME = 5; + curl_easy_setopt(handle, CURLOPT_LOW_SPEED_LIMIT, LOW_SPEED_LIMIT); + curl_easy_setopt(handle, CURLOPT_LOW_SPEED_TIME, LOW_SPEED_TIME); + + static const int MAX_REDIRS = 2; + if (MAX_REDIRS) + { + curl_easy_setopt(handle, CURLOPT_FOLLOWLOCATION, true); + curl_easy_setopt(handle, CURLOPT_MAXREDIRS, MAX_REDIRS); + } + } + + // get header info, if success set handle to content download state + bool _getHeaderInfoProc(CURL *handle, TaskWrapper& wrapper) + { + DownloadTaskCURL& coTask = *wrapper.second; + CURLcode rc = CURLE_OK; + do + { + long httpResponseCode = 0; + rc = curl_easy_getinfo(handle, CURLINFO_RESPONSE_CODE, &httpResponseCode); + if (CURLE_OK != rc) + { + break; + } + if (200 != httpResponseCode) + { + char buf[256] = {0}; + sprintf(buf + , "When crequest url(%s) header info, return unexcept http response code(%ld)" + , wrapper.first->requestURL.c_str() + , httpResponseCode); + coTask.setErrorProc(DownloadTask::ERROR_IMPL_INTERNAL, CURLE_OK, buf); + } + +// curl_easy_getinfo(handle, CURLINFO_EFFECTIVE_URL, &effectiveUrl); +// curl_easy_getinfo(handle, CURLINFO_CONTENT_TYPE, &contentType); + double contentLen = 0; + rc = curl_easy_getinfo(handle, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &contentLen); + if (CURLE_OK != rc) + { + break; + } + + bool acceptRanges = (string::npos != coTask._header.find("Accept-Ranges")) ? true : false; + + // get current file size + int64_t fileSize = 0; + if (acceptRanges && coTask._tempFileName.length()) + { + fileSize = FileUtils::getInstance()->getFileSize(coTask._tempFileName); + } + + // set header info to coTask + lock_guard lock(coTask._mutex); + coTask._totalBytesExpected = (int64_t)contentLen; + coTask._acceptRanges = acceptRanges; + if (acceptRanges && fileSize > 0) + { + coTask._totalBytesReceived = fileSize; + } + coTask._headerAchieved = true; + } while (0); + + if (CURLE_OK != rc) + { + coTask.setErrorProc(DownloadTask::ERROR_IMPL_INTERNAL, rc, curl_easy_strerror(rc)); + } + return coTask._headerAchieved; + } + + void _threadProc() + { + DLLOG("++++DownloaderCURL::Impl::_threadProc begin %p", this); + // the holder prevent DownloaderCURL::Impl class instance be destruct in main thread + auto holder = this->shared_from_this(); + auto thisThreadId = this_thread::get_id(); + uint32_t countOfMaxProcessingTasks = this->hints.countOfMaxProcessingTasks; + // init curl content + CURLM* curlmHandle = curl_multi_init(); + unordered_map coTaskMap; + int runningHandles = 0; + CURLMcode mcode = CURLM_OK; + int rc = 0; // select return code + + do + { + // check the thread should exit or not + { + lock_guard lock(_threadMutex); + // if the Impl stoped, this->_thread.reset will be called, thus _thread.get_id() not equal with thisThreadId + if (thisThreadId != this->_thread.get_id()) + { + break; + } + } + + if (runningHandles) + { + // get timeout setting from multi-handle + long timeoutMS = -1; + curl_multi_timeout(curlmHandle, &timeoutMS); + + if(timeoutMS < 0) + { + timeoutMS = 1000; + } + + /* get file descriptors from the transfers */ + fd_set fdread; + fd_set fdwrite; + fd_set fdexcep; + int maxfd = -1; + + FD_ZERO(&fdread); + FD_ZERO(&fdwrite); + FD_ZERO(&fdexcep); + + mcode = curl_multi_fdset(curlmHandle, &fdread, &fdwrite, &fdexcep, &maxfd); + if (CURLM_OK != mcode) + { + break; + } + + // do wait action + if(maxfd == -1) + { + this_thread::sleep_for(chrono::milliseconds(timeoutMS)); + rc = 0; + } + else + { + struct timeval timeout; + + timeout.tv_sec = timeoutMS / 1000; + timeout.tv_usec = (timeoutMS % 1000) * 1000; + + rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout); + } + + if (rc < 0) + { + DLLOG(" _threadProc: select return unexpect code: %d", rc); + } + } + + if (coTaskMap.size()) + { + mcode = CURLM_CALL_MULTI_PERFORM; + while(CURLM_CALL_MULTI_PERFORM == mcode) + { + mcode = curl_multi_perform(curlmHandle, &runningHandles); + } + if (CURLM_OK != mcode) + { + break; + } + + struct CURLMsg *m; + do { + int msgq = 0; + m = curl_multi_info_read(curlmHandle, &msgq); + if(m && (m->msg == CURLMSG_DONE)) + { + CURL *curlHandle = m->easy_handle; + CURLcode errCode = m->data.result; + + TaskWrapper wrapper = coTaskMap[curlHandle]; + + // remove from multi-handle + curl_multi_remove_handle(curlmHandle, curlHandle); + bool reinited = false; + do + { + if (CURLE_OK != errCode) + { + wrapper.second->setErrorProc(DownloadTask::ERROR_IMPL_INTERNAL, errCode, curl_easy_strerror(errCode)); + break; + } + + // if the task is content download task, cleanup the handle + if (wrapper.second->_headerAchieved) + { + break; + } + + // the task is get header task + // first, we get info from response + if (false == _getHeaderInfoProc(curlHandle, wrapper)) + { + // the error info has been set in _getHeaderInfoProc + break; + } + + // after get header info success + // wrapper.second->_totalBytesReceived inited by local file size + // if the local file size equal with the content size from header, the file has downloaded finish + if (wrapper.second->_totalBytesReceived && + wrapper.second->_totalBytesReceived == wrapper.second->_totalBytesExpected) + { + // the file has download complete + // break to move this task to finish queue + break; + } + // reinit curl handle for download content + curl_easy_reset(curlHandle); + _initCurlHandleProc(curlHandle, wrapper, true); + mcode = curl_multi_add_handle(curlmHandle, curlHandle); + if (CURLM_OK != mcode) + { + wrapper.second->setErrorProc(DownloadTask::ERROR_IMPL_INTERNAL, mcode, curl_multi_strerror(mcode)); + break; + } + reinited = true; + } while (0); + + if (reinited) + { + continue; + } + curl_easy_cleanup(curlHandle); + DLLOG(" _threadProc task clean cur handle :%p with errCode:%d", curlHandle, errCode); + + // remove from coTaskMap + coTaskMap.erase(curlHandle); + + // remove from _processSet + { + lock_guard lock(_processMutex); + if (_processSet.end() != _processSet.find(wrapper)) { + _processSet.erase(wrapper); + } + } + + // add to finishedQueue + { + lock_guard lock(_finishedMutex); + _finishedQueue.push_back(wrapper); + } + } + } while(m); + } + + // process tasks in _requestList + while (0 == countOfMaxProcessingTasks || coTaskMap.size() < countOfMaxProcessingTasks) + { + // get task wrapper from request queue + TaskWrapper wrapper; + { + lock_guard lock(_requestMutex); + if (_requestQueue.size()) + { + wrapper = _requestQueue.front(); + _requestQueue.pop_front(); + } + } + + // if request queue is empty, the wrapper.first is nullptr + if (! wrapper.first) + { + break; + } + + wrapper.second->initProc(); + + // create curl handle from task and add into curl multi handle + CURL* curlHandle = curl_easy_init(); + + if (nullptr == curlHandle) + { + wrapper.second->setErrorProc(DownloadTask::ERROR_IMPL_INTERNAL, 0, "Alloc curl handle failed."); + lock_guard lock(_finishedMutex); + _finishedQueue.push_back(wrapper); + continue; + } + + // init curl handle for get header info + _initCurlHandleProc(curlHandle, wrapper); + + // add curl handle to process list + mcode = curl_multi_add_handle(curlmHandle, curlHandle); + if (CURLM_OK != mcode) + { + wrapper.second->setErrorProc(DownloadTask::ERROR_IMPL_INTERNAL, mcode, curl_multi_strerror(mcode)); + lock_guard lock(_finishedMutex); + _finishedQueue.push_back(wrapper); + continue; + } + + DLLOG(" _threadProc task create curl handle:%p", curlHandle); + coTaskMap[curlHandle] = wrapper; + lock_guard lock(_processMutex); + _processSet.insert(wrapper); + } + } while (coTaskMap.size()); + + curl_multi_cleanup(curlmHandle); + this->stop(); + DLLOG("----DownloaderCURL::Impl::_threadProc end"); + } + + thread _thread; + deque _requestQueue; + set _processSet; + deque _finishedQueue; + + mutex _threadMutex; + mutex _requestMutex; + mutex _processMutex; + mutex _finishedMutex; + }; + + +//////////////////////////////////////////////////////////////////////////////// +// Implementation DownloaderCURL + DownloaderCURL::DownloaderCURL(const DownloaderHints& hints) + : _impl(std::make_shared()) + , _currTask(nullptr) + { + DLLOG("Construct DownloaderCURL %p", this); + _impl->hints = hints; + _scheduler = Director::getInstance()->getScheduler(); + _scheduler->retain(); + + _transferDataToBuffer = [this](void *buf, int64_t len)->int64_t + { + DownloadTaskCURL& coTask = *_currTask; + int64_t dataLen = coTask._buf.size(); + if (len < dataLen) + { + return 0; + } + + memcpy(buf, coTask._buf.data(), dataLen); + coTask._buf.resize(0); + return dataLen; + }; + + char key[128]; + sprintf(key, "DownloaderCURL(%p)", this); + _schedulerKey = key; + + _scheduler->schedule(bind(&DownloaderCURL::_onSchedule, this, placeholders::_1), + this, + 0.1f, + true, + _schedulerKey); + } + + DownloaderCURL::~DownloaderCURL() + { + _scheduler->unschedule(_schedulerKey, this); + _scheduler->release(); + + _impl->stop(); + DLLOG("Destruct DownloaderCURL %p", this); + } + + IDownloadTask *DownloaderCURL::createCoTask(std::shared_ptr& task) + { + DownloadTaskCURL *coTask = new DownloadTaskCURL; + coTask->init(task->storagePath, _impl->hints.tempFileNameSuffix); + + DLLOG(" DownloaderCURL: createTask: Id(%d)", coTask->serialId); + + _impl->addTask(task, coTask); + _impl->run(); + _scheduler->resumeTarget(this); + return coTask; + } + + void DownloaderCURL::_onSchedule(float) + { + vector tasks; + + // update processing tasks + _impl->getProcessTasks(tasks); + for (auto& wrapper : tasks) + { + const DownloadTask& task = *wrapper.first; + DownloadTaskCURL& coTask = *wrapper.second; + + lock_guard lock(coTask._mutex); + if (coTask._bytesReceived) + { + _currTask = &coTask; + onTaskProgress(task, + coTask._bytesReceived, + coTask._totalBytesReceived, + coTask._totalBytesExpected, + _transferDataToBuffer); + _currTask = nullptr; + coTask._bytesReceived = 0; + } + } + tasks.resize(0); + + // update finished tasks + _impl->getFinishedTasks(tasks); + for (auto& wrapper : tasks) + { + const DownloadTask& task = *wrapper.first; + DownloadTaskCURL& coTask = *wrapper.second; + + // if there is bytesReceived, call progress update first + if (coTask._bytesReceived) + { + _currTask = &coTask; + onTaskProgress(task, + coTask._bytesReceived, + coTask._totalBytesReceived, + coTask._totalBytesExpected, + _transferDataToBuffer); + coTask._bytesReceived = 0; + _currTask = nullptr; + } + + // if file task, close file handle and rename file if needed + if (coTask._fp) + { + fclose(coTask._fp); + coTask._fp = nullptr; + do + { + if (0 == coTask._fileName.length()) + { + break; + } + + auto util = FileUtils::getInstance(); + // if file already exist, remove it + if (util->isFileExist(coTask._fileName)) + { + if (false == util->removeFile(coTask._fileName)) + { + coTask._errCode = DownloadTask::ERROR_FILE_OP_FAILED; + coTask._errCodeInternal = 0; + coTask._errDescription = "Can't remove old file: "; + coTask._errDescription.append(coTask._fileName); + break; + } + } + + // rename file + if (util->renameFile(coTask._tempFileName, coTask._fileName)) + { + // success, remove storage from set + DownloadTaskCURL::_sStoragePathSet.erase(coTask._tempFileName); + break; + } + // failed + coTask._errCode = DownloadTask::ERROR_FILE_OP_FAILED; + coTask._errCodeInternal = 0; + coTask._errDescription = "Can't renamefile from: "; + coTask._errDescription.append(coTask._tempFileName); + coTask._errDescription.append(" to: "); + coTask._errDescription.append(coTask._fileName); + } while (0); + + } + // needn't lock coTask here, because tasks has removed form _impl + onTaskFinish(task, coTask._errCode, coTask._errCodeInternal, coTask._errDescription, coTask._buf); + DLLOG(" DownloaderCURL: finish Task: Id(%d)", coTask.serialId); + } + + if (_impl->stoped()) + { + _scheduler->pauseTarget(this); + } + } + +}} // namespace cocos2d::network diff --git a/cocos/network/CCDownloader-curl.h b/cocos/network/CCDownloader-curl.h new file mode 100644 index 0000000000..6e877ba6a1 --- /dev/null +++ b/cocos/network/CCDownloader-curl.h @@ -0,0 +1,61 @@ +/**************************************************************************** + Copyright (c) 2015 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. + ****************************************************************************/ + +#pragma once + +#include "network/CCIDownloaderImpl.h" + +namespace cocos2d { + class Scheduler; +} + +namespace cocos2d { namespace network +{ + class DownloadTaskCURL; + class DownloaderHints; + + class DownloaderCURL : public IDownloaderImpl + { + public: + DownloaderCURL(const DownloaderHints& hints); + virtual ~DownloaderCURL(); + + virtual IDownloadTask *createCoTask(std::shared_ptr& task) override; + + protected: + class Impl; + std::shared_ptr _impl; + + // for transfer data on schedule + DownloadTaskCURL* _currTask; // temp ref + std::function _transferDataToBuffer; + + // scheduler for update processing and finished task in main schedule + void _onSchedule(float); + std::string _schedulerKey; + Scheduler* _scheduler; + }; + +}} // namespace cocos2d::network + diff --git a/cocos/network/CCDownloader.cpp b/cocos/network/CCDownloader.cpp index ffb0c026d5..1ddcd534f6 100644 --- a/cocos/network/CCDownloader.cpp +++ b/cocos/network/CCDownloader.cpp @@ -24,545 +24,167 @@ #include "network/CCDownloader.h" -#include -#include -#include -#include -#include +// include platform specific implement class +#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) -#include "network/CCDownloaderImpl.h" -#include "base/CCDirector.h" -#include "base/CCScheduler.h" -#include "deprecated/CCString.h" +#include "network/CCDownloader-apple.h" +#include "network/CCDownloader-curl.h" +#define DownloaderImpl DownloaderCURL -namespace cocos2d { -namespace network { +#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) +#include "network/CCDownloader-apple.h" +#define DownloaderImpl DownloaderApple -#define LOW_SPEED_LIMIT 1L -#define LOW_SPEED_TIME 5L -#define MAX_REDIRS 2 -#define DEFAULT_TIMEOUT 5 -#define HTTP_CODE_SUPPORT_RESUME 206 -#define MAX_WAIT_MSECS 30*1000 /* Wait max. 30 seconds */ +#elif (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) -#define TEMP_EXT ".temp" +#include "network/CCDownloader-android.h" +#define DownloaderImpl DownloaderAndroid -Downloader::Downloader() -: _connectionTimeout(DEFAULT_TIMEOUT) -, _onError(nullptr) -, _onProgress(nullptr) -, _onSuccess(nullptr) -, _supportResuming(false) -, _downloaderImpl(nullptr) -{ - _fileUtils = FileUtils::getInstance(); - _downloaderImpl = new DownloaderImpl(); - _downloaderImpl->init(); -} +#else -Downloader::~Downloader() -{ - CC_SAFE_DELETE(_downloaderImpl); -} +#include "network/CCDownloader-curl.h" +#define DownloaderImpl DownloaderCURL -int Downloader::getConnectionTimeout() -{ - return _connectionTimeout; -} +#endif -void Downloader::setConnectionTimeout(int timeout) -{ - if (timeout >= 0) - _connectionTimeout = timeout; -} +namespace cocos2d { namespace network { -void Downloader::notifyError(ErrorCode code, const std::string& msg/* ="" */, const std::string& customId/* ="" */, int curle_code/* = CURLE_OK*/, int curlm_code/* = CURLM_OK*/) -{ - std::weak_ptr ptr = shared_from_this(); - Director::getInstance()->getScheduler()->performFunctionInCocosThread([=]{ - if (!ptr.expired()) + DownloadTask::DownloadTask() + { + DLLOG("Construct DownloadTask %p", this); + } + + DownloadTask::~DownloadTask() + { + DLLOG("Destruct DownloadTask %p", this); + } + +//////////////////////////////////////////////////////////////////////////////// +// Implement Downloader + Downloader::Downloader() + { + DownloaderHints hints = { - std::shared_ptr downloader = ptr.lock(); - if (downloader->_onError != nullptr) + 6, + 45, + ".tmp" + }; + new(this)Downloader(hints); + } + + Downloader::Downloader(const DownloaderHints& hints) + { + DLLOG("Construct Downloader %p", this); + _impl.reset(new DownloaderImpl(hints)); + _impl->onTaskProgress = [this](const DownloadTask& task, + int64_t bytesReceived, + int64_t totalBytesReceived, + int64_t totalBytesExpected, + std::function& transferDataToBuffer) + { + if (onTaskProgress) { - Error err; - err.code = code; - err.curle_code = curle_code; - err.curlm_code = curlm_code; - err.message = msg; - err.customId = customId; - downloader->_onError(err); + onTaskProgress(task, bytesReceived, totalBytesReceived, totalBytesExpected); } - } - }); -} - -void Downloader::notifyError(const std::string& msg, int curlm_code, const std::string& customId/* = ""*/) -{ - notifyError(ErrorCode::CURL_MULTI_ERROR, msg, customId, CURLE_OK, curlm_code); -} - -void Downloader::notifyError(const std::string& msg, const std::string& customId, int curle_code) -{ - notifyError(ErrorCode::CURL_EASY_ERROR, msg, customId, curle_code); -} - -std::string Downloader::getFileNameFromUrl(const std::string& srcUrl) -{ - // Find file name and file extension - std::string filename; - unsigned long found = srcUrl.find_last_of("/\\"); - if (found != std::string::npos) - filename = srcUrl.substr(found+1); - return filename; -} - -void Downloader::prepareDownload(const DownloadUnit& downloadUnit) -{ - std::string name = ""; - std::string path = ""; - - FILE *localFP = nullptr; - - downloadUnit.downloaded = 0; - downloadUnit.totalToDownload = 0; - - Error err; - err.customId = downloadUnit.customId; - - // Asserts - // Find file name and file extension - unsigned long found = downloadUnit.storagePath.find_last_of("/\\"); - if (found != std::string::npos) - { - name = downloadUnit.storagePath.substr(found+1); - path = downloadUnit.storagePath.substr(0, found+1); - } - else - { - err.code = ErrorCode::INVALID_URL; - err.message = "Invalid url or filename not exist error: " + downloadUnit.srcUrl; - if (this->_onError) - this->_onError(err); - downloadUnit.fp = nullptr; - return; - } - - // create possible subdirectories - if (!FileUtils::getInstance()->isDirectoryExist(path)) - FileUtils::getInstance()->createDirectory(path); - - // Create a file to save file. - const std::string outFileName = downloadUnit.storagePath + TEMP_EXT; - if (_supportResuming && downloadUnit.resumeDownload && _fileUtils->isFileExist(outFileName)) - { - localFP = fopen(FileUtils::getInstance()->getSuitableFOpen(outFileName).c_str(), "ab"); - } - else - { - localFP = fopen(FileUtils::getInstance()->getSuitableFOpen(outFileName).c_str(), "wb"); - } - if (!localFP) - { - err.code = ErrorCode::CREATE_FILE; - err.message = StringUtils::format("Can not create file %s: errno %d", outFileName.c_str(), errno); - if (this->_onError) - this->_onError(err); - } - - downloadUnit.fp = localFP; -} - -void Downloader::downloadToBufferAsync(const std::string& srcUrl, unsigned char *buffer, long size, const std::string& customId/* = ""*/) -{ - if (buffer != nullptr) - { - auto t = std::thread(&Downloader::downloadToBuffer, this, srcUrl, customId, buffer, size); - t.detach(); - } -} - -void Downloader::downloadToBufferSync(const std::string& srcUrl, unsigned char *buffer, long size, const std::string& customId/* = ""*/) -{ - if (buffer != nullptr) - { - downloadToBuffer(srcUrl, customId, buffer, size); - } -} - -void Downloader::downloadToBuffer(const std::string& srcUrl, const std::string& customId, unsigned char* buffer, long size) -{ - CC_ASSERT(buffer && "must not be nill"); - - CC_ASSERT(_downloaderImpl && "Cannot instanciate more than one instance of DownloaderImpl"); - - std::weak_ptr ptr = shared_from_this(); - std::shared_ptr shared = ptr.lock(); - - StreamData streamBuffer; - streamBuffer.buffer = buffer; - streamBuffer.total = size; - streamBuffer.offset = 0; - - DownloadUnit unit; - unit.srcUrl = srcUrl; - unit.customId = customId; - unit.fp = &streamBuffer; - unit.downloaded = 0; - unit.totalToDownload = 0; - - int res = _downloaderImpl->performDownload(&unit, - std::bind(&Downloader::bufferWriteFunc, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4), - std::bind(&Downloader::downloadProgressFunc, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3) - ); - // Download pacakge - if (res != 0) - { - std::string msg = StringUtils::format("Unable to download file to buffer: [curl error]%s", _downloaderImpl->getStrError().c_str()); - this->notifyError(msg, customId, res); - } - else - { - if (std::this_thread::get_id() != Director::getInstance()->getCocos2dThreadId()) + }; + + _impl->onTaskFinish = [this](const DownloadTask& task, + int errorCode, + int errorCodeInternal, + const std::string& errorStr, + std::vector& data) { - std::weak_ptr ptr = shared_from_this(); - std::shared_ptr shared = ptr.lock(); - - Director::getInstance()->getScheduler()->performFunctionInCocosThread([=]{ - if (!ptr.expired()) + if (DownloadTask::ERROR_NO_ERROR != errorCode) + { + if (onTaskError) { - std::shared_ptr downloader = ptr.lock(); - reportDownloadFinished(unit.srcUrl, "", unit.customId); + onTaskError(task, errorCode, errorCodeInternal, errorStr); } - }); - } - else - { - reportDownloadFinished(unit.srcUrl, "", unit.customId); - } - } -} + return; + } -void Downloader::downloadAsync(const std::string& srcUrl, const std::string& storagePath, const std::string& customId/* = ""*/) -{ - auto t = std::thread(&Downloader::downloadToFP, this, srcUrl, customId, storagePath); - t.detach(); -} - -void Downloader::downloadSync(const std::string& srcUrl, const std::string& storagePath, const std::string& customId/* = ""*/) -{ - downloadToFP(srcUrl, customId, storagePath); -} - -void Downloader::downloadToFP(const std::string& srcUrl, const std::string& customId, const std::string& storagePath) -{ - CC_ASSERT(_downloaderImpl && "Cannot instanciate more than one instance of DownloaderImpl"); - - std::weak_ptr ptr = shared_from_this(); - std::shared_ptr shared = ptr.lock(); - - DownloadUnit unit; - unit.srcUrl = srcUrl; - unit.customId = customId; - unit.storagePath = storagePath; - unit.fp = nullptr; - - prepareDownload(unit); - - int res = _downloaderImpl->performDownload(&unit, - std::bind(&Downloader::fileWriteFunc, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4), - std::bind(&Downloader::downloadProgressFunc, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3) - ); - - if (res != 0) - { - // XXX: If this is called from a different thread, will it crash? - // XXX: Can fileUtils run on a different thread ? - // XXX: can notifyError run on a different thread ? - _fileUtils->removeFile(unit.storagePath + TEMP_EXT); - std::string msg = StringUtils::format("Unable to download file: [curl error]%s", _downloaderImpl->getStrError().c_str()); - this->notifyError(msg, customId, res); - } - - fclose((FILE*)unit.fp); - - // This can only be done after fclose - if (res == 0) - { - _fileUtils->renameFile(unit.storagePath + TEMP_EXT, unit.storagePath); - - if (std::this_thread::get_id() != Director::getInstance()->getCocos2dThreadId()) - { - std::weak_ptr ptr = shared_from_this(); - std::shared_ptr shared = ptr.lock(); - - Director::getInstance()->getScheduler()->performFunctionInCocosThread([=]{ - if (!ptr.expired()) + // success callback + if (task.storagePath.length()) + { + if (onFileTaskSuccess) { - std::shared_ptr downloader = ptr.lock(); - reportDownloadFinished(unit.srcUrl, unit.storagePath, unit.customId); + onFileTaskSuccess(task); } - }); - } - else - { - reportDownloadFinished(unit.srcUrl, unit.storagePath, unit.customId); - } - } -} - -void Downloader::batchDownloadAsync(const DownloadUnits& units, const std::string& batchId/* = ""*/) -{ - auto t = std::thread(&Downloader::batchDownloadSync, this, units, batchId); - t.detach(); -} - -void Downloader::batchDownloadSync(const DownloadUnits& units, const std::string& batchId/* = ""*/) -{ - // Make sure downloader won't be released - std::weak_ptr ptr = shared_from_this(); - std::shared_ptr shared = ptr.lock(); - - if (units.size() != 0) - { - _supportResuming = _downloaderImpl->supportsResume(units.cbegin()->second.srcUrl); - - // split units in multiple parts if the size is bigger - // than FOPEN_MAX - if (units.size() >= FOPEN_MAX) - { - int count = 0; - DownloadUnits group; - for (auto it = units.cbegin(); it != units.cend(); ++it, ++count) - { - if (count == FOPEN_MAX) - { - groupBatchDownload(group); - group.clear(); - count = 0; - } - const std::string& key = it->first; - const DownloadUnit& unit = it->second; - group.emplace(key, unit); - } - if (group.size() > 0) - { - groupBatchDownload(group); - } - } - else - { - groupBatchDownload(units); - } - } - - Director::getInstance()->getScheduler()->performFunctionInCocosThread([ptr, batchId]{ - if (!ptr.expired()) { - std::shared_ptr downloader = ptr.lock(); - auto callback = downloader->getSuccessCallback(); - if (callback != nullptr) - { - callback("", "", batchId); - } - } - }); - _supportResuming = false; -} - -void Downloader::groupBatchDownload(const DownloadUnits& units) -{ - std::weak_ptr ptr = shared_from_this(); - std::shared_ptr shared = ptr.lock(); - - // static_cast needed since notifyError is overloaded - auto errorCallback = std::bind( static_cast - (&Downloader::notifyError), this, - std::placeholders::_1, std::placeholders::_2, std::placeholders::_3); - - for (const auto& entry: units) - { - auto&& unit = entry.second; - prepareDownload(unit); - } - _downloaderImpl->performBatchDownload(units, - std::bind(&Downloader::fileWriteFunc, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4), - std::bind(&Downloader::batchDownloadProgressFunc, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3), - errorCallback - ); - - // Check unfinished files and notify errors, succeed files will be renamed from temporary file name to real name - for(const auto& entry: units) - { - const auto& unit = entry.second; - - // first close, then rename. Otherwise sharing_violation_error on windows - if (unit.fp) - fclose((FILE*)unit.fp); - - if (unit.downloaded < unit.totalToDownload || unit.totalToDownload == 0) - { - this->notifyError(ErrorCode::NETWORK, "Unable to download file", unit.customId); - } - else - { - _fileUtils->renameFile(unit.storagePath + TEMP_EXT, unit.storagePath); - } - } -} - -HeaderInfo Downloader::getHeader(const std::string &srcUrl) -{ - HeaderInfo info; - _downloaderImpl->getHeader(srcUrl, &info); - return info; -} - -// callbacks -size_t Downloader::fileWriteFunc(void *ptr, size_t size, size_t nmemb, void *userdata) -{ - CC_ASSERT(userdata && "Invalid userdata"); - DownloadUnit* unit = (DownloadUnit*)userdata; - FILE *fp = (FILE*)(unit->fp); - - CC_ASSERT(fp && "Invalid FP"); - size_t written = fwrite(ptr, size, nmemb, fp); - return written; -} - -size_t Downloader::bufferWriteFunc(void *ptr, size_t size, size_t nmemb, void *userdata) -{ - CC_ASSERT(userdata && "Invalid userdata"); - Downloader::StreamData* streamBuffer = (Downloader::StreamData*)((DownloadUnit*)userdata)->fp; - - CC_ASSERT(streamBuffer && "Invalid streamBuffer"); - - size_t written = size * nmemb; - // Avoid pointer overflow - if (streamBuffer->offset + written <= static_cast(streamBuffer->total)) - { - memcpy(streamBuffer->buffer + streamBuffer->offset, ptr, written); - streamBuffer->offset += written; - return written; - } - else return 0; -} - -void Downloader::reportDownloadFinished(const std::string& url, const std::string& path, const std::string& customid) -{ - if (_onSuccess != nullptr) - { - _onSuccess(url, path, customid); - } -} -void Downloader::reportProgressFinished(double totalToDownload, double nowDownloaded, const DownloadUnit* unit) -{ - if (_onProgress != nullptr) - { - _onProgress(totalToDownload, nowDownloaded, unit->srcUrl, unit->customId); - } - reportDownloadFinished(unit->srcUrl, unit->storagePath, unit->customId); -} - -void Downloader::reportProgressInProgress(double totalToDownload, double nowDownloaded, const DownloadUnit* unit) -{ - if (_onProgress != nullptr) - { - _onProgress(totalToDownload, nowDownloaded, unit->srcUrl, unit->customId); - } -} - -// This is only for batchDownload process, will notify file succeed event in progress function -int Downloader::batchDownloadProgressFunc(void *userdata, double totalToDownload, double nowDownloaded) -{ - CC_ASSERT(userdata && "Invalid userdata"); - - DownloadUnit* ptr = (DownloadUnit*) userdata; - if (ptr->totalToDownload == 0) - { - ptr->totalToDownload = totalToDownload; - } - - if (ptr->downloaded != nowDownloaded) - { - ptr->downloaded = nowDownloaded; - - if (nowDownloaded == totalToDownload) - { - if (std::this_thread::get_id() != Director::getInstance()->getCocos2dThreadId()) - { - std::weak_ptr _this = shared_from_this(); - DownloadUnit copyUnit = *ptr; - Director::getInstance()->getScheduler()->performFunctionInCocosThread([=]{ - if (!_this.expired()) - { - this->reportProgressFinished(totalToDownload, nowDownloaded, ©Unit); - } - }); } else { - reportProgressFinished(totalToDownload, nowDownloaded, ptr); - } - } - else - { - if (std::this_thread::get_id() != Director::getInstance()->getCocos2dThreadId()) - { - std::weak_ptr _this = shared_from_this(); - DownloadUnit copyUnit = *ptr; - Director::getInstance()->getScheduler()->performFunctionInCocosThread([=]{ - if (!_this.expired()) - { - reportProgressInProgress(totalToDownload, nowDownloaded, ©Unit); - } - }); - } - else - { - reportProgressInProgress(totalToDownload, nowDownloaded, ptr); - } - } - } - - return 0; -} - -// Compare to batchDownloadProgressFunc, this only handles progress information notification -int Downloader::downloadProgressFunc(void *userdata, double totalToDownload, double nowDownloaded) -{ - CC_ASSERT(userdata && "Invalid userdata"); - - DownloadUnit* ptr = (DownloadUnit*)userdata; - if (ptr->totalToDownload == 0) - { - ptr->totalToDownload = totalToDownload; - } - - if (ptr->downloaded != nowDownloaded) - { - ptr->downloaded = nowDownloaded; - DownloadUnit copyUnit = *ptr; - std::weak_ptr _this = shared_from_this(); - - Director::getInstance()->getScheduler()->performFunctionInCocosThread([=]{ - if (!_this.expired()) - { - std::shared_ptr downloader = _this.lock(); - - auto callback = downloader->getProgressCallback(); - if (callback != nullptr) + // data task + if (onDataTaskSuccess) { - callback(totalToDownload, nowDownloaded, copyUnit.srcUrl, copyUnit.customId); + onDataTaskSuccess(task, data); } } - }); + }; } - return 0; -} + Downloader::~Downloader() + { + DLLOG("Destruct Downloader %p", this); + } + + std::shared_ptr Downloader::createDownloadDataTask(const std::string& srcUrl, const std::string& identifier/* = ""*/) + { + DownloadTask *task_ = new DownloadTask(); + std::shared_ptr task(task_); + do + { + task_->requestURL = srcUrl; + task_->identifier = identifier; + if (0 == srcUrl.length()) + { + if (onTaskError) + { + onTaskError(*task, DownloadTask::ERROR_INVALID_PARAMS, 0, "URL or is empty."); + } + task.reset(); + break; + } + task_->_coTask.reset(_impl->createCoTask(task)); + } while (0); + + return task; + } + + std::shared_ptr Downloader::createDownloadFileTask(const std::string& srcUrl, + const std::string& storagePath, + const std::string& identifier/* = ""*/) + { + DownloadTask *task_ = new DownloadTask(); + std::shared_ptr task(task_); + do + { + task_->requestURL = srcUrl; + task_->storagePath = storagePath; + task_->identifier = identifier; + if (0 == srcUrl.length() || 0 == storagePath.length()) + { + if (onTaskError) + { + onTaskError(*task, DownloadTask::ERROR_INVALID_PARAMS, 0, "URL or storage path is empty."); + } + task.reset(); + break; + } + task_->_coTask.reset(_impl->createCoTask(task)); + } while (0); + return task; + } + +//std::string Downloader::getFileNameFromUrl(const std::string& srcUrl) +//{ +// // Find file name and file extension +// std::string filename; +// unsigned long found = srcUrl.find_last_of("/\\"); +// if (found != std::string::npos) +// filename = srcUrl.substr(found+1); +// return filename; +//} -} // namespace network -} // namespace cocos2d - +}} // namespace cocos2d::network diff --git a/cocos/network/CCDownloader.h b/cocos/network/CCDownloader.h index 01e531d1a7..8caa88b4b8 100644 --- a/cocos/network/CCDownloader.h +++ b/cocos/network/CCDownloader.h @@ -22,140 +22,77 @@ THE SOFTWARE. ****************************************************************************/ -#ifndef __Downloader__ -#define __Downloader__ +#pragma once -#include -#include #include +#include #include +#include -#include "network/CCDownloaderImpl.h" -#include "platform/CCFileUtils.h" -#include "extensions/ExtensionMacros.h" -#include "extensions/ExtensionExport.h" +#include "platform/CCPlatformMacros.h" -namespace cocos2d { -namespace network { +namespace cocos2d { namespace network { -class CC_DLL Downloader : public std::enable_shared_from_this -{ -public: - - enum class ErrorCode - { - CREATE_FILE, - - NETWORK, - - NO_NEW_VERSION, - - UNCOMPRESS, - - CURL_UNINIT, - - CURL_MULTI_ERROR, - - CURL_EASY_ERROR, - - INVALID_URL, - - INVALID_STORAGE_PATH, - - PREPARE_HEADER_ERROR - }; - - struct Error - { - ErrorCode code; - int curlm_code; - int curle_code; - std::string message; - std::string customId; - std::string url; - }; - - struct StreamData - { - long offset; - long total; - unsigned char *buffer; - }; - - - typedef std::function ErrorCallback; - typedef std::function ProgressCallback; - typedef std::function SuccessCallback; - - int getConnectionTimeout(); - void setConnectionTimeout(int timeout); + class IDownloadTask; + class IDownloaderImpl; + class Downloader; - void setErrorCallback(const ErrorCallback &callback) { _onError = callback; }; - void setProgressCallback(const ProgressCallback &callback) { _onProgress = callback; }; - void setSuccessCallback(const SuccessCallback &callback) { _onSuccess = callback; }; + class CC_DLL DownloadTask final + { + public: + const static int ERROR_NO_ERROR = 0; + const static int ERROR_INVALID_PARAMS = -1; + const static int ERROR_FILE_OP_FAILED = -2; + const static int ERROR_IMPL_INTERNAL = -3; + + std::string identifier; + std::string requestURL; + std::string storagePath; - ErrorCallback getErrorCallback() const { return _onError; }; - ProgressCallback getProgressCallback() const { return _onProgress; }; - SuccessCallback getSuccessCallback() const { return _onSuccess; }; - - void downloadToBufferAsync(const std::string& srcUrl, unsigned char *buffer, long size, const std::string& customId = ""); - void downloadToBufferSync(const std::string& srcUrl, unsigned char *buffer, long size, const std::string& customId = ""); - - void downloadAsync(const std::string& srcUrl, const std::string& storagePath, const std::string& customId = ""); - void downloadSync(const std::string& srcUrl, const std::string& storagePath, const std::string& customId = ""); + DownloadTask(); + virtual ~DownloadTask(); + + private: + friend class Downloader; + std::unique_ptr _coTask; + }; - void batchDownloadAsync(const DownloadUnits &units, const std::string& batchId = ""); - void batchDownloadSync(const DownloadUnits &units, const std::string& batchId = ""); + class CC_DLL DownloaderHints + { + public: + uint32_t countOfMaxProcessingTasks; + uint32_t timeoutInSeconds; + std::string tempFileNameSuffix; + }; + + class CC_DLL Downloader final + { + public: + Downloader(); + Downloader(const DownloaderHints& hints); + ~Downloader(); + + std::function& data)> onDataTaskSuccess; + std::function onFileTaskSuccess; + + std::function onTaskProgress; + + std::function onTaskError; + + std::shared_ptr createDownloadDataTask(const std::string& srcUrl, const std::string& identifier = ""); + + std::shared_ptr createDownloadFileTask(const std::string& srcUrl, const std::string& storagePath, const std::string& identifier = ""); + + private: + std::unique_ptr _impl; + }; - HeaderInfo getHeader(const std::string &srcUrl); - - /** - * The default constructor. - */ - Downloader(); - ~Downloader(); - -protected: - - - void prepareDownload(const DownloadUnit& downloadUnit); - - void downloadToBuffer(const std::string& srcUrl, const std::string& customId, unsigned char* buffer, long size); - void downloadToFP(const std::string& srcUrl, const std::string& customId, const std::string& storagePath); - void groupBatchDownload(const DownloadUnits& units); - - void notifyError(ErrorCode code, const std::string& msg = "", const std::string& customId = "", int curle_code = 0, int curlm_code = 0); - void notifyError(const std::string& msg, int curlm_code, const std::string& customId = ""); - void notifyError(const std::string& msg, const std::string& customId, int curle_code); - - // callbacks - int downloadProgressFunc(void *userdata, double totalToDownload, double nowDownloaded); - int batchDownloadProgressFunc(void *userdata, double totalToDownload, double nowDownloaded); - size_t bufferWriteFunc(void *ptr, size_t size, size_t nmemb, void *userdata); - size_t fileWriteFunc(void *ptr, size_t size, size_t nmemb, void *userdata); - - // callback helpers - void reportProgressFinished(double totalToDownload, double nowDownloaded, const DownloadUnit* downloadUnit); - void reportProgressInProgress(double totalToDownload, double nowDownloaded, const DownloadUnit* downloadUnit); - void reportDownloadFinished(const std::string& url, const std::string&, const std::string& customid); - - -private: - std::string getFileNameFromUrl(const std::string& srcUrl); - - ErrorCallback _onError; - ProgressCallback _onProgress; - SuccessCallback _onSuccess; - - int _connectionTimeout; - FileUtils* _fileUtils; - bool _supportResuming; - DownloaderImpl* _downloaderImpl; -}; - -} // namespace cocos2d -} // namespace network - - -#endif /* defined(__Downloader__) */ \ No newline at end of file +}} // namespace cocos2d::network diff --git a/cocos/network/CCDownloaderImpl.cpp b/cocos/network/CCDownloaderImpl.cpp deleted file mode 100644 index dad831d186..0000000000 --- a/cocos/network/CCDownloaderImpl.cpp +++ /dev/null @@ -1,338 +0,0 @@ -/**************************************************************************** - Copyright (c) 2015 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. - ****************************************************************************/ - -#include "network/CCDownloaderImpl.h" - -#include - -#include "platform/CCFileUtils.h" -#include "deprecated/CCString.h" - -USING_NS_CC; -using namespace cocos2d::network; - -static const long LOW_SPEED_LIMIT = 1; -static const long LOW_SPEED_TIME = 5; -static const int DEFAULT_TIMEOUT = 5; -static const int MAX_REDIRS = 2; -static const int MAX_WAIT_MSECS = 30*1000; /* Wait max. 30 seconds */ - -static const int HTTP_CODE_SUPPORT_RESUME = 206; -static const char* TEMP_EXT = ".temp"; - -static size_t _fileWriteFunc(void *ptr, size_t size, size_t nmemb, void* userdata) -{ - DownloadUnit *unit = (DownloadUnit*)userdata; - DownloaderImpl* this_ = (DownloaderImpl*)unit->_reserved; - int ret = this_->getWriterCallback()(ptr, size, nmemb, unit); - return ret; -} -static size_t _fileWriteFuncForAdapter(void *ptr, size_t size, size_t nmemb, void* userdata) -{ - return nmemb; -} -static int _downloadProgressFunc(void* userdata, double totalToDownload, double nowDownloaded, double totalToUpLoad, double nowUpLoaded) -{ - DownloadUnit *downloadUnit = (DownloadUnit*)userdata; - DownloaderImpl* this_ = (DownloaderImpl*)downloadUnit->_reserved; - - this_->getProgressCallback()(downloadUnit, totalToDownload, nowDownloaded); - - // must return 0, otherwise download will get cancelled - return 0; -} - -DownloaderImpl::DownloaderImpl() -: IDownloaderImpl() -, _curlHandle(nullptr) -, _lastErrCode(CURLE_OK) -, _connectionTimeout(DEFAULT_TIMEOUT) -, _initialized(false) -{ -} -DownloaderImpl::~DownloaderImpl() -{ - if (_curlHandle) - curl_easy_cleanup(_curlHandle); -} - -bool DownloaderImpl::init() -{ - if (!_initialized) { - _curlHandle = curl_easy_init(); - _initialized = true; - } - - return _initialized; -} - -std::string DownloaderImpl::getStrError() const -{ - return curl_easy_strerror((CURLcode)_lastErrCode); -} - -int DownloaderImpl::performDownload(DownloadUnit* unit, - const WriterCallback& writerCallback, - const ProgressCallback& progressCallback - ) -{ - CC_ASSERT(_initialized && "must be initialized"); - - // for callbacks - unit->_reserved = this; - - curl_easy_setopt(_curlHandle, CURLOPT_URL, unit->srcUrl.c_str()); - - // Download pacakge - curl_easy_setopt(_curlHandle, CURLOPT_WRITEFUNCTION, _fileWriteFunc); - curl_easy_setopt(_curlHandle, CURLOPT_WRITEDATA, unit); - - curl_easy_setopt(_curlHandle, CURLOPT_NOPROGRESS, false); - curl_easy_setopt(_curlHandle, CURLOPT_PROGRESSFUNCTION, _downloadProgressFunc); - curl_easy_setopt(_curlHandle, CURLOPT_PROGRESSDATA, unit); - - curl_easy_setopt(_curlHandle, CURLOPT_FAILONERROR, true); - if (_connectionTimeout) - curl_easy_setopt(_curlHandle, CURLOPT_CONNECTTIMEOUT, _connectionTimeout); - curl_easy_setopt(_curlHandle, CURLOPT_NOSIGNAL, 1L); - curl_easy_setopt(_curlHandle, CURLOPT_LOW_SPEED_LIMIT, LOW_SPEED_LIMIT); - curl_easy_setopt(_curlHandle, CURLOPT_LOW_SPEED_TIME, LOW_SPEED_TIME); - - _writerCallback = writerCallback; - _progressCallback = progressCallback; - _lastErrCode = curl_easy_perform(_curlHandle); - return _lastErrCode; -} - -int DownloaderImpl::performBatchDownload(const DownloadUnits& units, - const WriterCallback& batchWriterCallback, - const ProgressCallback& batchProgressCallback, - const ErrorCallback& errorCallback) -{ - CC_ASSERT(_initialized && "must be initialized"); - - if (units.size() == 0) - return -1; - - CURLM* multi_handle = curl_multi_init(); - int still_running = 0; - - bool supportResume = supportsResume(units.cbegin()->second.srcUrl); - auto fileUtils = FileUtils::getInstance(); - - _writerCallback = batchWriterCallback; - _progressCallback = batchProgressCallback; - - std::vector curls; - curls.reserve(units.size()); - - for (const auto& unitEntry: units) - { - const auto& unit = unitEntry.second; - - // HACK: Needed for callbacks. "this" + "unit" are needed - unit._reserved = this; - - if (unit.fp != NULL) - { - CURL* curl = curl_easy_init(); - curl_easy_setopt(curl, CURLOPT_URL, unit.srcUrl.c_str()); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, _fileWriteFunc); - curl_easy_setopt(curl, CURLOPT_WRITEDATA, &unit); - curl_easy_setopt(curl, CURLOPT_NOPROGRESS, false); - curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, _downloadProgressFunc); - curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, &unit); - curl_easy_setopt(curl, CURLOPT_FAILONERROR, true); - if (_connectionTimeout) - curl_easy_setopt(_curlHandle, CURLOPT_CONNECTTIMEOUT, _connectionTimeout); - curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1L); - curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, LOW_SPEED_LIMIT); - curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, LOW_SPEED_TIME); - curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, true); - curl_easy_setopt(curl, CURLOPT_MAXREDIRS, MAX_REDIRS); - - // Resuming download support - if (supportResume && unit.resumeDownload) - { - // Check already downloaded size for current download unit - long size = fileUtils->getFileSize(unit.storagePath + TEMP_EXT); - if (size != -1) - { - curl_easy_setopt(curl, CURLOPT_RESUME_FROM_LARGE, size); - } - } - - CURLMcode code = curl_multi_add_handle(multi_handle, curl); - if (code != CURLM_OK) - { - errorCallback(StringUtils::format("Unable to add curl handler for %s: [curl error]%s", unit.customId.c_str(), curl_multi_strerror(code)), - code, - unit.customId); - curl_easy_cleanup(curl); - } - else - { - curls.push_back(curl); - } - } - } - - // Query multi perform - CURLMcode curlm_code = CURLM_CALL_MULTI_PERFORM; - while(CURLM_CALL_MULTI_PERFORM == curlm_code) { - curlm_code = curl_multi_perform(multi_handle, &still_running); - } - if (curlm_code != CURLM_OK) { - errorCallback(StringUtils::format("Unable to continue the download process: [curl error]%s", curl_multi_strerror(curlm_code)), - curlm_code, - ""); - } - else - { - bool failed = false; - while (still_running > 0 && !failed) - { - // set a suitable timeout to play around with - struct timeval select_tv; - long curl_timeo = -1; - select_tv.tv_sec = 1; - select_tv.tv_usec = 0; - - curl_multi_timeout(multi_handle, &curl_timeo); - if(curl_timeo >= 0) { - select_tv.tv_sec = curl_timeo / 1000; - if(select_tv.tv_sec > 1) - select_tv.tv_sec = 1; - else - select_tv.tv_usec = (curl_timeo % 1000) * 1000; - } - - int rc; - fd_set fdread; - fd_set fdwrite; - fd_set fdexcep; - int maxfd = -1; - FD_ZERO(&fdread); - FD_ZERO(&fdwrite); - FD_ZERO(&fdexcep); - // FIXME: when jenkins migrate to ubuntu, we should remove this hack code -#if (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX) - curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd); - rc = select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &select_tv); -#else - rc = curl_multi_wait(multi_handle,nullptr, 0, MAX_WAIT_MSECS, &maxfd); -#endif - - switch(rc) - { - case -1: - failed = true; - break; - case 0: - default: - curlm_code = CURLM_CALL_MULTI_PERFORM; - while(CURLM_CALL_MULTI_PERFORM == curlm_code) { - curlm_code = curl_multi_perform(multi_handle, &still_running); - } - if (curlm_code != CURLM_OK) { - errorCallback(StringUtils::format("Unable to continue the download process: [curl error]%s", curl_multi_strerror(curlm_code)), - curlm_code, - ""); - } - break; - } - } - } - - // Clean up and close files - for (auto& curl: curls) - { - curl_multi_remove_handle(multi_handle, curl); - curl_easy_cleanup(curl); - } - curl_multi_cleanup(multi_handle); - - return 0; -} - - -int DownloaderImpl::getHeader(const std::string& url, HeaderInfo* headerInfo) -{ - - void *curlHandle = curl_easy_init(); - CC_ASSERT(headerInfo && "headerInfo must not be null"); - - curl_easy_setopt(curlHandle, CURLOPT_URL, url.c_str()); - curl_easy_setopt(curlHandle, CURLOPT_HEADER, 1); - curl_easy_setopt(curlHandle, CURLOPT_NOBODY, 1); - curl_easy_setopt(curlHandle, CURLOPT_NOSIGNAL, 1); - // in win32 platform, if not set the writeFunction, it will return CURLE_WRITE_ERROR - curl_easy_setopt(curlHandle, CURLOPT_WRITEFUNCTION, _fileWriteFuncForAdapter); - if ((_lastErrCode=curl_easy_perform(curlHandle)) == CURLE_OK) - { - char *effectiveUrl; - char *contentType; - curl_easy_getinfo(curlHandle, CURLINFO_EFFECTIVE_URL, &effectiveUrl); - curl_easy_getinfo(curlHandle, CURLINFO_CONTENT_TYPE, &contentType); - curl_easy_getinfo(curlHandle, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &headerInfo->contentSize); - curl_easy_getinfo(curlHandle, CURLINFO_RESPONSE_CODE, &headerInfo->responseCode); - - if (contentType == nullptr || headerInfo->contentSize == -1 || headerInfo->responseCode >= 400) - { - headerInfo->valid = false; - } - else - { - headerInfo->url = effectiveUrl; - headerInfo->contentType = contentType; - headerInfo->valid = true; - } - - curl_easy_cleanup(curlHandle); - return 0; - } - - curl_easy_cleanup(curlHandle); - return -1; -} - -bool DownloaderImpl::supportsResume(const std::string& url) -{ - CC_ASSERT(_initialized && "must be initialized"); - - HeaderInfo headerInfo; - // Make a resume request - - curl_easy_setopt(_curlHandle, CURLOPT_RESUME_FROM_LARGE, 0); - if (getHeader(url, &headerInfo) == 0 && headerInfo.valid) - { - return (headerInfo.responseCode == HTTP_CODE_SUPPORT_RESUME); - } - return false; -} - -void DownloaderImpl::setConnectionTimeout(int connectionTimeout) -{ - _connectionTimeout = connectionTimeout; -} diff --git a/cocos/network/CCDownloaderImpl.h b/cocos/network/CCDownloaderImpl.h deleted file mode 100644 index 3707c3f40f..0000000000 --- a/cocos/network/CCDownloaderImpl.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** - Copyright (c) 2015 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. - ****************************************************************************/ - -#pragma once - -#include -#include - -#include "network/CCIDownloaderImpl.h" -#include "platform/CCPlatformMacros.h" - -/** - * @addtogroup network - * @{ - */ - -NS_CC_BEGIN - -namespace network -{ - class DownloaderImpl : public IDownloaderImpl - { - public: - DownloaderImpl(); - virtual ~DownloaderImpl(); - - bool init() override; - - // Overrides - int performDownload(DownloadUnit* unit, - const WriterCallback& writerCallback, - const ProgressCallback& progressCallback - ) override; - int performBatchDownload(const DownloadUnits& units, - const WriterCallback& writerCallback, - const ProgressCallback& progressCallback, - const ErrorCallback& errorCallback - ) override; - int getHeader(const std::string& url, HeaderInfo* headerInfo) override; - std::string getStrError() const override; - void setConnectionTimeout(int timeout) override; - bool supportsResume(const std::string& url); - - // - const WriterCallback& getWriterCallback() const { return _writerCallback; } - const ProgressCallback& getProgressCallback() const { return _progressCallback; } - - private: - - int _connectionTimeout; - WriterCallback _writerCallback; - ProgressCallback _progressCallback; - - void* _curlHandle; - int _lastErrCode; - bool _initialized; - }; - -} // namespace network - -NS_CC_END - -// end group -/// @} diff --git a/cocos/network/CCIDownloaderImpl.h b/cocos/network/CCIDownloaderImpl.h index 468be2db28..ff33db34aa 100644 --- a/cocos/network/CCIDownloaderImpl.h +++ b/cocos/network/CCIDownloaderImpl.h @@ -25,78 +25,46 @@ THE SOFTWARE. #pragma once #include -#include #include +#include -#include "platform/CCPlatformMacros.h" -#include "platform/CCStdC.h" +#include "base/CCConsole.h" -/** - * @addtogroup network - * @{ - */ +#define CC_DOWNLOADER_DEBUG +#ifdef CC_DOWNLOADER_DEBUG +#define DLLOG(format, ...) cocos2d::log(format, ##__VA_ARGS__) +#else +#define DLLOG(...) do {} while (0) +#endif -NS_CC_BEGIN - -namespace network +namespace cocos2d { namespace network { - struct HeaderInfo + class DownloadTask; + + class CC_DLL IDownloadTask { - bool valid; - std::string url; - std::string contentType; - double contentSize; - long responseCode; + public: + virtual ~IDownloadTask(){} }; - struct DownloadUnit - { - // info provided by the user - std::string srcUrl; - std::string storagePath; - std::string customId; - - // additional info created by CCDownloader - mutable void* fp; - mutable bool resumeDownload; - mutable double downloaded; - mutable double totalToDownload; - mutable void *_reserved; - }; - - typedef std::unordered_map DownloadUnits; - class IDownloaderImpl { public: - typedef std::function WriterCallback; - typedef std::function ProgressCallback; - typedef std::function ErrorCallback; - - IDownloaderImpl(){} virtual ~IDownloaderImpl(){} - virtual bool init() = 0; - - enum class Options { - RESUME - }; - - // methods that must be overriden - virtual int performDownload(DownloadUnit* unit, - const WriterCallback& writerCallback, - const ProgressCallback& progressCallback - ) = 0; - - virtual int performBatchDownload(const DownloadUnits& units, - const WriterCallback& writerCallback, - const ProgressCallback& progressCallback, - const ErrorCallback& errorCallback - ) = 0; - - virtual int getHeader(const std::string& url, HeaderInfo* headerInfo) = 0; - virtual std::string getStrError() const = 0; - virtual void setConnectionTimeout(int timeout) = 0; + + std::function& transferDataToBuffer)> onTaskProgress; + + std::function& data)> onTaskFinish; + + virtual IDownloadTask *createCoTask(std::shared_ptr& task) = 0; }; -} -NS_CC_END +}} // namespace cocos2d::network diff --git a/cocos/network/CMakeLists.txt b/cocos/network/CMakeLists.txt index a2079a9921..6c461736d9 100644 --- a/cocos/network/CMakeLists.txt +++ b/cocos/network/CMakeLists.txt @@ -13,7 +13,7 @@ set(COCOS_NETWORK_SRC network/SocketIO.cpp network/WebSocket.cpp network/CCDownloader.cpp - network/CCDownloaderImpl.cpp + network/CCDownloader-curl.cpp ) if(MSVC) diff --git a/cocos/network/SocketIO.cpp b/cocos/network/SocketIO.cpp index 58dd0de8ec..083b2071d8 100644 --- a/cocos/network/SocketIO.cpp +++ b/cocos/network/SocketIO.cpp @@ -1096,6 +1096,11 @@ void SIOClient::fireEvent(const std::string& eventName, const std::string& data) CCLOGINFO("SIOClient::fireEvent no native event with name %s found", eventName.c_str()); } + +void SIOClient::setTag(const char* tag) +{ + _tag = tag; +} //begin SocketIO methods SocketIO *SocketIO::_inst = nullptr; diff --git a/cocos/network/SocketIO.h b/cocos/network/SocketIO.h index 3456320cc6..5ad10d0f35 100644 --- a/cocos/network/SocketIO.h +++ b/cocos/network/SocketIO.h @@ -262,10 +262,8 @@ public: * The tag is used to distinguish the various SIOClient objects. * @param tag string object. */ - inline void setTag(const char* tag) - { - _tag = tag; - }; + void setTag(const char* tag); + /** * Get tag of SIOClient. * @return const char* the pointer point to the _tag. diff --git a/cocos/physics/CCComponentPhysics2d.cpp b/cocos/physics/CCComponentPhysics2d.cpp new file mode 100644 index 0000000000..08c4c9c3b8 --- /dev/null +++ b/cocos/physics/CCComponentPhysics2d.cpp @@ -0,0 +1,263 @@ +/**************************************************************************** + Copyright (c) 2015 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. + ****************************************************************************/ + +#include "base/ccConfig.h" // to include defination of CC_USE_PHYSICS +#if CC_USE_PHYSICS + +#include "physics/CCComponentPhysics2d.h" +#include "physics/CCPhysicsBody.h" +#include "physics/CCPhysicsManager.h" +#include "2d/CCNode.h" +#include "base/CCDirector.h" + +NS_CC_BEGIN + +const std::string ComponentPhysics2d::COMPONENT_NAME = "physics2d"; + +ComponentPhysics2d* ComponentPhysics2d::create() +{ + return create(nullptr); +} + +ComponentPhysics2d* ComponentPhysics2d::create(PhysicsBody *physicsBody) +{ + auto ret = new (std::nothrow) ComponentPhysics2d(physicsBody); + if (ret) + ret->autorelease(); + + return ret; +} + +ComponentPhysics2d::ComponentPhysics2d() +: _physicsBody(nullptr) +, _physicsRotation(0.0f) +, _ownerOriginRotation(0.0f) +{ + _name = COMPONENT_NAME; +} + +ComponentPhysics2d::ComponentPhysics2d(PhysicsBody* physicsBody) +: _physicsRotation(0.0f) +, _ownerOriginRotation(0.0f) +, _physicsBody(nullptr) // should set to null to invoke setPhysicsBody() +{ + _name = COMPONENT_NAME; + setPhysicsBody(physicsBody); +} + +ComponentPhysics2d::~ComponentPhysics2d() +{ + removePhysicsBody(); +} + +// true if two Vec3 equals, false else +bool ComponentPhysics2d::isVec3Equal(const cocos2d::Vec3 &v1, const cocos2d::Vec3 &v2) const +{ + return fabs(v1.x - v2.x) < FLT_EPSILON && + fabs(v1.x - v2.y) < FLT_EPSILON; +} + +void ComponentPhysics2d::beforeSimulation() +{ + if (nullptr == _physicsBody) + return; + + _nodeToWorldTransform = _owner->getNodeToWorldTransform(); + + // set scale + _nodeToWorldTransform.getScale(&_scale); + if (! isVec3Equal(_scale, _recordScale)) + { + _physicsBody->setScale(_scale.x, _scale.y); + _recordScale = _scale; + } + + // set rotation + if (_owner->getParent()) + { + _physicsRotation = getPhysicsRotation(_owner->getParent()) + _owner->getRotation(); + } + _physicsBody->setRotation(_physicsRotation - _ownerOriginRotation); + + // set position + auto worldPosition = _ownerCenterOffset; + _nodeToWorldTransform.transformPoint(&worldPosition); + _physicsBody->setPosition(Vec2(worldPosition.x, worldPosition.y)); + + getParentToWorldTransform().getInversed().transformPoint(&worldPosition); + _offset.x = worldPosition.x - _owner->getPosition().x; + _offset.y = worldPosition.y - _owner->getPosition().y; +} + +void ComponentPhysics2d::afterSimulation() +{ + if (nullptr == _physicsBody) + return; + + // set Node position + auto worldPosition = _physicsBody->getPosition(); + Vec3 positionInParent(worldPosition.x, worldPosition.y, 0); + getParentToWorldTransform().getInversed().transformPoint(&positionInParent); + _owner->setPosition(positionInParent.x - _offset.x, positionInParent.y - _offset.y); + + // set Node rotation + _physicsRotation = _physicsBody->getRotation(); + _owner->setRotation(_physicsRotation - getPhysicsRotation(_owner->getParent()) + _ownerOriginRotation); +} + +void ComponentPhysics2d::setPhysicsBody(PhysicsBody *physicsBody) +{ + removeFromPhysicsManager(); + + if (physicsBody != _physicsBody) + { + if (nullptr != _physicsBody) + { + _physicsBody->release(); + _physicsBody->_componentBelongsTo = nullptr; + } + + // two components should not share the same physics body + if (physicsBody && physicsBody->_componentBelongsTo != nullptr) + physicsBody->_componentBelongsTo->_physicsBody = nullptr; + + _physicsBody = physicsBody; + + if (nullptr != _physicsBody) + { + _physicsBody->retain(); + _physicsBody->_componentBelongsTo = this; + } + } + + addToPhysicsManager(); +} + +PhysicsBody* ComponentPhysics2d::getPhysicsBody() const +{ + return _physicsBody; +} + +void ComponentPhysics2d::setEnabled(bool value) +{ + Component::setEnabled(value); + + if (value) + addToPhysicsManager(); + else + removeFromPhysicsManager(); +} + +void ComponentPhysics2d::onEnter() +{ + addToPhysicsManager(); +} + +void ComponentPhysics2d::onExit() +{ + removeFromPhysicsManager(); +} + +void ComponentPhysics2d::onAdd() +{ + auto contentSize = _owner->getContentSize(); + _ownerCenterOffset.x = 0.5 * contentSize.width; + _ownerCenterOffset.y = 0.5 * contentSize.height; + + _ownerOriginRotation = _owner->getRotation(); + + // component may be added after onEnter() has been invoked, so we should add + // this line to make sure physics body is added to physics world + addToPhysicsManager(); +} + +void ComponentPhysics2d::onRemove() +{ + removePhysicsBody(); +} + +void ComponentPhysics2d::removePhysicsBody() +{ + removeFromPhysicsManager(); + + if (_physicsBody) + { + _physicsBody->_componentBelongsTo = nullptr; + _physicsBody->release(); + _physicsBody = nullptr; + } +} + +void ComponentPhysics2d::addToPhysicsManager() +{ + if (_owner) + { + auto scene = _owner->getScene(); + if (scene) + scene->getPhysicsManager()->addPhysicsComponent(this); + } + +} + +void ComponentPhysics2d::removeFromPhysicsManager() +{ + if (_owner) + { + auto scene = _owner->getScene(); + if (scene) + scene->getPhysicsManager()->removePhysicsComponent(this); + } +} + +Mat4 ComponentPhysics2d::getParentToWorldTransform() const +{ + if (_owner->getParent()) + return _owner->getParent()->getNodeToWorldTransform(); + else + return _owner->getNodeToWorldTransform(); +} + +float ComponentPhysics2d::getPhysicsRotation(Node *node) const +{ + if (!node) + return 0.0f; + + auto physicsComponent = node->getComponent(); + if (physicsComponent) + { + return physicsComponent->_physicsRotation; + } + else + { + auto parent = node->getParent(); + if (parent) + return getPhysicsRotation(parent) + node->getRotation(); + else + return 0.0f; + } +} + +NS_CC_END + +#endif // CC_USE_PHYSICS diff --git a/cocos/physics/CCComponentPhysics2d.h b/cocos/physics/CCComponentPhysics2d.h new file mode 100644 index 0000000000..6814b883ef --- /dev/null +++ b/cocos/physics/CCComponentPhysics2d.h @@ -0,0 +1,140 @@ +/**************************************************************************** + Copyright (c) 2015 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. + ****************************************************************************/ + +#pragma once + +#include "base/ccConfig.h" // to include defination of CC_USE_PHYSICS +#if CC_USE_PHYSICS + +#include "platform/CCPlatformMacros.h" +#include "2d/CCComponent.h" + +NS_CC_BEGIN + +/** + * @addtogroup physics + * @{ + * @addtogroup physics_2d + * @{ + */ + +class PhysicsBody; + +class CC_DLL ComponentPhysics2d : public Component +{ +public: + /** + * Create a physics component without physics body. Can set phyiscs body later with setPhysicsBody(). + * I am not sure if we need this function, because i think physics body is needed when creating a + * physics component. But i think it is needed by editor, so i keep this function. + * + * @return A pointer of `ComponentPhysics2d` that is autoreleased. + */ + static ComponentPhysics2d* create(); + /** + * Create a physics component with physics body. + * + * @param physicsBody The physics body that belongs to this component. + * @return A pointer of `ComponentPhysics2d` that is autoreleased. + */ + static ComponentPhysics2d* create(PhysicsBody *physicsBody); + + virtual ~ComponentPhysics2d(); + + /// @cond DO_NOT_SHOW + + /** + * Synchronize Node's status(position, rotation, scale) to phyiscs body. + * It is invoked before physics simulation. + * + * @warning Don't invoke this funciton by yourself. + */ + void beforeSimulation(); + /** + * Synchronize physics body's status(position, rotation) to phyiscs body. + * It is invoked after physics simulation. + * + * @warning Don't invoke this funciton by yourself. + */ + void afterSimulation(); + + /// @endcond DO_NOT_SHOW + + /** + * Set physics body of this physics component. If the physics body is set to + * another physics component before, will set another physics component's physics + * body to null. + * + * @param physicsBody The physics body belongs to this component. + */ + void setPhysicsBody(PhysicsBody *physicsBody); + /** + * Get the physics body of this component. + * + * @return The physics body of this component. + */ + PhysicsBody* getPhysicsBody() const; + + virtual void setEnabled(bool value) override; + virtual void onEnter() override; + virtual void onExit() override; + virtual void onAdd() override; + virtual void onRemove() override; + +public: + const static std::string COMPONENT_NAME; + +CC_CONSTRUCTOR_ACCESS: + ComponentPhysics2d(); + ComponentPhysics2d(PhysicsBody *phsicsBody); + +private: + void removePhysicsBody(); + void addToPhysicsManager(); + void removeFromPhysicsManager(); + Mat4 getParentToWorldTransform() const; + float getPhysicsRotation(Node *node) const; + bool isVec3Equal(const Vec3 &v1, const Vec3 &v2) const; + +private: + // this physic body of this component + PhysicsBody *_physicsBody; + // offset between owner's center point and down left point + Vec3 _ownerCenterOffset; + Mat4 _nodeToWorldTransform; + // offset of owner's center point and anchor point in parent coordinate + Vec2 _offset; + float _physicsRotation; + // the rotation of owner when the component is added to, the value will not change + float _ownerOriginRotation; + Vec3 _recordScale; + Vec3 _scale; +}; + +/** @} */ +/** @} */ + +NS_CC_END + +#endif // CC_USE_PHYSICS diff --git a/cocos/physics/CCPhysicsBody.cpp b/cocos/physics/CCPhysicsBody.cpp index 188a16e00b..563bb9973f 100644 --- a/cocos/physics/CCPhysicsBody.cpp +++ b/cocos/physics/CCPhysicsBody.cpp @@ -31,10 +31,11 @@ #include "chipmunk.h" #include "2d/CCScene.h" -#include "CCPhysicsShape.h" -#include "CCPhysicsJoint.h" -#include "CCPhysicsWorld.h" -#include "CCPhysicsHelper.h" +#include "physics/CCPhysicsShape.h" +#include "physics/CCPhysicsJoint.h" +#include "physics/CCPhysicsWorld.h" +#include "physics/CCPhysicsHelper.h" +#include "physics/CCComponentPhysics2d.h" static inline void cpBodyUpdateVelocityWithoutGravity(cpBody *body, cpVect gravity, cpFloat damping, cpFloat dt) { @@ -51,8 +52,7 @@ namespace } PhysicsBody::PhysicsBody() -: _node(nullptr) -, _world(nullptr) +: _world(nullptr) , _cpBody(nullptr) , _dynamic(true) , _enabled(true) @@ -68,10 +68,12 @@ PhysicsBody::PhysicsBody() , _linearDamping(0.0f) , _angularDamping(0.0f) , _tag(0) -, _positionInitDirty(true) , _rotationOffset(0) , _recordedRotation(0.0f) , _recordedAngle(0.0) +, _componentBelongsTo(nullptr) +, _massSetByUser(false) +, _momentSetByUser(false) { } @@ -334,8 +336,6 @@ void PhysicsBody::setGravityEnable(bool enable) void PhysicsBody::setPosition(const Vec2& position) { - _positionInitDirty = false; - _recordedPosition = position; cpBodySetPos(_cpBody, PhysicsHelper::point2cpv(position + _positionOffset)); } @@ -350,25 +350,25 @@ void PhysicsBody::setScale(float scaleX, float scaleY) { for (auto shape : _shapes) { + _area -= shape->getArea(); + if (!_massSetByUser) + addMass(-shape->getMass()); + if (!_momentSetByUser) + addMoment(-shape->getMoment()); + shape->setScale(scaleX, scaleY); + + _area += shape->getArea(); + if (!_massSetByUser) + addMass(shape->getMass()); + if (!_momentSetByUser) + addMoment(shape->getMoment()); } } -const Vec2& PhysicsBody::getPosition() +Vec2 PhysicsBody::getPosition() const { - if (_positionInitDirty) { - if (_node) { - if (_node->getParent()) { - _latestPosition = _node->getParent()->convertToWorldSpace(_node->getPosition()); - } else { - _latestPosition = _node->getPosition(); - } - } - } else { - _latestPosition.x = _cpBody->p.x - _positionOffset.x; - _latestPosition.y = _cpBody->p.y - _positionOffset.y; - } - return _latestPosition; + return Vec2(_cpBody->p.x - _positionOffset.x, _cpBody->p.y - _positionOffset.y); } float PhysicsBody::getRotation() @@ -450,6 +450,7 @@ void PhysicsBody::setMass(float mass) } _mass = mass; _massDefault = false; + _massSetByUser = true; // update density if (_mass == PHYSICS_INFINITY) @@ -628,6 +629,7 @@ void PhysicsBody::setMoment(float moment) { _moment = moment; _momentDefault = false; + _momentSetByUser = true; // the static body's mass and moment is always infinity if (_rotationEnabled && _dynamic) @@ -723,6 +725,14 @@ void PhysicsBody::removeFromWorld() } } +Node* PhysicsBody::getNode() const +{ + if (_componentBelongsTo) + return _componentBelongsTo->getOwner(); + else + return nullptr; +} + void PhysicsBody::setEnable(bool enable) { if (_enabled != enable) @@ -760,15 +770,12 @@ void PhysicsBody::setResting(bool rest) const void PhysicsBody::update(float delta) { - if (_node) + // damping compute + if (_isDamping && _dynamic && !isResting()) { - // damping compute - if (_isDamping && _dynamic && !isResting()) - { - _cpBody->v.x *= cpfclamp(1.0f - delta * _linearDamping, 0.0f, 1.0f); - _cpBody->v.y *= cpfclamp(1.0f - delta * _linearDamping, 0.0f, 1.0f); - _cpBody->w *= cpfclamp(1.0f - delta * _angularDamping, 0.0f, 1.0f); - } + _cpBody->v.x *= cpfclamp(1.0f - delta * _linearDamping, 0.0f, 1.0f); + _cpBody->v.y *= cpfclamp(1.0f - delta * _linearDamping, 0.0f, 1.0f); + _cpBody->w *= cpfclamp(1.0f - delta * _angularDamping, 0.0f, 1.0f); } } diff --git a/cocos/physics/CCPhysicsBody.h b/cocos/physics/CCPhysicsBody.h index a47fd564a8..ad0db3d1a5 100644 --- a/cocos/physics/CCPhysicsBody.h +++ b/cocos/physics/CCPhysicsBody.h @@ -41,6 +41,7 @@ class Node; class Sprite; class PhysicsWorld; class PhysicsJoint; +class ComponentPhysics2d; typedef Vec2 Vect; @@ -305,7 +306,7 @@ public: inline const std::vector& getJoints() const { return _joints; } /** get the sprite the body set to. */ - inline Node* getNode() const { return _node; } + Node* getNode() const; /** * A mask that defines which categories this physics body belongs to. @@ -368,7 +369,7 @@ public: int getGroup() const; /** get the body position. */ - const Vec2& getPosition(); + Vec2 getPosition() const; /** get the body rotation. */ float getRotation(); @@ -505,7 +506,7 @@ public: Vec2 local2World(const Vec2& point); /** Get the rigid body of chipmunk. */ - cpBody* getCPBody() { return _cpBody; } + cpBody* getCPBody() const { return _cpBody; } protected: @@ -525,10 +526,11 @@ protected: virtual ~PhysicsBody(); protected: - Node* _node; std::vector _joints; Vector _shapes; PhysicsWorld* _world; + // weak reference + ComponentPhysics2d *_componentBelongsTo; cpBody* _cpBody; bool _dynamic; bool _enabled; @@ -545,9 +547,11 @@ protected: float _angularDamping; int _tag; - bool _positionInitDirty; - Vec2 _recordedPosition; - Vec2 _latestPosition; + // when setMass() is invoked, it means body's mass is not calculated by shapes + bool _massSetByUser; + // when setMoment() is invoked, it means body's moment is not calculated by shapes + bool _momentSetByUser; + Vec2 _positionOffset; float _rotationOffset; float _recordedRotation; @@ -559,6 +563,7 @@ protected: friend class Node; friend class Layer; friend class ProtectedNode; + friend class ComponentPhysics2d; }; /** @} */ diff --git a/cocos/physics/CCPhysicsManager.cpp b/cocos/physics/CCPhysicsManager.cpp new file mode 100644 index 0000000000..15a4d40583 --- /dev/null +++ b/cocos/physics/CCPhysicsManager.cpp @@ -0,0 +1,133 @@ +/**************************************************************************** + Copyright (c) 2015 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. + ****************************************************************************/ + +#include "base/ccConfig.h" // to include defination of CC_USE_PHYSICS +#if CC_USE_PHYSICS + +#include "physics/CCPhysicsManager.h" +#include "physics/CCComponentPhysics2d.h" +#include "physics/CCPhysicsWorld.h" +#include "2d/CCScene.h" + +NS_CC_BEGIN + +PhysicsManager::PhysicsManager(Scene *scene) +: _scene(scene) +{ + _physicsWorld = PhysicsWorld::construct(); +} + +PhysicsManager::~PhysicsManager() +{ + delete _physicsWorld; +} + +void PhysicsManager::update(float dt) +{ + // Update physics position, should loop as the same sequence as node tree. + // ComponentPhysics2d::beforeSimulation() will depend on the sequence. + beforeSimulation(_scene); + + // do simulation + _physicsWorld->update(dt, false); + + // Update physics position, should loop as the same sequence as node tree. + // ComponentPhysics2d::afterSimulation() will depend on the sequence. + afterSimulation(_scene); +} + +void PhysicsManager::beforeSimulation(Node *node) +{ + auto iter = _owners.find(node); + if (iter != _owners.end()) + { + auto component = iter->second; + component->beforeSimulation(); + } + + for (auto child : node->getChildren()) + beforeSimulation(child); +} + +void PhysicsManager::afterSimulation(Node *node) +{ + auto iter = _owners.find(node); + if (iter != _owners.end()) + { + auto component = iter->second; + component->afterSimulation(); + } + + for (auto child : node->getChildren()) + afterSimulation(child); +} + +void PhysicsManager::addPhysicsComponent(ComponentPhysics2d* componentPhsics2d) +{ + // don't add component again + if (std::find(_components.begin(), _components.end(), componentPhsics2d) != _components.end()) + return; + + _components.push_back(componentPhsics2d); + // Node::getComponent<>() is a time comsuming operation, so record data to avoid invoking it. + std::pair element(componentPhsics2d->getOwner(), componentPhsics2d); + _owners.insert(element); + + if (nullptr != componentPhsics2d->getPhysicsBody()) + _physicsWorld->addBody(componentPhsics2d->getPhysicsBody()); +} + +void PhysicsManager::removePhysicsComponent(ComponentPhysics2d* componentPhsics2d) +{ + auto iter = std::find(_components.begin(), _components.end(), componentPhsics2d); + if (iter != _components.end()) + { + removeElementFromMap(*iter); + + _components.erase(iter); + if (componentPhsics2d->getPhysicsBody()) + _physicsWorld->removeBody(componentPhsics2d->getPhysicsBody()); + } +} + +void PhysicsManager::removeElementFromMap(ComponentPhysics2d* component) +{ + for (auto element : _owners) + { + if (element.second == component) + { + _owners.erase(element.first); + break; + } + } +} + +PhysicsWorld* PhysicsManager::getPhysicsWorld() const +{ + return _physicsWorld; +} + +NS_CC_END + +#endif // CC_USE_PHYSICS diff --git a/cocos/physics/CCPhysicsManager.h b/cocos/physics/CCPhysicsManager.h new file mode 100644 index 0000000000..5c1ecc0931 --- /dev/null +++ b/cocos/physics/CCPhysicsManager.h @@ -0,0 +1,124 @@ +/**************************************************************************** + Copyright (c) 2015 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. + ****************************************************************************/ + +#pragma once + +#include "base/ccConfig.h" // to include defination of CC_USE_PHYSICS +#if CC_USE_PHYSICS + +#include +#include + +#include "platform/CCPlatformMacros.h" + +NS_CC_BEGIN + +class ComponentPhysics2d; +class PhysicsWorld; +class Scene; +class Node; + +/** + * @addtogroup physics + * @{ + * @addtogroup physics_2d + * @{ + */ + +/** + * Now `PhysicsManager` belongs to a `Scene`. `Scene` will create `PhysicsManager` automatically. + * The reason to design like this are: + * - PhysicsManager keeps physics world, it is reasonale that a scene has its own physics world. + * It is useful that when a scene is active again, you don't have to create physics world and + * do all related things again. + * - Keep compatibility + */ +class CC_DLL PhysicsManager +{ +public: + + /// @cond DO_NOT_SHOW + + /** + * Create a PhysicsManager with `Scene`. `Scene` will create it automatically, + * so don't create it yourself. + * + * @scene The scene this `PhysicsManager` belongs to. + */ + PhysicsManager(Scene *scene); + /** + * Destructor. + */ + ~PhysicsManager(); + + /** + * Do physics simulation. It will do the following things: + * - synchronize Node's status(position, rotation, scale) to corresponding physics body + * - do physics simulation + * - synchronize physics body's status(position, rotation) to correspondind Node + * + * It is invoked by `Scene`, don't invoke it yourself. + */ + void update(float dt); + + /// @endcond DO_NOT_SHOW + + /** + * Get the physics world. + * + * @return Physics world managed by this `PhysicsManager`. + */ + PhysicsWorld* getPhysicsWorld() const; + + /** + * Add a physics component to be managed by the `PhysicsManager`. Will register physics + * component's physics body to physics world managed by this `PhysicsManager`. + * + * @param componentPhsics2d The physics component to be managed by this `PhysicsManager`. + */ + void addPhysicsComponent(ComponentPhysics2d* componentPhsics2d); + /** + * Remove a physics component from `PhysiscsManager`. Will remove physics component's physics + * body from the physics world managed by this `PhysicsManager`. + */ + void removePhysicsComponent(ComponentPhysics2d* componentPhsics2d); + +private: + void beforeSimulation(Node *node); + void afterSimulation(Node* node); + void removeElementFromMap(ComponentPhysics2d* component); +private: + std::vector _components; + // record the owners of components for performance + std::unordered_map _owners; + PhysicsWorld *_physicsWorld; + Scene *_scene; +}; + +/** @} */ +/** @} */ + +NS_CC_END + +#endif // CC_USE_PHYSICS diff --git a/cocos/physics/CCPhysicsShape.cpp b/cocos/physics/CCPhysicsShape.cpp index 538778e7d1..9f5116305e 100644 --- a/cocos/physics/CCPhysicsShape.cpp +++ b/cocos/physics/CCPhysicsShape.cpp @@ -114,7 +114,7 @@ void PhysicsShape::setMaterial(const PhysicsMaterial& material) void PhysicsShape::setScale(float scaleX, float scaleY) { - if (_scaleX != scaleX || _scaleY != scaleY) + if (fabs(_scaleX - scaleX) > FLT_EPSILON || fabs(_scaleY - scaleY) > FLT_EPSILON) { if (_type == Type::CIRCLE && scaleX != scaleY) { @@ -123,7 +123,13 @@ void PhysicsShape::setScale(float scaleX, float scaleY) } _newScaleX = scaleX; _newScaleY = scaleY; + updateScale(); + + // re-calculate area and mass + _area = calculateArea(); + _mass = _material.density * _area; + _moment = calculateDefaultMoment(); } } @@ -649,10 +655,14 @@ void PhysicsShapePolygon::updateScale() for (int i = 0; i < count; ++i) { - cpVect n = cpvnormalize(cpvperp(cpvsub(vects[i], vects[(i + 1) % count]))); - - planes[i].n = n; - planes[i].d = cpvdot(n, vects[i]); +// cpVect n = cpvnormalize(cpvperp(cpvsub(vects[i], vects[(i + 1) % count]))); +// +// planes[i].n = n; +// planes[i].d = cpvdot(n, vects[i]); + + // FIXED ME: if update 'planes[i]' as the above codes, then can not query polygon shape by PhysicsWorld::getShapes(). + // But modified like this, then ray test can not work correctly on some cases. + planes[i].d = cpvdot(planes[i].n, vects[i]); } PhysicsShape::updateScale(); diff --git a/cocos/physics/CCPhysicsWorld.cpp b/cocos/physics/CCPhysicsWorld.cpp index 117d4627c1..1ceb0824f4 100644 --- a/cocos/physics/CCPhysicsWorld.cpp +++ b/cocos/physics/CCPhysicsWorld.cpp @@ -281,7 +281,7 @@ int PhysicsWorld::collisionBeginCallback(PhysicsContact& contact) { contact.setEventCode(PhysicsContact::EventCode::BEGIN); contact.setWorld(this); - _scene->getEventDispatcher()->dispatchEvent(&contact); + Director::getInstance()->getEventDispatcher()->dispatchEvent(&contact); } return ret ? contact.resetResult() : false; @@ -296,7 +296,7 @@ int PhysicsWorld::collisionPreSolveCallback(PhysicsContact& contact) contact.setEventCode(PhysicsContact::EventCode::PRESOLVE); contact.setWorld(this); - _scene->getEventDispatcher()->dispatchEvent(&contact); + Director::getInstance()->getEventDispatcher()->dispatchEvent(&contact); return contact.resetResult(); } @@ -310,7 +310,7 @@ void PhysicsWorld::collisionPostSolveCallback(PhysicsContact& contact) contact.setEventCode(PhysicsContact::EventCode::POSTSOLVE); contact.setWorld(this); - _scene->getEventDispatcher()->dispatchEvent(&contact); + Director::getInstance()->getEventDispatcher()->dispatchEvent(&contact); } void PhysicsWorld::collisionSeparateCallback(PhysicsContact& contact) @@ -322,7 +322,7 @@ void PhysicsWorld::collisionSeparateCallback(PhysicsContact& contact) contact.setEventCode(PhysicsContact::EventCode::SEPARATE); contact.setWorld(this); - _scene->getEventDispatcher()->dispatchEvent(&contact); + Director::getInstance()->getEventDispatcher()->dispatchEvent(&contact); } void PhysicsWorld::rayCast(PhysicsRayCastCallbackFunc func, const Vec2& point1, const Vec2& point2, void* data) @@ -333,7 +333,6 @@ void PhysicsWorld::rayCast(PhysicsRayCastCallbackFunc func, const Vec2& point1, { if (!_delayAddBodies.empty() || !_delayRemoveBodies.empty()) { - _scene->updatePhysicsBodyTransform(_scene->getNodeToParentTransform(), 0, 1.0f, 1.0f); updateBodies(); } RayCastCallbackInfo info = { this, func, point1, point2, data }; @@ -357,7 +356,6 @@ void PhysicsWorld::queryRect(PhysicsQueryRectCallbackFunc func, const Rect& rect { if (!_delayAddBodies.empty() || !_delayRemoveBodies.empty()) { - _scene->updatePhysicsBodyTransform(_scene->getNodeToParentTransform(), 0, 1.0f, 1.0f); updateBodies(); } RectQueryCallbackInfo info = {this, func, data}; @@ -380,7 +378,6 @@ void PhysicsWorld::queryPoint(PhysicsQueryPointCallbackFunc func, const Vec2& po { if (!_delayAddBodies.empty() || !_delayRemoveBodies.empty()) { - _scene->updatePhysicsBodyTransform(_scene->getNodeToParentTransform(), 0, 1.0f, 1.0f); updateBodies(); } PointQueryCallbackInfo info = {this, func, data}; @@ -422,10 +419,10 @@ PhysicsShape* PhysicsWorld::getShape(const Vec2& point) const return shape == nullptr ? nullptr : s_physicsShapeMap.find(shape)->second; } -PhysicsWorld* PhysicsWorld::construct(Scene& scene) +PhysicsWorld* PhysicsWorld::construct() { PhysicsWorld * world = new (std::nothrow) PhysicsWorld(); - if(world && world->init(scene)) + if(world && world->init()) { return world; } @@ -434,15 +431,13 @@ PhysicsWorld* PhysicsWorld::construct(Scene& scene) return nullptr; } -bool PhysicsWorld::init(Scene& scene) +bool PhysicsWorld::init() { do { _cpSpace = cpSpaceNew(); CC_BREAK_IF(_cpSpace == nullptr); - _scene = &scene; - cpSpaceSetGravity(_cpSpace, PhysicsHelper::point2cpv(_gravity)); cpSpaceSetDefaultCollisionHandler(_cpSpace, @@ -817,11 +812,9 @@ void PhysicsWorld::step(float delta) void PhysicsWorld::update(float delta, bool userCall/* = false*/) { - if(_updateBodyTransform || !_delayAddBodies.empty()) + if(!_delayAddBodies.empty()) { - _scene->updatePhysicsBodyTransform(_scene->getNodeToParentTransform(), 0, 1.0f, 1.0f); updateBodies(); - _updateBodyTransform = false; } else if (!_delayRemoveBodies.empty()) { @@ -904,7 +897,7 @@ PhysicsDebugDraw::PhysicsDebugDraw(PhysicsWorld& world) , _world(world) { _drawNode = DrawNode::create(); - _world.getScene().addChild(_drawNode); + Director::getInstance()->getRunningScene()->addChild(_drawNode); } PhysicsDebugDraw::~PhysicsDebugDraw() diff --git a/cocos/physics/CCPhysicsWorld.h b/cocos/physics/CCPhysicsWorld.h index 4f45d6554e..107dcac932 100644 --- a/cocos/physics/CCPhysicsWorld.h +++ b/cocos/physics/CCPhysicsWorld.h @@ -329,8 +329,9 @@ public: void step(float delta); protected: - static PhysicsWorld* construct(Scene& scene); - bool init(Scene& scene); + static PhysicsWorld* construct(); + bool init(); + virtual void addBody(PhysicsBody* body); virtual void addShape(PhysicsShape* shape); @@ -389,6 +390,7 @@ protected: friend class PhysicsJoint; friend class PhysicsWorldCallback; friend class PhysicsDebugDraw; + friend class PhysicsManager; }; /** A physics helper class. Draw physics shape, joint in debug mode. diff --git a/cocos/physics/CMakeLists.txt b/cocos/physics/CMakeLists.txt index 22d5349bdf..4a2b9447d6 100644 --- a/cocos/physics/CMakeLists.txt +++ b/cocos/physics/CMakeLists.txt @@ -6,5 +6,6 @@ set(COCOS_PHYSICS_SRC physics/CCPhysicsJoint.cpp physics/CCPhysicsShape.cpp physics/CCPhysicsWorld.cpp - + physics/CCComponentPhysics2d.cpp + physics/CCPhysicsManager.cpp ) diff --git a/cocos/platform/CCFileUtils.cpp b/cocos/platform/CCFileUtils.cpp index 7349264842..93636e1856 100644 --- a/cocos/platform/CCFileUtils.cpp +++ b/cocos/platform/CCFileUtils.cpp @@ -827,7 +827,7 @@ std::string FileUtils::fullPathForFilename(const std::string &filename) const { fullpath = this->getPathForFilename(newFilename, resolutionIt, searchIt); - if (fullpath.length() > 0) + if (!fullpath.empty()) { // Using the filename passed in as key. _fullPathCache.insert(std::make_pair(filename, fullpath)); @@ -926,7 +926,7 @@ void FileUtils::setSearchPaths(const std::vector& searchPaths) prefix = _defaultResRootPath; } path = prefix + (iter); - if (path.length() > 0 && path[path.length()-1] != '/') + if (!path.empty() && path[path.length()-1] != '/') { path += "/"; } @@ -951,7 +951,7 @@ void FileUtils::addSearchPath(const std::string &searchpath,const bool front) prefix = _defaultResRootPath; std::string path = prefix + searchpath; - if (path.length() > 0 && path[path.length()-1] != '/') + if (!path.empty() && path[path.length()-1] != '/') { path += "/"; } @@ -971,7 +971,7 @@ void FileUtils::setFilenameLookupDictionary(const ValueMap& filenameLookupDict) void FileUtils::loadFilenameLookupDictionaryFromFile(const std::string &filename) { const std::string fullPath = fullPathForFilename(filename); - if (fullPath.length() > 0) + if (!fullPath.empty()) { ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(fullPath); if (!dict.empty()) diff --git a/cocos/platform/CCImage.cpp b/cocos/platform/CCImage.cpp index 3ff9040b2f..3373c8b5b3 100644 --- a/cocos/platform/CCImage.cpp +++ b/cocos/platform/CCImage.cpp @@ -576,7 +576,7 @@ bool Image::initWithImageData(const unsigned char * data, ssize_t dataLen) } else { - CCAssert(false, "unsupport image format!"); + CCLOG("cocos2d: unsupported image format!"); } free(tgaData); diff --git a/cocos/platform/android/java/libs/android-async-http-1.4.8.jar b/cocos/platform/android/java/libs/android-async-http-1.4.8.jar new file mode 100644 index 0000000000..74664cca13 Binary files /dev/null and b/cocos/platform/android/java/libs/android-async-http-1.4.8.jar differ diff --git a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java index 685fd027fc..cadabac2e2 100644 --- a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java +++ b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java @@ -108,6 +108,7 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe private Cocos2dxVideoHelper mVideoHelper = null; private Cocos2dxWebViewHelper mWebViewHelper = null; private Cocos2dxEditBoxHelper mEditBoxHelper = null; + private boolean hasFocus = false; public Cocos2dxGLSurfaceView getGLSurfaceView(){ return mGLSurfaceView; @@ -338,21 +339,30 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe @Override protected void onResume() { + Log.d(TAG, "onResume()"); super.onResume(); + resumeIfHasFocus(); } @Override public void onWindowFocusChanged(boolean hasFocus) { + Log.d(TAG, "onWindowFocusChanged() hasFocus=" + hasFocus); super.onWindowFocusChanged(hasFocus); - if (hasFocus) { - Cocos2dxHelper.onResume(); - mGLSurfaceView.onResume(); + this.hasFocus = hasFocus; + resumeIfHasFocus(); + } + + private void resumeIfHasFocus() { + if(hasFocus) { + Cocos2dxHelper.onResume(); + mGLSurfaceView.onResume(); } } @Override protected void onPause() { + Log.d(TAG, "onPause()"); super.onPause(); Cocos2dxHelper.onPause(); mGLSurfaceView.onPause(); diff --git a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxDownloader.java b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxDownloader.java new file mode 100644 index 0000000000..ae4f3ae69c --- /dev/null +++ b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxDownloader.java @@ -0,0 +1,296 @@ +package org.cocos2dx.lib; + +import com.loopj.android.http.AsyncHttpClient; +import com.loopj.android.http.AsyncHttpResponseHandler; +import com.loopj.android.http.BinaryHttpResponseHandler; +import com.loopj.android.http.FileAsyncHttpResponseHandler; +import com.loopj.android.http.RequestHandle; + +import org.apache.http.Header; +import org.apache.http.message.BasicHeader; + +import java.io.File; +import java.util.*; + +class DataTaskHandler extends BinaryHttpResponseHandler { + int _id; + private Cocos2dxDownloader _downloader; + private long _lastBytesWritten; + + void LogD(String msg) { + android.util.Log.d("Cocos2dxDownloader", msg); + } + + public DataTaskHandler(Cocos2dxDownloader downloader, int id) { + super(new String[]{".*"}); + _downloader = downloader; + _id = id; + _lastBytesWritten = 0; + } + + @Override + public void onProgress(long bytesWritten, long totalSize) { + //LogD("onProgress(bytesWritten:" + bytesWritten + " totalSize:" + totalSize); + long dlBytes = bytesWritten - _lastBytesWritten; + long dlNow = bytesWritten; + long dlTotal = totalSize; + _downloader.onProgress(_id, dlBytes, dlNow, dlTotal); + _lastBytesWritten = bytesWritten; + } + + @Override + public void onStart() { + _downloader.onStart(_id); + } + + @Override + public void onFailure(int i, Header[] headers, byte[] errorResponse, Throwable throwable) { + LogD("onFailure(i:" + i + " headers:" + headers + " throwable:" + throwable); + String errStr = ""; + if (null != throwable) { + errStr = throwable.toString(); + } + _downloader.onFinish(_id, i, errStr, null); + } + + @Override + public void onSuccess(int i, Header[] headers, byte[] binaryData) { + LogD("onSuccess(i:" + i + " headers:" + headers); + _downloader.onFinish(_id, 0, null, binaryData); + } +} + +class FileTaskHandler extends FileAsyncHttpResponseHandler { + int _id; + File _finalFile; + + private long _initFileLen; + private long _lastBytesWritten; + private Cocos2dxDownloader _downloader; + + void LogD(String msg) { + android.util.Log.d("Cocos2dxDownloader", msg); + } + + public FileTaskHandler(Cocos2dxDownloader downloader, int id, File temp, File finalFile) { + super(temp, true); + _finalFile = finalFile; + _downloader = downloader; + _id = id; + _initFileLen = getTargetFile().length(); + _lastBytesWritten = 0; + } + + @Override + public void onProgress(long bytesWritten, long totalSize) { + //LogD("onProgress(bytesWritten:" + bytesWritten + " totalSize:" + totalSize); + long dlBytes = bytesWritten - _lastBytesWritten; + long dlNow = bytesWritten + _initFileLen; + long dlTotal = totalSize + _initFileLen; + _downloader.onProgress(_id, dlBytes, dlNow, dlTotal); + _lastBytesWritten = bytesWritten; + } + + @Override + public void onStart() { + _downloader.onStart(_id); + } + + @Override + public void onFinish() { + // onFinish called after onSuccess/onFailure + } + + @Override + public void onFailure(int i, Header[] headers, Throwable throwable, File file) { + LogD("onFailure(i:" + i + " headers:" + headers + " throwable:" + throwable + " file:" + file); + String errStr = ""; + if (null != throwable) { + errStr = throwable.toString(); + } + _downloader.onFinish(_id, i, errStr, null); + } + + @Override + public void onSuccess(int i, Header[] headers, File file) { + LogD("onSuccess(i:" + i + " headers:" + headers + " file:" + file); + String errStr = null; + do { + // rename temp file to final file + // if final file exist, remove it + if (_finalFile.exists()) { + if (_finalFile.isDirectory()) { + errStr = "Dest file is directory:" + _finalFile.getAbsolutePath(); + break; + } + if (false == _finalFile.delete()) { + errStr = "Can't remove old file:" + _finalFile.getAbsolutePath(); + break; + } + } + + File tempFile = getTargetFile(); + tempFile.renameTo(_finalFile); + } while (false); + _downloader.onFinish(_id, 0, errStr, null); + } +} + +class DownloadTask { + + DownloadTask() { + handle = null; + handler = null; + resetStatus(); + } + + void resetStatus() { + bytesReceived = 0; + totalBytesReceived = 0; + totalBytesExpected = 0; + data = null; + } + + RequestHandle handle; + AsyncHttpResponseHandler handler; + + // progress + long bytesReceived; + long totalBytesReceived; + long totalBytesExpected; + byte[] data; + +} + +public class Cocos2dxDownloader { + private int _id; + private AsyncHttpClient _httpClient = new AsyncHttpClient(); + private String _tempFileNameSufix; + private HashMap _taskMap = new HashMap(); + + void onProgress(final int id, final long downloadBytes, final long downloadNow, final long downloadTotal) { + DownloadTask task = (DownloadTask)_taskMap.get(id); + if (null != task) { + task.bytesReceived = downloadBytes; + task.totalBytesReceived = downloadNow; + task.totalBytesExpected = downloadTotal; + } + Cocos2dxHelper.runOnGLThread(new Runnable() { + @Override + public void run() { + nativeOnProgress(_id, id, downloadBytes, downloadNow, downloadTotal); + } + }); + } + + public void onStart(int id) { + DownloadTask task = (DownloadTask)_taskMap.get(id); + if (null != task) { + task.resetStatus(); + } + } + + public void onFinish(final int id, final int errCode, final String errStr, final byte[] data) { + DownloadTask task = (DownloadTask)_taskMap.get(id); + if (null == task) return; + _taskMap.remove(id); + Cocos2dxHelper.runOnGLThread(new Runnable() { + @Override + public void run() { + nativeOnFinish(_id, id, errCode, errStr, data); + } + }); + } + + public static Cocos2dxDownloader createDownloader(int id, int timeoutInSeconds, String tempFileNameSufix) { + Cocos2dxDownloader downloader = new Cocos2dxDownloader(); + downloader._id = id; + + downloader._httpClient.setEnableRedirects(true); + if (timeoutInSeconds > 0) { + downloader._httpClient.setTimeout(timeoutInSeconds * 1000); + } + // downloader._httpClient.setMaxRetriesAndTimeout(3, timeoutInSeconds * 1000); + downloader._httpClient.allowRetryExceptionClass(javax.net.ssl.SSLException.class); + + downloader._tempFileNameSufix = tempFileNameSufix; + return downloader; + } + + public static void createTask(final Cocos2dxDownloader downloader, int id_, String url_, String path_) { + final int id = id_; + final String url = url_; + final String path = path_; + + Cocos2dxHelper.getActivity().runOnUiThread(new Runnable() { + @Override + public void run() { + DownloadTask task = new DownloadTask(); + if (0 == path.length()) { + // data task + task.handler = new DataTaskHandler(downloader, id); + task.handle = downloader._httpClient.get(Cocos2dxHelper.getActivity(), url, task.handler); + } + + do { + if (0 == path.length()) break; + // file task + File tempFile = new File(path + downloader._tempFileNameSufix); + if (tempFile.isDirectory()) break; + + File parent = tempFile.getParentFile(); + if (!parent.isDirectory() && !parent.mkdirs()) break; + + File finalFile = new File(path); + if (tempFile.isDirectory()) break; + + task.handler = new FileTaskHandler(downloader, id, tempFile, finalFile); + Header[] headers = null; + long fileLen = tempFile.length(); + if (fileLen > 0) { + // continue download + List
list = new ArrayList
(); + list.add(new BasicHeader("Range", "bytes=" + fileLen + "-")); + headers = list.toArray(new Header[list.size()]); + } + task.handle = downloader._httpClient.get(Cocos2dxHelper.getActivity(), url, headers, null, task.handler); + //task.handle = downloader._httpClient.get(url, task.handler); + } while (false); + + if (null == task.handle) { + final String errStr = "Can't create DownloadTask for " + url; + Cocos2dxHelper.runOnGLThread(new Runnable() { + @Override + public void run() { + downloader.nativeOnFinish(downloader._id, id, 0, errStr, null); + } + }); + } else { + downloader._taskMap.put(id, task); + } + } + }); + } + + public static void cancelAllRequests(final Cocos2dxDownloader downloader) { + Cocos2dxHelper.getActivity().runOnUiThread(new Runnable() { + @Override + public void run() { + + //downloader._httpClient.cancelAllRequests(true); + Iterator iter = downloader._taskMap.entrySet().iterator(); + while (iter.hasNext()) { + Map.Entry entry = (Map.Entry) iter.next(); + //Object key = entry.getKey(); + DownloadTask task = (DownloadTask) entry.getValue(); + if (null != task.handle) { + task.handle.cancel(true); + } + } + } + }); + } + + native void nativeOnProgress(int id, int taskId, long dl, long dlnow, long dltotal); + native void nativeOnFinish(int id, int taskId, int errCode, String errStr, final byte[] data); +} diff --git a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxEditBox.java b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxEditBox.java index a02daf0c10..4228b97c74 100644 --- a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxEditBox.java +++ b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxEditBox.java @@ -26,8 +26,11 @@ package org.cocos2dx.lib; import android.content.Context; import android.graphics.Color; +import android.graphics.Typeface; import android.text.InputFilter; import android.text.InputType; +import android.text.method.PasswordTransformationMethod; +import android.util.Log; import android.view.Gravity; import android.view.KeyEvent; import android.view.View; @@ -106,6 +109,12 @@ public class Cocos2dxEditBox extends EditText { private int mInputModeContraints; private int mMaxLength; + //OpenGL view scaleX + private float mScaleX; + + + + public Cocos2dxEditBox(Context context){ super(context); } @@ -121,6 +130,15 @@ public class Cocos2dxEditBox extends EditText { this.setLayoutParams(layoutParams); } + public float getOpenGLViewScaleX() { + return mScaleX; + } + + public void setOpenGLViewScaleX(float mScaleX) { + this.mScaleX = mScaleX; + } + + public void setMaxLength(int maxLength){ this.mMaxLength = maxLength; @@ -210,6 +228,8 @@ public class Cocos2dxEditBox extends EditText { switch (inputFlag) { case kEditBoxInputFlagPassword: this.mInputFlagConstraints = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD; + this.setTypeface(Typeface.DEFAULT); + this.setTransformationMethod(new PasswordTransformationMethod()); break; case kEditBoxInputFlagSensitive: this.mInputFlagConstraints = InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS; diff --git a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxEditBoxHelper.java b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxEditBoxHelper.java index 14a8c46920..1651aa27c5 100644 --- a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxEditBoxHelper.java +++ b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxEditBoxHelper.java @@ -75,8 +75,17 @@ public class Cocos2dxEditBoxHelper { Cocos2dxEditBoxHelper.mEditBoxArray = new SparseArray(); } + public static int convertToSP(float point){ + Resources r = mCocos2dxActivity.getResources(); - public static int createEditBox(final int left, final int top, final int width, final int height) { + int convertedValue = (int)TypedValue.applyDimension( + TypedValue.COMPLEX_UNIT_SP, point, r.getDisplayMetrics()); + + return convertedValue; + + } + + public static int createEditBox(final int left, final int top, final int width, final int height, final float scaleX) { final int index = mViewTag; mCocos2dxActivity.runOnUiThread(new Runnable() { @Override @@ -92,6 +101,17 @@ public class Cocos2dxEditBoxHelper { editBox.setBackgroundColor(Color.TRANSPARENT); editBox.setTextColor(Color.WHITE); editBox.setSingleLine(); + editBox.setOpenGLViewScaleX(scaleX); + Resources r = mCocos2dxActivity.getResources(); + float density = r.getDisplayMetrics().density; + int paddingBottom = (int)(height * 0.33f / density); + paddingBottom = convertToSP(paddingBottom - 5 * scaleX / density); + paddingBottom = paddingBottom / 2; + int paddingTop = paddingBottom; + int paddingLeft = (int)(5 * scaleX / density); + paddingLeft = convertToSP(paddingLeft); + + editBox.setPadding(paddingLeft,paddingTop, 0, paddingBottom); FrameLayout.LayoutParams lParams = new FrameLayout.LayoutParams( @@ -101,7 +121,7 @@ public class Cocos2dxEditBoxHelper { lParams.leftMargin = left; lParams.topMargin = top; lParams.width = width; - lParams.height = height+20; + lParams.height = height; lParams.gravity = Gravity.TOP | Gravity.LEFT; mFrameLayout.addView(editBox, lParams); @@ -222,7 +242,10 @@ public class Cocos2dxEditBoxHelper { } //TODO: The font size is not the same across all the anroid devices... if (fontSize >= 0){ - editBox.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize); + float density = mCocos2dxActivity.getResources().getDisplayMetrics().density; +// Log.e("XXX", "density is " + density); + editBox.setTextSize(TypedValue.COMPLEX_UNIT_SP, + fontSize / density ); } editBox.setTypeface(tf); } diff --git a/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp b/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp index 0ca899fd15..cbd1285e05 100644 --- a/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp +++ b/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp @@ -390,12 +390,12 @@ void deleteValueForKeyJNI(const char* key) } } -int addEditBoxJNI(int left, int top, int width, int height){ +int addEditBoxJNI(int left, int top, int width, int height, float scaleX){ JniMethodInfo t; int ret = -1; - if (JniHelper::getStaticMethodInfo(t, EDITBOX_CLASS_NAME, "createEditBox", "(IIII)I")) { - ret = t.env->CallStaticIntMethod(t.classID, t.methodID, left, top, width, height); + if (JniHelper::getStaticMethodInfo(t, EDITBOX_CLASS_NAME, "createEditBox", "(IIIIF)I")) { + ret = t.env->CallStaticIntMethod(t.classID, t.methodID, left, top, width, height, scaleX); t.env->DeleteLocalRef(t.classID); } return ret; diff --git a/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h b/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h index 0536c40991..534a35669c 100644 --- a/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h +++ b/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h @@ -55,7 +55,7 @@ extern void setStringForKeyJNI(const char* key, const char* value); extern void deleteValueForKeyJNI(const char* key); extern void conversionEncodingJNI(const char* src, int byteSize, const char* fromCharset, char* dst, const char* newCharset); //Added for new Android EditBox -extern int addEditBoxJNI(int left, int top, int width, int height); +extern int addEditBoxJNI(int left, int top, int width, int height, float scaleX); extern void removeEditBoxJNI(int index); extern void setEditBoxViewRectJNI(int index, int left, int top, int width, int height); extern void setMaxLengthJNI(int index, int maxLength); diff --git a/cocos/platform/android/libcocos2dx/build.gradle b/cocos/platform/android/libcocos2dx/build.gradle index b5daac2bc2..1a61e3e560 100644 --- a/cocos/platform/android/libcocos2dx/build.gradle +++ b/cocos/platform/android/libcocos2dx/build.gradle @@ -26,5 +26,5 @@ android { } dependencies { - compile fileTree(dir: 'libs', include: ['*.jar']) + compile fileTree(dir: '../java/libs', include: ['*.jar']) } diff --git a/cocos/platform/desktop/CCGLViewImpl-desktop.cpp b/cocos/platform/desktop/CCGLViewImpl-desktop.cpp index 17c88cb170..e35894bf43 100644 --- a/cocos/platform/desktop/CCGLViewImpl-desktop.cpp +++ b/cocos/platform/desktop/CCGLViewImpl-desktop.cpp @@ -186,7 +186,7 @@ static keyCodeItem g_keyCodeStructArray[] = { /* Function keys */ { GLFW_KEY_ESCAPE , EventKeyboard::KeyCode::KEY_ESCAPE }, - { GLFW_KEY_ENTER , EventKeyboard::KeyCode::KEY_KP_ENTER }, + { GLFW_KEY_ENTER , EventKeyboard::KeyCode::KEY_ENTER }, { GLFW_KEY_TAB , EventKeyboard::KeyCode::KEY_TAB }, { GLFW_KEY_BACKSPACE , EventKeyboard::KeyCode::KEY_BACKSPACE }, { GLFW_KEY_INSERT , EventKeyboard::KeyCode::KEY_INSERT }, @@ -195,9 +195,9 @@ static keyCodeItem g_keyCodeStructArray[] = { { GLFW_KEY_LEFT , EventKeyboard::KeyCode::KEY_LEFT_ARROW }, { GLFW_KEY_DOWN , EventKeyboard::KeyCode::KEY_DOWN_ARROW }, { GLFW_KEY_UP , EventKeyboard::KeyCode::KEY_UP_ARROW }, - { GLFW_KEY_PAGE_UP , EventKeyboard::KeyCode::KEY_KP_PG_UP }, - { GLFW_KEY_PAGE_DOWN , EventKeyboard::KeyCode::KEY_KP_PG_DOWN }, - { GLFW_KEY_HOME , EventKeyboard::KeyCode::KEY_KP_HOME }, + { GLFW_KEY_PAGE_UP , EventKeyboard::KeyCode::KEY_PG_UP }, + { GLFW_KEY_PAGE_DOWN , EventKeyboard::KeyCode::KEY_PG_DOWN }, + { GLFW_KEY_HOME , EventKeyboard::KeyCode::KEY_HOME }, { GLFW_KEY_END , EventKeyboard::KeyCode::KEY_END }, { GLFW_KEY_CAPS_LOCK , EventKeyboard::KeyCode::KEY_CAPS_LOCK }, { GLFW_KEY_SCROLL_LOCK , EventKeyboard::KeyCode::KEY_SCROLL_LOCK }, diff --git a/cocos/platform/ios/CCEAGLView-ios.mm b/cocos/platform/ios/CCEAGLView-ios.mm index 0e9438a75c..a8292d4087 100644 --- a/cocos/platform/ios/CCEAGLView-ios.mm +++ b/cocos/platform/ios/CCEAGLView-ios.mm @@ -378,7 +378,8 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved. for(UIView* view in subviews) { if([view isKindOfClass:NSClassFromString(@"CCCustomUITextField")] || - [view isKindOfClass:NSClassFromString(@"UICustomUITextField")]) + [view isKindOfClass:NSClassFromString(@"UISingleLineTextField")] || + [view isKindOfClass:NSClassFromString(@"UIMultilineTextField")]) { if ([view isFirstResponder]) { diff --git a/cocos/platform/win32/CCFileUtils-win32.cpp b/cocos/platform/win32/CCFileUtils-win32.cpp index c0369dd4c4..c890faf2cf 100644 --- a/cocos/platform/win32/CCFileUtils-win32.cpp +++ b/cocos/platform/win32/CCFileUtils-win32.cpp @@ -134,7 +134,7 @@ static std::string UTF8StringToMultiByte(const std::string& strUtf8) static void _checkPath() { - if (0 == s_resourcePath.length()) + if (s_resourcePath.empty()) { WCHAR *pUtf16ExePath = nullptr; _get_wpgmptr(&pUtf16ExePath); @@ -193,7 +193,7 @@ std::string FileUtilsWin32::getSuitableFOpen(const std::string& filenameUtf8) co bool FileUtilsWin32::isFileExistInternal(const std::string& strFilePath) const { - if (0 == strFilePath.length()) + if (strFilePath.empty()) { return false; } diff --git a/cocos/platform/winrt/Keyboard-winrt.cpp b/cocos/platform/winrt/Keyboard-winrt.cpp index f844159b36..491a649c4c 100644 --- a/cocos/platform/winrt/Keyboard-winrt.cpp +++ b/cocos/platform/winrt/Keyboard-winrt.cpp @@ -117,9 +117,9 @@ static keyCodeItem g_keyCodeStructArray [] = { { (int) VirtualKey::Left, EventKeyboard::KeyCode::KEY_LEFT_ARROW }, { (int) VirtualKey::Down, EventKeyboard::KeyCode::KEY_DOWN_ARROW }, { (int) VirtualKey::Up, EventKeyboard::KeyCode::KEY_UP_ARROW }, - { VK_PRIOR, EventKeyboard::KeyCode::KEY_KP_PG_UP }, - { VK_NEXT, EventKeyboard::KeyCode::KEY_KP_PG_DOWN }, - { VK_HOME, EventKeyboard::KeyCode::KEY_KP_HOME }, + { VK_PRIOR, EventKeyboard::KeyCode::KEY_PG_UP }, + { VK_NEXT, EventKeyboard::KeyCode::KEY_PG_DOWN }, + { VK_HOME, EventKeyboard::KeyCode::KEY_HOME }, { VK_END, EventKeyboard::KeyCode::KEY_END }, { VK_CAPITAL, EventKeyboard::KeyCode::KEY_CAPS_LOCK }, { VK_SCROLL, EventKeyboard::KeyCode::KEY_SCROLL_LOCK }, diff --git a/cocos/renderer/CCFrameBuffer.cpp b/cocos/renderer/CCFrameBuffer.cpp index d26016967b..7d679261bd 100644 --- a/cocos/renderer/CCFrameBuffer.cpp +++ b/cocos/renderer/CCFrameBuffer.cpp @@ -456,7 +456,7 @@ void FrameBuffer::applyFBO() CHECK_GL_ERROR_DEBUG(); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, nullptr == _rtDepthStencil ? 0 : _rtDepthStencil->getBuffer()); CHECK_GL_ERROR_DEBUG(); - CCLOG("FBO is %d _fbo %d color, %d ds", _fbo, RenderTargetBase::Type::Texture2D == _rt->getType() ? _rt->getTexture()->getName() : _rt->getBuffer(), _rtDepthStencil->getBuffer()); + CCLOG("FBO is %d _fbo %d color, %d ds", _fbo, RenderTargetBase::Type::Texture2D == _rt->getType() ? _rt->getTexture()->getName() : _rt->getBuffer(), nullptr == _rtDepthStencil ? 0 : _rtDepthStencil->getBuffer()); _fboBindingDirty = false; } if(GL_FRAMEBUFFER_COMPLETE != glCheckFramebufferStatus(GL_FRAMEBUFFER)) diff --git a/cocos/renderer/CCMaterial.cpp b/cocos/renderer/CCMaterial.cpp index 06a618b957..5b5d1aa8dd 100644 --- a/cocos/renderer/CCMaterial.cpp +++ b/cocos/renderer/CCMaterial.cpp @@ -442,6 +442,7 @@ Material* Material::clone() const for (const auto& technique: _techniques) { auto t = technique->clone(); + t->_parent = material; material->_techniques.pushBack(t); } diff --git a/cocos/renderer/CCRenderer.cpp b/cocos/renderer/CCRenderer.cpp index 1aef8015e5..3dcd282d6e 100644 --- a/cocos/renderer/CCRenderer.cpp +++ b/cocos/renderer/CCRenderer.cpp @@ -543,15 +543,19 @@ void Renderer::visitRenderQueue(RenderQueue& queue) { glEnable(GL_DEPTH_TEST); glDepthMask(true); + glEnable(GL_BLEND); RenderState::StateBlock::_defaultState->setDepthTest(true); RenderState::StateBlock::_defaultState->setDepthWrite(true); + RenderState::StateBlock::_defaultState->setBlend(true); } else { glDisable(GL_DEPTH_TEST); glDepthMask(false); + glEnable(GL_BLEND); RenderState::StateBlock::_defaultState->setDepthTest(false); RenderState::StateBlock::_defaultState->setDepthWrite(false); + RenderState::StateBlock::_defaultState->setBlend(true); } for (auto it = zNegQueue.cbegin(); it != zNegQueue.cend(); ++it) { @@ -569,8 +573,10 @@ void Renderer::visitRenderQueue(RenderQueue& queue) //Clear depth to achieve layered rendering glEnable(GL_DEPTH_TEST); glDepthMask(true); + glDisable(GL_BLEND); RenderState::StateBlock::_defaultState->setDepthTest(true); RenderState::StateBlock::_defaultState->setDepthWrite(true); + RenderState::StateBlock::_defaultState->setBlend(false); for (auto it = opaqueQueue.cbegin(); it != opaqueQueue.cend(); ++it) @@ -588,9 +594,11 @@ void Renderer::visitRenderQueue(RenderQueue& queue) { glEnable(GL_DEPTH_TEST); glDepthMask(false); + glEnable(GL_BLEND); RenderState::StateBlock::_defaultState->setDepthTest(true); RenderState::StateBlock::_defaultState->setDepthWrite(false); + RenderState::StateBlock::_defaultState->setBlend(true); for (auto it = transQueue.cbegin(); it != transQueue.cend(); ++it) @@ -610,18 +618,22 @@ void Renderer::visitRenderQueue(RenderQueue& queue) { glEnable(GL_DEPTH_TEST); glDepthMask(true); + glEnable(GL_BLEND); RenderState::StateBlock::_defaultState->setDepthTest(true); RenderState::StateBlock::_defaultState->setDepthWrite(true); + RenderState::StateBlock::_defaultState->setBlend(true); } else { glDisable(GL_DEPTH_TEST); glDepthMask(false); + glEnable(GL_BLEND); RenderState::StateBlock::_defaultState->setDepthTest(false); RenderState::StateBlock::_defaultState->setDepthWrite(false); + RenderState::StateBlock::_defaultState->setBlend(true); } for (auto it = zZeroQueue.cbegin(); it != zZeroQueue.cend(); ++it) @@ -637,6 +649,29 @@ void Renderer::visitRenderQueue(RenderQueue& queue) const auto& zPosQueue = queue.getSubQueue(RenderQueue::QUEUE_GROUP::GLOBALZ_POS); if (zPosQueue.size() > 0) { + if(_isDepthTestFor2D) + { + glEnable(GL_DEPTH_TEST); + glDepthMask(true); + glEnable(GL_BLEND); + + RenderState::StateBlock::_defaultState->setDepthTest(true); + RenderState::StateBlock::_defaultState->setDepthWrite(true); + RenderState::StateBlock::_defaultState->setBlend(true); + + } + else + { + glDisable(GL_DEPTH_TEST); + glDepthMask(false); + glEnable(GL_BLEND); + + RenderState::StateBlock::_defaultState->setDepthTest(false); + RenderState::StateBlock::_defaultState->setDepthWrite(false); + RenderState::StateBlock::_defaultState->setBlend(true); + + } + for (auto it = zPosQueue.cbegin(); it != zPosQueue.cend(); ++it) { processRenderCommand(*it); diff --git a/cocos/renderer/CCTechnique.cpp b/cocos/renderer/CCTechnique.cpp index 59c244a8f5..286780a471 100644 --- a/cocos/renderer/CCTechnique.cpp +++ b/cocos/renderer/CCTechnique.cpp @@ -86,6 +86,7 @@ Technique* Technique::clone() const for (const auto pass: _passes) { auto p = pass->clone(); + p->_parent = technique; technique->_passes.pushBack(p); } diff --git a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_auto_api.js b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_auto_api.js index 7969665b23..ed8da95df4 100644 --- a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_auto_api.js +++ b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_auto_api.js @@ -521,6 +521,173 @@ EventTouch : function ( }; +/** + * @class ComponentContainer + */ +cc.ComponentContainer = { + +/** + * @method visit + * @param {float} arg0 + */ +visit : function ( +float +) +{ +}, + +/** + * @method remove +* @param {cc.Component|String} component +* @return {bool|bool} +*/ +remove : function( +str +) +{ + return false; +}, + +/** + * @method removeAll + */ +removeAll : function ( +) +{ +}, + +/** + * @method add + * @param {cc.Component} arg0 + * @return {bool} + */ +add : function ( +component +) +{ + return false; +}, + +/** + * @method isEmpty + * @return {bool} + */ +isEmpty : function ( +) +{ + return false; +}, + +/** + * @method get + * @param {String} arg0 + * @return {cc.Component} + */ +get : function ( +str +) +{ + return cc.Component; +}, + +}; + +/** + * @class Component + */ +cc.Component = { + +/** + * @method setEnabled + * @param {bool} arg0 + */ +setEnabled : function ( +bool +) +{ +}, + +/** + * @method setName + * @param {String} arg0 + */ +setName : function ( +str +) +{ +}, + +/** + * @method isEnabled + * @return {bool} + */ +isEnabled : function ( +) +{ + return false; +}, + +/** + * @method getOwner + * @return {cc.Node} + */ +getOwner : function ( +) +{ + return cc.Node; +}, + +/** + * @method init + * @return {bool} + */ +init : function ( +) +{ + return false; +}, + +/** + * @method getName + * @return {String} + */ +getName : function ( +) +{ + return ; +}, + +/** + * @method setOwner + * @param {cc.Node} arg0 + */ +setOwner : function ( +node +) +{ +}, + +/** + * @method create + * @return {cc.Component} + */ +create : function ( +) +{ + return cc.Component; +}, + +/** + * @method Component + * @constructor + */ +Component : function ( +) +{ +}, + +}; + /** * @class Node */ @@ -552,16 +719,6 @@ str return false; }, -/** - * @method setPhysicsBody - * @param {cc.PhysicsBody} arg0 - */ -setPhysicsBody : function ( -physicsbody -) -{ -}, - /** * @method getGLProgram * @return {cc.GLProgram} @@ -572,18 +729,6 @@ getGLProgram : function ( return cc.GLProgram; }, -/** - * @method updateTransformFromPhysics - * @param {mat4_object} arg0 - * @param {unsigned int} arg1 - */ -updateTransformFromPhysics : function ( -mat4, -int -) -{ -}, - /** * @method getDescription * @return {String} @@ -746,14 +891,6 @@ func { }, -/** - * @method removeFromPhysicsWorld - */ -removeFromPhysicsWorld : function ( -) -{ -}, - /** * @method removeAllComponents */ @@ -804,16 +941,6 @@ getonEnterTransitionDidFinishCallback : function ( return std::function; }, -/** - * @method isOpacityModifyRGB - * @return {bool} - */ -isOpacityModifyRGB : function ( -) -{ - return false; -}, - /** * @method getNodeToWorldAffineTransform * @return {cc.AffineTransform} @@ -1053,13 +1180,13 @@ getOnEnterCallback : function ( }, /** - * @method getPhysicsBody - * @return {cc.PhysicsBody} + * @method isOpacityModifyRGB + * @return {bool} */ -getPhysicsBody : function ( +isOpacityModifyRGB : function ( ) { - return cc.PhysicsBody; + return false; }, /** @@ -1418,22 +1545,6 @@ str { }, -/** - * @method updatePhysicsBodyTransform - * @param {mat4_object} arg0 - * @param {unsigned int} arg1 - * @param {float} arg2 - * @param {float} arg3 - */ -updatePhysicsBodyTransform : function ( -mat4, -int, -float, -float -) -{ -}, - /** * @method getDisplayedOpacity * @return {unsigned char} @@ -2051,6 +2162,16 @@ eventcustom { }, +/** + * @method getPhysicsManager + * @return {cc.PhysicsManager} + */ +getPhysicsManager : function ( +) +{ + return cc.PhysicsManager; +}, + /** * @method initWithSize * @param {size_object} arg0 @@ -16622,16 +16743,6 @@ getTextureRect : function ( return cc.Rect; }, -/** - * @method debugDraw - * @param {bool} arg0 - */ -debugDraw : function ( -bool -) -{ -}, - /** * @method initWithFile * @param {String|String} str @@ -22672,173 +22783,6 @@ TileMapAtlas : function ( }; -/** - * @class Component - */ -cc.Component = { - -/** - * @method setEnabled - * @param {bool} arg0 - */ -setEnabled : function ( -bool -) -{ -}, - -/** - * @method setName - * @param {String} arg0 - */ -setName : function ( -str -) -{ -}, - -/** - * @method isEnabled - * @return {bool} - */ -isEnabled : function ( -) -{ - return false; -}, - -/** - * @method getOwner - * @return {cc.Node} - */ -getOwner : function ( -) -{ - return cc.Node; -}, - -/** - * @method init - * @return {bool} - */ -init : function ( -) -{ - return false; -}, - -/** - * @method getName - * @return {String} - */ -getName : function ( -) -{ - return ; -}, - -/** - * @method setOwner - * @param {cc.Node} arg0 - */ -setOwner : function ( -node -) -{ -}, - -/** - * @method create - * @return {cc.Component} - */ -create : function ( -) -{ - return cc.Component; -}, - -/** - * @method Component - * @constructor - */ -Component : function ( -) -{ -}, - -}; - -/** - * @class ComponentContainer - */ -cc.ComponentContainer = { - -/** - * @method visit - * @param {float} arg0 - */ -visit : function ( -float -) -{ -}, - -/** - * @method remove -* @param {cc.Component|String} component -* @return {bool|bool} -*/ -remove : function( -str -) -{ - return false; -}, - -/** - * @method removeAll - */ -removeAll : function ( -) -{ -}, - -/** - * @method add - * @param {cc.Component} arg0 - * @return {bool} - */ -add : function ( -component -) -{ - return false; -}, - -/** - * @method isEmpty - * @return {bool} - */ -isEmpty : function ( -) -{ - return false; -}, - -/** - * @method get - * @param {String} arg0 - * @return {cc.Component} - */ -get : function ( -str -) -{ - return cc.Component; -}, - -}; - /** * @class SimpleAudioEngine */ diff --git a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_ui_auto_api.js b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_ui_auto_api.js index de1b191482..0fa965c2e7 100644 --- a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_ui_auto_api.js +++ b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_ui_auto_api.js @@ -1368,6 +1368,16 @@ getTitleRenderer : function ( return cc.Label; }, +/** + * @method getRendererClicked + * @return {ccui.Scale9Sprite} + */ +getRendererClicked : function ( +) +{ + return ccui.Scale9Sprite; +}, + /** * @method getZoomScale * @return {float} @@ -1398,6 +1408,16 @@ color3b { }, +/** + * @method getRendererDisabled + * @return {ccui.Scale9Sprite} + */ +getRendererDisabled : function ( +) +{ + return ccui.Scale9Sprite; +}, + /** * @method setCapInsetsDisabledRenderer * @param {rect_object} arg0 @@ -1580,6 +1600,16 @@ getTitleFontSize : function ( return 0; }, +/** + * @method getRendererNormal + * @return {ccui.Scale9Sprite} + */ +getRendererNormal : function ( +) +{ + return ccui.Scale9Sprite; +}, + /** * @method getTitleFontName * @return {String} @@ -3273,26 +3303,6 @@ ScrollView : function ( */ ccui.ListView = { -/** - * @method getIndex - * @param {ccui.Widget} arg0 - * @return {long} - */ -getIndex : function ( -widget -) -{ - return 0; -}, - -/** - * @method removeAllItems - */ -removeAllItems : function ( -) -{ -}, - /** * @method setGravity * @param {ccui.ListView::Gravity} arg0 @@ -3303,82 +3313,6 @@ gravity { }, -/** - * @method pushBackCustomItem - * @param {ccui.Widget} arg0 - */ -pushBackCustomItem : function ( -widget -) -{ -}, - -/** - * @method getItems - * @return {Array} - */ -getItems : function ( -) -{ - return new Array(); -}, - -/** - * @method removeItem - * @param {long} arg0 - */ -removeItem : function ( -long -) -{ -}, - -/** - * @method getCurSelectedIndex - * @return {long} - */ -getCurSelectedIndex : function ( -) -{ - return 0; -}, - -/** - * @method insertDefaultItem - * @param {long} arg0 - */ -insertDefaultItem : function ( -long -) -{ -}, - -/** - * @method requestRefreshView - */ -requestRefreshView : function ( -) -{ -}, - -/** - * @method setItemsMargin - * @param {float} arg0 - */ -setItemsMargin : function ( -float -) -{ -}, - -/** - * @method refreshView - */ -refreshView : function ( -) -{ -}, - /** * @method removeLastItem */ @@ -3387,6 +3321,26 @@ removeLastItem : function ( { }, +/** + * @method getCenterItemInCurrentView + * @return {ccui.Widget} + */ +getCenterItemInCurrentView : function ( +) +{ + return ccui.Widget; +}, + +/** + * @method getCurSelectedIndex + * @return {long} + */ +getCurSelectedIndex : function ( +) +{ + return 0; +}, + /** * @method getItemsMargin * @return {float} @@ -3397,6 +3351,142 @@ getItemsMargin : function ( return 0; }, +/** + * @method setMagneticType + * @param {ccui.ListView::MagneticType} arg0 + */ +setMagneticType : function ( +magnetictype +) +{ +}, + +/** + * @method refreshViewIfNecessary + */ +refreshViewIfNecessary : function ( +) +{ +}, + +/** + * @method getIndex + * @param {ccui.Widget} arg0 + * @return {long} + */ +getIndex : function ( +widget +) +{ + return 0; +}, + +/** + * @method pushBackCustomItem + * @param {ccui.Widget} arg0 + */ +pushBackCustomItem : function ( +widget +) +{ +}, + +/** + * @method insertDefaultItem + * @param {long} arg0 + */ +insertDefaultItem : function ( +long +) +{ +}, + +/** + * @method setMagneticAllowedOutOfBoundary + * @param {bool} arg0 + */ +setMagneticAllowedOutOfBoundary : function ( +bool +) +{ +}, + +/** + * @method doLayout + */ +doLayout : function ( +) +{ +}, + +/** + * @method getTopmostItemInCurrentView + * @return {ccui.Widget} + */ +getTopmostItemInCurrentView : function ( +) +{ + return ccui.Widget; +}, + +/** + * @method removeAllItems + */ +removeAllItems : function ( +) +{ +}, + +/** + * @method getBottommostItemInCurrentView + * @return {ccui.Widget} + */ +getBottommostItemInCurrentView : function ( +) +{ + return ccui.Widget; +}, + +/** + * @method getItems + * @return {Array} + */ +getItems : function ( +) +{ + return new Array(); +}, + +/** + * @method getLeftmostItemInCurrentView + * @return {ccui.Widget} + */ +getLeftmostItemInCurrentView : function ( +) +{ + return ccui.Widget; +}, + +/** + * @method setItemsMargin + * @param {float} arg0 + */ +setItemsMargin : function ( +float +) +{ +}, + +/** + * @method getMagneticType + * @return {ccui.ListView::MagneticType} + */ +getMagneticType : function ( +) +{ + return 0; +}, + /** * @method getItem * @param {long} arg0 @@ -3409,6 +3499,96 @@ long return ccui.Widget; }, +/** + * @method removeItem + * @param {long} arg0 + */ +removeItem : function ( +long +) +{ +}, + +/** + * @method scrollToItem +* @param {int|int} int +* @param {vec2_object|vec2_object} vec2 +* @param {vec2_object|vec2_object} vec2 +* @param {float} float +*/ +scrollToItem : function( +int, +vec2, +vec2, +float +) +{ +}, + +/** + * @method pushBackDefaultItem + */ +pushBackDefaultItem : function ( +) +{ +}, + +/** + * @method getMagneticAllowedOutOfBoundary + * @return {bool} + */ +getMagneticAllowedOutOfBoundary : function ( +) +{ + return false; +}, + +/** + * @method getClosestItemToPosition + * @param {vec2_object} arg0 + * @param {vec2_object} arg1 + * @return {ccui.Widget} + */ +getClosestItemToPosition : function ( +vec2, +vec2 +) +{ + return ccui.Widget; +}, + +/** + * @method getRightmostItemInCurrentView + * @return {ccui.Widget} + */ +getRightmostItemInCurrentView : function ( +) +{ + return ccui.Widget; +}, + +/** + * @method getClosestItemToPositionInCurrentView + * @param {vec2_object} arg0 + * @param {vec2_object} arg1 + * @return {ccui.Widget} + */ +getClosestItemToPositionInCurrentView : function ( +vec2, +vec2 +) +{ + return ccui.Widget; +}, + +/** + * @method refreshView + */ +refreshView : function ( +) +{ +}, + /** * @method setItemModel * @param {ccui.Widget} arg0 @@ -3420,17 +3600,9 @@ widget }, /** - * @method doLayout + * @method requestRefreshView */ -doLayout : function ( -) -{ -}, - -/** - * @method pushBackDefaultItem - */ -pushBackDefaultItem : function ( +requestRefreshView : function ( ) { }, diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_auto.cpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_auto.cpp index 76eba29288..7ebf91c440 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_auto.cpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_auto.cpp @@ -287,7 +287,7 @@ bool js_cocos2dx_3d_Animate3D_setKeyFrameUserInfo(JSContext *cx, uint32_t argc, cocos2d::Animate3D* cobj = (cocos2d::Animate3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Animate3D_setKeyFrameUserInfo : Invalid Native Object"); if (argc == 2) { - int arg0; + int arg0 = 0; cocos2d::ValueMap arg1; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); ok &= jsval_to_ccvaluemap(cx, args.get(1), &arg1); @@ -347,7 +347,7 @@ bool js_cocos2dx_3d_Animate3D_setWeight(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Animate3D* cobj = (cocos2d::Animate3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Animate3D_setWeight : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Animate3D_setWeight : Error processing arguments"); cobj->setWeight(arg0); @@ -383,10 +383,10 @@ bool js_cocos2dx_3d_Animate3D_initWithFrames(JSContext *cx, uint32_t argc, jsval cocos2d::Animate3D* cobj = (cocos2d::Animate3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Animate3D_initWithFrames : Invalid Native Object"); if (argc == 4) { - cocos2d::Animation3D* arg0; - int arg1; - int arg2; - double arg3; + cocos2d::Animation3D* arg0 = nullptr; + int arg1 = 0; + int arg2 = 0; + double arg3 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -437,7 +437,7 @@ bool js_cocos2dx_3d_Animate3D_setSpeed(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Animate3D* cobj = (cocos2d::Animate3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Animate3D_setSpeed : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Animate3D_setSpeed : Error processing arguments"); cobj->setSpeed(arg0); @@ -461,7 +461,7 @@ bool js_cocos2dx_3d_Animate3D_init(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Animate3D_init : Invalid Native Object"); do { if (argc == 3) { - cocos2d::Animation3D* arg0; + cocos2d::Animation3D* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -472,10 +472,10 @@ bool js_cocos2dx_3d_Animate3D_init(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } bool ret = cobj->init(arg0, arg1, arg2); @@ -488,7 +488,7 @@ bool js_cocos2dx_3d_Animate3D_init(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 1) { - cocos2d::Animation3D* arg0; + cocos2d::Animation3D* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -519,7 +519,7 @@ bool js_cocos2dx_3d_Animate3D_setOriginInterval(JSContext *cx, uint32_t argc, js cocos2d::Animate3D* cobj = (cocos2d::Animate3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Animate3D_setOriginInterval : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Animate3D_setOriginInterval : Error processing arguments"); cobj->setOriginInterval(arg0); @@ -573,7 +573,7 @@ bool js_cocos2dx_3d_Animate3D_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 3) { - cocos2d::Animation3D* arg0; + cocos2d::Animation3D* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -584,10 +584,10 @@ bool js_cocos2dx_3d_Animate3D_create(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } cocos2d::Animate3D* ret = cocos2d::Animate3D::create(arg0, arg1, arg2); @@ -607,7 +607,7 @@ bool js_cocos2dx_3d_Animate3D_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 1) { - cocos2d::Animation3D* arg0; + cocos2d::Animation3D* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -654,9 +654,9 @@ bool js_cocos2dx_3d_Animate3D_createWithFrames(JSContext *cx, uint32_t argc, jsv JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 3) { - cocos2d::Animation3D* arg0; - int arg1; - int arg2; + cocos2d::Animation3D* arg0 = nullptr; + int arg1 = 0; + int arg2 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -683,10 +683,10 @@ bool js_cocos2dx_3d_Animate3D_createWithFrames(JSContext *cx, uint32_t argc, jsv return true; } if (argc == 4) { - cocos2d::Animation3D* arg0; - int arg1; - int arg2; - double arg3; + cocos2d::Animation3D* arg0 = nullptr; + int arg1 = 0; + int arg2 = 0; + double arg3 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -722,7 +722,7 @@ bool js_cocos2dx_3d_Animate3D_setTransitionTime(JSContext *cx, uint32_t argc, js JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Animate3D_setTransitionTime : Error processing arguments"); cocos2d::Animate3D::setTransitionTime(arg0); @@ -991,7 +991,7 @@ bool js_cocos2dx_3d_AttachNode_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::Bone3D* arg0; + cocos2d::Bone3D* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1287,7 +1287,7 @@ bool js_cocos2dx_3d_BillBoard_createWithTexture(JSContext *cx, uint32_t argc, js JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::Texture2D* arg0; + cocos2d::Texture2D* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1312,7 +1312,7 @@ bool js_cocos2dx_3d_BillBoard_createWithTexture(JSContext *cx, uint32_t argc, js return true; } if (argc == 2) { - cocos2d::Texture2D* arg0; + cocos2d::Texture2D* arg0 = nullptr; cocos2d::BillBoard::Mode arg1; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -1450,7 +1450,7 @@ bool js_cocos2dx_3d_Mesh_setTexture(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Mesh_setTexture : Invalid Native Object"); do { if (argc == 1) { - cocos2d::Texture2D* arg0; + cocos2d::Texture2D* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1583,7 +1583,7 @@ bool js_cocos2dx_3d_Mesh_setMaterial(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Mesh* cobj = (cocos2d::Mesh *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Mesh_setMaterial : Invalid Native Object"); if (argc == 1) { - cocos2d::Material* arg0; + cocos2d::Material* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1706,7 +1706,7 @@ bool js_cocos2dx_3d_Mesh_hasVertexAttrib(JSContext *cx, uint32_t argc, jsval *vp cocos2d::Mesh* cobj = (cocos2d::Mesh *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Mesh_hasVertexAttrib : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Mesh_hasVertexAttrib : Error processing arguments"); bool ret = cobj->hasVertexAttrib(arg0); @@ -1809,7 +1809,7 @@ bool js_cocos2dx_3d_Mesh_setMeshIndexData(JSContext *cx, uint32_t argc, jsval *v cocos2d::Mesh* cobj = (cocos2d::Mesh *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Mesh_setMeshIndexData : Invalid Native Object"); if (argc == 1) { - cocos2d::MeshIndexData* arg0; + cocos2d::MeshIndexData* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1913,7 +1913,7 @@ bool js_cocos2dx_3d_Mesh_setSkin(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Mesh* cobj = (cocos2d::Mesh *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Mesh_setSkin : Invalid Native Object"); if (argc == 1) { - cocos2d::MeshSkin* arg0; + cocos2d::MeshSkin* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1977,7 +1977,7 @@ bool js_cocos2dx_3d_Mesh_setGLProgramState(JSContext *cx, uint32_t argc, jsval * cocos2d::Mesh* cobj = (cocos2d::Mesh *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Mesh_setGLProgramState : Invalid Native Object"); if (argc == 1) { - cocos2d::GLProgramState* arg0; + cocos2d::GLProgramState* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2154,7 +2154,7 @@ bool js_cocos2dx_3d_Skeleton3D_addBone(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Skeleton3D* cobj = (cocos2d::Skeleton3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Skeleton3D_addBone : Invalid Native Object"); if (argc == 1) { - cocos2d::Bone3D* arg0; + cocos2d::Bone3D* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2211,7 +2211,7 @@ bool js_cocos2dx_3d_Skeleton3D_getRootBone(JSContext *cx, uint32_t argc, jsval * cocos2d::Skeleton3D* cobj = (cocos2d::Skeleton3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Skeleton3D_getRootBone : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Skeleton3D_getRootBone : Error processing arguments"); cocos2d::Bone3D* ret = cobj->getRootBone(arg0); @@ -2256,7 +2256,7 @@ bool js_cocos2dx_3d_Skeleton3D_getBoneByIndex(JSContext *cx, uint32_t argc, jsva cocos2d::Skeleton3D* cobj = (cocos2d::Skeleton3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Skeleton3D_getBoneByIndex : Invalid Native Object"); if (argc == 1) { - unsigned int arg0; + unsigned int arg0 = 0; ok &= jsval_to_uint32(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Skeleton3D_getBoneByIndex : Error processing arguments"); cocos2d::Bone3D* ret = cobj->getBoneByIndex(arg0); @@ -2303,7 +2303,7 @@ bool js_cocos2dx_3d_Skeleton3D_getBoneIndex(JSContext *cx, uint32_t argc, jsval cocos2d::Skeleton3D* cobj = (cocos2d::Skeleton3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Skeleton3D_getBoneIndex : Invalid Native Object"); if (argc == 1) { - cocos2d::Bone3D* arg0; + cocos2d::Bone3D* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2495,7 +2495,7 @@ bool js_cocos2dx_3d_Skybox_setTexture(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Skybox* cobj = (cocos2d::Skybox *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Skybox_setTexture : Invalid Native Object"); if (argc == 1) { - cocos2d::TextureCube* arg0; + cocos2d::TextureCube* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2701,7 +2701,7 @@ bool js_cocos2dx_3d_Sprite3D_setTexture(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_setTexture : Invalid Native Object"); do { if (argc == 1) { - cocos2d::Texture2D* arg0; + cocos2d::Texture2D* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2759,7 +2759,7 @@ bool js_cocos2dx_3d_Sprite3D_createAttachSprite3DNode(JSContext *cx, uint32_t ar cocos2d::Sprite3D* cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_createAttachSprite3DNode : Invalid Native Object"); if (argc == 2) { - cocos2d::NodeData* arg0; + cocos2d::NodeData* arg0 = nullptr; cocos2d::MaterialDatas arg1; #pragma warning NO CONVERSION TO NATIVE FOR NodeData* ok = false; @@ -2784,9 +2784,9 @@ bool js_cocos2dx_3d_Sprite3D_loadFromFile(JSContext *cx, uint32_t argc, jsval *v JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_loadFromFile : Invalid Native Object"); if (argc == 4) { std::string arg0; - cocos2d::NodeDatas* arg1; - cocos2d::MeshDatas* arg2; - cocos2d::MaterialDatas* arg3; + cocos2d::NodeDatas* arg1 = nullptr; + cocos2d::MeshDatas* arg2 = nullptr; + cocos2d::MaterialDatas* arg3 = nullptr; ok &= jsval_to_std_string(cx, args.get(0), &arg0); #pragma warning NO CONVERSION TO NATIVE FOR NodeDatas* ok = false; @@ -2814,7 +2814,7 @@ bool js_cocos2dx_3d_Sprite3D_getMaterial(JSContext *cx, uint32_t argc, jsval *vp cocos2d::Sprite3D* cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_getMaterial : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Sprite3D_getMaterial : Error processing arguments"); cocos2d::Material* ret = cobj->getMaterial(arg0); @@ -2843,7 +2843,7 @@ bool js_cocos2dx_3d_Sprite3D_setCullFace(JSContext *cx, uint32_t argc, jsval *vp cocos2d::Sprite3D* cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_setCullFace : Invalid Native Object"); if (argc == 1) { - unsigned int arg0; + unsigned int arg0 = 0; ok &= jsval_to_uint32(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Sprite3D_setCullFace : Error processing arguments"); cobj->setCullFace(arg0); @@ -2863,7 +2863,7 @@ bool js_cocos2dx_3d_Sprite3D_addMesh(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Sprite3D* cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_addMesh : Invalid Native Object"); if (argc == 1) { - cocos2d::Mesh* arg0; + cocos2d::Mesh* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2911,7 +2911,7 @@ bool js_cocos2dx_3d_Sprite3D_setMaterial(JSContext *cx, uint32_t argc, jsval *vp JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_setMaterial : Invalid Native Object"); do { if (argc == 2) { - cocos2d::Material* arg0; + cocos2d::Material* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2922,7 +2922,7 @@ bool js_cocos2dx_3d_Sprite3D_setMaterial(JSContext *cx, uint32_t argc, jsval *vp JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - int arg1; + int arg1 = 0; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); if (!ok) { ok = true; break; } cobj->setMaterial(arg0, arg1); @@ -2933,7 +2933,7 @@ bool js_cocos2dx_3d_Sprite3D_setMaterial(JSContext *cx, uint32_t argc, jsval *vp do { if (argc == 1) { - cocos2d::Material* arg0; + cocos2d::Material* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -3012,8 +3012,8 @@ bool js_cocos2dx_3d_Sprite3D_createSprite3DNode(JSContext *cx, uint32_t argc, js cocos2d::Sprite3D* cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_createSprite3DNode : Invalid Native Object"); if (argc == 3) { - cocos2d::NodeData* arg0; - cocos2d::ModelData* arg1; + cocos2d::NodeData* arg0 = nullptr; + cocos2d::ModelData* arg1 = nullptr; cocos2d::MaterialDatas arg2; #pragma warning NO CONVERSION TO NATIVE FOR NodeData* ok = false; @@ -3082,7 +3082,7 @@ bool js_cocos2dx_3d_Sprite3D_getMeshByIndex(JSContext *cx, uint32_t argc, jsval cocos2d::Sprite3D* cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_getMeshByIndex : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Sprite3D_getMeshByIndex : Error processing arguments"); cocos2d::Mesh* ret = cobj->getMeshByIndex(arg0); @@ -3111,8 +3111,8 @@ bool js_cocos2dx_3d_Sprite3D_createNode(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Sprite3D* cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_createNode : Invalid Native Object"); if (argc == 4) { - cocos2d::NodeData* arg0; - cocos2d::Node* arg1; + cocos2d::NodeData* arg0 = nullptr; + cocos2d::Node* arg1 = nullptr; cocos2d::MaterialDatas arg2; bool arg3; #pragma warning NO CONVERSION TO NATIVE FOR NodeData* @@ -3212,7 +3212,7 @@ bool js_cocos2dx_3d_Sprite3D_setLightMask(JSContext *cx, uint32_t argc, jsval *v cocos2d::Sprite3D* cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_setLightMask : Invalid Native Object"); if (argc == 1) { - unsigned int arg0; + unsigned int arg0 = 0; ok &= jsval_to_uint32(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Sprite3D_setLightMask : Error processing arguments"); cobj->setLightMask(arg0); @@ -3232,7 +3232,7 @@ bool js_cocos2dx_3d_Sprite3D_afterAsyncLoad(JSContext *cx, uint32_t argc, jsval cocos2d::Sprite3D* cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_afterAsyncLoad : Invalid Native Object"); if (argc == 1) { - void* arg0; + void* arg0 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR void* ok = false; JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Sprite3D_afterAsyncLoad : Error processing arguments"); @@ -3832,7 +3832,7 @@ bool js_cocos2dx_3d_Terrain_initHeightMap(JSContext *cx, uint32_t argc, jsval *v cocos2d::Terrain* cobj = (cocos2d::Terrain *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Terrain_initHeightMap : Invalid Native Object"); if (argc == 1) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Terrain_initHeightMap : Error processing arguments"); bool ret = cobj->initHeightMap(arg0); @@ -3854,7 +3854,7 @@ bool js_cocos2dx_3d_Terrain_setMaxDetailMapAmount(JSContext *cx, uint32_t argc, cocos2d::Terrain* cobj = (cocos2d::Terrain *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Terrain_setMaxDetailMapAmount : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Terrain_setMaxDetailMapAmount : Error processing arguments"); cobj->setMaxDetailMapAmount(arg0); @@ -3894,7 +3894,7 @@ bool js_cocos2dx_3d_Terrain_setDetailMap(JSContext *cx, uint32_t argc, jsval *vp cocos2d::Terrain* cobj = (cocos2d::Terrain *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Terrain_setDetailMap : Invalid Native Object"); if (argc == 2) { - unsigned int arg0; + unsigned int arg0 = 0; cocos2d::Terrain::DetailMap arg1; ok &= jsval_to_uint32(cx, args.get(0), &arg0); #pragma warning NO CONVERSION TO NATIVE FOR DetailMap @@ -3917,7 +3917,7 @@ bool js_cocos2dx_3d_Terrain_resetHeightMap(JSContext *cx, uint32_t argc, jsval * cocos2d::Terrain* cobj = (cocos2d::Terrain *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Terrain_resetHeightMap : Invalid Native Object"); if (argc == 1) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Terrain_resetHeightMap : Error processing arguments"); cobj->resetHeightMap(arg0); @@ -3957,7 +3957,7 @@ bool js_cocos2dx_3d_Terrain_setAlphaMap(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Terrain* cobj = (cocos2d::Terrain *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Terrain_setAlphaMap : Invalid Native Object"); if (argc == 1) { - cocos2d::Texture2D* arg0; + cocos2d::Texture2D* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -3985,7 +3985,7 @@ bool js_cocos2dx_3d_Terrain_setSkirtHeightRatio(JSContext *cx, uint32_t argc, js cocos2d::Terrain* cobj = (cocos2d::Terrain *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Terrain_setSkirtHeightRatio : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Terrain_setSkirtHeightRatio : Error processing arguments"); cobj->setSkirtHeightRatio(arg0); @@ -4083,7 +4083,7 @@ bool js_cocos2dx_3d_Terrain_getHeight(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Vec2 arg0; ok &= jsval_to_vector2(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - cocos2d::Vec3* arg1; + cocos2d::Vec3* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -4104,10 +4104,10 @@ bool js_cocos2dx_3d_Terrain_getHeight(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 2) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } double ret = cobj->getHeight(arg0, arg1); @@ -4120,13 +4120,13 @@ bool js_cocos2dx_3d_Terrain_getHeight(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 3) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } - cocos2d::Vec3* arg2; + cocos2d::Vec3* arg2 = nullptr; do { if (args.get(2).isNull()) { arg2 = nullptr; break; } if (!args.get(2).isObject()) { ok = false; break; } @@ -4181,9 +4181,9 @@ bool js_cocos2dx_3d_Terrain_setLODDistance(JSContext *cx, uint32_t argc, jsval * cocos2d::Terrain* cobj = (cocos2d::Terrain *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Terrain_setLODDistance : Invalid Native Object"); if (argc == 3) { - double arg0; - double arg1; - double arg2; + double arg0 = 0; + double arg1 = 0; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -4266,8 +4266,8 @@ bool js_cocos2dx_3d_Terrain_getNormal(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Terrain* cobj = (cocos2d::Terrain *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Terrain_getNormal : Invalid Native Object"); if (argc == 2) { - int arg0; - int arg1; + int arg0 = 0; + int arg1 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Terrain_getNormal : Error processing arguments"); @@ -4306,8 +4306,8 @@ bool js_cocos2dx_3d_Terrain_getImageHeight(JSContext *cx, uint32_t argc, jsval * cocos2d::Terrain* cobj = (cocos2d::Terrain *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Terrain_getImageHeight : Invalid Native Object"); if (argc == 2) { - int arg0; - int arg1; + int arg0 = 0; + int arg1 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Terrain_getImageHeight : Error processing arguments"); @@ -4541,7 +4541,7 @@ bool js_cocos2dx_3d_Bundle3D_loadSkinData(JSContext *cx, uint32_t argc, jsval *v JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Bundle3D_loadSkinData : Invalid Native Object"); if (argc == 2) { std::string arg0; - cocos2d::SkinData* arg1; + cocos2d::SkinData* arg1 = nullptr; ok &= jsval_to_std_string(cx, args.get(0), &arg0); #pragma warning NO CONVERSION TO NATIVE FOR SkinData* ok = false; @@ -4651,7 +4651,7 @@ bool js_cocos2dx_3d_Bundle3D_loadAnimationData(JSContext *cx, uint32_t argc, jsv JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Bundle3D_loadAnimationData : Invalid Native Object"); if (argc == 2) { std::string arg0; - cocos2d::Animation3DData* arg1; + cocos2d::Animation3DData* arg1 = nullptr; ok &= jsval_to_std_string(cx, args.get(0), &arg0); #pragma warning NO CONVERSION TO NATIVE FOR Animation3DData* ok = false; @@ -4692,7 +4692,7 @@ bool js_cocos2dx_3d_Bundle3D_destroyBundle(JSContext *cx, uint32_t argc, jsval * JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::Bundle3D* arg0; + cocos2d::Bundle3D* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -4739,7 +4739,7 @@ bool js_cocos2dx_3d_Bundle3D_loadObj(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::MaterialDatas arg1; cocos2d::NodeDatas arg2; std::string arg3; - const char* arg4; + const char* arg4 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR MeshDatas ok = false; #pragma warning NO CONVERSION TO NATIVE FOR MaterialDatas diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_extension_auto.cpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_extension_auto.cpp index 48a2ece354..498abfe8d8 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_extension_auto.cpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_extension_auto.cpp @@ -229,7 +229,7 @@ bool js_cocos2dx_3d_extension_ParticleSystem3D_setParticleQuota(JSContext *cx, u cocos2d::ParticleSystem3D* cobj = (cocos2d::ParticleSystem3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_ParticleSystem3D_setParticleQuota : Invalid Native Object"); if (argc == 1) { - unsigned int arg0; + unsigned int arg0 = 0; ok &= jsval_to_uint32(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_extension_ParticleSystem3D_setParticleQuota : Error processing arguments"); cobj->setParticleQuota(arg0); @@ -448,7 +448,7 @@ bool js_cocos2dx_3d_extension_PUParticleSystem3D_setEmittedSystemQuota(JSContext cocos2d::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_setEmittedSystemQuota : Invalid Native Object"); if (argc == 1) { - unsigned int arg0; + unsigned int arg0 = 0; ok &= jsval_to_uint32(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_setEmittedSystemQuota : Error processing arguments"); cobj->setEmittedSystemQuota(arg0); @@ -596,7 +596,7 @@ bool js_cocos2dx_3d_extension_PUParticleSystem3D_forceUpdate(JSContext *cx, uint cocos2d::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_forceUpdate : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_forceUpdate : Error processing arguments"); cobj->forceUpdate(arg0); @@ -688,7 +688,7 @@ bool js_cocos2dx_3d_extension_PUParticleSystem3D_setEmittedEmitterQuota(JSContex cocos2d::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_setEmittedEmitterQuota : Invalid Native Object"); if (argc == 1) { - unsigned int arg0; + unsigned int arg0 = 0; ok &= jsval_to_uint32(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_setEmittedEmitterQuota : Error processing arguments"); cobj->setEmittedEmitterQuota(arg0); @@ -753,7 +753,7 @@ bool js_cocos2dx_3d_extension_PUParticleSystem3D_setDefaultWidth(JSContext *cx, cocos2d::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_setDefaultWidth : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_setDefaultWidth : Error processing arguments"); cobj->setDefaultWidth(arg0); @@ -773,7 +773,7 @@ bool js_cocos2dx_3d_extension_PUParticleSystem3D_copyAttributesTo(JSContext *cx, cocos2d::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_copyAttributesTo : Invalid Native Object"); if (argc == 1) { - cocos2d::PUParticleSystem3D* arg0; + cocos2d::PUParticleSystem3D* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -846,7 +846,7 @@ bool js_cocos2dx_3d_extension_PUParticleSystem3D_setMaxVelocity(JSContext *cx, u cocos2d::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_setMaxVelocity : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_setMaxVelocity : Error processing arguments"); cobj->setMaxVelocity(arg0); @@ -956,7 +956,7 @@ bool js_cocos2dx_3d_extension_PUParticleSystem3D_setParticleSystemScaleVelocity( cocos2d::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_setParticleSystemScaleVelocity : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_setParticleSystemScaleVelocity : Error processing arguments"); cobj->setParticleSystemScaleVelocity(arg0); @@ -994,7 +994,7 @@ bool js_cocos2dx_3d_extension_PUParticleSystem3D_setDefaultHeight(JSContext *cx, cocos2d::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_setDefaultHeight : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_setDefaultHeight : Error processing arguments"); cobj->setDefaultHeight(arg0); @@ -1030,7 +1030,7 @@ bool js_cocos2dx_3d_extension_PUParticleSystem3D_setDefaultDepth(JSContext *cx, cocos2d::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_setDefaultDepth : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_setDefaultDepth : Error processing arguments"); cobj->setDefaultDepth(arg0); diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_audioengine_auto.cpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_audioengine_auto.cpp index c1ad9bc02a..e9b1b3e930 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_audioengine_auto.cpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_audioengine_auto.cpp @@ -89,7 +89,7 @@ bool js_cocos2dx_audioengine_AudioProfile_set_maxInstances(JSContext *cx, uint32 JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_audioengine_AudioProfile_set_maxInstances : Invalid Native Object"); bool ok = true; - unsigned int arg0; + unsigned int arg0 = 0; ok &= jsval_to_uint32(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_audioengine_AudioProfile_set_maxInstances : Error processing new value"); cobj->maxInstances = arg0; @@ -114,7 +114,7 @@ bool js_cocos2dx_audioengine_AudioProfile_set_minDelay(JSContext *cx, uint32_t a JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_audioengine_AudioProfile_set_minDelay : Invalid Native Object"); bool ok = true; - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_audioengine_AudioProfile_set_minDelay : Error processing new value"); cobj->minDelay = arg0; @@ -237,8 +237,8 @@ bool js_cocos2dx_audioengine_AudioEngine_setCurrentTime(JSContext *cx, uint32_t JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - int arg0; - double arg1; + int arg0 = 0; + double arg1 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_audioengine_AudioEngine_setCurrentTime : Error processing arguments"); @@ -257,7 +257,7 @@ bool js_cocos2dx_audioengine_AudioEngine_getVolume(JSContext *cx, uint32_t argc, JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_audioengine_AudioEngine_getVolume : Error processing arguments"); double ret = cocos2d::experimental::AudioEngine::getVolume(arg0); @@ -315,7 +315,7 @@ bool js_cocos2dx_audioengine_AudioEngine_pause(JSContext *cx, uint32_t argc, jsv JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_audioengine_AudioEngine_pause : Error processing arguments"); cocos2d::experimental::AudioEngine::pause(arg0); @@ -357,7 +357,7 @@ bool js_cocos2dx_audioengine_AudioEngine_getCurrentTime(JSContext *cx, uint32_t JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_audioengine_AudioEngine_getCurrentTime : Error processing arguments"); double ret = cocos2d::experimental::AudioEngine::getCurrentTime(arg0); @@ -375,7 +375,7 @@ bool js_cocos2dx_audioengine_AudioEngine_setMaxAudioInstance(JSContext *cx, uint JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_audioengine_AudioEngine_setMaxAudioInstance : Error processing arguments"); bool ret = cocos2d::experimental::AudioEngine::setMaxAudioInstance(arg0); @@ -393,7 +393,7 @@ bool js_cocos2dx_audioengine_AudioEngine_isLoop(JSContext *cx, uint32_t argc, js JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_audioengine_AudioEngine_isLoop : Error processing arguments"); bool ret = cocos2d::experimental::AudioEngine::isLoop(arg0); @@ -435,8 +435,8 @@ bool js_cocos2dx_audioengine_AudioEngine_setVolume(JSContext *cx, uint32_t argc, JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - int arg0; - double arg1; + int arg0 = 0; + double arg1 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_audioengine_AudioEngine_setVolume : Error processing arguments"); @@ -528,7 +528,7 @@ bool js_cocos2dx_audioengine_AudioEngine_play2d(JSContext *cx, uint32_t argc, js if (argc == 3) { std::string arg0; bool arg1; - double arg2; + double arg2 = 0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); arg1 = JS::ToBoolean(args.get(1)); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -542,8 +542,8 @@ bool js_cocos2dx_audioengine_AudioEngine_play2d(JSContext *cx, uint32_t argc, js if (argc == 4) { std::string arg0; bool arg1; - double arg2; - const cocos2d::experimental::AudioProfile* arg3; + double arg2 = 0; + const cocos2d::experimental::AudioProfile* arg3 = nullptr; ok &= jsval_to_std_string(cx, args.get(0), &arg0); arg1 = JS::ToBoolean(args.get(1)); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -572,7 +572,7 @@ bool js_cocos2dx_audioengine_AudioEngine_getState(JSContext *cx, uint32_t argc, JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_audioengine_AudioEngine_getState : Error processing arguments"); int ret = (int)cocos2d::experimental::AudioEngine::getState(arg0); @@ -590,7 +590,7 @@ bool js_cocos2dx_audioengine_AudioEngine_resume(JSContext *cx, uint32_t argc, js JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_audioengine_AudioEngine_resume : Error processing arguments"); cocos2d::experimental::AudioEngine::resume(arg0); @@ -606,7 +606,7 @@ bool js_cocos2dx_audioengine_AudioEngine_stop(JSContext *cx, uint32_t argc, jsva JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_audioengine_AudioEngine_stop : Error processing arguments"); cocos2d::experimental::AudioEngine::stop(arg0); @@ -622,7 +622,7 @@ bool js_cocos2dx_audioengine_AudioEngine_getDuration(JSContext *cx, uint32_t arg JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_audioengine_AudioEngine_getDuration : Error processing arguments"); double ret = cocos2d::experimental::AudioEngine::getDuration(arg0); @@ -640,7 +640,7 @@ bool js_cocos2dx_audioengine_AudioEngine_setLoop(JSContext *cx, uint32_t argc, j JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - int arg0; + int arg0 = 0; bool arg1; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); arg1 = JS::ToBoolean(args.get(1)); @@ -679,7 +679,7 @@ bool js_cocos2dx_audioengine_AudioEngine_setFinishCallback(JSContext *cx, uint32 JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - int arg0; + int arg0 = 0; std::function &)> arg1; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); do { @@ -741,7 +741,7 @@ bool js_cocos2dx_audioengine_AudioEngine_getProfile(JSContext *cx, uint32_t argc do { if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); if (!ok) { ok = true; break; } cocos2d::experimental::AudioProfile* ret = cocos2d::experimental::AudioEngine::getProfile(arg0); diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp index 5d9cd334d6..79052ac80a 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp @@ -121,7 +121,7 @@ bool js_cocos2dx_Texture2D_initWithImage(JSContext *cx, uint32_t argc, jsval *vp JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_initWithImage : Invalid Native Object"); do { if (argc == 2) { - cocos2d::Image* arg0; + cocos2d::Image* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -145,7 +145,7 @@ bool js_cocos2dx_Texture2D_initWithImage(JSContext *cx, uint32_t argc, jsval *vp do { if (argc == 1) { - cocos2d::Image* arg0; + cocos2d::Image* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -176,7 +176,7 @@ bool js_cocos2dx_Texture2D_setGLProgram(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_setGLProgram : Invalid Native Object"); if (argc == 1) { - cocos2d::GLProgram* arg0; + cocos2d::GLProgram* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -256,11 +256,11 @@ bool js_cocos2dx_Texture2D_initWithMipmaps(JSContext *cx, uint32_t argc, jsval * cocos2d::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_initWithMipmaps : Invalid Native Object"); if (argc == 5) { - cocos2d::_MipmapInfo* arg0; - int arg1; + cocos2d::_MipmapInfo* arg0 = nullptr; + int arg1 = 0; cocos2d::Texture2D::PixelFormat arg2; - int arg3; - int arg4; + int arg3 = 0; + int arg4 = 0; #pragma warning NO CONVERSION TO NATIVE FOR _MipmapInfo* ok = false; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); @@ -364,7 +364,7 @@ bool js_cocos2dx_Texture2D_initWithString(JSContext *cx, uint32_t argc, jsval *v JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_initWithString : Invalid Native Object"); do { if (argc == 2) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); if (!ok) { ok = true; break; } cocos2d::FontDefinition arg1; @@ -380,13 +380,13 @@ bool js_cocos2dx_Texture2D_initWithString(JSContext *cx, uint32_t argc, jsval *v do { if (argc == 3) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); if (!ok) { ok = true; break; } std::string arg1; ok &= jsval_to_std_string(cx, args.get(1), &arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } bool ret = cobj->initWithString(arg0, arg1, arg2); @@ -399,13 +399,13 @@ bool js_cocos2dx_Texture2D_initWithString(JSContext *cx, uint32_t argc, jsval *v do { if (argc == 4) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); if (!ok) { ok = true; break; } std::string arg1; ok &= jsval_to_std_string(cx, args.get(1), &arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } cocos2d::Size arg3; @@ -421,13 +421,13 @@ bool js_cocos2dx_Texture2D_initWithString(JSContext *cx, uint32_t argc, jsval *v do { if (argc == 5) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); if (!ok) { ok = true; break; } std::string arg1; ok &= jsval_to_std_string(cx, args.get(1), &arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } cocos2d::Size arg3; @@ -446,13 +446,13 @@ bool js_cocos2dx_Texture2D_initWithString(JSContext *cx, uint32_t argc, jsval *v do { if (argc == 6) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); if (!ok) { ok = true; break; } std::string arg1; ok &= jsval_to_std_string(cx, args.get(1), &arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } cocos2d::Size arg3; @@ -484,7 +484,7 @@ bool js_cocos2dx_Texture2D_setMaxT(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_setMaxT : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Texture2D_setMaxT : Error processing arguments"); cobj->setMaxT(arg0); @@ -700,7 +700,7 @@ bool js_cocos2dx_Texture2D_setMaxS(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_setMaxS : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Texture2D_setMaxS : Error processing arguments"); cobj->setMaxS(arg0); @@ -975,9 +975,9 @@ bool js_cocos2dx_Touch_setTouchInfo(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Touch* cobj = (cocos2d::Touch *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Touch_setTouchInfo : Invalid Native Object"); if (argc == 3) { - int arg0; - double arg1; - double arg2; + int arg0 = 0; + double arg1 = 0; + double arg2 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -1419,6 +1419,515 @@ void js_register_cocos2dx_EventTouch(JSContext *cx, JS::HandleObject global) { } } +JSClass *jsb_cocos2d_ComponentContainer_class; +JSObject *jsb_cocos2d_ComponentContainer_prototype; + +bool js_cocos2dx_ComponentContainer_visit(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ComponentContainer* cobj = (cocos2d::ComponentContainer *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ComponentContainer_visit : Invalid Native Object"); + if (argc == 1) { + double arg0 = 0; + ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ComponentContainer_visit : Error processing arguments"); + cobj->visit(arg0); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ComponentContainer_visit : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} +bool js_cocos2dx_ComponentContainer_remove(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + + JS::RootedObject obj(cx); + cocos2d::ComponentContainer* cobj = NULL; + obj = args.thisv().toObjectOrNull(); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cobj = (cocos2d::ComponentContainer *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ComponentContainer_remove : Invalid Native Object"); + do { + if (argc == 1) { + cocos2d::Component* arg0 = nullptr; + do { + if (args.get(0).isNull()) { arg0 = nullptr; break; } + if (!args.get(0).isObject()) { ok = false; break; } + js_proxy_t *jsProxy; + JSObject *tmpObj = args.get(0).toObjectOrNull(); + jsProxy = jsb_get_js_proxy(tmpObj); + arg0 = (cocos2d::Component*)(jsProxy ? jsProxy->ptr : NULL); + JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); + } while (0); + if (!ok) { ok = true; break; } + bool ret = cobj->remove(arg0); + jsval jsret = JSVAL_NULL; + jsret = BOOLEAN_TO_JSVAL(ret); + args.rval().set(jsret); + return true; + } + } while(0); + + do { + if (argc == 1) { + std::string arg0; + ok &= jsval_to_std_string(cx, args.get(0), &arg0); + if (!ok) { ok = true; break; } + bool ret = cobj->remove(arg0); + jsval jsret = JSVAL_NULL; + jsret = BOOLEAN_TO_JSVAL(ret); + args.rval().set(jsret); + return true; + } + } while(0); + + JS_ReportError(cx, "js_cocos2dx_ComponentContainer_remove : wrong number of arguments"); + return false; +} +bool js_cocos2dx_ComponentContainer_removeAll(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ComponentContainer* cobj = (cocos2d::ComponentContainer *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ComponentContainer_removeAll : Invalid Native Object"); + if (argc == 0) { + cobj->removeAll(); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ComponentContainer_removeAll : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_ComponentContainer_add(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ComponentContainer* cobj = (cocos2d::ComponentContainer *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ComponentContainer_add : Invalid Native Object"); + if (argc == 1) { + cocos2d::Component* arg0 = nullptr; + do { + if (args.get(0).isNull()) { arg0 = nullptr; break; } + if (!args.get(0).isObject()) { ok = false; break; } + js_proxy_t *jsProxy; + JSObject *tmpObj = args.get(0).toObjectOrNull(); + jsProxy = jsb_get_js_proxy(tmpObj); + arg0 = (cocos2d::Component*)(jsProxy ? jsProxy->ptr : NULL); + JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); + } while (0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ComponentContainer_add : Error processing arguments"); + bool ret = cobj->add(arg0); + jsval jsret = JSVAL_NULL; + jsret = BOOLEAN_TO_JSVAL(ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ComponentContainer_add : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} +bool js_cocos2dx_ComponentContainer_isEmpty(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ComponentContainer* cobj = (cocos2d::ComponentContainer *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ComponentContainer_isEmpty : Invalid Native Object"); + if (argc == 0) { + bool ret = cobj->isEmpty(); + jsval jsret = JSVAL_NULL; + jsret = BOOLEAN_TO_JSVAL(ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ComponentContainer_isEmpty : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_ComponentContainer_get(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ComponentContainer* cobj = (cocos2d::ComponentContainer *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ComponentContainer_get : Invalid Native Object"); + if (argc == 1) { + std::string arg0; + ok &= jsval_to_std_string(cx, args.get(0), &arg0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ComponentContainer_get : Error processing arguments"); + cocos2d::Component* ret = cobj->get(arg0); + jsval jsret = JSVAL_NULL; + do { + if (ret) { + js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::Component*)ret); + jsret = OBJECT_TO_JSVAL(jsProxy->obj); + } else { + jsret = JSVAL_NULL; + } + } while (0); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ComponentContainer_get : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} + +void js_cocos2d_ComponentContainer_finalize(JSFreeOp *fop, JSObject *obj) { + CCLOGINFO("jsbindings: finalizing JS object %p (ComponentContainer)", obj); +} +void js_register_cocos2dx_ComponentContainer(JSContext *cx, JS::HandleObject global) { + jsb_cocos2d_ComponentContainer_class = (JSClass *)calloc(1, sizeof(JSClass)); + jsb_cocos2d_ComponentContainer_class->name = "ComponentContainer"; + jsb_cocos2d_ComponentContainer_class->addProperty = JS_PropertyStub; + jsb_cocos2d_ComponentContainer_class->delProperty = JS_DeletePropertyStub; + jsb_cocos2d_ComponentContainer_class->getProperty = JS_PropertyStub; + jsb_cocos2d_ComponentContainer_class->setProperty = JS_StrictPropertyStub; + jsb_cocos2d_ComponentContainer_class->enumerate = JS_EnumerateStub; + jsb_cocos2d_ComponentContainer_class->resolve = JS_ResolveStub; + jsb_cocos2d_ComponentContainer_class->convert = JS_ConvertStub; + jsb_cocos2d_ComponentContainer_class->finalize = js_cocos2d_ComponentContainer_finalize; + jsb_cocos2d_ComponentContainer_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2); + + static JSPropertySpec properties[] = { + JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_PS_END + }; + + static JSFunctionSpec funcs[] = { + JS_FN("visit", js_cocos2dx_ComponentContainer_visit, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("remove", js_cocos2dx_ComponentContainer_remove, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("removeAll", js_cocos2dx_ComponentContainer_removeAll, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("add", js_cocos2dx_ComponentContainer_add, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("isEmpty", js_cocos2dx_ComponentContainer_isEmpty, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getComponent", js_cocos2dx_ComponentContainer_get, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FS_END + }; + + JSFunctionSpec *st_funcs = NULL; + + jsb_cocos2d_ComponentContainer_prototype = JS_InitClass( + cx, global, + JS::NullPtr(), // parent proto + jsb_cocos2d_ComponentContainer_class, + empty_constructor, 0, + properties, + funcs, + NULL, // no static properties + st_funcs); + // make the class enumerable in the registered namespace +// bool found; +//FIXME: Removed in Firefox v27 +// JS_SetPropertyAttributes(cx, global, "ComponentContainer", JSPROP_ENUMERATE | JSPROP_READONLY, &found); + + // add the proto and JSClass to the type->js info hash table + TypeTest t; + js_type_class_t *p; + std::string typeName = t.s_name(); + if (_js_global_type_map.find(typeName) == _js_global_type_map.end()) + { + p = (js_type_class_t *)malloc(sizeof(js_type_class_t)); + p->jsclass = jsb_cocos2d_ComponentContainer_class; + p->proto = jsb_cocos2d_ComponentContainer_prototype; + p->parentProto = NULL; + _js_global_type_map.insert(std::make_pair(typeName, p)); + } +} + +JSClass *jsb_cocos2d_Component_class; +JSObject *jsb_cocos2d_Component_prototype; + +bool js_cocos2dx_Component_setEnabled(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_setEnabled : Invalid Native Object"); + if (argc == 1) { + bool arg0; + arg0 = JS::ToBoolean(args.get(0)); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Component_setEnabled : Error processing arguments"); + cobj->setEnabled(arg0); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_Component_setEnabled : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} +bool js_cocos2dx_Component_setName(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_setName : Invalid Native Object"); + if (argc == 1) { + std::string arg0; + ok &= jsval_to_std_string(cx, args.get(0), &arg0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Component_setName : Error processing arguments"); + cobj->setName(arg0); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_Component_setName : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} +bool js_cocos2dx_Component_isEnabled(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_isEnabled : Invalid Native Object"); + if (argc == 0) { + bool ret = cobj->isEnabled(); + jsval jsret = JSVAL_NULL; + jsret = BOOLEAN_TO_JSVAL(ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_Component_isEnabled : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_Component_getOwner(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_getOwner : Invalid Native Object"); + if (argc == 0) { + cocos2d::Node* ret = cobj->getOwner(); + jsval jsret = JSVAL_NULL; + do { + if (ret) { + js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::Node*)ret); + jsret = OBJECT_TO_JSVAL(jsProxy->obj); + } else { + jsret = JSVAL_NULL; + } + } while (0); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_Component_getOwner : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_Component_init(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_init : Invalid Native Object"); + if (argc == 0) { + bool ret = cobj->init(); + jsval jsret = JSVAL_NULL; + jsret = BOOLEAN_TO_JSVAL(ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_Component_init : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_Component_getName(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_getName : Invalid Native Object"); + if (argc == 0) { + const std::string& ret = cobj->getName(); + jsval jsret = JSVAL_NULL; + jsret = std_string_to_jsval(cx, ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_Component_getName : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_Component_setOwner(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_setOwner : Invalid Native Object"); + if (argc == 1) { + cocos2d::Node* arg0 = nullptr; + do { + if (args.get(0).isNull()) { arg0 = nullptr; break; } + if (!args.get(0).isObject()) { ok = false; break; } + js_proxy_t *jsProxy; + JSObject *tmpObj = args.get(0).toObjectOrNull(); + jsProxy = jsb_get_js_proxy(tmpObj); + arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL); + JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); + } while (0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Component_setOwner : Error processing arguments"); + cobj->setOwner(arg0); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_Component_setOwner : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} +bool js_cocos2dx_Component_create(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + if (argc == 0) { + cocos2d::Component* ret = cocos2d::Component::create(); + jsval jsret = JSVAL_NULL; + do { + if (ret) { + js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::Component*)ret); + jsret = OBJECT_TO_JSVAL(jsProxy->obj); + } else { + jsret = JSVAL_NULL; + } + } while (0); + args.rval().set(jsret); + return true; + } + JS_ReportError(cx, "js_cocos2dx_Component_create : wrong number of arguments"); + return false; +} + +bool js_cocos2dx_Component_constructor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + cocos2d::Component* cobj = new (std::nothrow) cocos2d::Component(); + cocos2d::Ref *_ccobj = dynamic_cast(cobj); + if (_ccobj) { + _ccobj->autorelease(); + } + TypeTest t; + js_type_class_t *typeClass = nullptr; + std::string typeName = t.s_name(); + auto typeMapIter = _js_global_type_map.find(typeName); + CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!"); + typeClass = typeMapIter->second; + CCASSERT(typeClass, "The value is null."); + // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto); + JS::RootedObject proto(cx, typeClass->proto.get()); + JS::RootedObject parent(cx, typeClass->parentProto.get()); + JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent)); + args.rval().set(OBJECT_TO_JSVAL(obj)); + // link the native object with the javascript object + js_proxy_t* p = jsb_new_proxy(cobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::Component"); + if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + return true; +}static bool js_cocos2dx_Component_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::Component *nobj = new (std::nothrow) cocos2d::Component(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::Component"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; +} + +void js_cocos2d_Component_finalize(JSFreeOp *fop, JSObject *obj) { + CCLOGINFO("jsbindings: finalizing JS object %p (Component)", obj); +} + +void js_register_cocos2dx_Component(JSContext *cx, JS::HandleObject global) { + jsb_cocos2d_Component_class = (JSClass *)calloc(1, sizeof(JSClass)); + jsb_cocos2d_Component_class->name = "Component"; + jsb_cocos2d_Component_class->addProperty = JS_PropertyStub; + jsb_cocos2d_Component_class->delProperty = JS_DeletePropertyStub; + jsb_cocos2d_Component_class->getProperty = JS_PropertyStub; + jsb_cocos2d_Component_class->setProperty = JS_StrictPropertyStub; + jsb_cocos2d_Component_class->enumerate = JS_EnumerateStub; + jsb_cocos2d_Component_class->resolve = JS_ResolveStub; + jsb_cocos2d_Component_class->convert = JS_ConvertStub; + jsb_cocos2d_Component_class->finalize = js_cocos2d_Component_finalize; + jsb_cocos2d_Component_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2); + + static JSPropertySpec properties[] = { + JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_PS_END + }; + + static JSFunctionSpec funcs[] = { + JS_FN("setEnabled", js_cocos2dx_Component_setEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("setName", js_cocos2dx_Component_setName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("isEnabled", js_cocos2dx_Component_isEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getOwner", js_cocos2dx_Component_getOwner, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("init", js_cocos2dx_Component_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getName", js_cocos2dx_Component_getName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("setOwner", js_cocos2dx_Component_setOwner, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_Component_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FS_END + }; + + static JSFunctionSpec st_funcs[] = { + JS_FN("create", js_cocos2dx_Component_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FS_END + }; + + jsb_cocos2d_Component_prototype = JS_InitClass( + cx, global, + JS::NullPtr(), // parent proto + jsb_cocos2d_Component_class, + js_cocos2dx_Component_constructor, 0, // constructor + properties, + funcs, + NULL, // no static properties + st_funcs); + // make the class enumerable in the registered namespace +// bool found; +//FIXME: Removed in Firefox v27 +// JS_SetPropertyAttributes(cx, global, "Component", JSPROP_ENUMERATE | JSPROP_READONLY, &found); + + // add the proto and JSClass to the type->js info hash table + TypeTest t; + js_type_class_t *p; + std::string typeName = t.s_name(); + if (_js_global_type_map.find(typeName) == _js_global_type_map.end()) + { + p = (js_type_class_t *)malloc(sizeof(js_type_class_t)); + p->jsclass = jsb_cocos2d_Component_class; + p->proto = jsb_cocos2d_Component_prototype; + p->parentProto = NULL; + _js_global_type_map.insert(std::make_pair(typeName, p)); + } + anonEvaluate(cx, global, "(function () { cc.Component.extend = cc.Class.extend; })()"); +} + JSClass *jsb_cocos2d_Node_class; JSObject *jsb_cocos2d_Node_prototype; @@ -1435,7 +1944,7 @@ bool js_cocos2dx_Node_addChild(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_addChild : Invalid Native Object"); do { if (argc == 2) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1446,7 +1955,7 @@ bool js_cocos2dx_Node_addChild(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - int arg1; + int arg1 = 0; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); if (!ok) { ok = true; break; } cobj->addChild(arg0, arg1); @@ -1457,7 +1966,7 @@ bool js_cocos2dx_Node_addChild(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1476,7 +1985,7 @@ bool js_cocos2dx_Node_addChild(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 3) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1487,10 +1996,10 @@ bool js_cocos2dx_Node_addChild(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - int arg1; + int arg1 = 0; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); if (!ok) { ok = true; break; } - int arg2; + int arg2 = 0; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); if (!ok) { ok = true; break; } cobj->addChild(arg0, arg1, arg2); @@ -1501,7 +2010,7 @@ bool js_cocos2dx_Node_addChild(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 3) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1512,7 +2021,7 @@ bool js_cocos2dx_Node_addChild(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - int arg1; + int arg1 = 0; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); if (!ok) { ok = true; break; } std::string arg2; @@ -1540,7 +2049,7 @@ bool js_cocos2dx_Node_removeComponent(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_removeComponent : Invalid Native Object"); do { if (argc == 1) { - cocos2d::Component* arg0; + cocos2d::Component* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1575,34 +2084,6 @@ bool js_cocos2dx_Node_removeComponent(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_Node_removeComponent : wrong number of arguments"); return false; } -bool js_cocos2dx_Node_setPhysicsBody(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setPhysicsBody : Invalid Native Object"); - if (argc == 1) { - cocos2d::PhysicsBody* arg0; - do { - if (args.get(0).isNull()) { arg0 = nullptr; break; } - if (!args.get(0).isObject()) { ok = false; break; } - js_proxy_t *jsProxy; - JSObject *tmpObj = args.get(0).toObjectOrNull(); - jsProxy = jsb_get_js_proxy(tmpObj); - arg0 = (cocos2d::PhysicsBody*)(jsProxy ? jsProxy->ptr : NULL); - JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); - } while (0); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setPhysicsBody : Error processing arguments"); - cobj->setPhysicsBody(arg0); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_Node_setPhysicsBody : wrong number of arguments: %d, was expecting %d", argc, 1); - return false; -} bool js_cocos2dx_Node_getGLProgram(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -1628,28 +2109,6 @@ bool js_cocos2dx_Node_getGLProgram(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_Node_getGLProgram : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } -bool js_cocos2dx_Node_updateTransformFromPhysics(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_updateTransformFromPhysics : Invalid Native Object"); - if (argc == 2) { - cocos2d::Mat4 arg0; - unsigned int arg1; - ok &= jsval_to_matrix(cx, args.get(0), &arg0); - ok &= jsval_to_uint32(cx, args.get(1), &arg1); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_updateTransformFromPhysics : Error processing arguments"); - cobj->updateTransformFromPhysics(arg0, arg1); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_Node_updateTransformFromPhysics : wrong number of arguments: %d, was expecting %d", argc, 2); - return false; -} bool js_cocos2dx_Node_getDescription(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -1893,7 +2352,7 @@ bool js_cocos2dx_Node_setRotation(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setRotation : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setRotation : Error processing arguments"); cobj->setRotation(arg0); @@ -1913,7 +2372,7 @@ bool js_cocos2dx_Node_setScaleZ(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setScaleZ : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setScaleZ : Error processing arguments"); cobj->setScaleZ(arg0); @@ -1933,7 +2392,7 @@ bool js_cocos2dx_Node_setScaleY(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setScaleY : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setScaleY : Error processing arguments"); cobj->setScaleY(arg0); @@ -1953,7 +2412,7 @@ bool js_cocos2dx_Node_setScaleX(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setScaleX : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setScaleX : Error processing arguments"); cobj->setScaleX(arg0); @@ -2021,22 +2480,6 @@ bool js_cocos2dx_Node_setonEnterTransitionDidFinishCallback(JSContext *cx, uint3 JS_ReportError(cx, "js_cocos2dx_Node_setonEnterTransitionDidFinishCallback : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } -bool js_cocos2dx_Node_removeFromPhysicsWorld(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_removeFromPhysicsWorld : Invalid Native Object"); - if (argc == 0) { - cobj->removeFromPhysicsWorld(); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_Node_removeFromPhysicsWorld : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} bool js_cocos2dx_Node_removeAllComponents(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -2080,7 +2523,7 @@ bool js_cocos2dx_Node_setCameraMask(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setCameraMask : Invalid Native Object"); if (argc == 1) { - unsigned short arg0; + unsigned short arg0 = 0; ok &= jsval_to_ushort(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setCameraMask : Error processing arguments"); cobj->setCameraMask(arg0); @@ -2088,7 +2531,7 @@ bool js_cocos2dx_Node_setCameraMask(JSContext *cx, uint32_t argc, jsval *vp) return true; } if (argc == 2) { - unsigned short arg0; + unsigned short arg0 = 0; bool arg1; ok &= jsval_to_ushort(cx, args.get(0), &arg0); arg1 = JS::ToBoolean(args.get(1)); @@ -2137,24 +2580,6 @@ bool js_cocos2dx_Node_getonEnterTransitionDidFinishCallback(JSContext *cx, uint3 JS_ReportError(cx, "js_cocos2dx_Node_getonEnterTransitionDidFinishCallback : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } -bool js_cocos2dx_Node_isOpacityModifyRGB(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_isOpacityModifyRGB : Invalid Native Object"); - if (argc == 0) { - bool ret = cobj->isOpacityModifyRGB(); - jsval jsret = JSVAL_NULL; - jsret = BOOLEAN_TO_JSVAL(ret); - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_Node_isOpacityModifyRGB : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} bool js_cocos2dx_Node_getNodeToWorldAffineTransform(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -2200,7 +2625,7 @@ bool js_cocos2dx_Node_removeChild(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_removeChild : Invalid Native Object"); if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2216,7 +2641,7 @@ bool js_cocos2dx_Node_removeChild(JSContext *cx, uint32_t argc, jsval *vp) return true; } if (argc == 2) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; bool arg1; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -2296,7 +2721,7 @@ bool js_cocos2dx_Node_setSkewX(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setSkewX : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setSkewX : Error processing arguments"); cobj->setSkewX(arg0); @@ -2316,7 +2741,7 @@ bool js_cocos2dx_Node_setGLProgramState(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setGLProgramState : Invalid Native Object"); if (argc == 1) { - cocos2d::GLProgramState* arg0; + cocos2d::GLProgramState* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2383,7 +2808,7 @@ bool js_cocos2dx_Node_stopActionsByFlags(JSContext *cx, uint32_t argc, jsval *vp cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_stopActionsByFlags : Invalid Native Object"); if (argc == 1) { - unsigned int arg0; + unsigned int arg0 = 0; ok &= jsval_to_uint32(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_stopActionsByFlags : Error processing arguments"); cobj->stopActionsByFlags(arg0); @@ -2462,7 +2887,7 @@ bool js_cocos2dx_Node_convertTouchToNodeSpace(JSContext *cx, uint32_t argc, jsva cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_convertTouchToNodeSpace : Invalid Native Object"); if (argc == 1) { - cocos2d::Touch* arg0; + cocos2d::Touch* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2596,7 +3021,7 @@ bool js_cocos2dx_Node_setParent(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setParent : Invalid Native Object"); if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2664,7 +3089,7 @@ bool js_cocos2dx_Node_getNodeToParentAffineTransform(JSContext *cx, uint32_t arg JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getNodeToParentAffineTransform : Invalid Native Object"); do { if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2705,7 +3130,7 @@ bool js_cocos2dx_Node_convertTouchToNodeSpaceAR(JSContext *cx, uint32_t argc, js cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_convertTouchToNodeSpaceAR : Invalid Native Object"); if (argc == 1) { - cocos2d::Touch* arg0; + cocos2d::Touch* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2744,29 +3169,22 @@ bool js_cocos2dx_Node_getOnEnterCallback(JSContext *cx, uint32_t argc, jsval *vp JS_ReportError(cx, "js_cocos2dx_Node_getOnEnterCallback : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } -bool js_cocos2dx_Node_getPhysicsBody(JSContext *cx, uint32_t argc, jsval *vp) +bool js_cocos2dx_Node_isOpacityModifyRGB(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); js_proxy_t *proxy = jsb_get_js_proxy(obj); cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getPhysicsBody : Invalid Native Object"); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_isOpacityModifyRGB : Invalid Native Object"); if (argc == 0) { - cocos2d::PhysicsBody* ret = cobj->getPhysicsBody(); + bool ret = cobj->isOpacityModifyRGB(); jsval jsret = JSVAL_NULL; - do { - if (ret) { - js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::PhysicsBody*)ret); - jsret = OBJECT_TO_JSVAL(jsProxy->obj); - } else { - jsret = JSVAL_NULL; - } - } while (0); + jsret = BOOLEAN_TO_JSVAL(ret); args.rval().set(jsret); return true; } - JS_ReportError(cx, "js_cocos2dx_Node_getPhysicsBody : wrong number of arguments: %d, was expecting %d", argc, 0); + JS_ReportError(cx, "js_cocos2dx_Node_isOpacityModifyRGB : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } bool js_cocos2dx_Node_stopActionByTag(JSContext *cx, uint32_t argc, jsval *vp) @@ -2778,7 +3196,7 @@ bool js_cocos2dx_Node_stopActionByTag(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_stopActionByTag : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_stopActionByTag : Error processing arguments"); cobj->stopActionByTag(arg0); @@ -2798,8 +3216,8 @@ bool js_cocos2dx_Node_reorderChild(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_reorderChild : Invalid Native Object"); if (argc == 2) { - cocos2d::Node* arg0; - int arg1; + cocos2d::Node* arg0 = nullptr; + int arg1 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2848,7 +3266,7 @@ bool js_cocos2dx_Node_setSkewY(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setSkewY : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setSkewY : Error processing arguments"); cobj->setSkewY(arg0); @@ -2888,7 +3306,7 @@ bool js_cocos2dx_Node_setPositionX(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setPositionX : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setPositionX : Error processing arguments"); cobj->setPositionX(arg0); @@ -3020,7 +3438,7 @@ bool js_cocos2dx_Node_getNodeToParentTransform(JSContext *cx, uint32_t argc, jsv JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getNodeToParentTransform : Invalid Native Object"); do { if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -3083,7 +3501,7 @@ bool js_cocos2dx_Node_addComponent(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_addComponent : Invalid Native Object"); if (argc == 1) { - cocos2d::Component* arg0; + cocos2d::Component* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -3113,7 +3531,7 @@ bool js_cocos2dx_Node_runAction(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_runAction : Invalid Native Object"); if (argc == 1) { - cocos2d::Action* arg0; + cocos2d::Action* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -3162,7 +3580,7 @@ bool js_cocos2dx_Node_visit(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 3) { - cocos2d::Renderer* arg0; + cocos2d::Renderer* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -3176,7 +3594,7 @@ bool js_cocos2dx_Node_visit(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Mat4 arg1; ok &= jsval_to_matrix(cx, args.get(1), &arg1); if (!ok) { ok = true; break; } - unsigned int arg2; + unsigned int arg2 = 0; ok &= jsval_to_uint32(cx, args.get(2), &arg2); if (!ok) { ok = true; break; } cobj->visit(arg0, arg1, arg2); @@ -3197,7 +3615,7 @@ bool js_cocos2dx_Node_setGLProgram(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setGLProgram : Invalid Native Object"); if (argc == 1) { - cocos2d::GLProgram* arg0; + cocos2d::GLProgram* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -3309,7 +3727,7 @@ bool js_cocos2dx_Node_setPositionZ(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setPositionZ : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setPositionZ : Error processing arguments"); cobj->setPositionZ(arg0); @@ -3354,7 +3772,7 @@ bool js_cocos2dx_Node_setScheduler(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setScheduler : Invalid Native Object"); if (argc == 1) { - cocos2d::Scheduler* arg0; + cocos2d::Scheduler* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -3474,7 +3892,7 @@ bool js_cocos2dx_Node_getActionByTag(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getActionByTag : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_getActionByTag : Error processing arguments"); cocos2d::Action* ret = cobj->getActionByTag(arg0); @@ -3503,7 +3921,7 @@ bool js_cocos2dx_Node_setRotationSkewX(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setRotationSkewX : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setRotationSkewX : Error processing arguments"); cobj->setRotationSkewX(arg0); @@ -3523,7 +3941,7 @@ bool js_cocos2dx_Node_setRotationSkewY(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setRotationSkewY : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setRotationSkewY : Error processing arguments"); cobj->setRotationSkewY(arg0); @@ -3554,32 +3972,6 @@ bool js_cocos2dx_Node_setName(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_Node_setName : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } -bool js_cocos2dx_Node_updatePhysicsBodyTransform(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_updatePhysicsBodyTransform : Invalid Native Object"); - if (argc == 4) { - cocos2d::Mat4 arg0; - unsigned int arg1; - double arg2; - double arg3; - ok &= jsval_to_matrix(cx, args.get(0), &arg0); - ok &= jsval_to_uint32(cx, args.get(1), &arg1); - ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - ok &= JS::ToNumber( cx, args.get(3), &arg3) && !isnan(arg3); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_updatePhysicsBodyTransform : Error processing arguments"); - cobj->updatePhysicsBodyTransform(arg0, arg1, arg2, arg3); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_Node_updatePhysicsBodyTransform : wrong number of arguments: %d, was expecting %d", argc, 4); - return false; -} bool js_cocos2dx_Node_getDisplayedOpacity(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -3691,7 +4083,7 @@ bool js_cocos2dx_Node_setActionManager(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setActionManager : Invalid Native Object"); if (argc == 1) { - cocos2d::ActionManager* arg0; + cocos2d::ActionManager* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -3723,11 +4115,11 @@ bool js_cocos2dx_Node_getPosition(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getPosition : Invalid Native Object"); do { if (argc == 2) { - float* arg0; + float* arg0 = 0; #pragma warning NO CONVERSION TO NATIVE FOR float* ok = false; if (!ok) { ok = true; break; } - float* arg1; + float* arg1 = 0; #pragma warning NO CONVERSION TO NATIVE FOR float* ok = false; if (!ok) { ok = true; break; } @@ -3879,7 +4271,7 @@ bool js_cocos2dx_Node_removeChildByTag(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_removeChildByTag : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_removeChildByTag : Error processing arguments"); cobj->removeChildByTag(arg0); @@ -3887,7 +4279,7 @@ bool js_cocos2dx_Node_removeChildByTag(JSContext *cx, uint32_t argc, jsval *vp) return true; } if (argc == 2) { - int arg0; + int arg0 = 0; bool arg1; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); arg1 = JS::ToBoolean(args.get(1)); @@ -3909,7 +4301,7 @@ bool js_cocos2dx_Node_setPositionY(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setPositionY : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setPositionY : Error processing arguments"); cobj->setPositionY(arg0); @@ -4005,7 +4397,7 @@ bool js_cocos2dx_Node_setGlobalZOrder(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setGlobalZOrder : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setGlobalZOrder : Error processing arguments"); cobj->setGlobalZOrder(arg0); @@ -4029,10 +4421,10 @@ bool js_cocos2dx_Node_setScale(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setScale : Invalid Native Object"); do { if (argc == 2) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } cobj->setScale(arg0, arg1); @@ -4043,7 +4435,7 @@ bool js_cocos2dx_Node_setScale(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } cobj->setScale(arg0); @@ -4082,7 +4474,7 @@ bool js_cocos2dx_Node_getChildByTag(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getChildByTag : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_getChildByTag : Error processing arguments"); cocos2d::Node* ret = cobj->getChildByTag(arg0); @@ -4111,7 +4503,7 @@ bool js_cocos2dx_Node_setOrderOfArrival(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setOrderOfArrival : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setOrderOfArrival : Error processing arguments"); cobj->setOrderOfArrival(arg0); @@ -4185,7 +4577,7 @@ bool js_cocos2dx_Node_setLocalZOrder(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setLocalZOrder : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setLocalZOrder : Error processing arguments"); cobj->setLocalZOrder(arg0); @@ -4292,7 +4684,7 @@ bool js_cocos2dx_Node_stopAllActionsByTag(JSContext *cx, uint32_t argc, jsval *v cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_stopAllActionsByTag : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_stopAllActionsByTag : Error processing arguments"); cobj->stopAllActionsByTag(arg0); @@ -4330,7 +4722,7 @@ bool js_cocos2dx_Node_setEventDispatcher(JSContext *cx, uint32_t argc, jsval *vp cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setEventDispatcher : Invalid Native Object"); if (argc == 1) { - cocos2d::EventDispatcher* arg0; + cocos2d::EventDispatcher* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -4388,7 +4780,7 @@ bool js_cocos2dx_Node_draw(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 3) { - cocos2d::Renderer* arg0; + cocos2d::Renderer* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -4402,7 +4794,7 @@ bool js_cocos2dx_Node_draw(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Mat4 arg1; ok &= jsval_to_matrix(cx, args.get(1), &arg1); if (!ok) { ok = true; break; } - unsigned int arg2; + unsigned int arg2 = 0; ok &= jsval_to_uint32(cx, args.get(2), &arg2); if (!ok) { ok = true; break; } cobj->draw(arg0, arg1, arg2); @@ -4423,7 +4815,7 @@ bool js_cocos2dx_Node_setUserObject(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setUserObject : Invalid Native Object"); if (argc == 1) { - cocos2d::Ref* arg0; + cocos2d::Ref* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -4574,7 +4966,7 @@ bool js_cocos2dx_Node_update(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_update : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_update : Error processing arguments"); cobj->update(arg0); @@ -4704,7 +5096,7 @@ bool js_cocos2dx_Node_setTag(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setTag : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setTag : Error processing arguments"); cobj->setTag(arg0); @@ -4762,7 +5154,7 @@ bool js_cocos2dx_Node_stopAction(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_stopAction : Invalid Native Object"); if (argc == 1) { - cocos2d::Action* arg0; + cocos2d::Action* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -4919,9 +5311,7 @@ void js_register_cocos2dx_Node(JSContext *cx, JS::HandleObject global) { static JSFunctionSpec funcs[] = { JS_FN("addChild", js_cocos2dx_Node_addChild, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("removeComponent", js_cocos2dx_Node_removeComponent, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("setPhysicsBody", js_cocos2dx_Node_setPhysicsBody, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getShaderProgram", js_cocos2dx_Node_getGLProgram, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("updateTransformFromPhysics", js_cocos2dx_Node_updateTransformFromPhysics, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getDescription", js_cocos2dx_Node_getDescription, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setOpacityModifyRGB", js_cocos2dx_Node_setOpacityModifyRGB, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setCascadeOpacityEnabled", js_cocos2dx_Node_setCascadeOpacityEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -4938,13 +5328,11 @@ void js_register_cocos2dx_Node(JSContext *cx, JS::HandleObject global) { JS_FN("setScaleX", js_cocos2dx_Node_setScaleX, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getColor", js_cocos2dx_Node_getColor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setonEnterTransitionDidFinishCallback", js_cocos2dx_Node_setonEnterTransitionDidFinishCallback, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("removeFromPhysicsWorld", js_cocos2dx_Node_removeFromPhysicsWorld, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("removeAllComponents", js_cocos2dx_Node_removeAllComponents, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getOpacity", js_cocos2dx_Node_getOpacity, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setCameraMask", js_cocos2dx_Node_setCameraMask, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getTag", js_cocos2dx_Node_getTag, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getonEnterTransitionDidFinishCallback", js_cocos2dx_Node_getonEnterTransitionDidFinishCallback, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("isOpacityModifyRGB", js_cocos2dx_Node_isOpacityModifyRGB, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getNodeToWorldTransform", js_cocos2dx_Node_getNodeToWorldAffineTransform, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getPosition3D", js_cocos2dx_Node_getPosition3D, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("removeChild", js_cocos2dx_Node_removeChild, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -4968,7 +5356,7 @@ void js_register_cocos2dx_Node(JSContext *cx, JS::HandleObject global) { JS_FN("getNodeToParentTransform", js_cocos2dx_Node_getNodeToParentAffineTransform, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("convertTouchToNodeSpaceAR", js_cocos2dx_Node_convertTouchToNodeSpaceAR, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getOnEnterCallback", js_cocos2dx_Node_getOnEnterCallback, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("getPhysicsBody", js_cocos2dx_Node_getPhysicsBody, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("isOpacityModifyRGB", js_cocos2dx_Node_isOpacityModifyRGB, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("stopActionByTag", js_cocos2dx_Node_stopActionByTag, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("reorderChild", js_cocos2dx_Node_reorderChild, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("ignoreAnchorPointForPosition", js_cocos2dx_Node_ignoreAnchorPointForPosition, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -5003,7 +5391,6 @@ void js_register_cocos2dx_Node(JSContext *cx, JS::HandleObject global) { JS_FN("setRotationX", js_cocos2dx_Node_setRotationSkewX, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setRotationY", js_cocos2dx_Node_setRotationSkewY, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setName", js_cocos2dx_Node_setName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("updatePhysicsBodyTransform", js_cocos2dx_Node_updatePhysicsBodyTransform, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getDisplayedOpacity", js_cocos2dx_Node_getDisplayedOpacity, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getLocalZOrder", js_cocos2dx_Node_getLocalZOrder, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getScheduler", js_cocos2dx_Node_getScheduler, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -5229,7 +5616,7 @@ bool js_cocos2dx_Scene_render(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Scene* cobj = (cocos2d::Scene *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Scene_render : Invalid Native Object"); if (argc == 1) { - cocos2d::Renderer* arg0; + cocos2d::Renderer* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -5257,7 +5644,7 @@ bool js_cocos2dx_Scene_stepPhysicsAndNavigation(JSContext *cx, uint32_t argc, js cocos2d::Scene* cobj = (cocos2d::Scene *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Scene_stepPhysicsAndNavigation : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Scene_stepPhysicsAndNavigation : Error processing arguments"); cobj->stepPhysicsAndNavigation(arg0); @@ -5277,7 +5664,7 @@ bool js_cocos2dx_Scene_onProjectionChanged(JSContext *cx, uint32_t argc, jsval * cocos2d::Scene* cobj = (cocos2d::Scene *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Scene_onProjectionChanged : Invalid Native Object"); if (argc == 1) { - cocos2d::EventCustom* arg0; + cocos2d::EventCustom* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -5296,6 +5683,31 @@ bool js_cocos2dx_Scene_onProjectionChanged(JSContext *cx, uint32_t argc, jsval * JS_ReportError(cx, "js_cocos2dx_Scene_onProjectionChanged : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } +bool js_cocos2dx_Scene_getPhysicsManager(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::Scene* cobj = (cocos2d::Scene *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Scene_getPhysicsManager : Invalid Native Object"); + if (argc == 0) { + cocos2d::PhysicsManager* ret = cobj->getPhysicsManager(); + jsval jsret = JSVAL_NULL; + do { + if (ret) { + js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::PhysicsManager*)ret); + jsret = OBJECT_TO_JSVAL(jsProxy->obj); + } else { + jsret = JSVAL_NULL; + } + } while (0); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_Scene_getPhysicsManager : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_Scene_initWithSize(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -5462,6 +5874,7 @@ void js_register_cocos2dx_Scene(JSContext *cx, JS::HandleObject global) { JS_FN("render", js_cocos2dx_Scene_render, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("stepPhysicsAndNavigation", js_cocos2dx_Scene_stepPhysicsAndNavigation, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("onProjectionChanged", js_cocos2dx_Scene_onProjectionChanged, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getPhysicsManager", js_cocos2dx_Scene_getPhysicsManager, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("initWithSize", js_cocos2dx_Scene_initWithSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getDefaultCamera", js_cocos2dx_Scene_getDefaultCamera, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("ctor", js_cocos2dx_Scene_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -5515,8 +5928,8 @@ bool js_cocos2dx_GLView_setFrameSize(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_setFrameSize : Invalid Native Object"); if (argc == 2) { - double arg0; - double arg1; + double arg0 = 0; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLView_setFrameSize : Error processing arguments"); @@ -5555,7 +5968,7 @@ bool js_cocos2dx_GLView_setContentScaleFactor(JSContext *cx, uint32_t argc, jsva cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_setContentScaleFactor : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLView_setContentScaleFactor : Error processing arguments"); bool ret = cobj->setContentScaleFactor(arg0); @@ -5615,10 +6028,10 @@ bool js_cocos2dx_GLView_setScissorInPoints(JSContext *cx, uint32_t argc, jsval * cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_setScissorInPoints : Invalid Native Object"); if (argc == 4) { - double arg0; - double arg1; - double arg2; - double arg3; + double arg0 = 0; + double arg1 = 0; + double arg2 = 0; + double arg3 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -5769,7 +6182,7 @@ bool js_cocos2dx_GLView_setFrameZoomFactor(JSContext *cx, uint32_t argc, jsval * cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_setFrameZoomFactor : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLView_setFrameZoomFactor : Error processing arguments"); cobj->setFrameZoomFactor(arg0); @@ -5843,8 +6256,8 @@ bool js_cocos2dx_GLView_setDesignResolutionSize(JSContext *cx, uint32_t argc, js cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_setDesignResolutionSize : Invalid Native Object"); if (argc == 3) { - double arg0; - double arg1; + double arg0 = 0; + double arg1 = 0; ResolutionPolicy arg2; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); @@ -5903,10 +6316,10 @@ bool js_cocos2dx_GLView_setViewPortInPoints(JSContext *cx, uint32_t argc, jsval cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_setViewPortInPoints : Invalid Native Object"); if (argc == 4) { - double arg0; - double arg1; - double arg2; - double arg3; + double arg0 = 0; + double arg1 = 0; + double arg2 = 0; + double arg3 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -6193,7 +6606,7 @@ bool js_cocos2dx_Director_setEventDispatcher(JSContext *cx, uint32_t argc, jsval cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setEventDispatcher : Invalid Native Object"); if (argc == 1) { - cocos2d::EventDispatcher* arg0; + cocos2d::EventDispatcher* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -6221,7 +6634,7 @@ bool js_cocos2dx_Director_setContentScaleFactor(JSContext *cx, uint32_t argc, js cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setContentScaleFactor : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_setContentScaleFactor : Error processing arguments"); cobj->setContentScaleFactor(arg0); @@ -6311,7 +6724,7 @@ bool js_cocos2dx_Director_setActionManager(JSContext *cx, uint32_t argc, jsval * cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setActionManager : Invalid Native Object"); if (argc == 1) { - cocos2d::ActionManager* arg0; + cocos2d::ActionManager* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -6681,7 +7094,7 @@ bool js_cocos2dx_Director_setScheduler(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setScheduler : Invalid Native Object"); if (argc == 1) { - cocos2d::Scheduler* arg0; + cocos2d::Scheduler* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -6829,7 +7242,7 @@ bool js_cocos2dx_Director_popToSceneStackLevel(JSContext *cx, uint32_t argc, jsv cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_popToSceneStackLevel : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_popToSceneStackLevel : Error processing arguments"); cobj->popToSceneStackLevel(arg0); @@ -6903,7 +7316,7 @@ bool js_cocos2dx_Director_setOpenGLView(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setOpenGLView : Invalid Native Object"); if (argc == 1) { - cocos2d::GLView* arg0; + cocos2d::GLView* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -6987,7 +7400,7 @@ bool js_cocos2dx_Director_runWithScene(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_runWithScene : Invalid Native Object"); if (argc == 1) { - cocos2d::Scene* arg0; + cocos2d::Scene* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -7015,7 +7428,7 @@ bool js_cocos2dx_Director_setNotificationNode(JSContext *cx, uint32_t argc, jsva cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setNotificationNode : Invalid Native Object"); if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -7272,7 +7685,7 @@ bool js_cocos2dx_Director_pushScene(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_pushScene : Invalid Native Object"); if (argc == 1) { - cocos2d::Scene* arg0; + cocos2d::Scene* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -7381,7 +7794,7 @@ bool js_cocos2dx_Director_replaceScene(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_replaceScene : Invalid Native Object"); if (argc == 1) { - cocos2d::Scene* arg0; + cocos2d::Scene* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -7409,7 +7822,7 @@ bool js_cocos2dx_Director_setAnimationInterval(JSContext *cx, uint32_t argc, jsv cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setAnimationInterval : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_setAnimationInterval : Error processing arguments"); cobj->setAnimationInterval(arg0); @@ -7600,7 +8013,7 @@ bool js_cocos2dx_Scheduler_setTimeScale(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Scheduler* cobj = (cocos2d::Scheduler *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Scheduler_setTimeScale : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Scheduler_setTimeScale : Error processing arguments"); cobj->setTimeScale(arg0); @@ -7620,7 +8033,7 @@ bool js_cocos2dx_Scheduler_unscheduleAllWithMinPriority(JSContext *cx, uint32_t cocos2d::Scheduler* cobj = (cocos2d::Scheduler *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Scheduler_unscheduleAllWithMinPriority : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Scheduler_unscheduleAllWithMinPriority : Error processing arguments"); cobj->unscheduleAllWithMinPriority(arg0); @@ -7640,7 +8053,7 @@ bool js_cocos2dx_Scheduler_update(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Scheduler* cobj = (cocos2d::Scheduler *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Scheduler_update : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Scheduler_update : Error processing arguments"); cobj->update(arg0); @@ -7660,7 +8073,7 @@ bool js_cocos2dx_Scheduler_unscheduleScriptEntry(JSContext *cx, uint32_t argc, j cocos2d::Scheduler* cobj = (cocos2d::Scheduler *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Scheduler_unscheduleScriptEntry : Invalid Native Object"); if (argc == 1) { - unsigned int arg0; + unsigned int arg0 = 0; ok &= jsval_to_uint32(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Scheduler_unscheduleScriptEntry : Error processing arguments"); cobj->unscheduleScriptEntry(arg0); @@ -7964,7 +8377,7 @@ bool js_cocos2dx_Action_startWithTarget(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Action* cobj = (cocos2d::Action *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Action_startWithTarget : Invalid Native Object"); if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -7992,7 +8405,7 @@ bool js_cocos2dx_Action_setOriginalTarget(JSContext *cx, uint32_t argc, jsval *v cocos2d::Action* cobj = (cocos2d::Action *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Action_setOriginalTarget : Invalid Native Object"); if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -8086,7 +8499,7 @@ bool js_cocos2dx_Action_update(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Action* cobj = (cocos2d::Action *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Action_update : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Action_update : Error processing arguments"); cobj->update(arg0); @@ -8149,7 +8562,7 @@ bool js_cocos2dx_Action_step(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Action* cobj = (cocos2d::Action *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Action_step : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Action_step : Error processing arguments"); cobj->step(arg0); @@ -8169,7 +8582,7 @@ bool js_cocos2dx_Action_setTag(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Action* cobj = (cocos2d::Action *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Action_setTag : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Action_setTag : Error processing arguments"); cobj->setTag(arg0); @@ -8189,7 +8602,7 @@ bool js_cocos2dx_Action_setFlags(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Action* cobj = (cocos2d::Action *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Action_setFlags : Invalid Native Object"); if (argc == 1) { - unsigned int arg0; + unsigned int arg0 = 0; ok &= jsval_to_uint32(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Action_setFlags : Error processing arguments"); cobj->setFlags(arg0); @@ -8227,7 +8640,7 @@ bool js_cocos2dx_Action_setTarget(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Action* cobj = (cocos2d::Action *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Action_setTarget : Invalid Native Object"); if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -8372,7 +8785,7 @@ bool js_cocos2dx_FiniteTimeAction_setDuration(JSContext *cx, uint32_t argc, jsva cocos2d::FiniteTimeAction* cobj = (cocos2d::FiniteTimeAction *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FiniteTimeAction_setDuration : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FiniteTimeAction_setDuration : Error processing arguments"); cobj->setDuration(arg0); @@ -8473,7 +8886,7 @@ bool js_cocos2dx_Speed_setInnerAction(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Speed* cobj = (cocos2d::Speed *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Speed_setInnerAction : Invalid Native Object"); if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -8519,7 +8932,7 @@ bool js_cocos2dx_Speed_setSpeed(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Speed* cobj = (cocos2d::Speed *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Speed_setSpeed : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Speed_setSpeed : Error processing arguments"); cobj->setSpeed(arg0); @@ -8539,8 +8952,8 @@ bool js_cocos2dx_Speed_initWithAction(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Speed* cobj = (cocos2d::Speed *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Speed_initWithAction : Invalid Native Object"); if (argc == 2) { - cocos2d::ActionInterval* arg0; - double arg1; + cocos2d::ActionInterval* arg0 = nullptr; + double arg1 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -8592,8 +9005,8 @@ bool js_cocos2dx_Speed_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - cocos2d::ActionInterval* arg0; - double arg1; + cocos2d::ActionInterval* arg0 = nullptr; + double arg1 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -8748,7 +9161,7 @@ bool js_cocos2dx_Follow_initWithTarget(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Follow* cobj = (cocos2d::Follow *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Follow_initWithTarget : Invalid Native Object"); if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -8766,7 +9179,7 @@ bool js_cocos2dx_Follow_initWithTarget(JSContext *cx, uint32_t argc, jsval *vp) return true; } if (argc == 2) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; cocos2d::Rect arg1; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -8812,7 +9225,7 @@ bool js_cocos2dx_Follow_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -8837,7 +9250,7 @@ bool js_cocos2dx_Follow_create(JSContext *cx, uint32_t argc, jsval *vp) return true; } if (argc == 2) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; cocos2d::Rect arg1; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -8894,6 +9307,21 @@ bool js_cocos2dx_Follow_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_Follow_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::Follow *nobj = new (std::nothrow) cocos2d::Follow(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::Follow"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_Action_prototype; @@ -8901,6 +9329,7 @@ extern JSObject *jsb_cocos2d_Action_prototype; void js_cocos2d_Follow_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (Follow)", obj); } + void js_register_cocos2dx_Follow(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_Follow_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_Follow_class->name = "Follow"; @@ -8923,6 +9352,7 @@ void js_register_cocos2dx_Follow(JSContext *cx, JS::HandleObject global) { JS_FN("setBoundarySet", js_cocos2dx_Follow_setBoundarySet, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("initWithTarget", js_cocos2dx_Follow_initWithTarget, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("isBoundarySet", js_cocos2dx_Follow_isBoundarySet, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_Follow_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -8957,6 +9387,7 @@ void js_register_cocos2dx_Follow(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_Action_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.Follow.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_SpriteFrame_class; @@ -9016,7 +9447,7 @@ bool js_cocos2dx_SpriteFrame_setTexture(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_setTexture : Invalid Native Object"); if (argc == 1) { - cocos2d::Texture2D* arg0; + cocos2d::Texture2D* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -9245,7 +9676,7 @@ bool js_cocos2dx_SpriteFrame_initWithTexture(JSContext *cx, uint32_t argc, jsval JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_initWithTexture : Invalid Native Object"); do { if (argc == 5) { - cocos2d::Texture2D* arg0; + cocos2d::Texture2D* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -9277,7 +9708,7 @@ bool js_cocos2dx_SpriteFrame_initWithTexture(JSContext *cx, uint32_t argc, jsval do { if (argc == 2) { - cocos2d::Texture2D* arg0; + cocos2d::Texture2D* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -9499,7 +9930,7 @@ bool js_cocos2dx_SpriteFrame_createWithTexture(JSContext *cx, uint32_t argc, jsv do { if (argc == 5) { - cocos2d::Texture2D* arg0; + cocos2d::Texture2D* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -9539,7 +9970,7 @@ bool js_cocos2dx_SpriteFrame_createWithTexture(JSContext *cx, uint32_t argc, jsv do { if (argc == 2) { - cocos2d::Texture2D* arg0; + cocos2d::Texture2D* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -9707,7 +10138,7 @@ bool js_cocos2dx_AnimationFrame_setSpriteFrame(JSContext *cx, uint32_t argc, jsv cocos2d::AnimationFrame* cobj = (cocos2d::AnimationFrame *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AnimationFrame_setSpriteFrame : Invalid Native Object"); if (argc == 1) { - cocos2d::SpriteFrame* arg0; + cocos2d::SpriteFrame* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -9769,7 +10200,7 @@ bool js_cocos2dx_AnimationFrame_setDelayUnits(JSContext *cx, uint32_t argc, jsva cocos2d::AnimationFrame* cobj = (cocos2d::AnimationFrame *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AnimationFrame_setDelayUnits : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_AnimationFrame_setDelayUnits : Error processing arguments"); cobj->setDelayUnits(arg0); @@ -9877,8 +10308,8 @@ bool js_cocos2dx_AnimationFrame_initWithSpriteFrame(JSContext *cx, uint32_t argc cocos2d::AnimationFrame* cobj = (cocos2d::AnimationFrame *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AnimationFrame_initWithSpriteFrame : Invalid Native Object"); if (argc == 3) { - cocos2d::SpriteFrame* arg0; - double arg1; + cocos2d::SpriteFrame* arg0 = nullptr; + double arg1 = 0; cocos2d::ValueMap arg2; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -9907,8 +10338,8 @@ bool js_cocos2dx_AnimationFrame_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 3) { - cocos2d::SpriteFrame* arg0; - double arg1; + cocos2d::SpriteFrame* arg0 = nullptr; + double arg1 = 0; cocos2d::ValueMap arg2; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -9966,11 +10397,27 @@ bool js_cocos2dx_AnimationFrame_constructor(JSContext *cx, uint32_t argc, jsval if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_AnimationFrame_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::AnimationFrame *nobj = new (std::nothrow) cocos2d::AnimationFrame(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::AnimationFrame"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } void js_cocos2d_AnimationFrame_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (AnimationFrame)", obj); } + void js_register_cocos2dx_AnimationFrame(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_AnimationFrame_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_AnimationFrame_class->name = "AnimationFrame"; @@ -9998,6 +10445,7 @@ void js_register_cocos2dx_AnimationFrame(JSContext *cx, JS::HandleObject global) JS_FN("getDelayUnits", js_cocos2dx_AnimationFrame_getDelayUnits, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setUserInfo", js_cocos2dx_AnimationFrame_setUserInfo, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("initWithSpriteFrame", js_cocos2dx_AnimationFrame_initWithSpriteFrame, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_AnimationFrame_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -10032,6 +10480,7 @@ void js_register_cocos2dx_AnimationFrame(JSContext *cx, JS::HandleObject global) p->parentProto = NULL; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.AnimationFrame.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_Animation_class; @@ -10064,7 +10513,7 @@ bool js_cocos2dx_Animation_addSpriteFrame(JSContext *cx, uint32_t argc, jsval *v cocos2d::Animation* cobj = (cocos2d::Animation *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_addSpriteFrame : Invalid Native Object"); if (argc == 1) { - cocos2d::SpriteFrame* arg0; + cocos2d::SpriteFrame* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -10156,8 +10605,8 @@ bool js_cocos2dx_Animation_initWithAnimationFrames(JSContext *cx, uint32_t argc, JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_initWithAnimationFrames : Invalid Native Object"); if (argc == 3) { cocos2d::Vector arg0; - double arg1; - unsigned int arg2; + double arg1 = 0; + unsigned int arg2 = 0; ok &= jsval_to_ccvector(cx, args.get(0), &arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); ok &= jsval_to_uint32(cx, args.get(2), &arg2); @@ -10237,7 +10686,7 @@ bool js_cocos2dx_Animation_setLoops(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Animation* cobj = (cocos2d::Animation *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_setLoops : Invalid Native Object"); if (argc == 1) { - unsigned int arg0; + unsigned int arg0 = 0; ok &= jsval_to_uint32(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Animation_setLoops : Error processing arguments"); cobj->setLoops(arg0); @@ -10257,7 +10706,7 @@ bool js_cocos2dx_Animation_setDelayPerUnit(JSContext *cx, uint32_t argc, jsval * cocos2d::Animation* cobj = (cocos2d::Animation *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_setDelayPerUnit : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Animation_setDelayPerUnit : Error processing arguments"); cobj->setDelayPerUnit(arg0); @@ -10344,7 +10793,7 @@ bool js_cocos2dx_Animation_initWithSpriteFrames(JSContext *cx, uint32_t argc, js } if (argc == 2) { cocos2d::Vector arg0; - double arg1; + double arg1 = 0; ok &= jsval_to_ccvector(cx, args.get(0), &arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Animation_initWithSpriteFrames : Error processing arguments"); @@ -10356,8 +10805,8 @@ bool js_cocos2dx_Animation_initWithSpriteFrames(JSContext *cx, uint32_t argc, js } if (argc == 3) { cocos2d::Vector arg0; - double arg1; - unsigned int arg2; + double arg1 = 0; + unsigned int arg2 = 0; ok &= jsval_to_ccvector(cx, args.get(0), &arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); ok &= jsval_to_uint32(cx, args.get(2), &arg2); @@ -10399,7 +10848,7 @@ bool js_cocos2dx_Animation_addSpriteFrameWithTexture(JSContext *cx, uint32_t arg cocos2d::Animation* cobj = (cocos2d::Animation *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_addSpriteFrameWithTexture : Invalid Native Object"); if (argc == 2) { - cocos2d::Texture2D* arg0; + cocos2d::Texture2D* arg0 = nullptr; cocos2d::Rect arg1; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -10430,7 +10879,7 @@ bool js_cocos2dx_Animation_create(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Vector arg0; ok &= jsval_to_ccvector(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } cocos2d::Animation* ret = cocos2d::Animation::create(arg0, arg1); @@ -10452,10 +10901,10 @@ bool js_cocos2dx_Animation_create(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Vector arg0; ok &= jsval_to_ccvector(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } - unsigned int arg2; + unsigned int arg2 = 0; ok &= jsval_to_uint32(cx, args.get(2), &arg2); if (!ok) { ok = true; break; } cocos2d::Animation* ret = cocos2d::Animation::create(arg0, arg1, arg2); @@ -10515,7 +10964,7 @@ bool js_cocos2dx_Animation_createWithSpriteFrames(JSContext *cx, uint32_t argc, } if (argc == 2) { cocos2d::Vector arg0; - double arg1; + double arg1 = 0; ok &= jsval_to_ccvector(cx, args.get(0), &arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Animation_createWithSpriteFrames : Error processing arguments"); @@ -10534,8 +10983,8 @@ bool js_cocos2dx_Animation_createWithSpriteFrames(JSContext *cx, uint32_t argc, } if (argc == 3) { cocos2d::Vector arg0; - double arg1; - unsigned int arg2; + double arg1 = 0; + unsigned int arg2 = 0; ok &= jsval_to_ccvector(cx, args.get(0), &arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); ok &= jsval_to_uint32(cx, args.get(2), &arg2); @@ -10584,11 +11033,27 @@ bool js_cocos2dx_Animation_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_Animation_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::Animation *nobj = new (std::nothrow) cocos2d::Animation(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::Animation"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } void js_cocos2d_Animation_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (Animation)", obj); } + void js_register_cocos2dx_Animation(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_Animation_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_Animation_class->name = "Animation"; @@ -10625,6 +11090,7 @@ void js_register_cocos2dx_Animation(JSContext *cx, JS::HandleObject global) { JS_FN("initWithSpriteFrames", js_cocos2dx_Animation_initWithSpriteFrames, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getRestoreOriginalFrame", js_cocos2dx_Animation_getRestoreOriginalFrame, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("addSpriteFrameWithTexture", js_cocos2dx_Animation_addSpriteFrameWithTexture, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_Animation_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -10660,6 +11126,7 @@ void js_register_cocos2dx_Animation(JSContext *cx, JS::HandleObject global) { p->parentProto = NULL; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.Animation.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_ActionInterval_class; @@ -10692,7 +11159,7 @@ bool js_cocos2dx_ActionInterval_initWithDuration(JSContext *cx, uint32_t argc, j cocos2d::ActionInterval* cobj = (cocos2d::ActionInterval *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionInterval_initWithDuration : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ActionInterval_initWithDuration : Error processing arguments"); bool ret = cobj->initWithDuration(arg0); @@ -10714,7 +11181,7 @@ bool js_cocos2dx_ActionInterval_setAmplitudeRate(JSContext *cx, uint32_t argc, j cocos2d::ActionInterval* cobj = (cocos2d::ActionInterval *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionInterval_setAmplitudeRate : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ActionInterval_setAmplitudeRate : Error processing arguments"); cobj->setAmplitudeRate(arg0); @@ -10817,8 +11284,8 @@ bool js_cocos2dx_Sequence_initWithTwoActions(JSContext *cx, uint32_t argc, jsval cocos2d::Sequence* cobj = (cocos2d::Sequence *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sequence_initWithTwoActions : Invalid Native Object"); if (argc == 2) { - cocos2d::FiniteTimeAction* arg0; - cocos2d::FiniteTimeAction* arg1; + cocos2d::FiniteTimeAction* arg0 = nullptr; + cocos2d::FiniteTimeAction* arg1 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -10875,6 +11342,21 @@ bool js_cocos2dx_Sequence_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_Sequence_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::Sequence *nobj = new (std::nothrow) cocos2d::Sequence(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::Sequence"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_ActionInterval_prototype; @@ -10882,6 +11364,7 @@ extern JSObject *jsb_cocos2d_ActionInterval_prototype; void js_cocos2d_Sequence_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (Sequence)", obj); } + void js_register_cocos2dx_Sequence(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_Sequence_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_Sequence_class->name = "Sequence"; @@ -10902,6 +11385,7 @@ void js_register_cocos2dx_Sequence(JSContext *cx, JS::HandleObject global) { static JSFunctionSpec funcs[] = { JS_FN("initWithTwoActions", js_cocos2dx_Sequence_initWithTwoActions, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_Sequence_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -10933,6 +11417,7 @@ void js_register_cocos2dx_Sequence(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_ActionInterval_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.Sequence.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_Repeat_class; @@ -10947,7 +11432,7 @@ bool js_cocos2dx_Repeat_setInnerAction(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Repeat* cobj = (cocos2d::Repeat *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Repeat_setInnerAction : Invalid Native Object"); if (argc == 1) { - cocos2d::FiniteTimeAction* arg0; + cocos2d::FiniteTimeAction* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -10975,8 +11460,8 @@ bool js_cocos2dx_Repeat_initWithAction(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Repeat* cobj = (cocos2d::Repeat *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Repeat_initWithAction : Invalid Native Object"); if (argc == 2) { - cocos2d::FiniteTimeAction* arg0; - unsigned int arg1; + cocos2d::FiniteTimeAction* arg0 = nullptr; + unsigned int arg1 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -11028,8 +11513,8 @@ bool js_cocos2dx_Repeat_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - cocos2d::FiniteTimeAction* arg0; - unsigned int arg1; + cocos2d::FiniteTimeAction* arg0 = nullptr; + unsigned int arg1 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -11085,6 +11570,21 @@ bool js_cocos2dx_Repeat_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_Repeat_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::Repeat *nobj = new (std::nothrow) cocos2d::Repeat(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::Repeat"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_ActionInterval_prototype; @@ -11092,6 +11592,7 @@ extern JSObject *jsb_cocos2d_ActionInterval_prototype; void js_cocos2d_Repeat_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (Repeat)", obj); } + void js_register_cocos2dx_Repeat(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_Repeat_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_Repeat_class->name = "Repeat"; @@ -11114,6 +11615,7 @@ void js_register_cocos2dx_Repeat(JSContext *cx, JS::HandleObject global) { JS_FN("setInnerAction", js_cocos2dx_Repeat_setInnerAction, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("initWithAction", js_cocos2dx_Repeat_initWithAction, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getInnerAction", js_cocos2dx_Repeat_getInnerAction, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_Repeat_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -11148,6 +11650,7 @@ void js_register_cocos2dx_Repeat(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_ActionInterval_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.Repeat.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_RepeatForever_class; @@ -11162,7 +11665,7 @@ bool js_cocos2dx_RepeatForever_setInnerAction(JSContext *cx, uint32_t argc, jsva cocos2d::RepeatForever* cobj = (cocos2d::RepeatForever *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RepeatForever_setInnerAction : Invalid Native Object"); if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -11190,7 +11693,7 @@ bool js_cocos2dx_RepeatForever_initWithAction(JSContext *cx, uint32_t argc, jsva cocos2d::RepeatForever* cobj = (cocos2d::RepeatForever *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RepeatForever_initWithAction : Invalid Native Object"); if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -11241,7 +11744,7 @@ bool js_cocos2dx_RepeatForever_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -11296,6 +11799,21 @@ bool js_cocos2dx_RepeatForever_constructor(JSContext *cx, uint32_t argc, jsval * if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_RepeatForever_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::RepeatForever *nobj = new (std::nothrow) cocos2d::RepeatForever(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::RepeatForever"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_ActionInterval_prototype; @@ -11303,6 +11821,7 @@ extern JSObject *jsb_cocos2d_ActionInterval_prototype; void js_cocos2d_RepeatForever_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (RepeatForever)", obj); } + void js_register_cocos2dx_RepeatForever(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_RepeatForever_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_RepeatForever_class->name = "RepeatForever"; @@ -11325,6 +11844,7 @@ void js_register_cocos2dx_RepeatForever(JSContext *cx, JS::HandleObject global) JS_FN("setInnerAction", js_cocos2dx_RepeatForever_setInnerAction, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("initWithAction", js_cocos2dx_RepeatForever_initWithAction, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getInnerAction", js_cocos2dx_RepeatForever_getInnerAction, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_RepeatForever_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -11359,6 +11879,7 @@ void js_register_cocos2dx_RepeatForever(JSContext *cx, JS::HandleObject global) p->parentProto = jsb_cocos2d_ActionInterval_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.RepeatForever.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_Spawn_class; @@ -11373,8 +11894,8 @@ bool js_cocos2dx_Spawn_initWithTwoActions(JSContext *cx, uint32_t argc, jsval *v cocos2d::Spawn* cobj = (cocos2d::Spawn *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Spawn_initWithTwoActions : Invalid Native Object"); if (argc == 2) { - cocos2d::FiniteTimeAction* arg0; - cocos2d::FiniteTimeAction* arg1; + cocos2d::FiniteTimeAction* arg0 = nullptr; + cocos2d::FiniteTimeAction* arg1 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -11431,6 +11952,21 @@ bool js_cocos2dx_Spawn_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_Spawn_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::Spawn *nobj = new (std::nothrow) cocos2d::Spawn(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::Spawn"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_ActionInterval_prototype; @@ -11438,6 +11974,7 @@ extern JSObject *jsb_cocos2d_ActionInterval_prototype; void js_cocos2d_Spawn_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (Spawn)", obj); } + void js_register_cocos2dx_Spawn(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_Spawn_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_Spawn_class->name = "Spawn"; @@ -11458,6 +11995,7 @@ void js_register_cocos2dx_Spawn(JSContext *cx, JS::HandleObject global) { static JSFunctionSpec funcs[] = { JS_FN("initWithTwoActions", js_cocos2dx_Spawn_initWithTwoActions, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_Spawn_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -11489,6 +12027,7 @@ void js_register_cocos2dx_Spawn(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_ActionInterval_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.Spawn.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_RotateTo_class; @@ -11507,7 +12046,7 @@ bool js_cocos2dx_RotateTo_initWithDuration(JSContext *cx, uint32_t argc, jsval * JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RotateTo_initWithDuration : Invalid Native Object"); do { if (argc == 2) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } cocos2d::Vec3 arg1; @@ -11523,13 +12062,13 @@ bool js_cocos2dx_RotateTo_initWithDuration(JSContext *cx, uint32_t argc, jsval * do { if (argc == 3) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } bool ret = cobj->initWithDuration(arg0, arg1, arg2); @@ -11550,10 +12089,10 @@ bool js_cocos2dx_RotateTo_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 2) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } cocos2d::RotateTo* ret = cocos2d::RotateTo::create(arg0, arg1); @@ -11573,13 +12112,13 @@ bool js_cocos2dx_RotateTo_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 3) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } cocos2d::RotateTo* ret = cocos2d::RotateTo::create(arg0, arg1, arg2); @@ -11599,7 +12138,7 @@ bool js_cocos2dx_RotateTo_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 2) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } cocos2d::Vec3 arg1; @@ -11649,6 +12188,21 @@ bool js_cocos2dx_RotateTo_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_RotateTo_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::RotateTo *nobj = new (std::nothrow) cocos2d::RotateTo(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::RotateTo"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_ActionInterval_prototype; @@ -11656,6 +12210,7 @@ extern JSObject *jsb_cocos2d_ActionInterval_prototype; void js_cocos2d_RotateTo_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (RotateTo)", obj); } + void js_register_cocos2dx_RotateTo(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_RotateTo_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_RotateTo_class->name = "RotateTo"; @@ -11676,6 +12231,7 @@ void js_register_cocos2dx_RotateTo(JSContext *cx, JS::HandleObject global) { static JSFunctionSpec funcs[] = { JS_FN("initWithDuration", js_cocos2dx_RotateTo_initWithDuration, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_RotateTo_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -11710,6 +12266,7 @@ void js_register_cocos2dx_RotateTo(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_ActionInterval_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.RotateTo.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_RotateBy_class; @@ -11728,13 +12285,13 @@ bool js_cocos2dx_RotateBy_initWithDuration(JSContext *cx, uint32_t argc, jsval * JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RotateBy_initWithDuration : Invalid Native Object"); do { if (argc == 3) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } bool ret = cobj->initWithDuration(arg0, arg1, arg2); @@ -11747,10 +12304,10 @@ bool js_cocos2dx_RotateBy_initWithDuration(JSContext *cx, uint32_t argc, jsval * do { if (argc == 2) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } bool ret = cobj->initWithDuration(arg0, arg1); @@ -11763,7 +12320,7 @@ bool js_cocos2dx_RotateBy_initWithDuration(JSContext *cx, uint32_t argc, jsval * do { if (argc == 2) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } cocos2d::Vec3 arg1; @@ -11787,13 +12344,13 @@ bool js_cocos2dx_RotateBy_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 3) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } cocos2d::RotateBy* ret = cocos2d::RotateBy::create(arg0, arg1, arg2); @@ -11813,10 +12370,10 @@ bool js_cocos2dx_RotateBy_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 2) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } cocos2d::RotateBy* ret = cocos2d::RotateBy::create(arg0, arg1); @@ -11836,7 +12393,7 @@ bool js_cocos2dx_RotateBy_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 2) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } cocos2d::Vec3 arg1; @@ -11886,6 +12443,21 @@ bool js_cocos2dx_RotateBy_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_RotateBy_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::RotateBy *nobj = new (std::nothrow) cocos2d::RotateBy(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::RotateBy"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_ActionInterval_prototype; @@ -11893,6 +12465,7 @@ extern JSObject *jsb_cocos2d_ActionInterval_prototype; void js_cocos2d_RotateBy_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (RotateBy)", obj); } + void js_register_cocos2dx_RotateBy(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_RotateBy_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_RotateBy_class->name = "RotateBy"; @@ -11913,6 +12486,7 @@ void js_register_cocos2dx_RotateBy(JSContext *cx, JS::HandleObject global) { static JSFunctionSpec funcs[] = { JS_FN("initWithDuration", js_cocos2dx_RotateBy_initWithDuration, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_RotateBy_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -11947,6 +12521,7 @@ void js_register_cocos2dx_RotateBy(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_ActionInterval_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.RotateBy.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_MoveBy_class; @@ -11965,7 +12540,7 @@ bool js_cocos2dx_MoveBy_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MoveBy_initWithDuration : Invalid Native Object"); do { if (argc == 2) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } cocos2d::Vec3 arg1; @@ -11981,7 +12556,7 @@ bool js_cocos2dx_MoveBy_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp do { if (argc == 2) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } cocos2d::Vec2 arg1; @@ -12005,7 +12580,7 @@ bool js_cocos2dx_MoveBy_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 2) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } cocos2d::Vec3 arg1; @@ -12028,7 +12603,7 @@ bool js_cocos2dx_MoveBy_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 2) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } cocos2d::Vec2 arg1; @@ -12078,6 +12653,21 @@ bool js_cocos2dx_MoveBy_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_MoveBy_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::MoveBy *nobj = new (std::nothrow) cocos2d::MoveBy(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::MoveBy"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_ActionInterval_prototype; @@ -12085,6 +12675,7 @@ extern JSObject *jsb_cocos2d_ActionInterval_prototype; void js_cocos2d_MoveBy_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (MoveBy)", obj); } + void js_register_cocos2dx_MoveBy(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_MoveBy_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_MoveBy_class->name = "MoveBy"; @@ -12105,6 +12696,7 @@ void js_register_cocos2dx_MoveBy(JSContext *cx, JS::HandleObject global) { static JSFunctionSpec funcs[] = { JS_FN("initWithDuration", js_cocos2dx_MoveBy_initWithDuration, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_MoveBy_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -12139,6 +12731,7 @@ void js_register_cocos2dx_MoveBy(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_ActionInterval_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.MoveBy.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_MoveTo_class; @@ -12157,7 +12750,7 @@ bool js_cocos2dx_MoveTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MoveTo_initWithDuration : Invalid Native Object"); do { if (argc == 2) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } cocos2d::Vec3 arg1; @@ -12173,7 +12766,7 @@ bool js_cocos2dx_MoveTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp do { if (argc == 2) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } cocos2d::Vec2 arg1; @@ -12197,7 +12790,7 @@ bool js_cocos2dx_MoveTo_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 2) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } cocos2d::Vec3 arg1; @@ -12220,7 +12813,7 @@ bool js_cocos2dx_MoveTo_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 2) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } cocos2d::Vec2 arg1; @@ -12270,6 +12863,21 @@ bool js_cocos2dx_MoveTo_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_MoveTo_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::MoveTo *nobj = new (std::nothrow) cocos2d::MoveTo(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::MoveTo"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_MoveBy_prototype; @@ -12277,6 +12885,7 @@ extern JSObject *jsb_cocos2d_MoveBy_prototype; void js_cocos2d_MoveTo_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (MoveTo)", obj); } + void js_register_cocos2dx_MoveTo(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_MoveTo_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_MoveTo_class->name = "MoveTo"; @@ -12297,6 +12906,7 @@ void js_register_cocos2dx_MoveTo(JSContext *cx, JS::HandleObject global) { static JSFunctionSpec funcs[] = { JS_FN("initWithDuration", js_cocos2dx_MoveTo_initWithDuration, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_MoveTo_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -12331,6 +12941,7 @@ void js_register_cocos2dx_MoveTo(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_MoveBy_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.MoveTo.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_SkewTo_class; @@ -12345,9 +12956,9 @@ bool js_cocos2dx_SkewTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp cocos2d::SkewTo* cobj = (cocos2d::SkewTo *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SkewTo_initWithDuration : Invalid Native Object"); if (argc == 3) { - double arg0; - double arg1; - double arg2; + double arg0 = 0; + double arg1 = 0; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -12367,9 +12978,9 @@ bool js_cocos2dx_SkewTo_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 3) { - double arg0; - double arg1; - double arg2; + double arg0 = 0; + double arg1 = 0; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -12418,6 +13029,21 @@ bool js_cocos2dx_SkewTo_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_SkewTo_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::SkewTo *nobj = new (std::nothrow) cocos2d::SkewTo(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::SkewTo"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_ActionInterval_prototype; @@ -12425,6 +13051,7 @@ extern JSObject *jsb_cocos2d_ActionInterval_prototype; void js_cocos2d_SkewTo_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (SkewTo)", obj); } + void js_register_cocos2dx_SkewTo(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_SkewTo_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_SkewTo_class->name = "SkewTo"; @@ -12445,6 +13072,7 @@ void js_register_cocos2dx_SkewTo(JSContext *cx, JS::HandleObject global) { static JSFunctionSpec funcs[] = { JS_FN("initWithDuration", js_cocos2dx_SkewTo_initWithDuration, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_SkewTo_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -12479,6 +13107,7 @@ void js_register_cocos2dx_SkewTo(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_ActionInterval_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.SkewTo.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_SkewBy_class; @@ -12493,9 +13122,9 @@ bool js_cocos2dx_SkewBy_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp cocos2d::SkewBy* cobj = (cocos2d::SkewBy *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SkewBy_initWithDuration : Invalid Native Object"); if (argc == 3) { - double arg0; - double arg1; - double arg2; + double arg0 = 0; + double arg1 = 0; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -12515,9 +13144,9 @@ bool js_cocos2dx_SkewBy_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 3) { - double arg0; - double arg1; - double arg2; + double arg0 = 0; + double arg1 = 0; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -12566,6 +13195,21 @@ bool js_cocos2dx_SkewBy_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_SkewBy_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::SkewBy *nobj = new (std::nothrow) cocos2d::SkewBy(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::SkewBy"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_SkewTo_prototype; @@ -12573,6 +13217,7 @@ extern JSObject *jsb_cocos2d_SkewTo_prototype; void js_cocos2d_SkewBy_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (SkewBy)", obj); } + void js_register_cocos2dx_SkewBy(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_SkewBy_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_SkewBy_class->name = "SkewBy"; @@ -12593,6 +13238,7 @@ void js_register_cocos2dx_SkewBy(JSContext *cx, JS::HandleObject global) { static JSFunctionSpec funcs[] = { JS_FN("initWithDuration", js_cocos2dx_SkewBy_initWithDuration, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_SkewBy_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -12627,6 +13273,7 @@ void js_register_cocos2dx_SkewBy(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_SkewTo_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.SkewBy.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_JumpBy_class; @@ -12641,10 +13288,10 @@ bool js_cocos2dx_JumpBy_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp cocos2d::JumpBy* cobj = (cocos2d::JumpBy *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_JumpBy_initWithDuration : Invalid Native Object"); if (argc == 4) { - double arg0; + double arg0 = 0; cocos2d::Vec2 arg1; - double arg2; - int arg3; + double arg2 = 0; + int arg3 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_vector2(cx, args.get(1), &arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -12665,10 +13312,10 @@ bool js_cocos2dx_JumpBy_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 4) { - double arg0; + double arg0 = 0; cocos2d::Vec2 arg1; - double arg2; - int arg3; + double arg2 = 0; + int arg3 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_vector2(cx, args.get(1), &arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -12718,6 +13365,21 @@ bool js_cocos2dx_JumpBy_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_JumpBy_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::JumpBy *nobj = new (std::nothrow) cocos2d::JumpBy(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::JumpBy"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_ActionInterval_prototype; @@ -12725,6 +13387,7 @@ extern JSObject *jsb_cocos2d_ActionInterval_prototype; void js_cocos2d_JumpBy_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (JumpBy)", obj); } + void js_register_cocos2dx_JumpBy(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_JumpBy_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_JumpBy_class->name = "JumpBy"; @@ -12745,6 +13408,7 @@ void js_register_cocos2dx_JumpBy(JSContext *cx, JS::HandleObject global) { static JSFunctionSpec funcs[] = { JS_FN("initWithDuration", js_cocos2dx_JumpBy_initWithDuration, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_JumpBy_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -12779,6 +13443,7 @@ void js_register_cocos2dx_JumpBy(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_ActionInterval_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.JumpBy.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_JumpTo_class; @@ -12793,10 +13458,10 @@ bool js_cocos2dx_JumpTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp cocos2d::JumpTo* cobj = (cocos2d::JumpTo *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_JumpTo_initWithDuration : Invalid Native Object"); if (argc == 4) { - double arg0; + double arg0 = 0; cocos2d::Vec2 arg1; - double arg2; - int arg3; + double arg2 = 0; + int arg3 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_vector2(cx, args.get(1), &arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -12817,10 +13482,10 @@ bool js_cocos2dx_JumpTo_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 4) { - double arg0; + double arg0 = 0; cocos2d::Vec2 arg1; - double arg2; - int arg3; + double arg2 = 0; + int arg3 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_vector2(cx, args.get(1), &arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -12870,6 +13535,21 @@ bool js_cocos2dx_JumpTo_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_JumpTo_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::JumpTo *nobj = new (std::nothrow) cocos2d::JumpTo(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::JumpTo"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_JumpBy_prototype; @@ -12877,6 +13557,7 @@ extern JSObject *jsb_cocos2d_JumpBy_prototype; void js_cocos2d_JumpTo_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (JumpTo)", obj); } + void js_register_cocos2dx_JumpTo(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_JumpTo_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_JumpTo_class->name = "JumpTo"; @@ -12897,6 +13578,7 @@ void js_register_cocos2dx_JumpTo(JSContext *cx, JS::HandleObject global) { static JSFunctionSpec funcs[] = { JS_FN("initWithDuration", js_cocos2dx_JumpTo_initWithDuration, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_JumpTo_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -12931,6 +13613,7 @@ void js_register_cocos2dx_JumpTo(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_JumpBy_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.JumpTo.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_BezierBy_class; @@ -12963,6 +13646,21 @@ bool js_cocos2dx_BezierBy_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_BezierBy_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::BezierBy *nobj = new (std::nothrow) cocos2d::BezierBy(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::BezierBy"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_ActionInterval_prototype; @@ -12970,6 +13668,7 @@ extern JSObject *jsb_cocos2d_ActionInterval_prototype; void js_cocos2d_BezierBy_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (BezierBy)", obj); } + void js_register_cocos2dx_BezierBy(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_BezierBy_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_BezierBy_class->name = "BezierBy"; @@ -12989,6 +13688,7 @@ void js_register_cocos2dx_BezierBy(JSContext *cx, JS::HandleObject global) { }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_BezierBy_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -13020,6 +13720,7 @@ void js_register_cocos2dx_BezierBy(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_ActionInterval_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.BezierBy.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_BezierTo_class; @@ -13052,6 +13753,21 @@ bool js_cocos2dx_BezierTo_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_BezierTo_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::BezierTo *nobj = new (std::nothrow) cocos2d::BezierTo(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::BezierTo"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_BezierBy_prototype; @@ -13059,6 +13775,7 @@ extern JSObject *jsb_cocos2d_BezierBy_prototype; void js_cocos2d_BezierTo_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (BezierTo)", obj); } + void js_register_cocos2dx_BezierTo(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_BezierTo_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_BezierTo_class->name = "BezierTo"; @@ -13078,6 +13795,7 @@ void js_register_cocos2dx_BezierTo(JSContext *cx, JS::HandleObject global) { }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_BezierTo_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -13109,6 +13827,7 @@ void js_register_cocos2dx_BezierTo(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_BezierBy_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.BezierTo.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_ScaleTo_class; @@ -13127,13 +13846,13 @@ bool js_cocos2dx_ScaleTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *v JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ScaleTo_initWithDuration : Invalid Native Object"); do { if (argc == 3) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } bool ret = cobj->initWithDuration(arg0, arg1, arg2); @@ -13146,10 +13865,10 @@ bool js_cocos2dx_ScaleTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *v do { if (argc == 2) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } bool ret = cobj->initWithDuration(arg0, arg1); @@ -13162,16 +13881,16 @@ bool js_cocos2dx_ScaleTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *v do { if (argc == 4) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } - double arg3; + double arg3 = 0; ok &= JS::ToNumber( cx, args.get(3), &arg3) && !isnan(arg3); if (!ok) { ok = true; break; } bool ret = cobj->initWithDuration(arg0, arg1, arg2, arg3); @@ -13192,13 +13911,13 @@ bool js_cocos2dx_ScaleTo_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 3) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } cocos2d::ScaleTo* ret = cocos2d::ScaleTo::create(arg0, arg1, arg2); @@ -13218,10 +13937,10 @@ bool js_cocos2dx_ScaleTo_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 2) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } cocos2d::ScaleTo* ret = cocos2d::ScaleTo::create(arg0, arg1); @@ -13241,16 +13960,16 @@ bool js_cocos2dx_ScaleTo_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 4) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } - double arg3; + double arg3 = 0; ok &= JS::ToNumber( cx, args.get(3), &arg3) && !isnan(arg3); if (!ok) { ok = true; break; } cocos2d::ScaleTo* ret = cocos2d::ScaleTo::create(arg0, arg1, arg2, arg3); @@ -13297,6 +14016,21 @@ bool js_cocos2dx_ScaleTo_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_ScaleTo_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::ScaleTo *nobj = new (std::nothrow) cocos2d::ScaleTo(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::ScaleTo"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_ActionInterval_prototype; @@ -13304,6 +14038,7 @@ extern JSObject *jsb_cocos2d_ActionInterval_prototype; void js_cocos2d_ScaleTo_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (ScaleTo)", obj); } + void js_register_cocos2dx_ScaleTo(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_ScaleTo_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_ScaleTo_class->name = "ScaleTo"; @@ -13324,6 +14059,7 @@ void js_register_cocos2dx_ScaleTo(JSContext *cx, JS::HandleObject global) { static JSFunctionSpec funcs[] = { JS_FN("initWithDuration", js_cocos2dx_ScaleTo_initWithDuration, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_ScaleTo_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -13358,6 +14094,7 @@ void js_register_cocos2dx_ScaleTo(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_ActionInterval_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.ScaleTo.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_ScaleBy_class; @@ -13370,13 +14107,13 @@ bool js_cocos2dx_ScaleBy_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 3) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } cocos2d::ScaleBy* ret = cocos2d::ScaleBy::create(arg0, arg1, arg2); @@ -13396,10 +14133,10 @@ bool js_cocos2dx_ScaleBy_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 2) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } cocos2d::ScaleBy* ret = cocos2d::ScaleBy::create(arg0, arg1); @@ -13419,16 +14156,16 @@ bool js_cocos2dx_ScaleBy_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 4) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } - double arg3; + double arg3 = 0; ok &= JS::ToNumber( cx, args.get(3), &arg3) && !isnan(arg3); if (!ok) { ok = true; break; } cocos2d::ScaleBy* ret = cocos2d::ScaleBy::create(arg0, arg1, arg2, arg3); @@ -13475,6 +14212,21 @@ bool js_cocos2dx_ScaleBy_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_ScaleBy_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::ScaleBy *nobj = new (std::nothrow) cocos2d::ScaleBy(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::ScaleBy"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_ScaleTo_prototype; @@ -13482,6 +14234,7 @@ extern JSObject *jsb_cocos2d_ScaleTo_prototype; void js_cocos2d_ScaleBy_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (ScaleBy)", obj); } + void js_register_cocos2dx_ScaleBy(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_ScaleBy_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_ScaleBy_class->name = "ScaleBy"; @@ -13501,6 +14254,7 @@ void js_register_cocos2dx_ScaleBy(JSContext *cx, JS::HandleObject global) { }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_ScaleBy_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -13535,6 +14289,7 @@ void js_register_cocos2dx_ScaleBy(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_ScaleTo_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.ScaleBy.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_Blink_class; @@ -13549,8 +14304,8 @@ bool js_cocos2dx_Blink_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Blink* cobj = (cocos2d::Blink *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Blink_initWithDuration : Invalid Native Object"); if (argc == 2) { - double arg0; - int arg1; + double arg0 = 0; + int arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Blink_initWithDuration : Error processing arguments"); @@ -13569,8 +14324,8 @@ bool js_cocos2dx_Blink_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; - int arg1; + double arg0 = 0; + int arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Blink_create : Error processing arguments"); @@ -13618,6 +14373,21 @@ bool js_cocos2dx_Blink_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_Blink_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::Blink *nobj = new (std::nothrow) cocos2d::Blink(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::Blink"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_ActionInterval_prototype; @@ -13625,6 +14395,7 @@ extern JSObject *jsb_cocos2d_ActionInterval_prototype; void js_cocos2d_Blink_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (Blink)", obj); } + void js_register_cocos2dx_Blink(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_Blink_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_Blink_class->name = "Blink"; @@ -13645,6 +14416,7 @@ void js_register_cocos2dx_Blink(JSContext *cx, JS::HandleObject global) { static JSFunctionSpec funcs[] = { JS_FN("initWithDuration", js_cocos2dx_Blink_initWithDuration, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_Blink_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -13679,6 +14451,7 @@ void js_register_cocos2dx_Blink(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_ActionInterval_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.Blink.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_FadeTo_class; @@ -13693,7 +14466,7 @@ bool js_cocos2dx_FadeTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp cocos2d::FadeTo* cobj = (cocos2d::FadeTo *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FadeTo_initWithDuration : Invalid Native Object"); if (argc == 2) { - double arg0; + double arg0 = 0; uint16_t arg1; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_uint16(cx, args.get(1), &arg1); @@ -13713,7 +14486,7 @@ bool js_cocos2dx_FadeTo_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; + double arg0 = 0; uint16_t arg1; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_uint16(cx, args.get(1), &arg1); @@ -13762,6 +14535,21 @@ bool js_cocos2dx_FadeTo_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_FadeTo_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::FadeTo *nobj = new (std::nothrow) cocos2d::FadeTo(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::FadeTo"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_ActionInterval_prototype; @@ -13769,6 +14557,7 @@ extern JSObject *jsb_cocos2d_ActionInterval_prototype; void js_cocos2d_FadeTo_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (FadeTo)", obj); } + void js_register_cocos2dx_FadeTo(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_FadeTo_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_FadeTo_class->name = "FadeTo"; @@ -13789,6 +14578,7 @@ void js_register_cocos2dx_FadeTo(JSContext *cx, JS::HandleObject global) { static JSFunctionSpec funcs[] = { JS_FN("initWithDuration", js_cocos2dx_FadeTo_initWithDuration, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_FadeTo_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -13823,6 +14613,7 @@ void js_register_cocos2dx_FadeTo(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_ActionInterval_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.FadeTo.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_FadeIn_class; @@ -13837,7 +14628,7 @@ bool js_cocos2dx_FadeIn_setReverseAction(JSContext *cx, uint32_t argc, jsval *vp cocos2d::FadeIn* cobj = (cocos2d::FadeIn *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FadeIn_setReverseAction : Invalid Native Object"); if (argc == 1) { - cocos2d::FadeTo* arg0; + cocos2d::FadeTo* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -13861,7 +14652,7 @@ bool js_cocos2dx_FadeIn_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FadeIn_create : Error processing arguments"); cocos2d::FadeIn* ret = cocos2d::FadeIn::create(arg0); @@ -13908,6 +14699,21 @@ bool js_cocos2dx_FadeIn_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_FadeIn_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::FadeIn *nobj = new (std::nothrow) cocos2d::FadeIn(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::FadeIn"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_FadeTo_prototype; @@ -13915,6 +14721,7 @@ extern JSObject *jsb_cocos2d_FadeTo_prototype; void js_cocos2d_FadeIn_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (FadeIn)", obj); } + void js_register_cocos2dx_FadeIn(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_FadeIn_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_FadeIn_class->name = "FadeIn"; @@ -13935,6 +14742,7 @@ void js_register_cocos2dx_FadeIn(JSContext *cx, JS::HandleObject global) { static JSFunctionSpec funcs[] = { JS_FN("setReverseAction", js_cocos2dx_FadeIn_setReverseAction, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_FadeIn_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -13969,6 +14777,7 @@ void js_register_cocos2dx_FadeIn(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_FadeTo_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.FadeIn.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_FadeOut_class; @@ -13983,7 +14792,7 @@ bool js_cocos2dx_FadeOut_setReverseAction(JSContext *cx, uint32_t argc, jsval *v cocos2d::FadeOut* cobj = (cocos2d::FadeOut *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FadeOut_setReverseAction : Invalid Native Object"); if (argc == 1) { - cocos2d::FadeTo* arg0; + cocos2d::FadeTo* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -14007,7 +14816,7 @@ bool js_cocos2dx_FadeOut_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FadeOut_create : Error processing arguments"); cocos2d::FadeOut* ret = cocos2d::FadeOut::create(arg0); @@ -14054,6 +14863,21 @@ bool js_cocos2dx_FadeOut_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_FadeOut_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::FadeOut *nobj = new (std::nothrow) cocos2d::FadeOut(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::FadeOut"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_FadeTo_prototype; @@ -14061,6 +14885,7 @@ extern JSObject *jsb_cocos2d_FadeTo_prototype; void js_cocos2d_FadeOut_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (FadeOut)", obj); } + void js_register_cocos2dx_FadeOut(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_FadeOut_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_FadeOut_class->name = "FadeOut"; @@ -14081,6 +14906,7 @@ void js_register_cocos2dx_FadeOut(JSContext *cx, JS::HandleObject global) { static JSFunctionSpec funcs[] = { JS_FN("setReverseAction", js_cocos2dx_FadeOut_setReverseAction, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_FadeOut_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -14115,6 +14941,7 @@ void js_register_cocos2dx_FadeOut(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_FadeTo_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.FadeOut.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_TintTo_class; @@ -14129,7 +14956,7 @@ bool js_cocos2dx_TintTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp cocos2d::TintTo* cobj = (cocos2d::TintTo *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TintTo_initWithDuration : Invalid Native Object"); if (argc == 4) { - double arg0; + double arg0 = 0; uint16_t arg1; uint16_t arg2; uint16_t arg3; @@ -14155,7 +14982,7 @@ bool js_cocos2dx_TintTo_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 2) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } cocos2d::Color3B arg1; @@ -14178,7 +15005,7 @@ bool js_cocos2dx_TintTo_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 4) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } uint16_t arg1; @@ -14234,6 +15061,21 @@ bool js_cocos2dx_TintTo_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_TintTo_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::TintTo *nobj = new (std::nothrow) cocos2d::TintTo(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::TintTo"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_ActionInterval_prototype; @@ -14241,6 +15083,7 @@ extern JSObject *jsb_cocos2d_ActionInterval_prototype; void js_cocos2d_TintTo_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (TintTo)", obj); } + void js_register_cocos2dx_TintTo(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_TintTo_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_TintTo_class->name = "TintTo"; @@ -14261,6 +15104,7 @@ void js_register_cocos2dx_TintTo(JSContext *cx, JS::HandleObject global) { static JSFunctionSpec funcs[] = { JS_FN("initWithDuration", js_cocos2dx_TintTo_initWithDuration, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_TintTo_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -14295,6 +15139,7 @@ void js_register_cocos2dx_TintTo(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_ActionInterval_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.TintTo.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_TintBy_class; @@ -14309,10 +15154,10 @@ bool js_cocos2dx_TintBy_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp cocos2d::TintBy* cobj = (cocos2d::TintBy *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TintBy_initWithDuration : Invalid Native Object"); if (argc == 4) { - double arg0; - int32_t arg1; - int32_t arg2; - int32_t arg3; + double arg0 = 0; + int32_t arg1 = 0; + int32_t arg2 = 0; + int32_t arg3 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_int32(cx, args.get(1), &arg1); ok &= jsval_to_int32(cx, args.get(2), &arg2); @@ -14333,10 +15178,10 @@ bool js_cocos2dx_TintBy_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 4) { - double arg0; - int32_t arg1; - int32_t arg2; - int32_t arg3; + double arg0 = 0; + int32_t arg1 = 0; + int32_t arg2 = 0; + int32_t arg3 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_int32(cx, args.get(1), &arg1); ok &= jsval_to_int32(cx, args.get(2), &arg2); @@ -14386,6 +15231,21 @@ bool js_cocos2dx_TintBy_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_TintBy_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::TintBy *nobj = new (std::nothrow) cocos2d::TintBy(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::TintBy"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_ActionInterval_prototype; @@ -14393,6 +15253,7 @@ extern JSObject *jsb_cocos2d_ActionInterval_prototype; void js_cocos2d_TintBy_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (TintBy)", obj); } + void js_register_cocos2dx_TintBy(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_TintBy_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_TintBy_class->name = "TintBy"; @@ -14413,6 +15274,7 @@ void js_register_cocos2dx_TintBy(JSContext *cx, JS::HandleObject global) { static JSFunctionSpec funcs[] = { JS_FN("initWithDuration", js_cocos2dx_TintBy_initWithDuration, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_TintBy_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -14447,6 +15309,7 @@ void js_register_cocos2dx_TintBy(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_ActionInterval_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.TintBy.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_DelayTime_class; @@ -14457,7 +15320,7 @@ bool js_cocos2dx_DelayTime_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_DelayTime_create : Error processing arguments"); cocos2d::DelayTime* ret = cocos2d::DelayTime::create(arg0); @@ -14504,6 +15367,21 @@ bool js_cocos2dx_DelayTime_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_DelayTime_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::DelayTime *nobj = new (std::nothrow) cocos2d::DelayTime(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::DelayTime"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_ActionInterval_prototype; @@ -14511,6 +15389,7 @@ extern JSObject *jsb_cocos2d_ActionInterval_prototype; void js_cocos2d_DelayTime_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (DelayTime)", obj); } + void js_register_cocos2dx_DelayTime(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_DelayTime_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_DelayTime_class->name = "DelayTime"; @@ -14530,6 +15409,7 @@ void js_register_cocos2dx_DelayTime(JSContext *cx, JS::HandleObject global) { }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_DelayTime_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -14564,6 +15444,7 @@ void js_register_cocos2dx_DelayTime(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_ActionInterval_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.DelayTime.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_ReverseTime_class; @@ -14578,7 +15459,7 @@ bool js_cocos2dx_ReverseTime_initWithAction(JSContext *cx, uint32_t argc, jsval cocos2d::ReverseTime* cobj = (cocos2d::ReverseTime *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ReverseTime_initWithAction : Invalid Native Object"); if (argc == 1) { - cocos2d::FiniteTimeAction* arg0; + cocos2d::FiniteTimeAction* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -14604,7 +15485,7 @@ bool js_cocos2dx_ReverseTime_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::FiniteTimeAction* arg0; + cocos2d::FiniteTimeAction* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -14659,6 +15540,21 @@ bool js_cocos2dx_ReverseTime_constructor(JSContext *cx, uint32_t argc, jsval *vp if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_ReverseTime_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::ReverseTime *nobj = new (std::nothrow) cocos2d::ReverseTime(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::ReverseTime"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_ActionInterval_prototype; @@ -14666,6 +15562,7 @@ extern JSObject *jsb_cocos2d_ActionInterval_prototype; void js_cocos2d_ReverseTime_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (ReverseTime)", obj); } + void js_register_cocos2dx_ReverseTime(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_ReverseTime_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_ReverseTime_class->name = "ReverseTime"; @@ -14686,6 +15583,7 @@ void js_register_cocos2dx_ReverseTime(JSContext *cx, JS::HandleObject global) { static JSFunctionSpec funcs[] = { JS_FN("initWithAction", js_cocos2dx_ReverseTime_initWithAction, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_ReverseTime_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -14720,6 +15618,7 @@ void js_register_cocos2dx_ReverseTime(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_ActionInterval_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.ReverseTime.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_Animate_class; @@ -14734,7 +15633,7 @@ bool js_cocos2dx_Animate_initWithAnimation(JSContext *cx, uint32_t argc, jsval * cocos2d::Animate* cobj = (cocos2d::Animate *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animate_initWithAnimation : Invalid Native Object"); if (argc == 1) { - cocos2d::Animation* arg0; + cocos2d::Animation* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -14830,7 +15729,7 @@ bool js_cocos2dx_Animate_setAnimation(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Animate* cobj = (cocos2d::Animate *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animate_setAnimation : Invalid Native Object"); if (argc == 1) { - cocos2d::Animation* arg0; + cocos2d::Animation* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -14854,7 +15753,7 @@ bool js_cocos2dx_Animate_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::Animation* arg0; + cocos2d::Animation* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -14909,6 +15808,21 @@ bool js_cocos2dx_Animate_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_Animate_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::Animate *nobj = new (std::nothrow) cocos2d::Animate(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::Animate"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_ActionInterval_prototype; @@ -14916,6 +15830,7 @@ extern JSObject *jsb_cocos2d_ActionInterval_prototype; void js_cocos2d_Animate_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (Animate)", obj); } + void js_register_cocos2dx_Animate(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_Animate_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_Animate_class->name = "Animate"; @@ -14939,6 +15854,7 @@ void js_register_cocos2dx_Animate(JSContext *cx, JS::HandleObject global) { JS_FN("getAnimation", js_cocos2dx_Animate_getAnimation, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getCurrentFrameIndex", js_cocos2dx_Animate_getCurrentFrameIndex, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setAnimation", js_cocos2dx_Animate_setAnimation, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_Animate_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -14973,6 +15889,7 @@ void js_register_cocos2dx_Animate(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_ActionInterval_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.Animate.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_TargetedAction_class; @@ -15035,8 +15952,8 @@ bool js_cocos2dx_TargetedAction_initWithTarget(JSContext *cx, uint32_t argc, jsv cocos2d::TargetedAction* cobj = (cocos2d::TargetedAction *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TargetedAction_initWithTarget : Invalid Native Object"); if (argc == 2) { - cocos2d::Node* arg0; - cocos2d::FiniteTimeAction* arg1; + cocos2d::Node* arg0 = nullptr; + cocos2d::FiniteTimeAction* arg1 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -15075,7 +15992,7 @@ bool js_cocos2dx_TargetedAction_setForcedTarget(JSContext *cx, uint32_t argc, js cocos2d::TargetedAction* cobj = (cocos2d::TargetedAction *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TargetedAction_setForcedTarget : Invalid Native Object"); if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -15099,8 +16016,8 @@ bool js_cocos2dx_TargetedAction_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - cocos2d::Node* arg0; - cocos2d::FiniteTimeAction* arg1; + cocos2d::Node* arg0 = nullptr; + cocos2d::FiniteTimeAction* arg1 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -15259,9 +16176,9 @@ bool js_cocos2dx_ActionFloat_initWithDuration(JSContext *cx, uint32_t argc, jsva cocos2d::ActionFloat* cobj = (cocos2d::ActionFloat *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionFloat_initWithDuration : Invalid Native Object"); if (argc == 4) { - double arg0; - double arg1; - double arg2; + double arg0 = 0; + double arg1 = 0; + double arg2 = 0; std::function arg3; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); @@ -15304,9 +16221,9 @@ bool js_cocos2dx_ActionFloat_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 4) { - double arg0; - double arg1; - double arg2; + double arg0 = 0; + double arg1 = 0; + double arg2 = 0; std::function arg3; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); @@ -16009,7 +16926,7 @@ bool js_cocos2dx_Properties_getVariable(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Properties* cobj = (cocos2d::Properties *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Properties_getVariable : Invalid Native Object"); if (argc == 1) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Properties_getVariable : Error processing arguments"); const char* ret = cobj->getVariable(arg0); @@ -16019,8 +16936,8 @@ bool js_cocos2dx_Properties_getVariable(JSContext *cx, uint32_t argc, jsval *vp) return true; } if (argc == 2) { - const char* arg0; - const char* arg1; + const char* arg0 = nullptr; + const char* arg1 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str(); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Properties_getVariable : Error processing arguments"); @@ -16050,7 +16967,7 @@ bool js_cocos2dx_Properties_getString(JSContext *cx, uint32_t argc, jsval *vp) return true; } if (argc == 1) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Properties_getString : Error processing arguments"); const char* ret = cobj->getString(arg0); @@ -16060,8 +16977,8 @@ bool js_cocos2dx_Properties_getString(JSContext *cx, uint32_t argc, jsval *vp) return true; } if (argc == 2) { - const char* arg0; - const char* arg1; + const char* arg0 = nullptr; + const char* arg1 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str(); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Properties_getString : Error processing arguments"); @@ -16091,7 +17008,7 @@ bool js_cocos2dx_Properties_getLong(JSContext *cx, uint32_t argc, jsval *vp) return true; } if (argc == 1) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Properties_getLong : Error processing arguments"); long ret = cobj->getLong(arg0); @@ -16127,7 +17044,7 @@ bool js_cocos2dx_Properties_getNamespace(JSContext *cx, uint32_t argc, jsval *vp do { if (argc == 1) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); if (!ok) { ok = true; break; } cocos2d::Properties* ret = cobj->getNamespace(arg0); @@ -16147,7 +17064,7 @@ bool js_cocos2dx_Properties_getNamespace(JSContext *cx, uint32_t argc, jsval *vp do { if (argc == 2) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); if (!ok) { ok = true; break; } bool arg1; @@ -16169,7 +17086,7 @@ bool js_cocos2dx_Properties_getNamespace(JSContext *cx, uint32_t argc, jsval *vp do { if (argc == 3) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); if (!ok) { ok = true; break; } bool arg1; @@ -16203,8 +17120,8 @@ bool js_cocos2dx_Properties_getPath(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Properties* cobj = (cocos2d::Properties *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Properties_getPath : Invalid Native Object"); if (argc == 2) { - const char* arg0; - std::string* arg1; + const char* arg0 = nullptr; + std::string* arg1 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); #pragma warning NO CONVERSION TO NATIVE FOR std::string* ok = false; @@ -16228,8 +17145,8 @@ bool js_cocos2dx_Properties_getMat4(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Properties* cobj = (cocos2d::Properties *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Properties_getMat4 : Invalid Native Object"); if (argc == 2) { - const char* arg0; - cocos2d::Mat4* arg1; + const char* arg0 = nullptr; + cocos2d::Mat4* arg1 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -16260,7 +17177,7 @@ bool js_cocos2dx_Properties_exists(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Properties* cobj = (cocos2d::Properties *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Properties_exists : Invalid Native Object"); if (argc == 1) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Properties_exists : Error processing arguments"); bool ret = cobj->exists(arg0); @@ -16282,8 +17199,8 @@ bool js_cocos2dx_Properties_setString(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Properties* cobj = (cocos2d::Properties *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Properties_setString : Invalid Native Object"); if (argc == 2) { - const char* arg0; - const char* arg1; + const char* arg0 = nullptr; + const char* arg1 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str(); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Properties_setString : Error processing arguments"); @@ -16340,8 +17257,8 @@ bool js_cocos2dx_Properties_setVariable(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Properties* cobj = (cocos2d::Properties *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Properties_setVariable : Invalid Native Object"); if (argc == 2) { - const char* arg0; - const char* arg1; + const char* arg0 = nullptr; + const char* arg1 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str(); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Properties_setVariable : Error processing arguments"); @@ -16369,7 +17286,7 @@ bool js_cocos2dx_Properties_getBool(JSContext *cx, uint32_t argc, jsval *vp) return true; } if (argc == 1) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Properties_getBool : Error processing arguments"); bool ret = cobj->getBool(arg0); @@ -16379,7 +17296,7 @@ bool js_cocos2dx_Properties_getBool(JSContext *cx, uint32_t argc, jsval *vp) return true; } if (argc == 2) { - const char* arg0; + const char* arg0 = nullptr; bool arg1; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); arg1 = JS::ToBoolean(args.get(1)); @@ -16407,10 +17324,10 @@ bool js_cocos2dx_Properties_getColor(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Properties_getColor : Invalid Native Object"); do { if (argc == 2) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); if (!ok) { ok = true; break; } - cocos2d::Vec4* arg1; + cocos2d::Vec4* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -16431,10 +17348,10 @@ bool js_cocos2dx_Properties_getColor(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 2) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); if (!ok) { ok = true; break; } - cocos2d::Vec3* arg1; + cocos2d::Vec3* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -16472,7 +17389,7 @@ bool js_cocos2dx_Properties_getType(JSContext *cx, uint32_t argc, jsval *vp) return true; } if (argc == 1) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Properties_getType : Error processing arguments"); int ret = (int)cobj->getType(arg0); @@ -16526,7 +17443,7 @@ bool js_cocos2dx_Properties_getInt(JSContext *cx, uint32_t argc, jsval *vp) return true; } if (argc == 1) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Properties_getInt : Error processing arguments"); int ret = cobj->getInt(arg0); @@ -16548,8 +17465,8 @@ bool js_cocos2dx_Properties_getVec3(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Properties* cobj = (cocos2d::Properties *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Properties_getVec3 : Invalid Native Object"); if (argc == 2) { - const char* arg0; - cocos2d::Vec3* arg1; + const char* arg0 = nullptr; + cocos2d::Vec3* arg1 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -16580,8 +17497,8 @@ bool js_cocos2dx_Properties_getVec2(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Properties* cobj = (cocos2d::Properties *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Properties_getVec2 : Invalid Native Object"); if (argc == 2) { - const char* arg0; - cocos2d::Vec2* arg1; + const char* arg0 = nullptr; + cocos2d::Vec2* arg1 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -16612,8 +17529,8 @@ bool js_cocos2dx_Properties_getVec4(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Properties* cobj = (cocos2d::Properties *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Properties_getVec4 : Invalid Native Object"); if (argc == 2) { - const char* arg0; - cocos2d::Vec4* arg1; + const char* arg0 = nullptr; + cocos2d::Vec4* arg1 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -16669,7 +17586,7 @@ bool js_cocos2dx_Properties_getFloat(JSContext *cx, uint32_t argc, jsval *vp) return true; } if (argc == 1) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Properties_getFloat : Error processing arguments"); double ret = cobj->getFloat(arg0); @@ -16691,8 +17608,8 @@ bool js_cocos2dx_Properties_getQuaternionFromAxisAngle(JSContext *cx, uint32_t a cocos2d::Properties* cobj = (cocos2d::Properties *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Properties_getQuaternionFromAxisAngle : Invalid Native Object"); if (argc == 2) { - const char* arg0; - cocos2d::Quaternion* arg1; + const char* arg0 = nullptr; + cocos2d::Quaternion* arg1 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -16721,10 +17638,10 @@ bool js_cocos2dx_Properties_parseColor(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 2) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); if (!ok) { ok = true; break; } - cocos2d::Vec4* arg1; + cocos2d::Vec4* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -16745,10 +17662,10 @@ bool js_cocos2dx_Properties_parseColor(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 2) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); if (!ok) { ok = true; break; } - cocos2d::Vec3* arg1; + cocos2d::Vec3* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -16774,8 +17691,8 @@ bool js_cocos2dx_Properties_parseVec3(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - const char* arg0; - cocos2d::Vec3* arg1; + const char* arg0 = nullptr; + cocos2d::Vec3* arg1 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -16802,8 +17719,8 @@ bool js_cocos2dx_Properties_parseAxisAngle(JSContext *cx, uint32_t argc, jsval * JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - const char* arg0; - cocos2d::Quaternion* arg1; + const char* arg0 = nullptr; + cocos2d::Quaternion* arg1 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -16830,8 +17747,8 @@ bool js_cocos2dx_Properties_parseVec2(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - const char* arg0; - cocos2d::Vec2* arg1; + const char* arg0 = nullptr; + cocos2d::Vec2* arg1 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -16883,8 +17800,8 @@ bool js_cocos2dx_Properties_parseVec4(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - const char* arg0; - cocos2d::Vec4* arg1; + const char* arg0 = nullptr; + cocos2d::Vec4* arg1 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -17287,8 +18204,8 @@ bool js_cocos2dx_FileUtils_getValueMapFromData(JSContext *cx, uint32_t argc, jsv cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_getValueMapFromData : Invalid Native Object"); if (argc == 2) { - const char* arg0; - int arg1; + const char* arg0 = nullptr; + int arg1 = 0; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_getValueMapFromData : Error processing arguments"); @@ -17747,7 +18664,7 @@ bool js_cocos2dx_FileUtils_setDelegate(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::FileUtils* arg0; + cocos2d::FileUtils* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -18275,8 +19192,8 @@ bool js_cocos2dx_EventDispatcher_addEventListenerWithSceneGraphPriority(JSContex cocos2d::EventDispatcher* cobj = (cocos2d::EventDispatcher *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventDispatcher_addEventListenerWithSceneGraphPriority : Invalid Native Object"); if (argc == 2) { - cocos2d::EventListener* arg0; - cocos2d::Node* arg1; + cocos2d::EventListener* arg0 = nullptr; + cocos2d::Node* arg1 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -18372,8 +19289,8 @@ bool js_cocos2dx_EventDispatcher_addEventListenerWithFixedPriority(JSContext *cx cocos2d::EventDispatcher* cobj = (cocos2d::EventDispatcher *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventDispatcher_addEventListenerWithFixedPriority : Invalid Native Object"); if (argc == 2) { - cocos2d::EventListener* arg0; - int arg1; + cocos2d::EventListener* arg0 = nullptr; + int arg1 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -18406,7 +19323,7 @@ bool js_cocos2dx_EventDispatcher_removeEventListenersForTarget(JSContext *cx, ui JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventDispatcher_removeEventListenersForTarget : Invalid Native Object"); do { if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -18425,7 +19342,7 @@ bool js_cocos2dx_EventDispatcher_removeEventListenersForTarget(JSContext *cx, ui do { if (argc == 2) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -18467,7 +19384,7 @@ bool js_cocos2dx_EventDispatcher_resumeEventListenersForTarget(JSContext *cx, ui cocos2d::EventDispatcher* cobj = (cocos2d::EventDispatcher *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventDispatcher_resumeEventListenersForTarget : Invalid Native Object"); if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -18483,7 +19400,7 @@ bool js_cocos2dx_EventDispatcher_resumeEventListenersForTarget(JSContext *cx, ui return true; } if (argc == 2) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; bool arg1; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -18513,8 +19430,8 @@ bool js_cocos2dx_EventDispatcher_setPriority(JSContext *cx, uint32_t argc, jsval cocos2d::EventDispatcher* cobj = (cocos2d::EventDispatcher *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventDispatcher_setPriority : Invalid Native Object"); if (argc == 2) { - cocos2d::EventListener* arg0; - int arg1; + cocos2d::EventListener* arg0 = nullptr; + int arg1 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -18543,7 +19460,7 @@ bool js_cocos2dx_EventDispatcher_dispatchEvent(JSContext *cx, uint32_t argc, jsv cocos2d::EventDispatcher* cobj = (cocos2d::EventDispatcher *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventDispatcher_dispatchEvent : Invalid Native Object"); if (argc == 1) { - cocos2d::Event* arg0; + cocos2d::Event* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -18571,7 +19488,7 @@ bool js_cocos2dx_EventDispatcher_pauseEventListenersForTarget(JSContext *cx, uin cocos2d::EventDispatcher* cobj = (cocos2d::EventDispatcher *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventDispatcher_pauseEventListenersForTarget : Invalid Native Object"); if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -18587,7 +19504,7 @@ bool js_cocos2dx_EventDispatcher_pauseEventListenersForTarget(JSContext *cx, uin return true; } if (argc == 2) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; bool arg1; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -18637,7 +19554,7 @@ bool js_cocos2dx_EventDispatcher_removeEventListener(JSContext *cx, uint32_t arg cocos2d::EventDispatcher* cobj = (cocos2d::EventDispatcher *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventDispatcher_removeEventListener : Invalid Native Object"); if (argc == 1) { - cocos2d::EventListener* arg0; + cocos2d::EventListener* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -18778,8 +19695,8 @@ bool js_cocos2dx_EventFocus_constructor(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cocos2d::ui::Widget* arg0; - cocos2d::ui::Widget* arg1; + cocos2d::ui::Widget* arg0 = nullptr; + cocos2d::ui::Widget* arg1 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -19490,7 +20407,7 @@ bool js_cocos2dx_EventMouse_setMouseButton(JSContext *cx, uint32_t argc, jsval * cocos2d::EventMouse* cobj = (cocos2d::EventMouse *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventMouse_setMouseButton : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventMouse_setMouseButton : Error processing arguments"); cobj->setMouseButton(arg0); @@ -19510,8 +20427,8 @@ bool js_cocos2dx_EventMouse_setScrollData(JSContext *cx, uint32_t argc, jsval *v cocos2d::EventMouse* cobj = (cocos2d::EventMouse *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventMouse_setScrollData : Invalid Native Object"); if (argc == 2) { - double arg0; - double arg1; + double arg0 = 0; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventMouse_setScrollData : Error processing arguments"); @@ -19658,8 +20575,8 @@ bool js_cocos2dx_EventMouse_setCursorPosition(JSContext *cx, uint32_t argc, jsva cocos2d::EventMouse* cobj = (cocos2d::EventMouse *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventMouse_setCursorPosition : Invalid Native Object"); if (argc == 2) { - double arg0; - double arg1; + double arg0 = 0; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventMouse_setCursorPosition : Error processing arguments"); @@ -20209,13 +21126,13 @@ bool js_cocos2dx_ActionCamera_setEye(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionCamera_setEye : Invalid Native Object"); do { if (argc == 3) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } cobj->setEye(arg0, arg1, arg2); @@ -20454,9 +21371,9 @@ bool js_cocos2dx_OrbitCamera_sphericalRadius(JSContext *cx, uint32_t argc, jsval cocos2d::OrbitCamera* cobj = (cocos2d::OrbitCamera *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_OrbitCamera_sphericalRadius : Invalid Native Object"); if (argc == 3) { - float* arg0; - float* arg1; - float* arg2; + float* arg0 = 0; + float* arg1 = 0; + float* arg2 = 0; #pragma warning NO CONVERSION TO NATIVE FOR float* ok = false; #pragma warning NO CONVERSION TO NATIVE FOR float* @@ -20481,13 +21398,13 @@ bool js_cocos2dx_OrbitCamera_initWithDuration(JSContext *cx, uint32_t argc, jsva cocos2d::OrbitCamera* cobj = (cocos2d::OrbitCamera *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_OrbitCamera_initWithDuration : Invalid Native Object"); if (argc == 7) { - double arg0; - double arg1; - double arg2; - double arg3; - double arg4; - double arg5; - double arg6; + double arg0 = 0; + double arg1 = 0; + double arg2 = 0; + double arg3 = 0; + double arg4 = 0; + double arg5 = 0; + double arg6 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -20511,13 +21428,13 @@ bool js_cocos2dx_OrbitCamera_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 7) { - double arg0; - double arg1; - double arg2; - double arg3; - double arg4; - double arg5; - double arg6; + double arg0 = 0; + double arg1 = 0; + double arg2 = 0; + double arg3 = 0; + double arg4 = 0; + double arg5 = 0; + double arg6 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -20570,6 +21487,21 @@ bool js_cocos2dx_OrbitCamera_constructor(JSContext *cx, uint32_t argc, jsval *vp if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_OrbitCamera_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::OrbitCamera *nobj = new (std::nothrow) cocos2d::OrbitCamera(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::OrbitCamera"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_ActionCamera_prototype; @@ -20577,6 +21509,7 @@ extern JSObject *jsb_cocos2d_ActionCamera_prototype; void js_cocos2d_OrbitCamera_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (OrbitCamera)", obj); } + void js_register_cocos2dx_OrbitCamera(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_OrbitCamera_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_OrbitCamera_class->name = "OrbitCamera"; @@ -20598,6 +21531,7 @@ void js_register_cocos2dx_OrbitCamera(JSContext *cx, JS::HandleObject global) { static JSFunctionSpec funcs[] = { JS_FN("sphericalRadius", js_cocos2dx_OrbitCamera_sphericalRadius, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("initWithDuration", js_cocos2dx_OrbitCamera_initWithDuration, 7, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_OrbitCamera_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -20632,6 +21566,7 @@ void js_register_cocos2dx_OrbitCamera(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_ActionCamera_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.OrbitCamera.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_CardinalSplineTo_class; @@ -20993,7 +21928,7 @@ bool js_cocos2dx_ActionEase_initWithAction(JSContext *cx, uint32_t argc, jsval * cocos2d::ActionEase* cobj = (cocos2d::ActionEase *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionEase_initWithAction : Invalid Native Object"); if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -21111,7 +22046,7 @@ bool js_cocos2dx_EaseRateAction_setRate(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::EaseRateAction* cobj = (cocos2d::EaseRateAction *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EaseRateAction_setRate : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseRateAction_setRate : Error processing arguments"); cobj->setRate(arg0); @@ -21131,8 +22066,8 @@ bool js_cocos2dx_EaseRateAction_initWithAction(JSContext *cx, uint32_t argc, jsv cocos2d::EaseRateAction* cobj = (cocos2d::EaseRateAction *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EaseRateAction_initWithAction : Invalid Native Object"); if (argc == 2) { - cocos2d::ActionInterval* arg0; - double arg1; + cocos2d::ActionInterval* arg0 = nullptr; + double arg1 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -21177,8 +22112,8 @@ bool js_cocos2dx_EaseRateAction_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - cocos2d::ActionInterval* arg0; - double arg1; + cocos2d::ActionInterval* arg0 = nullptr; + double arg1 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -21279,8 +22214,8 @@ bool js_cocos2dx_EaseIn_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - cocos2d::ActionInterval* arg0; - double arg1; + cocos2d::ActionInterval* arg0 = nullptr; + double arg1 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -21336,6 +22271,21 @@ bool js_cocos2dx_EaseIn_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_EaseIn_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::EaseIn *nobj = new (std::nothrow) cocos2d::EaseIn(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseIn"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_EaseRateAction_prototype; @@ -21343,6 +22293,7 @@ extern JSObject *jsb_cocos2d_EaseRateAction_prototype; void js_cocos2d_EaseIn_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (EaseIn)", obj); } + void js_register_cocos2dx_EaseIn(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_EaseIn_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_EaseIn_class->name = "EaseIn"; @@ -21362,6 +22313,7 @@ void js_register_cocos2dx_EaseIn(JSContext *cx, JS::HandleObject global) { }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_EaseIn_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -21396,6 +22348,7 @@ void js_register_cocos2dx_EaseIn(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_EaseRateAction_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.EaseIn.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_EaseOut_class; @@ -21406,8 +22359,8 @@ bool js_cocos2dx_EaseOut_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - cocos2d::ActionInterval* arg0; - double arg1; + cocos2d::ActionInterval* arg0 = nullptr; + double arg1 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -21463,6 +22416,21 @@ bool js_cocos2dx_EaseOut_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_EaseOut_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::EaseOut *nobj = new (std::nothrow) cocos2d::EaseOut(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseOut"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_EaseRateAction_prototype; @@ -21470,6 +22438,7 @@ extern JSObject *jsb_cocos2d_EaseRateAction_prototype; void js_cocos2d_EaseOut_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (EaseOut)", obj); } + void js_register_cocos2dx_EaseOut(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_EaseOut_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_EaseOut_class->name = "EaseOut"; @@ -21489,6 +22458,7 @@ void js_register_cocos2dx_EaseOut(JSContext *cx, JS::HandleObject global) { }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_EaseOut_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -21523,6 +22493,7 @@ void js_register_cocos2dx_EaseOut(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_EaseRateAction_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.EaseOut.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_EaseInOut_class; @@ -21533,8 +22504,8 @@ bool js_cocos2dx_EaseInOut_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - cocos2d::ActionInterval* arg0; - double arg1; + cocos2d::ActionInterval* arg0 = nullptr; + double arg1 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -21590,6 +22561,21 @@ bool js_cocos2dx_EaseInOut_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_EaseInOut_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::EaseInOut *nobj = new (std::nothrow) cocos2d::EaseInOut(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseInOut"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_EaseRateAction_prototype; @@ -21597,6 +22583,7 @@ extern JSObject *jsb_cocos2d_EaseRateAction_prototype; void js_cocos2d_EaseInOut_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (EaseInOut)", obj); } + void js_register_cocos2dx_EaseInOut(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_EaseInOut_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_EaseInOut_class->name = "EaseInOut"; @@ -21616,6 +22603,7 @@ void js_register_cocos2dx_EaseInOut(JSContext *cx, JS::HandleObject global) { }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_EaseInOut_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -21650,6 +22638,7 @@ void js_register_cocos2dx_EaseInOut(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_EaseRateAction_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.EaseInOut.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_EaseExponentialIn_class; @@ -21660,7 +22649,7 @@ bool js_cocos2dx_EaseExponentialIn_create(JSContext *cx, uint32_t argc, jsval *v JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -21715,6 +22704,21 @@ bool js_cocos2dx_EaseExponentialIn_constructor(JSContext *cx, uint32_t argc, jsv if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_EaseExponentialIn_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::EaseExponentialIn *nobj = new (std::nothrow) cocos2d::EaseExponentialIn(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseExponentialIn"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_ActionEase_prototype; @@ -21722,6 +22726,7 @@ extern JSObject *jsb_cocos2d_ActionEase_prototype; void js_cocos2d_EaseExponentialIn_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (EaseExponentialIn)", obj); } + void js_register_cocos2dx_EaseExponentialIn(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_EaseExponentialIn_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_EaseExponentialIn_class->name = "EaseExponentialIn"; @@ -21741,6 +22746,7 @@ void js_register_cocos2dx_EaseExponentialIn(JSContext *cx, JS::HandleObject glob }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_EaseExponentialIn_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -21775,6 +22781,7 @@ void js_register_cocos2dx_EaseExponentialIn(JSContext *cx, JS::HandleObject glob p->parentProto = jsb_cocos2d_ActionEase_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.EaseExponentialIn.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_EaseExponentialOut_class; @@ -21785,7 +22792,7 @@ bool js_cocos2dx_EaseExponentialOut_create(JSContext *cx, uint32_t argc, jsval * JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -21840,6 +22847,21 @@ bool js_cocos2dx_EaseExponentialOut_constructor(JSContext *cx, uint32_t argc, js if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_EaseExponentialOut_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::EaseExponentialOut *nobj = new (std::nothrow) cocos2d::EaseExponentialOut(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseExponentialOut"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_ActionEase_prototype; @@ -21847,6 +22869,7 @@ extern JSObject *jsb_cocos2d_ActionEase_prototype; void js_cocos2d_EaseExponentialOut_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (EaseExponentialOut)", obj); } + void js_register_cocos2dx_EaseExponentialOut(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_EaseExponentialOut_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_EaseExponentialOut_class->name = "EaseExponentialOut"; @@ -21866,6 +22889,7 @@ void js_register_cocos2dx_EaseExponentialOut(JSContext *cx, JS::HandleObject glo }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_EaseExponentialOut_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -21900,6 +22924,7 @@ void js_register_cocos2dx_EaseExponentialOut(JSContext *cx, JS::HandleObject glo p->parentProto = jsb_cocos2d_ActionEase_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.EaseExponentialOut.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_EaseExponentialInOut_class; @@ -21910,7 +22935,7 @@ bool js_cocos2dx_EaseExponentialInOut_create(JSContext *cx, uint32_t argc, jsval JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -21965,6 +22990,21 @@ bool js_cocos2dx_EaseExponentialInOut_constructor(JSContext *cx, uint32_t argc, if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_EaseExponentialInOut_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::EaseExponentialInOut *nobj = new (std::nothrow) cocos2d::EaseExponentialInOut(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseExponentialInOut"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_ActionEase_prototype; @@ -21972,6 +23012,7 @@ extern JSObject *jsb_cocos2d_ActionEase_prototype; void js_cocos2d_EaseExponentialInOut_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (EaseExponentialInOut)", obj); } + void js_register_cocos2dx_EaseExponentialInOut(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_EaseExponentialInOut_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_EaseExponentialInOut_class->name = "EaseExponentialInOut"; @@ -21991,6 +23032,7 @@ void js_register_cocos2dx_EaseExponentialInOut(JSContext *cx, JS::HandleObject g }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_EaseExponentialInOut_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -22025,6 +23067,7 @@ void js_register_cocos2dx_EaseExponentialInOut(JSContext *cx, JS::HandleObject g p->parentProto = jsb_cocos2d_ActionEase_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.EaseExponentialInOut.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_EaseSineIn_class; @@ -22035,7 +23078,7 @@ bool js_cocos2dx_EaseSineIn_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -22090,6 +23133,21 @@ bool js_cocos2dx_EaseSineIn_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_EaseSineIn_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::EaseSineIn *nobj = new (std::nothrow) cocos2d::EaseSineIn(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseSineIn"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_ActionEase_prototype; @@ -22097,6 +23155,7 @@ extern JSObject *jsb_cocos2d_ActionEase_prototype; void js_cocos2d_EaseSineIn_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (EaseSineIn)", obj); } + void js_register_cocos2dx_EaseSineIn(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_EaseSineIn_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_EaseSineIn_class->name = "EaseSineIn"; @@ -22116,6 +23175,7 @@ void js_register_cocos2dx_EaseSineIn(JSContext *cx, JS::HandleObject global) { }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_EaseSineIn_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -22150,6 +23210,7 @@ void js_register_cocos2dx_EaseSineIn(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_ActionEase_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.EaseSineIn.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_EaseSineOut_class; @@ -22160,7 +23221,7 @@ bool js_cocos2dx_EaseSineOut_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -22215,6 +23276,21 @@ bool js_cocos2dx_EaseSineOut_constructor(JSContext *cx, uint32_t argc, jsval *vp if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_EaseSineOut_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::EaseSineOut *nobj = new (std::nothrow) cocos2d::EaseSineOut(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseSineOut"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_ActionEase_prototype; @@ -22222,6 +23298,7 @@ extern JSObject *jsb_cocos2d_ActionEase_prototype; void js_cocos2d_EaseSineOut_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (EaseSineOut)", obj); } + void js_register_cocos2dx_EaseSineOut(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_EaseSineOut_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_EaseSineOut_class->name = "EaseSineOut"; @@ -22241,6 +23318,7 @@ void js_register_cocos2dx_EaseSineOut(JSContext *cx, JS::HandleObject global) { }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_EaseSineOut_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -22275,6 +23353,7 @@ void js_register_cocos2dx_EaseSineOut(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_ActionEase_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.EaseSineOut.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_EaseSineInOut_class; @@ -22285,7 +23364,7 @@ bool js_cocos2dx_EaseSineInOut_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -22340,6 +23419,21 @@ bool js_cocos2dx_EaseSineInOut_constructor(JSContext *cx, uint32_t argc, jsval * if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_EaseSineInOut_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::EaseSineInOut *nobj = new (std::nothrow) cocos2d::EaseSineInOut(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseSineInOut"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_ActionEase_prototype; @@ -22347,6 +23441,7 @@ extern JSObject *jsb_cocos2d_ActionEase_prototype; void js_cocos2d_EaseSineInOut_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (EaseSineInOut)", obj); } + void js_register_cocos2dx_EaseSineInOut(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_EaseSineInOut_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_EaseSineInOut_class->name = "EaseSineInOut"; @@ -22366,6 +23461,7 @@ void js_register_cocos2dx_EaseSineInOut(JSContext *cx, JS::HandleObject global) }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_EaseSineInOut_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -22400,6 +23496,7 @@ void js_register_cocos2dx_EaseSineInOut(JSContext *cx, JS::HandleObject global) p->parentProto = jsb_cocos2d_ActionEase_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.EaseSineInOut.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_EaseElastic_class; @@ -22414,7 +23511,7 @@ bool js_cocos2dx_EaseElastic_setPeriod(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::EaseElastic* cobj = (cocos2d::EaseElastic *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EaseElastic_setPeriod : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseElastic_setPeriod : Error processing arguments"); cobj->setPeriod(arg0); @@ -22434,7 +23531,7 @@ bool js_cocos2dx_EaseElastic_initWithAction(JSContext *cx, uint32_t argc, jsval cocos2d::EaseElastic* cobj = (cocos2d::EaseElastic *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EaseElastic_initWithAction : Invalid Native Object"); if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -22452,8 +23549,8 @@ bool js_cocos2dx_EaseElastic_initWithAction(JSContext *cx, uint32_t argc, jsval return true; } if (argc == 2) { - cocos2d::ActionInterval* arg0; - double arg1; + cocos2d::ActionInterval* arg0 = nullptr; + double arg1 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -22564,7 +23661,7 @@ bool js_cocos2dx_EaseElasticIn_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -22592,7 +23689,7 @@ bool js_cocos2dx_EaseElasticIn_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 2) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -22603,7 +23700,7 @@ bool js_cocos2dx_EaseElasticIn_create(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } cocos2d::EaseElasticIn* ret = cocos2d::EaseElasticIn::create(arg0, arg1); @@ -22650,6 +23747,21 @@ bool js_cocos2dx_EaseElasticIn_constructor(JSContext *cx, uint32_t argc, jsval * if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_EaseElasticIn_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::EaseElasticIn *nobj = new (std::nothrow) cocos2d::EaseElasticIn(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseElasticIn"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_EaseElastic_prototype; @@ -22657,6 +23769,7 @@ extern JSObject *jsb_cocos2d_EaseElastic_prototype; void js_cocos2d_EaseElasticIn_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (EaseElasticIn)", obj); } + void js_register_cocos2dx_EaseElasticIn(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_EaseElasticIn_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_EaseElasticIn_class->name = "EaseElasticIn"; @@ -22676,6 +23789,7 @@ void js_register_cocos2dx_EaseElasticIn(JSContext *cx, JS::HandleObject global) }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_EaseElasticIn_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -22710,6 +23824,7 @@ void js_register_cocos2dx_EaseElasticIn(JSContext *cx, JS::HandleObject global) p->parentProto = jsb_cocos2d_EaseElastic_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.EaseElasticIn.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_EaseElasticOut_class; @@ -22722,7 +23837,7 @@ bool js_cocos2dx_EaseElasticOut_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -22750,7 +23865,7 @@ bool js_cocos2dx_EaseElasticOut_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 2) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -22761,7 +23876,7 @@ bool js_cocos2dx_EaseElasticOut_create(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } cocos2d::EaseElasticOut* ret = cocos2d::EaseElasticOut::create(arg0, arg1); @@ -22808,6 +23923,21 @@ bool js_cocos2dx_EaseElasticOut_constructor(JSContext *cx, uint32_t argc, jsval if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_EaseElasticOut_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::EaseElasticOut *nobj = new (std::nothrow) cocos2d::EaseElasticOut(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseElasticOut"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_EaseElastic_prototype; @@ -22815,6 +23945,7 @@ extern JSObject *jsb_cocos2d_EaseElastic_prototype; void js_cocos2d_EaseElasticOut_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (EaseElasticOut)", obj); } + void js_register_cocos2dx_EaseElasticOut(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_EaseElasticOut_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_EaseElasticOut_class->name = "EaseElasticOut"; @@ -22834,6 +23965,7 @@ void js_register_cocos2dx_EaseElasticOut(JSContext *cx, JS::HandleObject global) }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_EaseElasticOut_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -22868,6 +24000,7 @@ void js_register_cocos2dx_EaseElasticOut(JSContext *cx, JS::HandleObject global) p->parentProto = jsb_cocos2d_EaseElastic_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.EaseElasticOut.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_EaseElasticInOut_class; @@ -22880,7 +24013,7 @@ bool js_cocos2dx_EaseElasticInOut_create(JSContext *cx, uint32_t argc, jsval *vp do { if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -22908,7 +24041,7 @@ bool js_cocos2dx_EaseElasticInOut_create(JSContext *cx, uint32_t argc, jsval *vp do { if (argc == 2) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -22919,7 +24052,7 @@ bool js_cocos2dx_EaseElasticInOut_create(JSContext *cx, uint32_t argc, jsval *vp JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } cocos2d::EaseElasticInOut* ret = cocos2d::EaseElasticInOut::create(arg0, arg1); @@ -22966,6 +24099,21 @@ bool js_cocos2dx_EaseElasticInOut_constructor(JSContext *cx, uint32_t argc, jsva if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_EaseElasticInOut_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::EaseElasticInOut *nobj = new (std::nothrow) cocos2d::EaseElasticInOut(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseElasticInOut"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_EaseElastic_prototype; @@ -22973,6 +24121,7 @@ extern JSObject *jsb_cocos2d_EaseElastic_prototype; void js_cocos2d_EaseElasticInOut_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (EaseElasticInOut)", obj); } + void js_register_cocos2dx_EaseElasticInOut(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_EaseElasticInOut_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_EaseElasticInOut_class->name = "EaseElasticInOut"; @@ -22992,6 +24141,7 @@ void js_register_cocos2dx_EaseElasticInOut(JSContext *cx, JS::HandleObject globa }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_EaseElasticInOut_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -23026,6 +24176,7 @@ void js_register_cocos2dx_EaseElasticInOut(JSContext *cx, JS::HandleObject globa p->parentProto = jsb_cocos2d_EaseElastic_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.EaseElasticInOut.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_EaseBounce_class; @@ -23097,7 +24248,7 @@ bool js_cocos2dx_EaseBounceIn_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -23152,6 +24303,21 @@ bool js_cocos2dx_EaseBounceIn_constructor(JSContext *cx, uint32_t argc, jsval *v if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_EaseBounceIn_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::EaseBounceIn *nobj = new (std::nothrow) cocos2d::EaseBounceIn(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseBounceIn"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_EaseBounce_prototype; @@ -23159,6 +24325,7 @@ extern JSObject *jsb_cocos2d_EaseBounce_prototype; void js_cocos2d_EaseBounceIn_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (EaseBounceIn)", obj); } + void js_register_cocos2dx_EaseBounceIn(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_EaseBounceIn_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_EaseBounceIn_class->name = "EaseBounceIn"; @@ -23178,6 +24345,7 @@ void js_register_cocos2dx_EaseBounceIn(JSContext *cx, JS::HandleObject global) { }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_EaseBounceIn_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -23212,6 +24380,7 @@ void js_register_cocos2dx_EaseBounceIn(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_EaseBounce_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.EaseBounceIn.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_EaseBounceOut_class; @@ -23222,7 +24391,7 @@ bool js_cocos2dx_EaseBounceOut_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -23277,6 +24446,21 @@ bool js_cocos2dx_EaseBounceOut_constructor(JSContext *cx, uint32_t argc, jsval * if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_EaseBounceOut_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::EaseBounceOut *nobj = new (std::nothrow) cocos2d::EaseBounceOut(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseBounceOut"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_EaseBounce_prototype; @@ -23284,6 +24468,7 @@ extern JSObject *jsb_cocos2d_EaseBounce_prototype; void js_cocos2d_EaseBounceOut_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (EaseBounceOut)", obj); } + void js_register_cocos2dx_EaseBounceOut(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_EaseBounceOut_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_EaseBounceOut_class->name = "EaseBounceOut"; @@ -23303,6 +24488,7 @@ void js_register_cocos2dx_EaseBounceOut(JSContext *cx, JS::HandleObject global) }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_EaseBounceOut_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -23337,6 +24523,7 @@ void js_register_cocos2dx_EaseBounceOut(JSContext *cx, JS::HandleObject global) p->parentProto = jsb_cocos2d_EaseBounce_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.EaseBounceOut.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_EaseBounceInOut_class; @@ -23347,7 +24534,7 @@ bool js_cocos2dx_EaseBounceInOut_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -23402,6 +24589,21 @@ bool js_cocos2dx_EaseBounceInOut_constructor(JSContext *cx, uint32_t argc, jsval if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_EaseBounceInOut_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::EaseBounceInOut *nobj = new (std::nothrow) cocos2d::EaseBounceInOut(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseBounceInOut"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_EaseBounce_prototype; @@ -23409,6 +24611,7 @@ extern JSObject *jsb_cocos2d_EaseBounce_prototype; void js_cocos2d_EaseBounceInOut_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (EaseBounceInOut)", obj); } + void js_register_cocos2dx_EaseBounceInOut(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_EaseBounceInOut_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_EaseBounceInOut_class->name = "EaseBounceInOut"; @@ -23428,6 +24631,7 @@ void js_register_cocos2dx_EaseBounceInOut(JSContext *cx, JS::HandleObject global }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_EaseBounceInOut_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -23462,6 +24666,7 @@ void js_register_cocos2dx_EaseBounceInOut(JSContext *cx, JS::HandleObject global p->parentProto = jsb_cocos2d_EaseBounce_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.EaseBounceInOut.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_EaseBackIn_class; @@ -23472,7 +24677,7 @@ bool js_cocos2dx_EaseBackIn_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -23527,6 +24732,21 @@ bool js_cocos2dx_EaseBackIn_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_EaseBackIn_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::EaseBackIn *nobj = new (std::nothrow) cocos2d::EaseBackIn(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseBackIn"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_ActionEase_prototype; @@ -23534,6 +24754,7 @@ extern JSObject *jsb_cocos2d_ActionEase_prototype; void js_cocos2d_EaseBackIn_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (EaseBackIn)", obj); } + void js_register_cocos2dx_EaseBackIn(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_EaseBackIn_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_EaseBackIn_class->name = "EaseBackIn"; @@ -23553,6 +24774,7 @@ void js_register_cocos2dx_EaseBackIn(JSContext *cx, JS::HandleObject global) { }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_EaseBackIn_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -23587,6 +24809,7 @@ void js_register_cocos2dx_EaseBackIn(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_ActionEase_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.EaseBackIn.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_EaseBackOut_class; @@ -23597,7 +24820,7 @@ bool js_cocos2dx_EaseBackOut_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -23652,6 +24875,21 @@ bool js_cocos2dx_EaseBackOut_constructor(JSContext *cx, uint32_t argc, jsval *vp if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_EaseBackOut_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::EaseBackOut *nobj = new (std::nothrow) cocos2d::EaseBackOut(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseBackOut"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_ActionEase_prototype; @@ -23659,6 +24897,7 @@ extern JSObject *jsb_cocos2d_ActionEase_prototype; void js_cocos2d_EaseBackOut_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (EaseBackOut)", obj); } + void js_register_cocos2dx_EaseBackOut(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_EaseBackOut_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_EaseBackOut_class->name = "EaseBackOut"; @@ -23678,6 +24917,7 @@ void js_register_cocos2dx_EaseBackOut(JSContext *cx, JS::HandleObject global) { }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_EaseBackOut_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -23712,6 +24952,7 @@ void js_register_cocos2dx_EaseBackOut(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_ActionEase_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.EaseBackOut.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_EaseBackInOut_class; @@ -23722,7 +24963,7 @@ bool js_cocos2dx_EaseBackInOut_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -23777,6 +25018,21 @@ bool js_cocos2dx_EaseBackInOut_constructor(JSContext *cx, uint32_t argc, jsval * if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_EaseBackInOut_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::EaseBackInOut *nobj = new (std::nothrow) cocos2d::EaseBackInOut(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseBackInOut"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_ActionEase_prototype; @@ -23784,6 +25040,7 @@ extern JSObject *jsb_cocos2d_ActionEase_prototype; void js_cocos2d_EaseBackInOut_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (EaseBackInOut)", obj); } + void js_register_cocos2dx_EaseBackInOut(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_EaseBackInOut_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_EaseBackInOut_class->name = "EaseBackInOut"; @@ -23803,6 +25060,7 @@ void js_register_cocos2dx_EaseBackInOut(JSContext *cx, JS::HandleObject global) }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_EaseBackInOut_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -23837,6 +25095,7 @@ void js_register_cocos2dx_EaseBackInOut(JSContext *cx, JS::HandleObject global) p->parentProto = jsb_cocos2d_ActionEase_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.EaseBackInOut.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_EaseBezierAction_class; @@ -23851,10 +25110,10 @@ bool js_cocos2dx_EaseBezierAction_setBezierParamer(JSContext *cx, uint32_t argc, cocos2d::EaseBezierAction* cobj = (cocos2d::EaseBezierAction *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EaseBezierAction_setBezierParamer : Invalid Native Object"); if (argc == 4) { - double arg0; - double arg1; - double arg2; - double arg3; + double arg0 = 0; + double arg1 = 0; + double arg2 = 0; + double arg3 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -23873,7 +25132,7 @@ bool js_cocos2dx_EaseBezierAction_create(JSContext *cx, uint32_t argc, jsval *vp JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -24017,7 +25276,7 @@ bool js_cocos2dx_EaseQuadraticActionIn_create(JSContext *cx, uint32_t argc, jsva JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -24160,7 +25419,7 @@ bool js_cocos2dx_EaseQuadraticActionOut_create(JSContext *cx, uint32_t argc, jsv JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -24303,7 +25562,7 @@ bool js_cocos2dx_EaseQuadraticActionInOut_create(JSContext *cx, uint32_t argc, j JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -24446,7 +25705,7 @@ bool js_cocos2dx_EaseQuarticActionIn_create(JSContext *cx, uint32_t argc, jsval JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -24589,7 +25848,7 @@ bool js_cocos2dx_EaseQuarticActionOut_create(JSContext *cx, uint32_t argc, jsval JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -24732,7 +25991,7 @@ bool js_cocos2dx_EaseQuarticActionInOut_create(JSContext *cx, uint32_t argc, jsv JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -24875,7 +26134,7 @@ bool js_cocos2dx_EaseQuinticActionIn_create(JSContext *cx, uint32_t argc, jsval JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -25018,7 +26277,7 @@ bool js_cocos2dx_EaseQuinticActionOut_create(JSContext *cx, uint32_t argc, jsval JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -25161,7 +26420,7 @@ bool js_cocos2dx_EaseQuinticActionInOut_create(JSContext *cx, uint32_t argc, jsv JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -25304,7 +26563,7 @@ bool js_cocos2dx_EaseCircleActionIn_create(JSContext *cx, uint32_t argc, jsval * JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -25447,7 +26706,7 @@ bool js_cocos2dx_EaseCircleActionOut_create(JSContext *cx, uint32_t argc, jsval JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -25590,7 +26849,7 @@ bool js_cocos2dx_EaseCircleActionInOut_create(JSContext *cx, uint32_t argc, jsva JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -25733,7 +26992,7 @@ bool js_cocos2dx_EaseCubicActionIn_create(JSContext *cx, uint32_t argc, jsval *v JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -25876,7 +27135,7 @@ bool js_cocos2dx_EaseCubicActionOut_create(JSContext *cx, uint32_t argc, jsval * JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -26019,7 +27278,7 @@ bool js_cocos2dx_EaseCubicActionInOut_create(JSContext *cx, uint32_t argc, jsval JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -26266,6 +27525,21 @@ bool js_cocos2dx_Show_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_Show_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::Show *nobj = new (std::nothrow) cocos2d::Show(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::Show"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_ActionInstant_prototype; @@ -26273,6 +27547,7 @@ extern JSObject *jsb_cocos2d_ActionInstant_prototype; void js_cocos2d_Show_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (Show)", obj); } + void js_register_cocos2dx_Show(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_Show_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_Show_class->name = "Show"; @@ -26292,6 +27567,7 @@ void js_register_cocos2dx_Show(JSContext *cx, JS::HandleObject global) { }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_Show_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -26326,6 +27602,7 @@ void js_register_cocos2dx_Show(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_ActionInstant_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.Show.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_Hide_class; @@ -26379,6 +27656,21 @@ bool js_cocos2dx_Hide_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_Hide_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::Hide *nobj = new (std::nothrow) cocos2d::Hide(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::Hide"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_ActionInstant_prototype; @@ -26386,6 +27678,7 @@ extern JSObject *jsb_cocos2d_ActionInstant_prototype; void js_cocos2d_Hide_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (Hide)", obj); } + void js_register_cocos2dx_Hide(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_Hide_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_Hide_class->name = "Hide"; @@ -26405,6 +27698,7 @@ void js_register_cocos2dx_Hide(JSContext *cx, JS::HandleObject global) { }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_Hide_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -26439,6 +27733,7 @@ void js_register_cocos2dx_Hide(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_ActionInstant_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.Hide.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_ToggleVisibility_class; @@ -26785,6 +28080,21 @@ bool js_cocos2dx_FlipX_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_FlipX_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::FlipX *nobj = new (std::nothrow) cocos2d::FlipX(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::FlipX"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_ActionInstant_prototype; @@ -26792,6 +28102,7 @@ extern JSObject *jsb_cocos2d_ActionInstant_prototype; void js_cocos2d_FlipX_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (FlipX)", obj); } + void js_register_cocos2dx_FlipX(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_FlipX_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_FlipX_class->name = "FlipX"; @@ -26812,6 +28123,7 @@ void js_register_cocos2dx_FlipX(JSContext *cx, JS::HandleObject global) { static JSFunctionSpec funcs[] = { JS_FN("initWithFlipX", js_cocos2dx_FlipX_initWithFlipX, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_FlipX_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -26846,6 +28158,7 @@ void js_register_cocos2dx_FlipX(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_ActionInstant_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.FlipX.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_FlipY_class; @@ -26925,6 +28238,21 @@ bool js_cocos2dx_FlipY_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_FlipY_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::FlipY *nobj = new (std::nothrow) cocos2d::FlipY(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::FlipY"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_ActionInstant_prototype; @@ -26932,6 +28260,7 @@ extern JSObject *jsb_cocos2d_ActionInstant_prototype; void js_cocos2d_FlipY_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (FlipY)", obj); } + void js_register_cocos2dx_FlipY(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_FlipY_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_FlipY_class->name = "FlipY"; @@ -26952,6 +28281,7 @@ void js_register_cocos2dx_FlipY(JSContext *cx, JS::HandleObject global) { static JSFunctionSpec funcs[] = { JS_FN("initWithFlipY", js_cocos2dx_FlipY_initWithFlipY, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_FlipY_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -26986,6 +28316,7 @@ void js_register_cocos2dx_FlipY(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_ActionInstant_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.FlipY.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_Place_class; @@ -27065,6 +28396,21 @@ bool js_cocos2dx_Place_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_Place_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::Place *nobj = new (std::nothrow) cocos2d::Place(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::Place"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_ActionInstant_prototype; @@ -27072,6 +28418,7 @@ extern JSObject *jsb_cocos2d_ActionInstant_prototype; void js_cocos2d_Place_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (Place)", obj); } + void js_register_cocos2dx_Place(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_Place_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_Place_class->name = "Place"; @@ -27092,6 +28439,7 @@ void js_register_cocos2dx_Place(JSContext *cx, JS::HandleObject global) { static JSFunctionSpec funcs[] = { JS_FN("initWithPosition", js_cocos2dx_Place_initWithPosition, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_Place_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -27126,6 +28474,7 @@ void js_register_cocos2dx_Place(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_ActionInstant_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.Place.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_CallFunc_class; @@ -27174,6 +28523,21 @@ bool js_cocos2dx_CallFunc_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_CallFunc_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::CallFunc *nobj = new (std::nothrow) cocos2d::CallFunc(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::CallFunc"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_ActionInstant_prototype; @@ -27181,6 +28545,7 @@ extern JSObject *jsb_cocos2d_ActionInstant_prototype; void js_cocos2d_CallFunc_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (CallFunc)", obj); } + void js_register_cocos2dx_CallFunc(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_CallFunc_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_CallFunc_class->name = "_CallFunc"; @@ -27201,6 +28566,7 @@ void js_register_cocos2dx_CallFunc(JSContext *cx, JS::HandleObject global) { static JSFunctionSpec funcs[] = { JS_FN("execute", js_cocos2dx_CallFunc_execute, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_CallFunc_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -27232,6 +28598,7 @@ void js_register_cocos2dx_CallFunc(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_ActionInstant_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc._CallFunc.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_CallFuncN_class; @@ -27264,6 +28631,21 @@ bool js_cocos2dx_CallFuncN_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_CallFuncN_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::CallFuncN *nobj = new (std::nothrow) cocos2d::CallFuncN(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::CallFuncN"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_CallFunc_prototype; @@ -27271,6 +28653,7 @@ extern JSObject *jsb_cocos2d_CallFunc_prototype; void js_cocos2d_CallFuncN_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (CallFuncN)", obj); } + void js_register_cocos2dx_CallFuncN(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_CallFuncN_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_CallFuncN_class->name = "CallFunc"; @@ -27290,6 +28673,7 @@ void js_register_cocos2dx_CallFuncN(JSContext *cx, JS::HandleObject global) { }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_CallFuncN_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -27321,6 +28705,7 @@ void js_register_cocos2dx_CallFuncN(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_CallFunc_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.CallFunc.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_GridAction_class; @@ -27360,7 +28745,7 @@ bool js_cocos2dx_GridAction_initWithDuration(JSContext *cx, uint32_t argc, jsval cocos2d::GridAction* cobj = (cocos2d::GridAction *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GridAction_initWithDuration : Invalid Native Object"); if (argc == 2) { - double arg0; + double arg0 = 0; cocos2d::Size arg1; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_ccsize(cx, args.get(1), &arg1); @@ -27701,7 +29086,7 @@ bool js_cocos2dx_ReuseGrid_initWithTimes(JSContext *cx, uint32_t argc, jsval *vp cocos2d::ReuseGrid* cobj = (cocos2d::ReuseGrid *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ReuseGrid_initWithTimes : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ReuseGrid_initWithTimes : Error processing arguments"); bool ret = cobj->initWithTimes(arg0); @@ -27719,7 +29104,7 @@ bool js_cocos2dx_ReuseGrid_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ReuseGrid_create : Error processing arguments"); cocos2d::ReuseGrid* ret = cocos2d::ReuseGrid::create(arg0); @@ -27841,7 +29226,7 @@ bool js_cocos2dx_Waves3D_setAmplitudeRate(JSContext *cx, uint32_t argc, jsval *v cocos2d::Waves3D* cobj = (cocos2d::Waves3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Waves3D_setAmplitudeRate : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Waves3D_setAmplitudeRate : Error processing arguments"); cobj->setAmplitudeRate(arg0); @@ -27861,10 +29246,10 @@ bool js_cocos2dx_Waves3D_initWithDuration(JSContext *cx, uint32_t argc, jsval *v cocos2d::Waves3D* cobj = (cocos2d::Waves3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Waves3D_initWithDuration : Invalid Native Object"); if (argc == 4) { - double arg0; + double arg0 = 0; cocos2d::Size arg1; - unsigned int arg2; - double arg3; + unsigned int arg2 = 0; + double arg3 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_ccsize(cx, args.get(1), &arg1); ok &= jsval_to_uint32(cx, args.get(2), &arg2); @@ -27925,7 +29310,7 @@ bool js_cocos2dx_Waves3D_setAmplitude(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Waves3D* cobj = (cocos2d::Waves3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Waves3D_setAmplitude : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Waves3D_setAmplitude : Error processing arguments"); cobj->setAmplitude(arg0); @@ -27941,10 +29326,10 @@ bool js_cocos2dx_Waves3D_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 4) { - double arg0; + double arg0 = 0; cocos2d::Size arg1; - unsigned int arg2; - double arg3; + unsigned int arg2 = 0; + double arg3 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_ccsize(cx, args.get(1), &arg1); ok &= jsval_to_uint32(cx, args.get(2), &arg2); @@ -28074,7 +29459,7 @@ bool js_cocos2dx_FlipX3D_initWithSize(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FlipX3D_initWithSize : Invalid Native Object"); if (argc == 2) { cocos2d::Size arg0; - double arg1; + double arg1 = 0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FlipX3D_initWithSize : Error processing arguments"); @@ -28097,7 +29482,7 @@ bool js_cocos2dx_FlipX3D_initWithDuration(JSContext *cx, uint32_t argc, jsval *v cocos2d::FlipX3D* cobj = (cocos2d::FlipX3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FlipX3D_initWithDuration : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FlipX3D_initWithDuration : Error processing arguments"); bool ret = cobj->initWithDuration(arg0); @@ -28115,7 +29500,7 @@ bool js_cocos2dx_FlipX3D_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FlipX3D_create : Error processing arguments"); cocos2d::FlipX3D* ret = cocos2d::FlipX3D::create(arg0); @@ -28162,6 +29547,21 @@ bool js_cocos2dx_FlipX3D_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_FlipX3D_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::FlipX3D *nobj = new (std::nothrow) cocos2d::FlipX3D(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::FlipX3D"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_Grid3DAction_prototype; @@ -28169,6 +29569,7 @@ extern JSObject *jsb_cocos2d_Grid3DAction_prototype; void js_cocos2d_FlipX3D_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (FlipX3D)", obj); } + void js_register_cocos2dx_FlipX3D(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_FlipX3D_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_FlipX3D_class->name = "FlipX3D"; @@ -28190,6 +29591,7 @@ void js_register_cocos2dx_FlipX3D(JSContext *cx, JS::HandleObject global) { static JSFunctionSpec funcs[] = { JS_FN("initWithSize", js_cocos2dx_FlipX3D_initWithSize, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("initWithDuration", js_cocos2dx_FlipX3D_initWithDuration, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_FlipX3D_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -28224,6 +29626,7 @@ void js_register_cocos2dx_FlipX3D(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_Grid3DAction_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.FlipX3D.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_FlipY3D_class; @@ -28234,7 +29637,7 @@ bool js_cocos2dx_FlipY3D_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FlipY3D_create : Error processing arguments"); cocos2d::FlipY3D* ret = cocos2d::FlipY3D::create(arg0); @@ -28281,6 +29684,21 @@ bool js_cocos2dx_FlipY3D_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_FlipY3D_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::FlipY3D *nobj = new (std::nothrow) cocos2d::FlipY3D(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::FlipY3D"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_FlipX3D_prototype; @@ -28288,6 +29706,7 @@ extern JSObject *jsb_cocos2d_FlipX3D_prototype; void js_cocos2d_FlipY3D_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (FlipY3D)", obj); } + void js_register_cocos2dx_FlipY3D(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_FlipY3D_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_FlipY3D_class->name = "FlipY3D"; @@ -28307,6 +29726,7 @@ void js_register_cocos2dx_FlipY3D(JSContext *cx, JS::HandleObject global) { }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_FlipY3D_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -28341,6 +29761,7 @@ void js_register_cocos2dx_FlipY3D(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_FlipX3D_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.FlipY3D.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_Lens3D_class; @@ -28375,10 +29796,10 @@ bool js_cocos2dx_Lens3D_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp cocos2d::Lens3D* cobj = (cocos2d::Lens3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Lens3D_initWithDuration : Invalid Native Object"); if (argc == 4) { - double arg0; + double arg0 = 0; cocos2d::Size arg1; cocos2d::Vec2 arg2; - double arg3; + double arg3 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_ccsize(cx, args.get(1), &arg1); ok &= jsval_to_vector2(cx, args.get(2), &arg2); @@ -28403,7 +29824,7 @@ bool js_cocos2dx_Lens3D_setLensEffect(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Lens3D* cobj = (cocos2d::Lens3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Lens3D_setLensEffect : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Lens3D_setLensEffect : Error processing arguments"); cobj->setLensEffect(arg0); @@ -28475,10 +29896,10 @@ bool js_cocos2dx_Lens3D_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 4) { - double arg0; + double arg0 = 0; cocos2d::Size arg1; cocos2d::Vec2 arg2; - double arg3; + double arg3 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_ccsize(cx, args.get(1), &arg1); ok &= jsval_to_vector2(cx, args.get(2), &arg2); @@ -28608,7 +30029,7 @@ bool js_cocos2dx_Ripple3D_setAmplitudeRate(JSContext *cx, uint32_t argc, jsval * cocos2d::Ripple3D* cobj = (cocos2d::Ripple3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Ripple3D_setAmplitudeRate : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Ripple3D_setAmplitudeRate : Error processing arguments"); cobj->setAmplitudeRate(arg0); @@ -28628,12 +30049,12 @@ bool js_cocos2dx_Ripple3D_initWithDuration(JSContext *cx, uint32_t argc, jsval * cocos2d::Ripple3D* cobj = (cocos2d::Ripple3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Ripple3D_initWithDuration : Invalid Native Object"); if (argc == 6) { - double arg0; + double arg0 = 0; cocos2d::Size arg1; cocos2d::Vec2 arg2; - double arg3; - unsigned int arg4; - double arg5; + double arg3 = 0; + unsigned int arg4 = 0; + double arg5 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_ccsize(cx, args.get(1), &arg1); ok &= jsval_to_vector2(cx, args.get(2), &arg2); @@ -28678,7 +30099,7 @@ bool js_cocos2dx_Ripple3D_setAmplitude(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Ripple3D* cobj = (cocos2d::Ripple3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Ripple3D_setAmplitude : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Ripple3D_setAmplitude : Error processing arguments"); cobj->setAmplitude(arg0); @@ -28750,12 +30171,12 @@ bool js_cocos2dx_Ripple3D_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 6) { - double arg0; + double arg0 = 0; cocos2d::Size arg1; cocos2d::Vec2 arg2; - double arg3; - unsigned int arg4; - double arg5; + double arg3 = 0; + unsigned int arg4 = 0; + double arg5 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_ccsize(cx, args.get(1), &arg1); ok &= jsval_to_vector2(cx, args.get(2), &arg2); @@ -28888,9 +30309,9 @@ bool js_cocos2dx_Shaky3D_initWithDuration(JSContext *cx, uint32_t argc, jsval *v cocos2d::Shaky3D* cobj = (cocos2d::Shaky3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Shaky3D_initWithDuration : Invalid Native Object"); if (argc == 4) { - double arg0; + double arg0 = 0; cocos2d::Size arg1; - int arg2; + int arg2 = 0; bool arg3; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_ccsize(cx, args.get(1), &arg1); @@ -28912,9 +30333,9 @@ bool js_cocos2dx_Shaky3D_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 4) { - double arg0; + double arg0 = 0; cocos2d::Size arg1; - int arg2; + int arg2 = 0; bool arg3; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_ccsize(cx, args.get(1), &arg1); @@ -29040,7 +30461,7 @@ bool js_cocos2dx_Liquid_setAmplitudeRate(JSContext *cx, uint32_t argc, jsval *vp cocos2d::Liquid* cobj = (cocos2d::Liquid *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Liquid_setAmplitudeRate : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Liquid_setAmplitudeRate : Error processing arguments"); cobj->setAmplitudeRate(arg0); @@ -29060,10 +30481,10 @@ bool js_cocos2dx_Liquid_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp cocos2d::Liquid* cobj = (cocos2d::Liquid *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Liquid_initWithDuration : Invalid Native Object"); if (argc == 4) { - double arg0; + double arg0 = 0; cocos2d::Size arg1; - unsigned int arg2; - double arg3; + unsigned int arg2 = 0; + double arg3 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_ccsize(cx, args.get(1), &arg1); ok &= jsval_to_uint32(cx, args.get(2), &arg2); @@ -29124,7 +30545,7 @@ bool js_cocos2dx_Liquid_setAmplitude(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Liquid* cobj = (cocos2d::Liquid *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Liquid_setAmplitude : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Liquid_setAmplitude : Error processing arguments"); cobj->setAmplitude(arg0); @@ -29140,10 +30561,10 @@ bool js_cocos2dx_Liquid_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 4) { - double arg0; + double arg0 = 0; cocos2d::Size arg1; - unsigned int arg2; - double arg3; + unsigned int arg2 = 0; + double arg3 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_ccsize(cx, args.get(1), &arg1); ok &= jsval_to_uint32(cx, args.get(2), &arg2); @@ -29272,7 +30693,7 @@ bool js_cocos2dx_Waves_setAmplitudeRate(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Waves* cobj = (cocos2d::Waves *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Waves_setAmplitudeRate : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Waves_setAmplitudeRate : Error processing arguments"); cobj->setAmplitudeRate(arg0); @@ -29292,10 +30713,10 @@ bool js_cocos2dx_Waves_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Waves* cobj = (cocos2d::Waves *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Waves_initWithDuration : Invalid Native Object"); if (argc == 6) { - double arg0; + double arg0 = 0; cocos2d::Size arg1; - unsigned int arg2; - double arg3; + unsigned int arg2 = 0; + double arg3 = 0; bool arg4; bool arg5; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); @@ -29360,7 +30781,7 @@ bool js_cocos2dx_Waves_setAmplitude(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Waves* cobj = (cocos2d::Waves *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Waves_setAmplitude : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Waves_setAmplitude : Error processing arguments"); cobj->setAmplitude(arg0); @@ -29376,10 +30797,10 @@ bool js_cocos2dx_Waves_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 6) { - double arg0; + double arg0 = 0; cocos2d::Size arg1; - unsigned int arg2; - double arg3; + unsigned int arg2 = 0; + double arg3 = 0; bool arg4; bool arg5; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); @@ -29512,7 +30933,7 @@ bool js_cocos2dx_Twirl_setAmplitudeRate(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Twirl* cobj = (cocos2d::Twirl *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Twirl_setAmplitudeRate : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Twirl_setAmplitudeRate : Error processing arguments"); cobj->setAmplitudeRate(arg0); @@ -29532,11 +30953,11 @@ bool js_cocos2dx_Twirl_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Twirl* cobj = (cocos2d::Twirl *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Twirl_initWithDuration : Invalid Native Object"); if (argc == 5) { - double arg0; + double arg0 = 0; cocos2d::Size arg1; cocos2d::Vec2 arg2; - unsigned int arg3; - double arg4; + unsigned int arg3 = 0; + double arg4 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_ccsize(cx, args.get(1), &arg1); ok &= jsval_to_vector2(cx, args.get(2), &arg2); @@ -29580,7 +31001,7 @@ bool js_cocos2dx_Twirl_setAmplitude(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Twirl* cobj = (cocos2d::Twirl *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Twirl_setAmplitude : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Twirl_setAmplitude : Error processing arguments"); cobj->setAmplitude(arg0); @@ -29652,11 +31073,11 @@ bool js_cocos2dx_Twirl_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 5) { - double arg0; + double arg0 = 0; cocos2d::Size arg1; cocos2d::Vec2 arg2; - unsigned int arg3; - double arg4; + unsigned int arg3 = 0; + double arg4 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_ccsize(cx, args.get(1), &arg1); ok &= jsval_to_vector2(cx, args.get(2), &arg2); @@ -29788,8 +31209,8 @@ bool js_cocos2dx_ActionManager_getActionByTag(JSContext *cx, uint32_t argc, jsva cocos2d::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_getActionByTag : Invalid Native Object"); if (argc == 2) { - int arg0; - const cocos2d::Node* arg1; + int arg0 = 0; + const cocos2d::Node* arg1 = nullptr; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -29827,8 +31248,8 @@ bool js_cocos2dx_ActionManager_removeActionByTag(JSContext *cx, uint32_t argc, j cocos2d::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_removeActionByTag : Invalid Native Object"); if (argc == 2) { - int arg0; - cocos2d::Node* arg1; + int arg0 = 0; + cocos2d::Node* arg1 = nullptr; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -29857,8 +31278,8 @@ bool js_cocos2dx_ActionManager_removeActionsByFlags(JSContext *cx, uint32_t argc cocos2d::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_removeActionsByFlags : Invalid Native Object"); if (argc == 2) { - unsigned int arg0; - cocos2d::Node* arg1; + unsigned int arg0 = 0; + cocos2d::Node* arg1 = nullptr; ok &= jsval_to_uint32(cx, args.get(0), &arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -29903,8 +31324,8 @@ bool js_cocos2dx_ActionManager_addAction(JSContext *cx, uint32_t argc, jsval *vp cocos2d::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_addAction : Invalid Native Object"); if (argc == 3) { - cocos2d::Action* arg0; - cocos2d::Node* arg1; + cocos2d::Action* arg0 = nullptr; + cocos2d::Node* arg1 = nullptr; bool arg2; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -29943,7 +31364,7 @@ bool js_cocos2dx_ActionManager_resumeTarget(JSContext *cx, uint32_t argc, jsval cocos2d::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_resumeTarget : Invalid Native Object"); if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -29971,7 +31392,7 @@ bool js_cocos2dx_ActionManager_update(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_update : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ActionManager_update : Error processing arguments"); cobj->update(arg0); @@ -29991,7 +31412,7 @@ bool js_cocos2dx_ActionManager_pauseTarget(JSContext *cx, uint32_t argc, jsval * cocos2d::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_pauseTarget : Invalid Native Object"); if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -30019,7 +31440,7 @@ bool js_cocos2dx_ActionManager_getNumberOfRunningActionsInTarget(JSContext *cx, cocos2d::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_getNumberOfRunningActionsInTarget : Invalid Native Object"); if (argc == 1) { - const cocos2d::Node* arg0; + const cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -30049,7 +31470,7 @@ bool js_cocos2dx_ActionManager_removeAllActionsFromTarget(JSContext *cx, uint32_ cocos2d::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_removeAllActionsFromTarget : Invalid Native Object"); if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -30097,7 +31518,7 @@ bool js_cocos2dx_ActionManager_removeAction(JSContext *cx, uint32_t argc, jsval cocos2d::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_removeAction : Invalid Native Object"); if (argc == 1) { - cocos2d::Action* arg0; + cocos2d::Action* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -30125,8 +31546,8 @@ bool js_cocos2dx_ActionManager_removeAllActionsByTag(JSContext *cx, uint32_t arg cocos2d::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_removeAllActionsByTag : Invalid Native Object"); if (argc == 2) { - int arg0; - cocos2d::Node* arg1; + int arg0 = 0; + cocos2d::Node* arg1 = nullptr; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -30288,7 +31709,7 @@ bool js_cocos2dx_PageTurn3D_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; + double arg0 = 0; cocos2d::Size arg1; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_ccsize(cx, args.get(1), &arg1); @@ -30383,8 +31804,8 @@ bool js_cocos2dx_ProgressTo_initWithDuration(JSContext *cx, uint32_t argc, jsval cocos2d::ProgressTo* cobj = (cocos2d::ProgressTo *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ProgressTo_initWithDuration : Invalid Native Object"); if (argc == 2) { - double arg0; - double arg1; + double arg0 = 0; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ProgressTo_initWithDuration : Error processing arguments"); @@ -30403,8 +31824,8 @@ bool js_cocos2dx_ProgressTo_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; - double arg1; + double arg0 = 0; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ProgressTo_create : Error processing arguments"); @@ -30452,6 +31873,21 @@ bool js_cocos2dx_ProgressTo_constructor(JSContext *cx, uint32_t argc, jsval *vp) if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_ProgressTo_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::ProgressTo *nobj = new (std::nothrow) cocos2d::ProgressTo(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::ProgressTo"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_ActionInterval_prototype; @@ -30459,6 +31895,7 @@ extern JSObject *jsb_cocos2d_ActionInterval_prototype; void js_cocos2d_ProgressTo_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (ProgressTo)", obj); } + void js_register_cocos2dx_ProgressTo(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_ProgressTo_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_ProgressTo_class->name = "ProgressTo"; @@ -30479,6 +31916,7 @@ void js_register_cocos2dx_ProgressTo(JSContext *cx, JS::HandleObject global) { static JSFunctionSpec funcs[] = { JS_FN("initWithDuration", js_cocos2dx_ProgressTo_initWithDuration, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_ProgressTo_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -30513,6 +31951,7 @@ void js_register_cocos2dx_ProgressTo(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_ActionInterval_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.ProgressTo.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_ProgressFromTo_class; @@ -30527,9 +31966,9 @@ bool js_cocos2dx_ProgressFromTo_initWithDuration(JSContext *cx, uint32_t argc, j cocos2d::ProgressFromTo* cobj = (cocos2d::ProgressFromTo *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ProgressFromTo_initWithDuration : Invalid Native Object"); if (argc == 3) { - double arg0; - double arg1; - double arg2; + double arg0 = 0; + double arg1 = 0; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -30549,9 +31988,9 @@ bool js_cocos2dx_ProgressFromTo_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 3) { - double arg0; - double arg1; - double arg2; + double arg0 = 0; + double arg1 = 0; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -30600,6 +32039,21 @@ bool js_cocos2dx_ProgressFromTo_constructor(JSContext *cx, uint32_t argc, jsval if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_ProgressFromTo_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::ProgressFromTo *nobj = new (std::nothrow) cocos2d::ProgressFromTo(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::ProgressFromTo"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_ActionInterval_prototype; @@ -30607,6 +32061,7 @@ extern JSObject *jsb_cocos2d_ActionInterval_prototype; void js_cocos2d_ProgressFromTo_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (ProgressFromTo)", obj); } + void js_register_cocos2dx_ProgressFromTo(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_ProgressFromTo_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_ProgressFromTo_class->name = "ProgressFromTo"; @@ -30627,6 +32082,7 @@ void js_register_cocos2dx_ProgressFromTo(JSContext *cx, JS::HandleObject global) static JSFunctionSpec funcs[] = { JS_FN("initWithDuration", js_cocos2dx_ProgressFromTo_initWithDuration, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_ProgressFromTo_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -30661,6 +32117,7 @@ void js_register_cocos2dx_ProgressFromTo(JSContext *cx, JS::HandleObject global) p->parentProto = jsb_cocos2d_ActionInterval_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.ProgressFromTo.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_ShakyTiles3D_class; @@ -30675,9 +32132,9 @@ bool js_cocos2dx_ShakyTiles3D_initWithDuration(JSContext *cx, uint32_t argc, jsv cocos2d::ShakyTiles3D* cobj = (cocos2d::ShakyTiles3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ShakyTiles3D_initWithDuration : Invalid Native Object"); if (argc == 4) { - double arg0; + double arg0 = 0; cocos2d::Size arg1; - int arg2; + int arg2 = 0; bool arg3; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_ccsize(cx, args.get(1), &arg1); @@ -30699,9 +32156,9 @@ bool js_cocos2dx_ShakyTiles3D_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 4) { - double arg0; + double arg0 = 0; cocos2d::Size arg1; - int arg2; + int arg2 = 0; bool arg3; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_ccsize(cx, args.get(1), &arg1); @@ -30827,9 +32284,9 @@ bool js_cocos2dx_ShatteredTiles3D_initWithDuration(JSContext *cx, uint32_t argc, cocos2d::ShatteredTiles3D* cobj = (cocos2d::ShatteredTiles3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ShatteredTiles3D_initWithDuration : Invalid Native Object"); if (argc == 4) { - double arg0; + double arg0 = 0; cocos2d::Size arg1; - int arg2; + int arg2 = 0; bool arg3; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_ccsize(cx, args.get(1), &arg1); @@ -30851,9 +32308,9 @@ bool js_cocos2dx_ShatteredTiles3D_create(JSContext *cx, uint32_t argc, jsval *vp JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 4) { - double arg0; + double arg0 = 0; cocos2d::Size arg1; - int arg2; + int arg2 = 0; bool arg3; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_ccsize(cx, args.get(1), &arg1); @@ -30980,7 +32437,7 @@ bool js_cocos2dx_ShuffleTiles_placeTile(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ShuffleTiles_placeTile : Invalid Native Object"); if (argc == 2) { cocos2d::Vec2 arg0; - cocos2d::Tile* arg1; + cocos2d::Tile* arg1 = nullptr; ok &= jsval_to_vector2(cx, args.get(0), &arg0); #pragma warning NO CONVERSION TO NATIVE FOR Tile* ok = false; @@ -31002,8 +32459,8 @@ bool js_cocos2dx_ShuffleTiles_shuffle(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::ShuffleTiles* cobj = (cocos2d::ShuffleTiles *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ShuffleTiles_shuffle : Invalid Native Object"); if (argc == 2) { - unsigned int* arg0; - unsigned int arg1; + unsigned int* arg0 = 0; + unsigned int arg1 = 0; #pragma warning NO CONVERSION TO NATIVE FOR unsigned int* ok = false; ok &= jsval_to_uint32(cx, args.get(1), &arg1); @@ -31025,9 +32482,9 @@ bool js_cocos2dx_ShuffleTiles_initWithDuration(JSContext *cx, uint32_t argc, jsv cocos2d::ShuffleTiles* cobj = (cocos2d::ShuffleTiles *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ShuffleTiles_initWithDuration : Invalid Native Object"); if (argc == 3) { - double arg0; + double arg0 = 0; cocos2d::Size arg1; - unsigned int arg2; + unsigned int arg2 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_ccsize(cx, args.get(1), &arg1); ok &= jsval_to_uint32(cx, args.get(2), &arg2); @@ -31069,9 +32526,9 @@ bool js_cocos2dx_ShuffleTiles_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 3) { - double arg0; + double arg0 = 0; cocos2d::Size arg1; - unsigned int arg2; + unsigned int arg2 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_ccsize(cx, args.get(1), &arg1); ok &= jsval_to_uint32(cx, args.get(2), &arg2); @@ -31239,7 +32696,7 @@ bool js_cocos2dx_FadeOutTRTiles_transformTile(JSContext *cx, uint32_t argc, jsva JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FadeOutTRTiles_transformTile : Invalid Native Object"); if (argc == 2) { cocos2d::Vec2 arg0; - double arg1; + double arg1 = 0; ok &= jsval_to_vector2(cx, args.get(0), &arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FadeOutTRTiles_transformTile : Error processing arguments"); @@ -31261,7 +32718,7 @@ bool js_cocos2dx_FadeOutTRTiles_testFunc(JSContext *cx, uint32_t argc, jsval *vp JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FadeOutTRTiles_testFunc : Invalid Native Object"); if (argc == 2) { cocos2d::Size arg0; - double arg1; + double arg1 = 0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FadeOutTRTiles_testFunc : Error processing arguments"); @@ -31280,7 +32737,7 @@ bool js_cocos2dx_FadeOutTRTiles_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; + double arg0 = 0; cocos2d::Size arg1; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_ccsize(cx, args.get(1), &arg1); @@ -31329,6 +32786,21 @@ bool js_cocos2dx_FadeOutTRTiles_constructor(JSContext *cx, uint32_t argc, jsval if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_FadeOutTRTiles_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::FadeOutTRTiles *nobj = new (std::nothrow) cocos2d::FadeOutTRTiles(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::FadeOutTRTiles"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_TiledGrid3DAction_prototype; @@ -31336,6 +32808,7 @@ extern JSObject *jsb_cocos2d_TiledGrid3DAction_prototype; void js_cocos2d_FadeOutTRTiles_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (FadeOutTRTiles)", obj); } + void js_register_cocos2dx_FadeOutTRTiles(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_FadeOutTRTiles_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_FadeOutTRTiles_class->name = "FadeOutTRTiles"; @@ -31359,6 +32832,7 @@ void js_register_cocos2dx_FadeOutTRTiles(JSContext *cx, JS::HandleObject global) JS_FN("turnOffTile", js_cocos2dx_FadeOutTRTiles_turnOffTile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("transformTile", js_cocos2dx_FadeOutTRTiles_transformTile, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("testFunc", js_cocos2dx_FadeOutTRTiles_testFunc, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_FadeOutTRTiles_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -31393,6 +32867,7 @@ void js_register_cocos2dx_FadeOutTRTiles(JSContext *cx, JS::HandleObject global) p->parentProto = jsb_cocos2d_TiledGrid3DAction_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.FadeOutTRTiles.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_FadeOutBLTiles_class; @@ -31403,7 +32878,7 @@ bool js_cocos2dx_FadeOutBLTiles_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; + double arg0 = 0; cocos2d::Size arg1; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_ccsize(cx, args.get(1), &arg1); @@ -31452,6 +32927,21 @@ bool js_cocos2dx_FadeOutBLTiles_constructor(JSContext *cx, uint32_t argc, jsval if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_FadeOutBLTiles_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::FadeOutBLTiles *nobj = new (std::nothrow) cocos2d::FadeOutBLTiles(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::FadeOutBLTiles"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_FadeOutTRTiles_prototype; @@ -31459,6 +32949,7 @@ extern JSObject *jsb_cocos2d_FadeOutTRTiles_prototype; void js_cocos2d_FadeOutBLTiles_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (FadeOutBLTiles)", obj); } + void js_register_cocos2dx_FadeOutBLTiles(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_FadeOutBLTiles_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_FadeOutBLTiles_class->name = "FadeOutBLTiles"; @@ -31478,6 +32969,7 @@ void js_register_cocos2dx_FadeOutBLTiles(JSContext *cx, JS::HandleObject global) }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_FadeOutBLTiles_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -31512,6 +33004,7 @@ void js_register_cocos2dx_FadeOutBLTiles(JSContext *cx, JS::HandleObject global) p->parentProto = jsb_cocos2d_FadeOutTRTiles_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.FadeOutBLTiles.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_FadeOutUpTiles_class; @@ -31522,7 +33015,7 @@ bool js_cocos2dx_FadeOutUpTiles_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; + double arg0 = 0; cocos2d::Size arg1; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_ccsize(cx, args.get(1), &arg1); @@ -31571,6 +33064,21 @@ bool js_cocos2dx_FadeOutUpTiles_constructor(JSContext *cx, uint32_t argc, jsval if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_FadeOutUpTiles_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::FadeOutUpTiles *nobj = new (std::nothrow) cocos2d::FadeOutUpTiles(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::FadeOutUpTiles"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_FadeOutTRTiles_prototype; @@ -31578,6 +33086,7 @@ extern JSObject *jsb_cocos2d_FadeOutTRTiles_prototype; void js_cocos2d_FadeOutUpTiles_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (FadeOutUpTiles)", obj); } + void js_register_cocos2dx_FadeOutUpTiles(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_FadeOutUpTiles_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_FadeOutUpTiles_class->name = "FadeOutUpTiles"; @@ -31597,6 +33106,7 @@ void js_register_cocos2dx_FadeOutUpTiles(JSContext *cx, JS::HandleObject global) }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_FadeOutUpTiles_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -31631,6 +33141,7 @@ void js_register_cocos2dx_FadeOutUpTiles(JSContext *cx, JS::HandleObject global) p->parentProto = jsb_cocos2d_FadeOutTRTiles_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.FadeOutUpTiles.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_FadeOutDownTiles_class; @@ -31641,7 +33152,7 @@ bool js_cocos2dx_FadeOutDownTiles_create(JSContext *cx, uint32_t argc, jsval *vp JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; + double arg0 = 0; cocos2d::Size arg1; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_ccsize(cx, args.get(1), &arg1); @@ -31690,6 +33201,21 @@ bool js_cocos2dx_FadeOutDownTiles_constructor(JSContext *cx, uint32_t argc, jsva if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_FadeOutDownTiles_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::FadeOutDownTiles *nobj = new (std::nothrow) cocos2d::FadeOutDownTiles(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::FadeOutDownTiles"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_FadeOutUpTiles_prototype; @@ -31697,6 +33223,7 @@ extern JSObject *jsb_cocos2d_FadeOutUpTiles_prototype; void js_cocos2d_FadeOutDownTiles_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (FadeOutDownTiles)", obj); } + void js_register_cocos2dx_FadeOutDownTiles(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_FadeOutDownTiles_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_FadeOutDownTiles_class->name = "FadeOutDownTiles"; @@ -31716,6 +33243,7 @@ void js_register_cocos2dx_FadeOutDownTiles(JSContext *cx, JS::HandleObject globa }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_FadeOutDownTiles_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -31750,6 +33278,7 @@ void js_register_cocos2dx_FadeOutDownTiles(JSContext *cx, JS::HandleObject globa p->parentProto = jsb_cocos2d_FadeOutUpTiles_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.FadeOutDownTiles.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_TurnOffTiles_class; @@ -31804,8 +33333,8 @@ bool js_cocos2dx_TurnOffTiles_shuffle(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::TurnOffTiles* cobj = (cocos2d::TurnOffTiles *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TurnOffTiles_shuffle : Invalid Native Object"); if (argc == 2) { - unsigned int* arg0; - unsigned int arg1; + unsigned int* arg0 = 0; + unsigned int arg1 = 0; #pragma warning NO CONVERSION TO NATIVE FOR unsigned int* ok = false; ok &= jsval_to_uint32(cx, args.get(1), &arg1); @@ -31827,9 +33356,9 @@ bool js_cocos2dx_TurnOffTiles_initWithDuration(JSContext *cx, uint32_t argc, jsv cocos2d::TurnOffTiles* cobj = (cocos2d::TurnOffTiles *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TurnOffTiles_initWithDuration : Invalid Native Object"); if (argc == 3) { - double arg0; + double arg0 = 0; cocos2d::Size arg1; - unsigned int arg2; + unsigned int arg2 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_ccsize(cx, args.get(1), &arg1); ok &= jsval_to_uint32(cx, args.get(2), &arg2); @@ -31851,13 +33380,13 @@ bool js_cocos2dx_TurnOffTiles_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 3) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } cocos2d::Size arg1; ok &= jsval_to_ccsize(cx, args.get(1), &arg1); if (!ok) { ok = true; break; } - unsigned int arg2; + unsigned int arg2 = 0; ok &= jsval_to_uint32(cx, args.get(2), &arg2); if (!ok) { ok = true; break; } cocos2d::TurnOffTiles* ret = cocos2d::TurnOffTiles::create(arg0, arg1, arg2); @@ -31877,7 +33406,7 @@ bool js_cocos2dx_TurnOffTiles_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 2) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } cocos2d::Size arg1; @@ -32005,7 +33534,7 @@ bool js_cocos2dx_WavesTiles3D_setAmplitudeRate(JSContext *cx, uint32_t argc, jsv cocos2d::WavesTiles3D* cobj = (cocos2d::WavesTiles3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_WavesTiles3D_setAmplitudeRate : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_WavesTiles3D_setAmplitudeRate : Error processing arguments"); cobj->setAmplitudeRate(arg0); @@ -32025,10 +33554,10 @@ bool js_cocos2dx_WavesTiles3D_initWithDuration(JSContext *cx, uint32_t argc, jsv cocos2d::WavesTiles3D* cobj = (cocos2d::WavesTiles3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_WavesTiles3D_initWithDuration : Invalid Native Object"); if (argc == 4) { - double arg0; + double arg0 = 0; cocos2d::Size arg1; - unsigned int arg2; - double arg3; + unsigned int arg2 = 0; + double arg3 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_ccsize(cx, args.get(1), &arg1); ok &= jsval_to_uint32(cx, args.get(2), &arg2); @@ -32089,7 +33618,7 @@ bool js_cocos2dx_WavesTiles3D_setAmplitude(JSContext *cx, uint32_t argc, jsval * cocos2d::WavesTiles3D* cobj = (cocos2d::WavesTiles3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_WavesTiles3D_setAmplitude : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_WavesTiles3D_setAmplitude : Error processing arguments"); cobj->setAmplitude(arg0); @@ -32105,10 +33634,10 @@ bool js_cocos2dx_WavesTiles3D_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 4) { - double arg0; + double arg0 = 0; cocos2d::Size arg1; - unsigned int arg2; - double arg3; + unsigned int arg2 = 0; + double arg3 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_ccsize(cx, args.get(1), &arg1); ok &= jsval_to_uint32(cx, args.get(2), &arg2); @@ -32237,7 +33766,7 @@ bool js_cocos2dx_JumpTiles3D_setAmplitudeRate(JSContext *cx, uint32_t argc, jsva cocos2d::JumpTiles3D* cobj = (cocos2d::JumpTiles3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_JumpTiles3D_setAmplitudeRate : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_JumpTiles3D_setAmplitudeRate : Error processing arguments"); cobj->setAmplitudeRate(arg0); @@ -32257,10 +33786,10 @@ bool js_cocos2dx_JumpTiles3D_initWithDuration(JSContext *cx, uint32_t argc, jsva cocos2d::JumpTiles3D* cobj = (cocos2d::JumpTiles3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_JumpTiles3D_initWithDuration : Invalid Native Object"); if (argc == 4) { - double arg0; + double arg0 = 0; cocos2d::Size arg1; - unsigned int arg2; - double arg3; + unsigned int arg2 = 0; + double arg3 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_ccsize(cx, args.get(1), &arg1); ok &= jsval_to_uint32(cx, args.get(2), &arg2); @@ -32321,7 +33850,7 @@ bool js_cocos2dx_JumpTiles3D_setAmplitude(JSContext *cx, uint32_t argc, jsval *v cocos2d::JumpTiles3D* cobj = (cocos2d::JumpTiles3D *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_JumpTiles3D_setAmplitude : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_JumpTiles3D_setAmplitude : Error processing arguments"); cobj->setAmplitude(arg0); @@ -32337,10 +33866,10 @@ bool js_cocos2dx_JumpTiles3D_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 4) { - double arg0; + double arg0 = 0; cocos2d::Size arg1; - unsigned int arg2; - double arg3; + unsigned int arg2 = 0; + double arg3 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_ccsize(cx, args.get(1), &arg1); ok &= jsval_to_uint32(cx, args.get(2), &arg2); @@ -32390,6 +33919,21 @@ bool js_cocos2dx_JumpTiles3D_constructor(JSContext *cx, uint32_t argc, jsval *vp if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_JumpTiles3D_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::JumpTiles3D *nobj = new (std::nothrow) cocos2d::JumpTiles3D(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::JumpTiles3D"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_TiledGrid3DAction_prototype; @@ -32397,6 +33941,7 @@ extern JSObject *jsb_cocos2d_TiledGrid3DAction_prototype; void js_cocos2d_JumpTiles3D_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (JumpTiles3D)", obj); } + void js_register_cocos2dx_JumpTiles3D(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_JumpTiles3D_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_JumpTiles3D_class->name = "JumpTiles3D"; @@ -32421,6 +33966,7 @@ void js_register_cocos2dx_JumpTiles3D(JSContext *cx, JS::HandleObject global) { JS_FN("getAmplitude", js_cocos2dx_JumpTiles3D_getAmplitude, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getAmplitudeRate", js_cocos2dx_JumpTiles3D_getAmplitudeRate, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setAmplitude", js_cocos2dx_JumpTiles3D_setAmplitude, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_JumpTiles3D_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -32455,6 +34001,7 @@ void js_register_cocos2dx_JumpTiles3D(JSContext *cx, JS::HandleObject global) { p->parentProto = jsb_cocos2d_TiledGrid3DAction_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.JumpTiles3D.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_SplitRows_class; @@ -32469,8 +34016,8 @@ bool js_cocos2dx_SplitRows_initWithDuration(JSContext *cx, uint32_t argc, jsval cocos2d::SplitRows* cobj = (cocos2d::SplitRows *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SplitRows_initWithDuration : Invalid Native Object"); if (argc == 2) { - double arg0; - unsigned int arg1; + double arg0 = 0; + unsigned int arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_uint32(cx, args.get(1), &arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SplitRows_initWithDuration : Error processing arguments"); @@ -32489,8 +34036,8 @@ bool js_cocos2dx_SplitRows_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; - unsigned int arg1; + double arg0 = 0; + unsigned int arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_uint32(cx, args.get(1), &arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SplitRows_create : Error processing arguments"); @@ -32613,8 +34160,8 @@ bool js_cocos2dx_SplitCols_initWithDuration(JSContext *cx, uint32_t argc, jsval cocos2d::SplitCols* cobj = (cocos2d::SplitCols *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SplitCols_initWithDuration : Invalid Native Object"); if (argc == 2) { - double arg0; - unsigned int arg1; + double arg0 = 0; + unsigned int arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_uint32(cx, args.get(1), &arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SplitCols_initWithDuration : Error processing arguments"); @@ -32633,8 +34180,8 @@ bool js_cocos2dx_SplitCols_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; - unsigned int arg1; + double arg0 = 0; + unsigned int arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_uint32(cx, args.get(1), &arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SplitCols_create : Error processing arguments"); @@ -32757,10 +34304,10 @@ bool js_cocos2dx_ActionTween_initWithDuration(JSContext *cx, uint32_t argc, jsva cocos2d::ActionTween* cobj = (cocos2d::ActionTween *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionTween_initWithDuration : Invalid Native Object"); if (argc == 4) { - double arg0; + double arg0 = 0; std::string arg1; - double arg2; - double arg3; + double arg2 = 0; + double arg3 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_std_string(cx, args.get(1), &arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -32781,10 +34328,10 @@ bool js_cocos2dx_ActionTween_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 4) { - double arg0; + double arg0 = 0; std::string arg1; - double arg2; - double arg3; + double arg2 = 0; + double arg3 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_std_string(cx, args.get(1), &arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -32886,7 +34433,7 @@ bool js_cocos2dx_GLProgramState_setUniformCallback(JSContext *cx, uint32_t argc, JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_setUniformCallback : Invalid Native Object"); do { if (argc == 2) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); if (!ok) { ok = true; break; } std::function arg1; @@ -32905,14 +34452,7 @@ bool js_cocos2dx_GLProgramState_setUniformCallback(JSContext *cx, uint32_t argc, largv[0] = JSVAL_NULL; } } while (0); - do { - if (larg1) { - js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::Uniform*)larg1); - largv[1] = OBJECT_TO_JSVAL(jsProxy->obj); - } else { - largv[1] = JSVAL_NULL; - } - } while (0); + largv[1] = uniform_to_jsval(cx, larg1); JS::RootedValue rval(cx); bool succeed = func->invoke(2, &largv[0], &rval); if (!succeed && JS_IsExceptionPending(cx)) { @@ -32955,14 +34495,7 @@ bool js_cocos2dx_GLProgramState_setUniformCallback(JSContext *cx, uint32_t argc, largv[0] = JSVAL_NULL; } } while (0); - do { - if (larg1) { - js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::Uniform*)larg1); - largv[1] = OBJECT_TO_JSVAL(jsProxy->obj); - } else { - largv[1] = JSVAL_NULL; - } - } while (0); + largv[1] = uniform_to_jsval(cx, larg1); JS::RootedValue rval(cx); bool succeed = func->invoke(2, &largv[0], &rval); if (!succeed && JS_IsExceptionPending(cx)) { @@ -33040,7 +34573,7 @@ bool js_cocos2dx_GLProgramState_setUniformVec2(JSContext *cx, uint32_t argc, jsv JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_setUniformVec2 : Invalid Native Object"); do { if (argc == 2) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); if (!ok) { ok = true; break; } cocos2d::Vec2 arg1; @@ -33082,7 +34615,7 @@ bool js_cocos2dx_GLProgramState_setUniformVec3(JSContext *cx, uint32_t argc, jsv JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_setUniformVec3 : Invalid Native Object"); do { if (argc == 2) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); if (!ok) { ok = true; break; } cocos2d::Vec3 arg1; @@ -33235,7 +34768,7 @@ bool js_cocos2dx_GLProgramState_setNodeBinding(JSContext *cx, uint32_t argc, jsv cocos2d::GLProgramState* cobj = (cocos2d::GLProgramState *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_setNodeBinding : Invalid Native Object"); if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -33267,10 +34800,10 @@ bool js_cocos2dx_GLProgramState_setUniformInt(JSContext *cx, uint32_t argc, jsva JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_setUniformInt : Invalid Native Object"); do { if (argc == 2) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); if (!ok) { ok = true; break; } - int arg1; + int arg1 = 0; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); if (!ok) { ok = true; break; } cobj->setUniformInt(arg0, arg1); @@ -33284,7 +34817,7 @@ bool js_cocos2dx_GLProgramState_setUniformInt(JSContext *cx, uint32_t argc, jsva std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - int arg1; + int arg1 = 0; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); if (!ok) { ok = true; break; } cobj->setUniformInt(arg0, arg1); @@ -33331,13 +34864,13 @@ bool js_cocos2dx_GLProgramState_setUniformVec2v(JSContext *cx, uint32_t argc, js JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_setUniformVec2v : Invalid Native Object"); do { if (argc == 3) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); if (!ok) { ok = true; break; } - ssize_t arg1; + ssize_t arg1 = 0; ok &= jsval_to_ssize(cx, args.get(1), &arg1); if (!ok) { ok = true; break; } - const cocos2d::Vec2* arg2; + const cocos2d::Vec2* arg2 = nullptr; do { if (args.get(2).isNull()) { arg2 = nullptr; break; } if (!args.get(2).isObject()) { ok = false; break; } @@ -33359,10 +34892,10 @@ bool js_cocos2dx_GLProgramState_setUniformVec2v(JSContext *cx, uint32_t argc, js std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - ssize_t arg1; + ssize_t arg1 = 0; ok &= jsval_to_ssize(cx, args.get(1), &arg1); if (!ok) { ok = true; break; } - const cocos2d::Vec2* arg2; + const cocos2d::Vec2* arg2 = nullptr; do { if (args.get(2).isNull()) { arg2 = nullptr; break; } if (!args.get(2).isObject()) { ok = false; break; } @@ -33459,7 +34992,7 @@ bool js_cocos2dx_GLProgramState_setGLProgram(JSContext *cx, uint32_t argc, jsval cocos2d::GLProgramState* cobj = (cocos2d::GLProgramState *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_setGLProgram : Invalid Native Object"); if (argc == 1) { - cocos2d::GLProgram* arg0; + cocos2d::GLProgram* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -33491,13 +35024,13 @@ bool js_cocos2dx_GLProgramState_setUniformFloatv(JSContext *cx, uint32_t argc, j JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_setUniformFloatv : Invalid Native Object"); do { if (argc == 3) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); if (!ok) { ok = true; break; } - ssize_t arg1; + ssize_t arg1 = 0; ok &= jsval_to_ssize(cx, args.get(1), &arg1); if (!ok) { ok = true; break; } - const float* arg2; + const float* arg2 = 0; #pragma warning NO CONVERSION TO NATIVE FOR float* ok = false; if (!ok) { ok = true; break; } @@ -33512,10 +35045,10 @@ bool js_cocos2dx_GLProgramState_setUniformFloatv(JSContext *cx, uint32_t argc, j std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - ssize_t arg1; + ssize_t arg1 = 0; ok &= jsval_to_ssize(cx, args.get(1), &arg1); if (!ok) { ok = true; break; } - const float* arg2; + const float* arg2 = 0; #pragma warning NO CONVERSION TO NATIVE FOR float* ok = false; if (!ok) { ok = true; break; } @@ -33569,7 +35102,7 @@ bool js_cocos2dx_GLProgramState_setUniformTexture(JSContext *cx, uint32_t argc, std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - unsigned int arg1; + unsigned int arg1 = 0; ok &= jsval_to_uint32(cx, args.get(1), &arg1); if (!ok) { ok = true; break; } cobj->setUniformTexture(arg0, arg1); @@ -33583,7 +35116,7 @@ bool js_cocos2dx_GLProgramState_setUniformTexture(JSContext *cx, uint32_t argc, std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - cocos2d::Texture2D* arg1; + cocos2d::Texture2D* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -33602,10 +35135,10 @@ bool js_cocos2dx_GLProgramState_setUniformTexture(JSContext *cx, uint32_t argc, do { if (argc == 2) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); if (!ok) { ok = true; break; } - cocos2d::Texture2D* arg1; + cocos2d::Texture2D* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -33624,10 +35157,10 @@ bool js_cocos2dx_GLProgramState_setUniformTexture(JSContext *cx, uint32_t argc, do { if (argc == 2) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); if (!ok) { ok = true; break; } - unsigned int arg1; + unsigned int arg1 = 0; ok &= jsval_to_uint32(cx, args.get(1), &arg1); if (!ok) { ok = true; break; } cobj->setUniformTexture(arg0, arg1); @@ -33668,10 +35201,10 @@ bool js_cocos2dx_GLProgramState_setUniformFloat(JSContext *cx, uint32_t argc, js JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_setUniformFloat : Invalid Native Object"); do { if (argc == 2) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } cobj->setUniformFloat(arg0, arg1); @@ -33685,7 +35218,7 @@ bool js_cocos2dx_GLProgramState_setUniformFloat(JSContext *cx, uint32_t argc, js std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } cobj->setUniformFloat(arg0, arg1); @@ -33710,7 +35243,7 @@ bool js_cocos2dx_GLProgramState_setUniformMat4(JSContext *cx, uint32_t argc, jsv JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_setUniformMat4 : Invalid Native Object"); do { if (argc == 2) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); if (!ok) { ok = true; break; } cocos2d::Mat4 arg1; @@ -33752,13 +35285,13 @@ bool js_cocos2dx_GLProgramState_setUniformVec3v(JSContext *cx, uint32_t argc, js JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_setUniformVec3v : Invalid Native Object"); do { if (argc == 3) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); if (!ok) { ok = true; break; } - ssize_t arg1; + ssize_t arg1 = 0; ok &= jsval_to_ssize(cx, args.get(1), &arg1); if (!ok) { ok = true; break; } - const cocos2d::Vec3* arg2; + const cocos2d::Vec3* arg2 = nullptr; do { if (args.get(2).isNull()) { arg2 = nullptr; break; } if (!args.get(2).isObject()) { ok = false; break; } @@ -33780,10 +35313,10 @@ bool js_cocos2dx_GLProgramState_setUniformVec3v(JSContext *cx, uint32_t argc, js std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - ssize_t arg1; + ssize_t arg1 = 0; ok &= jsval_to_ssize(cx, args.get(1), &arg1); if (!ok) { ok = true; break; } - const cocos2d::Vec3* arg2; + const cocos2d::Vec3* arg2 = nullptr; do { if (args.get(2).isNull()) { arg2 = nullptr; break; } if (!args.get(2).isObject()) { ok = false; break; } @@ -33826,7 +35359,7 @@ bool js_cocos2dx_GLProgramState_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::GLProgram* arg0; + cocos2d::GLProgram* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -33884,7 +35417,7 @@ bool js_cocos2dx_GLProgramState_getOrCreateWithGLProgram(JSContext *cx, uint32_t JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::GLProgram* arg0; + cocos2d::GLProgram* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -34057,9 +35590,9 @@ bool js_cocos2dx_AtlasNode_initWithTileFile(JSContext *cx, uint32_t argc, jsval JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AtlasNode_initWithTileFile : Invalid Native Object"); if (argc == 4) { std::string arg0; - int arg1; - int arg2; - int arg3; + int arg1 = 0; + int arg2 = 0; + int arg3 = 0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); @@ -34109,7 +35642,7 @@ bool js_cocos2dx_AtlasNode_setTextureAtlas(JSContext *cx, uint32_t argc, jsval * cocos2d::AtlasNode* cobj = (cocos2d::AtlasNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AtlasNode_setTextureAtlas : Invalid Native Object"); if (argc == 1) { - cocos2d::TextureAtlas* arg0; + cocos2d::TextureAtlas* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -34218,7 +35751,7 @@ bool js_cocos2dx_AtlasNode_setTexture(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::AtlasNode* cobj = (cocos2d::AtlasNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AtlasNode_setTexture : Invalid Native Object"); if (argc == 1) { - cocos2d::Texture2D* arg0; + cocos2d::Texture2D* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -34246,10 +35779,10 @@ bool js_cocos2dx_AtlasNode_initWithTexture(JSContext *cx, uint32_t argc, jsval * cocos2d::AtlasNode* cobj = (cocos2d::AtlasNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AtlasNode_initWithTexture : Invalid Native Object"); if (argc == 4) { - cocos2d::Texture2D* arg0; - int arg1; - int arg2; - int arg3; + cocos2d::Texture2D* arg0 = nullptr; + int arg1 = 0; + int arg2 = 0; + int arg3 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -34282,7 +35815,7 @@ bool js_cocos2dx_AtlasNode_setQuadsToDraw(JSContext *cx, uint32_t argc, jsval *v cocos2d::AtlasNode* cobj = (cocos2d::AtlasNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AtlasNode_setQuadsToDraw : Invalid Native Object"); if (argc == 1) { - ssize_t arg0; + ssize_t arg0 = 0; ok &= jsval_to_ssize(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_AtlasNode_setQuadsToDraw : Error processing arguments"); cobj->setQuadsToDraw(arg0); @@ -34299,9 +35832,9 @@ bool js_cocos2dx_AtlasNode_create(JSContext *cx, uint32_t argc, jsval *vp) bool ok = true; if (argc == 4) { std::string arg0; - int arg1; - int arg2; - int arg3; + int arg1 = 0; + int arg2 = 0; + int arg3 = 0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); @@ -34474,7 +36007,7 @@ bool js_cocos2dx_ClippingNode_setStencil(JSContext *cx, uint32_t argc, jsval *vp cocos2d::ClippingNode* cobj = (cocos2d::ClippingNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ClippingNode_setStencil : Invalid Native Object"); if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -34545,7 +36078,7 @@ bool js_cocos2dx_ClippingNode_setAlphaThreshold(JSContext *cx, uint32_t argc, js cocos2d::ClippingNode* cobj = (cocos2d::ClippingNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ClippingNode_setAlphaThreshold : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ClippingNode_setAlphaThreshold : Error processing arguments"); cobj->setAlphaThreshold(arg0); @@ -34581,7 +36114,7 @@ bool js_cocos2dx_ClippingNode_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -34762,7 +36295,7 @@ bool js_cocos2dx_DrawNode_drawPoints(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_drawPoints : Invalid Native Object"); do { if (argc == 4) { - const cocos2d::Vec2* arg0; + const cocos2d::Vec2* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -34773,10 +36306,10 @@ bool js_cocos2dx_DrawNode_drawPoints(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - unsigned int arg1; + unsigned int arg1 = 0; ok &= jsval_to_uint32(cx, args.get(1), &arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } cocos2d::Color4F arg3; @@ -34790,7 +36323,7 @@ bool js_cocos2dx_DrawNode_drawPoints(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 3) { - const cocos2d::Vec2* arg0; + const cocos2d::Vec2* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -34801,7 +36334,7 @@ bool js_cocos2dx_DrawNode_drawPoints(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - unsigned int arg1; + unsigned int arg1 = 0; ok &= jsval_to_uint32(cx, args.get(1), &arg1); if (!ok) { ok = true; break; } cocos2d::Color4F arg2; @@ -34886,13 +36419,13 @@ bool js_cocos2dx_DrawNode_drawSolidCircle(JSContext *cx, uint32_t argc, jsval *v cocos2d::Vec2 arg0; ok &= jsval_to_vector2(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } - unsigned int arg3; + unsigned int arg3 = 0; ok &= jsval_to_uint32(cx, args.get(3), &arg3); if (!ok) { ok = true; break; } cocos2d::Color4F arg4; @@ -34909,19 +36442,19 @@ bool js_cocos2dx_DrawNode_drawSolidCircle(JSContext *cx, uint32_t argc, jsval *v cocos2d::Vec2 arg0; ok &= jsval_to_vector2(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } - unsigned int arg3; + unsigned int arg3 = 0; ok &= jsval_to_uint32(cx, args.get(3), &arg3); if (!ok) { ok = true; break; } - double arg4; + double arg4 = 0; ok &= JS::ToNumber( cx, args.get(4), &arg4) && !isnan(arg4); if (!ok) { ok = true; break; } - double arg5; + double arg5 = 0; ok &= JS::ToNumber( cx, args.get(5), &arg5) && !isnan(arg5); if (!ok) { ok = true; break; } cocos2d::Color4F arg6; @@ -34945,7 +36478,7 @@ bool js_cocos2dx_DrawNode_setLineWidth(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::DrawNode* cobj = (cocos2d::DrawNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_setLineWidth : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_DrawNode_setLineWidth : Error processing arguments"); cobj->setLineWidth(arg0); @@ -34966,7 +36499,7 @@ bool js_cocos2dx_DrawNode_onDrawGLPoint(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_onDrawGLPoint : Invalid Native Object"); if (argc == 2) { cocos2d::Mat4 arg0; - unsigned int arg1; + unsigned int arg1 = 0; ok &= jsval_to_matrix(cx, args.get(0), &arg0); ok &= jsval_to_uint32(cx, args.get(1), &arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_DrawNode_onDrawGLPoint : Error processing arguments"); @@ -34988,7 +36521,7 @@ bool js_cocos2dx_DrawNode_drawDot(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_drawDot : Invalid Native Object"); if (argc == 3) { cocos2d::Vec2 arg0; - double arg1; + double arg1 = 0; cocos2d::Color4F arg2; ok &= jsval_to_vector2(cx, args.get(0), &arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); @@ -35011,8 +36544,8 @@ bool js_cocos2dx_DrawNode_drawCatmullRom(JSContext *cx, uint32_t argc, jsval *vp cocos2d::DrawNode* cobj = (cocos2d::DrawNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_drawCatmullRom : Invalid Native Object"); if (argc == 3) { - cocos2d::PointArray* arg0; - unsigned int arg1; + cocos2d::PointArray* arg0 = nullptr; + unsigned int arg1 = 0; cocos2d::Color4F arg2; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -35045,7 +36578,7 @@ bool js_cocos2dx_DrawNode_drawSegment(JSContext *cx, uint32_t argc, jsval *vp) if (argc == 4) { cocos2d::Vec2 arg0; cocos2d::Vec2 arg1; - double arg2; + double arg2 = 0; cocos2d::Color4F arg3; ok &= jsval_to_vector2(cx, args.get(0), &arg0); ok &= jsval_to_vector2(cx, args.get(1), &arg1); @@ -35088,7 +36621,7 @@ bool js_cocos2dx_DrawNode_onDraw(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_onDraw : Invalid Native Object"); if (argc == 2) { cocos2d::Mat4 arg0; - unsigned int arg1; + unsigned int arg1 = 0; ok &= jsval_to_matrix(cx, args.get(0), &arg0); ok &= jsval_to_uint32(cx, args.get(1), &arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_DrawNode_onDraw : Error processing arguments"); @@ -35116,13 +36649,13 @@ bool js_cocos2dx_DrawNode_drawCircle(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Vec2 arg0; ok &= jsval_to_vector2(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } - unsigned int arg3; + unsigned int arg3 = 0; ok &= jsval_to_uint32(cx, args.get(3), &arg3); if (!ok) { ok = true; break; } bool arg4; @@ -35141,21 +36674,21 @@ bool js_cocos2dx_DrawNode_drawCircle(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Vec2 arg0; ok &= jsval_to_vector2(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } - unsigned int arg3; + unsigned int arg3 = 0; ok &= jsval_to_uint32(cx, args.get(3), &arg3); if (!ok) { ok = true; break; } bool arg4; arg4 = JS::ToBoolean(args.get(4)); - double arg5; + double arg5 = 0; ok &= JS::ToNumber( cx, args.get(5), &arg5) && !isnan(arg5); if (!ok) { ok = true; break; } - double arg6; + double arg6 = 0; ok &= JS::ToNumber( cx, args.get(6), &arg6) && !isnan(arg6); if (!ok) { ok = true; break; } cocos2d::Color4F arg7; @@ -35182,7 +36715,7 @@ bool js_cocos2dx_DrawNode_drawQuadBezier(JSContext *cx, uint32_t argc, jsval *vp cocos2d::Vec2 arg0; cocos2d::Vec2 arg1; cocos2d::Vec2 arg2; - unsigned int arg3; + unsigned int arg3 = 0; cocos2d::Color4F arg4; ok &= jsval_to_vector2(cx, args.get(0), &arg0); ok &= jsval_to_vector2(cx, args.get(1), &arg1); @@ -35208,7 +36741,7 @@ bool js_cocos2dx_DrawNode_onDrawGLLine(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_onDrawGLLine : Invalid Native Object"); if (argc == 2) { cocos2d::Mat4 arg0; - unsigned int arg1; + unsigned int arg1 = 0; ok &= jsval_to_matrix(cx, args.get(0), &arg0); ok &= jsval_to_uint32(cx, args.get(1), &arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_DrawNode_onDrawGLLine : Error processing arguments"); @@ -35229,8 +36762,8 @@ bool js_cocos2dx_DrawNode_drawSolidPoly(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::DrawNode* cobj = (cocos2d::DrawNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_drawSolidPoly : Invalid Native Object"); if (argc == 3) { - const cocos2d::Vec2* arg0; - unsigned int arg1; + const cocos2d::Vec2* arg0 = nullptr; + unsigned int arg1 = 0; cocos2d::Color4F arg2; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -35323,9 +36856,9 @@ bool js_cocos2dx_DrawNode_drawCardinalSpline(JSContext *cx, uint32_t argc, jsval cocos2d::DrawNode* cobj = (cocos2d::DrawNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_drawCardinalSpline : Invalid Native Object"); if (argc == 4) { - cocos2d::PointArray* arg0; - double arg1; - unsigned int arg2; + cocos2d::PointArray* arg0 = nullptr; + double arg1 = 0; + unsigned int arg2 = 0; cocos2d::Color4F arg3; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -35381,8 +36914,8 @@ bool js_cocos2dx_DrawNode_drawPoly(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::DrawNode* cobj = (cocos2d::DrawNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_drawPoly : Invalid Native Object"); if (argc == 4) { - const cocos2d::Vec2* arg0; - unsigned int arg1; + const cocos2d::Vec2* arg0 = nullptr; + unsigned int arg1 = 0; bool arg2; cocos2d::Color4F arg3; do { @@ -35416,7 +36949,7 @@ bool js_cocos2dx_DrawNode_drawPoint(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_drawPoint : Invalid Native Object"); if (argc == 3) { cocos2d::Vec2 arg0; - double arg1; + double arg1 = 0; cocos2d::Color4F arg2; ok &= jsval_to_vector2(cx, args.get(0), &arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); @@ -35443,7 +36976,7 @@ bool js_cocos2dx_DrawNode_drawCubicBezier(JSContext *cx, uint32_t argc, jsval *v cocos2d::Vec2 arg1; cocos2d::Vec2 arg2; cocos2d::Vec2 arg3; - unsigned int arg4; + unsigned int arg4 = 0; cocos2d::Color4F arg5; ok &= jsval_to_vector2(cx, args.get(0), &arg0); ok &= jsval_to_vector2(cx, args.get(1), &arg1); @@ -35666,7 +37199,7 @@ bool js_cocos2dx_Label_enableShadow(JSContext *cx, uint32_t argc, jsval *vp) if (argc == 3) { cocos2d::Color4B arg0; cocos2d::Size arg1; - int arg2; + int arg2 = 0; ok &= jsval_to_cccolor4b(cx, args.get(0), &arg0); ok &= jsval_to_ccsize(cx, args.get(1), &arg1); ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); @@ -35688,8 +37221,8 @@ bool js_cocos2dx_Label_setDimensions(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_setDimensions : Invalid Native Object"); if (argc == 2) { - double arg0; - double arg1; + double arg0 = 0; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_setDimensions : Error processing arguments"); @@ -35815,7 +37348,7 @@ bool js_cocos2dx_Label_setWidth(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_setWidth : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_setWidth : Error processing arguments"); cobj->setWidth(arg0); @@ -35965,7 +37498,7 @@ bool js_cocos2dx_Label_setLineHeight(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_setLineHeight : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_setLineHeight : Error processing arguments"); cobj->setLineHeight(arg0); @@ -35985,7 +37518,7 @@ bool js_cocos2dx_Label_setSystemFontSize(JSContext *cx, uint32_t argc, jsval *vp cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_setSystemFontSize : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_setSystemFontSize : Error processing arguments"); cobj->setSystemFontSize(arg0); @@ -36086,7 +37619,7 @@ bool js_cocos2dx_Label_enableOutline(JSContext *cx, uint32_t argc, jsval *vp) } if (argc == 2) { cocos2d::Color4B arg0; - int arg1; + int arg1 = 0; ok &= jsval_to_cccolor4b(cx, args.get(0), &arg0); ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_enableOutline : Error processing arguments"); @@ -36149,7 +37682,7 @@ bool js_cocos2dx_Label_setCharMap(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_setCharMap : Invalid Native Object"); do { if (argc == 4) { - cocos2d::Texture2D* arg0; + cocos2d::Texture2D* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -36160,13 +37693,13 @@ bool js_cocos2dx_Label_setCharMap(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - int arg1; + int arg1 = 0; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); if (!ok) { ok = true; break; } - int arg2; + int arg2 = 0; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); if (!ok) { ok = true; break; } - int arg3; + int arg3 = 0; ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3); if (!ok) { ok = true; break; } bool ret = cobj->setCharMap(arg0, arg1, arg2, arg3); @@ -36182,13 +37715,13 @@ bool js_cocos2dx_Label_setCharMap(JSContext *cx, uint32_t argc, jsval *vp) std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - int arg1; + int arg1 = 0; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); if (!ok) { ok = true; break; } - int arg2; + int arg2 = 0; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); if (!ok) { ok = true; break; } - int arg3; + int arg3 = 0; ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3); if (!ok) { ok = true; break; } bool ret = cobj->setCharMap(arg0, arg1, arg2, arg3); @@ -36242,7 +37775,7 @@ bool js_cocos2dx_Label_setMaxLineWidth(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_setMaxLineWidth : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_setMaxLineWidth : Error processing arguments"); cobj->setMaxLineWidth(arg0); @@ -36374,7 +37907,7 @@ bool js_cocos2dx_Label_setHeight(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_setHeight : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_setHeight : Error processing arguments"); cobj->setHeight(arg0); @@ -36432,7 +37965,7 @@ bool js_cocos2dx_Label_getLetter(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getLetter : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_getLetter : Error processing arguments"); cocos2d::Sprite* ret = cobj->getLetter(arg0); @@ -36461,7 +37994,7 @@ bool js_cocos2dx_Label_setAdditionalKerning(JSContext *cx, uint32_t argc, jsval cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_setAdditionalKerning : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_setAdditionalKerning : Error processing arguments"); cobj->setAdditionalKerning(arg0); @@ -36669,7 +38202,7 @@ bool js_cocos2dx_Label_createWithBMFont(JSContext *cx, uint32_t argc, jsval *vp) std::string arg0; std::string arg1; cocos2d::TextHAlignment arg2; - int arg3; + int arg3 = 0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); ok &= jsval_to_std_string(cx, args.get(1), &arg1); ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); @@ -36692,7 +38225,7 @@ bool js_cocos2dx_Label_createWithBMFont(JSContext *cx, uint32_t argc, jsval *vp) std::string arg0; std::string arg1; cocos2d::TextHAlignment arg2; - int arg3; + int arg3 = 0; cocos2d::Vec2 arg4; ok &= jsval_to_std_string(cx, args.get(0), &arg0); ok &= jsval_to_std_string(cx, args.get(1), &arg1); @@ -36745,7 +38278,7 @@ bool js_cocos2dx_Label_createWithCharMap(JSContext *cx, uint32_t argc, jsval *vp do { if (argc == 4) { - cocos2d::Texture2D* arg0; + cocos2d::Texture2D* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -36756,13 +38289,13 @@ bool js_cocos2dx_Label_createWithCharMap(JSContext *cx, uint32_t argc, jsval *vp JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - int arg1; + int arg1 = 0; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); if (!ok) { ok = true; break; } - int arg2; + int arg2 = 0; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); if (!ok) { ok = true; break; } - int arg3; + int arg3 = 0; ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3); if (!ok) { ok = true; break; } cocos2d::Label* ret = cocos2d::Label::createWithCharMap(arg0, arg1, arg2, arg3); @@ -36785,13 +38318,13 @@ bool js_cocos2dx_Label_createWithCharMap(JSContext *cx, uint32_t argc, jsval *vp std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - int arg1; + int arg1 = 0; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); if (!ok) { ok = true; break; } - int arg2; + int arg2 = 0; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); if (!ok) { ok = true; break; } - int arg3; + int arg3 = 0; ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3); if (!ok) { ok = true; break; } cocos2d::Label* ret = cocos2d::Label::createWithCharMap(arg0, arg1, arg2, arg3); @@ -36838,7 +38371,7 @@ bool js_cocos2dx_Label_createWithSystemFont(JSContext *cx, uint32_t argc, jsval if (argc == 3) { std::string arg0; std::string arg1; - double arg2; + double arg2 = 0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); ok &= jsval_to_std_string(cx, args.get(1), &arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -36859,7 +38392,7 @@ bool js_cocos2dx_Label_createWithSystemFont(JSContext *cx, uint32_t argc, jsval if (argc == 4) { std::string arg0; std::string arg1; - double arg2; + double arg2 = 0; cocos2d::Size arg3; ok &= jsval_to_std_string(cx, args.get(0), &arg0); ok &= jsval_to_std_string(cx, args.get(1), &arg1); @@ -36882,7 +38415,7 @@ bool js_cocos2dx_Label_createWithSystemFont(JSContext *cx, uint32_t argc, jsval if (argc == 5) { std::string arg0; std::string arg1; - double arg2; + double arg2 = 0; cocos2d::Size arg3; cocos2d::TextHAlignment arg4; ok &= jsval_to_std_string(cx, args.get(0), &arg0); @@ -36907,7 +38440,7 @@ bool js_cocos2dx_Label_createWithSystemFont(JSContext *cx, uint32_t argc, jsval if (argc == 6) { std::string arg0; std::string arg1; - double arg2; + double arg2 = 0; cocos2d::Size arg3; cocos2d::TextHAlignment arg4; cocos2d::TextVAlignment arg5; @@ -37148,13 +38681,13 @@ bool js_cocos2dx_LabelAtlas_initWithString(JSContext *cx, uint32_t argc, jsval * std::string arg1; ok &= jsval_to_std_string(cx, args.get(1), &arg1); if (!ok) { ok = true; break; } - int arg2; + int arg2 = 0; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); if (!ok) { ok = true; break; } - int arg3; + int arg3 = 0; ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3); if (!ok) { ok = true; break; } - int arg4; + int arg4 = 0; ok &= jsval_to_int32(cx, args.get(4), (int32_t *)&arg4); if (!ok) { ok = true; break; } bool ret = cobj->initWithString(arg0, arg1, arg2, arg3, arg4); @@ -37170,7 +38703,7 @@ bool js_cocos2dx_LabelAtlas_initWithString(JSContext *cx, uint32_t argc, jsval * std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - cocos2d::Texture2D* arg1; + cocos2d::Texture2D* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -37181,13 +38714,13 @@ bool js_cocos2dx_LabelAtlas_initWithString(JSContext *cx, uint32_t argc, jsval * JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - int arg2; + int arg2 = 0; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); if (!ok) { ok = true; break; } - int arg3; + int arg3 = 0; ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3); if (!ok) { ok = true; break; } - int arg4; + int arg4 = 0; ok &= jsval_to_int32(cx, args.get(4), (int32_t *)&arg4); if (!ok) { ok = true; break; } bool ret = cobj->initWithString(arg0, arg1, arg2, arg3, arg4); @@ -37232,13 +38765,13 @@ bool js_cocos2dx_LabelAtlas_create(JSContext *cx, uint32_t argc, jsval *vp) std::string arg1; ok &= jsval_to_std_string(cx, args.get(1), &arg1); if (!ok) { ok = true; break; } - int arg2; + int arg2 = 0; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); if (!ok) { ok = true; break; } - int arg3; + int arg3 = 0; ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3); if (!ok) { ok = true; break; } - int arg4; + int arg4 = 0; ok &= jsval_to_int32(cx, args.get(4), (int32_t *)&arg4); if (!ok) { ok = true; break; } cocos2d::LabelAtlas* ret = cocos2d::LabelAtlas::create(arg0, arg1, arg2, arg3, arg4); @@ -37458,7 +38991,7 @@ bool js_cocos2dx_LabelBMFont_getLetter(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::LabelBMFont* cobj = (cocos2d::LabelBMFont *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelBMFont_getLetter : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelBMFont_getLetter : Error processing arguments"); cocos2d::Sprite* ret = cobj->getLetter(arg0); @@ -37559,7 +39092,7 @@ bool js_cocos2dx_LabelBMFont_initWithString(JSContext *cx, uint32_t argc, jsval if (argc == 3) { std::string arg0; std::string arg1; - double arg2; + double arg2 = 0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); ok &= jsval_to_std_string(cx, args.get(1), &arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -37573,7 +39106,7 @@ bool js_cocos2dx_LabelBMFont_initWithString(JSContext *cx, uint32_t argc, jsval if (argc == 4) { std::string arg0; std::string arg1; - double arg2; + double arg2 = 0; cocos2d::TextHAlignment arg3; ok &= jsval_to_std_string(cx, args.get(0), &arg0); ok &= jsval_to_std_string(cx, args.get(1), &arg1); @@ -37589,7 +39122,7 @@ bool js_cocos2dx_LabelBMFont_initWithString(JSContext *cx, uint32_t argc, jsval if (argc == 5) { std::string arg0; std::string arg1; - double arg2; + double arg2 = 0; cocos2d::TextHAlignment arg3; cocos2d::Vec2 arg4; ok &= jsval_to_std_string(cx, args.get(0), &arg0); @@ -37685,7 +39218,7 @@ bool js_cocos2dx_LabelBMFont_setWidth(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::LabelBMFont* cobj = (cocos2d::LabelBMFont *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelBMFont_setWidth : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelBMFont_setWidth : Error processing arguments"); cobj->setWidth(arg0); @@ -37748,7 +39281,7 @@ bool js_cocos2dx_LabelBMFont_create(JSContext *cx, uint32_t argc, jsval *vp) std::string arg1; ok &= jsval_to_std_string(cx, args.get(1), &arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } cocos2d::LabelBMFont* ret = cocos2d::LabelBMFont::create(arg0, arg1, arg2); @@ -37773,7 +39306,7 @@ bool js_cocos2dx_LabelBMFont_create(JSContext *cx, uint32_t argc, jsval *vp) std::string arg1; ok &= jsval_to_std_string(cx, args.get(1), &arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } cocos2d::TextHAlignment arg3; @@ -37801,7 +39334,7 @@ bool js_cocos2dx_LabelBMFont_create(JSContext *cx, uint32_t argc, jsval *vp) std::string arg1; ok &= jsval_to_std_string(cx, args.get(1), &arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } cocos2d::TextHAlignment arg3; @@ -37958,8 +39491,8 @@ bool js_cocos2dx_LabelTTF_enableShadow(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelTTF_enableShadow : Invalid Native Object"); if (argc == 3) { cocos2d::Size arg0; - double arg1; - double arg2; + double arg1 = 0; + double arg2 = 0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -37970,8 +39503,8 @@ bool js_cocos2dx_LabelTTF_enableShadow(JSContext *cx, uint32_t argc, jsval *vp) } if (argc == 4) { cocos2d::Size arg0; - double arg1; - double arg2; + double arg1 = 0; + double arg2 = 0; bool arg3; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); @@ -38195,7 +39728,7 @@ bool js_cocos2dx_LabelTTF_initWithString(JSContext *cx, uint32_t argc, jsval *vp if (argc == 3) { std::string arg0; std::string arg1; - double arg2; + double arg2 = 0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); ok &= jsval_to_std_string(cx, args.get(1), &arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -38209,7 +39742,7 @@ bool js_cocos2dx_LabelTTF_initWithString(JSContext *cx, uint32_t argc, jsval *vp if (argc == 4) { std::string arg0; std::string arg1; - double arg2; + double arg2 = 0; cocos2d::Size arg3; ok &= jsval_to_std_string(cx, args.get(0), &arg0); ok &= jsval_to_std_string(cx, args.get(1), &arg1); @@ -38225,7 +39758,7 @@ bool js_cocos2dx_LabelTTF_initWithString(JSContext *cx, uint32_t argc, jsval *vp if (argc == 5) { std::string arg0; std::string arg1; - double arg2; + double arg2 = 0; cocos2d::Size arg3; cocos2d::TextHAlignment arg4; ok &= jsval_to_std_string(cx, args.get(0), &arg0); @@ -38243,7 +39776,7 @@ bool js_cocos2dx_LabelTTF_initWithString(JSContext *cx, uint32_t argc, jsval *vp if (argc == 6) { std::string arg0; std::string arg1; - double arg2; + double arg2 = 0; cocos2d::Size arg3; cocos2d::TextHAlignment arg4; cocos2d::TextVAlignment arg5; @@ -38322,7 +39855,7 @@ bool js_cocos2dx_LabelTTF_enableStroke(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelTTF_enableStroke : Invalid Native Object"); if (argc == 2) { cocos2d::Color3B arg0; - double arg1; + double arg1 = 0; ok &= jsval_to_cccolor3b(cx, args.get(0), &arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelTTF_enableStroke : Error processing arguments"); @@ -38332,7 +39865,7 @@ bool js_cocos2dx_LabelTTF_enableStroke(JSContext *cx, uint32_t argc, jsval *vp) } if (argc == 3) { cocos2d::Color3B arg0; - double arg1; + double arg1 = 0; bool arg2; ok &= jsval_to_cccolor3b(cx, args.get(0), &arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); @@ -38393,7 +39926,7 @@ bool js_cocos2dx_LabelTTF_setFontSize(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::LabelTTF* cobj = (cocos2d::LabelTTF *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelTTF_setFontSize : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelTTF_setFontSize : Error processing arguments"); cobj->setFontSize(arg0); @@ -38578,7 +40111,7 @@ bool js_cocos2dx_LabelTTF_create(JSContext *cx, uint32_t argc, jsval *vp) std::string arg1; ok &= jsval_to_std_string(cx, args.get(1), &arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } cocos2d::LabelTTF* ret = cocos2d::LabelTTF::create(arg0, arg1, arg2); @@ -38603,7 +40136,7 @@ bool js_cocos2dx_LabelTTF_create(JSContext *cx, uint32_t argc, jsval *vp) std::string arg1; ok &= jsval_to_std_string(cx, args.get(1), &arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } cocos2d::Size arg3; @@ -38631,7 +40164,7 @@ bool js_cocos2dx_LabelTTF_create(JSContext *cx, uint32_t argc, jsval *vp) std::string arg1; ok &= jsval_to_std_string(cx, args.get(1), &arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } cocos2d::Size arg3; @@ -38662,7 +40195,7 @@ bool js_cocos2dx_LabelTTF_create(JSContext *cx, uint32_t argc, jsval *vp) std::string arg1; ok &= jsval_to_std_string(cx, args.get(1), &arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } cocos2d::Size arg3; @@ -39107,8 +40640,8 @@ bool js_cocos2dx_LayerColor_changeWidthAndHeight(JSContext *cx, uint32_t argc, j cocos2d::LayerColor* cobj = (cocos2d::LayerColor *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LayerColor_changeWidthAndHeight : Invalid Native Object"); if (argc == 2) { - double arg0; - double arg1; + double arg0 = 0; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LayerColor_changeWidthAndHeight : Error processing arguments"); @@ -39167,7 +40700,7 @@ bool js_cocos2dx_LayerColor_changeWidth(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::LayerColor* cobj = (cocos2d::LayerColor *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LayerColor_changeWidth : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LayerColor_changeWidth : Error processing arguments"); cobj->changeWidth(arg0); @@ -39207,10 +40740,10 @@ bool js_cocos2dx_LayerColor_initWithColor(JSContext *cx, uint32_t argc, jsval *v cocos2d::Color4B arg0; ok &= jsval_to_cccolor4b(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } bool ret = cobj->initWithColor(arg0, arg1, arg2); @@ -39233,7 +40766,7 @@ bool js_cocos2dx_LayerColor_changeHeight(JSContext *cx, uint32_t argc, jsval *vp cocos2d::LayerColor* cobj = (cocos2d::LayerColor *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LayerColor_changeHeight : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LayerColor_changeHeight : Error processing arguments"); cobj->changeHeight(arg0); @@ -39254,10 +40787,10 @@ bool js_cocos2dx_LayerColor_create(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Color4B arg0; ok &= jsval_to_cccolor4b(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } cocos2d::LayerColor* ret = cocos2d::LayerColor::create(arg0, arg1, arg2); @@ -39934,7 +41467,7 @@ bool js_cocos2dx_LayerMultiplex_switchToAndReleaseMe(JSContext *cx, uint32_t arg cocos2d::LayerMultiplex* cobj = (cocos2d::LayerMultiplex *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LayerMultiplex_switchToAndReleaseMe : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LayerMultiplex_switchToAndReleaseMe : Error processing arguments"); cobj->switchToAndReleaseMe(arg0); @@ -39954,7 +41487,7 @@ bool js_cocos2dx_LayerMultiplex_addLayer(JSContext *cx, uint32_t argc, jsval *vp cocos2d::LayerMultiplex* cobj = (cocos2d::LayerMultiplex *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LayerMultiplex_addLayer : Invalid Native Object"); if (argc == 1) { - cocos2d::Layer* arg0; + cocos2d::Layer* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -39982,7 +41515,7 @@ bool js_cocos2dx_LayerMultiplex_switchTo(JSContext *cx, uint32_t argc, jsval *vp cocos2d::LayerMultiplex* cobj = (cocos2d::LayerMultiplex *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LayerMultiplex_switchTo : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LayerMultiplex_switchTo : Error processing arguments"); cobj->switchTo(arg0); @@ -40400,7 +41933,7 @@ bool js_cocos2dx_MenuItemLabel_setLabel(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::MenuItemLabel* cobj = (cocos2d::MenuItemLabel *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemLabel_setLabel : Invalid Native Object"); if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -40466,7 +41999,7 @@ bool js_cocos2dx_MenuItemLabel_initWithLabel(JSContext *cx, uint32_t argc, jsval cocos2d::MenuItemLabel* cobj = (cocos2d::MenuItemLabel *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemLabel_initWithLabel : Invalid Native Object"); if (argc == 2) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; std::function arg1; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -40686,8 +42219,8 @@ bool js_cocos2dx_MenuItemAtlasFont_initWithString(JSContext *cx, uint32_t argc, if (argc == 6) { std::string arg0; std::string arg1; - int arg2; - int arg3; + int arg2 = 0; + int arg3 = 0; int32_t arg4; std::function arg5; ok &= jsval_to_std_string(cx, args.get(0), &arg0); @@ -40890,7 +42423,7 @@ bool js_cocos2dx_MenuItemFont_setFontSizeObj(JSContext *cx, uint32_t argc, jsval cocos2d::MenuItemFont* cobj = (cocos2d::MenuItemFont *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemFont_setFontSizeObj : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MenuItemFont_setFontSizeObj : Error processing arguments"); cobj->setFontSizeObj(arg0); @@ -41020,7 +42553,7 @@ bool js_cocos2dx_MenuItemFont_setFontSize(JSContext *cx, uint32_t argc, jsval *v JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MenuItemFont_setFontSize : Error processing arguments"); cocos2d::MenuItemFont::setFontSize(arg0); @@ -41194,7 +42727,7 @@ bool js_cocos2dx_MenuItemSprite_setNormalImage(JSContext *cx, uint32_t argc, jsv cocos2d::MenuItemSprite* cobj = (cocos2d::MenuItemSprite *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemSprite_setNormalImage : Invalid Native Object"); if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -41222,7 +42755,7 @@ bool js_cocos2dx_MenuItemSprite_setDisabledImage(JSContext *cx, uint32_t argc, j cocos2d::MenuItemSprite* cobj = (cocos2d::MenuItemSprite *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemSprite_setDisabledImage : Invalid Native Object"); if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -41250,9 +42783,9 @@ bool js_cocos2dx_MenuItemSprite_initWithNormalSprite(JSContext *cx, uint32_t arg cocos2d::MenuItemSprite* cobj = (cocos2d::MenuItemSprite *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemSprite_initWithNormalSprite : Invalid Native Object"); if (argc == 4) { - cocos2d::Node* arg0; - cocos2d::Node* arg1; - cocos2d::Node* arg2; + cocos2d::Node* arg0 = nullptr; + cocos2d::Node* arg1 = nullptr; + cocos2d::Node* arg2 = nullptr; std::function arg3; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -41330,7 +42863,7 @@ bool js_cocos2dx_MenuItemSprite_setSelectedImage(JSContext *cx, uint32_t argc, j cocos2d::MenuItemSprite* cobj = (cocos2d::MenuItemSprite *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemSprite_setSelectedImage : Invalid Native Object"); if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -41566,7 +43099,7 @@ bool js_cocos2dx_MenuItemImage_setDisabledSpriteFrame(JSContext *cx, uint32_t ar cocos2d::MenuItemImage* cobj = (cocos2d::MenuItemImage *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemImage_setDisabledSpriteFrame : Invalid Native Object"); if (argc == 1) { - cocos2d::SpriteFrame* arg0; + cocos2d::SpriteFrame* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -41594,7 +43127,7 @@ bool js_cocos2dx_MenuItemImage_setSelectedSpriteFrame(JSContext *cx, uint32_t ar cocos2d::MenuItemImage* cobj = (cocos2d::MenuItemImage *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemImage_setSelectedSpriteFrame : Invalid Native Object"); if (argc == 1) { - cocos2d::SpriteFrame* arg0; + cocos2d::SpriteFrame* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -41622,7 +43155,7 @@ bool js_cocos2dx_MenuItemImage_setNormalSpriteFrame(JSContext *cx, uint32_t argc cocos2d::MenuItemImage* cobj = (cocos2d::MenuItemImage *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemImage_setNormalSpriteFrame : Invalid Native Object"); if (argc == 1) { - cocos2d::SpriteFrame* arg0; + cocos2d::SpriteFrame* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -41856,7 +43389,7 @@ bool js_cocos2dx_MenuItemToggle_initWithItem(JSContext *cx, uint32_t argc, jsval cocos2d::MenuItemToggle* cobj = (cocos2d::MenuItemToggle *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemToggle_initWithItem : Invalid Native Object"); if (argc == 1) { - cocos2d::MenuItem* arg0; + cocos2d::MenuItem* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -41904,7 +43437,7 @@ bool js_cocos2dx_MenuItemToggle_addSubItem(JSContext *cx, uint32_t argc, jsval * cocos2d::MenuItemToggle* cobj = (cocos2d::MenuItemToggle *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemToggle_addSubItem : Invalid Native Object"); if (argc == 1) { - cocos2d::MenuItem* arg0; + cocos2d::MenuItem* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -41957,7 +43490,7 @@ bool js_cocos2dx_MenuItemToggle_setSelectedIndex(JSContext *cx, uint32_t argc, j cocos2d::MenuItemToggle* cobj = (cocos2d::MenuItemToggle *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemToggle_setSelectedIndex : Invalid Native Object"); if (argc == 1) { - unsigned int arg0; + unsigned int arg0 = 0; ok &= jsval_to_uint32(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MenuItemToggle_setSelectedIndex : Error processing arguments"); cobj->setSelectedIndex(arg0); @@ -42166,7 +43699,7 @@ bool js_cocos2dx_Menu_alignItemsHorizontallyWithPadding(JSContext *cx, uint32_t cocos2d::Menu* cobj = (cocos2d::Menu *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Menu_alignItemsHorizontallyWithPadding : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Menu_alignItemsHorizontallyWithPadding : Error processing arguments"); cobj->alignItemsHorizontallyWithPadding(arg0); @@ -42186,7 +43719,7 @@ bool js_cocos2dx_Menu_alignItemsVerticallyWithPadding(JSContext *cx, uint32_t ar cocos2d::Menu* cobj = (cocos2d::Menu *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Menu_alignItemsVerticallyWithPadding : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Menu_alignItemsVerticallyWithPadding : Error processing arguments"); cobj->alignItemsVerticallyWithPadding(arg0); @@ -42352,7 +43885,7 @@ bool js_cocos2dx_MotionStreak_setTexture(JSContext *cx, uint32_t argc, jsval *vp cocos2d::MotionStreak* cobj = (cocos2d::MotionStreak *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MotionStreak_setTexture : Invalid Native Object"); if (argc == 1) { - cocos2d::Texture2D* arg0; + cocos2d::Texture2D* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -42541,19 +44074,19 @@ bool js_cocos2dx_MotionStreak_initWithFade(JSContext *cx, uint32_t argc, jsval * JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MotionStreak_initWithFade : Invalid Native Object"); do { if (argc == 5) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } cocos2d::Color3B arg3; ok &= jsval_to_cccolor3b(cx, args.get(3), &arg3); if (!ok) { ok = true; break; } - cocos2d::Texture2D* arg4; + cocos2d::Texture2D* arg4 = nullptr; do { if (args.get(4).isNull()) { arg4 = nullptr; break; } if (!args.get(4).isObject()) { ok = false; break; } @@ -42574,13 +44107,13 @@ bool js_cocos2dx_MotionStreak_initWithFade(JSContext *cx, uint32_t argc, jsval * do { if (argc == 5) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } cocos2d::Color3B arg3; @@ -42629,7 +44162,7 @@ bool js_cocos2dx_MotionStreak_setStroke(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::MotionStreak* cobj = (cocos2d::MotionStreak *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MotionStreak_setStroke : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MotionStreak_setStroke : Error processing arguments"); cobj->setStroke(arg0); @@ -42647,19 +44180,19 @@ bool js_cocos2dx_MotionStreak_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 5) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } cocos2d::Color3B arg3; ok &= jsval_to_cccolor3b(cx, args.get(3), &arg3); if (!ok) { ok = true; break; } - cocos2d::Texture2D* arg4; + cocos2d::Texture2D* arg4 = nullptr; do { if (args.get(4).isNull()) { arg4 = nullptr; break; } if (!args.get(4).isObject()) { ok = false; break; } @@ -42687,13 +44220,13 @@ bool js_cocos2dx_MotionStreak_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 5) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } cocos2d::Color3B arg3; @@ -42851,7 +44384,7 @@ bool js_cocos2dx_NodeGrid_setTarget(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::NodeGrid* cobj = (cocos2d::NodeGrid *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_NodeGrid_setTarget : Invalid Native Object"); if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -43084,7 +44617,7 @@ bool js_cocos2dx_ParticleBatchNode_setTexture(JSContext *cx, uint32_t argc, jsva cocos2d::ParticleBatchNode* cobj = (cocos2d::ParticleBatchNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleBatchNode_setTexture : Invalid Native Object"); if (argc == 1) { - cocos2d::Texture2D* arg0; + cocos2d::Texture2D* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -43112,8 +44645,8 @@ bool js_cocos2dx_ParticleBatchNode_initWithTexture(JSContext *cx, uint32_t argc, cocos2d::ParticleBatchNode* cobj = (cocos2d::ParticleBatchNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleBatchNode_initWithTexture : Invalid Native Object"); if (argc == 2) { - cocos2d::Texture2D* arg0; - int arg1; + cocos2d::Texture2D* arg0 = nullptr; + int arg1 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -43144,7 +44677,7 @@ bool js_cocos2dx_ParticleBatchNode_disableParticle(JSContext *cx, uint32_t argc, cocos2d::ParticleBatchNode* cobj = (cocos2d::ParticleBatchNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleBatchNode_disableParticle : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleBatchNode_disableParticle : Error processing arguments"); cobj->disableParticle(arg0); @@ -43189,7 +44722,7 @@ bool js_cocos2dx_ParticleBatchNode_setTextureAtlas(JSContext *cx, uint32_t argc, cocos2d::ParticleBatchNode* cobj = (cocos2d::ParticleBatchNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleBatchNode_setTextureAtlas : Invalid Native Object"); if (argc == 1) { - cocos2d::TextureAtlas* arg0; + cocos2d::TextureAtlas* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -43218,7 +44751,7 @@ bool js_cocos2dx_ParticleBatchNode_initWithFile(JSContext *cx, uint32_t argc, js JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleBatchNode_initWithFile : Invalid Native Object"); if (argc == 2) { std::string arg0; - int arg1; + int arg1 = 0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleBatchNode_initWithFile : Error processing arguments"); @@ -43324,8 +44857,8 @@ bool js_cocos2dx_ParticleBatchNode_insertChild(JSContext *cx, uint32_t argc, jsv cocos2d::ParticleBatchNode* cobj = (cocos2d::ParticleBatchNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleBatchNode_insertChild : Invalid Native Object"); if (argc == 2) { - cocos2d::ParticleSystem* arg0; - int arg1; + cocos2d::ParticleSystem* arg0 = nullptr; + int arg1 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -43354,7 +44887,7 @@ bool js_cocos2dx_ParticleBatchNode_removeChildAtIndex(JSContext *cx, uint32_t ar cocos2d::ParticleBatchNode* cobj = (cocos2d::ParticleBatchNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleBatchNode_removeChildAtIndex : Invalid Native Object"); if (argc == 2) { - int arg0; + int arg0 = 0; bool arg1; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); arg1 = JS::ToBoolean(args.get(1)); @@ -43390,7 +44923,7 @@ bool js_cocos2dx_ParticleBatchNode_create(JSContext *cx, uint32_t argc, jsval *v } if (argc == 2) { std::string arg0; - int arg1; + int arg1 = 0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleBatchNode_create : Error processing arguments"); @@ -43416,7 +44949,7 @@ bool js_cocos2dx_ParticleBatchNode_createWithTexture(JSContext *cx, uint32_t arg JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::Texture2D* arg0; + cocos2d::Texture2D* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -43441,8 +44974,8 @@ bool js_cocos2dx_ParticleBatchNode_createWithTexture(JSContext *cx, uint32_t arg return true; } if (argc == 2) { - cocos2d::Texture2D* arg0; - int arg1; + cocos2d::Texture2D* arg0 = nullptr; + int arg1 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -43763,7 +45296,7 @@ bool js_cocos2dx_ParticleSystem_setRotatePerSecondVar(JSContext *cx, uint32_t ar cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setRotatePerSecondVar : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setRotatePerSecondVar : Error processing arguments"); cobj->setRotatePerSecondVar(arg0); @@ -43837,7 +45370,7 @@ bool js_cocos2dx_ParticleSystem_setTangentialAccel(JSContext *cx, uint32_t argc, cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setTangentialAccel : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setTangentialAccel : Error processing arguments"); cobj->setTangentialAccel(arg0); @@ -43875,7 +45408,7 @@ bool js_cocos2dx_ParticleSystem_setStartRadius(JSContext *cx, uint32_t argc, jsv cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setStartRadius : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setStartRadius : Error processing arguments"); cobj->setStartRadius(arg0); @@ -43895,7 +45428,7 @@ bool js_cocos2dx_ParticleSystem_setRotatePerSecond(JSContext *cx, uint32_t argc, cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setRotatePerSecond : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setRotatePerSecond : Error processing arguments"); cobj->setRotatePerSecond(arg0); @@ -43915,7 +45448,7 @@ bool js_cocos2dx_ParticleSystem_setEndSize(JSContext *cx, uint32_t argc, jsval * cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setEndSize : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setEndSize : Error processing arguments"); cobj->setEndSize(arg0); @@ -43971,7 +45504,7 @@ bool js_cocos2dx_ParticleSystem_setEndRadius(JSContext *cx, uint32_t argc, jsval cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setEndRadius : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setEndRadius : Error processing arguments"); cobj->setEndRadius(arg0); @@ -44047,7 +45580,7 @@ bool js_cocos2dx_ParticleSystem_setStartSpin(JSContext *cx, uint32_t argc, jsval cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setStartSpin : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setStartSpin : Error processing arguments"); cobj->setStartSpin(arg0); @@ -44067,7 +45600,7 @@ bool js_cocos2dx_ParticleSystem_setDuration(JSContext *cx, uint32_t argc, jsval cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setDuration : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setDuration : Error processing arguments"); cobj->setDuration(arg0); @@ -44087,7 +45620,7 @@ bool js_cocos2dx_ParticleSystem_initWithTotalParticles(JSContext *cx, uint32_t a cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_initWithTotalParticles : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_initWithTotalParticles : Error processing arguments"); bool ret = cobj->initWithTotalParticles(arg0); @@ -44109,7 +45642,7 @@ bool js_cocos2dx_ParticleSystem_setTexture(JSContext *cx, uint32_t argc, jsval * cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setTexture : Invalid Native Object"); if (argc == 1) { - cocos2d::Texture2D* arg0; + cocos2d::Texture2D* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -44261,7 +45794,7 @@ bool js_cocos2dx_ParticleSystem_setLifeVar(JSContext *cx, uint32_t argc, jsval * cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setLifeVar : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setLifeVar : Error processing arguments"); cobj->setLifeVar(arg0); @@ -44281,7 +45814,7 @@ bool js_cocos2dx_ParticleSystem_setTotalParticles(JSContext *cx, uint32_t argc, cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setTotalParticles : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setTotalParticles : Error processing arguments"); cobj->setTotalParticles(arg0); @@ -44321,7 +45854,7 @@ bool js_cocos2dx_ParticleSystem_updateQuadWithParticle(JSContext *cx, uint32_t a cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_updateQuadWithParticle : Invalid Native Object"); if (argc == 2) { - cocos2d::sParticle* arg0; + cocos2d::sParticle* arg0 = nullptr; cocos2d::Vec2 arg1; #pragma warning NO CONVERSION TO NATIVE FOR sParticle* ok = false; @@ -44380,7 +45913,7 @@ bool js_cocos2dx_ParticleSystem_setStartSpinVar(JSContext *cx, uint32_t argc, js cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setStartSpinVar : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setStartSpinVar : Error processing arguments"); cobj->setStartSpinVar(arg0); @@ -44416,7 +45949,7 @@ bool js_cocos2dx_ParticleSystem_setAtlasIndex(JSContext *cx, uint32_t argc, jsva cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setAtlasIndex : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setAtlasIndex : Error processing arguments"); cobj->setAtlasIndex(arg0); @@ -44436,7 +45969,7 @@ bool js_cocos2dx_ParticleSystem_setTangentialAccelVar(JSContext *cx, uint32_t ar cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setTangentialAccelVar : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setTangentialAccelVar : Error processing arguments"); cobj->setTangentialAccelVar(arg0); @@ -44456,7 +45989,7 @@ bool js_cocos2dx_ParticleSystem_setEndRadiusVar(JSContext *cx, uint32_t argc, js cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setEndRadiusVar : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setEndRadiusVar : Error processing arguments"); cobj->setEndRadiusVar(arg0); @@ -44512,7 +46045,7 @@ bool js_cocos2dx_ParticleSystem_setRadialAccelVar(JSContext *cx, uint32_t argc, cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setRadialAccelVar : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setRadialAccelVar : Error processing arguments"); cobj->setRadialAccelVar(arg0); @@ -44532,7 +46065,7 @@ bool js_cocos2dx_ParticleSystem_setStartSize(JSContext *cx, uint32_t argc, jsval cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setStartSize : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setStartSize : Error processing arguments"); cobj->setStartSize(arg0); @@ -44552,7 +46085,7 @@ bool js_cocos2dx_ParticleSystem_setSpeed(JSContext *cx, uint32_t argc, jsval *vp cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setSpeed : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setSpeed : Error processing arguments"); cobj->setSpeed(arg0); @@ -44608,7 +46141,7 @@ bool js_cocos2dx_ParticleSystem_initParticle(JSContext *cx, uint32_t argc, jsval cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_initParticle : Invalid Native Object"); if (argc == 1) { - cocos2d::sParticle* arg0; + cocos2d::sParticle* arg0 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR sParticle* ok = false; JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_initParticle : Error processing arguments"); @@ -44725,7 +46258,7 @@ bool js_cocos2dx_ParticleSystem_setLife(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setLife : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setLife : Error processing arguments"); cobj->setLife(arg0); @@ -44745,7 +46278,7 @@ bool js_cocos2dx_ParticleSystem_setAngleVar(JSContext *cx, uint32_t argc, jsval cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setAngleVar : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setAngleVar : Error processing arguments"); cobj->setAngleVar(arg0); @@ -44785,7 +46318,7 @@ bool js_cocos2dx_ParticleSystem_setEndSizeVar(JSContext *cx, uint32_t argc, jsva cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setEndSizeVar : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setEndSizeVar : Error processing arguments"); cobj->setEndSizeVar(arg0); @@ -44805,7 +46338,7 @@ bool js_cocos2dx_ParticleSystem_setAngle(JSContext *cx, uint32_t argc, jsval *vp cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setAngle : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setAngle : Error processing arguments"); cobj->setAngle(arg0); @@ -44825,7 +46358,7 @@ bool js_cocos2dx_ParticleSystem_setBatchNode(JSContext *cx, uint32_t argc, jsval cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setBatchNode : Invalid Native Object"); if (argc == 1) { - cocos2d::ParticleBatchNode* arg0; + cocos2d::ParticleBatchNode* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -44889,7 +46422,7 @@ bool js_cocos2dx_ParticleSystem_setEndSpinVar(JSContext *cx, uint32_t argc, jsva cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setEndSpinVar : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setEndSpinVar : Error processing arguments"); cobj->setEndSpinVar(arg0); @@ -45023,7 +46556,7 @@ bool js_cocos2dx_ParticleSystem_setSpeedVar(JSContext *cx, uint32_t argc, jsval cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setSpeedVar : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setSpeedVar : Error processing arguments"); cobj->setSpeedVar(arg0); @@ -45099,7 +46632,7 @@ bool js_cocos2dx_ParticleSystem_setEmissionRate(JSContext *cx, uint32_t argc, js cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setEmissionRate : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setEmissionRate : Error processing arguments"); cobj->setEmissionRate(arg0); @@ -45209,7 +46742,7 @@ bool js_cocos2dx_ParticleSystem_setStartSizeVar(JSContext *cx, uint32_t argc, js cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setStartSizeVar : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setStartSizeVar : Error processing arguments"); cobj->setStartSizeVar(arg0); @@ -45339,7 +46872,7 @@ bool js_cocos2dx_ParticleSystem_setEndSpin(JSContext *cx, uint32_t argc, jsval * cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setEndSpin : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setEndSpin : Error processing arguments"); cobj->setEndSpin(arg0); @@ -45359,7 +46892,7 @@ bool js_cocos2dx_ParticleSystem_setRadialAccel(JSContext *cx, uint32_t argc, jsv cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setRadialAccel : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setRadialAccel : Error processing arguments"); cobj->setRadialAccel(arg0); @@ -45458,7 +46991,7 @@ bool js_cocos2dx_ParticleSystem_setStartRadiusVar(JSContext *cx, uint32_t argc, cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setStartRadiusVar : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setStartRadiusVar : Error processing arguments"); cobj->setStartRadiusVar(arg0); @@ -45555,7 +47088,7 @@ bool js_cocos2dx_ParticleSystem_createWithTotalParticles(JSContext *cx, uint32_t JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_createWithTotalParticles : Error processing arguments"); cocos2d::ParticleSystem* ret = cocos2d::ParticleSystem::createWithTotalParticles(arg0); @@ -45794,7 +47327,7 @@ bool js_cocos2dx_ParticleSystemQuad_setDisplayFrame(JSContext *cx, uint32_t argc cocos2d::ParticleSystemQuad* cobj = (cocos2d::ParticleSystemQuad *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystemQuad_setDisplayFrame : Invalid Native Object"); if (argc == 1) { - cocos2d::SpriteFrame* arg0; + cocos2d::SpriteFrame* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -45822,7 +47355,7 @@ bool js_cocos2dx_ParticleSystemQuad_setTextureWithRect(JSContext *cx, uint32_t a cocos2d::ParticleSystemQuad* cobj = (cocos2d::ParticleSystemQuad *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystemQuad_setTextureWithRect : Invalid Native Object"); if (argc == 2) { - cocos2d::Texture2D* arg0; + cocos2d::Texture2D* arg0 = nullptr; cocos2d::Rect arg1; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -45852,7 +47385,7 @@ bool js_cocos2dx_ParticleSystemQuad_listenRendererRecreated(JSContext *cx, uint3 cocos2d::ParticleSystemQuad* cobj = (cocos2d::ParticleSystemQuad *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystemQuad_listenRendererRecreated : Invalid Native Object"); if (argc == 1) { - cocos2d::EventCustom* arg0; + cocos2d::EventCustom* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -45940,7 +47473,7 @@ bool js_cocos2dx_ParticleSystemQuad_createWithTotalParticles(JSContext *cx, uint JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystemQuad_createWithTotalParticles : Error processing arguments"); cocos2d::ParticleSystemQuad* ret = cocos2d::ParticleSystemQuad::createWithTotalParticles(arg0); @@ -46082,7 +47615,7 @@ bool js_cocos2dx_ParticleFire_createWithTotalParticles(JSContext *cx, uint32_t a JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleFire_createWithTotalParticles : Error processing arguments"); cocos2d::ParticleFire* ret = cocos2d::ParticleFire::createWithTotalParticles(arg0); @@ -46222,7 +47755,7 @@ bool js_cocos2dx_ParticleFireworks_initWithTotalParticles(JSContext *cx, uint32_ cocos2d::ParticleFireworks* cobj = (cocos2d::ParticleFireworks *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleFireworks_initWithTotalParticles : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleFireworks_initWithTotalParticles : Error processing arguments"); bool ret = cobj->initWithTotalParticles(arg0); @@ -46261,7 +47794,7 @@ bool js_cocos2dx_ParticleFireworks_createWithTotalParticles(JSContext *cx, uint3 JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleFireworks_createWithTotalParticles : Error processing arguments"); cocos2d::ParticleFireworks* ret = cocos2d::ParticleFireworks::createWithTotalParticles(arg0); @@ -46403,7 +47936,7 @@ bool js_cocos2dx_ParticleSun_initWithTotalParticles(JSContext *cx, uint32_t argc cocos2d::ParticleSun* cobj = (cocos2d::ParticleSun *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSun_initWithTotalParticles : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSun_initWithTotalParticles : Error processing arguments"); bool ret = cobj->initWithTotalParticles(arg0); @@ -46442,7 +47975,7 @@ bool js_cocos2dx_ParticleSun_createWithTotalParticles(JSContext *cx, uint32_t ar JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSun_createWithTotalParticles : Error processing arguments"); cocos2d::ParticleSun* ret = cocos2d::ParticleSun::createWithTotalParticles(arg0); @@ -46584,7 +48117,7 @@ bool js_cocos2dx_ParticleGalaxy_initWithTotalParticles(JSContext *cx, uint32_t a cocos2d::ParticleGalaxy* cobj = (cocos2d::ParticleGalaxy *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleGalaxy_initWithTotalParticles : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleGalaxy_initWithTotalParticles : Error processing arguments"); bool ret = cobj->initWithTotalParticles(arg0); @@ -46623,7 +48156,7 @@ bool js_cocos2dx_ParticleGalaxy_createWithTotalParticles(JSContext *cx, uint32_t JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleGalaxy_createWithTotalParticles : Error processing arguments"); cocos2d::ParticleGalaxy* ret = cocos2d::ParticleGalaxy::createWithTotalParticles(arg0); @@ -46765,7 +48298,7 @@ bool js_cocos2dx_ParticleFlower_initWithTotalParticles(JSContext *cx, uint32_t a cocos2d::ParticleFlower* cobj = (cocos2d::ParticleFlower *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleFlower_initWithTotalParticles : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleFlower_initWithTotalParticles : Error processing arguments"); bool ret = cobj->initWithTotalParticles(arg0); @@ -46804,7 +48337,7 @@ bool js_cocos2dx_ParticleFlower_createWithTotalParticles(JSContext *cx, uint32_t JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleFlower_createWithTotalParticles : Error processing arguments"); cocos2d::ParticleFlower* ret = cocos2d::ParticleFlower::createWithTotalParticles(arg0); @@ -46946,7 +48479,7 @@ bool js_cocos2dx_ParticleMeteor_initWithTotalParticles(JSContext *cx, uint32_t a cocos2d::ParticleMeteor* cobj = (cocos2d::ParticleMeteor *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleMeteor_initWithTotalParticles : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleMeteor_initWithTotalParticles : Error processing arguments"); bool ret = cobj->initWithTotalParticles(arg0); @@ -46985,7 +48518,7 @@ bool js_cocos2dx_ParticleMeteor_createWithTotalParticles(JSContext *cx, uint32_t JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleMeteor_createWithTotalParticles : Error processing arguments"); cocos2d::ParticleMeteor* ret = cocos2d::ParticleMeteor::createWithTotalParticles(arg0); @@ -47127,7 +48660,7 @@ bool js_cocos2dx_ParticleSpiral_initWithTotalParticles(JSContext *cx, uint32_t a cocos2d::ParticleSpiral* cobj = (cocos2d::ParticleSpiral *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSpiral_initWithTotalParticles : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSpiral_initWithTotalParticles : Error processing arguments"); bool ret = cobj->initWithTotalParticles(arg0); @@ -47166,7 +48699,7 @@ bool js_cocos2dx_ParticleSpiral_createWithTotalParticles(JSContext *cx, uint32_t JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSpiral_createWithTotalParticles : Error processing arguments"); cocos2d::ParticleSpiral* ret = cocos2d::ParticleSpiral::createWithTotalParticles(arg0); @@ -47308,7 +48841,7 @@ bool js_cocos2dx_ParticleExplosion_initWithTotalParticles(JSContext *cx, uint32_ cocos2d::ParticleExplosion* cobj = (cocos2d::ParticleExplosion *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleExplosion_initWithTotalParticles : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleExplosion_initWithTotalParticles : Error processing arguments"); bool ret = cobj->initWithTotalParticles(arg0); @@ -47347,7 +48880,7 @@ bool js_cocos2dx_ParticleExplosion_createWithTotalParticles(JSContext *cx, uint3 JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleExplosion_createWithTotalParticles : Error processing arguments"); cocos2d::ParticleExplosion* ret = cocos2d::ParticleExplosion::createWithTotalParticles(arg0); @@ -47489,7 +49022,7 @@ bool js_cocos2dx_ParticleSmoke_initWithTotalParticles(JSContext *cx, uint32_t ar cocos2d::ParticleSmoke* cobj = (cocos2d::ParticleSmoke *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSmoke_initWithTotalParticles : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSmoke_initWithTotalParticles : Error processing arguments"); bool ret = cobj->initWithTotalParticles(arg0); @@ -47528,7 +49061,7 @@ bool js_cocos2dx_ParticleSmoke_createWithTotalParticles(JSContext *cx, uint32_t JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSmoke_createWithTotalParticles : Error processing arguments"); cocos2d::ParticleSmoke* ret = cocos2d::ParticleSmoke::createWithTotalParticles(arg0); @@ -47670,7 +49203,7 @@ bool js_cocos2dx_ParticleSnow_initWithTotalParticles(JSContext *cx, uint32_t arg cocos2d::ParticleSnow* cobj = (cocos2d::ParticleSnow *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSnow_initWithTotalParticles : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSnow_initWithTotalParticles : Error processing arguments"); bool ret = cobj->initWithTotalParticles(arg0); @@ -47709,7 +49242,7 @@ bool js_cocos2dx_ParticleSnow_createWithTotalParticles(JSContext *cx, uint32_t a JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSnow_createWithTotalParticles : Error processing arguments"); cocos2d::ParticleSnow* ret = cocos2d::ParticleSnow::createWithTotalParticles(arg0); @@ -47851,7 +49384,7 @@ bool js_cocos2dx_ParticleRain_initWithTotalParticles(JSContext *cx, uint32_t arg cocos2d::ParticleRain* cobj = (cocos2d::ParticleRain *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleRain_initWithTotalParticles : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleRain_initWithTotalParticles : Error processing arguments"); bool ret = cobj->initWithTotalParticles(arg0); @@ -47890,7 +49423,7 @@ bool js_cocos2dx_ParticleRain_createWithTotalParticles(JSContext *cx, uint32_t a JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleRain_createWithTotalParticles : Error processing arguments"); cocos2d::ParticleRain* ret = cocos2d::ParticleRain::createWithTotalParticles(arg0); @@ -48014,7 +49547,7 @@ bool js_cocos2dx_ProgressTimer_initWithSprite(JSContext *cx, uint32_t argc, jsva cocos2d::ProgressTimer* cobj = (cocos2d::ProgressTimer *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ProgressTimer_initWithSprite : Invalid Native Object"); if (argc == 1) { - cocos2d::Sprite* arg0; + cocos2d::Sprite* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -48100,7 +49633,7 @@ bool js_cocos2dx_ProgressTimer_setSprite(JSContext *cx, uint32_t argc, jsval *vp cocos2d::ProgressTimer* cobj = (cocos2d::ProgressTimer *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ProgressTimer_setSprite : Invalid Native Object"); if (argc == 1) { - cocos2d::Sprite* arg0; + cocos2d::Sprite* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -48261,7 +49794,7 @@ bool js_cocos2dx_ProgressTimer_setPercentage(JSContext *cx, uint32_t argc, jsval cocos2d::ProgressTimer* cobj = (cocos2d::ProgressTimer *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ProgressTimer_setPercentage : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ProgressTimer_setPercentage : Error processing arguments"); cobj->setPercentage(arg0); @@ -48297,7 +49830,7 @@ bool js_cocos2dx_ProgressTimer_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::Sprite* arg0; + cocos2d::Sprite* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -48461,7 +49994,7 @@ bool js_cocos2dx_ProtectedNode_addProtectedChild(JSContext *cx, uint32_t argc, j JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ProtectedNode_addProtectedChild : Invalid Native Object"); do { if (argc == 2) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -48472,7 +50005,7 @@ bool js_cocos2dx_ProtectedNode_addProtectedChild(JSContext *cx, uint32_t argc, j JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - int arg1; + int arg1 = 0; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); if (!ok) { ok = true; break; } cobj->addProtectedChild(arg0, arg1); @@ -48483,7 +50016,7 @@ bool js_cocos2dx_ProtectedNode_addProtectedChild(JSContext *cx, uint32_t argc, j do { if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -48502,7 +50035,7 @@ bool js_cocos2dx_ProtectedNode_addProtectedChild(JSContext *cx, uint32_t argc, j do { if (argc == 3) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -48513,10 +50046,10 @@ bool js_cocos2dx_ProtectedNode_addProtectedChild(JSContext *cx, uint32_t argc, j JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - int arg1; + int arg1 = 0; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); if (!ok) { ok = true; break; } - int arg2; + int arg2 = 0; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); if (!ok) { ok = true; break; } cobj->addProtectedChild(arg0, arg1, arg2); @@ -48553,7 +50086,7 @@ bool js_cocos2dx_ProtectedNode_removeProtectedChildByTag(JSContext *cx, uint32_t cocos2d::ProtectedNode* cobj = (cocos2d::ProtectedNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ProtectedNode_removeProtectedChildByTag : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ProtectedNode_removeProtectedChildByTag : Error processing arguments"); cobj->removeProtectedChildByTag(arg0); @@ -48561,7 +50094,7 @@ bool js_cocos2dx_ProtectedNode_removeProtectedChildByTag(JSContext *cx, uint32_t return true; } if (argc == 2) { - int arg0; + int arg0 = 0; bool arg1; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); arg1 = JS::ToBoolean(args.get(1)); @@ -48583,8 +50116,8 @@ bool js_cocos2dx_ProtectedNode_reorderProtectedChild(JSContext *cx, uint32_t arg cocos2d::ProtectedNode* cobj = (cocos2d::ProtectedNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ProtectedNode_reorderProtectedChild : Invalid Native Object"); if (argc == 2) { - cocos2d::Node* arg0; - int arg1; + cocos2d::Node* arg0 = nullptr; + int arg1 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -48665,7 +50198,7 @@ bool js_cocos2dx_ProtectedNode_getProtectedChildByTag(JSContext *cx, uint32_t ar cocos2d::ProtectedNode* cobj = (cocos2d::ProtectedNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ProtectedNode_getProtectedChildByTag : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ProtectedNode_getProtectedChildByTag : Error processing arguments"); cocos2d::Node* ret = cobj->getProtectedChildByTag(arg0); @@ -48694,7 +50227,7 @@ bool js_cocos2dx_ProtectedNode_removeProtectedChild(JSContext *cx, uint32_t argc cocos2d::ProtectedNode* cobj = (cocos2d::ProtectedNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ProtectedNode_removeProtectedChild : Invalid Native Object"); if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -48710,7 +50243,7 @@ bool js_cocos2dx_ProtectedNode_removeProtectedChild(JSContext *cx, uint32_t argc return true; } if (argc == 2) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; bool arg1; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -49151,11 +50684,11 @@ bool js_cocos2dx_Image_initWithRawData(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Image* cobj = (cocos2d::Image *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Image_initWithRawData : Invalid Native Object"); if (argc == 5) { - const unsigned char* arg0; - ssize_t arg1; - int arg2; - int arg3; - int arg4; + const unsigned char* arg0 = nullptr; + ssize_t arg1 = 0; + int arg2 = 0; + int arg3 = 0; + int arg4 = 0; #pragma warning NO CONVERSION TO NATIVE FOR unsigned char* ok = false; ok &= jsval_to_ssize(cx, args.get(1), &arg1); @@ -49170,11 +50703,11 @@ bool js_cocos2dx_Image_initWithRawData(JSContext *cx, uint32_t argc, jsval *vp) return true; } if (argc == 6) { - const unsigned char* arg0; - ssize_t arg1; - int arg2; - int arg3; - int arg4; + const unsigned char* arg0 = nullptr; + ssize_t arg1 = 0; + int arg2 = 0; + int arg3 = 0; + int arg4 = 0; bool arg5; #pragma warning NO CONVERSION TO NATIVE FOR unsigned char* ok = false; @@ -49328,7 +50861,7 @@ bool js_cocos2dx_Sprite_setSpriteFrame(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_setSpriteFrame : Invalid Native Object"); do { if (argc == 1) { - cocos2d::SpriteFrame* arg0; + cocos2d::SpriteFrame* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -49372,7 +50905,7 @@ bool js_cocos2dx_Sprite_setTexture(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_setTexture : Invalid Native Object"); do { if (argc == 1) { - cocos2d::Texture2D* arg0; + cocos2d::Texture2D* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -49477,7 +51010,7 @@ bool js_cocos2dx_Sprite_setRotationSkewX(JSContext *cx, uint32_t argc, jsval *vp cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_setRotationSkewX : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Sprite_setRotationSkewX : Error processing arguments"); cobj->setRotationSkewX(arg0); @@ -49497,7 +51030,7 @@ bool js_cocos2dx_Sprite_setRotationSkewY(JSContext *cx, uint32_t argc, jsval *vp cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_setRotationSkewY : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Sprite_setRotationSkewY : Error processing arguments"); cobj->setRotationSkewY(arg0); @@ -49521,7 +51054,7 @@ bool js_cocos2dx_Sprite_initWithTexture(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_initWithTexture : Invalid Native Object"); do { if (argc == 2) { - cocos2d::Texture2D* arg0; + cocos2d::Texture2D* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -49545,7 +51078,7 @@ bool js_cocos2dx_Sprite_initWithTexture(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 1) { - cocos2d::Texture2D* arg0; + cocos2d::Texture2D* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -49566,7 +51099,7 @@ bool js_cocos2dx_Sprite_initWithTexture(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 3) { - cocos2d::Texture2D* arg0; + cocos2d::Texture2D* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -49728,7 +51261,7 @@ bool js_cocos2dx_Sprite_isFrameDisplayed(JSContext *cx, uint32_t argc, jsval *vp cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_isFrameDisplayed : Invalid Native Object"); if (argc == 1) { - cocos2d::SpriteFrame* arg0; + cocos2d::SpriteFrame* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -49776,7 +51309,7 @@ bool js_cocos2dx_Sprite_setBatchNode(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_setBatchNode : Invalid Native Object"); if (argc == 1) { - cocos2d::SpriteBatchNode* arg0; + cocos2d::SpriteBatchNode* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -49823,7 +51356,7 @@ bool js_cocos2dx_Sprite_setDisplayFrameWithAnimationName(JSContext *cx, uint32_t JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_setDisplayFrameWithAnimationName : Invalid Native Object"); if (argc == 2) { std::string arg0; - ssize_t arg1; + ssize_t arg1 = 0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); ok &= jsval_to_ssize(cx, args.get(1), &arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Sprite_setDisplayFrameWithAnimationName : Error processing arguments"); @@ -49844,7 +51377,7 @@ bool js_cocos2dx_Sprite_setTextureAtlas(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_setTextureAtlas : Invalid Native Object"); if (argc == 1) { - cocos2d::TextureAtlas* arg0; + cocos2d::TextureAtlas* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -49915,7 +51448,7 @@ bool js_cocos2dx_Sprite_setAtlasIndex(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_setAtlasIndex : Invalid Native Object"); if (argc == 1) { - ssize_t arg0; + ssize_t arg0 = 0; ok &= jsval_to_ssize(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Sprite_setAtlasIndex : Error processing arguments"); cobj->setAtlasIndex(arg0); @@ -49982,26 +51515,6 @@ bool js_cocos2dx_Sprite_getTextureRect(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_Sprite_getTextureRect : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } -bool js_cocos2dx_Sprite_debugDraw(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_debugDraw : Invalid Native Object"); - if (argc == 1) { - bool arg0; - arg0 = JS::ToBoolean(args.get(0)); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Sprite_debugDraw : Error processing arguments"); - cobj->debugDraw(arg0); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_Sprite_debugDraw : wrong number of arguments: %d, was expecting %d", argc, 1); - return false; -} bool js_cocos2dx_Sprite_initWithFile(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -50099,7 +51612,7 @@ bool js_cocos2dx_Sprite_initWithSpriteFrame(JSContext *cx, uint32_t argc, jsval cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_initWithSpriteFrame : Invalid Native Object"); if (argc == 1) { - cocos2d::SpriteFrame* arg0; + cocos2d::SpriteFrame* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -50270,7 +51783,6 @@ void js_register_cocos2dx_Sprite(JSContext *cx, JS::HandleObject global) { JS_FN("setDirty", js_cocos2dx_Sprite_setDirty, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("isTextureRectRotated", js_cocos2dx_Sprite_isTextureRectRotated, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getTextureRect", js_cocos2dx_Sprite_getTextureRect, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("debugDraw", js_cocos2dx_Sprite_debugDraw, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("initWithFile", js_cocos2dx_Sprite_initWithFile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setBlendFunc", js_cocos2dx_Sprite_setBlendFunc, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getTextureAtlas", js_cocos2dx_Sprite_getTextureAtlas, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -50349,7 +51861,7 @@ bool js_cocos2dx_RenderTexture_clearStencil(JSContext *cx, uint32_t argc, jsval cocos2d::RenderTexture* cobj = (cocos2d::RenderTexture *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderTexture_clearStencil : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_RenderTexture_clearStencil : Error processing arguments"); cobj->clearStencil(arg0); @@ -50421,7 +51933,7 @@ bool js_cocos2dx_RenderTexture_setClearStencil(JSContext *cx, uint32_t argc, jsv cocos2d::RenderTexture* cobj = (cocos2d::RenderTexture *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderTexture_setClearStencil : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_RenderTexture_setClearStencil : Error processing arguments"); cobj->setClearStencil(arg0); @@ -50441,7 +51953,7 @@ bool js_cocos2dx_RenderTexture_setSprite(JSContext *cx, uint32_t argc, jsval *vp cocos2d::RenderTexture* cobj = (cocos2d::RenderTexture *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderTexture_setSprite : Invalid Native Object"); if (argc == 1) { - cocos2d::Sprite* arg0; + cocos2d::Sprite* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -50532,7 +52044,7 @@ bool js_cocos2dx_RenderTexture_setClearFlags(JSContext *cx, uint32_t argc, jsval cocos2d::RenderTexture* cobj = (cocos2d::RenderTexture *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderTexture_setClearFlags : Invalid Native Object"); if (argc == 1) { - unsigned int arg0; + unsigned int arg0 = 0; ok &= jsval_to_uint32(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_RenderTexture_setClearFlags : Error processing arguments"); cobj->setClearFlags(arg0); @@ -50628,19 +52140,19 @@ bool js_cocos2dx_RenderTexture_beginWithClear(JSContext *cx, uint32_t argc, jsva JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderTexture_beginWithClear : Invalid Native Object"); do { if (argc == 5) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } - double arg3; + double arg3 = 0; ok &= JS::ToNumber( cx, args.get(3), &arg3) && !isnan(arg3); if (!ok) { ok = true; break; } - double arg4; + double arg4 = 0; ok &= JS::ToNumber( cx, args.get(4), &arg4) && !isnan(arg4); if (!ok) { ok = true; break; } cobj->beginWithClear(arg0, arg1, arg2, arg3, arg4); @@ -50651,16 +52163,16 @@ bool js_cocos2dx_RenderTexture_beginWithClear(JSContext *cx, uint32_t argc, jsva do { if (argc == 4) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } - double arg3; + double arg3 = 0; ok &= JS::ToNumber( cx, args.get(3), &arg3) && !isnan(arg3); if (!ok) { ok = true; break; } cobj->beginWithClear(arg0, arg1, arg2, arg3); @@ -50671,22 +52183,22 @@ bool js_cocos2dx_RenderTexture_beginWithClear(JSContext *cx, uint32_t argc, jsva do { if (argc == 6) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } - double arg3; + double arg3 = 0; ok &= JS::ToNumber( cx, args.get(3), &arg3) && !isnan(arg3); if (!ok) { ok = true; break; } - double arg4; + double arg4 = 0; ok &= JS::ToNumber( cx, args.get(4), &arg4) && !isnan(arg4); if (!ok) { ok = true; break; } - int arg5; + int arg5 = 0; ok &= jsval_to_int32(cx, args.get(5), (int32_t *)&arg5); if (!ok) { ok = true; break; } cobj->beginWithClear(arg0, arg1, arg2, arg3, arg4, arg5); @@ -50707,7 +52219,7 @@ bool js_cocos2dx_RenderTexture_clearDepth(JSContext *cx, uint32_t argc, jsval *v cocos2d::RenderTexture* cobj = (cocos2d::RenderTexture *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderTexture_clearDepth : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_RenderTexture_clearDepth : Error processing arguments"); cobj->clearDepth(arg0); @@ -50745,10 +52257,10 @@ bool js_cocos2dx_RenderTexture_clear(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::RenderTexture* cobj = (cocos2d::RenderTexture *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderTexture_clear : Invalid Native Object"); if (argc == 4) { - double arg0; - double arg1; - double arg2; - double arg3; + double arg0 = 0; + double arg1 = 0; + double arg2 = 0; + double arg3 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -50832,7 +52344,7 @@ bool js_cocos2dx_RenderTexture_setClearDepth(JSContext *cx, uint32_t argc, jsval cocos2d::RenderTexture* cobj = (cocos2d::RenderTexture *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderTexture_setClearDepth : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_RenderTexture_setClearDepth : Error processing arguments"); cobj->setClearDepth(arg0); @@ -50856,16 +52368,16 @@ bool js_cocos2dx_RenderTexture_initWithWidthAndHeight(JSContext *cx, uint32_t ar JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderTexture_initWithWidthAndHeight : Invalid Native Object"); do { if (argc == 4) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); if (!ok) { ok = true; break; } - int arg1; + int arg1 = 0; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); if (!ok) { ok = true; break; } cocos2d::Texture2D::PixelFormat arg2; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); if (!ok) { ok = true; break; } - unsigned int arg3; + unsigned int arg3 = 0; ok &= jsval_to_uint32(cx, args.get(3), &arg3); if (!ok) { ok = true; break; } bool ret = cobj->initWithWidthAndHeight(arg0, arg1, arg2, arg3); @@ -50878,10 +52390,10 @@ bool js_cocos2dx_RenderTexture_initWithWidthAndHeight(JSContext *cx, uint32_t ar do { if (argc == 3) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); if (!ok) { ok = true; break; } - int arg1; + int arg1 = 0; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); if (!ok) { ok = true; break; } cocos2d::Texture2D::PixelFormat arg2; @@ -50905,10 +52417,10 @@ bool js_cocos2dx_RenderTexture_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 3) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); if (!ok) { ok = true; break; } - int arg1; + int arg1 = 0; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); if (!ok) { ok = true; break; } cocos2d::Texture2D::PixelFormat arg2; @@ -50931,16 +52443,16 @@ bool js_cocos2dx_RenderTexture_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 4) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); if (!ok) { ok = true; break; } - int arg1; + int arg1 = 0; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); if (!ok) { ok = true; break; } cocos2d::Texture2D::PixelFormat arg2; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); if (!ok) { ok = true; break; } - unsigned int arg3; + unsigned int arg3 = 0; ok &= jsval_to_uint32(cx, args.get(3), &arg3); if (!ok) { ok = true; break; } cocos2d::RenderTexture* ret = cocos2d::RenderTexture::create(arg0, arg1, arg2, arg3); @@ -50960,10 +52472,10 @@ bool js_cocos2dx_RenderTexture_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 2) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); if (!ok) { ok = true; break; } - int arg1; + int arg1 = 0; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); if (!ok) { ok = true; break; } cocos2d::RenderTexture* ret = cocos2d::RenderTexture::create(arg0, arg1); @@ -51125,7 +52637,7 @@ bool js_cocos2dx_TransitionEaseScene_easeActionWithAction(JSContext *cx, uint32_ cocos2d::TransitionEaseScene* cobj = (cocos2d::TransitionEaseScene *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TransitionEaseScene_easeActionWithAction : Invalid Native Object"); if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -51263,8 +52775,8 @@ bool js_cocos2dx_TransitionScene_initWithDuration(JSContext *cx, uint32_t argc, cocos2d::TransitionScene* cobj = (cocos2d::TransitionScene *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TransitionScene_initWithDuration : Invalid Native Object"); if (argc == 2) { - double arg0; - cocos2d::Scene* arg1; + double arg0 = 0; + cocos2d::Scene* arg1 = nullptr; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -51325,8 +52837,8 @@ bool js_cocos2dx_TransitionScene_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; - cocos2d::Scene* arg1; + double arg0 = 0; + cocos2d::Scene* arg1 = nullptr; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -51479,8 +52991,8 @@ bool js_cocos2dx_TransitionSceneOriented_initWithDuration(JSContext *cx, uint32_ cocos2d::TransitionSceneOriented* cobj = (cocos2d::TransitionSceneOriented *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TransitionSceneOriented_initWithDuration : Invalid Native Object"); if (argc == 3) { - double arg0; - cocos2d::Scene* arg1; + double arg0 = 0; + cocos2d::Scene* arg1 = nullptr; cocos2d::TransitionScene::Orientation arg2; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); do { @@ -51509,8 +53021,8 @@ bool js_cocos2dx_TransitionSceneOriented_create(JSContext *cx, uint32_t argc, js JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 3) { - double arg0; - cocos2d::Scene* arg1; + double arg0 = 0; + cocos2d::Scene* arg1 = nullptr; cocos2d::TransitionScene::Orientation arg2; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); do { @@ -51568,6 +53080,21 @@ bool js_cocos2dx_TransitionSceneOriented_constructor(JSContext *cx, uint32_t arg if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_TransitionSceneOriented_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::TransitionSceneOriented *nobj = new (std::nothrow) cocos2d::TransitionSceneOriented(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::TransitionSceneOriented"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_TransitionScene_prototype; @@ -51575,6 +53102,7 @@ extern JSObject *jsb_cocos2d_TransitionScene_prototype; void js_cocos2d_TransitionSceneOriented_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (TransitionSceneOriented)", obj); } + void js_register_cocos2dx_TransitionSceneOriented(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_TransitionSceneOriented_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_TransitionSceneOriented_class->name = "TransitionSceneOriented"; @@ -51595,6 +53123,7 @@ void js_register_cocos2dx_TransitionSceneOriented(JSContext *cx, JS::HandleObjec static JSFunctionSpec funcs[] = { JS_FN("initWithDuration", js_cocos2dx_TransitionSceneOriented_initWithDuration, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_TransitionSceneOriented_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -51629,6 +53158,7 @@ void js_register_cocos2dx_TransitionSceneOriented(JSContext *cx, JS::HandleObjec p->parentProto = jsb_cocos2d_TransitionScene_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.TransitionSceneOriented.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_TransitionRotoZoom_class; @@ -51639,8 +53169,8 @@ bool js_cocos2dx_TransitionRotoZoom_create(JSContext *cx, uint32_t argc, jsval * JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; - cocos2d::Scene* arg1; + double arg0 = 0; + cocos2d::Scene* arg1 = nullptr; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -51696,6 +53226,21 @@ bool js_cocos2dx_TransitionRotoZoom_constructor(JSContext *cx, uint32_t argc, js if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_TransitionRotoZoom_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::TransitionRotoZoom *nobj = new (std::nothrow) cocos2d::TransitionRotoZoom(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::TransitionRotoZoom"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_TransitionScene_prototype; @@ -51703,6 +53248,7 @@ extern JSObject *jsb_cocos2d_TransitionScene_prototype; void js_cocos2d_TransitionRotoZoom_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (TransitionRotoZoom)", obj); } + void js_register_cocos2dx_TransitionRotoZoom(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_TransitionRotoZoom_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_TransitionRotoZoom_class->name = "TransitionRotoZoom"; @@ -51722,6 +53268,7 @@ void js_register_cocos2dx_TransitionRotoZoom(JSContext *cx, JS::HandleObject glo }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_TransitionRotoZoom_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -51756,6 +53303,7 @@ void js_register_cocos2dx_TransitionRotoZoom(JSContext *cx, JS::HandleObject glo p->parentProto = jsb_cocos2d_TransitionScene_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.TransitionRotoZoom.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_TransitionJumpZoom_class; @@ -51766,8 +53314,8 @@ bool js_cocos2dx_TransitionJumpZoom_create(JSContext *cx, uint32_t argc, jsval * JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; - cocos2d::Scene* arg1; + double arg0 = 0; + cocos2d::Scene* arg1 = nullptr; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -51823,6 +53371,21 @@ bool js_cocos2dx_TransitionJumpZoom_constructor(JSContext *cx, uint32_t argc, js if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_TransitionJumpZoom_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::TransitionJumpZoom *nobj = new (std::nothrow) cocos2d::TransitionJumpZoom(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::TransitionJumpZoom"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_TransitionScene_prototype; @@ -51830,6 +53393,7 @@ extern JSObject *jsb_cocos2d_TransitionScene_prototype; void js_cocos2d_TransitionJumpZoom_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (TransitionJumpZoom)", obj); } + void js_register_cocos2dx_TransitionJumpZoom(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_TransitionJumpZoom_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_TransitionJumpZoom_class->name = "TransitionJumpZoom"; @@ -51849,6 +53413,7 @@ void js_register_cocos2dx_TransitionJumpZoom(JSContext *cx, JS::HandleObject glo }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_TransitionJumpZoom_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -51883,6 +53448,7 @@ void js_register_cocos2dx_TransitionJumpZoom(JSContext *cx, JS::HandleObject glo p->parentProto = jsb_cocos2d_TransitionScene_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.TransitionJumpZoom.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_TransitionMoveInL_class; @@ -51922,7 +53488,7 @@ bool js_cocos2dx_TransitionMoveInL_easeActionWithAction(JSContext *cx, uint32_t cocos2d::TransitionMoveInL* cobj = (cocos2d::TransitionMoveInL *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TransitionMoveInL_easeActionWithAction : Invalid Native Object"); if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -51955,8 +53521,8 @@ bool js_cocos2dx_TransitionMoveInL_create(JSContext *cx, uint32_t argc, jsval *v JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; - cocos2d::Scene* arg1; + double arg0 = 0; + cocos2d::Scene* arg1 = nullptr; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -52012,6 +53578,21 @@ bool js_cocos2dx_TransitionMoveInL_constructor(JSContext *cx, uint32_t argc, jsv if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_TransitionMoveInL_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::TransitionMoveInL *nobj = new (std::nothrow) cocos2d::TransitionMoveInL(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::TransitionMoveInL"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_TransitionScene_prototype; @@ -52019,6 +53600,7 @@ extern JSObject *jsb_cocos2d_TransitionScene_prototype; void js_cocos2d_TransitionMoveInL_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (TransitionMoveInL)", obj); } + void js_register_cocos2dx_TransitionMoveInL(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_TransitionMoveInL_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_TransitionMoveInL_class->name = "TransitionMoveInL"; @@ -52040,6 +53622,7 @@ void js_register_cocos2dx_TransitionMoveInL(JSContext *cx, JS::HandleObject glob static JSFunctionSpec funcs[] = { JS_FN("action", js_cocos2dx_TransitionMoveInL_action, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("easeActionWithAction", js_cocos2dx_TransitionMoveInL_easeActionWithAction, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_TransitionMoveInL_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -52074,6 +53657,7 @@ void js_register_cocos2dx_TransitionMoveInL(JSContext *cx, JS::HandleObject glob p->parentProto = jsb_cocos2d_TransitionScene_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.TransitionMoveInL.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_TransitionMoveInR_class; @@ -52084,8 +53668,8 @@ bool js_cocos2dx_TransitionMoveInR_create(JSContext *cx, uint32_t argc, jsval *v JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; - cocos2d::Scene* arg1; + double arg0 = 0; + cocos2d::Scene* arg1 = nullptr; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -52141,6 +53725,21 @@ bool js_cocos2dx_TransitionMoveInR_constructor(JSContext *cx, uint32_t argc, jsv if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_TransitionMoveInR_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::TransitionMoveInR *nobj = new (std::nothrow) cocos2d::TransitionMoveInR(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::TransitionMoveInR"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_TransitionMoveInL_prototype; @@ -52148,6 +53747,7 @@ extern JSObject *jsb_cocos2d_TransitionMoveInL_prototype; void js_cocos2d_TransitionMoveInR_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (TransitionMoveInR)", obj); } + void js_register_cocos2dx_TransitionMoveInR(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_TransitionMoveInR_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_TransitionMoveInR_class->name = "TransitionMoveInR"; @@ -52167,6 +53767,7 @@ void js_register_cocos2dx_TransitionMoveInR(JSContext *cx, JS::HandleObject glob }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_TransitionMoveInR_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -52201,6 +53802,7 @@ void js_register_cocos2dx_TransitionMoveInR(JSContext *cx, JS::HandleObject glob p->parentProto = jsb_cocos2d_TransitionMoveInL_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.TransitionMoveInR.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_TransitionMoveInT_class; @@ -52211,8 +53813,8 @@ bool js_cocos2dx_TransitionMoveInT_create(JSContext *cx, uint32_t argc, jsval *v JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; - cocos2d::Scene* arg1; + double arg0 = 0; + cocos2d::Scene* arg1 = nullptr; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -52268,6 +53870,21 @@ bool js_cocos2dx_TransitionMoveInT_constructor(JSContext *cx, uint32_t argc, jsv if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_TransitionMoveInT_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::TransitionMoveInT *nobj = new (std::nothrow) cocos2d::TransitionMoveInT(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::TransitionMoveInT"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_TransitionMoveInL_prototype; @@ -52275,6 +53892,7 @@ extern JSObject *jsb_cocos2d_TransitionMoveInL_prototype; void js_cocos2d_TransitionMoveInT_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (TransitionMoveInT)", obj); } + void js_register_cocos2dx_TransitionMoveInT(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_TransitionMoveInT_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_TransitionMoveInT_class->name = "TransitionMoveInT"; @@ -52294,6 +53912,7 @@ void js_register_cocos2dx_TransitionMoveInT(JSContext *cx, JS::HandleObject glob }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_TransitionMoveInT_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -52328,6 +53947,7 @@ void js_register_cocos2dx_TransitionMoveInT(JSContext *cx, JS::HandleObject glob p->parentProto = jsb_cocos2d_TransitionMoveInL_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.TransitionMoveInT.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_TransitionMoveInB_class; @@ -52338,8 +53958,8 @@ bool js_cocos2dx_TransitionMoveInB_create(JSContext *cx, uint32_t argc, jsval *v JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; - cocos2d::Scene* arg1; + double arg0 = 0; + cocos2d::Scene* arg1 = nullptr; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -52395,6 +54015,21 @@ bool js_cocos2dx_TransitionMoveInB_constructor(JSContext *cx, uint32_t argc, jsv if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_TransitionMoveInB_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::TransitionMoveInB *nobj = new (std::nothrow) cocos2d::TransitionMoveInB(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::TransitionMoveInB"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_TransitionMoveInL_prototype; @@ -52402,6 +54037,7 @@ extern JSObject *jsb_cocos2d_TransitionMoveInL_prototype; void js_cocos2d_TransitionMoveInB_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (TransitionMoveInB)", obj); } + void js_register_cocos2dx_TransitionMoveInB(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_TransitionMoveInB_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_TransitionMoveInB_class->name = "TransitionMoveInB"; @@ -52421,6 +54057,7 @@ void js_register_cocos2dx_TransitionMoveInB(JSContext *cx, JS::HandleObject glob }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_TransitionMoveInB_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -52455,6 +54092,7 @@ void js_register_cocos2dx_TransitionMoveInB(JSContext *cx, JS::HandleObject glob p->parentProto = jsb_cocos2d_TransitionMoveInL_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.TransitionMoveInB.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_TransitionSlideInL_class; @@ -52494,7 +54132,7 @@ bool js_cocos2dx_TransitionSlideInL_easeActionWithAction(JSContext *cx, uint32_t cocos2d::TransitionSlideInL* cobj = (cocos2d::TransitionSlideInL *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TransitionSlideInL_easeActionWithAction : Invalid Native Object"); if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -52527,8 +54165,8 @@ bool js_cocos2dx_TransitionSlideInL_create(JSContext *cx, uint32_t argc, jsval * JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; - cocos2d::Scene* arg1; + double arg0 = 0; + cocos2d::Scene* arg1 = nullptr; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -52584,6 +54222,21 @@ bool js_cocos2dx_TransitionSlideInL_constructor(JSContext *cx, uint32_t argc, js if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_TransitionSlideInL_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::TransitionSlideInL *nobj = new (std::nothrow) cocos2d::TransitionSlideInL(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::TransitionSlideInL"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_TransitionScene_prototype; @@ -52591,6 +54244,7 @@ extern JSObject *jsb_cocos2d_TransitionScene_prototype; void js_cocos2d_TransitionSlideInL_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (TransitionSlideInL)", obj); } + void js_register_cocos2dx_TransitionSlideInL(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_TransitionSlideInL_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_TransitionSlideInL_class->name = "TransitionSlideInL"; @@ -52612,6 +54266,7 @@ void js_register_cocos2dx_TransitionSlideInL(JSContext *cx, JS::HandleObject glo static JSFunctionSpec funcs[] = { JS_FN("action", js_cocos2dx_TransitionSlideInL_action, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("easeActionWithAction", js_cocos2dx_TransitionSlideInL_easeActionWithAction, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_TransitionSlideInL_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -52646,6 +54301,7 @@ void js_register_cocos2dx_TransitionSlideInL(JSContext *cx, JS::HandleObject glo p->parentProto = jsb_cocos2d_TransitionScene_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.TransitionSlideInL.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_TransitionSlideInR_class; @@ -52656,8 +54312,8 @@ bool js_cocos2dx_TransitionSlideInR_create(JSContext *cx, uint32_t argc, jsval * JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; - cocos2d::Scene* arg1; + double arg0 = 0; + cocos2d::Scene* arg1 = nullptr; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -52713,6 +54369,21 @@ bool js_cocos2dx_TransitionSlideInR_constructor(JSContext *cx, uint32_t argc, js if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_TransitionSlideInR_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::TransitionSlideInR *nobj = new (std::nothrow) cocos2d::TransitionSlideInR(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::TransitionSlideInR"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_TransitionSlideInL_prototype; @@ -52720,6 +54391,7 @@ extern JSObject *jsb_cocos2d_TransitionSlideInL_prototype; void js_cocos2d_TransitionSlideInR_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (TransitionSlideInR)", obj); } + void js_register_cocos2dx_TransitionSlideInR(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_TransitionSlideInR_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_TransitionSlideInR_class->name = "TransitionSlideInR"; @@ -52739,6 +54411,7 @@ void js_register_cocos2dx_TransitionSlideInR(JSContext *cx, JS::HandleObject glo }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_TransitionSlideInR_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -52773,6 +54446,7 @@ void js_register_cocos2dx_TransitionSlideInR(JSContext *cx, JS::HandleObject glo p->parentProto = jsb_cocos2d_TransitionSlideInL_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.TransitionSlideInR.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_TransitionSlideInB_class; @@ -52783,8 +54457,8 @@ bool js_cocos2dx_TransitionSlideInB_create(JSContext *cx, uint32_t argc, jsval * JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; - cocos2d::Scene* arg1; + double arg0 = 0; + cocos2d::Scene* arg1 = nullptr; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -52840,6 +54514,21 @@ bool js_cocos2dx_TransitionSlideInB_constructor(JSContext *cx, uint32_t argc, js if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_TransitionSlideInB_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::TransitionSlideInB *nobj = new (std::nothrow) cocos2d::TransitionSlideInB(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::TransitionSlideInB"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_TransitionSlideInL_prototype; @@ -52847,6 +54536,7 @@ extern JSObject *jsb_cocos2d_TransitionSlideInL_prototype; void js_cocos2d_TransitionSlideInB_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (TransitionSlideInB)", obj); } + void js_register_cocos2dx_TransitionSlideInB(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_TransitionSlideInB_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_TransitionSlideInB_class->name = "TransitionSlideInB"; @@ -52866,6 +54556,7 @@ void js_register_cocos2dx_TransitionSlideInB(JSContext *cx, JS::HandleObject glo }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_TransitionSlideInB_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -52900,6 +54591,7 @@ void js_register_cocos2dx_TransitionSlideInB(JSContext *cx, JS::HandleObject glo p->parentProto = jsb_cocos2d_TransitionSlideInL_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.TransitionSlideInB.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_TransitionSlideInT_class; @@ -52910,8 +54602,8 @@ bool js_cocos2dx_TransitionSlideInT_create(JSContext *cx, uint32_t argc, jsval * JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; - cocos2d::Scene* arg1; + double arg0 = 0; + cocos2d::Scene* arg1 = nullptr; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -52967,6 +54659,21 @@ bool js_cocos2dx_TransitionSlideInT_constructor(JSContext *cx, uint32_t argc, js if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_TransitionSlideInT_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::TransitionSlideInT *nobj = new (std::nothrow) cocos2d::TransitionSlideInT(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::TransitionSlideInT"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_TransitionSlideInL_prototype; @@ -52974,6 +54681,7 @@ extern JSObject *jsb_cocos2d_TransitionSlideInL_prototype; void js_cocos2d_TransitionSlideInT_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (TransitionSlideInT)", obj); } + void js_register_cocos2dx_TransitionSlideInT(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_TransitionSlideInT_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_TransitionSlideInT_class->name = "TransitionSlideInT"; @@ -52993,6 +54701,7 @@ void js_register_cocos2dx_TransitionSlideInT(JSContext *cx, JS::HandleObject glo }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_TransitionSlideInT_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -53027,6 +54736,7 @@ void js_register_cocos2dx_TransitionSlideInT(JSContext *cx, JS::HandleObject glo p->parentProto = jsb_cocos2d_TransitionSlideInL_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.TransitionSlideInT.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_TransitionShrinkGrow_class; @@ -53041,7 +54751,7 @@ bool js_cocos2dx_TransitionShrinkGrow_easeActionWithAction(JSContext *cx, uint32 cocos2d::TransitionShrinkGrow* cobj = (cocos2d::TransitionShrinkGrow *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TransitionShrinkGrow_easeActionWithAction : Invalid Native Object"); if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -53074,8 +54784,8 @@ bool js_cocos2dx_TransitionShrinkGrow_create(JSContext *cx, uint32_t argc, jsval JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; - cocos2d::Scene* arg1; + double arg0 = 0; + cocos2d::Scene* arg1 = nullptr; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -53131,6 +54841,21 @@ bool js_cocos2dx_TransitionShrinkGrow_constructor(JSContext *cx, uint32_t argc, if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_TransitionShrinkGrow_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::TransitionShrinkGrow *nobj = new (std::nothrow) cocos2d::TransitionShrinkGrow(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::TransitionShrinkGrow"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_TransitionScene_prototype; @@ -53138,6 +54863,7 @@ extern JSObject *jsb_cocos2d_TransitionScene_prototype; void js_cocos2d_TransitionShrinkGrow_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (TransitionShrinkGrow)", obj); } + void js_register_cocos2dx_TransitionShrinkGrow(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_TransitionShrinkGrow_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_TransitionShrinkGrow_class->name = "TransitionShrinkGrow"; @@ -53158,6 +54884,7 @@ void js_register_cocos2dx_TransitionShrinkGrow(JSContext *cx, JS::HandleObject g static JSFunctionSpec funcs[] = { JS_FN("easeActionWithAction", js_cocos2dx_TransitionShrinkGrow_easeActionWithAction, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_TransitionShrinkGrow_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -53192,6 +54919,7 @@ void js_register_cocos2dx_TransitionShrinkGrow(JSContext *cx, JS::HandleObject g p->parentProto = jsb_cocos2d_TransitionScene_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.TransitionShrinkGrow.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_TransitionFlipX_class; @@ -53204,10 +54932,10 @@ bool js_cocos2dx_TransitionFlipX_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 2) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - cocos2d::Scene* arg1; + cocos2d::Scene* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -53235,10 +54963,10 @@ bool js_cocos2dx_TransitionFlipX_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 3) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - cocos2d::Scene* arg1; + cocos2d::Scene* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -53296,6 +55024,21 @@ bool js_cocos2dx_TransitionFlipX_constructor(JSContext *cx, uint32_t argc, jsval if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_TransitionFlipX_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::TransitionFlipX *nobj = new (std::nothrow) cocos2d::TransitionFlipX(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::TransitionFlipX"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_TransitionSceneOriented_prototype; @@ -53303,6 +55046,7 @@ extern JSObject *jsb_cocos2d_TransitionSceneOriented_prototype; void js_cocos2d_TransitionFlipX_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (TransitionFlipX)", obj); } + void js_register_cocos2dx_TransitionFlipX(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_TransitionFlipX_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_TransitionFlipX_class->name = "TransitionFlipX"; @@ -53322,6 +55066,7 @@ void js_register_cocos2dx_TransitionFlipX(JSContext *cx, JS::HandleObject global }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_TransitionFlipX_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -53356,6 +55101,7 @@ void js_register_cocos2dx_TransitionFlipX(JSContext *cx, JS::HandleObject global p->parentProto = jsb_cocos2d_TransitionSceneOriented_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.TransitionFlipX.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_TransitionFlipY_class; @@ -53368,10 +55114,10 @@ bool js_cocos2dx_TransitionFlipY_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 2) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - cocos2d::Scene* arg1; + cocos2d::Scene* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -53399,10 +55145,10 @@ bool js_cocos2dx_TransitionFlipY_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 3) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - cocos2d::Scene* arg1; + cocos2d::Scene* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -53460,6 +55206,21 @@ bool js_cocos2dx_TransitionFlipY_constructor(JSContext *cx, uint32_t argc, jsval if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_TransitionFlipY_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::TransitionFlipY *nobj = new (std::nothrow) cocos2d::TransitionFlipY(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::TransitionFlipY"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_TransitionSceneOriented_prototype; @@ -53467,6 +55228,7 @@ extern JSObject *jsb_cocos2d_TransitionSceneOriented_prototype; void js_cocos2d_TransitionFlipY_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (TransitionFlipY)", obj); } + void js_register_cocos2dx_TransitionFlipY(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_TransitionFlipY_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_TransitionFlipY_class->name = "TransitionFlipY"; @@ -53486,6 +55248,7 @@ void js_register_cocos2dx_TransitionFlipY(JSContext *cx, JS::HandleObject global }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_TransitionFlipY_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -53520,6 +55283,7 @@ void js_register_cocos2dx_TransitionFlipY(JSContext *cx, JS::HandleObject global p->parentProto = jsb_cocos2d_TransitionSceneOriented_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.TransitionFlipY.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_TransitionFlipAngular_class; @@ -53532,10 +55296,10 @@ bool js_cocos2dx_TransitionFlipAngular_create(JSContext *cx, uint32_t argc, jsva do { if (argc == 2) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - cocos2d::Scene* arg1; + cocos2d::Scene* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -53563,10 +55327,10 @@ bool js_cocos2dx_TransitionFlipAngular_create(JSContext *cx, uint32_t argc, jsva do { if (argc == 3) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - cocos2d::Scene* arg1; + cocos2d::Scene* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -53624,6 +55388,21 @@ bool js_cocos2dx_TransitionFlipAngular_constructor(JSContext *cx, uint32_t argc, if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_TransitionFlipAngular_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::TransitionFlipAngular *nobj = new (std::nothrow) cocos2d::TransitionFlipAngular(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::TransitionFlipAngular"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_TransitionSceneOriented_prototype; @@ -53631,6 +55410,7 @@ extern JSObject *jsb_cocos2d_TransitionSceneOriented_prototype; void js_cocos2d_TransitionFlipAngular_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (TransitionFlipAngular)", obj); } + void js_register_cocos2dx_TransitionFlipAngular(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_TransitionFlipAngular_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_TransitionFlipAngular_class->name = "TransitionFlipAngular"; @@ -53650,6 +55430,7 @@ void js_register_cocos2dx_TransitionFlipAngular(JSContext *cx, JS::HandleObject }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_TransitionFlipAngular_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -53684,6 +55465,7 @@ void js_register_cocos2dx_TransitionFlipAngular(JSContext *cx, JS::HandleObject p->parentProto = jsb_cocos2d_TransitionSceneOriented_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.TransitionFlipAngular.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_TransitionZoomFlipX_class; @@ -53696,10 +55478,10 @@ bool js_cocos2dx_TransitionZoomFlipX_create(JSContext *cx, uint32_t argc, jsval do { if (argc == 2) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - cocos2d::Scene* arg1; + cocos2d::Scene* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -53727,10 +55509,10 @@ bool js_cocos2dx_TransitionZoomFlipX_create(JSContext *cx, uint32_t argc, jsval do { if (argc == 3) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - cocos2d::Scene* arg1; + cocos2d::Scene* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -53788,6 +55570,21 @@ bool js_cocos2dx_TransitionZoomFlipX_constructor(JSContext *cx, uint32_t argc, j if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_TransitionZoomFlipX_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::TransitionZoomFlipX *nobj = new (std::nothrow) cocos2d::TransitionZoomFlipX(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::TransitionZoomFlipX"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_TransitionSceneOriented_prototype; @@ -53795,6 +55592,7 @@ extern JSObject *jsb_cocos2d_TransitionSceneOriented_prototype; void js_cocos2d_TransitionZoomFlipX_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (TransitionZoomFlipX)", obj); } + void js_register_cocos2dx_TransitionZoomFlipX(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_TransitionZoomFlipX_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_TransitionZoomFlipX_class->name = "TransitionZoomFlipX"; @@ -53814,6 +55612,7 @@ void js_register_cocos2dx_TransitionZoomFlipX(JSContext *cx, JS::HandleObject gl }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_TransitionZoomFlipX_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -53848,6 +55647,7 @@ void js_register_cocos2dx_TransitionZoomFlipX(JSContext *cx, JS::HandleObject gl p->parentProto = jsb_cocos2d_TransitionSceneOriented_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.TransitionZoomFlipX.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_TransitionZoomFlipY_class; @@ -53860,10 +55660,10 @@ bool js_cocos2dx_TransitionZoomFlipY_create(JSContext *cx, uint32_t argc, jsval do { if (argc == 2) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - cocos2d::Scene* arg1; + cocos2d::Scene* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -53891,10 +55691,10 @@ bool js_cocos2dx_TransitionZoomFlipY_create(JSContext *cx, uint32_t argc, jsval do { if (argc == 3) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - cocos2d::Scene* arg1; + cocos2d::Scene* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -53952,6 +55752,21 @@ bool js_cocos2dx_TransitionZoomFlipY_constructor(JSContext *cx, uint32_t argc, j if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_TransitionZoomFlipY_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::TransitionZoomFlipY *nobj = new (std::nothrow) cocos2d::TransitionZoomFlipY(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::TransitionZoomFlipY"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_TransitionSceneOriented_prototype; @@ -53959,6 +55774,7 @@ extern JSObject *jsb_cocos2d_TransitionSceneOriented_prototype; void js_cocos2d_TransitionZoomFlipY_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (TransitionZoomFlipY)", obj); } + void js_register_cocos2dx_TransitionZoomFlipY(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_TransitionZoomFlipY_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_TransitionZoomFlipY_class->name = "TransitionZoomFlipY"; @@ -53978,6 +55794,7 @@ void js_register_cocos2dx_TransitionZoomFlipY(JSContext *cx, JS::HandleObject gl }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_TransitionZoomFlipY_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -54012,6 +55829,7 @@ void js_register_cocos2dx_TransitionZoomFlipY(JSContext *cx, JS::HandleObject gl p->parentProto = jsb_cocos2d_TransitionSceneOriented_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.TransitionZoomFlipY.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_TransitionZoomFlipAngular_class; @@ -54024,10 +55842,10 @@ bool js_cocos2dx_TransitionZoomFlipAngular_create(JSContext *cx, uint32_t argc, do { if (argc == 2) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - cocos2d::Scene* arg1; + cocos2d::Scene* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -54055,10 +55873,10 @@ bool js_cocos2dx_TransitionZoomFlipAngular_create(JSContext *cx, uint32_t argc, do { if (argc == 3) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - cocos2d::Scene* arg1; + cocos2d::Scene* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -54116,6 +55934,21 @@ bool js_cocos2dx_TransitionZoomFlipAngular_constructor(JSContext *cx, uint32_t a if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_TransitionZoomFlipAngular_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::TransitionZoomFlipAngular *nobj = new (std::nothrow) cocos2d::TransitionZoomFlipAngular(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::TransitionZoomFlipAngular"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_TransitionSceneOriented_prototype; @@ -54123,6 +55956,7 @@ extern JSObject *jsb_cocos2d_TransitionSceneOriented_prototype; void js_cocos2d_TransitionZoomFlipAngular_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (TransitionZoomFlipAngular)", obj); } + void js_register_cocos2dx_TransitionZoomFlipAngular(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_TransitionZoomFlipAngular_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_TransitionZoomFlipAngular_class->name = "TransitionZoomFlipAngular"; @@ -54142,6 +55976,7 @@ void js_register_cocos2dx_TransitionZoomFlipAngular(JSContext *cx, JS::HandleObj }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_TransitionZoomFlipAngular_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -54176,6 +56011,7 @@ void js_register_cocos2dx_TransitionZoomFlipAngular(JSContext *cx, JS::HandleObj p->parentProto = jsb_cocos2d_TransitionSceneOriented_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.TransitionZoomFlipAngular.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_TransitionFade_class; @@ -54194,10 +56030,10 @@ bool js_cocos2dx_TransitionFade_initWithDuration(JSContext *cx, uint32_t argc, j JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TransitionFade_initWithDuration : Invalid Native Object"); do { if (argc == 2) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - cocos2d::Scene* arg1; + cocos2d::Scene* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -54218,10 +56054,10 @@ bool js_cocos2dx_TransitionFade_initWithDuration(JSContext *cx, uint32_t argc, j do { if (argc == 3) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - cocos2d::Scene* arg1; + cocos2d::Scene* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -54253,10 +56089,10 @@ bool js_cocos2dx_TransitionFade_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 2) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - cocos2d::Scene* arg1; + cocos2d::Scene* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -54284,10 +56120,10 @@ bool js_cocos2dx_TransitionFade_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 3) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - cocos2d::Scene* arg1; + cocos2d::Scene* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -54345,6 +56181,21 @@ bool js_cocos2dx_TransitionFade_constructor(JSContext *cx, uint32_t argc, jsval if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_TransitionFade_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::TransitionFade *nobj = new (std::nothrow) cocos2d::TransitionFade(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::TransitionFade"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_TransitionScene_prototype; @@ -54352,6 +56203,7 @@ extern JSObject *jsb_cocos2d_TransitionScene_prototype; void js_cocos2d_TransitionFade_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (TransitionFade)", obj); } + void js_register_cocos2dx_TransitionFade(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_TransitionFade_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_TransitionFade_class->name = "TransitionFade"; @@ -54372,6 +56224,7 @@ void js_register_cocos2dx_TransitionFade(JSContext *cx, JS::HandleObject global) static JSFunctionSpec funcs[] = { JS_FN("initWithDuration", js_cocos2dx_TransitionFade_initWithDuration, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_TransitionFade_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -54406,6 +56259,7 @@ void js_register_cocos2dx_TransitionFade(JSContext *cx, JS::HandleObject global) p->parentProto = jsb_cocos2d_TransitionScene_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.TransitionFade.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_TransitionCrossFade_class; @@ -54416,8 +56270,8 @@ bool js_cocos2dx_TransitionCrossFade_create(JSContext *cx, uint32_t argc, jsval JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; - cocos2d::Scene* arg1; + double arg0 = 0; + cocos2d::Scene* arg1 = nullptr; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -54473,6 +56327,21 @@ bool js_cocos2dx_TransitionCrossFade_constructor(JSContext *cx, uint32_t argc, j if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_TransitionCrossFade_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::TransitionCrossFade *nobj = new (std::nothrow) cocos2d::TransitionCrossFade(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::TransitionCrossFade"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_TransitionScene_prototype; @@ -54480,6 +56349,7 @@ extern JSObject *jsb_cocos2d_TransitionScene_prototype; void js_cocos2d_TransitionCrossFade_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (TransitionCrossFade)", obj); } + void js_register_cocos2dx_TransitionCrossFade(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_TransitionCrossFade_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_TransitionCrossFade_class->name = "TransitionCrossFade"; @@ -54499,6 +56369,7 @@ void js_register_cocos2dx_TransitionCrossFade(JSContext *cx, JS::HandleObject gl }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_TransitionCrossFade_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -54533,6 +56404,7 @@ void js_register_cocos2dx_TransitionCrossFade(JSContext *cx, JS::HandleObject gl p->parentProto = jsb_cocos2d_TransitionScene_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.TransitionCrossFade.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_TransitionTurnOffTiles_class; @@ -54547,7 +56419,7 @@ bool js_cocos2dx_TransitionTurnOffTiles_easeActionWithAction(JSContext *cx, uint cocos2d::TransitionTurnOffTiles* cobj = (cocos2d::TransitionTurnOffTiles *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TransitionTurnOffTiles_easeActionWithAction : Invalid Native Object"); if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -54580,8 +56452,8 @@ bool js_cocos2dx_TransitionTurnOffTiles_create(JSContext *cx, uint32_t argc, jsv JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; - cocos2d::Scene* arg1; + double arg0 = 0; + cocos2d::Scene* arg1 = nullptr; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -54637,6 +56509,21 @@ bool js_cocos2dx_TransitionTurnOffTiles_constructor(JSContext *cx, uint32_t argc if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_TransitionTurnOffTiles_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::TransitionTurnOffTiles *nobj = new (std::nothrow) cocos2d::TransitionTurnOffTiles(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::TransitionTurnOffTiles"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_TransitionScene_prototype; @@ -54644,6 +56531,7 @@ extern JSObject *jsb_cocos2d_TransitionScene_prototype; void js_cocos2d_TransitionTurnOffTiles_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (TransitionTurnOffTiles)", obj); } + void js_register_cocos2dx_TransitionTurnOffTiles(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_TransitionTurnOffTiles_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_TransitionTurnOffTiles_class->name = "TransitionTurnOffTiles"; @@ -54664,6 +56552,7 @@ void js_register_cocos2dx_TransitionTurnOffTiles(JSContext *cx, JS::HandleObject static JSFunctionSpec funcs[] = { JS_FN("easeActionWithAction", js_cocos2dx_TransitionTurnOffTiles_easeActionWithAction, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_TransitionTurnOffTiles_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -54698,6 +56587,7 @@ void js_register_cocos2dx_TransitionTurnOffTiles(JSContext *cx, JS::HandleObject p->parentProto = jsb_cocos2d_TransitionScene_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.TransitionTurnOffTiles.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_TransitionSplitCols_class; @@ -54737,7 +56627,7 @@ bool js_cocos2dx_TransitionSplitCols_easeActionWithAction(JSContext *cx, uint32_ cocos2d::TransitionSplitCols* cobj = (cocos2d::TransitionSplitCols *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TransitionSplitCols_easeActionWithAction : Invalid Native Object"); if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -54770,8 +56660,8 @@ bool js_cocos2dx_TransitionSplitCols_create(JSContext *cx, uint32_t argc, jsval JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; - cocos2d::Scene* arg1; + double arg0 = 0; + cocos2d::Scene* arg1 = nullptr; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -54827,6 +56717,21 @@ bool js_cocos2dx_TransitionSplitCols_constructor(JSContext *cx, uint32_t argc, j if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_TransitionSplitCols_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::TransitionSplitCols *nobj = new (std::nothrow) cocos2d::TransitionSplitCols(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::TransitionSplitCols"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_TransitionScene_prototype; @@ -54834,6 +56739,7 @@ extern JSObject *jsb_cocos2d_TransitionScene_prototype; void js_cocos2d_TransitionSplitCols_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (TransitionSplitCols)", obj); } + void js_register_cocos2dx_TransitionSplitCols(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_TransitionSplitCols_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_TransitionSplitCols_class->name = "TransitionSplitCols"; @@ -54855,6 +56761,7 @@ void js_register_cocos2dx_TransitionSplitCols(JSContext *cx, JS::HandleObject gl static JSFunctionSpec funcs[] = { JS_FN("action", js_cocos2dx_TransitionSplitCols_action, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("easeActionWithAction", js_cocos2dx_TransitionSplitCols_easeActionWithAction, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_TransitionSplitCols_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -54889,6 +56796,7 @@ void js_register_cocos2dx_TransitionSplitCols(JSContext *cx, JS::HandleObject gl p->parentProto = jsb_cocos2d_TransitionScene_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.TransitionSplitCols.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_TransitionSplitRows_class; @@ -54899,8 +56807,8 @@ bool js_cocos2dx_TransitionSplitRows_create(JSContext *cx, uint32_t argc, jsval JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; - cocos2d::Scene* arg1; + double arg0 = 0; + cocos2d::Scene* arg1 = nullptr; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -54956,6 +56864,21 @@ bool js_cocos2dx_TransitionSplitRows_constructor(JSContext *cx, uint32_t argc, j if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_TransitionSplitRows_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::TransitionSplitRows *nobj = new (std::nothrow) cocos2d::TransitionSplitRows(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::TransitionSplitRows"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_TransitionSplitCols_prototype; @@ -54963,6 +56886,7 @@ extern JSObject *jsb_cocos2d_TransitionSplitCols_prototype; void js_cocos2d_TransitionSplitRows_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (TransitionSplitRows)", obj); } + void js_register_cocos2dx_TransitionSplitRows(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_TransitionSplitRows_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_TransitionSplitRows_class->name = "TransitionSplitRows"; @@ -54982,6 +56906,7 @@ void js_register_cocos2dx_TransitionSplitRows(JSContext *cx, JS::HandleObject gl }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_TransitionSplitRows_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -55016,6 +56941,7 @@ void js_register_cocos2dx_TransitionSplitRows(JSContext *cx, JS::HandleObject gl p->parentProto = jsb_cocos2d_TransitionSplitCols_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.TransitionSplitRows.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_TransitionFadeTR_class; @@ -55030,7 +56956,7 @@ bool js_cocos2dx_TransitionFadeTR_easeActionWithAction(JSContext *cx, uint32_t a cocos2d::TransitionFadeTR* cobj = (cocos2d::TransitionFadeTR *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TransitionFadeTR_easeActionWithAction : Invalid Native Object"); if (argc == 1) { - cocos2d::ActionInterval* arg0; + cocos2d::ActionInterval* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -55092,8 +57018,8 @@ bool js_cocos2dx_TransitionFadeTR_create(JSContext *cx, uint32_t argc, jsval *vp JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; - cocos2d::Scene* arg1; + double arg0 = 0; + cocos2d::Scene* arg1 = nullptr; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -55149,6 +57075,21 @@ bool js_cocos2dx_TransitionFadeTR_constructor(JSContext *cx, uint32_t argc, jsva if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_TransitionFadeTR_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::TransitionFadeTR *nobj = new (std::nothrow) cocos2d::TransitionFadeTR(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::TransitionFadeTR"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_TransitionScene_prototype; @@ -55156,6 +57097,7 @@ extern JSObject *jsb_cocos2d_TransitionScene_prototype; void js_cocos2d_TransitionFadeTR_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (TransitionFadeTR)", obj); } + void js_register_cocos2dx_TransitionFadeTR(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_TransitionFadeTR_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_TransitionFadeTR_class->name = "TransitionFadeTR"; @@ -55177,6 +57119,7 @@ void js_register_cocos2dx_TransitionFadeTR(JSContext *cx, JS::HandleObject globa static JSFunctionSpec funcs[] = { JS_FN("easeActionWithAction", js_cocos2dx_TransitionFadeTR_easeActionWithAction, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("actionWithSize", js_cocos2dx_TransitionFadeTR_actionWithSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_TransitionFadeTR_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -55211,6 +57154,7 @@ void js_register_cocos2dx_TransitionFadeTR(JSContext *cx, JS::HandleObject globa p->parentProto = jsb_cocos2d_TransitionScene_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.TransitionFadeTR.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_TransitionFadeBL_class; @@ -55221,8 +57165,8 @@ bool js_cocos2dx_TransitionFadeBL_create(JSContext *cx, uint32_t argc, jsval *vp JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; - cocos2d::Scene* arg1; + double arg0 = 0; + cocos2d::Scene* arg1 = nullptr; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -55278,6 +57222,21 @@ bool js_cocos2dx_TransitionFadeBL_constructor(JSContext *cx, uint32_t argc, jsva if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_TransitionFadeBL_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::TransitionFadeBL *nobj = new (std::nothrow) cocos2d::TransitionFadeBL(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::TransitionFadeBL"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_TransitionFadeTR_prototype; @@ -55285,6 +57244,7 @@ extern JSObject *jsb_cocos2d_TransitionFadeTR_prototype; void js_cocos2d_TransitionFadeBL_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (TransitionFadeBL)", obj); } + void js_register_cocos2dx_TransitionFadeBL(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_TransitionFadeBL_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_TransitionFadeBL_class->name = "TransitionFadeBL"; @@ -55304,6 +57264,7 @@ void js_register_cocos2dx_TransitionFadeBL(JSContext *cx, JS::HandleObject globa }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_TransitionFadeBL_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -55338,6 +57299,7 @@ void js_register_cocos2dx_TransitionFadeBL(JSContext *cx, JS::HandleObject globa p->parentProto = jsb_cocos2d_TransitionFadeTR_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.TransitionFadeBL.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_TransitionFadeUp_class; @@ -55348,8 +57310,8 @@ bool js_cocos2dx_TransitionFadeUp_create(JSContext *cx, uint32_t argc, jsval *vp JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; - cocos2d::Scene* arg1; + double arg0 = 0; + cocos2d::Scene* arg1 = nullptr; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -55405,6 +57367,21 @@ bool js_cocos2dx_TransitionFadeUp_constructor(JSContext *cx, uint32_t argc, jsva if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_TransitionFadeUp_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::TransitionFadeUp *nobj = new (std::nothrow) cocos2d::TransitionFadeUp(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::TransitionFadeUp"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_TransitionFadeTR_prototype; @@ -55412,6 +57389,7 @@ extern JSObject *jsb_cocos2d_TransitionFadeTR_prototype; void js_cocos2d_TransitionFadeUp_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (TransitionFadeUp)", obj); } + void js_register_cocos2dx_TransitionFadeUp(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_TransitionFadeUp_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_TransitionFadeUp_class->name = "TransitionFadeUp"; @@ -55431,6 +57409,7 @@ void js_register_cocos2dx_TransitionFadeUp(JSContext *cx, JS::HandleObject globa }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_TransitionFadeUp_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -55465,6 +57444,7 @@ void js_register_cocos2dx_TransitionFadeUp(JSContext *cx, JS::HandleObject globa p->parentProto = jsb_cocos2d_TransitionFadeTR_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.TransitionFadeUp.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_TransitionFadeDown_class; @@ -55475,8 +57455,8 @@ bool js_cocos2dx_TransitionFadeDown_create(JSContext *cx, uint32_t argc, jsval * JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; - cocos2d::Scene* arg1; + double arg0 = 0; + cocos2d::Scene* arg1 = nullptr; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -55532,6 +57512,21 @@ bool js_cocos2dx_TransitionFadeDown_constructor(JSContext *cx, uint32_t argc, js if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_TransitionFadeDown_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::TransitionFadeDown *nobj = new (std::nothrow) cocos2d::TransitionFadeDown(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::TransitionFadeDown"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_TransitionFadeTR_prototype; @@ -55539,6 +57534,7 @@ extern JSObject *jsb_cocos2d_TransitionFadeTR_prototype; void js_cocos2d_TransitionFadeDown_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (TransitionFadeDown)", obj); } + void js_register_cocos2dx_TransitionFadeDown(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_TransitionFadeDown_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_TransitionFadeDown_class->name = "TransitionFadeDown"; @@ -55558,6 +57554,7 @@ void js_register_cocos2dx_TransitionFadeDown(JSContext *cx, JS::HandleObject glo }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_TransitionFadeDown_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -55592,6 +57589,7 @@ void js_register_cocos2dx_TransitionFadeDown(JSContext *cx, JS::HandleObject glo p->parentProto = jsb_cocos2d_TransitionFadeTR_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.TransitionFadeDown.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_TransitionPageTurn_class; @@ -55635,8 +57633,8 @@ bool js_cocos2dx_TransitionPageTurn_initWithDuration(JSContext *cx, uint32_t arg cocos2d::TransitionPageTurn* cobj = (cocos2d::TransitionPageTurn *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TransitionPageTurn_initWithDuration : Invalid Native Object"); if (argc == 3) { - double arg0; - cocos2d::Scene* arg1; + double arg0 = 0; + cocos2d::Scene* arg1 = nullptr; bool arg2; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); do { @@ -55665,8 +57663,8 @@ bool js_cocos2dx_TransitionPageTurn_create(JSContext *cx, uint32_t argc, jsval * JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 3) { - double arg0; - cocos2d::Scene* arg1; + double arg0 = 0; + cocos2d::Scene* arg1 = nullptr; bool arg2; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); do { @@ -55724,6 +57722,21 @@ bool js_cocos2dx_TransitionPageTurn_constructor(JSContext *cx, uint32_t argc, js if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_TransitionPageTurn_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::TransitionPageTurn *nobj = new (std::nothrow) cocos2d::TransitionPageTurn(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::TransitionPageTurn"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_TransitionScene_prototype; @@ -55731,6 +57744,7 @@ extern JSObject *jsb_cocos2d_TransitionScene_prototype; void js_cocos2d_TransitionPageTurn_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (TransitionPageTurn)", obj); } + void js_register_cocos2dx_TransitionPageTurn(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_TransitionPageTurn_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_TransitionPageTurn_class->name = "TransitionPageTurn"; @@ -55752,6 +57766,7 @@ void js_register_cocos2dx_TransitionPageTurn(JSContext *cx, JS::HandleObject glo static JSFunctionSpec funcs[] = { JS_FN("actionWithSize", js_cocos2dx_TransitionPageTurn_actionWithSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("initWithDuration", js_cocos2dx_TransitionPageTurn_initWithDuration, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_TransitionPageTurn_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -55786,6 +57801,7 @@ void js_register_cocos2dx_TransitionPageTurn(JSContext *cx, JS::HandleObject glo p->parentProto = jsb_cocos2d_TransitionScene_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.TransitionPageTurn.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_TransitionProgress_class; @@ -55796,8 +57812,8 @@ bool js_cocos2dx_TransitionProgress_create(JSContext *cx, uint32_t argc, jsval * JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; - cocos2d::Scene* arg1; + double arg0 = 0; + cocos2d::Scene* arg1 = nullptr; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -55853,6 +57869,21 @@ bool js_cocos2dx_TransitionProgress_constructor(JSContext *cx, uint32_t argc, js if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_TransitionProgress_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::TransitionProgress *nobj = new (std::nothrow) cocos2d::TransitionProgress(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::TransitionProgress"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_TransitionScene_prototype; @@ -55860,6 +57891,7 @@ extern JSObject *jsb_cocos2d_TransitionScene_prototype; void js_cocos2d_TransitionProgress_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (TransitionProgress)", obj); } + void js_register_cocos2dx_TransitionProgress(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_TransitionProgress_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_TransitionProgress_class->name = "TransitionProgress"; @@ -55879,6 +57911,7 @@ void js_register_cocos2dx_TransitionProgress(JSContext *cx, JS::HandleObject glo }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_TransitionProgress_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -55913,6 +57946,7 @@ void js_register_cocos2dx_TransitionProgress(JSContext *cx, JS::HandleObject glo p->parentProto = jsb_cocos2d_TransitionScene_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.TransitionProgress.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_TransitionProgressRadialCCW_class; @@ -55923,8 +57957,8 @@ bool js_cocos2dx_TransitionProgressRadialCCW_create(JSContext *cx, uint32_t argc JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; - cocos2d::Scene* arg1; + double arg0 = 0; + cocos2d::Scene* arg1 = nullptr; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -55980,6 +58014,21 @@ bool js_cocos2dx_TransitionProgressRadialCCW_constructor(JSContext *cx, uint32_t if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_TransitionProgressRadialCCW_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::TransitionProgressRadialCCW *nobj = new (std::nothrow) cocos2d::TransitionProgressRadialCCW(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::TransitionProgressRadialCCW"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_TransitionProgress_prototype; @@ -55987,6 +58036,7 @@ extern JSObject *jsb_cocos2d_TransitionProgress_prototype; void js_cocos2d_TransitionProgressRadialCCW_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (TransitionProgressRadialCCW)", obj); } + void js_register_cocos2dx_TransitionProgressRadialCCW(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_TransitionProgressRadialCCW_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_TransitionProgressRadialCCW_class->name = "TransitionProgressRadialCCW"; @@ -56006,6 +58056,7 @@ void js_register_cocos2dx_TransitionProgressRadialCCW(JSContext *cx, JS::HandleO }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_TransitionProgressRadialCCW_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -56040,6 +58091,7 @@ void js_register_cocos2dx_TransitionProgressRadialCCW(JSContext *cx, JS::HandleO p->parentProto = jsb_cocos2d_TransitionProgress_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.TransitionProgressRadialCCW.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_TransitionProgressRadialCW_class; @@ -56050,8 +58102,8 @@ bool js_cocos2dx_TransitionProgressRadialCW_create(JSContext *cx, uint32_t argc, JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; - cocos2d::Scene* arg1; + double arg0 = 0; + cocos2d::Scene* arg1 = nullptr; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -56107,6 +58159,21 @@ bool js_cocos2dx_TransitionProgressRadialCW_constructor(JSContext *cx, uint32_t if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_TransitionProgressRadialCW_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::TransitionProgressRadialCW *nobj = new (std::nothrow) cocos2d::TransitionProgressRadialCW(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::TransitionProgressRadialCW"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_TransitionProgress_prototype; @@ -56114,6 +58181,7 @@ extern JSObject *jsb_cocos2d_TransitionProgress_prototype; void js_cocos2d_TransitionProgressRadialCW_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (TransitionProgressRadialCW)", obj); } + void js_register_cocos2dx_TransitionProgressRadialCW(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_TransitionProgressRadialCW_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_TransitionProgressRadialCW_class->name = "TransitionProgressRadialCW"; @@ -56133,6 +58201,7 @@ void js_register_cocos2dx_TransitionProgressRadialCW(JSContext *cx, JS::HandleOb }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_TransitionProgressRadialCW_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -56167,6 +58236,7 @@ void js_register_cocos2dx_TransitionProgressRadialCW(JSContext *cx, JS::HandleOb p->parentProto = jsb_cocos2d_TransitionProgress_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.TransitionProgressRadialCW.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_TransitionProgressHorizontal_class; @@ -56177,8 +58247,8 @@ bool js_cocos2dx_TransitionProgressHorizontal_create(JSContext *cx, uint32_t arg JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; - cocos2d::Scene* arg1; + double arg0 = 0; + cocos2d::Scene* arg1 = nullptr; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -56234,6 +58304,21 @@ bool js_cocos2dx_TransitionProgressHorizontal_constructor(JSContext *cx, uint32_ if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_TransitionProgressHorizontal_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::TransitionProgressHorizontal *nobj = new (std::nothrow) cocos2d::TransitionProgressHorizontal(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::TransitionProgressHorizontal"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_TransitionProgress_prototype; @@ -56241,6 +58326,7 @@ extern JSObject *jsb_cocos2d_TransitionProgress_prototype; void js_cocos2d_TransitionProgressHorizontal_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (TransitionProgressHorizontal)", obj); } + void js_register_cocos2dx_TransitionProgressHorizontal(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_TransitionProgressHorizontal_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_TransitionProgressHorizontal_class->name = "TransitionProgressHorizontal"; @@ -56260,6 +58346,7 @@ void js_register_cocos2dx_TransitionProgressHorizontal(JSContext *cx, JS::Handle }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_TransitionProgressHorizontal_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -56294,6 +58381,7 @@ void js_register_cocos2dx_TransitionProgressHorizontal(JSContext *cx, JS::Handle p->parentProto = jsb_cocos2d_TransitionProgress_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.TransitionProgressHorizontal.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_TransitionProgressVertical_class; @@ -56304,8 +58392,8 @@ bool js_cocos2dx_TransitionProgressVertical_create(JSContext *cx, uint32_t argc, JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; - cocos2d::Scene* arg1; + double arg0 = 0; + cocos2d::Scene* arg1 = nullptr; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -56361,6 +58449,21 @@ bool js_cocos2dx_TransitionProgressVertical_constructor(JSContext *cx, uint32_t if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_TransitionProgressVertical_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::TransitionProgressVertical *nobj = new (std::nothrow) cocos2d::TransitionProgressVertical(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::TransitionProgressVertical"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_TransitionProgress_prototype; @@ -56368,6 +58471,7 @@ extern JSObject *jsb_cocos2d_TransitionProgress_prototype; void js_cocos2d_TransitionProgressVertical_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (TransitionProgressVertical)", obj); } + void js_register_cocos2dx_TransitionProgressVertical(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_TransitionProgressVertical_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_TransitionProgressVertical_class->name = "TransitionProgressVertical"; @@ -56387,6 +58491,7 @@ void js_register_cocos2dx_TransitionProgressVertical(JSContext *cx, JS::HandleOb }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_TransitionProgressVertical_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -56421,6 +58526,7 @@ void js_register_cocos2dx_TransitionProgressVertical(JSContext *cx, JS::HandleOb p->parentProto = jsb_cocos2d_TransitionProgress_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.TransitionProgressVertical.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_TransitionProgressInOut_class; @@ -56431,8 +58537,8 @@ bool js_cocos2dx_TransitionProgressInOut_create(JSContext *cx, uint32_t argc, js JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; - cocos2d::Scene* arg1; + double arg0 = 0; + cocos2d::Scene* arg1 = nullptr; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -56488,6 +58594,21 @@ bool js_cocos2dx_TransitionProgressInOut_constructor(JSContext *cx, uint32_t arg if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_TransitionProgressInOut_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::TransitionProgressInOut *nobj = new (std::nothrow) cocos2d::TransitionProgressInOut(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::TransitionProgressInOut"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_TransitionProgress_prototype; @@ -56495,6 +58616,7 @@ extern JSObject *jsb_cocos2d_TransitionProgress_prototype; void js_cocos2d_TransitionProgressInOut_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (TransitionProgressInOut)", obj); } + void js_register_cocos2dx_TransitionProgressInOut(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_TransitionProgressInOut_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_TransitionProgressInOut_class->name = "TransitionProgressInOut"; @@ -56514,6 +58636,7 @@ void js_register_cocos2dx_TransitionProgressInOut(JSContext *cx, JS::HandleObjec }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_TransitionProgressInOut_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -56548,6 +58671,7 @@ void js_register_cocos2dx_TransitionProgressInOut(JSContext *cx, JS::HandleObjec p->parentProto = jsb_cocos2d_TransitionProgress_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.TransitionProgressInOut.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_TransitionProgressOutIn_class; @@ -56558,8 +58682,8 @@ bool js_cocos2dx_TransitionProgressOutIn_create(JSContext *cx, uint32_t argc, js JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; - cocos2d::Scene* arg1; + double arg0 = 0; + cocos2d::Scene* arg1 = nullptr; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -56615,6 +58739,21 @@ bool js_cocos2dx_TransitionProgressOutIn_constructor(JSContext *cx, uint32_t arg if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_TransitionProgressOutIn_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::TransitionProgressOutIn *nobj = new (std::nothrow) cocos2d::TransitionProgressOutIn(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::TransitionProgressOutIn"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } extern JSObject *jsb_cocos2d_TransitionProgress_prototype; @@ -56622,6 +58761,7 @@ extern JSObject *jsb_cocos2d_TransitionProgress_prototype; void js_cocos2d_TransitionProgressOutIn_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (TransitionProgressOutIn)", obj); } + void js_register_cocos2dx_TransitionProgressOutIn(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_TransitionProgressOutIn_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_TransitionProgressOutIn_class->name = "TransitionProgressOutIn"; @@ -56641,6 +58781,7 @@ void js_register_cocos2dx_TransitionProgressOutIn(JSContext *cx, JS::HandleObjec }; static JSFunctionSpec funcs[] = { + JS_FN("ctor", js_cocos2dx_TransitionProgressOutIn_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -56675,6 +58816,7 @@ void js_register_cocos2dx_TransitionProgressOutIn(JSContext *cx, JS::HandleObjec p->parentProto = jsb_cocos2d_TransitionProgress_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.TransitionProgressOutIn.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_Camera_class; @@ -56741,7 +58883,7 @@ bool js_cocos2dx_Camera_setBackgroundBrush(JSContext *cx, uint32_t argc, jsval * cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Camera_setBackgroundBrush : Invalid Native Object"); if (argc == 1) { - cocos2d::CameraBackgroundBrush* arg0; + cocos2d::CameraBackgroundBrush* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -56991,10 +59133,10 @@ bool js_cocos2dx_Camera_initOrthographic(JSContext *cx, uint32_t argc, jsval *vp cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Camera_initOrthographic : Invalid Native Object"); if (argc == 4) { - double arg0; - double arg1; - double arg2; - double arg3; + double arg0 = 0; + double arg1 = 0; + double arg2 = 0; + double arg3 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -57057,7 +59199,7 @@ bool js_cocos2dx_Camera_setScene(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Camera_setScene : Invalid Native Object"); if (argc == 1) { - cocos2d::Scene* arg0; + cocos2d::Scene* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -57219,7 +59361,7 @@ bool js_cocos2dx_Camera_setFrameBufferObject(JSContext *cx, uint32_t argc, jsval cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Camera_setFrameBufferObject : Invalid Native Object"); if (argc == 1) { - cocos2d::experimental::FrameBuffer* arg0; + cocos2d::experimental::FrameBuffer* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -57265,10 +59407,10 @@ bool js_cocos2dx_Camera_initPerspective(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Camera_initPerspective : Invalid Native Object"); if (argc == 4) { - double arg0; - double arg1; - double arg2; - double arg3; + double arg0 = 0; + double arg1 = 0; + double arg2 = 0; + double arg3 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -57289,10 +59431,10 @@ bool js_cocos2dx_Camera_createOrthographic(JSContext *cx, uint32_t argc, jsval * JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 4) { - double arg0; - double arg1; - double arg2; - double arg3; + double arg0 = 0; + double arg1 = 0; + double arg2 = 0; + double arg3 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -57362,10 +59504,10 @@ bool js_cocos2dx_Camera_createPerspective(JSContext *cx, uint32_t argc, jsval *v JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 4) { - double arg0; - double arg1; - double arg2; - double arg3; + double arg0 = 0; + double arg1 = 0; + double arg2 = 0; + double arg3 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -57594,7 +59736,7 @@ bool js_cocos2dx_CameraBackgroundBrush_drawBackground(JSContext *cx, uint32_t ar cocos2d::CameraBackgroundBrush* cobj = (cocos2d::CameraBackgroundBrush *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_CameraBackgroundBrush_drawBackground : Invalid Native Object"); if (argc == 1) { - cocos2d::Camera* arg0; + cocos2d::Camera* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -57672,7 +59814,7 @@ bool js_cocos2dx_CameraBackgroundBrush_createColorBrush(JSContext *cx, uint32_t bool ok = true; if (argc == 2) { cocos2d::Color4F arg0; - double arg1; + double arg1 = 0; ok &= jsval_to_cccolor4f(cx, args.get(0), &arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_CameraBackgroundBrush_createColorBrush : Error processing arguments"); @@ -57733,7 +59875,7 @@ bool js_cocos2dx_CameraBackgroundBrush_createDepthBrush(JSContext *cx, uint32_t return true; } if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_CameraBackgroundBrush_createDepthBrush : Error processing arguments"); cocos2d::CameraBackgroundDepthBrush* ret = cocos2d::CameraBackgroundBrush::createDepthBrush(arg0); @@ -57858,7 +60000,7 @@ bool js_cocos2dx_CameraBackgroundDepthBrush_setDepth(JSContext *cx, uint32_t arg cocos2d::CameraBackgroundDepthBrush* cobj = (cocos2d::CameraBackgroundDepthBrush *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_CameraBackgroundDepthBrush_setDepth : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_CameraBackgroundDepthBrush_setDepth : Error processing arguments"); cobj->setDepth(arg0); @@ -57874,7 +60016,7 @@ bool js_cocos2dx_CameraBackgroundDepthBrush_create(JSContext *cx, uint32_t argc, JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_CameraBackgroundDepthBrush_create : Error processing arguments"); cocos2d::CameraBackgroundDepthBrush* ret = cocos2d::CameraBackgroundDepthBrush::create(arg0); @@ -58013,7 +60155,7 @@ bool js_cocos2dx_CameraBackgroundColorBrush_create(JSContext *cx, uint32_t argc, bool ok = true; if (argc == 2) { cocos2d::Color4F arg0; - double arg1; + double arg1 = 0; ok &= jsval_to_cccolor4f(cx, args.get(0), &arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_CameraBackgroundColorBrush_create : Error processing arguments"); @@ -58136,7 +60278,7 @@ bool js_cocos2dx_CameraBackgroundSkyBoxBrush_setTexture(JSContext *cx, uint32_t cocos2d::CameraBackgroundSkyBoxBrush* cobj = (cocos2d::CameraBackgroundSkyBoxBrush *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_CameraBackgroundSkyBoxBrush_setTexture : Invalid Native Object"); if (argc == 1) { - cocos2d::TextureCube* arg0; + cocos2d::TextureCube* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -58390,7 +60532,7 @@ bool js_cocos2dx_GridBase_afterDraw(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::GridBase* cobj = (cocos2d::GridBase *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GridBase_afterDraw : Invalid Native Object"); if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -58650,7 +60792,7 @@ bool js_cocos2dx_GridBase_initWithSize(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - cocos2d::Texture2D* arg1; + cocos2d::Texture2D* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -58676,7 +60818,7 @@ bool js_cocos2dx_GridBase_initWithSize(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - cocos2d::Texture2D* arg1; + cocos2d::Texture2D* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -58728,7 +60870,7 @@ bool js_cocos2dx_GridBase_setReuseGrid(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::GridBase* cobj = (cocos2d::GridBase *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GridBase_setReuseGrid : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GridBase_setReuseGrid : Error processing arguments"); cobj->setReuseGrid(arg0); @@ -58803,7 +60945,7 @@ bool js_cocos2dx_GridBase_create(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - cocos2d::Texture2D* arg1; + cocos2d::Texture2D* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -59009,7 +61151,7 @@ bool js_cocos2dx_Grid3D_create(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - cocos2d::Texture2D* arg1; + cocos2d::Texture2D* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -59043,7 +61185,7 @@ bool js_cocos2dx_Grid3D_create(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - cocos2d::Texture2D* arg1; + cocos2d::Texture2D* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -59242,7 +61384,7 @@ bool js_cocos2dx_TiledGrid3D_create(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - cocos2d::Texture2D* arg1; + cocos2d::Texture2D* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -59276,7 +61418,7 @@ bool js_cocos2dx_TiledGrid3D_create(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - cocos2d::Texture2D* arg1; + cocos2d::Texture2D* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -59523,7 +61665,7 @@ bool js_cocos2dx_BaseLight_setIntensity(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::BaseLight* cobj = (cocos2d::BaseLight *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_BaseLight_setIntensity : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_BaseLight_setIntensity : Error processing arguments"); cobj->setIntensity(arg0); @@ -59825,7 +61967,7 @@ bool js_cocos2dx_PointLight_setRange(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::PointLight* cobj = (cocos2d::PointLight *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_PointLight_setRange : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_PointLight_setRange : Error processing arguments"); cobj->setRange(arg0); @@ -59843,7 +61985,7 @@ bool js_cocos2dx_PointLight_create(JSContext *cx, uint32_t argc, jsval *vp) if (argc == 3) { cocos2d::Vec3 arg0; cocos2d::Color3B arg1; - double arg2; + double arg2 = 0; ok &= jsval_to_vector3(cx, args.get(0), &arg0); ok &= jsval_to_cccolor3b(cx, args.get(1), &arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -60096,7 +62238,7 @@ bool js_cocos2dx_SpotLight_setOuterAngle(JSContext *cx, uint32_t argc, jsval *vp cocos2d::SpotLight* cobj = (cocos2d::SpotLight *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpotLight_setOuterAngle : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpotLight_setOuterAngle : Error processing arguments"); cobj->setOuterAngle(arg0); @@ -60116,7 +62258,7 @@ bool js_cocos2dx_SpotLight_setInnerAngle(JSContext *cx, uint32_t argc, jsval *vp cocos2d::SpotLight* cobj = (cocos2d::SpotLight *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpotLight_setInnerAngle : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpotLight_setInnerAngle : Error processing arguments"); cobj->setInnerAngle(arg0); @@ -60154,7 +62296,7 @@ bool js_cocos2dx_SpotLight_setRange(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::SpotLight* cobj = (cocos2d::SpotLight *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpotLight_setRange : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpotLight_setRange : Error processing arguments"); cobj->setRange(arg0); @@ -60173,9 +62315,9 @@ bool js_cocos2dx_SpotLight_create(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Vec3 arg0; cocos2d::Vec3 arg1; cocos2d::Color3B arg2; - double arg3; - double arg4; - double arg5; + double arg3 = 0; + double arg4 = 0; + double arg5 = 0; ok &= jsval_to_vector3(cx, args.get(0), &arg0); ok &= jsval_to_vector3(cx, args.get(1), &arg1); ok &= jsval_to_cccolor3b(cx, args.get(2), &arg2); @@ -60448,7 +62590,7 @@ bool js_cocos2dx_GLProgram_bindAttribLocation(JSContext *cx, uint32_t argc, jsva JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_bindAttribLocation : Invalid Native Object"); if (argc == 2) { std::string arg0; - unsigned int arg1; + unsigned int arg1 = 0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); ok &= jsval_to_uint32(cx, args.get(1), &arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLProgram_bindAttribLocation : Error processing arguments"); @@ -60469,7 +62611,7 @@ bool js_cocos2dx_GLProgram_getUniformLocationForName(JSContext *cx, uint32_t arg cocos2d::GLProgram* cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_getUniformLocationForName : Invalid Native Object"); if (argc == 1) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLProgram_getUniformLocationForName : Error processing arguments"); int ret = cobj->getUniformLocationForName(arg0); @@ -60530,7 +62672,7 @@ bool js_cocos2dx_GLProgram_getUniform(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLProgram_getUniform : Error processing arguments"); cocos2d::Uniform* ret = cobj->getUniform(arg0); jsval jsret = JSVAL_NULL; - #pragma warning NO CONVERSION FROM NATIVE FOR Uniform*; + jsret = uniform_to_jsval(cx, ret); args.rval().set(jsret); return true; } @@ -60551,10 +62693,10 @@ bool js_cocos2dx_GLProgram_initWithByteArrays(JSContext *cx, uint32_t argc, jsva JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_initWithByteArrays : Invalid Native Object"); do { if (argc == 3) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); if (!ok) { ok = true; break; } - const char* arg1; + const char* arg1 = nullptr; std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str(); if (!ok) { ok = true; break; } std::string arg2; @@ -60570,10 +62712,10 @@ bool js_cocos2dx_GLProgram_initWithByteArrays(JSContext *cx, uint32_t argc, jsva do { if (argc == 2) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); if (!ok) { ok = true; break; } - const char* arg1; + const char* arg1 = nullptr; std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str(); if (!ok) { ok = true; break; } bool ret = cobj->initWithByteArrays(arg0, arg1); @@ -60596,8 +62738,8 @@ bool js_cocos2dx_GLProgram_setUniformLocationWith1f(JSContext *cx, uint32_t argc cocos2d::GLProgram* cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_setUniformLocationWith1f : Invalid Native Object"); if (argc == 2) { - int arg0; - double arg1; + int arg0 = 0; + double arg1 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLProgram_setUniformLocationWith1f : Error processing arguments"); @@ -60667,10 +62809,10 @@ bool js_cocos2dx_GLProgram_setUniformLocationWith3f(JSContext *cx, uint32_t argc cocos2d::GLProgram* cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_setUniformLocationWith3f : Invalid Native Object"); if (argc == 4) { - int arg0; - double arg1; - double arg2; - double arg3; + int arg0 = 0; + double arg1 = 0; + double arg2 = 0; + double arg3 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -60726,10 +62868,10 @@ bool js_cocos2dx_GLProgram_setUniformLocationWith3i(JSContext *cx, uint32_t argc cocos2d::GLProgram* cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_setUniformLocationWith3i : Invalid Native Object"); if (argc == 4) { - int arg0; - int arg1; - int arg2; - int arg3; + int arg0 = 0; + int arg1 = 0; + int arg2 = 0; + int arg3 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); @@ -60752,11 +62894,11 @@ bool js_cocos2dx_GLProgram_setUniformLocationWith4f(JSContext *cx, uint32_t argc cocos2d::GLProgram* cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_setUniformLocationWith4f : Invalid Native Object"); if (argc == 5) { - int arg0; - double arg1; - double arg2; - double arg3; - double arg4; + int arg0 = 0; + double arg1 = 0; + double arg2 = 0; + double arg3 = 0; + double arg4 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -60896,9 +63038,9 @@ bool js_cocos2dx_GLProgram_setUniformLocationWith2f(JSContext *cx, uint32_t argc cocos2d::GLProgram* cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_setUniformLocationWith2f : Invalid Native Object"); if (argc == 3) { - int arg0; - double arg1; - double arg2; + int arg0 = 0; + double arg1 = 0; + double arg2 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -60920,11 +63062,11 @@ bool js_cocos2dx_GLProgram_setUniformLocationWith4i(JSContext *cx, uint32_t argc cocos2d::GLProgram* cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_setUniformLocationWith4i : Invalid Native Object"); if (argc == 5) { - int arg0; - int arg1; - int arg2; - int arg3; - int arg4; + int arg0 = 0; + int arg1 = 0; + int arg2 = 0; + int arg3 = 0; + int arg4 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); @@ -60948,8 +63090,8 @@ bool js_cocos2dx_GLProgram_setUniformLocationWith1i(JSContext *cx, uint32_t argc cocos2d::GLProgram* cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_setUniformLocationWith1i : Invalid Native Object"); if (argc == 2) { - int arg0; - int arg1; + int arg0 = 0; + int arg1 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLProgram_setUniformLocationWith1i : Error processing arguments"); @@ -60970,9 +63112,9 @@ bool js_cocos2dx_GLProgram_setUniformLocationWith2i(JSContext *cx, uint32_t argc cocos2d::GLProgram* cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_setUniformLocationWith2i : Invalid Native Object"); if (argc == 3) { - int arg0; - int arg1; - int arg2; + int arg0 = 0; + int arg1 = 0; + int arg2 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); @@ -60992,10 +63134,10 @@ bool js_cocos2dx_GLProgram_createWithByteArrays(JSContext *cx, uint32_t argc, js do { if (argc == 3) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); if (!ok) { ok = true; break; } - const char* arg1; + const char* arg1 = nullptr; std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str(); if (!ok) { ok = true; break; } std::string arg2; @@ -61018,10 +63160,10 @@ bool js_cocos2dx_GLProgram_createWithByteArrays(JSContext *cx, uint32_t argc, js do { if (argc == 2) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); if (!ok) { ok = true; break; } - const char* arg1; + const char* arg1 = nullptr; std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str(); if (!ok) { ok = true; break; } cocos2d::GLProgram* ret = cocos2d::GLProgram::createWithByteArrays(arg0, arg1); @@ -61270,7 +63412,7 @@ bool js_cocos2dx_GLProgramCache_addGLProgram(JSContext *cx, uint32_t argc, jsval cocos2d::GLProgramCache* cobj = (cocos2d::GLProgramCache *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramCache_addGLProgram : Invalid Native Object"); if (argc == 2) { - cocos2d::GLProgram* arg0; + cocos2d::GLProgram* arg0 = nullptr; std::string arg1; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -61474,7 +63616,7 @@ bool js_cocos2dx_RenderState_setTexture(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::RenderState* cobj = (cocos2d::RenderState *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderState_setTexture : Invalid Native Object"); if (argc == 1) { - cocos2d::Texture2D* arg0; + cocos2d::Texture2D* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -61502,7 +63644,7 @@ bool js_cocos2dx_RenderState_getTopmost(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::RenderState* cobj = (cocos2d::RenderState *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderState_getTopmost : Invalid Native Object"); if (argc == 1) { - cocos2d::RenderState* arg0; + cocos2d::RenderState* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -61564,7 +63706,7 @@ bool js_cocos2dx_RenderState_bind(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::RenderState* cobj = (cocos2d::RenderState *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderState_bind : Invalid Native Object"); if (argc == 1) { - cocos2d::Pass* arg0; + cocos2d::Pass* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -61875,7 +64017,7 @@ bool js_cocos2dx_Pass_setVertexAttribBinding(JSContext *cx, uint32_t argc, jsval cocos2d::Pass* cobj = (cocos2d::Pass *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Pass_setVertexAttribBinding : Invalid Native Object"); if (argc == 1) { - cocos2d::VertexAttribBinding* arg0; + cocos2d::VertexAttribBinding* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -61899,7 +64041,7 @@ bool js_cocos2dx_Pass_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::Technique* arg0; + cocos2d::Technique* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -61932,8 +64074,8 @@ bool js_cocos2dx_Pass_createWithGLProgramState(JSContext *cx, uint32_t argc, jsv JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - cocos2d::Technique* arg0; - cocos2d::GLProgramState* arg1; + cocos2d::Technique* arg0 = nullptr; + cocos2d::GLProgramState* arg1 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -62094,7 +64236,7 @@ bool js_cocos2dx_Technique_addPass(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Technique* cobj = (cocos2d::Technique *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Technique_addPass : Invalid Native Object"); if (argc == 1) { - cocos2d::Pass* arg0; + cocos2d::Pass* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -62158,7 +64300,7 @@ bool js_cocos2dx_Technique_getPassByIndex(JSContext *cx, uint32_t argc, jsval *v cocos2d::Technique* cobj = (cocos2d::Technique *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Technique_getPassByIndex : Invalid Native Object"); if (argc == 1) { - ssize_t arg0; + ssize_t arg0 = 0; ok &= jsval_to_ssize(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Technique_getPassByIndex : Error processing arguments"); cocos2d::Pass* ret = cobj->getPassByIndex(arg0); @@ -62183,7 +64325,7 @@ bool js_cocos2dx_Technique_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::Material* arg0; + cocos2d::Material* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -62216,8 +64358,8 @@ bool js_cocos2dx_Technique_createWithGLProgramState(JSContext *cx, uint32_t argc JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - cocos2d::Material* arg0; - cocos2d::GLProgramState* arg1; + cocos2d::Material* arg0 = nullptr; + cocos2d::GLProgramState* arg1 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -62397,7 +64539,7 @@ bool js_cocos2dx_Material_getTechniqueByIndex(JSContext *cx, uint32_t argc, jsva cocos2d::Material* cobj = (cocos2d::Material *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Material_getTechniqueByIndex : Invalid Native Object"); if (argc == 1) { - ssize_t arg0; + ssize_t arg0 = 0; ok &= jsval_to_ssize(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Material_getTechniqueByIndex : Error processing arguments"); cocos2d::Technique* ret = cobj->getTechniqueByIndex(arg0); @@ -62511,7 +64653,7 @@ bool js_cocos2dx_Material_addTechnique(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Material* cobj = (cocos2d::Material *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Material_addTechnique : Invalid Native Object"); if (argc == 1) { - cocos2d::Technique* arg0; + cocos2d::Technique* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -62585,7 +64727,7 @@ bool js_cocos2dx_Material_createWithGLStateProgram(JSContext *cx, uint32_t argc, JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::GLProgramState* arg0; + cocos2d::GLProgramState* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -62618,7 +64760,7 @@ bool js_cocos2dx_Material_createWithProperties(JSContext *cx, uint32_t argc, jsv JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::Properties* arg0; + cocos2d::Properties* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -62895,7 +65037,7 @@ bool js_cocos2dx_TextureCache_addImage(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextureCache_addImage : Invalid Native Object"); do { if (argc == 2) { - cocos2d::Image* arg0; + cocos2d::Image* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -63005,7 +65147,7 @@ bool js_cocos2dx_TextureCache_getTextureFilePath(JSContext *cx, uint32_t argc, j cocos2d::TextureCache* cobj = (cocos2d::TextureCache *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextureCache_getTextureFilePath : Invalid Native Object"); if (argc == 1) { - cocos2d::Texture2D* arg0; + cocos2d::Texture2D* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -63051,7 +65193,7 @@ bool js_cocos2dx_TextureCache_removeTexture(JSContext *cx, uint32_t argc, jsval cocos2d::TextureCache* cobj = (cocos2d::TextureCache *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextureCache_removeTexture : Invalid Native Object"); if (argc == 1) { - cocos2d::Texture2D* arg0; + cocos2d::Texture2D* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -63208,7 +65350,7 @@ bool js_cocos2dx_Device_setAccelerometerInterval(JSContext *cx, uint32_t argc, j JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Device_setAccelerometerInterval : Error processing arguments"); cocos2d::Device::setAccelerometerInterval(arg0); @@ -63240,7 +65382,7 @@ bool js_cocos2dx_Device_vibrate(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Device_vibrate : Error processing arguments"); cocos2d::Device::vibrate(arg0); @@ -63340,7 +65482,7 @@ bool js_cocos2dx_SAXParser_init(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::SAXParser* cobj = (cocos2d::SAXParser *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SAXParser_init : Invalid Native Object"); if (argc == 1) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SAXParser_init : Error processing arguments"); bool ret = cobj->init(arg0); @@ -63595,7 +65737,7 @@ bool js_cocos2dx_AnimationCache_addAnimation(JSContext *cx, uint32_t argc, jsval cocos2d::AnimationCache* cobj = (cocos2d::AnimationCache *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AnimationCache_addAnimation : Invalid Native Object"); if (argc == 2) { - cocos2d::Animation* arg0; + cocos2d::Animation* arg0 = nullptr; std::string arg1; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -63756,11 +65898,27 @@ bool js_cocos2dx_AnimationCache_constructor(JSContext *cx, uint32_t argc, jsval if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); return true; +}static bool js_cocos2dx_AnimationCache_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::AnimationCache *nobj = new (std::nothrow) cocos2d::AnimationCache(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::AnimationCache"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; } void js_cocos2d_AnimationCache_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (AnimationCache)", obj); } + void js_register_cocos2dx_AnimationCache(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_AnimationCache_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_AnimationCache_class->name = "AnimationCache"; @@ -63786,6 +65944,7 @@ void js_register_cocos2dx_AnimationCache(JSContext *cx, JS::HandleObject global) JS_FN("addAnimationsWithDictionary", js_cocos2dx_AnimationCache_addAnimationsWithDictionary, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("removeAnimation", js_cocos2dx_AnimationCache_removeAnimation, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("addAnimations", js_cocos2dx_AnimationCache_addAnimationsWithFile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_AnimationCache_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -63821,6 +65980,7 @@ void js_register_cocos2dx_AnimationCache(JSContext *cx, JS::HandleObject global) p->parentProto = NULL; _js_global_type_map.insert(std::make_pair(typeName, p)); } + anonEvaluate(cx, global, "(function () { cc.AnimationCache.extend = cc.Class.extend; })()"); } JSClass *jsb_cocos2d_SpriteBatchNode_class; @@ -63835,7 +65995,7 @@ bool js_cocos2dx_SpriteBatchNode_appendChild(JSContext *cx, uint32_t argc, jsval cocos2d::SpriteBatchNode* cobj = (cocos2d::SpriteBatchNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteBatchNode_appendChild : Invalid Native Object"); if (argc == 1) { - cocos2d::Sprite* arg0; + cocos2d::Sprite* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -63863,9 +66023,9 @@ bool js_cocos2dx_SpriteBatchNode_addSpriteWithoutQuad(JSContext *cx, uint32_t ar cocos2d::SpriteBatchNode* cobj = (cocos2d::SpriteBatchNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteBatchNode_addSpriteWithoutQuad : Invalid Native Object"); if (argc == 3) { - cocos2d::Sprite* arg0; - int arg1; - int arg2; + cocos2d::Sprite* arg0 = nullptr; + int arg1 = 0; + int arg2 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -63924,7 +66084,7 @@ bool js_cocos2dx_SpriteBatchNode_initWithTexture(JSContext *cx, uint32_t argc, j cocos2d::SpriteBatchNode* cobj = (cocos2d::SpriteBatchNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteBatchNode_initWithTexture : Invalid Native Object"); if (argc == 1) { - cocos2d::Texture2D* arg0; + cocos2d::Texture2D* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -63942,8 +66102,8 @@ bool js_cocos2dx_SpriteBatchNode_initWithTexture(JSContext *cx, uint32_t argc, j return true; } if (argc == 2) { - cocos2d::Texture2D* arg0; - ssize_t arg1; + cocos2d::Texture2D* arg0 = nullptr; + ssize_t arg1 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -63992,7 +66152,7 @@ bool js_cocos2dx_SpriteBatchNode_lowestAtlasIndexInChild(JSContext *cx, uint32_t cocos2d::SpriteBatchNode* cobj = (cocos2d::SpriteBatchNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteBatchNode_lowestAtlasIndexInChild : Invalid Native Object"); if (argc == 1) { - cocos2d::Sprite* arg0; + cocos2d::Sprite* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -64022,8 +66182,8 @@ bool js_cocos2dx_SpriteBatchNode_atlasIndexForChild(JSContext *cx, uint32_t argc cocos2d::SpriteBatchNode* cobj = (cocos2d::SpriteBatchNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteBatchNode_atlasIndexForChild : Invalid Native Object"); if (argc == 2) { - cocos2d::Sprite* arg0; - int arg1; + cocos2d::Sprite* arg0 = nullptr; + int arg1 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -64054,7 +66214,7 @@ bool js_cocos2dx_SpriteBatchNode_setTextureAtlas(JSContext *cx, uint32_t argc, j cocos2d::SpriteBatchNode* cobj = (cocos2d::SpriteBatchNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteBatchNode_setTextureAtlas : Invalid Native Object"); if (argc == 1) { - cocos2d::TextureAtlas* arg0; + cocos2d::TextureAtlas* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -64093,7 +66253,7 @@ bool js_cocos2dx_SpriteBatchNode_initWithFile(JSContext *cx, uint32_t argc, jsva } if (argc == 2) { std::string arg0; - ssize_t arg1; + ssize_t arg1 = 0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); ok &= jsval_to_ssize(cx, args.get(1), &arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteBatchNode_initWithFile : Error processing arguments"); @@ -64182,8 +66342,8 @@ bool js_cocos2dx_SpriteBatchNode_insertQuadFromSprite(JSContext *cx, uint32_t ar cocos2d::SpriteBatchNode* cobj = (cocos2d::SpriteBatchNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteBatchNode_insertQuadFromSprite : Invalid Native Object"); if (argc == 2) { - cocos2d::Sprite* arg0; - ssize_t arg1; + cocos2d::Sprite* arg0 = nullptr; + ssize_t arg1 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -64212,7 +66372,7 @@ bool js_cocos2dx_SpriteBatchNode_setTexture(JSContext *cx, uint32_t argc, jsval cocos2d::SpriteBatchNode* cobj = (cocos2d::SpriteBatchNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteBatchNode_setTexture : Invalid Native Object"); if (argc == 1) { - cocos2d::Texture2D* arg0; + cocos2d::Texture2D* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -64240,8 +66400,8 @@ bool js_cocos2dx_SpriteBatchNode_rebuildIndexInOrder(JSContext *cx, uint32_t arg cocos2d::SpriteBatchNode* cobj = (cocos2d::SpriteBatchNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteBatchNode_rebuildIndexInOrder : Invalid Native Object"); if (argc == 2) { - cocos2d::Sprite* arg0; - ssize_t arg1; + cocos2d::Sprite* arg0 = nullptr; + ssize_t arg1 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -64272,7 +66432,7 @@ bool js_cocos2dx_SpriteBatchNode_highestAtlasIndexInChild(JSContext *cx, uint32_ cocos2d::SpriteBatchNode* cobj = (cocos2d::SpriteBatchNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteBatchNode_highestAtlasIndexInChild : Invalid Native Object"); if (argc == 1) { - cocos2d::Sprite* arg0; + cocos2d::Sprite* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -64302,7 +66462,7 @@ bool js_cocos2dx_SpriteBatchNode_removeChildAtIndex(JSContext *cx, uint32_t argc cocos2d::SpriteBatchNode* cobj = (cocos2d::SpriteBatchNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteBatchNode_removeChildAtIndex : Invalid Native Object"); if (argc == 2) { - ssize_t arg0; + ssize_t arg0 = 0; bool arg1; ok &= jsval_to_ssize(cx, args.get(0), &arg0); arg1 = JS::ToBoolean(args.get(1)); @@ -64324,7 +66484,7 @@ bool js_cocos2dx_SpriteBatchNode_removeSpriteFromAtlas(JSContext *cx, uint32_t a cocos2d::SpriteBatchNode* cobj = (cocos2d::SpriteBatchNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteBatchNode_removeSpriteFromAtlas : Invalid Native Object"); if (argc == 1) { - cocos2d::Sprite* arg0; + cocos2d::Sprite* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -64386,7 +66546,7 @@ bool js_cocos2dx_SpriteBatchNode_create(JSContext *cx, uint32_t argc, jsval *vp) } if (argc == 2) { std::string arg0; - ssize_t arg1; + ssize_t arg1 = 0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); ok &= jsval_to_ssize(cx, args.get(1), &arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteBatchNode_create : Error processing arguments"); @@ -64412,7 +66572,7 @@ bool js_cocos2dx_SpriteBatchNode_createWithTexture(JSContext *cx, uint32_t argc, JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::Texture2D* arg0; + cocos2d::Texture2D* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -64437,8 +66597,8 @@ bool js_cocos2dx_SpriteBatchNode_createWithTexture(JSContext *cx, uint32_t argc, return true; } if (argc == 2) { - cocos2d::Texture2D* arg0; - ssize_t arg1; + cocos2d::Texture2D* arg0 = nullptr; + ssize_t arg1 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -64607,7 +66767,7 @@ bool js_cocos2dx_SpriteFrameCache_addSpriteFramesWithFileContent(JSContext *cx, JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrameCache_addSpriteFramesWithFileContent : Invalid Native Object"); if (argc == 2) { std::string arg0; - cocos2d::Texture2D* arg1; + cocos2d::Texture2D* arg1 = nullptr; ok &= jsval_to_std_string(cx, args.get(0), &arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -64636,7 +66796,7 @@ bool js_cocos2dx_SpriteFrameCache_addSpriteFrame(JSContext *cx, uint32_t argc, j cocos2d::SpriteFrameCache* cobj = (cocos2d::SpriteFrameCache *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrameCache_addSpriteFrame : Invalid Native Object"); if (argc == 2) { - cocos2d::SpriteFrame* arg0; + cocos2d::SpriteFrame* arg0 = nullptr; std::string arg1; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -64698,7 +66858,7 @@ bool js_cocos2dx_SpriteFrameCache_addSpriteFramesWithFile(JSContext *cx, uint32_ std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - cocos2d::Texture2D* arg1; + cocos2d::Texture2D* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -64888,7 +67048,7 @@ bool js_cocos2dx_SpriteFrameCache_removeSpriteFramesFromTexture(JSContext *cx, u cocos2d::SpriteFrameCache* cobj = (cocos2d::SpriteFrameCache *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrameCache_removeSpriteFramesFromTexture : Invalid Native Object"); if (argc == 1) { - cocos2d::Texture2D* arg0; + cocos2d::Texture2D* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -65090,7 +67250,7 @@ bool js_cocos2dx_TextFieldTTF_initWithPlaceHolder(JSContext *cx, uint32_t argc, std::string arg1; ok &= jsval_to_std_string(cx, args.get(1), &arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } bool ret = cobj->initWithPlaceHolder(arg0, arg1, arg2); @@ -65115,7 +67275,7 @@ bool js_cocos2dx_TextFieldTTF_initWithPlaceHolder(JSContext *cx, uint32_t argc, std::string arg3; ok &= jsval_to_std_string(cx, args.get(3), &arg3); if (!ok) { ok = true; break; } - double arg4; + double arg4 = 0; ok &= JS::ToNumber( cx, args.get(4), &arg4) && !isnan(arg4); if (!ok) { ok = true; break; } bool ret = cobj->initWithPlaceHolder(arg0, arg1, arg2, arg3, arg4); @@ -65270,7 +67430,7 @@ bool js_cocos2dx_TextFieldTTF_textFieldWithPlaceHolder(JSContext *cx, uint32_t a std::string arg1; ok &= jsval_to_std_string(cx, args.get(1), &arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } cocos2d::TextFieldTTF* ret = cocos2d::TextFieldTTF::textFieldWithPlaceHolder(arg0, arg1, arg2); @@ -65302,7 +67462,7 @@ bool js_cocos2dx_TextFieldTTF_textFieldWithPlaceHolder(JSContext *cx, uint32_t a std::string arg3; ok &= jsval_to_std_string(cx, args.get(3), &arg3); if (!ok) { ok = true; break; } - double arg4; + double arg4 = 0; ok &= JS::ToNumber( cx, args.get(4), &arg4) && !isnan(arg4); if (!ok) { ok = true; break; } cocos2d::TextFieldTTF* ret = cocos2d::TextFieldTTF::textFieldWithPlaceHolder(arg0, arg1, arg2, arg3, arg4); @@ -65485,8 +67645,8 @@ bool js_cocos2dx_ParallaxNode_addChild(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::ParallaxNode* cobj = (cocos2d::ParallaxNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParallaxNode_addChild : Invalid Native Object"); if (argc == 4) { - cocos2d::Node* arg0; - int arg1; + cocos2d::Node* arg0 = nullptr; + int arg1 = 0; cocos2d::Vec2 arg2; cocos2d::Vec2 arg3; do { @@ -65539,7 +67699,7 @@ bool js_cocos2dx_ParallaxNode_setParallaxArray(JSContext *cx, uint32_t argc, jsv cocos2d::ParallaxNode* cobj = (cocos2d::ParallaxNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParallaxNode_setParallaxArray : Invalid Native Object"); if (argc == 1) { - cocos2d::_ccArray* arg0; + cocos2d::_ccArray* arg0 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR _ccArray* ok = false; JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParallaxNode_setParallaxArray : Error processing arguments"); @@ -66147,7 +68307,7 @@ bool js_cocos2dx_TMXTilesetInfo_getRectForGID(JSContext *cx, uint32_t argc, jsva cocos2d::TMXTilesetInfo* cobj = (cocos2d::TMXTilesetInfo *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXTilesetInfo_getRectForGID : Invalid Native Object"); if (argc == 1) { - unsigned int arg0; + unsigned int arg0 = 0; ok &= jsval_to_uint32(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXTilesetInfo_getRectForGID : Error processing arguments"); cocos2d::Rect ret = cobj->getRectForGID(arg0); @@ -66543,7 +68703,7 @@ bool js_cocos2dx_TMXMapInfo_setParentElement(JSContext *cx, uint32_t argc, jsval cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_setParentElement : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXMapInfo_setParentElement : Error processing arguments"); cobj->setParentElement(arg0); @@ -66587,7 +68747,7 @@ bool js_cocos2dx_TMXMapInfo_setParentGID(JSContext *cx, uint32_t argc, jsval *vp cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_setParentGID : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXMapInfo_setParentGID : Error processing arguments"); cobj->setParentGID(arg0); @@ -66753,7 +68913,7 @@ bool js_cocos2dx_TMXMapInfo_setOrientation(JSContext *cx, uint32_t argc, jsval * cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_setOrientation : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXMapInfo_setOrientation : Error processing arguments"); cobj->setOrientation(arg0); @@ -66923,7 +69083,7 @@ bool js_cocos2dx_TMXMapInfo_setLayerAttribs(JSContext *cx, uint32_t argc, jsval cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_setLayerAttribs : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXMapInfo_setLayerAttribs : Error processing arguments"); cobj->setLayerAttribs(arg0); @@ -67147,7 +69307,7 @@ bool js_cocos2dx_TMXLayer_getTileGIDAt(JSContext *cx, uint32_t argc, jsval *vp) } if (argc == 2) { cocos2d::Vec2 arg0; - cocos2d::TMXTileFlags_* arg1; + cocos2d::TMXTileFlags_* arg1 = nullptr; ok &= jsval_to_vector2(cx, args.get(0), &arg0); uint32_t tempData;arg1=(cocos2d::TMXTileFlags_*)&tempData;ok &= jsval_to_uint32(cx, args.get(1), (uint32_t *)&arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXLayer_getTileGIDAt : Error processing arguments"); @@ -67192,7 +69352,7 @@ bool js_cocos2dx_TMXLayer_setLayerOrientation(JSContext *cx, uint32_t argc, jsva cocos2d::TMXLayer* cobj = (cocos2d::TMXLayer *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXLayer_setLayerOrientation : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXLayer_setLayerOrientation : Error processing arguments"); cobj->setLayerOrientation(arg0); @@ -67228,7 +69388,7 @@ bool js_cocos2dx_TMXLayer_setTiles(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::TMXLayer* cobj = (cocos2d::TMXLayer *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXLayer_setTiles : Invalid Native Object"); if (argc == 1) { - unsigned int* arg0; + unsigned int* arg0 = 0; #pragma warning NO CONVERSION TO NATIVE FOR unsigned int* ok = false; JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXLayer_setTiles : Error processing arguments"); @@ -67365,9 +69525,9 @@ bool js_cocos2dx_TMXLayer_initWithTilesetInfo(JSContext *cx, uint32_t argc, jsva cocos2d::TMXLayer* cobj = (cocos2d::TMXLayer *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXLayer_initWithTilesetInfo : Invalid Native Object"); if (argc == 3) { - cocos2d::TMXTilesetInfo* arg0; - cocos2d::TMXLayerInfo* arg1; - cocos2d::TMXMapInfo* arg2; + cocos2d::TMXTilesetInfo* arg0 = nullptr; + cocos2d::TMXLayerInfo* arg1 = nullptr; + cocos2d::TMXMapInfo* arg2 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -67435,7 +69595,7 @@ bool js_cocos2dx_TMXLayer_setTileGID(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXLayer_setTileGID : Invalid Native Object"); do { if (argc == 3) { - unsigned int arg0; + unsigned int arg0 = 0; ok &= jsval_to_uint32(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } cocos2d::Vec2 arg1; @@ -67452,7 +69612,7 @@ bool js_cocos2dx_TMXLayer_setTileGID(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 2) { - unsigned int arg0; + unsigned int arg0 = 0; ok &= jsval_to_uint32(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } cocos2d::Vec2 arg1; @@ -67554,7 +69714,7 @@ bool js_cocos2dx_TMXLayer_setTileSet(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::TMXLayer* cobj = (cocos2d::TMXLayer *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXLayer_setTileSet : Invalid Native Object"); if (argc == 1) { - cocos2d::TMXTilesetInfo* arg0; + cocos2d::TMXTilesetInfo* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -67666,9 +69826,9 @@ bool js_cocos2dx_TMXLayer_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 3) { - cocos2d::TMXTilesetInfo* arg0; - cocos2d::TMXLayerInfo* arg1; - cocos2d::TMXMapInfo* arg2; + cocos2d::TMXTilesetInfo* arg0 = nullptr; + cocos2d::TMXLayerInfo* arg1 = nullptr; + cocos2d::TMXMapInfo* arg2 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -68084,10 +70244,10 @@ bool js_cocos2dx_TMXTiledMap_getPropertiesForGID(JSContext *cx, uint32_t argc, j JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXTiledMap_getPropertiesForGID : Invalid Native Object"); do { if (argc == 2) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); if (!ok) { ok = true; break; } - cocos2d::Value** arg1; + cocos2d::Value** arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -68108,7 +70268,7 @@ bool js_cocos2dx_TMXTiledMap_getPropertiesForGID(JSContext *cx, uint32_t argc, j do { if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); if (!ok) { ok = true; break; } cocos2d::Value ret = cobj->getPropertiesForGID(arg0); @@ -68218,7 +70378,7 @@ bool js_cocos2dx_TMXTiledMap_setMapOrientation(JSContext *cx, uint32_t argc, jsv cocos2d::TMXTiledMap* cobj = (cocos2d::TMXTiledMap *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXTiledMap_setMapOrientation : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXTiledMap_setMapOrientation : Error processing arguments"); cobj->setMapOrientation(arg0); @@ -68419,8 +70579,8 @@ bool js_cocos2dx_TileMapAtlas_initWithTileFile(JSContext *cx, uint32_t argc, jsv if (argc == 4) { std::string arg0; std::string arg1; - int arg2; - int arg3; + int arg2 = 0; + int arg3 = 0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); ok &= jsval_to_std_string(cx, args.get(1), &arg1); ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); @@ -68523,7 +70683,7 @@ bool js_cocos2dx_TileMapAtlas_setTGAInfo(JSContext *cx, uint32_t argc, jsval *vp cocos2d::TileMapAtlas* cobj = (cocos2d::TileMapAtlas *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TileMapAtlas_setTGAInfo : Invalid Native Object"); if (argc == 1) { - cocos2d::sImageTGA* arg0; + cocos2d::sImageTGA* arg0 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR sImageTGA* ok = false; JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TileMapAtlas_setTGAInfo : Error processing arguments"); @@ -68542,8 +70702,8 @@ bool js_cocos2dx_TileMapAtlas_create(JSContext *cx, uint32_t argc, jsval *vp) if (argc == 4) { std::string arg0; std::string arg1; - int arg2; - int arg3; + int arg2 = 0; + int arg3 = 0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); ok &= jsval_to_std_string(cx, args.get(1), &arg1); ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); @@ -68679,515 +70839,6 @@ void js_register_cocos2dx_TileMapAtlas(JSContext *cx, JS::HandleObject global) { anonEvaluate(cx, global, "(function () { cc.TileMapAtlas.extend = cc.Class.extend; })()"); } -JSClass *jsb_cocos2d_Component_class; -JSObject *jsb_cocos2d_Component_prototype; - -bool js_cocos2dx_Component_setEnabled(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_setEnabled : Invalid Native Object"); - if (argc == 1) { - bool arg0; - arg0 = JS::ToBoolean(args.get(0)); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Component_setEnabled : Error processing arguments"); - cobj->setEnabled(arg0); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_Component_setEnabled : wrong number of arguments: %d, was expecting %d", argc, 1); - return false; -} -bool js_cocos2dx_Component_setName(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_setName : Invalid Native Object"); - if (argc == 1) { - std::string arg0; - ok &= jsval_to_std_string(cx, args.get(0), &arg0); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Component_setName : Error processing arguments"); - cobj->setName(arg0); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_Component_setName : wrong number of arguments: %d, was expecting %d", argc, 1); - return false; -} -bool js_cocos2dx_Component_isEnabled(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_isEnabled : Invalid Native Object"); - if (argc == 0) { - bool ret = cobj->isEnabled(); - jsval jsret = JSVAL_NULL; - jsret = BOOLEAN_TO_JSVAL(ret); - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_Component_isEnabled : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} -bool js_cocos2dx_Component_getOwner(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_getOwner : Invalid Native Object"); - if (argc == 0) { - cocos2d::Node* ret = cobj->getOwner(); - jsval jsret = JSVAL_NULL; - do { - if (ret) { - js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::Node*)ret); - jsret = OBJECT_TO_JSVAL(jsProxy->obj); - } else { - jsret = JSVAL_NULL; - } - } while (0); - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_Component_getOwner : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} -bool js_cocos2dx_Component_init(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_init : Invalid Native Object"); - if (argc == 0) { - bool ret = cobj->init(); - jsval jsret = JSVAL_NULL; - jsret = BOOLEAN_TO_JSVAL(ret); - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_Component_init : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} -bool js_cocos2dx_Component_getName(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_getName : Invalid Native Object"); - if (argc == 0) { - const std::string& ret = cobj->getName(); - jsval jsret = JSVAL_NULL; - jsret = std_string_to_jsval(cx, ret); - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_Component_getName : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} -bool js_cocos2dx_Component_setOwner(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_setOwner : Invalid Native Object"); - if (argc == 1) { - cocos2d::Node* arg0; - do { - if (args.get(0).isNull()) { arg0 = nullptr; break; } - if (!args.get(0).isObject()) { ok = false; break; } - js_proxy_t *jsProxy; - JSObject *tmpObj = args.get(0).toObjectOrNull(); - jsProxy = jsb_get_js_proxy(tmpObj); - arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL); - JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); - } while (0); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Component_setOwner : Error processing arguments"); - cobj->setOwner(arg0); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_Component_setOwner : wrong number of arguments: %d, was expecting %d", argc, 1); - return false; -} -bool js_cocos2dx_Component_create(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - if (argc == 0) { - cocos2d::Component* ret = cocos2d::Component::create(); - jsval jsret = JSVAL_NULL; - do { - if (ret) { - js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::Component*)ret); - jsret = OBJECT_TO_JSVAL(jsProxy->obj); - } else { - jsret = JSVAL_NULL; - } - } while (0); - args.rval().set(jsret); - return true; - } - JS_ReportError(cx, "js_cocos2dx_Component_create : wrong number of arguments"); - return false; -} - -bool js_cocos2dx_Component_constructor(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; - cocos2d::Component* cobj = new (std::nothrow) cocos2d::Component(); - cocos2d::Ref *_ccobj = dynamic_cast(cobj); - if (_ccobj) { - _ccobj->autorelease(); - } - TypeTest t; - js_type_class_t *typeClass = nullptr; - std::string typeName = t.s_name(); - auto typeMapIter = _js_global_type_map.find(typeName); - CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!"); - typeClass = typeMapIter->second; - CCASSERT(typeClass, "The value is null."); - // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto); - JS::RootedObject proto(cx, typeClass->proto.get()); - JS::RootedObject parent(cx, typeClass->parentProto.get()); - JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent)); - args.rval().set(OBJECT_TO_JSVAL(obj)); - // link the native object with the javascript object - js_proxy_t* p = jsb_new_proxy(cobj, obj); - AddNamedObjectRoot(cx, &p->obj, "cocos2d::Component"); - if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) - ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); - return true; -}static bool js_cocos2dx_Component_ctor(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - cocos2d::Component *nobj = new (std::nothrow) cocos2d::Component(); - if (nobj) { - nobj->autorelease(); - } - js_proxy_t* p = jsb_new_proxy(nobj, obj); - AddNamedObjectRoot(cx, &p->obj, "cocos2d::Component"); - bool isFound = false; - if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) - ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); - args.rval().setUndefined(); - return true; -} - -void js_cocos2d_Component_finalize(JSFreeOp *fop, JSObject *obj) { - CCLOGINFO("jsbindings: finalizing JS object %p (Component)", obj); -} - -void js_register_cocos2dx_Component(JSContext *cx, JS::HandleObject global) { - jsb_cocos2d_Component_class = (JSClass *)calloc(1, sizeof(JSClass)); - jsb_cocos2d_Component_class->name = "Component"; - jsb_cocos2d_Component_class->addProperty = JS_PropertyStub; - jsb_cocos2d_Component_class->delProperty = JS_DeletePropertyStub; - jsb_cocos2d_Component_class->getProperty = JS_PropertyStub; - jsb_cocos2d_Component_class->setProperty = JS_StrictPropertyStub; - jsb_cocos2d_Component_class->enumerate = JS_EnumerateStub; - jsb_cocos2d_Component_class->resolve = JS_ResolveStub; - jsb_cocos2d_Component_class->convert = JS_ConvertStub; - jsb_cocos2d_Component_class->finalize = js_cocos2d_Component_finalize; - jsb_cocos2d_Component_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2); - - static JSPropertySpec properties[] = { - JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_PS_END - }; - - static JSFunctionSpec funcs[] = { - JS_FN("setEnabled", js_cocos2dx_Component_setEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("setName", js_cocos2dx_Component_setName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("isEnabled", js_cocos2dx_Component_isEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("getOwner", js_cocos2dx_Component_getOwner, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("init", js_cocos2dx_Component_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("getName", js_cocos2dx_Component_getName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("setOwner", js_cocos2dx_Component_setOwner, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("ctor", js_cocos2dx_Component_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FS_END - }; - - static JSFunctionSpec st_funcs[] = { - JS_FN("create", js_cocos2dx_Component_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FS_END - }; - - jsb_cocos2d_Component_prototype = JS_InitClass( - cx, global, - JS::NullPtr(), // parent proto - jsb_cocos2d_Component_class, - js_cocos2dx_Component_constructor, 0, // constructor - properties, - funcs, - NULL, // no static properties - st_funcs); - // make the class enumerable in the registered namespace -// bool found; -//FIXME: Removed in Firefox v27 -// JS_SetPropertyAttributes(cx, global, "Component", JSPROP_ENUMERATE | JSPROP_READONLY, &found); - - // add the proto and JSClass to the type->js info hash table - TypeTest t; - js_type_class_t *p; - std::string typeName = t.s_name(); - if (_js_global_type_map.find(typeName) == _js_global_type_map.end()) - { - p = (js_type_class_t *)malloc(sizeof(js_type_class_t)); - p->jsclass = jsb_cocos2d_Component_class; - p->proto = jsb_cocos2d_Component_prototype; - p->parentProto = NULL; - _js_global_type_map.insert(std::make_pair(typeName, p)); - } - anonEvaluate(cx, global, "(function () { cc.Component.extend = cc.Class.extend; })()"); -} - -JSClass *jsb_cocos2d_ComponentContainer_class; -JSObject *jsb_cocos2d_ComponentContainer_prototype; - -bool js_cocos2dx_ComponentContainer_visit(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::ComponentContainer* cobj = (cocos2d::ComponentContainer *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ComponentContainer_visit : Invalid Native Object"); - if (argc == 1) { - double arg0; - ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ComponentContainer_visit : Error processing arguments"); - cobj->visit(arg0); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_ComponentContainer_visit : wrong number of arguments: %d, was expecting %d", argc, 1); - return false; -} -bool js_cocos2dx_ComponentContainer_remove(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; - - JS::RootedObject obj(cx); - cocos2d::ComponentContainer* cobj = NULL; - obj = args.thisv().toObjectOrNull(); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cobj = (cocos2d::ComponentContainer *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ComponentContainer_remove : Invalid Native Object"); - do { - if (argc == 1) { - cocos2d::Component* arg0; - do { - if (args.get(0).isNull()) { arg0 = nullptr; break; } - if (!args.get(0).isObject()) { ok = false; break; } - js_proxy_t *jsProxy; - JSObject *tmpObj = args.get(0).toObjectOrNull(); - jsProxy = jsb_get_js_proxy(tmpObj); - arg0 = (cocos2d::Component*)(jsProxy ? jsProxy->ptr : NULL); - JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); - } while (0); - if (!ok) { ok = true; break; } - bool ret = cobj->remove(arg0); - jsval jsret = JSVAL_NULL; - jsret = BOOLEAN_TO_JSVAL(ret); - args.rval().set(jsret); - return true; - } - } while(0); - - do { - if (argc == 1) { - std::string arg0; - ok &= jsval_to_std_string(cx, args.get(0), &arg0); - if (!ok) { ok = true; break; } - bool ret = cobj->remove(arg0); - jsval jsret = JSVAL_NULL; - jsret = BOOLEAN_TO_JSVAL(ret); - args.rval().set(jsret); - return true; - } - } while(0); - - JS_ReportError(cx, "js_cocos2dx_ComponentContainer_remove : wrong number of arguments"); - return false; -} -bool js_cocos2dx_ComponentContainer_removeAll(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::ComponentContainer* cobj = (cocos2d::ComponentContainer *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ComponentContainer_removeAll : Invalid Native Object"); - if (argc == 0) { - cobj->removeAll(); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_ComponentContainer_removeAll : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} -bool js_cocos2dx_ComponentContainer_add(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::ComponentContainer* cobj = (cocos2d::ComponentContainer *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ComponentContainer_add : Invalid Native Object"); - if (argc == 1) { - cocos2d::Component* arg0; - do { - if (args.get(0).isNull()) { arg0 = nullptr; break; } - if (!args.get(0).isObject()) { ok = false; break; } - js_proxy_t *jsProxy; - JSObject *tmpObj = args.get(0).toObjectOrNull(); - jsProxy = jsb_get_js_proxy(tmpObj); - arg0 = (cocos2d::Component*)(jsProxy ? jsProxy->ptr : NULL); - JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); - } while (0); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ComponentContainer_add : Error processing arguments"); - bool ret = cobj->add(arg0); - jsval jsret = JSVAL_NULL; - jsret = BOOLEAN_TO_JSVAL(ret); - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_ComponentContainer_add : wrong number of arguments: %d, was expecting %d", argc, 1); - return false; -} -bool js_cocos2dx_ComponentContainer_isEmpty(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::ComponentContainer* cobj = (cocos2d::ComponentContainer *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ComponentContainer_isEmpty : Invalid Native Object"); - if (argc == 0) { - bool ret = cobj->isEmpty(); - jsval jsret = JSVAL_NULL; - jsret = BOOLEAN_TO_JSVAL(ret); - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_ComponentContainer_isEmpty : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} -bool js_cocos2dx_ComponentContainer_get(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::ComponentContainer* cobj = (cocos2d::ComponentContainer *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ComponentContainer_get : Invalid Native Object"); - if (argc == 1) { - std::string arg0; - ok &= jsval_to_std_string(cx, args.get(0), &arg0); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ComponentContainer_get : Error processing arguments"); - cocos2d::Component* ret = cobj->get(arg0); - jsval jsret = JSVAL_NULL; - do { - if (ret) { - js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::Component*)ret); - jsret = OBJECT_TO_JSVAL(jsProxy->obj); - } else { - jsret = JSVAL_NULL; - } - } while (0); - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_ComponentContainer_get : wrong number of arguments: %d, was expecting %d", argc, 1); - return false; -} - -void js_cocos2d_ComponentContainer_finalize(JSFreeOp *fop, JSObject *obj) { - CCLOGINFO("jsbindings: finalizing JS object %p (ComponentContainer)", obj); -} -void js_register_cocos2dx_ComponentContainer(JSContext *cx, JS::HandleObject global) { - jsb_cocos2d_ComponentContainer_class = (JSClass *)calloc(1, sizeof(JSClass)); - jsb_cocos2d_ComponentContainer_class->name = "ComponentContainer"; - jsb_cocos2d_ComponentContainer_class->addProperty = JS_PropertyStub; - jsb_cocos2d_ComponentContainer_class->delProperty = JS_DeletePropertyStub; - jsb_cocos2d_ComponentContainer_class->getProperty = JS_PropertyStub; - jsb_cocos2d_ComponentContainer_class->setProperty = JS_StrictPropertyStub; - jsb_cocos2d_ComponentContainer_class->enumerate = JS_EnumerateStub; - jsb_cocos2d_ComponentContainer_class->resolve = JS_ResolveStub; - jsb_cocos2d_ComponentContainer_class->convert = JS_ConvertStub; - jsb_cocos2d_ComponentContainer_class->finalize = js_cocos2d_ComponentContainer_finalize; - jsb_cocos2d_ComponentContainer_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2); - - static JSPropertySpec properties[] = { - JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_PS_END - }; - - static JSFunctionSpec funcs[] = { - JS_FN("visit", js_cocos2dx_ComponentContainer_visit, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("remove", js_cocos2dx_ComponentContainer_remove, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("removeAll", js_cocos2dx_ComponentContainer_removeAll, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("add", js_cocos2dx_ComponentContainer_add, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("isEmpty", js_cocos2dx_ComponentContainer_isEmpty, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("getComponent", js_cocos2dx_ComponentContainer_get, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FS_END - }; - - JSFunctionSpec *st_funcs = NULL; - - jsb_cocos2d_ComponentContainer_prototype = JS_InitClass( - cx, global, - JS::NullPtr(), // parent proto - jsb_cocos2d_ComponentContainer_class, - empty_constructor, 0, - properties, - funcs, - NULL, // no static properties - st_funcs); - // make the class enumerable in the registered namespace -// bool found; -//FIXME: Removed in Firefox v27 -// JS_SetPropertyAttributes(cx, global, "ComponentContainer", JSPROP_ENUMERATE | JSPROP_READONLY, &found); - - // add the proto and JSClass to the type->js info hash table - TypeTest t; - js_type_class_t *p; - std::string typeName = t.s_name(); - if (_js_global_type_map.find(typeName) == _js_global_type_map.end()) - { - p = (js_type_class_t *)malloc(sizeof(js_type_class_t)); - p->jsclass = jsb_cocos2d_ComponentContainer_class; - p->proto = jsb_cocos2d_ComponentContainer_prototype; - p->parentProto = NULL; - _js_global_type_map.insert(std::make_pair(typeName, p)); - } -} - JSClass *jsb_CocosDenshion_SimpleAudioEngine_class; JSObject *jsb_CocosDenshion_SimpleAudioEngine_prototype; @@ -69200,7 +70851,7 @@ bool js_cocos2dx_SimpleAudioEngine_preloadBackgroundMusic(JSContext *cx, uint32_ CocosDenshion::SimpleAudioEngine* cobj = (CocosDenshion::SimpleAudioEngine *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SimpleAudioEngine_preloadBackgroundMusic : Invalid Native Object"); if (argc == 1) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SimpleAudioEngine_preloadBackgroundMusic : Error processing arguments"); cobj->preloadBackgroundMusic(arg0); @@ -69295,7 +70946,7 @@ bool js_cocos2dx_SimpleAudioEngine_setBackgroundMusicVolume(JSContext *cx, uint3 CocosDenshion::SimpleAudioEngine* cobj = (CocosDenshion::SimpleAudioEngine *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SimpleAudioEngine_setBackgroundMusicVolume : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SimpleAudioEngine_setBackgroundMusicVolume : Error processing arguments"); cobj->setBackgroundMusicVolume(arg0); @@ -69315,7 +70966,7 @@ bool js_cocos2dx_SimpleAudioEngine_preloadEffect(JSContext *cx, uint32_t argc, j CocosDenshion::SimpleAudioEngine* cobj = (CocosDenshion::SimpleAudioEngine *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SimpleAudioEngine_preloadEffect : Invalid Native Object"); if (argc == 1) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SimpleAudioEngine_preloadEffect : Error processing arguments"); cobj->preloadEffect(arg0); @@ -69389,7 +71040,7 @@ bool js_cocos2dx_SimpleAudioEngine_pauseEffect(JSContext *cx, uint32_t argc, jsv CocosDenshion::SimpleAudioEngine* cobj = (CocosDenshion::SimpleAudioEngine *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SimpleAudioEngine_pauseEffect : Invalid Native Object"); if (argc == 1) { - unsigned int arg0; + unsigned int arg0 = 0; ok &= jsval_to_uint32(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SimpleAudioEngine_pauseEffect : Error processing arguments"); cobj->pauseEffect(arg0); @@ -69409,7 +71060,7 @@ bool js_cocos2dx_SimpleAudioEngine_playEffect(JSContext *cx, uint32_t argc, jsva CocosDenshion::SimpleAudioEngine* cobj = (CocosDenshion::SimpleAudioEngine *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SimpleAudioEngine_playEffect : Invalid Native Object"); if (argc == 1) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SimpleAudioEngine_playEffect : Error processing arguments"); unsigned int ret = cobj->playEffect(arg0); @@ -69419,7 +71070,7 @@ bool js_cocos2dx_SimpleAudioEngine_playEffect(JSContext *cx, uint32_t argc, jsva return true; } if (argc == 2) { - const char* arg0; + const char* arg0 = nullptr; bool arg1; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); arg1 = JS::ToBoolean(args.get(1)); @@ -69431,9 +71082,9 @@ bool js_cocos2dx_SimpleAudioEngine_playEffect(JSContext *cx, uint32_t argc, jsva return true; } if (argc == 3) { - const char* arg0; + const char* arg0 = nullptr; bool arg1; - double arg2; + double arg2 = 0; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); arg1 = JS::ToBoolean(args.get(1)); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -69445,10 +71096,10 @@ bool js_cocos2dx_SimpleAudioEngine_playEffect(JSContext *cx, uint32_t argc, jsva return true; } if (argc == 4) { - const char* arg0; + const char* arg0 = nullptr; bool arg1; - double arg2; - double arg3; + double arg2 = 0; + double arg3 = 0; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); arg1 = JS::ToBoolean(args.get(1)); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -69461,11 +71112,11 @@ bool js_cocos2dx_SimpleAudioEngine_playEffect(JSContext *cx, uint32_t argc, jsva return true; } if (argc == 5) { - const char* arg0; + const char* arg0 = nullptr; bool arg1; - double arg2; - double arg3; - double arg4; + double arg2 = 0; + double arg3 = 0; + double arg4 = 0; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); arg1 = JS::ToBoolean(args.get(1)); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -69507,7 +71158,7 @@ bool js_cocos2dx_SimpleAudioEngine_playBackgroundMusic(JSContext *cx, uint32_t a CocosDenshion::SimpleAudioEngine* cobj = (CocosDenshion::SimpleAudioEngine *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SimpleAudioEngine_playBackgroundMusic : Invalid Native Object"); if (argc == 1) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SimpleAudioEngine_playBackgroundMusic : Error processing arguments"); cobj->playBackgroundMusic(arg0); @@ -69515,7 +71166,7 @@ bool js_cocos2dx_SimpleAudioEngine_playBackgroundMusic(JSContext *cx, uint32_t a return true; } if (argc == 2) { - const char* arg0; + const char* arg0 = nullptr; bool arg1; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); arg1 = JS::ToBoolean(args.get(1)); @@ -69553,7 +71204,7 @@ bool js_cocos2dx_SimpleAudioEngine_setEffectsVolume(JSContext *cx, uint32_t argc CocosDenshion::SimpleAudioEngine* cobj = (CocosDenshion::SimpleAudioEngine *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SimpleAudioEngine_setEffectsVolume : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SimpleAudioEngine_setEffectsVolume : Error processing arguments"); cobj->setEffectsVolume(arg0); @@ -69573,7 +71224,7 @@ bool js_cocos2dx_SimpleAudioEngine_stopEffect(JSContext *cx, uint32_t argc, jsva CocosDenshion::SimpleAudioEngine* cobj = (CocosDenshion::SimpleAudioEngine *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SimpleAudioEngine_stopEffect : Invalid Native Object"); if (argc == 1) { - unsigned int arg0; + unsigned int arg0 = 0; ok &= jsval_to_uint32(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SimpleAudioEngine_stopEffect : Error processing arguments"); cobj->stopEffect(arg0); @@ -69625,7 +71276,7 @@ bool js_cocos2dx_SimpleAudioEngine_unloadEffect(JSContext *cx, uint32_t argc, js CocosDenshion::SimpleAudioEngine* cobj = (CocosDenshion::SimpleAudioEngine *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SimpleAudioEngine_unloadEffect : Invalid Native Object"); if (argc == 1) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SimpleAudioEngine_unloadEffect : Error processing arguments"); cobj->unloadEffect(arg0); @@ -69645,7 +71296,7 @@ bool js_cocos2dx_SimpleAudioEngine_resumeEffect(JSContext *cx, uint32_t argc, js CocosDenshion::SimpleAudioEngine* cobj = (CocosDenshion::SimpleAudioEngine *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SimpleAudioEngine_resumeEffect : Invalid Native Object"); if (argc == 1) { - unsigned int arg0; + unsigned int arg0 = 0; ok &= jsval_to_uint32(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SimpleAudioEngine_resumeEffect : Error processing arguments"); cobj->resumeEffect(arg0); @@ -69807,12 +71458,11 @@ void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj) { js_register_cocos2dx_JumpBy(cx, ns); js_register_cocos2dx_EventListener(cx, ns); js_register_cocos2dx_EventListenerKeyboard(cx, ns); - js_register_cocos2dx_ActionEase(cx, ns); - js_register_cocos2dx_EaseBounce(cx, ns); - js_register_cocos2dx_EaseBounceIn(cx, ns); - js_register_cocos2dx_TransitionRotoZoom(cx, ns); + js_register_cocos2dx_EventListenerMouse(cx, ns); + js_register_cocos2dx_ComponentContainer(cx, ns); js_register_cocos2dx_Director(cx, ns); js_register_cocos2dx_Scheduler(cx, ns); + js_register_cocos2dx_ActionEase(cx, ns); js_register_cocos2dx_EaseElastic(cx, ns); js_register_cocos2dx_EaseElasticOut(cx, ns); js_register_cocos2dx_EaseQuadraticActionInOut(cx, ns); @@ -69835,7 +71485,6 @@ void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj) { js_register_cocos2dx_EaseQuadraticActionOut(cx, ns); js_register_cocos2dx_TransitionProgress(cx, ns); js_register_cocos2dx_TransitionProgressVertical(cx, ns); - js_register_cocos2dx_ComponentContainer(cx, ns); js_register_cocos2dx_TMXTiledMap(cx, ns); js_register_cocos2dx_Grid3DAction(cx, ns); js_register_cocos2dx_BaseLight(cx, ns); @@ -69851,6 +71500,7 @@ void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj) { js_register_cocos2dx_TransitionFlipAngular(cx, ns); js_register_cocos2dx_SimpleAudioEngine(cx, ns); js_register_cocos2dx_EaseElasticInOut(cx, ns); + js_register_cocos2dx_EaseBounce(cx, ns); js_register_cocos2dx_Show(cx, ns); js_register_cocos2dx_FadeOut(cx, ns); js_register_cocos2dx_CallFunc(cx, ns); @@ -69926,7 +71576,7 @@ void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj) { js_register_cocos2dx_NodeGrid(cx, ns); js_register_cocos2dx_TMXLayerInfo(cx, ns); js_register_cocos2dx_EaseSineIn(cx, ns); - js_register_cocos2dx_EventListenerMouse(cx, ns); + js_register_cocos2dx_EaseBounceIn(cx, ns); js_register_cocos2dx_Camera(cx, ns); js_register_cocos2dx_GLProgram(cx, ns); js_register_cocos2dx_ParticleGalaxy(cx, ns); @@ -69963,6 +71613,7 @@ void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj) { js_register_cocos2dx_TransitionZoomFlipX(cx, ns); js_register_cocos2dx_EventFocus(cx, ns); js_register_cocos2dx_EaseQuinticActionInOut(cx, ns); + js_register_cocos2dx_TransitionRotoZoom(cx, ns); js_register_cocos2dx_SpriteFrameCache(cx, ns); js_register_cocos2dx_PointLight(cx, ns); js_register_cocos2dx_TransitionCrossFade(cx, ns); diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp index 35eb6bfb37..1f53571c7b 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp @@ -84,6 +84,37 @@ bool js_cocos2dx_EventTouch_getEventCode(JSContext *cx, uint32_t argc, jsval *vp bool js_cocos2dx_EventTouch_setEventCode(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_EventTouch_EventTouch(JSContext *cx, uint32_t argc, jsval *vp); +extern JSClass *jsb_cocos2d_ComponentContainer_class; +extern JSObject *jsb_cocos2d_ComponentContainer_prototype; + +bool js_cocos2dx_ComponentContainer_constructor(JSContext *cx, uint32_t argc, jsval *vp); +void js_cocos2dx_ComponentContainer_finalize(JSContext *cx, JSObject *obj); +void js_register_cocos2dx_ComponentContainer(JSContext *cx, JS::HandleObject global); +void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj); +bool js_cocos2dx_ComponentContainer_visit(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ComponentContainer_remove(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ComponentContainer_removeAll(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ComponentContainer_add(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ComponentContainer_isEmpty(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ComponentContainer_get(JSContext *cx, uint32_t argc, jsval *vp); + +extern JSClass *jsb_cocos2d_Component_class; +extern JSObject *jsb_cocos2d_Component_prototype; + +bool js_cocos2dx_Component_constructor(JSContext *cx, uint32_t argc, jsval *vp); +void js_cocos2dx_Component_finalize(JSContext *cx, JSObject *obj); +void js_register_cocos2dx_Component(JSContext *cx, JS::HandleObject global); +void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj); +bool js_cocos2dx_Component_setEnabled(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_Component_setName(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_Component_isEnabled(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_Component_getOwner(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_Component_init(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_Component_getName(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_Component_setOwner(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_Component_create(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_Component_Component(JSContext *cx, uint32_t argc, jsval *vp); + extern JSClass *jsb_cocos2d_Node_class; extern JSObject *jsb_cocos2d_Node_prototype; @@ -93,9 +124,7 @@ void js_register_cocos2dx_Node(JSContext *cx, JS::HandleObject global); void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj); bool js_cocos2dx_Node_addChild(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_removeComponent(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Node_setPhysicsBody(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_getGLProgram(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Node_updateTransformFromPhysics(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_getDescription(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_setOpacityModifyRGB(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_setCascadeOpacityEnabled(JSContext *cx, uint32_t argc, jsval *vp); @@ -112,13 +141,11 @@ bool js_cocos2dx_Node_setScaleY(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_setScaleX(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_getColor(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_setonEnterTransitionDidFinishCallback(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Node_removeFromPhysicsWorld(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_removeAllComponents(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_getOpacity(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_setCameraMask(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_getTag(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_getonEnterTransitionDidFinishCallback(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Node_isOpacityModifyRGB(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_getNodeToWorldAffineTransform(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_getPosition3D(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_removeChild(JSContext *cx, uint32_t argc, jsval *vp); @@ -142,7 +169,7 @@ bool js_cocos2dx_Node_getRotation3D(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_getNodeToParentAffineTransform(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_convertTouchToNodeSpaceAR(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_getOnEnterCallback(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Node_getPhysicsBody(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_Node_isOpacityModifyRGB(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_stopActionByTag(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_reorderChild(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_ignoreAnchorPointForPosition(JSContext *cx, uint32_t argc, jsval *vp); @@ -177,7 +204,6 @@ bool js_cocos2dx_Node_getActionByTag(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_setRotationSkewX(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_setRotationSkewY(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_setName(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Node_updatePhysicsBodyTransform(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_getDisplayedOpacity(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_getLocalZOrder(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Node_getScheduler(JSContext *cx, uint32_t argc, jsval *vp); @@ -253,6 +279,7 @@ bool js_cocos2dx_Scene_setCameraOrderDirty(JSContext *cx, uint32_t argc, jsval * bool js_cocos2dx_Scene_render(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Scene_stepPhysicsAndNavigation(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Scene_onProjectionChanged(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_Scene_getPhysicsManager(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Scene_initWithSize(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Scene_getDefaultCamera(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Scene_createWithSize(JSContext *cx, uint32_t argc, jsval *vp); @@ -2901,7 +2928,6 @@ bool js_cocos2dx_Sprite_setAtlasIndex(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Sprite_setDirty(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Sprite_isTextureRectRotated(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Sprite_getTextureRect(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Sprite_debugDraw(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Sprite_initWithFile(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Sprite_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Sprite_getTextureAtlas(JSContext *cx, uint32_t argc, jsval *vp); @@ -3987,37 +4013,6 @@ bool js_cocos2dx_TileMapAtlas_setTGAInfo(JSContext *cx, uint32_t argc, jsval *vp bool js_cocos2dx_TileMapAtlas_create(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TileMapAtlas_TileMapAtlas(JSContext *cx, uint32_t argc, jsval *vp); -extern JSClass *jsb_cocos2d_Component_class; -extern JSObject *jsb_cocos2d_Component_prototype; - -bool js_cocos2dx_Component_constructor(JSContext *cx, uint32_t argc, jsval *vp); -void js_cocos2dx_Component_finalize(JSContext *cx, JSObject *obj); -void js_register_cocos2dx_Component(JSContext *cx, JS::HandleObject global); -void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj); -bool js_cocos2dx_Component_setEnabled(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Component_setName(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Component_isEnabled(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Component_getOwner(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Component_init(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Component_getName(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Component_setOwner(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Component_create(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Component_Component(JSContext *cx, uint32_t argc, jsval *vp); - -extern JSClass *jsb_cocos2d_ComponentContainer_class; -extern JSObject *jsb_cocos2d_ComponentContainer_prototype; - -bool js_cocos2dx_ComponentContainer_constructor(JSContext *cx, uint32_t argc, jsval *vp); -void js_cocos2dx_ComponentContainer_finalize(JSContext *cx, JSObject *obj); -void js_register_cocos2dx_ComponentContainer(JSContext *cx, JS::HandleObject global); -void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj); -bool js_cocos2dx_ComponentContainer_visit(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ComponentContainer_remove(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ComponentContainer_removeAll(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ComponentContainer_add(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ComponentContainer_isEmpty(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ComponentContainer_get(JSContext *cx, uint32_t argc, jsval *vp); - extern JSClass *jsb_CocosDenshion_SimpleAudioEngine_class; extern JSObject *jsb_CocosDenshion_SimpleAudioEngine_prototype; diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_builder_auto.cpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_builder_auto.cpp index 01f134c3a3..0383de1337 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_builder_auto.cpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_builder_auto.cpp @@ -53,8 +53,8 @@ bool js_cocos2dx_builder_CCBAnimationManager_moveAnimationsFromNode(JSContext *c cocosbuilder::CCBAnimationManager* cobj = (cocosbuilder::CCBAnimationManager *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_builder_CCBAnimationManager_moveAnimationsFromNode : Invalid Native Object"); if (argc == 2) { - cocos2d::Node* arg0; - cocos2d::Node* arg1; + cocos2d::Node* arg0 = nullptr; + cocos2d::Node* arg1 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -91,7 +91,7 @@ bool js_cocos2dx_builder_CCBAnimationManager_setAutoPlaySequenceId(JSContext *cx cocosbuilder::CCBAnimationManager* cobj = (cocosbuilder::CCBAnimationManager *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_builder_CCBAnimationManager_setAutoPlaySequenceId : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_builder_CCBAnimationManager_setAutoPlaySequenceId : Error processing arguments"); cobj->setAutoPlaySequenceId(arg0); @@ -129,7 +129,7 @@ bool js_cocos2dx_builder_CCBAnimationManager_actionForSoundChannel(JSContext *cx cocosbuilder::CCBAnimationManager* cobj = (cocosbuilder::CCBAnimationManager *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_builder_CCBAnimationManager_actionForSoundChannel : Invalid Native Object"); if (argc == 1) { - cocosbuilder::CCBSequenceProperty* arg0; + cocosbuilder::CCBSequenceProperty* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -167,7 +167,7 @@ bool js_cocos2dx_builder_CCBAnimationManager_setBaseValue(JSContext *cx, uint32_ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_builder_CCBAnimationManager_setBaseValue : Invalid Native Object"); if (argc == 3) { cocos2d::Value arg0; - cocos2d::Node* arg1; + cocos2d::Node* arg1 = nullptr; std::string arg2; ok &= jsval_to_ccvalue(cx, args.get(0), &arg0); do { @@ -234,7 +234,7 @@ bool js_cocos2dx_builder_CCBAnimationManager_setRootNode(JSContext *cx, uint32_t cocosbuilder::CCBAnimationManager* cobj = (cocosbuilder::CCBAnimationManager *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_builder_CCBAnimationManager_setRootNode : Invalid Native Object"); if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -262,8 +262,8 @@ bool js_cocos2dx_builder_CCBAnimationManager_runAnimationsForSequenceNamedTweenD cocosbuilder::CCBAnimationManager* cobj = (cocosbuilder::CCBAnimationManager *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_builder_CCBAnimationManager_runAnimationsForSequenceNamedTweenDuration : Invalid Native Object"); if (argc == 2) { - const char* arg0; - double arg1; + const char* arg0 = nullptr; + double arg1 = 0; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_builder_CCBAnimationManager_runAnimationsForSequenceNamedTweenDuration : Error processing arguments"); @@ -342,8 +342,8 @@ bool js_cocos2dx_builder_CCBAnimationManager_setObject(JSContext *cx, uint32_t a cocosbuilder::CCBAnimationManager* cobj = (cocosbuilder::CCBAnimationManager *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_builder_CCBAnimationManager_setObject : Invalid Native Object"); if (argc == 3) { - cocos2d::Ref* arg0; - cocos2d::Node* arg1; + cocos2d::Ref* arg0 = nullptr; + cocos2d::Node* arg1 = nullptr; std::string arg2; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -382,7 +382,7 @@ bool js_cocos2dx_builder_CCBAnimationManager_getContainerSize(JSContext *cx, uin cocosbuilder::CCBAnimationManager* cobj = (cocosbuilder::CCBAnimationManager *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_builder_CCBAnimationManager_getContainerSize : Invalid Native Object"); if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -412,7 +412,7 @@ bool js_cocos2dx_builder_CCBAnimationManager_actionForCallbackChannel(JSContext cocosbuilder::CCBAnimationManager* cobj = (cocosbuilder::CCBAnimationManager *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_builder_CCBAnimationManager_actionForCallbackChannel : Invalid Native Object"); if (argc == 1) { - cocosbuilder::CCBSequenceProperty* arg0; + cocosbuilder::CCBSequenceProperty* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -561,8 +561,8 @@ bool js_cocos2dx_builder_CCBAnimationManager_runAnimationsForSequenceIdTweenDura cocosbuilder::CCBAnimationManager* cobj = (cocosbuilder::CCBAnimationManager *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_builder_CCBAnimationManager_runAnimationsForSequenceIdTweenDuration : Invalid Native Object"); if (argc == 2) { - int arg0; - double arg1; + int arg0 = 0; + double arg1 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_builder_CCBAnimationManager_runAnimationsForSequenceIdTweenDuration : Error processing arguments"); @@ -664,7 +664,7 @@ bool js_cocos2dx_builder_CCBAnimationManager_addDocumentOutletNode(JSContext *cx cocosbuilder::CCBAnimationManager* cobj = (cocosbuilder::CCBAnimationManager *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_builder_CCBAnimationManager_addDocumentOutletNode : Invalid Native Object"); if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -692,7 +692,7 @@ bool js_cocos2dx_builder_CCBAnimationManager_setDelegate(JSContext *cx, uint32_t cocosbuilder::CCBAnimationManager* cobj = (cocosbuilder::CCBAnimationManager *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_builder_CCBAnimationManager_setDelegate : Invalid Native Object"); if (argc == 1) { - cocosbuilder::CCBAnimationManagerDelegate* arg0; + cocosbuilder::CCBAnimationManagerDelegate* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -720,7 +720,7 @@ bool js_cocos2dx_builder_CCBAnimationManager_getSequenceDuration(JSContext *cx, cocosbuilder::CCBAnimationManager* cobj = (cocosbuilder::CCBAnimationManager *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_builder_CCBAnimationManager_getSequenceDuration : Invalid Native Object"); if (argc == 1) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_builder_CCBAnimationManager_getSequenceDuration : Error processing arguments"); double ret = cobj->getSequenceDuration(arg0); @@ -742,7 +742,7 @@ bool js_cocos2dx_builder_CCBAnimationManager_addDocumentCallbackNode(JSContext * cocosbuilder::CCBAnimationManager* cobj = (cocosbuilder::CCBAnimationManager *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_builder_CCBAnimationManager_addDocumentCallbackNode : Invalid Native Object"); if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -770,7 +770,7 @@ bool js_cocos2dx_builder_CCBAnimationManager_runAnimationsForSequenceNamed(JSCon cocosbuilder::CCBAnimationManager* cobj = (cocosbuilder::CCBAnimationManager *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_builder_CCBAnimationManager_runAnimationsForSequenceNamed : Invalid Native Object"); if (argc == 1) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_builder_CCBAnimationManager_runAnimationsForSequenceNamed : Error processing arguments"); cobj->runAnimationsForSequenceNamed(arg0); @@ -790,7 +790,7 @@ bool js_cocos2dx_builder_CCBAnimationManager_getSequenceId(JSContext *cx, uint32 cocosbuilder::CCBAnimationManager* cobj = (cocosbuilder::CCBAnimationManager *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_builder_CCBAnimationManager_getSequenceId : Invalid Native Object"); if (argc == 1) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_builder_CCBAnimationManager_getSequenceId : Error processing arguments"); int ret = cobj->getSequenceId(arg0); @@ -812,7 +812,7 @@ bool js_cocos2dx_builder_CCBAnimationManager_setCallFunc(JSContext *cx, uint32_t cocosbuilder::CCBAnimationManager* cobj = (cocosbuilder::CCBAnimationManager *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_builder_CCBAnimationManager_setCallFunc : Invalid Native Object"); if (argc == 2) { - cocos2d::CallFunc* arg0; + cocos2d::CallFunc* arg0 = nullptr; std::string arg1; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -1063,7 +1063,7 @@ bool js_cocos2dx_builder_CCBReader_setAnimationManager(JSContext *cx, uint32_t a cocosbuilder::CCBReader* cobj = (cocosbuilder::CCBReader *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_builder_CCBReader_setAnimationManager : Invalid Native Object"); if (argc == 1) { - cocosbuilder::CCBAnimationManager* arg0; + cocosbuilder::CCBAnimationManager* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1149,7 +1149,7 @@ bool js_cocos2dx_builder_CCBReader_setCCBRootPath(JSContext *cx, uint32_t argc, cocosbuilder::CCBReader* cobj = (cocosbuilder::CCBReader *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_builder_CCBReader_setCCBRootPath : Invalid Native Object"); if (argc == 1) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_builder_CCBReader_setCCBRootPath : Error processing arguments"); cobj->setCCBRootPath(arg0); @@ -1169,7 +1169,7 @@ bool js_cocos2dx_builder_CCBReader_addOwnerOutletNode(JSContext *cx, uint32_t ar cocosbuilder::CCBReader* cobj = (cocosbuilder::CCBReader *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_builder_CCBReader_addOwnerOutletNode : Invalid Native Object"); if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1215,7 +1215,7 @@ bool js_cocos2dx_builder_CCBReader_readSoundKeyframesForSeq(JSContext *cx, uint3 cocosbuilder::CCBReader* cobj = (cocosbuilder::CCBReader *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_builder_CCBReader_readSoundKeyframesForSeq : Invalid Native Object"); if (argc == 1) { - cocosbuilder::CCBSequence* arg0; + cocosbuilder::CCBSequence* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1355,7 +1355,7 @@ bool js_cocos2dx_builder_CCBReader_readCallbackKeyframesForSeq(JSContext *cx, ui cocosbuilder::CCBReader* cobj = (cocosbuilder::CCBReader *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_builder_CCBReader_readCallbackKeyframesForSeq : Invalid Native Object"); if (argc == 1) { - cocosbuilder::CCBSequence* arg0; + cocosbuilder::CCBSequence* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1417,7 +1417,7 @@ bool js_cocos2dx_builder_CCBReader_setResolutionScale(JSContext *cx, uint32_t ar JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_builder_CCBReader_setResolutionScale : Error processing arguments"); cocosbuilder::CCBReader::setResolutionScale(arg0); @@ -1437,7 +1437,7 @@ bool js_cocos2dx_builder_CCBReader_constructor(JSContext *cx, uint32_t argc, jsv cocosbuilder::CCBReader* cobj = NULL; do { if (argc == 1) { - cocosbuilder::CCBReader* arg0; + cocosbuilder::CCBReader* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1472,7 +1472,7 @@ bool js_cocos2dx_builder_CCBReader_constructor(JSContext *cx, uint32_t argc, jsv do { if (argc == 1) { - cocosbuilder::NodeLoaderLibrary* arg0; + cocosbuilder::NodeLoaderLibrary* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1507,7 +1507,7 @@ bool js_cocos2dx_builder_CCBReader_constructor(JSContext *cx, uint32_t argc, jsv do { if (argc == 2) { - cocosbuilder::NodeLoaderLibrary* arg0; + cocosbuilder::NodeLoaderLibrary* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1518,7 +1518,7 @@ bool js_cocos2dx_builder_CCBReader_constructor(JSContext *cx, uint32_t argc, jsv JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocosbuilder::CCBMemberVariableAssigner* arg1; + cocosbuilder::CCBMemberVariableAssigner* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -1553,7 +1553,7 @@ bool js_cocos2dx_builder_CCBReader_constructor(JSContext *cx, uint32_t argc, jsv do { if (argc == 3) { - cocosbuilder::NodeLoaderLibrary* arg0; + cocosbuilder::NodeLoaderLibrary* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1564,7 +1564,7 @@ bool js_cocos2dx_builder_CCBReader_constructor(JSContext *cx, uint32_t argc, jsv JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocosbuilder::CCBMemberVariableAssigner* arg1; + cocosbuilder::CCBMemberVariableAssigner* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -1575,7 +1575,7 @@ bool js_cocos2dx_builder_CCBReader_constructor(JSContext *cx, uint32_t argc, jsv JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocosbuilder::CCBSelectorResolver* arg2; + cocosbuilder::CCBSelectorResolver* arg2 = nullptr; do { if (args.get(2).isNull()) { arg2 = nullptr; break; } if (!args.get(2).isObject()) { ok = false; break; } @@ -1610,7 +1610,7 @@ bool js_cocos2dx_builder_CCBReader_constructor(JSContext *cx, uint32_t argc, jsv do { if (argc == 4) { - cocosbuilder::NodeLoaderLibrary* arg0; + cocosbuilder::NodeLoaderLibrary* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1621,7 +1621,7 @@ bool js_cocos2dx_builder_CCBReader_constructor(JSContext *cx, uint32_t argc, jsv JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocosbuilder::CCBMemberVariableAssigner* arg1; + cocosbuilder::CCBMemberVariableAssigner* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -1632,7 +1632,7 @@ bool js_cocos2dx_builder_CCBReader_constructor(JSContext *cx, uint32_t argc, jsv JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocosbuilder::CCBSelectorResolver* arg2; + cocosbuilder::CCBSelectorResolver* arg2 = nullptr; do { if (args.get(2).isNull()) { arg2 = nullptr; break; } if (!args.get(2).isObject()) { ok = false; break; } @@ -1643,7 +1643,7 @@ bool js_cocos2dx_builder_CCBReader_constructor(JSContext *cx, uint32_t argc, jsv JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocosbuilder::NodeLoaderListener* arg3; + cocosbuilder::NodeLoaderListener* arg3 = nullptr; do { if (args.get(3).isNull()) { arg3 = nullptr; break; } if (!args.get(3).isObject()) { ok = false; break; } diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_experimental_video_auto.cpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_experimental_video_auto.cpp index 6f74cf756d..1bd3397c2b 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_experimental_video_auto.cpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_experimental_video_auto.cpp @@ -220,7 +220,7 @@ bool js_cocos2dx_experimental_video_VideoPlayer_onPlayEvent(JSContext *cx, uint3 cocos2d::experimental::ui::VideoPlayer* cobj = (cocos2d::experimental::ui::VideoPlayer *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_experimental_video_VideoPlayer_onPlayEvent : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_experimental_video_VideoPlayer_onPlayEvent : Error processing arguments"); cobj->onPlayEvent(arg0); @@ -276,7 +276,7 @@ bool js_cocos2dx_experimental_video_VideoPlayer_seekTo(JSContext *cx, uint32_t a cocos2d::experimental::ui::VideoPlayer* cobj = (cocos2d::experimental::ui::VideoPlayer *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_experimental_video_VideoPlayer_seekTo : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_experimental_video_VideoPlayer_seekTo : Error processing arguments"); cobj->seekTo(arg0); diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_extension_auto.cpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_extension_auto.cpp index 323b867f66..43f375f676 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_extension_auto.cpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_extension_auto.cpp @@ -201,7 +201,7 @@ bool js_cocos2dx_extension_Control_isTouchInside(JSContext *cx, uint32_t argc, j cocos2d::extension::Control* cobj = (cocos2d::extension::Control *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_Control_isTouchInside : Invalid Native Object"); if (argc == 1) { - cocos2d::Touch* arg0; + cocos2d::Touch* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -251,7 +251,7 @@ bool js_cocos2dx_extension_Control_getTouchLocation(JSContext *cx, uint32_t argc cocos2d::extension::Control* cobj = (cocos2d::extension::Control *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_Control_getTouchLocation : Invalid Native Object"); if (argc == 1) { - cocos2d::Touch* arg0; + cocos2d::Touch* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -442,7 +442,7 @@ bool js_cocos2dx_extension_ControlButton_setTitleLabelForState(JSContext *cx, ui cocos2d::extension::ControlButton* cobj = (cocos2d::extension::ControlButton *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlButton_setTitleLabelForState : Invalid Native Object"); if (argc == 2) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; cocos2d::extension::Control::State arg1; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -552,7 +552,7 @@ bool js_cocos2dx_extension_ControlButton_initWithBackgroundSprite(JSContext *cx, cocos2d::extension::ControlButton* cobj = (cocos2d::extension::ControlButton *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlButton_initWithBackgroundSprite : Invalid Native Object"); if (argc == 1) { - cocos2d::ui::Scale9Sprite* arg0; + cocos2d::ui::Scale9Sprite* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -626,7 +626,7 @@ bool js_cocos2dx_extension_ControlButton_setTitleTTFSizeForState(JSContext *cx, cocos2d::extension::ControlButton* cobj = (cocos2d::extension::ControlButton *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlButton_setTitleTTFSizeForState : Invalid Native Object"); if (argc == 2) { - double arg0; + double arg0 = 0; cocos2d::extension::Control::State arg1; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); @@ -648,7 +648,7 @@ bool js_cocos2dx_extension_ControlButton_setTitleLabel(JSContext *cx, uint32_t a cocos2d::extension::ControlButton* cobj = (cocos2d::extension::ControlButton *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlButton_setTitleLabel : Invalid Native Object"); if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -734,7 +734,7 @@ bool js_cocos2dx_extension_ControlButton_setBackgroundSprite(JSContext *cx, uint cocos2d::extension::ControlButton* cobj = (cocos2d::extension::ControlButton *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlButton_setBackgroundSprite : Invalid Native Object"); if (argc == 1) { - cocos2d::ui::Scale9Sprite* arg0; + cocos2d::ui::Scale9Sprite* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -811,7 +811,7 @@ bool js_cocos2dx_extension_ControlButton_initWithTitleAndFontNameAndFontSize(JSC if (argc == 3) { std::string arg0; std::string arg1; - double arg2; + double arg2 = 0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); ok &= jsval_to_std_string(cx, args.get(1), &arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -984,7 +984,7 @@ bool js_cocos2dx_extension_ControlButton_setBackgroundSpriteFrameForState(JSCont cocos2d::extension::ControlButton* cobj = (cocos2d::extension::ControlButton *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlButton_setBackgroundSpriteFrameForState : Invalid Native Object"); if (argc == 2) { - cocos2d::SpriteFrame* arg0; + cocos2d::SpriteFrame* arg0 = nullptr; cocos2d::extension::Control::State arg1; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -1014,7 +1014,7 @@ bool js_cocos2dx_extension_ControlButton_setBackgroundSpriteForState(JSContext * cocos2d::extension::ControlButton* cobj = (cocos2d::extension::ControlButton *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlButton_setBackgroundSpriteForState : Invalid Native Object"); if (argc == 2) { - cocos2d::ui::Scale9Sprite* arg0; + cocos2d::ui::Scale9Sprite* arg0 = nullptr; cocos2d::extension::Control::State arg1; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -1044,7 +1044,7 @@ bool js_cocos2dx_extension_ControlButton_setScaleRatio(JSContext *cx, uint32_t a cocos2d::extension::ControlButton* cobj = (cocos2d::extension::ControlButton *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlButton_setScaleRatio : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_extension_ControlButton_setScaleRatio : Error processing arguments"); cobj->setScaleRatio(arg0); @@ -1176,8 +1176,8 @@ bool js_cocos2dx_extension_ControlButton_setMargins(JSContext *cx, uint32_t argc cocos2d::extension::ControlButton* cobj = (cocos2d::extension::ControlButton *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlButton_setMargins : Invalid Native Object"); if (argc == 2) { - int arg0; - int arg1; + int arg0 = 0; + int arg1 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_extension_ControlButton_setMargins : Error processing arguments"); @@ -1232,8 +1232,8 @@ bool js_cocos2dx_extension_ControlButton_initWithLabelAndBackgroundSprite(JSCont cocos2d::extension::ControlButton* cobj = (cocos2d::extension::ControlButton *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlButton_initWithLabelAndBackgroundSprite : Invalid Native Object"); if (argc == 2) { - cocos2d::Node* arg0; - cocos2d::ui::Scale9Sprite* arg1; + cocos2d::Node* arg0 = nullptr; + cocos2d::ui::Scale9Sprite* arg1 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1310,7 +1310,7 @@ bool js_cocos2dx_extension_ControlButton_create(JSContext *cx, uint32_t argc, js do { if (argc == 1) { - cocos2d::ui::Scale9Sprite* arg0; + cocos2d::ui::Scale9Sprite* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1355,7 +1355,7 @@ bool js_cocos2dx_extension_ControlButton_create(JSContext *cx, uint32_t argc, js do { if (argc == 2) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1366,7 +1366,7 @@ bool js_cocos2dx_extension_ControlButton_create(JSContext *cx, uint32_t argc, js JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocos2d::ui::Scale9Sprite* arg1; + cocos2d::ui::Scale9Sprite* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -1400,7 +1400,7 @@ bool js_cocos2dx_extension_ControlButton_create(JSContext *cx, uint32_t argc, js std::string arg1; ok &= jsval_to_std_string(cx, args.get(1), &arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } cocos2d::extension::ControlButton* ret = cocos2d::extension::ControlButton::create(arg0, arg1, arg2); @@ -1577,7 +1577,7 @@ bool js_cocos2dx_extension_ControlHuePicker_initWithTargetAndPos(JSContext *cx, cocos2d::extension::ControlHuePicker* cobj = (cocos2d::extension::ControlHuePicker *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlHuePicker_initWithTargetAndPos : Invalid Native Object"); if (argc == 2) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; cocos2d::Vec2 arg1; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -1609,7 +1609,7 @@ bool js_cocos2dx_extension_ControlHuePicker_setHue(JSContext *cx, uint32_t argc, cocos2d::extension::ControlHuePicker* cobj = (cocos2d::extension::ControlHuePicker *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlHuePicker_setHue : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_extension_ControlHuePicker_setHue : Error processing arguments"); cobj->setHue(arg0); @@ -1690,7 +1690,7 @@ bool js_cocos2dx_extension_ControlHuePicker_setBackground(JSContext *cx, uint32_ cocos2d::extension::ControlHuePicker* cobj = (cocos2d::extension::ControlHuePicker *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlHuePicker_setBackground : Invalid Native Object"); if (argc == 1) { - cocos2d::Sprite* arg0; + cocos2d::Sprite* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1718,7 +1718,7 @@ bool js_cocos2dx_extension_ControlHuePicker_setHuePercentage(JSContext *cx, uint cocos2d::extension::ControlHuePicker* cobj = (cocos2d::extension::ControlHuePicker *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlHuePicker_setHuePercentage : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_extension_ControlHuePicker_setHuePercentage : Error processing arguments"); cobj->setHuePercentage(arg0); @@ -1781,7 +1781,7 @@ bool js_cocos2dx_extension_ControlHuePicker_setSlider(JSContext *cx, uint32_t ar cocos2d::extension::ControlHuePicker* cobj = (cocos2d::extension::ControlHuePicker *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlHuePicker_setSlider : Invalid Native Object"); if (argc == 1) { - cocos2d::Sprite* arg0; + cocos2d::Sprite* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1805,7 +1805,7 @@ bool js_cocos2dx_extension_ControlHuePicker_create(JSContext *cx, uint32_t argc, JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; cocos2d::Vec2 arg1; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -1971,7 +1971,7 @@ bool js_cocos2dx_extension_ControlSaturationBrightnessPicker_initWithTargetAndPo cocos2d::extension::ControlSaturationBrightnessPicker* cobj = (cocos2d::extension::ControlSaturationBrightnessPicker *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlSaturationBrightnessPicker_initWithTargetAndPos : Invalid Native Object"); if (argc == 2) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; cocos2d::Vec2 arg1; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -2128,7 +2128,7 @@ bool js_cocos2dx_extension_ControlSaturationBrightnessPicker_create(JSContext *c JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; cocos2d::Vec2 arg1; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -2267,7 +2267,7 @@ bool js_cocos2dx_extension_ControlColourPicker_hueSliderValueChanged(JSContext * cocos2d::extension::ControlColourPicker* cobj = (cocos2d::extension::ControlColourPicker *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlColourPicker_hueSliderValueChanged : Invalid Native Object"); if (argc == 2) { - cocos2d::Ref* arg0; + cocos2d::Ref* arg0 = nullptr; cocos2d::extension::Control::EventType arg1; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -2347,7 +2347,7 @@ bool js_cocos2dx_extension_ControlColourPicker_setBackground(JSContext *cx, uint cocos2d::extension::ControlColourPicker* cobj = (cocos2d::extension::ControlColourPicker *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlColourPicker_setBackground : Invalid Native Object"); if (argc == 1) { - cocos2d::Sprite* arg0; + cocos2d::Sprite* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2375,7 +2375,7 @@ bool js_cocos2dx_extension_ControlColourPicker_setcolourPicker(JSContext *cx, ui cocos2d::extension::ControlColourPicker* cobj = (cocos2d::extension::ControlColourPicker *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlColourPicker_setcolourPicker : Invalid Native Object"); if (argc == 1) { - cocos2d::extension::ControlSaturationBrightnessPicker* arg0; + cocos2d::extension::ControlSaturationBrightnessPicker* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2403,7 +2403,7 @@ bool js_cocos2dx_extension_ControlColourPicker_colourSliderValueChanged(JSContex cocos2d::extension::ControlColourPicker* cobj = (cocos2d::extension::ControlColourPicker *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlColourPicker_colourSliderValueChanged : Invalid Native Object"); if (argc == 2) { - cocos2d::Ref* arg0; + cocos2d::Ref* arg0 = nullptr; cocos2d::extension::Control::EventType arg1; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -2433,7 +2433,7 @@ bool js_cocos2dx_extension_ControlColourPicker_setHuePicker(JSContext *cx, uint3 cocos2d::extension::ControlColourPicker* cobj = (cocos2d::extension::ControlColourPicker *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlColourPicker_setHuePicker : Invalid Native Object"); if (argc == 1) { - cocos2d::extension::ControlHuePicker* arg0; + cocos2d::extension::ControlHuePicker* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2645,7 +2645,7 @@ bool js_cocos2dx_extension_ControlPotentiometer_setValue(JSContext *cx, uint32_t cocos2d::extension::ControlPotentiometer* cobj = (cocos2d::extension::ControlPotentiometer *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlPotentiometer_setValue : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_extension_ControlPotentiometer_setValue : Error processing arguments"); cobj->setValue(arg0); @@ -2756,7 +2756,7 @@ bool js_cocos2dx_extension_ControlPotentiometer_setMaximumValue(JSContext *cx, u cocos2d::extension::ControlPotentiometer* cobj = (cocos2d::extension::ControlPotentiometer *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlPotentiometer_setMaximumValue : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_extension_ControlPotentiometer_setMaximumValue : Error processing arguments"); cobj->setMaximumValue(arg0); @@ -2794,7 +2794,7 @@ bool js_cocos2dx_extension_ControlPotentiometer_setThumbSprite(JSContext *cx, ui cocos2d::extension::ControlPotentiometer* cobj = (cocos2d::extension::ControlPotentiometer *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlPotentiometer_setThumbSprite : Invalid Native Object"); if (argc == 1) { - cocos2d::Sprite* arg0; + cocos2d::Sprite* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2902,7 +2902,7 @@ bool js_cocos2dx_extension_ControlPotentiometer_setProgressTimer(JSContext *cx, cocos2d::extension::ControlPotentiometer* cobj = (cocos2d::extension::ControlPotentiometer *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlPotentiometer_setProgressTimer : Invalid Native Object"); if (argc == 1) { - cocos2d::ProgressTimer* arg0; + cocos2d::ProgressTimer* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2930,7 +2930,7 @@ bool js_cocos2dx_extension_ControlPotentiometer_setMinimumValue(JSContext *cx, u cocos2d::extension::ControlPotentiometer* cobj = (cocos2d::extension::ControlPotentiometer *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlPotentiometer_setMinimumValue : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_extension_ControlPotentiometer_setMinimumValue : Error processing arguments"); cobj->setMinimumValue(arg0); @@ -2975,9 +2975,9 @@ bool js_cocos2dx_extension_ControlPotentiometer_initWithTrackSprite_ProgressTime cocos2d::extension::ControlPotentiometer* cobj = (cocos2d::extension::ControlPotentiometer *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlPotentiometer_initWithTrackSprite_ProgressTimer_ThumbSprite : Invalid Native Object"); if (argc == 3) { - cocos2d::Sprite* arg0; - cocos2d::ProgressTimer* arg1; - cocos2d::Sprite* arg2; + cocos2d::Sprite* arg0 = nullptr; + cocos2d::ProgressTimer* arg1 = nullptr; + cocos2d::Sprite* arg2 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -3041,9 +3041,9 @@ bool js_cocos2dx_extension_ControlPotentiometer_create(JSContext *cx, uint32_t a JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 3) { - const char* arg0; - const char* arg1; - const char* arg2; + const char* arg0 = nullptr; + const char* arg1 = nullptr; + const char* arg2 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str(); std::string arg2_tmp; ok &= jsval_to_std_string(cx, args.get(2), &arg2_tmp); arg2 = arg2_tmp.c_str(); @@ -3202,7 +3202,7 @@ bool js_cocos2dx_extension_ControlSlider_setBackgroundSprite(JSContext *cx, uint cocos2d::extension::ControlSlider* cobj = (cocos2d::extension::ControlSlider *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlSlider_setBackgroundSprite : Invalid Native Object"); if (argc == 1) { - cocos2d::Sprite* arg0; + cocos2d::Sprite* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -3252,7 +3252,7 @@ bool js_cocos2dx_extension_ControlSlider_initWithSprites(JSContext *cx, uint32_t JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlSlider_initWithSprites : Invalid Native Object"); do { if (argc == 4) { - cocos2d::Sprite* arg0; + cocos2d::Sprite* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -3263,7 +3263,7 @@ bool js_cocos2dx_extension_ControlSlider_initWithSprites(JSContext *cx, uint32_t JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocos2d::Sprite* arg1; + cocos2d::Sprite* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -3274,7 +3274,7 @@ bool js_cocos2dx_extension_ControlSlider_initWithSprites(JSContext *cx, uint32_t JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocos2d::Sprite* arg2; + cocos2d::Sprite* arg2 = nullptr; do { if (args.get(2).isNull()) { arg2 = nullptr; break; } if (!args.get(2).isObject()) { ok = false; break; } @@ -3285,7 +3285,7 @@ bool js_cocos2dx_extension_ControlSlider_initWithSprites(JSContext *cx, uint32_t JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocos2d::Sprite* arg3; + cocos2d::Sprite* arg3 = nullptr; do { if (args.get(3).isNull()) { arg3 = nullptr; break; } if (!args.get(3).isObject()) { ok = false; break; } @@ -3306,7 +3306,7 @@ bool js_cocos2dx_extension_ControlSlider_initWithSprites(JSContext *cx, uint32_t do { if (argc == 3) { - cocos2d::Sprite* arg0; + cocos2d::Sprite* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -3317,7 +3317,7 @@ bool js_cocos2dx_extension_ControlSlider_initWithSprites(JSContext *cx, uint32_t JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocos2d::Sprite* arg1; + cocos2d::Sprite* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -3328,7 +3328,7 @@ bool js_cocos2dx_extension_ControlSlider_initWithSprites(JSContext *cx, uint32_t JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocos2d::Sprite* arg2; + cocos2d::Sprite* arg2 = nullptr; do { if (args.get(2).isNull()) { arg2 = nullptr; break; } if (!args.get(2).isObject()) { ok = false; break; } @@ -3420,7 +3420,7 @@ bool js_cocos2dx_extension_ControlSlider_setProgressSprite(JSContext *cx, uint32 cocos2d::extension::ControlSlider* cobj = (cocos2d::extension::ControlSlider *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlSlider_setProgressSprite : Invalid Native Object"); if (argc == 1) { - cocos2d::Sprite* arg0; + cocos2d::Sprite* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -3448,7 +3448,7 @@ bool js_cocos2dx_extension_ControlSlider_setMaximumValue(JSContext *cx, uint32_t cocos2d::extension::ControlSlider* cobj = (cocos2d::extension::ControlSlider *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlSlider_setMaximumValue : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_extension_ControlSlider_setMaximumValue : Error processing arguments"); cobj->setMaximumValue(arg0); @@ -3486,7 +3486,7 @@ bool js_cocos2dx_extension_ControlSlider_setThumbSprite(JSContext *cx, uint32_t cocos2d::extension::ControlSlider* cobj = (cocos2d::extension::ControlSlider *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlSlider_setThumbSprite : Invalid Native Object"); if (argc == 1) { - cocos2d::Sprite* arg0; + cocos2d::Sprite* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -3582,7 +3582,7 @@ bool js_cocos2dx_extension_ControlSlider_setValue(JSContext *cx, uint32_t argc, cocos2d::extension::ControlSlider* cobj = (cocos2d::extension::ControlSlider *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlSlider_setValue : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_extension_ControlSlider_setValue : Error processing arguments"); cobj->setValue(arg0); @@ -3602,7 +3602,7 @@ bool js_cocos2dx_extension_ControlSlider_locationFromTouch(JSContext *cx, uint32 cocos2d::extension::ControlSlider* cobj = (cocos2d::extension::ControlSlider *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlSlider_locationFromTouch : Invalid Native Object"); if (argc == 1) { - cocos2d::Touch* arg0; + cocos2d::Touch* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -3632,7 +3632,7 @@ bool js_cocos2dx_extension_ControlSlider_setMinimumValue(JSContext *cx, uint32_t cocos2d::extension::ControlSlider* cobj = (cocos2d::extension::ControlSlider *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlSlider_setMinimumValue : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_extension_ControlSlider_setMinimumValue : Error processing arguments"); cobj->setMinimumValue(arg0); @@ -3652,7 +3652,7 @@ bool js_cocos2dx_extension_ControlSlider_setMinimumAllowedValue(JSContext *cx, u cocos2d::extension::ControlSlider* cobj = (cocos2d::extension::ControlSlider *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlSlider_setMinimumAllowedValue : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_extension_ControlSlider_setMinimumAllowedValue : Error processing arguments"); cobj->setMinimumAllowedValue(arg0); @@ -3697,7 +3697,7 @@ bool js_cocos2dx_extension_ControlSlider_setSelectedThumbSprite(JSContext *cx, u cocos2d::extension::ControlSlider* cobj = (cocos2d::extension::ControlSlider *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlSlider_setSelectedThumbSprite : Invalid Native Object"); if (argc == 1) { - cocos2d::Sprite* arg0; + cocos2d::Sprite* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -3725,7 +3725,7 @@ bool js_cocos2dx_extension_ControlSlider_setMaximumAllowedValue(JSContext *cx, u cocos2d::extension::ControlSlider* cobj = (cocos2d::extension::ControlSlider *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlSlider_setMaximumAllowedValue : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_extension_ControlSlider_setMaximumAllowedValue : Error processing arguments"); cobj->setMaximumAllowedValue(arg0); @@ -3743,7 +3743,7 @@ bool js_cocos2dx_extension_ControlSlider_create(JSContext *cx, uint32_t argc, js do { if (argc == 3) { - cocos2d::Sprite* arg0; + cocos2d::Sprite* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -3754,7 +3754,7 @@ bool js_cocos2dx_extension_ControlSlider_create(JSContext *cx, uint32_t argc, js JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocos2d::Sprite* arg1; + cocos2d::Sprite* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -3765,7 +3765,7 @@ bool js_cocos2dx_extension_ControlSlider_create(JSContext *cx, uint32_t argc, js JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocos2d::Sprite* arg2; + cocos2d::Sprite* arg2 = nullptr; do { if (args.get(2).isNull()) { arg2 = nullptr; break; } if (!args.get(2).isObject()) { ok = false; break; } @@ -3793,13 +3793,13 @@ bool js_cocos2dx_extension_ControlSlider_create(JSContext *cx, uint32_t argc, js do { if (argc == 3) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); if (!ok) { ok = true; break; } - const char* arg1; + const char* arg1 = nullptr; std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str(); if (!ok) { ok = true; break; } - const char* arg2; + const char* arg2 = nullptr; std::string arg2_tmp; ok &= jsval_to_std_string(cx, args.get(2), &arg2_tmp); arg2 = arg2_tmp.c_str(); if (!ok) { ok = true; break; } cocos2d::extension::ControlSlider* ret = cocos2d::extension::ControlSlider::create(arg0, arg1, arg2); @@ -3819,16 +3819,16 @@ bool js_cocos2dx_extension_ControlSlider_create(JSContext *cx, uint32_t argc, js do { if (argc == 4) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); if (!ok) { ok = true; break; } - const char* arg1; + const char* arg1 = nullptr; std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str(); if (!ok) { ok = true; break; } - const char* arg2; + const char* arg2 = nullptr; std::string arg2_tmp; ok &= jsval_to_std_string(cx, args.get(2), &arg2_tmp); arg2 = arg2_tmp.c_str(); if (!ok) { ok = true; break; } - const char* arg3; + const char* arg3 = nullptr; std::string arg3_tmp; ok &= jsval_to_std_string(cx, args.get(3), &arg3_tmp); arg3 = arg3_tmp.c_str(); if (!ok) { ok = true; break; } cocos2d::extension::ControlSlider* ret = cocos2d::extension::ControlSlider::create(arg0, arg1, arg2, arg3); @@ -3848,7 +3848,7 @@ bool js_cocos2dx_extension_ControlSlider_create(JSContext *cx, uint32_t argc, js do { if (argc == 4) { - cocos2d::Sprite* arg0; + cocos2d::Sprite* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -3859,7 +3859,7 @@ bool js_cocos2dx_extension_ControlSlider_create(JSContext *cx, uint32_t argc, js JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocos2d::Sprite* arg1; + cocos2d::Sprite* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -3870,7 +3870,7 @@ bool js_cocos2dx_extension_ControlSlider_create(JSContext *cx, uint32_t argc, js JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocos2d::Sprite* arg2; + cocos2d::Sprite* arg2 = nullptr; do { if (args.get(2).isNull()) { arg2 = nullptr; break; } if (!args.get(2).isObject()) { ok = false; break; } @@ -3881,7 +3881,7 @@ bool js_cocos2dx_extension_ControlSlider_create(JSContext *cx, uint32_t argc, js JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocos2d::Sprite* arg3; + cocos2d::Sprite* arg3 = nullptr; do { if (args.get(3).isNull()) { arg3 = nullptr; break; } if (!args.get(3).isObject()) { ok = false; break; } @@ -4073,7 +4073,7 @@ bool js_cocos2dx_extension_ControlStepper_setValue(JSContext *cx, uint32_t argc, cocos2d::extension::ControlStepper* cobj = (cocos2d::extension::ControlStepper *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlStepper_setValue : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_extension_ControlStepper_setValue : Error processing arguments"); cobj->setValue(arg0); @@ -4093,7 +4093,7 @@ bool js_cocos2dx_extension_ControlStepper_setStepValue(JSContext *cx, uint32_t a cocos2d::extension::ControlStepper* cobj = (cocos2d::extension::ControlStepper *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlStepper_setStepValue : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_extension_ControlStepper_setStepValue : Error processing arguments"); cobj->setStepValue(arg0); @@ -4113,8 +4113,8 @@ bool js_cocos2dx_extension_ControlStepper_initWithMinusSpriteAndPlusSprite(JSCon cocos2d::extension::ControlStepper* cobj = (cocos2d::extension::ControlStepper *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlStepper_initWithMinusSpriteAndPlusSprite : Invalid Native Object"); if (argc == 2) { - cocos2d::Sprite* arg0; - cocos2d::Sprite* arg1; + cocos2d::Sprite* arg0 = nullptr; + cocos2d::Sprite* arg1 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -4153,7 +4153,7 @@ bool js_cocos2dx_extension_ControlStepper_setValueWithSendingEvent(JSContext *cx cocos2d::extension::ControlStepper* cobj = (cocos2d::extension::ControlStepper *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlStepper_setValueWithSendingEvent : Invalid Native Object"); if (argc == 2) { - double arg0; + double arg0 = 0; bool arg1; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); arg1 = JS::ToBoolean(args.get(1)); @@ -4175,7 +4175,7 @@ bool js_cocos2dx_extension_ControlStepper_setMaximumValue(JSContext *cx, uint32_ cocos2d::extension::ControlStepper* cobj = (cocos2d::extension::ControlStepper *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlStepper_setMaximumValue : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_extension_ControlStepper_setMaximumValue : Error processing arguments"); cobj->setMaximumValue(arg0); @@ -4265,7 +4265,7 @@ bool js_cocos2dx_extension_ControlStepper_setMinusLabel(JSContext *cx, uint32_t cocos2d::extension::ControlStepper* cobj = (cocos2d::extension::ControlStepper *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlStepper_setMinusLabel : Invalid Native Object"); if (argc == 1) { - cocos2d::Label* arg0; + cocos2d::Label* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -4363,7 +4363,7 @@ bool js_cocos2dx_extension_ControlStepper_setMinimumValue(JSContext *cx, uint32_ cocos2d::extension::ControlStepper* cobj = (cocos2d::extension::ControlStepper *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlStepper_setMinimumValue : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_extension_ControlStepper_setMinimumValue : Error processing arguments"); cobj->setMinimumValue(arg0); @@ -4383,7 +4383,7 @@ bool js_cocos2dx_extension_ControlStepper_setPlusLabel(JSContext *cx, uint32_t a cocos2d::extension::ControlStepper* cobj = (cocos2d::extension::ControlStepper *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlStepper_setPlusLabel : Invalid Native Object"); if (argc == 1) { - cocos2d::Label* arg0; + cocos2d::Label* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -4454,7 +4454,7 @@ bool js_cocos2dx_extension_ControlStepper_setPlusSprite(JSContext *cx, uint32_t cocos2d::extension::ControlStepper* cobj = (cocos2d::extension::ControlStepper *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlStepper_setPlusSprite : Invalid Native Object"); if (argc == 1) { - cocos2d::Sprite* arg0; + cocos2d::Sprite* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -4482,7 +4482,7 @@ bool js_cocos2dx_extension_ControlStepper_setMinusSprite(JSContext *cx, uint32_t cocos2d::extension::ControlStepper* cobj = (cocos2d::extension::ControlStepper *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlStepper_setMinusSprite : Invalid Native Object"); if (argc == 1) { - cocos2d::Sprite* arg0; + cocos2d::Sprite* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -4506,8 +4506,8 @@ bool js_cocos2dx_extension_ControlStepper_create(JSContext *cx, uint32_t argc, j JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - cocos2d::Sprite* arg0; - cocos2d::Sprite* arg1; + cocos2d::Sprite* arg0 = nullptr; + cocos2d::Sprite* arg1 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -4719,7 +4719,7 @@ bool js_cocos2dx_extension_ControlSwitch_locationFromTouch(JSContext *cx, uint32 cocos2d::extension::ControlSwitch* cobj = (cocos2d::extension::ControlSwitch *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlSwitch_locationFromTouch : Invalid Native Object"); if (argc == 1) { - cocos2d::Touch* arg0; + cocos2d::Touch* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -4771,7 +4771,7 @@ bool js_cocos2dx_extension_ControlSwitch_initWithMaskSprite(JSContext *cx, uint3 JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlSwitch_initWithMaskSprite : Invalid Native Object"); do { if (argc == 6) { - cocos2d::Sprite* arg0; + cocos2d::Sprite* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -4782,7 +4782,7 @@ bool js_cocos2dx_extension_ControlSwitch_initWithMaskSprite(JSContext *cx, uint3 JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocos2d::Sprite* arg1; + cocos2d::Sprite* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -4793,7 +4793,7 @@ bool js_cocos2dx_extension_ControlSwitch_initWithMaskSprite(JSContext *cx, uint3 JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocos2d::Sprite* arg2; + cocos2d::Sprite* arg2 = nullptr; do { if (args.get(2).isNull()) { arg2 = nullptr; break; } if (!args.get(2).isObject()) { ok = false; break; } @@ -4804,7 +4804,7 @@ bool js_cocos2dx_extension_ControlSwitch_initWithMaskSprite(JSContext *cx, uint3 JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocos2d::Sprite* arg3; + cocos2d::Sprite* arg3 = nullptr; do { if (args.get(3).isNull()) { arg3 = nullptr; break; } if (!args.get(3).isObject()) { ok = false; break; } @@ -4815,7 +4815,7 @@ bool js_cocos2dx_extension_ControlSwitch_initWithMaskSprite(JSContext *cx, uint3 JSB_PRECONDITION2( arg3, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocos2d::Label* arg4; + cocos2d::Label* arg4 = nullptr; do { if (args.get(4).isNull()) { arg4 = nullptr; break; } if (!args.get(4).isObject()) { ok = false; break; } @@ -4826,7 +4826,7 @@ bool js_cocos2dx_extension_ControlSwitch_initWithMaskSprite(JSContext *cx, uint3 JSB_PRECONDITION2( arg4, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocos2d::Label* arg5; + cocos2d::Label* arg5 = nullptr; do { if (args.get(5).isNull()) { arg5 = nullptr; break; } if (!args.get(5).isObject()) { ok = false; break; } @@ -4847,7 +4847,7 @@ bool js_cocos2dx_extension_ControlSwitch_initWithMaskSprite(JSContext *cx, uint3 do { if (argc == 4) { - cocos2d::Sprite* arg0; + cocos2d::Sprite* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -4858,7 +4858,7 @@ bool js_cocos2dx_extension_ControlSwitch_initWithMaskSprite(JSContext *cx, uint3 JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocos2d::Sprite* arg1; + cocos2d::Sprite* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -4869,7 +4869,7 @@ bool js_cocos2dx_extension_ControlSwitch_initWithMaskSprite(JSContext *cx, uint3 JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocos2d::Sprite* arg2; + cocos2d::Sprite* arg2 = nullptr; do { if (args.get(2).isNull()) { arg2 = nullptr; break; } if (!args.get(2).isObject()) { ok = false; break; } @@ -4880,7 +4880,7 @@ bool js_cocos2dx_extension_ControlSwitch_initWithMaskSprite(JSContext *cx, uint3 JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocos2d::Sprite* arg3; + cocos2d::Sprite* arg3 = nullptr; do { if (args.get(3).isNull()) { arg3 = nullptr; break; } if (!args.get(3).isObject()) { ok = false; break; } @@ -4927,7 +4927,7 @@ bool js_cocos2dx_extension_ControlSwitch_create(JSContext *cx, uint32_t argc, js do { if (argc == 4) { - cocos2d::Sprite* arg0; + cocos2d::Sprite* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -4938,7 +4938,7 @@ bool js_cocos2dx_extension_ControlSwitch_create(JSContext *cx, uint32_t argc, js JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocos2d::Sprite* arg1; + cocos2d::Sprite* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -4949,7 +4949,7 @@ bool js_cocos2dx_extension_ControlSwitch_create(JSContext *cx, uint32_t argc, js JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocos2d::Sprite* arg2; + cocos2d::Sprite* arg2 = nullptr; do { if (args.get(2).isNull()) { arg2 = nullptr; break; } if (!args.get(2).isObject()) { ok = false; break; } @@ -4960,7 +4960,7 @@ bool js_cocos2dx_extension_ControlSwitch_create(JSContext *cx, uint32_t argc, js JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocos2d::Sprite* arg3; + cocos2d::Sprite* arg3 = nullptr; do { if (args.get(3).isNull()) { arg3 = nullptr; break; } if (!args.get(3).isObject()) { ok = false; break; } @@ -4988,7 +4988,7 @@ bool js_cocos2dx_extension_ControlSwitch_create(JSContext *cx, uint32_t argc, js do { if (argc == 6) { - cocos2d::Sprite* arg0; + cocos2d::Sprite* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -4999,7 +4999,7 @@ bool js_cocos2dx_extension_ControlSwitch_create(JSContext *cx, uint32_t argc, js JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocos2d::Sprite* arg1; + cocos2d::Sprite* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -5010,7 +5010,7 @@ bool js_cocos2dx_extension_ControlSwitch_create(JSContext *cx, uint32_t argc, js JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocos2d::Sprite* arg2; + cocos2d::Sprite* arg2 = nullptr; do { if (args.get(2).isNull()) { arg2 = nullptr; break; } if (!args.get(2).isObject()) { ok = false; break; } @@ -5021,7 +5021,7 @@ bool js_cocos2dx_extension_ControlSwitch_create(JSContext *cx, uint32_t argc, js JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocos2d::Sprite* arg3; + cocos2d::Sprite* arg3 = nullptr; do { if (args.get(3).isNull()) { arg3 = nullptr; break; } if (!args.get(3).isObject()) { ok = false; break; } @@ -5032,7 +5032,7 @@ bool js_cocos2dx_extension_ControlSwitch_create(JSContext *cx, uint32_t argc, js JSB_PRECONDITION2( arg3, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocos2d::Label* arg4; + cocos2d::Label* arg4 = nullptr; do { if (args.get(4).isNull()) { arg4 = nullptr; break; } if (!args.get(4).isObject()) { ok = false; break; } @@ -5043,7 +5043,7 @@ bool js_cocos2dx_extension_ControlSwitch_create(JSContext *cx, uint32_t argc, js JSB_PRECONDITION2( arg4, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocos2d::Label* arg5; + cocos2d::Label* arg5 = nullptr; do { if (args.get(5).isNull()) { arg5 = nullptr; break; } if (!args.get(5).isObject()) { ok = false; break; } @@ -5213,7 +5213,7 @@ bool js_cocos2dx_extension_ScrollView_setContainer(JSContext *cx, uint32_t argc, cocos2d::extension::ScrollView* cobj = (cocos2d::extension::ScrollView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ScrollView_setContainer : Invalid Native Object"); if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -5242,7 +5242,7 @@ bool js_cocos2dx_extension_ScrollView_setContentOffsetInDuration(JSContext *cx, JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ScrollView_setContentOffsetInDuration : Invalid Native Object"); if (argc == 2) { cocos2d::Vec2 arg0; - double arg1; + double arg1 = 0; ok &= jsval_to_vector2(cx, args.get(0), &arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_extension_ScrollView_setContentOffsetInDuration : Error processing arguments"); @@ -5263,8 +5263,8 @@ bool js_cocos2dx_extension_ScrollView_setZoomScaleInDuration(JSContext *cx, uint cocos2d::extension::ScrollView* cobj = (cocos2d::extension::ScrollView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ScrollView_setZoomScaleInDuration : Invalid Native Object"); if (argc == 2) { - double arg0; - double arg1; + double arg0 = 0; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_extension_ScrollView_setZoomScaleInDuration : Error processing arguments"); @@ -5285,7 +5285,7 @@ bool js_cocos2dx_extension_ScrollView_updateTweenAction(JSContext *cx, uint32_t cocos2d::extension::ScrollView* cobj = (cocos2d::extension::ScrollView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ScrollView_updateTweenAction : Invalid Native Object"); if (argc == 2) { - double arg0; + double arg0 = 0; std::string arg1; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_std_string(cx, args.get(1), &arg1); @@ -5307,7 +5307,7 @@ bool js_cocos2dx_extension_ScrollView_setMaxScale(JSContext *cx, uint32_t argc, cocos2d::extension::ScrollView* cobj = (cocos2d::extension::ScrollView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ScrollView_setMaxScale : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_extension_ScrollView_setMaxScale : Error processing arguments"); cobj->setMaxScale(arg0); @@ -5388,7 +5388,7 @@ bool js_cocos2dx_extension_ScrollView_setMinScale(JSContext *cx, uint32_t argc, cocos2d::extension::ScrollView* cobj = (cocos2d::extension::ScrollView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ScrollView_setMinScale : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_extension_ScrollView_setMinScale : Error processing arguments"); cobj->setMinScale(arg0); @@ -5453,7 +5453,7 @@ bool js_cocos2dx_extension_ScrollView_initWithViewSize(JSContext *cx, uint32_t a } if (argc == 2) { cocos2d::Size arg0; - cocos2d::Node* arg1; + cocos2d::Node* arg1 = nullptr; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -5484,7 +5484,7 @@ bool js_cocos2dx_extension_ScrollView_pause(JSContext *cx, uint32_t argc, jsval cocos2d::extension::ScrollView* cobj = (cocos2d::extension::ScrollView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ScrollView_pause : Invalid Native Object"); if (argc == 1) { - cocos2d::Ref* arg0; + cocos2d::Ref* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -5674,7 +5674,7 @@ bool js_cocos2dx_extension_ScrollView_resume(JSContext *cx, uint32_t argc, jsval cocos2d::extension::ScrollView* cobj = (cocos2d::extension::ScrollView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ScrollView_resume : Invalid Native Object"); if (argc == 1) { - cocos2d::Ref* arg0; + cocos2d::Ref* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -5796,7 +5796,7 @@ bool js_cocos2dx_extension_ScrollView_isNodeVisible(JSContext *cx, uint32_t argc cocos2d::extension::ScrollView* cobj = (cocos2d::extension::ScrollView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ScrollView_isNodeVisible : Invalid Native Object"); if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -5848,7 +5848,7 @@ bool js_cocos2dx_extension_ScrollView_setZoomScale(JSContext *cx, uint32_t argc, JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ScrollView_setZoomScale : Invalid Native Object"); do { if (argc == 2) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } bool arg1; @@ -5861,7 +5861,7 @@ bool js_cocos2dx_extension_ScrollView_setZoomScale(JSContext *cx, uint32_t argc, do { if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } cobj->setZoomScale(arg0); @@ -5919,7 +5919,7 @@ bool js_cocos2dx_extension_ScrollView_create(JSContext *cx, uint32_t argc, jsval cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - cocos2d::Node* arg1; + cocos2d::Node* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -6131,7 +6131,7 @@ bool js_cocos2dx_extension_TableViewCell_setIdx(JSContext *cx, uint32_t argc, js cocos2d::extension::TableViewCell* cobj = (cocos2d::extension::TableViewCell *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_TableViewCell_setIdx : Invalid Native Object"); if (argc == 1) { - ssize_t arg0; + ssize_t arg0 = 0; ok &= jsval_to_ssize(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_extension_TableViewCell_setIdx : Error processing arguments"); cobj->setIdx(arg0); @@ -6285,7 +6285,7 @@ bool js_cocos2dx_extension_TableView_updateCellAtIndex(JSContext *cx, uint32_t a cocos2d::extension::TableView* cobj = (cocos2d::extension::TableView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_TableView_updateCellAtIndex : Invalid Native Object"); if (argc == 1) { - ssize_t arg0; + ssize_t arg0 = 0; ok &= jsval_to_ssize(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_extension_TableView_updateCellAtIndex : Error processing arguments"); cobj->updateCellAtIndex(arg0); @@ -6325,7 +6325,7 @@ bool js_cocos2dx_extension_TableView_scrollViewDidZoom(JSContext *cx, uint32_t a cocos2d::extension::TableView* cobj = (cocos2d::extension::TableView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_TableView_scrollViewDidZoom : Invalid Native Object"); if (argc == 1) { - cocos2d::extension::ScrollView* arg0; + cocos2d::extension::ScrollView* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -6387,7 +6387,7 @@ bool js_cocos2dx_extension_TableView_removeCellAtIndex(JSContext *cx, uint32_t a cocos2d::extension::TableView* cobj = (cocos2d::extension::TableView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_TableView_removeCellAtIndex : Invalid Native Object"); if (argc == 1) { - ssize_t arg0; + ssize_t arg0 = 0; ok &= jsval_to_ssize(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_extension_TableView_removeCellAtIndex : Error processing arguments"); cobj->removeCellAtIndex(arg0); @@ -6418,7 +6418,7 @@ bool js_cocos2dx_extension_TableView_initWithViewSize(JSContext *cx, uint32_t ar } if (argc == 2) { cocos2d::Size arg0; - cocos2d::Node* arg1; + cocos2d::Node* arg1 = nullptr; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -6449,7 +6449,7 @@ bool js_cocos2dx_extension_TableView_scrollViewDidScroll(JSContext *cx, uint32_t cocos2d::extension::TableView* cobj = (cocos2d::extension::TableView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_TableView_scrollViewDidScroll : Invalid Native Object"); if (argc == 1) { - cocos2d::extension::ScrollView* arg0; + cocos2d::extension::ScrollView* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -6493,7 +6493,7 @@ bool js_cocos2dx_extension_TableView_insertCellAtIndex(JSContext *cx, uint32_t a cocos2d::extension::TableView* cobj = (cocos2d::extension::TableView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_TableView_insertCellAtIndex : Invalid Native Object"); if (argc == 1) { - ssize_t arg0; + ssize_t arg0 = 0; ok &= jsval_to_ssize(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_extension_TableView_insertCellAtIndex : Error processing arguments"); cobj->insertCellAtIndex(arg0); @@ -6513,7 +6513,7 @@ bool js_cocos2dx_extension_TableView_cellAtIndex(JSContext *cx, uint32_t argc, j cocos2d::extension::TableView* cobj = (cocos2d::extension::TableView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_TableView_cellAtIndex : Invalid Native Object"); if (argc == 1) { - ssize_t arg0; + ssize_t arg0 = 0; ok &= jsval_to_ssize(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_extension_TableView_cellAtIndex : Error processing arguments"); cocos2d::extension::TableViewCell* ret = cobj->cellAtIndex(arg0); @@ -6833,7 +6833,7 @@ bool js_cocos2dx_extension_EventAssetsManagerEx_constructor(JSContext *cx, uint3 JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; std::string arg0; - cocos2d::extension::AssetsManagerEx* arg1; + cocos2d::extension::AssetsManagerEx* arg1 = nullptr; cocos2d::extension::EventAssetsManagerEx::EventCode arg2; ok &= jsval_to_std_string(cx, args.get(0), &arg0); do { @@ -7404,7 +7404,7 @@ bool js_cocos2dx_extension_EventListenerAssetsManagerEx_init(JSContext *cx, uint cocos2d::extension::EventListenerAssetsManagerEx* cobj = (cocos2d::extension::EventListenerAssetsManagerEx *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_EventListenerAssetsManagerEx_init : Invalid Native Object"); if (argc == 2) { - const cocos2d::extension::AssetsManagerEx* arg0; + const cocos2d::extension::AssetsManagerEx* arg0 = nullptr; std::function arg1; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -7460,7 +7460,7 @@ bool js_cocos2dx_extension_EventListenerAssetsManagerEx_create(JSContext *cx, ui JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - cocos2d::extension::AssetsManagerEx* arg0; + cocos2d::extension::AssetsManagerEx* arg0 = nullptr; std::function arg1; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_navmesh_auto.cpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_navmesh_auto.cpp index 15661be180..f8e7581799 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_navmesh_auto.cpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_navmesh_auto.cpp @@ -55,7 +55,7 @@ bool js_cocos2dx_navmesh_NavMeshAgent_setMaxSpeed(JSContext *cx, uint32_t argc, cocos2d::NavMeshAgent* cobj = (cocos2d::NavMeshAgent *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_navmesh_NavMeshAgent_setMaxSpeed : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_navmesh_NavMeshAgent_setMaxSpeed : Error processing arguments"); cobj->setMaxSpeed(arg0); @@ -197,7 +197,7 @@ bool js_cocos2dx_navmesh_NavMeshAgent_setSeparationWeight(JSContext *cx, uint32_ cocos2d::NavMeshAgent* cobj = (cocos2d::NavMeshAgent *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_navmesh_NavMeshAgent_setSeparationWeight : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_navmesh_NavMeshAgent_setSeparationWeight : Error processing arguments"); cobj->setSeparationWeight(arg0); @@ -395,7 +395,7 @@ bool js_cocos2dx_navmesh_NavMeshAgent_setMaxAcceleration(JSContext *cx, uint32_t cocos2d::NavMeshAgent* cobj = (cocos2d::NavMeshAgent *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_navmesh_NavMeshAgent_setMaxAcceleration : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_navmesh_NavMeshAgent_setMaxAcceleration : Error processing arguments"); cobj->setMaxAcceleration(arg0); @@ -453,7 +453,7 @@ bool js_cocos2dx_navmesh_NavMeshAgent_setHeight(JSContext *cx, uint32_t argc, js cocos2d::NavMeshAgent* cobj = (cocos2d::NavMeshAgent *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_navmesh_NavMeshAgent_setHeight : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_navmesh_NavMeshAgent_setHeight : Error processing arguments"); cobj->setHeight(arg0); @@ -509,7 +509,7 @@ bool js_cocos2dx_navmesh_NavMeshAgent_setRadius(JSContext *cx, uint32_t argc, js cocos2d::NavMeshAgent* cobj = (cocos2d::NavMeshAgent *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_navmesh_NavMeshAgent_setRadius : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_navmesh_NavMeshAgent_setRadius : Error processing arguments"); cobj->setRadius(arg0); @@ -726,8 +726,8 @@ bool js_cocos2dx_navmesh_NavMeshObstacle_initWith(JSContext *cx, uint32_t argc, cocos2d::NavMeshObstacle* cobj = (cocos2d::NavMeshObstacle *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_navmesh_NavMeshObstacle_initWith : Invalid Native Object"); if (argc == 2) { - double arg0; - double arg1; + double arg0 = 0; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_navmesh_NavMeshObstacle_initWith : Error processing arguments"); @@ -834,8 +834,8 @@ bool js_cocos2dx_navmesh_NavMeshObstacle_create(JSContext *cx, uint32_t argc, js JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; - double arg1; + double arg0 = 0; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_navmesh_NavMeshObstacle_create : Error processing arguments"); @@ -979,7 +979,7 @@ bool js_cocos2dx_navmesh_NavMesh_removeNavMeshObstacle(JSContext *cx, uint32_t a cocos2d::NavMesh* cobj = (cocos2d::NavMesh *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_navmesh_NavMesh_removeNavMeshObstacle : Invalid Native Object"); if (argc == 1) { - cocos2d::NavMeshObstacle* arg0; + cocos2d::NavMeshObstacle* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1007,7 +1007,7 @@ bool js_cocos2dx_navmesh_NavMesh_removeNavMeshAgent(JSContext *cx, uint32_t argc cocos2d::NavMesh* cobj = (cocos2d::NavMesh *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_navmesh_NavMesh_removeNavMeshAgent : Invalid Native Object"); if (argc == 1) { - cocos2d::NavMeshAgent* arg0; + cocos2d::NavMeshAgent* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1035,7 +1035,7 @@ bool js_cocos2dx_navmesh_NavMesh_update(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::NavMesh* cobj = (cocos2d::NavMesh *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_navmesh_NavMesh_update : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_navmesh_NavMesh_update : Error processing arguments"); cobj->update(arg0); @@ -1073,7 +1073,7 @@ bool js_cocos2dx_navmesh_NavMesh_addNavMeshAgent(JSContext *cx, uint32_t argc, j cocos2d::NavMesh* cobj = (cocos2d::NavMesh *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_navmesh_NavMesh_addNavMeshAgent : Invalid Native Object"); if (argc == 1) { - cocos2d::NavMeshAgent* arg0; + cocos2d::NavMeshAgent* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1101,7 +1101,7 @@ bool js_cocos2dx_navmesh_NavMesh_addNavMeshObstacle(JSContext *cx, uint32_t argc cocos2d::NavMesh* cobj = (cocos2d::NavMesh *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_navmesh_NavMesh_addNavMeshObstacle : Invalid Native Object"); if (argc == 1) { - cocos2d::NavMeshObstacle* arg0; + cocos2d::NavMeshObstacle* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1149,7 +1149,7 @@ bool js_cocos2dx_navmesh_NavMesh_debugDraw(JSContext *cx, uint32_t argc, jsval * cocos2d::NavMesh* cobj = (cocos2d::NavMesh *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_navmesh_NavMesh_debugDraw : Invalid Native Object"); if (argc == 1) { - cocos2d::Renderer* arg0; + cocos2d::Renderer* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_physics3d_auto.cpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_physics3d_auto.cpp index 2cc1ff28db..9796ae84f5 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_physics3d_auto.cpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_physics3d_auto.cpp @@ -55,8 +55,8 @@ bool js_cocos2dx_physics3d_Physics3DShape_initConvexHull(JSContext *cx, uint32_t cocos2d::Physics3DShape* cobj = (cocos2d::Physics3DShape *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DShape_initConvexHull : Invalid Native Object"); if (argc == 2) { - const cocos2d::Vec3* arg0; - int arg1; + const cocos2d::Vec3* arg0 = nullptr; + int arg1 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -112,7 +112,7 @@ bool js_cocos2dx_physics3d_Physics3DShape_initSphere(JSContext *cx, uint32_t arg cocos2d::Physics3DShape* cobj = (cocos2d::Physics3DShape *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DShape_initSphere : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DShape_initSphere : Error processing arguments"); bool ret = cobj->initSphere(arg0); @@ -156,8 +156,8 @@ bool js_cocos2dx_physics3d_Physics3DShape_initCapsule(JSContext *cx, uint32_t ar cocos2d::Physics3DShape* cobj = (cocos2d::Physics3DShape *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DShape_initCapsule : Invalid Native Object"); if (argc == 2) { - double arg0; - double arg1; + double arg0 = 0; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DShape_initCapsule : Error processing arguments"); @@ -180,8 +180,8 @@ bool js_cocos2dx_physics3d_Physics3DShape_initCylinder(JSContext *cx, uint32_t a cocos2d::Physics3DShape* cobj = (cocos2d::Physics3DShape *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DShape_initCylinder : Invalid Native Object"); if (argc == 2) { - double arg0; - double arg1; + double arg0 = 0; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DShape_initCylinder : Error processing arguments"); @@ -243,8 +243,8 @@ bool js_cocos2dx_physics3d_Physics3DShape_createCylinder(JSContext *cx, uint32_t JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; - double arg1; + double arg0 = 0; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DShape_createCylinder : Error processing arguments"); @@ -270,8 +270,8 @@ bool js_cocos2dx_physics3d_Physics3DShape_createConvexHull(JSContext *cx, uint32 JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - const cocos2d::Vec3* arg0; - int arg1; + const cocos2d::Vec3* arg0 = nullptr; + int arg1 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -305,8 +305,8 @@ bool js_cocos2dx_physics3d_Physics3DShape_createCapsule(JSContext *cx, uint32_t JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - double arg0; - double arg1; + double arg0 = 0; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DShape_createCapsule : Error processing arguments"); @@ -332,7 +332,7 @@ bool js_cocos2dx_physics3d_Physics3DShape_createSphere(JSContext *cx, uint32_t a JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DShape_createSphere : Error processing arguments"); cocos2d::Physics3DShape* ret = cocos2d::Physics3DShape::createSphere(arg0); @@ -462,7 +462,7 @@ bool js_cocos2dx_physics3d_Physics3DObject_setUserData(JSContext *cx, uint32_t a cocos2d::Physics3DObject* cobj = (cocos2d::Physics3DObject *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DObject_setUserData : Invalid Native Object"); if (argc == 1) { - void* arg0; + void* arg0 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR void* ok = false; JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DObject_setUserData : Error processing arguments"); @@ -519,7 +519,7 @@ bool js_cocos2dx_physics3d_Physics3DObject_setPhysicsWorld(JSContext *cx, uint32 cocos2d::Physics3DObject* cobj = (cocos2d::Physics3DObject *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DObject_setPhysicsWorld : Invalid Native Object"); if (argc == 1) { - cocos2d::Physics3DWorld* arg0; + cocos2d::Physics3DWorld* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -590,7 +590,7 @@ bool js_cocos2dx_physics3d_Physics3DObject_setMask(JSContext *cx, uint32_t argc, cocos2d::Physics3DObject* cobj = (cocos2d::Physics3DObject *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DObject_setMask : Invalid Native Object"); if (argc == 1) { - unsigned int arg0; + unsigned int arg0 = 0; ok &= jsval_to_uint32(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DObject_setMask : Error processing arguments"); cobj->setMask(arg0); @@ -775,7 +775,7 @@ bool js_cocos2dx_physics3d_Physics3DRigidBody_setAngularFactor(JSContext *cx, ui JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DRigidBody_setAngularFactor : Invalid Native Object"); do { if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } cobj->setAngularFactor(arg0); @@ -807,7 +807,7 @@ bool js_cocos2dx_physics3d_Physics3DRigidBody_addConstraint(JSContext *cx, uint3 cocos2d::Physics3DRigidBody* cobj = (cocos2d::Physics3DRigidBody *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DRigidBody_addConstraint : Invalid Native Object"); if (argc == 1) { - cocos2d::Physics3DConstraint* arg0; + cocos2d::Physics3DConstraint* arg0 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -916,7 +916,7 @@ bool js_cocos2dx_physics3d_Physics3DRigidBody_setMassProps(JSContext *cx, uint32 cocos2d::Physics3DRigidBody* cobj = (cocos2d::Physics3DRigidBody *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DRigidBody_setMassProps : Invalid Native Object"); if (argc == 2) { - double arg0; + double arg0 = 0; cocos2d::Vec3 arg1; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= jsval_to_vector3(cx, args.get(1), &arg1); @@ -938,7 +938,7 @@ bool js_cocos2dx_physics3d_Physics3DRigidBody_setFriction(JSContext *cx, uint32_ cocos2d::Physics3DRigidBody* cobj = (cocos2d::Physics3DRigidBody *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DRigidBody_setFriction : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DRigidBody_setFriction : Error processing arguments"); cobj->setFriction(arg0); @@ -978,8 +978,8 @@ bool js_cocos2dx_physics3d_Physics3DRigidBody_setDamping(JSContext *cx, uint32_t cocos2d::Physics3DRigidBody* cobj = (cocos2d::Physics3DRigidBody *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DRigidBody_setDamping : Invalid Native Object"); if (argc == 2) { - double arg0; - double arg1; + double arg0 = 0; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DRigidBody_setDamping : Error processing arguments"); @@ -1060,7 +1060,7 @@ bool js_cocos2dx_physics3d_Physics3DRigidBody_setCcdMotionThreshold(JSContext *c cocos2d::Physics3DRigidBody* cobj = (cocos2d::Physics3DRigidBody *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DRigidBody_setCcdMotionThreshold : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DRigidBody_setCcdMotionThreshold : Error processing arguments"); cobj->setCcdMotionThreshold(arg0); @@ -1080,7 +1080,7 @@ bool js_cocos2dx_physics3d_Physics3DRigidBody_setRollingFriction(JSContext *cx, cocos2d::Physics3DRigidBody* cobj = (cocos2d::Physics3DRigidBody *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DRigidBody_setRollingFriction : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DRigidBody_setRollingFriction : Error processing arguments"); cobj->setRollingFriction(arg0); @@ -1136,7 +1136,7 @@ bool js_cocos2dx_physics3d_Physics3DRigidBody_applyDamping(JSContext *cx, uint32 cocos2d::Physics3DRigidBody* cobj = (cocos2d::Physics3DRigidBody *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DRigidBody_applyDamping : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DRigidBody_applyDamping : Error processing arguments"); cobj->applyDamping(arg0); @@ -1174,7 +1174,7 @@ bool js_cocos2dx_physics3d_Physics3DRigidBody_init(JSContext *cx, uint32_t argc, cocos2d::Physics3DRigidBody* cobj = (cocos2d::Physics3DRigidBody *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DRigidBody_init : Invalid Native Object"); if (argc == 1) { - cocos2d::Physics3DRigidBodyDes* arg0; + cocos2d::Physics3DRigidBodyDes* arg0 = nullptr; cocos2d::Physics3DRigidBodyDes tempObj;arg0=&tempObj;ok &= jsval_to_physics3DRigidBodyDes(cx, args.get(0), arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DRigidBody_init : Error processing arguments"); bool ret = cobj->init(arg0); @@ -1294,7 +1294,7 @@ bool js_cocos2dx_physics3d_Physics3DRigidBody_setCcdSweptSphereRadius(JSContext cocos2d::Physics3DRigidBody* cobj = (cocos2d::Physics3DRigidBody *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DRigidBody_setCcdSweptSphereRadius : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DRigidBody_setCcdSweptSphereRadius : Error processing arguments"); cobj->setCcdSweptSphereRadius(arg0); @@ -1456,7 +1456,7 @@ bool js_cocos2dx_physics3d_Physics3DRigidBody_removeConstraint(JSContext *cx, ui JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DRigidBody_removeConstraint : Invalid Native Object"); do { if (argc == 1) { - unsigned int arg0; + unsigned int arg0 = 0; ok &= jsval_to_uint32(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } cobj->removeConstraint(arg0); @@ -1467,7 +1467,7 @@ bool js_cocos2dx_physics3d_Physics3DRigidBody_removeConstraint(JSContext *cx, ui do { if (argc == 1) { - cocos2d::Physics3DConstraint* arg0; + cocos2d::Physics3DConstraint* arg0 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1532,7 +1532,7 @@ bool js_cocos2dx_physics3d_Physics3DRigidBody_getConstraint(JSContext *cx, uint3 cocos2d::Physics3DRigidBody* cobj = (cocos2d::Physics3DRigidBody *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DRigidBody_getConstraint : Invalid Native Object"); if (argc == 1) { - unsigned int arg0; + unsigned int arg0 = 0; ok &= jsval_to_uint32(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DRigidBody_getConstraint : Error processing arguments"); cocos2d::Physics3DConstraint* ret = cobj->getConstraint(arg0); @@ -1687,7 +1687,7 @@ bool js_cocos2dx_physics3d_Physics3DRigidBody_setRestitution(JSContext *cx, uint cocos2d::Physics3DRigidBody* cobj = (cocos2d::Physics3DRigidBody *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DRigidBody_setRestitution : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DRigidBody_setRestitution : Error processing arguments"); cobj->setRestitution(arg0); @@ -1707,7 +1707,7 @@ bool js_cocos2dx_physics3d_Physics3DRigidBody_setHitFraction(JSContext *cx, uint cocos2d::Physics3DRigidBody* cobj = (cocos2d::Physics3DRigidBody *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DRigidBody_setHitFraction : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DRigidBody_setHitFraction : Error processing arguments"); cobj->setHitFraction(arg0); @@ -1899,7 +1899,7 @@ bool js_cocos2dx_physics3d_Physics3DComponent_addToPhysicsWorld(JSContext *cx, u cocos2d::Physics3DComponent* cobj = (cocos2d::Physics3DComponent *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DComponent_addToPhysicsWorld : Invalid Native Object"); if (argc == 1) { - cocos2d::Physics3DWorld* arg0; + cocos2d::Physics3DWorld* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1968,7 +1968,7 @@ bool js_cocos2dx_physics3d_Physics3DComponent_setPhysics3DObject(JSContext *cx, cocos2d::Physics3DComponent* cobj = (cocos2d::Physics3DComponent *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DComponent_setPhysics3DObject : Invalid Native Object"); if (argc == 1) { - cocos2d::Physics3DObject* arg0; + cocos2d::Physics3DObject* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2036,7 +2036,7 @@ bool js_cocos2dx_physics3d_Physics3DComponent_create(JSContext *cx, uint32_t arg do { if (argc == 1) { - cocos2d::Physics3DObject* arg0; + cocos2d::Physics3DObject* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2063,7 +2063,7 @@ bool js_cocos2dx_physics3d_Physics3DComponent_create(JSContext *cx, uint32_t arg } while (0); do { if (argc == 2) { - cocos2d::Physics3DObject* arg0; + cocos2d::Physics3DObject* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2093,7 +2093,7 @@ bool js_cocos2dx_physics3d_Physics3DComponent_create(JSContext *cx, uint32_t arg } while (0); do { if (argc == 3) { - cocos2d::Physics3DObject* arg0; + cocos2d::Physics3DObject* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2457,7 +2457,7 @@ bool js_cocos2dx_physics3d_Physics3DWorld_stepSimulate(JSContext *cx, uint32_t a cocos2d::Physics3DWorld* cobj = (cocos2d::Physics3DWorld *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DWorld_stepSimulate : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DWorld_stepSimulate : Error processing arguments"); cobj->stepSimulate(arg0); @@ -2527,7 +2527,7 @@ bool js_cocos2dx_physics3d_Physics3DWorld_init(JSContext *cx, uint32_t argc, jsv cocos2d::Physics3DWorld* cobj = (cocos2d::Physics3DWorld *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DWorld_init : Invalid Native Object"); if (argc == 1) { - cocos2d::Physics3DWorldDes* arg0; + cocos2d::Physics3DWorldDes* arg0 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR Physics3DWorldDes* ok = false; JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DWorld_init : Error processing arguments"); @@ -2618,7 +2618,7 @@ bool js_cocos2dx_physics3d_Physics3DWorld_removePhysics3DConstraint(JSContext *c cocos2d::Physics3DWorld* cobj = (cocos2d::Physics3DWorld *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DWorld_removePhysics3DConstraint : Invalid Native Object"); if (argc == 1) { - cocos2d::Physics3DConstraint* arg0; + cocos2d::Physics3DConstraint* arg0 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2646,7 +2646,7 @@ bool js_cocos2dx_physics3d_Physics3DWorld_addPhysics3DObject(JSContext *cx, uint cocos2d::Physics3DWorld* cobj = (cocos2d::Physics3DWorld *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DWorld_addPhysics3DObject : Invalid Native Object"); if (argc == 1) { - cocos2d::Physics3DObject* arg0; + cocos2d::Physics3DObject* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2694,7 +2694,7 @@ bool js_cocos2dx_physics3d_Physics3DWorld_removePhysics3DObject(JSContext *cx, u cocos2d::Physics3DWorld* cobj = (cocos2d::Physics3DWorld *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DWorld_removePhysics3DObject : Invalid Native Object"); if (argc == 1) { - cocos2d::Physics3DObject* arg0; + cocos2d::Physics3DObject* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2722,7 +2722,7 @@ bool js_cocos2dx_physics3d_Physics3DWorld_getPhysicsObject(JSContext *cx, uint32 cocos2d::Physics3DWorld* cobj = (cocos2d::Physics3DWorld *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DWorld_getPhysicsObject : Invalid Native Object"); if (argc == 1) { - const btCollisionObject* arg0; + const btCollisionObject* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2759,7 +2759,7 @@ bool js_cocos2dx_physics3d_Physics3DWorld_addPhysics3DConstraint(JSContext *cx, cocos2d::Physics3DWorld* cobj = (cocos2d::Physics3DWorld *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DWorld_addPhysics3DConstraint : Invalid Native Object"); if (argc == 1) { - cocos2d::Physics3DConstraint* arg0; + cocos2d::Physics3DConstraint* arg0 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2775,7 +2775,7 @@ bool js_cocos2dx_physics3d_Physics3DWorld_addPhysics3DConstraint(JSContext *cx, return true; } if (argc == 2) { - cocos2d::Physics3DConstraint* arg0; + cocos2d::Physics3DConstraint* arg0 = 0; bool arg1; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -2805,7 +2805,7 @@ bool js_cocos2dx_physics3d_Physics3DWorld_debugDraw(JSContext *cx, uint32_t argc cocos2d::Physics3DWorld* cobj = (cocos2d::Physics3DWorld *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DWorld_debugDraw : Invalid Native Object"); if (argc == 1) { - cocos2d::Renderer* arg0; + cocos2d::Renderer* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2833,10 +2833,10 @@ bool js_cocos2dx_physics3d_Physics3DWorld_sweepShape(JSContext *cx, uint32_t arg cocos2d::Physics3DWorld* cobj = (cocos2d::Physics3DWorld *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DWorld_sweepShape : Invalid Native Object"); if (argc == 4) { - cocos2d::Physics3DShape* arg0; + cocos2d::Physics3DShape* arg0 = nullptr; cocos2d::Mat4 arg1; cocos2d::Mat4 arg2; - cocos2d::Physics3DWorld::HitResult* arg3; + cocos2d::Physics3DWorld::HitResult* arg3 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2866,7 +2866,7 @@ bool js_cocos2dx_physics3d_Physics3DWorld_create(JSContext *cx, uint32_t argc, j JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::Physics3DWorldDes* arg0; + cocos2d::Physics3DWorldDes* arg0 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR Physics3DWorldDes* ok = false; JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DWorld_create : Error processing arguments"); @@ -3024,7 +3024,7 @@ bool js_cocos2dx_physics3d_Physics3DConstraint_setBreakingImpulse(JSContext *cx, cocos2d::Physics3DConstraint* cobj = (cocos2d::Physics3DConstraint *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DConstraint_setBreakingImpulse : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DConstraint_setBreakingImpulse : Error processing arguments"); cobj->setBreakingImpulse(arg0); @@ -3166,7 +3166,7 @@ bool js_cocos2dx_physics3d_Physics3DConstraint_setOverrideNumSolverIterations(JS cocos2d::Physics3DConstraint* cobj = (cocos2d::Physics3DConstraint *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DConstraint_setOverrideNumSolverIterations : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DConstraint_setOverrideNumSolverIterations : Error processing arguments"); cobj->setOverrideNumSolverIterations(arg0); @@ -3204,7 +3204,7 @@ bool js_cocos2dx_physics3d_Physics3DConstraint_setUserData(JSContext *cx, uint32 cocos2d::Physics3DConstraint* cobj = (cocos2d::Physics3DConstraint *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DConstraint_setUserData : Invalid Native Object"); if (argc == 1) { - void* arg0; + void* arg0 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR void* ok = false; JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DConstraint_setUserData : Error processing arguments"); @@ -3361,7 +3361,7 @@ bool js_cocos2dx_physics3d_Physics3DPointToPointConstraint_init(JSContext *cx, u JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DPointToPointConstraint_init : Invalid Native Object"); do { if (argc == 4) { - cocos2d::Physics3DRigidBody* arg0; + cocos2d::Physics3DRigidBody* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -3372,7 +3372,7 @@ bool js_cocos2dx_physics3d_Physics3DPointToPointConstraint_init(JSContext *cx, u JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocos2d::Physics3DRigidBody* arg1; + cocos2d::Physics3DRigidBody* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -3399,7 +3399,7 @@ bool js_cocos2dx_physics3d_Physics3DPointToPointConstraint_init(JSContext *cx, u do { if (argc == 2) { - cocos2d::Physics3DRigidBody* arg0; + cocos2d::Physics3DRigidBody* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -3471,7 +3471,7 @@ bool js_cocos2dx_physics3d_Physics3DPointToPointConstraint_create(JSContext *cx, do { if (argc == 4) { - cocos2d::Physics3DRigidBody* arg0; + cocos2d::Physics3DRigidBody* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -3482,7 +3482,7 @@ bool js_cocos2dx_physics3d_Physics3DPointToPointConstraint_create(JSContext *cx, JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocos2d::Physics3DRigidBody* arg1; + cocos2d::Physics3DRigidBody* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -3516,7 +3516,7 @@ bool js_cocos2dx_physics3d_Physics3DPointToPointConstraint_create(JSContext *cx, do { if (argc == 2) { - cocos2d::Physics3DRigidBody* arg0; + cocos2d::Physics3DRigidBody* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -3747,7 +3747,7 @@ bool js_cocos2dx_physics3d_Physics3DHingeConstraint_setMaxMotorImpulse(JSContext cocos2d::Physics3DHingeConstraint* cobj = (cocos2d::Physics3DHingeConstraint *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DHingeConstraint_setMaxMotorImpulse : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DHingeConstraint_setMaxMotorImpulse : Error processing arguments"); cobj->setMaxMotorImpulse(arg0); @@ -3768,8 +3768,8 @@ bool js_cocos2dx_physics3d_Physics3DHingeConstraint_enableAngularMotor(JSContext JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DHingeConstraint_enableAngularMotor : Invalid Native Object"); if (argc == 3) { bool arg0; - double arg1; - double arg2; + double arg1 = 0; + double arg2 = 0; arg0 = JS::ToBoolean(args.get(0)); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -3981,8 +3981,8 @@ bool js_cocos2dx_physics3d_Physics3DHingeConstraint_setLimit(JSContext *cx, uint cocos2d::Physics3DHingeConstraint* cobj = (cocos2d::Physics3DHingeConstraint *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DHingeConstraint_setLimit : Invalid Native Object"); if (argc == 2) { - double arg0; - double arg1; + double arg0 = 0; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DHingeConstraint_setLimit : Error processing arguments"); @@ -3991,9 +3991,9 @@ bool js_cocos2dx_physics3d_Physics3DHingeConstraint_setLimit(JSContext *cx, uint return true; } if (argc == 3) { - double arg0; - double arg1; - double arg2; + double arg0 = 0; + double arg1 = 0; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -4003,10 +4003,10 @@ bool js_cocos2dx_physics3d_Physics3DHingeConstraint_setLimit(JSContext *cx, uint return true; } if (argc == 4) { - double arg0; - double arg1; - double arg2; - double arg3; + double arg0 = 0; + double arg1 = 0; + double arg2 = 0; + double arg3 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -4017,11 +4017,11 @@ bool js_cocos2dx_physics3d_Physics3DHingeConstraint_setLimit(JSContext *cx, uint return true; } if (argc == 5) { - double arg0; - double arg1; - double arg2; - double arg3; - double arg4; + double arg0 = 0; + double arg1 = 0; + double arg2 = 0; + double arg3 = 0; + double arg4 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -4049,10 +4049,10 @@ bool js_cocos2dx_physics3d_Physics3DHingeConstraint_setMotorTarget(JSContext *cx JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DHingeConstraint_setMotorTarget : Invalid Native Object"); do { if (argc == 2) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } cobj->setMotorTarget(arg0, arg1); @@ -4066,7 +4066,7 @@ bool js_cocos2dx_physics3d_Physics3DHingeConstraint_setMotorTarget(JSContext *cx cocos2d::Quaternion arg0; ok &= jsval_to_quaternion(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } cobj->setMotorTarget(arg0, arg1); @@ -4141,7 +4141,7 @@ bool js_cocos2dx_physics3d_Physics3DHingeConstraint_create(JSContext *cx, uint32 do { if (argc == 3) { - cocos2d::Physics3DRigidBody* arg0; + cocos2d::Physics3DRigidBody* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -4174,7 +4174,7 @@ bool js_cocos2dx_physics3d_Physics3DHingeConstraint_create(JSContext *cx, uint32 } while (0); do { if (argc == 4) { - cocos2d::Physics3DRigidBody* arg0; + cocos2d::Physics3DRigidBody* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -4211,7 +4211,7 @@ bool js_cocos2dx_physics3d_Physics3DHingeConstraint_create(JSContext *cx, uint32 do { if (argc == 2) { - cocos2d::Physics3DRigidBody* arg0; + cocos2d::Physics3DRigidBody* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -4241,7 +4241,7 @@ bool js_cocos2dx_physics3d_Physics3DHingeConstraint_create(JSContext *cx, uint32 } while (0); do { if (argc == 3) { - cocos2d::Physics3DRigidBody* arg0; + cocos2d::Physics3DRigidBody* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -4275,7 +4275,7 @@ bool js_cocos2dx_physics3d_Physics3DHingeConstraint_create(JSContext *cx, uint32 do { if (argc == 6) { - cocos2d::Physics3DRigidBody* arg0; + cocos2d::Physics3DRigidBody* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -4286,7 +4286,7 @@ bool js_cocos2dx_physics3d_Physics3DHingeConstraint_create(JSContext *cx, uint32 JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocos2d::Physics3DRigidBody* arg1; + cocos2d::Physics3DRigidBody* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -4325,7 +4325,7 @@ bool js_cocos2dx_physics3d_Physics3DHingeConstraint_create(JSContext *cx, uint32 } while (0); do { if (argc == 7) { - cocos2d::Physics3DRigidBody* arg0; + cocos2d::Physics3DRigidBody* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -4336,7 +4336,7 @@ bool js_cocos2dx_physics3d_Physics3DHingeConstraint_create(JSContext *cx, uint32 JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocos2d::Physics3DRigidBody* arg1; + cocos2d::Physics3DRigidBody* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -4379,7 +4379,7 @@ bool js_cocos2dx_physics3d_Physics3DHingeConstraint_create(JSContext *cx, uint32 do { if (argc == 4) { - cocos2d::Physics3DRigidBody* arg0; + cocos2d::Physics3DRigidBody* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -4390,7 +4390,7 @@ bool js_cocos2dx_physics3d_Physics3DHingeConstraint_create(JSContext *cx, uint32 JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocos2d::Physics3DRigidBody* arg1; + cocos2d::Physics3DRigidBody* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -4423,7 +4423,7 @@ bool js_cocos2dx_physics3d_Physics3DHingeConstraint_create(JSContext *cx, uint32 } while (0); do { if (argc == 5) { - cocos2d::Physics3DRigidBody* arg0; + cocos2d::Physics3DRigidBody* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -4434,7 +4434,7 @@ bool js_cocos2dx_physics3d_Physics3DHingeConstraint_create(JSContext *cx, uint32 JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocos2d::Physics3DRigidBody* arg1; + cocos2d::Physics3DRigidBody* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -4631,7 +4631,7 @@ bool js_cocos2dx_physics3d_Physics3DSliderConstraint_setRestitutionOrthoLin(JSCo cocos2d::Physics3DSliderConstraint* cobj = (cocos2d::Physics3DSliderConstraint *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setRestitutionOrthoLin : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setRestitutionOrthoLin : Error processing arguments"); cobj->setRestitutionOrthoLin(arg0); @@ -4651,7 +4651,7 @@ bool js_cocos2dx_physics3d_Physics3DSliderConstraint_setRestitutionDirLin(JSCont cocos2d::Physics3DSliderConstraint* cobj = (cocos2d::Physics3DSliderConstraint *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setRestitutionDirLin : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setRestitutionDirLin : Error processing arguments"); cobj->setRestitutionDirLin(arg0); @@ -4799,7 +4799,7 @@ bool js_cocos2dx_physics3d_Physics3DSliderConstraint_setSoftnessOrthoLin(JSConte cocos2d::Physics3DSliderConstraint* cobj = (cocos2d::Physics3DSliderConstraint *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setSoftnessOrthoLin : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setSoftnessOrthoLin : Error processing arguments"); cobj->setSoftnessOrthoLin(arg0); @@ -4819,7 +4819,7 @@ bool js_cocos2dx_physics3d_Physics3DSliderConstraint_setSoftnessLimLin(JSContext cocos2d::Physics3DSliderConstraint* cobj = (cocos2d::Physics3DSliderConstraint *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setSoftnessLimLin : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setSoftnessLimLin : Error processing arguments"); cobj->setSoftnessLimLin(arg0); @@ -4857,7 +4857,7 @@ bool js_cocos2dx_physics3d_Physics3DSliderConstraint_setRestitutionLimAng(JSCont cocos2d::Physics3DSliderConstraint* cobj = (cocos2d::Physics3DSliderConstraint *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setRestitutionLimAng : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setRestitutionLimAng : Error processing arguments"); cobj->setRestitutionLimAng(arg0); @@ -4877,7 +4877,7 @@ bool js_cocos2dx_physics3d_Physics3DSliderConstraint_setUpperLinLimit(JSContext cocos2d::Physics3DSliderConstraint* cobj = (cocos2d::Physics3DSliderConstraint *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setUpperLinLimit : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setUpperLinLimit : Error processing arguments"); cobj->setUpperLinLimit(arg0); @@ -4897,7 +4897,7 @@ bool js_cocos2dx_physics3d_Physics3DSliderConstraint_setDampingDirLin(JSContext cocos2d::Physics3DSliderConstraint* cobj = (cocos2d::Physics3DSliderConstraint *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setDampingDirLin : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setDampingDirLin : Error processing arguments"); cobj->setDampingDirLin(arg0); @@ -4989,7 +4989,7 @@ bool js_cocos2dx_physics3d_Physics3DSliderConstraint_setLowerAngLimit(JSContext cocos2d::Physics3DSliderConstraint* cobj = (cocos2d::Physics3DSliderConstraint *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setLowerAngLimit : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setLowerAngLimit : Error processing arguments"); cobj->setLowerAngLimit(arg0); @@ -5009,7 +5009,7 @@ bool js_cocos2dx_physics3d_Physics3DSliderConstraint_setUpperAngLimit(JSContext cocos2d::Physics3DSliderConstraint* cobj = (cocos2d::Physics3DSliderConstraint *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setUpperAngLimit : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setUpperAngLimit : Error processing arguments"); cobj->setUpperAngLimit(arg0); @@ -5029,7 +5029,7 @@ bool js_cocos2dx_physics3d_Physics3DSliderConstraint_setTargetLinMotorVelocity(J cocos2d::Physics3DSliderConstraint* cobj = (cocos2d::Physics3DSliderConstraint *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setTargetLinMotorVelocity : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setTargetLinMotorVelocity : Error processing arguments"); cobj->setTargetLinMotorVelocity(arg0); @@ -5049,7 +5049,7 @@ bool js_cocos2dx_physics3d_Physics3DSliderConstraint_setDampingLimAng(JSContext cocos2d::Physics3DSliderConstraint* cobj = (cocos2d::Physics3DSliderConstraint *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setDampingLimAng : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setDampingLimAng : Error processing arguments"); cobj->setDampingLimAng(arg0); @@ -5161,7 +5161,7 @@ bool js_cocos2dx_physics3d_Physics3DSliderConstraint_setLowerLinLimit(JSContext cocos2d::Physics3DSliderConstraint* cobj = (cocos2d::Physics3DSliderConstraint *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setLowerLinLimit : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setLowerLinLimit : Error processing arguments"); cobj->setLowerLinLimit(arg0); @@ -5253,7 +5253,7 @@ bool js_cocos2dx_physics3d_Physics3DSliderConstraint_setDampingOrthoAng(JSContex cocos2d::Physics3DSliderConstraint* cobj = (cocos2d::Physics3DSliderConstraint *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setDampingOrthoAng : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setDampingOrthoAng : Error processing arguments"); cobj->setDampingOrthoAng(arg0); @@ -5273,7 +5273,7 @@ bool js_cocos2dx_physics3d_Physics3DSliderConstraint_setSoftnessDirAng(JSContext cocos2d::Physics3DSliderConstraint* cobj = (cocos2d::Physics3DSliderConstraint *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setSoftnessDirAng : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setSoftnessDirAng : Error processing arguments"); cobj->setSoftnessDirAng(arg0); @@ -5311,7 +5311,7 @@ bool js_cocos2dx_physics3d_Physics3DSliderConstraint_setRestitutionOrthoAng(JSCo cocos2d::Physics3DSliderConstraint* cobj = (cocos2d::Physics3DSliderConstraint *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setRestitutionOrthoAng : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setRestitutionOrthoAng : Error processing arguments"); cobj->setRestitutionOrthoAng(arg0); @@ -5331,7 +5331,7 @@ bool js_cocos2dx_physics3d_Physics3DSliderConstraint_setDampingDirAng(JSContext cocos2d::Physics3DSliderConstraint* cobj = (cocos2d::Physics3DSliderConstraint *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setDampingDirAng : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setDampingDirAng : Error processing arguments"); cobj->setDampingDirAng(arg0); @@ -5445,7 +5445,7 @@ bool js_cocos2dx_physics3d_Physics3DSliderConstraint_setMaxLinMotorForce(JSConte cocos2d::Physics3DSliderConstraint* cobj = (cocos2d::Physics3DSliderConstraint *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setMaxLinMotorForce : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setMaxLinMotorForce : Error processing arguments"); cobj->setMaxLinMotorForce(arg0); @@ -5483,7 +5483,7 @@ bool js_cocos2dx_physics3d_Physics3DSliderConstraint_setTargetAngMotorVelocity(J cocos2d::Physics3DSliderConstraint* cobj = (cocos2d::Physics3DSliderConstraint *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setTargetAngMotorVelocity : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setTargetAngMotorVelocity : Error processing arguments"); cobj->setTargetAngMotorVelocity(arg0); @@ -5521,7 +5521,7 @@ bool js_cocos2dx_physics3d_Physics3DSliderConstraint_setRestitutionDirAng(JSCont cocos2d::Physics3DSliderConstraint* cobj = (cocos2d::Physics3DSliderConstraint *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setRestitutionDirAng : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setRestitutionDirAng : Error processing arguments"); cobj->setRestitutionDirAng(arg0); @@ -5613,7 +5613,7 @@ bool js_cocos2dx_physics3d_Physics3DSliderConstraint_setRestitutionLimLin(JSCont cocos2d::Physics3DSliderConstraint* cobj = (cocos2d::Physics3DSliderConstraint *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setRestitutionLimLin : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setRestitutionLimLin : Error processing arguments"); cobj->setRestitutionLimLin(arg0); @@ -5651,7 +5651,7 @@ bool js_cocos2dx_physics3d_Physics3DSliderConstraint_setDampingOrthoLin(JSContex cocos2d::Physics3DSliderConstraint* cobj = (cocos2d::Physics3DSliderConstraint *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setDampingOrthoLin : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setDampingOrthoLin : Error processing arguments"); cobj->setDampingOrthoLin(arg0); @@ -5671,7 +5671,7 @@ bool js_cocos2dx_physics3d_Physics3DSliderConstraint_setSoftnessOrthoAng(JSConte cocos2d::Physics3DSliderConstraint* cobj = (cocos2d::Physics3DSliderConstraint *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setSoftnessOrthoAng : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setSoftnessOrthoAng : Error processing arguments"); cobj->setSoftnessOrthoAng(arg0); @@ -5691,7 +5691,7 @@ bool js_cocos2dx_physics3d_Physics3DSliderConstraint_setDampingLimLin(JSContext cocos2d::Physics3DSliderConstraint* cobj = (cocos2d::Physics3DSliderConstraint *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setDampingLimLin : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setDampingLimLin : Error processing arguments"); cobj->setDampingLimLin(arg0); @@ -5711,7 +5711,7 @@ bool js_cocos2dx_physics3d_Physics3DSliderConstraint_setSoftnessDirLin(JSContext cocos2d::Physics3DSliderConstraint* cobj = (cocos2d::Physics3DSliderConstraint *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setSoftnessDirLin : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setSoftnessDirLin : Error processing arguments"); cobj->setSoftnessDirLin(arg0); @@ -5731,7 +5731,7 @@ bool js_cocos2dx_physics3d_Physics3DSliderConstraint_setMaxAngMotorForce(JSConte cocos2d::Physics3DSliderConstraint* cobj = (cocos2d::Physics3DSliderConstraint *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setMaxAngMotorForce : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setMaxAngMotorForce : Error processing arguments"); cobj->setMaxAngMotorForce(arg0); @@ -5769,7 +5769,7 @@ bool js_cocos2dx_physics3d_Physics3DSliderConstraint_setSoftnessLimAng(JSContext cocos2d::Physics3DSliderConstraint* cobj = (cocos2d::Physics3DSliderConstraint *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setSoftnessLimAng : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DSliderConstraint_setSoftnessLimAng : Error processing arguments"); cobj->setSoftnessLimAng(arg0); @@ -5803,8 +5803,8 @@ bool js_cocos2dx_physics3d_Physics3DSliderConstraint_create(JSContext *cx, uint3 JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 5) { - cocos2d::Physics3DRigidBody* arg0; - cocos2d::Physics3DRigidBody* arg1; + cocos2d::Physics3DRigidBody* arg0 = nullptr; + cocos2d::Physics3DRigidBody* arg1 = nullptr; cocos2d::Mat4 arg2; cocos2d::Mat4 arg3; bool arg4; @@ -6030,7 +6030,7 @@ bool js_cocos2dx_physics3d_Physics3DConeTwistConstraint_setFixThresh(JSContext * cocos2d::Physics3DConeTwistConstraint* cobj = (cocos2d::Physics3DConeTwistConstraint *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DConeTwistConstraint_setFixThresh : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DConeTwistConstraint_setFixThresh : Error processing arguments"); cobj->setFixThresh(arg0); @@ -6140,7 +6140,7 @@ bool js_cocos2dx_physics3d_Physics3DConeTwistConstraint_setMaxMotorImpulse(JSCon cocos2d::Physics3DConeTwistConstraint* cobj = (cocos2d::Physics3DConeTwistConstraint *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DConeTwistConstraint_setMaxMotorImpulse : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DConeTwistConstraint_setMaxMotorImpulse : Error processing arguments"); cobj->setMaxMotorImpulse(arg0); @@ -6200,8 +6200,8 @@ bool js_cocos2dx_physics3d_Physics3DConeTwistConstraint_GetPointForAngle(JSConte cocos2d::Physics3DConeTwistConstraint* cobj = (cocos2d::Physics3DConeTwistConstraint *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DConeTwistConstraint_GetPointForAngle : Invalid Native Object"); if (argc == 2) { - double arg0; - double arg1; + double arg0 = 0; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DConeTwistConstraint_GetPointForAngle : Error processing arguments"); @@ -6224,7 +6224,7 @@ bool js_cocos2dx_physics3d_Physics3DConeTwistConstraint_setMaxMotorImpulseNormal cocos2d::Physics3DConeTwistConstraint* cobj = (cocos2d::Physics3DConeTwistConstraint *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DConeTwistConstraint_setMaxMotorImpulseNormalized : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DConeTwistConstraint_setMaxMotorImpulseNormalized : Error processing arguments"); cobj->setMaxMotorImpulseNormalized(arg0); @@ -6262,7 +6262,7 @@ bool js_cocos2dx_physics3d_Physics3DConeTwistConstraint_setDamping(JSContext *cx cocos2d::Physics3DConeTwistConstraint* cobj = (cocos2d::Physics3DConeTwistConstraint *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DConeTwistConstraint_setDamping : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DConeTwistConstraint_setDamping : Error processing arguments"); cobj->setDamping(arg0); @@ -6282,9 +6282,9 @@ bool js_cocos2dx_physics3d_Physics3DConeTwistConstraint_setLimit(JSContext *cx, cocos2d::Physics3DConeTwistConstraint* cobj = (cocos2d::Physics3DConeTwistConstraint *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DConeTwistConstraint_setLimit : Invalid Native Object"); if (argc == 3) { - double arg0; - double arg1; - double arg2; + double arg0 = 0; + double arg1 = 0; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -6294,10 +6294,10 @@ bool js_cocos2dx_physics3d_Physics3DConeTwistConstraint_setLimit(JSContext *cx, return true; } if (argc == 4) { - double arg0; - double arg1; - double arg2; - double arg3; + double arg0 = 0; + double arg1 = 0; + double arg2 = 0; + double arg3 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -6308,11 +6308,11 @@ bool js_cocos2dx_physics3d_Physics3DConeTwistConstraint_setLimit(JSContext *cx, return true; } if (argc == 5) { - double arg0; - double arg1; - double arg2; - double arg3; - double arg4; + double arg0 = 0; + double arg1 = 0; + double arg2 = 0; + double arg3 = 0; + double arg4 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -6324,12 +6324,12 @@ bool js_cocos2dx_physics3d_Physics3DConeTwistConstraint_setLimit(JSContext *cx, return true; } if (argc == 6) { - double arg0; - double arg1; - double arg2; - double arg3; - double arg4; - double arg5; + double arg0 = 0; + double arg1 = 0; + double arg2 = 0; + double arg3 = 0; + double arg4 = 0; + double arg5 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -6390,7 +6390,7 @@ bool js_cocos2dx_physics3d_Physics3DConeTwistConstraint_create(JSContext *cx, ui do { if (argc == 4) { - cocos2d::Physics3DRigidBody* arg0; + cocos2d::Physics3DRigidBody* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -6401,7 +6401,7 @@ bool js_cocos2dx_physics3d_Physics3DConeTwistConstraint_create(JSContext *cx, ui JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocos2d::Physics3DRigidBody* arg1; + cocos2d::Physics3DRigidBody* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -6435,7 +6435,7 @@ bool js_cocos2dx_physics3d_Physics3DConeTwistConstraint_create(JSContext *cx, ui do { if (argc == 2) { - cocos2d::Physics3DRigidBody* arg0; + cocos2d::Physics3DRigidBody* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -6696,7 +6696,7 @@ bool js_cocos2dx_physics3d_Physics3D6DofConstraint_isLimited(JSContext *cx, uint cocos2d::Physics3D6DofConstraint* cobj = (cocos2d::Physics3D6DofConstraint *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3D6DofConstraint_isLimited : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3D6DofConstraint_isLimited : Error processing arguments"); bool ret = cobj->isLimited(arg0); @@ -6794,7 +6794,7 @@ bool js_cocos2dx_physics3d_Physics3D6DofConstraint_create(JSContext *cx, uint32_ do { if (argc == 3) { - cocos2d::Physics3DRigidBody* arg0; + cocos2d::Physics3DRigidBody* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -6828,7 +6828,7 @@ bool js_cocos2dx_physics3d_Physics3D6DofConstraint_create(JSContext *cx, uint32_ do { if (argc == 5) { - cocos2d::Physics3DRigidBody* arg0; + cocos2d::Physics3DRigidBody* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -6839,7 +6839,7 @@ bool js_cocos2dx_physics3d_Physics3D6DofConstraint_create(JSContext *cx, uint32_ JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocos2d::Physics3DRigidBody* arg1; + cocos2d::Physics3DRigidBody* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.cpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.cpp index fc1e55b240..73cb0f4267 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.cpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.cpp @@ -54,7 +54,7 @@ bool js_cocos2dx_spine_SkeletonRenderer_setTimeScale(JSContext *cx, uint32_t arg spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonRenderer_setTimeScale : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_spine_SkeletonRenderer_setTimeScale : Error processing arguments"); cobj->setTimeScale(arg0); @@ -99,7 +99,7 @@ bool js_cocos2dx_spine_SkeletonRenderer_setAttachment(JSContext *cx, uint32_t ar std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - const char* arg1; + const char* arg1 = nullptr; std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str(); if (!ok) { ok = true; break; } bool ret = cobj->setAttachment(arg0, arg1); @@ -154,7 +154,7 @@ bool js_cocos2dx_spine_SkeletonRenderer_initWithData(JSContext *cx, uint32_t arg spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonRenderer_initWithData : Invalid Native Object"); if (argc == 1) { - spSkeletonData* arg0; + spSkeletonData* arg0 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData* ok = false; JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_spine_SkeletonRenderer_initWithData : Error processing arguments"); @@ -163,7 +163,7 @@ bool js_cocos2dx_spine_SkeletonRenderer_initWithData(JSContext *cx, uint32_t arg return true; } if (argc == 2) { - spSkeletonData* arg0; + spSkeletonData* arg0 = nullptr; bool arg1; #pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData* ok = false; @@ -257,7 +257,7 @@ bool js_cocos2dx_spine_SkeletonRenderer_drawSkeleton(JSContext *cx, uint32_t arg JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonRenderer_drawSkeleton : Invalid Native Object"); if (argc == 2) { cocos2d::Mat4 arg0; - unsigned int arg1; + unsigned int arg1 = 0; ok &= jsval_to_matrix(cx, args.get(0), &arg0); ok &= jsval_to_uint32(cx, args.get(1), &arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_spine_SkeletonRenderer_drawSkeleton : Error processing arguments"); @@ -390,7 +390,7 @@ bool js_cocos2dx_spine_SkeletonRenderer_initWithFile(JSContext *cx, uint32_t arg std::string arg1; ok &= jsval_to_std_string(cx, args.get(1), &arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } cobj->initWithFile(arg0, arg1, arg2); @@ -404,7 +404,7 @@ bool js_cocos2dx_spine_SkeletonRenderer_initWithFile(JSContext *cx, uint32_t arg std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - spAtlas* arg1; + spAtlas* arg1 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* ok = false; if (!ok) { ok = true; break; } @@ -419,11 +419,11 @@ bool js_cocos2dx_spine_SkeletonRenderer_initWithFile(JSContext *cx, uint32_t arg std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - spAtlas* arg1; + spAtlas* arg1 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* ok = false; if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } cobj->initWithFile(arg0, arg1, arg2); @@ -468,7 +468,7 @@ bool js_cocos2dx_spine_SkeletonRenderer_setSkin(JSContext *cx, uint32_t argc, js JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonRenderer_setSkin : Invalid Native Object"); do { if (argc == 1) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); if (!ok) { ok = true; break; } bool ret = cobj->setSkin(arg0); @@ -548,7 +548,7 @@ bool js_cocos2dx_spine_SkeletonRenderer_createWithFile(JSContext *cx, uint32_t a std::string arg1; ok &= jsval_to_std_string(cx, args.get(1), &arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } spine::SkeletonRenderer* ret = spine::SkeletonRenderer::createWithFile(arg0, arg1, arg2); @@ -571,7 +571,7 @@ bool js_cocos2dx_spine_SkeletonRenderer_createWithFile(JSContext *cx, uint32_t a std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - spAtlas* arg1; + spAtlas* arg1 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* ok = false; if (!ok) { ok = true; break; } @@ -594,11 +594,11 @@ bool js_cocos2dx_spine_SkeletonRenderer_createWithFile(JSContext *cx, uint32_t a std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - spAtlas* arg1; + spAtlas* arg1 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* ok = false; if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } spine::SkeletonRenderer* ret = spine::SkeletonRenderer::createWithFile(arg0, arg1, arg2); @@ -627,7 +627,7 @@ bool js_cocos2dx_spine_SkeletonRenderer_constructor(JSContext *cx, uint32_t argc spine::SkeletonRenderer* cobj = NULL; do { if (argc == 1) { - spSkeletonData* arg0; + spSkeletonData* arg0 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData* ok = false; if (!ok) { ok = true; break; } @@ -655,7 +655,7 @@ bool js_cocos2dx_spine_SkeletonRenderer_constructor(JSContext *cx, uint32_t argc do { if (argc == 2) { - spSkeletonData* arg0; + spSkeletonData* arg0 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData* ok = false; if (!ok) { ok = true; break; } @@ -712,7 +712,7 @@ bool js_cocos2dx_spine_SkeletonRenderer_constructor(JSContext *cx, uint32_t argc std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - spAtlas* arg1; + spAtlas* arg1 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* ok = false; if (!ok) { ok = true; break; } @@ -743,11 +743,11 @@ bool js_cocos2dx_spine_SkeletonRenderer_constructor(JSContext *cx, uint32_t argc std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - spAtlas* arg1; + spAtlas* arg1 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* ok = false; if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } cobj = new (std::nothrow) spine::SkeletonRenderer(arg0, arg1, arg2); @@ -810,7 +810,7 @@ bool js_cocos2dx_spine_SkeletonRenderer_constructor(JSContext *cx, uint32_t argc std::string arg1; ok &= jsval_to_std_string(cx, args.get(1), &arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } cobj = new (std::nothrow) spine::SkeletonRenderer(arg0, arg1, arg2); @@ -979,7 +979,7 @@ bool js_cocos2dx_spine_SkeletonAnimation_setTrackEventListener(JSContext *cx, ui spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonAnimation_setTrackEventListener : Invalid Native Object"); if (argc == 2) { - spTrackEntry* arg0; + spTrackEntry* arg0 = nullptr; std::function arg1; #pragma warning NO CONVERSION TO NATIVE FOR spTrackEntry* ok = false; @@ -1042,7 +1042,7 @@ bool js_cocos2dx_spine_SkeletonAnimation_setTrackCompleteListener(JSContext *cx, spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonAnimation_setTrackCompleteListener : Invalid Native Object"); if (argc == 2) { - spTrackEntry* arg0; + spTrackEntry* arg0 = nullptr; std::function arg1; #pragma warning NO CONVERSION TO NATIVE FOR spTrackEntry* ok = false; @@ -1087,10 +1087,10 @@ bool js_cocos2dx_spine_SkeletonAnimation_onTrackEntryEvent(JSContext *cx, uint32 spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonAnimation_onTrackEntryEvent : Invalid Native Object"); if (argc == 4) { - int arg0; + int arg0 = 0; spEventType arg1; - spEvent* arg2; - int arg3; + spEvent* arg2 = nullptr; + int arg3 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); #pragma warning NO CONVERSION TO NATIVE FOR spEvent* @@ -1114,7 +1114,7 @@ bool js_cocos2dx_spine_SkeletonAnimation_setTrackStartListener(JSContext *cx, ui spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonAnimation_setTrackStartListener : Invalid Native Object"); if (argc == 2) { - spTrackEntry* arg0; + spTrackEntry* arg0 = nullptr; std::function arg1; #pragma warning NO CONVERSION TO NATIVE FOR spTrackEntry* ok = false; @@ -1158,7 +1158,7 @@ bool js_cocos2dx_spine_SkeletonAnimation_update(JSContext *cx, uint32_t argc, js spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonAnimation_update : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_spine_SkeletonAnimation_update : Error processing arguments"); cobj->update(arg0); @@ -1220,7 +1220,7 @@ bool js_cocos2dx_spine_SkeletonAnimation_setTrackEndListener(JSContext *cx, uint spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonAnimation_setTrackEndListener : Invalid Native Object"); if (argc == 2) { - spTrackEntry* arg0; + spTrackEntry* arg0 = nullptr; std::function arg1; #pragma warning NO CONVERSION TO NATIVE FOR spTrackEntry* ok = false; @@ -1308,7 +1308,7 @@ bool js_cocos2dx_spine_SkeletonAnimation_setMix(JSContext *cx, uint32_t argc, js if (argc == 3) { std::string arg0; std::string arg1; - double arg2; + double arg2 = 0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); ok &= jsval_to_std_string(cx, args.get(1), &arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -1408,7 +1408,7 @@ bool js_cocos2dx_spine_SkeletonAnimation_clearTrack(JSContext *cx, uint32_t argc return true; } if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_spine_SkeletonAnimation_clearTrack : Error processing arguments"); cobj->clearTrack(arg0); @@ -1428,10 +1428,10 @@ bool js_cocos2dx_spine_SkeletonAnimation_onAnimationStateEvent(JSContext *cx, ui spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonAnimation_onAnimationStateEvent : Invalid Native Object"); if (argc == 4) { - int arg0; + int arg0 = 0; spEventType arg1; - spEvent* arg2; - int arg3; + spEvent* arg2 = nullptr; + int arg3 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); #pragma warning NO CONVERSION TO NATIVE FOR spEvent* @@ -1481,7 +1481,7 @@ bool js_cocos2dx_spine_SkeletonAnimation_createWithFile(JSContext *cx, uint32_t std::string arg1; ok &= jsval_to_std_string(cx, args.get(1), &arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } spine::SkeletonAnimation* ret = spine::SkeletonAnimation::createWithFile(arg0, arg1, arg2); @@ -1504,7 +1504,7 @@ bool js_cocos2dx_spine_SkeletonAnimation_createWithFile(JSContext *cx, uint32_t std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - spAtlas* arg1; + spAtlas* arg1 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* ok = false; if (!ok) { ok = true; break; } @@ -1527,11 +1527,11 @@ bool js_cocos2dx_spine_SkeletonAnimation_createWithFile(JSContext *cx, uint32_t std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - spAtlas* arg1; + spAtlas* arg1 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* ok = false; if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } spine::SkeletonAnimation* ret = spine::SkeletonAnimation::createWithFile(arg0, arg1, arg2); @@ -1560,7 +1560,7 @@ bool js_cocos2dx_spine_SkeletonAnimation_constructor(JSContext *cx, uint32_t arg spine::SkeletonAnimation* cobj = NULL; do { if (argc == 1) { - spSkeletonData* arg0; + spSkeletonData* arg0 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData* ok = false; if (!ok) { ok = true; break; } @@ -1588,7 +1588,7 @@ bool js_cocos2dx_spine_SkeletonAnimation_constructor(JSContext *cx, uint32_t arg do { if (argc == 2) { - spSkeletonData* arg0; + spSkeletonData* arg0 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData* ok = false; if (!ok) { ok = true; break; } @@ -1645,7 +1645,7 @@ bool js_cocos2dx_spine_SkeletonAnimation_constructor(JSContext *cx, uint32_t arg std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - spAtlas* arg1; + spAtlas* arg1 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* ok = false; if (!ok) { ok = true; break; } @@ -1676,11 +1676,11 @@ bool js_cocos2dx_spine_SkeletonAnimation_constructor(JSContext *cx, uint32_t arg std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - spAtlas* arg1; + spAtlas* arg1 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* ok = false; if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } cobj = new (std::nothrow) spine::SkeletonAnimation(arg0, arg1, arg2); @@ -1743,7 +1743,7 @@ bool js_cocos2dx_spine_SkeletonAnimation_constructor(JSContext *cx, uint32_t arg std::string arg1; ok &= jsval_to_std_string(cx, args.get(1), &arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } cobj = new (std::nothrow) spine::SkeletonAnimation(arg0, arg1, arg2); @@ -1787,7 +1787,7 @@ bool js_cocos2dx_spine_SkeletonAnimation_ctor(JSContext *cx, uint32_t argc, jsva spine::SkeletonAnimation* cobj = NULL; do { if (argc == 1) { - spSkeletonData* arg0; + spSkeletonData* arg0 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData* ok = false; if (!ok) { ok = true; break; } @@ -1815,7 +1815,7 @@ bool js_cocos2dx_spine_SkeletonAnimation_ctor(JSContext *cx, uint32_t argc, jsva do { if (argc == 2) { - spSkeletonData* arg0; + spSkeletonData* arg0 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData* ok = false; if (!ok) { ok = true; break; } @@ -1872,7 +1872,7 @@ bool js_cocos2dx_spine_SkeletonAnimation_ctor(JSContext *cx, uint32_t argc, jsva std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - spAtlas* arg1; + spAtlas* arg1 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* ok = false; if (!ok) { ok = true; break; } @@ -1903,11 +1903,11 @@ bool js_cocos2dx_spine_SkeletonAnimation_ctor(JSContext *cx, uint32_t argc, jsva std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - spAtlas* arg1; + spAtlas* arg1 = nullptr; #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* ok = false; if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } cobj = new (std::nothrow) spine::SkeletonAnimation(arg0, arg1, arg2); @@ -1970,7 +1970,7 @@ bool js_cocos2dx_spine_SkeletonAnimation_ctor(JSContext *cx, uint32_t argc, jsva std::string arg1; ok &= jsval_to_std_string(cx, args.get(1), &arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } cobj = new (std::nothrow) spine::SkeletonAnimation(arg0, arg1, arg2); diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_studio_auto.cpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_studio_auto.cpp index 0d03c24b6b..60f8c41dc8 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_studio_auto.cpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_studio_auto.cpp @@ -55,7 +55,7 @@ bool js_cocos2dx_studio_ActionObject_setCurrentTime(JSContext *cx, uint32_t argc cocostudio::ActionObject* cobj = (cocostudio::ActionObject *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ActionObject_setCurrentTime : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ActionObject_setCurrentTime : Error processing arguments"); cobj->setCurrentTime(arg0); @@ -91,7 +91,7 @@ bool js_cocos2dx_studio_ActionObject_setName(JSContext *cx, uint32_t argc, jsval cocostudio::ActionObject* cobj = (cocostudio::ActionObject *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ActionObject_setName : Invalid Native Object"); if (argc == 1) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ActionObject_setName : Error processing arguments"); cobj->setName(arg0); @@ -111,7 +111,7 @@ bool js_cocos2dx_studio_ActionObject_setUnitTime(JSContext *cx, uint32_t argc, j cocostudio::ActionObject* cobj = (cocostudio::ActionObject *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ActionObject_setUnitTime : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ActionObject_setUnitTime : Error processing arguments"); cobj->setUnitTime(arg0); @@ -187,7 +187,7 @@ bool js_cocos2dx_studio_ActionObject_play(JSContext *cx, uint32_t argc, jsval *v JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ActionObject_play : Invalid Native Object"); do { if (argc == 1) { - cocos2d::CallFunc* arg0; + cocos2d::CallFunc* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -242,7 +242,7 @@ bool js_cocos2dx_studio_ActionObject_removeActionNode(JSContext *cx, uint32_t ar cocostudio::ActionObject* cobj = (cocostudio::ActionObject *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ActionObject_removeActionNode : Invalid Native Object"); if (argc == 1) { - cocostudio::ActionNode* arg0; + cocostudio::ActionNode* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -288,9 +288,9 @@ bool js_cocos2dx_studio_ActionObject_initWithBinary(JSContext *cx, uint32_t argc cocostudio::ActionObject* cobj = (cocostudio::ActionObject *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ActionObject_initWithBinary : Invalid Native Object"); if (argc == 3) { - cocostudio::CocoLoader* arg0; - cocostudio::stExpCocoNode* arg1; - cocos2d::Ref* arg2; + cocostudio::CocoLoader* arg0 = nullptr; + cocostudio::stExpCocoNode* arg1 = nullptr; + cocos2d::Ref* arg2 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -329,7 +329,7 @@ bool js_cocos2dx_studio_ActionObject_addActionNode(JSContext *cx, uint32_t argc, cocostudio::ActionObject* cobj = (cocostudio::ActionObject *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ActionObject_addActionNode : Invalid Native Object"); if (argc == 1) { - cocostudio::ActionNode* arg0; + cocostudio::ActionNode* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -393,7 +393,7 @@ bool js_cocos2dx_studio_ActionObject_updateToFrameByTime(JSContext *cx, uint32_t cocostudio::ActionObject* cobj = (cocostudio::ActionObject *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ActionObject_updateToFrameByTime : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ActionObject_updateToFrameByTime : Error processing arguments"); cobj->updateToFrameByTime(arg0); @@ -433,7 +433,7 @@ bool js_cocos2dx_studio_ActionObject_simulationActionUpdate(JSContext *cx, uint3 cocostudio::ActionObject* cobj = (cocostudio::ActionObject *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ActionObject_simulationActionUpdate : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ActionObject_simulationActionUpdate : Error processing arguments"); cobj->simulationActionUpdate(arg0); @@ -558,8 +558,8 @@ bool js_cocos2dx_studio_ActionManagerEx_stopActionByName(JSContext *cx, uint32_t cocostudio::ActionManagerEx* cobj = (cocostudio::ActionManagerEx *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ActionManagerEx_stopActionByName : Invalid Native Object"); if (argc == 2) { - const char* arg0; - const char* arg1; + const char* arg0 = nullptr; + const char* arg1 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str(); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ActionManagerEx_stopActionByName : Error processing arguments"); @@ -589,8 +589,8 @@ bool js_cocos2dx_studio_ActionManagerEx_getActionByName(JSContext *cx, uint32_t cocostudio::ActionManagerEx* cobj = (cocostudio::ActionManagerEx *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ActionManagerEx_getActionByName : Invalid Native Object"); if (argc == 2) { - const char* arg0; - const char* arg1; + const char* arg0 = nullptr; + const char* arg1 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str(); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ActionManagerEx_getActionByName : Error processing arguments"); @@ -620,10 +620,10 @@ bool js_cocos2dx_studio_ActionManagerEx_initWithBinary(JSContext *cx, uint32_t a cocostudio::ActionManagerEx* cobj = (cocostudio::ActionManagerEx *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ActionManagerEx_initWithBinary : Invalid Native Object"); if (argc == 4) { - const char* arg0; - cocos2d::Ref* arg1; - cocostudio::CocoLoader* arg2; - cocostudio::stExpCocoNode* arg3; + const char* arg0 = nullptr; + cocos2d::Ref* arg1 = nullptr; + cocostudio::CocoLoader* arg2 = nullptr; + cocostudio::stExpCocoNode* arg3 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -667,13 +667,13 @@ bool js_cocos2dx_studio_ActionManagerEx_playActionByName(JSContext *cx, uint32_t JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ActionManagerEx_playActionByName : Invalid Native Object"); do { if (argc == 3) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); if (!ok) { ok = true; break; } - const char* arg1; + const char* arg1 = nullptr; std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str(); if (!ok) { ok = true; break; } - cocos2d::CallFunc* arg2; + cocos2d::CallFunc* arg2 = nullptr; do { if (args.get(2).isNull()) { arg2 = nullptr; break; } if (!args.get(2).isObject()) { ok = false; break; } @@ -701,10 +701,10 @@ bool js_cocos2dx_studio_ActionManagerEx_playActionByName(JSContext *cx, uint32_t do { if (argc == 2) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); if (!ok) { ok = true; break; } - const char* arg1; + const char* arg1 = nullptr; std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str(); if (!ok) { ok = true; break; } cocostudio::ActionObject* ret = cobj->playActionByName(arg0, arg1); @@ -1031,7 +1031,7 @@ bool js_cocos2dx_studio_MovementData_addMovementBoneData(JSContext *cx, uint32_t cocostudio::MovementData* cobj = (cocostudio::MovementData *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_MovementData_addMovementBoneData : Invalid Native Object"); if (argc == 1) { - cocostudio::MovementBoneData* arg0; + cocostudio::MovementBoneData* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1219,7 +1219,7 @@ bool js_cocos2dx_studio_AnimationData_addMovement(JSContext *cx, uint32_t argc, cocostudio::AnimationData* cobj = (cocostudio::AnimationData *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_AnimationData_addMovement : Invalid Native Object"); if (argc == 1) { - cocostudio::MovementData* arg0; + cocostudio::MovementData* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1512,7 +1512,7 @@ bool js_cocos2dx_studio_TextureData_getContourData(JSContext *cx, uint32_t argc, cocostudio::TextureData* cobj = (cocostudio::TextureData *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_TextureData_getContourData : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_TextureData_getContourData : Error processing arguments"); cocostudio::ContourData* ret = cobj->getContourData(arg0); @@ -1559,7 +1559,7 @@ bool js_cocos2dx_studio_TextureData_addContourData(JSContext *cx, uint32_t argc, cocostudio::TextureData* cobj = (cocostudio::TextureData *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_TextureData_addContourData : Invalid Native Object"); if (argc == 1) { - cocostudio::ContourData* arg0; + cocostudio::ContourData* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1701,10 +1701,10 @@ bool js_cocos2dx_studio_ProcessBase_play(JSContext *cx, uint32_t argc, jsval *vp cocostudio::ProcessBase* cobj = (cocostudio::ProcessBase *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ProcessBase_play : Invalid Native Object"); if (argc == 4) { - int arg0; - int arg1; - int arg2; - int arg3; + int arg0 = 0; + int arg1 = 0; + int arg2 = 0; + int arg3 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); @@ -1813,7 +1813,7 @@ bool js_cocos2dx_studio_ProcessBase_update(JSContext *cx, uint32_t argc, jsval * cocostudio::ProcessBase* cobj = (cocostudio::ProcessBase *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ProcessBase_update : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ProcessBase_update : Error processing arguments"); cobj->update(arg0); @@ -1961,7 +1961,7 @@ bool js_cocos2dx_studio_ProcessBase_setProcessScale(JSContext *cx, uint32_t argc cocostudio::ProcessBase* cobj = (cocostudio::ProcessBase *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ProcessBase_setProcessScale : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ProcessBase_setProcessScale : Error processing arguments"); cobj->setProcessScale(arg0); @@ -2129,7 +2129,7 @@ bool js_cocos2dx_studio_Tween_gotoAndPause(JSContext *cx, uint32_t argc, jsval * cocostudio::Tween* cobj = (cocostudio::Tween *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Tween_gotoAndPause : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_Tween_gotoAndPause : Error processing arguments"); cobj->gotoAndPause(arg0); @@ -2149,11 +2149,11 @@ bool js_cocos2dx_studio_Tween_play(JSContext *cx, uint32_t argc, jsval *vp) cocostudio::Tween* cobj = (cocostudio::Tween *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Tween_play : Invalid Native Object"); if (argc == 5) { - cocostudio::MovementBoneData* arg0; - int arg1; - int arg2; - int arg3; - int arg4; + cocostudio::MovementBoneData* arg0 = nullptr; + int arg1 = 0; + int arg2 = 0; + int arg3 = 0; + int arg4 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2185,7 +2185,7 @@ bool js_cocos2dx_studio_Tween_gotoAndPlay(JSContext *cx, uint32_t argc, jsval *v cocostudio::Tween* cobj = (cocostudio::Tween *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Tween_gotoAndPlay : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_Tween_gotoAndPlay : Error processing arguments"); cobj->gotoAndPlay(arg0); @@ -2205,7 +2205,7 @@ bool js_cocos2dx_studio_Tween_init(JSContext *cx, uint32_t argc, jsval *vp) cocostudio::Tween* cobj = (cocostudio::Tween *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Tween_init : Invalid Native Object"); if (argc == 1) { - cocostudio::Bone* arg0; + cocostudio::Bone* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2235,7 +2235,7 @@ bool js_cocos2dx_studio_Tween_setAnimation(JSContext *cx, uint32_t argc, jsval * cocostudio::Tween* cobj = (cocostudio::Tween *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Tween_setAnimation : Invalid Native Object"); if (argc == 1) { - cocostudio::ArmatureAnimation* arg0; + cocostudio::ArmatureAnimation* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2259,7 +2259,7 @@ bool js_cocos2dx_studio_Tween_create(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocostudio::Bone* arg0; + cocostudio::Bone* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2613,7 +2613,7 @@ bool js_cocos2dx_studio_ColliderDetector_init(JSContext *cx, uint32_t argc, jsva JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ColliderDetector_init : Invalid Native Object"); do { if (argc == 1) { - cocostudio::Bone* arg0; + cocostudio::Bone* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2674,7 +2674,7 @@ bool js_cocos2dx_studio_ColliderDetector_setBone(JSContext *cx, uint32_t argc, j cocostudio::ColliderDetector* cobj = (cocostudio::ColliderDetector *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ColliderDetector_setBone : Invalid Native Object"); if (argc == 1) { - cocostudio::Bone* arg0; + cocostudio::Bone* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2700,7 +2700,7 @@ bool js_cocos2dx_studio_ColliderDetector_create(JSContext *cx, uint32_t argc, js do { if (argc == 1) { - cocostudio::Bone* arg0; + cocostudio::Bone* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2874,7 +2874,7 @@ bool js_cocos2dx_studio_DecorativeDisplay_setDisplay(JSContext *cx, uint32_t arg cocostudio::DecorativeDisplay* cobj = (cocostudio::DecorativeDisplay *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_DecorativeDisplay_setDisplay : Invalid Native Object"); if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2920,7 +2920,7 @@ bool js_cocos2dx_studio_DecorativeDisplay_setDisplayData(JSContext *cx, uint32_t cocostudio::DecorativeDisplay* cobj = (cocostudio::DecorativeDisplay *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_DecorativeDisplay_setDisplayData : Invalid Native Object"); if (argc == 1) { - cocostudio::DisplayData* arg0; + cocostudio::DisplayData* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -2973,7 +2973,7 @@ bool js_cocos2dx_studio_DecorativeDisplay_setColliderDetector(JSContext *cx, uin cocostudio::DecorativeDisplay* cobj = (cocostudio::DecorativeDisplay *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_DecorativeDisplay_setColliderDetector : Invalid Native Object"); if (argc == 1) { - cocostudio::ColliderDetector* arg0; + cocostudio::ColliderDetector* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -3159,7 +3159,7 @@ bool js_cocos2dx_studio_DisplayManager_setCurrentDecorativeDisplay(JSContext *cx cocostudio::DisplayManager* cobj = (cocostudio::DisplayManager *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_DisplayManager_setCurrentDecorativeDisplay : Invalid Native Object"); if (argc == 1) { - cocostudio::DecorativeDisplay* arg0; + cocostudio::DecorativeDisplay* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -3205,7 +3205,7 @@ bool js_cocos2dx_studio_DisplayManager_removeDisplay(JSContext *cx, uint32_t arg cocostudio::DisplayManager* cobj = (cocostudio::DisplayManager *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_DisplayManager_removeDisplay : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_DisplayManager_removeDisplay : Error processing arguments"); cobj->removeDisplay(arg0); @@ -3245,7 +3245,7 @@ bool js_cocos2dx_studio_DisplayManager_init(JSContext *cx, uint32_t argc, jsval cocostudio::DisplayManager* cobj = (cocostudio::DisplayManager *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_DisplayManager_init : Invalid Native Object"); if (argc == 1) { - cocostudio::Bone* arg0; + cocostudio::Bone* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -3315,7 +3315,7 @@ bool js_cocos2dx_studio_DisplayManager_addDisplay(JSContext *cx, uint32_t argc, JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_DisplayManager_addDisplay : Invalid Native Object"); do { if (argc == 2) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -3326,7 +3326,7 @@ bool js_cocos2dx_studio_DisplayManager_addDisplay(JSContext *cx, uint32_t argc, JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - int arg1; + int arg1 = 0; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); if (!ok) { ok = true; break; } cobj->addDisplay(arg0, arg1); @@ -3337,7 +3337,7 @@ bool js_cocos2dx_studio_DisplayManager_addDisplay(JSContext *cx, uint32_t argc, do { if (argc == 2) { - cocostudio::DisplayData* arg0; + cocostudio::DisplayData* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -3348,7 +3348,7 @@ bool js_cocos2dx_studio_DisplayManager_addDisplay(JSContext *cx, uint32_t argc, JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - int arg1; + int arg1 = 0; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); if (!ok) { ok = true; break; } cobj->addDisplay(arg0, arg1); @@ -3373,10 +3373,10 @@ bool js_cocos2dx_studio_DisplayManager_containPoint(JSContext *cx, uint32_t argc JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_DisplayManager_containPoint : Invalid Native Object"); do { if (argc == 2) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } bool ret = cobj->containPoint(arg0, arg1); @@ -3412,7 +3412,7 @@ bool js_cocos2dx_studio_DisplayManager_initDisplayList(JSContext *cx, uint32_t a cocostudio::DisplayManager* cobj = (cocostudio::DisplayManager *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_DisplayManager_initDisplayList : Invalid Native Object"); if (argc == 1) { - cocostudio::BoneData* arg0; + cocostudio::BoneData* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -3440,7 +3440,7 @@ bool js_cocos2dx_studio_DisplayManager_changeDisplayWithIndex(JSContext *cx, uin cocostudio::DisplayManager* cobj = (cocostudio::DisplayManager *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_DisplayManager_changeDisplayWithIndex : Invalid Native Object"); if (argc == 2) { - int arg0; + int arg0 = 0; bool arg1; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); arg1 = JS::ToBoolean(args.get(1)); @@ -3502,7 +3502,7 @@ bool js_cocos2dx_studio_DisplayManager_getDecorativeDisplayByIndex(JSContext *cx cocostudio::DisplayManager* cobj = (cocostudio::DisplayManager *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_DisplayManager_getDecorativeDisplayByIndex : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_DisplayManager_getDecorativeDisplayByIndex : Error processing arguments"); cocostudio::DecorativeDisplay* ret = cobj->getDecorativeDisplayByIndex(arg0); @@ -3619,7 +3619,7 @@ bool js_cocos2dx_studio_DisplayManager_create(JSContext *cx, uint32_t argc, jsva JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocostudio::Bone* arg0; + cocostudio::Bone* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -3883,7 +3883,7 @@ bool js_cocos2dx_studio_Bone_addChildBone(JSContext *cx, uint32_t argc, jsval *v cocostudio::Bone* cobj = (cocostudio::Bone *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Bone_addChildBone : Invalid Native Object"); if (argc == 1) { - cocostudio::Bone* arg0; + cocostudio::Bone* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -4040,7 +4040,7 @@ bool js_cocos2dx_studio_Bone_removeDisplay(JSContext *cx, uint32_t argc, jsval * cocostudio::Bone* cobj = (cocostudio::Bone *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Bone_removeDisplay : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_Bone_removeDisplay : Error processing arguments"); cobj->removeDisplay(arg0); @@ -4060,7 +4060,7 @@ bool js_cocos2dx_studio_Bone_setBoneData(JSContext *cx, uint32_t argc, jsval *vp cocostudio::Bone* cobj = (cocostudio::Bone *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Bone_setBoneData : Invalid Native Object"); if (argc == 1) { - cocostudio::BoneData* arg0; + cocostudio::BoneData* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -4110,7 +4110,7 @@ bool js_cocos2dx_studio_Bone_setParentBone(JSContext *cx, uint32_t argc, jsval * cocostudio::Bone* cobj = (cocostudio::Bone *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Bone_setParentBone : Invalid Native Object"); if (argc == 1) { - cocostudio::Bone* arg0; + cocostudio::Bone* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -4142,7 +4142,7 @@ bool js_cocos2dx_studio_Bone_addDisplay(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Bone_addDisplay : Invalid Native Object"); do { if (argc == 2) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -4153,7 +4153,7 @@ bool js_cocos2dx_studio_Bone_addDisplay(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - int arg1; + int arg1 = 0; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); if (!ok) { ok = true; break; } cobj->addDisplay(arg0, arg1); @@ -4164,7 +4164,7 @@ bool js_cocos2dx_studio_Bone_addDisplay(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 2) { - cocostudio::DisplayData* arg0; + cocostudio::DisplayData* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -4175,7 +4175,7 @@ bool js_cocos2dx_studio_Bone_addDisplay(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - int arg1; + int arg1 = 0; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); if (!ok) { ok = true; break; } cobj->addDisplay(arg0, arg1); @@ -4304,7 +4304,7 @@ bool js_cocos2dx_studio_Bone_changeDisplayWithIndex(JSContext *cx, uint32_t argc cocostudio::Bone* cobj = (cocostudio::Bone *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Bone_changeDisplayWithIndex : Invalid Native Object"); if (argc == 2) { - int arg0; + int arg0 = 0; bool arg1; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); arg1 = JS::ToBoolean(args.get(1)); @@ -4348,7 +4348,7 @@ bool js_cocos2dx_studio_Bone_setArmature(JSContext *cx, uint32_t argc, jsval *vp cocostudio::Bone* cobj = (cocostudio::Bone *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Bone_setArmature : Invalid Native Object"); if (argc == 1) { - cocostudio::Armature* arg0; + cocostudio::Armature* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -4396,7 +4396,7 @@ bool js_cocos2dx_studio_Bone_removeChildBone(JSContext *cx, uint32_t argc, jsval cocostudio::Bone* cobj = (cocostudio::Bone *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Bone_removeChildBone : Invalid Native Object"); if (argc == 2) { - cocostudio::Bone* arg0; + cocostudio::Bone* arg0 = nullptr; bool arg1; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -4426,7 +4426,7 @@ bool js_cocos2dx_studio_Bone_setChildArmature(JSContext *cx, uint32_t argc, jsva cocostudio::Bone* cobj = (cocostudio::Bone *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Bone_setChildArmature : Invalid Native Object"); if (argc == 1) { - cocostudio::Armature* arg0; + cocostudio::Armature* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -4802,7 +4802,7 @@ bool js_cocos2dx_studio_ArmatureAnimation_play(JSContext *cx, uint32_t argc, jsv } if (argc == 2) { std::string arg0; - int arg1; + int arg1 = 0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ArmatureAnimation_play : Error processing arguments"); @@ -4812,8 +4812,8 @@ bool js_cocos2dx_studio_ArmatureAnimation_play(JSContext *cx, uint32_t argc, jsv } if (argc == 3) { std::string arg0; - int arg1; - int arg2; + int arg1 = 0; + int arg2 = 0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); @@ -4835,7 +4835,7 @@ bool js_cocos2dx_studio_ArmatureAnimation_gotoAndPause(JSContext *cx, uint32_t a cocostudio::ArmatureAnimation* cobj = (cocostudio::ArmatureAnimation *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ArmatureAnimation_gotoAndPause : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ArmatureAnimation_gotoAndPause : Error processing arguments"); cobj->gotoAndPause(arg0); @@ -4864,7 +4864,7 @@ bool js_cocos2dx_studio_ArmatureAnimation_playWithIndexes(JSContext *cx, uint32_ } if (argc == 2) { std::vector arg0; - int arg1; + int arg1 = 0; ok &= jsval_to_std_vector_int(cx, args.get(0), &arg0); ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ArmatureAnimation_playWithIndexes : Error processing arguments"); @@ -4874,7 +4874,7 @@ bool js_cocos2dx_studio_ArmatureAnimation_playWithIndexes(JSContext *cx, uint32_ } if (argc == 3) { std::vector arg0; - int arg1; + int arg1 = 0; bool arg2; ok &= jsval_to_std_vector_int(cx, args.get(0), &arg0); ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); @@ -4897,7 +4897,7 @@ bool js_cocos2dx_studio_ArmatureAnimation_setAnimationData(JSContext *cx, uint32 cocostudio::ArmatureAnimation* cobj = (cocostudio::ArmatureAnimation *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ArmatureAnimation_setAnimationData : Invalid Native Object"); if (argc == 1) { - cocostudio::AnimationData* arg0; + cocostudio::AnimationData* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -4925,7 +4925,7 @@ bool js_cocos2dx_studio_ArmatureAnimation_setSpeedScale(JSContext *cx, uint32_t cocostudio::ArmatureAnimation* cobj = (cocostudio::ArmatureAnimation *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ArmatureAnimation_setSpeedScale : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ArmatureAnimation_setSpeedScale : Error processing arguments"); cobj->setSpeedScale(arg0); @@ -4970,7 +4970,7 @@ bool js_cocos2dx_studio_ArmatureAnimation_gotoAndPlay(JSContext *cx, uint32_t ar cocostudio::ArmatureAnimation* cobj = (cocostudio::ArmatureAnimation *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ArmatureAnimation_gotoAndPlay : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ArmatureAnimation_gotoAndPlay : Error processing arguments"); cobj->gotoAndPlay(arg0); @@ -4990,7 +4990,7 @@ bool js_cocos2dx_studio_ArmatureAnimation_init(JSContext *cx, uint32_t argc, jsv cocostudio::ArmatureAnimation* cobj = (cocostudio::ArmatureAnimation *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ArmatureAnimation_init : Invalid Native Object"); if (argc == 1) { - cocostudio::Armature* arg0; + cocostudio::Armature* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -5029,7 +5029,7 @@ bool js_cocos2dx_studio_ArmatureAnimation_playWithNames(JSContext *cx, uint32_t } if (argc == 2) { std::vector arg0; - int arg1; + int arg1 = 0; ok &= jsval_to_std_vector_string(cx, args.get(0), &arg0); ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ArmatureAnimation_playWithNames : Error processing arguments"); @@ -5039,7 +5039,7 @@ bool js_cocos2dx_studio_ArmatureAnimation_playWithNames(JSContext *cx, uint32_t } if (argc == 3) { std::vector arg0; - int arg1; + int arg1 = 0; bool arg2; ok &= jsval_to_std_vector_string(cx, args.get(0), &arg0); ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); @@ -5080,7 +5080,7 @@ bool js_cocos2dx_studio_ArmatureAnimation_playWithIndex(JSContext *cx, uint32_t cocostudio::ArmatureAnimation* cobj = (cocostudio::ArmatureAnimation *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ArmatureAnimation_playWithIndex : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ArmatureAnimation_playWithIndex : Error processing arguments"); cobj->playWithIndex(arg0); @@ -5088,8 +5088,8 @@ bool js_cocos2dx_studio_ArmatureAnimation_playWithIndex(JSContext *cx, uint32_t return true; } if (argc == 2) { - int arg0; - int arg1; + int arg0 = 0; + int arg1 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ArmatureAnimation_playWithIndex : Error processing arguments"); @@ -5098,9 +5098,9 @@ bool js_cocos2dx_studio_ArmatureAnimation_playWithIndex(JSContext *cx, uint32_t return true; } if (argc == 3) { - int arg0; - int arg1; - int arg2; + int arg0 = 0; + int arg1 = 0; + int arg2 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); @@ -5136,7 +5136,7 @@ bool js_cocos2dx_studio_ArmatureAnimation_create(JSContext *cx, uint32_t argc, j JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocostudio::Armature* arg0; + cocostudio::Armature* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -5317,7 +5317,7 @@ bool js_cocos2dx_studio_ArmatureDataManager_addArmatureData(JSContext *cx, uint3 JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ArmatureDataManager_addArmatureData : Invalid Native Object"); if (argc == 2) { std::string arg0; - cocostudio::ArmatureData* arg1; + cocostudio::ArmatureData* arg1 = nullptr; ok &= jsval_to_std_string(cx, args.get(0), &arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -5335,7 +5335,7 @@ bool js_cocos2dx_studio_ArmatureDataManager_addArmatureData(JSContext *cx, uint3 } if (argc == 3) { std::string arg0; - cocostudio::ArmatureData* arg1; + cocostudio::ArmatureData* arg1 = nullptr; std::string arg2; ok &= jsval_to_std_string(cx, args.get(0), &arg0); do { @@ -5516,7 +5516,7 @@ bool js_cocos2dx_studio_ArmatureDataManager_addAnimationData(JSContext *cx, uint JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ArmatureDataManager_addAnimationData : Invalid Native Object"); if (argc == 2) { std::string arg0; - cocostudio::AnimationData* arg1; + cocostudio::AnimationData* arg1 = nullptr; ok &= jsval_to_std_string(cx, args.get(0), &arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -5534,7 +5534,7 @@ bool js_cocos2dx_studio_ArmatureDataManager_addAnimationData(JSContext *cx, uint } if (argc == 3) { std::string arg0; - cocostudio::AnimationData* arg1; + cocostudio::AnimationData* arg1 = nullptr; std::string arg2; ok &= jsval_to_std_string(cx, args.get(0), &arg0); do { @@ -5642,7 +5642,7 @@ bool js_cocos2dx_studio_ArmatureDataManager_addTextureData(JSContext *cx, uint32 JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ArmatureDataManager_addTextureData : Invalid Native Object"); if (argc == 2) { std::string arg0; - cocostudio::TextureData* arg1; + cocostudio::TextureData* arg1 = nullptr; ok &= jsval_to_std_string(cx, args.get(0), &arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -5660,7 +5660,7 @@ bool js_cocos2dx_studio_ArmatureDataManager_addTextureData(JSContext *cx, uint32 } if (argc == 3) { std::string arg0; - cocostudio::TextureData* arg1; + cocostudio::TextureData* arg1 = nullptr; std::string arg2; ok &= jsval_to_std_string(cx, args.get(0), &arg0); do { @@ -5884,7 +5884,7 @@ bool js_cocos2dx_studio_Armature_changeBoneParent(JSContext *cx, uint32_t argc, cocostudio::Armature* cobj = (cocostudio::Armature *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Armature_changeBoneParent : Invalid Native Object"); if (argc == 2) { - cocostudio::Bone* arg0; + cocostudio::Bone* arg0 = nullptr; std::string arg1; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -5914,7 +5914,7 @@ bool js_cocos2dx_studio_Armature_setAnimation(JSContext *cx, uint32_t argc, jsva cocostudio::Armature* cobj = (cocostudio::Armature *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Armature_setAnimation : Invalid Native Object"); if (argc == 1) { - cocostudio::ArmatureAnimation* arg0; + cocostudio::ArmatureAnimation* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -5942,8 +5942,8 @@ bool js_cocos2dx_studio_Armature_getBoneAtPoint(JSContext *cx, uint32_t argc, js cocostudio::Armature* cobj = (cocostudio::Armature *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Armature_getBoneAtPoint : Invalid Native Object"); if (argc == 2) { - double arg0; - double arg1; + double arg0 = 0; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_Armature_getBoneAtPoint : Error processing arguments"); @@ -5991,7 +5991,7 @@ bool js_cocos2dx_studio_Armature_setVersion(JSContext *cx, uint32_t argc, jsval cocostudio::Armature* cobj = (cocostudio::Armature *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Armature_setVersion : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_Armature_setVersion : Error processing arguments"); cobj->setVersion(arg0); @@ -6052,7 +6052,7 @@ bool js_cocos2dx_studio_Armature_removeBone(JSContext *cx, uint32_t argc, jsval cocostudio::Armature* cobj = (cocostudio::Armature *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Armature_removeBone : Invalid Native Object"); if (argc == 2) { - cocostudio::Bone* arg0; + cocostudio::Bone* arg0 = nullptr; bool arg1; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -6114,7 +6114,7 @@ bool js_cocos2dx_studio_Armature_init(JSContext *cx, uint32_t argc, jsval *vp) std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - cocostudio::Bone* arg1; + cocostudio::Bone* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -6158,7 +6158,7 @@ bool js_cocos2dx_studio_Armature_setParentBone(JSContext *cx, uint32_t argc, jsv cocostudio::Armature* cobj = (cocostudio::Armature *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Armature_setParentBone : Invalid Native Object"); if (argc == 1) { - cocostudio::Bone* arg0; + cocostudio::Bone* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -6186,7 +6186,7 @@ bool js_cocos2dx_studio_Armature_setBatchNode(JSContext *cx, uint32_t argc, jsva cocostudio::Armature* cobj = (cocostudio::Armature *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Armature_setBatchNode : Invalid Native Object"); if (argc == 1) { - cocostudio::BatchNode* arg0; + cocostudio::BatchNode* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -6232,7 +6232,7 @@ bool js_cocos2dx_studio_Armature_setArmatureData(JSContext *cx, uint32_t argc, j cocostudio::Armature* cobj = (cocostudio::Armature *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Armature_setArmatureData : Invalid Native Object"); if (argc == 1) { - cocostudio::ArmatureData* arg0; + cocostudio::ArmatureData* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -6260,7 +6260,7 @@ bool js_cocos2dx_studio_Armature_addBone(JSContext *cx, uint32_t argc, jsval *vp cocostudio::Armature* cobj = (cocostudio::Armature *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Armature_addBone : Invalid Native Object"); if (argc == 2) { - cocostudio::Bone* arg0; + cocostudio::Bone* arg0 = nullptr; std::string arg1; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -6470,7 +6470,7 @@ bool js_cocos2dx_studio_Armature_create(JSContext *cx, uint32_t argc, jsval *vp) std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - cocostudio::Bone* arg1; + cocostudio::Bone* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -6717,7 +6717,7 @@ bool js_cocos2dx_studio_Skin_setBone(JSContext *cx, uint32_t argc, jsval *vp) cocostudio::Skin* cobj = (cocostudio::Skin *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Skin_setBone : Invalid Native Object"); if (argc == 1) { - cocostudio::Bone* arg0; + cocostudio::Bone* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -6923,7 +6923,7 @@ bool js_cocos2dx_studio_ComAttribute_getFloat(JSContext *cx, uint32_t argc, jsva } if (argc == 2) { std::string arg0; - double arg1; + double arg1 = 0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ComAttribute_getFloat : Error processing arguments"); @@ -7015,7 +7015,7 @@ bool js_cocos2dx_studio_ComAttribute_setFloat(JSContext *cx, uint32_t argc, jsva JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ComAttribute_setFloat : Invalid Native Object"); if (argc == 2) { std::string arg0; - double arg1; + double arg1 = 0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ComAttribute_setFloat : Error processing arguments"); @@ -7059,7 +7059,7 @@ bool js_cocos2dx_studio_ComAttribute_setInt(JSContext *cx, uint32_t argc, jsval JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ComAttribute_setInt : Invalid Native Object"); if (argc == 2) { std::string arg0; - int arg1; + int arg1 = 0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ComAttribute_setInt : Error processing arguments"); @@ -7113,7 +7113,7 @@ bool js_cocos2dx_studio_ComAttribute_getInt(JSContext *cx, uint32_t argc, jsval } if (argc == 2) { std::string arg0; - int arg1; + int arg1 = 0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ComAttribute_getInt : Error processing arguments"); @@ -7314,7 +7314,7 @@ bool js_cocos2dx_studio_ComAudio_stopEffect(JSContext *cx, uint32_t argc, jsval cocostudio::ComAudio* cobj = (cocostudio::ComAudio *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ComAudio_stopEffect : Invalid Native Object"); if (argc == 1) { - unsigned int arg0; + unsigned int arg0 = 0; ok &= jsval_to_uint32(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ComAudio_stopEffect : Error processing arguments"); cobj->stopEffect(arg0); @@ -7370,7 +7370,7 @@ bool js_cocos2dx_studio_ComAudio_setBackgroundMusicVolume(JSContext *cx, uint32_ cocostudio::ComAudio* cobj = (cocostudio::ComAudio *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ComAudio_setBackgroundMusicVolume : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ComAudio_setBackgroundMusicVolume : Error processing arguments"); cobj->setBackgroundMusicVolume(arg0); @@ -7522,7 +7522,7 @@ bool js_cocos2dx_studio_ComAudio_preloadBackgroundMusic(JSContext *cx, uint32_t cocostudio::ComAudio* cobj = (cocostudio::ComAudio *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ComAudio_preloadBackgroundMusic : Invalid Native Object"); if (argc == 1) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ComAudio_preloadBackgroundMusic : Error processing arguments"); cobj->preloadBackgroundMusic(arg0); @@ -7546,7 +7546,7 @@ bool js_cocos2dx_studio_ComAudio_playBackgroundMusic(JSContext *cx, uint32_t arg JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ComAudio_playBackgroundMusic : Invalid Native Object"); do { if (argc == 1) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); if (!ok) { ok = true; break; } cobj->playBackgroundMusic(arg0); @@ -7557,7 +7557,7 @@ bool js_cocos2dx_studio_ComAudio_playBackgroundMusic(JSContext *cx, uint32_t arg do { if (argc == 2) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); if (!ok) { ok = true; break; } bool arg1; @@ -7592,7 +7592,7 @@ bool js_cocos2dx_studio_ComAudio_playEffect(JSContext *cx, uint32_t argc, jsval JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ComAudio_playEffect : Invalid Native Object"); do { if (argc == 1) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); if (!ok) { ok = true; break; } unsigned int ret = cobj->playEffect(arg0); @@ -7605,7 +7605,7 @@ bool js_cocos2dx_studio_ComAudio_playEffect(JSContext *cx, uint32_t argc, jsval do { if (argc == 2) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); if (!ok) { ok = true; break; } bool arg1; @@ -7640,7 +7640,7 @@ bool js_cocos2dx_studio_ComAudio_preloadEffect(JSContext *cx, uint32_t argc, jsv cocostudio::ComAudio* cobj = (cocostudio::ComAudio *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ComAudio_preloadEffect : Invalid Native Object"); if (argc == 1) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ComAudio_preloadEffect : Error processing arguments"); cobj->preloadEffect(arg0); @@ -7680,7 +7680,7 @@ bool js_cocos2dx_studio_ComAudio_unloadEffect(JSContext *cx, uint32_t argc, jsva cocostudio::ComAudio* cobj = (cocostudio::ComAudio *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ComAudio_unloadEffect : Invalid Native Object"); if (argc == 1) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ComAudio_unloadEffect : Error processing arguments"); cobj->unloadEffect(arg0); @@ -7716,7 +7716,7 @@ bool js_cocos2dx_studio_ComAudio_pauseEffect(JSContext *cx, uint32_t argc, jsval cocostudio::ComAudio* cobj = (cocostudio::ComAudio *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ComAudio_pauseEffect : Invalid Native Object"); if (argc == 1) { - unsigned int arg0; + unsigned int arg0 = 0; ok &= jsval_to_uint32(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ComAudio_pauseEffect : Error processing arguments"); cobj->pauseEffect(arg0); @@ -7752,7 +7752,7 @@ bool js_cocos2dx_studio_ComAudio_setFile(JSContext *cx, uint32_t argc, jsval *vp cocostudio::ComAudio* cobj = (cocostudio::ComAudio *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ComAudio_setFile : Invalid Native Object"); if (argc == 1) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ComAudio_setFile : Error processing arguments"); cobj->setFile(arg0); @@ -7772,7 +7772,7 @@ bool js_cocos2dx_studio_ComAudio_setEffectsVolume(JSContext *cx, uint32_t argc, cocostudio::ComAudio* cobj = (cocostudio::ComAudio *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ComAudio_setEffectsVolume : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ComAudio_setEffectsVolume : Error processing arguments"); cobj->setEffectsVolume(arg0); @@ -7810,7 +7810,7 @@ bool js_cocos2dx_studio_ComAudio_resumeEffect(JSContext *cx, uint32_t argc, jsva cocostudio::ComAudio* cobj = (cocostudio::ComAudio *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ComAudio_resumeEffect : Invalid Native Object"); if (argc == 1) { - unsigned int arg0; + unsigned int arg0 = 0; ok &= jsval_to_uint32(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ComAudio_resumeEffect : Error processing arguments"); cobj->resumeEffect(arg0); @@ -8081,7 +8081,7 @@ bool js_cocos2dx_studio_InputDelegate_setTouchPriority(JSContext *cx, uint32_t a cocostudio::InputDelegate* cobj = (cocostudio::InputDelegate *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_InputDelegate_setTouchPriority : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_InputDelegate_setTouchPriority : Error processing arguments"); cobj->setTouchPriority(arg0); @@ -8384,7 +8384,7 @@ bool js_cocos2dx_studio_ComRender_setNode(JSContext *cx, uint32_t argc, jsval *v cocostudio::ComRender* cobj = (cocostudio::ComRender *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ComRender_setNode : Invalid Native Object"); if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -8410,7 +8410,7 @@ bool js_cocos2dx_studio_ComRender_create(JSContext *cx, uint32_t argc, jsval *vp do { if (argc == 2) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -8421,7 +8421,7 @@ bool js_cocos2dx_studio_ComRender_create(JSContext *cx, uint32_t argc, jsval *vp JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - const char* arg1; + const char* arg1 = nullptr; std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str(); if (!ok) { ok = true; break; } cocostudio::ComRender* ret = cocostudio::ComRender::create(arg0, arg1); @@ -8467,7 +8467,7 @@ bool js_cocos2dx_studio_ComRender_constructor(JSContext *cx, uint32_t argc, jsva cocostudio::ComRender* cobj = NULL; do { if (argc == 2) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -8478,7 +8478,7 @@ bool js_cocos2dx_studio_ComRender_constructor(JSContext *cx, uint32_t argc, jsva JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - const char* arg1; + const char* arg1 = nullptr; std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str(); if (!ok) { ok = true; break; } cobj = new (std::nothrow) cocostudio::ComRender(arg0, arg1); @@ -8658,7 +8658,7 @@ bool js_cocos2dx_studio_Frame_setNode(JSContext *cx, uint32_t argc, jsval *vp) cocostudio::timeline::Frame* cobj = (cocostudio::timeline::Frame *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Frame_setNode : Invalid Native Object"); if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -8686,7 +8686,7 @@ bool js_cocos2dx_studio_Frame_setTimeline(JSContext *cx, uint32_t argc, jsval *v cocostudio::timeline::Frame* cobj = (cocostudio::timeline::Frame *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Frame_setTimeline : Invalid Native Object"); if (argc == 1) { - cocostudio::timeline::Timeline* arg0; + cocostudio::timeline::Timeline* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -8768,7 +8768,7 @@ bool js_cocos2dx_studio_Frame_apply(JSContext *cx, uint32_t argc, jsval *vp) cocostudio::timeline::Frame* cobj = (cocostudio::timeline::Frame *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Frame_apply : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_Frame_apply : Error processing arguments"); cobj->apply(arg0); @@ -8806,7 +8806,7 @@ bool js_cocos2dx_studio_Frame_setFrameIndex(JSContext *cx, uint32_t argc, jsval cocostudio::timeline::Frame* cobj = (cocostudio::timeline::Frame *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Frame_setFrameIndex : Invalid Native Object"); if (argc == 1) { - unsigned int arg0; + unsigned int arg0 = 0; ok &= jsval_to_uint32(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_Frame_setFrameIndex : Error processing arguments"); cobj->setFrameIndex(arg0); @@ -9274,7 +9274,7 @@ bool js_cocos2dx_studio_RotationFrame_setRotation(JSContext *cx, uint32_t argc, cocostudio::timeline::RotationFrame* cobj = (cocostudio::timeline::RotationFrame *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_RotationFrame_setRotation : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_RotationFrame_setRotation : Error processing arguments"); cobj->setRotation(arg0); @@ -9445,7 +9445,7 @@ bool js_cocos2dx_studio_SkewFrame_setSkewX(JSContext *cx, uint32_t argc, jsval * cocostudio::timeline::SkewFrame* cobj = (cocostudio::timeline::SkewFrame *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_SkewFrame_setSkewX : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_SkewFrame_setSkewX : Error processing arguments"); cobj->setSkewX(arg0); @@ -9465,7 +9465,7 @@ bool js_cocos2dx_studio_SkewFrame_setSkewY(JSContext *cx, uint32_t argc, jsval * cocostudio::timeline::SkewFrame* cobj = (cocostudio::timeline::SkewFrame *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_SkewFrame_setSkewY : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_SkewFrame_setSkewY : Error processing arguments"); cobj->setSkewY(arg0); @@ -9789,7 +9789,7 @@ bool js_cocos2dx_studio_PositionFrame_setX(JSContext *cx, uint32_t argc, jsval * cocostudio::timeline::PositionFrame* cobj = (cocostudio::timeline::PositionFrame *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_PositionFrame_setX : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_PositionFrame_setX : Error processing arguments"); cobj->setX(arg0); @@ -9809,7 +9809,7 @@ bool js_cocos2dx_studio_PositionFrame_setY(JSContext *cx, uint32_t argc, jsval * cocostudio::timeline::PositionFrame* cobj = (cocostudio::timeline::PositionFrame *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_PositionFrame_setY : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_PositionFrame_setY : Error processing arguments"); cobj->setY(arg0); @@ -9966,7 +9966,7 @@ bool js_cocos2dx_studio_ScaleFrame_setScaleY(JSContext *cx, uint32_t argc, jsval cocostudio::timeline::ScaleFrame* cobj = (cocostudio::timeline::ScaleFrame *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ScaleFrame_setScaleY : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ScaleFrame_setScaleY : Error processing arguments"); cobj->setScaleY(arg0); @@ -9986,7 +9986,7 @@ bool js_cocos2dx_studio_ScaleFrame_setScaleX(JSContext *cx, uint32_t argc, jsval cocostudio::timeline::ScaleFrame* cobj = (cocostudio::timeline::ScaleFrame *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ScaleFrame_setScaleX : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ScaleFrame_setScaleX : Error processing arguments"); cobj->setScaleX(arg0); @@ -10042,7 +10042,7 @@ bool js_cocos2dx_studio_ScaleFrame_setScale(JSContext *cx, uint32_t argc, jsval cocostudio::timeline::ScaleFrame* cobj = (cocostudio::timeline::ScaleFrame *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ScaleFrame_setScale : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ScaleFrame_setScale : Error processing arguments"); cobj->setScale(arg0); @@ -10387,7 +10387,7 @@ bool js_cocos2dx_studio_InnerActionFrame_setEndFrameIndex(JSContext *cx, uint32_ cocostudio::timeline::InnerActionFrame* cobj = (cocostudio::timeline::InnerActionFrame *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_InnerActionFrame_setEndFrameIndex : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_InnerActionFrame_setEndFrameIndex : Error processing arguments"); cobj->setEndFrameIndex(arg0); @@ -10427,7 +10427,7 @@ bool js_cocos2dx_studio_InnerActionFrame_setSingleFrameIndex(JSContext *cx, uint cocostudio::timeline::InnerActionFrame* cobj = (cocostudio::timeline::InnerActionFrame *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_InnerActionFrame_setSingleFrameIndex : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_InnerActionFrame_setSingleFrameIndex : Error processing arguments"); cobj->setSingleFrameIndex(arg0); @@ -10447,7 +10447,7 @@ bool js_cocos2dx_studio_InnerActionFrame_setStartFrameIndex(JSContext *cx, uint3 cocostudio::timeline::InnerActionFrame* cobj = (cocostudio::timeline::InnerActionFrame *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_InnerActionFrame_setStartFrameIndex : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_InnerActionFrame_setStartFrameIndex : Error processing arguments"); cobj->setStartFrameIndex(arg0); @@ -11142,7 +11142,7 @@ bool js_cocos2dx_studio_ZOrderFrame_setZOrder(JSContext *cx, uint32_t argc, jsva cocostudio::timeline::ZOrderFrame* cobj = (cocostudio::timeline::ZOrderFrame *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ZOrderFrame_setZOrder : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ZOrderFrame_setZOrder : Error processing arguments"); cobj->setZOrder(arg0); @@ -11455,7 +11455,7 @@ bool js_cocos2dx_studio_Timeline_gotoFrame(JSContext *cx, uint32_t argc, jsval * cocostudio::timeline::Timeline* cobj = (cocostudio::timeline::Timeline *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Timeline_gotoFrame : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_Timeline_gotoFrame : Error processing arguments"); cobj->gotoFrame(arg0); @@ -11475,7 +11475,7 @@ bool js_cocos2dx_studio_Timeline_setNode(JSContext *cx, uint32_t argc, jsval *vp cocostudio::timeline::Timeline* cobj = (cocostudio::timeline::Timeline *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Timeline_setNode : Invalid Native Object"); if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -11528,8 +11528,8 @@ bool js_cocos2dx_studio_Timeline_insertFrame(JSContext *cx, uint32_t argc, jsval cocostudio::timeline::Timeline* cobj = (cocostudio::timeline::Timeline *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Timeline_insertFrame : Invalid Native Object"); if (argc == 2) { - cocostudio::timeline::Frame* arg0; - int arg1; + cocostudio::timeline::Frame* arg0 = nullptr; + int arg1 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -11558,7 +11558,7 @@ bool js_cocos2dx_studio_Timeline_setActionTag(JSContext *cx, uint32_t argc, jsva cocostudio::timeline::Timeline* cobj = (cocostudio::timeline::Timeline *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Timeline_setActionTag : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_Timeline_setActionTag : Error processing arguments"); cobj->setActionTag(arg0); @@ -11578,7 +11578,7 @@ bool js_cocos2dx_studio_Timeline_addFrame(JSContext *cx, uint32_t argc, jsval *v cocostudio::timeline::Timeline* cobj = (cocostudio::timeline::Timeline *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Timeline_addFrame : Invalid Native Object"); if (argc == 1) { - cocostudio::timeline::Frame* arg0; + cocostudio::timeline::Frame* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -11667,7 +11667,7 @@ bool js_cocos2dx_studio_Timeline_removeFrame(JSContext *cx, uint32_t argc, jsval cocostudio::timeline::Timeline* cobj = (cocostudio::timeline::Timeline *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Timeline_removeFrame : Invalid Native Object"); if (argc == 1) { - cocostudio::timeline::Frame* arg0; + cocostudio::timeline::Frame* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -11695,7 +11695,7 @@ bool js_cocos2dx_studio_Timeline_setActionTimeline(JSContext *cx, uint32_t argc, cocostudio::timeline::Timeline* cobj = (cocostudio::timeline::Timeline *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Timeline_setActionTimeline : Invalid Native Object"); if (argc == 1) { - cocostudio::timeline::ActionTimeline* arg0; + cocostudio::timeline::ActionTimeline* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -11723,7 +11723,7 @@ bool js_cocos2dx_studio_Timeline_stepToFrame(JSContext *cx, uint32_t argc, jsval cocostudio::timeline::Timeline* cobj = (cocostudio::timeline::Timeline *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Timeline_stepToFrame : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_Timeline_stepToFrame : Error processing arguments"); cobj->stepToFrame(arg0); @@ -11867,7 +11867,7 @@ bool js_cocos2dx_studio_ActionTimelineData_setActionTag(JSContext *cx, uint32_t cocostudio::timeline::ActionTimelineData* cobj = (cocostudio::timeline::ActionTimelineData *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ActionTimelineData_setActionTag : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ActionTimelineData_setActionTag : Error processing arguments"); cobj->setActionTag(arg0); @@ -11887,7 +11887,7 @@ bool js_cocos2dx_studio_ActionTimelineData_init(JSContext *cx, uint32_t argc, js cocostudio::timeline::ActionTimelineData* cobj = (cocostudio::timeline::ActionTimelineData *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ActionTimelineData_init : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ActionTimelineData_init : Error processing arguments"); bool ret = cobj->init(arg0); @@ -11923,7 +11923,7 @@ bool js_cocos2dx_studio_ActionTimelineData_create(JSContext *cx, uint32_t argc, JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ActionTimelineData_create : Error processing arguments"); cocostudio::timeline::ActionTimelineData* ret = cocostudio::timeline::ActionTimelineData::create(arg0); @@ -12093,7 +12093,7 @@ bool js_cocos2dx_studio_ActionTimeline_addTimeline(JSContext *cx, uint32_t argc, cocostudio::timeline::ActionTimeline* cobj = (cocostudio::timeline::ActionTimeline *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ActionTimeline_addTimeline : Invalid Native Object"); if (argc == 1) { - cocostudio::timeline::Timeline* arg0; + cocostudio::timeline::Timeline* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -12191,7 +12191,7 @@ bool js_cocos2dx_studio_ActionTimeline_removeTimeline(JSContext *cx, uint32_t ar cocostudio::timeline::ActionTimeline* cobj = (cocostudio::timeline::ActionTimeline *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ActionTimeline_removeTimeline : Invalid Native Object"); if (argc == 1) { - cocostudio::timeline::Timeline* arg0; + cocostudio::timeline::Timeline* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -12434,7 +12434,7 @@ bool js_cocos2dx_studio_ActionTimeline_gotoFrameAndPause(JSContext *cx, uint32_t cocostudio::timeline::ActionTimeline* cobj = (cocostudio::timeline::ActionTimeline *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ActionTimeline_gotoFrameAndPause : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ActionTimeline_gotoFrameAndPause : Error processing arguments"); cobj->gotoFrameAndPause(arg0); @@ -12476,7 +12476,7 @@ bool js_cocos2dx_studio_ActionTimeline_gotoFrameAndPlay(JSContext *cx, uint32_t JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ActionTimeline_gotoFrameAndPlay : Invalid Native Object"); do { if (argc == 2) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); if (!ok) { ok = true; break; } bool arg1; @@ -12489,7 +12489,7 @@ bool js_cocos2dx_studio_ActionTimeline_gotoFrameAndPlay(JSContext *cx, uint32_t do { if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); if (!ok) { ok = true; break; } cobj->gotoFrameAndPlay(arg0); @@ -12500,10 +12500,10 @@ bool js_cocos2dx_studio_ActionTimeline_gotoFrameAndPlay(JSContext *cx, uint32_t do { if (argc == 3) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); if (!ok) { ok = true; break; } - int arg1; + int arg1 = 0; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); if (!ok) { ok = true; break; } bool arg2; @@ -12516,13 +12516,13 @@ bool js_cocos2dx_studio_ActionTimeline_gotoFrameAndPlay(JSContext *cx, uint32_t do { if (argc == 4) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); if (!ok) { ok = true; break; } - int arg1; + int arg1 = 0; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); if (!ok) { ok = true; break; } - int arg2; + int arg2 = 0; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); if (!ok) { ok = true; break; } bool arg3; @@ -12579,7 +12579,7 @@ bool js_cocos2dx_studio_ActionTimeline_setTimeSpeed(JSContext *cx, uint32_t argc cocostudio::timeline::ActionTimeline* cobj = (cocostudio::timeline::ActionTimeline *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ActionTimeline_setTimeSpeed : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ActionTimeline_setTimeSpeed : Error processing arguments"); cobj->setTimeSpeed(arg0); @@ -12615,7 +12615,7 @@ bool js_cocos2dx_studio_ActionTimeline_setDuration(JSContext *cx, uint32_t argc, cocostudio::timeline::ActionTimeline* cobj = (cocostudio::timeline::ActionTimeline *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ActionTimeline_setDuration : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ActionTimeline_setDuration : Error processing arguments"); cobj->setDuration(arg0); @@ -12635,7 +12635,7 @@ bool js_cocos2dx_studio_ActionTimeline_setCurrentFrame(JSContext *cx, uint32_t a cocostudio::timeline::ActionTimeline* cobj = (cocostudio::timeline::ActionTimeline *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ActionTimeline_setCurrentFrame : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ActionTimeline_setCurrentFrame : Error processing arguments"); cobj->setCurrentFrame(arg0); @@ -12975,7 +12975,7 @@ bool js_cocos2dx_studio_BoneNode_displaySkin(JSContext *cx, uint32_t argc, jsval do { if (argc == 2) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -13028,7 +13028,7 @@ bool js_cocos2dx_studio_BoneNode_addSkin(JSContext *cx, uint32_t argc, jsval *vp JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_BoneNode_addSkin : Invalid Native Object"); do { if (argc == 3) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -13051,7 +13051,7 @@ bool js_cocos2dx_studio_BoneNode_addSkin(JSContext *cx, uint32_t argc, jsval *vp do { if (argc == 2) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -13107,7 +13107,7 @@ bool js_cocos2dx_studio_BoneNode_setDebugDrawLength(JSContext *cx, uint32_t argc cocostudio::timeline::BoneNode* cobj = (cocostudio::timeline::BoneNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_BoneNode_setDebugDrawLength : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_BoneNode_setDebugDrawLength : Error processing arguments"); cobj->setDebugDrawLength(arg0); @@ -13179,7 +13179,7 @@ bool js_cocos2dx_studio_BoneNode_setDebugDrawWidth(JSContext *cx, uint32_t argc, cocostudio::timeline::BoneNode* cobj = (cocostudio::timeline::BoneNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_BoneNode_setDebugDrawWidth : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_BoneNode_setDebugDrawWidth : Error processing arguments"); cobj->setDebugDrawWidth(arg0); @@ -13253,7 +13253,7 @@ bool js_cocos2dx_studio_BoneNode_create(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); if (!ok) { ok = true; break; } cocostudio::timeline::BoneNode* ret = cocostudio::timeline::BoneNode::create(arg0); @@ -13668,7 +13668,7 @@ bool js_cocos2dx_studio_ComExtensionData_setActionTag(JSContext *cx, uint32_t ar cocostudio::ComExtensionData* cobj = (cocostudio::ComExtensionData *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ComExtensionData_setActionTag : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ComExtensionData_setActionTag : Error processing arguments"); cobj->setActionTag(arg0); diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.cpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.cpp index e1410854fd..d2ae6a127c 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.cpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.cpp @@ -122,7 +122,7 @@ bool js_cocos2dx_ui_LayoutParameter_copyProperties(JSContext *cx, uint32_t argc, cocos2d::ui::LayoutParameter* cobj = (cocos2d::ui::LayoutParameter *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_LayoutParameter_copyProperties : Invalid Native Object"); if (argc == 1) { - cocos2d::ui::LayoutParameter* arg0; + cocos2d::ui::LayoutParameter* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1131,7 +1131,7 @@ bool js_cocos2dx_ui_Widget_findNextFocusedWidget(JSContext *cx, uint32_t argc, j JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Widget_findNextFocusedWidget : Invalid Native Object"); if (argc == 2) { cocos2d::ui::Widget::FocusDirection arg0; - cocos2d::ui::Widget* arg1; + cocos2d::ui::Widget* arg1 = nullptr; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -1333,7 +1333,7 @@ bool js_cocos2dx_ui_Widget_setActionTag(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::ui::Widget* cobj = (cocos2d::ui::Widget *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Widget_setActionTag : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_Widget_setActionTag : Error processing arguments"); cobj->setActionTag(arg0); @@ -1469,7 +1469,7 @@ bool js_cocos2dx_ui_Widget_setLayoutParameter(JSContext *cx, uint32_t argc, jsva cocos2d::ui::Widget* cobj = (cocos2d::ui::Widget *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Widget_setLayoutParameter : Invalid Native Object"); if (argc == 1) { - cocos2d::ui::LayoutParameter* arg0; + cocos2d::ui::LayoutParameter* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1578,8 +1578,8 @@ bool js_cocos2dx_ui_Widget_dispatchFocusEvent(JSContext *cx, uint32_t argc, jsva cocos2d::ui::Widget* cobj = (cocos2d::ui::Widget *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Widget_dispatchFocusEvent : Invalid Native Object"); if (argc == 2) { - cocos2d::ui::Widget* arg0; - cocos2d::ui::Widget* arg1; + cocos2d::ui::Widget* arg0 = nullptr; + cocos2d::ui::Widget* arg1 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1680,8 +1680,8 @@ bool js_cocos2dx_ui_Widget_hitTest(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Widget_hitTest : Invalid Native Object"); if (argc == 3) { cocos2d::Vec2 arg0; - const cocos2d::Camera* arg1; - cocos2d::Vec3* arg2; + const cocos2d::Camera* arg1 = nullptr; + cocos2d::Vec3* arg2 = nullptr; ok &= jsval_to_vector2(cx, args.get(0), &arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -1788,8 +1788,8 @@ bool js_cocos2dx_ui_Widget_onFocusChange(JSContext *cx, uint32_t argc, jsval *vp cocos2d::ui::Widget* cobj = (cocos2d::ui::Widget *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Widget_onFocusChange : Invalid Native Object"); if (argc == 2) { - cocos2d::ui::Widget* arg0; - cocos2d::ui::Widget* arg1; + cocos2d::ui::Widget* arg0 = nullptr; + cocos2d::ui::Widget* arg1 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1917,8 +1917,8 @@ bool js_cocos2dx_ui_Widget_propagateTouchEvent(JSContext *cx, uint32_t argc, jsv JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Widget_propagateTouchEvent : Invalid Native Object"); if (argc == 3) { cocos2d::ui::Widget::TouchEventType arg0; - cocos2d::ui::Widget* arg1; - cocos2d::Touch* arg2; + cocos2d::ui::Widget* arg1 = nullptr; + cocos2d::Touch* arg2 = nullptr; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -2083,8 +2083,8 @@ bool js_cocos2dx_ui_Widget_interceptTouchEvent(JSContext *cx, uint32_t argc, jsv JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Widget_interceptTouchEvent : Invalid Native Object"); if (argc == 3) { cocos2d::ui::Widget::TouchEventType arg0; - cocos2d::ui::Widget* arg1; - cocos2d::Touch* arg2; + cocos2d::ui::Widget* arg1 = nullptr; + cocos2d::Touch* arg2 = nullptr; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); do { if (args.get(1).isNull()) { arg1 = nullptr; break; } @@ -3264,7 +3264,7 @@ bool js_cocos2dx_ui_Button_setTitleFontSize(JSContext *cx, uint32_t argc, jsval cocos2d::ui::Button* cobj = (cocos2d::ui::Button *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Button_setTitleFontSize : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_Button_setTitleFontSize : Error processing arguments"); cobj->setTitleFontSize(arg0); @@ -3320,6 +3320,31 @@ bool js_cocos2dx_ui_Button_getTitleRenderer(JSContext *cx, uint32_t argc, jsval JS_ReportError(cx, "js_cocos2dx_ui_Button_getTitleRenderer : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } +bool js_cocos2dx_ui_Button_getRendererClicked(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::Button* cobj = (cocos2d::ui::Button *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Button_getRendererClicked : Invalid Native Object"); + if (argc == 0) { + cocos2d::ui::Scale9Sprite* ret = cobj->getRendererClicked(); + jsval jsret = JSVAL_NULL; + do { + if (ret) { + js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::ui::Scale9Sprite*)ret); + jsret = OBJECT_TO_JSVAL(jsProxy->obj); + } else { + jsret = JSVAL_NULL; + } + } while (0); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_Button_getRendererClicked : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_ui_Button_getZoomScale(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -3376,6 +3401,31 @@ bool js_cocos2dx_ui_Button_setTitleColor(JSContext *cx, uint32_t argc, jsval *vp JS_ReportError(cx, "js_cocos2dx_ui_Button_setTitleColor : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } +bool js_cocos2dx_ui_Button_getRendererDisabled(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::Button* cobj = (cocos2d::ui::Button *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Button_getRendererDisabled : Invalid Native Object"); + if (argc == 0) { + cocos2d::ui::Scale9Sprite* ret = cobj->getRendererDisabled(); + jsval jsret = JSVAL_NULL; + do { + if (ret) { + js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::ui::Scale9Sprite*)ret); + jsret = OBJECT_TO_JSVAL(jsProxy->obj); + } else { + jsret = JSVAL_NULL; + } + } while (0); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_Button_getRendererDisabled : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_ui_Button_setCapInsetsDisabledRenderer(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -3809,6 +3859,31 @@ bool js_cocos2dx_ui_Button_getTitleFontSize(JSContext *cx, uint32_t argc, jsval JS_ReportError(cx, "js_cocos2dx_ui_Button_getTitleFontSize : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } +bool js_cocos2dx_ui_Button_getRendererNormal(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::Button* cobj = (cocos2d::ui::Button *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Button_getRendererNormal : Invalid Native Object"); + if (argc == 0) { + cocos2d::ui::Scale9Sprite* ret = cobj->getRendererNormal(); + jsval jsret = JSVAL_NULL; + do { + if (ret) { + js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::ui::Scale9Sprite*)ret); + jsret = OBJECT_TO_JSVAL(jsProxy->obj); + } else { + jsret = JSVAL_NULL; + } + } while (0); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_Button_getRendererNormal : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_ui_Button_getTitleFontName(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -3874,7 +3949,7 @@ bool js_cocos2dx_ui_Button_setZoomScale(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::ui::Button* cobj = (cocos2d::ui::Button *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Button_setZoomScale : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_Button_setZoomScale : Error processing arguments"); cobj->setZoomScale(arg0); @@ -4099,9 +4174,11 @@ void js_register_cocos2dx_ui_Button(JSContext *cx, JS::HandleObject global) { JS_FN("setTitleFontSize", js_cocos2dx_ui_Button_setTitleFontSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setScale9Enabled", js_cocos2dx_ui_Button_setScale9Enabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getTitleRenderer", js_cocos2dx_ui_Button_getTitleRenderer, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getRendererClicked", js_cocos2dx_ui_Button_getRendererClicked, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getZoomScale", js_cocos2dx_ui_Button_getZoomScale, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getCapInsetsDisabledRenderer", js_cocos2dx_ui_Button_getCapInsetsDisabledRenderer, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setTitleColor", js_cocos2dx_ui_Button_setTitleColor, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getRendererDisabled", js_cocos2dx_ui_Button_getRendererDisabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setCapInsetsDisabledRenderer", js_cocos2dx_ui_Button_setCapInsetsDisabledRenderer, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setCapInsets", js_cocos2dx_ui_Button_setCapInsets, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("loadTextureDisabled", js_cocos2dx_ui_Button_loadTextureDisabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -4118,6 +4195,7 @@ void js_register_cocos2dx_ui_Button(JSContext *cx, JS::HandleObject global) { JS_FN("loadTextureNormal", js_cocos2dx_ui_Button_loadTextureNormal, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setCapInsetsPressedRenderer", js_cocos2dx_ui_Button_setCapInsetsPressedRenderer, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getTitleFontSize", js_cocos2dx_ui_Button_getTitleFontSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getRendererNormal", js_cocos2dx_ui_Button_getRendererNormal, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getTitleFontName", js_cocos2dx_ui_Button_getTitleFontName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getTitleColor", js_cocos2dx_ui_Button_getTitleColor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setPressedActionEnabled", js_cocos2dx_ui_Button_setPressedActionEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -4570,7 +4648,7 @@ bool js_cocos2dx_ui_AbstractCheckButton_setZoomScale(JSContext *cx, uint32_t arg cocos2d::ui::AbstractCheckButton* cobj = (cocos2d::ui::AbstractCheckButton *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_AbstractCheckButton_setZoomScale : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_AbstractCheckButton_setZoomScale : Error processing arguments"); cobj->setZoomScale(arg0); @@ -5237,7 +5315,7 @@ bool js_cocos2dx_ui_RadioButtonGroup_removeRadioButton(JSContext *cx, uint32_t a cocos2d::ui::RadioButtonGroup* cobj = (cocos2d::ui::RadioButtonGroup *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_RadioButtonGroup_removeRadioButton : Invalid Native Object"); if (argc == 1) { - cocos2d::ui::RadioButton* arg0; + cocos2d::ui::RadioButton* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -5325,7 +5403,7 @@ bool js_cocos2dx_ui_RadioButtonGroup_setSelectedButtonWithoutEvent(JSContext *cx JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_RadioButtonGroup_setSelectedButtonWithoutEvent : Invalid Native Object"); do { if (argc == 1) { - cocos2d::ui::RadioButton* arg0; + cocos2d::ui::RadioButton* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -5344,7 +5422,7 @@ bool js_cocos2dx_ui_RadioButtonGroup_setSelectedButtonWithoutEvent(JSContext *cx do { if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); if (!ok) { ok = true; break; } cobj->setSelectedButtonWithoutEvent(arg0); @@ -5381,7 +5459,7 @@ bool js_cocos2dx_ui_RadioButtonGroup_getRadioButtonByIndex(JSContext *cx, uint32 cocos2d::ui::RadioButtonGroup* cobj = (cocos2d::ui::RadioButtonGroup *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_RadioButtonGroup_getRadioButtonByIndex : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_RadioButtonGroup_getRadioButtonByIndex : Error processing arguments"); cocos2d::ui::RadioButton* ret = cobj->getRadioButtonByIndex(arg0); @@ -5428,7 +5506,7 @@ bool js_cocos2dx_ui_RadioButtonGroup_addRadioButton(JSContext *cx, uint32_t argc cocos2d::ui::RadioButtonGroup* cobj = (cocos2d::ui::RadioButtonGroup *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_RadioButtonGroup_addRadioButton : Invalid Native Object"); if (argc == 1) { - cocos2d::ui::RadioButton* arg0; + cocos2d::ui::RadioButton* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -5460,7 +5538,7 @@ bool js_cocos2dx_ui_RadioButtonGroup_setSelectedButton(JSContext *cx, uint32_t a JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_RadioButtonGroup_setSelectedButton : Invalid Native Object"); do { if (argc == 1) { - cocos2d::ui::RadioButton* arg0; + cocos2d::ui::RadioButton* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -5479,7 +5557,7 @@ bool js_cocos2dx_ui_RadioButtonGroup_setSelectedButton(JSContext *cx, uint32_t a do { if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); if (!ok) { ok = true; break; } cobj->setSelectedButton(arg0); @@ -6031,7 +6109,7 @@ bool js_cocos2dx_ui_Text_enableShadow(JSContext *cx, uint32_t argc, jsval *vp) if (argc == 3) { cocos2d::Color4B arg0; cocos2d::Size arg1; - int arg2; + int arg2 = 0; ok &= jsval_to_cccolor4b(cx, args.get(0), &arg0); ok &= jsval_to_ccsize(cx, args.get(1), &arg1); ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); @@ -6222,7 +6300,7 @@ bool js_cocos2dx_ui_Text_init(JSContext *cx, uint32_t argc, jsval *vp) if (argc == 3) { std::string arg0; std::string arg1; - double arg2; + double arg2 = 0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); ok &= jsval_to_std_string(cx, args.get(1), &arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -6347,7 +6425,7 @@ bool js_cocos2dx_ui_Text_enableOutline(JSContext *cx, uint32_t argc, jsval *vp) } if (argc == 2) { cocos2d::Color4B arg0; - int arg1; + int arg1 = 0; ok &= jsval_to_cccolor4b(cx, args.get(0), &arg0); ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_Text_enableOutline : Error processing arguments"); @@ -6404,7 +6482,7 @@ bool js_cocos2dx_ui_Text_setFontSize(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::ui::Text* cobj = (cocos2d::ui::Text *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Text_setFontSize : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_Text_setFontSize : Error processing arguments"); cobj->setFontSize(arg0); @@ -6524,7 +6602,7 @@ bool js_cocos2dx_ui_Text_create(JSContext *cx, uint32_t argc, jsval *vp) std::string arg1; ok &= jsval_to_std_string(cx, args.get(1), &arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } cocos2d::ui::Text* ret = cocos2d::ui::Text::create(arg0, arg1, arg2); @@ -6784,8 +6862,8 @@ bool js_cocos2dx_ui_TextAtlas_setProperty(JSContext *cx, uint32_t argc, jsval *v if (argc == 5) { std::string arg0; std::string arg1; - int arg2; - int arg3; + int arg2 = 0; + int arg3 = 0; std::string arg4; ok &= jsval_to_std_string(cx, args.get(0), &arg0); ok &= jsval_to_std_string(cx, args.get(1), &arg1); @@ -6830,10 +6908,10 @@ bool js_cocos2dx_ui_TextAtlas_create(JSContext *cx, uint32_t argc, jsval *vp) std::string arg1; ok &= jsval_to_std_string(cx, args.get(1), &arg1); if (!ok) { ok = true; break; } - int arg2; + int arg2 = 0; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); if (!ok) { ok = true; break; } - int arg3; + int arg3 = 0; ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3); if (!ok) { ok = true; break; } std::string arg4; @@ -7019,7 +7097,7 @@ bool js_cocos2dx_ui_LoadingBar_setPercent(JSContext *cx, uint32_t argc, jsval *v cocos2d::ui::LoadingBar* cobj = (cocos2d::ui::LoadingBar *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_LoadingBar_setPercent : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_LoadingBar_setPercent : Error processing arguments"); cobj->setPercent(arg0); @@ -7221,7 +7299,7 @@ bool js_cocos2dx_ui_LoadingBar_create(JSContext *cx, uint32_t argc, jsval *vp) std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); if (!ok) { ok = true; break; } cocos2d::ui::LoadingBar* ret = cocos2d::ui::LoadingBar::create(arg0, arg1); @@ -7286,7 +7364,7 @@ bool js_cocos2dx_ui_LoadingBar_create(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::ui::Widget::TextureResType arg1; ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); if (!ok) { ok = true; break; } - double arg2; + double arg2 = 0; ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); if (!ok) { ok = true; break; } cocos2d::ui::LoadingBar* ret = cocos2d::ui::LoadingBar::create(arg0, arg1, arg2); @@ -7456,7 +7534,7 @@ bool js_cocos2dx_ui_ScrollView_scrollToTop(JSContext *cx, uint32_t argc, jsval * cocos2d::ui::ScrollView* cobj = (cocos2d::ui::ScrollView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ScrollView_scrollToTop : Invalid Native Object"); if (argc == 2) { - double arg0; + double arg0 = 0; bool arg1; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); arg1 = JS::ToBoolean(args.get(1)); @@ -7478,8 +7556,8 @@ bool js_cocos2dx_ui_ScrollView_scrollToPercentHorizontal(JSContext *cx, uint32_t cocos2d::ui::ScrollView* cobj = (cocos2d::ui::ScrollView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ScrollView_scrollToPercentHorizontal : Invalid Native Object"); if (argc == 3) { - double arg0; - double arg1; + double arg0 = 0; + double arg1 = 0; bool arg2; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); @@ -7561,7 +7639,7 @@ bool js_cocos2dx_ui_ScrollView_scrollToPercentBothDirection(JSContext *cx, uint3 JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ScrollView_scrollToPercentBothDirection : Invalid Native Object"); if (argc == 3) { cocos2d::Vec2 arg0; - double arg1; + double arg1 = 0; bool arg2; ok &= jsval_to_vector2(cx, args.get(0), &arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); @@ -7622,7 +7700,7 @@ bool js_cocos2dx_ui_ScrollView_scrollToBottomLeft(JSContext *cx, uint32_t argc, cocos2d::ui::ScrollView* cobj = (cocos2d::ui::ScrollView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ScrollView_scrollToBottomLeft : Invalid Native Object"); if (argc == 2) { - double arg0; + double arg0 = 0; bool arg1; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); arg1 = JS::ToBoolean(args.get(1)); @@ -7725,7 +7803,7 @@ bool js_cocos2dx_ui_ScrollView_scrollToTopLeft(JSContext *cx, uint32_t argc, jsv cocos2d::ui::ScrollView* cobj = (cocos2d::ui::ScrollView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ScrollView_scrollToTopLeft : Invalid Native Object"); if (argc == 2) { - double arg0; + double arg0 = 0; bool arg1; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); arg1 = JS::ToBoolean(args.get(1)); @@ -7853,7 +7931,7 @@ bool js_cocos2dx_ui_ScrollView_jumpToPercentVertical(JSContext *cx, uint32_t arg cocos2d::ui::ScrollView* cobj = (cocos2d::ui::ScrollView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ScrollView_jumpToPercentVertical : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_ScrollView_jumpToPercentVertical : Error processing arguments"); cobj->jumpToPercentVertical(arg0); @@ -7873,7 +7951,7 @@ bool js_cocos2dx_ui_ScrollView_setScrollBarAutoHideTime(JSContext *cx, uint32_t cocos2d::ui::ScrollView* cobj = (cocos2d::ui::ScrollView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ScrollView_setScrollBarAutoHideTime : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_ScrollView_setScrollBarAutoHideTime : Error processing arguments"); cobj->setScrollBarAutoHideTime(arg0); @@ -7987,7 +8065,7 @@ bool js_cocos2dx_ui_ScrollView_jumpToPercentHorizontal(JSContext *cx, uint32_t a cocos2d::ui::ScrollView* cobj = (cocos2d::ui::ScrollView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ScrollView_jumpToPercentHorizontal : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_ScrollView_jumpToPercentHorizontal : Error processing arguments"); cobj->jumpToPercentHorizontal(arg0); @@ -8041,7 +8119,7 @@ bool js_cocos2dx_ui_ScrollView_setScrollBarWidth(JSContext *cx, uint32_t argc, j cocos2d::ui::ScrollView* cobj = (cocos2d::ui::ScrollView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ScrollView_setScrollBarWidth : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_ScrollView_setScrollBarWidth : Error processing arguments"); cobj->setScrollBarWidth(arg0); @@ -8097,7 +8175,7 @@ bool js_cocos2dx_ui_ScrollView_scrollToLeft(JSContext *cx, uint32_t argc, jsval cocos2d::ui::ScrollView* cobj = (cocos2d::ui::ScrollView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ScrollView_scrollToLeft : Invalid Native Object"); if (argc == 2) { - double arg0; + double arg0 = 0; bool arg1; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); arg1 = JS::ToBoolean(args.get(1)); @@ -8157,8 +8235,8 @@ bool js_cocos2dx_ui_ScrollView_scrollToPercentVertical(JSContext *cx, uint32_t a cocos2d::ui::ScrollView* cobj = (cocos2d::ui::ScrollView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ScrollView_scrollToPercentVertical : Invalid Native Object"); if (argc == 3) { - double arg0; - double arg1; + double arg0 = 0; + double arg1 = 0; bool arg2; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1); @@ -8181,7 +8259,7 @@ bool js_cocos2dx_ui_ScrollView_scrollToBottom(JSContext *cx, uint32_t argc, jsva cocos2d::ui::ScrollView* cobj = (cocos2d::ui::ScrollView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ScrollView_scrollToBottom : Invalid Native Object"); if (argc == 2) { - double arg0; + double arg0 = 0; bool arg1; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); arg1 = JS::ToBoolean(args.get(1)); @@ -8221,7 +8299,7 @@ bool js_cocos2dx_ui_ScrollView_scrollToBottomRight(JSContext *cx, uint32_t argc, cocos2d::ui::ScrollView* cobj = (cocos2d::ui::ScrollView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ScrollView_scrollToBottomRight : Invalid Native Object"); if (argc == 2) { - double arg0; + double arg0 = 0; bool arg1; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); arg1 = JS::ToBoolean(args.get(1)); @@ -8317,7 +8395,7 @@ bool js_cocos2dx_ui_ScrollView_scrollToRight(JSContext *cx, uint32_t argc, jsval cocos2d::ui::ScrollView* cobj = (cocos2d::ui::ScrollView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ScrollView_scrollToRight : Invalid Native Object"); if (argc == 2) { - double arg0; + double arg0 = 0; bool arg1; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); arg1 = JS::ToBoolean(args.get(1)); @@ -8409,7 +8487,7 @@ bool js_cocos2dx_ui_ScrollView_scrollToTopRight(JSContext *cx, uint32_t argc, js cocos2d::ui::ScrollView* cobj = (cocos2d::ui::ScrollView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ScrollView_scrollToTopRight : Invalid Native Object"); if (argc == 2) { - double arg0; + double arg0 = 0; bool arg1; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); arg1 = JS::ToBoolean(args.get(1)); @@ -8625,52 +8703,6 @@ void js_register_cocos2dx_ui_ScrollView(JSContext *cx, JS::HandleObject global) JSClass *jsb_cocos2d_ui_ListView_class; JSObject *jsb_cocos2d_ui_ListView_prototype; -bool js_cocos2dx_ui_ListView_getIndex(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::ui::ListView* cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_getIndex : Invalid Native Object"); - if (argc == 1) { - cocos2d::ui::Widget* arg0; - do { - if (args.get(0).isNull()) { arg0 = nullptr; break; } - if (!args.get(0).isObject()) { ok = false; break; } - js_proxy_t *jsProxy; - JSObject *tmpObj = args.get(0).toObjectOrNull(); - jsProxy = jsb_get_js_proxy(tmpObj); - arg0 = (cocos2d::ui::Widget*)(jsProxy ? jsProxy->ptr : NULL); - JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); - } while (0); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_ListView_getIndex : Error processing arguments"); - ssize_t ret = cobj->getIndex(arg0); - jsval jsret = JSVAL_NULL; - jsret = ssize_to_jsval(cx, ret); - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_ui_ListView_getIndex : wrong number of arguments: %d, was expecting %d", argc, 1); - return false; -} -bool js_cocos2dx_ui_ListView_removeAllItems(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::ui::ListView* cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_removeAllItems : Invalid Native Object"); - if (argc == 0) { - cobj->removeAllItems(); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_ui_ListView_removeAllItems : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} bool js_cocos2dx_ui_ListView_setGravity(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -8691,70 +8723,45 @@ bool js_cocos2dx_ui_ListView_setGravity(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_ui_ListView_setGravity : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } -bool js_cocos2dx_ui_ListView_pushBackCustomItem(JSContext *cx, uint32_t argc, jsval *vp) +bool js_cocos2dx_ui_ListView_removeLastItem(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); js_proxy_t *proxy = jsb_get_js_proxy(obj); cocos2d::ui::ListView* cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_pushBackCustomItem : Invalid Native Object"); - if (argc == 1) { - cocos2d::ui::Widget* arg0; - do { - if (args.get(0).isNull()) { arg0 = nullptr; break; } - if (!args.get(0).isObject()) { ok = false; break; } - js_proxy_t *jsProxy; - JSObject *tmpObj = args.get(0).toObjectOrNull(); - jsProxy = jsb_get_js_proxy(tmpObj); - arg0 = (cocos2d::ui::Widget*)(jsProxy ? jsProxy->ptr : NULL); - JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); - } while (0); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_ListView_pushBackCustomItem : Error processing arguments"); - cobj->pushBackCustomItem(arg0); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_removeLastItem : Invalid Native Object"); + if (argc == 0) { + cobj->removeLastItem(); args.rval().setUndefined(); return true; } - JS_ReportError(cx, "js_cocos2dx_ui_ListView_pushBackCustomItem : wrong number of arguments: %d, was expecting %d", argc, 1); + JS_ReportError(cx, "js_cocos2dx_ui_ListView_removeLastItem : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } -bool js_cocos2dx_ui_ListView_getItems(JSContext *cx, uint32_t argc, jsval *vp) +bool js_cocos2dx_ui_ListView_getCenterItemInCurrentView(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); js_proxy_t *proxy = jsb_get_js_proxy(obj); cocos2d::ui::ListView* cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_getItems : Invalid Native Object"); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_getCenterItemInCurrentView : Invalid Native Object"); if (argc == 0) { - cocos2d::Vector& ret = cobj->getItems(); + cocos2d::ui::Widget* ret = cobj->getCenterItemInCurrentView(); jsval jsret = JSVAL_NULL; - jsret = ccvector_to_jsval(cx, ret); + do { + if (ret) { + js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::ui::Widget*)ret); + jsret = OBJECT_TO_JSVAL(jsProxy->obj); + } else { + jsret = JSVAL_NULL; + } + } while (0); args.rval().set(jsret); return true; } - JS_ReportError(cx, "js_cocos2dx_ui_ListView_getItems : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} -bool js_cocos2dx_ui_ListView_removeItem(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::ui::ListView* cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_removeItem : Invalid Native Object"); - if (argc == 1) { - ssize_t arg0; - ok &= jsval_to_ssize(cx, args.get(0), &arg0); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_ListView_removeItem : Error processing arguments"); - cobj->removeItem(arg0); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_ui_ListView_removeItem : wrong number of arguments: %d, was expecting %d", argc, 1); + JS_ReportError(cx, "js_cocos2dx_ui_ListView_getCenterItemInCurrentView : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } bool js_cocos2dx_ui_ListView_getCurSelectedIndex(JSContext *cx, uint32_t argc, jsval *vp) @@ -8775,94 +8782,6 @@ bool js_cocos2dx_ui_ListView_getCurSelectedIndex(JSContext *cx, uint32_t argc, j JS_ReportError(cx, "js_cocos2dx_ui_ListView_getCurSelectedIndex : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } -bool js_cocos2dx_ui_ListView_insertDefaultItem(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::ui::ListView* cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_insertDefaultItem : Invalid Native Object"); - if (argc == 1) { - ssize_t arg0; - ok &= jsval_to_ssize(cx, args.get(0), &arg0); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_ListView_insertDefaultItem : Error processing arguments"); - cobj->insertDefaultItem(arg0); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_ui_ListView_insertDefaultItem : wrong number of arguments: %d, was expecting %d", argc, 1); - return false; -} -bool js_cocos2dx_ui_ListView_requestRefreshView(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::ui::ListView* cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_requestRefreshView : Invalid Native Object"); - if (argc == 0) { - cobj->requestRefreshView(); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_ui_ListView_requestRefreshView : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} -bool js_cocos2dx_ui_ListView_setItemsMargin(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::ui::ListView* cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_setItemsMargin : Invalid Native Object"); - if (argc == 1) { - double arg0; - ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_ListView_setItemsMargin : Error processing arguments"); - cobj->setItemsMargin(arg0); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_ui_ListView_setItemsMargin : wrong number of arguments: %d, was expecting %d", argc, 1); - return false; -} -bool js_cocos2dx_ui_ListView_refreshView(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::ui::ListView* cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_refreshView : Invalid Native Object"); - if (argc == 0) { - cobj->refreshView(); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_ui_ListView_refreshView : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} -bool js_cocos2dx_ui_ListView_removeLastItem(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::ui::ListView* cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_removeLastItem : Invalid Native Object"); - if (argc == 0) { - cobj->removeLastItem(); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_ui_ListView_removeLastItem : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} bool js_cocos2dx_ui_ListView_getItemsMargin(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -8881,6 +8800,303 @@ bool js_cocos2dx_ui_ListView_getItemsMargin(JSContext *cx, uint32_t argc, jsval JS_ReportError(cx, "js_cocos2dx_ui_ListView_getItemsMargin : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } +bool js_cocos2dx_ui_ListView_setMagneticType(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::ListView* cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_setMagneticType : Invalid Native Object"); + if (argc == 1) { + cocos2d::ui::ListView::MagneticType arg0; + ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_ListView_setMagneticType : Error processing arguments"); + cobj->setMagneticType(arg0); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_ListView_setMagneticType : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} +bool js_cocos2dx_ui_ListView_refreshViewIfNecessary(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::ListView* cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_refreshViewIfNecessary : Invalid Native Object"); + if (argc == 0) { + cobj->refreshViewIfNecessary(); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_ListView_refreshViewIfNecessary : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_ui_ListView_getIndex(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::ListView* cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_getIndex : Invalid Native Object"); + if (argc == 1) { + cocos2d::ui::Widget* arg0 = nullptr; + do { + if (args.get(0).isNull()) { arg0 = nullptr; break; } + if (!args.get(0).isObject()) { ok = false; break; } + js_proxy_t *jsProxy; + JSObject *tmpObj = args.get(0).toObjectOrNull(); + jsProxy = jsb_get_js_proxy(tmpObj); + arg0 = (cocos2d::ui::Widget*)(jsProxy ? jsProxy->ptr : NULL); + JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); + } while (0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_ListView_getIndex : Error processing arguments"); + ssize_t ret = cobj->getIndex(arg0); + jsval jsret = JSVAL_NULL; + jsret = ssize_to_jsval(cx, ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_ListView_getIndex : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} +bool js_cocos2dx_ui_ListView_pushBackCustomItem(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::ListView* cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_pushBackCustomItem : Invalid Native Object"); + if (argc == 1) { + cocos2d::ui::Widget* arg0 = nullptr; + do { + if (args.get(0).isNull()) { arg0 = nullptr; break; } + if (!args.get(0).isObject()) { ok = false; break; } + js_proxy_t *jsProxy; + JSObject *tmpObj = args.get(0).toObjectOrNull(); + jsProxy = jsb_get_js_proxy(tmpObj); + arg0 = (cocos2d::ui::Widget*)(jsProxy ? jsProxy->ptr : NULL); + JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); + } while (0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_ListView_pushBackCustomItem : Error processing arguments"); + cobj->pushBackCustomItem(arg0); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_ListView_pushBackCustomItem : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} +bool js_cocos2dx_ui_ListView_insertDefaultItem(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::ListView* cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_insertDefaultItem : Invalid Native Object"); + if (argc == 1) { + ssize_t arg0 = 0; + ok &= jsval_to_ssize(cx, args.get(0), &arg0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_ListView_insertDefaultItem : Error processing arguments"); + cobj->insertDefaultItem(arg0); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_ListView_insertDefaultItem : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} +bool js_cocos2dx_ui_ListView_setMagneticAllowedOutOfBoundary(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::ListView* cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_setMagneticAllowedOutOfBoundary : Invalid Native Object"); + if (argc == 1) { + bool arg0; + arg0 = JS::ToBoolean(args.get(0)); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_ListView_setMagneticAllowedOutOfBoundary : Error processing arguments"); + cobj->setMagneticAllowedOutOfBoundary(arg0); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_ListView_setMagneticAllowedOutOfBoundary : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} +bool js_cocos2dx_ui_ListView_doLayout(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::ListView* cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_doLayout : Invalid Native Object"); + if (argc == 0) { + cobj->doLayout(); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_ListView_doLayout : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_ui_ListView_getTopmostItemInCurrentView(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::ListView* cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_getTopmostItemInCurrentView : Invalid Native Object"); + if (argc == 0) { + cocos2d::ui::Widget* ret = cobj->getTopmostItemInCurrentView(); + jsval jsret = JSVAL_NULL; + do { + if (ret) { + js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::ui::Widget*)ret); + jsret = OBJECT_TO_JSVAL(jsProxy->obj); + } else { + jsret = JSVAL_NULL; + } + } while (0); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_ListView_getTopmostItemInCurrentView : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_ui_ListView_removeAllItems(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::ListView* cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_removeAllItems : Invalid Native Object"); + if (argc == 0) { + cobj->removeAllItems(); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_ListView_removeAllItems : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_ui_ListView_getBottommostItemInCurrentView(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::ListView* cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_getBottommostItemInCurrentView : Invalid Native Object"); + if (argc == 0) { + cocos2d::ui::Widget* ret = cobj->getBottommostItemInCurrentView(); + jsval jsret = JSVAL_NULL; + do { + if (ret) { + js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::ui::Widget*)ret); + jsret = OBJECT_TO_JSVAL(jsProxy->obj); + } else { + jsret = JSVAL_NULL; + } + } while (0); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_ListView_getBottommostItemInCurrentView : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_ui_ListView_getItems(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::ListView* cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_getItems : Invalid Native Object"); + if (argc == 0) { + cocos2d::Vector& ret = cobj->getItems(); + jsval jsret = JSVAL_NULL; + jsret = ccvector_to_jsval(cx, ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_ListView_getItems : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_ui_ListView_getLeftmostItemInCurrentView(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::ListView* cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_getLeftmostItemInCurrentView : Invalid Native Object"); + if (argc == 0) { + cocos2d::ui::Widget* ret = cobj->getLeftmostItemInCurrentView(); + jsval jsret = JSVAL_NULL; + do { + if (ret) { + js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::ui::Widget*)ret); + jsret = OBJECT_TO_JSVAL(jsProxy->obj); + } else { + jsret = JSVAL_NULL; + } + } while (0); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_ListView_getLeftmostItemInCurrentView : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_ui_ListView_setItemsMargin(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::ListView* cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_setItemsMargin : Invalid Native Object"); + if (argc == 1) { + double arg0 = 0; + ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_ListView_setItemsMargin : Error processing arguments"); + cobj->setItemsMargin(arg0); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_ListView_setItemsMargin : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} +bool js_cocos2dx_ui_ListView_getMagneticType(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::ListView* cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_getMagneticType : Invalid Native Object"); + if (argc == 0) { + int ret = (int)cobj->getMagneticType(); + jsval jsret = JSVAL_NULL; + jsret = int32_to_jsval(cx, ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_ListView_getMagneticType : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_ui_ListView_getItem(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -8890,7 +9106,7 @@ bool js_cocos2dx_ui_ListView_getItem(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::ui::ListView* cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_getItem : Invalid Native Object"); if (argc == 1) { - ssize_t arg0; + ssize_t arg0 = 0; ok &= jsval_to_ssize(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_ListView_getItem : Error processing arguments"); cocos2d::ui::Widget* ret = cobj->getItem(arg0); @@ -8910,48 +9126,75 @@ bool js_cocos2dx_ui_ListView_getItem(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_ui_ListView_getItem : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } -bool js_cocos2dx_ui_ListView_setItemModel(JSContext *cx, uint32_t argc, jsval *vp) +bool js_cocos2dx_ui_ListView_removeItem(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); js_proxy_t *proxy = jsb_get_js_proxy(obj); cocos2d::ui::ListView* cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_setItemModel : Invalid Native Object"); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_removeItem : Invalid Native Object"); if (argc == 1) { - cocos2d::ui::Widget* arg0; - do { - if (args.get(0).isNull()) { arg0 = nullptr; break; } - if (!args.get(0).isObject()) { ok = false; break; } - js_proxy_t *jsProxy; - JSObject *tmpObj = args.get(0).toObjectOrNull(); - jsProxy = jsb_get_js_proxy(tmpObj); - arg0 = (cocos2d::ui::Widget*)(jsProxy ? jsProxy->ptr : NULL); - JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); - } while (0); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_ListView_setItemModel : Error processing arguments"); - cobj->setItemModel(arg0); + ssize_t arg0 = 0; + ok &= jsval_to_ssize(cx, args.get(0), &arg0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_ListView_removeItem : Error processing arguments"); + cobj->removeItem(arg0); args.rval().setUndefined(); return true; } - JS_ReportError(cx, "js_cocos2dx_ui_ListView_setItemModel : wrong number of arguments: %d, was expecting %d", argc, 1); + JS_ReportError(cx, "js_cocos2dx_ui_ListView_removeItem : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } -bool js_cocos2dx_ui_ListView_doLayout(JSContext *cx, uint32_t argc, jsval *vp) +bool js_cocos2dx_ui_ListView_scrollToItem(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::ui::ListView* cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_doLayout : Invalid Native Object"); - if (argc == 0) { - cobj->doLayout(); - args.rval().setUndefined(); - return true; - } + bool ok = true; - JS_ReportError(cx, "js_cocos2dx_ui_ListView_doLayout : wrong number of arguments: %d, was expecting %d", argc, 0); + JS::RootedObject obj(cx); + cocos2d::ui::ListView* cobj = NULL; + obj = args.thisv().toObjectOrNull(); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_scrollToItem : Invalid Native Object"); + do { + if (argc == 4) { + int arg0 = 0; + ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); + if (!ok) { ok = true; break; } + cocos2d::Vec2 arg1; + ok &= jsval_to_vector2(cx, args.get(1), &arg1); + if (!ok) { ok = true; break; } + cocos2d::Vec2 arg2; + ok &= jsval_to_vector2(cx, args.get(2), &arg2); + if (!ok) { ok = true; break; } + double arg3 = 0; + ok &= JS::ToNumber( cx, args.get(3), &arg3) && !isnan(arg3); + if (!ok) { ok = true; break; } + cobj->scrollToItem(arg0, arg1, arg2, arg3); + args.rval().setUndefined(); + return true; + } + } while(0); + + do { + if (argc == 3) { + int arg0 = 0; + ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); + if (!ok) { ok = true; break; } + cocos2d::Vec2 arg1; + ok &= jsval_to_vector2(cx, args.get(1), &arg1); + if (!ok) { ok = true; break; } + cocos2d::Vec2 arg2; + ok &= jsval_to_vector2(cx, args.get(2), &arg2); + if (!ok) { ok = true; break; } + cobj->scrollToItem(arg0, arg1, arg2); + args.rval().setUndefined(); + return true; + } + } while(0); + + JS_ReportError(cx, "js_cocos2dx_ui_ListView_scrollToItem : wrong number of arguments"); return false; } bool js_cocos2dx_ui_ListView_pushBackDefaultItem(JSContext *cx, uint32_t argc, jsval *vp) @@ -8970,6 +9213,171 @@ bool js_cocos2dx_ui_ListView_pushBackDefaultItem(JSContext *cx, uint32_t argc, j JS_ReportError(cx, "js_cocos2dx_ui_ListView_pushBackDefaultItem : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } +bool js_cocos2dx_ui_ListView_getMagneticAllowedOutOfBoundary(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::ListView* cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_getMagneticAllowedOutOfBoundary : Invalid Native Object"); + if (argc == 0) { + bool ret = cobj->getMagneticAllowedOutOfBoundary(); + jsval jsret = JSVAL_NULL; + jsret = BOOLEAN_TO_JSVAL(ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_ListView_getMagneticAllowedOutOfBoundary : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_ui_ListView_getClosestItemToPosition(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::ListView* cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_getClosestItemToPosition : Invalid Native Object"); + if (argc == 2) { + cocos2d::Vec2 arg0; + cocos2d::Vec2 arg1; + ok &= jsval_to_vector2(cx, args.get(0), &arg0); + ok &= jsval_to_vector2(cx, args.get(1), &arg1); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_ListView_getClosestItemToPosition : Error processing arguments"); + cocos2d::ui::Widget* ret = cobj->getClosestItemToPosition(arg0, arg1); + jsval jsret = JSVAL_NULL; + do { + if (ret) { + js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::ui::Widget*)ret); + jsret = OBJECT_TO_JSVAL(jsProxy->obj); + } else { + jsret = JSVAL_NULL; + } + } while (0); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_ListView_getClosestItemToPosition : wrong number of arguments: %d, was expecting %d", argc, 2); + return false; +} +bool js_cocos2dx_ui_ListView_getRightmostItemInCurrentView(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::ListView* cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_getRightmostItemInCurrentView : Invalid Native Object"); + if (argc == 0) { + cocos2d::ui::Widget* ret = cobj->getRightmostItemInCurrentView(); + jsval jsret = JSVAL_NULL; + do { + if (ret) { + js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::ui::Widget*)ret); + jsret = OBJECT_TO_JSVAL(jsProxy->obj); + } else { + jsret = JSVAL_NULL; + } + } while (0); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_ListView_getRightmostItemInCurrentView : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_ui_ListView_getClosestItemToPositionInCurrentView(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::ListView* cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_getClosestItemToPositionInCurrentView : Invalid Native Object"); + if (argc == 2) { + cocos2d::Vec2 arg0; + cocos2d::Vec2 arg1; + ok &= jsval_to_vector2(cx, args.get(0), &arg0); + ok &= jsval_to_vector2(cx, args.get(1), &arg1); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_ListView_getClosestItemToPositionInCurrentView : Error processing arguments"); + cocos2d::ui::Widget* ret = cobj->getClosestItemToPositionInCurrentView(arg0, arg1); + jsval jsret = JSVAL_NULL; + do { + if (ret) { + js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::ui::Widget*)ret); + jsret = OBJECT_TO_JSVAL(jsProxy->obj); + } else { + jsret = JSVAL_NULL; + } + } while (0); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_ListView_getClosestItemToPositionInCurrentView : wrong number of arguments: %d, was expecting %d", argc, 2); + return false; +} +bool js_cocos2dx_ui_ListView_refreshView(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::ListView* cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_refreshView : Invalid Native Object"); + if (argc == 0) { + cobj->refreshView(); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_ListView_refreshView : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_ui_ListView_setItemModel(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::ListView* cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_setItemModel : Invalid Native Object"); + if (argc == 1) { + cocos2d::ui::Widget* arg0 = nullptr; + do { + if (args.get(0).isNull()) { arg0 = nullptr; break; } + if (!args.get(0).isObject()) { ok = false; break; } + js_proxy_t *jsProxy; + JSObject *tmpObj = args.get(0).toObjectOrNull(); + jsProxy = jsb_get_js_proxy(tmpObj); + arg0 = (cocos2d::ui::Widget*)(jsProxy ? jsProxy->ptr : NULL); + JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); + } while (0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_ListView_setItemModel : Error processing arguments"); + cobj->setItemModel(arg0); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_ListView_setItemModel : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} +bool js_cocos2dx_ui_ListView_requestRefreshView(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::ListView* cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_requestRefreshView : Invalid Native Object"); + if (argc == 0) { + cobj->requestRefreshView(); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_ListView_requestRefreshView : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_ui_ListView_insertCustomItem(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -8979,8 +9387,8 @@ bool js_cocos2dx_ui_ListView_insertCustomItem(JSContext *cx, uint32_t argc, jsva cocos2d::ui::ListView* cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_insertCustomItem : Invalid Native Object"); if (argc == 2) { - cocos2d::ui::Widget* arg0; - ssize_t arg1; + cocos2d::ui::Widget* arg0 = nullptr; + ssize_t arg1 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -9111,23 +9519,36 @@ void js_register_cocos2dx_ui_ListView(JSContext *cx, JS::HandleObject global) { }; static JSFunctionSpec funcs[] = { - JS_FN("getIndex", js_cocos2dx_ui_ListView_getIndex, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("removeAllItems", js_cocos2dx_ui_ListView_removeAllItems, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setGravity", js_cocos2dx_ui_ListView_setGravity, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("pushBackCustomItem", js_cocos2dx_ui_ListView_pushBackCustomItem, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("getItems", js_cocos2dx_ui_ListView_getItems, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("removeItem", js_cocos2dx_ui_ListView_removeItem, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("getCurSelectedIndex", js_cocos2dx_ui_ListView_getCurSelectedIndex, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("insertDefaultItem", js_cocos2dx_ui_ListView_insertDefaultItem, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("requestRefreshView", js_cocos2dx_ui_ListView_requestRefreshView, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("setItemsMargin", js_cocos2dx_ui_ListView_setItemsMargin, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("refreshView", js_cocos2dx_ui_ListView_refreshView, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("removeLastItem", js_cocos2dx_ui_ListView_removeLastItem, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getCenterItemInCurrentView", js_cocos2dx_ui_ListView_getCenterItemInCurrentView, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getCurSelectedIndex", js_cocos2dx_ui_ListView_getCurSelectedIndex, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getItemsMargin", js_cocos2dx_ui_ListView_getItemsMargin, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("getItem", js_cocos2dx_ui_ListView_getItem, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("setItemModel", js_cocos2dx_ui_ListView_setItemModel, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("setMagneticType", js_cocos2dx_ui_ListView_setMagneticType, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("refreshViewIfNecessary", js_cocos2dx_ui_ListView_refreshViewIfNecessary, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getIndex", js_cocos2dx_ui_ListView_getIndex, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("pushBackCustomItem", js_cocos2dx_ui_ListView_pushBackCustomItem, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("insertDefaultItem", js_cocos2dx_ui_ListView_insertDefaultItem, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("setMagneticAllowedOutOfBoundary", js_cocos2dx_ui_ListView_setMagneticAllowedOutOfBoundary, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("doLayout", js_cocos2dx_ui_ListView_doLayout, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getTopmostItemInCurrentView", js_cocos2dx_ui_ListView_getTopmostItemInCurrentView, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("removeAllItems", js_cocos2dx_ui_ListView_removeAllItems, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getBottommostItemInCurrentView", js_cocos2dx_ui_ListView_getBottommostItemInCurrentView, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getItems", js_cocos2dx_ui_ListView_getItems, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getLeftmostItemInCurrentView", js_cocos2dx_ui_ListView_getLeftmostItemInCurrentView, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("setItemsMargin", js_cocos2dx_ui_ListView_setItemsMargin, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getMagneticType", js_cocos2dx_ui_ListView_getMagneticType, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getItem", js_cocos2dx_ui_ListView_getItem, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("removeItem", js_cocos2dx_ui_ListView_removeItem, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("scrollToItem", js_cocos2dx_ui_ListView_scrollToItem, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("pushBackDefaultItem", js_cocos2dx_ui_ListView_pushBackDefaultItem, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getMagneticAllowedOutOfBoundary", js_cocos2dx_ui_ListView_getMagneticAllowedOutOfBoundary, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getClosestItemToPosition", js_cocos2dx_ui_ListView_getClosestItemToPosition, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getRightmostItemInCurrentView", js_cocos2dx_ui_ListView_getRightmostItemInCurrentView, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getClosestItemToPositionInCurrentView", js_cocos2dx_ui_ListView_getClosestItemToPositionInCurrentView, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("refreshView", js_cocos2dx_ui_ListView_refreshView, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("setItemModel", js_cocos2dx_ui_ListView_setItemModel, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("requestRefreshView", js_cocos2dx_ui_ListView_requestRefreshView, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("insertCustomItem", js_cocos2dx_ui_ListView_insertCustomItem, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("ctor", js_cocos2dx_ui_ListView_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END @@ -9180,7 +9601,7 @@ bool js_cocos2dx_ui_Slider_setMaxPercent(JSContext *cx, uint32_t argc, jsval *vp cocos2d::ui::Slider* cobj = (cocos2d::ui::Slider *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_setMaxPercent : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_Slider_setMaxPercent : Error processing arguments"); cobj->setMaxPercent(arg0); @@ -9200,7 +9621,7 @@ bool js_cocos2dx_ui_Slider_setPercent(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::ui::Slider* cobj = (cocos2d::ui::Slider *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_setPercent : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_Slider_setPercent : Error processing arguments"); cobj->setPercent(arg0); @@ -9492,7 +9913,7 @@ bool js_cocos2dx_ui_Slider_setZoomScale(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::ui::Slider* cobj = (cocos2d::ui::Slider *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_setZoomScale : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_Slider_setZoomScale : Error processing arguments"); cobj->setZoomScale(arg0); @@ -9857,7 +10278,7 @@ bool js_cocos2dx_ui_UICCTextField_onTextFieldAttachWithIME(JSContext *cx, uint32 cocos2d::ui::UICCTextField* cobj = (cocos2d::ui::UICCTextField *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_UICCTextField_onTextFieldAttachWithIME : Invalid Native Object"); if (argc == 1) { - cocos2d::TextFieldTTF* arg0; + cocos2d::TextFieldTTF* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -9963,9 +10384,9 @@ bool js_cocos2dx_ui_UICCTextField_onTextFieldDeleteBackward(JSContext *cx, uint3 cocos2d::ui::UICCTextField* cobj = (cocos2d::ui::UICCTextField *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_UICCTextField_onTextFieldDeleteBackward : Invalid Native Object"); if (argc == 3) { - cocos2d::TextFieldTTF* arg0; - const char* arg1; - unsigned long arg2; + cocos2d::TextFieldTTF* arg0 = nullptr; + const char* arg1 = nullptr; + unsigned long arg2 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -10161,8 +10582,8 @@ bool js_cocos2dx_ui_UICCTextField_insertText(JSContext *cx, uint32_t argc, jsval cocos2d::ui::UICCTextField* cobj = (cocos2d::ui::UICCTextField *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_UICCTextField_insertText : Invalid Native Object"); if (argc == 2) { - const char* arg0; - unsigned long arg1; + const char* arg0 = nullptr; + unsigned long arg1 = 0; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); ok &= jsval_to_ulong(cx, args.get(1), &arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_UICCTextField_insertText : Error processing arguments"); @@ -10203,9 +10624,9 @@ bool js_cocos2dx_ui_UICCTextField_onTextFieldInsertText(JSContext *cx, uint32_t cocos2d::ui::UICCTextField* cobj = (cocos2d::ui::UICCTextField *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_UICCTextField_onTextFieldInsertText : Invalid Native Object"); if (argc == 3) { - cocos2d::TextFieldTTF* arg0; - const char* arg1; - unsigned long arg2; + cocos2d::TextFieldTTF* arg0 = nullptr; + const char* arg1 = nullptr; + unsigned long arg2 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -10237,7 +10658,7 @@ bool js_cocos2dx_ui_UICCTextField_onTextFieldDetachWithIME(JSContext *cx, uint32 cocos2d::ui::UICCTextField* cobj = (cocos2d::ui::UICCTextField *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_UICCTextField_onTextFieldDetachWithIME : Invalid Native Object"); if (argc == 1) { - cocos2d::TextFieldTTF* arg0; + cocos2d::TextFieldTTF* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -10339,7 +10760,7 @@ bool js_cocos2dx_ui_UICCTextField_setMaxLength(JSContext *cx, uint32_t argc, jsv cocos2d::ui::UICCTextField* cobj = (cocos2d::ui::UICCTextField *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_UICCTextField_setMaxLength : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_UICCTextField_setMaxLength : Error processing arguments"); cobj->setMaxLength(arg0); @@ -10377,7 +10798,7 @@ bool js_cocos2dx_ui_UICCTextField_create(JSContext *cx, uint32_t argc, jsval *vp if (argc == 3) { std::string arg0; std::string arg1; - double arg2; + double arg2 = 0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); ok &= jsval_to_std_string(cx, args.get(1), &arg1); ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); @@ -10581,7 +11002,7 @@ bool js_cocos2dx_ui_TextField_setPasswordStyleText(JSContext *cx, uint32_t argc, cocos2d::ui::TextField* cobj = (cocos2d::ui::TextField *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_TextField_setPasswordStyleText : Invalid Native Object"); if (argc == 1) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_TextField_setPasswordStyleText : Error processing arguments"); cobj->setPasswordStyleText(arg0); @@ -11027,7 +11448,7 @@ bool js_cocos2dx_ui_TextField_setFontSize(JSContext *cx, uint32_t argc, jsval *v cocos2d::ui::TextField* cobj = (cocos2d::ui::TextField *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_TextField_setFontSize : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_TextField_setFontSize : Error processing arguments"); cobj->setFontSize(arg0); @@ -11237,7 +11658,7 @@ bool js_cocos2dx_ui_TextField_setMaxLength(JSContext *cx, uint32_t argc, jsval * cocos2d::ui::TextField* cobj = (cocos2d::ui::TextField *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_TextField_setMaxLength : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_TextField_setMaxLength : Error processing arguments"); cobj->setMaxLength(arg0); @@ -11299,7 +11720,7 @@ bool js_cocos2dx_ui_TextField_create(JSContext *cx, uint32_t argc, jsval *vp) std::string arg1; ok &= jsval_to_std_string(cx, args.get(1), &arg1); if (!ok) { ok = true; break; } - int arg2; + int arg2 = 0; ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); if (!ok) { ok = true; break; } cocos2d::ui::TextField* ret = cocos2d::ui::TextField::create(arg0, arg1, arg2); @@ -11832,8 +12253,8 @@ bool js_cocos2dx_ui_PageView_addWidgetToPage(JSContext *cx, uint32_t argc, jsval cocos2d::ui::PageView* cobj = (cocos2d::ui::PageView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_addWidgetToPage : Invalid Native Object"); if (argc == 3) { - cocos2d::ui::Widget* arg0; - ssize_t arg1; + cocos2d::ui::Widget* arg0 = nullptr; + ssize_t arg1 = 0; bool arg2; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -11882,7 +12303,7 @@ bool js_cocos2dx_ui_PageView_setCurPageIndex(JSContext *cx, uint32_t argc, jsval cocos2d::ui::PageView* cobj = (cocos2d::ui::PageView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_setCurPageIndex : Invalid Native Object"); if (argc == 1) { - ssize_t arg0; + ssize_t arg0 = 0; ok &= jsval_to_ssize(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_PageView_setCurPageIndex : Error processing arguments"); cobj->setCurPageIndex(arg0); @@ -11902,7 +12323,7 @@ bool js_cocos2dx_ui_PageView_removePage(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::ui::PageView* cobj = (cocos2d::ui::PageView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_removePage : Invalid Native Object"); if (argc == 1) { - cocos2d::ui::Layout* arg0; + cocos2d::ui::Layout* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -11950,7 +12371,7 @@ bool js_cocos2dx_ui_PageView_setCustomScrollThreshold(JSContext *cx, uint32_t ar cocos2d::ui::PageView* cobj = (cocos2d::ui::PageView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_setCustomScrollThreshold : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_PageView_setCustomScrollThreshold : Error processing arguments"); cobj->setCustomScrollThreshold(arg0); @@ -11970,8 +12391,8 @@ bool js_cocos2dx_ui_PageView_insertPage(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::ui::PageView* cobj = (cocos2d::ui::PageView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_insertPage : Invalid Native Object"); if (argc == 2) { - cocos2d::ui::Layout* arg0; - int arg1; + cocos2d::ui::Layout* arg0 = nullptr; + int arg1 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -12018,7 +12439,7 @@ bool js_cocos2dx_ui_PageView_scrollToPage(JSContext *cx, uint32_t argc, jsval *v cocos2d::ui::PageView* cobj = (cocos2d::ui::PageView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_scrollToPage : Invalid Native Object"); if (argc == 1) { - ssize_t arg0; + ssize_t arg0 = 0; ok &= jsval_to_ssize(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_PageView_scrollToPage : Error processing arguments"); cobj->scrollToPage(arg0); @@ -12038,7 +12459,7 @@ bool js_cocos2dx_ui_PageView_getPage(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::ui::PageView* cobj = (cocos2d::ui::PageView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_getPage : Invalid Native Object"); if (argc == 1) { - ssize_t arg0; + ssize_t arg0 = 0; ok &= jsval_to_ssize(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_PageView_getPage : Error processing arguments"); cocos2d::ui::Layout* ret = cobj->getPage(arg0); @@ -12067,7 +12488,7 @@ bool js_cocos2dx_ui_PageView_removePageAtIndex(JSContext *cx, uint32_t argc, jsv cocos2d::ui::PageView* cobj = (cocos2d::ui::PageView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_removePageAtIndex : Invalid Native Object"); if (argc == 1) { - ssize_t arg0; + ssize_t arg0 = 0; ok &= jsval_to_ssize(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_PageView_removePageAtIndex : Error processing arguments"); cobj->removePageAtIndex(arg0); @@ -12121,7 +12542,7 @@ bool js_cocos2dx_ui_PageView_addPage(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::ui::PageView* cobj = (cocos2d::ui::PageView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_addPage : Invalid Native Object"); if (argc == 1) { - cocos2d::ui::Layout* arg0; + cocos2d::ui::Layout* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -12316,8 +12737,8 @@ bool js_cocos2dx_ui_Helper_getSubStringOfUTF8String(JSContext *cx, uint32_t argc bool ok = true; if (argc == 3) { std::string arg0; - unsigned long arg1; - unsigned long arg2; + unsigned long arg1 = 0; + unsigned long arg2 = 0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); ok &= jsval_to_ulong(cx, args.get(1), &arg1); ok &= jsval_to_ulong(cx, args.get(2), &arg2); @@ -12337,7 +12758,7 @@ bool js_cocos2dx_ui_Helper_convertBoundingBoxToScreen(JSContext *cx, uint32_t ar JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -12379,8 +12800,8 @@ bool js_cocos2dx_ui_Helper_seekActionWidgetByActionTag(JSContext *cx, uint32_t a JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - cocos2d::ui::Widget* arg0; - int arg1; + cocos2d::ui::Widget* arg0 = nullptr; + int arg1 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -12414,7 +12835,7 @@ bool js_cocos2dx_ui_Helper_seekWidgetByName(JSContext *cx, uint32_t argc, jsval JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - cocos2d::ui::Widget* arg0; + cocos2d::ui::Widget* arg0 = nullptr; std::string arg1; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -12449,8 +12870,8 @@ bool js_cocos2dx_ui_Helper_seekWidgetByTag(JSContext *cx, uint32_t argc, jsval * JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - cocos2d::ui::Widget* arg0; - int arg1; + cocos2d::ui::Widget* arg0 = nullptr; + int arg1 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -12504,7 +12925,7 @@ bool js_cocos2dx_ui_Helper_doLayout(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -12601,7 +13022,7 @@ bool js_cocos2dx_ui_RichElement_init(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::ui::RichElement* cobj = (cocos2d::ui::RichElement *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_RichElement_init : Invalid Native Object"); if (argc == 3) { - int arg0; + int arg0 = 0; cocos2d::Color3B arg1; uint16_t arg2; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); @@ -12733,12 +13154,12 @@ bool js_cocos2dx_ui_RichElementText_init(JSContext *cx, uint32_t argc, jsval *vp cocos2d::ui::RichElementText* cobj = (cocos2d::ui::RichElementText *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_RichElementText_init : Invalid Native Object"); if (argc == 6) { - int arg0; + int arg0 = 0; cocos2d::Color3B arg1; uint16_t arg2; std::string arg3; std::string arg4; - double arg5; + double arg5 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); ok &= jsval_to_cccolor3b(cx, args.get(1), &arg1); ok &= jsval_to_uint16(cx, args.get(2), &arg2); @@ -12761,12 +13182,12 @@ bool js_cocos2dx_ui_RichElementText_create(JSContext *cx, uint32_t argc, jsval * JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 6) { - int arg0; + int arg0 = 0; cocos2d::Color3B arg1; uint16_t arg2; std::string arg3; std::string arg4; - double arg5; + double arg5 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); ok &= jsval_to_cccolor3b(cx, args.get(1), &arg1); ok &= jsval_to_uint16(cx, args.get(2), &arg2); @@ -12911,7 +13332,7 @@ bool js_cocos2dx_ui_RichElementImage_init(JSContext *cx, uint32_t argc, jsval *v cocos2d::ui::RichElementImage* cobj = (cocos2d::ui::RichElementImage *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_RichElementImage_init : Invalid Native Object"); if (argc == 4) { - int arg0; + int arg0 = 0; cocos2d::Color3B arg1; uint16_t arg2; std::string arg3; @@ -12935,7 +13356,7 @@ bool js_cocos2dx_ui_RichElementImage_create(JSContext *cx, uint32_t argc, jsval JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 4) { - int arg0; + int arg0 = 0; cocos2d::Color3B arg1; uint16_t arg2; std::string arg3; @@ -13081,10 +13502,10 @@ bool js_cocos2dx_ui_RichElementCustomNode_init(JSContext *cx, uint32_t argc, jsv cocos2d::ui::RichElementCustomNode* cobj = (cocos2d::ui::RichElementCustomNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_RichElementCustomNode_init : Invalid Native Object"); if (argc == 4) { - int arg0; + int arg0 = 0; cocos2d::Color3B arg1; uint16_t arg2; - cocos2d::Node* arg3; + cocos2d::Node* arg3 = nullptr; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); ok &= jsval_to_cccolor3b(cx, args.get(1), &arg1); ok &= jsval_to_uint16(cx, args.get(2), &arg2); @@ -13113,10 +13534,10 @@ bool js_cocos2dx_ui_RichElementCustomNode_create(JSContext *cx, uint32_t argc, j JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 4) { - int arg0; + int arg0 = 0; cocos2d::Color3B arg1; uint16_t arg2; - cocos2d::Node* arg3; + cocos2d::Node* arg3 = nullptr; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); ok &= jsval_to_cccolor3b(cx, args.get(1), &arg1); ok &= jsval_to_uint16(cx, args.get(2), &arg2); @@ -13267,8 +13688,8 @@ bool js_cocos2dx_ui_RichText_insertElement(JSContext *cx, uint32_t argc, jsval * cocos2d::ui::RichText* cobj = (cocos2d::ui::RichText *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_RichText_insertElement : Invalid Native Object"); if (argc == 2) { - cocos2d::ui::RichElement* arg0; - int arg1; + cocos2d::ui::RichElement* arg0 = nullptr; + int arg1 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -13297,7 +13718,7 @@ bool js_cocos2dx_ui_RichText_pushBackElement(JSContext *cx, uint32_t argc, jsval cocos2d::ui::RichText* cobj = (cocos2d::ui::RichText *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_RichText_pushBackElement : Invalid Native Object"); if (argc == 1) { - cocos2d::ui::RichElement* arg0; + cocos2d::ui::RichElement* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -13325,7 +13746,7 @@ bool js_cocos2dx_ui_RichText_setVerticalSpace(JSContext *cx, uint32_t argc, jsva cocos2d::ui::RichText* cobj = (cocos2d::ui::RichText *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_RichText_setVerticalSpace : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_RichText_setVerticalSpace : Error processing arguments"); cobj->setVerticalSpace(arg0); @@ -13365,7 +13786,7 @@ bool js_cocos2dx_ui_RichText_removeElement(JSContext *cx, uint32_t argc, jsval * JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_RichText_removeElement : Invalid Native Object"); do { if (argc == 1) { - cocos2d::ui::RichElement* arg0; + cocos2d::ui::RichElement* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -13384,7 +13805,7 @@ bool js_cocos2dx_ui_RichText_removeElement(JSContext *cx, uint32_t argc, jsval * do { if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); if (!ok) { ok = true; break; } cobj->removeElement(arg0); @@ -14092,7 +14513,7 @@ bool js_cocos2dx_ui_Scale9Sprite_updateWithSprite(JSContext *cx, uint32_t argc, JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Scale9Sprite_updateWithSprite : Invalid Native Object"); do { if (argc == 6) { - cocos2d::Sprite* arg0; + cocos2d::Sprite* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -14127,7 +14548,7 @@ bool js_cocos2dx_ui_Scale9Sprite_updateWithSprite(JSContext *cx, uint32_t argc, do { if (argc == 4) { - cocos2d::Sprite* arg0; + cocos2d::Sprite* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -14327,7 +14748,7 @@ bool js_cocos2dx_ui_Scale9Sprite_setInsetBottom(JSContext *cx, uint32_t argc, js cocos2d::ui::Scale9Sprite* cobj = (cocos2d::ui::Scale9Sprite *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Scale9Sprite_setInsetBottom : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_Scale9Sprite_setInsetBottom : Error processing arguments"); cobj->setInsetBottom(arg0); @@ -14415,7 +14836,7 @@ bool js_cocos2dx_ui_Scale9Sprite_setInsetTop(JSContext *cx, uint32_t argc, jsval cocos2d::ui::Scale9Sprite* cobj = (cocos2d::ui::Scale9Sprite *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Scale9Sprite_setInsetTop : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_Scale9Sprite_setInsetTop : Error processing arguments"); cobj->setInsetTop(arg0); @@ -14439,7 +14860,7 @@ bool js_cocos2dx_ui_Scale9Sprite_init(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Scale9Sprite_init : Invalid Native Object"); do { if (argc == 3) { - cocos2d::Sprite* arg0; + cocos2d::Sprite* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -14466,7 +14887,7 @@ bool js_cocos2dx_ui_Scale9Sprite_init(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 4) { - cocos2d::Sprite* arg0; + cocos2d::Sprite* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -14495,7 +14916,7 @@ bool js_cocos2dx_ui_Scale9Sprite_init(JSContext *cx, uint32_t argc, jsval *vp) do { if (argc == 6) { - cocos2d::Sprite* arg0; + cocos2d::Sprite* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -14560,7 +14981,7 @@ bool js_cocos2dx_ui_Scale9Sprite_setSpriteFrame(JSContext *cx, uint32_t argc, js cocos2d::ui::Scale9Sprite* cobj = (cocos2d::ui::Scale9Sprite *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Scale9Sprite_setSpriteFrame : Invalid Native Object"); if (argc == 1) { - cocos2d::SpriteFrame* arg0; + cocos2d::SpriteFrame* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -14576,7 +14997,7 @@ bool js_cocos2dx_ui_Scale9Sprite_setSpriteFrame(JSContext *cx, uint32_t argc, js return true; } if (argc == 2) { - cocos2d::SpriteFrame* arg0; + cocos2d::SpriteFrame* arg0 = nullptr; cocos2d::Rect arg1; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -14830,7 +15251,7 @@ bool js_cocos2dx_ui_Scale9Sprite_setInsetLeft(JSContext *cx, uint32_t argc, jsva cocos2d::ui::Scale9Sprite* cobj = (cocos2d::ui::Scale9Sprite *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Scale9Sprite_setInsetLeft : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_Scale9Sprite_setInsetLeft : Error processing arguments"); cobj->setInsetLeft(arg0); @@ -14854,7 +15275,7 @@ bool js_cocos2dx_ui_Scale9Sprite_initWithSpriteFrame(JSContext *cx, uint32_t arg JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Scale9Sprite_initWithSpriteFrame : Invalid Native Object"); do { if (argc == 1) { - cocos2d::SpriteFrame* arg0; + cocos2d::SpriteFrame* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -14875,7 +15296,7 @@ bool js_cocos2dx_ui_Scale9Sprite_initWithSpriteFrame(JSContext *cx, uint32_t arg do { if (argc == 2) { - cocos2d::SpriteFrame* arg0; + cocos2d::SpriteFrame* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -14983,7 +15404,7 @@ bool js_cocos2dx_ui_Scale9Sprite_setInsetRight(JSContext *cx, uint32_t argc, jsv cocos2d::ui::Scale9Sprite* cobj = (cocos2d::ui::Scale9Sprite *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Scale9Sprite_setInsetRight : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_Scale9Sprite_setInsetRight : Error processing arguments"); cobj->setInsetRight(arg0); @@ -15167,7 +15588,7 @@ bool js_cocos2dx_ui_Scale9Sprite_createWithSpriteFrame(JSContext *cx, uint32_t a do { if (argc == 2) { - cocos2d::SpriteFrame* arg0; + cocos2d::SpriteFrame* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -15198,7 +15619,7 @@ bool js_cocos2dx_ui_Scale9Sprite_createWithSpriteFrame(JSContext *cx, uint32_t a do { if (argc == 1) { - cocos2d::SpriteFrame* arg0; + cocos2d::SpriteFrame* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -15398,7 +15819,7 @@ bool js_cocos2dx_ui_EditBox_setFontSize(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::ui::EditBox* cobj = (cocos2d::ui::EditBox *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_EditBox_setFontSize : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_EditBox_setFontSize : Error processing arguments"); cobj->setFontSize(arg0); @@ -15418,7 +15839,7 @@ bool js_cocos2dx_ui_EditBox_setPlaceholderFontName(JSContext *cx, uint32_t argc, cocos2d::ui::EditBox* cobj = (cocos2d::ui::EditBox *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_EditBox_setPlaceholderFontName : Invalid Native Object"); if (argc == 1) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_EditBox_setPlaceholderFontName : Error processing arguments"); cobj->setPlaceholderFontName(arg0); @@ -15456,7 +15877,7 @@ bool js_cocos2dx_ui_EditBox_setFontName(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::ui::EditBox* cobj = (cocos2d::ui::EditBox *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_EditBox_setFontName : Invalid Native Object"); if (argc == 1) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_EditBox_setFontName : Error processing arguments"); cobj->setFontName(arg0); @@ -15476,7 +15897,7 @@ bool js_cocos2dx_ui_EditBox_setText(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::ui::EditBox* cobj = (cocos2d::ui::EditBox *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_EditBox_setText : Invalid Native Object"); if (argc == 1) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_EditBox_setText : Error processing arguments"); cobj->setText(arg0); @@ -15496,7 +15917,7 @@ bool js_cocos2dx_ui_EditBox_setPlaceholderFontSize(JSContext *cx, uint32_t argc, cocos2d::ui::EditBox* cobj = (cocos2d::ui::EditBox *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_EditBox_setPlaceholderFontSize : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_EditBox_setPlaceholderFontSize : Error processing arguments"); cobj->setPlaceholderFontSize(arg0); @@ -15608,8 +16029,8 @@ bool js_cocos2dx_ui_EditBox_setPlaceholderFont(JSContext *cx, uint32_t argc, jsv cocos2d::ui::EditBox* cobj = (cocos2d::ui::EditBox *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_EditBox_setPlaceholderFont : Invalid Native Object"); if (argc == 2) { - const char* arg0; - int arg1; + const char* arg0 = nullptr; + int arg1 = 0; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_EditBox_setPlaceholderFont : Error processing arguments"); @@ -15637,7 +16058,7 @@ bool js_cocos2dx_ui_EditBox_initWithSizeAndBackgroundSprite(JSContext *cx, uint3 cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - cocos2d::ui::Scale9Sprite* arg1; + cocos2d::ui::Scale9Sprite* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -15703,7 +16124,7 @@ bool js_cocos2dx_ui_EditBox_setPlaceHolder(JSContext *cx, uint32_t argc, jsval * cocos2d::ui::EditBox* cobj = (cocos2d::ui::EditBox *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_EditBox_setPlaceHolder : Invalid Native Object"); if (argc == 1) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_EditBox_setPlaceHolder : Error processing arguments"); cobj->setPlaceHolder(arg0); @@ -15781,7 +16202,7 @@ bool js_cocos2dx_ui_EditBox_setMaxLength(JSContext *cx, uint32_t argc, jsval *vp cocos2d::ui::EditBox* cobj = (cocos2d::ui::EditBox *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_EditBox_setMaxLength : Invalid Native Object"); if (argc == 1) { - int arg0; + int arg0 = 0; ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_EditBox_setMaxLength : Error processing arguments"); cobj->setMaxLength(arg0); @@ -15801,8 +16222,8 @@ bool js_cocos2dx_ui_EditBox_setFont(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::ui::EditBox* cobj = (cocos2d::ui::EditBox *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_EditBox_setFont : Invalid Native Object"); if (argc == 2) { - const char* arg0; - int arg1; + const char* arg0 = nullptr; + int arg1 = 0; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_EditBox_setFont : Error processing arguments"); @@ -15872,7 +16293,7 @@ bool js_cocos2dx_ui_EditBox_create(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - cocos2d::ui::Scale9Sprite* arg1; + cocos2d::ui::Scale9Sprite* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -15902,7 +16323,7 @@ bool js_cocos2dx_ui_EditBox_create(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - cocos2d::ui::Scale9Sprite* arg1; + cocos2d::ui::Scale9Sprite* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -15913,7 +16334,7 @@ bool js_cocos2dx_ui_EditBox_create(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocos2d::ui::Scale9Sprite* arg2; + cocos2d::ui::Scale9Sprite* arg2 = nullptr; do { if (args.get(2).isNull()) { arg2 = nullptr; break; } if (!args.get(2).isObject()) { ok = false; break; } @@ -15943,7 +16364,7 @@ bool js_cocos2dx_ui_EditBox_create(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::Size arg0; ok &= jsval_to_ccsize(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } - cocos2d::ui::Scale9Sprite* arg1; + cocos2d::ui::Scale9Sprite* arg1 = nullptr; do { if (args.get(1).isNull()) { arg1 = nullptr; break; } if (!args.get(1).isObject()) { ok = false; break; } @@ -15954,7 +16375,7 @@ bool js_cocos2dx_ui_EditBox_create(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocos2d::ui::Scale9Sprite* arg2; + cocos2d::ui::Scale9Sprite* arg2 = nullptr; do { if (args.get(2).isNull()) { arg2 = nullptr; break; } if (!args.get(2).isObject()) { ok = false; break; } @@ -15965,7 +16386,7 @@ bool js_cocos2dx_ui_EditBox_create(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object"); } while (0); if (!ok) { ok = true; break; } - cocos2d::ui::Scale9Sprite* arg3; + cocos2d::ui::Scale9Sprite* arg3 = nullptr; do { if (args.get(3).isNull()) { arg3 = nullptr; break; } if (!args.get(3).isObject()) { ok = false; break; } @@ -16150,7 +16571,7 @@ bool js_cocos2dx_ui_LayoutComponent_setPercentWidth(JSContext *cx, uint32_t argc cocos2d::ui::LayoutComponent* cobj = (cocos2d::ui::LayoutComponent *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_LayoutComponent_setPercentWidth : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_LayoutComponent_setPercentWidth : Error processing arguments"); cobj->setPercentWidth(arg0); @@ -16376,7 +16797,7 @@ bool js_cocos2dx_ui_LayoutComponent_setSizeWidth(JSContext *cx, uint32_t argc, j cocos2d::ui::LayoutComponent* cobj = (cocos2d::ui::LayoutComponent *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_LayoutComponent_setSizeWidth : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_LayoutComponent_setSizeWidth : Error processing arguments"); cobj->setSizeWidth(arg0); @@ -16470,7 +16891,7 @@ bool js_cocos2dx_ui_LayoutComponent_setLeftMargin(JSContext *cx, uint32_t argc, cocos2d::ui::LayoutComponent* cobj = (cocos2d::ui::LayoutComponent *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_LayoutComponent_setLeftMargin : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_LayoutComponent_setLeftMargin : Error processing arguments"); cobj->setLeftMargin(arg0); @@ -16582,7 +17003,7 @@ bool js_cocos2dx_ui_LayoutComponent_setTopMargin(JSContext *cx, uint32_t argc, j cocos2d::ui::LayoutComponent* cobj = (cocos2d::ui::LayoutComponent *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_LayoutComponent_setTopMargin : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_LayoutComponent_setTopMargin : Error processing arguments"); cobj->setTopMargin(arg0); @@ -16638,7 +17059,7 @@ bool js_cocos2dx_ui_LayoutComponent_setPositionPercentY(JSContext *cx, uint32_t cocos2d::ui::LayoutComponent* cobj = (cocos2d::ui::LayoutComponent *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_LayoutComponent_setPositionPercentY : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_LayoutComponent_setPositionPercentY : Error processing arguments"); cobj->setPositionPercentY(arg0); @@ -16658,7 +17079,7 @@ bool js_cocos2dx_ui_LayoutComponent_setPositionPercentX(JSContext *cx, uint32_t cocos2d::ui::LayoutComponent* cobj = (cocos2d::ui::LayoutComponent *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_LayoutComponent_setPositionPercentX : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_LayoutComponent_setPositionPercentX : Error processing arguments"); cobj->setPositionPercentX(arg0); @@ -16678,7 +17099,7 @@ bool js_cocos2dx_ui_LayoutComponent_setRightMargin(JSContext *cx, uint32_t argc, cocos2d::ui::LayoutComponent* cobj = (cocos2d::ui::LayoutComponent *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_LayoutComponent_setRightMargin : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_LayoutComponent_setRightMargin : Error processing arguments"); cobj->setRightMargin(arg0); @@ -16716,7 +17137,7 @@ bool js_cocos2dx_ui_LayoutComponent_setPercentHeight(JSContext *cx, uint32_t arg cocos2d::ui::LayoutComponent* cobj = (cocos2d::ui::LayoutComponent *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_LayoutComponent_setPercentHeight : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_LayoutComponent_setPercentHeight : Error processing arguments"); cobj->setPercentHeight(arg0); @@ -16852,7 +17273,7 @@ bool js_cocos2dx_ui_LayoutComponent_setSizeHeight(JSContext *cx, uint32_t argc, cocos2d::ui::LayoutComponent* cobj = (cocos2d::ui::LayoutComponent *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_LayoutComponent_setSizeHeight : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_LayoutComponent_setSizeHeight : Error processing arguments"); cobj->setSizeHeight(arg0); @@ -17020,7 +17441,7 @@ bool js_cocos2dx_ui_LayoutComponent_setBottomMargin(JSContext *cx, uint32_t argc cocos2d::ui::LayoutComponent* cobj = (cocos2d::ui::LayoutComponent *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_LayoutComponent_setBottomMargin : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_LayoutComponent_setBottomMargin : Error processing arguments"); cobj->setBottomMargin(arg0); @@ -17077,7 +17498,7 @@ bool js_cocos2dx_ui_LayoutComponent_bindLayoutComponent(JSContext *cx, uint32_t JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 1) { - cocos2d::Node* arg0; + cocos2d::Node* arg0 = nullptr; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -17332,7 +17753,7 @@ bool js_cocos2dx_ui_ScrollViewBar_setAutoHideTime(JSContext *cx, uint32_t argc, cocos2d::ui::ScrollViewBar* cobj = (cocos2d::ui::ScrollViewBar *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ScrollViewBar_setAutoHideTime : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_ScrollViewBar_setAutoHideTime : Error processing arguments"); cobj->setAutoHideTime(arg0); @@ -17426,7 +17847,7 @@ bool js_cocos2dx_ui_ScrollViewBar_setWidth(JSContext *cx, uint32_t argc, jsval * cocos2d::ui::ScrollViewBar* cobj = (cocos2d::ui::ScrollViewBar *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ScrollViewBar_setWidth : Invalid Native Object"); if (argc == 1) { - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_ScrollViewBar_setWidth : Error processing arguments"); cobj->setWidth(arg0); @@ -17442,7 +17863,7 @@ bool js_cocos2dx_ui_ScrollViewBar_create(JSContext *cx, uint32_t argc, jsval *vp JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - cocos2d::ui::ScrollView* arg0; + cocos2d::ui::ScrollView* arg0 = nullptr; cocos2d::ui::ScrollView::Direction arg1; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -17476,7 +17897,7 @@ bool js_cocos2dx_ui_ScrollViewBar_constructor(JSContext *cx, uint32_t argc, jsva { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cocos2d::ui::ScrollView* arg0; + cocos2d::ui::ScrollView* arg0 = nullptr; cocos2d::ui::ScrollView::Direction arg1; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -17517,7 +17938,7 @@ bool js_cocos2dx_ui_ScrollViewBar_constructor(JSContext *cx, uint32_t argc, jsva JS::CallArgs args = JS::CallArgsFromVp(argc, vp); JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); bool ok = true; - cocos2d::ui::ScrollView* arg0; + cocos2d::ui::ScrollView* arg0 = nullptr; cocos2d::ui::ScrollView::Direction arg1; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.hpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.hpp index d7a4847077..734ab0560a 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.hpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.hpp @@ -183,9 +183,11 @@ bool js_cocos2dx_ui_Button_getTitleText(JSContext *cx, uint32_t argc, jsval *vp) bool js_cocos2dx_ui_Button_setTitleFontSize(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Button_setScale9Enabled(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Button_getTitleRenderer(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Button_getRendererClicked(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Button_getZoomScale(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Button_getCapInsetsDisabledRenderer(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Button_setTitleColor(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Button_getRendererDisabled(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Button_setCapInsetsDisabledRenderer(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Button_setCapInsets(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Button_loadTextureDisabled(JSContext *cx, uint32_t argc, jsval *vp); @@ -202,6 +204,7 @@ bool js_cocos2dx_ui_Button_isScale9Enabled(JSContext *cx, uint32_t argc, jsval * bool js_cocos2dx_ui_Button_loadTextureNormal(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Button_setCapInsetsPressedRenderer(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Button_getTitleFontSize(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Button_getRendererNormal(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Button_getTitleFontName(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Button_getTitleColor(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Button_setPressedActionEnabled(JSContext *cx, uint32_t argc, jsval *vp); @@ -433,23 +436,36 @@ bool js_cocos2dx_ui_ListView_constructor(JSContext *cx, uint32_t argc, jsval *vp void js_cocos2dx_ui_ListView_finalize(JSContext *cx, JSObject *obj); void js_register_cocos2dx_ui_ListView(JSContext *cx, JS::HandleObject global); void register_all_cocos2dx_ui(JSContext* cx, JS::HandleObject obj); -bool js_cocos2dx_ui_ListView_getIndex(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ui_ListView_removeAllItems(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_ListView_setGravity(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ui_ListView_pushBackCustomItem(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ui_ListView_getItems(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ui_ListView_removeItem(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ui_ListView_getCurSelectedIndex(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ui_ListView_insertDefaultItem(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ui_ListView_requestRefreshView(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ui_ListView_setItemsMargin(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ui_ListView_refreshView(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_ListView_removeLastItem(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_ListView_getCenterItemInCurrentView(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_ListView_getCurSelectedIndex(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_ListView_getItemsMargin(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ui_ListView_getItem(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ui_ListView_setItemModel(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_ListView_setMagneticType(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_ListView_refreshViewIfNecessary(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_ListView_getIndex(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_ListView_pushBackCustomItem(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_ListView_insertDefaultItem(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_ListView_setMagneticAllowedOutOfBoundary(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_ListView_doLayout(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_ListView_getTopmostItemInCurrentView(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_ListView_removeAllItems(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_ListView_getBottommostItemInCurrentView(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_ListView_getItems(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_ListView_getLeftmostItemInCurrentView(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_ListView_setItemsMargin(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_ListView_getMagneticType(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_ListView_getItem(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_ListView_removeItem(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_ListView_scrollToItem(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_ListView_pushBackDefaultItem(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_ListView_getMagneticAllowedOutOfBoundary(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_ListView_getClosestItemToPosition(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_ListView_getRightmostItemInCurrentView(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_ListView_getClosestItemToPositionInCurrentView(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_ListView_refreshView(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_ListView_setItemModel(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_ListView_requestRefreshView(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_ListView_insertCustomItem(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_ListView_create(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_ListView_createInstance(JSContext *cx, uint32_t argc, jsval *vp); diff --git a/cocos/scripting/js-bindings/manual/ScriptingCore.cpp b/cocos/scripting/js-bindings/manual/ScriptingCore.cpp index c416671d3c..6da639bc6d 100644 --- a/cocos/scripting/js-bindings/manual/ScriptingCore.cpp +++ b/cocos/scripting/js-bindings/manual/ScriptingCore.cpp @@ -33,6 +33,7 @@ #include "cocos2d_specifics.hpp" #include "jsb_cocos2dx_auto.hpp" #include "js_bindings_config.h" + // for debug socket #if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) #include @@ -452,6 +453,14 @@ static const JSClass global_class = { JS_GlobalObjectTraceHook }; +ScriptingCore* ScriptingCore::getInstance() +{ + static ScriptingCore* instance = nullptr; + if (instance == nullptr) + instance = new ScriptingCore(); + + return instance; +} ScriptingCore::ScriptingCore() : _rt(nullptr) @@ -985,6 +994,35 @@ bool ScriptingCore::isFunctionOverridedInJS(JS::HandleObject obj, const std::str return false; } +int ScriptingCore::handleActionEvent(void* data) +{ + if (NULL == data) + return 0; + + ActionObjectScriptData* actionObjectScriptData = static_cast(data); + if (NULL == actionObjectScriptData->nativeObject || NULL == actionObjectScriptData->eventType) + return 0; + + Action* actionObject = static_cast(actionObjectScriptData->nativeObject); + int eventType = *((int*)(actionObjectScriptData->eventType)); + + js_proxy_t * p = jsb_get_native_proxy(actionObject); + if (!p) return 0; + + int ret = 0; + JS::RootedValue retval(_cx); + + if (eventType == kActionUpdate) + { + if (isFunctionOverridedInJS(JS::RootedObject(_cx, p->obj.get()), "update", js_cocos2dx_Action_update)) + { + jsval dataVal = DOUBLE_TO_JSVAL(*((float *)actionObjectScriptData->param)); + ret = executeFunctionWithOwner(OBJECT_TO_JSVAL(p->obj), "update", 1, &dataVal, &retval); + } + } + return ret; +} + int ScriptingCore::handleNodeEvent(void* data) { if (NULL == data) @@ -1456,6 +1494,11 @@ int ScriptingCore::sendEvent(ScriptEvent* evt) return handleNodeEvent(evt->data); } break; + case kScriptActionEvent: + { + return handleActionEvent(evt->data); + } + break; case kMenuClickedEvent: break; case kTouchEvent: diff --git a/cocos/scripting/js-bindings/manual/ScriptingCore.h b/cocos/scripting/js-bindings/manual/ScriptingCore.h index 6d9565887f..4bc565c8ef 100644 --- a/cocos/scripting/js-bindings/manual/ScriptingCore.h +++ b/cocos/scripting/js-bindings/manual/ScriptingCore.h @@ -39,7 +39,7 @@ #include #include -#define ENGINE_VERSION "Cocos2d-JS v3.8 RC0" +#define ENGINE_VERSION "Cocos2d-JS v3.8" void js_log(const char *format, ...); @@ -70,13 +70,7 @@ private: public: ~ScriptingCore(); - static ScriptingCore *getInstance() { - static ScriptingCore* pInstance = NULL; - if (pInstance == NULL) { - pInstance = new ScriptingCore(); - } - return pInstance; - }; + static ScriptingCore *getInstance(); virtual cocos2d::ccScriptType getScriptType() { return cocos2d::kScriptTypeJavascript; }; @@ -263,6 +257,7 @@ private: public: int handleNodeEvent(void* data); + int handleActionEvent(void* data); int handleComponentEvent(void* data); bool handleTouchesEvent(void* nativeObj, cocos2d::EventTouch::EventCode eventCode, const std::vector& touches, cocos2d::Event* event); diff --git a/cocos/scripting/js-bindings/manual/chipmunk/js_bindings_chipmunk_auto_classes.cpp b/cocos/scripting/js-bindings/manual/chipmunk/js_bindings_chipmunk_auto_classes.cpp index df9c30a684..6d4813fa5a 100644 --- a/cocos/scripting/js-bindings/manual/chipmunk/js_bindings_chipmunk_auto_classes.cpp +++ b/cocos/scripting/js-bindings/manual/chipmunk/js_bindings_chipmunk_auto_classes.cpp @@ -82,7 +82,7 @@ bool JSB_cpConstraint_getA(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpConstraint* arg0 = (cpConstraint*) proxy->handle; - cpBody* ret_val; + cpBody* ret_val = nullptr; ret_val = cpConstraintGetA((cpConstraint*)arg0 ); @@ -100,7 +100,7 @@ bool JSB_cpConstraint_getB(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpConstraint* arg0 = (cpConstraint*) proxy->handle; - cpBody* ret_val; + cpBody* ret_val = nullptr; ret_val = cpConstraintGetB((cpConstraint*)arg0 ); @@ -118,7 +118,7 @@ bool JSB_cpConstraint_getErrorBias(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpConstraint* arg0 = (cpConstraint*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpConstraintGetErrorBias((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -133,7 +133,7 @@ bool JSB_cpConstraint_getImpulse(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpConstraint* arg0 = (cpConstraint*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpConstraintGetImpulse((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -148,7 +148,7 @@ bool JSB_cpConstraint_getMaxBias(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpConstraint* arg0 = (cpConstraint*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpConstraintGetMaxBias((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -163,7 +163,7 @@ bool JSB_cpConstraint_getMaxForce(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpConstraint* arg0 = (cpConstraint*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpConstraintGetMaxForce((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -178,7 +178,7 @@ bool JSB_cpConstraint_getSpace(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpConstraint* arg0 = (cpConstraint*) proxy->handle; - cpSpace* ret_val; + cpSpace* ret_val = nullptr; ret_val = cpConstraintGetSpace((cpConstraint*)arg0 ); @@ -304,7 +304,7 @@ bool JSB_cpGrooveJoint_constructor(JSContext *cx, uint32_t argc, jsval *vp) JSObject *jsobj = JS_NewObject(cx, JSB_cpGrooveJoint_class, JS::RootedObject(cx, JSB_cpGrooveJoint_object), JS::NullPtr()); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; cpBody* arg1; cpVect arg2; cpVect arg3; cpVect arg4; + cpBody* arg0 = nullptr; cpBody* arg1 = nullptr; cpVect arg2; cpVect arg3; cpVect arg4; ok &= jsval_to_c_class( cx, args.get(0), (void**)&arg0, NULL ); ok &= jsval_to_c_class( cx, args.get(1), (void**)&arg1, NULL ); @@ -501,7 +501,7 @@ bool JSB_cpSimpleMotor_constructor(JSContext *cx, uint32_t argc, jsval *vp) JSObject *jsobj = JS_NewObject(cx, JSB_cpSimpleMotor_class, JS::RootedObject(cx, JSB_cpSimpleMotor_object), JS::NullPtr()); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; cpBody* arg1; double arg2; + cpBody* arg0 = nullptr; cpBody* arg1 = nullptr; double arg2 = 0; ok &= jsval_to_c_class( cx, args.get(0), (void**)&arg0, NULL ); ok &= jsval_to_c_class( cx, args.get(1), (void**)&arg1, NULL ); @@ -540,7 +540,7 @@ bool JSB_cpSimpleMotor_getRate(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpSimpleMotor* arg0 = (cpSimpleMotor*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpSimpleMotorGetRate((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -613,7 +613,7 @@ bool JSB_cpPivotJoint_constructor(JSContext *cx, uint32_t argc, jsval *vp) JSObject *jsobj = JS_NewObject(cx, JSB_cpPivotJoint_class, JS::RootedObject(cx, JSB_cpPivotJoint_object), JS::NullPtr()); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; cpBody* arg1; cpVect arg2; cpVect arg3; void *ret_val; + cpBody* arg0 = nullptr; cpBody* arg1 = nullptr; cpVect arg2; cpVect arg3; void *ret_val = nullptr; ok &= jsval_to_c_class( cx, args.get(0), (void**)&arg0, NULL ); ok &= jsval_to_c_class( cx, args.get(1), (void**)&arg1, NULL ); @@ -773,7 +773,7 @@ bool JSB_cpPinJoint_constructor(JSContext *cx, uint32_t argc, jsval *vp) JSObject *jsobj = JS_NewObject(cx, JSB_cpPinJoint_class, JS::RootedObject(cx, JSB_cpPinJoint_object), JS::NullPtr()); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; cpBody* arg1; cpVect arg2; cpVect arg3; + cpBody* arg0 = nullptr; cpBody* arg1 = nullptr; cpVect arg2; cpVect arg3; ok &= jsval_to_c_class( cx, args.get(0), (void**)&arg0, NULL ); ok &= jsval_to_c_class( cx, args.get(1), (void**)&arg1, NULL ); @@ -849,7 +849,7 @@ bool JSB_cpPinJoint_getDist(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpPinJoint* arg0 = (cpPinJoint*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpPinJointGetDist((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -906,7 +906,7 @@ bool JSB_cpPinJoint_setDist(JSContext *cx, uint32_t argc, jsval *vp) { cpPinJoint* arg0 = (cpPinJoint*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -966,7 +966,7 @@ bool JSB_cpSlideJoint_constructor(JSContext *cx, uint32_t argc, jsval *vp) JSObject *jsobj = JS_NewObject(cx, JSB_cpSlideJoint_class, JS::RootedObject(cx, JSB_cpSlideJoint_object), JS::NullPtr()); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; cpBody* arg1; cpVect arg2; cpVect arg3; double arg4; double arg5; + cpBody* arg0 = nullptr; cpBody* arg1 = nullptr; cpVect arg2; cpVect arg3; double arg4 = 0; double arg5 = 0; ok &= jsval_to_c_class( cx, args.get(0), (void**)&arg0, NULL ); ok &= jsval_to_c_class( cx, args.get(1), (void**)&arg1, NULL ); @@ -1044,7 +1044,7 @@ bool JSB_cpSlideJoint_getMax(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpSlideJoint* arg0 = (cpSlideJoint*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpSlideJointGetMax((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -1059,7 +1059,7 @@ bool JSB_cpSlideJoint_getMin(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpSlideJoint* arg0 = (cpSlideJoint*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpSlideJointGetMin((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -1116,7 +1116,7 @@ bool JSB_cpSlideJoint_setMax(JSContext *cx, uint32_t argc, jsval *vp) { cpSlideJoint* arg0 = (cpSlideJoint*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -1136,7 +1136,7 @@ bool JSB_cpSlideJoint_setMin(JSContext *cx, uint32_t argc, jsval *vp) { cpSlideJoint* arg0 = (cpSlideJoint*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -1198,7 +1198,7 @@ bool JSB_cpGearJoint_constructor(JSContext *cx, uint32_t argc, jsval *vp) JSObject *jsobj = JS_NewObject(cx, JSB_cpGearJoint_class, JS::RootedObject(cx, JSB_cpGearJoint_object), JS::NullPtr()); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; cpBody* arg1; double arg2; double arg3; + cpBody* arg0 = nullptr; cpBody* arg1 = nullptr; double arg2 = 0; double arg3 = 0; ok &= jsval_to_c_class( cx, args.get(0), (void**)&arg0, NULL ); ok &= jsval_to_c_class( cx, args.get(1), (void**)&arg1, NULL ); @@ -1238,7 +1238,7 @@ bool JSB_cpGearJoint_getPhase(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpGearJoint* arg0 = (cpGearJoint*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpGearJointGetPhase((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -1253,7 +1253,7 @@ bool JSB_cpGearJoint_getRatio(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpGearJoint* arg0 = (cpGearJoint*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpGearJointGetRatio((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -1270,7 +1270,7 @@ bool JSB_cpGearJoint_setPhase(JSContext *cx, uint32_t argc, jsval *vp) { cpGearJoint* arg0 = (cpGearJoint*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -1290,7 +1290,7 @@ bool JSB_cpGearJoint_setRatio(JSContext *cx, uint32_t argc, jsval *vp) { cpGearJoint* arg0 = (cpGearJoint*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -1348,7 +1348,7 @@ bool JSB_cpDampedRotarySpring_constructor(JSContext *cx, uint32_t argc, jsval *v JSObject *jsobj = JS_NewObject(cx, JSB_cpDampedRotarySpring_class, JS::RootedObject(cx, JSB_cpDampedRotarySpring_object), JS::NullPtr()); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; cpBody* arg1; double arg2; double arg3; double arg4; + cpBody* arg0 = nullptr; cpBody* arg1 = nullptr; double arg2 = 0; double arg3 = 0; double arg4 = 0; ok &= jsval_to_c_class( cx, args.get(0), (void**)&arg0, NULL ); ok &= jsval_to_c_class( cx, args.get(1), (void**)&arg1, NULL ); @@ -1389,7 +1389,7 @@ bool JSB_cpDampedRotarySpring_getDamping(JSContext *cx, uint32_t argc, jsval *vp JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpDampedRotarySpring* arg0 = (cpDampedRotarySpring*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpDampedRotarySpringGetDamping((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -1404,7 +1404,7 @@ bool JSB_cpDampedRotarySpring_getRestAngle(JSContext *cx, uint32_t argc, jsval * JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpDampedRotarySpring* arg0 = (cpDampedRotarySpring*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpDampedRotarySpringGetRestAngle((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -1419,7 +1419,7 @@ bool JSB_cpDampedRotarySpring_getStiffness(JSContext *cx, uint32_t argc, jsval * JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpDampedRotarySpring* arg0 = (cpDampedRotarySpring*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpDampedRotarySpringGetStiffness((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -1436,7 +1436,7 @@ bool JSB_cpDampedRotarySpring_setDamping(JSContext *cx, uint32_t argc, jsval *vp cpDampedRotarySpring* arg0 = (cpDampedRotarySpring*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -1456,7 +1456,7 @@ bool JSB_cpDampedRotarySpring_setRestAngle(JSContext *cx, uint32_t argc, jsval * cpDampedRotarySpring* arg0 = (cpDampedRotarySpring*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -1476,7 +1476,7 @@ bool JSB_cpDampedRotarySpring_setStiffness(JSContext *cx, uint32_t argc, jsval * cpDampedRotarySpring* arg0 = (cpDampedRotarySpring*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -1536,7 +1536,7 @@ bool JSB_cpDampedSpring_constructor(JSContext *cx, uint32_t argc, jsval *vp) JSObject *jsobj = JS_NewObject(cx, JSB_cpDampedSpring_class, JS::RootedObject(cx, JSB_cpDampedSpring_object), JS::NullPtr()); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; cpBody* arg1; cpVect arg2; cpVect arg3; double arg4; double arg5; double arg6; + cpBody* arg0 = nullptr; cpBody* arg1 = nullptr; cpVect arg2; cpVect arg3; double arg4 = 0; double arg5 = 0; double arg6 = 0; ok &= jsval_to_c_class( cx, args.get(0), (void**)&arg0, NULL ); ok &= jsval_to_c_class( cx, args.get(1), (void**)&arg1, NULL ); @@ -1615,7 +1615,7 @@ bool JSB_cpDampedSpring_getDamping(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpDampedSpring* arg0 = (cpDampedSpring*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpDampedSpringGetDamping((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -1630,7 +1630,7 @@ bool JSB_cpDampedSpring_getRestLength(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpDampedSpring* arg0 = (cpDampedSpring*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpDampedSpringGetRestLength((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -1645,7 +1645,7 @@ bool JSB_cpDampedSpring_getStiffness(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpDampedSpring* arg0 = (cpDampedSpring*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpDampedSpringGetStiffness((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -1702,7 +1702,7 @@ bool JSB_cpDampedSpring_setDamping(JSContext *cx, uint32_t argc, jsval *vp) { cpDampedSpring* arg0 = (cpDampedSpring*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -1722,7 +1722,7 @@ bool JSB_cpDampedSpring_setRestLength(JSContext *cx, uint32_t argc, jsval *vp) { cpDampedSpring* arg0 = (cpDampedSpring*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -1742,7 +1742,7 @@ bool JSB_cpDampedSpring_setStiffness(JSContext *cx, uint32_t argc, jsval *vp) { cpDampedSpring* arg0 = (cpDampedSpring*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -1806,7 +1806,7 @@ bool JSB_cpRatchetJoint_constructor(JSContext *cx, uint32_t argc, jsval *vp) JSObject *jsobj = JS_NewObject(cx, JSB_cpRatchetJoint_class, JS::RootedObject(cx, JSB_cpRatchetJoint_object), JS::NullPtr()); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; cpBody* arg1; double arg2; double arg3; + cpBody* arg0 = nullptr; cpBody* arg1 = nullptr; double arg2 = 0; double arg3 = 0; ok &= jsval_to_c_class( cx, args.get(0), (void**)&arg0, NULL ); ok &= jsval_to_c_class( cx, args.get(1), (void**)&arg1, NULL ); @@ -1846,7 +1846,7 @@ bool JSB_cpRatchetJoint_getAngle(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpRatchetJoint* arg0 = (cpRatchetJoint*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpRatchetJointGetAngle((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -1861,7 +1861,7 @@ bool JSB_cpRatchetJoint_getPhase(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpRatchetJoint* arg0 = (cpRatchetJoint*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpRatchetJointGetPhase((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -1876,7 +1876,7 @@ bool JSB_cpRatchetJoint_getRatchet(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpRatchetJoint* arg0 = (cpRatchetJoint*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpRatchetJointGetRatchet((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -1893,7 +1893,7 @@ bool JSB_cpRatchetJoint_setAngle(JSContext *cx, uint32_t argc, jsval *vp) { cpRatchetJoint* arg0 = (cpRatchetJoint*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -1913,7 +1913,7 @@ bool JSB_cpRatchetJoint_setPhase(JSContext *cx, uint32_t argc, jsval *vp) { cpRatchetJoint* arg0 = (cpRatchetJoint*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -1933,7 +1933,7 @@ bool JSB_cpRatchetJoint_setRatchet(JSContext *cx, uint32_t argc, jsval *vp) { cpRatchetJoint* arg0 = (cpRatchetJoint*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -1993,7 +1993,7 @@ bool JSB_cpRotaryLimitJoint_constructor(JSContext *cx, uint32_t argc, jsval *vp) JSObject *jsobj = JS_NewObject(cx, JSB_cpRotaryLimitJoint_class, JS::RootedObject(cx, JSB_cpRotaryLimitJoint_object), JS::NullPtr()); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; cpBody* arg1; double arg2; double arg3; + cpBody* arg0 = nullptr; cpBody* arg1 = nullptr; double arg2 = 0; double arg3 = 0; ok &= jsval_to_c_class( cx, args.get(0), (void**)&arg0, NULL ); ok &= jsval_to_c_class( cx, args.get(1), (void**)&arg1, NULL ); @@ -2033,7 +2033,7 @@ bool JSB_cpRotaryLimitJoint_getMax(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpRotaryLimitJoint* arg0 = (cpRotaryLimitJoint*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpRotaryLimitJointGetMax((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -2048,7 +2048,7 @@ bool JSB_cpRotaryLimitJoint_getMin(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpRotaryLimitJoint* arg0 = (cpRotaryLimitJoint*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpRotaryLimitJointGetMin((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -2065,7 +2065,7 @@ bool JSB_cpRotaryLimitJoint_setMax(JSContext *cx, uint32_t argc, jsval *vp) { cpRotaryLimitJoint* arg0 = (cpRotaryLimitJoint*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -2085,7 +2085,7 @@ bool JSB_cpRotaryLimitJoint_setMin(JSContext *cx, uint32_t argc, jsval *vp) { cpRotaryLimitJoint* arg0 = (cpRotaryLimitJoint*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -2169,7 +2169,7 @@ bool JSB_cpArbiter_getCount(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpArbiter* arg0 = (cpArbiter*) proxy->handle; - int ret_val; + int ret_val = 0; ret_val = cpArbiterGetCount((cpArbiter*)arg0 ); args.rval().set(INT_TO_JSVAL((int32_t)ret_val)); @@ -2186,11 +2186,11 @@ bool JSB_cpArbiter_getDepth(JSContext *cx, uint32_t argc, jsval *vp) { cpArbiter* arg0 = (cpArbiter*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - int32_t arg1; + int32_t arg1 = 0; ok &= jsval_to_int32( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpArbiterGetDepth((cpArbiter*)arg0 , (int)arg1 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -2205,7 +2205,7 @@ bool JSB_cpArbiter_getElasticity(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpArbiter* arg0 = (cpArbiter*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpArbiterGetElasticity((cpArbiter*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -2220,7 +2220,7 @@ bool JSB_cpArbiter_getFriction(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpArbiter* arg0 = (cpArbiter*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpArbiterGetFriction((cpArbiter*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -2237,7 +2237,7 @@ bool JSB_cpArbiter_getNormal(JSContext *cx, uint32_t argc, jsval *vp) { cpArbiter* arg0 = (cpArbiter*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - int32_t arg1; + int32_t arg1 = 0; ok &= jsval_to_int32( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -2261,7 +2261,7 @@ bool JSB_cpArbiter_getPoint(JSContext *cx, uint32_t argc, jsval *vp) { cpArbiter* arg0 = (cpArbiter*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - int32_t arg1; + int32_t arg1 = 0; ok &= jsval_to_int32( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -2332,7 +2332,7 @@ bool JSB_cpArbiter_setElasticity(JSContext *cx, uint32_t argc, jsval *vp) { cpArbiter* arg0 = (cpArbiter*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -2352,7 +2352,7 @@ bool JSB_cpArbiter_setFriction(JSContext *cx, uint32_t argc, jsval *vp) { cpArbiter* arg0 = (cpArbiter*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -2426,7 +2426,7 @@ bool JSB_cpArbiter_totalKE(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpArbiter* arg0 = (cpArbiter*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpArbiterTotalKE((cpArbiter*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -2577,7 +2577,7 @@ bool JSB_cpSpace_activateShapesTouchingShape(JSContext *cx, uint32_t argc, jsval cpSpace* arg0 = (cpSpace*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg1; + cpShape* arg1 = nullptr; ok &= jsval_to_c_class( cx, args.get(0), (void**)&arg1, NULL ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -2597,7 +2597,7 @@ bool JSB_cpSpace_containsBody(JSContext *cx, uint32_t argc, jsval *vp) { cpSpace* arg0 = (cpSpace*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg1; + cpBody* arg1 = nullptr; ok &= jsval_to_c_class( cx, args.get(0), (void**)&arg1, NULL ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -2618,7 +2618,7 @@ bool JSB_cpSpace_containsConstraint(JSContext *cx, uint32_t argc, jsval *vp) { cpSpace* arg0 = (cpSpace*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg1; + cpConstraint* arg1 = nullptr; ok &= jsval_to_c_class( cx, args.get(0), (void**)&arg1, NULL ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -2639,7 +2639,7 @@ bool JSB_cpSpace_containsShape(JSContext *cx, uint32_t argc, jsval *vp) { cpSpace* arg0 = (cpSpace*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg1; + cpShape* arg1 = nullptr; ok &= jsval_to_c_class( cx, args.get(0), (void**)&arg1, NULL ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -2672,7 +2672,7 @@ bool JSB_cpSpace_getCollisionBias(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpSpace* arg0 = (cpSpace*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpSpaceGetCollisionBias((cpSpace*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -2687,7 +2687,7 @@ bool JSB_cpSpace_getCollisionPersistence(JSContext *cx, uint32_t argc, jsval *vp JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpSpace* arg0 = (cpSpace*) proxy->handle; - cpTimestamp ret_val; + cpTimestamp ret_val = 0; ret_val = cpSpaceGetCollisionPersistence((cpSpace*)arg0 ); args.rval().set(UINT_TO_JSVAL((uint32_t)ret_val)); @@ -2702,7 +2702,7 @@ bool JSB_cpSpace_getCollisionSlop(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpSpace* arg0 = (cpSpace*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpSpaceGetCollisionSlop((cpSpace*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -2717,7 +2717,7 @@ bool JSB_cpSpace_getCurrentTimeStep(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpSpace* arg0 = (cpSpace*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpSpaceGetCurrentTimeStep((cpSpace*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -2732,7 +2732,7 @@ bool JSB_cpSpace_getDamping(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpSpace* arg0 = (cpSpace*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpSpaceGetDamping((cpSpace*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -2780,7 +2780,7 @@ bool JSB_cpSpace_getIdleSpeedThreshold(JSContext *cx, uint32_t argc, jsval *vp) JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpSpace* arg0 = (cpSpace*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpSpaceGetIdleSpeedThreshold((cpSpace*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -2795,7 +2795,7 @@ bool JSB_cpSpace_getIterations(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpSpace* arg0 = (cpSpace*) proxy->handle; - int ret_val; + int ret_val = 0; ret_val = cpSpaceGetIterations((cpSpace*)arg0 ); args.rval().set(INT_TO_JSVAL((int32_t)ret_val)); @@ -2810,7 +2810,7 @@ bool JSB_cpSpace_getSleepTimeThreshold(JSContext *cx, uint32_t argc, jsval *vp) JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpSpace* arg0 = (cpSpace*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpSpaceGetSleepTimeThreshold((cpSpace*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -2825,7 +2825,7 @@ bool JSB_cpSpace_getStaticBody(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpSpace* arg0 = (cpSpace*) proxy->handle; - cpBody* ret_val; + cpBody* ret_val = nullptr; ret_val = cpSpaceGetStaticBody((cpSpace*)arg0 ); @@ -2843,7 +2843,7 @@ bool JSB_cpSpace_init(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpSpace* arg0 = (cpSpace*) proxy->handle; - cpSpace* ret_val; + cpSpace* ret_val = nullptr; ret_val = cpSpaceInit((cpSpace*)arg0 ); @@ -2878,13 +2878,13 @@ bool JSB_cpSpace_pointQueryFirst(JSContext *cx, uint32_t argc, jsval *vp) { cpSpace* arg0 = (cpSpace*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpVect arg1; uint32_t arg2; cpGroup arg3; + cpVect arg1; uint32_t arg2 = 0; cpGroup arg3 = 0; ok &= jsval_to_cpVect( cx, args.get(0), (cpVect*) &arg1 ); ok &= jsval_to_uint32( cx, args.get(1), &arg2 ); ok &= jsval_to_uint( cx, args.get(2), (unsigned int*) &arg3 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpShape* ret_val; + cpShape* ret_val = nullptr; ret_val = cpSpacePointQueryFirst((cpSpace*)arg0 , (cpVect)arg1 , (cpLayers)arg2 , (cpGroup)arg3 ); @@ -2906,7 +2906,7 @@ bool JSB_cpSpace_reindexShape(JSContext *cx, uint32_t argc, jsval *vp) { cpSpace* arg0 = (cpSpace*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg1; + cpShape* arg1 = nullptr; ok &= jsval_to_c_class( cx, args.get(0), (void**)&arg1, NULL ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -2926,7 +2926,7 @@ bool JSB_cpSpace_reindexShapesForBody(JSContext *cx, uint32_t argc, jsval *vp) { cpSpace* arg0 = (cpSpace*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg1; + cpBody* arg1 = nullptr; ok &= jsval_to_c_class( cx, args.get(0), (void**)&arg1, NULL ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -2960,7 +2960,7 @@ bool JSB_cpSpace_setCollisionBias(JSContext *cx, uint32_t argc, jsval *vp) { cpSpace* arg0 = (cpSpace*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -2980,7 +2980,7 @@ bool JSB_cpSpace_setCollisionPersistence(JSContext *cx, uint32_t argc, jsval *vp cpSpace* arg0 = (cpSpace*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - uint32_t arg1; + uint32_t arg1 = 0; ok &= jsval_to_uint32( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -3000,7 +3000,7 @@ bool JSB_cpSpace_setCollisionSlop(JSContext *cx, uint32_t argc, jsval *vp) { cpSpace* arg0 = (cpSpace*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -3020,7 +3020,7 @@ bool JSB_cpSpace_setDamping(JSContext *cx, uint32_t argc, jsval *vp) { cpSpace* arg0 = (cpSpace*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -3040,7 +3040,7 @@ bool JSB_cpSpace_setEnableContactGraph(JSContext *cx, uint32_t argc, jsval *vp) cpSpace* arg0 = (cpSpace*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - int32_t arg1; + int32_t arg1 = 0; ok &= jsval_to_int32( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -3080,7 +3080,7 @@ bool JSB_cpSpace_setIdleSpeedThreshold(JSContext *cx, uint32_t argc, jsval *vp) cpSpace* arg0 = (cpSpace*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -3100,7 +3100,7 @@ bool JSB_cpSpace_setIterations(JSContext *cx, uint32_t argc, jsval *vp) { cpSpace* arg0 = (cpSpace*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - int32_t arg1; + int32_t arg1 = 0; ok &= jsval_to_int32( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -3120,7 +3120,7 @@ bool JSB_cpSpace_setSleepTimeThreshold(JSContext *cx, uint32_t argc, jsval *vp) cpSpace* arg0 = (cpSpace*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -3140,7 +3140,7 @@ bool JSB_cpSpace_step(JSContext *cx, uint32_t argc, jsval *vp) { cpSpace* arg0 = (cpSpace*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -3160,7 +3160,7 @@ bool JSB_cpSpace_useSpatialHash(JSContext *cx, uint32_t argc, jsval *vp) { cpSpace* arg0 = (cpSpace*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg1; int32_t arg2; + double arg1 = 0; int32_t arg2 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg1 ); ok &= jsval_to_int32( cx, args.get(1), &arg2 ); @@ -3298,7 +3298,7 @@ bool JSB_cpBody_activateStatic(JSContext *cx, uint32_t argc, jsval *vp) { cpBody* arg0 = (cpBody*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg1; + cpShape* arg1 = nullptr; ok &= jsval_to_c_class( cx, args.get(0), (void**)&arg1, NULL ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -3372,7 +3372,7 @@ bool JSB_cpBody_getAngVel(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpBody* arg0 = (cpBody*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpBodyGetAngVel((cpBody*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -3387,7 +3387,7 @@ bool JSB_cpBody_getAngVelLimit(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpBody* arg0 = (cpBody*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpBodyGetAngVelLimit((cpBody*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -3402,7 +3402,7 @@ bool JSB_cpBody_getAngle(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpBody* arg0 = (cpBody*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpBodyGetAngle((cpBody*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -3435,7 +3435,7 @@ bool JSB_cpBody_getMass(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpBody* arg0 = (cpBody*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpBodyGetMass((cpBody*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -3450,7 +3450,7 @@ bool JSB_cpBody_getMoment(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpBody* arg0 = (cpBody*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpBodyGetMoment((cpBody*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -3501,7 +3501,7 @@ bool JSB_cpBody_getSpace(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpBody* arg0 = (cpBody*) proxy->handle; - cpSpace* ret_val; + cpSpace* ret_val = nullptr; ret_val = cpBodyGetSpace((cpBody*)arg0 ); @@ -3519,7 +3519,7 @@ bool JSB_cpBody_getTorque(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpBody* arg0 = (cpBody*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpBodyGetTorque((cpBody*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -3600,7 +3600,7 @@ bool JSB_cpBody_getVelLimit(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpBody* arg0 = (cpBody*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpBodyGetVelLimit((cpBody*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -3617,12 +3617,12 @@ bool JSB_cpBody_init(JSContext *cx, uint32_t argc, jsval *vp) { cpBody* arg0 = (cpBody*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg1; double arg2; + double arg1 = 0; double arg2 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg1 ); ok &= JS::ToNumber( cx, args.get(1), &arg2 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpBody* ret_val; + cpBody* ret_val = nullptr; ret_val = cpBodyInit((cpBody*)arg0 , (cpFloat)arg1 , (cpFloat)arg2 ); @@ -3640,7 +3640,7 @@ bool JSB_cpBody_initStatic(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpBody* arg0 = (cpBody*) proxy->handle; - cpBody* ret_val; + cpBody* ret_val = nullptr; ret_val = cpBodyInitStatic((cpBody*)arg0 ); @@ -3703,7 +3703,7 @@ bool JSB_cpBody_kineticEnergy(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpBody* arg0 = (cpBody*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpBodyKineticEnergy((cpBody*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -3758,7 +3758,7 @@ bool JSB_cpBody_setAngVel(JSContext *cx, uint32_t argc, jsval *vp) { cpBody* arg0 = (cpBody*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -3778,7 +3778,7 @@ bool JSB_cpBody_setAngVelLimit(JSContext *cx, uint32_t argc, jsval *vp) { cpBody* arg0 = (cpBody*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -3798,7 +3798,7 @@ bool JSB_cpBody_setAngle(JSContext *cx, uint32_t argc, jsval *vp) { cpBody* arg0 = (cpBody*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -3838,7 +3838,7 @@ bool JSB_cpBody_setMass(JSContext *cx, uint32_t argc, jsval *vp) { cpBody* arg0 = (cpBody*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -3858,7 +3858,7 @@ bool JSB_cpBody_setMoment(JSContext *cx, uint32_t argc, jsval *vp) { cpBody* arg0 = (cpBody*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -3898,7 +3898,7 @@ bool JSB_cpBody_setTorque(JSContext *cx, uint32_t argc, jsval *vp) { cpBody* arg0 = (cpBody*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -3938,7 +3938,7 @@ bool JSB_cpBody_setVelLimit(JSContext *cx, uint32_t argc, jsval *vp) { cpBody* arg0 = (cpBody*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -3972,7 +3972,7 @@ bool JSB_cpBody_sleepWithGroup(JSContext *cx, uint32_t argc, jsval *vp) { cpBody* arg0 = (cpBody*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg1; + cpBody* arg1 = nullptr; ok &= jsval_to_c_class( cx, args.get(0), (void**)&arg1, NULL ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -3992,7 +3992,7 @@ bool JSB_cpBody_updatePosition(JSContext *cx, uint32_t argc, jsval *vp) { cpBody* arg0 = (cpBody*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -4012,7 +4012,7 @@ bool JSB_cpBody_updateVelocity(JSContext *cx, uint32_t argc, jsval *vp) { cpBody* arg0 = (cpBody*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpVect arg1; double arg2; double arg3; + cpVect arg1; double arg2 = 0; double arg3 = 0; ok &= jsval_to_cpVect( cx, args.get(0), (cpVect*) &arg1 ); ok &= JS::ToNumber( cx, args.get(1), &arg2 ); @@ -4255,7 +4255,7 @@ bool JSB_cpShape_getBody(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpShape* arg0 = (cpShape*) proxy->handle; - cpBody* ret_val; + cpBody* ret_val = nullptr; ret_val = cpShapeGetBody((cpShape*)arg0 ); @@ -4273,7 +4273,7 @@ bool JSB_cpShape_getCollisionType(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpShape* arg0 = (cpShape*) proxy->handle; - cpCollisionType ret_val; + cpCollisionType ret_val = 0; ret_val = cpShapeGetCollisionType((cpShape*)arg0 ); @@ -4291,7 +4291,7 @@ bool JSB_cpShape_getElasticity(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpShape* arg0 = (cpShape*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpShapeGetElasticity((cpShape*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -4306,7 +4306,7 @@ bool JSB_cpShape_getFriction(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpShape* arg0 = (cpShape*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpShapeGetFriction((cpShape*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -4321,7 +4321,7 @@ bool JSB_cpShape_getGroup(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpShape* arg0 = (cpShape*) proxy->handle; - cpGroup ret_val; + cpGroup ret_val = 0; ret_val = cpShapeGetGroup((cpShape*)arg0 ); @@ -4339,7 +4339,7 @@ bool JSB_cpShape_getLayers(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpShape* arg0 = (cpShape*) proxy->handle; - cpLayers ret_val; + cpLayers ret_val = 0; ret_val = cpShapeGetLayers((cpShape*)arg0 ); args.rval().set(UINT_TO_JSVAL((uint32_t)ret_val)); @@ -4369,7 +4369,7 @@ bool JSB_cpShape_getSpace(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpShape* arg0 = (cpShape*) proxy->handle; - cpSpace* ret_val; + cpSpace* ret_val = nullptr; ret_val = cpShapeGetSpace((cpShape*)arg0 ); @@ -4428,7 +4428,7 @@ bool JSB_cpShape_setBody(JSContext *cx, uint32_t argc, jsval *vp) { cpShape* arg0 = (cpShape*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg1; + cpBody* arg1 = nullptr; ok &= jsval_to_c_class( cx, args.get(0), (void**)&arg1, NULL ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -4448,7 +4448,7 @@ bool JSB_cpShape_setCollisionType(JSContext *cx, uint32_t argc, jsval *vp) { cpShape* arg0 = (cpShape*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpCollisionType arg1; + cpCollisionType arg1 = 0; ok &= jsval_to_uint( cx, args.get(0), (unsigned int*) &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -4468,7 +4468,7 @@ bool JSB_cpShape_setElasticity(JSContext *cx, uint32_t argc, jsval *vp) { cpShape* arg0 = (cpShape*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -4488,7 +4488,7 @@ bool JSB_cpShape_setFriction(JSContext *cx, uint32_t argc, jsval *vp) { cpShape* arg0 = (cpShape*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg1; + double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -4508,7 +4508,7 @@ bool JSB_cpShape_setGroup(JSContext *cx, uint32_t argc, jsval *vp) { cpShape* arg0 = (cpShape*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpGroup arg1; + cpGroup arg1 = 0; ok &= jsval_to_uint( cx, args.get(0), (unsigned int*) &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -4528,7 +4528,7 @@ bool JSB_cpShape_setLayers(JSContext *cx, uint32_t argc, jsval *vp) { cpShape* arg0 = (cpShape*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - uint32_t arg1; + uint32_t arg1 = 0; ok &= jsval_to_uint32( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -4548,7 +4548,7 @@ bool JSB_cpShape_setSensor(JSContext *cx, uint32_t argc, jsval *vp) { cpShape* arg0 = (cpShape*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - int32_t arg1; + int32_t arg1 = 0; ok &= jsval_to_int32( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -4808,7 +4808,7 @@ bool JSB_cpCircleShape_constructor(JSContext *cx, uint32_t argc, jsval *vp) JSObject *jsobj = JS_NewObject(cx, JSB_cpCircleShape_class, JS::RootedObject(cx, JSB_cpCircleShape_object), JS::NullPtr()); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; double arg1; cpVect arg2; + cpBody* arg0 = nullptr; double arg1 = 0; cpVect arg2; ok &= jsval_to_c_class( cx, args.get(0), (void**)&arg0, NULL ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -4865,7 +4865,7 @@ bool JSB_cpCircleShape_getRadius(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpCircleShape* arg0 = (cpCircleShape*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpCircleShapeGetRadius((cpShape*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -4918,7 +4918,7 @@ bool JSB_cpSegmentShape_constructor(JSContext *cx, uint32_t argc, jsval *vp) JSObject *jsobj = JS_NewObject(cx, JSB_cpSegmentShape_class, JS::RootedObject(cx, JSB_cpSegmentShape_object), JS::NullPtr()); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; cpVect arg1; cpVect arg2; double arg3; + cpBody* arg0 = nullptr; cpVect arg1; cpVect arg2; double arg3 = 0; ok &= jsval_to_c_class( cx, args.get(0), (void**)&arg0, NULL ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); @@ -5012,7 +5012,7 @@ bool JSB_cpSegmentShape_getRadius(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpSegmentShape* arg0 = (cpSegmentShape*) proxy->handle; - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpSegmentShapeGetRadius((cpShape*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -5130,7 +5130,7 @@ bool JSB_cpPolyShape_getNumVerts(JSContext *cx, uint32_t argc, jsval *vp) { JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp); struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis); cpPolyShape* arg0 = (cpPolyShape*) proxy->handle; - int ret_val; + int ret_val = 0; ret_val = cpPolyShapeGetNumVerts((cpShape*)arg0 ); args.rval().set(INT_TO_JSVAL((int32_t)ret_val)); @@ -5147,7 +5147,7 @@ bool JSB_cpPolyShape_getVert(JSContext *cx, uint32_t argc, jsval *vp) { cpPolyShape* arg0 = (cpPolyShape*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - int32_t arg1; + int32_t arg1 = 0; ok &= jsval_to_int32( cx, args.get(0), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -5403,8 +5403,8 @@ bool js_set_cpSegmentQueryInfo_shape(JSContext *cx, uint32_t argc, jsval *vp) struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(args.thisv().toObjectOrNull()); cpSegmentQueryInfo* info = (cpSegmentQueryInfo*) proxy->handle; - cpShape* shape; - struct jsb_c_proxy_s *retproxy; + cpShape* shape = nullptr; + struct jsb_c_proxy_s *retproxy = nullptr; jsval_to_c_class( cx, args.get(0), (void**)&shape, &retproxy ); info->shape = shape; @@ -5509,8 +5509,8 @@ bool js_set_cpNearestPointQueryInfo_shape(JSContext *cx, uint32_t argc, jsval *v struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(args.thisv().toObjectOrNull()); cpNearestPointQueryInfo* info = (cpNearestPointQueryInfo*) proxy->handle; - cpShape* shape; - struct jsb_c_proxy_s *retproxy; + cpShape* shape = nullptr; + struct jsb_c_proxy_s *retproxy = nullptr; jsval_to_c_class( cx, args.get(0), (void**)&shape, &retproxy ); info->shape = shape; diff --git a/cocos/scripting/js-bindings/manual/chipmunk/js_bindings_chipmunk_functions.cpp b/cocos/scripting/js-bindings/manual/chipmunk/js_bindings_chipmunk_functions.cpp index c1f4904218..609fe3a23a 100644 --- a/cocos/scripting/js-bindings/manual/chipmunk/js_bindings_chipmunk_functions.cpp +++ b/cocos/scripting/js-bindings/manual/chipmunk/js_bindings_chipmunk_functions.cpp @@ -19,11 +19,11 @@ bool JSB_cpArbiterGetCount(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpArbiter* arg0; + cpArbiter* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - int ret_val; + int ret_val = 0; ret_val = cpArbiterGetCount((cpArbiter*)arg0 ); args.rval().set(INT_TO_JSVAL((int32_t)ret_val)); @@ -36,12 +36,12 @@ bool JSB_cpArbiterGetDepth(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpArbiter* arg0; int32_t arg1; + cpArbiter* arg0 = nullptr; int32_t arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_int32( cx, args.get(1), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpArbiterGetDepth((cpArbiter*)arg0 , (int)arg1 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -54,11 +54,11 @@ bool JSB_cpArbiterGetElasticity(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpArbiter* arg0; + cpArbiter* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpArbiterGetElasticity((cpArbiter*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -71,11 +71,11 @@ bool JSB_cpArbiterGetFriction(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpArbiter* arg0; + cpArbiter* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpArbiterGetFriction((cpArbiter*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -88,7 +88,7 @@ bool JSB_cpArbiterGetNormal(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpArbiter* arg0; int32_t arg1; + cpArbiter* arg0 = nullptr; int32_t arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_int32( cx, args.get(1), &arg1 ); @@ -109,7 +109,7 @@ bool JSB_cpArbiterGetPoint(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpArbiter* arg0; int32_t arg1; + cpArbiter* arg0 = nullptr; int32_t arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_int32( cx, args.get(1), &arg1 ); @@ -130,7 +130,7 @@ bool JSB_cpArbiterGetSurfaceVelocity(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpArbiter* arg0; + cpArbiter* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -150,7 +150,7 @@ bool JSB_cpArbiterIgnore(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpArbiter* arg0; + cpArbiter* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -166,7 +166,7 @@ bool JSB_cpArbiterIsFirstContact(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpArbiter* arg0; + cpArbiter* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -183,7 +183,7 @@ bool JSB_cpArbiterSetElasticity(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpArbiter* arg0; double arg1; + cpArbiter* arg0 = nullptr; double arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -200,7 +200,7 @@ bool JSB_cpArbiterSetFriction(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpArbiter* arg0; double arg1; + cpArbiter* arg0 = nullptr; double arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -217,7 +217,7 @@ bool JSB_cpArbiterSetSurfaceVelocity(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpArbiter* arg0; cpVect arg1; + cpArbiter* arg0 = nullptr; cpVect arg1; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); @@ -234,7 +234,7 @@ bool JSB_cpArbiterTotalImpulse(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpArbiter* arg0; + cpArbiter* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -254,7 +254,7 @@ bool JSB_cpArbiterTotalImpulseWithFriction(JSContext *cx, uint32_t argc, jsval * JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpArbiter* arg0; + cpArbiter* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -274,11 +274,11 @@ bool JSB_cpArbiterTotalKE(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpArbiter* arg0; + cpArbiter* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpArbiterTotalKE((cpArbiter*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -291,12 +291,12 @@ bool JSB_cpAreaForCircle(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg0; double arg1; + double arg0 = 0; double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpAreaForCircle((cpFloat)arg0 , (cpFloat)arg1 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -309,13 +309,13 @@ bool JSB_cpAreaForSegment(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 3, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpVect arg0; cpVect arg1; double arg2; + cpVect arg0; cpVect arg1; double arg2 = 0; ok &= jsval_to_cpVect( cx, args.get(0), (cpVect*) &arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); ok &= JS::ToNumber( cx, args.get(2), &arg2 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpAreaForSegment((cpVect)arg0 , (cpVect)arg1 , (cpFloat)arg2 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -332,7 +332,7 @@ bool JSB_cpBBArea(JSContext *cx, uint32_t argc, jsval *vp) { ok &= jsval_to_cpBB( cx, args.get(0), (cpBB*) &arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpBBArea((cpBB)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -486,7 +486,7 @@ bool JSB_cpBBMergedArea(JSContext *cx, uint32_t argc, jsval *vp) { ok &= jsval_to_cpBB( cx, args.get(0), (cpBB*) &arg0 ); ok &= jsval_to_cpBB( cx, args.get(1), (cpBB*) &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpBBMergedArea((cpBB)arg0 , (cpBB)arg1 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -499,7 +499,7 @@ bool JSB_cpBBNew(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 4, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg0; double arg1; double arg2; double arg3; + double arg0 = 0; double arg1 = 0; double arg2 = 0; double arg3 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -522,7 +522,7 @@ bool JSB_cpBBNewForCircle(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpVect arg0; double arg1; + cpVect arg0; double arg1 = 0; ok &= jsval_to_cpVect( cx, args.get(0), (cpVect*) &arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -549,7 +549,7 @@ bool JSB_cpBBSegmentQuery(JSContext *cx, uint32_t argc, jsval *vp) { ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); ok &= jsval_to_cpVect( cx, args.get(2), (cpVect*) &arg2 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpBBSegmentQuery((cpBB)arg0 , (cpVect)arg1 , (cpVect)arg2 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -583,7 +583,7 @@ bool JSB_cpBodyActivate(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; + cpBody* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -599,7 +599,7 @@ bool JSB_cpBodyActivateStatic(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; cpShape* arg1; + cpBody* arg0 = nullptr; cpShape* arg1 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_opaque( cx, args.get(1), (void**)&arg1 ); @@ -616,7 +616,7 @@ bool JSB_cpBodyApplyForce(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 3, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; cpVect arg1; cpVect arg2; + cpBody* arg0 = nullptr; cpVect arg1; cpVect arg2; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); @@ -634,7 +634,7 @@ bool JSB_cpBodyApplyImpulse(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 3, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; cpVect arg1; cpVect arg2; + cpBody* arg0 = nullptr; cpVect arg1; cpVect arg2; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); @@ -652,7 +652,7 @@ bool JSB_cpBodyDestroy(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; + cpBody* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -668,7 +668,7 @@ bool JSB_cpBodyFree(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; + cpBody* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -684,11 +684,11 @@ bool JSB_cpBodyGetAngVel(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; + cpBody* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpBodyGetAngVel((cpBody*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -701,11 +701,11 @@ bool JSB_cpBodyGetAngVelLimit(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; + cpBody* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpBodyGetAngVelLimit((cpBody*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -718,11 +718,11 @@ bool JSB_cpBodyGetAngle(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; + cpBody* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpBodyGetAngle((cpBody*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -735,7 +735,7 @@ bool JSB_cpBodyGetForce(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; + cpBody* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -755,11 +755,11 @@ bool JSB_cpBodyGetMass(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; + cpBody* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpBodyGetMass((cpBody*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -772,11 +772,11 @@ bool JSB_cpBodyGetMoment(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; + cpBody* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpBodyGetMoment((cpBody*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -789,7 +789,7 @@ bool JSB_cpBodyGetPos(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; + cpBody* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -809,7 +809,7 @@ bool JSB_cpBodyGetRot(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; + cpBody* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -829,11 +829,11 @@ bool JSB_cpBodyGetSpace(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; + cpBody* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpSpace* ret_val; + cpSpace* ret_val = nullptr; ret_val = cpBodyGetSpace((cpBody*)arg0 ); @@ -849,11 +849,11 @@ bool JSB_cpBodyGetTorque(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; + cpBody* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpBodyGetTorque((cpBody*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -866,7 +866,7 @@ bool JSB_cpBodyGetVel(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; + cpBody* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -886,7 +886,7 @@ bool JSB_cpBodyGetVelAtLocalPoint(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; cpVect arg1; + cpBody* arg0 = nullptr; cpVect arg1; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); @@ -907,7 +907,7 @@ bool JSB_cpBodyGetVelAtWorldPoint(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; cpVect arg1; + cpBody* arg0 = nullptr; cpVect arg1; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); @@ -928,11 +928,11 @@ bool JSB_cpBodyGetVelLimit(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; + cpBody* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpBodyGetVelLimit((cpBody*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -945,13 +945,13 @@ bool JSB_cpBodyInit(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 3, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; double arg1; double arg2; + cpBody* arg0 = nullptr; double arg1 = 0; double arg2 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); ok &= JS::ToNumber( cx, args.get(2), &arg2 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpBody* ret_val; + cpBody* ret_val = nullptr; ret_val = cpBodyInit((cpBody*)arg0 , (cpFloat)arg1 , (cpFloat)arg2 ); @@ -967,11 +967,11 @@ bool JSB_cpBodyInitStatic(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; + cpBody* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpBody* ret_val; + cpBody* ret_val = nullptr; ret_val = cpBodyInitStatic((cpBody*)arg0 ); @@ -987,7 +987,7 @@ bool JSB_cpBodyIsRogue(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; + cpBody* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -1004,7 +1004,7 @@ bool JSB_cpBodyIsSleeping(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; + cpBody* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -1021,7 +1021,7 @@ bool JSB_cpBodyIsStatic(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; + cpBody* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -1038,11 +1038,11 @@ bool JSB_cpBodyKineticEnergy(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; + cpBody* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpBodyKineticEnergy((cpBody*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -1055,7 +1055,7 @@ bool JSB_cpBodyLocal2World(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; cpVect arg1; + cpBody* arg0 = nullptr; cpVect arg1; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); @@ -1076,12 +1076,12 @@ bool JSB_cpBodyNew(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg0; double arg1; + double arg0 = 0; double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpBody* ret_val; + cpBody* ret_val = nullptr; ret_val = cpBodyNew((cpFloat)arg0 , (cpFloat)arg1 ); @@ -1096,7 +1096,7 @@ bool JSB_cpBodyNew(JSContext *cx, uint32_t argc, jsval *vp) { bool JSB_cpBodyNewStatic(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 0, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - cpBody* ret_val; + cpBody* ret_val = nullptr; ret_val = cpBodyNewStatic( ); @@ -1112,7 +1112,7 @@ bool JSB_cpBodyResetForces(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; + cpBody* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -1128,7 +1128,7 @@ bool JSB_cpBodySetAngVel(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; double arg1; + cpBody* arg0 = nullptr; double arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -1145,7 +1145,7 @@ bool JSB_cpBodySetAngVelLimit(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; double arg1; + cpBody* arg0 = nullptr; double arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -1162,7 +1162,7 @@ bool JSB_cpBodySetAngle(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; double arg1; + cpBody* arg0 = nullptr; double arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -1179,7 +1179,7 @@ bool JSB_cpBodySetForce(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; cpVect arg1; + cpBody* arg0 = nullptr; cpVect arg1; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); @@ -1196,7 +1196,7 @@ bool JSB_cpBodySetMass(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; double arg1; + cpBody* arg0 = nullptr; double arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -1213,7 +1213,7 @@ bool JSB_cpBodySetMoment(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; double arg1; + cpBody* arg0 = nullptr; double arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -1230,7 +1230,7 @@ bool JSB_cpBodySetPos(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; cpVect arg1; + cpBody* arg0 = nullptr; cpVect arg1; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); @@ -1247,7 +1247,7 @@ bool JSB_cpBodySetTorque(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; double arg1; + cpBody* arg0 = nullptr; double arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -1264,7 +1264,7 @@ bool JSB_cpBodySetVel(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; cpVect arg1; + cpBody* arg0 = nullptr; cpVect arg1; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); @@ -1281,7 +1281,7 @@ bool JSB_cpBodySetVelLimit(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; double arg1; + cpBody* arg0 = nullptr; double arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -1298,7 +1298,7 @@ bool JSB_cpBodySleep(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; + cpBody* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -1314,7 +1314,7 @@ bool JSB_cpBodySleepWithGroup(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; cpBody* arg1; + cpBody* arg0 = nullptr; cpBody* arg1 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_opaque( cx, args.get(1), (void**)&arg1 ); @@ -1331,7 +1331,7 @@ bool JSB_cpBodyUpdatePosition(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; double arg1; + cpBody* arg0 = nullptr; double arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -1348,7 +1348,7 @@ bool JSB_cpBodyUpdateVelocity(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 4, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; cpVect arg1; double arg2; double arg3; + cpBody* arg0 = nullptr; cpVect arg1; double arg2 = 0; double arg3 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); @@ -1367,7 +1367,7 @@ bool JSB_cpBodyWorld2Local(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; cpVect arg1; + cpBody* arg0 = nullptr; cpVect arg1; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); @@ -1388,13 +1388,13 @@ bool JSB_cpBoxShapeNew(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 3, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; double arg1; double arg2; + cpBody* arg0 = nullptr; double arg1 = 0; double arg2 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); ok &= JS::ToNumber( cx, args.get(2), &arg2 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpShape* ret_val; + cpShape* ret_val = nullptr; ret_val = cpBoxShapeNew((cpBody*)arg0 , (cpFloat)arg1 , (cpFloat)arg2 ); @@ -1410,12 +1410,12 @@ bool JSB_cpBoxShapeNew2(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; cpBB arg1; + cpBody* arg0 = nullptr; cpBB arg1; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_cpBB( cx, args.get(1), (cpBB*) &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpShape* ret_val; + cpShape* ret_val = nullptr; ret_val = cpBoxShapeNew2((cpBody*)arg0 , (cpBB)arg1 ); @@ -1431,7 +1431,7 @@ bool JSB_cpCircleShapeGetOffset(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg0; + cpShape* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -1451,11 +1451,11 @@ bool JSB_cpCircleShapeGetRadius(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg0; + cpShape* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpCircleShapeGetRadius((cpShape*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -1468,13 +1468,13 @@ bool JSB_cpCircleShapeNew(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 3, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; double arg1; cpVect arg2; + cpBody* arg0 = nullptr; double arg1 = 0; cpVect arg2; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); ok &= jsval_to_cpVect( cx, args.get(2), (cpVect*) &arg2 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpShape* ret_val; + cpShape* ret_val = nullptr; ret_val = cpCircleShapeNew((cpBody*)arg0 , (cpFloat)arg1 , (cpVect)arg2 ); @@ -1490,7 +1490,7 @@ bool JSB_cpConstraintActivateBodies(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; + cpConstraint* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -1506,7 +1506,7 @@ bool JSB_cpConstraintDestroy(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; + cpConstraint* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -1522,7 +1522,7 @@ bool JSB_cpConstraintFree(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; + cpConstraint* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -1538,11 +1538,11 @@ bool JSB_cpConstraintGetA(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; + cpConstraint* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpBody* ret_val; + cpBody* ret_val = nullptr; ret_val = cpConstraintGetA((cpConstraint*)arg0 ); @@ -1558,11 +1558,11 @@ bool JSB_cpConstraintGetB(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; + cpConstraint* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpBody* ret_val; + cpBody* ret_val = nullptr; ret_val = cpConstraintGetB((cpConstraint*)arg0 ); @@ -1578,11 +1578,11 @@ bool JSB_cpConstraintGetErrorBias(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; + cpConstraint* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpConstraintGetErrorBias((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -1595,11 +1595,11 @@ bool JSB_cpConstraintGetImpulse(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; + cpConstraint* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpConstraintGetImpulse((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -1612,11 +1612,11 @@ bool JSB_cpConstraintGetMaxBias(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; + cpConstraint* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpConstraintGetMaxBias((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -1629,11 +1629,11 @@ bool JSB_cpConstraintGetMaxForce(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; + cpConstraint* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpConstraintGetMaxForce((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -1646,11 +1646,11 @@ bool JSB_cpConstraintGetSpace(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; + cpConstraint* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpSpace* ret_val; + cpSpace* ret_val = nullptr; ret_val = cpConstraintGetSpace((cpConstraint*)arg0 ); @@ -1666,7 +1666,7 @@ bool JSB_cpConstraintSetErrorBias(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; double arg1; + cpConstraint* arg0 = nullptr; double arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -1683,7 +1683,7 @@ bool JSB_cpConstraintSetMaxBias(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; double arg1; + cpConstraint* arg0 = nullptr; double arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -1700,7 +1700,7 @@ bool JSB_cpConstraintSetMaxForce(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; double arg1; + cpConstraint* arg0 = nullptr; double arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -1717,11 +1717,11 @@ bool JSB_cpDampedRotarySpringGetDamping(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; + cpConstraint* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpDampedRotarySpringGetDamping((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -1734,11 +1734,11 @@ bool JSB_cpDampedRotarySpringGetRestAngle(JSContext *cx, uint32_t argc, jsval *v JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; + cpConstraint* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpDampedRotarySpringGetRestAngle((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -1751,11 +1751,11 @@ bool JSB_cpDampedRotarySpringGetStiffness(JSContext *cx, uint32_t argc, jsval *v JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; + cpConstraint* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpDampedRotarySpringGetStiffness((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -1768,7 +1768,7 @@ bool JSB_cpDampedRotarySpringNew(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 5, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; cpBody* arg1; double arg2; double arg3; double arg4; + cpBody* arg0 = nullptr; cpBody* arg1 = nullptr; double arg2 = 0; double arg3 = 0; double arg4 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_opaque( cx, args.get(1), (void**)&arg1 ); @@ -1776,7 +1776,7 @@ bool JSB_cpDampedRotarySpringNew(JSContext *cx, uint32_t argc, jsval *vp) { ok &= JS::ToNumber( cx, args.get(3), &arg3 ); ok &= JS::ToNumber( cx, args.get(4), &arg4 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpConstraint* ret_val; + cpConstraint* ret_val = nullptr; ret_val = cpDampedRotarySpringNew((cpBody*)arg0 , (cpBody*)arg1 , (cpFloat)arg2 , (cpFloat)arg3 , (cpFloat)arg4 ); @@ -1792,7 +1792,7 @@ bool JSB_cpDampedRotarySpringSetDamping(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; double arg1; + cpConstraint* arg0 = nullptr; double arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -1809,7 +1809,7 @@ bool JSB_cpDampedRotarySpringSetRestAngle(JSContext *cx, uint32_t argc, jsval *v JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; double arg1; + cpConstraint* arg0 = nullptr; double arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -1826,7 +1826,7 @@ bool JSB_cpDampedRotarySpringSetStiffness(JSContext *cx, uint32_t argc, jsval *v JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; double arg1; + cpConstraint* arg0 = nullptr; double arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -1843,7 +1843,7 @@ bool JSB_cpDampedSpringGetAnchr1(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; + cpConstraint* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -1863,7 +1863,7 @@ bool JSB_cpDampedSpringGetAnchr2(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; + cpConstraint* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -1883,11 +1883,11 @@ bool JSB_cpDampedSpringGetDamping(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; + cpConstraint* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpDampedSpringGetDamping((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -1900,11 +1900,11 @@ bool JSB_cpDampedSpringGetRestLength(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; + cpConstraint* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpDampedSpringGetRestLength((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -1917,11 +1917,11 @@ bool JSB_cpDampedSpringGetStiffness(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; + cpConstraint* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpDampedSpringGetStiffness((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -1934,7 +1934,7 @@ bool JSB_cpDampedSpringNew(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 7, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; cpBody* arg1; cpVect arg2; cpVect arg3; double arg4; double arg5; double arg6; + cpBody* arg0 = nullptr; cpBody* arg1 = nullptr; cpVect arg2; cpVect arg3; double arg4 = 0; double arg5 = 0; double arg6 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_opaque( cx, args.get(1), (void**)&arg1 ); @@ -1944,7 +1944,7 @@ bool JSB_cpDampedSpringNew(JSContext *cx, uint32_t argc, jsval *vp) { ok &= JS::ToNumber( cx, args.get(5), &arg5 ); ok &= JS::ToNumber( cx, args.get(6), &arg6 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpConstraint* ret_val; + cpConstraint* ret_val = nullptr; ret_val = cpDampedSpringNew((cpBody*)arg0 , (cpBody*)arg1 , (cpVect)arg2 , (cpVect)arg3 , (cpFloat)arg4 , (cpFloat)arg5 , (cpFloat)arg6 ); @@ -1960,7 +1960,7 @@ bool JSB_cpDampedSpringSetAnchr1(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; cpVect arg1; + cpConstraint* arg0 = nullptr; cpVect arg1; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); @@ -1977,7 +1977,7 @@ bool JSB_cpDampedSpringSetAnchr2(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; cpVect arg1; + cpConstraint* arg0 = nullptr; cpVect arg1; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); @@ -1994,7 +1994,7 @@ bool JSB_cpDampedSpringSetDamping(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; double arg1; + cpConstraint* arg0 = nullptr; double arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -2011,7 +2011,7 @@ bool JSB_cpDampedSpringSetRestLength(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; double arg1; + cpConstraint* arg0 = nullptr; double arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -2028,7 +2028,7 @@ bool JSB_cpDampedSpringSetStiffness(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; double arg1; + cpConstraint* arg0 = nullptr; double arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -2045,11 +2045,11 @@ bool JSB_cpGearJointGetPhase(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; + cpConstraint* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpGearJointGetPhase((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -2062,11 +2062,11 @@ bool JSB_cpGearJointGetRatio(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; + cpConstraint* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpGearJointGetRatio((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -2079,14 +2079,14 @@ bool JSB_cpGearJointNew(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 4, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; cpBody* arg1; double arg2; double arg3; + cpBody* arg0 = nullptr; cpBody* arg1 = nullptr; double arg2 = 0; double arg3 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_opaque( cx, args.get(1), (void**)&arg1 ); ok &= JS::ToNumber( cx, args.get(2), &arg2 ); ok &= JS::ToNumber( cx, args.get(3), &arg3 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpConstraint* ret_val; + cpConstraint* ret_val = nullptr; ret_val = cpGearJointNew((cpBody*)arg0 , (cpBody*)arg1 , (cpFloat)arg2 , (cpFloat)arg3 ); @@ -2102,7 +2102,7 @@ bool JSB_cpGearJointSetPhase(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; double arg1; + cpConstraint* arg0 = nullptr; double arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -2119,7 +2119,7 @@ bool JSB_cpGearJointSetRatio(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; double arg1; + cpConstraint* arg0 = nullptr; double arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -2136,7 +2136,7 @@ bool JSB_cpGrooveJointGetAnchr2(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; + cpConstraint* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -2156,7 +2156,7 @@ bool JSB_cpGrooveJointGetGrooveA(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; + cpConstraint* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -2176,7 +2176,7 @@ bool JSB_cpGrooveJointGetGrooveB(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; + cpConstraint* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -2196,7 +2196,7 @@ bool JSB_cpGrooveJointNew(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 5, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; cpBody* arg1; cpVect arg2; cpVect arg3; cpVect arg4; + cpBody* arg0 = nullptr; cpBody* arg1 = nullptr; cpVect arg2; cpVect arg3; cpVect arg4; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_opaque( cx, args.get(1), (void**)&arg1 ); @@ -2204,7 +2204,7 @@ bool JSB_cpGrooveJointNew(JSContext *cx, uint32_t argc, jsval *vp) { ok &= jsval_to_cpVect( cx, args.get(3), (cpVect*) &arg3 ); ok &= jsval_to_cpVect( cx, args.get(4), (cpVect*) &arg4 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpConstraint* ret_val; + cpConstraint* ret_val = nullptr; ret_val = cpGrooveJointNew((cpBody*)arg0 , (cpBody*)arg1 , (cpVect)arg2 , (cpVect)arg3 , (cpVect)arg4 ); @@ -2220,7 +2220,7 @@ bool JSB_cpGrooveJointSetAnchr2(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; cpVect arg1; + cpConstraint* arg0 = nullptr; cpVect arg1; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); @@ -2237,7 +2237,7 @@ bool JSB_cpGrooveJointSetGrooveA(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; cpVect arg1; + cpConstraint* arg0 = nullptr; cpVect arg1; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); @@ -2254,7 +2254,7 @@ bool JSB_cpGrooveJointSetGrooveB(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; cpVect arg1; + cpConstraint* arg0 = nullptr; cpVect arg1; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); @@ -2281,13 +2281,13 @@ bool JSB_cpMomentForBox(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 3, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg0; double arg1; double arg2; + double arg0 = 0; double arg1 = 0; double arg2 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); ok &= JS::ToNumber( cx, args.get(2), &arg2 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpMomentForBox((cpFloat)arg0 , (cpFloat)arg1 , (cpFloat)arg2 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -2300,12 +2300,12 @@ bool JSB_cpMomentForBox2(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg0; cpBB arg1; + double arg0 = 0; cpBB arg1; ok &= JS::ToNumber( cx, args.get(0), &arg0 ); ok &= jsval_to_cpBB( cx, args.get(1), (cpBB*) &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpMomentForBox2((cpFloat)arg0 , (cpBB)arg1 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -2318,14 +2318,14 @@ bool JSB_cpMomentForCircle(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 4, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg0; double arg1; double arg2; cpVect arg3; + double arg0 = 0; double arg1 = 0; double arg2 = 0; cpVect arg3; ok &= JS::ToNumber( cx, args.get(0), &arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); ok &= JS::ToNumber( cx, args.get(2), &arg2 ); ok &= jsval_to_cpVect( cx, args.get(3), (cpVect*) &arg3 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpMomentForCircle((cpFloat)arg0 , (cpFloat)arg1 , (cpFloat)arg2 , (cpVect)arg3 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -2338,13 +2338,13 @@ bool JSB_cpMomentForSegment(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 3, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg0; cpVect arg1; cpVect arg2; + double arg0 = 0; cpVect arg1; cpVect arg2; ok &= JS::ToNumber( cx, args.get(0), &arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); ok &= jsval_to_cpVect( cx, args.get(2), (cpVect*) &arg2 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpMomentForSegment((cpFloat)arg0 , (cpVect)arg1 , (cpVect)arg2 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -2357,7 +2357,7 @@ bool JSB_cpPinJointGetAnchr1(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; + cpConstraint* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -2377,7 +2377,7 @@ bool JSB_cpPinJointGetAnchr2(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; + cpConstraint* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -2397,11 +2397,11 @@ bool JSB_cpPinJointGetDist(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; + cpConstraint* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpPinJointGetDist((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -2414,14 +2414,14 @@ bool JSB_cpPinJointNew(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 4, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; cpBody* arg1; cpVect arg2; cpVect arg3; + cpBody* arg0 = nullptr; cpBody* arg1 = nullptr; cpVect arg2; cpVect arg3; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_opaque( cx, args.get(1), (void**)&arg1 ); ok &= jsval_to_cpVect( cx, args.get(2), (cpVect*) &arg2 ); ok &= jsval_to_cpVect( cx, args.get(3), (cpVect*) &arg3 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpConstraint* ret_val; + cpConstraint* ret_val = nullptr; ret_val = cpPinJointNew((cpBody*)arg0 , (cpBody*)arg1 , (cpVect)arg2 , (cpVect)arg3 ); @@ -2437,7 +2437,7 @@ bool JSB_cpPinJointSetAnchr1(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; cpVect arg1; + cpConstraint* arg0 = nullptr; cpVect arg1; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); @@ -2454,7 +2454,7 @@ bool JSB_cpPinJointSetAnchr2(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; cpVect arg1; + cpConstraint* arg0 = nullptr; cpVect arg1; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); @@ -2471,7 +2471,7 @@ bool JSB_cpPinJointSetDist(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; double arg1; + cpConstraint* arg0 = nullptr; double arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -2488,7 +2488,7 @@ bool JSB_cpPivotJointGetAnchr1(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; + cpConstraint* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -2508,7 +2508,7 @@ bool JSB_cpPivotJointGetAnchr2(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; + cpConstraint* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -2528,7 +2528,7 @@ bool JSB_cpPivotJointNew(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 3 || argc == 4, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; cpBody* arg1; cpVect arg2; cpVect arg3; + cpBody* arg0 = nullptr; cpBody* arg1 = nullptr; cpVect arg2; cpVect arg3; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_opaque( cx, args.get(1), (void**)&arg1 ); @@ -2537,7 +2537,7 @@ bool JSB_cpPivotJointNew(JSContext *cx, uint32_t argc, jsval *vp) { ok &= jsval_to_cpVect( cx, args.get(3), (cpVect*) &arg3 ); } JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpConstraint* ret_val; + cpConstraint* ret_val = nullptr; if(argc == 4) { ret_val = cpPivotJointNew2((cpBody*)arg0 , (cpBody*)arg1 , (cpVect)arg2 , (cpVect)arg3 ); @@ -2557,14 +2557,14 @@ bool JSB_cpPivotJointNew2(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 4, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; cpBody* arg1; cpVect arg2; cpVect arg3; + cpBody* arg0 = nullptr; cpBody* arg1 = nullptr; cpVect arg2; cpVect arg3; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_opaque( cx, args.get(1), (void**)&arg1 ); ok &= jsval_to_cpVect( cx, args.get(2), (cpVect*) &arg2 ); ok &= jsval_to_cpVect( cx, args.get(3), (cpVect*) &arg3 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpConstraint* ret_val; + cpConstraint* ret_val = nullptr; ret_val = cpPivotJointNew2((cpBody*)arg0 , (cpBody*)arg1 , (cpVect)arg2 , (cpVect)arg3 ); @@ -2580,7 +2580,7 @@ bool JSB_cpPivotJointSetAnchr1(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; cpVect arg1; + cpConstraint* arg0 = nullptr; cpVect arg1; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); @@ -2597,7 +2597,7 @@ bool JSB_cpPivotJointSetAnchr2(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; cpVect arg1; + cpConstraint* arg0 = nullptr; cpVect arg1; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); @@ -2614,11 +2614,11 @@ bool JSB_cpPolyShapeGetNumVerts(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg0; + cpShape* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - int ret_val; + int ret_val = 0; ret_val = cpPolyShapeGetNumVerts((cpShape*)arg0 ); args.rval().set(INT_TO_JSVAL((int32_t)ret_val)); @@ -2631,7 +2631,7 @@ bool JSB_cpPolyShapeGetVert(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg0; int32_t arg1; + cpShape* arg0 = nullptr; int32_t arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_int32( cx, args.get(1), &arg1 ); @@ -2652,11 +2652,11 @@ bool JSB_cpRatchetJointGetAngle(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; + cpConstraint* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpRatchetJointGetAngle((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -2669,11 +2669,11 @@ bool JSB_cpRatchetJointGetPhase(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; + cpConstraint* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpRatchetJointGetPhase((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -2686,11 +2686,11 @@ bool JSB_cpRatchetJointGetRatchet(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; + cpConstraint* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpRatchetJointGetRatchet((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -2703,14 +2703,14 @@ bool JSB_cpRatchetJointNew(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 4, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; cpBody* arg1; double arg2; double arg3; + cpBody* arg0 = nullptr; cpBody* arg1 = nullptr; double arg2 = 0; double arg3 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_opaque( cx, args.get(1), (void**)&arg1 ); ok &= JS::ToNumber( cx, args.get(2), &arg2 ); ok &= JS::ToNumber( cx, args.get(3), &arg3 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpConstraint* ret_val; + cpConstraint* ret_val = nullptr; ret_val = cpRatchetJointNew((cpBody*)arg0 , (cpBody*)arg1 , (cpFloat)arg2 , (cpFloat)arg3 ); @@ -2726,7 +2726,7 @@ bool JSB_cpRatchetJointSetAngle(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; double arg1; + cpConstraint* arg0 = nullptr; double arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -2743,7 +2743,7 @@ bool JSB_cpRatchetJointSetPhase(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; double arg1; + cpConstraint* arg0 = nullptr; double arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -2760,7 +2760,7 @@ bool JSB_cpRatchetJointSetRatchet(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; double arg1; + cpConstraint* arg0 = nullptr; double arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -2787,11 +2787,11 @@ bool JSB_cpRotaryLimitJointGetMax(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; + cpConstraint* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpRotaryLimitJointGetMax((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -2804,11 +2804,11 @@ bool JSB_cpRotaryLimitJointGetMin(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; + cpConstraint* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpRotaryLimitJointGetMin((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -2821,14 +2821,14 @@ bool JSB_cpRotaryLimitJointNew(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 4, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; cpBody* arg1; double arg2; double arg3; + cpBody* arg0 = nullptr; cpBody* arg1 = nullptr; double arg2 = 0; double arg3 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_opaque( cx, args.get(1), (void**)&arg1 ); ok &= JS::ToNumber( cx, args.get(2), &arg2 ); ok &= JS::ToNumber( cx, args.get(3), &arg3 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpConstraint* ret_val; + cpConstraint* ret_val = nullptr; ret_val = cpRotaryLimitJointNew((cpBody*)arg0 , (cpBody*)arg1 , (cpFloat)arg2 , (cpFloat)arg3 ); @@ -2844,7 +2844,7 @@ bool JSB_cpRotaryLimitJointSetMax(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; double arg1; + cpConstraint* arg0 = nullptr; double arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -2861,7 +2861,7 @@ bool JSB_cpRotaryLimitJointSetMin(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; double arg1; + cpConstraint* arg0 = nullptr; double arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -2878,7 +2878,7 @@ bool JSB_cpSegmentShapeGetA(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg0; + cpShape* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -2898,7 +2898,7 @@ bool JSB_cpSegmentShapeGetB(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg0; + cpShape* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -2918,7 +2918,7 @@ bool JSB_cpSegmentShapeGetNormal(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg0; + cpShape* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -2938,11 +2938,11 @@ bool JSB_cpSegmentShapeGetRadius(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg0; + cpShape* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpSegmentShapeGetRadius((cpShape*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -2955,14 +2955,14 @@ bool JSB_cpSegmentShapeNew(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 4, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; cpVect arg1; cpVect arg2; double arg3; + cpBody* arg0 = nullptr; cpVect arg1; cpVect arg2; double arg3 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); ok &= jsval_to_cpVect( cx, args.get(2), (cpVect*) &arg2 ); ok &= JS::ToNumber( cx, args.get(3), &arg3 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpShape* ret_val; + cpShape* ret_val = nullptr; ret_val = cpSegmentShapeNew((cpBody*)arg0 , (cpVect)arg1 , (cpVect)arg2 , (cpFloat)arg3 ); @@ -2978,7 +2978,7 @@ bool JSB_cpSegmentShapeSetNeighbors(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 3, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg0; cpVect arg1; cpVect arg2; + cpShape* arg0 = nullptr; cpVect arg1; cpVect arg2; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); @@ -2996,7 +2996,7 @@ bool JSB_cpShapeCacheBB(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg0; + cpShape* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -3016,7 +3016,7 @@ bool JSB_cpShapeDestroy(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg0; + cpShape* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -3032,7 +3032,7 @@ bool JSB_cpShapeFree(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg0; + cpShape* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -3048,7 +3048,7 @@ bool JSB_cpShapeGetBB(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg0; + cpShape* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -3068,11 +3068,11 @@ bool JSB_cpShapeGetBody(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg0; + cpShape* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpBody* ret_val; + cpBody* ret_val = nullptr; ret_val = cpShapeGetBody((cpShape*)arg0 ); @@ -3088,11 +3088,11 @@ bool JSB_cpShapeGetCollisionType(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg0; + cpShape* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpCollisionType ret_val; + cpCollisionType ret_val = 0; ret_val = cpShapeGetCollisionType((cpShape*)arg0 ); @@ -3108,11 +3108,11 @@ bool JSB_cpShapeGetElasticity(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg0; + cpShape* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpShapeGetElasticity((cpShape*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -3125,11 +3125,11 @@ bool JSB_cpShapeGetFriction(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg0; + cpShape* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpShapeGetFriction((cpShape*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -3142,11 +3142,11 @@ bool JSB_cpShapeGetGroup(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg0; + cpShape* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpGroup ret_val; + cpGroup ret_val = 0; ret_val = cpShapeGetGroup((cpShape*)arg0 ); @@ -3162,11 +3162,11 @@ bool JSB_cpShapeGetLayers(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg0; + cpShape* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpLayers ret_val; + cpLayers ret_val = 0; ret_val = cpShapeGetLayers((cpShape*)arg0 ); args.rval().set(UINT_TO_JSVAL((uint32_t)ret_val)); @@ -3179,7 +3179,7 @@ bool JSB_cpShapeGetSensor(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg0; + cpShape* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -3196,11 +3196,11 @@ bool JSB_cpShapeGetSpace(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg0; + cpShape* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpSpace* ret_val; + cpSpace* ret_val = nullptr; ret_val = cpShapeGetSpace((cpShape*)arg0 ); @@ -3216,7 +3216,7 @@ bool JSB_cpShapeGetSurfaceVelocity(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg0; + cpShape* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -3236,7 +3236,7 @@ bool JSB_cpShapePointQuery(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg0; cpVect arg1; + cpShape* arg0 = nullptr; cpVect arg1; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); @@ -3254,7 +3254,7 @@ bool JSB_cpShapeSetBody(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg0; cpBody* arg1; + cpShape* arg0 = nullptr; cpBody* arg1 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_opaque( cx, args.get(1), (void**)&arg1 ); @@ -3271,7 +3271,7 @@ bool JSB_cpShapeSetCollisionType(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg0; cpCollisionType arg1; + cpShape* arg0 = nullptr; cpCollisionType arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_uint( cx, args.get(1), (unsigned int*) &arg1 ); @@ -3288,7 +3288,7 @@ bool JSB_cpShapeSetElasticity(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg0; double arg1; + cpShape* arg0 = nullptr; double arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -3305,7 +3305,7 @@ bool JSB_cpShapeSetFriction(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg0; double arg1; + cpShape* arg0 = nullptr; double arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -3322,7 +3322,7 @@ bool JSB_cpShapeSetGroup(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg0; cpGroup arg1; + cpShape* arg0 = nullptr; cpGroup arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_uint( cx, args.get(1), (unsigned int*) &arg1 ); @@ -3339,7 +3339,7 @@ bool JSB_cpShapeSetLayers(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg0; uint32_t arg1; + cpShape* arg0 = nullptr; uint32_t arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_uint32( cx, args.get(1), &arg1 ); @@ -3356,7 +3356,7 @@ bool JSB_cpShapeSetSensor(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg0; int32_t arg1; + cpShape* arg0 = nullptr; int32_t arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_int32( cx, args.get(1), &arg1 ); @@ -3373,7 +3373,7 @@ bool JSB_cpShapeSetSurfaceVelocity(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg0; cpVect arg1; + cpShape* arg0 = nullptr; cpVect arg1; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); @@ -3390,7 +3390,7 @@ bool JSB_cpShapeUpdate(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 3, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg0; cpVect arg1; cpVect arg2; + cpShape* arg0 = nullptr; cpVect arg1; cpVect arg2; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); @@ -3412,11 +3412,11 @@ bool JSB_cpSimpleMotorGetRate(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; + cpConstraint* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpSimpleMotorGetRate((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -3429,13 +3429,13 @@ bool JSB_cpSimpleMotorNew(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 3, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; cpBody* arg1; double arg2; + cpBody* arg0 = nullptr; cpBody* arg1 = nullptr; double arg2 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_opaque( cx, args.get(1), (void**)&arg1 ); ok &= JS::ToNumber( cx, args.get(2), &arg2 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpConstraint* ret_val; + cpConstraint* ret_val = nullptr; ret_val = cpSimpleMotorNew((cpBody*)arg0 , (cpBody*)arg1 , (cpFloat)arg2 ); @@ -3451,7 +3451,7 @@ bool JSB_cpSimpleMotorSetRate(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; double arg1; + cpConstraint* arg0 = nullptr; double arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -3468,7 +3468,7 @@ bool JSB_cpSlideJointGetAnchr1(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; + cpConstraint* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -3488,7 +3488,7 @@ bool JSB_cpSlideJointGetAnchr2(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; + cpConstraint* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -3508,11 +3508,11 @@ bool JSB_cpSlideJointGetMax(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; + cpConstraint* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpSlideJointGetMax((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -3525,11 +3525,11 @@ bool JSB_cpSlideJointGetMin(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; + cpConstraint* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpSlideJointGetMin((cpConstraint*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -3542,7 +3542,7 @@ bool JSB_cpSlideJointNew(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 6, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; cpBody* arg1; cpVect arg2; cpVect arg3; double arg4; double arg5; + cpBody* arg0 = nullptr; cpBody* arg1 = nullptr; cpVect arg2; cpVect arg3; double arg4 = 0; double arg5 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_opaque( cx, args.get(1), (void**)&arg1 ); @@ -3551,7 +3551,7 @@ bool JSB_cpSlideJointNew(JSContext *cx, uint32_t argc, jsval *vp) { ok &= JS::ToNumber( cx, args.get(4), &arg4 ); ok &= JS::ToNumber( cx, args.get(5), &arg5 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpConstraint* ret_val; + cpConstraint* ret_val = nullptr; ret_val = cpSlideJointNew((cpBody*)arg0 , (cpBody*)arg1 , (cpVect)arg2 , (cpVect)arg3 , (cpFloat)arg4 , (cpFloat)arg5 ); @@ -3567,7 +3567,7 @@ bool JSB_cpSlideJointSetAnchr1(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; cpVect arg1; + cpConstraint* arg0 = nullptr; cpVect arg1; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); @@ -3584,7 +3584,7 @@ bool JSB_cpSlideJointSetAnchr2(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; cpVect arg1; + cpConstraint* arg0 = nullptr; cpVect arg1; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); @@ -3601,7 +3601,7 @@ bool JSB_cpSlideJointSetMax(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; double arg1; + cpConstraint* arg0 = nullptr; double arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -3618,7 +3618,7 @@ bool JSB_cpSlideJointSetMin(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg0; double arg1; + cpConstraint* arg0 = nullptr; double arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -3635,7 +3635,7 @@ bool JSB_cpSpaceActivateShapesTouchingShape(JSContext *cx, uint32_t argc, jsval JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; cpShape* arg1; + cpSpace* arg0 = nullptr; cpShape* arg1 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_opaque( cx, args.get(1), (void**)&arg1 ); @@ -3652,12 +3652,12 @@ bool JSB_cpSpaceAddBody(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; cpBody* arg1; + cpSpace* arg0 = nullptr; cpBody* arg1 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_opaque( cx, args.get(1), (void**)&arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpBody* ret_val; + cpBody* ret_val = nullptr; ret_val = cpSpaceAddBody((cpSpace*)arg0 , (cpBody*)arg1 ); @@ -3673,12 +3673,12 @@ bool JSB_cpSpaceAddConstraint(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; cpConstraint* arg1; + cpSpace* arg0 = nullptr; cpConstraint* arg1 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_opaque( cx, args.get(1), (void**)&arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpConstraint* ret_val; + cpConstraint* ret_val = nullptr; ret_val = cpSpaceAddConstraint((cpSpace*)arg0 , (cpConstraint*)arg1 ); @@ -3694,12 +3694,12 @@ bool JSB_cpSpaceAddShape(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; cpShape* arg1; + cpSpace* arg0 = nullptr; cpShape* arg1 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_opaque( cx, args.get(1), (void**)&arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpShape* ret_val; + cpShape* ret_val = nullptr; ret_val = cpSpaceAddShape((cpSpace*)arg0 , (cpShape*)arg1 ); @@ -3715,12 +3715,12 @@ bool JSB_cpSpaceAddStaticShape(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; cpShape* arg1; + cpSpace* arg0 = nullptr; cpShape* arg1 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_opaque( cx, args.get(1), (void**)&arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpShape* ret_val; + cpShape* ret_val = nullptr; ret_val = cpSpaceAddStaticShape((cpSpace*)arg0 , (cpShape*)arg1 ); @@ -3736,7 +3736,7 @@ bool JSB_cpSpaceContainsBody(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; cpBody* arg1; + cpSpace* arg0 = nullptr; cpBody* arg1 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_opaque( cx, args.get(1), (void**)&arg1 ); @@ -3754,7 +3754,7 @@ bool JSB_cpSpaceContainsConstraint(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; cpConstraint* arg1; + cpSpace* arg0 = nullptr; cpConstraint* arg1 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_opaque( cx, args.get(1), (void**)&arg1 ); @@ -3772,7 +3772,7 @@ bool JSB_cpSpaceContainsShape(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; cpShape* arg1; + cpSpace* arg0 = nullptr; cpShape* arg1 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_opaque( cx, args.get(1), (void**)&arg1 ); @@ -3790,7 +3790,7 @@ bool JSB_cpSpaceDestroy(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; + cpSpace* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -3806,7 +3806,7 @@ bool JSB_cpSpaceFree(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; + cpSpace* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -3822,11 +3822,11 @@ bool JSB_cpSpaceGetCollisionBias(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; + cpSpace* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpSpaceGetCollisionBias((cpSpace*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -3839,11 +3839,11 @@ bool JSB_cpSpaceGetCollisionPersistence(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; + cpSpace* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpTimestamp ret_val; + cpTimestamp ret_val = 0; ret_val = cpSpaceGetCollisionPersistence((cpSpace*)arg0 ); args.rval().set(UINT_TO_JSVAL((uint32_t)ret_val)); @@ -3856,11 +3856,11 @@ bool JSB_cpSpaceGetCollisionSlop(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; + cpSpace* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpSpaceGetCollisionSlop((cpSpace*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -3873,11 +3873,11 @@ bool JSB_cpSpaceGetCurrentTimeStep(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; + cpSpace* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpSpaceGetCurrentTimeStep((cpSpace*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -3890,11 +3890,11 @@ bool JSB_cpSpaceGetDamping(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; + cpSpace* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpSpaceGetDamping((cpSpace*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -3907,7 +3907,7 @@ bool JSB_cpSpaceGetEnableContactGraph(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; + cpSpace* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -3924,7 +3924,7 @@ bool JSB_cpSpaceGetGravity(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; + cpSpace* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -3944,11 +3944,11 @@ bool JSB_cpSpaceGetIdleSpeedThreshold(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; + cpSpace* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpSpaceGetIdleSpeedThreshold((cpSpace*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -3961,11 +3961,11 @@ bool JSB_cpSpaceGetIterations(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; + cpSpace* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - int ret_val; + int ret_val = 0; ret_val = cpSpaceGetIterations((cpSpace*)arg0 ); args.rval().set(INT_TO_JSVAL((int32_t)ret_val)); @@ -3978,11 +3978,11 @@ bool JSB_cpSpaceGetSleepTimeThreshold(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; + cpSpace* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpSpaceGetSleepTimeThreshold((cpSpace*)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -3995,11 +3995,11 @@ bool JSB_cpSpaceGetStaticBody(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; + cpSpace* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpBody* ret_val; + cpBody* ret_val = nullptr; ret_val = cpSpaceGetStaticBody((cpSpace*)arg0 ); @@ -4015,11 +4015,11 @@ bool JSB_cpSpaceInit(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; + cpSpace* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpSpace* ret_val; + cpSpace* ret_val = nullptr; ret_val = cpSpaceInit((cpSpace*)arg0 ); @@ -4035,7 +4035,7 @@ bool JSB_cpSpaceIsLocked(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; + cpSpace* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -4051,7 +4051,7 @@ bool JSB_cpSpaceIsLocked(JSContext *cx, uint32_t argc, jsval *vp) { bool JSB_cpSpaceNew(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 0, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - cpSpace* ret_val; + cpSpace* ret_val = nullptr; ret_val = cpSpaceNew( ); @@ -4067,14 +4067,14 @@ bool JSB_cpSpacePointQueryFirst(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 4, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; cpVect arg1; uint32_t arg2; cpGroup arg3; + cpSpace* arg0 = nullptr; cpVect arg1; uint32_t arg2 = 0; cpGroup arg3 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); ok &= jsval_to_uint32( cx, args.get(2), &arg2 ); ok &= jsval_to_uint( cx, args.get(3), (unsigned int*) &arg3 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpShape* ret_val; + cpShape* ret_val = nullptr; ret_val = cpSpacePointQueryFirst((cpSpace*)arg0 , (cpVect)arg1 , (cpLayers)arg2 , (cpGroup)arg3 ); if(ret_val) { @@ -4093,7 +4093,7 @@ bool JSB_cpSpaceReindexShape(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; cpShape* arg1; + cpSpace* arg0 = nullptr; cpShape* arg1 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_opaque( cx, args.get(1), (void**)&arg1 ); @@ -4110,7 +4110,7 @@ bool JSB_cpSpaceReindexShapesForBody(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; cpBody* arg1; + cpSpace* arg0 = nullptr; cpBody* arg1 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_opaque( cx, args.get(1), (void**)&arg1 ); @@ -4127,7 +4127,7 @@ bool JSB_cpSpaceReindexStatic(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; + cpSpace* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -4143,7 +4143,7 @@ bool JSB_cpSpaceRemoveBody(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; cpBody* arg1; + cpSpace* arg0 = nullptr; cpBody* arg1 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_opaque( cx, args.get(1), (void**)&arg1 ); @@ -4160,7 +4160,7 @@ bool JSB_cpSpaceRemoveConstraint(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; cpConstraint* arg1; + cpSpace* arg0 = nullptr; cpConstraint* arg1 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_opaque( cx, args.get(1), (void**)&arg1 ); @@ -4177,7 +4177,7 @@ bool JSB_cpSpaceRemoveShape(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; cpShape* arg1; + cpSpace* arg0 = nullptr; cpShape* arg1 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_opaque( cx, args.get(1), (void**)&arg1 ); @@ -4194,7 +4194,7 @@ bool JSB_cpSpaceRemoveStaticShape(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; cpShape* arg1; + cpSpace* arg0 = nullptr; cpShape* arg1 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_opaque( cx, args.get(1), (void**)&arg1 ); @@ -4211,7 +4211,7 @@ bool JSB_cpSpaceSetCollisionBias(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; double arg1; + cpSpace* arg0 = nullptr; double arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -4228,7 +4228,7 @@ bool JSB_cpSpaceSetCollisionPersistence(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; uint32_t arg1; + cpSpace* arg0 = nullptr; uint32_t arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_uint32( cx, args.get(1), &arg1 ); @@ -4245,7 +4245,7 @@ bool JSB_cpSpaceSetCollisionSlop(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; double arg1; + cpSpace* arg0 = nullptr; double arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -4262,7 +4262,7 @@ bool JSB_cpSpaceSetDamping(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; double arg1; + cpSpace* arg0 = nullptr; double arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -4279,7 +4279,7 @@ bool JSB_cpSpaceSetEnableContactGraph(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; int32_t arg1; + cpSpace* arg0 = nullptr; int32_t arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_int32( cx, args.get(1), &arg1 ); @@ -4296,7 +4296,7 @@ bool JSB_cpSpaceSetGravity(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; cpVect arg1; + cpSpace* arg0 = nullptr; cpVect arg1; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); @@ -4313,7 +4313,7 @@ bool JSB_cpSpaceSetIdleSpeedThreshold(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; double arg1; + cpSpace* arg0 = nullptr; double arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -4330,7 +4330,7 @@ bool JSB_cpSpaceSetIterations(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; int32_t arg1; + cpSpace* arg0 = nullptr; int32_t arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= jsval_to_int32( cx, args.get(1), &arg1 ); @@ -4347,7 +4347,7 @@ bool JSB_cpSpaceSetSleepTimeThreshold(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; double arg1; + cpSpace* arg0 = nullptr; double arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -4364,7 +4364,7 @@ bool JSB_cpSpaceStep(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; double arg1; + cpSpace* arg0 = nullptr; double arg1 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -4381,7 +4381,7 @@ bool JSB_cpSpaceUseSpatialHash(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 3, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; double arg1; int32_t arg2; + cpSpace* arg0 = nullptr; double arg1 = 0; int32_t arg2 = 0; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -4399,11 +4399,11 @@ bool JSB_cpfabs(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpfabs((cpFloat)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -4416,13 +4416,13 @@ bool JSB_cpfclamp(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 3, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg0; double arg1; double arg2; + double arg0 = 0; double arg1 = 0; double arg2 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); ok &= JS::ToNumber( cx, args.get(2), &arg2 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpfclamp((cpFloat)arg0 , (cpFloat)arg1 , (cpFloat)arg2 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -4435,11 +4435,11 @@ bool JSB_cpfclamp01(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpfclamp01((cpFloat)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -4452,13 +4452,13 @@ bool JSB_cpflerp(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 3, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg0; double arg1; double arg2; + double arg0 = 0; double arg1 = 0; double arg2 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); ok &= JS::ToNumber( cx, args.get(2), &arg2 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpflerp((cpFloat)arg0 , (cpFloat)arg1 , (cpFloat)arg2 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -4471,13 +4471,13 @@ bool JSB_cpflerpconst(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 3, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg0; double arg1; double arg2; + double arg0 = 0; double arg1 = 0; double arg2 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); ok &= JS::ToNumber( cx, args.get(2), &arg2 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpflerpconst((cpFloat)arg0 , (cpFloat)arg1 , (cpFloat)arg2 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -4490,12 +4490,12 @@ bool JSB_cpfmax(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg0; double arg1; + double arg0 = 0; double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpfmax((cpFloat)arg0 , (cpFloat)arg1 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -4508,12 +4508,12 @@ bool JSB_cpfmin(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg0; double arg1; + double arg0 = 0; double arg1 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpfmin((cpFloat)arg0 , (cpFloat)arg1 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -4547,7 +4547,7 @@ bool JSB_cpvclamp(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpVect arg0; double arg1; + cpVect arg0; double arg1 = 0; ok &= jsval_to_cpVect( cx, args.get(0), (cpVect*) &arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -4573,7 +4573,7 @@ bool JSB_cpvcross(JSContext *cx, uint32_t argc, jsval *vp) { ok &= jsval_to_cpVect( cx, args.get(0), (cpVect*) &arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpvcross((cpVect)arg0 , (cpVect)arg1 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -4591,7 +4591,7 @@ bool JSB_cpvdist(JSContext *cx, uint32_t argc, jsval *vp) { ok &= jsval_to_cpVect( cx, args.get(0), (cpVect*) &arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpvdist((cpVect)arg0 , (cpVect)arg1 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -4609,7 +4609,7 @@ bool JSB_cpvdistsq(JSContext *cx, uint32_t argc, jsval *vp) { ok &= jsval_to_cpVect( cx, args.get(0), (cpVect*) &arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpvdistsq((cpVect)arg0 , (cpVect)arg1 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -4627,7 +4627,7 @@ bool JSB_cpvdot(JSContext *cx, uint32_t argc, jsval *vp) { ok &= jsval_to_cpVect( cx, args.get(0), (cpVect*) &arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpvdot((cpVect)arg0 , (cpVect)arg1 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -4658,7 +4658,7 @@ bool JSB_cpvforangle(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double arg0; + double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -4682,7 +4682,7 @@ bool JSB_cpvlength(JSContext *cx, uint32_t argc, jsval *vp) { ok &= jsval_to_cpVect( cx, args.get(0), (cpVect*) &arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpvlength((cpVect)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -4699,7 +4699,7 @@ bool JSB_cpvlengthsq(JSContext *cx, uint32_t argc, jsval *vp) { ok &= jsval_to_cpVect( cx, args.get(0), (cpVect*) &arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpvlengthsq((cpVect)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); @@ -4712,7 +4712,7 @@ bool JSB_cpvlerp(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 3, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpVect arg0; cpVect arg1; double arg2; + cpVect arg0; cpVect arg1; double arg2 = 0; ok &= jsval_to_cpVect( cx, args.get(0), (cpVect*) &arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); @@ -4734,7 +4734,7 @@ bool JSB_cpvlerpconst(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 3, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpVect arg0; cpVect arg1; double arg2; + cpVect arg0; cpVect arg1; double arg2 = 0; ok &= jsval_to_cpVect( cx, args.get(0), (cpVect*) &arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); @@ -4756,7 +4756,7 @@ bool JSB_cpvmult(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpVect arg0; double arg1; + cpVect arg0; double arg1 = 0; ok &= jsval_to_cpVect( cx, args.get(0), (cpVect*) &arg0 ); ok &= JS::ToNumber( cx, args.get(1), &arg1 ); @@ -4777,7 +4777,7 @@ bool JSB_cpvnear(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 3, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpVect arg0; cpVect arg1; double arg2; + cpVect arg0; cpVect arg1; double arg2 = 0; ok &= jsval_to_cpVect( cx, args.get(0), (cpVect*) &arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); @@ -4938,7 +4938,7 @@ bool JSB_cpvslerp(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 3, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpVect arg0; cpVect arg1; double arg2; + cpVect arg0; cpVect arg1; double arg2 = 0; ok &= jsval_to_cpVect( cx, args.get(0), (cpVect*) &arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); @@ -4960,7 +4960,7 @@ bool JSB_cpvslerpconst(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 3, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpVect arg0; cpVect arg1; double arg2; + cpVect arg0; cpVect arg1; double arg2 = 0; ok &= jsval_to_cpVect( cx, args.get(0), (cpVect*) &arg0 ); ok &= jsval_to_cpVect( cx, args.get(1), (cpVect*) &arg1 ); @@ -5007,7 +5007,7 @@ bool JSB_cpvtoangle(JSContext *cx, uint32_t argc, jsval *vp) { ok &= jsval_to_cpVect( cx, args.get(0), (cpVect*) &arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - cpFloat ret_val; + cpFloat ret_val = 0; ret_val = cpvtoangle((cpVect)arg0 ); args.rval().set(DOUBLE_TO_JSVAL(ret_val)); diff --git a/cocos/scripting/js-bindings/manual/chipmunk/js_bindings_chipmunk_manual.cpp b/cocos/scripting/js-bindings/manual/chipmunk/js_bindings_chipmunk_manual.cpp index 835f6d93af..4da02c3e13 100644 --- a/cocos/scripting/js-bindings/manual/chipmunk/js_bindings_chipmunk_manual.cpp +++ b/cocos/scripting/js-bindings/manual/chipmunk/js_bindings_chipmunk_manual.cpp @@ -98,7 +98,7 @@ bool JSPROXY_CCPhysicsSprite_getCPBody(JSContext *cx, uint32_t argc, jsval *vp) js_proxy_t *proxy = jsb_get_js_proxy(obj); PhysicsSprite* real = (PhysicsSprite *)(proxy ? proxy->ptr : NULL); TEST_NATIVE_OBJECT(cx, real) - cpBody* ret_val; + cpBody* ret_val = nullptr; ret_val = real->getCPBody(); jsval ret_jsval = c_class_to_jsval( cx, ret_val, JS::RootedObject(cx, JSB_cpBody_object), JSB_cpBody_class, "cpBody" ); @@ -135,7 +135,7 @@ bool JSPROXY_CCPhysicsSprite_setCPBody_(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg0; + cpBody* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); if( ! ok ) return false; @@ -185,7 +185,7 @@ bool JSB_CCPhysicsDebugNode_debugNodeForCPSpace__static(JSContext *cx, uint32_t JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; + cpSpace* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -228,7 +228,7 @@ bool JSB_CCPhysicsDebugNode_setSpace_(JSContext *cx, uint32_t argc, jsval *vp) { JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" ); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpSpace* arg0; + cpSpace* arg0 = nullptr; ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 ); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -343,7 +343,7 @@ bool JSPROXY_CCPhysicsSprite_spriteWithFile_rect__static(JSContext *cx, uint32_t JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; if (argc == 2) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); cocos2d::Rect arg1; ok &= jsval_to_ccrect(cx, args.get(1), &arg1); @@ -374,7 +374,7 @@ bool JSPROXY_CCPhysicsSprite_spriteWithFile_rect__static(JSContext *cx, uint32_t return true; } if (argc == 1) { - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); @@ -409,7 +409,7 @@ bool JSPROXY_CCPhysicsSprite_spriteWithFile_rect__static(JSContext *cx, uint32_t // Ret value: PhysicsSprite* (o) bool JSPROXY_CCPhysicsSprite_spriteWithSpriteFrame__static(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - cocos2d::SpriteFrame* arg0; + cocos2d::SpriteFrame* arg0 = nullptr; if (argc >= 1) { do { js_proxy_t *proxy; @@ -448,7 +448,7 @@ bool JSPROXY_CCPhysicsSprite_spriteWithSpriteFrame__static(JSContext *cx, uint32 bool JSPROXY_CCPhysicsSprite_spriteWithSpriteFrameName__static(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - const char* arg0; + const char* arg0 = nullptr; std::string arg0_tmp; if (argc == 1) { ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); @@ -613,7 +613,7 @@ bool jsval_to_cpBB( JSContext *cx, jsval vp, cpBB *ret ) ok &= JS_GetProperty(cx, jsobj, "t", &valt); JSB_PRECONDITION( ok, "Error obtaining point properties"); - double l, b, r, t; + double l = 0, b = 0, r = 0, t = 0; ok &= JS::ToNumber(cx, vall, &l); ok &= JS::ToNumber(cx, valb, &b); ok &= JS::ToNumber(cx, valr, &r); @@ -656,7 +656,7 @@ bool jsval_to_array_of_cpvect( JSContext *cx, jsval vp, cpVect**verts, int *numV JSB_PRECONDITION( jsobj && JS_IsArrayObject( cx, jsobj), "Object must be an array"); - uint32_t len; + uint32_t len = 0; JS_GetArrayLength(cx, jsobj, &len); JSB_PRECONDITION( len%2==0, "Array lenght should be even"); @@ -667,7 +667,7 @@ bool jsval_to_array_of_cpvect( JSContext *cx, jsval vp, cpVect**verts, int *numV JS::RootedValue valarg(cx); JS_GetElement(cx, jsobj, i, &valarg); - double value; + double value = 0; ok = JS::ToNumber(cx, valarg, &value); JSB_PRECONDITION( ok, "Error converting value to nsobject"); @@ -703,7 +703,7 @@ bool jsval_to_cpVect( JSContext *cx, jsval vp, cpVect *ret ) if( ! ok ) return false; - double x, y; + double x = 0, y = 0; ok &= JS::ToNumber(cx, valx, &x); ok &= JS::ToNumber(cx, valy, &y); @@ -717,7 +717,7 @@ bool jsval_to_cpVect( JSContext *cx, jsval vp, cpVect *ret ) #else // #! JSB_COMPATIBLE_WITH_COCOS2D_HTML5_BASIC_TYPES - JSObject *tmp_arg; + JSObject *tmp_arg = nullptr; if( ! JS_ValueToObject( cx, vp, &tmp_arg ) ) return false; @@ -906,7 +906,7 @@ void JSB_cpSpace_finalize(JSFreeOp *fop, JSObject *jsthis) // Remove collision handlers, since the user might have forgotten to manually remove them - struct collision_handler *current, *tmp; + struct collision_handler *current = nullptr, *tmp = nullptr; HASH_ITER(hh, collision_handler_hash, current, tmp) { if( current->space == space ) { @@ -945,6 +945,8 @@ static bool __jsb_cpSpace_addCollisionHandler(JSContext *cx, jsval *vp, jsval *argvp, cpSpace *space, unsigned int is_oo) { struct collision_handler *handler = (struct collision_handler*) malloc( sizeof(*handler) ); + handler->typeA = 0; + handler->typeB = 0; JSB_PRECONDITION(handler, "Error allocating memory"); @@ -1021,7 +1023,7 @@ bool JSB_cpSpaceAddCollisionHandler(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); // args - cpSpace *space; + cpSpace *space = nullptr; jsval* argvp = args.array(); bool ok = jsval_to_opaque( cx, JS::RootedValue(cx, *argvp++), (void**)&space); JSB_PRECONDITION(ok, "Error parsing arguments"); @@ -1122,8 +1124,8 @@ bool __jsb_cpSpace_removeCollisionHandler(JSContext *cx, jsval *vp, jsval *argvp { bool ok = true; - cpCollisionType typeA; - cpCollisionType typeB; + cpCollisionType typeA = 0; + cpCollisionType typeB = 0; ok &= jsval_to_int(cx, JS::RootedValue(cx, *argvp++), (int32_t*) &typeA ); ok &= jsval_to_int(cx, JS::RootedValue(cx, *argvp++), (int32_t*) &typeB ); @@ -1161,7 +1163,7 @@ bool JSB_cpSpaceRemoveCollisionHandler(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - cpSpace* space; + cpSpace* space = nullptr; jsval* argvp = args.array(); bool ok = jsval_to_opaque( cx, JS::RootedValue(cx, *argvp++), (void**)&space); @@ -1196,7 +1198,7 @@ bool JSB_cpSpace_addBody(JSContext *cx, uint32_t argc, jsval *vp) { cpSpace* arg0 = (cpSpace*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg1; + cpBody* arg1 = nullptr; jsval retval = args.get(0); struct jsb_c_proxy_s *retproxy; ok &= jsval_to_c_class( cx, args.get(0), (void**)&arg1, &retproxy ); @@ -1223,7 +1225,7 @@ bool JSB_cpSpace_addConstraint(JSContext *cx, uint32_t argc, jsval *vp) { cpSpace* arg0 = (cpSpace*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg1; + cpConstraint* arg1 = nullptr; jsval retval = args.get(0); struct jsb_c_proxy_s *retproxy; ok &= jsval_to_c_class( cx, args.get(0), (void**)&arg1, &retproxy ); @@ -1250,7 +1252,7 @@ bool JSB_cpSpace_addShape(JSContext *cx, uint32_t argc, jsval *vp) { cpSpace* arg0 = (cpSpace*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg1; + cpShape* arg1 = nullptr; jsval retval = args.get(0); struct jsb_c_proxy_s *retproxy; ok &= jsval_to_c_class( cx, args.get(0), (void**)&arg1, &retproxy ); @@ -1277,7 +1279,7 @@ bool JSB_cpSpace_addStaticShape(JSContext *cx, uint32_t argc, jsval *vp) { cpSpace* arg0 = (cpSpace*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg1; + cpShape* arg1 = nullptr; jsval retval = args.get(0); struct jsb_c_proxy_s *retproxy; ok &= jsval_to_c_class( cx, args.get(0), (void**)&arg1, &retproxy ); @@ -1306,9 +1308,9 @@ bool JSB_cpSpace_removeBody(JSContext *cx, uint32_t argc, jsval *vp) { cpSpace* arg0 = (cpSpace*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* arg1; + cpBody* arg1 = nullptr; - struct jsb_c_proxy_s *retproxy; + struct jsb_c_proxy_s *retproxy = nullptr; ok &= jsval_to_c_class( cx, args.get(0), (void**)&arg1, &retproxy ); JSB_PRECONDITION(ok, "Error processing arguments"); @@ -1329,9 +1331,9 @@ bool JSB_cpSpace_removeConstraint(JSContext *cx, uint32_t argc, jsval *vp) { cpSpace* arg0 = (cpSpace*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpConstraint* arg1; + cpConstraint* arg1 = nullptr; - struct jsb_c_proxy_s *retproxy; + struct jsb_c_proxy_s *retproxy = nullptr; ok &= jsval_to_c_class( cx, args.get(0), (void**)&arg1, &retproxy ); JSB_PRECONDITION(ok, "Error processing arguments"); @@ -1352,9 +1354,9 @@ bool JSB_cpSpace_removeShape(JSContext *cx, uint32_t argc, jsval *vp) { cpSpace* arg0 = (cpSpace*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg1; + cpShape* arg1 = nullptr; - struct jsb_c_proxy_s *retproxy; + struct jsb_c_proxy_s *retproxy = nullptr; ok &= jsval_to_c_class( cx, args.get(0), (void**)&arg1, &retproxy ); JSB_PRECONDITION(ok, "Error processing arguments"); @@ -1375,9 +1377,9 @@ bool JSB_cpSpace_removeStaticShape(JSContext *cx, uint32_t argc, jsval *vp) { cpSpace* arg0 = (cpSpace*) proxy->handle; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpShape* arg1; + cpShape* arg1 = nullptr; - struct jsb_c_proxy_s *retproxy; + struct jsb_c_proxy_s *retproxy = nullptr; ok &= jsval_to_c_class( cx, args.get(0), (void**)&arg1, &retproxy ); JSB_PRECONDITION(ok, "Error processing arguments"); @@ -1398,8 +1400,8 @@ bool JSB_cpSpace_segmentQueryFirst(JSContext *cx, uint32_t argc, jsval *vp){ cpVect start; cpVect end; - cpLayers layers; - cpGroup group; + cpLayers layers = 0; + cpGroup group = 0; bool ok = true; ok &= jsval_to_cpVect( cx, args.get(0), &start ); ok &= jsval_to_cpVect( cx, args.get(1), &end ); @@ -1434,9 +1436,9 @@ bool JSB_cpSpace_nearestPointQueryNearest(JSContext *cx, uint32_t argc, jsval *v JS::CallArgs args = JS::CallArgsFromVp(argc, vp); cpVect point; - double maxDistance; - cpLayers layers; - cpGroup group; + double maxDistance = 0; + cpLayers layers = 0; + cpGroup group = 0; bool ok = true; ok &= jsval_to_cpVect( cx, args.get(0), &point ); ok &= JS::ToNumber(cx, args.get(1), &maxDistance); @@ -1494,8 +1496,8 @@ bool JSB_cpSpace_pointQuery(JSContext *cx, uint32_t argc, jsval *vp) cpSpace* space = (cpSpace*) proxy->handle; cpVect point; - cpLayers layers; - cpGroup group; + cpLayers layers = 0; + cpGroup group = 0; bool ok = jsval_to_cpVect(cx, args.get(0), &point); ok &= jsval_to_uint32(cx, args.get(1), &layers); @@ -1546,9 +1548,9 @@ bool JSB_cpSpace_nearestPointQuery(JSContext *cx, uint32_t argc, jsval *vp) cpSpace* space = (cpSpace*) proxy->handle; cpVect point; - double maxDistance; - cpLayers layers; - cpGroup group; + double maxDistance = 0; + cpLayers layers = 0; + cpGroup group = 0; bool ok = jsval_to_cpVect(cx, args.get(0), &point); ok &= JS::ToNumber(cx, args.get(1), &maxDistance); @@ -1600,8 +1602,8 @@ bool JSB_cpSpace_segmentQuery(JSContext *cx, uint32_t argc, jsval *vp) cpVect start; cpVect end; - cpLayers layers; - cpGroup group; + cpLayers layers = 0; + cpGroup group = 0; bool ok = jsval_to_cpVect(cx, args.get(0), &start); ok = jsval_to_cpVect(cx, args.get(1), &end); @@ -1636,8 +1638,8 @@ bool JSB_cpSpace_bbQuery(JSContext *cx, uint32_t argc, jsval *vp) cpSpace* space = (cpSpace*) proxy->handle; cpBB bb; - cpLayers layers; - cpGroup group; + cpLayers layers = 0; + cpGroup group = 0; bool ok = jsval_to_cpBB(cx, args.get(0), &bb); ok &= jsval_to_uint32(cx, args.get(1), &layers); @@ -1866,8 +1868,8 @@ bool JSB_cpBody_eachArbiter(JSContext *cx, uint32_t argc, jsval *vp) static bool __jsb_cpArbiter_getBodies(JSContext *cx, const JS::CallArgs& args, cpArbiter *arbiter, unsigned int is_oo) { - cpBody *bodyA; - cpBody *bodyB; + cpBody *bodyA = nullptr; + cpBody *bodyB = nullptr; cpArbiterGetBodies(arbiter, &bodyA, &bodyB); JS::RootedValue valA(cx); @@ -1896,7 +1898,7 @@ bool JSB_cpArbiterGetBodies(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - cpArbiter* arbiter; + cpArbiter* arbiter = nullptr; if( ! jsval_to_opaque( cx, args.get(0), (void**)&arbiter ) ) return false; @@ -1922,8 +1924,8 @@ bool JSB_cpArbiter_getBodies(JSContext *cx, uint32_t argc, jsval *vp) static bool __jsb_cpArbiter_getShapes(JSContext *cx, const JS::CallArgs& args, cpArbiter *arbiter, unsigned int is_oo) { - cpShape *shapeA; - cpShape *shapeB; + cpShape *shapeA = nullptr; + cpShape *shapeB = nullptr; cpArbiterGetShapes(arbiter, &shapeA, &shapeB); JS::RootedValue valA(cx); @@ -1952,7 +1954,7 @@ bool JSB_cpArbiterGetShapes(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - cpArbiter* arbiter; + cpArbiter* arbiter = nullptr; if( ! jsval_to_opaque( cx, args.get(0), (void**) &arbiter ) ) return false; @@ -1983,7 +1985,7 @@ bool JSB_cpBody_constructor(JSContext *cx, uint32_t argc, jsval *vp) JSObject *jsobj = JS_NewObject(cx, JSB_cpBody_class, JS::RootedObject(cx, JSB_cpBody_object), JS::NullPtr()); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - double m; double i; + double m = 0; double i = 0; ok &= JS::ToNumber( cx, args.get(0), &m ); ok &= JS::ToNumber( cx, args.get(1), &i ); @@ -2025,7 +2027,7 @@ bool JSB_cpBodyGetUserData(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2(argc==1, cx, false, "Invalid number of arguments"); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - cpBody *body; + cpBody *body = nullptr; if( ! jsval_to_opaque( cx, args.get(0), (void**) &body ) ) return false; @@ -2068,7 +2070,7 @@ bool JSB_cpBodySetUserData(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2(argc==2, cx, false, "Invalid number of arguments"); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - cpBody *body; + cpBody *body = nullptr; jsval* argvp = args.array(); bool ok = jsval_to_opaque( cx, JS::RootedValue(cx, *argvp++), (void**) &body ); JSB_PRECONDITION(ok, "Error parsing arguments"); @@ -2096,8 +2098,8 @@ bool JSB_cpAreaForPoly(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2(argc==1, cx, false, "Invalid number of arguments"); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpVect *verts; - int numVerts; + cpVect *verts = nullptr; + int numVerts = 0; ok &= jsval_to_array_of_cpvect( cx, args.get(0), &verts, &numVerts); JSB_PRECONDITION2(ok, cx, false, "Error parsing array"); @@ -2116,9 +2118,10 @@ bool JSB_cpMomentForPoly(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2(argc==3, cx, false, "Invalid number of arguments"); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpVect *verts; cpVect offset; - int numVerts; - double m; + cpVect *verts = nullptr; + cpVect offset; + int numVerts = 0; + double m = 0; ok &= JS::ToNumber(cx, args.get(0), &m); ok &= jsval_to_array_of_cpvect( cx, args.get(1), &verts, &numVerts); @@ -2140,8 +2143,8 @@ bool JSB_cpCentroidForPoly(JSContext *cx, uint32_t argc, jsval *vp) JSB_PRECONDITION2(argc==1, cx, false, "Invalid number of arguments"); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpVect *verts; - int numVerts; + cpVect *verts = nullptr; + int numVerts = 0; ok &= jsval_to_array_of_cpvect( cx, args.get(0), &verts, &numVerts); JSB_PRECONDITION2(ok, cx, false, "Error parsing args"); @@ -2223,7 +2226,7 @@ bool JSB_cpBase_setHandle(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - void *handle; + void *handle = nullptr; bool ok = jsval_to_opaque(cx, args.get(0), &handle); JSB_PRECONDITION( ok, "Invalid parsing arguments"); @@ -2274,8 +2277,8 @@ bool JSB_cpPolyShape_constructor(JSContext *cx, uint32_t argc, jsval *vp) JSObject *jsobj = JS_NewObject(cx, JSB_cpPolyShape_class, JS::RootedObject(cx, JSB_cpPolyShape_object), JS::NullPtr()); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cpBody* body; cpVect *verts; cpVect offset; - int numVerts; + cpBody* body = nullptr; cpVect *verts = nullptr; cpVect offset; + int numVerts = 0; ok &= jsval_to_c_class( cx, args.get(0), (void**)&body, NULL ); ok &= jsval_to_array_of_cpvect( cx, args.get(1), &verts, &numVerts); diff --git a/cocos/scripting/js-bindings/manual/extension/jsb_cocos2dx_extension_manual.cpp b/cocos/scripting/js-bindings/manual/extension/jsb_cocos2dx_extension_manual.cpp index 039c804dd8..b44f1ad40e 100644 --- a/cocos/scripting/js-bindings/manual/extension/jsb_cocos2dx_extension_manual.cpp +++ b/cocos/scripting/js-bindings/manual/extension/jsb_cocos2dx_extension_manual.cpp @@ -867,7 +867,6 @@ bool js_cocos2dx_ext_AssetsManager_getFailedAssets(JSContext *cx, uint32_t argc, __JSDownloaderDelegator::__JSDownloaderDelegator(JSContext *cx, JS::HandleObject obj, const std::string &url, JS::HandleObject callback) : _cx(cx) , _url(url) -, _buffer(nullptr) { _obj.construct(_cx); _obj.ref().set(obj); @@ -879,10 +878,8 @@ __JSDownloaderDelegator::~__JSDownloaderDelegator() { _obj.destroyIfConstructed(); _jsCallback.destroyIfConstructed(); - if (_buffer != nullptr) - free(_buffer); - _downloader->setErrorCallback(nullptr); - _downloader->setSuccessCallback(nullptr); + _downloader->onTaskError = (nullptr); + _downloader->onDataTaskSuccess = (nullptr); } __JSDownloaderDelegator *__JSDownloaderDelegator::create(JSContext *cx, JS::HandleObject obj, const std::string &url, JS::HandleObject callback) @@ -894,24 +891,46 @@ __JSDownloaderDelegator *__JSDownloaderDelegator::create(JSContext *cx, JS::Hand void __JSDownloaderDelegator::startDownload() { - if (Director::getInstance()->getTextureCache()->getTextureForKey(_url)) + if (auto texture = Director::getInstance()->getTextureCache()->getTextureForKey(_url)) { - onSuccess(nullptr, nullptr, nullptr); + onSuccess(texture); } else { _downloader = std::make_shared(); - _downloader->setConnectionTimeout(8); - _downloader->setErrorCallback( std::bind(&__JSDownloaderDelegator::onError, this, std::placeholders::_1) ); - _downloader->setSuccessCallback( std::bind(&__JSDownloaderDelegator::onSuccess, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3) ); +// _downloader->setConnectionTimeout(8); + _downloader->onTaskError = [this](const cocos2d::network::DownloadTask& task, + int errorCode, + int errorCodeInternal, + const std::string& errorStr) + { + this->onError(); + }; - auto info = _downloader->getHeader(_url); - long contentSize = info.contentSize; - if (contentSize > 0 && info.responseCode < 400) { - _size = contentSize / sizeof(unsigned char); - _buffer = (unsigned char*)malloc(contentSize); - _downloader->downloadToBufferSync(_url, _buffer, _size); - } + _downloader->onDataTaskSuccess = [this](const cocos2d::network::DownloadTask& task, + std::vector& data) + { + Image img; + Texture2D *tex = nullptr; + do + { + if (false == img.initWithImageData(data.data(), data.size())) + { + break; + } + tex = Director::getInstance()->getTextureCache()->addImage(&img, _url); + } while (0); + if (tex) + { + this->onSuccess(tex); + } + else + { + this->onError(); + } + }; + + _downloader->createDownloadDataTask(_url); } } @@ -928,7 +947,7 @@ void __JSDownloaderDelegator::downloadAsync() t.detach(); } -void __JSDownloaderDelegator::onError(const cocos2d::network::Downloader::Error &error) +void __JSDownloaderDelegator::onError() { Director::getInstance()->getScheduler()->performFunctionInCocosThread([this] { @@ -945,22 +964,10 @@ void __JSDownloaderDelegator::onError(const cocos2d::network::Downloader::Error }); } -void __JSDownloaderDelegator::onSuccess(const std::string &srcUrl, const std::string &storagePath, const std::string &customId) +void __JSDownloaderDelegator::onSuccess(Texture2D *tex) { - Image *image = new Image(); - cocos2d::TextureCache *cache = Director::getInstance()->getTextureCache(); - - Texture2D *tex = cache->getTextureForKey(_url); - if (!tex) - { - if (image->initWithImageData(_buffer, _size)) - { - tex = Director::getInstance()->getTextureCache()->addImage(image, _url); - } - } - image->release(); - - Director::getInstance()->getScheduler()->performFunctionInCocosThread([this, tex] + CCASSERT(tex, "__JSDownloaderDelegator::onSuccess must make sure tex not null!"); + //Director::getInstance()->getScheduler()->performFunctionInCocosThread([this, tex] { JS::RootedObject global(_cx, ScriptingCore::getInstance()->getGlobalObject()); JSAutoCompartment ac(_cx, global); @@ -993,7 +1000,7 @@ void __JSDownloaderDelegator::onSuccess(const std::string &srcUrl, const std::st JS_CallFunctionValue(_cx, global, callback, JS::HandleValueArray::fromMarkedLocation(2, valArr), &retval); } release(); - }); + }//); } // jsb.loadRemoteImg(url, function(succeed, result) {}) diff --git a/cocos/scripting/js-bindings/manual/extension/jsb_cocos2dx_extension_manual.h b/cocos/scripting/js-bindings/manual/extension/jsb_cocos2dx_extension_manual.h index 355482fe40..1235ff1123 100644 --- a/cocos/scripting/js-bindings/manual/extension/jsb_cocos2dx_extension_manual.h +++ b/cocos/scripting/js-bindings/manual/extension/jsb_cocos2dx_extension_manual.h @@ -28,6 +28,7 @@ #include "jsfriendapi.h" #include "mozilla/Maybe.h" #include "cocos/network/CCDownloader.h" +#include "renderer/CCTexture2D.h" class __JSDownloaderDelegator : cocos2d::Ref { @@ -44,10 +45,8 @@ protected: void startDownload(); private: - void onSuccess(const std::string &srcUrl, const std::string &storagePath, const std::string &customId); - void onError(const cocos2d::network::Downloader::Error &error); - unsigned char *_buffer; - long _size; + void onSuccess(cocos2d::Texture2D *tex); + void onError(); std::shared_ptr _downloader; std::string _url; JSContext *_cx; diff --git a/cocos/scripting/js-bindings/manual/js_manual_conversions.cpp b/cocos/scripting/js-bindings/manual/js_manual_conversions.cpp index 20a2bf7e9f..24097f76b9 100644 --- a/cocos/scripting/js-bindings/manual/js_manual_conversions.cpp +++ b/cocos/scripting/js-bindings/manual/js_manual_conversions.cpp @@ -2182,6 +2182,21 @@ jsval quaternion_to_jsval(JSContext* cx, const cocos2d::Quaternion& q) return JSVAL_NULL; } +jsval uniform_to_jsval(JSContext* cx, const cocos2d::Uniform* uniform) +{ + JS::RootedObject tmp(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr())); + if(!tmp) return JSVAL_NULL; + bool ok = JS_DefineProperty(cx, tmp, "location", uniform->location, JSPROP_ENUMERATE | JSPROP_PERMANENT) && + JS_DefineProperty(cx, tmp, "size", uniform->size, JSPROP_ENUMERATE | JSPROP_PERMANENT) && + JS_DefineProperty(cx, tmp, "type", uniform->type, JSPROP_ENUMERATE | JSPROP_PERMANENT) && + JS_DefineProperty(cx, tmp, "name", JS::RootedValue(cx, std_string_to_jsval(cx, uniform->name)), JSPROP_ENUMERATE | JSPROP_PERMANENT); + if(ok) + return OBJECT_TO_JSVAL(tmp); + + return JSVAL_NULL; +} + + jsval meshVertexAttrib_to_jsval(JSContext* cx, const cocos2d::MeshVertexAttrib& q) { JS::RootedObject tmp(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr())); diff --git a/cocos/scripting/js-bindings/manual/js_manual_conversions.h b/cocos/scripting/js-bindings/manual/js_manual_conversions.h index 584fea58c9..ae99be38f3 100644 --- a/cocos/scripting/js-bindings/manual/js_manual_conversions.h +++ b/cocos/scripting/js-bindings/manual/js_manual_conversions.h @@ -271,6 +271,7 @@ jsval ccaffinetransform_to_jsval(JSContext* cx, const cocos2d::AffineTransform& jsval FontDefinition_to_jsval(JSContext* cx, const cocos2d::FontDefinition& t); jsval quaternion_to_jsval(JSContext* cx, const cocos2d::Quaternion& q); jsval meshVertexAttrib_to_jsval(JSContext* cx, const cocos2d::MeshVertexAttrib& q); +jsval uniform_to_jsval(JSContext* cx, const cocos2d::Uniform* uniform); template js_proxy_t *js_get_or_create_proxy(JSContext *cx, T *native_obj); diff --git a/cocos/scripting/js-bindings/script/jsb_boot.js b/cocos/scripting/js-bindings/script/jsb_boot.js index 86f5b740df..e6fbe904d3 100644 --- a/cocos/scripting/js-bindings/script/jsb_boot.js +++ b/cocos/scripting/js-bindings/script/jsb_boot.js @@ -786,6 +786,7 @@ cc.view.setDesignResolutionSize = function(width,height,resolutionPolicy){ cc.winSize = cc.director.getWinSize(); cc.visibleRect.init(); }; +cc.view.setRealPixelResolution = cc.view.setDesignResolutionSize; cc.view.setResolutionPolicy = function(resolutionPolicy){ var size = cc.view.getDesignResolutionSize(); cc.view.setDesignResolutionSize(size.width,size.height,resolutionPolicy); @@ -816,6 +817,10 @@ cc.audioEngine.end = function(){ this.stopMusic(); this.stopAllEffects(); }; +cc.audioEngine.features = { + MULTI_CHANNEL: true, + AUTOPLAY: true +}; /** * @type {Object} * @name cc.configuration @@ -1365,8 +1370,18 @@ cc._initSys = function(config, CONFIG_KEY){ } })(); + /** + * Indicate the real pixel resolution of the whole game window + * @memberof cc.sys + * @name windowPixelResolution + * @type {Number} + */ + locSys.windowPixelResolution = cc.view.getFrameSize(); + /** The type of browser */ - locSys.browserType = null;//null in jsb + locSys.browserType = null; //null in jsb + /** The version of browser */ + locSys.browserVersion = null; //null in jsb capabilities = locSys.capabilities = {"opengl":true}; if( locSys.isMobile ) { diff --git a/cocos/scripting/js-bindings/script/jsb_cocos2d.js b/cocos/scripting/js-bindings/script/jsb_cocos2d.js index c9cd0b1466..42e1a4bc7f 100644 --- a/cocos/scripting/js-bindings/script/jsb_cocos2d.js +++ b/cocos/scripting/js-bindings/script/jsb_cocos2d.js @@ -26,7 +26,7 @@ // CCConfig.js // -cc.ENGINE_VERSION = "Cocos2d-JS v3.8 RC0"; +cc.ENGINE_VERSION = "Cocos2d-JS v3.8"; cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL = 0; cc.DIRECTOR_STATS_POSITION = {x: 0, y: 0}; @@ -1276,49 +1276,6 @@ cc.defineGetterSetter(_proto, "ORANGE", _proto._getOrange); _proto.GRAY; cc.defineGetterSetter(_proto, "GRAY", _proto._getGray); -// Extends -cc.Node.extend = cc.Class.extend; -cc.AtlasNode.extend = cc.Class.extend; -cc.Layer.extend = cc.Class.extend; -cc.LayerGradient.extend = cc.Class.extend; -cc.LayerColor.extend = cc.Class.extend; -cc.LayerMultiplex.extend = cc.Class.extend; -cc.Sprite.extend = cc.Class.extend; -cc.SpriteBatchNode.extend = cc.Class.extend; -cc.SpriteFrame.extend = cc.Class.extend; -cc.LabelTTF.extend = cc.Class.extend; -cc.LabelBMFont.extend = cc.Class.extend; -cc.LabelAtlas.extend = cc.Class.extend; -cc.Menu.extend = cc.Class.extend; -cc.MenuItem.extend = cc.Class.extend; -cc.MenuItemLabel.extend = cc.Class.extend; -cc.MenuItemFont.extend = cc.Class.extend; -cc.MenuItemAtlasFont.extend = cc.Class.extend; -cc.MenuItemSprite.extend = cc.Class.extend; -cc.MenuItemImage.extend = cc.Class.extend; -cc.MenuItemToggle.extend = cc.Class.extend; -cc.Scene.extend = cc.Class.extend; -cc.ClippingNode.extend = cc.Class.extend; -cc.ProgressTimer.extend = cc.Class.extend; -cc.ParallaxNode.extend = cc.Class.extend; -cc.DrawNode.extend = cc.Class.extend; -cc.Component.extend = cc.Class.extend; -cc.GridBase.extend = cc.Class.extend; -cc.Grid3D.extend = cc.Class.extend; -cc.TiledGrid3D.extend = cc.Class.extend; -cc.MotionStreak.extend = cc.Class.extend; -cc.ParticleBatchNode.extend = cc.Class.extend; -cc.ParticleSystem.extend = cc.Class.extend; -cc.TextFieldTTF.extend = cc.Class.extend; -cc.RenderTexture.extend = cc.Class.extend; -cc.TileMapAtlas.extend = cc.Class.extend; -cc.TMXLayer.extend = cc.Class.extend; -cc.TMXTiledMap.extend = cc.Class.extend; -cc.TMXMapInfo.extend = cc.Class.extend; -cc.TransitionScene.extend = cc.Class.extend; -cc.GLProgram.extend = cc.Class.extend; - - // Cocos2d-html5 supports multi scene resources preloading. // This is a compatible function for JSB. cc.Loader = cc.Class.extend({ diff --git a/cocos/scripting/js-bindings/script/jsb_opengl_constants.js b/cocos/scripting/js-bindings/script/jsb_opengl_constants.js index d9bed9393c..1a2b892da5 100644 --- a/cocos/scripting/js-bindings/script/jsb_opengl_constants.js +++ b/cocos/scripting/js-bindings/script/jsb_opengl_constants.js @@ -381,6 +381,7 @@ gl.INVERT = 0x150a; gl.KEEP = 0x1e00; gl.KHR_debug = 0x1; gl.KHR_texture_compression_astc_ldr = 0x1; +gl.LEFT = 0x0406; gl.LEQUAL = 0x203; gl.LESS = 0x201; gl.LINEAR = 0x2601; @@ -620,6 +621,7 @@ gl.RGBA4_OES = 0x8056; gl.RGBA8_OES = 0x8058; gl.RGB_422_APPLE = 0x8a1f; gl.RG_EXT = 0x8227; +gl.RIGHT = 0x0407; gl.SAMPLER = 0x82e6; gl.SAMPLER_2D = 0x8b5e; gl.SAMPLER_2D_ARRAY_SHADOW_NV = 0x8dc4; diff --git a/cocos/scripting/js-bindings/script/studio/jsb_studio_load.js b/cocos/scripting/js-bindings/script/studio/jsb_studio_load.js index 1b8ae731d8..74914a54d7 100644 --- a/cocos/scripting/js-bindings/script/studio/jsb_studio_load.js +++ b/cocos/scripting/js-bindings/script/studio/jsb_studio_load.js @@ -193,6 +193,28 @@ ccs.load = function(file, path){ return object; }; +/** + * Analysis of studio JSON file and layout ui widgets by visible size. + * The incoming file name, parse out the corresponding object + * Temporary support file list: + * ui 1.* + * node 1.* - 2.* + * action 1.* - 2.* + * scene 0.* - 1.* + * @param {String} file + * @param {String} [path=] Resource path + * @returns {{node: cc.Node, action: cc.Action}} + */ +ccs.loadWithVisibleSize = function(file, path){ + var object = ccs.load(file, path); + var size = cc.director.getVisibleSize(); + if(object.node && size){ + object.node.setContentSize(size.width, size.height); + ccui.helper.doLayout(object.node); + } + return object; +}; + //Forward compatible interface ccs.actionTimelineCache = { diff --git a/cocos/scripting/js-bindings/script/studio/parsers/timelineParser-2.x.js b/cocos/scripting/js-bindings/script/studio/parsers/timelineParser-2.x.js index 1ecc5a070b..5699352c79 100644 --- a/cocos/scripting/js-bindings/script/studio/parsers/timelineParser-2.x.js +++ b/cocos/scripting/js-bindings/script/studio/parsers/timelineParser-2.x.js @@ -160,6 +160,7 @@ } }; + var skyBoxBrushInstance = null; var getSkyboxRes = function(json, key) { if(json.hasOwnProperty(key) && json[key].hasOwnProperty("Path")) { return json[key]["Path"]; @@ -172,7 +173,7 @@ * @param json * @returns {cc.Node} */ - parser.initSingleNode = function(json){ + parser.initSingleNode = function(json, resourcePath){ var node = new cc.Node(); this.generalAttributes(node, json); @@ -180,23 +181,25 @@ if(color != null) node.setColor(getColor(color)); - if(json.hasOwnProperty("SkyBoxEnabled") && true == json["SkyBoxEnabled"]) + if(json.hasOwnProperty("SkyBoxEnabled") && true == json["SkyBoxEnabled"]&& + json.hasOwnProperty("SkyBoxValid") && true == json["SkyBoxValid"]) { - var leftFileData = getSkyboxRes(json, "LeftImage"); - var rightFileData = getSkyboxRes(json, "RightImage"); - var upFileData = getSkyboxRes(json, "UpImage"); - var downFileData = getSkyboxRes(json, "DownImage"); - var forwardFileData = getSkyboxRes(json, "ForwardImage"); - var backFileData = getSkyboxRes(json, "BackImage"); - var cameraFlag = json["SkyBoxMask"]; - if(undefined === cameraFlag || isNaN(cameraFlag)) { - cameraFlag = 1024; + var leftFileData = resourcePath + getSkyboxRes(json, "LeftImage"); + var rightFileData = resourcePath + getSkyboxRes(json, "RightImage"); + var upFileData = resourcePath + getSkyboxRes(json, "UpImage"); + var downFileData = resourcePath + getSkyboxRes(json, "DownImage"); + var forwardFileData = resourcePath + getSkyboxRes(json, "ForwardImage"); + var backFileData = resourcePath + getSkyboxRes(json, "BackImage"); + var fileUtil = jsb.fileUtils; + if(fileUtil.isFileExist(leftFileData)&& + fileUtil.isFileExist(rightFileData)&& + fileUtil.isFileExist(upFileData)&& + fileUtil.isFileExist(downFileData)&& + fileUtil.isFileExist(forwardFileData)&& + fileUtil.isFileExist(backFileData)) + { + skyBoxBrushInstance = cc.CameraBackgroundSkyBoxBrush.create(leftFileData,rightFileData,upFileData,downFileData,forwardFileData,backFileData); } - - var skyBox = new jsb.Skybox(); - skyBox.init(leftFileData,rightFileData,upFileData,downFileData,forwardFileData,backFileData); - skyBox.setCameraMask(cameraFlag, false); - node.addChild(skyBox); } return node; @@ -1439,7 +1442,7 @@ * @param json * @returns {*} */ - parser.initCamera = function(json){ + parser.initCamera = function(json,resourcePath){ var s = cc.winSize; var fov = json["Fov"] ? json["Fov"] : 60; @@ -1500,21 +1503,34 @@ node.setCameraFlag(cameraFlag); } - if(json.hasOwnProperty("SkyBoxEnabled") && true == json["SkyBoxEnabled"]) + if(json.hasOwnProperty("SkyBoxEnabled") && true == json["SkyBoxEnabled"] && + json.hasOwnProperty("SkyBoxValid") && true == json["SkyBoxValid"]) { - var leftFileData = getSkyboxRes(json, "LeftImage"); - var rightFileData = getSkyboxRes(json, "RightImage"); - var upFileData = getSkyboxRes(json, "UpImage"); - var downFileData = getSkyboxRes(json, "DownImage"); - var forwardFileData = getSkyboxRes(json, "ForwardImage"); - var backFileData = getSkyboxRes(json, "BackImage"); + var leftFileData = resourcePath + getSkyboxRes(json, "LeftImage"); + var rightFileData = resourcePath + getSkyboxRes(json, "RightImage"); + var upFileData = resourcePath + getSkyboxRes(json, "UpImage"); + var downFileData = resourcePath + getSkyboxRes(json, "DownImage"); + var forwardFileData = resourcePath + getSkyboxRes(json, "ForwardImage"); + var backFileData = resourcePath + getSkyboxRes(json, "BackImage"); - var skyBox = new jsb.Skybox(); - skyBox.init(leftFileData,rightFileData,upFileData,downFileData,forwardFileData,backFileData); - skyBox.setCameraMask(cameraFlag); - node.addChild(skyBox); + var fileUtil = jsb.fileUtils; + if(fileUtil.isFileExist(leftFileData)&& + fileUtil.isFileExist(rightFileData)&& + fileUtil.isFileExist(upFileData)&& + fileUtil.isFileExist(downFileData)&& + fileUtil.isFileExist(forwardFileData)&& + fileUtil.isFileExist(backFileData)) + { + var innerBrush = cc.CameraBackgroundSkyBoxBrush.create(leftFileData,rightFileData,upFileData,downFileData,forwardFileData,backFileData); + node.setBackgroundBrush(innerBrush); + } + else + node.setBackgroundBrush(skyBoxBrushInstance); } - + else if(skyBoxBrushInstance != null) + { + node.setBackgroundBrush(skyBoxBrushInstance); + } return node; }; @@ -1546,6 +1562,11 @@ node.setColor(col); } + if(json.hasOwnProperty("IsFlipped") && true == json["IsFlipped"]) { + node.setCullFaceEnabled(true); + node.setCullFace(gl.FRONT); + } + var autoAction = getParam(json["RunAction3D"], false); if(autoAction && resFile){ var animation = jsb.Animation3D.create(resFile, ""); diff --git a/cocos/scripting/lua-bindings/auto/api/Button.lua b/cocos/scripting/lua-bindings/auto/api/Button.lua index 3b8ebc7ff3..b5cff2b758 100644 --- a/cocos/scripting/lua-bindings/auto/api/Button.lua +++ b/cocos/scripting/lua-bindings/auto/api/Button.lua @@ -41,6 +41,14 @@ -- @param self -- @return Label#Label ret (return value: cc.Label) +-------------------------------- +-- brief Return the nine-patch sprite of clicked state
+-- return the nine-patch sprite of clicked state
+-- since v3.9 +-- @function [parent=#Button] getRendererClicked +-- @param self +-- @return Scale9Sprite#Scale9Sprite ret (return value: ccui.Scale9Sprite) + -------------------------------- -- brief Return a zoom scale
-- return the zoom scale in float
@@ -64,6 +72,14 @@ -- @param #color3b_table color -- @return Button#Button self (return value: ccui.Button) +-------------------------------- +-- brief Return the nine-patch sprite of disabled state
+-- return the nine-patch sprite of disabled state
+-- since v3.9 +-- @function [parent=#Button] getRendererDisabled +-- @param self +-- @return Scale9Sprite#Scale9Sprite ret (return value: ccui.Scale9Sprite) + -------------------------------- -- Sets capInsets for button, only the disabled state scale9 renderer will be affected.
-- param capInsets capInsets in Rect. @@ -204,6 +220,14 @@ -- @param self -- @return float#float ret (return value: float) +-------------------------------- +-- brief Return the nine-patch sprite of normal state
+-- return the nine-patch sprite of normal state
+-- since v3.9 +-- @function [parent=#Button] getRendererNormal +-- @param self +-- @return Scale9Sprite#Scale9Sprite ret (return value: ccui.Scale9Sprite) + -------------------------------- -- Query the font name of button's title
-- return font name in std::string diff --git a/cocos/scripting/lua-bindings/auto/api/CSLoader.lua b/cocos/scripting/lua-bindings/auto/api/CSLoader.lua index eb6dab057a..5f158180ec 100644 --- a/cocos/scripting/lua-bindings/auto/api/CSLoader.lua +++ b/cocos/scripting/lua-bindings/auto/api/CSLoader.lua @@ -86,6 +86,15 @@ -- @param self -- @return CSLoader#CSLoader self (return value: cc.CSLoader) +-------------------------------- +-- @overload self, string, function +-- @overload self, string +-- @function [parent=#CSLoader] createNodeWithVisibleSize +-- @param self +-- @param #string filename +-- @param #function callback +-- @return Node#Node ret (return value: cc.Node) + -------------------------------- -- -- @function [parent=#CSLoader] getInstance diff --git a/cocos/scripting/lua-bindings/auto/api/ComponentPhysics2d.lua b/cocos/scripting/lua-bindings/auto/api/ComponentPhysics2d.lua new file mode 100644 index 0000000000..04cd94baf7 --- /dev/null +++ b/cocos/scripting/lua-bindings/auto/api/ComponentPhysics2d.lua @@ -0,0 +1,71 @@ + +-------------------------------- +-- @module ComponentPhysics2d +-- @extend Component +-- @parent_module cc + +-------------------------------- +-- Set physics body of this physics component. If the physics body is set to
+-- another physics component before, will set another physics component's physics
+-- body to null.
+-- param physicsBody The physics body belongs to this component. +-- @function [parent=#ComponentPhysics2d] setPhysicsBody +-- @param self +-- @param #cc.PhysicsBody physicsBody +-- @return ComponentPhysics2d#ComponentPhysics2d self (return value: cc.ComponentPhysics2d) + +-------------------------------- +-- Get the physics body of this component.
+-- return The physics body of this component. +-- @function [parent=#ComponentPhysics2d] getPhysicsBody +-- @param self +-- @return PhysicsBody#PhysicsBody ret (return value: cc.PhysicsBody) + +-------------------------------- +-- @overload self, cc.PhysicsBody +-- @overload self +-- @function [parent=#ComponentPhysics2d] create +-- @param self +-- @param #cc.PhysicsBody physicsBody +-- @return ComponentPhysics2d#ComponentPhysics2d ret (return value: cc.ComponentPhysics2d) + +-------------------------------- +-- +-- @function [parent=#ComponentPhysics2d] setEnabled +-- @param self +-- @param #bool value +-- @return ComponentPhysics2d#ComponentPhysics2d self (return value: cc.ComponentPhysics2d) + +-------------------------------- +-- +-- @function [parent=#ComponentPhysics2d] onRemove +-- @param self +-- @return ComponentPhysics2d#ComponentPhysics2d self (return value: cc.ComponentPhysics2d) + +-------------------------------- +-- +-- @function [parent=#ComponentPhysics2d] onEnter +-- @param self +-- @return ComponentPhysics2d#ComponentPhysics2d self (return value: cc.ComponentPhysics2d) + +-------------------------------- +-- +-- @function [parent=#ComponentPhysics2d] onExit +-- @param self +-- @return ComponentPhysics2d#ComponentPhysics2d self (return value: cc.ComponentPhysics2d) + +-------------------------------- +-- +-- @function [parent=#ComponentPhysics2d] onAdd +-- @param self +-- @return ComponentPhysics2d#ComponentPhysics2d self (return value: cc.ComponentPhysics2d) + +-------------------------------- +-- @overload self, cc.PhysicsBody +-- @overload self +-- @function [parent=#ComponentPhysics2d] ComponentPhysics2d +-- @param self +-- @param #cc.PhysicsBody phsicsBody +-- @return ComponentPhysics2d#ComponentPhysics2d self (return value: cc.ComponentPhysics2d) + +return nil diff --git a/cocos/scripting/lua-bindings/auto/api/Director.lua b/cocos/scripting/lua-bindings/auto/api/Director.lua index 8db28ae43d..eb6049ec18 100644 --- a/cocos/scripting/lua-bindings/auto/api/Director.lua +++ b/cocos/scripting/lua-bindings/auto/api/Director.lua @@ -358,7 +358,7 @@ -- @return Director#Director self (return value: cc.Director) -------------------------------- --- Whether or not to display the FPS on the bottom-left corner. +-- Whether or not displaying the FPS on the bottom-left corner of the screen. -- @function [parent=#Director] isDisplayStats -- @param self -- @return bool#bool ret (return value: bool) @@ -390,8 +390,8 @@ -- @return Director#Director self (return value: cc.Director) -------------------------------- --- Gets the distance between camera and near clipping frane.
--- It is correct for default camera that near clipping frane is the same as screen. +-- Gets the distance between camera and near clipping frame.
+-- It is correct for default camera that near clipping frame is same as the screen. -- @function [parent=#Director] getZEye -- @param self -- @return float#float ret (return value: float) @@ -450,7 +450,7 @@ -- @return bool#bool ret (return value: bool) -------------------------------- --- Display the FPS on the bottom-left corner. +-- Display the FPS on the bottom-left corner of the screen. -- @function [parent=#Director] setDisplayStats -- @param self -- @param #bool displayStats @@ -474,7 +474,7 @@ -- @return Director#Director self (return value: cc.Director) -------------------------------- --- Sets the FPS value. FPS = 1/internal. +-- Sets the FPS value. FPS = 1/interval. -- @function [parent=#Director] setAnimationInterval -- @param self -- @param #float interval diff --git a/cocos/scripting/lua-bindings/auto/api/Grid3D.lua b/cocos/scripting/lua-bindings/auto/api/Grid3D.lua index 6d70cce7cd..5c73a82676 100644 --- a/cocos/scripting/lua-bindings/auto/api/Grid3D.lua +++ b/cocos/scripting/lua-bindings/auto/api/Grid3D.lua @@ -40,7 +40,7 @@ -------------------------------- -- @{
--- Implementations for interfaces in base calss. +-- Implementations for interfaces in base class. -- @function [parent=#Grid3D] beforeBlit -- @param self -- @return Grid3D#Grid3D self (return value: cc.Grid3D) diff --git a/cocos/scripting/lua-bindings/auto/api/ListView.lua b/cocos/scripting/lua-bindings/auto/api/ListView.lua index 14ea4b5978..7f51eced55 100644 --- a/cocos/scripting/lua-bindings/auto/api/ListView.lua +++ b/cocos/scripting/lua-bindings/auto/api/ListView.lua @@ -4,6 +4,55 @@ -- @extend ScrollView -- @parent_module ccui +-------------------------------- +-- Set the gravity of ListView.
+-- see `ListViewGravity` +-- @function [parent=#ListView] setGravity +-- @param self +-- @param #int gravity +-- @return ListView#ListView self (return value: ccui.ListView) + +-------------------------------- +-- Removes the last item of ListView. +-- @function [parent=#ListView] removeLastItem +-- @param self +-- @return ListView#ListView self (return value: ccui.ListView) + +-------------------------------- +-- brief Query the center item
+-- return A item instance. +-- @function [parent=#ListView] getCenterItemInCurrentView +-- @param self +-- @return Widget#Widget ret (return value: ccui.Widget) + +-------------------------------- +-- brief Query current selected widget's idnex.
+-- return A index of a selected item. +-- @function [parent=#ListView] getCurSelectedIndex +-- @param self +-- @return long#long ret (return value: long) + +-------------------------------- +-- brief Query margin between each item in ListView.
+-- return A margin in float. +-- @function [parent=#ListView] getItemsMargin +-- @param self +-- @return float#float ret (return value: float) + +-------------------------------- +-- Set magnetic type of ListView.
+-- see `MagneticType` +-- @function [parent=#ListView] setMagneticType +-- @param self +-- @param #int magneticType +-- @return ListView#ListView self (return value: ccui.ListView) + +-------------------------------- +-- +-- @function [parent=#ListView] refreshViewIfNecessary +-- @param self +-- @return ListView#ListView self (return value: ccui.ListView) + -------------------------------- -- Return the index of specified widget.
-- param item A widget pointer.
@@ -13,20 +62,6 @@ -- @param #ccui.Widget item -- @return long#long ret (return value: long) --------------------------------- --- brief Remove all items in current ListView. --- @function [parent=#ListView] removeAllItems --- @param self --- @return ListView#ListView self (return value: ccui.ListView) - --------------------------------- --- Set the gravity of ListView.
--- see `ListViewGravity` --- @function [parent=#ListView] setGravity --- @param self --- @param #int gravity --- @return ListView#ListView self (return value: ccui.ListView) - -------------------------------- -- Insert a custom item into the end of ListView.
-- param item A item in `Widget*`. @@ -35,28 +70,6 @@ -- @param #ccui.Widget item -- @return ListView#ListView self (return value: ccui.ListView) --------------------------------- --- Return all items in a ListView.
--- returns A vector of widget pointers. --- @function [parent=#ListView] getItems --- @param self --- @return array_table#array_table ret (return value: array_table) - --------------------------------- --- Remove a item at given index.
--- param index A given index in ssize_t. --- @function [parent=#ListView] removeItem --- @param self --- @param #long index --- @return ListView#ListView self (return value: ccui.ListView) - --------------------------------- --- brief Query current selected widget's idnex.
--- return A index of a selected item. --- @function [parent=#ListView] getCurSelectedIndex --- @param self --- @return long#long ret (return value: long) - -------------------------------- -- Insert a default item(create by cloning model) into listview at a give index.
-- param index A index in ssize_t. @@ -66,12 +79,60 @@ -- @return ListView#ListView self (return value: ccui.ListView) -------------------------------- --- brief Refresh view and layout of ListView manually.
--- This method will mark ListView content as dirty and the content view will be refershed in the next frame. --- @function [parent=#ListView] requestRefreshView +-- Set magnetic allowed out of boundary. +-- @function [parent=#ListView] setMagneticAllowedOutOfBoundary +-- @param self +-- @param #bool magneticAllowedOutOfBoundary +-- @return ListView#ListView self (return value: ccui.ListView) + +-------------------------------- +-- Add a event click callback to ListView, then one item of Listview is clicked, the callback will be called.
+-- param callback A callback function with type of `ccListViewCallback`. +-- @function [parent=#ListView] addEventListener +-- @param self +-- @param #function callback +-- @return ListView#ListView self (return value: ccui.ListView) + +-------------------------------- +-- +-- @function [parent=#ListView] doLayout -- @param self -- @return ListView#ListView self (return value: ccui.ListView) +-------------------------------- +-- brief Query the topmost item in horizontal list
+-- return A item instance. +-- @function [parent=#ListView] getTopmostItemInCurrentView +-- @param self +-- @return Widget#Widget ret (return value: ccui.Widget) + +-------------------------------- +-- brief Remove all items in current ListView. +-- @function [parent=#ListView] removeAllItems +-- @param self +-- @return ListView#ListView self (return value: ccui.ListView) + +-------------------------------- +-- brief Query the bottommost item in horizontal list
+-- return A item instance. +-- @function [parent=#ListView] getBottommostItemInCurrentView +-- @param self +-- @return Widget#Widget ret (return value: ccui.Widget) + +-------------------------------- +-- Return all items in a ListView.
+-- returns A vector of widget pointers. +-- @function [parent=#ListView] getItems +-- @param self +-- @return array_table#array_table ret (return value: array_table) + +-------------------------------- +-- brief Query the leftmost item in horizontal list
+-- return A item instance. +-- @function [parent=#ListView] getLeftmostItemInCurrentView +-- @param self +-- @return Widget#Widget ret (return value: ccui.Widget) + -------------------------------- -- Set the margin between each item in ListView.
-- param margin @@ -81,31 +142,10 @@ -- @return ListView#ListView self (return value: ccui.ListView) -------------------------------- --- brief Refresh content view of ListView. --- @function [parent=#ListView] refreshView +-- Get magnetic type of ListView. +-- @function [parent=#ListView] getMagneticType -- @param self --- @return ListView#ListView self (return value: ccui.ListView) - --------------------------------- --- Removes the last item of ListView. --- @function [parent=#ListView] removeLastItem --- @param self --- @return ListView#ListView self (return value: ccui.ListView) - --------------------------------- --- brief Query margin between each item in ListView.
--- return A margin in float. --- @function [parent=#ListView] getItemsMargin --- @param self --- @return float#float ret (return value: float) - --------------------------------- --- Add a event click callback to ListView, then one item of Listview is clicked, the callback will be called.
--- param callback A callback function with type of `ccListViewCallback`. --- @function [parent=#ListView] addEventListener --- @param self --- @param #function callback --- @return ListView#ListView self (return value: ccui.ListView) +-- @return int#int ret (return value: int) -------------------------------- -- Return a item at a given index.
@@ -116,6 +156,73 @@ -- @param #long index -- @return Widget#Widget ret (return value: ccui.Widget) +-------------------------------- +-- Remove a item at given index.
+-- param index A given index in ssize_t. +-- @function [parent=#ListView] removeItem +-- @param self +-- @param #long index +-- @return ListView#ListView self (return value: ccui.ListView) + +-------------------------------- +-- @overload self, int, vec2_table, vec2_table, float +-- @overload self, int, vec2_table, vec2_table +-- @function [parent=#ListView] scrollToItem +-- @param self +-- @param #int itemIndex +-- @param #vec2_table positionRatioInView +-- @param #vec2_table itemAnchorPoint +-- @param #float timeInSec +-- @return ListView#ListView self (return value: ccui.ListView) + +-------------------------------- +-- Insert a a default item(create by a cloned model) at the end of the listview. +-- @function [parent=#ListView] pushBackDefaultItem +-- @param self +-- @return ListView#ListView self (return value: ccui.ListView) + +-------------------------------- +-- Query whether the magnetic out of boundary is allowed. +-- @function [parent=#ListView] getMagneticAllowedOutOfBoundary +-- @param self +-- @return bool#bool ret (return value: bool) + +-------------------------------- +-- brief Query the closest item to a specific position in inner container.
+-- param targetPosition Specifies the target position in inner container's coordinates.
+-- param itemAnchorPoint Specifies an anchor point of each item for position to calculate distance.
+-- return A item instance if list view is not empty. Otherwise, returns null. +-- @function [parent=#ListView] getClosestItemToPosition +-- @param self +-- @param #vec2_table targetPosition +-- @param #vec2_table itemAnchorPoint +-- @return Widget#Widget ret (return value: ccui.Widget) + +-------------------------------- +-- brief Query the rightmost item in horizontal list
+-- return A item instance. +-- @function [parent=#ListView] getRightmostItemInCurrentView +-- @param self +-- @return Widget#Widget ret (return value: ccui.Widget) + +-------------------------------- +-- brief Query the closest item to a specific position in current view.
+-- For instance, to find the item in the center of view, call 'getClosestItemToPositionInCurrentView(Vec2::ANCHOR_MIDDLE, Vec2::ANCHOR_MIDDLE)'.
+-- param positionRatioInView Specifies the target position with ratio in list view's content size.
+-- param itemAnchorPoint Specifies an anchor point of each item for position to calculate distance.
+-- return A item instance if list view is not empty. Otherwise, returns null. +-- @function [parent=#ListView] getClosestItemToPositionInCurrentView +-- @param self +-- @param #vec2_table positionRatioInView +-- @param #vec2_table itemAnchorPoint +-- @return Widget#Widget ret (return value: ccui.Widget) + +-------------------------------- +-- brief Refresh content view of ListView. +-- @function [parent=#ListView] refreshView +-- @param self +-- @return ListView#ListView self (return value: ccui.ListView) + -------------------------------- -- Set a item model for listview.
-- When calling `pushBackDefaultItem`, the model will be used as a blueprint and new model copy will be inserted into ListView.
@@ -126,14 +233,9 @@ -- @return ListView#ListView self (return value: ccui.ListView) -------------------------------- --- --- @function [parent=#ListView] doLayout --- @param self --- @return ListView#ListView self (return value: ccui.ListView) - --------------------------------- --- Insert a a default item(create by a cloned model) at the end of the listview. --- @function [parent=#ListView] pushBackDefaultItem +-- brief Refresh view and layout of ListView manually.
+-- This method will mark ListView content as dirty and the content view will be refershed in the next frame. +-- @function [parent=#ListView] requestRefreshView -- @param self -- @return ListView#ListView self (return value: ccui.ListView) @@ -172,6 +274,12 @@ -- @param #string name -- @return ListView#ListView self (return value: ccui.ListView) +-------------------------------- +-- Override functions +-- @function [parent=#ListView] jumpToBottom +-- @param self +-- @return ListView#ListView self (return value: ccui.ListView) + -------------------------------- -- -- @function [parent=#ListView] forceDoLayout @@ -189,9 +297,15 @@ -------------------------------- -- --- @function [parent=#ListView] getDescription +-- @function [parent=#ListView] jumpToTopRight -- @param self --- @return string#string ret (return value: string) +-- @return ListView#ListView self (return value: ccui.ListView) + +-------------------------------- +-- +-- @function [parent=#ListView] jumpToLeft +-- @param self +-- @return ListView#ListView self (return value: ccui.ListView) -------------------------------- -- @@ -206,6 +320,18 @@ -- @param self -- @return ListView#ListView self (return value: ccui.ListView) +-------------------------------- +-- +-- @function [parent=#ListView] jumpToTop +-- @param self +-- @return ListView#ListView self (return value: ccui.ListView) + +-------------------------------- +-- +-- @function [parent=#ListView] jumpToTopLeft +-- @param self +-- @return ListView#ListView self (return value: ccui.ListView) + -------------------------------- -- -- @function [parent=#ListView] removeChild @@ -220,6 +346,51 @@ -- @param self -- @return bool#bool ret (return value: bool) +-------------------------------- +-- +-- @function [parent=#ListView] jumpToBottomLeft +-- @param self +-- @return ListView#ListView self (return value: ccui.ListView) + +-------------------------------- +-- +-- @function [parent=#ListView] jumpToBottomRight +-- @param self +-- @return ListView#ListView self (return value: ccui.ListView) + +-------------------------------- +-- +-- @function [parent=#ListView] jumpToPercentBothDirection +-- @param self +-- @param #vec2_table percent +-- @return ListView#ListView self (return value: ccui.ListView) + +-------------------------------- +-- +-- @function [parent=#ListView] jumpToPercentHorizontal +-- @param self +-- @param #float percent +-- @return ListView#ListView self (return value: ccui.ListView) + +-------------------------------- +-- +-- @function [parent=#ListView] jumpToRight +-- @param self +-- @return ListView#ListView self (return value: ccui.ListView) + +-------------------------------- +-- +-- @function [parent=#ListView] getDescription +-- @param self +-- @return string#string ret (return value: string) + +-------------------------------- +-- +-- @function [parent=#ListView] jumpToPercentVertical +-- @param self +-- @param #float percent +-- @return ListView#ListView self (return value: ccui.ListView) + -------------------------------- -- Default constructor
-- js ctor
diff --git a/cocos/scripting/lua-bindings/auto/api/Node.lua b/cocos/scripting/lua-bindings/auto/api/Node.lua index 406ac0a66e..69f6882ad4 100644 --- a/cocos/scripting/lua-bindings/auto/api/Node.lua +++ b/cocos/scripting/lua-bindings/auto/api/Node.lua @@ -197,7 +197,7 @@ -- @return Node#Node self (return value: cc.Node) -------------------------------- --- +-- / @} end of component functions -- @function [parent=#Node] getOpacity -- @param self -- @return unsigned char#unsigned char ret (return value: unsigned char) @@ -423,6 +423,12 @@ -- @param #vec2_table worldPoint -- @return vec2_table#vec2_table ret (return value: vec2_table) +-------------------------------- +-- +-- @function [parent=#Node] isOpacityModifyRGB +-- @param self +-- @return bool#bool ret (return value: bool) + -------------------------------- -- @overload self, float, float -- @overload self, vec2_table @@ -599,12 +605,6 @@ -- @param #unsigned int parentFlags -- @return Node#Node self (return value: cc.Node) --------------------------------- --- --- @function [parent=#Node] isOpacityModifyRGB --- @param self --- @return bool#bool ret (return value: bool) - -------------------------------- -- Returns the rotation of the node in degrees.
-- see `setRotation(float)`
diff --git a/cocos/scripting/lua-bindings/auto/api/PhysicsManager.lua b/cocos/scripting/lua-bindings/auto/api/PhysicsManager.lua new file mode 100644 index 0000000000..c61521e211 --- /dev/null +++ b/cocos/scripting/lua-bindings/auto/api/PhysicsManager.lua @@ -0,0 +1,39 @@ + +-------------------------------- +-- @module PhysicsManager +-- @parent_module cc + +-------------------------------- +-- Remove a physics component from `PhysiscsManager`. Will remove physics component's physics
+-- body from the physics world managed by this `PhysicsManager`. +-- @function [parent=#PhysicsManager] removePhysicsComponent +-- @param self +-- @param #cc.ComponentPhysics2d componentPhsics2d +-- @return PhysicsManager#PhysicsManager self (return value: cc.PhysicsManager) + +-------------------------------- +-- Add a physics component to be managed by the `PhysicsManager`. Will register physics
+-- component's physics body to physics world managed by this `PhysicsManager`.
+-- param componentPhsics2d The physics component to be managed by this `PhysicsManager`. +-- @function [parent=#PhysicsManager] addPhysicsComponent +-- @param self +-- @param #cc.ComponentPhysics2d componentPhsics2d +-- @return PhysicsManager#PhysicsManager self (return value: cc.PhysicsManager) + +-------------------------------- +-- Get the physics world.
+-- return Physics world managed by this `PhysicsManager`. +-- @function [parent=#PhysicsManager] getPhysicsWorld +-- @param self +-- @return PhysicsWorld#PhysicsWorld ret (return value: cc.PhysicsWorld) + +-------------------------------- +-- Create a PhysicsManager with `Scene`. `Scene` will create it automatically,
+-- so don't create it yourself.
+-- scene The scene this `PhysicsManager` belongs to. +-- @function [parent=#PhysicsManager] PhysicsManager +-- @param self +-- @param #cc.Scene scene +-- @return PhysicsManager#PhysicsManager self (return value: cc.PhysicsManager) + +return nil diff --git a/cocos/scripting/lua-bindings/auto/api/Scene.lua b/cocos/scripting/lua-bindings/auto/api/Scene.lua index 82f13176e8..7a4c8dfa22 100644 --- a/cocos/scripting/lua-bindings/auto/api/Scene.lua +++ b/cocos/scripting/lua-bindings/auto/api/Scene.lua @@ -58,16 +58,6 @@ -- @param self -- @return Scene#Scene ret (return value: cc.Scene) --------------------------------- --- @overload self, cc.Node, int, string --- @overload self, cc.Node, int, int --- @function [parent=#Scene] addChild --- @param self --- @param #cc.Node child --- @param #int zOrder --- @param #int tag --- @return Scene#Scene self (return value: cc.Scene) - -------------------------------- -- -- @function [parent=#Scene] init diff --git a/cocos/scripting/lua-bindings/auto/api/ScrollView.lua b/cocos/scripting/lua-bindings/auto/api/ScrollView.lua index d73edbdb3d..272d798062 100644 --- a/cocos/scripting/lua-bindings/auto/api/ScrollView.lua +++ b/cocos/scripting/lua-bindings/auto/api/ScrollView.lua @@ -6,23 +6,23 @@ -------------------------------- -- Scroll inner container to top boundary of scrollview.
--- param second Time in seconds.
+-- param timeInSec Time in seconds.
-- param attenuated Whether scroll speed attenuate or not. -- @function [parent=#ScrollView] scrollToTop -- @param self --- @param #float second +-- @param #float timeInSec -- @param #bool attenuated -- @return ScrollView#ScrollView self (return value: ccui.ScrollView) -------------------------------- -- Scroll inner container to horizontal percent position of scrollview.
-- param percent A value between 0 and 100.
--- param second Time in seconds.
+-- param timeInSec Time in seconds.
-- param attenuated Whether scroll speed attenuate or not. -- @function [parent=#ScrollView] scrollToPercentHorizontal -- @param self -- @param #float percent --- @param #float second +-- @param #float timeInSec -- @param #bool attenuated -- @return ScrollView#ScrollView self (return value: ccui.ScrollView) @@ -52,12 +52,12 @@ -------------------------------- -- Scroll inner container to both direction percent position of scrollview.
-- param percent A value between 0 and 100.
--- param second Time in seconds.
+-- param timeInSec Time in seconds.
-- param attenuated Whether scroll speed attenuate or not. -- @function [parent=#ScrollView] scrollToPercentBothDirection -- @param self -- @param #vec2_table percent --- @param #float second +-- @param #float timeInSec -- @param #bool attenuated -- @return ScrollView#ScrollView self (return value: ccui.ScrollView) @@ -79,11 +79,11 @@ -------------------------------- -- Scroll inner container to bottom and left boundary of scrollview.
--- param second Time in seconds.
+-- param timeInSec Time in seconds.
-- param attenuated Whether scroll speed attenuate or not. -- @function [parent=#ScrollView] scrollToBottomLeft -- @param self --- @param #float second +-- @param #float timeInSec -- @param #bool attenuated -- @return ScrollView#ScrollView self (return value: ccui.ScrollView) @@ -120,11 +120,11 @@ -------------------------------- -- Scroll inner container to top and left boundary of scrollview.
--- param second Time in seconds.
+-- param timeInSec Time in seconds.
-- param attenuated Whether scroll speed attenuate or not. -- @function [parent=#ScrollView] scrollToTopLeft -- @param self --- @param #float second +-- @param #float timeInSec -- @param #bool attenuated -- @return ScrollView#ScrollView self (return value: ccui.ScrollView) @@ -277,11 +277,11 @@ -------------------------------- -- Scroll inner container to left boundary of scrollview.
--- param second Time in seconds.
+-- param timeInSec Time in seconds.
-- param attenuated Whether scroll speed attenuate or not. -- @function [parent=#ScrollView] scrollToLeft -- @param self --- @param #float second +-- @param #float timeInSec -- @param #bool attenuated -- @return ScrollView#ScrollView self (return value: ccui.ScrollView) @@ -303,22 +303,22 @@ -------------------------------- -- Scroll inner container to vertical percent position of scrollview.
-- param percent A value between 0 and 100.
--- param second Time in seconds.
+-- param timeInSec Time in seconds.
-- param attenuated Whether scroll speed attenuate or not. -- @function [parent=#ScrollView] scrollToPercentVertical -- @param self -- @param #float percent --- @param #float second +-- @param #float timeInSec -- @param #bool attenuated -- @return ScrollView#ScrollView self (return value: ccui.ScrollView) -------------------------------- -- Scroll inner container to bottom boundary of scrollview.
--- param second Time in seconds.
+-- param timeInSec Time in seconds.
-- param attenuated Whether scroll speed attenuate or not. -- @function [parent=#ScrollView] scrollToBottom -- @param self --- @param #float second +-- @param #float timeInSec -- @param #bool attenuated -- @return ScrollView#ScrollView self (return value: ccui.ScrollView) @@ -331,11 +331,11 @@ -------------------------------- -- Scroll inner container to bottom and right boundary of scrollview.
--- param second Time in seconds
+-- param timeInSec Time in seconds
-- param attenuated Whether scroll speed attenuate or not. -- @function [parent=#ScrollView] scrollToBottomRight -- @param self --- @param #float time +-- @param #float timeInSec -- @param #bool attenuated -- @return ScrollView#ScrollView self (return value: ccui.ScrollView) @@ -370,11 +370,11 @@ -------------------------------- -- Scroll inner container to right boundary of scrollview.
--- param second Time in seconds.
+-- param timeInSec Time in seconds.
-- param attenuated Whether scroll speed attenuate or not. -- @function [parent=#ScrollView] scrollToRight -- @param self --- @param #float time +-- @param #float timeInSec -- @param #bool attenuated -- @return ScrollView#ScrollView self (return value: ccui.ScrollView) @@ -407,11 +407,11 @@ -------------------------------- -- Scroll inner container to top and right boundary of scrollview.
--- param second Time in seconds.
+-- param timeInSec Time in seconds.
-- param attenuated Whether scroll speed attenuate or not. -- @function [parent=#ScrollView] scrollToTopRight -- @param self --- @param #float time +-- @param #float timeInSec -- @param #bool attenuated -- @return ScrollView#ScrollView self (return value: ccui.ScrollView) diff --git a/cocos/scripting/lua-bindings/auto/api/Sprite.lua b/cocos/scripting/lua-bindings/auto/api/Sprite.lua index 44e61a83f3..1b907d0ce3 100644 --- a/cocos/scripting/lua-bindings/auto/api/Sprite.lua +++ b/cocos/scripting/lua-bindings/auto/api/Sprite.lua @@ -186,13 +186,6 @@ -- @param self -- @return rect_table#rect_table ret (return value: rect_table) --------------------------------- --- --- @function [parent=#Sprite] debugDraw --- @param self --- @param #bool on --- @return Sprite#Sprite self (return value: cc.Sprite) - -------------------------------- -- @overload self, string, rect_table -- @overload self, string diff --git a/cocos/scripting/lua-bindings/auto/api/Sprite3D.lua b/cocos/scripting/lua-bindings/auto/api/Sprite3D.lua index d8f4aa6252..3e05d25a70 100644 --- a/cocos/scripting/lua-bindings/auto/api/Sprite3D.lua +++ b/cocos/scripting/lua-bindings/auto/api/Sprite3D.lua @@ -172,7 +172,7 @@ -- @return Action#Action ret (return value: cc.Action) -------------------------------- --- just rember bind attributes +-- just remember bind attributes -- @function [parent=#Sprite3D] setGLProgram -- @param self -- @param #cc.GLProgram glprogram @@ -180,7 +180,7 @@ -------------------------------- -- Returns 2d bounding-box
--- Note: the bouding-box is just get from the AABB which as Z=0, so that is not very accurate. +-- Note: the bounding-box is just get from the AABB which as Z=0, so that is not very accurate. -- @function [parent=#Sprite3D] getBoundingBox -- @param self -- @return rect_table#rect_table ret (return value: rect_table) diff --git a/cocos/scripting/lua-bindings/auto/api/Terrain.lua b/cocos/scripting/lua-bindings/auto/api/Terrain.lua index 8630b342dc..385372f31b 100644 --- a/cocos/scripting/lua-bindings/auto/api/Terrain.lua +++ b/cocos/scripting/lua-bindings/auto/api/Terrain.lua @@ -97,7 +97,7 @@ -- @return bool#bool ret (return value: bool) -------------------------------- --- Set threshold distance of each LOD level,must equal or gereater than the chunk size
+-- Set threshold distance of each LOD level,must equal or greater than the chunk size
-- Note when invoke initHeightMap, the LOD distance will be automatic calculated. -- @function [parent=#Terrain] setLODDistance -- @param self @@ -113,7 +113,7 @@ -- @return size_table#size_table ret (return value: size_table) -------------------------------- --- get the normal of the specified pistion in terrain
+-- get the normal of the specified position in terrain
-- return the normal vector of the specified position of the terrain.
-- note the fast normal calculation may not get precise normal vector. -- @function [parent=#Terrain] getNormal @@ -152,13 +152,13 @@ -- @return Terrain#Terrain self (return value: cc.Terrain) -------------------------------- --- get the terrain's mininal height. +-- get the terrain's minimal height. -- @function [parent=#Terrain] getMinHeight -- @param self -- @return float#float ret (return value: float) -------------------------------- --- get the terrain's maximum height. +-- get the terrain's maximal height. -- @function [parent=#Terrain] getMaxHeight -- @param self -- @return float#float ret (return value: float) diff --git a/cocos/scripting/lua-bindings/auto/api/TiledGrid3D.lua b/cocos/scripting/lua-bindings/auto/api/TiledGrid3D.lua index b59e195164..002c48a64e 100644 --- a/cocos/scripting/lua-bindings/auto/api/TiledGrid3D.lua +++ b/cocos/scripting/lua-bindings/auto/api/TiledGrid3D.lua @@ -25,7 +25,7 @@ -------------------------------- -- @{
--- Implementations for interfaces in base calss. +-- Implementations for interfaces in base class. -- @function [parent=#TiledGrid3D] blit -- @param self -- @return TiledGrid3D#TiledGrid3D self (return value: cc.TiledGrid3D) diff --git a/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_auto_api.lua b/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_auto_api.lua index 9682fe5436..340cf0c853 100644 --- a/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_auto_api.lua +++ b/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_auto_api.lua @@ -36,6 +36,11 @@ -- @field [parent=#cc] EventKeyboard#EventKeyboard EventKeyboard preloaded module +-------------------------------------------------------- +-- the cc Component +-- @field [parent=#cc] Component#Component Component preloaded module + + -------------------------------------------------------- -- the cc Node -- @field [parent=#cc] Node#Node Node preloaded module @@ -1306,9 +1311,4 @@ -- @field [parent=#cc] TileMapAtlas#TileMapAtlas TileMapAtlas preloaded module --------------------------------------------------------- --- the cc Component --- @field [parent=#cc] Component#Component Component preloaded module - - return nil diff --git a/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_physics_auto_api.lua b/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_physics_auto_api.lua index ce2faeb562..cd5dfccee6 100644 --- a/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_physics_auto_api.lua +++ b/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_physics_auto_api.lua @@ -151,4 +151,14 @@ -- @field [parent=#cc] PhysicsDebugDraw#PhysicsDebugDraw PhysicsDebugDraw preloaded module +-------------------------------------------------------- +-- the cc ComponentPhysics2d +-- @field [parent=#cc] ComponentPhysics2d#ComponentPhysics2d ComponentPhysics2d preloaded module + + +-------------------------------------------------------- +-- the cc PhysicsManager +-- @field [parent=#cc] PhysicsManager#PhysicsManager PhysicsManager preloaded module + + return nil diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp index 3e14809075..269ccf98f1 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp @@ -2873,6 +2873,552 @@ int lua_register_cocos2dx_EventKeyboard(lua_State* tolua_S) return 1; } +int lua_cocos2dx_Component_setEnabled(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Component* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_setEnabled'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + bool arg0; + + ok &= luaval_to_boolean(tolua_S, 2,&arg0, "cc.Component:setEnabled"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Component_setEnabled'", nullptr); + return 0; + } + cobj->setEnabled(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:setEnabled",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_setEnabled'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Component_setName(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Component* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_setName'", 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, "cc.Component:setName"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Component_setName'", nullptr); + return 0; + } + cobj->setName(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:setName",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_setName'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Component_isEnabled(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Component* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_isEnabled'", 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_Component_isEnabled'", nullptr); + return 0; + } + bool ret = cobj->isEnabled(); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:isEnabled",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_isEnabled'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Component_onRemove(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Component* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_onRemove'", 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_Component_onRemove'", nullptr); + return 0; + } + cobj->onRemove(); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:onRemove",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_onRemove'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Component_update(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Component* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_update'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + double arg0; + + ok &= luaval_to_number(tolua_S, 2,&arg0, "cc.Component:update"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Component_update'", nullptr); + return 0; + } + cobj->update(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:update",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_update'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Component_getOwner(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Component* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_getOwner'", 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_Component_getOwner'", nullptr); + return 0; + } + cocos2d::Node* ret = cobj->getOwner(); + object_to_luaval(tolua_S, "cc.Node",(cocos2d::Node*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:getOwner",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_getOwner'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Component_init(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Component* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_init'", 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_Component_init'", nullptr); + return 0; + } + bool ret = cobj->init(); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:init",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_init'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Component_onAdd(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Component* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_onAdd'", 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_Component_onAdd'", nullptr); + return 0; + } + cobj->onAdd(); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:onAdd",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_onAdd'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Component_getName(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Component* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_getName'", 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_Component_getName'", nullptr); + return 0; + } + const std::string& ret = cobj->getName(); + tolua_pushcppstring(tolua_S,ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:getName",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_getName'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Component_setOwner(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Component* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_setOwner'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + cocos2d::Node* arg0; + + ok &= luaval_to_object(tolua_S, 2, "cc.Node",&arg0, "cc.Component:setOwner"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Component_setOwner'", nullptr); + return 0; + } + cobj->setOwner(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:setOwner",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_setOwner'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Component_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,"cc.Component",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_Component_create'", nullptr); + return 0; + } + cocos2d::Component* ret = cocos2d::Component::create(); + object_to_luaval(tolua_S, "cc.Component",(cocos2d::Component*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d\n ", "cc.Component:create",argc, 0); + return 0; +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_create'.",&tolua_err); +#endif + return 0; +} +static int lua_cocos2dx_Component_finalize(lua_State* tolua_S) +{ + printf("luabindings: finalizing LUA object (Component)"); + return 0; +} + +int lua_register_cocos2dx_Component(lua_State* tolua_S) +{ + tolua_usertype(tolua_S,"cc.Component"); + tolua_cclass(tolua_S,"Component","cc.Component","cc.Ref",nullptr); + + tolua_beginmodule(tolua_S,"Component"); + tolua_function(tolua_S,"setEnabled",lua_cocos2dx_Component_setEnabled); + tolua_function(tolua_S,"setName",lua_cocos2dx_Component_setName); + tolua_function(tolua_S,"isEnabled",lua_cocos2dx_Component_isEnabled); + tolua_function(tolua_S,"onRemove",lua_cocos2dx_Component_onRemove); + tolua_function(tolua_S,"update",lua_cocos2dx_Component_update); + tolua_function(tolua_S,"getOwner",lua_cocos2dx_Component_getOwner); + tolua_function(tolua_S,"init",lua_cocos2dx_Component_init); + tolua_function(tolua_S,"onAdd",lua_cocos2dx_Component_onAdd); + tolua_function(tolua_S,"getName",lua_cocos2dx_Component_getName); + tolua_function(tolua_S,"setOwner",lua_cocos2dx_Component_setOwner); + tolua_function(tolua_S,"create", lua_cocos2dx_Component_create); + tolua_endmodule(tolua_S); + std::string typeName = typeid(cocos2d::Component).name(); + g_luaType[typeName] = "cc.Component"; + g_typeCast["Component"] = "cc.Component"; + return 1; +} + int lua_cocos2dx_Node_addChild(lua_State* tolua_S) { int argc = 0; @@ -5376,6 +5922,53 @@ int lua_cocos2dx_Node_convertToNodeSpace(lua_State* tolua_S) return 0; } +int lua_cocos2dx_Node_isOpacityModifyRGB(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Node* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Node",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Node*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Node_isOpacityModifyRGB'", 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_Node_isOpacityModifyRGB'", nullptr); + return 0; + } + bool ret = cobj->isOpacityModifyRGB(); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Node:isOpacityModifyRGB",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Node_isOpacityModifyRGB'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_Node_setPosition(lua_State* tolua_S) { int argc = 0; @@ -6282,53 +6875,6 @@ int lua_cocos2dx_Node_visit(lua_State* tolua_S) return 0; } -int lua_cocos2dx_Node_isOpacityModifyRGB(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Node* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Node",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Node*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Node_isOpacityModifyRGB'", 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_Node_isOpacityModifyRGB'", nullptr); - return 0; - } - bool ret = cobj->isOpacityModifyRGB(); - tolua_pushboolean(tolua_S,(bool)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Node:isOpacityModifyRGB",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Node_isOpacityModifyRGB'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_Node_getRotation(lua_State* tolua_S) { int argc = 0; @@ -9657,6 +10203,7 @@ int lua_register_cocos2dx_Node(lua_State* tolua_S) tolua_function(tolua_S,"getNodeToParentTransform",lua_cocos2dx_Node_getNodeToParentTransform); tolua_function(tolua_S,"convertTouchToNodeSpaceAR",lua_cocos2dx_Node_convertTouchToNodeSpaceAR); tolua_function(tolua_S,"convertToNodeSpace",lua_cocos2dx_Node_convertToNodeSpace); + tolua_function(tolua_S,"isOpacityModifyRGB",lua_cocos2dx_Node_isOpacityModifyRGB); tolua_function(tolua_S,"setPosition",lua_cocos2dx_Node_setPosition); tolua_function(tolua_S,"stopActionByTag",lua_cocos2dx_Node_stopActionByTag); tolua_function(tolua_S,"reorderChild",lua_cocos2dx_Node_reorderChild); @@ -9675,7 +10222,6 @@ int lua_register_cocos2dx_Node(lua_State* tolua_S) tolua_function(tolua_S,"addComponent",lua_cocos2dx_Node_addComponent); tolua_function(tolua_S,"runAction",lua_cocos2dx_Node_runAction); tolua_function(tolua_S,"visit",lua_cocos2dx_Node_visit); - tolua_function(tolua_S,"isOpacityModifyRGB",lua_cocos2dx_Node_isOpacityModifyRGB); tolua_function(tolua_S,"getRotation",lua_cocos2dx_Node_getRotation); tolua_function(tolua_S,"getAnchorPointInPoints",lua_cocos2dx_Node_getAnchorPointInPoints); tolua_function(tolua_S,"removeChildByName",lua_cocos2dx_Node_removeChildByName); @@ -69481,56 +70027,6 @@ int lua_cocos2dx_Sprite_getTextureRect(lua_State* tolua_S) return 0; } -int lua_cocos2dx_Sprite_debugDraw(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Sprite* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Sprite*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite_debugDraw'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - bool arg0; - - ok &= luaval_to_boolean(tolua_S, 2,&arg0, "cc.Sprite:debugDraw"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_debugDraw'", nullptr); - return 0; - } - cobj->debugDraw(arg0); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite:debugDraw",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_debugDraw'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_Sprite_initWithFile(lua_State* tolua_S) { int argc = 0; @@ -70096,7 +70592,6 @@ int lua_register_cocos2dx_Sprite(lua_State* tolua_S) tolua_function(tolua_S,"setDirty",lua_cocos2dx_Sprite_setDirty); tolua_function(tolua_S,"isTextureRectRotated",lua_cocos2dx_Sprite_isTextureRectRotated); tolua_function(tolua_S,"getTextureRect",lua_cocos2dx_Sprite_getTextureRect); - tolua_function(tolua_S,"debugDraw",lua_cocos2dx_Sprite_debugDraw); tolua_function(tolua_S,"initWithFile",lua_cocos2dx_Sprite_initWithFile); tolua_function(tolua_S,"setBlendFunc",lua_cocos2dx_Sprite_setBlendFunc); tolua_function(tolua_S,"getTextureAtlas",lua_cocos2dx_Sprite_getTextureAtlas); @@ -93877,552 +94372,6 @@ int lua_register_cocos2dx_TileMapAtlas(lua_State* tolua_S) g_typeCast["TileMapAtlas"] = "cc.TileMapAtlas"; return 1; } - -int lua_cocos2dx_Component_setEnabled(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Component* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_setEnabled'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - bool arg0; - - ok &= luaval_to_boolean(tolua_S, 2,&arg0, "cc.Component:setEnabled"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Component_setEnabled'", nullptr); - return 0; - } - cobj->setEnabled(arg0); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:setEnabled",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_setEnabled'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Component_setName(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Component* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_setName'", 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, "cc.Component:setName"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Component_setName'", nullptr); - return 0; - } - cobj->setName(arg0); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:setName",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_setName'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Component_isEnabled(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Component* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_isEnabled'", 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_Component_isEnabled'", nullptr); - return 0; - } - bool ret = cobj->isEnabled(); - tolua_pushboolean(tolua_S,(bool)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:isEnabled",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_isEnabled'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Component_onRemove(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Component* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_onRemove'", 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_Component_onRemove'", nullptr); - return 0; - } - cobj->onRemove(); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:onRemove",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_onRemove'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Component_update(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Component* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_update'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - double arg0; - - ok &= luaval_to_number(tolua_S, 2,&arg0, "cc.Component:update"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Component_update'", nullptr); - return 0; - } - cobj->update(arg0); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:update",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_update'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Component_getOwner(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Component* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_getOwner'", 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_Component_getOwner'", nullptr); - return 0; - } - cocos2d::Node* ret = cobj->getOwner(); - object_to_luaval(tolua_S, "cc.Node",(cocos2d::Node*)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:getOwner",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_getOwner'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Component_init(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Component* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_init'", 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_Component_init'", nullptr); - return 0; - } - bool ret = cobj->init(); - tolua_pushboolean(tolua_S,(bool)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:init",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_init'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Component_onAdd(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Component* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_onAdd'", 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_Component_onAdd'", nullptr); - return 0; - } - cobj->onAdd(); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:onAdd",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_onAdd'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Component_getName(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Component* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_getName'", 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_Component_getName'", nullptr); - return 0; - } - const std::string& ret = cobj->getName(); - tolua_pushcppstring(tolua_S,ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:getName",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_getName'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Component_setOwner(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Component* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_setOwner'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - cocos2d::Node* arg0; - - ok &= luaval_to_object(tolua_S, 2, "cc.Node",&arg0, "cc.Component:setOwner"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Component_setOwner'", nullptr); - return 0; - } - cobj->setOwner(arg0); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:setOwner",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_setOwner'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Component_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,"cc.Component",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_Component_create'", nullptr); - return 0; - } - cocos2d::Component* ret = cocos2d::Component::create(); - object_to_luaval(tolua_S, "cc.Component",(cocos2d::Component*)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d\n ", "cc.Component:create",argc, 0); - return 0; -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_create'.",&tolua_err); -#endif - return 0; -} -static int lua_cocos2dx_Component_finalize(lua_State* tolua_S) -{ - printf("luabindings: finalizing LUA object (Component)"); - return 0; -} - -int lua_register_cocos2dx_Component(lua_State* tolua_S) -{ - tolua_usertype(tolua_S,"cc.Component"); - tolua_cclass(tolua_S,"Component","cc.Component","cc.Ref",nullptr); - - tolua_beginmodule(tolua_S,"Component"); - tolua_function(tolua_S,"setEnabled",lua_cocos2dx_Component_setEnabled); - tolua_function(tolua_S,"setName",lua_cocos2dx_Component_setName); - tolua_function(tolua_S,"isEnabled",lua_cocos2dx_Component_isEnabled); - tolua_function(tolua_S,"onRemove",lua_cocos2dx_Component_onRemove); - tolua_function(tolua_S,"update",lua_cocos2dx_Component_update); - tolua_function(tolua_S,"getOwner",lua_cocos2dx_Component_getOwner); - tolua_function(tolua_S,"init",lua_cocos2dx_Component_init); - tolua_function(tolua_S,"onAdd",lua_cocos2dx_Component_onAdd); - tolua_function(tolua_S,"getName",lua_cocos2dx_Component_getName); - tolua_function(tolua_S,"setOwner",lua_cocos2dx_Component_setOwner); - tolua_function(tolua_S,"create", lua_cocos2dx_Component_create); - tolua_endmodule(tolua_S); - std::string typeName = typeid(cocos2d::Component).name(); - g_luaType[typeName] = "cc.Component"; - g_typeCast["Component"] = "cc.Component"; - return 1; -} TOLUA_API int register_all_cocos2dx(lua_State* tolua_S) { tolua_open(tolua_S); diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp index 4bfbed20a5..e6137a3bfe 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp @@ -2104,7 +2104,6 @@ int register_all_cocos2dx(lua_State* tolua_S); - #endif // __cocos2dx_h__ diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_csloader_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_csloader_auto.cpp index 4b3a08f182..2736da98a1 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_csloader_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_csloader_auto.cpp @@ -588,6 +588,61 @@ int lua_cocos2dx_csloader_CSLoader_destroyInstance(lua_State* tolua_S) #endif return 0; } +int lua_cocos2dx_csloader_CSLoader_createNodeWithVisibleSize(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,"cc.CSLoader",0,&tolua_err)) goto tolua_lerror; +#endif + + argc = lua_gettop(tolua_S)-1; + + do + { + if (argc == 2) + { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.CSLoader:createNodeWithVisibleSize"); + if (!ok) { break; } + std::function arg1; + do { + // Lambda binding for lua is not supported. + assert(false); + } while(0) + ; + if (!ok) { break; } + cocos2d::Node* ret = cocos2d::CSLoader::createNodeWithVisibleSize(arg0, arg1); + object_to_luaval(tolua_S, "cc.Node",(cocos2d::Node*)ret); + return 1; + } + } while (0); + ok = true; + do + { + if (argc == 1) + { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.CSLoader:createNodeWithVisibleSize"); + if (!ok) { break; } + cocos2d::Node* ret = cocos2d::CSLoader::createNodeWithVisibleSize(arg0); + object_to_luaval(tolua_S, "cc.Node",(cocos2d::Node*)ret); + return 1; + } + } while (0); + ok = true; + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d", "cc.CSLoader:createNodeWithVisibleSize",argc, 1); + return 0; +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_csloader_CSLoader_createNodeWithVisibleSize'.",&tolua_err); +#endif + return 0; +} int lua_cocos2dx_csloader_CSLoader_getInstance(lua_State* tolua_S) { int argc = 0; @@ -682,6 +737,7 @@ int lua_register_cocos2dx_csloader_CSLoader(lua_State* tolua_S) tolua_function(tolua_S,"setRecordJsonPath",lua_cocos2dx_csloader_CSLoader_setRecordJsonPath); tolua_function(tolua_S,"createNodeWithFlatBuffersForSimulator",lua_cocos2dx_csloader_CSLoader_createNodeWithFlatBuffersForSimulator); tolua_function(tolua_S,"destroyInstance", lua_cocos2dx_csloader_CSLoader_destroyInstance); + tolua_function(tolua_S,"createNodeWithVisibleSize", lua_cocos2dx_csloader_CSLoader_createNodeWithVisibleSize); tolua_function(tolua_S,"getInstance", lua_cocos2dx_csloader_CSLoader_getInstance); tolua_endmodule(tolua_S); std::string typeName = typeid(cocos2d::CSLoader).name(); diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_csloader_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_csloader_auto.hpp index 2a07603455..bdedab007e 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_csloader_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_csloader_auto.hpp @@ -27,4 +27,5 @@ int register_all_cocos2dx_csloader(lua_State* tolua_S); + #endif // __cocos2dx_csloader_h__ diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.cpp index 04bc6277ec..5c50f4e821 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.cpp @@ -3802,7 +3802,7 @@ int lua_cocos2dx_physics_PhysicsBody_getPosition(lua_State* tolua_S) tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_physics_PhysicsBody_getPosition'", nullptr); return 0; } - const cocos2d::Vec2& ret = cobj->getPosition(); + cocos2d::Vec2 ret = cobj->getPosition(); vec2_to_luaval(tolua_S, ret); return 1; } @@ -12611,6 +12611,425 @@ int lua_register_cocos2dx_physics_PhysicsDebugDraw(lua_State* tolua_S) g_typeCast["PhysicsDebugDraw"] = "cc.PhysicsDebugDraw"; return 1; } + +int lua_cocos2dx_physics_ComponentPhysics2d_setPhysicsBody(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ComponentPhysics2d* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.ComponentPhysics2d",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ComponentPhysics2d*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_physics_ComponentPhysics2d_setPhysicsBody'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + cocos2d::PhysicsBody* arg0; + + ok &= luaval_to_object(tolua_S, 2, "cc.PhysicsBody",&arg0, "cc.ComponentPhysics2d:setPhysicsBody"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_physics_ComponentPhysics2d_setPhysicsBody'", nullptr); + return 0; + } + cobj->setPhysicsBody(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.ComponentPhysics2d:setPhysicsBody",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_physics_ComponentPhysics2d_setPhysicsBody'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_physics_ComponentPhysics2d_getPhysicsBody(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ComponentPhysics2d* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.ComponentPhysics2d",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ComponentPhysics2d*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_physics_ComponentPhysics2d_getPhysicsBody'", 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_physics_ComponentPhysics2d_getPhysicsBody'", nullptr); + return 0; + } + cocos2d::PhysicsBody* ret = cobj->getPhysicsBody(); + object_to_luaval(tolua_S, "cc.PhysicsBody",(cocos2d::PhysicsBody*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.ComponentPhysics2d:getPhysicsBody",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_physics_ComponentPhysics2d_getPhysicsBody'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_physics_ComponentPhysics2d_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,"cc.ComponentPhysics2d",0,&tolua_err)) goto tolua_lerror; +#endif + + argc = lua_gettop(tolua_S)-1; + + do + { + if (argc == 1) + { + cocos2d::PhysicsBody* arg0; + ok &= luaval_to_object(tolua_S, 2, "cc.PhysicsBody",&arg0, "cc.ComponentPhysics2d:create"); + if (!ok) { break; } + cocos2d::ComponentPhysics2d* ret = cocos2d::ComponentPhysics2d::create(arg0); + object_to_luaval(tolua_S, "cc.ComponentPhysics2d",(cocos2d::ComponentPhysics2d*)ret); + return 1; + } + } while (0); + ok = true; + do + { + if (argc == 0) + { + cocos2d::ComponentPhysics2d* ret = cocos2d::ComponentPhysics2d::create(); + object_to_luaval(tolua_S, "cc.ComponentPhysics2d",(cocos2d::ComponentPhysics2d*)ret); + return 1; + } + } while (0); + ok = true; + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d", "cc.ComponentPhysics2d:create",argc, 0); + return 0; +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_physics_ComponentPhysics2d_create'.",&tolua_err); +#endif + return 0; +} +int lua_cocos2dx_physics_ComponentPhysics2d_constructor(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ComponentPhysics2d* cobj = nullptr; + bool ok = true; +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + argc = lua_gettop(tolua_S)-1; + do{ + if (argc == 1) { + cocos2d::PhysicsBody* arg0; + ok &= luaval_to_object(tolua_S, 2, "cc.PhysicsBody",&arg0, "cc.ComponentPhysics2d:ComponentPhysics2d"); + + if (!ok) { break; } + cobj = new cocos2d::ComponentPhysics2d(arg0); + cobj->autorelease(); + int ID = (int)cobj->_ID ; + int* luaID = &cobj->_luaID ; + toluafix_pushusertype_ccobject(tolua_S, ID, luaID, (void*)cobj,"cc.ComponentPhysics2d"); + return 1; + } + }while(0); + ok = true; + do{ + if (argc == 0) { + cobj = new cocos2d::ComponentPhysics2d(); + cobj->autorelease(); + int ID = (int)cobj->_ID ; + int* luaID = &cobj->_luaID ; + toluafix_pushusertype_ccobject(tolua_S, ID, luaID, (void*)cobj,"cc.ComponentPhysics2d"); + return 1; + } + }while(0); + ok = true; + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.ComponentPhysics2d:ComponentPhysics2d",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_physics_ComponentPhysics2d_constructor'.",&tolua_err); +#endif + + return 0; +} + +static int lua_cocos2dx_physics_ComponentPhysics2d_finalize(lua_State* tolua_S) +{ + printf("luabindings: finalizing LUA object (ComponentPhysics2d)"); + return 0; +} + +int lua_register_cocos2dx_physics_ComponentPhysics2d(lua_State* tolua_S) +{ + tolua_usertype(tolua_S,"cc.ComponentPhysics2d"); + tolua_cclass(tolua_S,"ComponentPhysics2d","cc.ComponentPhysics2d","cc.Component",nullptr); + + tolua_beginmodule(tolua_S,"ComponentPhysics2d"); + tolua_function(tolua_S,"new",lua_cocos2dx_physics_ComponentPhysics2d_constructor); + tolua_function(tolua_S,"setPhysicsBody",lua_cocos2dx_physics_ComponentPhysics2d_setPhysicsBody); + tolua_function(tolua_S,"getPhysicsBody",lua_cocos2dx_physics_ComponentPhysics2d_getPhysicsBody); + tolua_function(tolua_S,"create", lua_cocos2dx_physics_ComponentPhysics2d_create); + tolua_endmodule(tolua_S); + std::string typeName = typeid(cocos2d::ComponentPhysics2d).name(); + g_luaType[typeName] = "cc.ComponentPhysics2d"; + g_typeCast["ComponentPhysics2d"] = "cc.ComponentPhysics2d"; + return 1; +} + +int lua_cocos2dx_physics_PhysicsManager_removePhysicsComponent(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::PhysicsManager* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.PhysicsManager",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::PhysicsManager*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_physics_PhysicsManager_removePhysicsComponent'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + cocos2d::ComponentPhysics2d* arg0; + + ok &= luaval_to_object(tolua_S, 2, "cc.ComponentPhysics2d",&arg0, "cc.PhysicsManager:removePhysicsComponent"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_physics_PhysicsManager_removePhysicsComponent'", nullptr); + return 0; + } + cobj->removePhysicsComponent(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.PhysicsManager:removePhysicsComponent",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_physics_PhysicsManager_removePhysicsComponent'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_physics_PhysicsManager_addPhysicsComponent(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::PhysicsManager* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.PhysicsManager",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::PhysicsManager*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_physics_PhysicsManager_addPhysicsComponent'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + cocos2d::ComponentPhysics2d* arg0; + + ok &= luaval_to_object(tolua_S, 2, "cc.ComponentPhysics2d",&arg0, "cc.PhysicsManager:addPhysicsComponent"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_physics_PhysicsManager_addPhysicsComponent'", nullptr); + return 0; + } + cobj->addPhysicsComponent(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.PhysicsManager:addPhysicsComponent",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_physics_PhysicsManager_addPhysicsComponent'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_physics_PhysicsManager_getPhysicsWorld(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::PhysicsManager* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.PhysicsManager",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::PhysicsManager*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_physics_PhysicsManager_getPhysicsWorld'", 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_physics_PhysicsManager_getPhysicsWorld'", nullptr); + return 0; + } + cocos2d::PhysicsWorld* ret = cobj->getPhysicsWorld(); + object_to_luaval(tolua_S, "cc.PhysicsWorld",(cocos2d::PhysicsWorld*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.PhysicsManager:getPhysicsWorld",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_physics_PhysicsManager_getPhysicsWorld'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_physics_PhysicsManager_constructor(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::PhysicsManager* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + cocos2d::Scene* arg0; + + ok &= luaval_to_object(tolua_S, 2, "cc.Scene",&arg0, "cc.PhysicsManager:PhysicsManager"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_physics_PhysicsManager_constructor'", nullptr); + return 0; + } + cobj = new cocos2d::PhysicsManager(arg0); + tolua_pushusertype(tolua_S,(void*)cobj,"cc.PhysicsManager"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.PhysicsManager:PhysicsManager",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_physics_PhysicsManager_constructor'.",&tolua_err); +#endif + + return 0; +} + +static int lua_cocos2dx_physics_PhysicsManager_finalize(lua_State* tolua_S) +{ + printf("luabindings: finalizing LUA object (PhysicsManager)"); + return 0; +} + +int lua_register_cocos2dx_physics_PhysicsManager(lua_State* tolua_S) +{ + tolua_usertype(tolua_S,"cc.PhysicsManager"); + tolua_cclass(tolua_S,"PhysicsManager","cc.PhysicsManager","",nullptr); + + tolua_beginmodule(tolua_S,"PhysicsManager"); + tolua_function(tolua_S,"new",lua_cocos2dx_physics_PhysicsManager_constructor); + tolua_function(tolua_S,"removePhysicsComponent",lua_cocos2dx_physics_PhysicsManager_removePhysicsComponent); + tolua_function(tolua_S,"addPhysicsComponent",lua_cocos2dx_physics_PhysicsManager_addPhysicsComponent); + tolua_function(tolua_S,"getPhysicsWorld",lua_cocos2dx_physics_PhysicsManager_getPhysicsWorld); + tolua_endmodule(tolua_S); + std::string typeName = typeid(cocos2d::PhysicsManager).name(); + g_luaType[typeName] = "cc.PhysicsManager"; + g_typeCast["PhysicsManager"] = "cc.PhysicsManager"; + return 1; +} TOLUA_API int register_all_cocos2dx_physics(lua_State* tolua_S) { tolua_open(tolua_S); @@ -12628,6 +13047,7 @@ TOLUA_API int register_all_cocos2dx_physics(lua_State* tolua_S) lua_register_cocos2dx_physics_PhysicsShape(tolua_S); lua_register_cocos2dx_physics_PhysicsShapePolygon(tolua_S); lua_register_cocos2dx_physics_PhysicsShapeBox(tolua_S); + lua_register_cocos2dx_physics_PhysicsManager(tolua_S); lua_register_cocos2dx_physics_PhysicsJointMotor(tolua_S); lua_register_cocos2dx_physics_PhysicsJointRatchet(tolua_S); lua_register_cocos2dx_physics_PhysicsJointDistance(tolua_S); @@ -12636,6 +13056,7 @@ TOLUA_API int register_all_cocos2dx_physics(lua_State* tolua_S) lua_register_cocos2dx_physics_PhysicsJointPin(tolua_S); lua_register_cocos2dx_physics_PhysicsContactPreSolve(tolua_S); lua_register_cocos2dx_physics_PhysicsDebugDraw(tolua_S); + lua_register_cocos2dx_physics_ComponentPhysics2d(tolua_S); lua_register_cocos2dx_physics_PhysicsShapeEdgeChain(tolua_S); lua_register_cocos2dx_physics_PhysicsShapeEdgeSegment(tolua_S); lua_register_cocos2dx_physics_PhysicsJointGear(tolua_S); diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.hpp index d521804635..5edcef0fcc 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.hpp @@ -270,6 +270,16 @@ int register_all_cocos2dx_physics(lua_State* tolua_S); + + + + + + + + + + diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp index ae53270be6..d023c7f90e 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp @@ -6306,6 +6306,53 @@ int lua_cocos2dx_ui_Button_getTitleRenderer(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_Button_getRendererClicked(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Button* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Button",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Button*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Button_getRendererClicked'", 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_ui_Button_getRendererClicked'", nullptr); + return 0; + } + cocos2d::ui::Scale9Sprite* ret = cobj->getRendererClicked(); + object_to_luaval(tolua_S, "ccui.Scale9Sprite",(cocos2d::ui::Scale9Sprite*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Button:getRendererClicked",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Button_getRendererClicked'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_Button_getZoomScale(lua_State* tolua_S) { int argc = 0; @@ -6450,6 +6497,53 @@ int lua_cocos2dx_ui_Button_setTitleColor(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_Button_getRendererDisabled(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Button* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Button",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Button*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Button_getRendererDisabled'", 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_ui_Button_getRendererDisabled'", nullptr); + return 0; + } + cocos2d::ui::Scale9Sprite* ret = cobj->getRendererDisabled(); + object_to_luaval(tolua_S, "ccui.Scale9Sprite",(cocos2d::ui::Scale9Sprite*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Button:getRendererDisabled",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Button_getRendererDisabled'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_Button_setCapInsetsDisabledRenderer(lua_State* tolua_S) { int argc = 0; @@ -7404,6 +7498,53 @@ int lua_cocos2dx_ui_Button_getTitleFontSize(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_Button_getRendererNormal(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Button* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Button",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Button*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Button_getRendererNormal'", 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_ui_Button_getRendererNormal'", nullptr); + return 0; + } + cocos2d::ui::Scale9Sprite* ret = cobj->getRendererNormal(); + object_to_luaval(tolua_S, "ccui.Scale9Sprite",(cocos2d::ui::Scale9Sprite*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Button:getRendererNormal",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Button_getRendererNormal'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_Button_getTitleFontName(lua_State* tolua_S) { int argc = 0; @@ -7789,9 +7930,11 @@ int lua_register_cocos2dx_ui_Button(lua_State* tolua_S) tolua_function(tolua_S,"setTitleFontSize",lua_cocos2dx_ui_Button_setTitleFontSize); tolua_function(tolua_S,"setScale9Enabled",lua_cocos2dx_ui_Button_setScale9Enabled); tolua_function(tolua_S,"getTitleRenderer",lua_cocos2dx_ui_Button_getTitleRenderer); + tolua_function(tolua_S,"getRendererClicked",lua_cocos2dx_ui_Button_getRendererClicked); tolua_function(tolua_S,"getZoomScale",lua_cocos2dx_ui_Button_getZoomScale); tolua_function(tolua_S,"getCapInsetsDisabledRenderer",lua_cocos2dx_ui_Button_getCapInsetsDisabledRenderer); tolua_function(tolua_S,"setTitleColor",lua_cocos2dx_ui_Button_setTitleColor); + tolua_function(tolua_S,"getRendererDisabled",lua_cocos2dx_ui_Button_getRendererDisabled); tolua_function(tolua_S,"setCapInsetsDisabledRenderer",lua_cocos2dx_ui_Button_setCapInsetsDisabledRenderer); tolua_function(tolua_S,"setCapInsets",lua_cocos2dx_ui_Button_setCapInsets); tolua_function(tolua_S,"loadTextureDisabled",lua_cocos2dx_ui_Button_loadTextureDisabled); @@ -7808,6 +7951,7 @@ int lua_register_cocos2dx_ui_Button(lua_State* tolua_S) tolua_function(tolua_S,"loadTextureNormal",lua_cocos2dx_ui_Button_loadTextureNormal); tolua_function(tolua_S,"setCapInsetsPressedRenderer",lua_cocos2dx_ui_Button_setCapInsetsPressedRenderer); tolua_function(tolua_S,"getTitleFontSize",lua_cocos2dx_ui_Button_getTitleFontSize); + tolua_function(tolua_S,"getRendererNormal",lua_cocos2dx_ui_Button_getRendererNormal); tolua_function(tolua_S,"getTitleFontName",lua_cocos2dx_ui_Button_getTitleFontName); tolua_function(tolua_S,"getTitleColor",lua_cocos2dx_ui_Button_getTitleColor); tolua_function(tolua_S,"setPressedActionEnabled",lua_cocos2dx_ui_Button_setPressedActionEnabled); @@ -15708,103 +15852,6 @@ int lua_register_cocos2dx_ui_ScrollView(lua_State* tolua_S) return 1; } -int lua_cocos2dx_ui_ListView_getIndex(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::ui::ListView* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"ccui.ListView",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::ui::ListView*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ListView_getIndex'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - cocos2d::ui::Widget* arg0; - - ok &= luaval_to_object(tolua_S, 2, "ccui.Widget",&arg0, "ccui.ListView:getIndex"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ListView_getIndex'", nullptr); - return 0; - } - ssize_t ret = cobj->getIndex(arg0); - tolua_pushnumber(tolua_S,(lua_Number)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ListView:getIndex",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ListView_getIndex'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_ui_ListView_removeAllItems(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::ui::ListView* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"ccui.ListView",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::ui::ListView*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ListView_removeAllItems'", 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_ui_ListView_removeAllItems'", nullptr); - return 0; - } - cobj->removeAllItems(); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ListView:removeAllItems",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ListView_removeAllItems'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_ui_ListView_setGravity(lua_State* tolua_S) { int argc = 0; @@ -15855,6 +15902,341 @@ int lua_cocos2dx_ui_ListView_setGravity(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_ListView_removeLastItem(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::ListView* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.ListView",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::ListView*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ListView_removeLastItem'", 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_ui_ListView_removeLastItem'", nullptr); + return 0; + } + cobj->removeLastItem(); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ListView:removeLastItem",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ListView_removeLastItem'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_ListView_getCenterItemInCurrentView(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::ListView* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.ListView",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::ListView*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ListView_getCenterItemInCurrentView'", 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_ui_ListView_getCenterItemInCurrentView'", nullptr); + return 0; + } + cocos2d::ui::Widget* ret = cobj->getCenterItemInCurrentView(); + object_to_luaval(tolua_S, "ccui.Widget",(cocos2d::ui::Widget*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ListView:getCenterItemInCurrentView",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ListView_getCenterItemInCurrentView'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_ListView_getCurSelectedIndex(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::ListView* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.ListView",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::ListView*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ListView_getCurSelectedIndex'", 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_ui_ListView_getCurSelectedIndex'", nullptr); + return 0; + } + ssize_t ret = cobj->getCurSelectedIndex(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ListView:getCurSelectedIndex",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ListView_getCurSelectedIndex'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_ListView_getItemsMargin(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::ListView* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.ListView",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::ListView*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ListView_getItemsMargin'", 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_ui_ListView_getItemsMargin'", nullptr); + return 0; + } + double ret = cobj->getItemsMargin(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ListView:getItemsMargin",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ListView_getItemsMargin'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_ListView_setMagneticType(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::ListView* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.ListView",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::ListView*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ListView_setMagneticType'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + cocos2d::ui::ListView::MagneticType arg0; + + ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccui.ListView:setMagneticType"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ListView_setMagneticType'", nullptr); + return 0; + } + cobj->setMagneticType(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ListView:setMagneticType",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ListView_setMagneticType'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_ListView_refreshViewIfNecessary(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::ListView* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.ListView",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::ListView*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ListView_refreshViewIfNecessary'", 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_ui_ListView_refreshViewIfNecessary'", nullptr); + return 0; + } + cobj->refreshViewIfNecessary(); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ListView:refreshViewIfNecessary",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ListView_refreshViewIfNecessary'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_ListView_getIndex(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::ListView* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.ListView",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::ListView*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ListView_getIndex'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + cocos2d::ui::Widget* arg0; + + ok &= luaval_to_object(tolua_S, 2, "ccui.Widget",&arg0, "ccui.ListView:getIndex"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ListView_getIndex'", nullptr); + return 0; + } + ssize_t ret = cobj->getIndex(arg0); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ListView:getIndex",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ListView_getIndex'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_ListView_pushBackCustomItem(lua_State* tolua_S) { int argc = 0; @@ -15905,150 +16287,6 @@ int lua_cocos2dx_ui_ListView_pushBackCustomItem(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_ListView_getItems(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::ui::ListView* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"ccui.ListView",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::ui::ListView*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ListView_getItems'", 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_ui_ListView_getItems'", nullptr); - return 0; - } - cocos2d::Vector& ret = cobj->getItems(); - ccvector_to_luaval(tolua_S, ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ListView:getItems",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ListView_getItems'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_ui_ListView_removeItem(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::ui::ListView* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"ccui.ListView",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::ui::ListView*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ListView_removeItem'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - ssize_t arg0; - - ok &= luaval_to_ssize(tolua_S, 2, &arg0, "ccui.ListView:removeItem"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ListView_removeItem'", nullptr); - return 0; - } - cobj->removeItem(arg0); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ListView:removeItem",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ListView_removeItem'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_ui_ListView_getCurSelectedIndex(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::ui::ListView* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"ccui.ListView",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::ui::ListView*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ListView_getCurSelectedIndex'", 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_ui_ListView_getCurSelectedIndex'", nullptr); - return 0; - } - ssize_t ret = cobj->getCurSelectedIndex(); - tolua_pushnumber(tolua_S,(lua_Number)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ListView:getCurSelectedIndex",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ListView_getCurSelectedIndex'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_ui_ListView_insertDefaultItem(lua_State* tolua_S) { int argc = 0; @@ -16099,7 +16337,7 @@ int lua_cocos2dx_ui_ListView_insertDefaultItem(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_ListView_requestRefreshView(lua_State* tolua_S) +int lua_cocos2dx_ui_ListView_setMagneticAllowedOutOfBoundary(lua_State* tolua_S) { int argc = 0; cocos2d::ui::ListView* cobj = nullptr; @@ -16119,54 +16357,7 @@ int lua_cocos2dx_ui_ListView_requestRefreshView(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ListView_requestRefreshView'", 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_ui_ListView_requestRefreshView'", nullptr); - return 0; - } - cobj->requestRefreshView(); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ListView:requestRefreshView",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ListView_requestRefreshView'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_ui_ListView_setItemsMargin(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::ui::ListView* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"ccui.ListView",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::ui::ListView*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ListView_setItemsMargin'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ListView_setMagneticAllowedOutOfBoundary'", nullptr); return 0; } #endif @@ -16174,165 +16365,24 @@ int lua_cocos2dx_ui_ListView_setItemsMargin(lua_State* tolua_S) argc = lua_gettop(tolua_S)-1; if (argc == 1) { - double arg0; + bool arg0; - ok &= luaval_to_number(tolua_S, 2,&arg0, "ccui.ListView:setItemsMargin"); + ok &= luaval_to_boolean(tolua_S, 2,&arg0, "ccui.ListView:setMagneticAllowedOutOfBoundary"); if(!ok) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ListView_setItemsMargin'", nullptr); + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ListView_setMagneticAllowedOutOfBoundary'", nullptr); return 0; } - cobj->setItemsMargin(arg0); + cobj->setMagneticAllowedOutOfBoundary(arg0); lua_settop(tolua_S, 1); return 1; } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ListView:setItemsMargin",argc, 1); + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ListView:setMagneticAllowedOutOfBoundary",argc, 1); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ListView_setItemsMargin'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_ui_ListView_refreshView(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::ui::ListView* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"ccui.ListView",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::ui::ListView*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ListView_refreshView'", 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_ui_ListView_refreshView'", nullptr); - return 0; - } - cobj->refreshView(); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ListView:refreshView",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ListView_refreshView'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_ui_ListView_removeLastItem(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::ui::ListView* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"ccui.ListView",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::ui::ListView*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ListView_removeLastItem'", 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_ui_ListView_removeLastItem'", nullptr); - return 0; - } - cobj->removeLastItem(); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ListView:removeLastItem",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ListView_removeLastItem'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_ui_ListView_getItemsMargin(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::ui::ListView* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"ccui.ListView",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::ui::ListView*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ListView_getItemsMargin'", 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_ui_ListView_getItemsMargin'", nullptr); - return 0; - } - double ret = cobj->getItemsMargin(); - tolua_pushnumber(tolua_S,(lua_Number)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ListView:getItemsMargin",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ListView_getItemsMargin'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ListView_setMagneticAllowedOutOfBoundary'.",&tolua_err); #endif return 0; @@ -16391,6 +16441,385 @@ int lua_cocos2dx_ui_ListView_addEventListener(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_ListView_doLayout(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::ListView* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.ListView",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::ListView*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ListView_doLayout'", 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_ui_ListView_doLayout'", nullptr); + return 0; + } + cobj->doLayout(); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ListView:doLayout",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ListView_doLayout'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_ListView_getTopmostItemInCurrentView(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::ListView* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.ListView",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::ListView*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ListView_getTopmostItemInCurrentView'", 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_ui_ListView_getTopmostItemInCurrentView'", nullptr); + return 0; + } + cocos2d::ui::Widget* ret = cobj->getTopmostItemInCurrentView(); + object_to_luaval(tolua_S, "ccui.Widget",(cocos2d::ui::Widget*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ListView:getTopmostItemInCurrentView",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ListView_getTopmostItemInCurrentView'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_ListView_removeAllItems(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::ListView* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.ListView",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::ListView*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ListView_removeAllItems'", 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_ui_ListView_removeAllItems'", nullptr); + return 0; + } + cobj->removeAllItems(); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ListView:removeAllItems",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ListView_removeAllItems'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_ListView_getBottommostItemInCurrentView(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::ListView* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.ListView",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::ListView*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ListView_getBottommostItemInCurrentView'", 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_ui_ListView_getBottommostItemInCurrentView'", nullptr); + return 0; + } + cocos2d::ui::Widget* ret = cobj->getBottommostItemInCurrentView(); + object_to_luaval(tolua_S, "ccui.Widget",(cocos2d::ui::Widget*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ListView:getBottommostItemInCurrentView",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ListView_getBottommostItemInCurrentView'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_ListView_getItems(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::ListView* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.ListView",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::ListView*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ListView_getItems'", 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_ui_ListView_getItems'", nullptr); + return 0; + } + cocos2d::Vector& ret = cobj->getItems(); + ccvector_to_luaval(tolua_S, ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ListView:getItems",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ListView_getItems'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_ListView_getLeftmostItemInCurrentView(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::ListView* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.ListView",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::ListView*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ListView_getLeftmostItemInCurrentView'", 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_ui_ListView_getLeftmostItemInCurrentView'", nullptr); + return 0; + } + cocos2d::ui::Widget* ret = cobj->getLeftmostItemInCurrentView(); + object_to_luaval(tolua_S, "ccui.Widget",(cocos2d::ui::Widget*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ListView:getLeftmostItemInCurrentView",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ListView_getLeftmostItemInCurrentView'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_ListView_setItemsMargin(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::ListView* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.ListView",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::ListView*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ListView_setItemsMargin'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + double arg0; + + ok &= luaval_to_number(tolua_S, 2,&arg0, "ccui.ListView:setItemsMargin"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ListView_setItemsMargin'", nullptr); + return 0; + } + cobj->setItemsMargin(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ListView:setItemsMargin",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ListView_setItemsMargin'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_ListView_getMagneticType(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::ListView* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.ListView",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::ListView*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ListView_getMagneticType'", 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_ui_ListView_getMagneticType'", nullptr); + return 0; + } + int ret = (int)cobj->getMagneticType(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ListView:getMagneticType",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ListView_getMagneticType'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_ListView_getItem(lua_State* tolua_S) { int argc = 0; @@ -16441,6 +16870,425 @@ int lua_cocos2dx_ui_ListView_getItem(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_ListView_removeItem(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::ListView* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.ListView",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::ListView*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ListView_removeItem'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + ssize_t arg0; + + ok &= luaval_to_ssize(tolua_S, 2, &arg0, "ccui.ListView:removeItem"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ListView_removeItem'", nullptr); + return 0; + } + cobj->removeItem(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ListView:removeItem",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ListView_removeItem'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_ListView_scrollToItem(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::ListView* cobj = nullptr; + bool ok = true; +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.ListView",0,&tolua_err)) goto tolua_lerror; +#endif + cobj = (cocos2d::ui::ListView*)tolua_tousertype(tolua_S,1,0); +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ListView_scrollToItem'", nullptr); + return 0; + } +#endif + argc = lua_gettop(tolua_S)-1; + do{ + if (argc == 4) { + int arg0; + ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccui.ListView:scrollToItem"); + + if (!ok) { break; } + cocos2d::Vec2 arg1; + ok &= luaval_to_vec2(tolua_S, 3, &arg1, "ccui.ListView:scrollToItem"); + + if (!ok) { break; } + cocos2d::Vec2 arg2; + ok &= luaval_to_vec2(tolua_S, 4, &arg2, "ccui.ListView:scrollToItem"); + + if (!ok) { break; } + double arg3; + ok &= luaval_to_number(tolua_S, 5,&arg3, "ccui.ListView:scrollToItem"); + + if (!ok) { break; } + cobj->scrollToItem(arg0, arg1, arg2, arg3); + lua_settop(tolua_S, 1); + return 1; + } + }while(0); + ok = true; + do{ + if (argc == 3) { + int arg0; + ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccui.ListView:scrollToItem"); + + if (!ok) { break; } + cocos2d::Vec2 arg1; + ok &= luaval_to_vec2(tolua_S, 3, &arg1, "ccui.ListView:scrollToItem"); + + if (!ok) { break; } + cocos2d::Vec2 arg2; + ok &= luaval_to_vec2(tolua_S, 4, &arg2, "ccui.ListView:scrollToItem"); + + if (!ok) { break; } + cobj->scrollToItem(arg0, arg1, arg2); + lua_settop(tolua_S, 1); + return 1; + } + }while(0); + ok = true; + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ListView:scrollToItem",argc, 3); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ListView_scrollToItem'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_ListView_pushBackDefaultItem(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::ListView* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.ListView",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::ListView*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ListView_pushBackDefaultItem'", 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_ui_ListView_pushBackDefaultItem'", nullptr); + return 0; + } + cobj->pushBackDefaultItem(); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ListView:pushBackDefaultItem",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ListView_pushBackDefaultItem'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_ListView_getMagneticAllowedOutOfBoundary(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::ListView* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.ListView",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::ListView*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ListView_getMagneticAllowedOutOfBoundary'", 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_ui_ListView_getMagneticAllowedOutOfBoundary'", nullptr); + return 0; + } + bool ret = cobj->getMagneticAllowedOutOfBoundary(); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ListView:getMagneticAllowedOutOfBoundary",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ListView_getMagneticAllowedOutOfBoundary'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_ListView_getClosestItemToPosition(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::ListView* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.ListView",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::ListView*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ListView_getClosestItemToPosition'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 2) + { + cocos2d::Vec2 arg0; + cocos2d::Vec2 arg1; + + ok &= luaval_to_vec2(tolua_S, 2, &arg0, "ccui.ListView:getClosestItemToPosition"); + + ok &= luaval_to_vec2(tolua_S, 3, &arg1, "ccui.ListView:getClosestItemToPosition"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ListView_getClosestItemToPosition'", nullptr); + return 0; + } + cocos2d::ui::Widget* ret = cobj->getClosestItemToPosition(arg0, arg1); + object_to_luaval(tolua_S, "ccui.Widget",(cocos2d::ui::Widget*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ListView:getClosestItemToPosition",argc, 2); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ListView_getClosestItemToPosition'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_ListView_getRightmostItemInCurrentView(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::ListView* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.ListView",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::ListView*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ListView_getRightmostItemInCurrentView'", 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_ui_ListView_getRightmostItemInCurrentView'", nullptr); + return 0; + } + cocos2d::ui::Widget* ret = cobj->getRightmostItemInCurrentView(); + object_to_luaval(tolua_S, "ccui.Widget",(cocos2d::ui::Widget*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ListView:getRightmostItemInCurrentView",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ListView_getRightmostItemInCurrentView'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_ListView_getClosestItemToPositionInCurrentView(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::ListView* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.ListView",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::ListView*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ListView_getClosestItemToPositionInCurrentView'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 2) + { + cocos2d::Vec2 arg0; + cocos2d::Vec2 arg1; + + ok &= luaval_to_vec2(tolua_S, 2, &arg0, "ccui.ListView:getClosestItemToPositionInCurrentView"); + + ok &= luaval_to_vec2(tolua_S, 3, &arg1, "ccui.ListView:getClosestItemToPositionInCurrentView"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ListView_getClosestItemToPositionInCurrentView'", nullptr); + return 0; + } + cocos2d::ui::Widget* ret = cobj->getClosestItemToPositionInCurrentView(arg0, arg1); + object_to_luaval(tolua_S, "ccui.Widget",(cocos2d::ui::Widget*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ListView:getClosestItemToPositionInCurrentView",argc, 2); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ListView_getClosestItemToPositionInCurrentView'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_ListView_refreshView(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::ListView* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.ListView",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::ListView*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ListView_refreshView'", 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_ui_ListView_refreshView'", nullptr); + return 0; + } + cobj->refreshView(); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ListView:refreshView",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ListView_refreshView'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_ListView_setItemModel(lua_State* tolua_S) { int argc = 0; @@ -16491,7 +17339,7 @@ int lua_cocos2dx_ui_ListView_setItemModel(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_ListView_doLayout(lua_State* tolua_S) +int lua_cocos2dx_ui_ListView_requestRefreshView(lua_State* tolua_S) { int argc = 0; cocos2d::ui::ListView* cobj = nullptr; @@ -16511,7 +17359,7 @@ int lua_cocos2dx_ui_ListView_doLayout(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ListView_doLayout'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ListView_requestRefreshView'", nullptr); return 0; } #endif @@ -16521,66 +17369,19 @@ int lua_cocos2dx_ui_ListView_doLayout(lua_State* tolua_S) { if(!ok) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ListView_doLayout'", nullptr); + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ListView_requestRefreshView'", nullptr); return 0; } - cobj->doLayout(); + cobj->requestRefreshView(); lua_settop(tolua_S, 1); return 1; } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ListView:doLayout",argc, 0); + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ListView:requestRefreshView",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ListView_doLayout'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_ui_ListView_pushBackDefaultItem(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::ui::ListView* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"ccui.ListView",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::ui::ListView*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ListView_pushBackDefaultItem'", 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_ui_ListView_pushBackDefaultItem'", nullptr); - return 0; - } - cobj->pushBackDefaultItem(); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ListView:pushBackDefaultItem",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ListView_pushBackDefaultItem'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ListView_requestRefreshView'.",&tolua_err); #endif return 0; @@ -16756,24 +17557,37 @@ int lua_register_cocos2dx_ui_ListView(lua_State* tolua_S) tolua_beginmodule(tolua_S,"ListView"); tolua_function(tolua_S,"new",lua_cocos2dx_ui_ListView_constructor); - tolua_function(tolua_S,"getIndex",lua_cocos2dx_ui_ListView_getIndex); - tolua_function(tolua_S,"removeAllItems",lua_cocos2dx_ui_ListView_removeAllItems); tolua_function(tolua_S,"setGravity",lua_cocos2dx_ui_ListView_setGravity); - tolua_function(tolua_S,"pushBackCustomItem",lua_cocos2dx_ui_ListView_pushBackCustomItem); - tolua_function(tolua_S,"getItems",lua_cocos2dx_ui_ListView_getItems); - tolua_function(tolua_S,"removeItem",lua_cocos2dx_ui_ListView_removeItem); - tolua_function(tolua_S,"getCurSelectedIndex",lua_cocos2dx_ui_ListView_getCurSelectedIndex); - tolua_function(tolua_S,"insertDefaultItem",lua_cocos2dx_ui_ListView_insertDefaultItem); - tolua_function(tolua_S,"requestRefreshView",lua_cocos2dx_ui_ListView_requestRefreshView); - tolua_function(tolua_S,"setItemsMargin",lua_cocos2dx_ui_ListView_setItemsMargin); - tolua_function(tolua_S,"refreshView",lua_cocos2dx_ui_ListView_refreshView); tolua_function(tolua_S,"removeLastItem",lua_cocos2dx_ui_ListView_removeLastItem); + tolua_function(tolua_S,"getCenterItemInCurrentView",lua_cocos2dx_ui_ListView_getCenterItemInCurrentView); + tolua_function(tolua_S,"getCurSelectedIndex",lua_cocos2dx_ui_ListView_getCurSelectedIndex); tolua_function(tolua_S,"getItemsMargin",lua_cocos2dx_ui_ListView_getItemsMargin); + tolua_function(tolua_S,"setMagneticType",lua_cocos2dx_ui_ListView_setMagneticType); + tolua_function(tolua_S,"refreshViewIfNecessary",lua_cocos2dx_ui_ListView_refreshViewIfNecessary); + tolua_function(tolua_S,"getIndex",lua_cocos2dx_ui_ListView_getIndex); + tolua_function(tolua_S,"pushBackCustomItem",lua_cocos2dx_ui_ListView_pushBackCustomItem); + tolua_function(tolua_S,"insertDefaultItem",lua_cocos2dx_ui_ListView_insertDefaultItem); + tolua_function(tolua_S,"setMagneticAllowedOutOfBoundary",lua_cocos2dx_ui_ListView_setMagneticAllowedOutOfBoundary); tolua_function(tolua_S,"addEventListener",lua_cocos2dx_ui_ListView_addEventListener); - tolua_function(tolua_S,"getItem",lua_cocos2dx_ui_ListView_getItem); - tolua_function(tolua_S,"setItemModel",lua_cocos2dx_ui_ListView_setItemModel); tolua_function(tolua_S,"doLayout",lua_cocos2dx_ui_ListView_doLayout); + tolua_function(tolua_S,"getTopmostItemInCurrentView",lua_cocos2dx_ui_ListView_getTopmostItemInCurrentView); + tolua_function(tolua_S,"removeAllItems",lua_cocos2dx_ui_ListView_removeAllItems); + tolua_function(tolua_S,"getBottommostItemInCurrentView",lua_cocos2dx_ui_ListView_getBottommostItemInCurrentView); + tolua_function(tolua_S,"getItems",lua_cocos2dx_ui_ListView_getItems); + tolua_function(tolua_S,"getLeftmostItemInCurrentView",lua_cocos2dx_ui_ListView_getLeftmostItemInCurrentView); + tolua_function(tolua_S,"setItemsMargin",lua_cocos2dx_ui_ListView_setItemsMargin); + tolua_function(tolua_S,"getMagneticType",lua_cocos2dx_ui_ListView_getMagneticType); + tolua_function(tolua_S,"getItem",lua_cocos2dx_ui_ListView_getItem); + tolua_function(tolua_S,"removeItem",lua_cocos2dx_ui_ListView_removeItem); + tolua_function(tolua_S,"scrollToItem",lua_cocos2dx_ui_ListView_scrollToItem); tolua_function(tolua_S,"pushBackDefaultItem",lua_cocos2dx_ui_ListView_pushBackDefaultItem); + tolua_function(tolua_S,"getMagneticAllowedOutOfBoundary",lua_cocos2dx_ui_ListView_getMagneticAllowedOutOfBoundary); + tolua_function(tolua_S,"getClosestItemToPosition",lua_cocos2dx_ui_ListView_getClosestItemToPosition); + tolua_function(tolua_S,"getRightmostItemInCurrentView",lua_cocos2dx_ui_ListView_getRightmostItemInCurrentView); + tolua_function(tolua_S,"getClosestItemToPositionInCurrentView",lua_cocos2dx_ui_ListView_getClosestItemToPositionInCurrentView); + tolua_function(tolua_S,"refreshView",lua_cocos2dx_ui_ListView_refreshView); + tolua_function(tolua_S,"setItemModel",lua_cocos2dx_ui_ListView_setItemModel); + tolua_function(tolua_S,"requestRefreshView",lua_cocos2dx_ui_ListView_requestRefreshView); tolua_function(tolua_S,"insertCustomItem",lua_cocos2dx_ui_ListView_insertCustomItem); tolua_function(tolua_S,"create", lua_cocos2dx_ui_ListView_create); tolua_function(tolua_S,"createInstance", lua_cocos2dx_ui_ListView_createInstance); diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp index e0819c16db..15e87279e6 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp @@ -598,6 +598,22 @@ int register_all_cocos2dx_ui(lua_State* tolua_S); + + + + + + + + + + + + + + + + diff --git a/cocos/scripting/lua-bindings/manual/cocos2d/lua_cocos2dx_manual.cpp b/cocos/scripting/lua-bindings/manual/cocos2d/lua_cocos2dx_manual.cpp index 641413e080..ae3b6e61c9 100644 --- a/cocos/scripting/lua-bindings/manual/cocos2d/lua_cocos2dx_manual.cpp +++ b/cocos/scripting/lua-bindings/manual/cocos2d/lua_cocos2dx_manual.cpp @@ -2261,10 +2261,10 @@ static int lua_cocos2dx_Node_enumerateChildren(lua_State* tolua_S) int* luaID = node ? &node->_luaID : nullptr; toluafix_pushusertype_ccobject(tolua_S, id, luaID, (void*)node,"cc.Node"); bool ret = LuaEngine::getInstance()->getLuaStack()->executeFunctionByHandler(handler, 1); - LuaEngine::getInstance()->removeScriptHandler(handler); + return ret; }); - + LuaEngine::getInstance()->removeScriptHandler(handler); lua_settop(tolua_S, 1); return 1; } @@ -2379,157 +2379,6 @@ tolua_lerror: return 0; } -#if CC_USE_PHYSICS - -int lua_cocos2dx_Node_setPhysicsBody(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Node* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Node",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Node*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Node_setPhysicsBody'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - cocos2d::PhysicsBody* arg0; - - ok &= luaval_to_object(tolua_S, 2, "cc.PhysicsBody",&arg0, "cc.Node:setPhysicsBody"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Node_setPhysicsBody'", nullptr); - return 0; - } - cobj->setPhysicsBody(arg0); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Node:setPhysicsBody",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 -tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Node_setPhysicsBody'.",&tolua_err); -#endif - - return 0; -} - -int lua_cocos2dx_Node_removeFromPhysicsWorld(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Node* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Node",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Node*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Node_removeFromPhysicsWorld'", 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_Node_removeFromPhysicsWorld'", nullptr); - return 0; - } - cobj->removeFromPhysicsWorld(); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Node:removeFromPhysicsWorld",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 -tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Node_removeFromPhysicsWorld'.",&tolua_err); -#endif - - return 0; -} - -int lua_cocos2dx_Node_getPhysicsBody(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Node* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Node",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Node*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Node_getPhysicsBody'", 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_Node_getPhysicsBody'", nullptr); - return 0; - } - cocos2d::PhysicsBody* ret = cobj->getPhysicsBody(); - object_to_luaval(tolua_S, "cc.PhysicsBody",(cocos2d::PhysicsBody*)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Node:getPhysicsBody",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 -tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Node_getPhysicsBody'.",&tolua_err); -#endif - - return 0; -} - -#endif //CC_USE_PHYSICS - #if CC_USE_NAVMESH #include "navmesh/CCNavMesh.h" int lua_cocos2dx_Scene_setNavMeshDebugCamera(lua_State* tolua_S) @@ -5083,18 +4932,6 @@ static void extendNode(lua_State* tolua_S) lua_pushstring(tolua_S, "setRotationQuat"); lua_pushcfunction(tolua_S, lua_cocos2dx_Node_setRotationQuat); lua_rawset(tolua_S, -3); -#if CC_USE_PHYSICS - lua_pushstring(tolua_S, "setPhysicsBody"); - lua_pushcfunction(tolua_S, lua_cocos2dx_Node_setPhysicsBody); - lua_rawset(tolua_S, -3); - lua_pushstring(tolua_S, "removeFromPhysicsWorld"); - lua_pushcfunction(tolua_S, lua_cocos2dx_Node_removeFromPhysicsWorld); - lua_rawset(tolua_S, -3); - lua_pushstring(tolua_S, "getPhysicsBody"); - lua_pushcfunction(tolua_S, lua_cocos2dx_Node_getPhysicsBody); - lua_rawset(tolua_S, -3); -#endif //CC_USE_PHYSICS - } lua_pop(tolua_S, 1); } diff --git a/cocos/scripting/lua-bindings/manual/network/lua_xml_http_request.cpp b/cocos/scripting/lua-bindings/manual/network/lua_xml_http_request.cpp index df1514c1c5..0c77a3f268 100644 --- a/cocos/scripting/lua-bindings/manual/network/lua_xml_http_request.cpp +++ b/cocos/scripting/lua-bindings/manual/network/lua_xml_http_request.cpp @@ -206,8 +206,6 @@ void LuaMinXmlHttpRequest::_sendRequest() } long statusCode = response->getResponseCode(); - char statusString[64] = {}; - sprintf(statusString, "HTTP Status Code: %ld, tag = %s", statusCode, response->getHttpRequest()->getTag()); if (!response->isSucceed()) { @@ -269,7 +267,6 @@ void LuaMinXmlHttpRequest::_sendRequest() release(); }); network::HttpClient::getInstance()->sendImmediate(_httpRequest); - CC_SAFE_RELEASE_NULL(_httpRequest); retain(); } @@ -287,7 +284,7 @@ static void lua_reg_xml_http_request(lua_State* L) static int lua_collect_xml_http_request (lua_State* L) { LuaMinXmlHttpRequest* self = (LuaMinXmlHttpRequest*) tolua_tousertype(L,1,0); - Mtolua_delete(self); + self->release(); return 0; } @@ -304,10 +301,8 @@ static int lua_cocos2dx_XMLHttpRequest_constructor(lua_State* L) if (argc == 0) { self = new (std::nothrow) LuaMinXmlHttpRequest(); - self->autorelease(); - int ID = self? (int)self->_ID : -1; - int* luaID = self? &self->_luaID : NULL; - toluafix_pushusertype_ccobject(L, ID, luaID, (void*)self, "cc.XMLHttpRequest"); + tolua_pushusertype(L, (void*)self, "cc.XMLHttpRequest"); + tolua_register_gc(L, lua_gettop(L)); return 1; } diff --git a/cocos/scripting/lua-bindings/manual/ui/lua_cocos2dx_experimental_webview_manual.cpp b/cocos/scripting/lua-bindings/manual/ui/lua_cocos2dx_experimental_webview_manual.cpp index f9892ae91c..b4d204438d 100644 --- a/cocos/scripting/lua-bindings/manual/ui/lua_cocos2dx_experimental_webview_manual.cpp +++ b/cocos/scripting/lua-bindings/manual/ui/lua_cocos2dx_experimental_webview_manual.cpp @@ -152,7 +152,7 @@ static int lua_cocos2dx_experimental_WebView_setOnDidFailLoading(lua_State* L) }; ScriptHandlerMgr::getInstance()->addCustomHandler((void*)self, handler); - self->setOnDidFinishLoading(callback); + self->setOnDidFailLoading(callback); return 0; } luaL_error(L, "%s has wrong number of arguments: %d, was expecting %d\n ", "ccexp.WebView:setOnDidFailLoading",argc, 1); diff --git a/cocos/scripting/lua-bindings/script/cocos2d/Cocos2dConstants.lua b/cocos/scripting/lua-bindings/script/cocos2d/Cocos2dConstants.lua index dd56ba3e34..5a56473349 100644 --- a/cocos/scripting/lua-bindings/script/cocos2d/Cocos2dConstants.lua +++ b/cocos/scripting/lua-bindings/script/cocos2d/Cocos2dConstants.lua @@ -508,6 +508,8 @@ cc.EventAssetsManagerEx = ASSET_UPDATED = 6, ERROR_UPDATING = 7, UPDATE_FINISHED = 8, + UPDATE_FAILED = 9, + ERROR_DECOMPRESS = 10 }, } diff --git a/cocos/ui/Android.mk b/cocos/ui/Android.mk index 09596acbd8..4031741943 100644 --- a/cocos/ui/Android.mk +++ b/cocos/ui/Android.mk @@ -42,6 +42,7 @@ UIWebView.cpp \ UIWebViewImpl-android.cpp \ UIEditBox/UIEditBox.cpp \ UIEditBox/UIEditBoxImpl-android.cpp \ +UIEditBox/UIEditBoxImpl-common.cpp \ UILayoutComponent.cpp \ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../editor-support diff --git a/cocos/ui/UIButton.cpp b/cocos/ui/UIButton.cpp index acc66a63d6..2e785a5e14 100644 --- a/cocos/ui/UIButton.cpp +++ b/cocos/ui/UIButton.cpp @@ -46,7 +46,7 @@ IMPLEMENT_CLASS_GUI_INFO(Button) Button::Button(): _buttonNormalRenderer(nullptr), _buttonClickedRenderer(nullptr), -_buttonDisableRenderer(nullptr), +_buttonDisabledRenderer(nullptr), _titleRenderer(nullptr), _zoomScale(0.1f), _prevIgnoreSize(true), @@ -137,14 +137,14 @@ void Button::initRenderer() { _buttonNormalRenderer = Scale9Sprite::create(); _buttonClickedRenderer = Scale9Sprite::create(); - _buttonDisableRenderer = Scale9Sprite::create(); + _buttonDisabledRenderer = Scale9Sprite::create(); _buttonClickedRenderer->setScale9Enabled(false); _buttonNormalRenderer->setScale9Enabled(false); - _buttonDisableRenderer->setScale9Enabled(false); + _buttonDisabledRenderer->setScale9Enabled(false); addProtectedChild(_buttonNormalRenderer, NORMAL_RENDERER_Z, -1); addProtectedChild(_buttonClickedRenderer, PRESSED_RENDERER_Z, -1); - addProtectedChild(_buttonDisableRenderer, DISABLED_RENDERER_Z, -1); + addProtectedChild(_buttonDisabledRenderer, DISABLED_RENDERER_Z, -1); } void Button::createTitleRenderer() @@ -165,7 +165,7 @@ void Button::setScale9Enabled(bool able) _buttonNormalRenderer->setScale9Enabled(_scale9Enabled); _buttonClickedRenderer->setScale9Enabled(_scale9Enabled); - _buttonDisableRenderer->setScale9Enabled(_scale9Enabled); + _buttonDisabledRenderer->setScale9Enabled(_scale9Enabled); if (_scale9Enabled) { @@ -319,10 +319,10 @@ void Button::loadTextureDisabled(const std::string& disabled,TextureResType texT switch (texType) { case TextureResType::LOCAL: - _buttonDisableRenderer->initWithFile(disabled); + _buttonDisabledRenderer->initWithFile(disabled); break; case TextureResType::PLIST: - _buttonDisableRenderer->initWithSpriteFrameName(disabled); + _buttonDisabledRenderer->initWithSpriteFrameName(disabled); break; default: break; @@ -332,7 +332,7 @@ void Button::loadTextureDisabled(const std::string& disabled,TextureResType texT void Button::setupDisabledTexture() { - _disabledTextureSize = _buttonDisableRenderer->getContentSize(); + _disabledTextureSize = _buttonDisabledRenderer->getContentSize(); this->updateChildrenDisplayedRGBA(); @@ -342,7 +342,7 @@ void Button::setupDisabledTexture() void Button::loadTextureDisabled(SpriteFrame* disabledSpriteFrame) { - _buttonDisableRenderer->initWithSpriteFrame(disabledSpriteFrame); + _buttonDisabledRenderer->initWithSpriteFrame(disabledSpriteFrame); this->setupDisabledTexture(); } @@ -387,7 +387,7 @@ void Button::setCapInsetsDisabledRenderer(const Rect &capInsets) { return; } - _buttonDisableRenderer->setCapInsets(_capInsetsDisabled); + _buttonDisabledRenderer->setCapInsets(_capInsetsDisabled); } const Rect& Button::getCapInsetsNormalRenderer()const @@ -409,7 +409,7 @@ void Button::onPressStateChangedToNormal() { _buttonNormalRenderer->setVisible(true); _buttonClickedRenderer->setVisible(false); - _buttonDisableRenderer->setVisible(false); + _buttonDisabledRenderer->setVisible(false); _buttonNormalRenderer->setState(Scale9Sprite::State::NORMAL); if (_pressedTextureLoaded) @@ -463,7 +463,7 @@ void Button::onPressStateChangedToPressed() { _buttonNormalRenderer->setVisible(false); _buttonClickedRenderer->setVisible(true); - _buttonDisableRenderer->setVisible(false); + _buttonDisabledRenderer->setVisible(false); if (_pressedActionEnabled) { @@ -491,7 +491,7 @@ void Button::onPressStateChangedToPressed() { _buttonNormalRenderer->setVisible(true); _buttonClickedRenderer->setVisible(true); - _buttonDisableRenderer->setVisible(false); + _buttonDisabledRenderer->setVisible(false); _buttonNormalRenderer->stopAllActions(); _buttonNormalRenderer->setScale(_normalTextureScaleXInSize +_zoomScale, _normalTextureScaleYInSize + _zoomScale); @@ -518,7 +518,7 @@ void Button::onPressStateChangedToDisabled() else { _buttonNormalRenderer->setVisible(false); - _buttonDisableRenderer->setVisible(true); + _buttonDisabledRenderer->setVisible(true); } _buttonClickedRenderer->setVisible(false); @@ -621,7 +621,7 @@ Node* Button::getVirtualRenderer() } else { - return _buttonDisableRenderer; + return _buttonDisabledRenderer; } } @@ -709,31 +709,31 @@ void Button::disabledTextureScaleChangedWithSize() { if (!_scale9Enabled) { - _buttonDisableRenderer->setScale(1.0f); + _buttonDisabledRenderer->setScale(1.0f); } } else { if (_scale9Enabled) { - _buttonDisableRenderer->setScale(1.0); - _buttonDisableRenderer->setPreferredSize(_contentSize); + _buttonDisabledRenderer->setScale(1.0); + _buttonDisabledRenderer->setPreferredSize(_contentSize); } else { Size textureSize = _disabledTextureSize; if (textureSize.width <= 0.0f || textureSize.height <= 0.0f) { - _buttonDisableRenderer->setScale(1.0f); + _buttonDisabledRenderer->setScale(1.0f); return; } float scaleX = _contentSize.width / _disabledTextureSize.width; float scaleY = _contentSize.height / _disabledTextureSize.height; - _buttonDisableRenderer->setScaleX(scaleX); - _buttonDisableRenderer->setScaleY(scaleY); + _buttonDisabledRenderer->setScaleX(scaleX); + _buttonDisabledRenderer->setScaleY(scaleY); } } - _buttonDisableRenderer->setPosition(_contentSize.width / 2.0f, _contentSize.height / 2.0f); + _buttonDisabledRenderer->setPosition(_contentSize.width / 2.0f, _contentSize.height / 2.0f); } void Button::setPressedActionEnabled(bool enabled) @@ -772,6 +772,7 @@ void Button::setTitleText(const std::string& text) _titleRenderer->setString(text); this->setTitleFontSize(_fontSize); updateContentSize(); + updateTitleLocation(); } const std::string Button::getTitleText() const @@ -933,7 +934,7 @@ void Button::copySpecialProperties(Widget *widget) { loadTexturePressed(clickedSprite->getSpriteFrame()); } - auto disabledSprite = button->_buttonDisableRenderer->getSprite(); + auto disabledSprite = button->_buttonDisabledRenderer->getSprite(); if (nullptr != disabledSprite) { loadTextureDisabled(disabledSprite->getSpriteFrame()); diff --git a/cocos/ui/UIButton.h b/cocos/ui/UIButton.h index aa13509370..aac84bbf21 100644 --- a/cocos/ui/UIButton.h +++ b/cocos/ui/UIButton.h @@ -274,6 +274,27 @@ public: * @since v3.3 */ float getZoomScale()const; + + /** + * @brief Return the nine-patch sprite of normal state + * @return the nine-patch sprite of normal state + * @since v3.9 + */ + Scale9Sprite* getRendererNormal() const { return _buttonNormalRenderer; } + + /** + * @brief Return the nine-patch sprite of clicked state + * @return the nine-patch sprite of clicked state + * @since v3.9 + */ + Scale9Sprite* getRendererClicked() const { return _buttonClickedRenderer; } + + /** + * @brief Return the nine-patch sprite of disabled state + * @return the nine-patch sprite of disabled state + * @since v3.9 + */ + Scale9Sprite* getRendererDisabled() const { return _buttonDisabledRenderer; } CC_CONSTRUCTOR_ACCESS: virtual bool init() override; @@ -314,7 +335,7 @@ protected: protected: Scale9Sprite* _buttonNormalRenderer; Scale9Sprite* _buttonClickedRenderer; - Scale9Sprite* _buttonDisableRenderer; + Scale9Sprite* _buttonDisabledRenderer; Label* _titleRenderer; float _zoomScale; diff --git a/cocos/ui/UIEditBox/UIEditBoxImpl-android.cpp b/cocos/ui/UIEditBox/UIEditBoxImpl-android.cpp index f0426d456a..471750190c 100644 --- a/cocos/ui/UIEditBox/UIEditBoxImpl-android.cpp +++ b/cocos/ui/UIEditBox/UIEditBoxImpl-android.cpp @@ -1,7 +1,8 @@ /**************************************************************************** Copyright (c) 2010-2012 cocos2d-x.org Copyright (c) 2012 James Chen - + Copyright (c) 2013-2015 zilongshanren + http://www.cocos2d-x.org Permission is hereby granted, free of charge, to any person obtaining a copy @@ -29,13 +30,12 @@ #include "UIEditBox.h" #include -#include "jni/Java_org_cocos2dx_lib_Cocos2dxBitmap.h" #include "jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h" #include "2d/CCLabel.h" #include "base/ccUTF8.h" #include "math/Vec2.h" #include "ui/UIHelper.h" -#include "base/ccUTF8.h" +#include "base/CCDirector.h" NS_CC_BEGIN @@ -70,88 +70,9 @@ EditBoxImpl* __createSystemEditBox(EditBox* editBox) return new EditBoxImplAndroid(editBox); } -void EditBoxImplAndroid::editBoxEditingDidBegin() -{ - // LOGD("textFieldShouldBeginEditing..."); - cocos2d::ui::EditBoxDelegate *pDelegate = _editBox->getDelegate(); - - if (pDelegate != nullptr) - { - pDelegate->editBoxEditingDidBegin(_editBox); - } - -#if CC_ENABLE_SCRIPT_BINDING - if (NULL != _editBox && 0 != _editBox->getScriptEditBoxHandler()) - { - cocos2d::CommonScriptData data(_editBox->getScriptEditBoxHandler(), "began", _editBox); - cocos2d::ScriptEvent event(cocos2d::kCommonEvent, (void *)&data); - cocos2d::ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event); - } -#endif -} - -void EditBoxImplAndroid::editBoxEditingDidEnd(const std::string& text) -{ - // LOGD("textFieldShouldEndEditing..."); - _text = text; - this->refreshInactiveText(); - - cocos2d::ui::EditBoxDelegate *pDelegate = _editBox->getDelegate(); - if (pDelegate != nullptr) - { - pDelegate->editBoxEditingDidEnd(_editBox); - pDelegate->editBoxReturn(_editBox); - } - -#if CC_ENABLE_SCRIPT_BINDING - if (_editBox != nullptr && 0 != _editBox->getScriptEditBoxHandler()) - { - cocos2d::CommonScriptData data(_editBox->getScriptEditBoxHandler(), "ended", _editBox); - cocos2d::ScriptEvent event(cocos2d::kCommonEvent, (void *)&data); - cocos2d::ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event); - memset(data.eventName, 0, sizeof(data.eventName)); - strncpy(data.eventName, "return", sizeof(data.eventName)); - event.data = (void *)&data; - cocos2d::ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event); - } -#endif - - if (_editBox != nullptr) - { - this->onEndEditing(text); - } -} - -void EditBoxImplAndroid::editBoxEditingChanged(const std::string& text) -{ - // LOGD("editBoxTextChanged..."); - cocos2d::ui::EditBoxDelegate *pDelegate = _editBox->getDelegate(); - _text = text; - if (pDelegate != nullptr) - { - pDelegate->editBoxTextChanged(_editBox, text); - } - -#if CC_ENABLE_SCRIPT_BINDING - if (NULL != _editBox && 0 != _editBox->getScriptEditBoxHandler()) - { - cocos2d::CommonScriptData data(_editBox->getScriptEditBoxHandler(), "changed", _editBox); - cocos2d::ScriptEvent event(cocos2d::kCommonEvent, (void *)&data); - cocos2d::ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event); - } -#endif -} EditBoxImplAndroid::EditBoxImplAndroid(EditBox* pEditText) -: EditBoxImpl(pEditText) -, _label(nullptr) -, _labelPlaceHolder(nullptr) -, _editBoxInputMode(EditBox::InputMode::SINGLE_LINE) -, _editBoxInputFlag(EditBox::InputFlag::INTIAL_CAPS_ALL_CHARACTERS) -, _keyboardReturnType(EditBox::KeyboardReturnType::DEFAULT) -, _colText(Color3B::WHITE) -, _colPlaceHolder(Color3B::GRAY) -, _maxLength(-1) +: EditBoxImplCommon(pEditText) , _editBoxIndex(-1) { } @@ -162,124 +83,67 @@ EditBoxImplAndroid::~EditBoxImplAndroid() removeEditBoxJNI(_editBoxIndex); } -void EditBoxImplAndroid::doAnimationWhenKeyboardMove(float duration, float distance) -{ // don't need to be implemented on android platform. - -} - -static const int CC_EDIT_BOX_PADDING = 5; - -bool EditBoxImplAndroid::initWithSize(const Size& size) +void EditBoxImplAndroid::createNativeControl(const Rect& frame) { - auto rect = Rect(0,0, size.width, size.height); - _editBoxIndex = addEditBoxJNI(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height); - s_allEditBoxes[_editBoxIndex] = this; - - _label = Label::create(); - _label->setSystemFontSize(size.height-12); - // align the text vertically center - _label->setAnchorPoint(Vec2(0, 0.5f)); - _label->setPosition(Vec2(CC_EDIT_BOX_PADDING, size.height / 2.0f)); - _label->setTextColor(_colText); - _editBox->addChild(_label); - - _labelPlaceHolder = Label::create(); - _labelPlaceHolder->setSystemFontSize(size.height-12); - // align the text vertically center - _labelPlaceHolder->setAnchorPoint(Vec2(0, 0.5f)); - _labelPlaceHolder->setPosition(CC_EDIT_BOX_PADDING, size.height / 2.0f); - _labelPlaceHolder->setVisible(false); - _labelPlaceHolder->setTextColor(_colPlaceHolder); - _editBox->addChild(_labelPlaceHolder); + auto director = cocos2d::Director::getInstance(); + auto glView = director->getOpenGLView(); + auto frameSize = glView->getFrameSize(); - _editSize = size; - return true; + auto winSize = director->getWinSize(); + auto leftBottom = _editBox->convertToWorldSpace(Point::ZERO); + + auto contentSize = frame.size; + auto rightTop = _editBox->convertToWorldSpace(Point(contentSize.width, contentSize.height)); + + auto uiLeft = frameSize.width / 2 + (leftBottom.x - winSize.width / 2 ) * glView->getScaleX(); + auto uiTop = frameSize.height /2 - (rightTop.y - winSize.height / 2) * glView->getScaleY(); + auto uiWidth = (rightTop.x - leftBottom.x) * glView->getScaleX(); + auto uiHeight = (rightTop.y - leftBottom.y) * glView->getScaleY(); + LOGD("scaleX = %f", glView->getScaleX()); + _editBoxIndex = addEditBoxJNI(uiLeft, uiTop, uiWidth, uiHeight, glView->getScaleX()); + s_allEditBoxes[_editBoxIndex] = this; } -void EditBoxImplAndroid::setFont(const char* pFontName, int fontSize) +void EditBoxImplAndroid::setNativeFont(const char* pFontName, int fontSize) { - if(_label != NULL) - { - if(strlen(pFontName) > 0) - { - _label->setSystemFontName(pFontName); - } - if(fontSize > 0) - { - _label->setSystemFontSize(fontSize); - } - } - - if(_labelPlaceHolder != NULL) - { - if(strlen(pFontName) > 0) - { - _labelPlaceHolder->setSystemFontName(pFontName); - } - if(fontSize > 0) - { - _labelPlaceHolder->setSystemFontSize(fontSize); - } - } - setFontEditBoxJNI(_editBoxIndex, pFontName, fontSize); + auto director = cocos2d::Director::getInstance(); + auto glView = director->getOpenGLView(); + setFontEditBoxJNI(_editBoxIndex, pFontName, fontSize * glView->getScaleX()); } -void EditBoxImplAndroid::setFontColor(const Color4B& color) +void EditBoxImplAndroid::setNativeFontColor(const Color4B& color) { - _colText = color; - _label->setTextColor(color); setFontColorEditBoxJNI(_editBoxIndex, color.r, color.g, color.b, color.a); } -void EditBoxImplAndroid::setPlaceholderFont(const char* pFontName, int fontSize) +void EditBoxImplAndroid::setNativePlaceholderFont(const char* pFontName, int fontSize) { - if(_labelPlaceHolder != NULL) - { - if(strlen(pFontName) > 0) - { - _labelPlaceHolder->setSystemFontName(pFontName); - } - if(fontSize > 0) - { - _labelPlaceHolder->setSystemFontSize(fontSize); - } - } - CCLOG("Wraning! You can't change Andriod Hint fontName and fontSize"); + CCLOG("Wraning! You can't change Andriod Hint fontName and fontSize"); } -void EditBoxImplAndroid::setPlaceholderFontColor(const Color4B& color) +void EditBoxImplAndroid::setNativePlaceholderFontColor(const Color4B& color) { - _colPlaceHolder = color; - _labelPlaceHolder->setTextColor(color); setPlaceHolderTextColorEditBoxJNI(_editBoxIndex, color.r, color.g, color.b, color.a); } -void EditBoxImplAndroid::setInputMode(EditBox::InputMode inputMode) +void EditBoxImplAndroid::setNativeInputMode(EditBox::InputMode inputMode) { - _editBoxInputMode = inputMode; setInputModeEditBoxJNI(_editBoxIndex, static_cast(inputMode)); } -void EditBoxImplAndroid::setMaxLength(int maxLength) +void EditBoxImplAndroid::setNativeMaxLength(int maxLength) { - _maxLength = maxLength; - setMaxLengthJNI(_editBoxIndex, _maxLength); + setMaxLengthJNI(_editBoxIndex, maxLength); } -int EditBoxImplAndroid::getMaxLength() -{ - return _maxLength; -} -void EditBoxImplAndroid::setInputFlag(EditBox::InputFlag inputFlag) +void EditBoxImplAndroid::setNativeInputFlag(EditBox::InputFlag inputFlag) { - _editBoxInputFlag = inputFlag; setInputFlagEditBoxJNI(_editBoxIndex, static_cast(inputFlag)); } -void EditBoxImplAndroid::setReturnType(EditBox::KeyboardReturnType returnType) +void EditBoxImplAndroid::setNativeReturnType(EditBox::KeyboardReturnType returnType) { - _keyboardReturnType = returnType; setReturnTypeEditBoxJNI(_editBoxIndex, static_cast(returnType)); } @@ -288,129 +152,40 @@ bool EditBoxImplAndroid::isEditing() return false; } -void EditBoxImplAndroid::setInactiveText(const char* pText) -{ - if(EditBox::InputFlag::PASSWORD == _editBoxInputFlag) - { - std::string passwordString; - for(int i = 0; i < strlen(pText); ++i) - passwordString.append("\u25CF"); - _label->setString(passwordString.c_str()); - } - else - { - _label->setString(pText); - } - // Clip the text width to fit to the text box - float fMaxWidth = _editBox->getContentSize().width - CC_EDIT_BOX_PADDING * 2; - Size labelSize = _label->getContentSize(); - if(labelSize.width > fMaxWidth) { - _label->setDimensions(fMaxWidth,labelSize.height); - } -} - -void EditBoxImplAndroid::refreshInactiveText() -{ - setInactiveText(_text.c_str()); - if(_text.size() == 0) - { - _label->setVisible(false); - _labelPlaceHolder->setVisible(true); - } - else - { - _label->setVisible(true); - _labelPlaceHolder->setVisible(false); - } -} -void EditBoxImplAndroid::setText(const char* pText) +void EditBoxImplAndroid::setNativeText(const char* pText) { setTextEditBoxJNI(_editBoxIndex, pText); - _text = pText; - refreshInactiveText(); } -const char* EditBoxImplAndroid::getText(void) +void EditBoxImplAndroid::setNativePlaceHolder(const char* pText) { - return _text.c_str(); + setPlaceHolderTextEditBoxJNI(_editBoxIndex, pText); } -void EditBoxImplAndroid::setPlaceHolder(const char* pText) -{ - if (pText != NULL) - { - _placeHolder = pText; - if (_placeHolder.length() > 0 && _text.length() == 0) - { - _labelPlaceHolder->setVisible(true); - } - - _labelPlaceHolder->setString(_placeHolder.c_str()); - setPlaceHolderTextEditBoxJNI(_editBoxIndex, pText); - } -} -void EditBoxImplAndroid::setPosition(const Vec2& pos) -{ // don't need to be implemented on android platform. -} - -void EditBoxImplAndroid::setVisible(bool visible) +void EditBoxImplAndroid::setNativeVisible(bool visible) { // don't need to be implemented on android platform. setVisibleEditBoxJNI(_editBoxIndex, visible); } -void EditBoxImplAndroid::setContentSize(const Size& size) -{ // don't need to be implemented on android platform. -} - -void EditBoxImplAndroid::setAnchorPoint(const Vec2& anchorPoint) -{ // don't need to be implemented on android platform. -} - -void EditBoxImplAndroid::draw(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags) -{ // don't need to be implemented on android platform. - if(parentFlags) - { - auto rect = ui::Helper::convertBoundingBoxToScreen(_editBox); - setEditBoxViewRectJNI(_editBoxIndex, rect.origin.x, rect.origin.y, rect.size.width, rect.size.height); - } -} - -void EditBoxImplAndroid::onEnter(void) -{ // don't need to be implemented on android platform. -} - -void EditBoxImplAndroid::openKeyboard() +void EditBoxImplAndroid::updateNativeFrame(const Rect& rect) { - _label->setVisible(false); - _labelPlaceHolder->setVisible(false); + setEditBoxViewRectJNI(_editBoxIndex, rect.origin.x, rect.origin.y, rect.size.width, rect.size.height); +} + +void EditBoxImplAndroid::nativeOpenKeyboard() +{ //it will also open up the soft keyboard setVisibleEditBoxJNI(_editBoxIndex,true); } -void EditBoxImplAndroid::closeKeyboard() +void EditBoxImplAndroid::nativeCloseKeyboard() { closeEditBoxKeyboardJNI(_editBoxIndex); } -void EditBoxImplAndroid::onEndEditing(const std::string& text) -{ - setVisibleEditBoxJNI(_editBoxIndex, false); - if(text.size() == 0) - { - _label->setVisible(false); - _labelPlaceHolder->setVisible(true); - } - else - { - _label->setVisible(true); - _labelPlaceHolder->setVisible(false); - setInactiveText(text.c_str()); - } -} - void editBoxEditingDidBegin(int index) { auto it = s_allEditBoxes.find(index); @@ -436,6 +211,12 @@ void editBoxEditingDidEnd(int index, const std::string& text) s_allEditBoxes[index]->editBoxEditingDidEnd(text); } } + +const char* EditBoxImplAndroid::getNativeDefaultFontName() +{ + return ""; +} + } //end of ui namespace NS_CC_END diff --git a/cocos/ui/UIEditBox/UIEditBoxImpl-android.h b/cocos/ui/UIEditBox/UIEditBoxImpl-android.h index 90c273a0b3..66eae9ba45 100644 --- a/cocos/ui/UIEditBox/UIEditBoxImpl-android.h +++ b/cocos/ui/UIEditBox/UIEditBoxImpl-android.h @@ -30,7 +30,7 @@ #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) -#include "UIEditBoxImpl.h" +#include "UIEditBoxImpl-common.h" NS_CC_BEGIN @@ -40,7 +40,7 @@ namespace ui { class EditBox; -class EditBoxImplAndroid : public EditBoxImpl +class EditBoxImplAndroid : public EditBoxImplCommon { public: /** @@ -53,64 +53,30 @@ public: */ virtual ~EditBoxImplAndroid(); - virtual bool initWithSize(const Size& size) override; - virtual void setFont(const char* pFontName, int fontSize) override; - virtual void setFontColor(const Color4B& color) override; - virtual void setPlaceholderFont(const char* pFontName, int fontSize) override; - virtual void setPlaceholderFontColor(const Color4B& color) override; - virtual void setInputMode(EditBox::InputMode inputMode) override; - virtual void setInputFlag(EditBox::InputFlag inputFlag) override; - virtual void setMaxLength(int maxLength) override; - virtual int getMaxLength() override; - virtual void setReturnType(EditBox::KeyboardReturnType returnType) override; + virtual bool isEditing() override; + virtual void createNativeControl(const Rect& frame) override; + virtual void setNativeFont(const char* pFontName, int fontSize) override; + virtual void setNativeFontColor(const Color4B& color) override; + virtual void setNativePlaceholderFont(const char* pFontName, int fontSize) override; + virtual void setNativePlaceholderFontColor(const Color4B& color) override; + virtual void setNativeInputMode(EditBox::InputMode inputMode) override; + virtual void setNativeInputFlag(EditBox::InputFlag inputFlag) override; + virtual void setNativeReturnType(EditBox::KeyboardReturnType returnType)override; + virtual void setNativeText(const char* pText) override; + virtual void setNativePlaceHolder(const char* pText) override; + virtual void setNativeVisible(bool visible) override; + virtual void updateNativeFrame(const Rect& rect) override; + virtual void setNativeContentSize(const Size& size) override {}; + virtual const char* getNativeDefaultFontName() override; + virtual void nativeOpenKeyboard() override; + virtual void nativeCloseKeyboard() override; + virtual void setNativeMaxLength(int maxLength); + - virtual void setText(const char* pText) override; - virtual const char* getText(void) override; - virtual void setPlaceHolder(const char* pText) override; - virtual void setPosition(const Vec2& pos) override; - virtual void setVisible(bool visible) override; - virtual void setContentSize(const Size& size) override; - virtual void setAnchorPoint(const Vec2& anchorPoint) override; - /** - * @js NA - * @lua NA - */ - virtual void draw(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags) override; - /** - * @js NA - * @lua NA - */ - virtual void onEnter(void) override; - virtual void doAnimationWhenKeyboardMove(float duration, float distance) override; - virtual void openKeyboard() override; - virtual void closeKeyboard() override; - - - void editBoxEditingDidBegin(); - void editBoxEditingChanged(const std::string& text); - void editBoxEditingDidEnd(const std::string& text); private: - void setInactiveText(const char* pText); - void onEndEditing(const std::string& text); - void refreshInactiveText(); + virtual void doAnimationWhenKeyboardMove(float duration, float distance)override {} - - Label* _label; - Label* _labelPlaceHolder; - EditBox::InputMode _editBoxInputMode; - EditBox::InputFlag _editBoxInputFlag; - EditBox::KeyboardReturnType _keyboardReturnType; - - std::string _text; - std::string _placeHolder; - - Color4B _colText; - Color4B _colPlaceHolder; - - int _maxLength; - Size _editSize; - int _editBoxIndex; }; diff --git a/cocos/ui/UIEditBox/UIEditBoxImpl-common.cpp b/cocos/ui/UIEditBox/UIEditBoxImpl-common.cpp new file mode 100644 index 0000000000..69afca8d48 --- /dev/null +++ b/cocos/ui/UIEditBox/UIEditBoxImpl-common.cpp @@ -0,0 +1,382 @@ +/**************************************************************************** + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2012 James Chen + Copyright (c) 2013-2015 zilongshanren + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ +#include "UIEditBoxImpl-common.h" + +#define kLabelZOrder 9999 + +#include "UIEditBox.h" +#include "base/CCDirector.h" +#include "2d/CCLabel.h" +#include "ui/UIHelper.h" + +static const int CC_EDIT_BOX_PADDING = 5; + +NS_CC_BEGIN + +namespace ui { + +EditBoxImplCommon::EditBoxImplCommon(EditBox* pEditText) +: EditBoxImpl(pEditText) +, _label(nullptr) +, _labelPlaceHolder(nullptr) +, _editBoxInputMode(EditBox::InputMode::SINGLE_LINE) +, _editBoxInputFlag(EditBox::InputFlag::INTIAL_CAPS_ALL_CHARACTERS) +, _keyboardReturnType(EditBox::KeyboardReturnType::DEFAULT) +, _colText(Color3B::WHITE) +, _colPlaceHolder(Color3B::GRAY) +, _maxLength(-1) +{ +} + +EditBoxImplCommon::~EditBoxImplCommon() +{ +} + + +bool EditBoxImplCommon::initWithSize(const Size& size) +{ + do + { + + Rect rect = Rect(0, 0, size.width, size.height); + + this->createNativeControl(rect); + + initInactiveLabels(size); + setContentSize(size); + + return true; + }while (0); + + return false; +} + +void EditBoxImplCommon::initInactiveLabels(const Size& size) +{ + const char* pDefaultFontName = this->getNativeDefaultFontName(); + + _label = Label::create(); + _label->setAnchorPoint(Vec2(0, 0.5f)); + _label->setColor(Color3B::WHITE); + _label->setVisible(false); + _editBox->addChild(_label, kLabelZOrder); + + _labelPlaceHolder = Label::create(); + _labelPlaceHolder->setAnchorPoint(Vec2(0, 0.5f)); + _labelPlaceHolder->setColor(Color3B::GRAY); + _editBox->addChild(_labelPlaceHolder, kLabelZOrder); + + setFont(pDefaultFontName, size.height*2/3); + setPlaceholderFont(pDefaultFontName, size.height*2/3); +} + +void EditBoxImplCommon::placeInactiveLabels() +{ + _label->setPosition(CC_EDIT_BOX_PADDING, _contentSize.height / 2.0f); + _labelPlaceHolder->setPosition(CC_EDIT_BOX_PADDING, _contentSize.height / 2.0f); +} + +void EditBoxImplCommon::setInactiveText(const char* pText) +{ + if(EditBox::InputFlag::PASSWORD == _editBoxInputFlag) + { + std::string passwordString; + for(int i = 0; i < strlen(pText); ++i) + passwordString.append("\u25CF"); + _label->setString(passwordString.c_str()); + } + else + { + _label->setString(pText); + } + // Clip the text width to fit to the text box + float fMaxWidth = _editBox->getContentSize().width; + float fMaxHeight = _editBox->getContentSize().height; + Size labelSize = _label->getContentSize(); + if(labelSize.width > fMaxWidth || labelSize.height > fMaxHeight) + { + _label->setDimensions(fMaxWidth, fMaxHeight); + } +} + +void EditBoxImplCommon::setFont(const char* pFontName, int fontSize) +{ + this->setNativeFont(pFontName, fontSize); + + if(strlen(pFontName) > 0) + { + _label->setSystemFontName(pFontName); + } + if(fontSize > 0) + { + _label->setSystemFontSize(fontSize); + } +} + +void EditBoxImplCommon::setFontColor(const Color4B& color) +{ + this->setNativeFontColor(color); + + _label->setTextColor(color); +} + +void EditBoxImplCommon::setPlaceholderFont(const char* pFontName, int fontSize) +{ + this->setNativePlaceholderFont(pFontName, fontSize); + + if( strlen(pFontName) > 0) + { + _labelPlaceHolder->setSystemFontName(pFontName); + } + if(fontSize > 0) + { + _labelPlaceHolder->setSystemFontSize(fontSize); + } +} + +void EditBoxImplCommon::setPlaceholderFontColor(const Color4B &color) +{ + this->setNativePlaceholderFontColor(color); + + _labelPlaceHolder->setTextColor(color); +} + +void EditBoxImplCommon::setInputMode(EditBox::InputMode inputMode) +{ + _editBoxInputMode = inputMode; + this->setNativeInputMode(inputMode); +} + +void EditBoxImplCommon::setMaxLength(int maxLength) +{ + _maxLength = maxLength; + this->setNativeMaxLength(maxLength); +} + +int EditBoxImplCommon::getMaxLength() +{ + return _maxLength; +} + +void EditBoxImplCommon::setInputFlag(EditBox::InputFlag inputFlag) +{ + _editBoxInputFlag = inputFlag; + this->setNativeInputFlag(inputFlag); +} + +void EditBoxImplCommon::setReturnType(EditBox::KeyboardReturnType returnType) +{ + _keyboardReturnType = returnType; + this->setNativeReturnType(returnType); +} + +void EditBoxImplCommon::refreshInactiveText() +{ + setInactiveText(_text.c_str()); + if(_text.size() == 0) + { + _label->setVisible(false); + _labelPlaceHolder->setVisible(true); + } + else + { + _label->setVisible(true); + _labelPlaceHolder->setVisible(false); + } +} + +void EditBoxImplCommon::setText(const char* text) +{ + this->setNativeText(text); + _text = text; + refreshInactiveText(); +} + +const char* EditBoxImplCommon::getText(void) +{ + return _text.c_str(); +} + +void EditBoxImplCommon::setPlaceHolder(const char* pText) +{ + if (pText != NULL) + { + _placeHolder = pText; + if (_placeHolder.length() > 0 && _text.length() == 0) + { + _labelPlaceHolder->setVisible(true); + } + + _labelPlaceHolder->setString(_placeHolder.c_str()); + this->setNativePlaceHolder(pText); + } +} + + +void EditBoxImplCommon::setVisible(bool visible) +{ + this->setNativeVisible(visible); +} + +void EditBoxImplCommon::setContentSize(const Size& size) +{ + _contentSize = size; + CCLOG("[Edit text] content size = (%f, %f)", size.width, size.height); + placeInactiveLabels(); + + auto director = cocos2d::Director::getInstance(); + auto glview = director->getOpenGLView(); + Size controlSize = Size(size.width * glview->getScaleX(),size.height * glview->getScaleY()); + + this->setNativeContentSize(controlSize); + +} + +void EditBoxImplCommon::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) +{ + if(flags) + { + auto rect = ui::Helper::convertBoundingBoxToScreen(_editBox); + this->updateNativeFrame(rect); + } +} + +void EditBoxImplCommon::onEnter(void) +{ + const char* pText = getText(); + if (pText) { + setInactiveText(pText); + } +} + +void EditBoxImplCommon::openKeyboard() +{ + _label->setVisible(false); + _labelPlaceHolder->setVisible(false); + + this->nativeOpenKeyboard(); +} + +void EditBoxImplCommon::closeKeyboard() +{ + this->nativeCloseKeyboard(); +} + +void EditBoxImplCommon::onEndEditing(const std::string& text) +{ + this->setNativeVisible(false); + + if(text.size() == 0) + { + _label->setVisible(false); + _labelPlaceHolder->setVisible(true); + } + else + { + _label->setVisible(true); + _labelPlaceHolder->setVisible(false); + setInactiveText(text.c_str()); + } +} + +void EditBoxImplCommon::editBoxEditingDidBegin() +{ + // LOGD("textFieldShouldBeginEditing..."); + cocos2d::ui::EditBoxDelegate *pDelegate = _editBox->getDelegate(); + + if (pDelegate != nullptr) + { + pDelegate->editBoxEditingDidBegin(_editBox); + } + +#if CC_ENABLE_SCRIPT_BINDING + if (NULL != _editBox && 0 != _editBox->getScriptEditBoxHandler()) + { + cocos2d::CommonScriptData data(_editBox->getScriptEditBoxHandler(), "began", _editBox); + cocos2d::ScriptEvent event(cocos2d::kCommonEvent, (void *)&data); + cocos2d::ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event); + } +#endif +} + +void EditBoxImplCommon::editBoxEditingDidEnd(const std::string& text) +{ + // LOGD("textFieldShouldEndEditing..."); + _text = text; + this->refreshInactiveText(); + + cocos2d::ui::EditBoxDelegate *pDelegate = _editBox->getDelegate(); + if (pDelegate != nullptr) + { + pDelegate->editBoxEditingDidEnd(_editBox); + pDelegate->editBoxReturn(_editBox); + } + +#if CC_ENABLE_SCRIPT_BINDING + if (_editBox != nullptr && 0 != _editBox->getScriptEditBoxHandler()) + { + cocos2d::CommonScriptData data(_editBox->getScriptEditBoxHandler(), "ended", _editBox); + cocos2d::ScriptEvent event(cocos2d::kCommonEvent, (void *)&data); + cocos2d::ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event); + memset(data.eventName, 0, sizeof(data.eventName)); + strncpy(data.eventName, "return", sizeof(data.eventName)); + event.data = (void *)&data; + cocos2d::ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event); + } +#endif + + if (_editBox != nullptr) + { + this->onEndEditing(text); + } +} + +void EditBoxImplCommon::editBoxEditingChanged(const std::string& text) +{ + // LOGD("editBoxTextChanged..."); + cocos2d::ui::EditBoxDelegate *pDelegate = _editBox->getDelegate(); + _text = text; + if (pDelegate != nullptr) + { + pDelegate->editBoxTextChanged(_editBox, text); + } + +#if CC_ENABLE_SCRIPT_BINDING + if (NULL != _editBox && 0 != _editBox->getScriptEditBoxHandler()) + { + cocos2d::CommonScriptData data(_editBox->getScriptEditBoxHandler(), "changed", _editBox); + cocos2d::ScriptEvent event(cocos2d::kCommonEvent, (void *)&data); + cocos2d::ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event); + } +#endif +} + + +} + +NS_CC_END + + diff --git a/cocos/ui/UIEditBox/UIEditBoxImpl-common.h b/cocos/ui/UIEditBox/UIEditBoxImpl-common.h new file mode 100644 index 0000000000..9fea60d3dc --- /dev/null +++ b/cocos/ui/UIEditBox/UIEditBoxImpl-common.h @@ -0,0 +1,145 @@ +/**************************************************************************** + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2012 James Chen + Copyright (c) 2013-2015 zilongshanren + + 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 __UIEditBoxIMPLICOMMON_H__ +#define __UIEditBoxIMPLICOMMON_H__ + +#include "platform/CCPlatformConfig.h" + +#include "UIEditBoxImpl.h" + +NS_CC_BEGIN + +namespace ui { + +class EditBox; + +class EditBoxImplCommon : public EditBoxImpl +{ +public: + /** + * @js NA + */ + EditBoxImplCommon(EditBox* pEditText); + /** + * @js NA + * @lua NA + */ + virtual ~EditBoxImplCommon(); + + virtual bool initWithSize(const Size& size); + + virtual void setFont(const char* pFontName, int fontSize); + virtual void setFontColor(const Color4B& color); + virtual void setPlaceholderFont(const char* pFontName, int fontSize); + virtual void setPlaceholderFontColor(const Color4B& color); + virtual void setInputMode(EditBox::InputMode inputMode); + virtual void setInputFlag(EditBox::InputFlag inputFlag); + virtual void setReturnType(EditBox::KeyboardReturnType returnType); + virtual void setText(const char* pText); + virtual void setPlaceHolder(const char* pText); + virtual void setVisible(bool visible); + + + virtual void setMaxLength(int maxLength); + virtual int getMaxLength(); + + virtual const char* getText(void); + virtual void refreshInactiveText(); + + virtual void setContentSize(const Size& size); + + virtual void setAnchorPoint(const Vec2& anchorPoint){} + virtual void setPosition(const Vec2& pos) {} + + /** + * @js NA + * @lua NA + */ + virtual void draw(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags) override; + /** + * @js NA + * @lua NA + */ + virtual void onEnter(void); + virtual void openKeyboard(); + virtual void closeKeyboard(); + + virtual void onEndEditing(const std::string& text); + + void editBoxEditingDidBegin(); + void editBoxEditingChanged(const std::string& text); + void editBoxEditingDidEnd(const std::string& text); + + virtual bool isEditing() = 0; + virtual void createNativeControl(const Rect& frame) = 0; + virtual void setNativeFont(const char* pFontName, int fontSize) = 0; + virtual void setNativeFontColor(const Color4B& color) = 0; + virtual void setNativePlaceholderFont(const char* pFontName, int fontSize) = 0; + virtual void setNativePlaceholderFontColor(const Color4B& color) = 0; + virtual void setNativeInputMode(EditBox::InputMode inputMode) = 0; + virtual void setNativeInputFlag(EditBox::InputFlag inputFlag) = 0; + virtual void setNativeReturnType(EditBox::KeyboardReturnType returnType) = 0; + virtual void setNativeText(const char* pText) = 0; + virtual void setNativePlaceHolder(const char* pText) = 0; + virtual void setNativeVisible(bool visible) = 0; + virtual void updateNativeFrame(const Rect& rect) = 0; + virtual void setNativeContentSize(const Size& size) = 0; + virtual const char* getNativeDefaultFontName() = 0; + virtual void nativeOpenKeyboard() = 0; + virtual void nativeCloseKeyboard() = 0; + virtual void setNativeMaxLength(int maxLength) {}; + + +private: + void initInactiveLabels(const Size& size); + void setInactiveText(const char* pText); + void placeInactiveLabels(); + + Label* _label; + Label* _labelPlaceHolder; + EditBox::InputMode _editBoxInputMode; + EditBox::InputFlag _editBoxInputFlag; + EditBox::KeyboardReturnType _keyboardReturnType; + + std::string _text; + std::string _placeHolder; + + Color4B _colText; + Color4B _colPlaceHolder; + + int _maxLength; + Size _contentSize; +}; + + +} + +NS_CC_END + + +#endif /* __UIEditBoxIMPLICOMMON_H__ */ + diff --git a/cocos/ui/UIEditBox/UIEditBoxImpl-ios.h b/cocos/ui/UIEditBox/UIEditBoxImpl-ios.h index 37db60bfcb..34efc8b265 100644 --- a/cocos/ui/UIEditBox/UIEditBoxImpl-ios.h +++ b/cocos/ui/UIEditBox/UIEditBoxImpl-ios.h @@ -26,14 +26,14 @@ #ifndef __UIEditBoxIMPLIOS_H__ #define __UIEditBoxIMPLIOS_H__ -#include "platform/CCPlatformConfig.h" - #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) -#include "extensions/ExtensionMacros.h" -#include "UIEditBoxImpl.h" +#include "UIEditBoxImpl-common.h" + + @class UIEditBoxImplIOS_objc; +@class UIFont; NS_CC_BEGIN @@ -41,7 +41,7 @@ namespace ui { class EditBox; -class EditBoxImplIOS : public EditBoxImpl +class EditBoxImplIOS : public EditBoxImplCommon { public: /** @@ -53,57 +53,39 @@ public: * @lua NA */ virtual ~EditBoxImplIOS(); - - virtual bool initWithSize(const Size& size); - virtual void setFont(const char* pFontName, int fontSize); - virtual void setFontColor(const Color4B& color); - virtual void setPlaceholderFont(const char* pFontName, int fontSize); - virtual void setPlaceholderFontColor(const Color4B& color); - virtual void setInputMode(EditBox::InputMode inputMode); - virtual void setInputFlag(EditBox::InputFlag inputFlag); - virtual void setMaxLength(int maxLength); - virtual int getMaxLength(); - virtual void setReturnType(EditBox::KeyboardReturnType returnType); - virtual bool isEditing(); - - virtual void setText(const char* pText); - virtual const char* getText(void); - virtual void refreshInactiveText(); - virtual void setPlaceHolder(const char* pText); - virtual void setPosition(const Vec2& pos); - virtual void setVisible(bool visible); - virtual void setContentSize(const Size& size); - virtual void setAnchorPoint(const Vec2& anchorPoint); + virtual void setPosition(const Vec2& pos) override; + virtual void setAnchorPoint(const Vec2& anchorPoint) override; virtual void updatePosition(float dt) override; - /** - * @js NA - * @lua NA - */ - virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)override; - /** - * @js NA - * @lua NA - */ - virtual void onEnter(void); + + virtual bool isEditing() override; + virtual void createNativeControl(const Rect& frame) override; + virtual void setNativeFont(const char* pFontName, int fontSize) override; + virtual void setNativeFontColor(const Color4B& color) override; + virtual void setNativePlaceholderFont(const char* pFontName, int fontSize) override; + virtual void setNativePlaceholderFontColor(const Color4B& color) override; + virtual void setNativeInputMode(EditBox::InputMode inputMode) override; + virtual void setNativeInputFlag(EditBox::InputFlag inputFlag) override; + virtual void setNativeReturnType(EditBox::KeyboardReturnType returnType)override; + virtual void setNativeText(const char* pText) override; + virtual void setNativePlaceHolder(const char* pText) override; + virtual void setNativeVisible(bool visible) override; + virtual void updateNativeFrame(const Rect& rect) override; + virtual void setNativeContentSize(const Size& size) override; + virtual const char* getNativeDefaultFontName() override; + virtual void nativeOpenKeyboard() override; + virtual void nativeCloseKeyboard() override; + + //need to remove siri text + virtual const char* getText(void)override; + virtual void doAnimationWhenKeyboardMove(float duration, float distance); - virtual void openKeyboard(); - virtual void closeKeyboard(); - - virtual void onEndEditing(); private: - void initInactiveLabels(const Size& size); - void setInactiveText(const char* pText); - void adjustTextFieldPosition(); - void placeInactiveLabels(); UIFont* constructFont(const char* fontName, int fontSize); - - Label* _label; - Label* _labelPlaceHolder; - Size _contentSize; + void adjustTextFieldPosition(); + + UIEditBoxImplIOS_objc* _systemControl; Vec2 _position; Vec2 _anchorPoint; - UIEditBoxImplIOS_objc* _systemControl; - int _maxTextLength; }; diff --git a/cocos/ui/UIEditBox/UIEditBoxImpl-ios.mm b/cocos/ui/UIEditBox/UIEditBoxImpl-ios.mm index 711c1fefbc..8579fe8b76 100644 --- a/cocos/ui/UIEditBox/UIEditBoxImpl-ios.mm +++ b/cocos/ui/UIEditBox/UIEditBoxImpl-ios.mm @@ -1,6 +1,7 @@ /**************************************************************************** Copyright (c) 2010-2012 cocos2d-x.org Copyright (c) 2012 James Chen + Copyright (c) 2013-2015 zilongshanren http://www.cocos2d-x.org @@ -36,286 +37,10 @@ #import #import +#import "iOS/CCUIEditBoxIOS.h" + #define getEditBoxImplIOS() ((cocos2d::ui::EditBoxImplIOS *)_editBox) -static const int CC_EDIT_BOX_PADDING = 5; - -#pragma mark - Internal Classes - -/** TODO: Missing doc - Why is this subclass necessary? - */ -@interface UICustomUITextField : UITextField -@end - -@implementation UICustomUITextField - -- (CGRect)textRectForBounds:(CGRect)bounds -{ - auto glview = cocos2d::Director::getInstance()->getOpenGLView(); - - float padding = CC_EDIT_BOX_PADDING * glview->getScaleX() / glview->getContentScaleFactor(); - return CGRectInset(bounds, padding, padding); -} - -- (CGRect)editingRectForBounds:(CGRect)bounds -{ - return [self textRectForBounds:bounds]; -} - -@end - -#pragma mark - UIEditBox ios implementation - - -@interface UIEditBoxImplIOS_objc : NSObject - -@property (nonatomic, retain) UITextField *textField; -@property (nonatomic, assign) void *editBox; -@property (nonatomic, readonly, getter = isEditState) BOOL editState; - -- (instancetype)initWithFrame:(CGRect)frameRect editBox:(void *)editBox; -- (void)doAnimationWhenKeyboardMoveWithDuration:(float)duration distance:(float)distance; - -- (void)setPosition:(CGPoint)pos; -- (void)setContentSize:(CGSize)size; - -- (void)openKeyboard; -- (void)closeKeyboard; - -@end - -#pragma mark - UIEditBox iOS implementation - -@implementation UIEditBoxImplIOS_objc - -#pragma mark - Init & Dealloc - -- (instancetype)initWithFrame:(CGRect)frameRect editBox:(void *)editBox -{ - self = [super init]; - - if (self) - { - _editState = NO; - UITextField *textField = [[[UICustomUITextField alloc] initWithFrame: frameRect] autorelease]; - - textField.textColor = [UIColor whiteColor]; - // TODO: need to delete hard code here. - textField.font = [UIFont systemFontOfSize:frameRect.size.height*2/3]; - textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; - textField.backgroundColor = [UIColor clearColor]; - textField.borderStyle = UITextBorderStyleNone; - textField.delegate = self; - textField.hidden = true; - textField.returnKeyType = UIReturnKeyDefault; - - [textField addTarget:self action:@selector(textChanged:) forControlEvents:UIControlEventEditingChanged]; - - - self.textField = textField; - self.editBox = editBox; - } - - return self; -} - -- (void)dealloc -{ - [_textField resignFirstResponder]; - [_textField removeFromSuperview]; - - self.textField = nil; - - [super dealloc]; -} - -#pragma mark - Public methods - -- (void)doAnimationWhenKeyboardMoveWithDuration:(float)duration distance:(float)distance -{ - auto view = cocos2d::Director::getInstance()->getOpenGLView(); - CCEAGLView *eaglview = (CCEAGLView *)view->getEAGLView(); - - [eaglview doAnimationWhenKeyboardMoveWithDuration:duration distance:distance]; -} - -- (void)setPosition:(CGPoint)pos -{ - // TODO: Handle anchor point? - CGRect frame = _textField.frame; - frame.origin = pos; - - _textField.frame = frame; -} - -- (void)setContentSize:(CGSize)size -{ - CGRect frame = _textField.frame; - frame.size = size; - - _textField.frame = frame; -} - -- (void)openKeyboard -{ - auto view = cocos2d::Director::getInstance()->getOpenGLView(); - CCEAGLView *eaglview = (CCEAGLView *)view->getEAGLView(); - - [eaglview addSubview:_textField]; - [_textField becomeFirstResponder]; -} - -- (void)closeKeyboard -{ - [_textField resignFirstResponder]; - [_textField removeFromSuperview]; -} - -- (BOOL)textFieldShouldReturn:(UITextField *)sender -{ - if (sender == _textField) { - [sender resignFirstResponder]; - } - return NO; -} - -- (void)animationSelector -{ - auto view = cocos2d::Director::getInstance()->getOpenGLView(); - CCEAGLView *eaglview = (CCEAGLView *)view->getEAGLView(); - - [eaglview doAnimationWhenAnotherEditBeClicked]; -} - -/** - * Called each time when the text field's text has changed. - */ -- (void)textChanged:(UITextField*)textField -{ - int maxLength = getEditBoxImplIOS()->getMaxLength(); - if (textField.text.length > maxLength) { - textField.text = [textField.text substringToIndex:maxLength]; - } - - cocos2d::ui::EditBoxDelegate *pDelegate = getEditBoxImplIOS()->getDelegate(); - if (pDelegate != NULL) - { - pDelegate->editBoxTextChanged(getEditBoxImplIOS()->getEditBox(), getEditBoxImplIOS()->getText()); - } - -#if CC_ENABLE_SCRIPT_BINDING - cocos2d::ui::EditBox* pEditBox= getEditBoxImplIOS()->getEditBox(); - if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler()) - { - cocos2d::CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "changed", pEditBox); - cocos2d::ScriptEvent event(cocos2d::kCommonEvent, (void *)&data); - cocos2d::ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event); - } -#endif -} - -#pragma mark - UITextField delegate methods - -- (BOOL)textFieldShouldBeginEditing:(UITextField *)sender // return NO to disallow editing. -{ - CCLOG("textFieldShouldBeginEditing..."); - _editState = YES; - - auto view = cocos2d::Director::getInstance()->getOpenGLView(); - CCEAGLView *eaglview = (CCEAGLView *) view->getEAGLView(); - - if ([eaglview isKeyboardShown]) - { - [self performSelector:@selector(animationSelector) withObject:nil afterDelay:0.0f]; - } - - cocos2d::ui::EditBoxDelegate *pDelegate = getEditBoxImplIOS()->getDelegate(); - - if (pDelegate != NULL) - { - pDelegate->editBoxEditingDidBegin(getEditBoxImplIOS()->getEditBox()); - } - -#if CC_ENABLE_SCRIPT_BINDING - cocos2d::ui::EditBox *pEditBox= getEditBoxImplIOS()->getEditBox(); - if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler()) - { - cocos2d::CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "began", pEditBox); - cocos2d::ScriptEvent event(cocos2d::kCommonEvent, (void *)&data); - cocos2d::ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event); - } -#endif - - return YES; -} - -- (BOOL)textFieldShouldEndEditing:(UITextField *)sender -{ - CCLOG("textFieldShouldEndEditing..."); - _editState = NO; - getEditBoxImplIOS()->refreshInactiveText(); - - cocos2d::ui::EditBoxDelegate *pDelegate = getEditBoxImplIOS()->getDelegate(); - if (pDelegate != NULL) - { - pDelegate->editBoxEditingDidEnd(getEditBoxImplIOS()->getEditBox()); - pDelegate->editBoxReturn(getEditBoxImplIOS()->getEditBox()); - } - -#if CC_ENABLE_SCRIPT_BINDING - cocos2d::ui::EditBox *pEditBox= getEditBoxImplIOS()->getEditBox(); - if (pEditBox != nullptr && 0 != pEditBox->getScriptEditBoxHandler()) - { - cocos2d::CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "ended", pEditBox); - cocos2d::ScriptEvent event(cocos2d::kCommonEvent, (void *)&data); - cocos2d::ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event); - memset(data.eventName, 0, sizeof(data.eventName)); - strncpy(data.eventName, "return", sizeof(data.eventName)); - event.data = (void *)&data; - cocos2d::ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event); - } -#endif - - if (_editBox != nil) - { - getEditBoxImplIOS()->onEndEditing(); - } - - return YES; -} - -/** - * Delegate method called before the text has been changed. - * @param textField The text field containing the text. - * @param range The range of characters to be replaced. - * @param string The replacement string. - * @return YES if the specified text range should be replaced; otherwise, NO to keep the old text. - */ -- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string -{ - int maxLength = getEditBoxImplIOS()->getMaxLength(); - if (maxLength < 0) - { - return YES; - } - - // Prevent crashing undo bug http://stackoverflow.com/questions/433337/set-the-maximum-character-length-of-a-uitextfield - if(range.length + range.location > textField.text.length) - { - return NO; - } - - NSUInteger oldLength = textField.text.length; - NSUInteger replacementLength = string.length; - NSUInteger rangeLength = range.length; - - NSUInteger newLength = oldLength - rangeLength + replacementLength; - - return newLength <= maxLength; -} - -@end - NS_CC_BEGIN @@ -327,98 +52,153 @@ EditBoxImpl* __createSystemEditBox(EditBox* pEditBox) } EditBoxImplIOS::EditBoxImplIOS(EditBox* pEditText) -: EditBoxImpl(pEditText) -, _label(nullptr) -, _labelPlaceHolder(nullptr) -, _anchorPoint(Vec2(0.5f, 0.5f)) +: EditBoxImplCommon(pEditText) , _systemControl(nullptr) -, _maxTextLength(-1) +, _anchorPoint(Vec2(0.5f, 0.5f)) { + } EditBoxImplIOS::~EditBoxImplIOS() { [_systemControl release]; + _systemControl = nil; +} + +void EditBoxImplIOS::createNativeControl(const Rect& frame) +{ + auto glview = cocos2d::Director::getInstance()->getOpenGLView(); + + Rect rect(0, 0, frame.size.width * glview->getScaleX(), frame.size.height * glview->getScaleY()); + + float factor = cocos2d::Director::getInstance()->getContentScaleFactor(); + + rect.size.width /= factor; + rect.size.height /= factor; + + _systemControl = [[UIEditBoxImplIOS_objc alloc] initWithFrame:CGRectMake(rect.origin.x, + rect.origin.y, + rect.size.width, + rect.size.height) + editBox:this]; + +} + +bool EditBoxImplIOS::isEditing() +{ + return [_systemControl isEditState] ? true : false; } void EditBoxImplIOS::doAnimationWhenKeyboardMove(float duration, float distance) { - if ([_systemControl isEditState] || distance < 0.0f) - { + if ([_systemControl isEditState] || distance < 0.0f) { [_systemControl doAnimationWhenKeyboardMoveWithDuration:duration distance:distance]; } } - -bool EditBoxImplIOS::initWithSize(const Size& size) -{ - do - { - auto glview = cocos2d::Director::getInstance()->getOpenGLView(); - - CGRect rect = CGRectMake(0, 0, size.width * glview->getScaleX(),size.height * glview->getScaleY()); - - CCEAGLView *eaglview = static_cast(glview->getEAGLView()); - float factor = eaglview.contentScaleFactor; - rect.size.width /= factor; - rect.size.height /= factor; - - _systemControl = [[UIEditBoxImplIOS_objc alloc] initWithFrame:rect editBox:this]; - if (!_systemControl) break; - - initInactiveLabels(size); - setContentSize(size); - - return true; - }while (0); - return false; -} - -void EditBoxImplIOS::initInactiveLabels(const Size& size) +void EditBoxImplIOS::setNativeFont(const char* pFontName, int fontSize) { - const char* pDefaultFontName = [[_systemControl.textField.font fontName] UTF8String]; - - _label = Label::create(); - _label->setAnchorPoint(Vec2(0, 0.5f)); - _label->setColor(Color3B::WHITE); - _label->setVisible(false); - _editBox->addChild(_label, kLabelZOrder); - - _labelPlaceHolder = Label::create(); - // align the text vertically center - _labelPlaceHolder->setAnchorPoint(Vec2(0, 0.5f)); - _labelPlaceHolder->setColor(Color3B::GRAY); - _editBox->addChild(_labelPlaceHolder, kLabelZOrder); - - setFont(pDefaultFontName, size.height*2/3); - setPlaceholderFont(pDefaultFontName, size.height*2/3); -} - -void EditBoxImplIOS::placeInactiveLabels() -{ - _label->setPosition(CC_EDIT_BOX_PADDING, _contentSize.height / 2.0f); - _labelPlaceHolder->setPosition(CC_EDIT_BOX_PADDING, _contentSize.height / 2.0f); -} - -void EditBoxImplIOS::setInactiveText(const char* pText) -{ - if(_systemControl.textField.secureTextEntry == YES) - { - std::string passwordString; - for(int i = 0; i < strlen(pText); ++i) - passwordString.append("\u25CF"); - _label->setString(passwordString.c_str()); + UIFont* textFont = constructFont(pFontName, fontSize); + if (textFont != nil) { + [_systemControl setFont:textFont]; } - else - _label->setString(getText()); +} + +void EditBoxImplIOS::setNativeFontColor(const Color4B& color) +{ + _systemControl.textColor = [UIColor colorWithRed:color.r / 255.0f + green:color.g / 255.0f + blue:color.b / 255.0f + alpha:color.a / 255.f]; - // Clip the text width to fit to the text box - float fMaxWidth = _editBox->getContentSize().width - CC_EDIT_BOX_PADDING * 2; - Size labelSize = _label->getContentSize(); - if(labelSize.width > fMaxWidth) { - _label->setDimensions(fMaxWidth,labelSize.height); +} + +void EditBoxImplIOS::setNativePlaceholderFont(const char* pFontName, int fontSize) +{ + //TODO:: +} + +void EditBoxImplIOS::setNativePlaceholderFontColor(const Color4B& color) +{ + //TODO:: +} + +void EditBoxImplIOS::setNativeInputMode(EditBox::InputMode inputMode) +{ + [_systemControl setInputMode:inputMode]; +} + +void EditBoxImplIOS::setNativeInputFlag(EditBox::InputFlag inputFlag) +{ + [_systemControl setInputFlag:inputFlag]; +} + +NSString* removeSiriString(NSString* str) +{ + NSString* siriString = @"\xef\xbf\xbc"; + return [str stringByReplacingOccurrencesOfString:siriString withString:@""]; +} + +const char* EditBoxImplIOS::getText(void) +{ + return [removeSiriString(_systemControl.text) UTF8String]; +} + + +void EditBoxImplIOS::setNativeReturnType(EditBox::KeyboardReturnType returnType) +{ + [_systemControl setReturnType:returnType]; +} + +void EditBoxImplIOS::setNativeText(const char* pText) +{ + NSString* nsText =[NSString stringWithUTF8String:pText]; + if ([nsText compare:_systemControl.text] != NSOrderedSame) { + _systemControl.text = nsText; } } + +void EditBoxImplIOS::setNativePlaceHolder(const char* pText) +{ + [_systemControl setPlaceHolder:[NSString stringWithUTF8String:pText]]; +} + +void EditBoxImplIOS::setNativeVisible(bool visible) +{ + [_systemControl setVisible:visible]; +} + +void EditBoxImplIOS::updateNativeFrame(const Rect& rect) +{ + //no-op +} + +void EditBoxImplIOS::setNativeContentSize(const Size& size) +{ + auto director = cocos2d::Director::getInstance(); + auto glview = director->getOpenGLView(); + CCEAGLView *eaglview = static_cast(glview->getEAGLView()); + float factor = eaglview.contentScaleFactor; + + [_systemControl setContentSize:CGSizeMake(size.width / factor, size.height / factor)]; +} + +const char* EditBoxImplIOS::getNativeDefaultFontName() +{ + const char* pDefaultFontName = [[_systemControl getDefaultFontName] UTF8String]; + return pDefaultFontName; +} + +void EditBoxImplIOS::nativeOpenKeyboard() +{ + [_systemControl setVisible:YES]; + [_systemControl openKeyboard]; +} + +void EditBoxImplIOS::nativeCloseKeyboard() +{ + [_systemControl closeKeyboard]; +} UIFont* EditBoxImplIOS::constructFont(const char *fontName, int fontSize) { @@ -429,10 +209,10 @@ UIFont* EditBoxImplIOS::constructFont(const char *fontName, int fontSize) auto glview = cocos2d::Director::getInstance()->getOpenGLView(); float scaleFactor = glview->getScaleX(); - + if (fontSize == -1) { - fontSize = [_systemControl.textField frame].size.height*2/3; + fontSize = _systemControl.frameRect.size.height*2/3; } else { @@ -450,190 +230,32 @@ UIFont* EditBoxImplIOS::constructFont(const char *fontName, int fontSize) } return textFont; } - -void EditBoxImplIOS::setFont(const char* pFontName, int fontSize) -{ - UIFont* textFont = constructFont(pFontName, fontSize); - if(textFont != nil) { - [_systemControl.textField setFont:textFont]; - } - - if(strlen(pFontName) > 0) - { - _label->setSystemFontName(pFontName); - } - if(fontSize > 0) - { - _label->setSystemFontSize(fontSize); - } -} - -void EditBoxImplIOS::setFontColor(const Color4B& color) -{ - _systemControl.textField.textColor = [UIColor colorWithRed:color.r / 255.0f green:color.g / 255.0f blue:color.b / 255.0f alpha:color.a / 255.f]; - _label->setTextColor(color); -} - -void EditBoxImplIOS::setPlaceholderFont(const char* pFontName, int fontSize) -{ - if( strlen(pFontName) > 0) - { - _labelPlaceHolder->setSystemFontName(pFontName); - } - if(fontSize > 0) - { - _labelPlaceHolder->setSystemFontSize(fontSize); - } -} -void EditBoxImplIOS::setPlaceholderFontColor(const Color4B &color) +void EditBoxImplIOS::setPosition(const Vec2& pos) { - _labelPlaceHolder->setTextColor(color); + _position = pos; + adjustTextFieldPosition(); } -void EditBoxImplIOS::setInputMode(EditBox::InputMode inputMode) +void EditBoxImplIOS::setAnchorPoint(const Vec2& anchorPoint) { - switch (inputMode) - { - case EditBox::InputMode::EMAIL_ADDRESS: - _systemControl.textField.keyboardType = UIKeyboardTypeEmailAddress; - break; - case EditBox::InputMode::NUMERIC: - _systemControl.textField.keyboardType = UIKeyboardTypeDecimalPad; - break; - case EditBox::InputMode::PHONE_NUMBER: - _systemControl.textField.keyboardType = UIKeyboardTypePhonePad; - break; - case EditBox::InputMode::URL: - _systemControl.textField.keyboardType = UIKeyboardTypeURL; - break; - case EditBox::InputMode::DECIMAL: - _systemControl.textField.keyboardType = UIKeyboardTypeDecimalPad; - break; - case EditBox::InputMode::SINGLE_LINE: - _systemControl.textField.keyboardType = UIKeyboardTypeDefault; - break; - default: - _systemControl.textField.keyboardType = UIKeyboardTypeDefault; - break; + CCLOG("[Edit text] anchor point = (%f, %f)", anchorPoint.x, anchorPoint.y); + _anchorPoint = anchorPoint; + setPosition(_position); +} + +void EditBoxImplIOS::updatePosition(float dt) +{ + if (nullptr != _systemControl) { + this->adjustTextFieldPosition(); } } -void EditBoxImplIOS::setMaxLength(int maxLength) -{ - _maxTextLength = maxLength; -} - -int EditBoxImplIOS::getMaxLength() -{ - return _maxTextLength; -} - -void EditBoxImplIOS::setInputFlag(EditBox::InputFlag inputFlag) -{ - switch (inputFlag) - { - case EditBox::InputFlag::PASSWORD: - _systemControl.textField.secureTextEntry = YES; - break; - case EditBox::InputFlag::INITIAL_CAPS_WORD: - _systemControl.textField.autocapitalizationType = UITextAutocapitalizationTypeWords; - break; - case EditBox::InputFlag::INITIAL_CAPS_SENTENCE: - _systemControl.textField.autocapitalizationType = UITextAutocapitalizationTypeSentences; - break; - case EditBox::InputFlag::INTIAL_CAPS_ALL_CHARACTERS: - _systemControl.textField.autocapitalizationType = UITextAutocapitalizationTypeAllCharacters; - break; - case EditBox::InputFlag::SENSITIVE: - _systemControl.textField.autocorrectionType = UITextAutocorrectionTypeNo; - break; - default: - break; - } -} - -void EditBoxImplIOS::setReturnType(EditBox::KeyboardReturnType returnType) -{ - switch (returnType) { - case EditBox::KeyboardReturnType::DEFAULT: - _systemControl.textField.returnKeyType = UIReturnKeyDefault; - break; - case EditBox::KeyboardReturnType::DONE: - _systemControl.textField.returnKeyType = UIReturnKeyDone; - break; - case EditBox::KeyboardReturnType::SEND: - _systemControl.textField.returnKeyType = UIReturnKeySend; - break; - case EditBox::KeyboardReturnType::SEARCH: - _systemControl.textField.returnKeyType = UIReturnKeySearch; - break; - case EditBox::KeyboardReturnType::GO: - _systemControl.textField.returnKeyType = UIReturnKeyGo; - break; - default: - _systemControl.textField.returnKeyType = UIReturnKeyDefault; - break; - } -} - -bool EditBoxImplIOS::isEditing() -{ - return [_systemControl isEditState] ? true : false; -} - -void EditBoxImplIOS::refreshInactiveText() -{ - const char* text = getText(); - if(_systemControl.textField.hidden == YES) - { - setInactiveText(text); - if(strlen(text) == 0) - { - _label->setVisible(false); - _labelPlaceHolder->setVisible(true); - } - else - { - _label->setVisible(true); - _labelPlaceHolder->setVisible(false); - } - } -} - -void EditBoxImplIOS::setText(const char* text) -{ - NSString* nsText =[NSString stringWithUTF8String:text]; - if ([nsText compare:_systemControl.textField.text] != NSOrderedSame) - { - _systemControl.textField.text = nsText; - } - - refreshInactiveText(); -} - -NSString* removeSiriString(NSString* str) -{ - NSString* siriString = @"\xef\xbf\xbc"; - return [str stringByReplacingOccurrencesOfString:siriString withString:@""]; -} - -const char* EditBoxImplIOS::getText(void) -{ - return [removeSiriString(_systemControl.textField.text) UTF8String]; -} - -void EditBoxImplIOS::setPlaceHolder(const char* pText) -{ - _systemControl.textField.placeholder = [NSString stringWithUTF8String:pText]; - _labelPlaceHolder->setString(pText); -} - static CGPoint convertDesignCoordToScreenCoord(const Vec2& designCoord) { auto glview = cocos2d::Director::getInstance()->getOpenGLView(); CCEAGLView *eaglview = (CCEAGLView *) glview->getEAGLView(); - + float viewH = (float)[eaglview getHeight]; Vec2 visiblePos = Vec2(designCoord.x * glview->getScaleX(), designCoord.y * glview->getScaleY()); @@ -644,66 +266,11 @@ static CGPoint convertDesignCoordToScreenCoord(const Vec2& designCoord) float factor = eaglview.contentScaleFactor; screenPos.x = screenPos.x / factor; screenPos.y = screenPos.y / factor; - + CCLOGINFO("[EditBox] pos x = %f, y = %f", screenGLPos.x, screenGLPos.y); return screenPos; } -void EditBoxImplIOS::setPosition(const Vec2& pos) -{ - _position = pos; - adjustTextFieldPosition(); -} - -void EditBoxImplIOS::setVisible(bool visible) -{ -// _systemControl.textField.hidden = !visible; -} - -void EditBoxImplIOS::setContentSize(const Size& size) -{ - _contentSize = size; - CCLOG("[Edit text] content size = (%f, %f)", size.width, size.height); - placeInactiveLabels(); - auto glview = cocos2d::Director::getInstance()->getOpenGLView(); - CGSize controlSize = CGSizeMake(size.width * glview->getScaleX(),size.height * glview->getScaleY()); - - CCEAGLView *eaglview = static_cast(glview->getEAGLView()); - float factor = eaglview.contentScaleFactor; - controlSize.width /= factor; - controlSize.height /= factor; - - [_systemControl setContentSize:controlSize]; -} - -void EditBoxImplIOS::setAnchorPoint(const Vec2& anchorPoint) -{ - CCLOG("[Edit text] anchor point = (%f, %f)", anchorPoint.x, anchorPoint.y); - _anchorPoint = anchorPoint; - setPosition(_position); -} - -void EditBoxImplIOS::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) -{ -} - -void EditBoxImplIOS::onEnter(void) -{ - adjustTextFieldPosition(); - const char* pText = getText(); - if (pText) { - setInactiveText(pText); - } -} - -void EditBoxImplIOS::updatePosition(float dt) -{ - if (nullptr != _systemControl) { - this->adjustTextFieldPosition(); - } -} - - void EditBoxImplIOS::adjustTextFieldPosition() { @@ -715,36 +282,6 @@ void EditBoxImplIOS::adjustTextFieldPosition() [_systemControl setPosition:convertDesignCoordToScreenCoord(designCoord)]; } -void EditBoxImplIOS::openKeyboard() -{ - _label->setVisible(false); - _labelPlaceHolder->setVisible(false); - - _systemControl.textField.hidden = NO; - [_systemControl openKeyboard]; -} - -void EditBoxImplIOS::closeKeyboard() -{ - [_systemControl closeKeyboard]; -} - -void EditBoxImplIOS::onEndEditing() -{ - _systemControl.textField.hidden = YES; - if(strlen(getText()) == 0) - { - _label->setVisible(false); - _labelPlaceHolder->setVisible(true); - } - else - { - _label->setVisible(true); - _labelPlaceHolder->setVisible(false); - setInactiveText(getText()); - } -} - } NS_CC_END diff --git a/cocos/ui/UIEditBox/UIEditBoxImpl-win32.cpp b/cocos/ui/UIEditBox/UIEditBoxImpl-win32.cpp index 59e3ea2f3a..e453fb15ad 100644 --- a/cocos/ui/UIEditBox/UIEditBoxImpl-win32.cpp +++ b/cocos/ui/UIEditBox/UIEditBoxImpl-win32.cpp @@ -39,6 +39,8 @@ class CWin32InputBox; +typedef void (*Win32InputBoxTextChange)(const char *pText, cocos2d::ui::EditBoxImplWin *ctx); + // Structure used to orient the inputbox behavior struct WIN32INPUTBOX_PARAM { @@ -70,6 +72,12 @@ struct WIN32INPUTBOX_PARAM IN DWORD nMaxLength; + IN OPTIONAL cocos2d::ui::EditBox::KeyboardReturnType eReturnType; + IN OPTIONAL cocos2d::ui::EditBox::InputMode eInputMode; + IN OPTIONAL cocos2d::ui::EditBox::InputFlag eInputFlag; + IN OPTIONAL Win32InputBoxTextChange lpfnOnTextChange; + IN OPTIONAL cocos2d::ui::EditBoxImplWin* lpCtx; + // Owner window HWND hwndOwner; HINSTANCE hInstance; @@ -87,6 +95,7 @@ private: WIN32INPUTBOX_PARAM *_param; static LRESULT CALLBACK DlgProc(HWND, UINT, WPARAM, LPARAM); HWND _hwndEditCtrl; + int _recursionDepth; void InitDialog(); void SetParam(WIN32INPUTBOX_PARAM *); @@ -103,8 +112,16 @@ public: LPCSTR szPrompt, std::string* pstrResult, DWORD nMaxLength, - bool bMultiLine = false, - HWND hwndParent = 0); + bool bMultiLine, + HWND hwndParent, + cocos2d::ui::EditBox::KeyboardReturnType eReturnType, + cocos2d::ui::EditBox::InputMode eInputMode, + cocos2d::ui::EditBox::InputFlag eInputFlag, + Win32InputBoxTextChange lpfnOnTextChange, + cocos2d::ui::EditBoxImplWin *ctx); + + void SetText(const char *pText); + void Close(); }; @@ -174,14 +191,13 @@ static unsigned char definputbox_dlg[] = 0xff, 0xff, 0xff, 0xff, 0xff, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static LPCTSTR definputbox_buttonnames[] = { _T("OK"), _T("CANCEL") }; -static const INT_PTR definputbox_buttonids[] = { IDOK, IDCANCEL }; - static const INT definputbox_id_prompt = 1000, definputbox_id_edit1 = 1001, definputbox_id_edit2 = 1002; +static CWin32InputBox *s_win32InputBox = nullptr; + WIN32INPUTBOX_PARAM::WIN32INPUTBOX_PARAM() { bMultiline = false; @@ -206,6 +222,8 @@ WIN32INPUTBOX_PARAM::WIN32INPUTBOX_PARAM() CWin32InputBox::CWin32InputBox(WIN32INPUTBOX_PARAM *param) { _param = param; + _hwndEditCtrl = NULL; + _recursionDepth = 0; } CWin32InputBox::~CWin32InputBox() @@ -292,9 +310,12 @@ INT_PTR CWin32InputBox::InputBoxEx(WIN32INPUTBOX_PARAM *param) } CWin32InputBox inputbox(param); + s_win32InputBox = &inputbox; // Resize dialog and SHOW or HIDE multiline INT_PTR r = ::DialogBoxIndirectParam(param->hInstance, dlgTemplate, param->hwndOwner, (DLGPROC)DlgProc, (LPARAM)&inputbox); + param->hDlg = NULL; + s_win32InputBox = nullptr; return r; } @@ -305,7 +326,12 @@ INT_PTR CWin32InputBox::InputBox( std::string* pstrResult, DWORD nResultSize, bool bMultiLine, - HWND hwndParent) + HWND hwndParent, + cocos2d::ui::EditBox::KeyboardReturnType eReturnType, + cocos2d::ui::EditBox::InputMode eInputMode, + cocos2d::ui::EditBox::InputFlag eInputFlag, + Win32InputBoxTextChange lpfnOnTextChange, + cocos2d::ui::EditBoxImplWin *ctx) { WIN32INPUTBOX_PARAM param; @@ -315,14 +341,36 @@ INT_PTR CWin32InputBox::InputBox( param.nMaxLength = nResultSize; param.bMultiline = bMultiLine; param.hwndOwner = hwndParent; + param.eReturnType = eReturnType; + param.eInputMode = eInputMode; + param.eInputFlag = eInputFlag; + param.lpfnOnTextChange = lpfnOnTextChange; + param.lpCtx = ctx; return InputBoxEx(¶m); } void CWin32InputBox::InitDialog() { - // Set the button captions - for (size_t i = 0; ihDlg, (int)definputbox_buttonids[i], definputbox_buttonnames[i]); + // Set the button captions, associated with ReturnType + switch (_param->eReturnType) + { + case cocos2d::ui::EditBox::KeyboardReturnType::DEFAULT: + ::SetDlgItemTextW(_param->hDlg, IDOK, L"OK"); + break; + case cocos2d::ui::EditBox::KeyboardReturnType::DONE: + ::SetDlgItemTextW(_param->hDlg, IDOK, L"DONE"); + break; + case cocos2d::ui::EditBox::KeyboardReturnType::SEND: + ::SetDlgItemTextW(_param->hDlg, IDOK, L"SEND"); + break; + case cocos2d::ui::EditBox::KeyboardReturnType::SEARCH: + ::SetDlgItemTextW(_param->hDlg, IDOK, L"SEARCH"); + break; + case cocos2d::ui::EditBox::KeyboardReturnType::GO: + ::SetDlgItemTextW(_param->hDlg, IDOK, L"GO"); + break; + } + ::SetDlgItemTextW(_param->hDlg, IDCANCEL, L"CANCEL"); // Set other controls std::u16string utf16Title; @@ -330,7 +378,7 @@ void CWin32InputBox::InitDialog() ::SetWindowTextW(_param->hDlg, (LPCWSTR) utf16Title.c_str()); std::u16string utf16Prompt; - cocos2d::StringUtils::UTF8ToUTF16(_param->szTitle, utf16Prompt); + cocos2d::StringUtils::UTF8ToUTF16(_param->szPrompt, utf16Prompt); ::SetDlgItemTextW(_param->hDlg, definputbox_id_prompt, (LPCWSTR) utf16Prompt.c_str()); HWND hwndEdit1 = ::GetDlgItem(_param->hDlg, definputbox_id_edit1); @@ -386,8 +434,68 @@ void CWin32InputBox::InitDialog() ::ShowWindow(hwndEdit2, SW_HIDE); } + + // Sets the text limit of the edit control. + // wParam is the maximum number of WCHARs the user can enter. For Unicode text, wParam is the number of characters. + // Please refer to https://msdn.microsoft.com/en-us/library/bb761607%28v=vs.85%29.aspx + if ((int)_param->nMaxLength > 0) + { + ::SendMessageW(hwndEdit1, EM_LIMITTEXT, (WPARAM)_param->nMaxLength, 0); + ::SendMessageW(hwndEdit2, EM_LIMITTEXT, (WPARAM)_param->nMaxLength, 0); + } + + switch (_param->eInputFlag) + { + case cocos2d::ui::EditBox::InputFlag::PASSWORD: + // Sets a password character displayed in a edit control when the user types text. + // Please refer to https://msdn.microsoft.com/en-us/library/bb761653%28v=vs.85%29.aspx + ::SendMessageW(hwndEdit1, EM_SETPASSWORDCHAR, (WPARAM)L'*', 0); + ::SendMessageW(hwndEdit2, EM_SETPASSWORDCHAR, (WPARAM)L'*', 0); + break; + case cocos2d::ui::EditBox::InputFlag::SENSITIVE: + break; + case cocos2d::ui::EditBox::InputFlag::INITIAL_CAPS_WORD: + break; + case cocos2d::ui::EditBox::InputFlag::INITIAL_CAPS_SENTENCE: + break; + case cocos2d::ui::EditBox::InputFlag::INTIAL_CAPS_ALL_CHARACTERS: + // Converts all characters to lowercase as they are typed into the edit control. + // Please refer to https://msdn.microsoft.com/en-us/library/bb775464%28v=vs.85%29.aspx + ::SetWindowLongW(hwndEdit1, GWL_STYLE, ::GetWindowLongW(hwndEdit1, GWL_STYLE) | ES_UPPERCASE); + ::SetWindowLongW(hwndEdit2, GWL_STYLE, ::GetWindowLongW(hwndEdit2, GWL_STYLE) | ES_UPPERCASE); + break; + default: + break; + } + + switch (_param->eInputMode) + { + case cocos2d::ui::EditBox::InputMode::ANY: + break; + case cocos2d::ui::EditBox::InputMode::EMAIL_ADDRESS: + break; + case cocos2d::ui::EditBox::InputMode::NUMERIC: + // Allows only digits to be entered into the edit control. + // Note that, even with this set, it is still possible to paste non-digits into the edit control. + // Please refer to https://msdn.microsoft.com/en-us/library/bb775464%28v=vs.85%29.aspx + ::SetWindowLongW(hwndEdit1, GWL_STYLE, ::GetWindowLongW(hwndEdit1, GWL_STYLE) | ES_NUMBER); + ::SetWindowLongW(hwndEdit2, GWL_STYLE, ::GetWindowLongW(hwndEdit2, GWL_STYLE) | ES_NUMBER); + break; + case cocos2d::ui::EditBox::InputMode::PHONE_NUMBER: + break; + case cocos2d::ui::EditBox::InputMode::URL: + break; + case cocos2d::ui::EditBox::InputMode::DECIMAL: + break; + case cocos2d::ui::EditBox::InputMode::SINGLE_LINE: + break; + default: + break; + } } +#define REDNERING_TIMER_ID 2015 + // Message handler for about box. LRESULT CALLBACK CWin32InputBox::DlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { @@ -403,6 +511,15 @@ LRESULT CALLBACK CWin32InputBox::DlgProc(HWND hDlg, UINT message, WPARAM wParam, _this = (CWin32InputBox *)lParam; _this->_param->hDlg = hDlg; _this->InitDialog(); + + // Set timer for rendering + TIMERPROC lpTimerFunc = [](HWND, UINT, UINT, DWORD) { + auto director = cocos2d::Director::getInstance(); + auto glview = director->getOpenGLView(); + director->mainLoop(); + glview->pollEvents(); + }; + ::SetTimer(hDlg, REDNERING_TIMER_ID, USER_TIMER_MINIMUM, lpTimerFunc); return TRUE; } @@ -412,15 +529,21 @@ LRESULT CALLBACK CWin32InputBox::DlgProc(HWND hDlg, UINT message, WPARAM wParam, CHAR buf[1024]; static int i = 0; sprintf(buf, "WM_COMMAND: %09d wParam=%08X lParam=%08X\n", i++, wParam, lParam); - OutputDebugString(buf); + OutputDebugStringA(buf); #endif INT_PTR buttonId = LOWORD(wParam); - for (size_t i = 0; - i_recursionDepth == 0 && _this->_param->lpfnOnTextChange != nullptr) { - if (buttonId == definputbox_buttonids[i]) - { std::u16string wstrResult; std::string utf8Result; @@ -434,34 +557,15 @@ LRESULT CALLBACK CWin32InputBox::DlgProc(HWND hDlg, UINT message, WPARAM wParam, bool conversionResult = cocos2d::StringUtils::UTF16ToUTF8(wstrResult, utf8Result); _this->_param->pstrResult->clear(); + ++_this->_recursionDepth; // Prevent recursive calls if (conversionResult) { - DWORD inputLengthAsUTF8 = (DWORD) cocos2d::StringUtils::getCharacterCountInUTF8String(utf8Result); - if ((_this->_param->nMaxLength > 0) && - (_this->_param->nMaxLength < inputLengthAsUTF8)) - { - // LengthFilter - for (size_t pos=0; pos < _this->_param->nMaxLength; pos++) - { - std::string utf8Bytes; - std::u16string utf16Character(1, wstrResult[pos]); - - bool utf16toutf8ConversionResult = cocos2d::StringUtils::UTF16ToUTF8(utf16Character, utf8Bytes); - if (utf16toutf8ConversionResult) - { - _this->_param->pstrResult->append(utf8Bytes); - } - } - } - else - { - *(_this->_param->pstrResult) = utf8Result; - } + *(_this->_param->pstrResult) = std::move(utf8Result); } - - ::EndDialog(hDlg, buttonId); + // Invoke editBoxTextChanged indirectly + _this->_param->lpfnOnTextChange(_this->_param->pstrResult->c_str(), _this->_param->lpCtx); + --_this->_recursionDepth; return TRUE; - } } } break; @@ -469,6 +573,33 @@ LRESULT CALLBACK CWin32InputBox::DlgProc(HWND hDlg, UINT message, WPARAM wParam, return FALSE; } +void CWin32InputBox::SetText(const char* pText) +{ + if (_hwndEditCtrl != NULL) + { + std::u16string utf16Text; + cocos2d::StringUtils::UTF8ToUTF16(pText, utf16Text); + + // Keep the cursor position + // Please refer to : + // https://msdn.microsoft.com/en-us/library/bb761598%28v=vs.85%29.aspx + // https://msdn.microsoft.com/en-us/library/bb761661%28v=vs.85%29.aspx + size_t len = utf16Text.length(); + DWORD beginPos, endPos; + ::SendMessageW(_hwndEditCtrl, EM_GETSEL, (WPARAM)&beginPos, (LPARAM)&endPos); + ::SendMessageW(_hwndEditCtrl, WM_SETTEXT, 0, (LPARAM)utf16Text.c_str()); + ::SendMessageW(_hwndEditCtrl, EM_SETSEL, (WPARAM)std::min(beginPos, len), (LPARAM)std::min(endPos, len)); + } +} + +void CWin32InputBox::Close() +{ + if (_param->hDlg != NULL) + { + ::EndDialog(_param->hDlg, IDCANCEL); + _param->hDlg = NULL; + } +} NS_CC_BEGIN @@ -476,7 +607,7 @@ namespace ui { EditBoxImpl* __createSystemEditBox(EditBox* pEditBox) { - return new EditBoxImplWin(pEditBox); + return new (std::nothrow) EditBoxImplWin(pEditBox); } EditBoxImplWin::EditBoxImplWin(EditBox* pEditText) @@ -489,6 +620,7 @@ EditBoxImplWin::EditBoxImplWin(EditBox* pEditText) , _colText(Color3B::WHITE) , _colPlaceHolder(Color3B::GRAY) , _maxLength(-1) +, _isEditing(false) { } @@ -608,37 +740,38 @@ void EditBoxImplWin::setReturnType(EditBox::KeyboardReturnType returnType) bool EditBoxImplWin::isEditing() { - return false; + return _isEditing; } void EditBoxImplWin::setText(const char* pText) { if (pText != nullptr) { + if (strcmp(_text.c_str(), pText) == 0) // do nothing if the text is not changed + { + return; + } + _text = pText; + if (_isEditing && s_win32InputBox != nullptr) // set text for the running Win32InputBox + { + s_win32InputBox->SetText(pText); + } if (_text.length() > 0) { _labelPlaceHolder->setVisible(false); - std::string strToShow; - if (EditBox::InputFlag::PASSWORD == _editBoxInputFlag) { long length = StringUtils::getCharacterCountInUTF8String(_text); - for (long i = 0; i < length; i++) - { - strToShow.append("*"); - } + std::string strToShow(length, '*'); // Fills strToShow with length consecutive copies of character '*' + _label->setString(strToShow); } else { - strToShow = _text; + _label->setString(_text); } - - //! std::string strWithEllipsis = getStringWithEllipsisJni(strToShow.c_str(), _editSize.width, _editSize.height-12); - //! _label->setString(strWithEllipsis.c_str()); - _label->setString(strToShow.c_str()); float maxWidth = _editSize.width - 2 * CC_EDIT_BOX_PADDING; auto labelSize = _label->getContentSize(); @@ -671,7 +804,7 @@ void EditBoxImplWin::setPlaceHolder(const char* pText) _labelPlaceHolder->setVisible(true); } - _labelPlaceHolder->setString(_placeHolder.c_str()); + _labelPlaceHolder->setString(_placeHolder); } } @@ -705,9 +838,10 @@ void EditBoxImplWin::openKeyboard() _delegate->editBoxEditingDidBegin(_editBox); } + _isEditing = true; #if CC_ENABLE_SCRIPT_BINDING auto editBox = this->getEditBox(); - if (editBox && editBox->getScriptEditBoxHandler()) + if (nullptr != editBox && 0 != editBox->getScriptEditBoxHandler()) { CommonScriptData data(editBox->getScriptEditBoxHandler(), "began",editBox); ScriptEvent event(kCommonEvent,(void*)&data); @@ -720,17 +854,19 @@ void EditBoxImplWin::openKeyboard() placeHolder = "Enter value"; std::string text = getText(); + std::string originalText = text; auto glView = Director::getInstance()->getOpenGLView(); HWND hwnd = glView->getWin32Window(); - bool didChange = CWin32InputBox::InputBox("Input", placeHolder.c_str(), &text, _maxLength, false, hwnd) == IDOK; + bool didChange = CWin32InputBox::InputBox("Input", placeHolder.c_str(), &text, _maxLength, false, hwnd, + _keyboardReturnType, _editBoxInputMode, _editBoxInputFlag, + &EditBoxImplWin::onWin32InputBoxTextChange, this) == IDOK; + _isEditing = false; - if (didChange) - setText(text.c_str()); + setText(didChange ? text.c_str() : originalText.c_str()); if (_delegate != nullptr) { - if (didChange) - _delegate->editBoxTextChanged(_editBox, getText()); + _delegate->editBoxTextChanged(_editBox, getText()); _delegate->editBoxEditingDidEnd(_editBox); _delegate->editBoxReturn(_editBox); } @@ -740,10 +876,7 @@ void EditBoxImplWin::openKeyboard() { CommonScriptData data(_editBox->getScriptEditBoxHandler(), "changed",_editBox); ScriptEvent event(kCommonEvent,(void*)&data); - if (didChange) - { - ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event); - } + ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event); memset(data.eventName,0,sizeof(data.eventName)); strncpy(data.eventName,"ended",sizeof(data.eventName)); event.data = (void*)&data; @@ -756,9 +889,38 @@ void EditBoxImplWin::openKeyboard() #endif // #if CC_ENABLE_SCRIPT_BINDING } +void EditBoxImplWin::onWin32InputBoxTextChange(const char *pText, EditBoxImplWin* thiz) +{ + thiz->_isEditing = false; // Prevent recursive calls + thiz->setText(pText); + thiz->_isEditing = true; + + auto delegate = thiz->getDelegate(); + if (delegate != nullptr) + { + delegate->editBoxTextChanged(thiz->_editBox, thiz->_text); + } + +#if CC_ENABLE_SCRIPT_BINDING + auto editBox = thiz->getEditBox(); + if (nullptr != editBox && 0 != editBox->getScriptEditBoxHandler()) + { + CommonScriptData data(editBox->getScriptEditBoxHandler(), "changed", editBox); + ScriptEvent event(kCommonEvent, (void*)&data); + ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event); + } +#endif // #if CC_ENABLE_SCRIPT_BINDING +} + void EditBoxImplWin::closeKeyboard() { - + // close the running Win32InputBox + if (s_win32InputBox != nullptr) + { + s_win32InputBox->Close(); + s_win32InputBox = nullptr; + _isEditing = false; + } } void EditBoxImplWin::onEnter(void) diff --git a/cocos/ui/UIEditBox/UIEditBoxImpl-win32.h b/cocos/ui/UIEditBox/UIEditBoxImpl-win32.h index bc25d54989..9ebfa94162 100644 --- a/cocos/ui/UIEditBox/UIEditBoxImpl-win32.h +++ b/cocos/ui/UIEditBox/UIEditBoxImpl-win32.h @@ -105,6 +105,8 @@ private: HWND _sysEdit; int _maxTextLength; */ + bool _isEditing; + static void onWin32InputBoxTextChange(const char *pText, EditBoxImplWin *thiz); }; diff --git a/cocos/ui/UIEditBox/iOS/CCUIEditBoxIOS.h b/cocos/ui/UIEditBox/iOS/CCUIEditBoxIOS.h new file mode 100644 index 0000000000..8aa9ff7b78 --- /dev/null +++ b/cocos/ui/UIEditBox/iOS/CCUIEditBoxIOS.h @@ -0,0 +1,62 @@ +/**************************************************************************** + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2012 James Chen + Copyright (c) 2013-2015 zilongshanren + Copyright (c) 2015 Mazyad Alabduljaleel + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#import +#import "CCUITextInput.h" +#include "UIEditBoxImpl-ios.h" + + +@interface UIEditBoxImplIOS_objc : NSObject + +@property (nonatomic, retain) UIView *textInput; +@property (nonatomic, assign) void *editBox; +@property (nonatomic, assign) NSString *text; +@property (nonatomic, assign) CGRect frameRect; +@property (nonatomic, assign) cocos2d::ui::EditBox::InputFlag dataInputMode; +@property (nonatomic, assign) cocos2d::ui::EditBox::KeyboardReturnType keyboardReturnType; +@property (nonatomic, readonly, getter = isEditState) BOOL editState; + +- (instancetype)initWithFrame:(CGRect)frameRect editBox:(void *)editBox; +- (void)doAnimationWhenKeyboardMoveWithDuration:(float)duration distance:(float)distance; + +- (NSString *)getDefaultFontName; + +- (void)setInputMode:(cocos2d::ui::EditBox::InputMode)inputMode; +- (void)setInputFlag:(cocos2d::ui::EditBox::InputFlag)flag; +- (void)setReturnType:(cocos2d::ui::EditBox::KeyboardReturnType)returnType; + +- (void)setPlaceHolder:(NSString *)text; +- (void)setVisible:(BOOL)visible; +- (void)setTextColor:(UIColor*)color; +- (void)setFont:(UIFont *)font; +- (void)setPosition:(CGPoint)pos; +- (void)setContentSize:(CGSize)size; + +- (void)openKeyboard; +- (void)closeKeyboard; + +@end diff --git a/cocos/ui/UIEditBox/iOS/CCUIEditBoxIOS.mm b/cocos/ui/UIEditBox/iOS/CCUIEditBoxIOS.mm new file mode 100644 index 0000000000..de35ea08d1 --- /dev/null +++ b/cocos/ui/UIEditBox/iOS/CCUIEditBoxIOS.mm @@ -0,0 +1,457 @@ +/**************************************************************************** + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2012 James Chen + Copyright (c) 2013-2015 zilongshanren + Copyright (c) 2015 Mazyad Alabduljaleel + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#import "CCUIEditBoxIOS.h" +#import "CCUISingleLineTextField.h" +#import "CCUIMultilineTextField.h" + +#import "platform/ios/CCEAGLView-ios.h" +#include "base/CCDirector.h" + +#define getEditBoxImplIOS() ((cocos2d::ui::EditBoxImplIOS *)_editBox) + + +@implementation UIEditBoxImplIOS_objc + +#pragma mark - Static methods + ++ (void)initialize +{ + [super initialize]; + + LoadUITextViewCCUITextInputCategory(); + LoadUITextFieldCCUITextInputCategory(); +} + +#pragma mark - Init & Dealloc + +- (instancetype)initWithFrame:(CGRect)frameRect editBox:(void *)editBox +{ + self = [super init]; + if (self) { + + _editState = NO; + self.frameRect = frameRect; + self.editBox = editBox; + self.dataInputMode = cocos2d::ui::EditBox::InputFlag::INTIAL_CAPS_ALL_CHARACTERS; + self.keyboardReturnType = cocos2d::ui::EditBox::KeyboardReturnType::DEFAULT; + + [self createMultiLineTextField]; + } + + return self; +} + +- (void)dealloc +{ + // custom setter cleanup + self.textInput = nil; + + [super dealloc]; +} + +#pragma mark - Properties + +- (void)setTextInput:(UIView *)textInput +{ + if (_textInput == textInput) { + return; + } + + // common init + textInput.backgroundColor = [UIColor clearColor]; + textInput.hidden = true; + textInput.returnKeyType = UIReturnKeyDefault; + [textInput ccui_setDelegate:self]; + + // Migrate properties + textInput.ccui_textColor = _textInput.ccui_textColor ?: [UIColor whiteColor]; + textInput.ccui_text = _textInput.ccui_text ?: @""; + textInput.ccui_placeholder = _textInput.ccui_placeholder ?: @""; + textInput.ccui_font = _textInput.ccui_font ?: [UIFont systemFontOfSize:self.frameRect.size.height*2/3]; + + [_textInput resignFirstResponder]; + [_textInput removeFromSuperview]; + [_textInput release]; + + _textInput = [textInput retain]; + + [self setInputFlag:self.dataInputMode]; + [self setReturnType:self.keyboardReturnType]; +} + +#pragma mark - Public methods + +- (void)createSingleLineTextField +{ + CCUISingleLineTextField *textField = [[[CCUISingleLineTextField alloc] initWithFrame:self.frameRect] autorelease]; + textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; + textField.borderStyle = UITextBorderStyleNone; + + [textField addTarget:self action:@selector(textChanged:) forControlEvents:UIControlEventEditingChanged]; + + self.textInput = textField; +} + +- (void)createMultiLineTextField +{ + CCUIMultilineTextField *textView = [[[CCUIMultilineTextField alloc] initWithFrame:self.frameRect] autorelease]; + self.textInput = textView; +} + +#pragma mark - Public methods + +- (void)setFont:(UIFont *)font +{ + self.textInput.ccui_font = font; +} + +- (void)setTextColor:(UIColor*)color +{ + self.textInput.ccui_textColor = color; +} + +- (void)setInputMode:(cocos2d::ui::EditBox::InputMode)inputMode +{ + //multiline input + if (inputMode == cocos2d::ui::EditBox::InputMode::ANY) { + if (![self.textInput isKindOfClass:[UITextView class]]) { + [self createMultiLineTextField]; + } + } + else { + if (![self.textInput isKindOfClass:[UITextField class]]) { + [self createSingleLineTextField]; + } + } + + switch (inputMode) + { + case cocos2d::ui::EditBox::InputMode::EMAIL_ADDRESS: + self.keyboardType = UIKeyboardTypeEmailAddress; + break; + case cocos2d::ui::EditBox::InputMode::NUMERIC: + self.keyboardType = UIKeyboardTypeDecimalPad; + break; + case cocos2d::ui::EditBox::InputMode::PHONE_NUMBER: + self.keyboardType = UIKeyboardTypePhonePad; + break; + case cocos2d::ui::EditBox::InputMode::URL: + self.keyboardType = UIKeyboardTypeURL; + break; + case cocos2d::ui::EditBox::InputMode::DECIMAL: + self.keyboardType = UIKeyboardTypeDecimalPad; + break; + case cocos2d::ui::EditBox::InputMode::SINGLE_LINE: + self.keyboardType = UIKeyboardTypeDefault; + break; + default: + self.keyboardType = UIKeyboardTypeDefault; + break; + } +} + +- (void)setKeyboardType:(UIKeyboardType)type +{ + self.textInput.keyboardType = type; +} + +- (void)setInputFlag:(cocos2d::ui::EditBox::InputFlag)flag +{ + self.dataInputMode = flag; + switch (flag) + { + case cocos2d::ui::EditBox::InputFlag::PASSWORD: + //textView can't be used for input password + self.textInput.ccui_secureTextEntry = YES; + break; + + case cocos2d::ui::EditBox::InputFlag::INITIAL_CAPS_WORD: + self.textInput.autocapitalizationType = UITextAutocapitalizationTypeWords; + break; + + case cocos2d::ui::EditBox::InputFlag::INITIAL_CAPS_SENTENCE: + self.textInput.autocapitalizationType = UITextAutocapitalizationTypeSentences; + break; + + case cocos2d::ui::EditBox::InputFlag::INTIAL_CAPS_ALL_CHARACTERS: + self.textInput.autocapitalizationType = UITextAutocapitalizationTypeAllCharacters; + break; + + case cocos2d::ui::EditBox::InputFlag::SENSITIVE: + self.textInput.autocorrectionType = UITextAutocorrectionTypeNo; + break; + + default: + break; + } +} + +- (void)setReturnType:(cocos2d::ui::EditBox::KeyboardReturnType)returnType +{ + self.keyboardReturnType = returnType; + switch (returnType) { + case cocos2d::ui::EditBox::KeyboardReturnType::DEFAULT: + self.textInput.returnKeyType = UIReturnKeyDefault; + break; + + case cocos2d::ui::EditBox::KeyboardReturnType::DONE: + self.textInput.returnKeyType = UIReturnKeyDone; + break; + + case cocos2d::ui::EditBox::KeyboardReturnType::SEND: + self.textInput.returnKeyType = UIReturnKeySend; + break; + + case cocos2d::ui::EditBox::KeyboardReturnType::SEARCH: + self.textInput.returnKeyType = UIReturnKeySearch; + break; + + case cocos2d::ui::EditBox::KeyboardReturnType::GO: + self.textInput.returnKeyType = UIReturnKeyGo; + break; + + default: + self.textInput.returnKeyType = UIReturnKeyDefault; + break; + } +} + +- (void)setText:(NSString *)text +{ + self.textInput.ccui_text = text; +} + +- (NSString *)text +{ + return self.textInput.ccui_text ?: @""; +} + +- (void)setVisible:(BOOL)visible +{ + self.textInput.hidden = !visible; +} + +- (NSString *)getDefaultFontName +{ + return self.textInput.ccui_font.fontName ?: @""; +} + +- (void)setPlaceHolder:(NSString *)text +{ + self.textInput.ccui_placeholder = text; +} + +- (void)doAnimationWhenKeyboardMoveWithDuration:(float)duration distance:(float)distance +{ + auto view = cocos2d::Director::getInstance()->getOpenGLView(); + CCEAGLView *eaglview = (CCEAGLView *)view->getEAGLView(); + + [eaglview doAnimationWhenKeyboardMoveWithDuration:duration distance:distance]; +} + +- (void)setPosition:(CGPoint)pos +{ + // TODO: Handle anchor point? + CGRect frame = self.textInput.frame; + frame.origin = pos; + self.textInput.frame = frame; +} + +- (void)setContentSize:(CGSize)size +{ + CGRect frame = self.textInput.frame; + frame.size = size; + self.textInput.frame = frame; +} + +- (void)openKeyboard +{ + auto view = cocos2d::Director::getInstance()->getOpenGLView(); + CCEAGLView *eaglview = (CCEAGLView *)view->getEAGLView(); + + [eaglview addSubview:self.textInput]; + [self.textInput becomeFirstResponder]; +} + +- (void)closeKeyboard +{ + [self.textInput resignFirstResponder]; + [self.textInput removeFromSuperview]; +} + +- (BOOL)textFieldShouldReturn:(UITextField *)sender +{ + if (sender == self.textInput) { + [sender resignFirstResponder]; + } + return NO; +} + +- (void)animationSelector +{ + auto view = cocos2d::Director::getInstance()->getOpenGLView(); + CCEAGLView *eaglview = (CCEAGLView *)view->getEAGLView(); + + [eaglview doAnimationWhenAnotherEditBeClicked]; +} + +#pragma mark - UITextView delegate methods + +- (BOOL)textViewShouldBeginEditing:(UITextView *)textView +{ + CCLOG("textFieldShouldBeginEditing..."); + _editState = YES; + + auto view = cocos2d::Director::getInstance()->getOpenGLView(); + CCEAGLView *eaglview = (CCEAGLView *) view->getEAGLView(); + + if ([eaglview isKeyboardShown]) { + [self performSelector:@selector(animationSelector) withObject:nil afterDelay:0.0f]; + } + + getEditBoxImplIOS()->editBoxEditingDidBegin(); + return YES; +} + +- (BOOL)textViewShouldEndEditing:(UITextView *)textView; +{ + CCLOG("textFieldShouldEndEditing..."); + _editState = NO; + getEditBoxImplIOS()->refreshInactiveText(); + + const char* inputText = [textView.text UTF8String]; + getEditBoxImplIOS()->editBoxEditingDidEnd(inputText); + + return YES; +} + +- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text +{ + int maxLength = getEditBoxImplIOS()->getMaxLength(); + if (maxLength < 0) + { + return YES; + } + + // Prevent crashing undo bug http://stackoverflow.com/questions/433337/set-the-maximum-character-length-of-a-uitextfield + if (range.length + range.location > textView.text.length) { + return NO; + } + + NSUInteger oldLength = textView.text.length; + NSUInteger replacementLength = text.length; + NSUInteger rangeLength = range.length; + + NSUInteger newLength = oldLength - rangeLength + replacementLength; + + return newLength <= maxLength; +} + +- (void)textViewDidChange:(UITextView *)textView +{ + int maxLength = getEditBoxImplIOS()->getMaxLength(); + if (textView.text.length > maxLength) { + textView.text = [textView.text substringToIndex:maxLength]; + } + + const char* inputText = [textView.text UTF8String]; + getEditBoxImplIOS()->editBoxEditingChanged(inputText); +} + + +#pragma mark - UITextField delegate methods +/** + * Called each time when the text field's text has changed. + */ +- (void)textChanged:(UITextField *)textField +{ + int maxLength = getEditBoxImplIOS()->getMaxLength(); + if (textField.text.length > maxLength) { + textField.text = [textField.text substringToIndex:maxLength]; + } + + const char* inputText = [textField.text UTF8String]; + getEditBoxImplIOS()->editBoxEditingChanged(inputText); +} + +- (BOOL)textFieldShouldBeginEditing:(UITextField *)sender // return NO to disallow editing. +{ + CCLOG("textFieldShouldBeginEditing..."); + _editState = YES; + + auto view = cocos2d::Director::getInstance()->getOpenGLView(); + CCEAGLView *eaglview = (CCEAGLView *)view->getEAGLView(); + + if ([eaglview isKeyboardShown]) { + [self performSelector:@selector(animationSelector) withObject:nil afterDelay:0.0f]; + } + + getEditBoxImplIOS()->editBoxEditingDidBegin(); + return YES; +} + +- (BOOL)textFieldShouldEndEditing:(UITextField *)sender +{ + CCLOG("textFieldShouldEndEditing..."); + _editState = NO; + const char* inputText = [sender.text UTF8String]; + + getEditBoxImplIOS()->editBoxEditingDidEnd(inputText); + + return YES; +} + +/** + * Delegate method called before the text has been changed. + * @param textField The text field containing the text. + * @param range The range of characters to be replaced. + * @param string The replacement string. + * @return YES if the specified text range should be replaced; otherwise, NO to keep the old text. + */ +- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string +{ + int maxLength = getEditBoxImplIOS()->getMaxLength(); + if (maxLength < 0) { + return YES; + } + + // Prevent crashing undo bug http://stackoverflow.com/questions/433337/set-the-maximum-character-length-of-a-uitextfield + if (range.length + range.location > textField.text.length) { + return NO; + } + + NSUInteger oldLength = textField.text.length; + NSUInteger replacementLength = string.length; + NSUInteger rangeLength = range.length; + + NSUInteger newLength = oldLength - rangeLength + replacementLength; + + return newLength <= maxLength; +} + +@end diff --git a/cocos/ui/UIEditBox/iOS/CCUIMultilineTextField.h b/cocos/ui/UIEditBox/iOS/CCUIMultilineTextField.h new file mode 100644 index 0000000000..0a57d7d1e1 --- /dev/null +++ b/cocos/ui/UIEditBox/iOS/CCUIMultilineTextField.h @@ -0,0 +1,37 @@ +/**************************************************************************** + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2012 James Chen + Copyright (c) 2015 Mazyad Alabduljaleel + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#import +#import "UITextView+CCUITextInput.h" + +#pragma mark - UIMultilineTextField implementation + +@interface CCUIMultilineTextField : UITextView + +@property (nonatomic, assign) NSString *placeholder; +@property (nonatomic, retain) UILabel *placeHolderLabel; + +@end diff --git a/cocos/ui/UIEditBox/iOS/CCUIMultilineTextField.mm b/cocos/ui/UIEditBox/iOS/CCUIMultilineTextField.mm new file mode 100644 index 0000000000..d83b4ef78c --- /dev/null +++ b/cocos/ui/UIEditBox/iOS/CCUIMultilineTextField.mm @@ -0,0 +1,148 @@ +/**************************************************************************** + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2012 James Chen + Copyright (c) 2015 Mazyad Alabduljaleel + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#import "CCUIMultilineTextField.h" + +#include "base/CCDirector.h" + +/** + * http://stackoverflow.com/questions/1328638/placeholder-in-uitextview + */ +CGFloat const UI_PLACEHOLDER_TEXT_CHANGED_ANIMATION_DURATION = 0.25; + + +@implementation CCUIMultilineTextField + +#pragma mark - Init & Dealloc + +- (instancetype)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(textChanged:) + name:UITextViewTextDidChangeNotification + object:nil]; + } + return self; +} + +- (void)dealloc +{ + [[NSNotificationCenter defaultCenter] removeObserver:self]; + + [_placeHolderLabel release]; + + [super dealloc]; +} + +#pragma mark - Properties + +- (NSString *)placeholder +{ + return self.placeHolderLabel.text; +} + +- (void)setPlaceholder:(NSString *)placeholder +{ + self.placeHolderLabel.text = placeholder; + [self.placeHolderLabel sizeToFit]; +} + +- (void)setText:(NSString *)text +{ + [super setText:text]; + [self textChanged:nil]; +} + +- (UILabel *)placeHolderLabel +{ + if (_placeHolderLabel == nil) { + + _placeHolderLabel = [[UILabel alloc] initWithFrame:CGRectMake(8,8,self.bounds.size.width - 16,0)]; + _placeHolderLabel.lineBreakMode = NSLineBreakByWordWrapping; + _placeHolderLabel.numberOfLines = 0; + _placeHolderLabel.font = self.font; + _placeHolderLabel.backgroundColor = [UIColor clearColor]; + _placeHolderLabel.textColor = [UIColor lightGrayColor]; + _placeHolderLabel.alpha = 0; + + [self addSubview:_placeHolderLabel]; + } + + return _placeHolderLabel; +} + +#pragma mark - Public methods + +- (CGRect)textRectForBounds:(CGRect)bounds +{ + auto glview = cocos2d::Director::getInstance()->getOpenGLView(); + + float padding = CC_EDIT_BOX_PADDING * glview->getScaleX() / glview->getContentScaleFactor(); + return CGRectInset(bounds, padding, padding); +} + +- (CGRect)editingRectForBounds:(CGRect)bounds +{ + return [self textRectForBounds:bounds]; +} + +- (void)layoutSubviews +{ + [super layoutSubviews]; + + if (self.placeholder.length > 0) { + [self sendSubviewToBack:self.placeHolderLabel]; + } +} + +- (void)drawRect:(CGRect)rect +{ + if (self.text.length == 0 && self.placeholder.length > 0) { + self.placeHolderLabel.alpha = 1; + } + + [super drawRect:rect]; +} + +#pragma mark - NSNotification Observers + +- (void)textChanged:(NSNotification *)notification +{ + if (self.placeholder.length == 0) { + return; + } + + [UIView animateWithDuration:UI_PLACEHOLDER_TEXT_CHANGED_ANIMATION_DURATION animations:^{ + + CGFloat alpha = (self.text.length == 0 ? 1 : 0); + self.placeHolderLabel.alpha = alpha; + }]; +} + +@end diff --git a/cocos/ui/UIEditBox/iOS/CCUISingleLineTextField.h b/cocos/ui/UIEditBox/iOS/CCUISingleLineTextField.h new file mode 100644 index 0000000000..8b67df9018 --- /dev/null +++ b/cocos/ui/UIEditBox/iOS/CCUISingleLineTextField.h @@ -0,0 +1,33 @@ +/**************************************************************************** + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2012 James Chen + Copyright (c) 2015 Mazyad Alabduljaleel + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#import +#import "UITextField+CCUITextInput.h" + +/** TODO: Missing doc - Why is this subclass necessary? + */ +@interface CCUISingleLineTextField : UITextField +@end diff --git a/cocos/ui/UIEditBox/iOS/CCUISingleLineTextField.mm b/cocos/ui/UIEditBox/iOS/CCUISingleLineTextField.mm new file mode 100644 index 0000000000..06096093a0 --- /dev/null +++ b/cocos/ui/UIEditBox/iOS/CCUISingleLineTextField.mm @@ -0,0 +1,48 @@ +/**************************************************************************** + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2012 James Chen + Copyright (c) 2015 Mazyad Alabduljaleel + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#import "CCUISingleLineTextField.h" +#import "CCUITextInput.h" + +#include "base/CCDirector.h" + + +@implementation CCUISingleLineTextField + +- (CGRect)textRectForBounds:(CGRect)bounds +{ + auto glview = cocos2d::Director::getInstance()->getOpenGLView(); + + float padding = CC_EDIT_BOX_PADDING * glview->getScaleX() / glview->getContentScaleFactor(); + return CGRectInset(bounds, padding, padding); +} + +- (CGRect)editingRectForBounds:(CGRect)bounds +{ + return [self textRectForBounds:bounds]; +} + +@end diff --git a/cocos/ui/UIEditBox/iOS/CCUITextInput.h b/cocos/ui/UIEditBox/iOS/CCUITextInput.h new file mode 100644 index 0000000000..2aef29cdb5 --- /dev/null +++ b/cocos/ui/UIEditBox/iOS/CCUITextInput.h @@ -0,0 +1,46 @@ +/**************************************************************************** + Copyright (c) 2015 Mazyad Alabduljaleel + + 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 cocos2d_libs_CCUITextInput_h +#define cocos2d_libs_CCUITextInput_h + +static const int CC_EDIT_BOX_PADDING = 5; + +/** + This protocol provides a common interface for consolidating text input method calls + */ +@protocol CCUITextInput + +@property (nonatomic, retain, setter=ccui_setText:) NSString *ccui_text; +@property (nonatomic, retain, setter=ccui_setPlaceholder:) NSString *ccui_placeholder; +@property (nonatomic, retain, setter=ccui_setTextColor:) UIColor *ccui_textColor; +@property (nonatomic, retain, setter=ccui_setFont:) UIFont *ccui_font; +@property (nonatomic, assign, setter=ccui_setSecureTextEntry:) BOOL ccui_secureTextEntry; + +/* can only set. and not get, since the getter will only return one delegate implementation */ +- (void)ccui_setDelegate:(id)delegate; + +@end + +#endif diff --git a/cocos/ui/UIEditBox/iOS/UITextField+CCUITextInput.h b/cocos/ui/UIEditBox/iOS/UITextField+CCUITextInput.h new file mode 100644 index 0000000000..6a99a8bee8 --- /dev/null +++ b/cocos/ui/UIEditBox/iOS/UITextField+CCUITextInput.h @@ -0,0 +1,36 @@ +/**************************************************************************** + Copyright (c) 2015 Mazyad Alabduljaleel + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#import +#import "CCUITextInput.h" + + +@interface UITextField (CCUITextInput) +@end + + +/** Trick to load category objects without using -ObjC flag + * http://stackoverflow.com/questions/2567498/objective-c-categories-in-static-library + */ +extern void LoadUITextFieldCCUITextInputCategory(); diff --git a/cocos/ui/UIEditBox/iOS/UITextField+CCUITextInput.mm b/cocos/ui/UIEditBox/iOS/UITextField+CCUITextInput.mm new file mode 100644 index 0000000000..289263b9f0 --- /dev/null +++ b/cocos/ui/UIEditBox/iOS/UITextField+CCUITextInput.mm @@ -0,0 +1,89 @@ +/**************************************************************************** + Copyright (c) 2015 Mazyad Alabduljaleel + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#import "UITextField+CCUITextInput.h" + +@implementation UITextField (CCUITextInput) + +- (NSString *)ccui_text +{ + return self.text; +} + +- (void)ccui_setText:(NSString *)ccui_text +{ + self.text = ccui_text; +} + +- (NSString *)ccui_placeholder +{ + return self.placeholder; +} + +- (void)ccui_setPlaceholder:(NSString *)ccui_placeholder +{ + self.placeholder = ccui_placeholder; +} + +- (UIColor *)ccui_textColor +{ + return self.textColor; +} + +- (void)ccui_setTextColor:(UIColor *)ccui_textColor +{ + self.textColor = ccui_textColor; +} + +- (UIFont *)ccui_font +{ + return self.font; +} + +- (void)ccui_setFont:(UIFont *)ccui_font +{ + self.font = ccui_font; +} + +- (BOOL)ccui_secureTextEntry +{ + return self.secureTextEntry; +} + +- (void)ccui_setSecureTextEntry:(BOOL)ccui_secureTextEntry +{ + self.secureTextEntry = ccui_secureTextEntry; +} + +- (void)ccui_setDelegate:(id)delegate +{ + self.delegate = delegate; +} + +@end + + +void LoadUITextFieldCCUITextInputCategory() { + // noop +} diff --git a/cocos/ui/UIEditBox/iOS/UITextView+CCUITextInput.h b/cocos/ui/UIEditBox/iOS/UITextView+CCUITextInput.h new file mode 100644 index 0000000000..62b35df68a --- /dev/null +++ b/cocos/ui/UIEditBox/iOS/UITextView+CCUITextInput.h @@ -0,0 +1,36 @@ +/**************************************************************************** + Copyright (c) 2015 Mazyad Alabduljaleel + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#import +#import "CCUITextInput.h" + + +@interface UITextView (CCUITextInput) +@end + + +/** Trick to load category objects without using -ObjC flag + * http://stackoverflow.com/questions/2567498/objective-c-categories-in-static-library + */ +extern void LoadUITextViewCCUITextInputCategory(); diff --git a/cocos/ui/UIEditBox/iOS/UITextView+CCUITextInput.mm b/cocos/ui/UIEditBox/iOS/UITextView+CCUITextInput.mm new file mode 100644 index 0000000000..bfe5b8730e --- /dev/null +++ b/cocos/ui/UIEditBox/iOS/UITextView+CCUITextInput.mm @@ -0,0 +1,97 @@ +/**************************************************************************** + Copyright (c) 2015 Mazyad Alabduljaleel + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#import "UITextView+CCUITextInput.h" + + +@implementation UITextView (CCUITextInput) + +- (NSString *)ccui_text +{ + return self.text; +} + +- (void)ccui_setText:(NSString *)ccui_text +{ + self.text = ccui_text; +} + +- (NSString *)ccui_placeholder +{ + SEL selector = @selector(placeholder); + if ([self respondsToSelector:selector]) { + return [self performSelector:selector]; + } + return nil; +} + +- (void)ccui_setPlaceholder:(NSString *)ccui_placeholder +{ + SEL selector = @selector(setPlaceholder:); + if ([self respondsToSelector:selector]) { + [self performSelector:selector withObject:ccui_placeholder]; + } +} + +- (UIColor *)ccui_textColor +{ + return self.textColor; +} + +- (void)ccui_setTextColor:(UIColor *)ccui_textColor +{ + self.textColor = ccui_textColor; +} + +- (UIFont *)ccui_font +{ + return self.font; +} + +- (void)ccui_setFont:(UIFont *)ccui_font +{ + self.font = ccui_font; +} + +- (BOOL)ccui_secureTextEntry +{ + return self.secureTextEntry; +} + +- (void)ccui_setSecureTextEntry:(BOOL)ccui_secureTextEntry +{ + self.secureTextEntry = ccui_secureTextEntry; +} + +- (void)ccui_setDelegate:(id)delegate +{ + self.delegate = delegate; +} + +@end + + +void LoadUITextViewCCUITextInputCategory() { + +} diff --git a/cocos/ui/UIHelper.cpp b/cocos/ui/UIHelper.cpp index 9345a4bb3e..5bdde18f67 100644 --- a/cocos/ui/UIHelper.cpp +++ b/cocos/ui/UIHelper.cpp @@ -193,25 +193,25 @@ Rect Helper::restrictCapInsetRect(const cocos2d::Rect &capInsets, const Size& te return Rect(x, y, width, height); } - Rect Helper::convertBoundingBoxToScreen(Node* node) - { - auto director = Director::getInstance(); - auto glView = director->getOpenGLView(); - auto frameSize = glView->getFrameSize(); +Rect Helper::convertBoundingBoxToScreen(Node* node) +{ + auto director = Director::getInstance(); + auto glView = director->getOpenGLView(); + auto frameSize = glView->getFrameSize(); - auto winSize = director->getWinSize(); - auto leftBottom = node->convertToWorldSpace(Point::ZERO); + auto winSize = director->getWinSize(); + auto leftBottom = node->convertToWorldSpace(Point::ZERO); - auto contentSize = node->getContentSize(); - auto rightTop = node->convertToWorldSpace(Point(contentSize.width, contentSize.height)); + auto contentSize = node->getContentSize(); + auto rightTop = node->convertToWorldSpace(Point(contentSize.width, contentSize.height)); - auto uiLeft = frameSize.width / 2 + (leftBottom.x - winSize.width / 2 ) * glView->getScaleX(); - auto uiTop = frameSize.height /2 - (rightTop.y - winSize.height / 2) * glView->getScaleY(); - - return Rect(uiLeft,uiTop, - (rightTop.x - leftBottom.x) * glView->getScaleX(), - (rightTop.y - leftBottom.y) * glView->getScaleY()); - } + auto uiLeft = frameSize.width / 2 + (leftBottom.x - winSize.width / 2 ) * glView->getScaleX(); + auto uiTop = frameSize.height /2 - (rightTop.y - winSize.height / 2) * glView->getScaleY(); + auto uiWidth = (rightTop.x - leftBottom.x) * glView->getScaleX(); + auto uiHeight = (rightTop.y - leftBottom.y) * glView->getScaleY(); + + return Rect(uiLeft, uiTop, uiWidth, uiHeight); +} } NS_CC_END diff --git a/cocos/ui/UIListView.cpp b/cocos/ui/UIListView.cpp index 708963aedc..8452d4f9ec 100644 --- a/cocos/ui/UIListView.cpp +++ b/cocos/ui/UIListView.cpp @@ -27,6 +27,8 @@ THE SOFTWARE. NS_CC_BEGIN +static const float DEFAULT_TIME_IN_SEC_FOR_SCROLL_TO_ITEM = 1.0f; + namespace ui { IMPLEMENT_CLASS_GUI_INFO(ListView) @@ -34,6 +36,8 @@ IMPLEMENT_CLASS_GUI_INFO(ListView) ListView::ListView(): _model(nullptr), _gravity(Gravity::CENTER_VERTICAL), +_magneticType(MagneticType::NONE), +_magneticAllowedOutOfBoundary(true), _itemsMargin(0.0f), _curSelectedIndex(-1), _refreshViewDirty(true), @@ -86,6 +90,16 @@ void ListView::setItemModel(Widget *model) CC_SAFE_RETAIN(_model); } +void ListView::handleReleaseLogic(Touch *touch) +{ + ScrollView::handleReleaseLogic(touch); + + if(!_autoScrolling) + { + startMagneticScroll(); + } +} + void ListView::updateInnerContainerSize() { switch (_direction) @@ -249,6 +263,7 @@ void ListView::addChild(cocos2d::Node *child, int zOrder, int tag) if (nullptr != widget) { _items.pushBack(widget); + _outOfBoundaryAmountDirty = true; } } @@ -270,6 +285,7 @@ void ListView::addChild(Node* child, int zOrder, const std::string &name) if (nullptr != widget) { _items.pushBack(widget); + _outOfBoundaryAmountDirty = true; } } @@ -291,6 +307,7 @@ void ListView::removeChild(cocos2d::Node *child, bool cleaup) } } _items.eraseObject(widget); + _outOfBoundaryAmountDirty = true; } ScrollView::removeChild(child, cleaup); @@ -306,6 +323,7 @@ void ListView::removeAllChildrenWithCleanup(bool cleanup) ScrollView::removeAllChildrenWithCleanup(cleanup); _items.clear(); _curSelectedIndex = -1; + _outOfBoundaryAmountDirty = true; } void ListView::insertCustomItem(Widget* item, ssize_t index) @@ -318,6 +336,8 @@ void ListView::insertCustomItem(Widget* item, ssize_t index) } } _items.insert(index, item); + _outOfBoundaryAmountDirty = true; + ScrollView::addChild(item); remedyLayoutParameter(item); @@ -332,7 +352,6 @@ void ListView::removeItem(ssize_t index) return; } removeChild(item, true); - _refreshViewDirty = true; } @@ -379,6 +398,28 @@ void ListView::setGravity(Gravity gravity) _refreshViewDirty = true; } +void ListView::setMagneticType(MagneticType magneticType) +{ + _magneticType = magneticType; + _outOfBoundaryAmountDirty = true; + startMagneticScroll(); +} + +ListView::MagneticType ListView::getMagneticType() const +{ + return _magneticType; +} + +void ListView::setMagneticAllowedOutOfBoundary(bool magneticAllowedOutOfBoundary) +{ + _magneticAllowedOutOfBoundary = magneticAllowedOutOfBoundary; +} + +bool ListView::getMagneticAllowedOutOfBoundary() const +{ + return _magneticAllowedOutOfBoundary; +} + void ListView::setItemsMargin(float margin) { if (_itemsMargin == margin) @@ -429,28 +470,27 @@ void ListView::refreshView() remedyLayoutParameter(item); } updateInnerContainerSize(); + _refreshViewDirty = false; } - -void ListView::forceDoLayout() + +void ListView::refreshViewIfNecessary() { if (_refreshViewDirty) { refreshView(); - _refreshViewDirty = false; } - +} + +void ListView::forceDoLayout() +{ + refreshViewIfNecessary(); this->_innerContainer->forceDoLayout(); } void ListView::doLayout() { Layout::doLayout(); - - if (_refreshViewDirty) - { - refreshView(); - _refreshViewDirty = false; - } + refreshViewIfNecessary(); } void ListView::addEventListenerListView(Ref *target, SEL_ListViewEvent selector) @@ -529,6 +569,208 @@ void ListView::interceptTouchEvent(TouchEventType event, Widget *sender, Touch* } } +static Vec2 calculateItemPositionWithAnchor(Widget* item, const Vec2& itemAnchorPoint) +{ + Vec2 origin(item->getLeftBoundary(), item->getBottomBoundary()); + Size size = item->getContentSize(); + return origin + Vec2(size.width * itemAnchorPoint.x, size.height * itemAnchorPoint.y); +} + +static Widget* findClosestItem(const Vec2& targetPosition, const Vector& items, const Vec2& itemAnchorPoint, ssize_t firstIndex, float distanceFromFirst, ssize_t lastIndex, float distanceFromLast) +{ + CCASSERT(firstIndex >= 0 && lastIndex < items.size() && firstIndex <= lastIndex, ""); + if (firstIndex == lastIndex) + { + return items.at(firstIndex); + } + if (lastIndex - firstIndex == 1) + { + if (distanceFromFirst <= distanceFromLast) + { + return items.at(firstIndex); + } + else + { + return items.at(lastIndex); + } + } + + // Binary search + ssize_t midIndex = (firstIndex + lastIndex) / 2; + Vec2 itemPosition = calculateItemPositionWithAnchor(items.at(midIndex), itemAnchorPoint); + float distanceFromMid = (targetPosition - itemPosition).length(); + if (distanceFromFirst <= distanceFromLast) + { + // Left half + return findClosestItem(targetPosition, items, itemAnchorPoint, firstIndex, distanceFromFirst, midIndex, distanceFromMid); + } + else + { + // Right half + return findClosestItem(targetPosition, items, itemAnchorPoint, midIndex, distanceFromMid, lastIndex, distanceFromLast); + } +} + +Widget* ListView::getClosestItemToPosition(const Vec2& targetPosition, const Vec2& itemAnchorPoint) const +{ + if (_items.empty()) + { + return nullptr; + } + + // Find the closest item through binary search + ssize_t firstIndex = 0; + Vec2 firstPosition = calculateItemPositionWithAnchor(_items.at(firstIndex), itemAnchorPoint); + float distanceFromFirst = (targetPosition - firstPosition).length(); + + ssize_t lastIndex = _items.size() - 1; + Vec2 lastPosition = calculateItemPositionWithAnchor(_items.at(lastIndex), itemAnchorPoint); + float distanceFromLast = (targetPosition - lastPosition).length(); + + return findClosestItem(targetPosition, _items, itemAnchorPoint, firstIndex, distanceFromFirst, lastIndex, distanceFromLast); +} + +Widget* ListView::getClosestItemToPositionInCurrentView(const Vec2& positionRatioInView, const Vec2& itemAnchorPoint) const +{ + // Calculate the target position + Size contentSize = getContentSize(); + Vec2 targetPosition = -_innerContainer->getPosition(); + targetPosition.x += contentSize.width * positionRatioInView.x; + targetPosition.y += contentSize.height * positionRatioInView.y; + return getClosestItemToPosition(targetPosition, itemAnchorPoint); +} + +Widget* ListView::getCenterItemInCurrentView() const +{ + return getClosestItemToPositionInCurrentView(Vec2::ANCHOR_MIDDLE, Vec2::ANCHOR_MIDDLE); +} + +Widget* ListView::getLeftmostItemInCurrentView() const +{ + if (_direction == Direction::HORIZONTAL) + { + return getClosestItemToPositionInCurrentView(Vec2::ANCHOR_MIDDLE_LEFT, Vec2::ANCHOR_MIDDLE); + } + return nullptr; +} + +Widget* ListView::getRightmostItemInCurrentView() const +{ + if (_direction == Direction::HORIZONTAL) + { + return getClosestItemToPositionInCurrentView(Vec2::ANCHOR_MIDDLE_RIGHT, Vec2::ANCHOR_MIDDLE); + } + return nullptr; +} + +Widget* ListView::getTopmostItemInCurrentView() const +{ + if (_direction == Direction::VERTICAL) + { + return getClosestItemToPositionInCurrentView(Vec2::ANCHOR_MIDDLE_TOP, Vec2::ANCHOR_MIDDLE); + } + return nullptr; +} + +Widget* ListView::getBottommostItemInCurrentView() const +{ + if (_direction == Direction::VERTICAL) + { + return getClosestItemToPositionInCurrentView(Vec2::ANCHOR_MIDDLE_BOTTOM, Vec2::ANCHOR_MIDDLE); + } + return nullptr; +} + +void ListView::jumpToBottom() +{ + refreshViewIfNecessary(); + ScrollView::jumpToBottom(); +} + +void ListView::jumpToTop() +{ + refreshViewIfNecessary(); + ScrollView::jumpToTop(); +} + +void ListView::jumpToLeft() +{ + refreshViewIfNecessary(); + ScrollView::jumpToLeft(); +} + +void ListView::jumpToRight() +{ + refreshViewIfNecessary(); + ScrollView::jumpToRight(); +} + +void ListView::jumpToTopLeft() +{ + refreshViewIfNecessary(); + ScrollView::jumpToTopLeft(); +} + +void ListView::jumpToTopRight() +{ + refreshViewIfNecessary(); + ScrollView::jumpToTopRight(); +} + +void ListView::jumpToBottomLeft() +{ + refreshViewIfNecessary(); + ScrollView::jumpToBottomLeft(); +} + +void ListView::jumpToBottomRight() +{ + refreshViewIfNecessary(); + ScrollView::jumpToBottomRight(); +} + +void ListView::jumpToPercentVertical(float percent) +{ + refreshViewIfNecessary(); + ScrollView::jumpToPercentVertical(percent); +} + +void ListView::jumpToPercentHorizontal(float percent) +{ + refreshViewIfNecessary(); + ScrollView::jumpToPercentHorizontal(percent); +} + +void ListView::jumpToPercentBothDirection(const Vec2& percent) +{ + refreshViewIfNecessary(); + ScrollView::jumpToPercentBothDirection(percent); +} + +void ListView::scrollToItem(int itemIndex, const Vec2& positionRatioInView, const Vec2& itemAnchorPoint) +{ + scrollToItem(itemIndex, positionRatioInView, itemAnchorPoint, DEFAULT_TIME_IN_SEC_FOR_SCROLL_TO_ITEM); +} + +void ListView::scrollToItem(int itemIndex, const Vec2& positionRatioInView, const Vec2& itemAnchorPoint, float timeInSec) +{ + Widget* item = getItem(itemIndex); + if (item == nullptr) + { + return; + } + + Size contentSize = getContentSize(); + Vec2 positionInView; + positionInView.x += contentSize.width * positionRatioInView.x; + positionInView.y += contentSize.height * positionRatioInView.y; + + Vec2 itemPosition = calculateItemPositionWithAnchor(item, itemAnchorPoint); + Vec2 destination = -(itemPosition - positionInView); + + startAutoScrollToDestination(destination, timeInSec, true); +} + ssize_t ListView::getCurSelectedIndex() const { return _curSelectedIndex; @@ -574,5 +816,154 @@ void ListView::copySpecialProperties(Widget *widget) } } +Vec2 ListView::getHowMuchOutOfBoundary(const Vec2& addition) +{ + if(!_magneticAllowedOutOfBoundary || _items.empty()) + { + return ScrollView::getHowMuchOutOfBoundary(addition); + } + else if(_magneticType == MagneticType::NONE || _magneticType == MagneticType::BOTH_END) + { + return ScrollView::getHowMuchOutOfBoundary(addition); + } + else if(addition == Vec2::ZERO && !_outOfBoundaryAmountDirty) + { + return _outOfBoundaryAmount; + } + + // If it is allowed to be out of boundary by magnetic, adjust the boundaries according to the magnetic type. + float leftBoundary = _leftBoundary; + float rightBoundary = _rightBoundary; + float topBoundary = _topBoundary; + float bottomBoundary = _bottomBoundary; + { + int lastItemIndex = _items.size() - 1; + Size contentSize = getContentSize(); + Vec2 firstItemAdjustment, lastItemAdjustment; + if(_magneticType == MagneticType::CENTER) + { + firstItemAdjustment = (contentSize - _items.at(0)->getContentSize()) / 2; + lastItemAdjustment = (contentSize - _items.at(lastItemIndex)->getContentSize()) / 2; + } + else if(_magneticType == MagneticType::LEFT) + { + lastItemAdjustment = contentSize - _items.at(lastItemIndex)->getContentSize(); + } + else if(_magneticType == MagneticType::RIGHT) + { + firstItemAdjustment = contentSize - _items.at(0)->getContentSize(); + } + else if(_magneticType == MagneticType::TOP) + { + lastItemAdjustment = contentSize - _items.at(lastItemIndex)->getContentSize(); + } + else if(_magneticType == MagneticType::BOTTOM) + { + firstItemAdjustment = contentSize - _items.at(0)->getContentSize(); + } + leftBoundary += firstItemAdjustment.x; + rightBoundary -= lastItemAdjustment.x; + topBoundary -= firstItemAdjustment.y; + bottomBoundary += lastItemAdjustment.y; + } + + // Calculate the actual amount + Vec2 outOfBoundaryAmount; + if(_innerContainer->getLeftBoundary() + addition.x > leftBoundary) + { + outOfBoundaryAmount.x = leftBoundary - (_innerContainer->getLeftBoundary() + addition.x); + } + else if(_innerContainer->getRightBoundary() + addition.x < rightBoundary) + { + outOfBoundaryAmount.x = rightBoundary - (_innerContainer->getRightBoundary() + addition.x); + } + + if(_innerContainer->getTopBoundary() + addition.y < topBoundary) + { + outOfBoundaryAmount.y = topBoundary - (_innerContainer->getTopBoundary() + addition.y); + } + else if(_innerContainer->getBottomBoundary() + addition.y > bottomBoundary) + { + outOfBoundaryAmount.y = bottomBoundary - (_innerContainer->getBottomBoundary() + addition.y); + } + + if(addition == Vec2::ZERO) + { + _outOfBoundaryAmount = outOfBoundaryAmount; + _outOfBoundaryAmountDirty = false; + } + return outOfBoundaryAmount; +} + +static Vec2 getAnchorPointByMagneticType(ListView::MagneticType magneticType) +{ + switch(magneticType) + { + case ListView::MagneticType::NONE: return Vec2::ZERO; + case ListView::MagneticType::BOTH_END: return Vec2::ANCHOR_TOP_LEFT; + case ListView::MagneticType::CENTER: return Vec2::ANCHOR_MIDDLE; + case ListView::MagneticType::LEFT: return Vec2::ANCHOR_MIDDLE_LEFT; + case ListView::MagneticType::RIGHT: return Vec2::ANCHOR_MIDDLE_RIGHT; + case ListView::MagneticType::TOP: return Vec2::ANCHOR_MIDDLE_TOP; + case ListView::MagneticType::BOTTOM: return Vec2::ANCHOR_MIDDLE_BOTTOM; + } + return Vec2::ZERO; +} + +void ListView::startAttenuatingAutoScroll(const Vec2& deltaMove, const Vec2& initialVelocity) +{ + Vec2 adjustedDeltaMove = deltaMove; + + if(!_items.empty() && _magneticType != MagneticType::NONE) + { + adjustedDeltaMove = flattenVectorByDirection(adjustedDeltaMove); + + // If the destination is out of boundary, do nothing here. Because it will be handled by bouncing back. + if(getHowMuchOutOfBoundary(adjustedDeltaMove) == Vec2::ZERO) + { + MagneticType magType = _magneticType; + if(magType == MagneticType::BOTH_END) + { + if(_direction == Direction::HORIZONTAL) + { + magType = (adjustedDeltaMove.x > 0 ? MagneticType::LEFT : MagneticType::RIGHT); + } + else if(_direction == Direction::VERTICAL) + { + magType = (adjustedDeltaMove.y > 0 ? MagneticType::BOTTOM : MagneticType::TOP); + } + } + + // Adjust the delta move amount according to the magnetic type + Vec2 magneticAnchorPoint = getAnchorPointByMagneticType(magType); + Vec2 magneticPosition = -_innerContainer->getPosition(); + magneticPosition.x += getContentSize().width * magneticAnchorPoint.x; + magneticPosition.y += getContentSize().height * magneticAnchorPoint.y; + + Widget* pTargetItem = getClosestItemToPosition(magneticPosition - adjustedDeltaMove, magneticAnchorPoint); + Vec2 itemPosition = calculateItemPositionWithAnchor(pTargetItem, magneticAnchorPoint); + adjustedDeltaMove = magneticPosition - itemPosition; + } + } + ScrollView::startAttenuatingAutoScroll(adjustedDeltaMove, initialVelocity); +} + +void ListView::startMagneticScroll() +{ + if(_items.empty() || _magneticType == MagneticType::NONE) + { + return; + } + + // Find the closest item + Vec2 magneticAnchorPoint = getAnchorPointByMagneticType(_magneticType); + Vec2 magneticPosition = -_innerContainer->getPosition(); + magneticPosition.x += getContentSize().width * magneticAnchorPoint.x; + magneticPosition.y += getContentSize().height * magneticAnchorPoint.y; + + Widget* pTargetItem = getClosestItemToPosition(magneticPosition, magneticAnchorPoint); + scrollToItem(getIndex(pTargetItem), magneticAnchorPoint, magneticAnchorPoint); +} + } NS_CC_END diff --git a/cocos/ui/UIListView.h b/cocos/ui/UIListView.h index 379cb1b9bd..e7f4e010d9 100644 --- a/cocos/ui/UIListView.h +++ b/cocos/ui/UIListView.h @@ -86,6 +86,22 @@ public: ON_SELECTED_ITEM_END }; + /** + * ListView supports magnetic scroll. + * With CENTER type, ListView tries to align its items in center of current view. + * With BOTH_END type, ListView tries to align its items in left or right end if it is horizontal, top or bottom in vertical. The aligning side (left or right, top or bottom) is determined by user's scroll direction. + */ + enum class MagneticType + { + NONE, + CENTER, + BOTH_END, + LEFT, + RIGHT, + TOP, + BOTTOM, + }; + /** * ListView item click callback. */ @@ -193,6 +209,27 @@ public: */ void setGravity(Gravity gravity); + /** + * Set magnetic type of ListView. + * @see `MagneticType` + */ + void setMagneticType(MagneticType magneticType); + + /** + * Get magnetic type of ListView. + */ + MagneticType getMagneticType() const; + + /** + * Set magnetic allowed out of boundary. + */ + void setMagneticAllowedOutOfBoundary(bool magneticAllowedOutOfBoundary); + + /** + * Query whether the magnetic out of boundary is allowed. + */ + bool getMagneticAllowedOutOfBoundary() const; + /** * Set the margin between each item in ListView. * @@ -200,7 +237,6 @@ public: */ void setItemsMargin(float margin); - /** * @brief Query margin between each item in ListView. * @@ -220,7 +256,79 @@ public: virtual void removeAllChildrenWithCleanup(bool cleanup) override; virtual void removeChild(Node* child, bool cleaup = true) override; - + /** + * @brief Query the closest item to a specific position in inner container. + * + * @param targetPosition Specifies the target position in inner container's coordinates. + * @param itemAnchorPoint Specifies an anchor point of each item for position to calculate distance. + * @return A item instance if list view is not empty. Otherwise, returns null. + */ + Widget* getClosestItemToPosition(const Vec2& targetPosition, const Vec2& itemAnchorPoint) const; + + /** + * @brief Query the closest item to a specific position in current view. + * For instance, to find the item in the center of view, call 'getClosestItemToPositionInCurrentView(Vec2::ANCHOR_MIDDLE, Vec2::ANCHOR_MIDDLE)'. + * + * @param positionRatioInView Specifies the target position with ratio in list view's content size. + * @param itemAnchorPoint Specifies an anchor point of each item for position to calculate distance. + * @return A item instance if list view is not empty. Otherwise, returns null. + */ + Widget* getClosestItemToPositionInCurrentView(const Vec2& positionRatioInView, const Vec2& itemAnchorPoint) const; + + /** + * @brief Query the center item + * @return A item instance. + */ + Widget* getCenterItemInCurrentView() const; + + /** + * @brief Query the leftmost item in horizontal list + * @return A item instance. + */ + Widget* getLeftmostItemInCurrentView() const; + + /** + * @brief Query the rightmost item in horizontal list + * @return A item instance. + */ + Widget* getRightmostItemInCurrentView() const; + + /** + * @brief Query the topmost item in horizontal list + * @return A item instance. + */ + Widget* getTopmostItemInCurrentView() const; + + /** + * @brief Query the bottommost item in horizontal list + * @return A item instance. + */ + Widget* getBottommostItemInCurrentView() const; + + /** + * Override functions + */ + virtual void jumpToBottom() override; + virtual void jumpToTop() override; + virtual void jumpToLeft() override; + virtual void jumpToRight() override; + virtual void jumpToTopLeft() override; + virtual void jumpToTopRight() override; + virtual void jumpToBottomLeft() override; + virtual void jumpToBottomRight() override; + virtual void jumpToPercentVertical(float percent) override; + virtual void jumpToPercentHorizontal(float percent) override; + virtual void jumpToPercentBothDirection(const Vec2& percent) override; + + /** + * @brief Scroll to specific item + * @param positionRatioInView Specifies the position with ratio in list view's content size. + * @param itemAnchorPoint Specifies an anchor point of each item for position to calculate distance. + * @param timeInSec Scroll time + */ + void scrollToItem(int itemIndex, const Vec2& positionRatioInView, const Vec2& itemAnchorPoint); + void scrollToItem(int itemIndex, const Vec2& positionRatioInView, const Vec2& itemAnchorPoint, float timeInSec); + /** * @brief Query current selected widget's idnex. * @@ -265,11 +373,13 @@ public: * @brief Refresh content view of ListView. */ void refreshView(); + void refreshViewIfNecessary(); CC_CONSTRUCTOR_ACCESS: virtual bool init() override; protected: + virtual void handleReleaseLogic(Touch *touch) override; void updateInnerContainerSize(); void remedyLayoutParameter(Widget* item); @@ -282,6 +392,13 @@ protected: virtual void copyClonedWidgetChildren(Widget* model) override; void selectedItemEvent(TouchEventType event); virtual void interceptTouchEvent(Widget::TouchEventType event,Widget* sender,Touch* touch) override; + + virtual Vec2 getHowMuchOutOfBoundary(const Vec2& addition = Vec2::ZERO) override; + + virtual void startAttenuatingAutoScroll(const Vec2& deltaMove, const Vec2& initialVelocity) override; + + void startMagneticScroll(); + protected: Widget* _model; @@ -289,6 +406,9 @@ protected: Gravity _gravity; + MagneticType _magneticType; + bool _magneticAllowedOutOfBoundary; + float _itemsMargin; ssize_t _curSelectedIndex; diff --git a/cocos/ui/UIScrollView.cpp b/cocos/ui/UIScrollView.cpp index 2c23915930..30c1b6bacd 100644 --- a/cocos/ui/UIScrollView.cpp +++ b/cocos/ui/UIScrollView.cpp @@ -31,11 +31,10 @@ THE SOFTWARE. #include "2d/CCCamera.h" NS_CC_BEGIN -namespace ui { - -static const float INERTIA_DEACCELERATION = 700.0f; -static const float INERTIA_VELOCITY_MAX = 2500; +static const int NUMBER_OF_GATHERED_TOUCHES_FOR_MOVE_SPEED = 5; +static const float OUT_OF_BOUNDARY_BREAKING_FACTOR = 0.05f; static const float BOUNCE_BACK_DURATION = 1.0f; + #define MOVE_INCH 7.0f/160.0f static float convertDistanceFromPointToInch(const Vec2& dis) @@ -46,6 +45,8 @@ static float convertDistanceFromPointToInch(const Vec2& dis) return distance; } +namespace ui { + IMPLEMENT_CLASS_GUI_INFO(ScrollView) ScrollView::ScrollView(): @@ -57,17 +58,16 @@ _leftBoundary(0.0f), _rightBoundary(0.0f), _bePressed(false), _childFocusCancelOffsetInInch(MOVE_INCH), -_inertiaScrollEnabled(true), -_inertiaScrolling(false), -_inertiaPrevTouchTimestamp(0), -_inertiaScrollExpectedTime(0), -_inertiaScrollElapsedTime(0), +_touchMovePreviousTimestamp(0), _autoScrolling(false), _autoScrollAttenuate(true), -_autoScrollDuration(0), +_autoScrollTotalTime(0), _autoScrollAccumulatedTime(0), +_autoScrollCurrentlyOutOfBoundary(false), +_autoScrollBraking(false), +_inertiaScrollEnabled(true), _bounceEnabled(false), -_bouncingBack(false), +_outOfBoundaryAmountDirty(true), _scrollBarEnabled(true), _verticalScrollBar(nullptr), _horizontalScrollBar(nullptr), @@ -223,7 +223,24 @@ const Size& ScrollView::getInnerContainerSize() const void ScrollView::setInnerContainerPosition(const Vec2 &position) { + if(position == _innerContainer->getPosition()) + { + return; + } _innerContainer->setPosition(position); + _outOfBoundaryAmountDirty = true; + + // Process bouncing events + if(_bounceEnabled) + { + for(int direction = (int) MoveDirection::TOP; direction < (int) MoveDirection::RIGHT; ++direction) + { + if(isOutOfBoundary((MoveDirection) direction)) + { + processScrollEvent((MoveDirection) direction, true); + } + } + } this->retain(); if (_eventCallback) @@ -328,123 +345,223 @@ void ScrollView::updateScrollBar(const Vec2& outOfBoundary) } } +Vec2 ScrollView::calculateTouchMoveVelocity() const +{ + float totalTime = 0; + for(auto &timeDelta : _touchMoveTimeDeltas) + { + totalTime += timeDelta; + } + if(totalTime == 0 || totalTime >= 0.1f) + { + return Vec2::ZERO; + } + + Vec2 totalMovement; + for(auto &displacement : _touchMoveDisplacements) + { + totalMovement += displacement; + } + return totalMovement / totalTime; +} + +void ScrollView::startInertiaScroll(const Vec2& touchMoveVelocity) +{ + const float MOVEMENT_FACTOR = 0.7f; + Vec2 inertiaTotalMovement = touchMoveVelocity * MOVEMENT_FACTOR; + startAttenuatingAutoScroll(inertiaTotalMovement, touchMoveVelocity); +} + bool ScrollView::startBounceBackIfNeeded() { if (!_bounceEnabled) { return false; } - Vec2 outOfBoundary = getHowMuchOutOfBoundary(Vec2::ZERO); - if(outOfBoundary == Vec2::ZERO) + Vec2 bounceBackAmount = getHowMuchOutOfBoundary(); + if(bounceBackAmount == Vec2::ZERO) { return false; } - - _bouncingBack = true; - startAutoScroll(outOfBoundary, BOUNCE_BACK_DURATION, true); + + startAutoScroll(bounceBackAmount, BOUNCE_BACK_DURATION, true); return true; } -Vec2 ScrollView::getHowMuchOutOfBoundary(const Vec2& addition) const +Vec2 ScrollView::flattenVectorByDirection(const Vec2& vector) { - Vec2 result; - - if(_innerContainer->getLeftBoundary() + addition.x > _leftBoundary) - { - result.x = _leftBoundary - (_innerContainer->getLeftBoundary() + addition.x); - } - else if(_innerContainer->getRightBoundary() + addition.x < _rightBoundary) - { - result.x = _rightBoundary - (_innerContainer->getRightBoundary() + addition.x); - } - - if(_innerContainer->getTopBoundary() + addition.y < _topBoundary) - { - result.y = _topBoundary - (_innerContainer->getTopBoundary() + addition.y); - } - else if(_innerContainer->getBottomBoundary() + addition.y > _bottomBoundary) - { - result.y = _bottomBoundary - (_innerContainer->getBottomBoundary() + addition.y); - } + Vec2 result = vector; + result.x = (_direction == Direction::VERTICAL ? 0 : result.x); + result.y = (_direction == Direction::HORIZONTAL ? 0 : result.y); return result; } -void ScrollView::processAutoScrolling(float deltaTime) +Vec2 ScrollView::getHowMuchOutOfBoundary(const Vec2& addition) { - _autoScrollAccumulatedTime += deltaTime; - float percentage = _autoScrollAccumulatedTime / _autoScrollDuration; - if(percentage >= 1) + if(addition == Vec2::ZERO && !_outOfBoundaryAmountDirty) { - moveChildrenToPosition(_autoScrollStartPosition + _autoScrollTargetDelta); - _autoScrolling = false; - _bouncingBack = false; + return _outOfBoundaryAmount; + } + + Vec2 outOfBoundaryAmount; + if(_innerContainer->getLeftBoundary() + addition.x > _leftBoundary) + { + outOfBoundaryAmount.x = _leftBoundary - (_innerContainer->getLeftBoundary() + addition.x); + } + else if(_innerContainer->getRightBoundary() + addition.x < _rightBoundary) + { + outOfBoundaryAmount.x = _rightBoundary - (_innerContainer->getRightBoundary() + addition.x); + } + + if(_innerContainer->getTopBoundary() + addition.y < _topBoundary) + { + outOfBoundaryAmount.y = _topBoundary - (_innerContainer->getTopBoundary() + addition.y); + } + else if(_innerContainer->getBottomBoundary() + addition.y > _bottomBoundary) + { + outOfBoundaryAmount.y = _bottomBoundary - (_innerContainer->getBottomBoundary() + addition.y); + } + + if(addition == Vec2::ZERO) + { + _outOfBoundaryAmount = outOfBoundaryAmount; + _outOfBoundaryAmountDirty = false; + } + return outOfBoundaryAmount; +} + +bool ScrollView::isOutOfBoundary(MoveDirection dir) +{ + Vec2 outOfBoundary = getHowMuchOutOfBoundary(); + switch(dir) + { + case MoveDirection::TOP: return outOfBoundary.y > 0; + case MoveDirection::BOTTOM: return outOfBoundary.y < 0; + case MoveDirection::LEFT: return outOfBoundary.x < 0; + case MoveDirection::RIGHT: return outOfBoundary.x > 0; + } + return false; +} + +bool ScrollView::isOutOfBoundary() +{ + return getHowMuchOutOfBoundary() != Vec2::ZERO; +} + +void ScrollView::startAutoScrollToDestination(const Vec2& destination, float timeInSec, bool attenuated) +{ + startAutoScroll(destination - _innerContainer->getPosition(), timeInSec, attenuated); +} + +static float calculateAutoScrollTimeByInitialSpeed(float initialSpeed) +{ + // Calculate the time from the initial speed according to quintic polynomial. + float time = sqrtf(sqrtf(initialSpeed / 5)); + return time; +} + +void ScrollView::startAttenuatingAutoScroll(const Vec2& deltaMove, const Vec2& initialVelocity) +{ + float time = calculateAutoScrollTimeByInitialSpeed(initialVelocity.length()); + startAutoScroll(deltaMove, time, true); +} + +void ScrollView::startAutoScroll(const Vec2& deltaMove, float timeInSec, bool attenuated) +{ + Vec2 adjustedDeltaMove = flattenVectorByDirection(deltaMove); + + _autoScrolling = true; + _autoScrollTargetDelta = adjustedDeltaMove; + _autoScrollAttenuate = attenuated; + _autoScrollStartPosition = _innerContainer->getPosition(); + _autoScrollTotalTime = timeInSec; + _autoScrollAccumulatedTime = 0; + _autoScrollBraking = false; + _autoScrollBrakingStartPosition = Vec2::ZERO; + + // If the destination is also out of boundary of same side, start brake from beggining. + Vec2 currentOutOfBoundary = getHowMuchOutOfBoundary(); + if(currentOutOfBoundary != Vec2::ZERO) + { + _autoScrollCurrentlyOutOfBoundary = true; + Vec2 afterOutOfBoundary = getHowMuchOutOfBoundary(adjustedDeltaMove); + if(currentOutOfBoundary.x * afterOutOfBoundary.x > 0 || currentOutOfBoundary.y * afterOutOfBoundary.y > 0) + { + _autoScrollBraking = true; + } + } +} + +bool ScrollView::isNecessaryAutoScrollBrake() +{ + if(_autoScrollBraking) + { + return true; + } + + if(isOutOfBoundary()) + { + // It just went out of boundary. + if(!_autoScrollCurrentlyOutOfBoundary) + { + _autoScrollCurrentlyOutOfBoundary = true; + _autoScrollBraking = true; + _autoScrollBrakingStartPosition = getInnerContainerPosition(); + return true; + } } else { - if(_autoScrollAttenuate) - { - percentage = tweenfunc::quintEaseOut(percentage); - } - Vec2 moveDelta = _autoScrollTargetDelta * percentage; - moveChildrenToPosition(_autoScrollStartPosition + moveDelta); - - // Dispatch related events if bouncing - if(_bouncingBack) - { - if(moveDelta.x > 0) - { - processScrollEvent(MoveDirection::RIGHT, true); - } - else if(moveDelta.x < 0) - { - processScrollEvent(MoveDirection::LEFT, true); - } - if(moveDelta.y > 0) - { - processScrollEvent(MoveDirection::TOP, true); - } - else if(moveDelta.y < 0) - { - processScrollEvent(MoveDirection::BOTTOM, true); - } - } + _autoScrollCurrentlyOutOfBoundary = false; } + return false; } - -bool ScrollView::isOutOfBoundary(MoveDirection dir) const + +void ScrollView::processAutoScrolling(float deltaTime) { - switch(dir) + // Make auto scroll shorter if it needs to deaccelerate. + float brakingFactor = (isNecessaryAutoScrollBrake() ? OUT_OF_BOUNDARY_BREAKING_FACTOR : 1); + + // Elapsed time + _autoScrollAccumulatedTime += deltaTime * (1 / brakingFactor); + + // Calculate the progress percentage + float percentage = MIN(1, _autoScrollAccumulatedTime / _autoScrollTotalTime); + if(_autoScrollAttenuate) { - case MoveDirection::TOP: return _innerContainer->getTopBoundary() < _topBoundary; - case MoveDirection::BOTTOM: return _innerContainer->getBottomBoundary() > _bottomBoundary; - case MoveDirection::LEFT: return _innerContainer->getLeftBoundary() > _leftBoundary; - case MoveDirection::RIGHT: return _innerContainer->getRightBoundary() < _rightBoundary; + // Use quintic(5th degree) polynomial + percentage = tweenfunc::quintEaseOut(percentage); + } + + // Calculate the new position + Vec2 newPosition = _autoScrollStartPosition + (_autoScrollTargetDelta * percentage); + bool reachedEnd = (percentage == 1); + + if(_bounceEnabled) + { + // The new position is adjusted if out of boundary + newPosition = _autoScrollBrakingStartPosition + (newPosition - _autoScrollBrakingStartPosition) * brakingFactor; + } + else + { + // Don't let go out of boundary + Vec2 moveDelta = newPosition - getInnerContainerPosition(); + Vec2 outOfBoundary = getHowMuchOutOfBoundary(moveDelta); + if(outOfBoundary != Vec2::ZERO) + { + newPosition += outOfBoundary; + reachedEnd = true; + } + } + + moveChildrenToPosition(newPosition); + + // Finish auto scroll if it ended + if(reachedEnd) + { + _autoScrolling = false; + startBounceBackIfNeeded(); } -} - -bool ScrollView::isOutOfBoundaryTopOrBottom() const -{ - return isOutOfBoundary(MoveDirection::TOP) || isOutOfBoundary(MoveDirection::BOTTOM); -} - -bool ScrollView::isOutOfBoundaryLeftOrRight() const -{ - return isOutOfBoundary(MoveDirection::LEFT) || isOutOfBoundary(MoveDirection::RIGHT); -} - -void ScrollView::startAutoScroll(const Vec2& deltaMove, float duration, bool attenuated) -{ - _autoScrolling = true; - _autoScrollTargetDelta = deltaMove; - _autoScrollAttenuate = attenuated; - _autoScrollStartPosition = _innerContainer->getPosition(); - _autoScrollDuration = duration; - _autoScrollAccumulatedTime = 0; -} - -void ScrollView::startAutoScrollChildrenWithDestination(const Vec2& des, float second, bool attenuated) -{ - startAutoScroll(des - _innerContainer->getPosition(), second, attenuated); } void ScrollView::jumpToDestination(const Vec2 &des) @@ -462,77 +579,6 @@ void ScrollView::jumpToDestination(const Vec2 &des) moveChildrenToPosition(Vec2(finalOffsetX, finalOffsetY)); } -void ScrollView::startInertiaScroll() -{ - float totalDuration = 0; - for(auto &timeDelta : _inertiaTouchTimeDeltas) - { - totalDuration += timeDelta; - } - if(totalDuration == 0 || totalDuration >= 0.5f) - { - return; - } - - _inertiaScrolling = true; - - // Calcualte the initial velocity - Vec2 totalMovement; - for(auto &displacement : _inertiaTouchDisplacements) - { - totalMovement += displacement; - } - - for(auto i = _inertiaTouchDisplacements.begin(); i != _inertiaTouchDisplacements.end(); ++i) - { - totalMovement += (*i); - } - totalMovement.x = (_direction == Direction::VERTICAL ? 0 : totalMovement.x); - totalMovement.y = (_direction == Direction::HORIZONTAL ? 0 : totalMovement.y); - - _inertiaInitiVelocity = totalMovement / totalDuration; - _inertiaInitiVelocity.x = MIN(_inertiaInitiVelocity.x, INERTIA_VELOCITY_MAX); - _inertiaInitiVelocity.y = MIN(_inertiaInitiVelocity.y, INERTIA_VELOCITY_MAX); - _inertiaInitiVelocity.x = MAX(_inertiaInitiVelocity.x, -INERTIA_VELOCITY_MAX); - _inertiaInitiVelocity.y = MAX(_inertiaInitiVelocity.y, -INERTIA_VELOCITY_MAX); - - // Calculate values for ease out - _inertiaScrollExpectedTime = _inertiaInitiVelocity.length() / INERTIA_DEACCELERATION; - _inertiaScrollElapsedTime = 0; -} - -void ScrollView::processInertiaScrolling(float dt) -{ - _inertiaScrollElapsedTime += dt; - if(isOutOfBoundaryLeftOrRight() || isOutOfBoundaryTopOrBottom()) - { - // If the inner container is out of boundary, shorten the inertia time. - _inertiaScrollElapsedTime += dt * (45000 / INERTIA_DEACCELERATION); - } - float percentage = _inertiaScrollElapsedTime / _inertiaScrollExpectedTime; - if(percentage >= 1) - { - _inertiaScrolling = false; - startBounceBackIfNeeded(); - return; - } - percentage = tweenfunc::quartEaseOut(percentage); - - Vec2 inertiaVelocity = _inertiaInitiVelocity * (1 - percentage); - Vec2 displacement = inertiaVelocity * dt; - if(!_bounceEnabled) - { - Vec2 outOfBoundary = getHowMuchOutOfBoundary(displacement); - if(outOfBoundary != Vec2::ZERO) - { - // Don't allow to go out of boundary - displacement += outOfBoundary; - _inertiaScrolling = false; - } - } - moveChildren(displacement.x, displacement.y); -} - bool ScrollView::scrollChildren(float touchOffsetX, float touchOffsetY) { touchOffsetX = (_direction == Direction::VERTICAL ? 0 : touchOffsetX); @@ -540,8 +586,9 @@ bool ScrollView::scrollChildren(float touchOffsetX, float touchOffsetY) if(_bounceEnabled) { // If the position of the inner container is out of the boundary, the offsets should be divided by two. - touchOffsetX *= (isOutOfBoundaryLeftOrRight() ? 0.5f : 1); - touchOffsetY *= (isOutOfBoundaryTopOrBottom() ? 0.5f : 1); + Vec2 outOfBoundary = getHowMuchOutOfBoundary(); + touchOffsetX *= (outOfBoundary.x == 0 ? 1 : 0.5f); + touchOffsetY *= (outOfBoundary.y == 0 ? 1 : 0.5f); } float realOffsetX = touchOffsetX; @@ -628,83 +675,83 @@ bool ScrollView::scrollChildren(float touchOffsetX, float touchOffsetY) return scrollEnabledUpDown || scrollEnabledLeftRight; } -void ScrollView::scrollToBottom(float second, bool attenuated) +void ScrollView::scrollToBottom(float timeInSec, bool attenuated) { - startAutoScrollChildrenWithDestination(Vec2(_innerContainer->getPosition().x, 0.0f), second, attenuated); + startAutoScrollToDestination(Vec2(_innerContainer->getPosition().x, 0.0f), timeInSec, attenuated); } -void ScrollView::scrollToTop(float second, bool attenuated) +void ScrollView::scrollToTop(float timeInSec, bool attenuated) { - startAutoScrollChildrenWithDestination(Vec2(_innerContainer->getPosition().x, - _contentSize.height - _innerContainer->getContentSize().height), second, attenuated); + startAutoScrollToDestination(Vec2(_innerContainer->getPosition().x, + _contentSize.height - _innerContainer->getContentSize().height), timeInSec, attenuated); } -void ScrollView::scrollToLeft(float second, bool attenuated) +void ScrollView::scrollToLeft(float timeInSec, bool attenuated) { - startAutoScrollChildrenWithDestination(Vec2(0.0f, _innerContainer->getPosition().y), second, attenuated); + startAutoScrollToDestination(Vec2(0.0f, _innerContainer->getPosition().y), timeInSec, attenuated); } -void ScrollView::scrollToRight(float second, bool attenuated) +void ScrollView::scrollToRight(float timeInSec, bool attenuated) { - startAutoScrollChildrenWithDestination(Vec2(_contentSize.width - _innerContainer->getContentSize().width, - _innerContainer->getPosition().y), second, attenuated); + startAutoScrollToDestination(Vec2(_contentSize.width - _innerContainer->getContentSize().width, + _innerContainer->getPosition().y), timeInSec, attenuated); } -void ScrollView::scrollToTopLeft(float second, bool attenuated) +void ScrollView::scrollToTopLeft(float timeInSec, bool attenuated) { if (_direction != Direction::BOTH) { CCLOG("Scroll direction is not both!"); return; } - startAutoScrollChildrenWithDestination(Vec2(0.0f, _contentSize.height - _innerContainer->getContentSize().height), second, attenuated); + startAutoScrollToDestination(Vec2(0.0f, _contentSize.height - _innerContainer->getContentSize().height), timeInSec, attenuated); } -void ScrollView::scrollToTopRight(float second, bool attenuated) +void ScrollView::scrollToTopRight(float timeInSec, bool attenuated) { if (_direction != Direction::BOTH) { CCLOG("Scroll direction is not both!"); return; } - startAutoScrollChildrenWithDestination(Vec2(_contentSize.width - _innerContainer->getContentSize().width, - _contentSize.height - _innerContainer->getContentSize().height), second, attenuated); + startAutoScrollToDestination(Vec2(_contentSize.width - _innerContainer->getContentSize().width, + _contentSize.height - _innerContainer->getContentSize().height), timeInSec, attenuated); } -void ScrollView::scrollToBottomLeft(float second, bool attenuated) +void ScrollView::scrollToBottomLeft(float timeInSec, bool attenuated) { if (_direction != Direction::BOTH) { CCLOG("Scroll direction is not both!"); return; } - startAutoScrollChildrenWithDestination(Vec2::ZERO, second, attenuated); + startAutoScrollToDestination(Vec2::ZERO, timeInSec, attenuated); } -void ScrollView::scrollToBottomRight(float second, bool attenuated) +void ScrollView::scrollToBottomRight(float timeInSec, bool attenuated) { if (_direction != Direction::BOTH) { CCLOG("Scroll direction is not both!"); return; } - startAutoScrollChildrenWithDestination(Vec2(_contentSize.width - _innerContainer->getContentSize().width, 0.0f), second, attenuated); + startAutoScrollToDestination(Vec2(_contentSize.width - _innerContainer->getContentSize().width, 0.0f), timeInSec, attenuated); } -void ScrollView::scrollToPercentVertical(float percent, float second, bool attenuated) +void ScrollView::scrollToPercentVertical(float percent, float timeInSec, bool attenuated) { float minY = _contentSize.height - _innerContainer->getContentSize().height; float h = - minY; - startAutoScrollChildrenWithDestination(Vec2(_innerContainer->getPosition().x, minY + percent * h / 100.0f), second, attenuated); + startAutoScrollToDestination(Vec2(_innerContainer->getPosition().x, minY + percent * h / 100.0f), timeInSec, attenuated); } -void ScrollView::scrollToPercentHorizontal(float percent, float second, bool attenuated) +void ScrollView::scrollToPercentHorizontal(float percent, float timeInSec, bool attenuated) { float w = _innerContainer->getContentSize().width - _contentSize.width; - startAutoScrollChildrenWithDestination(Vec2(-(percent * w / 100.0f), _innerContainer->getPosition().y), second, attenuated); + startAutoScrollToDestination(Vec2(-(percent * w / 100.0f), _innerContainer->getPosition().y), timeInSec, attenuated); } -void ScrollView::scrollToPercentBothDirection(const Vec2& percent, float second, bool attenuated) +void ScrollView::scrollToPercentBothDirection(const Vec2& percent, float timeInSec, bool attenuated) { if (_direction != Direction::BOTH) { @@ -713,7 +760,7 @@ void ScrollView::scrollToPercentBothDirection(const Vec2& percent, float second, float minY = _contentSize.height - _innerContainer->getContentSize().height; float h = - minY; float w = _innerContainer->getContentSize().width - _contentSize.width; - startAutoScrollChildrenWithDestination(Vec2(-(percent.x * w / 100.0f), minY + percent.y * h / 100.0f), second, attenuated); + startAutoScrollToDestination(Vec2(-(percent.x * w / 100.0f), minY + percent.y * h / 100.0f), timeInSec, attenuated); } void ScrollView::jumpToBottom() @@ -803,36 +850,42 @@ void ScrollView::jumpToPercentBothDirection(const Vec2& percent) jumpToDestination(Vec2(-(percent.x * w / 100.0f), minY + percent.y * h / 100.0f)); } -void ScrollView::startRecordSlidAction() +bool ScrollView::calculateCurrAndPrevTouchPoints(Touch* touch, Vec3* currPt, Vec3* prevPt) { - if (_inertiaScrolling) + if (nullptr == _hittedByCamera || + false == hitTest(touch->getLocation(), _hittedByCamera, currPt) || + false == hitTest(touch->getPreviousLocation(), _hittedByCamera, prevPt)) { - _inertiaScrolling = false; - } - if(_autoScrolling) - { - _autoScrolling = false; - _bouncingBack = false; + return false; } + return true; } -void ScrollView::endRecordSlidAction() +void ScrollView::gatherTouchMove(const Vec2& delta) { - bool bounceBackStarted = startBounceBackIfNeeded(); - if(!bounceBackStarted && _inertiaScrollEnabled) + while(_touchMoveDisplacements.size() >= NUMBER_OF_GATHERED_TOUCHES_FOR_MOVE_SPEED) { - startInertiaScroll(); + _touchMoveDisplacements.pop_front(); + _touchMoveTimeDeltas.pop_front(); } + _touchMoveDisplacements.push_back(delta); + + long long timestamp = utils::getTimeInMilliseconds(); + _touchMoveTimeDeltas.push_back((timestamp - _touchMovePreviousTimestamp) / 1000.0f); + _touchMovePreviousTimestamp = timestamp; } void ScrollView::handlePressLogic(Touch *touch) { - startRecordSlidAction(); _bePressed = true; - - _inertiaPrevTouchTimestamp = utils::getTimeInMilliseconds(); - _inertiaTouchDisplacements.clear(); - _inertiaTouchTimeDeltas.clear(); + _autoScrolling = false; + + // Clear gathered touch move information + { + _touchMovePreviousTimestamp = utils::getTimeInMilliseconds(); + _touchMoveDisplacements.clear(); + _touchMoveTimeDeltas.clear(); + } if(_verticalScrollBar != nullptr) { @@ -847,33 +900,43 @@ void ScrollView::handlePressLogic(Touch *touch) void ScrollView::handleMoveLogic(Touch *touch) { Vec3 currPt, prevPt; - if (nullptr == _hittedByCamera || - false == hitTest(touch->getLocation(), _hittedByCamera, &currPt) || - false == hitTest(touch->getPreviousLocation(), _hittedByCamera, &prevPt)) + if(!calculateCurrAndPrevTouchPoints(touch, &currPt, &prevPt)) { return; } Vec3 delta3 = currPt - prevPt; Vec2 delta(delta3.x, delta3.y); scrollChildren(delta.x, delta.y); - - while(_inertiaTouchDisplacements.size() > 5) - { - _inertiaTouchDisplacements.pop_front(); - _inertiaTouchTimeDeltas.pop_front(); - } - _inertiaTouchDisplacements.push_back(delta); - - long long timestamp = utils::getTimeInMilliseconds(); - _inertiaTouchTimeDeltas.push_back((timestamp - _inertiaPrevTouchTimestamp) / 1000.0f); - _inertiaPrevTouchTimestamp = timestamp; + + // Gather touch move information for speed calculation + gatherTouchMove(delta); } void ScrollView::handleReleaseLogic(Touch *touch) { - endRecordSlidAction(); + // Gather the last touch information when released + { + Vec3 currPt, prevPt; + if(calculateCurrAndPrevTouchPoints(touch, &currPt, &prevPt)) + { + Vec3 delta3 = currPt - prevPt; + Vec2 delta(delta3.x, delta3.y); + gatherTouchMove(delta); + } + } + _bePressed = false; + bool bounceBackStarted = startBounceBackIfNeeded(); + if(!bounceBackStarted && _inertiaScrollEnabled) + { + Vec2 touchMoveVelocity = calculateTouchMoveVelocity(); + if(touchMoveVelocity != Vec2::ZERO) + { + startInertiaScroll(touchMoveVelocity); + } + } + if(_verticalScrollBar != nullptr) { _verticalScrollBar->onTouchEnded(); @@ -928,11 +991,7 @@ void ScrollView::onTouchCancelled(Touch *touch, Event *unusedEvent) void ScrollView::update(float dt) { - if (_inertiaScrolling) - { - processInertiaScrolling(dt); - } - else if (_autoScrolling) + if (_autoScrolling) { processAutoScrolling(dt); } @@ -1002,29 +1061,29 @@ void ScrollView::processScrollEvent(MoveDirection dir, bool bounce) ScrollviewEventType scrollEventType; EventType eventType; switch(dir) { - case MoveDirection::TOP: - { - scrollEventType = (bounce ? SCROLLVIEW_EVENT_BOUNCE_TOP : SCROLLVIEW_EVENT_SCROLL_TO_TOP); - eventType = (bounce ? EventType::BOUNCE_TOP : EventType::SCROLL_TO_TOP); - break; - } - case MoveDirection::BOTTOM: - { - scrollEventType = (bounce ? SCROLLVIEW_EVENT_BOUNCE_BOTTOM : SCROLLVIEW_EVENT_SCROLL_TO_BOTTOM); - eventType = (bounce ? EventType::BOUNCE_BOTTOM : EventType::SCROLL_TO_BOTTOM); - break; - } - case MoveDirection::LEFT: - { - scrollEventType = (bounce ? SCROLLVIEW_EVENT_BOUNCE_LEFT : SCROLLVIEW_EVENT_SCROLL_TO_LEFT); - eventType = (bounce ? EventType::BOUNCE_LEFT : EventType::SCROLL_TO_LEFT); - break; - } - case MoveDirection::RIGHT: - { - scrollEventType = (bounce ? SCROLLVIEW_EVENT_BOUNCE_RIGHT : SCROLLVIEW_EVENT_SCROLL_TO_RIGHT); - eventType = (bounce ? EventType::BOUNCE_RIGHT : EventType::SCROLL_TO_RIGHT); - break; + case MoveDirection::TOP: + { + scrollEventType = (bounce ? SCROLLVIEW_EVENT_BOUNCE_TOP : SCROLLVIEW_EVENT_SCROLL_TO_TOP); + eventType = (bounce ? EventType::BOUNCE_TOP : EventType::SCROLL_TO_TOP); + break; + } + case MoveDirection::BOTTOM: + { + scrollEventType = (bounce ? SCROLLVIEW_EVENT_BOUNCE_BOTTOM : SCROLLVIEW_EVENT_SCROLL_TO_BOTTOM); + eventType = (bounce ? EventType::BOUNCE_BOTTOM : EventType::SCROLL_TO_BOTTOM); + break; + } + case MoveDirection::LEFT: + { + scrollEventType = (bounce ? SCROLLVIEW_EVENT_BOUNCE_LEFT : SCROLLVIEW_EVENT_SCROLL_TO_LEFT); + eventType = (bounce ? EventType::BOUNCE_LEFT : EventType::SCROLL_TO_LEFT); + break; + } + case MoveDirection::RIGHT: + { + scrollEventType = (bounce ? SCROLLVIEW_EVENT_BOUNCE_RIGHT : SCROLLVIEW_EVENT_SCROLL_TO_RIGHT); + eventType = (bounce ? EventType::BOUNCE_RIGHT : EventType::SCROLL_TO_RIGHT); + break; } } dispatchEvent(scrollEventType, eventType); @@ -1342,8 +1401,8 @@ void ScrollView::copySpecialProperties(Widget *widget) if (scrollView) { Layout::copySpecialProperties(widget); - _innerContainer = scrollView->_innerContainer; setDirection(scrollView->_direction); + setInnerContainerPosition(scrollView->getInnerContainerPosition()); setInnerContainerSize(scrollView->getInnerContainerSize()); _topBoundary = scrollView->_topBoundary; _bottomBoundary = scrollView->_bottomBoundary; @@ -1351,22 +1410,20 @@ void ScrollView::copySpecialProperties(Widget *widget) _rightBoundary = scrollView->_rightBoundary; _bePressed = scrollView->_bePressed; _childFocusCancelOffsetInInch = scrollView->_childFocusCancelOffsetInInch; - setInertiaScrollEnabled(scrollView->_inertiaScrollEnabled); - _inertiaScrolling = scrollView->_inertiaScrolling; - _inertiaInitiVelocity = scrollView->_inertiaInitiVelocity; - _inertiaTouchDisplacements = scrollView->_inertiaTouchDisplacements; - _inertiaTouchTimeDeltas = scrollView->_inertiaTouchTimeDeltas; - _inertiaPrevTouchTimestamp = scrollView->_inertiaPrevTouchTimestamp; - _inertiaScrollExpectedTime = scrollView->_inertiaScrollExpectedTime; - _inertiaScrollElapsedTime = scrollView->_inertiaScrollElapsedTime; + _touchMoveDisplacements = scrollView->_touchMoveDisplacements; + _touchMoveTimeDeltas = scrollView->_touchMoveTimeDeltas; + _touchMovePreviousTimestamp = scrollView->_touchMovePreviousTimestamp; _autoScrolling = scrollView->_autoScrolling; _autoScrollAttenuate = scrollView->_autoScrollAttenuate; _autoScrollStartPosition = scrollView->_autoScrollStartPosition; _autoScrollTargetDelta = scrollView->_autoScrollTargetDelta; - _autoScrollDuration = scrollView->_autoScrollDuration; + _autoScrollTotalTime = scrollView->_autoScrollTotalTime; _autoScrollAccumulatedTime = scrollView->_autoScrollAccumulatedTime; + _autoScrollCurrentlyOutOfBoundary = scrollView->_autoScrollCurrentlyOutOfBoundary; + _autoScrollBraking = scrollView->_autoScrollBraking; + _autoScrollBrakingStartPosition = scrollView->_autoScrollBrakingStartPosition; + setInertiaScrollEnabled(scrollView->_inertiaScrollEnabled); setBounceEnabled(scrollView->_bounceEnabled); - _bouncingBack = scrollView->_bouncingBack; _scrollViewEventListener = scrollView->_scrollViewEventListener; _scrollViewEventSelector = scrollView->_scrollViewEventSelector; _eventCallback = scrollView->_eventCallback; diff --git a/cocos/ui/UIScrollView.h b/cocos/ui/UIScrollView.h index 8f311ee458..e061a37fbc 100644 --- a/cocos/ui/UIScrollView.h +++ b/cocos/ui/UIScrollView.h @@ -156,141 +156,141 @@ public: /** * Scroll inner container to bottom boundary of scrollview. - * @param second Time in seconds. + * @param timeInSec Time in seconds. * @param attenuated Whether scroll speed attenuate or not. */ - void scrollToBottom(float second, bool attenuated); + void scrollToBottom(float timeInSec, bool attenuated); /** * Scroll inner container to top boundary of scrollview. - * @param second Time in seconds. + * @param timeInSec Time in seconds. * @param attenuated Whether scroll speed attenuate or not. */ - void scrollToTop(float second, bool attenuated); + void scrollToTop(float timeInSec, bool attenuated); /** * Scroll inner container to left boundary of scrollview. - * @param second Time in seconds. + * @param timeInSec Time in seconds. * @param attenuated Whether scroll speed attenuate or not. */ - void scrollToLeft(float second, bool attenuated); + void scrollToLeft(float timeInSec, bool attenuated); /** * Scroll inner container to right boundary of scrollview. - * @param second Time in seconds. + * @param timeInSec Time in seconds. * @param attenuated Whether scroll speed attenuate or not. */ - void scrollToRight(float time, bool attenuated); + void scrollToRight(float timeInSec, bool attenuated); /** * Scroll inner container to top and left boundary of scrollview. - * @param second Time in seconds. + * @param timeInSec Time in seconds. * @param attenuated Whether scroll speed attenuate or not. */ - void scrollToTopLeft(float second, bool attenuated); + void scrollToTopLeft(float timeInSec, bool attenuated); /** * Scroll inner container to top and right boundary of scrollview. - * @param second Time in seconds. + * @param timeInSec Time in seconds. * @param attenuated Whether scroll speed attenuate or not. */ - void scrollToTopRight(float time, bool attenuated); + void scrollToTopRight(float timeInSec, bool attenuated); /** * Scroll inner container to bottom and left boundary of scrollview. - * @param second Time in seconds. + * @param timeInSec Time in seconds. * @param attenuated Whether scroll speed attenuate or not. */ - void scrollToBottomLeft(float second, bool attenuated); + void scrollToBottomLeft(float timeInSec, bool attenuated); /** * Scroll inner container to bottom and right boundary of scrollview. - * @param second Time in seconds + * @param timeInSec Time in seconds * @param attenuated Whether scroll speed attenuate or not. */ - void scrollToBottomRight(float time, bool attenuated); + void scrollToBottomRight(float timeInSec, bool attenuated); /** * Scroll inner container to vertical percent position of scrollview. * @param percent A value between 0 and 100. - * @param second Time in seconds. + * @param timeInSec Time in seconds. * @param attenuated Whether scroll speed attenuate or not. */ - void scrollToPercentVertical(float percent, float second, bool attenuated); + void scrollToPercentVertical(float percent, float timeInSec, bool attenuated); /** * Scroll inner container to horizontal percent position of scrollview. * @param percent A value between 0 and 100. - * @param second Time in seconds. + * @param timeInSec Time in seconds. * @param attenuated Whether scroll speed attenuate or not. */ - void scrollToPercentHorizontal(float percent, float second, bool attenuated); + void scrollToPercentHorizontal(float percent, float timeInSec, bool attenuated); /** * Scroll inner container to both direction percent position of scrollview. * @param percent A value between 0 and 100. - * @param second Time in seconds. + * @param timeInSec Time in seconds. * @param attenuated Whether scroll speed attenuate or not. */ - void scrollToPercentBothDirection(const Vec2& percent, float second, bool attenuated); + void scrollToPercentBothDirection(const Vec2& percent, float timeInSec, bool attenuated); /** * Move inner container to bottom boundary of scrollview. */ - void jumpToBottom(); + virtual void jumpToBottom(); /** * Move inner container to top boundary of scrollview. */ - void jumpToTop(); + virtual void jumpToTop(); /** * Move inner container to left boundary of scrollview. */ - void jumpToLeft(); + virtual void jumpToLeft(); /** * Move inner container to right boundary of scrollview. */ - void jumpToRight(); + virtual void jumpToRight(); /** * Move inner container to top and left boundary of scrollview. */ - void jumpToTopLeft(); + virtual void jumpToTopLeft(); /** * Move inner container to top and right boundary of scrollview. */ - void jumpToTopRight(); + virtual void jumpToTopRight(); /** * Move inner container to bottom and left boundary of scrollview. */ - void jumpToBottomLeft(); + virtual void jumpToBottomLeft(); /** * Move inner container to bottom and right boundary of scrollview. */ - void jumpToBottomRight(); + virtual void jumpToBottomRight(); /** * Move inner container to vertical percent position of scrollview. * @param percent A value between 0 and 100. */ - void jumpToPercentVertical(float percent); + virtual void jumpToPercentVertical(float percent); /** * Move inner container to horizontal percent position of scrollview. * @param percent A value between 0 and 100. */ - void jumpToPercentHorizontal(float percent); + virtual void jumpToPercentHorizontal(float percent); /** * Move inner container to both direction percent position of scrollview. * @param percent A value between 0 and 100. */ - void jumpToPercentBothDirection(const Vec2& percent); + virtual void jumpToPercentBothDirection(const Vec2& percent); /** * Change inner container size of scrollview. @@ -358,7 +358,6 @@ public: virtual void onTouchCancelled(Touch *touch, Event *unusedEvent) override; virtual void update(float dt) override; - /** * @brief Toggle bounce enabled when scroll to the edge. * @@ -565,30 +564,33 @@ protected: virtual void initScrollBar(); virtual void removeScrollBar(); - bool isOutOfBoundary(MoveDirection dir) const; - bool isOutOfBoundaryTopOrBottom() const; - bool isOutOfBoundaryLeftOrRight() const; + Vec2 flattenVectorByDirection(const Vec2& vector); + + virtual Vec2 getHowMuchOutOfBoundary(const Vec2& addition = Vec2::ZERO); + bool isOutOfBoundary(MoveDirection dir); + bool isOutOfBoundary(); void moveChildren(float offsetX, float offsetY); void moveChildrenToPosition(const Vec2& position); + + bool calculateCurrAndPrevTouchPoints(Touch* touch, Vec3* currPt, Vec3* prevPt); + void gatherTouchMove(const Vec2& delta); + Vec2 calculateTouchMoveVelocity() const; - void startInertiaScroll(); - void processInertiaScrolling(float dt); - - void startAutoScroll(const Vec2& deltaMove, float duration, bool attenuated); - void startAutoScrollChildrenWithDestination(const Vec2& des, float second, bool attenuated); + virtual void startAttenuatingAutoScroll(const Vec2& deltaMove, const Vec2& initialVelocity); + void startAutoScroll(const Vec2& deltaMove, float timeInSec, bool attenuated); + void startAutoScrollToDestination(const Vec2& des, float timeInSec, bool attenuated); + bool isNecessaryAutoScrollBrake(); void processAutoScrolling(float deltaTime); + void startInertiaScroll(const Vec2& touchMoveVelocity); + bool startBounceBackIfNeeded(); void jumpToDestination(const Vec2& des); virtual bool scrollChildren(float touchOffsetX, float touchOffsetY); - void startRecordSlidAction(); - virtual void endRecordSlidAction(); - - //ScrollViewProtocol virtual void handlePressLogic(Touch *touch); virtual void handleMoveLogic(Touch *touch); virtual void handleReleaseLogic(Touch *touch); @@ -599,8 +601,6 @@ protected: void processScrollingEvent(); void dispatchEvent(ScrollviewEventType scrollEventType, EventType eventType); - Vec2 getHowMuchOutOfBoundary(const Vec2& addition) const; - void updateScrollBar(const Vec2& outOfBoundary); protected: @@ -616,25 +616,28 @@ protected: bool _bePressed; float _childFocusCancelOffsetInInch; - - bool _inertiaScrollEnabled; - bool _inertiaScrolling; - Vec2 _inertiaInitiVelocity; - std::list _inertiaTouchDisplacements; - std::list _inertiaTouchTimeDeltas; - long long _inertiaPrevTouchTimestamp; - float _inertiaScrollExpectedTime; - float _inertiaScrollElapsedTime; - + + // Touch move speed + std::list _touchMoveDisplacements; + std::list _touchMoveTimeDeltas; + long long _touchMovePreviousTimestamp; + bool _autoScrolling; bool _autoScrollAttenuate; Vec2 _autoScrollStartPosition; Vec2 _autoScrollTargetDelta; - float _autoScrollDuration; + float _autoScrollTotalTime; float _autoScrollAccumulatedTime; + bool _autoScrollCurrentlyOutOfBoundary; + bool _autoScrollBraking; + Vec2 _autoScrollBrakingStartPosition; + bool _inertiaScrollEnabled; + bool _bounceEnabled; - bool _bouncingBack; + + Vec2 _outOfBoundaryAmount; + bool _outOfBoundaryAmountDirty; bool _scrollBarEnabled; ScrollViewBar* _verticalScrollBar; diff --git a/cocos/ui/UISlider.cpp b/cocos/ui/UISlider.cpp index a827b6e87a..aa5e0c1738 100644 --- a/cocos/ui/UISlider.cpp +++ b/cocos/ui/UISlider.cpp @@ -98,8 +98,8 @@ Slider* Slider::create(const std::string& barTextureName, Slider* widget = new (std::nothrow) Slider(); if (widget && widget->init()) { - widget->loadBarTexture(barTextureName); - widget->loadSlidBallTextureNormal(normalBallTextureName); + widget->loadBarTexture(barTextureName, resType); + widget->loadSlidBallTextureNormal(normalBallTextureName, resType); widget->autorelease(); return widget; } @@ -431,7 +431,11 @@ bool Slider::hitTest(const cocos2d::Vec2 &pt, const Camera *camera, Vec3 *p) con Rect rect; rect.size = _slidBallNormalRenderer->getContentSize(); auto w2l = _slidBallNormalRenderer->getWorldToNodeTransform(); - return isScreenPointInRect(pt, camera, w2l, rect, nullptr); + + Rect sliderBarRect; + sliderBarRect.size = this->_barRenderer->getContentSize(); + auto barW2l = this->_barRenderer->getWorldToNodeTransform(); + return isScreenPointInRect(pt, camera, w2l, rect, nullptr) || isScreenPointInRect(pt, camera, barW2l, sliderBarRect, nullptr); } bool Slider::onTouchBegan(Touch *touch, Event *unusedEvent) diff --git a/cocos/ui/UIWidget.cpp b/cocos/ui/UIWidget.cpp index f276cdb07e..a48baecba3 100644 --- a/cocos/ui/UIWidget.cpp +++ b/cocos/ui/UIWidget.cpp @@ -289,6 +289,11 @@ LayoutComponent* Widget::getOrCreateLayoutComponent() void Widget::setContentSize(const cocos2d::Size &contentSize) { + Size previousSize = ProtectedNode::getContentSize(); + if(previousSize.equals(contentSize)) + { + return; + } ProtectedNode::setContentSize(contentSize); _customSize = contentSize; diff --git a/docs/RELEASE_NOTES.md b/docs/RELEASE_NOTES.md index 4fdbc15ac4..19350b0fc5 100644 --- a/docs/RELEASE_NOTES.md +++ b/docs/RELEASE_NOTES.md @@ -181,7 +181,7 @@ Here is some highlighted improvments and API changes: ## Download -[Cocos2d-x v3.8 rc0](http://www.cocos2d-x.org/filedown/cocos2d-x-3.8-rc0.zip) including : C++, Lua & JS +[Cocos2d-x v3.8](http://www.cocos2d-x.org/filedown/cocos2d-x-3.8.zip) including : C++, Lua & JS ## The main features in detail: @@ -270,9 +270,12 @@ Here is some highlighted improvments and API changes: 1. Reimplemented EditBox - The usage of EditBox is the same as before. It is more likely a iOS version EditBox remake plus a few improvments. + The usage of EditBox is the same as before, but we have reimplemented it for Android platform. The use experience is highly improved, important improvements are: - Besides, it supports multi-line input now, you should set InputMode to `ANY` to enable multi-line input. + - Display cursor in EditBox + - Support copy, cut, paste and select actions in EditBox + - Support multi-line input, you should set InputMode to `ANY` to enable multi-line input + - EditBox won't be masked by the keyboard UI anymore 2. ScrollViewBar diff --git a/extensions/assets-manager/AssetsManagerEx.cpp b/extensions/assets-manager/AssetsManagerEx.cpp index c8ef3371a4..a3b9a737e6 100644 --- a/extensions/assets-manager/AssetsManagerEx.cpp +++ b/extensions/assets-manager/AssetsManagerEx.cpp @@ -50,7 +50,6 @@ NS_CC_EXT_BEGIN const std::string AssetsManagerEx::VERSION_ID = "@version"; const std::string AssetsManagerEx::MANIFEST_ID = "@manifest"; -const std::string AssetsManagerEx::BATCH_UPDATE_ID = "@batch_update"; // Implementation of AssetsManagerEx @@ -80,16 +79,19 @@ AssetsManagerEx::AssetsManagerEx(const std::string& manifestUrl, const std::stri _updateState = State::UNCHECKED; _downloader = std::shared_ptr(new network::Downloader); - _downloader->setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT); - _downloader->setErrorCallback(std::bind(&AssetsManagerEx::onError, this, std::placeholders::_1)); - _downloader->setProgressCallback(std::bind(&AssetsManagerEx::onProgress, - this, - std::placeholders::_1, - std::placeholders::_2, - std::placeholders::_3, - std::placeholders::_4) - ); - _downloader->setSuccessCallback(std::bind(&AssetsManagerEx::onSuccess, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); +// _downloader->setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT); + _downloader->onTaskError = bind(&AssetsManagerEx::onError, this, placeholders::_1, placeholders::_2, placeholders::_3, placeholders::_4); + _downloader->onTaskProgress = [this](const network::DownloadTask& task, + int64_t bytesReceived, + int64_t totalBytesReceived, + int64_t totalBytesExpected) + { + this->onProgress(totalBytesExpected, totalBytesReceived, task.requestURL, task.identifier); + }; + _downloader->onFileTaskSuccess = [this](const network::DownloadTask& task) + { + this->onSuccess(task.requestURL, task.storagePath, task.identifier); + }; setStoragePath(storagePath); _cacheVersionPath = _storagePath + VERSION_FILENAME; _cacheManifestPath = _storagePath + MANIFEST_FILENAME; @@ -100,9 +102,9 @@ AssetsManagerEx::AssetsManagerEx(const std::string& manifestUrl, const std::stri AssetsManagerEx::~AssetsManagerEx() { - _downloader->setErrorCallback(nullptr); - _downloader->setSuccessCallback(nullptr); - _downloader->setProgressCallback(nullptr); + _downloader->onTaskError = (nullptr); + _downloader->onFileTaskSuccess = (nullptr); + _downloader->onTaskProgress = (nullptr); CC_SAFE_RELEASE(_localManifest); // _tempManifest could share a ptr with _remoteManifest or _localManifest if (_tempManifest != _localManifest && _tempManifest != _remoteManifest) @@ -440,7 +442,7 @@ void AssetsManagerEx::downloadVersion() { _updateState = State::DOWNLOADING_VERSION; // Download version file asynchronously - _downloader->downloadAsync(versionUrl, _cacheVersionPath, VERSION_ID); + _downloader->createDownloadFileTask(versionUrl, _cacheVersionPath, VERSION_ID); } // No version file found else @@ -496,7 +498,7 @@ void AssetsManagerEx::downloadManifest() { _updateState = State::DOWNLOADING_MANIFEST; // Download version file asynchronously - _downloader->downloadAsync(manifestUrl, _tempManifestPath, MANIFEST_ID); + _downloader->createDownloadFileTask(manifestUrl, _tempManifestPath, MANIFEST_ID); } // No manifest file found else @@ -559,9 +561,8 @@ void AssetsManagerEx::startUpdate() if (_tempManifest->isLoaded() && _tempManifest->versionEquals(_remoteManifest)) { _tempManifest->genResumeAssetsList(&_downloadUnits); - _totalWaitToDownload = _totalToDownload = (int)_downloadUnits.size(); - _downloader->batchDownloadAsync(_downloadUnits, BATCH_UPDATE_ID); + this->batchDownload(); std::string msg = StringUtils::format("Resuming from previous unfinished update, %d files remains to be finished.", _totalToDownload); dispatchUpdateEvent(EventAssetsManagerEx::EventCode::UPDATE_PROGRESSION, "", msg); @@ -598,16 +599,15 @@ void AssetsManagerEx::startUpdate() // Create path _fileUtils->createDirectory(basename(_storagePath + path)); - network::DownloadUnit unit; + DownloadUnit unit; unit.customId = it->first; unit.srcUrl = packageUrl + path; unit.storagePath = _storagePath + path; - unit.resumeDownload = false; _downloadUnits.emplace(unit.customId, unit); } } // Set other assets' downloadState to SUCCESSED - auto assets = _remoteManifest->getAssets(); + auto &assets = _remoteManifest->getAssets(); for (auto it = assets.cbegin(); it != assets.cend(); ++it) { const std::string &key = it->first; @@ -617,9 +617,8 @@ void AssetsManagerEx::startUpdate() _tempManifest->setAssetDownloadState(key, Manifest::DownloadState::SUCCESSED); } } - _totalWaitToDownload = _totalToDownload = (int)_downloadUnits.size(); - _downloader->batchDownloadAsync(_downloadUnits, BATCH_UPDATE_ID); + this->batchDownload(); std::string msg = StringUtils::format("Start to update %d files from remote package.", _totalToDownload); dispatchUpdateEvent(EventAssetsManagerEx::EventCode::UPDATE_PROGRESSION, "", msg); @@ -752,7 +751,7 @@ void AssetsManagerEx::update() } } -void AssetsManagerEx::updateAssets(const network::DownloadUnits& assets) +void AssetsManagerEx::updateAssets(const DownloadUnits& assets) { if (!_inited){ CCLOG("AssetsManagerEx : Manifests uninited.\n"); @@ -768,7 +767,7 @@ void AssetsManagerEx::updateAssets(const network::DownloadUnits& assets) _updateState = State::UPDATING; _downloadUnits.clear(); _downloadUnits = assets; - _downloader->batchDownloadAsync(_downloadUnits, BATCH_UPDATE_ID); + this->batchDownload(); } else if (size == 0 && _totalWaitToDownload == 0) { @@ -777,7 +776,7 @@ void AssetsManagerEx::updateAssets(const network::DownloadUnits& assets) } } -const network::DownloadUnits& AssetsManagerEx::getFailedAssets() const +const DownloadUnits& AssetsManagerEx::getFailedAssets() const { return _failedUnits; } @@ -789,29 +788,32 @@ void AssetsManagerEx::downloadFailedAssets() } -void AssetsManagerEx::onError(const network::Downloader::Error &error) +void AssetsManagerEx::onError(const network::DownloadTask& task, + int errorCode, + int errorCodeInternal, + const std::string& errorStr) { // Skip version error occured - if (error.customId == VERSION_ID) + if (task.identifier == VERSION_ID) { CCLOG("AssetsManagerEx : Fail to download version file, step skipped\n"); _updateState = State::PREDOWNLOAD_MANIFEST; downloadManifest(); } - else if (error.customId == MANIFEST_ID) + else if (task.identifier == MANIFEST_ID) { - dispatchUpdateEvent(EventAssetsManagerEx::EventCode::ERROR_DOWNLOAD_MANIFEST, error.customId, error.message, error.curle_code, error.curlm_code); + dispatchUpdateEvent(EventAssetsManagerEx::EventCode::ERROR_DOWNLOAD_MANIFEST, task.identifier, errorStr, errorCode, errorCodeInternal); } else { - auto unitIt = _downloadUnits.find(error.customId); + auto unitIt = _downloadUnits.find(task.identifier); // Found unit and add it to failed units if (unitIt != _downloadUnits.end()) { - network::DownloadUnit unit = unitIt->second; + DownloadUnit unit = unitIt->second; _failedUnits.emplace(unit.customId, unit); } - dispatchUpdateEvent(EventAssetsManagerEx::EventCode::ERROR_UPDATING, error.customId, error.message, error.curle_code, error.curlm_code); + dispatchUpdateEvent(EventAssetsManagerEx::EventCode::ERROR_UPDATING, task.identifier, errorStr, errorCode, errorCodeInternal); } } @@ -879,27 +881,9 @@ void AssetsManagerEx::onSuccess(const std::string &srcUrl, const std::string &st _updateState = State::MANIFEST_LOADED; parseManifest(); } - else if (customId == BATCH_UPDATE_ID) - { - // Finished with error check - if (_failedUnits.size() > 0 || _totalWaitToDownload > 0) - { - // Save current download manifest information for resuming - _tempManifest->saveToFile(_tempManifestPath); - - decompressDownloadedZip(); - - _updateState = State::FAIL_TO_UPDATE; - dispatchUpdateEvent(EventAssetsManagerEx::EventCode::UPDATE_FAILED); - } - else - { - updateSucceed(); - } - } else { - auto assets = _remoteManifest->getAssets(); + auto &assets = _remoteManifest->getAssets(); auto assetIt = assets.find(customId); if (assetIt != assets.end()) { @@ -932,6 +916,25 @@ void AssetsManagerEx::onSuccess(const std::string &srcUrl, const std::string &st // Remove from failed units list _failedUnits.erase(unitIt); } + + if (_totalWaitToDownload <= 0) + { + // Finished with error check + if (_failedUnits.size() > 0) + { + // Save current download manifest information for resuming + _tempManifest->saveToFile(_tempManifestPath); + + decompressDownloadedZip(); + + _updateState = State::FAIL_TO_UPDATE; + dispatchUpdateEvent(EventAssetsManagerEx::EventCode::UPDATE_FAILED); + } + else + { + updateSucceed(); + } + } } } @@ -941,4 +944,13 @@ void AssetsManagerEx::destroyDownloadedVersion() _fileUtils->removeFile(_cacheManifestPath); } +void AssetsManagerEx::batchDownload() +{ + for(auto iter : _downloadUnits) + { + DownloadUnit& unit = iter.second; + _downloader->createDownloadFileTask(unit.srcUrl, unit.storagePath, unit.customId); + } +} + NS_CC_EXT_END diff --git a/extensions/assets-manager/AssetsManagerEx.h b/extensions/assets-manager/AssetsManagerEx.h index d039422341..05a9be61ff 100644 --- a/extensions/assets-manager/AssetsManagerEx.h +++ b/extensions/assets-manager/AssetsManagerEx.h @@ -68,7 +68,6 @@ public: const static std::string VERSION_ID; const static std::string MANIFEST_ID; - const static std::string BATCH_UPDATE_ID; /** @brief Create function for creating a new AssetsManagerEx @param manifestUrl The url for the local manifest file @@ -143,11 +142,11 @@ protected: /** @brief Update a list of assets under the current AssetsManagerEx context */ - void updateAssets(const network::DownloadUnits& assets); + void updateAssets(const DownloadUnits& assets); /** @brief Retrieve all failed assets during the last update */ - const network::DownloadUnits& getFailedAssets() const; + const DownloadUnits& getFailedAssets() const; /** @brief Function for destorying the downloaded version file and manifest file */ @@ -160,7 +159,10 @@ protected: * @js NA * @lua NA */ - virtual void onError(const network::Downloader::Error &error); + virtual void onError(const network::DownloadTask& task, + int errorCode, + int errorCodeInternal, + const std::string& errorStr); /** @brief Call back function for recording downloading percent of the current asset, the progression will then be reported to user's listener registed in addUpdateProgressEventListener @@ -185,6 +187,7 @@ protected: virtual void onSuccess(const std::string &srcUrl, const std::string &storagePath, const std::string &customId); private: + void batchDownload(); //! The event of the current AssetsManagerEx in event dispatcher std::string _eventName; @@ -231,10 +234,10 @@ private: bool _waitToUpdate; //! All assets unit to download - network::DownloadUnits _downloadUnits; + DownloadUnits _downloadUnits; //! All failed units - network::DownloadUnits _failedUnits; + DownloadUnits _failedUnits; //! All files to be decompressed std::vector _compressedFiles; diff --git a/extensions/assets-manager/Manifest.cpp b/extensions/assets-manager/Manifest.cpp index 3dc78a577f..c5c7d1cc6f 100644 --- a/extensions/assets-manager/Manifest.cpp +++ b/extensions/assets-manager/Manifest.cpp @@ -209,7 +209,7 @@ std::unordered_map Manifest::genDiff(const Man return diff_map; } -void Manifest::genResumeAssetsList(network::DownloadUnits *units) const +void Manifest::genResumeAssetsList(DownloadUnits *units) const { for (auto it = _assets.begin(); it != _assets.end(); ++it) { @@ -217,18 +217,10 @@ void Manifest::genResumeAssetsList(network::DownloadUnits *units) const if (asset.downloadState != DownloadState::SUCCESSED) { - network::DownloadUnit unit; + DownloadUnit unit; unit.customId = it->first; unit.srcUrl = _packageUrl + asset.path; unit.storagePath = _manifestRoot + asset.path; - if (asset.downloadState == DownloadState::DOWNLOADING) - { - unit.resumeDownload = true; - } - else - { - unit.resumeDownload = false; - } units->emplace(unit.customId, unit); } } diff --git a/extensions/assets-manager/Manifest.h b/extensions/assets-manager/Manifest.h index 767eb6de72..437ffbdb1e 100644 --- a/extensions/assets-manager/Manifest.h +++ b/extensions/assets-manager/Manifest.h @@ -32,12 +32,20 @@ #include "extensions/ExtensionMacros.h" #include "extensions/ExtensionExport.h" #include "network/CCDownloader.h" - +#include "platform/CCFileUtils.h" #include "json/document.h" NS_CC_EXT_BEGIN +struct DownloadUnit +{ + std::string srcUrl; + std::string storagePath; + std::string customId; +}; + +typedef std::unordered_map DownloadUnits; class CC_EX_DLL Manifest : public Ref { @@ -135,7 +143,7 @@ protected: /** @brief Generate resuming download assets list * @param units The download units reference to be modified by the generation result */ - void genResumeAssetsList(network::DownloadUnits *units) const; + void genResumeAssetsList(DownloadUnits *units) const; /** @brief Prepend all search paths to the FileUtils. */ diff --git a/external/config.json b/external/config.json index a653cc9f0d..eafbbb13c0 100644 --- a/external/config.json +++ b/external/config.json @@ -1,5 +1,5 @@ { - "version":"v3-deps-72", + "version":"v3-deps-73", "zip_file_size":"119277304", "repo_name":"cocos2d-x-3rd-party-libs-bin", "repo_parent":"https://github.com/cocos2d/", diff --git a/templates/cocos2dx_files.json b/templates/cocos2dx_files.json index 3683794f2a..ea86f79b83 100644 --- a/templates/cocos2dx_files.json +++ b/templates/cocos2dx_files.json @@ -3,6 +3,7 @@ "AUTHORS", "CHANGELOG", "CMakeLists.txt", + "CONTRIBUTING.md", "README.cmake", "README.md", "build/android-build.py", @@ -807,10 +808,14 @@ "cocos/navmesh/CCNavMeshUtils.h", "cocos/navmesh/CMakeLists.txt", "cocos/network/Android.mk", + "cocos/network/CCDownloader-android.cpp", + "cocos/network/CCDownloader-android.h", + "cocos/network/CCDownloader-apple.h", + "cocos/network/CCDownloader-apple.mm", + "cocos/network/CCDownloader-curl.cpp", + "cocos/network/CCDownloader-curl.h", "cocos/network/CCDownloader.cpp", "cocos/network/CCDownloader.h", - "cocos/network/CCDownloaderImpl.cpp", - "cocos/network/CCDownloaderImpl.h", "cocos/network/CCIDownloaderImpl.h", "cocos/network/CMakeLists.txt", "cocos/network/HttpAsynConnection-apple.h", @@ -830,6 +835,8 @@ "cocos/network/SocketIO.h", "cocos/network/WebSocket.cpp", "cocos/network/WebSocket.h", + "cocos/physics/CCComponentPhysics2d.cpp", + "cocos/physics/CCComponentPhysics2d.h", "cocos/physics/CCPhysicsBody.cpp", "cocos/physics/CCPhysicsBody.h", "cocos/physics/CCPhysicsContact.cpp", @@ -837,6 +844,8 @@ "cocos/physics/CCPhysicsHelper.h", "cocos/physics/CCPhysicsJoint.cpp", "cocos/physics/CCPhysicsJoint.h", + "cocos/physics/CCPhysicsManager.cpp", + "cocos/physics/CCPhysicsManager.h", "cocos/physics/CCPhysicsShape.cpp", "cocos/physics/CCPhysicsShape.h", "cocos/physics/CCPhysicsWorld.cpp", @@ -924,6 +933,7 @@ "cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxAccelerometer.java", "cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java", "cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxBitmap.java", + "cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxDownloader.java", "cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxEditBox.java", "cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxEditBoxHelper.java", "cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxGLSurfaceView.java", @@ -1195,6 +1205,8 @@ "cocos/ui/UIEditBox/UIEditBox.h", "cocos/ui/UIEditBox/UIEditBoxImpl-android.cpp", "cocos/ui/UIEditBox/UIEditBoxImpl-android.h", + "cocos/ui/UIEditBox/UIEditBoxImpl-common.cpp", + "cocos/ui/UIEditBox/UIEditBoxImpl-common.h", "cocos/ui/UIEditBox/UIEditBoxImpl-ios.h", "cocos/ui/UIEditBox/UIEditBoxImpl-ios.mm", "cocos/ui/UIEditBox/UIEditBoxImpl-mac.h", @@ -1205,6 +1217,17 @@ "cocos/ui/UIEditBox/UIEditBoxImpl-winrt.cpp", "cocos/ui/UIEditBox/UIEditBoxImpl-winrt.h", "cocos/ui/UIEditBox/UIEditBoxImpl.h", + "cocos/ui/UIEditBox/iOS/CCUIEditBoxIOS.h", + "cocos/ui/UIEditBox/iOS/CCUIEditBoxIOS.mm", + "cocos/ui/UIEditBox/iOS/CCUIMultilineTextField.h", + "cocos/ui/UIEditBox/iOS/CCUIMultilineTextField.mm", + "cocos/ui/UIEditBox/iOS/CCUISingleLineTextField.h", + "cocos/ui/UIEditBox/iOS/CCUISingleLineTextField.mm", + "cocos/ui/UIEditBox/iOS/CCUITextInput.h", + "cocos/ui/UIEditBox/iOS/UITextField+CCUITextInput.h", + "cocos/ui/UIEditBox/iOS/UITextField+CCUITextInput.mm", + "cocos/ui/UIEditBox/iOS/UITextView+CCUITextInput.h", + "cocos/ui/UIEditBox/iOS/UITextView+CCUITextInput.mm", "cocos/ui/UIHBox.cpp", "cocos/ui/UIHBox.h", "cocos/ui/UIHelper.cpp", @@ -1265,7 +1288,6 @@ "cocos/ui/proj.win32/libui.vcxproj", "cocos/ui/proj.win32/libui.vcxproj.filters", "docs/CODING_STYLE.md", - "docs/CONTRIBUTE.md", "docs/Groups.h", "docs/MainPage.h", "docs/MainPageWhiteBook.h", @@ -5229,6 +5251,8 @@ "tools/fbx-conv/mac/libfbxsdk.dylib", "tools/missing-tools.txt", "tools/particle/convert_YCoordFlipped.py", + "tools/performance-analyze/README.md", + "tools/performance-analyze/convertor.py", "tools/simulator/.cocos-project.json", "tools/simulator/.project", "tools/simulator/config.json", @@ -6474,6 +6498,7 @@ "cocos/scripting/lua-bindings/auto/api/ComExtensionData.lua", "cocos/scripting/lua-bindings/auto/api/ComRender.lua", "cocos/scripting/lua-bindings/auto/api/Component.lua", + "cocos/scripting/lua-bindings/auto/api/ComponentPhysics2d.lua", "cocos/scripting/lua-bindings/auto/api/Console.lua", "cocos/scripting/lua-bindings/auto/api/ContourData.lua", "cocos/scripting/lua-bindings/auto/api/Control.lua", @@ -6676,6 +6701,7 @@ "cocos/scripting/lua-bindings/auto/api/PhysicsJointRotaryLimit.lua", "cocos/scripting/lua-bindings/auto/api/PhysicsJointRotarySpring.lua", "cocos/scripting/lua-bindings/auto/api/PhysicsJointSpring.lua", + "cocos/scripting/lua-bindings/auto/api/PhysicsManager.lua", "cocos/scripting/lua-bindings/auto/api/PhysicsShape.lua", "cocos/scripting/lua-bindings/auto/api/PhysicsShapeBox.lua", "cocos/scripting/lua-bindings/auto/api/PhysicsShapeCircle.lua", diff --git a/templates/cpp-template-default/cocos-project-template.json b/templates/cpp-template-default/cocos-project-template.json index 4bca350bc7..e5e3104fa3 100644 --- a/templates/cpp-template-default/cocos-project-template.json +++ b/templates/cpp-template-default/cocos-project-template.json @@ -49,6 +49,7 @@ "proj.android/build.xml", "proj.android/res/values/strings.xml", "proj.android-studio/settings.gradle", + "proj.android-studio/app/res/values/strings.xml", "proj.ios_mac/ios/main.m", "proj.ios_mac/ios/Prefix.pch", "proj.ios_mac/PROJECT_NAME.xcodeproj/project.pbxproj", diff --git a/templates/js-template-default/cocos-project-template.json b/templates/js-template-default/cocos-project-template.json index d069a1fdce..e0277c40dc 100644 --- a/templates/js-template-default/cocos-project-template.json +++ b/templates/js-template-default/cocos-project-template.json @@ -66,6 +66,7 @@ "frameworks/runtime-src/proj.android/build.xml", "frameworks/runtime-src/proj.android/res/values/strings.xml", "frameworks/runtime-src/proj.android-studio/settings.gradle", + "frameworks/runtime-src/proj.android-studio/app/res/values/strings.xml", "frameworks/runtime-src/proj.ios_mac/ios/main.m", "frameworks/runtime-src/proj.ios_mac/ios/Prefix.pch", "frameworks/runtime-src/proj.ios_mac/PROJECT_NAME.xcodeproj/project.pbxproj", diff --git a/templates/js-template-default/frameworks/runtime-src/proj.android/.project b/templates/js-template-default/frameworks/runtime-src/proj.android/.project index 2509d6ba53..506d4d652f 100644 --- a/templates/js-template-default/frameworks/runtime-src/proj.android/.project +++ b/templates/js-template-default/frameworks/runtime-src/proj.android/.project @@ -44,7 +44,7 @@ jsjavabridge 2 - PARENT-2-PROJECT_LOC/js-bindings/bindings/manual/platform/android/java/src + PARENT-2-PROJECT_LOC/cocos2d-x/cocos/platform/android/java/src diff --git a/templates/js-template-default/frameworks/runtime-src/proj.android/build_native.py b/templates/js-template-default/frameworks/runtime-src/proj.android/build_native.py index 31c3ef4513..576b43e3ef 100755 --- a/templates/js-template-default/frameworks/runtime-src/proj.android/build_native.py +++ b/templates/js-template-default/frameworks/runtime-src/proj.android/build_native.py @@ -136,7 +136,7 @@ def copy_resources(app_android_root): resources_dir = os.path.join(app_android_root, "../../../src") copy_files(resources_dir, assets_scripts_dir) - resources_dir = os.path.join(app_android_root, "../../../frameworks/js-bindings/bindings/script") + resources_dir = os.path.join(app_android_root, "../../../frameworks/cocos2d-x/cocos/js-bindings/bindings/script") copy_files(resources_dir, assets_jsb_dir) def build(targets,ndk_build_param,build_mode): @@ -145,7 +145,7 @@ def build(targets,ndk_build_param,build_mode): sdk_root = None project_root = os.path.dirname(os.path.realpath(__file__)) - cocos_root = os.path.join(project_root, "..", "..", "..", "frameworks/js-bindings/cocos2d-x") + cocos_root = os.path.join(project_root, "..", "..", "cocos2d-x") print cocos_root diff --git a/templates/lua-template-default/cocos-project-template.json b/templates/lua-template-default/cocos-project-template.json index fb4eedf4e6..6d44944420 100644 --- a/templates/lua-template-default/cocos-project-template.json +++ b/templates/lua-template-default/cocos-project-template.json @@ -174,6 +174,7 @@ "frameworks/runtime-src/proj.android/build.xml", "frameworks/runtime-src/proj.android/res/values/strings.xml", "frameworks/runtime-src/proj.android-studio/settings.gradle", + "frameworks/runtime-src/proj.android-studio/app/res/values/strings.xml", "frameworks/runtime-src/proj.ios_mac/ios/main.m", "frameworks/runtime-src/proj.ios_mac/ios/Prefix.pch", "frameworks/runtime-src/proj.ios_mac/mac/SimulatorApp.mm", diff --git a/templates/lua-template-runtime/cocos-project-template.json b/templates/lua-template-runtime/cocos-project-template.json index 0671b8e5a2..a4f6b3779c 100644 --- a/templates/lua-template-runtime/cocos-project-template.json +++ b/templates/lua-template-runtime/cocos-project-template.json @@ -174,6 +174,7 @@ "frameworks/runtime-src/proj.android/build.xml", "frameworks/runtime-src/proj.android/res/values/strings.xml", "frameworks/runtime-src/proj.android-studio/settings.gradle", + "frameworks/runtime-src/proj.android-studio/app/res/values/strings.xml", "frameworks/runtime-src/proj.ios_mac/ios/main.m", "frameworks/runtime-src/proj.ios_mac/ios/Prefix.pch", "frameworks/runtime-src/proj.ios_mac/mac/SimulatorApp.mm", diff --git a/tests/cpp-tests/CMakeLists.txt b/tests/cpp-tests/CMakeLists.txt index d069093461..7f0b58af5b 100644 --- a/tests/cpp-tests/CMakeLists.txt +++ b/tests/cpp-tests/CMakeLists.txt @@ -113,21 +113,6 @@ set(TESTS_SRC Classes/ParallaxTest/ParallaxTest.cpp Classes/Particle3DTest/Particle3DTest.cpp Classes/ParticleTest/ParticleTest.cpp - Classes/PerformanceTest/PerformanceAllocTest.cpp - Classes/PerformanceTest/PerformanceCallbackTest.cpp - Classes/PerformanceTest/PerformanceContainerTest.cpp - Classes/PerformanceTest/PerformanceEventDispatcherTest.cpp - Classes/PerformanceTest/PerformanceLabelTest.cpp - Classes/PerformanceTest/PerformanceMathTest.cpp - Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp - Classes/PerformanceTest/PerformanceParticle3DTest.cpp - Classes/PerformanceTest/PerformanceParticleTest.cpp - Classes/PerformanceTest/PerformanceRendererTest.cpp - Classes/PerformanceTest/PerformanceScenarioTest.cpp - Classes/PerformanceTest/PerformanceSpriteTest.cpp - Classes/PerformanceTest/PerformanceTest.cpp - Classes/PerformanceTest/PerformanceTextureTest.cpp - Classes/PerformanceTest/PerformanceTouchesTest.cpp Classes/PhysicsTest/PhysicsTest.cpp Classes/ReleasePoolTest/ReleasePoolTest.cpp Classes/RenderTextureTest/RenderTextureTest.cpp diff --git a/tests/cpp-tests/Classes/DownloaderTest/DownloaderTest.cpp b/tests/cpp-tests/Classes/DownloaderTest/DownloaderTest.cpp index 663f163c94..7c36e30ef7 100644 --- a/tests/cpp-tests/Classes/DownloaderTest/DownloaderTest.cpp +++ b/tests/cpp-tests/Classes/DownloaderTest/DownloaderTest.cpp @@ -27,236 +27,298 @@ #include "../testResource.h" +#include "cocos/ui/UILoadingBar.h" #include "network/CCDownloader.h" USING_NS_CC; -DownloaderTests::DownloaderTests() +static const char* sURLList[] = { - ADD_TEST_CASE(DownloaderSyncTest); - ADD_TEST_CASE(DownloaderAsyncTest); - ADD_TEST_CASE(DownloaderBatchSyncTest); - ADD_TEST_CASE(DownloaderBatchAsyncTest); + "http://www.cocos2d-x.org/attachments/802/cocos2dx_landscape.png", + "http://www.cocos2d-x.org/docs/manual/framework/native/wiki/logo-resources-of-cocos2d-x/res/2dx_icon_512_rounded.png", + "http://www.cocos2d-x.org/attachments/1503/Cocos2CoordinateRelease.png", + "http://download.sdkbox.com/installer/v1/sdkbox-iap_v1.2.3.3.tar.gz", +}; +const static int sListSize = (sizeof(sURLList)/sizeof(sURLList[0])); +static const char* sNameList[sListSize] = +{ + "cocos2dx_landscape.png", + "2dx_icon_512_rounded.png", + "Cocos2CoordinateRelease.png", + "big file", }; -// -// -// -DownloaderBaseTest::DownloaderBaseTest() +struct DownloaderTest : public TestCase { - _downloader = std::shared_ptr(new network::Downloader); - _downloader->setErrorCallback(std::bind(&DownloaderBaseTest::errorCallback, this, std::placeholders::_1)); - _downloader->setProgressCallback(std::bind(&DownloaderBaseTest::progressCallback, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4)); - _downloader->setSuccessCallback(std::bind(&DownloaderBaseTest::successCallback, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); -} + CREATE_FUNC(DownloaderTest); + + virtual std::string title() const override { return "Downloader Test"; } + + std::unique_ptr downloader; + + DownloaderTest() + { + downloader.reset(new network::Downloader()); + } + + enum { + TAG_TITLE = 1, + TAG_BUTTON, + TAG_PROGRESS_BAR, + TAG_STATUS, + TAG_SPRITE, + }; + + Node* createDownloadView(const char *name, const cocos2d::ui::Button::ccWidgetClickCallback &callback) + { + Size viewSize(220, 120); + float margin = 5; + + // create background + auto bg = ui::Scale9Sprite::createWithSpriteFrameName("button_actived.png"); + bg->setContentSize(viewSize); + + // add a titile on the top + auto title = Label::createWithTTF(name,"fonts/arial.ttf",16); + title->setTag(TAG_TITLE); + title->setAnchorPoint(Vec2(0.5, 1)); + title->setPosition(viewSize.width / 2, viewSize.height - margin); + bg->addChild(title, 10); + + // add a button on the bottom + auto btn = ui::Button::create("cocosui/animationbuttonnormal.png", + "cocosui/animationbuttonpressed.png"); + btn->setTag(TAG_BUTTON); + btn->setTitleText("Download"); + btn->setAnchorPoint(Vec2(0.5, 0)); + btn->setPosition(Vec2(viewSize.width / 2, margin)); + btn->addClickEventListener(callback); + bg->addChild(btn, 10); + + // add a progress bar + auto bar = ui::LoadingBar::create("cocosui/UIEditorTest/UISlider/silder_progressBar.png"); + bar->setTag(TAG_PROGRESS_BAR); + bar->ignoreContentAdaptWithSize(false); + bar->setAnchorPoint(Vec2(0.5, 0)); + bar->setContentSize(Size(viewSize.width - margin * 2, btn->getContentSize().height)); + bar->setPosition(btn->getPosition()); + bar->setVisible(false); + bg->addChild(bar, 10); -std::string DownloaderBaseTest::title() const -{ - return "Downloader Test"; -} + // add a status label + auto label = Label::createWithTTF("","fonts/arial.ttf",14); + label->setTag(TAG_STATUS); + label->setAnchorPoint(Vec2(0.5, 0.5)); + label->setPosition(Vec2(viewSize.width / 2, viewSize.height / 2)); + label->setContentSize(Size(viewSize.width, 0)); + label->setAlignment(TextHAlignment::CENTER, TextVAlignment::CENTER); + bg->addChild(label, 20); + + return bg; + } + + virtual void onEnter() override + { + TestCase::onEnter(); + _restartTestItem->setVisible(true); + + SpriteFrameCache::getInstance()->addSpriteFramesWithFile(s_s9s_ui_plist); -void DownloaderBaseTest::errorCallback(const cocos2d::network::Downloader::Error& error) -{ - cocos2d::log("error downloading: %s - %s", error.url.c_str(), error.message.c_str()); -} - -void DownloaderBaseTest::progressCallback(double totalToDownload, double nowDownloaded, const std::string& url, const std::string& customId) -{ - cocos2d::log("download progress: %d%% - %s", (int)((nowDownloaded/totalToDownload)*100), url.c_str()); -} - -void DownloaderBaseTest::successCallback(const std::string& url, const std::string& path, const std::string& customId) -{ - cocos2d::log("download finished: %s", path.c_str()); -} - -//------------------------------------------------------------------ -// -// DownloaderSyncTest -// -//------------------------------------------------------------------ -void DownloaderSyncTest::onEnter() -{ - DownloaderBaseTest::onEnter(); - - auto menuItem = MenuItemFont::create("start download", [=](Ref* sender){ - - if (_downloader) + // add four download view in test case + Node* topRightView = createDownloadView(sNameList[0], [this](Ref*) { - - std::string path = FileUtils::getInstance()->getWritablePath() + "CppTests/DownloaderTest/cocos2d_logo_sync.jpg"; - std::string remote = "http://www.cocos2d-x.org/attachments/802/cocos2dx_landscape.png"; - cocos2d::log("Downloading '%s' into '%s'", remote.c_str(), path.c_str()); - - _downloader->downloadSync(remote, path, "download_async_test"); - } - }); - auto menu = Menu::create(menuItem, nullptr); - addChild(menu); - menu->setNormalizedPosition(Vec2(0.5, 0.5)); -} - -std::string DownloaderSyncTest::title() const -{ - return "Downloader"; -} - -std::string DownloaderSyncTest::subtitle() const -{ - return "Sync test"; -} - - -//------------------------------------------------------------------ -// -// DownloaderAsyncTest -// -//------------------------------------------------------------------ -void DownloaderAsyncTest::onEnter() -{ - DownloaderBaseTest::onEnter(); - - auto menuItem = MenuItemFont::create("start download", [=](Ref* sender){ - MenuItemFont* item = (MenuItemFont*)sender; - item->setEnabled(false); - if (_downloader) - { - std::string path = FileUtils::getInstance()->getWritablePath() + "CppTests/DownloaderTest/cocos2d_logo_async.jpg"; - std::string remote = "http://www.cocos2d-x.org/attachments/802/cocos2dx_landscape.png"; - _downloader->downloadAsync(remote, path, "download_async_test"); - - cocos2d::log("Downloading '%s' into '%s'", remote.c_str(), path.c_str()); - } - }); - auto menu = Menu::create(menuItem, nullptr); - addChild(menu); - menu->setNormalizedPosition(Vec2(0.5, 0.5)); -} - -std::string DownloaderAsyncTest::title() const -{ - return "Downloader"; -} - -std::string DownloaderAsyncTest::subtitle() const -{ - return "Async test"; -} - -//------------------------------------------------------------------ -// -// DownloaderBatchSyncTest -// -//------------------------------------------------------------------ -void DownloaderBatchSyncTest::onEnter() -{ - DownloaderBaseTest::onEnter(); - - auto menuItem = MenuItemFont::create("start download", [=](Ref* sender){ - - if (_downloader) - { - std::vector images = { - "http://www.cocos2d-x.org/attachments/802/cocos2dx_landscape.png", - "http://www.cocos2d-x.org/docs/manual/framework/native/wiki/logo-resources-of-cocos2d-x/res/2dx_icon_512_rounded.png", - "http://www.cocos2d-x.org/attachments/1503/Cocos2CoordinateRelease.png" - }; - - std::vector names = { - "cocos2dx_landscape.png", - "2dx_icon_512_rounded.png", - "Cocos2CoordinateRelease.png" - }; - - network::DownloadUnits units; - - int i=0; - for(const auto& image: images) + auto view = this->getChildByName(sNameList[0]); + auto sprite = view->getChildByTag(TAG_SPRITE); + if (sprite) { - network::DownloadUnit unit; - unit.storagePath = FileUtils::getInstance()->getWritablePath() + "CppTests/DownloaderTest/Sync/" + names[i]; - unit.srcUrl = image; - unit.customId = image; - i++; - units[image] = unit; + sprite->removeFromParentAndCleanup(true); } + auto btn = (ui::Button*)view->getChildByTag(TAG_BUTTON); + btn->setEnabled(false); + btn->setVisible(false); + auto bar = (ui::LoadingBar*)view->getChildByTag(TAG_PROGRESS_BAR); + bar->setPercent(0); + bar->setVisible(true); + this->downloader->createDownloadDataTask(sURLList[0], sNameList[0]); + }); + topRightView->setName(sNameList[0]); + topRightView->setAnchorPoint(Vec2(0, 0)); + topRightView->setPosition(VisibleRect::center()); + this->addChild(topRightView); - _downloader->batchDownloadSync(units, "sync_download"); - cocos2d::log("Downloading..."); - } - }); - auto menu = Menu::create(menuItem, nullptr); - addChild(menu); - menu->setNormalizedPosition(Vec2(0.5, 0.5)); -} - -std::string DownloaderBatchSyncTest::title() const -{ - return "Downloader"; -} - -std::string DownloaderBatchSyncTest::subtitle() const -{ - return "Batch Sync test"; -} - - -//------------------------------------------------------------------ -// -// DownloaderBatchAsyncTest -// -//------------------------------------------------------------------ -void DownloaderBatchAsyncTest::onEnter() -{ - DownloaderBaseTest::onEnter(); - - auto menuItem = MenuItemFont::create("start download", [=](Ref* sender){ - - if (_downloader) + Node* topLeftView = createDownloadView(sNameList[1], [this](Ref*) { - std::vector images = { - "http://www.cocos2d-x.org/attachments/802/cocos2dx_landscape.png", - "http://www.cocos2d-x.org/docs/manual/framework/native/wiki/logo-resources-of-cocos2d-x/res/2dx_icon_512_rounded.png", - "http://www.cocos2d-x.org/attachments/1503/Cocos2CoordinateRelease.png" - }; - - std::vector names = { - "cocos2dx_landscape.png", - "2dx_icon_512_rounded.png", - "Cocos2CoordinateRelease.png" - }; - - network::DownloadUnits units; - - int i=0; - for(const auto& image: images) + auto view = this->getChildByName(sNameList[1]); + auto sprite = view->getChildByTag(TAG_SPRITE); + if (sprite) { - network::DownloadUnit unit; - unit.storagePath = FileUtils::getInstance()->getWritablePath() + "CppTests/DownloaderTest/Async/" + names[i]; - unit.srcUrl = image; - unit.customId = image; - i++; - units[image] = unit; + sprite->removeFromParentAndCleanup(true); } + auto btn = (ui::Button*)view->getChildByTag(TAG_BUTTON); + btn->setEnabled(false); + btn->setVisible(false); + auto bar = (ui::LoadingBar*)view->getChildByTag(TAG_PROGRESS_BAR); + bar->setPercent(0); + bar->setVisible(true); + bar->setEnabled(true); + this->downloader->createDownloadDataTask(sURLList[1], sNameList[1]); + }); + topLeftView->setName(sNameList[1]); + topLeftView->setAnchorPoint(Vec2(1, 0)); + topLeftView->setPosition(VisibleRect::center()); + this->addChild(topLeftView); - _downloader->batchDownloadAsync(units, "sync_download"); - cocos2d::log("Downloading..."); - } - }); - auto menu = Menu::create(menuItem, nullptr); - addChild(menu); - menu->setNormalizedPosition(Vec2(0.5, 0.5)); -} + Node* bottomLeftView = createDownloadView(sNameList[2], [this](Ref*) + { + auto view = this->getChildByName(sNameList[2]); + auto sprite = view->getChildByTag(TAG_SPRITE); + if (sprite) + { + sprite->removeFromParentAndCleanup(true); + } + auto btn = (ui::Button*)view->getChildByTag(TAG_BUTTON); + btn->setEnabled(false); + btn->setVisible(false); + auto bar = (ui::LoadingBar*)view->getChildByTag(TAG_PROGRESS_BAR); + bar->setPercent(0); + bar->setVisible(true); + bar->setEnabled(true); + auto path = FileUtils::getInstance()->getWritablePath() + "CppTests/DownloaderTest/" + sNameList[2]; + this->downloader->createDownloadFileTask(sURLList[2], path, sNameList[2]); + }); + bottomLeftView->setName(sNameList[2]); + bottomLeftView->setAnchorPoint(Vec2(1, 1)); + bottomLeftView->setPosition(VisibleRect::center()); + this->addChild(bottomLeftView); -std::string DownloaderBatchAsyncTest::title() const + Node* bottomRightView = createDownloadView(sNameList[3], [this](Ref*) + { + auto view = this->getChildByName(sNameList[3]); + auto btn = (ui::Button*)view->getChildByTag(TAG_BUTTON); + btn->setEnabled(false); + btn->setVisible(false); + auto bar = (ui::LoadingBar*)view->getChildByTag(TAG_PROGRESS_BAR); + bar->setPercent(0); + bar->setVisible(true); + bar->setEnabled(true); + auto path = FileUtils::getInstance()->getWritablePath() + "CppTests/DownloaderTest/" + sNameList[3]; + this->downloader->createDownloadFileTask(sURLList[3], path, sNameList[3]); + }); + bottomRightView->setName(sNameList[3]); + bottomRightView->setAnchorPoint(Vec2(0, 1)); + bottomRightView->setPosition(VisibleRect::center()); + this->addChild(bottomRightView); + + // define progress callback + downloader->onTaskProgress = [this](const network::DownloadTask& task, + int64_t bytesReceived, + int64_t totalBytesReceived, + int64_t totalBytesExpected) + { + Node* view = this->getChildByName(task.identifier); + auto bar = (ui::LoadingBar*)view->getChildByTag(TAG_PROGRESS_BAR); + float percent = float(totalBytesReceived * 100) / totalBytesExpected; + bar->setPercent(percent); + char buf[32]; + sprintf(buf, "%.1f%%[total %d KB]", percent, int(totalBytesExpected/1024)); + auto status = (Label*)view->getChildByTag(TAG_STATUS); + status->setString(buf); + }; + + // define success callback + downloader->onDataTaskSuccess = [this](const cocos2d::network::DownloadTask& task, + std::vector& data) + { + // create texture from data + Texture2D* texture = nullptr; + do + { + Image img; + if (false == img.initWithImageData(data.data(), data.size())) + { + break; + } + + texture = new Texture2D(); + if (false == texture->initWithImage(&img)) + { + break; + } + auto sprite = Sprite::createWithTexture(texture); + auto view = this->getChildByName(task.identifier); + auto viewSize = view->getContentSize(); + sprite->setPosition(viewSize.width / 2, viewSize.height / 2); + auto spriteSize = sprite->getContentSize(); + float scale = MIN((viewSize.height - 20) / spriteSize.height, (viewSize.width - 20) / spriteSize.width); + sprite->setScale(scale); + view->addChild(sprite, 5, TAG_SPRITE); + + auto btn = (ui::Button*)view->getChildByTag(TAG_BUTTON); + btn->setEnabled(true); + btn->setVisible(true); + auto bar = (ui::LoadingBar*)view->getChildByTag(TAG_PROGRESS_BAR); + bar->setVisible(false); + } while (0); + CC_SAFE_RELEASE(texture); + }; + + downloader->onFileTaskSuccess = [this](const cocos2d::network::DownloadTask& task) + { + Texture2D* texture = nullptr; + do + { + auto view = this->getChildByName(task.identifier); + if (std::string::npos == task.storagePath.find(".png")) + { + // download big file success + char buf[32]; + sprintf(buf, "Download [%s] success.", task.identifier.c_str()); + auto status = (Label*)view->getChildByTag(TAG_STATUS); + status->setString(buf); + break; + } + // create sprite from file + auto sprite = Sprite::create(task.storagePath); + auto viewSize = view->getContentSize(); + sprite->setPosition(viewSize.width / 2, viewSize.height / 2); + auto spriteSize = sprite->getContentSize(); + float scale = MIN((viewSize.height - 20) / spriteSize.height, (viewSize.width - 20) / spriteSize.width); + sprite->setScale(scale); + view->addChild(sprite, 5, TAG_SPRITE); + + auto btn = (ui::Button*)view->getChildByTag(TAG_BUTTON); + btn->setEnabled(true); + btn->setVisible(true); + auto bar = (ui::LoadingBar*)view->getChildByTag(TAG_PROGRESS_BAR); + bar->setVisible(false); + } while (0); + CC_SAFE_RELEASE(texture); + }; + + // define failed callback + downloader->onTaskError = [this](const cocos2d::network::DownloadTask& task, + int errorCode, + int errorCodeInternal, + const std::string& errorStr) + { + log("Failed to download : %s, identifier(%s) error code(%d), internal error code(%d) desc(%s)" + , task.requestURL.c_str() + , task.identifier.c_str() + , errorCode + , errorCodeInternal + , errorStr.c_str()); + auto view = this->getChildByName(task.identifier); + auto status = (Label*)view->getChildByTag(TAG_STATUS); + status->setString(errorStr.length() ? errorStr : "Download failed."); + + auto btn = (ui::Button*)view->getChildByTag(TAG_BUTTON); + btn->setEnabled(true); + btn->setVisible(true); + }; + } +}; + +DownloaderTests::DownloaderTests() { - return "Downloader"; -} - -std::string DownloaderBatchAsyncTest::subtitle() const -{ - return "Batch Async test"; -} - - - + ADD_TEST_CASE(DownloaderTest); +}; diff --git a/tests/cpp-tests/Classes/DownloaderTest/DownloaderTest.h b/tests/cpp-tests/Classes/DownloaderTest/DownloaderTest.h index b7063822c2..e3dc9d3edb 100644 --- a/tests/cpp-tests/Classes/DownloaderTest/DownloaderTest.h +++ b/tests/cpp-tests/Classes/DownloaderTest/DownloaderTest.h @@ -24,68 +24,5 @@ #pragma once -#include "cocos2d.h" #include "../BaseTest.h" -#include - -#include "network/CCDownloader.h" -DEFINE_TEST_SUITE(DownloaderTests); - - -class DownloaderBaseTest : public TestCase -{ -public: - DownloaderBaseTest(); - virtual std::string title() const override; - - void errorCallback(const cocos2d::network::Downloader::Error& error); - void progressCallback(double totalToDownload, double nowDownloaded, const std::string& url, const std::string& customId); - void successCallback(const std::string& url, const std::string& path, const std::string& customId); - -protected: - std::shared_ptr _downloader; -}; - -// -// --- -// -class DownloaderSyncTest : public DownloaderBaseTest -{ -public: - CREATE_FUNC(DownloaderSyncTest); - - virtual void onEnter() override; - virtual std::string title() const override; - virtual std::string subtitle() const override; -}; - -class DownloaderAsyncTest : public DownloaderBaseTest -{ -public: - CREATE_FUNC(DownloaderAsyncTest); - - virtual void onEnter() override; - virtual std::string title() const override; - virtual std::string subtitle() const override; -}; - -class DownloaderBatchSyncTest : public DownloaderBaseTest -{ -public: - CREATE_FUNC(DownloaderBatchSyncTest); - - virtual void onEnter() override; - virtual std::string title() const override; - virtual std::string subtitle() const override; -}; - -class DownloaderBatchAsyncTest : public DownloaderBaseTest -{ -public: - CREATE_FUNC(DownloaderBatchAsyncTest); - - virtual void onEnter() override; - virtual std::string title() const override; - virtual std::string subtitle() const override; -}; - +DEFINE_TEST_SUITE(DownloaderTests); \ No newline at end of file diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceLabelTest.h b/tests/cpp-tests/Classes/PerformanceTest/PerformanceLabelTest.h deleted file mode 100644 index 4fb422e795..0000000000 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceLabelTest.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef __PERFORMANCE_LABEL_TEST_H__ -#define __PERFORMANCE_LABEL_TEST_H__ - -#include "BaseTest.h" - -DEFINE_TEST_SUITE(PerformceLabelTests); - -class LabelMainScene : public TestCase -{ -public: - static const int AUTO_TEST_NODE_NUM = 20; - - CREATE_FUNC(LabelMainScene); - - virtual ~LabelMainScene(); - - std::string title() const override; - virtual bool init() override; - void updateNodes(); - - void onIncrease(cocos2d::Ref* sender); - void onDecrease(cocos2d::Ref* sender); - - int getSubTestNum() { return 1; } - int getNodesNum() { return _quantityNodes; } - - void updateAutoTest(float dt); - void updateText(float dt); - void onAutoTest(cocos2d::Ref* sender); - - virtual void onEnter() override; - virtual void onExit() override; - - virtual void nextTestCallback(cocos2d::Ref* sender) override; - virtual void priorTestCallback(cocos2d::Ref* sender) override; - - static bool _s_autoTest; - static int _s_labelCurCase; - -private: - static const int MAX_AUTO_TEST_TIMES = 35; - static const int MAX_SUB_TEST_NUMS = 5; - static int NODE_TEST_COUNT; - - void dumpProfilerFPS(); - - void endAutoTest(); - void nextAutoTest(); - void finishAutoTest(); - - cocos2d::Layer* _labelContainer; - - int _lastRenderedCount; - int _quantityNodes; - - std::vector _vecFPS; - int _executeTimes; - - float _accumulativeTime; -}; - -#endif diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceRendererTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceRendererTest.cpp deleted file mode 100644 index df44d1e833..0000000000 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceRendererTest.cpp +++ /dev/null @@ -1,29 +0,0 @@ -// -// PerformanceRendererTest.cpp -// cocos2d_samples -// -// Created by Huabing on 1/10/14. -// -// - -#include "PerformanceRendererTest.h" -#include "PerformanceTextureTest.h" -#include "../testResource.h" - -USING_NS_CC; - -PerformceRenderTests::PerformceRenderTests() -{ - ADD_TEST_CASE(RenderPerformceTest); -} - -void RenderPerformceTest::onEnter() -{ - TestCase::onEnter(); - auto map = TMXTiledMap::create("TileMaps/map/sl.tmx"); - - Size CC_UNUSED s = map->getContentSize(); - CCLOG("ContentSize: %f, %f", s.width,s.height); - - addChild(map,-1); -} diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceRendererTest.h b/tests/cpp-tests/Classes/PerformanceTest/PerformanceRendererTest.h deleted file mode 100644 index fbcf7a04f6..0000000000 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceRendererTest.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// PerformanceRendererTest.h -// cocos2d_samples -// -// Created by Huabing on 1/10/14. -// -// - -#ifndef __PERFORMANCE_RENDERER_TEST_H__ -#define __PERFORMANCE_RENDERER_TEST_H__ - -#include "BaseTest.h" - -DEFINE_TEST_SUITE(PerformceRenderTests); - -class RenderPerformceTest : public TestCase -{ -public: - CREATE_FUNC(RenderPerformceTest); - - virtual void onEnter() override; -}; - -#endif diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceTest.cpp deleted file mode 100644 index 07fa5b2486..0000000000 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceTest.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include "PerformanceTest.h" -#include "../testResource.h" -#include "PerformanceNodeChildrenTest.h" -#include "PerformanceParticleTest.h" -#include "PerformanceParticle3DTest.h" -#include "PerformanceSpriteTest.h" -#include "PerformanceTextureTest.h" -#include "PerformanceTouchesTest.h" -#include "PerformanceAllocTest.h" -#include "PerformanceLabelTest.h" -#include "PerformanceContainerTest.h" -#include "PerformanceEventDispatcherTest.h" -#include "PerformanceScenarioTest.h" -#include "PerformanceCallbackTest.h" -#include "PerformanceMathTest.h" - -USING_NS_CC; - -PerformanceTests::PerformanceTests() -{ - addTest("Alloc Test", [](){ return new (std::nothrow) PerformceAllocTests; }); - addTest("NodeChildren Test", [](){ return new (std::nothrow) PerformceNodeChildrenTests; }); - addTest("Particle Test", [](){ return new (std::nothrow) PerformceParticleTests; }); - addTest("Particle3D Perf Test", [](){ return new (std::nothrow) PerformceParticle3DTests; }); - addTest("Sprite Perf Test", [](){ return new (std::nothrow) PerformceSpriteTests; }); - addTest("Texture Perf Test", [](){ return new (std::nothrow) PerformceTextureTests; }); - addTest("Touches Perf Test", [](){ return new (std::nothrow) PerformceTouchesTests; }); - addTest("Label Perf Test", [](){ return new (std::nothrow) PerformceLabelTests; }); - addTest("Container Perf Test", []() { return new (std::nothrow) PerformceContainerTests; }); - addTest("EventDispatcher Perf Test", []() { return new (std::nothrow) PerformceEventDispatcherTests; }); - addTest("Scenario Perf Test", []() { return new (std::nothrow) PerformceScenarioTests; }); - addTest("Callback Perf Test", []() { return new (std::nothrow) PerformceCallbackTests; }); - addTest("Math Perf Test", []() { return new (std::nothrow) PerformceMathTests; }); -} diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceTest.h b/tests/cpp-tests/Classes/PerformanceTest/PerformanceTest.h deleted file mode 100644 index 3c357c0ac4..0000000000 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceTest.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef __PERFORMANCE_TEST_H__ -#define __PERFORMANCE_TEST_H__ - -#include "BaseTest.h" - -DEFINE_TEST_LIST(PerformanceTests); - -#endif diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceTouchesTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceTouchesTest.cpp deleted file mode 100644 index bedb5693bf..0000000000 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceTouchesTest.cpp +++ /dev/null @@ -1,251 +0,0 @@ -#include "PerformanceTouchesTest.h" - -USING_NS_CC; - -// Enable profiles for this file -#undef CC_PROFILER_DISPLAY_TIMERS -#define CC_PROFILER_DISPLAY_TIMERS() Profiler::getInstance()->displayTimers() -#undef CC_PROFILER_PURGE_ALL -#define CC_PROFILER_PURGE_ALL() Profiler::getInstance()->releaseAllTimers() - -#undef CC_PROFILER_START -#define CC_PROFILER_START(__name__) ProfilingBeginTimingBlock(__name__) -#undef CC_PROFILER_STOP -#define CC_PROFILER_STOP(__name__) ProfilingEndTimingBlock(__name__) -#undef CC_PROFILER_RESET -#define CC_PROFILER_RESET(__name__) ProfilingResetTimingBlock(__name__) - -#undef CC_PROFILER_START_CATEGORY -#define CC_PROFILER_START_CATEGORY(__cat__, __name__) do{ if(__cat__) ProfilingBeginTimingBlock(__name__); } while(0) -#undef CC_PROFILER_STOP_CATEGORY -#define CC_PROFILER_STOP_CATEGORY(__cat__, __name__) do{ if(__cat__) ProfilingEndTimingBlock(__name__); } while(0) -#undef CC_PROFILER_RESET_CATEGORY -#define CC_PROFILER_RESET_CATEGORY(__cat__, __name__) do{ if(__cat__) ProfilingResetTimingBlock(__name__); } while(0) - -#undef CC_PROFILER_START_INSTANCE -#define CC_PROFILER_START_INSTANCE(__id__, __name__) do{ ProfilingBeginTimingBlock( String::createWithFormat("%08X - %s", __id__, __name__)->getCString() ); } while(0) -#undef CC_PROFILER_STOP_INSTANCE -#define CC_PROFILER_STOP_INSTANCE(__id__, __name__) do{ ProfilingEndTimingBlock( String::createWithFormat("%08X - %s", __id__, __name__)->getCString() ); } while(0) -#undef CC_PROFILER_RESET_INSTANCE -#define CC_PROFILER_RESET_INSTANCE(__id__, __name__) do{ ProfilingResetTimingBlock( String::createWithFormat("%08X - %s", __id__, __name__)->getCString() ); } while(0) - -PerformceTouchesTests::PerformceTouchesTests() -{ - ADD_TEST_CASE(TouchesPerformTest1); - ADD_TEST_CASE(TouchesPerformTest2); - ADD_TEST_CASE(TouchesPerformTest3); -} - -//////////////////////////////////////////////////////// -// -// TouchesMainScene -// -//////////////////////////////////////////////////////// - -void TouchesMainScene::onEnter() -{ - TestCase::onEnter(); - - auto s = Director::getInstance()->getWinSize(); - - scheduleUpdate(); - - _plabel = Label::createWithBMFont("fonts/arial16.fnt","00.0"); - _plabel->setPosition(Vec2(s.width/2, s.height/2)); - addChild(_plabel); - - elapsedTime = 0; - numberOfTouchesB = numberOfTouchesM = numberOfTouchesE = numberOfTouchesC = 0; -} - -void TouchesMainScene::update(float dt) -{ - elapsedTime += dt; - - if ( elapsedTime > 1.0f) - { - float frameRateB = numberOfTouchesB / elapsedTime; - float frameRateM = numberOfTouchesM / elapsedTime; - float frameRateE = numberOfTouchesE / elapsedTime; - float frameRateC = numberOfTouchesC / elapsedTime; - elapsedTime = 0; - numberOfTouchesB = numberOfTouchesM = numberOfTouchesE = numberOfTouchesC = 0; - - char str[32] = {0}; - sprintf(str, "%.1f %.1f %.1f %.1f", frameRateB, frameRateM, frameRateE, frameRateC); - _plabel->setString(str); - } -} - -//////////////////////////////////////////////////////// -// -// TouchesPerformTest1 -// -//////////////////////////////////////////////////////// -void TouchesPerformTest1::onEnter() -{ - TouchesMainScene::onEnter(); - auto listener = EventListenerTouchOneByOne::create(); - listener->setSwallowTouches(true); - listener->onTouchBegan = CC_CALLBACK_2(TouchesPerformTest1::onTouchBegan, this); - listener->onTouchMoved = CC_CALLBACK_2(TouchesPerformTest1::onTouchMoved, this); - listener->onTouchEnded = CC_CALLBACK_2(TouchesPerformTest1::onTouchEnded, this); - listener->onTouchCancelled = CC_CALLBACK_2(TouchesPerformTest1::onTouchCancelled, this); - _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); -} - -std::string TouchesPerformTest1::title() const -{ - return "Targeted touches"; -} - -bool TouchesPerformTest1::onTouchBegan(Touch* touch, Event* event) -{ - numberOfTouchesB++; - return true; -} - -void TouchesPerformTest1::onTouchMoved(Touch* touch, Event* event) -{ - numberOfTouchesM++; -} - -void TouchesPerformTest1::onTouchEnded(Touch* touch, Event* event) -{ - numberOfTouchesE++; -} - -void TouchesPerformTest1::onTouchCancelled(Touch* touch, Event* event) -{ - numberOfTouchesC++; -} - -//////////////////////////////////////////////////////// -// -// TouchesPerformTest2 -// -//////////////////////////////////////////////////////// -void TouchesPerformTest2::onEnter() -{ - TouchesMainScene::onEnter(); - - auto listener = EventListenerTouchAllAtOnce::create(); - listener->onTouchesBegan = CC_CALLBACK_2(TouchesPerformTest2::onTouchesBegan, this); - listener->onTouchesMoved = CC_CALLBACK_2(TouchesPerformTest2::onTouchesMoved, this); - listener->onTouchesEnded = CC_CALLBACK_2(TouchesPerformTest2::onTouchesEnded, this); - listener->onTouchesCancelled = CC_CALLBACK_2(TouchesPerformTest2::onTouchesCancelled, this); - _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); -} - -std::string TouchesPerformTest2::title() const -{ - return "Standard touches"; -} - -void TouchesPerformTest2::onTouchesBegan(const std::vector& touches, Event* event) -{ - numberOfTouchesB += touches.size(); -} - -void TouchesPerformTest2::onTouchesMoved(const std::vector& touches, Event* event) -{ - numberOfTouchesM += touches.size(); -} -void TouchesPerformTest2::onTouchesEnded(const std::vector& touches, Event* event) -{ - numberOfTouchesE += touches.size(); -} - -void TouchesPerformTest2::onTouchesCancelled(const std::vector& touches, Event* event) -{ - numberOfTouchesC += touches.size(); -} - -//////////////////////////////////////////////////////// -// -// TouchesPerformTest3 -// -//////////////////////////////////////////////////////// - -class TouchableLayer : public Layer -{ -public: - bool onTouchBegan(Touch *touch, Event *event) - { - return false; - } - void onTouchMoved(Touch *touch, Event *event) {} - void onTouchEnded(Touch *touch, Event *event) {} - void onTouchCancelled(Touch *touch, Event *event) {} -}; - -void TouchesPerformTest3::onEnter() -{ - TestCase::onEnter(); - - auto s = Director::getInstance()->getWinSize(); - -#define TOUCH_PROFILER_NAME "TouchProfileName" -#define TOUCHABLE_NODE_NUM 1000 - - srand((unsigned)time(nullptr)); - - for (int i = 0; i < TOUCHABLE_NODE_NUM; ++i) - { - int zorder = rand() % TOUCHABLE_NODE_NUM; - auto layer = new (std::nothrow) TouchableLayer(); - - auto listener = EventListenerTouchOneByOne::create(); - listener->onTouchBegan = CC_CALLBACK_2(TouchableLayer::onTouchBegan, layer); - listener->onTouchMoved = CC_CALLBACK_2(TouchableLayer::onTouchMoved, layer); - listener->onTouchEnded = CC_CALLBACK_2(TouchableLayer::onTouchEnded, layer); - listener->onTouchCancelled = CC_CALLBACK_2(TouchableLayer::onTouchCancelled, layer); - _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, layer); - - addChild(layer, zorder); - layer->release(); - } - - auto emitEventlabel = Label::createWithSystemFont("Emit Touch Event", "", 24); - auto menuItem = MenuItemLabel::create(emitEventlabel, [this](Ref* sender){ - - CC_PROFILER_PURGE_ALL(); - - std::vector touches; - for (int i = 0; i < EventTouch::MAX_TOUCHES; ++i) - { - Touch* touch = new (std::nothrow) Touch(); - touch->setTouchInfo(i, 10, (i+1) * 10); - touches.push_back(touch); - } - - EventTouch event; - event.setEventCode(EventTouch::EventCode::BEGAN); - event.setTouches(touches); - - for (int i = 0; i < 100; ++i) - { - CC_PROFILER_START(TOUCH_PROFILER_NAME); - - _eventDispatcher->dispatchEvent(&event); - - CC_PROFILER_STOP(TOUCH_PROFILER_NAME); - } - - CC_PROFILER_DISPLAY_TIMERS(); - - for (auto& touch : touches) - { - touch->release(); - } - }); - - menuItem->setPosition(Vec2(0, -20)); - auto menu = Menu::create(menuItem, nullptr); - addChild(menu); -} - -std::string TouchesPerformTest3::title() const -{ - return "Touch Event Perf Test"; -} diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceTouchesTest.h b/tests/cpp-tests/Classes/PerformanceTest/PerformanceTouchesTest.h deleted file mode 100644 index 2fdca344ef..0000000000 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceTouchesTest.h +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef __PERFORMANCE_TOUCHES_TEST_H__ -#define __PERFORMANCE_TOUCHES_TEST_H__ - -#include "BaseTest.h" - -DEFINE_TEST_SUITE(PerformceTouchesTests); - -class TouchesMainScene : public TestCase -{ -public: - virtual void onEnter() override; - virtual void update(float dt) override; - -protected: - cocos2d::Label* _plabel; - int numberOfTouchesB; - int numberOfTouchesM; - int numberOfTouchesE; - int numberOfTouchesC; - float elapsedTime; -}; - -class TouchesPerformTest1 : public TouchesMainScene -{ -public: - CREATE_FUNC(TouchesPerformTest1); - - virtual void onEnter() override; - virtual std::string title() const override; - - bool onTouchBegan(cocos2d::Touch* touch, cocos2d::Event* event); - void onTouchMoved(cocos2d::Touch* touch, cocos2d::Event* event); - void onTouchEnded(cocos2d::Touch* touch, cocos2d::Event* event); - void onTouchCancelled(cocos2d::Touch* touch, cocos2d::Event* event); -}; - -class TouchesPerformTest2 : public TouchesMainScene -{ -public: - CREATE_FUNC(TouchesPerformTest2); - - virtual void onEnter() override; - virtual std::string title() const override; - - void onTouchesBegan(const std::vector& touches, cocos2d::Event* event); - void onTouchesMoved(const std::vector& touches, cocos2d::Event* event); - void onTouchesEnded(const std::vector& touches, cocos2d::Event* event); - void onTouchesCancelled(const std::vector& touches, cocos2d::Event* event); -}; - -class TouchesPerformTest3 : public TestCase -{ -public: - CREATE_FUNC(TouchesPerformTest3); - - virtual void onEnter() override; - virtual std::string title() const override; -}; - - -#endif diff --git a/tests/cpp-tests/Classes/PhysicsTest/PhysicsTest.cpp b/tests/cpp-tests/Classes/PhysicsTest/PhysicsTest.cpp index c4441e7099..b63d7b63fd 100644 --- a/tests/cpp-tests/Classes/PhysicsTest/PhysicsTest.cpp +++ b/tests/cpp-tests/Classes/PhysicsTest/PhysicsTest.cpp @@ -1,18 +1,22 @@ #include "PhysicsTest.h" + +#if CC_USE_PHYSICS + #include -#include "../testResource.h" #include "ui/CocosGUI.h" +#include "physics/CCComponentPhysics2d.h" +#include "../testResource.h" + USING_NS_CC; PhysicsTests::PhysicsTests() { -#if CC_USE_PHYSICS ADD_TEST_CASE(PhysicsDemoLogoSmash); ADD_TEST_CASE(PhysicsDemoPyramidStack); ADD_TEST_CASE(PhysicsDemoClickAdd); ADD_TEST_CASE(PhysicsDemoRayCast); - ADD_TEST_CASE(PhysicsDemoJoints); ADD_TEST_CASE(PhysicsDemoActions); + ADD_TEST_CASE(PhysicsDemoJoints); ADD_TEST_CASE(PhysicsDemoPump); ADD_TEST_CASE(PhysicsDemoOneWayPlatform); ADD_TEST_CASE(PhysicsDemoSlice); @@ -20,38 +24,26 @@ PhysicsTests::PhysicsTests() ADD_TEST_CASE(PhysicsContactTest); ADD_TEST_CASE(PhysicsPositionRotationTest); ADD_TEST_CASE(PhysicsSetGravityEnableTest); - ADD_TEST_CASE(Bug5482); + ADD_TEST_CASE(PhysicsDemoBug5482); ADD_TEST_CASE(PhysicsFixedUpdate); ADD_TEST_CASE(PhysicsTransformTest); ADD_TEST_CASE(PhysicsIssue9959); -#else - ADD_TEST_CASE(PhysicsDemoDisabled); -#endif } - -static const Color4F STATIC_COLOR(1.0f, 0.0f, 0.0f, 1.0f); -static const int DRAG_BODYS_TAG = 0x80; + +namespace +{ + Color4F STATIC_COLOR(1.0f, 0.0f, 0.0f, 1.0f); + const int DRAG_BODYS_TAG = 0x80; +} void PhysicsDemo::toggleDebug() { #if CC_USE_PHYSICS _debugDraw = !_debugDraw; - getPhysicsWorld()->setDebugDrawMask(_debugDraw ? PhysicsWorld::DEBUGDRAW_ALL : PhysicsWorld::DEBUGDRAW_NONE); + _physicsWorld->setDebugDrawMask(_debugDraw ? PhysicsWorld::DEBUGDRAW_ALL : PhysicsWorld::DEBUGDRAW_NONE); #endif } -#if CC_USE_PHYSICS == 0 -void PhysicsDemoDisabled::onEnter() -{ - auto label = Label::createWithTTF("Should define CC_USE_PHYSICS\n to run this test case", - "fonts/arial.ttf", - 18); - auto size = Director::getInstance()->getWinSize(); - label->setPosition(Vec2(size.width/2, size.height/2)); - - addChild(label); -} -#else PhysicsDemo::PhysicsDemo() : _spriteTexture(nullptr) @@ -60,22 +52,19 @@ PhysicsDemo::PhysicsDemo() { } -PhysicsDemo::~PhysicsDemo() -{ - -} - bool PhysicsDemo::init() { - if (TestCase::init()) - { - return initWithPhysics(); - } - return false; + TestCase::init(); + return initWithPhysics(); } + +PhysicsDemo::~PhysicsDemo() +{ +} + std::string PhysicsDemo::title() const { - return "PhysicsTest"; + return "PhysicsComponentTest"; } void PhysicsDemo::onEnter() @@ -90,12 +79,12 @@ void PhysicsDemo::onEnter() auto menu = Menu::create(item, nullptr); this->addChild(menu); - menu->setPosition(Vec2(VisibleRect::right().x-50, VisibleRect::top().y-10)); + menu->setPosition(Vec2(VisibleRect::right().x - item->getContentSize().width / 2 - 10, VisibleRect::top().y - item->getContentSize().height / 2 - 10)); } Sprite* PhysicsDemo::addGrossiniAtPosition(Vec2 p, float scale/* = 1.0*/) { - CCLOG("Add sprite %0.2f x %02.f",p.x,p.y); + CCLOG("Add sprite %0.2f x %02.f", p.x, p.y); int posx, posy; @@ -106,10 +95,12 @@ Sprite* PhysicsDemo::addGrossiniAtPosition(Vec2 p, float scale/* = 1.0*/) posy = (posy % 3) * 121; auto sp = Sprite::createWithTexture(_spriteTexture, Rect(posx, posy, 85, 121)); + sp->setScale(scale); - sp->setPhysicsBody(PhysicsBody::createBox(Size(48.0f * scale, 108.0f * scale))); - this->addChild(sp); sp->setPosition(p); + addPhysicsComponent(sp, PhysicsBody::createBox(Size(48.0f, 108.0f))); + //addPhysicsComponent(sp, PhysicsBody::createCircle(sp->getContentSize().height/2)); + this->addChild(sp); return sp; } @@ -119,116 +110,56 @@ void PhysicsDemo::toggleDebugCallback(Ref* sender) toggleDebug(); } -PhysicsDemoClickAdd::~PhysicsDemoClickAdd() -{ - Device::setAccelerometerEnabled(false); -} - -void PhysicsDemoClickAdd::onEnter() -{ - PhysicsDemo::onEnter(); - - auto touchListener = EventListenerTouchAllAtOnce::create(); - touchListener->onTouchesEnded = CC_CALLBACK_2(PhysicsDemoClickAdd::onTouchesEnded, this); - _eventDispatcher->addEventListenerWithSceneGraphPriority(touchListener, this); - - Device::setAccelerometerEnabled(true); - auto accListener = EventListenerAcceleration::create(CC_CALLBACK_2(PhysicsDemoClickAdd::onAcceleration, this)); - _eventDispatcher->addEventListenerWithSceneGraphPriority(accListener, this); - - auto node = Node::create(); - node->setPhysicsBody(PhysicsBody::createEdgeBox(VisibleRect::getVisibleRect().size)); - node->setPosition(VisibleRect::center()); - this->addChild(node); - - addGrossiniAtPosition(VisibleRect::center()); -} - -std::string PhysicsDemoClickAdd::subtitle() const -{ - return "multi touch to add grossini"; -} - -void PhysicsDemoClickAdd::onTouchesEnded(const std::vector& touches, Event* event) -{ - //Add a new body/atlas sprite at the touched location - - for( auto &touch: touches) - { - auto location = touch->getLocation(); - - addGrossiniAtPosition( location ); - } -} - -void PhysicsDemoClickAdd::onAcceleration(Acceleration* acc, Event* event) -{ - static float prevX=0, prevY=0; - -#define kFilterFactor 0.05f - - float accelX = (float) acc->x * kFilterFactor + (1- kFilterFactor)*prevX; - float accelY = (float) acc->y * kFilterFactor + (1- kFilterFactor)*prevY; - - prevX = accelX; - prevY = accelY; - - auto v = Vec2( accelX, accelY); - v = v * 200; - - getPhysicsWorld()->setGravity(v); -} - namespace { - static const int logo_width = 188; - static const int logo_height = 35; - static const int logo_row_length = 24; - static const char logo_image[] = + const int LOGO_WIDTH = 188; + const int LOGO_HEIGHT = 35; + const int LOGO_RAW_LENGTH = 24; + const char LOGO_IMAGE[] = { - 15,-16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,-64,15,63,-32,-2,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,31,-64,15,127,-125,-1,-128,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,127,-64,15,127,15,-1,-64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,-1,-64,15,-2, - 31,-1,-64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,-1,-64,0,-4,63,-1,-32,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,1,-1,-64,15,-8,127,-1,-32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 1,-1,-64,0,-8,-15,-1,-32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,-31,-1,-64,15,-8,-32, - -1,-32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,-15,-1,-64,9,-15,-32,-1,-32,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,31,-15,-1,-64,0,-15,-32,-1,-32,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,63,-7,-1,-64,9,-29,-32,127,-61,-16,63,15,-61,-1,-8,31,-16,15,-8,126,7,-31, - -8,31,-65,-7,-1,-64,9,-29,-32,0,7,-8,127,-97,-25,-1,-2,63,-8,31,-4,-1,15,-13, - -4,63,-1,-3,-1,-64,9,-29,-32,0,7,-8,127,-97,-25,-1,-2,63,-8,31,-4,-1,15,-13, - -2,63,-1,-3,-1,-64,9,-29,-32,0,7,-8,127,-97,-25,-1,-1,63,-4,63,-4,-1,15,-13, - -2,63,-33,-1,-1,-32,9,-25,-32,0,7,-8,127,-97,-25,-1,-1,63,-4,63,-4,-1,15,-13, - -1,63,-33,-1,-1,-16,9,-25,-32,0,7,-8,127,-97,-25,-1,-1,63,-4,63,-4,-1,15,-13, - -1,63,-49,-1,-1,-8,9,-57,-32,0,7,-8,127,-97,-25,-8,-1,63,-2,127,-4,-1,15,-13, - -1,-65,-49,-1,-1,-4,9,-57,-32,0,7,-8,127,-97,-25,-8,-1,63,-2,127,-4,-1,15,-13, - -1,-65,-57,-1,-1,-2,9,-57,-32,0,7,-8,127,-97,-25,-8,-1,63,-2,127,-4,-1,15,-13, - -1,-1,-57,-1,-1,-1,9,-57,-32,0,7,-1,-1,-97,-25,-8,-1,63,-1,-1,-4,-1,15,-13,-1, - -1,-61,-1,-1,-1,-119,-57,-32,0,7,-1,-1,-97,-25,-8,-1,63,-1,-1,-4,-1,15,-13,-1, - -1,-61,-1,-1,-1,-55,-49,-32,0,7,-1,-1,-97,-25,-8,-1,63,-1,-1,-4,-1,15,-13,-1, - -1,-63,-1,-1,-1,-23,-49,-32,127,-57,-1,-1,-97,-25,-1,-1,63,-1,-1,-4,-1,15,-13, - -1,-1,-63,-1,-1,-1,-16,-49,-32,-1,-25,-1,-1,-97,-25,-1,-1,63,-33,-5,-4,-1,15, - -13,-1,-1,-64,-1,-9,-1,-7,-49,-32,-1,-25,-8,127,-97,-25,-1,-1,63,-33,-5,-4,-1, - 15,-13,-1,-1,-64,-1,-13,-1,-32,-49,-32,-1,-25,-8,127,-97,-25,-1,-2,63,-49,-13, - -4,-1,15,-13,-1,-1,-64,127,-7,-1,-119,-17,-15,-1,-25,-8,127,-97,-25,-1,-2,63, - -49,-13,-4,-1,15,-13,-3,-1,-64,127,-8,-2,15,-17,-1,-1,-25,-8,127,-97,-25,-1, - -8,63,-49,-13,-4,-1,15,-13,-3,-1,-64,63,-4,120,0,-17,-1,-1,-25,-8,127,-97,-25, - -8,0,63,-57,-29,-4,-1,15,-13,-4,-1,-64,63,-4,0,15,-17,-1,-1,-25,-8,127,-97, - -25,-8,0,63,-57,-29,-4,-1,-1,-13,-4,-1,-64,31,-2,0,0,103,-1,-1,-57,-8,127,-97, - -25,-8,0,63,-57,-29,-4,-1,-1,-13,-4,127,-64,31,-2,0,15,103,-1,-1,-57,-8,127, - -97,-25,-8,0,63,-61,-61,-4,127,-1,-29,-4,127,-64,15,-8,0,0,55,-1,-1,-121,-8, - 127,-97,-25,-8,0,63,-61,-61,-4,127,-1,-29,-4,63,-64,15,-32,0,0,23,-1,-2,3,-16, - 63,15,-61,-16,0,31,-127,-127,-8,31,-1,-127,-8,31,-128,7,-128,0,0 + 15, -16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, -64, 15, 63, -32, -2, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, -64, 15, 127, -125, -1, -128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 127, -64, 15, 127, 15, -1, -64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, -64, 15, -2, + 31, -1, -64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, -64, 0, -4, 63, -1, -32, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, -64, 15, -8, 127, -1, -32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, -1, -64, 0, -8, -15, -1, -32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -31, -1, -64, 15, -8, -32, + -1, -32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, -15, -1, -64, 9, -15, -32, -1, -32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, -15, -1, -64, 0, -15, -32, -1, -32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 63, -7, -1, -64, 9, -29, -32, 127, -61, -16, 63, 15, -61, -1, -8, 31, -16, 15, -8, 126, 7, -31, + -8, 31, -65, -7, -1, -64, 9, -29, -32, 0, 7, -8, 127, -97, -25, -1, -2, 63, -8, 31, -4, -1, 15, -13, + -4, 63, -1, -3, -1, -64, 9, -29, -32, 0, 7, -8, 127, -97, -25, -1, -2, 63, -8, 31, -4, -1, 15, -13, + -2, 63, -1, -3, -1, -64, 9, -29, -32, 0, 7, -8, 127, -97, -25, -1, -1, 63, -4, 63, -4, -1, 15, -13, + -2, 63, -33, -1, -1, -32, 9, -25, -32, 0, 7, -8, 127, -97, -25, -1, -1, 63, -4, 63, -4, -1, 15, -13, + -1, 63, -33, -1, -1, -16, 9, -25, -32, 0, 7, -8, 127, -97, -25, -1, -1, 63, -4, 63, -4, -1, 15, -13, + -1, 63, -49, -1, -1, -8, 9, -57, -32, 0, 7, -8, 127, -97, -25, -8, -1, 63, -2, 127, -4, -1, 15, -13, + -1, -65, -49, -1, -1, -4, 9, -57, -32, 0, 7, -8, 127, -97, -25, -8, -1, 63, -2, 127, -4, -1, 15, -13, + -1, -65, -57, -1, -1, -2, 9, -57, -32, 0, 7, -8, 127, -97, -25, -8, -1, 63, -2, 127, -4, -1, 15, -13, + -1, -1, -57, -1, -1, -1, 9, -57, -32, 0, 7, -1, -1, -97, -25, -8, -1, 63, -1, -1, -4, -1, 15, -13, -1, + -1, -61, -1, -1, -1, -119, -57, -32, 0, 7, -1, -1, -97, -25, -8, -1, 63, -1, -1, -4, -1, 15, -13, -1, + -1, -61, -1, -1, -1, -55, -49, -32, 0, 7, -1, -1, -97, -25, -8, -1, 63, -1, -1, -4, -1, 15, -13, -1, + -1, -63, -1, -1, -1, -23, -49, -32, 127, -57, -1, -1, -97, -25, -1, -1, 63, -1, -1, -4, -1, 15, -13, + -1, -1, -63, -1, -1, -1, -16, -49, -32, -1, -25, -1, -1, -97, -25, -1, -1, 63, -33, -5, -4, -1, 15, + -13, -1, -1, -64, -1, -9, -1, -7, -49, -32, -1, -25, -8, 127, -97, -25, -1, -1, 63, -33, -5, -4, -1, + 15, -13, -1, -1, -64, -1, -13, -1, -32, -49, -32, -1, -25, -8, 127, -97, -25, -1, -2, 63, -49, -13, + -4, -1, 15, -13, -1, -1, -64, 127, -7, -1, -119, -17, -15, -1, -25, -8, 127, -97, -25, -1, -2, 63, + -49, -13, -4, -1, 15, -13, -3, -1, -64, 127, -8, -2, 15, -17, -1, -1, -25, -8, 127, -97, -25, -1, + -8, 63, -49, -13, -4, -1, 15, -13, -3, -1, -64, 63, -4, 120, 0, -17, -1, -1, -25, -8, 127, -97, -25, + -8, 0, 63, -57, -29, -4, -1, 15, -13, -4, -1, -64, 63, -4, 0, 15, -17, -1, -1, -25, -8, 127, -97, + -25, -8, 0, 63, -57, -29, -4, -1, -1, -13, -4, -1, -64, 31, -2, 0, 0, 103, -1, -1, -57, -8, 127, -97, + -25, -8, 0, 63, -57, -29, -4, -1, -1, -13, -4, 127, -64, 31, -2, 0, 15, 103, -1, -1, -57, -8, 127, + -97, -25, -8, 0, 63, -61, -61, -4, 127, -1, -29, -4, 127, -64, 15, -8, 0, 0, 55, -1, -1, -121, -8, + 127, -97, -25, -8, 0, 63, -61, -61, -4, 127, -1, -29, -4, 63, -64, 15, -32, 0, 0, 23, -1, -2, 3, -16, + 63, 15, -61, -16, 0, 31, -127, -127, -8, 31, -1, -127, -8, 31, -128, 7, -128, 0, 0 }; - static inline int get_pixel(int x, int y) + int getPixel(int x, int y) { - return (logo_image[(x>>3) + y*logo_row_length]>>(~x&0x7)) & 1; + return (LOGO_IMAGE[(x >> 3) + y * LOGO_RAW_LENGTH] >> (~x & 0x7)) & 1; } - static inline float frand(void) + float frand(void) { - return rand()/RAND_MAX; + return rand() / RAND_MAX; } } @@ -236,17 +167,13 @@ Sprite* PhysicsDemo::makeBall(Vec2 point, float radius, PhysicsMaterial material { Sprite* ball = nullptr; if (_ball != nullptr) - { ball = Sprite::createWithTexture(_ball->getTexture()); - }else - { + else ball = Sprite::create("Images/ball.png"); - } ball->setScale(0.13f * radius); - auto body = PhysicsBody::createCircle(radius, material); - ball->setPhysicsBody(body); + addPhysicsComponent(ball, PhysicsBody::createCircle(ball->getContentSize().width / 2, material)); ball->setPosition(Vec2(point.x, point.y)); return ball; @@ -258,18 +185,18 @@ Sprite* PhysicsDemo::makeBox(Vec2 point, Size size, int color, PhysicsMaterial m if (color == 0) { yellow = CCRANDOM_0_1() > 0.5f; - }else + } + else { yellow = color == 1; } auto box = yellow ? Sprite::create("Images/YellowSquare.png") : Sprite::create("Images/CyanSquare.png"); + box->setScaleX(size.width / 100.0f); + box->setScaleY(size.height / 100.0f); - box->setScaleX(size.width/100.0f); - box->setScaleY(size.height/100.0f); + addPhysicsComponent(box, PhysicsBody::createBox(box->getContentSize(), material)); - auto body = PhysicsBody::createBox(size, material); - box->setPhysicsBody(body); box->setPosition(Vec2(point.x, point.y)); return box; @@ -281,26 +208,27 @@ Sprite* PhysicsDemo::makeTriangle(Vec2 point, Size size, int color, PhysicsMater if (color == 0) { yellow = CCRANDOM_0_1() > 0.5f; - }else + } + else { yellow = color == 1; } auto triangle = yellow ? Sprite::create("Images/YellowTriangle.png") : Sprite::create("Images/CyanTriangle.png"); - if(size.height == 0) + if (size.height == 0) { - triangle->setScale(size.width/100.0f); - }else + triangle->setScale(size.width / 100.0f); + } + else { - triangle->setScaleX(size.width/50.0f); - triangle->setScaleY(size.height/43.5f); + triangle->setScaleX(size.width / 50.0f); + triangle->setScaleY(size.height / 43.5f); } - Vec2 vers[] = { Vec2(0, size.height/2), Vec2(size.width/2, -size.height/2), Vec2(-size.width/2, -size.height/2)}; + Vec2 vers[] = { Vec2(0, triangle->getContentSize().height / 2), Vec2(triangle->getContentSize().width / 2, -triangle->getContentSize().height / 2), Vec2(-triangle->getContentSize().width / 2, -triangle->getContentSize().height / 2) }; - auto body = PhysicsBody::createPolygon(vers, 3, material); - triangle->setPhysicsBody(body); + addPhysicsComponent(triangle, PhysicsBody::createPolygon(vers, 3, material)); triangle->setPosition(Vec2(point.x, point.y)); return triangle; @@ -309,7 +237,7 @@ Sprite* PhysicsDemo::makeTriangle(Vec2 point, Size size, int color, PhysicsMater bool PhysicsDemo::onTouchBegan(Touch* touch, Event* event) { auto location = touch->getLocation(); - auto arr = getPhysicsWorld()->getShapes(location); + auto arr = _physicsWorld->getShapes(location); PhysicsBody* body = nullptr; for (auto& obj : arr) @@ -324,13 +252,14 @@ bool PhysicsDemo::onTouchBegan(Touch* touch, Event* event) if (body != nullptr) { Node* mouse = Node::create(); - mouse->setPhysicsBody(PhysicsBody::create(PHYSICS_INFINITY, PHYSICS_INFINITY)); - mouse->getPhysicsBody()->setDynamic(false); + auto physicsBody = PhysicsBody::create(PHYSICS_INFINITY, PHYSICS_INFINITY); + physicsBody->setDynamic(false); + addPhysicsComponent(mouse, physicsBody); mouse->setPosition(location); this->addChild(mouse); - PhysicsJointPin* joint = PhysicsJointPin::construct(mouse->getPhysicsBody(), body, location); + PhysicsJointPin* joint = PhysicsJointPin::construct(physicsBody, body, location); joint->setMaxForce(5000.0f * body->getMass()); - getPhysicsWorld()->addJoint(joint); + _physicsWorld->addJoint(joint); _mouses.insert(std::make_pair(touch->getID(), mouse)); return true; @@ -360,40 +289,49 @@ void PhysicsDemo::onTouchEnded(Touch* touch, Event* event) } } +void PhysicsDemo::addPhysicsComponent(Node *node, PhysicsBody *physicsBody) +{ + auto physicsComponent = ComponentPhysics2d::create(); + physicsComponent->setPhysicsBody(physicsBody); + node->addComponent(physicsComponent); +} + +// Implementation of PhysicsComponentDemoLogoSmash + void PhysicsDemoLogoSmash::onEnter() { PhysicsDemo::onEnter(); - getPhysicsWorld()->setGravity(Vec2(0, 0)); - getPhysicsWorld()->setUpdateRate(5.0f); + _physicsWorld->setGravity(Vec2(0, 0)); + _physicsWorld->setUpdateRate(5.0f); - _ball = SpriteBatchNode::create("Images/ball.png", sizeof(logo_image)/sizeof(logo_image[0])); + _ball = SpriteBatchNode::create("Images/ball.png", sizeof(LOGO_IMAGE)/sizeof(LOGO_IMAGE[0])); addChild(_ball); - for (int y = 0; y < logo_height; ++y) + for (int y = 0; y < LOGO_HEIGHT; ++y) { - for (int x = 0; x < logo_width; ++x) + for (int x = 0; x < LOGO_WIDTH; ++x) { - if (get_pixel(x, y)) + if (getPixel(x, y)) { - float x_jitter = 0.05*frand(); - float y_jitter = 0.05*frand(); + float xJitter = 0.05 * frand(); + float yJitter = 0.05 * frand(); - Node* ball = makeBall(Vec2(2*(x - logo_width/2 + x_jitter) + VisibleRect::getVisibleRect().size.width/2, - 2*(logo_height-y + y_jitter) + VisibleRect::getVisibleRect().size.height/2 - logo_height/2), + Node* ball = makeBall(Vec2(2*(x - LOGO_WIDTH/2 + xJitter) + VisibleRect::getVisibleRect().size.width/2, + 2*(LOGO_HEIGHT-y + yJitter) + VisibleRect::getVisibleRect().size.height/2 - LOGO_HEIGHT/2), 0.95f, PhysicsMaterial(0.01f, 0.0f, 0.0f)); - ball->getPhysicsBody()->setMass(1.0); - ball->getPhysicsBody()->setMoment(PHYSICS_INFINITY); + auto physicsBody = ball->getComponent()->getPhysicsBody(); + physicsBody->setMass(1.0); + physicsBody->setMoment(PHYSICS_INFINITY); _ball->addChild(ball); - } } } auto bullet = makeBall(Vec2(400, 0), 10, PhysicsMaterial(PHYSICS_INFINITY, 0, 0)); - bullet->getPhysicsBody()->setVelocity(Vec2(200, 0)); + bullet->getComponent()->getPhysicsBody()->setVelocity(Vec2(200, 0)); bullet->setPosition(Vec2(-500, VisibleRect::getVisibleRect().size.height/2)); @@ -405,13 +343,66 @@ std::string PhysicsDemoLogoSmash::title() const return "Logo Smash"; } -void PhysicsDemoPyramidStack::updateOnce(float delta) +// Implementation of PhysicsComponentDemoClickAdd + +PhysicsDemoClickAdd::~PhysicsDemoClickAdd() { - auto ball = getChildByTag(100); + Device::setAccelerometerEnabled(false); +} + +void PhysicsDemoClickAdd::onEnter() +{ + PhysicsDemo::onEnter(); - ball->setScale(ball->getScale() * 3); - ball->setPhysicsBody(PhysicsBody::createCircle(30)); - ball->getPhysicsBody()->setTag(DRAG_BODYS_TAG); + auto touchListener = EventListenerTouchAllAtOnce::create(); + touchListener->onTouchesEnded = CC_CALLBACK_2(PhysicsDemoClickAdd::onTouchesEnded, this); + _eventDispatcher->addEventListenerWithSceneGraphPriority(touchListener, this); + + Device::setAccelerometerEnabled(true); + auto accListener = EventListenerAcceleration::create(CC_CALLBACK_2(PhysicsDemoClickAdd::onAcceleration, this)); + _eventDispatcher->addEventListenerWithSceneGraphPriority(accListener, this); + + auto node = Node::create(); + addPhysicsComponent(node, PhysicsBody::createEdgeBox(VisibleRect::getVisibleRect().size)); + node->setPosition(VisibleRect::center()); + this->addChild(node); + + addGrossiniAtPosition(VisibleRect::center()); +} + +std::string PhysicsDemoClickAdd::subtitle() const +{ + return "multi touch to add grossini"; +} + +void PhysicsDemoClickAdd::onTouchesEnded(const std::vector& touches, Event* event) +{ + //Add a new body/atlas sprite at the touched location + + for( auto touch: touches) + { + auto location = touch->getLocation(); + + addGrossiniAtPosition( location ); + } +} + +void PhysicsDemoClickAdd::onAcceleration(Acceleration* acc, Event* event) +{ + static float prevX=0, prevY=0; + +#define FILTER_FACTOR 0.05f + + float accelX = (float) acc->x * FILTER_FACTOR + (1- FILTER_FACTOR)*prevX; + float accelY = (float) acc->y * FILTER_FACTOR + (1- FILTER_FACTOR)*prevY; + + prevX = accelX; + prevY = accelY; + + auto v = Vec2( accelX, accelY); + v = v * 200; + + _physicsWorld->setGravity(v); } void PhysicsDemoPyramidStack::onEnter() @@ -425,28 +416,36 @@ void PhysicsDemoPyramidStack::onEnter() _eventDispatcher->addEventListenerWithSceneGraphPriority(touchListener, this); auto node = Node::create(); - node->setPhysicsBody(PhysicsBody::createEdgeSegment(VisibleRect::leftBottom() + Vec2(0, 50), VisibleRect::rightBottom() + Vec2(0, 50))); + addPhysicsComponent(node, PhysicsBody::createEdgeSegment(VisibleRect::leftBottom() + Vec2(0, 50), VisibleRect::rightBottom() + Vec2(0, 50))); this->addChild(node); auto ball = Sprite::create("Images/ball.png"); ball->setScale(1); ball->setTag(100); - ball->setPhysicsBody(PhysicsBody::createCircle(10)); - ball->getPhysicsBody()->setTag(DRAG_BODYS_TAG); + addPhysicsComponent(ball, PhysicsBody::createCircle(10)); + ball->getComponent()->getPhysicsBody()->setTag(DRAG_BODYS_TAG); ball->setPosition(VisibleRect::bottom() + Vec2(0, 60)); this->addChild(ball); scheduleOnce(CC_SCHEDULE_SELECTOR(PhysicsDemoPyramidStack::updateOnce), 3.0); - - for(int i=0; i<14; i++) + + for (int i = 0; i < 14; i++) { - for(int j=0; j<=i; j++) + for (int j = 0; j <= i; j++) { - auto sp = addGrossiniAtPosition(VisibleRect::bottom() + Vec2((i/2 - j) * 11, (14 - i) * 23 + 100), 0.2f); - sp->getPhysicsBody()->setTag(DRAG_BODYS_TAG); + auto sp = addGrossiniAtPosition(VisibleRect::bottom() + Vec2((i / 2 - j) * 11, (14 - i) * 23 + 100), 0.2f); + sp->getComponent()->getPhysicsBody()->setTag(DRAG_BODYS_TAG); } } } + +void PhysicsDemoPyramidStack::updateOnce(float delta) +{ + auto ball = getChildByTag(100); + if (ball) + ball->setScale(ball->getScale() * 3); +} + std::string PhysicsDemoPyramidStack::title() const { return "Pyramid Stack"; @@ -466,10 +465,10 @@ void PhysicsDemoRayCast::onEnter() listener->onTouchesEnded = CC_CALLBACK_2(PhysicsDemoRayCast::onTouchesEnded, this); _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); - getPhysicsWorld()->setGravity(Point::ZERO); + _physicsWorld->setGravity(Point::ZERO); auto node = DrawNode::create(); - node->setPhysicsBody(PhysicsBody::createEdgeSegment(VisibleRect::leftBottom() + Vec2(0, 50), VisibleRect::rightBottom() + Vec2(0, 50))); + addPhysicsComponent(node, PhysicsBody::createEdgeSegment(VisibleRect::leftBottom() + Vec2(0, 50), VisibleRect::rightBottom() + Vec2(0, 50))); node->drawSegment(VisibleRect::leftBottom() + Vec2(0, 50), VisibleRect::rightBottom() + Vec2(0, 50), 1, STATIC_COLOR); this->addChild(node); @@ -478,7 +477,7 @@ void PhysicsDemoRayCast::onEnter() auto menu = Menu::create(item, nullptr); this->addChild(menu); - menu->setPosition(Vec2(VisibleRect::left().x+100, VisibleRect::top().y-10)); + menu->setPosition(Vec2(VisibleRect::left().x + 100, VisibleRect::top().y - 10)); scheduleUpdate(); } @@ -526,7 +525,7 @@ void PhysicsDemoRayCast::update(float delta) Vec2 point3 = point2; auto func = CC_CALLBACK_3(PhysicsDemoRayCast::anyRay, this); - getPhysicsWorld()->rayCast(func, point1, point2, &point3); + _physicsWorld->rayCast(func, point1, point2, &point3); _node->drawSegment(point1, point3, 1, STATIC_COLOR); if (point2 != point3) @@ -552,7 +551,7 @@ void PhysicsDemoRayCast::update(float delta) return true; }; - getPhysicsWorld()->rayCast(func, point1, point2, nullptr); + _physicsWorld->rayCast(func, point1, point2, nullptr); _node->drawSegment(point1, point3, 1, STATIC_COLOR); if (point2 != point3) @@ -579,7 +578,7 @@ void PhysicsDemoRayCast::update(float delta) return true; }; - getPhysicsWorld()->rayCast(func, point1, point2, nullptr); + _physicsWorld->rayCast(func, point1, point2, nullptr); _node->drawSegment(point1, point2, 1, STATIC_COLOR); @@ -604,21 +603,23 @@ void PhysicsDemoRayCast::onTouchesEnded(const std::vector& touches, Even { //Add a new body/atlas sprite at the touched location - for( auto &touch: touches) + for (auto &touch : touches) { auto location = touch->getLocation(); float r = CCRANDOM_0_1(); - if (r < 1.0f/3.0f) + if (r < 1.0f / 3.0f) { - addChild(makeBall(location, 5 + CCRANDOM_0_1()*10)); - }else if(r < 2.0f/3.0f) + addChild(makeBall(location, 5 + CCRANDOM_0_1() * 10)); + } + else if (r < 2.0f / 3.0f) { - addChild(makeBox(location, Size(10 + CCRANDOM_0_1()*15, 10 + CCRANDOM_0_1()*15))); - }else + addChild(makeBox(location, Size(10 + CCRANDOM_0_1() * 15, 10 + CCRANDOM_0_1() * 15))); + } + else { - addChild(makeTriangle(location, Size(10 + CCRANDOM_0_1()*20, 10 + CCRANDOM_0_1()*20))); + addChild(makeTriangle(location, Size(10 + CCRANDOM_0_1() * 20, 10 + CCRANDOM_0_1() * 20))); } } } @@ -628,15 +629,63 @@ std::string PhysicsDemoRayCast::title() const return "Ray Cast"; } +void PhysicsDemoActions::onEnter() +{ + PhysicsDemo::onEnter(); + _physicsWorld->setGravity(Vect::ZERO); + + auto touchListener = EventListenerTouchOneByOne::create(); + touchListener->onTouchBegan = CC_CALLBACK_2(PhysicsDemoActions::onTouchBegan, this); + touchListener->onTouchMoved = CC_CALLBACK_2(PhysicsDemoActions::onTouchMoved, this); + touchListener->onTouchEnded = CC_CALLBACK_2(PhysicsDemoActions::onTouchEnded, this); + _eventDispatcher->addEventListenerWithSceneGraphPriority(touchListener, this); + + auto node = Node::create(); + addPhysicsComponent(node, PhysicsBody::createEdgeBox(VisibleRect::getVisibleRect().size)); + node->setPosition(VisibleRect::center()); + this->addChild(node); + + Sprite* sp1 = addGrossiniAtPosition(VisibleRect::center()); + Sprite* sp2 = addGrossiniAtPosition(VisibleRect::left() + Vec2(50, 0)); + Sprite* sp3 = addGrossiniAtPosition(VisibleRect::right() - Vec2(20, 0)); + Sprite* sp4 = addGrossiniAtPosition(VisibleRect::leftTop() + Vec2(50, -50)); + sp4->getComponent()->getPhysicsBody()->setGravityEnable(false); + + sp1->getComponent()->getPhysicsBody()->setTag(DRAG_BODYS_TAG); + sp2->getComponent()->getPhysicsBody()->setTag(DRAG_BODYS_TAG); + sp3->getComponent()->getPhysicsBody()->setTag(DRAG_BODYS_TAG); + sp4->getComponent()->getPhysicsBody()->setTag(DRAG_BODYS_TAG); + + auto actionTo = JumpTo::create(2, Vec2(100, 100), 50, 4); + auto actionBy = JumpBy::create(2, Vec2(300, 0), 50, 4); + auto actionUp = JumpBy::create(2, Vec2(0, 50), 80, 4); + auto actionByBack = actionBy->reverse(); + auto rotateBy = RotateBy::create(2, 180); + auto rotateByBack = RotateBy::create(2, -180); + + sp1->runAction(RepeatForever::create(actionUp)); + sp2->runAction(RepeatForever::create(Sequence::create(actionBy, actionByBack, nullptr))); + sp3->runAction(actionTo); + sp4->runAction(RepeatForever::create(Sequence::create(rotateBy, rotateByBack, nullptr))); +} + +std::string PhysicsDemoActions::title() const +{ + return "Actions"; +} + +// implementation of PhysicsDemoJoints + + void PhysicsDemoJoints::onEnter() { PhysicsDemo::onEnter(); toggleDebug(); auto listener = EventListenerTouchOneByOne::create(); - listener->onTouchBegan = CC_CALLBACK_2(PhysicsDemoJoints::onTouchBegan, this); - listener->onTouchMoved = CC_CALLBACK_2(PhysicsDemoJoints::onTouchMoved, this); - listener->onTouchEnded = CC_CALLBACK_2(PhysicsDemoJoints::onTouchEnded, this); + listener->onTouchBegan = CC_CALLBACK_2(PhysicsDemo::onTouchBegan, this); + listener->onTouchMoved = CC_CALLBACK_2(PhysicsDemo::onTouchMoved, this); + listener->onTouchEnded = CC_CALLBACK_2(PhysicsDemo::onTouchEnded, this); _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); float width = (VisibleRect::getVisibleRect().size.width - 10) / 4; @@ -644,7 +693,8 @@ void PhysicsDemoJoints::onEnter() Node* node = Node::create(); PhysicsBody* box = PhysicsBody::create(); - node->setPhysicsBody(box); + addPhysicsComponent(node, box); + box->setDynamic(false); node->setPosition(Point::ZERO); this->addChild(node); @@ -655,17 +705,20 @@ void PhysicsDemoJoints::onEnter() { Vec2 offset(VisibleRect::leftBottom().x + 5 + j * width + width/2, VisibleRect::leftBottom().y + 50 + i * height + height/2); box->addShape(PhysicsShapeEdgeBox::create(Size(width, height), PHYSICSSHAPE_MATERIAL_DEFAULT, 1, offset)); - + switch (i*4 + j) { case 0: { auto sp1 = makeBall(offset - Vec2(30, 0), 10); - sp1->getPhysicsBody()->setTag(DRAG_BODYS_TAG); - auto sp2 = makeBall(offset + Vec2(30, 0), 10); - sp2->getPhysicsBody()->setTag(DRAG_BODYS_TAG); + auto sp1PhysicsBody = sp1->getComponent()->getPhysicsBody(); + sp1PhysicsBody->setTag(DRAG_BODYS_TAG); - PhysicsJointPin* joint = PhysicsJointPin::construct(sp1->getPhysicsBody(), sp2->getPhysicsBody(), offset); + auto sp2 = makeBall(offset + Vec2(30, 0), 10); + auto sp2PhysicsBody = sp2->getComponent()->getPhysicsBody(); + sp2PhysicsBody->setTag(DRAG_BODYS_TAG); + + PhysicsJointPin* joint = PhysicsJointPin::construct(sp1PhysicsBody, sp2PhysicsBody, offset); getPhysicsWorld()->addJoint(joint); this->addChild(sp1); @@ -676,11 +729,14 @@ void PhysicsDemoJoints::onEnter() { auto sp1 = makeBall(offset - Vec2(30, 0), 10); - sp1->getPhysicsBody()->setTag(DRAG_BODYS_TAG); - auto sp2 = makeBox(offset + Vec2(30, 0), Size(30, 10)); - sp2->getPhysicsBody()->setTag(DRAG_BODYS_TAG); + auto sp1PhysicsBody = sp1->getComponent()->getPhysicsBody(); + sp1PhysicsBody->setTag(DRAG_BODYS_TAG); - PhysicsJointFixed* joint = PhysicsJointFixed::construct(sp1->getPhysicsBody(), sp2->getPhysicsBody(), offset); + auto sp2 = makeBox(offset + Vec2(30, 0), Size(30, 10)); + auto sp2PhysicsBody = sp2->getComponent()->getPhysicsBody(); + sp2PhysicsBody->setTag(DRAG_BODYS_TAG); + + PhysicsJointFixed* joint = PhysicsJointFixed::construct(sp1PhysicsBody, sp2PhysicsBody, offset); getPhysicsWorld()->addJoint(joint); this->addChild(sp1); @@ -690,11 +746,14 @@ void PhysicsDemoJoints::onEnter() case 2: { auto sp1 = makeBall(offset - Vec2(30, 0), 10); - sp1->getPhysicsBody()->setTag(DRAG_BODYS_TAG); - auto sp2 = makeBox(offset + Vec2(30, 0), Size(30, 10)); - sp2->getPhysicsBody()->setTag(DRAG_BODYS_TAG); + auto sp1PhysicsBody = sp1->getComponent()->getPhysicsBody(); + sp1PhysicsBody->setTag(DRAG_BODYS_TAG); - PhysicsJointDistance* joint = PhysicsJointDistance::construct(sp1->getPhysicsBody(), sp2->getPhysicsBody(), Point::ZERO, Point::ZERO); + auto sp2 = makeBox(offset + Vec2(30, 0), Size(30, 10)); + auto sp2PhysicsBody = sp2->getComponent()->getPhysicsBody(); + sp2PhysicsBody->setTag(DRAG_BODYS_TAG); + + PhysicsJointDistance* joint = PhysicsJointDistance::construct(sp1PhysicsBody, sp2PhysicsBody, Point::ZERO, Point::ZERO); getPhysicsWorld()->addJoint(joint); this->addChild(sp1); @@ -704,11 +763,14 @@ void PhysicsDemoJoints::onEnter() case 3: { auto sp1 = makeBall(offset - Vec2(30, 0), 10); - sp1->getPhysicsBody()->setTag(DRAG_BODYS_TAG); - auto sp2 = makeBox(offset + Vec2(30, 0), Size(30, 10)); - sp2->getPhysicsBody()->setTag(DRAG_BODYS_TAG); + auto sp1PhysicsBody = sp1->getComponent()->getPhysicsBody(); + sp1PhysicsBody->setTag(DRAG_BODYS_TAG); - PhysicsJointLimit* joint = PhysicsJointLimit::construct(sp1->getPhysicsBody(), sp2->getPhysicsBody(), Point::ZERO, Point::ZERO, 30.0f, 60.0f); + auto sp2 = makeBox(offset + Vec2(30, 0), Size(30, 10)); + auto sp2PhysicsBody = sp2->getComponent()->getPhysicsBody(); + sp2PhysicsBody->setTag(DRAG_BODYS_TAG); + + PhysicsJointLimit* joint = PhysicsJointLimit::construct(sp1PhysicsBody, sp2PhysicsBody, Point::ZERO, Point::ZERO, 30.0f, 60.0f); getPhysicsWorld()->addJoint(joint); this->addChild(sp1); @@ -718,11 +780,14 @@ void PhysicsDemoJoints::onEnter() case 4: { auto sp1 = makeBall(offset - Vec2(30, 0), 10); - sp1->getPhysicsBody()->setTag(DRAG_BODYS_TAG); - auto sp2 = makeBox(offset + Vec2(30, 0), Size(30, 10)); - sp2->getPhysicsBody()->setTag(DRAG_BODYS_TAG); + auto sp1PhysicsBody = sp1->getComponent()->getPhysicsBody(); + sp1PhysicsBody->setTag(DRAG_BODYS_TAG); - PhysicsJointSpring* joint = PhysicsJointSpring::construct(sp1->getPhysicsBody(), sp2->getPhysicsBody(), Point::ZERO, Point::ZERO, 500.0f, 0.3f); + auto sp2 = makeBox(offset + Vec2(30, 0), Size(30, 10)); + auto sp2PhysicsBody = sp2->getComponent()->getPhysicsBody(); + sp2PhysicsBody->setTag(DRAG_BODYS_TAG); + + PhysicsJointSpring* joint = PhysicsJointSpring::construct(sp1PhysicsBody, sp2PhysicsBody, Point::ZERO, Point::ZERO, 500.0f, 0.3f); getPhysicsWorld()->addJoint(joint); this->addChild(sp1); @@ -732,11 +797,14 @@ void PhysicsDemoJoints::onEnter() case 5: { auto sp1 = makeBall(offset - Vec2(30, 0), 10); - sp1->getPhysicsBody()->setTag(DRAG_BODYS_TAG); - auto sp2 = makeBox(offset + Vec2(30, 0), Size(30, 10)); - sp2->getPhysicsBody()->setTag(DRAG_BODYS_TAG); + auto sp1PhysicsBody = sp1->getComponent()->getPhysicsBody(); + sp1PhysicsBody->setTag(DRAG_BODYS_TAG); - PhysicsJointGroove* joint = PhysicsJointGroove::construct(sp1->getPhysicsBody(), sp2->getPhysicsBody(), Vec2(30, 15), Vec2(30, -15), Vec2(-30, 0)); + auto sp2 = makeBox(offset + Vec2(30, 0), Size(30, 10)); + auto sp2PhysicsBody = sp2->getComponent()->getPhysicsBody(); + sp2PhysicsBody->setTag(DRAG_BODYS_TAG); + + PhysicsJointGroove* joint = PhysicsJointGroove::construct(sp1PhysicsBody, sp2PhysicsBody, Vec2(30, 15), Vec2(30, -15), Vec2(-30, 0)); getPhysicsWorld()->addJoint(joint); this->addChild(sp1); @@ -746,13 +814,16 @@ void PhysicsDemoJoints::onEnter() case 6: { auto sp1 = makeBox(offset - Vec2(30, 0), Size(30, 10)); - sp1->getPhysicsBody()->setTag(DRAG_BODYS_TAG); - auto sp2 = makeBox(offset + Vec2(30, 0), Size(30, 10)); - sp2->getPhysicsBody()->setTag(DRAG_BODYS_TAG); + auto sp1PhysicsBody = sp1->getComponent()->getPhysicsBody(); + sp1PhysicsBody->setTag(DRAG_BODYS_TAG); - getPhysicsWorld()->addJoint(PhysicsJointPin::construct(sp1->getPhysicsBody(), box, sp1->getPosition())); - getPhysicsWorld()->addJoint(PhysicsJointPin::construct(sp2->getPhysicsBody(), box, sp2->getPosition())); - PhysicsJointRotarySpring* joint = PhysicsJointRotarySpring::construct(sp1->getPhysicsBody(), sp2->getPhysicsBody(), 3000.0f, 60.0f); + auto sp2 = makeBox(offset + Vec2(30, 0), Size(30, 10)); + auto sp2PhysicsBody = sp2->getComponent()->getPhysicsBody(); + sp2PhysicsBody->setTag(DRAG_BODYS_TAG); + + getPhysicsWorld()->addJoint(PhysicsJointPin::construct(sp1PhysicsBody, box, sp1->getPosition())); + getPhysicsWorld()->addJoint(PhysicsJointPin::construct(sp2PhysicsBody, box, sp2->getPosition())); + PhysicsJointRotarySpring* joint = PhysicsJointRotarySpring::construct(sp1PhysicsBody, sp2PhysicsBody, 3000.0f, 60.0f); getPhysicsWorld()->addJoint(joint); this->addChild(sp1); @@ -762,13 +833,16 @@ void PhysicsDemoJoints::onEnter() case 7: { auto sp1 = makeBox(offset - Vec2(30, 0), Size(30, 10)); - sp1->getPhysicsBody()->setTag(DRAG_BODYS_TAG); - auto sp2 = makeBox(offset + Vec2(30, 0), Size(30, 10)); - sp2->getPhysicsBody()->setTag(DRAG_BODYS_TAG); + auto sp1PhysicsBody = sp1->getComponent()->getPhysicsBody(); + sp1PhysicsBody->setTag(DRAG_BODYS_TAG); - getPhysicsWorld()->addJoint(PhysicsJointPin::construct(sp1->getPhysicsBody(), box, sp1->getPosition())); - getPhysicsWorld()->addJoint(PhysicsJointPin::construct(sp2->getPhysicsBody(), box, sp2->getPosition())); - PhysicsJointRotaryLimit* joint = PhysicsJointRotaryLimit::construct(sp1->getPhysicsBody(), sp2->getPhysicsBody(), 0.0f,(float) M_PI_2); + auto sp2 = makeBox(offset + Vec2(30, 0), Size(30, 10)); + auto sp2PhysicsBody = sp2->getComponent()->getPhysicsBody(); + sp2PhysicsBody->setTag(DRAG_BODYS_TAG); + + getPhysicsWorld()->addJoint(PhysicsJointPin::construct(sp1PhysicsBody, box, sp1->getPosition())); + getPhysicsWorld()->addJoint(PhysicsJointPin::construct(sp2PhysicsBody, box, sp2->getPosition())); + PhysicsJointRotaryLimit* joint = PhysicsJointRotaryLimit::construct(sp1PhysicsBody, sp2PhysicsBody, 0.0f,(float) M_PI_2); getPhysicsWorld()->addJoint(joint); this->addChild(sp1); @@ -778,13 +852,16 @@ void PhysicsDemoJoints::onEnter() case 8: { auto sp1 = makeBox(offset - Vec2(30, 0), Size(30, 10)); - sp1->getPhysicsBody()->setTag(DRAG_BODYS_TAG); - auto sp2 = makeBox(offset + Vec2(30, 0), Size(30, 10)); - sp2->getPhysicsBody()->setTag(DRAG_BODYS_TAG); + auto sp1PhysicsBody = sp1->getComponent()->getPhysicsBody(); + sp1PhysicsBody->setTag(DRAG_BODYS_TAG); - getPhysicsWorld()->addJoint(PhysicsJointPin::construct(sp1->getPhysicsBody(), box, sp1->getPosition())); - getPhysicsWorld()->addJoint(PhysicsJointPin::construct(sp2->getPhysicsBody(), box, sp2->getPosition())); - PhysicsJointRatchet* joint = PhysicsJointRatchet::construct(sp1->getPhysicsBody(), sp2->getPhysicsBody(), 0.0f, (float)M_PI_2); + auto sp2 = makeBox(offset + Vec2(30, 0), Size(30, 10)); + auto sp2PhysicsBody = sp2->getComponent()->getPhysicsBody(); + sp2PhysicsBody->setTag(DRAG_BODYS_TAG); + + getPhysicsWorld()->addJoint(PhysicsJointPin::construct(sp1PhysicsBody, box, sp1->getPosition())); + getPhysicsWorld()->addJoint(PhysicsJointPin::construct(sp2PhysicsBody, box, sp2->getPosition())); + PhysicsJointRatchet* joint = PhysicsJointRatchet::construct(sp1PhysicsBody, sp2PhysicsBody, 0.0f, (float)M_PI_2); getPhysicsWorld()->addJoint(joint); this->addChild(sp1); @@ -794,13 +871,16 @@ void PhysicsDemoJoints::onEnter() case 9: { auto sp1 = makeBox(offset - Vec2(30, 0), Size(30, 10)); - sp1->getPhysicsBody()->setTag(DRAG_BODYS_TAG); - auto sp2 = makeBox(offset + Vec2(30, 0), Size(30, 10)); - sp2->getPhysicsBody()->setTag(DRAG_BODYS_TAG); + auto sp1PhysicsBody = sp1->getComponent()->getPhysicsBody(); + sp1PhysicsBody->setTag(DRAG_BODYS_TAG); - getPhysicsWorld()->addJoint(PhysicsJointPin::construct(sp1->getPhysicsBody(), box, sp1->getPosition())); - getPhysicsWorld()->addJoint(PhysicsJointPin::construct(sp2->getPhysicsBody(), box, sp2->getPosition())); - PhysicsJointGear* joint = PhysicsJointGear::construct(sp1->getPhysicsBody(), sp2->getPhysicsBody(), 0.0f, 2.0f); + auto sp2 = makeBox(offset + Vec2(30, 0), Size(30, 10)); + auto sp2PhysicsBody = sp2->getComponent()->getPhysicsBody(); + sp2PhysicsBody->setTag(DRAG_BODYS_TAG); + + getPhysicsWorld()->addJoint(PhysicsJointPin::construct(sp1PhysicsBody, box, sp1->getPosition())); + getPhysicsWorld()->addJoint(PhysicsJointPin::construct(sp2PhysicsBody, box, sp2->getPosition())); + PhysicsJointGear* joint = PhysicsJointGear::construct(sp1PhysicsBody, sp2PhysicsBody, 0.0f, 2.0f); getPhysicsWorld()->addJoint(joint); this->addChild(sp1); @@ -810,13 +890,16 @@ void PhysicsDemoJoints::onEnter() case 10: { auto sp1 = makeBox(offset - Vec2(30, 0), Size(30, 10)); - sp1->getPhysicsBody()->setTag(DRAG_BODYS_TAG); - auto sp2 = makeBox(offset + Vec2(30, 0), Size(30, 10)); - sp2->getPhysicsBody()->setTag(DRAG_BODYS_TAG); + auto sp1PhysicsBody = sp1->getComponent()->getPhysicsBody(); + sp1PhysicsBody->setTag(DRAG_BODYS_TAG); - getPhysicsWorld()->addJoint(PhysicsJointPin::construct(sp1->getPhysicsBody(), box, sp1->getPosition())); - getPhysicsWorld()->addJoint(PhysicsJointPin::construct(sp2->getPhysicsBody(), box, sp2->getPosition())); - PhysicsJointMotor* joint = PhysicsJointMotor::construct(sp1->getPhysicsBody(), sp2->getPhysicsBody(), (float)M_PI_2); + auto sp2 = makeBox(offset + Vec2(30, 0), Size(30, 10)); + auto sp2PhysicsBody = sp2->getComponent()->getPhysicsBody(); + sp2PhysicsBody->setTag(DRAG_BODYS_TAG); + + getPhysicsWorld()->addJoint(PhysicsJointPin::construct(sp1PhysicsBody, box, sp1->getPosition())); + getPhysicsWorld()->addJoint(PhysicsJointPin::construct(sp2PhysicsBody, box, sp2->getPosition())); + PhysicsJointMotor* joint = PhysicsJointMotor::construct(sp1PhysicsBody, sp2PhysicsBody, (float)M_PI_2); getPhysicsWorld()->addJoint(joint); this->addChild(sp1); @@ -835,51 +918,6 @@ std::string PhysicsDemoJoints::title() const return "Joints"; } -void PhysicsDemoActions::onEnter() -{ - PhysicsDemo::onEnter(); - getPhysicsWorld()->setGravity(Vect::ZERO); - - auto touchListener = EventListenerTouchOneByOne::create(); - touchListener->onTouchBegan = CC_CALLBACK_2(PhysicsDemoActions::onTouchBegan, this); - touchListener->onTouchMoved = CC_CALLBACK_2(PhysicsDemoActions::onTouchMoved, this); - touchListener->onTouchEnded = CC_CALLBACK_2(PhysicsDemoActions::onTouchEnded, this); - _eventDispatcher->addEventListenerWithSceneGraphPriority(touchListener, this); - - auto node = Node::create(); - node->setPhysicsBody(PhysicsBody::createEdgeBox(VisibleRect::getVisibleRect().size)); - node->setPosition(VisibleRect::center()); - this->addChild(node); - - Sprite* sp1 = addGrossiniAtPosition(VisibleRect::center()); - Sprite* sp2 = addGrossiniAtPosition(VisibleRect::left() + Vec2(50, 0)); - Sprite* sp3 = addGrossiniAtPosition(VisibleRect::right() - Vec2(20, 0)); - Sprite* sp4 = addGrossiniAtPosition(VisibleRect::leftTop() + Vec2(50, -50)); - sp4->getPhysicsBody()->setGravityEnable(false); - - sp1->getPhysicsBody()->setTag(DRAG_BODYS_TAG); - sp2->getPhysicsBody()->setTag(DRAG_BODYS_TAG); - sp3->getPhysicsBody()->setTag(DRAG_BODYS_TAG); - sp4->getPhysicsBody()->setTag(DRAG_BODYS_TAG); - - auto actionTo = JumpTo::create(2, Vec2(100,100), 50, 4); - auto actionBy = JumpBy::create(2, Vec2(300,0), 50, 4); - auto actionUp = JumpBy::create(2, Vec2(0,50), 80, 4); - auto actionByBack = actionBy->reverse(); - auto rotateBy = RotateBy::create(2, 180); - auto rotateByBack = RotateBy::create(2, -180); - - sp1->runAction(RepeatForever::create(actionUp)); - sp2->runAction(RepeatForever::create(Sequence::create(actionBy, actionByBack, nullptr))); - sp3->runAction(actionTo); - sp4->runAction(RepeatForever::create(Sequence::create(rotateBy, rotateByBack, nullptr))); -} - -std::string PhysicsDemoActions::title() const -{ - return "Actions"; -} - void PhysicsDemoPump::onEnter() { PhysicsDemo::onEnter(); @@ -895,20 +933,19 @@ void PhysicsDemoPump::onEnter() scheduleUpdate(); auto node = Node::create(); - auto body = PhysicsBody::create(); - body->setDynamic(false); + addPhysicsComponent(node, PhysicsBody::create()); + node->getComponent()->getPhysicsBody()->setDynamic(false); PhysicsMaterial staticMaterial(PHYSICS_INFINITY, 0, 0.5f); - body->addShape(PhysicsShapeEdgeSegment::create(VisibleRect::leftTop() + Vec2(50, 0), VisibleRect::leftTop() + Vec2(50, -130), staticMaterial, 2.0f)); - body->addShape(PhysicsShapeEdgeSegment::create(VisibleRect::leftTop() + Vec2(190, 0), VisibleRect::leftTop() + Vec2(100, -50), staticMaterial, 2.0f)); - body->addShape(PhysicsShapeEdgeSegment::create(VisibleRect::leftTop() + Vec2(100, -50), VisibleRect::leftTop() + Vec2(100, -90), staticMaterial, 2.0f)); - body->addShape(PhysicsShapeEdgeSegment::create(VisibleRect::leftTop() + Vec2(50, -130), VisibleRect::leftTop() + Vec2(100, -145), staticMaterial, 2.0f)); - body->addShape(PhysicsShapeEdgeSegment::create(VisibleRect::leftTop() + Vec2(100, -145), VisibleRect::leftBottom() + Vec2(100, 80), staticMaterial, 2.0f)); - body->addShape(PhysicsShapeEdgeSegment::create(VisibleRect::leftTop() + Vec2(150, -80), VisibleRect::leftBottom() + Vec2(150, 80), staticMaterial, 2.0f)); - body->addShape(PhysicsShapeEdgeSegment::create(VisibleRect::leftTop() + Vec2(150, -80), VisibleRect::rightTop() + Vec2(-100, -150), staticMaterial, 2.0f)); + node->getComponent()->getPhysicsBody()->addShape(PhysicsShapeEdgeSegment::create(VisibleRect::leftTop() + Vec2(50, 0), VisibleRect::leftTop() + Vec2(50, -130), staticMaterial, 2.0f)); + node->getComponent()->getPhysicsBody()->addShape(PhysicsShapeEdgeSegment::create(VisibleRect::leftTop() + Vec2(190, 0), VisibleRect::leftTop() + Vec2(100, -50), staticMaterial, 2.0f)); + node->getComponent()->getPhysicsBody()->addShape(PhysicsShapeEdgeSegment::create(VisibleRect::leftTop() + Vec2(100, -50), VisibleRect::leftTop() + Vec2(100, -90), staticMaterial, 2.0f)); + node->getComponent()->getPhysicsBody()->addShape(PhysicsShapeEdgeSegment::create(VisibleRect::leftTop() + Vec2(50, -130), VisibleRect::leftTop() + Vec2(100, -145), staticMaterial, 2.0f)); + node->getComponent()->getPhysicsBody()->addShape(PhysicsShapeEdgeSegment::create(VisibleRect::leftTop() + Vec2(100, -145), VisibleRect::leftBottom() + Vec2(100, 80), staticMaterial, 2.0f)); + node->getComponent()->getPhysicsBody()->addShape(PhysicsShapeEdgeSegment::create(VisibleRect::leftTop() + Vec2(150, -80), VisibleRect::leftBottom() + Vec2(150, 80), staticMaterial, 2.0f)); + node->getComponent()->getPhysicsBody()->addShape(PhysicsShapeEdgeSegment::create(VisibleRect::leftTop() + Vec2(150, -80), VisibleRect::rightTop() + Vec2(-100, -150), staticMaterial, 2.0f)); - body->setCategoryBitmask(0x01); - node->setPhysicsBody(body); + node->getComponent()->getPhysicsBody()->setCategoryBitmask(0x01); node->setPosition(Vec2::ZERO); this->addChild(node); @@ -916,12 +953,10 @@ void PhysicsDemoPump::onEnter() for (int i = 0; i < 6; ++i) { auto ball = makeBall(VisibleRect::leftTop() + Vec2(75 + CCRANDOM_0_1() * 90, 0), 22, PhysicsMaterial(0.05f, 0.0f, 0.1f)); - ball->getPhysicsBody()->setTag(DRAG_BODYS_TAG); + ball->getComponent()->getPhysicsBody()->setTag(DRAG_BODYS_TAG); addChild(ball); } - auto _world = getPhysicsWorld(); - Vec2 vec[4] = { VisibleRect::leftTop() + Vec2(102, -148), @@ -934,75 +969,73 @@ void PhysicsDemoPump::onEnter() auto pump = Node::create(); auto center = PhysicsShape::getPolyonCenter(vec, 4); pump->setPosition(center); - auto pumpB = PhysicsBody::createPolygon(vec, 4, PHYSICSBODY_MATERIAL_DEFAULT, -center); - pump->setPhysicsBody(pumpB); + addPhysicsComponent(pump, PhysicsBody::createPolygon(vec, 4, PHYSICSBODY_MATERIAL_DEFAULT, -center)); this->addChild(pump); - pumpB->setCategoryBitmask(0x02); - pumpB->setGravityEnable(false); + pump->getComponent()->getPhysicsBody()->setCategoryBitmask(0x02); + pump->getComponent()->getPhysicsBody()->setGravityEnable(false); // small gear auto sgear = Node::create(); - auto sgearB = PhysicsBody::createCircle(44); - sgear->setPhysicsBody(sgearB); + addPhysicsComponent(sgear, PhysicsBody::createCircle(44)); sgear->setPosition(VisibleRect::leftBottom() + Vec2(125, 0)); this->addChild(sgear); - sgearB->setCategoryBitmask(0x04); - sgearB->setCollisionBitmask(0x04); - sgearB->setTag(1); - - _world->addJoint(PhysicsJointPin::construct(body, sgearB, sgear->getPosition())); - _world->addJoint(PhysicsJointDistance::construct(pumpB, sgearB, Vec2(0, 0), Vec2(0, -44))); + sgear->getComponent()->getPhysicsBody()->setCategoryBitmask(0x04); + sgear->getComponent()->getPhysicsBody()->setCollisionBitmask(0x04); + sgear->getComponent()->getPhysicsBody()->setTag(1); + + _physicsWorld->addJoint(PhysicsJointPin::construct(node->getComponent()->getPhysicsBody(), sgear->getComponent()->getPhysicsBody(), sgear->getPosition())); + _physicsWorld->addJoint(PhysicsJointDistance::construct(pump->getComponent()->getPhysicsBody(), sgear->getComponent()->getPhysicsBody(), Vec2(0, 0), Vec2(0, -44))); // big gear auto bgear = Node::create(); - auto bgearB = PhysicsBody::createCircle(100); - bgear->setPhysicsBody(bgearB); + addPhysicsComponent(bgear, PhysicsBody::createCircle(100)); bgear->setPosition(VisibleRect::leftBottom() + Vec2(275, 0)); this->addChild(bgear); - bgearB->setCategoryBitmask(0x04); - - _world->addJoint(PhysicsJointPin::construct(bgearB, body, bgear->getPosition())); - _world->addJoint(PhysicsJointGear::construct(sgearB, bgearB, (float)-M_PI_2, -2.0f)); - + bgear->getComponent()->getPhysicsBody()->setCategoryBitmask(0x04); + + _physicsWorld->addJoint(PhysicsJointPin::construct(bgear->getComponent()->getPhysicsBody(), node->getComponent()->getPhysicsBody(), bgear->getPosition())); + _physicsWorld->addJoint(PhysicsJointGear::construct(sgear->getComponent()->getPhysicsBody(), bgear->getComponent()->getPhysicsBody(), (float)-M_PI_2, -2.0f)); + // plugger - Vec2 seg[] = {VisibleRect::leftTop() + Vec2(75, -120), VisibleRect::leftBottom() + Vec2(75, -100)}; - Vec2 segCenter = (seg[1] + seg[0])/2; + Vec2 seg[] = { VisibleRect::leftTop() + Vec2(75, -120), VisibleRect::leftBottom() + Vec2(75, -100) }; + Vec2 segCenter = (seg[1] + seg[0]) / 2; seg[1] -= segCenter; seg[0] -= segCenter; auto plugger = Node::create(); - auto pluggerB = PhysicsBody::createEdgeSegment(seg[0], seg[1], PhysicsMaterial(0.01f, 0.0f, 0.5f), 20); - pluggerB->setDynamic(true); - pluggerB->setMass(30); - pluggerB->setMoment(100000); - plugger->setPhysicsBody(pluggerB); + addPhysicsComponent(plugger, PhysicsBody::createEdgeSegment(seg[0], seg[1], PhysicsMaterial(0.01f, 0.0f, 0.5f), 20)); + plugger->getComponent()->getPhysicsBody()->setDynamic(true); + plugger->getComponent()->getPhysicsBody()->setMass(30); + plugger->getComponent()->getPhysicsBody()->setMoment(100000); plugger->setPosition(segCenter); this->addChild(plugger); - pluggerB->setCategoryBitmask(0x02); - sgearB->setCollisionBitmask(0x04 | 0x01); - _world->addJoint(PhysicsJointPin::construct(body, pluggerB, VisibleRect::leftBottom() + Vec2(75, -90))); - _world->addJoint(PhysicsJointDistance::construct(pluggerB, sgearB, Vec2::ZERO, Vec2(44, 0))); + plugger->getComponent()->getPhysicsBody()->setCategoryBitmask(0x02); + sgear->getComponent()->getPhysicsBody()->setCollisionBitmask(0x04 | 0x01); + _physicsWorld->addJoint(PhysicsJointPin::construct(node->getComponent()->getPhysicsBody(), plugger->getComponent()->getPhysicsBody(), VisibleRect::leftBottom() + Vec2(75, -90))); + _physicsWorld->addJoint(PhysicsJointDistance::construct(plugger->getComponent()->getPhysicsBody(), sgear->getComponent()->getPhysicsBody(), Vec2::ZERO, Vec2(44, 0))); } void PhysicsDemoPump::update(float delta) { - auto physicsWorld = getPhysicsWorld(); - - for (const auto& body : physicsWorld->getAllBodies()) + for (const auto& body : _physicsWorld->getAllBodies()) { if (body->getTag() == DRAG_BODYS_TAG && body->getPosition().y < 0.0f) { - body->getNode()->setPosition(VisibleRect::leftTop() + Vec2(75 + CCRANDOM_0_1() * 90, 0)); + if (body->getNode()!=nullptr) + { + body->getNode()->setPosition(VisibleRect::leftTop() + Vec2(75 + CCRANDOM_0_1() * 90, 0)); + } + body->setVelocity(Vec2(0, 0)); } } - PhysicsBody* gear = physicsWorld->getBody(1); + PhysicsBody* gear = _physicsWorld->getBody(1); if (gear != nullptr) { if (_distance != 0.0f) { - _rotationV += _distance/2500.0f; + _rotationV += _distance / 2500.0f; if (_rotationV > 30) _rotationV = 30.0f; if (_rotationV < -30) _rotationV = -30.0f; @@ -1057,22 +1090,22 @@ void PhysicsDemoOneWayPlatform::onEnter() _eventDispatcher->addEventListenerWithSceneGraphPriority(touchListener, this); auto ground = Node::create(); - ground->setPhysicsBody(PhysicsBody::createEdgeSegment(VisibleRect::leftBottom() + Vec2(0, 50), VisibleRect::rightBottom() + Vec2(0, 50))); + addPhysicsComponent(ground, PhysicsBody::createEdgeSegment(VisibleRect::leftBottom() + Vec2(0, 50), VisibleRect::rightBottom() + Vec2(0, 50))); this->addChild(ground); auto platform = makeBox(VisibleRect::center(), Size(200, 50)); - platform->getPhysicsBody()->setDynamic(false); - platform->getPhysicsBody()->setContactTestBitmask(0xFFFFFFFF); + platform->getComponent()->getPhysicsBody()->setDynamic(false); + platform->getComponent()->getPhysicsBody()->setContactTestBitmask(0xFFFFFFFF); this->addChild(platform); auto ball = makeBall(VisibleRect::center() - Vec2(0, 50), 20); - ball->getPhysicsBody()->setVelocity(Vec2(0, 150)); - ball->getPhysicsBody()->setTag(DRAG_BODYS_TAG); - ball->getPhysicsBody()->setMass(1.0f); - ball->getPhysicsBody()->setContactTestBitmask(0xFFFFFFFF); + ball->getComponent()->getPhysicsBody()->setVelocity(Vec2(0, 150)); + ball->getComponent()->getPhysicsBody()->setTag(DRAG_BODYS_TAG); + ball->getComponent()->getPhysicsBody()->setMass(1.0f); + ball->getComponent()->getPhysicsBody()->setContactTestBitmask(0xFFFFFFFF); this->addChild(ball); - auto contactListener = EventListenerPhysicsContactWithBodies::create(platform->getPhysicsBody(), ball->getPhysicsBody()); + auto contactListener = EventListenerPhysicsContactWithBodies::create(platform->getComponent()->getPhysicsBody(), ball->getComponent()->getPhysicsBody()); contactListener->onContactBegin = CC_CALLBACK_1(PhysicsDemoOneWayPlatform::onContactBegin, this); _eventDispatcher->addEventListenerWithSceneGraphPriority(contactListener, this); } @@ -1100,14 +1133,14 @@ void PhysicsDemoSlice::onEnter() _eventDispatcher->addEventListenerWithSceneGraphPriority(touchListener, this); auto ground = Node::create(); - ground->setPhysicsBody(PhysicsBody::createEdgeSegment(VisibleRect::leftBottom() + Vec2(0, 50), VisibleRect::rightBottom() + Vec2(0, 50))); + addPhysicsComponent(ground, PhysicsBody::createEdgeSegment(VisibleRect::leftBottom() + Vec2(0, 50), VisibleRect::rightBottom() + Vec2(0, 50))); this->addChild(ground); auto box = Node::create(); Vec2 points[4] = {Vec2(-100, -100), Vec2(-100, 100), Vec2(100, 100), Vec2(100, -100)}; - box->setPhysicsBody(PhysicsBody::createPolygon(points, 4)); + addPhysicsComponent(box, PhysicsBody::createPolygon(points, 4)); box->setPosition(VisibleRect::center()); - box->getPhysicsBody()->setTag(_sliceTag); + box->getComponent()->getPhysicsBody()->setTag(_sliceTag); addChild(box); } @@ -1166,7 +1199,7 @@ void PhysicsDemoSlice::clipPoly(PhysicsShapePolygon* shape, Vec2 normal, float d Node* node = Node::create(); PhysicsBody* polyon = PhysicsBody::createPolygon(points, pointsCount, PHYSICSBODY_MATERIAL_DEFAULT, -center); node->setPosition(center); - node->setPhysicsBody(polyon); + addPhysicsComponent(node, polyon); polyon->setVelocity(body->getVelocityAtWorldPoint(center)); polyon->setAngularVelocity(body->getAngularVelocity()); polyon->setTag(_sliceTag); @@ -1191,21 +1224,20 @@ std::string PhysicsDemoSlice::subtitle() const return "click and drag to slice up the block"; } - void PhysicsDemoBug3988::onEnter() { PhysicsDemo::onEnter(); toggleDebug(); - getPhysicsWorld()->setGravity(Vect::ZERO); - - auto ball = Sprite::create("Images/YellowSquare.png"); - ball->setPosition(VisibleRect::center() - Vec2(100, 0)); - ball->setRotation(30.0f); - this->addChild(ball); - - auto physicsBall = makeBox(VisibleRect::center() + Vec2(100, 0), Size(100, 100)); - physicsBall->setRotation(30.0f); - this->addChild(physicsBall); + _physicsWorld->setGravity(Vect::ZERO); + + auto ball = Sprite::create("Images/YellowSquare.png"); + ball->setPosition(VisibleRect::center() - Vec2(100, 0)); + ball->setRotation(30.0f); + this->addChild(ball); + + auto physicsBall = makeBox(VisibleRect::center() + Vec2(100, 0), Size(100, 100)); + physicsBall->setRotation(30.0f); + this->addChild(physicsBall); } std::string PhysicsDemoBug3988::title() const @@ -1221,7 +1253,7 @@ std::string PhysicsDemoBug3988::subtitle() const void PhysicsContactTest::onEnter() { PhysicsDemo::onEnter(); - getPhysicsWorld()->setGravity(Vect::ZERO); + _physicsWorld->setGravity(Vect::ZERO); auto s = VisibleRect::getVisibleRect().size; _yellowBoxNum = 50; @@ -1232,69 +1264,69 @@ void PhysicsContactTest::onEnter() MenuItemFont::setFontSize(65); auto decrease1 = MenuItemFont::create(" - ", CC_CALLBACK_1(PhysicsContactTest::onDecrease, this)); - decrease1->setColor(Color3B(0,200,20)); + decrease1->setColor(Color3B(0, 200, 20)); auto increase1 = MenuItemFont::create(" + ", CC_CALLBACK_1(PhysicsContactTest::onIncrease, this)); - increase1->setColor(Color3B(0,200,20)); + increase1->setColor(Color3B(0, 200, 20)); decrease1->setTag(1); increase1->setTag(1); auto menu1 = Menu::create(decrease1, increase1, nullptr); menu1->alignItemsHorizontally(); - menu1->setPosition(Vec2(s.width/2, s.height-50)); + menu1->setPosition(Vec2(s.width / 2, s.height - 50)); addChild(menu1, 1); auto label = Label::createWithTTF("yellow box", "fonts/arial.ttf", 32); addChild(label, 1); - label->setPosition(Vec2(s.width/2 - 150, s.height-50)); + label->setPosition(Vec2(s.width / 2 - 150, s.height - 50)); auto decrease2 = MenuItemFont::create(" - ", CC_CALLBACK_1(PhysicsContactTest::onDecrease, this)); - decrease2->setColor(Color3B(0,200,20)); + decrease2->setColor(Color3B(0, 200, 20)); auto increase2 = MenuItemFont::create(" + ", CC_CALLBACK_1(PhysicsContactTest::onIncrease, this)); - increase2->setColor(Color3B(0,200,20)); + increase2->setColor(Color3B(0, 200, 20)); decrease2->setTag(2); increase2->setTag(2); auto menu2 = Menu::create(decrease2, increase2, nullptr); menu2->alignItemsHorizontally(); - menu2->setPosition(Vec2(s.width/2, s.height-90)); + menu2->setPosition(Vec2(s.width / 2, s.height - 90)); addChild(menu2, 1); label = Label::createWithTTF("blue box", "fonts/arial.ttf", 32); addChild(label, 1); - label->setPosition(Vec2(s.width/2 - 150, s.height-90)); + label->setPosition(Vec2(s.width / 2 - 150, s.height - 90)); auto decrease3 = MenuItemFont::create(" - ", CC_CALLBACK_1(PhysicsContactTest::onDecrease, this)); - decrease3->setColor(Color3B(0,200,20)); + decrease3->setColor(Color3B(0, 200, 20)); auto increase3 = MenuItemFont::create(" + ", CC_CALLBACK_1(PhysicsContactTest::onIncrease, this)); - increase3->setColor(Color3B(0,200,20)); + increase3->setColor(Color3B(0, 200, 20)); decrease3->setTag(3); increase3->setTag(3); auto menu3 = Menu::create(decrease3, increase3, nullptr); menu3->alignItemsHorizontally(); - menu3->setPosition(Vec2(s.width/2, s.height-130)); + menu3->setPosition(Vec2(s.width / 2, s.height - 130)); addChild(menu3, 1); label = Label::createWithTTF("yellow triangle", "fonts/arial.ttf", 32); addChild(label, 1); - label->setPosition(Vec2(s.width/2 - 150, s.height-130)); + label->setPosition(Vec2(s.width / 2 - 150, s.height - 130)); auto decrease4 = MenuItemFont::create(" - ", CC_CALLBACK_1(PhysicsContactTest::onDecrease, this)); - decrease4->setColor(Color3B(0,200,20)); + decrease4->setColor(Color3B(0, 200, 20)); auto increase4 = MenuItemFont::create(" + ", CC_CALLBACK_1(PhysicsContactTest::onIncrease, this)); - increase4->setColor(Color3B(0,200,20)); + increase4->setColor(Color3B(0, 200, 20)); decrease4->setTag(4); increase4->setTag(4); auto menu4 = Menu::create(decrease4, increase4, nullptr); menu4->alignItemsHorizontally(); - menu4->setPosition(Vec2(s.width/2, s.height-170)); + menu4->setPosition(Vec2(s.width / 2, s.height - 170)); addChild(menu4, 1); label = Label::createWithTTF("blue triangle", "fonts/arial.ttf", 32); addChild(label, 1); - label->setPosition(Vec2(s.width/2 - 150, s.height-170)); - + label->setPosition(Vec2(s.width / 2 - 150, s.height - 170)); + resetTest(); } @@ -1303,16 +1335,16 @@ void PhysicsContactTest::onDecrease(Ref* sender) switch (dynamic_cast(sender)->getTag()) { case 1: - if(_yellowBoxNum > 0) _yellowBoxNum -= 50; + if (_yellowBoxNum > 0) _yellowBoxNum -= 50; break; case 2: - if(_blueBoxNum > 0) _blueBoxNum -= 50; + if (_blueBoxNum > 0) _blueBoxNum -= 50; break; case 3: - if(_yellowTriangleNum > 0) _yellowTriangleNum -= 50; + if (_yellowTriangleNum > 0) _yellowTriangleNum -= 50; break; case 4: - if(_blueTriangleNum > 0) _blueTriangleNum -= 50; + if (_blueTriangleNum > 0) _blueTriangleNum -= 50; break; default: @@ -1360,25 +1392,25 @@ void PhysicsContactTest::resetTest() sprintf(buffer, "%d", _yellowBoxNum); auto label = Label::createWithTTF(buffer, "fonts/arial.ttf", 32); root->addChild(label, 1); - label->setPosition(Vec2(s.width/2, s.height-50)); + label->setPosition(Vec2(s.width / 2, s.height - 50)); sprintf(buffer, "%d", _blueBoxNum); label = Label::createWithTTF(buffer, "fonts/arial.ttf", 32); root->addChild(label, 1); - label->setPosition(Vec2(s.width/2, s.height-90)); + label->setPosition(Vec2(s.width / 2, s.height - 90)); sprintf(buffer, "%d", _yellowTriangleNum); label = Label::createWithTTF(buffer, "fonts/arial.ttf", 32); root->addChild(label, 1); - label->setPosition(Vec2(s.width/2, s.height-130)); + label->setPosition(Vec2(s.width / 2, s.height - 130)); sprintf(buffer, "%d", _blueTriangleNum); label = Label::createWithTTF(buffer, "fonts/arial.ttf", 32); root->addChild(label, 1); - label->setPosition(Vec2(s.width/2, s.height-170)); + label->setPosition(Vec2(s.width / 2, s.height - 170)); auto wall = Node::create(); - wall->setPhysicsBody(PhysicsBody::createEdgeBox(VisibleRect::getVisibleRect().size, PhysicsMaterial(0.1f, 1, 0.0f))); + addPhysicsComponent(wall, PhysicsBody::createEdgeBox(VisibleRect::getVisibleRect().size, PhysicsMaterial(0.1f, 1, 0.0f))); wall->setPosition(VisibleRect::center()); root->addChild(wall); @@ -1389,72 +1421,72 @@ void PhysicsContactTest::resetTest() // yellow box, will collide with itself and blue box. for (int i = 0; i < _yellowBoxNum; ++i) { - Size size(10 + CCRANDOM_0_1()*10, 10 + CCRANDOM_0_1()*10); + Size size(10 + CCRANDOM_0_1() * 10, 10 + CCRANDOM_0_1() * 10); Size winSize = VisibleRect::getVisibleRect().size; Vec2 position = Vec2(winSize.width, winSize.height) - Vec2(size.width, size.height); position.x = position.x * CCRANDOM_0_1(); position.y = position.y * CCRANDOM_0_1(); - position = VisibleRect::leftBottom() + position + Vec2(size.width/2, size.height/2); - Vect velocity((CCRANDOM_0_1() - 0.5)*200, (CCRANDOM_0_1() - 0.5)*200); + position = VisibleRect::leftBottom() + position + Vec2(size.width / 2, size.height / 2); + Vect velocity((CCRANDOM_0_1() - 0.5) * 200, (CCRANDOM_0_1() - 0.5) * 200); auto box = makeBox(position, size, 1, PhysicsMaterial(0.1f, 1, 0.0f)); - box->getPhysicsBody()->setVelocity(velocity); - box->getPhysicsBody()->setCategoryBitmask(0x01); // 0001 - box->getPhysicsBody()->setContactTestBitmask(0x04); // 0100 - box->getPhysicsBody()->setCollisionBitmask(0x03); // 0011 + box->getComponent()->getPhysicsBody()->setVelocity(velocity); + box->getComponent()->getPhysicsBody()->setCategoryBitmask(0x01); // 0001 + box->getComponent()->getPhysicsBody()->setContactTestBitmask(0x04); // 0100 + box->getComponent()->getPhysicsBody()->setCollisionBitmask(0x03); // 0011 root->addChild(box); } // blue box, will collide with blue box. for (int i = 0; i < _blueBoxNum; ++i) { - Size size(10 + CCRANDOM_0_1()*10, 10 + CCRANDOM_0_1()*10); + Size size(10 + CCRANDOM_0_1() * 10, 10 + CCRANDOM_0_1() * 10); Size winSize = VisibleRect::getVisibleRect().size; Vec2 position = Vec2(winSize.width, winSize.height) - Vec2(size.width, size.height); position.x = position.x * CCRANDOM_0_1(); position.y = position.y * CCRANDOM_0_1(); - position = VisibleRect::leftBottom() + position + Vec2(size.width/2, size.height/2); - Vect velocity((CCRANDOM_0_1() - 0.5)*200, (CCRANDOM_0_1() - 0.5)*200); + position = VisibleRect::leftBottom() + position + Vec2(size.width / 2, size.height / 2); + Vect velocity((CCRANDOM_0_1() - 0.5) * 200, (CCRANDOM_0_1() - 0.5) * 200); auto box = makeBox(position, size, 2, PhysicsMaterial(0.1f, 1, 0.0f)); - box->getPhysicsBody()->setVelocity(velocity); - box->getPhysicsBody()->setCategoryBitmask(0x02); // 0010 - box->getPhysicsBody()->setContactTestBitmask(0x08); // 1000 - box->getPhysicsBody()->setCollisionBitmask(0x01); // 0001 + box->getComponent()->getPhysicsBody()->setVelocity(velocity); + box->getComponent()->getPhysicsBody()->setCategoryBitmask(0x02); // 0010 + box->getComponent()->getPhysicsBody()->setContactTestBitmask(0x08); // 1000 + box->getComponent()->getPhysicsBody()->setCollisionBitmask(0x01); // 0001 root->addChild(box); } // yellow triangle, will collide with itself and blue box. for (int i = 0; i < _yellowTriangleNum; ++i) { - Size size(10 + CCRANDOM_0_1()*10, 10 + CCRANDOM_0_1()*10); + Size size(10 + CCRANDOM_0_1() * 10, 10 + CCRANDOM_0_1() * 10); Size winSize = VisibleRect::getVisibleRect().size; Vec2 position = Vec2(winSize.width, winSize.height) - Vec2(size.width, size.height); position.x = position.x * CCRANDOM_0_1(); position.y = position.y * CCRANDOM_0_1(); - position = VisibleRect::leftBottom() + position + Vec2(size.width/2, size.height/2); - Vect velocity((CCRANDOM_0_1() - 0.5)*300, (CCRANDOM_0_1() - 0.5)*300); + position = VisibleRect::leftBottom() + position + Vec2(size.width / 2, size.height / 2); + Vect velocity((CCRANDOM_0_1() - 0.5) * 300, (CCRANDOM_0_1() - 0.5) * 300); auto triangle = makeTriangle(position, size, 1, PhysicsMaterial(0.1f, 1, 0.0f)); - triangle->getPhysicsBody()->setVelocity(velocity); - triangle->getPhysicsBody()->setCategoryBitmask(0x04); // 0100 - triangle->getPhysicsBody()->setContactTestBitmask(0x01); // 0001 - triangle->getPhysicsBody()->setCollisionBitmask(0x06); // 0110 + triangle->getComponent()->getPhysicsBody()->setVelocity(velocity); + triangle->getComponent()->getPhysicsBody()->setCategoryBitmask(0x04); // 0100 + triangle->getComponent()->getPhysicsBody()->setContactTestBitmask(0x01); // 0001 + triangle->getComponent()->getPhysicsBody()->setCollisionBitmask(0x06); // 0110 root->addChild(triangle); } // blue triangle, will collide with yellow box. for (int i = 0; i < _blueTriangleNum; ++i) { - Size size(10 + CCRANDOM_0_1()*10, 10 + CCRANDOM_0_1()*10); + Size size(10 + CCRANDOM_0_1() * 10, 10 + CCRANDOM_0_1() * 10); Size winSize = VisibleRect::getVisibleRect().size; Vec2 position = Vec2(winSize.width, winSize.height) - Vec2(size.width, size.height); position.x = position.x * CCRANDOM_0_1(); position.y = position.y * CCRANDOM_0_1(); - position = VisibleRect::leftBottom() + position + Vec2(size.width/2, size.height/2); - Vect velocity((CCRANDOM_0_1() - 0.5)*300, (CCRANDOM_0_1() - 0.5)*300); + position = VisibleRect::leftBottom() + position + Vec2(size.width / 2, size.height / 2); + Vect velocity((CCRANDOM_0_1() - 0.5) * 300, (CCRANDOM_0_1() - 0.5) * 300); auto triangle = makeTriangle(position, size, 2, PhysicsMaterial(0.1f, 1, 0.0f)); - triangle->getPhysicsBody()->setVelocity(velocity); - triangle->getPhysicsBody()->setCategoryBitmask(0x08); // 1000 - triangle->getPhysicsBody()->setContactTestBitmask(0x02); // 0010 - triangle->getPhysicsBody()->setCollisionBitmask(0x01); // 0001 + triangle->getComponent()->getPhysicsBody()->setVelocity(velocity); + triangle->getComponent()->getPhysicsBody()->setCategoryBitmask(0x08); // 1000 + triangle->getComponent()->getPhysicsBody()->setContactTestBitmask(0x02); // 0010 + triangle->getComponent()->getPhysicsBody()->setCollisionBitmask(0x01); // 0001 root->addChild(triangle); } } @@ -1484,7 +1516,7 @@ void PhysicsPositionRotationTest::onEnter() { PhysicsDemo::onEnter(); toggleDebug(); - getPhysicsWorld()->setGravity(Point::ZERO); + _physicsWorld->setGravity(Point::ZERO); auto touchListener = EventListenerTouchOneByOne::create(); touchListener->onTouchBegan = CC_CALLBACK_2(PhysicsDemo::onTouchBegan, this); @@ -1493,41 +1525,41 @@ void PhysicsPositionRotationTest::onEnter() _eventDispatcher->addEventListenerWithSceneGraphPriority(touchListener, this); auto wall = Node::create(); - wall->setPhysicsBody(PhysicsBody::createEdgeBox(VisibleRect::getVisibleRect().size)); + addPhysicsComponent(wall, PhysicsBody::createEdgeBox(VisibleRect::getVisibleRect().size)); wall->setPosition(VisibleRect::center()); addChild(wall); // anchor test auto anchorNode = Sprite::create("Images/YellowSquare.png"); - anchorNode->setAnchorPoint(Vec2(0.1f, 0.9f)); + //anchorNode->setAnchorPoint(Vec2(0.1f, 0.9f)); anchorNode->setPosition(100, 100); anchorNode->setScale(0.25); + addPhysicsComponent(anchorNode, PhysicsBody::createBox(anchorNode->getContentSize())); + anchorNode->getComponent()->getPhysicsBody()->setTag(DRAG_BODYS_TAG); addChild(anchorNode); - anchorNode->setPhysicsBody(PhysicsBody::createBox(anchorNode->getContentSize()*anchorNode->getScale())); - anchorNode->getPhysicsBody()->setTag(DRAG_BODYS_TAG); //parent test auto parent = Sprite::create("Images/YellowSquare.png"); parent->setPosition(200, 100); parent->setScale(0.25); - parent->setPhysicsBody(PhysicsBody::createBox(parent->getContentSize()*anchorNode->getScale())); - parent->getPhysicsBody()->setTag(DRAG_BODYS_TAG); + addPhysicsComponent(parent,PhysicsBody::createBox(parent->getContentSize())); + parent->getComponent()->getPhysicsBody()->setTag(DRAG_BODYS_TAG); addChild(parent); auto leftBall = Sprite::create("Images/ball.png"); leftBall->setPosition(-30, 0); - leftBall->cocos2d::Node::setScale(2); - leftBall->setPhysicsBody(PhysicsBody::createCircle(leftBall->getContentSize().width)); - leftBall->getPhysicsBody()->setTag(DRAG_BODYS_TAG); + leftBall->Node::setScale(2); + addPhysicsComponent(leftBall, PhysicsBody::createCircle(leftBall->getContentSize().width/2)); + leftBall->getComponent()->getPhysicsBody()->setTag(DRAG_BODYS_TAG); parent->addChild(leftBall); // offset position rotation test auto offsetPosNode = Sprite::create("Images/YellowSquare.png"); offsetPosNode->setPosition(100, 200); - offsetPosNode->setPhysicsBody(PhysicsBody::createBox(offsetPosNode->getContentSize()/2)); - offsetPosNode->getPhysicsBody()->setPositionOffset(-Vec2(offsetPosNode->getContentSize()/2)); - offsetPosNode->getPhysicsBody()->setRotationOffset(45); - offsetPosNode->getPhysicsBody()->setTag(DRAG_BODYS_TAG); + addPhysicsComponent(offsetPosNode, PhysicsBody::createBox(offsetPosNode->getContentSize()/2)); + offsetPosNode->getComponent()->getPhysicsBody()->setPositionOffset(-Vec2(offsetPosNode->getContentSize() / 2)); + offsetPosNode->getComponent()->getPhysicsBody()->setRotationOffset(45); + offsetPosNode->getComponent()->getPhysicsBody()->setTag(DRAG_BODYS_TAG); addChild(offsetPosNode); return; @@ -1538,7 +1570,6 @@ std::string PhysicsPositionRotationTest::title() const return "Position/Rotation Test"; } - void PhysicsSetGravityEnableTest::onEnter() { PhysicsDemo::onEnter(); @@ -1551,36 +1582,36 @@ void PhysicsSetGravityEnableTest::onEnter() // wall auto wall = Node::create(); - wall->setPhysicsBody(PhysicsBody::createEdgeBox(VisibleRect::getVisibleRect().size, PhysicsMaterial(0.1f, 1.0f, 0.0f))); + addPhysicsComponent(wall, PhysicsBody::createEdgeBox(VisibleRect::getVisibleRect().size, PhysicsMaterial(0.1f, 1.0f, 0.0f))); wall->setPosition(VisibleRect::center()); addChild(wall); // common box auto commonBox = makeBox(Vec2(100, 100), Size(50, 50), 1); - commonBox->getPhysicsBody()->setTag(DRAG_BODYS_TAG); + commonBox->getComponent()->getPhysicsBody()->setTag(DRAG_BODYS_TAG); addChild(commonBox); auto box = makeBox(Vec2(200, 100), Size(50, 50), 2); - box->getPhysicsBody()->setMass(20); - box->getPhysicsBody()->setTag(DRAG_BODYS_TAG); - box->getPhysicsBody()->setGravityEnable(false); + box->getComponent()->getPhysicsBody()->setMass(20); + box->getComponent()->getPhysicsBody()->setTag(DRAG_BODYS_TAG); + box->getComponent()->getPhysicsBody()->setGravityEnable(false); addChild(box); auto ball = makeBall(Vec2(200, 200), 50); ball->setTag(2); - ball->getPhysicsBody()->setTag(DRAG_BODYS_TAG); - ball->getPhysicsBody()->setGravityEnable(false); + ball->getComponent()->getPhysicsBody()->setTag(DRAG_BODYS_TAG); + ball->getComponent()->getPhysicsBody()->setGravityEnable(false); addChild(ball); - ball->getPhysicsBody()->setMass(50); + ball->getComponent()->getPhysicsBody()->setMass(50); scheduleOnce(CC_SCHEDULE_SELECTOR(PhysicsSetGravityEnableTest::onScheduleOnce), 1.0); } void PhysicsSetGravityEnableTest::onScheduleOnce(float delta) { auto ball = getChildByTag(2); - ball->getPhysicsBody()->setMass(200); + ball->getComponent()->getPhysicsBody()->setMass(200); - getPhysicsWorld()->setGravity(Vect(0, 98)); + _physicsWorld->setGravity(Vect(0, 98)); } std::string PhysicsSetGravityEnableTest::title() const @@ -1593,7 +1624,7 @@ std::string PhysicsSetGravityEnableTest::subtitle() const return "only yellow box drop down"; } -void Bug5482::onEnter() +void PhysicsDemoBug5482::onEnter() { PhysicsDemo::onEnter(); @@ -1609,23 +1640,25 @@ void Bug5482::onEnter() // wall auto wall = Node::create(); - wall->setPhysicsBody(PhysicsBody::createEdgeBox(VisibleRect::getVisibleRect().size, PhysicsMaterial(0.1f, 1.0f, 0.0f))); + addPhysicsComponent(wall, PhysicsBody::createEdgeBox(VisibleRect::getVisibleRect().size, PhysicsMaterial(0.1f, 1.0f, 0.0f))); wall->setPosition(VisibleRect::center()); addChild(wall); //button MenuItemFont::setFontSize(18); - _button = MenuItemFont::create("Set Body To A", CC_CALLBACK_1(Bug5482::changeBodyCallback, this)); + _button = MenuItemFont::create("Set Body To A", CC_CALLBACK_1(PhysicsDemoBug5482::changeBodyCallback, this)); auto menu = Menu::create(_button, nullptr); this->addChild(menu); _nodeA = Sprite::create("Images/YellowSquare.png"); _nodeA->setPosition(VisibleRect::center().x - 150, 100); + _nodeA->addComponent(ComponentPhysics2d::create()); this->addChild(_nodeA); _nodeB = Sprite::create("Images/YellowSquare.png"); _nodeB->setPosition(VisibleRect::center().x + 150, 100); + _nodeB->addComponent(ComponentPhysics2d::create()); this->addChild(_nodeB); _body = PhysicsBody::createBox(_nodeA->getContentSize()); @@ -1633,27 +1666,25 @@ void Bug5482::onEnter() _body->retain(); } -void Bug5482::onExit() +void PhysicsDemoBug5482::onExit() { PhysicsDemo::onExit(); _body->release(); } -void Bug5482::changeBodyCallback(Ref* sender) +void PhysicsDemoBug5482::changeBodyCallback(Ref* sender) { Sprite* node = _bodyInA ? _nodeB : _nodeA; - - node->setPhysicsBody(_body); - + node->getComponent()->setPhysicsBody(_body); _bodyInA = !_bodyInA; } -std::string Bug5482::title() const +std::string PhysicsDemoBug5482::title() const { return "bug 5482: setPhysicsBodyTest"; } -std::string Bug5482::subtitle() const +std::string PhysicsDemoBug5482::subtitle() const { return "change physics body to the other."; } @@ -1662,12 +1693,12 @@ void PhysicsFixedUpdate::onEnter() { PhysicsDemo::onEnter(); - getPhysicsWorld()->setDebugDrawMask(PhysicsWorld::DEBUGDRAW_ALL); - getPhysicsWorld()->setGravity(Point::ZERO); + _physicsWorld->setDebugDrawMask(PhysicsWorld::DEBUGDRAW_ALL); + _physicsWorld->setGravity(Point::ZERO); // wall auto wall = Node::create(); - wall->setPhysicsBody(PhysicsBody::createEdgeBox(VisibleRect::getVisibleRect().size, PhysicsMaterial(0.1f, 1, 0.0f))); + addPhysicsComponent(wall, PhysicsBody::createEdgeBox(VisibleRect::getVisibleRect().size, PhysicsMaterial(0.1f, 1, 0.0f))); wall->setPosition(VisibleRect::center()); this->addChild(wall); @@ -1680,9 +1711,9 @@ void PhysicsFixedUpdate::addBall() { auto ball = Sprite::create("Images/ball.png"); ball->setPosition(100, 100); - ball->setPhysicsBody(PhysicsBody::createCircle(ball->getContentSize().width/2, PhysicsMaterial(0.1f, 1, 0.0f))); - ball->getPhysicsBody()->setTag(DRAG_BODYS_TAG); - ball->getPhysicsBody()->setVelocity(Point(1000, 20)); + addPhysicsComponent(ball, PhysicsBody::createCircle(ball->getContentSize().width/2, PhysicsMaterial(0.1f, 1, 0.0f))); + ball->getComponent()->getPhysicsBody()->setTag(DRAG_BODYS_TAG); + ball->getComponent()->getPhysicsBody()->setVelocity(Point(1000, 20)); this->addChild(ball); } @@ -1690,7 +1721,7 @@ void PhysicsFixedUpdate::updateStart(float delta) { addBall(); - getPhysicsWorld()->setAutoStep(false); + _physicsWorld->setAutoStep(false); scheduleUpdate(); } @@ -1700,7 +1731,7 @@ void PhysicsFixedUpdate::update(float delta) // use fixed time and calculate 3 times per frame makes physics simulate more precisely. for (int i = 0; i < 3; ++i) { - getPhysicsWorld()->step(1/180.0f); + _physicsWorld->step(1/180.0f); } } @@ -1724,7 +1755,7 @@ void PhysicsTransformTest::onEnter() { PhysicsDemo::onEnter(); toggleDebug(); - getPhysicsWorld()->setGravity(Point::ZERO); + _physicsWorld->setGravity(Point::ZERO); auto touchListener = EventListenerTouchOneByOne::create(); touchListener->onTouchBegan = CC_CALLBACK_2(PhysicsTransformTest::onTouchBegan, this); @@ -1734,7 +1765,7 @@ void PhysicsTransformTest::onEnter() addChild(_rootLayer); auto wall = Node::create(); - wall->setPhysicsBody(PhysicsBody::createEdgeBox(VisibleRect::getVisibleRect().size, PhysicsMaterial(0.1f, 1.0f, 0.0f))); + addPhysicsComponent(wall, PhysicsBody::createEdgeBox(VisibleRect::getVisibleRect().size, PhysicsMaterial(0.1f, 1.0f, 0.0f))); wall->setPosition(VisibleRect::center()); _rootLayer->addChild(wall); @@ -1742,16 +1773,16 @@ void PhysicsTransformTest::onEnter() _parentSprite = Sprite::create("Images/YellowSquare.png"); _parentSprite->setPosition(200, 100); _parentSprite->setScale(0.25); - _parentSprite->setPhysicsBody(PhysicsBody::createBox(_parentSprite->getContentSize()*_parentSprite->getScale(), PhysicsMaterial(0.1f, 1.0f, 0.0f))); - _parentSprite->getPhysicsBody()->setTag(DRAG_BODYS_TAG); + addPhysicsComponent(_parentSprite, PhysicsBody::createBox(_parentSprite->getContentSize(), PhysicsMaterial(0.1f, 1.0f, 0.0f))); + _parentSprite->getComponent()->getPhysicsBody()->setTag(DRAG_BODYS_TAG); _parentSprite->setTag(1); _rootLayer->addChild(_parentSprite); auto leftBall = Sprite::create("Images/ball.png"); leftBall->setPosition(-30, 0); - leftBall->cocos2d::Node::setScale(2); - leftBall->setPhysicsBody(PhysicsBody::createCircle(leftBall->getContentSize().width, PhysicsMaterial(0.1f, 1.0f, 0.0f))); - leftBall->getPhysicsBody()->setTag(DRAG_BODYS_TAG); + leftBall->setScale(2); + addPhysicsComponent(leftBall, PhysicsBody::createCircle(leftBall->getContentSize().width/2, PhysicsMaterial(0.1f, 1.0f, 0.0f))); + leftBall->getComponent()->getPhysicsBody()->setTag(DRAG_BODYS_TAG); _parentSprite->addChild(leftBall); ScaleTo* scaleTo = ScaleTo::create(2.0, 0.5); @@ -1761,20 +1792,16 @@ void PhysicsTransformTest::onEnter() auto normal = Sprite::create("Images/YellowSquare.png"); normal->setPosition(300, 100); normal->setScale(0.25, 0.5); - auto size = _parentSprite->getContentSize(); - size.width *= normal->getScaleX(); - size.height *= normal->getScaleY(); - normal->setPhysicsBody(PhysicsBody::createBox(size, PhysicsMaterial(0.1f, 1.0f, 0.0f))); - normal->getPhysicsBody()->setTag(DRAG_BODYS_TAG); + addPhysicsComponent(normal,PhysicsBody::createBox(normal->getContentSize(), PhysicsMaterial(0.1f, 1.0f, 0.0f))); + normal->getComponent()->getPhysicsBody()->setTag(DRAG_BODYS_TAG); _rootLayer->addChild(normal); auto bullet = Sprite::create("Images/ball.png"); bullet->setPosition(200, 200); - bullet->setPhysicsBody(PhysicsBody::createCircle(bullet->getContentSize().width/2, PhysicsMaterial(0.1f, 1.0f, 0.0f))); - bullet->getPhysicsBody()->setVelocity(Vect(100, 100)); + addPhysicsComponent(bullet,PhysicsBody::createCircle(bullet->getContentSize().width/2, PhysicsMaterial(0.1f, 1.0f, 0.0f))); + bullet->getComponent()->getPhysicsBody()->setVelocity(Vect(100, 100)); _rootLayer->addChild(bullet); - MoveBy* move = MoveBy::create(2.0f, Vec2(100, 100)); MoveBy* move2 = MoveBy::create(2.0f, Vec2(-200, 0)); MoveBy* move3 = MoveBy::create(2.0f, Vec2(100, -100)); @@ -1826,4 +1853,4 @@ std::string PhysicsIssue9959::subtitle() const return "Test Scale9Sprite run scale/move/rotation action in physics scene"; } -#endif // ifndef CC_USE_PHYSICS +#endif \ No newline at end of file diff --git a/tests/cpp-tests/Classes/PhysicsTest/PhysicsTest.h b/tests/cpp-tests/Classes/PhysicsTest/PhysicsTest.h index 0e3646c9fd..4163e1d13b 100644 --- a/tests/cpp-tests/Classes/PhysicsTest/PhysicsTest.h +++ b/tests/cpp-tests/Classes/PhysicsTest/PhysicsTest.h @@ -1,22 +1,13 @@ -#ifndef _PHYSICS_TEST_H_ -#define _PHYSICS_TEST_H_ - -#include "cocos2d.h" -#include "../BaseTest.h" +#pragma once #include -DEFINE_TEST_SUITE(PhysicsTests); +#include "../BaseTest.h" -#if CC_USE_PHYSICS == 0 -class PhysicsDemoDisabled : public TestCase -{ -public: - CREATE_FUNC(PhysicsDemoDisabled); - - virtual void onEnter() override; -}; -#else +#if CC_USE_PHYSICS + + +DEFINE_TEST_SUITE(PhysicsTests); class PhysicsDemo : public TestCase { @@ -38,20 +29,32 @@ public: bool onTouchBegan(cocos2d::Touch* touch, cocos2d::Event* event); void onTouchMoved(cocos2d::Touch* touch, cocos2d::Event* event); void onTouchEnded(cocos2d::Touch* touch, cocos2d::Event* event); - + void toggleDebug(); + protected: + void addPhysicsComponent(cocos2d::Node *node, cocos2d::PhysicsBody *physicsBody); + cocos2d::Texture2D* _spriteTexture; cocos2d::SpriteBatchNode* _ball; std::unordered_map _mouses; bool _debugDraw; }; +class PhysicsDemoLogoSmash : public PhysicsDemo +{ +public: + CREATE_FUNC(PhysicsDemoLogoSmash); + + void onEnter() override; + virtual std::string title() const override; +}; + class PhysicsDemoClickAdd : public PhysicsDemo { public: CREATE_FUNC(PhysicsDemoClickAdd); - + virtual ~PhysicsDemoClickAdd(); void onEnter() override; virtual std::string subtitle() const override; @@ -60,20 +63,11 @@ public: void onAcceleration(cocos2d::Acceleration* acc, cocos2d::Event* event); }; -class PhysicsDemoLogoSmash : public PhysicsDemo -{ -public: - CREATE_FUNC(PhysicsDemoLogoSmash); - - void onEnter() override; - virtual std::string title() const override; -}; - class PhysicsDemoPyramidStack : public PhysicsDemo { public: CREATE_FUNC(PhysicsDemoPyramidStack); - + void onEnter() override; void updateOnce(float delta); virtual std::string title() const override; @@ -83,9 +77,9 @@ class PhysicsDemoRayCast : public PhysicsDemo { public: CREATE_FUNC(PhysicsDemoRayCast); - + PhysicsDemoRayCast(); - + void onEnter() override; virtual std::string title() const override; void update(float delta) override; @@ -101,20 +95,20 @@ private: int _mode; }; -class PhysicsDemoJoints : public PhysicsDemo -{ -public: - CREATE_FUNC(PhysicsDemoJoints); - - void onEnter() override; - virtual std::string title() const override; -}; - class PhysicsDemoActions : public PhysicsDemo { public: CREATE_FUNC(PhysicsDemoActions); + + void onEnter() override; + virtual std::string title() const override; +}; +class PhysicsDemoJoints : public PhysicsDemo +{ +public: + CREATE_FUNC(PhysicsDemoJoints); + void onEnter() override; virtual std::string title() const override; }; @@ -123,7 +117,7 @@ class PhysicsDemoPump : public PhysicsDemo { public: CREATE_FUNC(PhysicsDemoPump); - + void onEnter() override; void update(float delta) override; virtual std::string title() const override; @@ -142,7 +136,7 @@ class PhysicsDemoOneWayPlatform : public PhysicsDemo { public: CREATE_FUNC(PhysicsDemoOneWayPlatform); - + void onEnter() override; virtual std::string title() const override; @@ -153,7 +147,7 @@ class PhysicsDemoSlice : public PhysicsDemo { public: CREATE_FUNC(PhysicsDemoSlice); - + void onEnter() override; virtual std::string title() const override; virtual std::string subtitle() const override; @@ -171,7 +165,7 @@ class PhysicsDemoBug3988 : public PhysicsDemo { public: CREATE_FUNC(PhysicsDemoBug3988); - + void onEnter() override; virtual std::string title() const override; virtual std::string subtitle() const override; @@ -218,10 +212,10 @@ public: virtual std::string subtitle() const override; }; -class Bug5482 : public PhysicsDemo +class PhysicsDemoBug5482 : public PhysicsDemo { public: - CREATE_FUNC(Bug5482); + CREATE_FUNC(PhysicsDemoBug5482); void onEnter() override; void onExit() override; @@ -274,5 +268,4 @@ public: virtual std::string subtitle() const override; }; -#endif -#endif +#endif // #if CC_USE_PHYSICS \ No newline at end of file diff --git a/tests/cpp-tests/Classes/SpritePolygonTest/SpritePolygonTest.cpp b/tests/cpp-tests/Classes/SpritePolygonTest/SpritePolygonTest.cpp index d4f1a9abbb..af749d442a 100644 --- a/tests/cpp-tests/Classes/SpritePolygonTest/SpritePolygonTest.cpp +++ b/tests/cpp-tests/Classes/SpritePolygonTest/SpritePolygonTest.cpp @@ -15,115 +15,346 @@ SpritePolygonTest::SpritePolygonTest() ADD_TEST_CASE(SpritePerformanceTestDynamic); } -void SpritePolygonTestCase::onBackCallback(cocos2d::Ref *sender) +SpritePolygonTestCase::SpritePolygonTestCase() { - TestCase::onBackCallback(sender); - Director::getInstance()->setClearColor(Color4F::BLACK); + _isDebugDraw = true; + _isNeedDebugMenu = true; } -void SpritePolygonTestDemo::initTouchDebugDraw() +SpritePolygonTestCase::~SpritePolygonTestCase() +{ + _drawNodes.clear(); +} + +void SpritePolygonTestCase::onEnter() +{ + TestCase::onEnter(); + Director::getInstance()->setClearColor(Color4F(102.0f/255.0f, 184.0f/255.0f, 204.0f/255.0f, 1.0f)); +} + +void SpritePolygonTestCase::onExit() +{ + Director::getInstance()->setClearColor(Color4F::BLACK); + TestCase::onExit(); +} + +bool SpritePolygonTestCase::init() +{ + if(TestCase::init()) + { + if (_isNeedDebugMenu) + { + TTFConfig ttfConfig("fonts/arial.ttf", 10); + auto label = Label::createWithTTF(ttfConfig,"DebugDraw OFF"); + auto menuItem = MenuItemLabel::create(label, [=](Ref *ref){ + if (_isDebugDraw){ + _isDebugDraw = false; + label->setString("DebugDraw ON"); + for (int i = 0; i < _drawNodes.size(); i++) + { + _drawNodes.at(i)->setVisible(false); + } + }else{ + _isDebugDraw = true; + label->setString("DebugDraw OFF"); + for (int i = 0; i < _drawNodes.size(); i++) + { + _drawNodes.at(i)->setVisible(true); + updateDrawNode(); + } + } + }); + + auto menu = Menu::create(menuItem, nullptr); + menu->setPosition(Vec2::ZERO); + menuItem->setAnchorPoint(Vec2::ANCHOR_TOP_LEFT); + menuItem->setPosition( VisibleRect::leftBottom() + Vec2(0, VisibleRect::leftTop().y/4)); + this->addChild(menu, 9999); + } + return true; + } + return false; +} + +void SpritePolygonTestCase::updateDrawNode() +{ + if (_isDebugDraw && _drawNodes.size() > 0) { + for (int i = 0; i < _drawNodes.size(); i++) + { + auto drawnode = _drawNodes.at(i); + auto sp = (Sprite*)drawnode->getParent(); + if(!sp) return; + auto polygoninfo = sp->getPolygonInfo(); + drawnode->clear(); + auto count = polygoninfo.triangles.indexCount/3; + auto indices = polygoninfo.triangles.indices; + auto verts = polygoninfo.triangles.verts; + for(ssize_t i = 0; i < count; i++) + { + //draw 3 lines + Vec3 from =verts[indices[i*3]].vertices; + Vec3 to = verts[indices[i*3+1]].vertices; + drawnode->drawLine(Vec2(from.x, from.y), Vec2(to.x,to.y), Color4F::GREEN); + + from =verts[indices[i*3+1]].vertices; + to = verts[indices[i*3+2]].vertices; + drawnode->drawLine(Vec2(from.x, from.y), Vec2(to.x,to.y), Color4F::GREEN); + + from =verts[indices[i*3+2]].vertices; + to = verts[indices[i*3]].vertices; + drawnode->drawLine(Vec2(from.x, from.y), Vec2(to.x,to.y), Color4F::GREEN); + } + } + } +} + +bool SpritePolygonTestDemo::init() +{ + if (SpritePolygonTestCase::init()) { + initSprites(); + initTouches(); + return true; + } + return false; +} + +void SpritePolygonTestDemo::initTouches() { auto touchListener = EventListenerTouchOneByOne::create(); touchListener->onTouchBegan = [&](Touch* touch, Event* event){ - sp->debugDraw(true); - spp->debugDraw(true); return true; }; touchListener->onTouchMoved = [&](Touch* touch, Event* event){ auto pos = touch->getDelta(); - float newScale = clampf(spp->getScale() + pos.x * 0.01f, 0.1f, 2.f); - spp->setScale(newScale); - sp->setScale(newScale); - }; - touchListener->onTouchEnded = [&](Touch* touch, Event* event){ - spp->debugDraw(false); - sp->debugDraw(false); + float newScale = clampf(_polygonSprite->getScale() + pos.x * 0.01f, 0.1f, 2.f); + _polygonSprite->setScale(newScale); + _normalSprite->setScale(newScale); + updateDrawNode(); }; _eventDispatcher->addEventListenerWithSceneGraphPriority(touchListener, this); } -void SpritePolygonTest1::make2Sprites() -{ - Director::getInstance()->setClearColor(Color4F(102.f/255, 184.f/255, 204.f/255, 255.f)); - auto filename = s_pathGrossini; - auto pinfo = AutoPolygon::generatePolygon(filename); - spp = Sprite::create(pinfo); - addChild(spp); - auto s = Director::getInstance()->getWinSize(); - auto offset = Vec2(0.15*s.width,0); - spp->setPosition(Vec2(s)/2 + offset); - - sp = Sprite::create(filename); - addChild(sp); - sp->setPosition(Vec2(s)/2 - offset); - - TTFConfig ttfConfig("fonts/arial.ttf", 8); - std::string temp = "Sprite:\nPixels drawn: "; - auto spSize = sp->getContentSize(); - auto spArea = Label::createWithTTF(ttfConfig, temp+Value((int)spSize.width*(int)spSize.height).asString()); - sp->addChild(spArea); - spArea->setAnchorPoint(Vec2(0,1)); - - temp = "SpritePolygon:\nPixels drawn: "; - auto vertCount = "\nverts:"+Value((int)pinfo.getVertCount()).asString(); - auto sppArea = Label::createWithTTF(ttfConfig, temp+Value((int)pinfo.getArea()).asString()+vertCount); - spp->addChild(sppArea); - sppArea->setAnchorPoint(Vec2(0,1)); - - initTouchDebugDraw(); -} - SpritePolygonTest1::SpritePolygonTest1() { _title = "SpritePolygon Creation"; _subtitle = "Sprite::create(AutoPolygon::generatePolygon(filename))"; - make2Sprites(); +} + +void SpritePolygonTest1::initSprites() +{ + auto s = Director::getInstance()->getWinSize(); + auto offset = Vec2(0.15*s.width,0); + auto filename = s_pathGrossini; + + //Sprite + auto pinfo = AutoPolygon::generatePolygon(filename); + _polygonSprite = Sprite::create(pinfo); + _polygonSprite->setTag(101); + addChild(_polygonSprite); + _polygonSprite->setPosition(Vec2(s)/2 + offset); + + _normalSprite = Sprite::create(filename); + _normalSprite->setTag(100); + addChild(_normalSprite); + _normalSprite->setPosition(Vec2(s)/2 - offset); + + //DrawNode + auto spDrawNode = DrawNode::create(); + spDrawNode->setTag(_normalSprite->getTag()); + spDrawNode->clear(); + _normalSprite->addChild(spDrawNode); + _drawNodes.pushBack(spDrawNode); + + auto sppDrawNode = DrawNode::create(); + sppDrawNode->setTag(_polygonSprite->getTag()); + sppDrawNode->clear(); + _polygonSprite->addChild(sppDrawNode); + _drawNodes.pushBack(sppDrawNode); + + //Label + TTFConfig ttfConfig("fonts/arial.ttf", 8); + std::string temp = "Sprite:\nPixels drawn: "; + auto spSize = _normalSprite->getContentSize(); + auto spArea = Label::createWithTTF(ttfConfig, temp+Value((int)spSize.width*(int)spSize.height).asString()); + _normalSprite->addChild(spArea); + spArea->setAnchorPoint(Vec2(0,1)); + + temp = "SpritePolygon:\nPixels drawn: "; + auto vertCount = "\nverts:"+Value((int)pinfo.getVertCount()).asString(); + auto sppArea = Label::createWithTTF(ttfConfig, temp+Value((int)pinfo.getArea()).asString()+vertCount); + _polygonSprite->addChild(sppArea); + sppArea->setAnchorPoint(Vec2(0,1)); + + updateDrawNode(); } SpritePolygonTest2::SpritePolygonTest2() { _title = "SpritePolygon Creation with a rect"; _subtitle = "Sprite::create(AutoPolygon::generatePolygon(filename, rect))"; - make2Sprites(); } -void SpritePolygonTest2::make2Sprites() +void SpritePolygonTest2::initSprites() { - Director::getInstance()->setClearColor(Color4F(102.f/255, 184.f/255, 204.f/255, 255.f)); - auto filename = s_pathGrossini; - Rect head = Rect(30,25,25,25); - auto pinfo = AutoPolygon::generatePolygon(filename, head); - spp = Sprite::create(pinfo); - addChild(spp); auto s = Director::getInstance()->getWinSize(); auto offset = Vec2(0.15*s.width,0); - spp->setPosition(Vec2(s)/2 + offset); + auto filename = s_pathGrossini; + Rect head = Rect(30,25,25,25); - sp = Sprite::create(filename,head); - addChild(sp); - sp->setPosition(Vec2(s)/2 - offset); + //Sprite + auto pinfo = AutoPolygon::generatePolygon(filename, head); + _polygonSprite = Sprite::create(pinfo); + _polygonSprite->setTag(101); + addChild(_polygonSprite); + _polygonSprite->setPosition(Vec2(s)/2 + offset); + _normalSprite = Sprite::create(filename,head); + _normalSprite->setTag(100); + addChild(_normalSprite); + _normalSprite->setPosition(Vec2(s)/2 - offset); + + //DrawNode + auto spDrawNode = DrawNode::create(); + _drawNodes.pushBack(spDrawNode); + spDrawNode->setTag(_normalSprite->getTag()); + spDrawNode->clear(); + _normalSprite->addChild(spDrawNode); + + auto sppDrawNode = DrawNode::create(); + _drawNodes.pushBack(sppDrawNode); + sppDrawNode->setTag(_polygonSprite->getTag()); + sppDrawNode->clear(); + _polygonSprite->addChild(sppDrawNode); + + //Label TTFConfig ttfConfig("fonts/arial.ttf", 8); std::string temp = "Sprite:\nPixels drawn: "; - auto spSize = sp->getContentSize(); + auto spSize = _normalSprite->getContentSize(); auto spArea = Label::createWithTTF(ttfConfig, temp+Value((int)spSize.width*(int)spSize.height).asString()); - sp->addChild(spArea); + _normalSprite->addChild(spArea); spArea->setAnchorPoint(Vec2(0,1)); temp = "SpritePolygon:\nPixels drawn: "; auto vertCount = "\nverts:"+Value((int)pinfo.getVertCount()).asString(); auto sppArea = Label::createWithTTF(ttfConfig, temp+Value((int)pinfo.getArea()).asString()+vertCount); - spp->addChild(sppArea); + _polygonSprite->addChild(sppArea); sppArea->setAnchorPoint(Vec2(0,1)); - initTouchDebugDraw(); + updateDrawNode(); +} + +bool SpritePolygonTestSlider::init() +{ + if(SpritePolygonTestCase::init()) + { + initSliders(); + initSprites(); + return true; + } + return false; +} + +void SpritePolygonTestSlider::initSliders() +{ + auto vsize =Director::getInstance()->getVisibleSize(); + cocos2d::ui::Slider* slider = cocos2d::ui::Slider::create(); + slider->loadBarTexture("cocosui/sliderTrack.png"); + slider->loadSlidBallTextures("cocosui/sliderThumb.png", "cocosui/sliderThumb.png", ""); + slider->loadProgressBarTexture("cocosui/sliderProgress.png"); + slider->setPosition(Vec2(vsize.width/2, vsize.height/4)); + + slider->addEventListener(CC_CALLBACK_2(SpritePolygonTestSlider::changeEpsilon, this)); + slider->setPercent((int)(sqrtf(1.0f/19.0f)*100)); + + auto ttfConfig = TTFConfig("fonts/arial.ttf", 8); + _epsilonLabel = Label::createWithTTF(ttfConfig, "Epsilon: 2.0"); + addChild(_epsilonLabel); + _epsilonLabel->setPosition(Vec2(vsize.width/2, vsize.height/4 + 15)); + addChild(slider); +} + +void SpritePolygonTestSlider::makeSprites(const std::string* list, const int count, const float y) +{ + auto vsize =Director::getInstance()->getVisibleSize(); + float offset = (vsize.width-100)/(count-1); + for(int i = 0; i < count; i++) + { + auto sp = makeSprite(list[i], Vec2(50+offset*i, y)); + addChild(sp); + } +} + +void SpritePolygonTestSlider::changeEpsilon(cocos2d::Ref *pSender, cocos2d::ui::Slider::EventType type) +{ + if (type == cocos2d::ui::Slider::EventType::ON_PERCENTAGE_CHANGED) + { + cocos2d::ui::Slider* slider = dynamic_cast(pSender); + float epsilon = powf(slider->getPercent()/100.0,2)*19.0f + 1.0f; + for(auto child : _children) + { + if(child->getName().size()) + { + Sprite *sp = (Sprite*)child; + auto file = sp->getName(); + auto pinfo = AutoPolygon::generatePolygon(file, Rect::ZERO, epsilon); + sp->setPolygonInfo(pinfo); + updateLabel(sp, pinfo); + } + } + _epsilonLabel->setString("Epsilon: "+ Value(epsilon).asString()); + updateDrawNode(); + } +} + +void SpritePolygonTestSlider::updateLabel(const cocos2d::Sprite *sp, const PolygonInfo &pinfo) +{ + Label *label = (Label*)(sp->getChildByName(sp->getName())); + auto filename = sp->getName(); + auto size = pinfo.rect.size/Director::getInstance()->getContentScaleFactor(); + label->setString(filename+"\nVerts: "+Value((int)pinfo.getVertCount()).asString()+ "\nPixels: "+Value((int)(pinfo.getArea()/(size.width*size.height)*100)).asString()+"%"); +} + +Sprite* SpritePolygonTestSlider::makeSprite(const std::string &filename, const Vec2 &pos) +{ + //Sprite + auto quadSize = Sprite::create(filename)->getContentSize(); + int originalSize = quadSize.width * quadSize.height; + auto pinfo = AutoPolygon::generatePolygon(filename); + auto ret = Sprite::create(pinfo); + ret->setName(filename); + ret->setTag(_tagIndex); + _tagIndex++; + ret->setPosition(pos); + + //DrawNode + auto drawNode = DrawNode::create(); + _drawNodes.pushBack(drawNode); + drawNode->setTag(ret->getTag()); + drawNode->clear(); + ret->addChild(drawNode); + + //Label + auto ttfConfig = TTFConfig("fonts/arial.ttf", 8); + auto spArea = Label::createWithTTF(ttfConfig, filename+"\nVerts: "+Value((int)pinfo.getVertCount()).asString()+ "\nPixels: "+Value((int)(pinfo.getArea()/originalSize*100)).asString()+"%"); + ret->addChild(spArea); + spArea->setAnchorPoint(Vec2(0,1)); + spArea->setName(filename); + ret->setAnchorPoint(Vec2(0.5, 0)); + + updateDrawNode(); + + return ret; } SpritePolygonTest3::SpritePolygonTest3() { - _ttfConfig = TTFConfig("fonts/arial.ttf", 8); _title = "Optimization Value (default:2.0)"; _subtitle = ""; + _tagIndex = 100; +} + +void SpritePolygonTest3::initSprites() +{ auto vsize =Director::getInstance()->getVisibleSize(); std::string list[] = { "Images/arrows.png", @@ -137,18 +368,20 @@ SpritePolygonTest3::SpritePolygonTest3() SpritePolygonTest4::SpritePolygonTest4() { - _ttfConfig = TTFConfig("fonts/arial.ttf", 8); _title = "Optimization Value (default:2.0)"; _subtitle = ""; + _tagIndex = 100; +} + +void SpritePolygonTest4::initSprites() +{ auto vsize =Director::getInstance()->getVisibleSize(); - int count = 3; std::string list[] = { s_pathGrossini, "Images/grossinis_sister1.png", "Images/grossinis_sister2.png" }; - makeSprites(list, count, vsize.height/5*2); } @@ -156,11 +389,20 @@ SpritePolygonTest5::SpritePolygonTest5() { _title = "SpritePolygon Actions"; _subtitle = "Touch screen to add sprite with random action."; - Director::getInstance()->setClearColor(Color4F(102.f/255, 184.f/255, 204.f/255, 255.f)); - auto filename = s_pathGrossini; - _polygonInfo = AutoPolygon::generatePolygon(filename); - initTouch(); - loadDefaultSprites(); + _tagIndex = 100; +} + +bool SpritePolygonTest5::init() +{ + if (SpritePolygonTestCase::init()) + { + _polygonInfo = AutoPolygon::generatePolygon(s_pathGrossini); + loadDefaultSprites(); + initTouch(); + scheduleUpdate(); + return true; + } + return false; } void SpritePolygonTest5::initTouch() @@ -185,8 +427,15 @@ void SpritePolygonTest5::loadDefaultSprites() for (int i = 0; i < DEFAULT_SPRITEPOLYGON_COUNT; i++) { sprites[i] = Sprite::create(_polygonInfo); + sprites[i]->setTag(_tagIndex); + _tagIndex++; sprites[i]->setPosition(s.width * CCRANDOM_0_1(), s.height * CCRANDOM_0_1()); this->addChild(sprites[i]); + auto drawNode = DrawNode::create(); + _drawNodes.pushBack(drawNode); + drawNode->setTag(sprites[i]->getTag()); + drawNode->clear(); + sprites[i]->addChild(drawNode); } sprites[0]->setColor(Color3B::RED); sprites[1]->setOpacity(100); @@ -196,16 +445,23 @@ void SpritePolygonTest5::loadDefaultSprites() sprites[5]->setFlippedY(true); sprites[6]->setSkewX(60); sprites[7]->setRotation(90); - for (int i = 0; i < DEFAULT_SPRITEPOLYGON_COUNT; i++) { - sprites[i]->debugDraw(true); - } + + updateDrawNode(); } void SpritePolygonTest5::addSpritePolygon(const Vec2& pos) { auto sprite = Sprite::create(_polygonInfo); + sprite->setTag(_tagIndex); + _tagIndex++; sprite->setPosition(pos); this->addChild(sprite); + auto drawNode = DrawNode::create(); + _drawNodes.pushBack(drawNode); + drawNode->setTag(sprite->getTag()); + drawNode->clear(); + sprite->addChild(drawNode); + ActionInterval* action; float random = CCRANDOM_0_1(); if( random < 0.20 ) @@ -218,64 +474,77 @@ void SpritePolygonTest5::addSpritePolygon(const Vec2& pos) action = TintBy::create(2, 0, -255, -255); else action = FadeOut::create(2); - auto action_back = action->reverse(); - auto seq = Sequence::create( action, action_back, nullptr ); - sprite->runAction(seq); - sprite->debugDraw(true); + auto seq = Sequence::create( action, action->reverse(), nullptr ); + sprite->runAction(RepeatForever::create(seq)); +} + +void SpritePolygonTest5::update(float dt) +{ + updateDrawNode(); } SpritePolygonPerformance::SpritePolygonPerformance() { - Director::getInstance()->setClearColor(Color4F(102.f/255, 184.f/255, 204.f/255, 255.f)); TTFConfig ttfConfig("fonts/arial.ttf", 10); - perfLabel = Label::createWithTTF(ttfConfig, "performance test"); - addChild(perfLabel); - perfLabel->setPosition(Director::getInstance()->getVisibleSize().width/2, 80); + _perfLabel = Label::createWithTTF(ttfConfig, "performance test"); + addChild(_perfLabel); + _perfLabel->setPosition(Director::getInstance()->getVisibleSize().width/2, 80); - spriteCount = vertCount = triCount = pixelCount = continuousLowDt =0; + _spriteCount = _vertCount = _triCount = _pixelCount = _continuousLowDt =0; auto size = Director::getInstance()->getVisibleSize(); - elapsedTime = 0; + _elapsedTime = 0; _posX = _leftX = size.width*0.15; _rightX = size.width*0.85; _posY = size.height/2; prevDt = 0.016f; goRight = true; ended = false; - scheduleUpdate(); - continuousHighDtTime = 0.0; - waitingTime = 0.0; + _continuousHighDtTime = 0.0; + _waitingTime = 0.0; + + _isNeedDebugMenu = false; +} + +bool SpritePolygonPerformance::init() +{ + if (SpritePolygonTestCase::init()) { + initIncrementStats(); + scheduleUpdate(); + return true; + } + return false; } void SpritePolygonPerformance::updateLabel() { - std::string temp = "Nodes: " + Value(spriteCount).asString() + " Triangles: " + Value(triCount).asString() + "\nPixels: " + Value(pixelCount).asString() + " Vertices: " + Value(vertCount).asString(); + std::string temp = "Nodes: " + Value(_spriteCount).asString() + " Triangles: " + Value(_triCount).asString() + "\nPixels: " + Value(_pixelCount).asString() + " Vertices: " + Value(_vertCount).asString(); if(!ended) - perfLabel->setString("Nodes: " + Value(spriteCount).asString() + " Triangles: " + Value(triCount).asString() + "\nPixels: " + Value(pixelCount).asString() + " Vertices: " + Value(vertCount).asString()); + _perfLabel->setString("Nodes: " + Value(_spriteCount).asString() + " Triangles: " + Value(_triCount).asString() + "\nPixels: " + Value(_pixelCount).asString() + " Vertices: " + Value(_vertCount).asString()); } Node *SpritePolygonPerformance::makeSprite() { - return Node::create(); + return nullptr; } void SpritePolygonPerformance::update(float dt) { dt = dt*0.3 + prevDt*0.7; prevDt = dt; - elapsedTime += dt; + _elapsedTime += dt; int loops = (0.025-dt)*1000; if(dt < 0.025 && loops>0) { - continuousHighDtTime = clampf(continuousHighDtTime-dt*2, 0.0, 1.0); - waitingTime = clampf(waitingTime-dt, 0.0, 5.0); - continuousLowDt++; + _continuousHighDtTime = clampf(_continuousHighDtTime-dt*2, 0.0, 1.0); + _waitingTime = clampf(_waitingTime-dt, 0.0, 5.0); + _continuousLowDt++; } else { - continuousHighDtTime+=dt; - continuousLowDt = 0; + _continuousHighDtTime+=dt; + _continuousLowDt = 0; } - if (continuousLowDt >= 5 && loops > 0) { + if (_continuousLowDt >= 5 && loops > 0) { for(int i = 0; i < loops; i++) { if(_posX >= _rightX) @@ -300,28 +569,29 @@ void SpritePolygonPerformance::update(float dt) } //if we have 10 continuous low dt, then we will start to create more sprites - else if(continuousHighDtTime >= .5 || waitingTime > 3.0){ + else if(_continuousHighDtTime >= .5 || _waitingTime > 3.0){ // its now 1 seconds with high DT time, time to end ended = true; unscheduleUpdate(); - perfLabel->setString("Test ended in " + Value(elapsedTime).asString() + " seconds\nNodes: " + Value(spriteCount).asString() + " Triangles: " + Value(triCount).asString() + "\nPixels: " + Value(pixelCount).asString() + " Vertices: " + Value(vertCount).asString()); + _perfLabel->setString("Test ended in " + Value(_elapsedTime).asString() + " seconds\nNodes: " + Value(_spriteCount).asString() + " Triangles: " + Value(_triCount).asString() + "\nPixels: " + Value(_pixelCount).asString() + " Vertices: " + Value(_vertCount).asString()); _subtitleLabel->setString("Test ended"); } else{ - waitingTime += dt; + _waitingTime += dt; } } void SpritePolygonPerformance::incrementStats() { - spriteCount ++; - vertCount += _incVert; - triCount += _incTri; - pixelCount += _incPix; + _spriteCount ++; + _vertCount += _incVert; + _triCount += _incTri; + _pixelCount += _incPix; } void SpritePolygonPerformanceTestDynamic::initIncrementStats() { + _pinfo = AutoPolygon::generatePolygon(s_pathGrossini); _incVert = _pinfo.getVertCount(); _incTri = _pinfo.getTriaglesCount(); _incPix = _pinfo.getArea(); @@ -329,10 +599,8 @@ void SpritePolygonPerformanceTestDynamic::initIncrementStats() SpritePolygonPerformanceTestDynamic::SpritePolygonPerformanceTestDynamic() { - _pinfo = AutoPolygon::generatePolygon(s_pathGrossini); _title = "Dynamic SpritePolygon Performance"; _subtitle = "Test running, please wait until it ends"; - initIncrementStats(); } Sprite* SpritePolygonPerformanceTestDynamic::makeSprite() @@ -346,7 +614,6 @@ SpritePerformanceTestDynamic::SpritePerformanceTestDynamic() { _title = "Dynamic Sprite Performance"; _subtitle = "Test running, please wait until it ends"; - initIncrementStats(); } void SpritePerformanceTestDynamic::initIncrementStats() @@ -363,83 +630,3 @@ Sprite* SpritePerformanceTestDynamic::makeSprite() ret->runAction(RepeatForever::create(RotateBy::create(1.0,360.0))); return ret; } - -SpritePolygonTestSlider::SpritePolygonTestSlider() -{ - _ttfConfig = TTFConfig("fonts/arial.ttf", 8); - _title = "Optimization Value (default:2.0)"; - _subtitle = ""; - - auto vsize =Director::getInstance()->getVisibleSize(); - cocos2d::ui::Slider* slider = cocos2d::ui::Slider::create(); - slider->loadBarTexture("cocosui/sliderTrack.png"); - slider->loadSlidBallTextures("cocosui/sliderThumb.png", "cocosui/sliderThumb.png", ""); - slider->loadProgressBarTexture("cocosui/sliderProgress.png"); - slider->setPosition(Vec2(vsize.width/2, vsize.height/4/* + slider->getSize().height * 2.0f*/)); - - slider->addEventListener(CC_CALLBACK_2(SpritePolygonTestSlider::changeEpsilon, this)); - slider->setPercent((int)(sqrtf(1.0f/19.0f)*100)); - - _epsilonLabel = Label::createWithTTF(_ttfConfig, "Epsilon: 2.0"); - addChild(_epsilonLabel); - _epsilonLabel->setPosition(Vec2(vsize.width/2, vsize.height/4 + 15)); - addChild(slider); -} - -void SpritePolygonTestSlider::makeSprites(const std::string* list, const int count, const float y) -{ - auto vsize =Director::getInstance()->getVisibleSize(); - float offset = (vsize.width-100)/(count-1); - for(int i = 0; i < count; i++) - { - auto sp = makeSprite(list[i], Vec2(50+offset*i, y)); - addChild(sp); - sp->debugDraw(true); - } -} - -void SpritePolygonTestSlider::changeEpsilon(cocos2d::Ref *pSender, cocos2d::ui::Slider::EventType type) -{ - if (type == cocos2d::ui::Slider::EventType::ON_PERCENTAGE_CHANGED) - { - cocos2d::ui::Slider* slider = dynamic_cast(pSender); - float epsilon = powf(slider->getPercent()/100.0,2)*19.0f + 1.0f; - for(auto child : _children) - { - if(child->getName().size()) - { - Sprite *sp = (Sprite*)child; - auto file = sp->getName(); - auto pinfo = AutoPolygon::generatePolygon(file, Rect::ZERO, epsilon); - sp->setPolygonInfo(pinfo); - sp->debugDraw(true); - updateLabel(sp, pinfo); - } - } - _epsilonLabel->setString("Epsilon: "+ Value(epsilon).asString()); - } -} - -void SpritePolygonTestSlider::updateLabel(const cocos2d::Sprite *sp, const PolygonInfo &pinfo) -{ - Label *label = (Label*)(sp->getChildren().at(0)); - auto filename = sp->getName(); - auto size = pinfo.rect.size/Director::getInstance()->getContentScaleFactor(); - label->setString(filename+"\nVerts: "+Value((int)pinfo.getVertCount()).asString()+ "\nPixels: "+Value((int)(pinfo.getArea()/(size.width*size.height)*100)).asString()+"%"); -} - -Sprite* SpritePolygonTestSlider::makeSprite(const std::string &filename, const Vec2 &pos) -{ - auto quadSize = Sprite::create(filename)->getContentSize(); - int originalSize = quadSize.width * quadSize.height; - auto pinfo = AutoPolygon::generatePolygon(filename); - auto ret = Sprite::create(pinfo); - ret->setPosition(pos); - - auto spArea = Label::createWithTTF(_ttfConfig, filename+"\nVerts: "+Value((int)pinfo.getVertCount()).asString()+ "\nPixels: "+Value((int)(pinfo.getArea()/originalSize*100)).asString()+"%"); - ret->addChild(spArea); - spArea->setAnchorPoint(Vec2(0,1)); - ret->setName(filename); - ret->setAnchorPoint(Vec2(0.5, 0)); - return ret; -} diff --git a/tests/cpp-tests/Classes/SpritePolygonTest/SpritePolygonTest.h b/tests/cpp-tests/Classes/SpritePolygonTest/SpritePolygonTest.h index 9cb250cd33..01fc2df088 100644 --- a/tests/cpp-tests/Classes/SpritePolygonTest/SpritePolygonTest.h +++ b/tests/cpp-tests/Classes/SpritePolygonTest/SpritePolygonTest.h @@ -8,19 +8,29 @@ DEFINE_TEST_SUITE(SpritePolygonTest); class SpritePolygonTestCase : public TestCase { protected: - virtual void onBackCallback(Ref* sender)override; std::string _title; std::string _subtitle; + bool _isDebugDraw; + bool _isNeedDebugMenu; + cocos2d::Vector _drawNodes; virtual std::string title() const override {return _title;}; virtual std::string subtitle() const override {return _subtitle;}; + virtual bool init() override; + virtual void onEnter()override; + virtual void onExit()override; + SpritePolygonTestCase(); + ~SpritePolygonTestCase(); + void updateDrawNode(); }; class SpritePolygonTestDemo : public SpritePolygonTestCase { protected: - void initTouchDebugDraw(); - cocos2d::Sprite* spp; - cocos2d::Sprite* sp; + cocos2d::Sprite* _polygonSprite; + cocos2d::Sprite* _normalSprite; + virtual bool init() override; + virtual void initSprites(){}; + void initTouches(); }; class SpritePolygonTest1 : public SpritePolygonTestDemo @@ -28,7 +38,7 @@ class SpritePolygonTest1 : public SpritePolygonTestDemo public: CREATE_FUNC(SpritePolygonTest1); SpritePolygonTest1(); - void make2Sprites(); + virtual void initSprites() override; }; class SpritePolygonTest2 : public SpritePolygonTestDemo @@ -36,19 +46,19 @@ class SpritePolygonTest2 : public SpritePolygonTestDemo public: CREATE_FUNC(SpritePolygonTest2); SpritePolygonTest2(); - void make2Sprites(); + virtual void initSprites() override; }; class SpritePolygonTestSlider : public SpritePolygonTestCase { -public: - CREATE_FUNC(SpritePolygonTestSlider); - SpritePolygonTestSlider(); protected: cocos2d::Label *_epsilonLabel; + int _tagIndex; cocos2d::Sprite* makeSprite(const std::string& filename, const cocos2d::Vec2& pos); + virtual bool init() override; + void initSliders(); + virtual void initSprites(){}; void makeSprites(const std::string* list, const int count, const float y); - cocos2d::TTFConfig _ttfConfig; void changeEpsilon(Ref *pSender, cocos2d::ui::Slider::EventType type); void updateLabel(const cocos2d::Sprite* sp, const cocos2d::PolygonInfo &pinfo); }; @@ -58,6 +68,7 @@ class SpritePolygonTest3 : public SpritePolygonTestSlider public: CREATE_FUNC(SpritePolygonTest3); SpritePolygonTest3(); + void initSprites() override; }; class SpritePolygonTest4 : public SpritePolygonTestSlider @@ -65,6 +76,7 @@ class SpritePolygonTest4 : public SpritePolygonTestSlider public: CREATE_FUNC(SpritePolygonTest4); SpritePolygonTest4(); + void initSprites() override; }; class SpritePolygonTest5 : public SpritePolygonTestCase @@ -72,11 +84,15 @@ class SpritePolygonTest5 : public SpritePolygonTestCase public: CREATE_FUNC(SpritePolygonTest5); SpritePolygonTest5(); +protected: + virtual bool init() override; void initTouch(); void loadDefaultSprites(); void addSpritePolygon(const cocos2d::Vec2& pos); + void update(float dt)override; private: cocos2d::PolygonInfo _polygonInfo; + int _tagIndex; }; class SpritePolygonPerformance : public SpritePolygonTestCase @@ -84,20 +100,17 @@ class SpritePolygonPerformance : public SpritePolygonTestCase public: CREATE_FUNC(SpritePolygonPerformance); SpritePolygonPerformance(); - virtual void update(float dt); protected: - int spriteCount; - int vertCount; - int triCount; - int pixelCount; - float elapsedTime; - cocos2d::Label * perfLabel; - void updateLabel(); - int continuousLowDt; - float continuousHighDtTime; - float waitingTime; + int _spriteCount; + int _vertCount; + int _triCount; + int _pixelCount; + float _elapsedTime; + cocos2d::Label * _perfLabel; + int _continuousLowDt; + float _continuousHighDtTime; + float _waitingTime; - int _posX; int _posY; int _leftX; @@ -107,13 +120,16 @@ protected: float prevDt; - virtual Node* makeSprite(); - virtual void incrementStats(); - - void initIncrementStats(); unsigned int _incVert; unsigned int _incTri; unsigned int _incPix; + + void updateLabel(); + virtual void update(float dt)override; + virtual bool init() override; + virtual Node* makeSprite(); + void incrementStats(); + virtual void initIncrementStats(){}; }; class SpritePolygonPerformanceTestDynamic : public SpritePolygonPerformance @@ -122,9 +138,9 @@ public: CREATE_FUNC(SpritePolygonPerformanceTestDynamic); SpritePolygonPerformanceTestDynamic(); protected: - cocos2d::Sprite* makeSprite(); + cocos2d::Sprite* makeSprite() override; cocos2d::PolygonInfo _pinfo; - void initIncrementStats(); + virtual void initIncrementStats() override; }; class SpritePerformanceTestDynamic : public SpritePolygonPerformance @@ -133,8 +149,8 @@ public: CREATE_FUNC(SpritePerformanceTestDynamic); SpritePerformanceTestDynamic(); protected: - cocos2d::Sprite* makeSprite(); - void initIncrementStats(); + virtual cocos2d::Sprite* makeSprite() override; + virtual void initIncrementStats() override; }; #endif /* defined(__cocos2d_tests__SpritePolygonTest__) */ diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIEditBoxTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIEditBoxTest.cpp index 9c5cae002a..c6dd7d9a31 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIEditBoxTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIEditBoxTest.cpp @@ -53,45 +53,69 @@ bool UIEditBoxTest::init() addChild(_TTFShowEditReturn); - auto editBoxSize = Size(visibleSize.width - 100, 60); + auto editBoxSize = Size(visibleSize.width - 100, visibleSize.height * 0.1); // top std::string pNormalSprite = "extensions/green_edit.png"; - _editName = ui::EditBox::create(editBoxSize, ui::Scale9Sprite::create(pNormalSprite)); - _editName->setPosition(Vec2(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height*3/4)); - _editName->setFontName("Paint Boy"); + _editName = ui::EditBox::create(editBoxSize + Size(0,40), ui::Scale9Sprite::create(pNormalSprite)); + _editName->setPosition(Vec2(visibleOrigin.x+visibleSize.width/2-50, visibleOrigin.y+visibleSize.height*3/4)); _editName->setFontColor(Color3B::RED); _editName->setPlaceHolder("Name:"); _editName->setPlaceholderFontColor(Color3B::WHITE); _editName->setMaxLength(8); - _editName->setFontSize(editBoxSize.height/2); + _editName->setFontSize(editBoxSize.height/2); _editName->setText("v👐👊💝"); _editName->setReturnType(ui::EditBox::KeyboardReturnType::DONE); _editName->setDelegate(this); addChild(_editName); - + + Button* button = Button::create("cocosui/animationbuttonnormal.png", + "cocosui/animationbuttonpressed.png"); + auto buttonSize = button->getContentSize(); + button->setTitleText("Single Line"); + button->setPosition(_editName->getPosition() + Vec2(editBoxSize.width/2 + buttonSize.width/2, 0 )); + button->addClickEventListener([=](Ref* ref){ + _editName->setInputMode(ui::EditBox::InputMode::SINGLE_LINE); + }); + addChild(button); + // middle _editPassword = ui::EditBox::create(editBoxSize, "extensions/orange_edit.png"); - _editPassword->setPosition(Vec2(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/2)); + _editPassword->setPosition(Vec2(visibleOrigin.x+visibleSize.width/2-50, visibleOrigin.y+visibleSize.height/2)); _editPassword->setFontColor(Color3B::GREEN); _editPassword->setPlaceHolder("Password:"); _editPassword->setMaxLength(6); _editPassword->setInputFlag(ui::EditBox::InputFlag::PASSWORD); _editPassword->setInputMode(ui::EditBox::InputMode::SINGLE_LINE); - _editPassword->setFontSize(editBoxSize.height/2); + _editPassword->setFontSize(editBoxSize.height/2); _editPassword->setDelegate(this); addChild(_editPassword); + auto buttonPassword = (ui::Button*)button->clone(); + buttonPassword->setTitleText("Multiline"); + buttonPassword->setPosition(_editPassword->getPosition() + Vec2(editBoxSize.width/2 + buttonSize.width/2, 0 )); + buttonPassword->addClickEventListener([=](Ref* ref){ + _editPassword->setInputMode(ui::EditBox::InputMode::ANY); + }); + addChild(buttonPassword); + // bottom auto bottomButtonSize = Size(editBoxSize.width, editBoxSize.height + 10); _editEmail = ui::EditBox::create(bottomButtonSize, "extensions/yellow_edit.png"); - _editEmail->setPosition(Vec2(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/4)); + _editEmail->setPosition(Vec2(visibleOrigin.x+visibleSize.width/2-50, visibleOrigin.y+visibleSize.height/4)); _editEmail->setPlaceHolder("Email:"); _editEmail->setInputMode(ui::EditBox::InputMode::EMAIL_ADDRESS); _editEmail->setDelegate(this); - _editEmail->setFontSize(bottomButtonSize.height/2); addChild(_editEmail); + auto buttonEmail = (ui::Button*)button->clone(); + buttonEmail->setTitleText("Multiline"); + buttonEmail->setPosition(_editEmail->getPosition() + Vec2(editBoxSize.width/2 + buttonSize.width/2, 0 )); + buttonEmail->addClickEventListener([=](Ref* ref){ + _editEmail->setInputMode(ui::EditBox::InputMode::ANY); + }); + addChild(buttonEmail); + return true; } return false; diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIListViewTest/UIListViewTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIListViewTest/UIListViewTest.cpp index 036bc37e26..6170a0f2c2 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIListViewTest/UIListViewTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIListViewTest/UIListViewTest.cpp @@ -7,8 +7,12 @@ const char* font_UIListViewTest = "fonts/Marker Felt.ttf"; UIListViewTests::UIListViewTests() { - ADD_TEST_CASE(UIListViewTest_Vertical); ADD_TEST_CASE(UIListViewTest_Horizontal); + ADD_TEST_CASE(UIListViewTest_Vertical); + ADD_TEST_CASE(UIListViewTest_ScrollToItemVertical); + ADD_TEST_CASE(UIListViewTest_ScrollToItemHorizontal); + ADD_TEST_CASE(UIListViewTest_MagneticVertical); + ADD_TEST_CASE(UIListViewTest_MagneticHorizontal); ADD_TEST_CASE(Issue12692); ADD_TEST_CASE(Issue8316); } @@ -67,10 +71,7 @@ bool UIListViewTest_Vertical::init() listView->setBackGroundImage("cocosui/green_edit.png"); listView->setBackGroundImageScale9Enabled(true); listView->setContentSize(Size(240, 130)); - listView->setPosition(Vec2((widgetSize.width - backgroundSize.width) / 2.0f + - (backgroundSize.width - listView->getContentSize().width) / 2.0f, - (widgetSize.height - backgroundSize.height) / 2.0f + - (backgroundSize.height - listView->getContentSize().height) / 2.0f)); + listView->setPosition(Vec2((widgetSize - listView->getContentSize()) / 2.0f)); listView->addEventListener((ui::ListView::ccListViewCallback)CC_CALLBACK_2(UIListViewTest_Vertical::selectedItemEvent, this)); listView->addEventListener((ui::ListView::ccScrollViewCallback)CC_CALLBACK_2(UIListViewTest_Vertical::selectedItemEventScrollView,this)); listView->setScrollBarPositionFromCorner(Vec2(7, 7)); @@ -84,8 +85,7 @@ bool UIListViewTest_Vertical::init() Layout* default_item = Layout::create(); default_item->setTouchEnabled(true); default_item->setContentSize(default_button->getContentSize()); - default_button->setPosition(Vec2(default_item->getContentSize().width / 2.0f, - default_item->getContentSize().height / 2.0f)); + default_button->setPosition(Vec2(default_item->getContentSize() / 2.0f)); default_item->addChild(default_button); // set model @@ -165,7 +165,44 @@ bool UIListViewTest_Vertical::init() // set items margin listView->setItemsMargin(2.0f); - + + // Show the indexes of items on each boundary. + { + float position = 75; + // Labels + _indexLabels[0] = Text::create(" ", "fonts/Marker Felt.ttf", 12); + _indexLabels[0]->setAnchorPoint(Vec2::ANCHOR_MIDDLE); + _indexLabels[0]->setPosition(_uiLayer->getContentSize() / 2 + Size(0, position)); + _uiLayer->addChild(_indexLabels[0]); + _indexLabels[1] = Text::create(" ", "fonts/Marker Felt.ttf", 12); + _indexLabels[1]->setAnchorPoint(Vec2::ANCHOR_MIDDLE); + _indexLabels[1]->setPosition(_uiLayer->getContentSize() / 2 + Size(140, 0)); + _uiLayer->addChild(_indexLabels[1]); + _indexLabels[2] = Text::create(" ", "fonts/Marker Felt.ttf", 12); + _indexLabels[2]->setAnchorPoint(Vec2::ANCHOR_MIDDLE); + _indexLabels[2]->setPosition(_uiLayer->getContentSize() / 2 + Size(0, -position)); + _uiLayer->addChild(_indexLabels[2]); + + // Callback + listView->ScrollView::addEventListener([this](Ref* ref, ScrollView::EventType eventType) { + ListView* listView = dynamic_cast(ref); + if(listView == nullptr || eventType != ScrollView::EventType::CONTAINER_MOVED) + { + return; + } + auto bottom = listView->getBottommostItemInCurrentView(); + auto center = listView->getCenterItemInCurrentView(); + auto top = listView->getTopmostItemInCurrentView(); + + _indexLabels[0]->setString(StringUtils::format("Top index=%zd", listView->getIndex(top))); + _indexLabels[1]->setString(StringUtils::format("Center\nindex=%zd", listView->getIndex(center))); + _indexLabels[2]->setString(StringUtils::format("Bottom index=%zd", listView->getIndex(bottom))); + }); + } + + // Jump to bottom + listView->jumpToBottom(); + return true; } @@ -353,7 +390,10 @@ bool UIListViewTest_Horizontal::init() // set items margin listView->setItemsMargin(2); - + + // Jump to right + listView->jumpToRight(); + return true; } @@ -545,3 +585,237 @@ bool Issue8316::init() return false; } + + +// UIListViewTest_ScrollToItem +bool UIListViewTest_ScrollToItem::init() +{ + if(!UIScene::init()) + { + return false; + } + + Size layerSize = _uiLayer->getContentSize(); + + static int NUMBER_OF_ITEMS = 31; + _nextIndex = 0; + _titleLabel = Text::create("Scroll to item", "fonts/Marker Felt.ttf", 32); + _titleLabel->setAnchorPoint(Vec2::ANCHOR_MIDDLE); + _titleLabel->setPosition(Vec2(layerSize / 2) + Vec2(0, _titleLabel->getContentSize().height * 3.15f)); + _uiLayer->addChild(_titleLabel, 3); + + // Create the list view + _listView = ListView::create(); + _listView->setDirection(getListViewDirection()); + _listView->setBounceEnabled(true); + _listView->setBackGroundImage("cocosui/green_edit.png"); + _listView->setBackGroundImageScale9Enabled(true); + _listView->setContentSize(layerSize / 2); + _listView->setScrollBarPositionFromCorner(Vec2(7, 7)); + _listView->setItemsMargin(2.0f); + _listView->setAnchorPoint(Vec2::ANCHOR_MIDDLE); + _listView->setPosition(layerSize / 2); + _uiLayer->addChild(_listView); + + // Guide line for center align + { + DrawNode* pNode = DrawNode::create(); + Vec2 center = layerSize / 2; + if(getListViewDirection() == ScrollView::Direction::HORIZONTAL) + { + float halfY = 110; + pNode->drawLine(Vec2(center.x, center.y - halfY), Vec2(center.x, center.y + halfY), Color4F(0, 0, 0, 1)); + } + else + { + float halfX = 150; + pNode->drawLine(Vec2(center.x - halfX, center.y), Vec2(center.x + halfX, center.y), Color4F(0, 0, 0, 1)); + } + pNode->setLineWidth(2); + _uiLayer->addChild(pNode); + } + + // Button + auto pButton = Button::create("cocosui/backtotoppressed.png", "cocosui/backtotopnormal.png"); + pButton->setAnchorPoint(Vec2::ANCHOR_MIDDLE_LEFT); + pButton->setScale(0.8f); + pButton->setPosition(Vec2(layerSize / 2) + Vec2(120, -60)); + pButton->setTitleText(StringUtils::format("Go to '%d'", _nextIndex)); + pButton->addClickEventListener([this, pButton](Ref*) { + _listView->scrollToItem(_nextIndex, Vec2::ANCHOR_MIDDLE, Vec2::ANCHOR_MIDDLE); + _nextIndex = (_nextIndex + (NUMBER_OF_ITEMS / 2)) % NUMBER_OF_ITEMS; + pButton->setTitleText(StringUtils::format("Go to '%d'", _nextIndex)); + }); + _uiLayer->addChild(pButton); + + // Add list items + static const Size BUTTON_SIZE(50, 40); + for (int i = 0; i < NUMBER_OF_ITEMS; ++i) + { + auto pButton = Button::create("cocosui/button.png", "cocosui/buttonHighlighted.png"); + pButton->setContentSize(BUTTON_SIZE); + pButton->setScale9Enabled(true); + pButton->setTitleText(StringUtils::format("Button-%d", i)); + _listView->pushBackCustomItem(pButton); + } + return true; +} + + + +// UIListViewTest_Magnetic +bool UIListViewTest_Magnetic::init() +{ + if(!UIScene::init()) + { + return false; + } + + Size layerSize = _uiLayer->getContentSize(); + + _titleLabel = Text::create("Magnetic scroll", "fonts/Marker Felt.ttf", 32); + _titleLabel->setAnchorPoint(Vec2::ANCHOR_MIDDLE); + _titleLabel->setPosition(Vec2(layerSize / 2) + Vec2(0, _titleLabel->getContentSize().height * 3.15f)); + _uiLayer->addChild(_titleLabel, 3); + + // Create the list view + _listView = ListView::create(); + _listView->setDirection(getListViewDirection()); + _listView->setBounceEnabled(true); + _listView->setBackGroundImage("cocosui/green_edit.png"); + _listView->setBackGroundImageScale9Enabled(true); + _listView->setContentSize(layerSize / 2); + _listView->setScrollBarPositionFromCorner(Vec2(7, 7)); + _listView->setItemsMargin(2.0f); + _listView->setAnchorPoint(Vec2::ANCHOR_MIDDLE); + _listView->setPosition(layerSize / 2); + _uiLayer->addChild(_listView); + + // Guide line for center align + { + DrawNode* pNode = DrawNode::create(); + Vec2 center = layerSize / 2; + if(getListViewDirection() == ScrollView::Direction::HORIZONTAL) + { + float halfY = 110; + pNode->drawLine(Vec2(center.x, center.y - halfY), Vec2(center.x, center.y + halfY), Color4F(0, 0, 0, 1)); + } + else + { + float halfX = 150; + pNode->drawLine(Vec2(center.x - halfX, center.y), Vec2(center.x + halfX, center.y), Color4F(0, 0, 0, 1)); + } + pNode->setLineWidth(2); + _uiLayer->addChild(pNode); + } + + // Show the indexes of items on each boundary. + { + for(int i = 0; i < 5; ++i) + { + _indexLabels[i] = Text::create(" ", "fonts/Marker Felt.ttf", 12); + _indexLabels[i]->setAnchorPoint(Vec2::ANCHOR_MIDDLE); + _uiLayer->addChild(_indexLabels[i]); + } + float deltaX = 145, deltaY = 90; + _indexLabels[0]->setPosition(_uiLayer->getContentSize() / 2 + Size(-deltaX, 0)); // left + _indexLabels[1]->setPosition(_uiLayer->getContentSize() / 2 + Size(deltaX, 0)); // right + _indexLabels[2]->setPosition(_uiLayer->getContentSize() / 2 + Size(0, deltaY)); // top + _indexLabels[3]->setPosition(_uiLayer->getContentSize() / 2 + Size(0, -deltaY)); // bottom + _indexLabels[4]->setPosition(_uiLayer->getContentSize() / 2 + Size(deltaX, deltaY)); // center + + // Callback + _listView->ScrollView::addEventListener([this](Ref* ref, ScrollView::EventType eventType) { + ListView* listView = dynamic_cast(ref); + if(listView == nullptr || eventType != ScrollView::EventType::CONTAINER_MOVED) + { + return; + } + auto left = listView->getLeftmostItemInCurrentView(); + auto right = listView->getRightmostItemInCurrentView(); + auto top = listView->getTopmostItemInCurrentView(); + auto bottom = listView->getBottommostItemInCurrentView(); + auto center = listView->getCenterItemInCurrentView(); + + _indexLabels[0]->setString(StringUtils::format("Left\nindex=%zd", listView->getIndex(left))); + _indexLabels[1]->setString(StringUtils::format("RIght\nindex=%zd", listView->getIndex(right))); + _indexLabels[2]->setString(StringUtils::format("Top index=%zd", listView->getIndex(top))); + _indexLabels[3]->setString(StringUtils::format("Bottom index=%zd", listView->getIndex(bottom))); + _indexLabels[4]->setString(StringUtils::format("Center\nindex=%zd", listView->getIndex(center))); + }); + } + + // Initial magnetic type + _listView->setMagneticType(ListView::MagneticType::NONE); + _titleLabel->setString("MagneticType - NONE"); + + // Magnetic change button + auto pButton = Button::create("cocosui/backtotoppressed.png", "cocosui/backtotopnormal.png"); + pButton->setAnchorPoint(Vec2::ANCHOR_MIDDLE_LEFT); + pButton->setScale(0.8f); + pButton->setPosition(Vec2(layerSize / 2) + Vec2(130, -60)); + pButton->setTitleText("Next Magnetic"); + pButton->addClickEventListener([this](Ref*) { + ListView::MagneticType eCurrentType = _listView->getMagneticType(); + ListView::MagneticType eNextType; + std::string sString; + if(eCurrentType == ListView::MagneticType::NONE) + { + eNextType = ListView::MagneticType::CENTER; + sString = "CENTER"; + } + else if(eCurrentType == ListView::MagneticType::CENTER) + { + eNextType = ListView::MagneticType::BOTH_END; + sString = "BOTH_END"; + } + else if(eCurrentType == ListView::MagneticType::BOTH_END) + { + if(getListViewDirection() == ScrollView::Direction::HORIZONTAL) + { + eNextType = ListView::MagneticType::LEFT; + sString = "LEFT"; + } + else + { + eNextType = ListView::MagneticType::TOP; + sString = "TOP"; + } + } + else if(eCurrentType == ListView::MagneticType::LEFT) + { + eNextType = ListView::MagneticType::RIGHT; + sString = "RIGHT"; + } + else if(eCurrentType == ListView::MagneticType::RIGHT) + { + eNextType = ListView::MagneticType::NONE; + sString = "NONE"; + } + else if(eCurrentType == ListView::MagneticType::TOP) + { + eNextType = ListView::MagneticType::BOTTOM; + sString = "BOTTOM"; + } + else if(eCurrentType == ListView::MagneticType::BOTTOM) + { + eNextType = ListView::MagneticType::NONE; + sString = "NONE"; + } + _listView->setMagneticType(eNextType); + _titleLabel->setString(StringUtils::format("MagneticType - %s", sString.c_str())); + }); + _uiLayer->addChild(pButton); + + // Add list items + static const Size BUTTON_SIZE(100, 70); + for (int i = 0; i < 40; ++i) + { + auto pButton = Button::create("cocosui/button.png", "cocosui/buttonHighlighted.png"); + pButton->setContentSize(BUTTON_SIZE); + pButton->setScale9Enabled(true); + pButton->setTitleText(StringUtils::format("Button-%d", i)); + _listView->pushBackCustomItem(pButton); + } + return true; +} diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIListViewTest/UIListViewTest.h b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIListViewTest/UIListViewTest.h index d5c98cbd3c..9f9898f811 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIListViewTest/UIListViewTest.h +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIListViewTest/UIListViewTest.h @@ -47,6 +47,8 @@ protected: cocos2d::ui::Text* _displayValueLabel; std::vector _array; + cocos2d::ui::Text* _indexLabels[3]; + }; class UIListViewTest_Horizontal : public UIScene @@ -84,4 +86,71 @@ public: virtual bool init() override; }; + +// Test for scroll to item +class UIListViewTest_ScrollToItem : public UIScene +{ +protected: + virtual bool init() override; + virtual cocos2d::ui::ScrollView::Direction getListViewDirection() const = 0; + + cocos2d::ui::ListView* _listView; + cocos2d::ui::Text* _titleLabel; + int _nextIndex; +}; + +class UIListViewTest_ScrollToItemVertical : public UIListViewTest_ScrollToItem +{ +public: + CREATE_FUNC(UIListViewTest_ScrollToItemVertical); + virtual cocos2d::ui::ScrollView::Direction getListViewDirection() const + { + return cocos2d::ui::ScrollView::Direction::VERTICAL; + } +}; + +class UIListViewTest_ScrollToItemHorizontal : public UIListViewTest_ScrollToItem +{ +public: + CREATE_FUNC(UIListViewTest_ScrollToItemHorizontal); + virtual cocos2d::ui::ScrollView::Direction getListViewDirection() const + { + return cocos2d::ui::ScrollView::Direction::HORIZONTAL; + } +}; + + +// Test for magnetic scroll +class UIListViewTest_Magnetic : public UIScene +{ +protected: + virtual bool init() override; + virtual cocos2d::ui::ScrollView::Direction getListViewDirection() const = 0; + + cocos2d::ui::ListView* _listView; + cocos2d::ui::Text* _titleLabel; + cocos2d::ui::Text* _indexLabels[5]; + +}; + +class UIListViewTest_MagneticVertical : public UIListViewTest_Magnetic +{ +public: + CREATE_FUNC(UIListViewTest_MagneticVertical); + virtual cocos2d::ui::ScrollView::Direction getListViewDirection() const + { + return cocos2d::ui::ScrollView::Direction::VERTICAL; + } +}; + +class UIListViewTest_MagneticHorizontal : public UIListViewTest_Magnetic +{ +public: + CREATE_FUNC(UIListViewTest_MagneticHorizontal); + virtual cocos2d::ui::ScrollView::Direction getListViewDirection() const + { + return cocos2d::ui::ScrollView::Direction::HORIZONTAL; + } +}; + #endif /* defined(__TestCpp__UIListViewTest__) */ diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp index df096e07fd..4dbc7c2879 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp @@ -85,8 +85,7 @@ bool UIScrollViewTest_Vertical::init() imageView->setPosition(Vec2(innerWidth / 2.0f, imageView->getContentSize().height / 2.0f)); scrollView->addChild(imageView); - - + scrollView->scrollToBottom(2.0, true); return true; } @@ -134,10 +133,7 @@ bool UIScrollViewTest_Horizontal::init() scrollView->setScrollBarPositionFromCorner(Vec2(4, 4)); scrollView->setScrollBarColor(Color3B::YELLOW); Size backgroundSize = background->getContentSize(); - scrollView->setPosition(Vec2((widgetSize.width - backgroundSize.width) / 2.0f + - (backgroundSize.width - scrollView->getContentSize().width) / 2.0f, - (widgetSize.height - backgroundSize.height) / 2.0f + - (backgroundSize.height - scrollView->getContentSize().height) / 2.0f)); + scrollView->setPosition((widgetSize - scrollView->getContentSize()) / 2.0f); _uiLayer->addChild(scrollView); ImageView* imageView = ImageView::create("cocosui/ccicon.png"); @@ -163,12 +159,15 @@ bool UIScrollViewTest_Horizontal::init() button_scale9->setContentSize(Size(100.0f, button_scale9->getVirtualRendererSize().height)); button_scale9->setPosition(Vec2(titleButton->getRightBoundary() + titleButton->getContentSize().width / 2.0f, titleButton->getBottomBoundary() - titleButton->getContentSize().height / 2.0f)); - scrollView->addChild(button_scale9); + scrollView->addChild(button_scale9); imageView->setPosition(Vec2(innerWidth - imageView->getContentSize().width / 2.0f, button_scale9->getBottomBoundary() - button_scale9->getContentSize().height / 2.0f)); - scrollView->addChild(imageView); - + scrollView->addChild(imageView); + + // Jump to right + scrollView->jumpToRight(); + return true; } @@ -231,7 +230,10 @@ bool UIScrollViewTest_Both::init() imageView->setPosition(Vec2(innerSize.width / 2.0f, innerSize.height / 2.0f)); _uiLayer->addChild(scrollView); - + + // Jump to right bottom + scrollView->jumpToBottomRight(); + return true; } diff --git a/tests/cpp-tests/Classes/controller.cpp b/tests/cpp-tests/Classes/controller.cpp index c18faa8e07..b298b1c1e6 100644 --- a/tests/cpp-tests/Classes/controller.cpp +++ b/tests/cpp-tests/Classes/controller.cpp @@ -71,7 +71,9 @@ public: addTest("Node: Parallax", [](){return new ParallaxTests(); }); addTest("Node: Particles", [](){return new ParticleTests(); }); addTest("Node: Particle3D (PU)", [](){return new Particle3DTests(); }); +#if CC_USE_PHYSICS addTest("Node: Physics", []() { return new PhysicsTests(); }); +#endif addTest("Node: Physics3D", []() { return new Physics3DTests(); } ); addTest("Node: RenderTexture", [](){return new RenderTextureTests(); }); addTest("Node: Scene", [](){return new SceneTests(); }); @@ -86,7 +88,6 @@ public: addTest("Node: UI", [](){ return new UITests(); }); addTest("Mouse", []() { return new MouseTests(); }); addTest("MultiTouch", []() { return new MutiTouchTests(); }); - addTest("Performance tests", []() { return new PerformanceTests(); }); addTest("Renderer", []() { return new NewRendererTests(); }); addTest("ReleasePool", [](){ return new ReleasePoolTests(); }); addTest("Rotate World", [](){return new RotateWorldTests(); }); diff --git a/tests/cpp-tests/Classes/tests.h b/tests/cpp-tests/Classes/tests.h index 47c7f3c14d..0cbf4f42e9 100644 --- a/tests/cpp-tests/Classes/tests.h +++ b/tests/cpp-tests/Classes/tests.h @@ -62,7 +62,6 @@ #include "ParallaxTest/ParallaxTest.h" #include "Particle3DTest/Particle3DTest.h" #include "ParticleTest/ParticleTest.h" -#include "PerformanceTest/PerformanceTest.h" #include "Physics3DTest/Physics3DTest.h" #include "PhysicsTest/PhysicsTest.h" #include "ReleasePoolTest/ReleasePoolTest.h" diff --git a/tests/cpp-tests/Resources/Manifests/AMTestScene4/project.manifest b/tests/cpp-tests/Resources/Manifests/AMTestScene4/project.manifest new file mode 100755 index 0000000000..0965cc54f8 --- /dev/null +++ b/tests/cpp-tests/Resources/Manifests/AMTestScene4/project.manifest @@ -0,0 +1,16 @@ +{ + "packageUrl" : "http://cocostudio.download.appget.cn/Cocos2D-X/", + "remoteManifestUrl" : "http://tools.itharbors.com/assets_manager/AMTestScene4/project_dev.manifest", + "remoteVersionUrl" : "http://tools.itharbors.com/assets_manager/AMTestScene4/version_dev.manifest", + "version" : "1.0.0", + "engineVersion" : "3.0 beta", + + "assets" : { + "Images/background1.jpg" : { + "md5" : "..." + } + }, + + "searchPaths" : [ + ] +} diff --git a/tests/cpp-tests/proj.android-studio/app/jni/Android.mk b/tests/cpp-tests/proj.android-studio/app/jni/Android.mk index 4717c01e4f..46f6de4b80 100644 --- a/tests/cpp-tests/proj.android-studio/app/jni/Android.mk +++ b/tests/cpp-tests/proj.android-studio/app/jni/Android.mk @@ -105,21 +105,6 @@ LOCAL_SRC_FILES := main.cpp \ ../../../Classes/ParallaxTest/ParallaxTest.cpp \ ../../../Classes/Particle3DTest/Particle3DTest.cpp \ ../../../Classes/ParticleTest/ParticleTest.cpp \ -../../../Classes/PerformanceTest/PerformanceAllocTest.cpp \ -../../../Classes/PerformanceTest/PerformanceCallbackTest.cpp \ -../../../Classes/PerformanceTest/PerformanceContainerTest.cpp \ -../../../Classes/PerformanceTest/PerformanceEventDispatcherTest.cpp \ -../../../Classes/PerformanceTest/PerformanceLabelTest.cpp \ -../../../Classes/PerformanceTest/PerformanceMathTest.cpp \ -../../../Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp \ -../../../Classes/PerformanceTest/PerformanceParticle3DTest.cpp \ -../../../Classes/PerformanceTest/PerformanceParticleTest.cpp \ -../../../Classes/PerformanceTest/PerformanceRendererTest.cpp \ -../../../Classes/PerformanceTest/PerformanceScenarioTest.cpp \ -../../../Classes/PerformanceTest/PerformanceSpriteTest.cpp \ -../../../Classes/PerformanceTest/PerformanceTest.cpp \ -../../../Classes/PerformanceTest/PerformanceTextureTest.cpp \ -../../../Classes/PerformanceTest/PerformanceTouchesTest.cpp \ ../../../Classes/PhysicsTest/PhysicsTest.cpp \ ../../../Classes/Physics3DTest/Physics3DTest.cpp \ ../../../Classes/ReleasePoolTest/ReleasePoolTest.cpp \ diff --git a/tests/cpp-tests/proj.android/jni/Android.mk b/tests/cpp-tests/proj.android/jni/Android.mk index f88ba92cec..be4a40e64a 100644 --- a/tests/cpp-tests/proj.android/jni/Android.mk +++ b/tests/cpp-tests/proj.android/jni/Android.mk @@ -105,21 +105,6 @@ LOCAL_SRC_FILES := main.cpp \ ../../Classes/ParallaxTest/ParallaxTest.cpp \ ../../Classes/Particle3DTest/Particle3DTest.cpp \ ../../Classes/ParticleTest/ParticleTest.cpp \ -../../Classes/PerformanceTest/PerformanceAllocTest.cpp \ -../../Classes/PerformanceTest/PerformanceCallbackTest.cpp \ -../../Classes/PerformanceTest/PerformanceContainerTest.cpp \ -../../Classes/PerformanceTest/PerformanceEventDispatcherTest.cpp \ -../../Classes/PerformanceTest/PerformanceLabelTest.cpp \ -../../Classes/PerformanceTest/PerformanceMathTest.cpp \ -../../Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp \ -../../Classes/PerformanceTest/PerformanceParticle3DTest.cpp \ -../../Classes/PerformanceTest/PerformanceParticleTest.cpp \ -../../Classes/PerformanceTest/PerformanceRendererTest.cpp \ -../../Classes/PerformanceTest/PerformanceScenarioTest.cpp \ -../../Classes/PerformanceTest/PerformanceSpriteTest.cpp \ -../../Classes/PerformanceTest/PerformanceTest.cpp \ -../../Classes/PerformanceTest/PerformanceTextureTest.cpp \ -../../Classes/PerformanceTest/PerformanceTouchesTest.cpp \ ../../Classes/PhysicsTest/PhysicsTest.cpp \ ../../Classes/Physics3DTest/Physics3DTest.cpp \ ../../Classes/ReleasePoolTest/ReleasePoolTest.cpp \ diff --git a/tests/cpp-tests/proj.win10/cpp-tests.vcxproj b/tests/cpp-tests/proj.win10/cpp-tests.vcxproj index 3eeff99840..1d11d1c59b 100644 --- a/tests/cpp-tests/proj.win10/cpp-tests.vcxproj +++ b/tests/cpp-tests/proj.win10/cpp-tests.vcxproj @@ -400,21 +400,6 @@ - - - - - - - - - - - - - - - @@ -630,21 +615,6 @@ - - - - - - - - - - - - - - - diff --git a/tests/cpp-tests/proj.win10/cpp-tests.vcxproj.filters b/tests/cpp-tests/proj.win10/cpp-tests.vcxproj.filters index db8fcd0ccb..4c4fc67ff3 100644 --- a/tests/cpp-tests/proj.win10/cpp-tests.vcxproj.filters +++ b/tests/cpp-tests/proj.win10/cpp-tests.vcxproj.filters @@ -131,9 +131,6 @@ {0648a349-fa88-45e2-8304-58576ac063b2} - - {a52b46b5-e7f9-4780-938f-98e58d702db3} - {1a5d3f8b-3643-47e1-a6d9-7dad49dcb624} @@ -671,51 +668,6 @@ Classes\ParticleTest - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - Classes\PhysicsTest @@ -1468,51 +1420,6 @@ Classes\ParticleTest - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - Classes\PhysicsTest diff --git a/tests/cpp-tests/proj.win32/cpp-tests.vcxproj b/tests/cpp-tests/proj.win32/cpp-tests.vcxproj index 874e1fe48d..6214945a7f 100644 --- a/tests/cpp-tests/proj.win32/cpp-tests.vcxproj +++ b/tests/cpp-tests/proj.win32/cpp-tests.vcxproj @@ -194,14 +194,6 @@ xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y - - - - - - - - @@ -301,13 +293,6 @@ xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y - - - - - - - @@ -406,14 +391,6 @@ xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y - - - - - - - - @@ -514,13 +491,6 @@ xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y - - - - - - - diff --git a/tests/cpp-tests/proj.win32/cpp-tests.vcxproj.filters b/tests/cpp-tests/proj.win32/cpp-tests.vcxproj.filters index 422d288f8a..5ac16aa2dd 100644 --- a/tests/cpp-tests/proj.win32/cpp-tests.vcxproj.filters +++ b/tests/cpp-tests/proj.win32/cpp-tests.vcxproj.filters @@ -79,9 +79,6 @@ {a786a2de-3545-4fdc-9884-5a8c68bf8eb8} - - {2013787a-dc87-456f-bf75-33c4cac37af3} - {3bd8ffaa-c24f-455b-bb31-25b038490329} @@ -468,27 +465,6 @@ Classes\CocosDenshionTest - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - Classes\VibrateTest @@ -669,9 +645,6 @@ Classes\LabelTest - - Classes\PerformanceTest - Classes\ExtensionsTest\CocoStudioArmatureTest @@ -705,9 +678,6 @@ Classes\ConsoleTest - - Classes\PerformanceTest - Classes\NewRendererTest @@ -723,21 +693,9 @@ Classes\ExtensionsTest\CocoStudioSceneTest\TriggerCode - - Classes\PerformanceTest - - - Classes\PerformanceTest - Classes\ReleasePoolTest - - Classes\PerformanceTest - - - Classes\PerformanceTest - Classes\ShaderTest @@ -933,9 +891,6 @@ Classes\CocosStudio3DTest - - Classes\PerformanceTest - Classes\UITest\CocostudioGUISceneTest\CustomTest\CustomWidgetCallbackBindTest @@ -951,9 +906,6 @@ Classes\TerrainTest - - Classes\PerformanceTest - Classes\Physics3DTest @@ -1080,27 +1032,6 @@ Classes\CocosDenshionTest - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - Classes\VibrateTest @@ -1503,9 +1434,6 @@ Classes\ConsoleTest - - Classes\PerformanceTest - Classes\NewRendererTest @@ -1524,24 +1452,9 @@ Classes\ExtensionsTest\CocoStudioSceneTest\TriggerCode - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - Classes\ReleasePoolTest - - Classes\PerformanceTest - - - Classes\PerformanceTest - Classes\ShaderTest @@ -1737,9 +1650,6 @@ Classes\CocosStudio3DTest - - Classes\PerformanceTest - Classes\UITest\CocostudioGUISceneTest\CustomTest\CustomWidgetCallbackBindTest @@ -1755,9 +1665,6 @@ Classes\TerrainTest - - Classes\PerformanceTest - Classes\Physics3DTest diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/cpp-tests.Shared.vcxitems b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/cpp-tests.Shared.vcxitems index 5e8900c5bf..94d574d0e1 100644 --- a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/cpp-tests.Shared.vcxitems +++ b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/cpp-tests.Shared.vcxitems @@ -124,21 +124,6 @@ - - - - - - - - - - - - - - - @@ -398,21 +383,6 @@ - - - - - - - - - - - - - - - diff --git a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/cpp-tests.Shared.vcxitems.filters b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/cpp-tests.Shared.vcxitems.filters index 91ed9bd564..912bc1cb8b 100644 --- a/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/cpp-tests.Shared.vcxitems.filters +++ b/tests/cpp-tests/proj.win8.1-universal/cpp-tests.Shared/cpp-tests.Shared.vcxitems.filters @@ -468,45 +468,6 @@ Classes\ParticleTest - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - Classes\PhysicsTest @@ -754,9 +715,6 @@ Classes\UITest\CocostudioGUISceneTest\UITextFieldTest - - Classes\PerformanceTest - Classes\UITest\CocostudioGUISceneTest\CustomTest\CustomWidgetCallbackBindTest @@ -775,9 +733,6 @@ Classes\CocosStudio3DTest - - Classes\PerformanceTest - Classes\TerrainTest @@ -1084,45 +1039,6 @@ Classes\ParticleTest - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - - - Classes\PerformanceTest - Classes\PhysicsTest @@ -1564,9 +1480,6 @@ {82efd737-e8e7-4086-85e8-fb4229430d52} - - {cc43ce58-9f43-4a06-9c51-e8aa588dfa94} - {baa5d22b-c453-4aba-a286-86a79614ee79} @@ -1747,9 +1660,6 @@ - - Classes\PerformanceTest - Classes\UITest\CocostudioGUISceneTest\CustomTest\CustomWidgetCallbackBindTest @@ -1768,9 +1678,6 @@ Classes\CocosStudio3DTest - - Classes\PerformanceTest - Classes\TerrainTest diff --git a/tests/js-tests/project.json b/tests/js-tests/project.json index b085e88a37..c42e93adf5 100644 --- a/tests/js-tests/project.json +++ b/tests/js-tests/project.json @@ -31,7 +31,6 @@ "src/TouchesTest/Paddle.js", "src/TouchesTest/TouchesTest.js", "src/SchedulerTest/SchedulerTest.js", - "src/ClickAndMoveTest/ClickAndMoveTest.js", "src/MenuTest/MenuTest.js", "src/ActionsTest/ActionsTest.js", "src/TileMapTest/TileMapTest.js", @@ -57,17 +56,7 @@ "src/ActionManagerTest/ActionManagerTest.js", "src/EaseActionsTest/EaseActionsTest.js", "src/ParallaxTest/ParallaxTest.js", - "src/PerformanceTest/PerformanceTest.js", - "src/PerformanceTest/PerformanceSpriteTest.js", - "src/PerformanceTest/PerformanceSpriteTest2.js", - "src/PerformanceTest/PerformanceParticleTest.js", - "src/PerformanceTest/PerformanceNodeChildrenTest.js", - "src/PerformanceTest/PerformanceTextureTest.js", - "src/PerformanceTest/PerformanceAnimationTest.js", - "src/PerformanceTest/PerformanceVirtualMachineTest.js", - "src/PerformanceTest/seedrandom.js", "src/FontTest/FontTest.js", - "src/PerformanceTest/PerformanceTouchesTest.js", "src/LabelTest/LabelTest.js", "src/CurrentLanguageTest/CurrentLanguageTest.js", "src/TextInputTest/TextInputTest.js", diff --git a/tests/js-tests/src/ActionsTest/ActionsTest.js b/tests/js-tests/src/ActionsTest/ActionsTest.js index 7952e6c8a5..153729201d 100644 --- a/tests/js-tests/src/ActionsTest/ActionsTest.js +++ b/tests/js-tests/src/ActionsTest/ActionsTest.js @@ -2662,6 +2662,296 @@ var SequenceRepeatTest = ActionsDemo.extend({ } }); +// custom action sample code +var customMoveBy = cc.MoveBy.extend({ + ctor:function (duration, deltaPos, deltaY) { + this._super(duration, deltaPos, deltaY); + }, + update:function (dt) { + this._super(dt); + + if (this.getTarget()) { // rand color + this.getTarget().setColor(cc.color(cc.rand()%255, cc.rand()%255, cc.rand()%255)); + } + + } +}); + +// special code, just for reduce code redundancy +var createCustomAction = function(actionObject) { + var customAction = actionObject.extend({ + ctor:function () { + actionObject.prototype.ctor.apply(this, arguments); + }, + update:function (dt) { + this._super(dt); + if (this.getTarget()) { // rand color + this.getTarget().setColor(cc.color(cc.rand()%255, cc.rand()%255, cc.rand()%255)); + } + + } + }); + return customAction; +} + +var ActionCustomTest = ActionsDemo.extend({ + _spritePos:null, + _layer:null, + onEnter:function () { + //----start47----onEnter + this._super(); + + this.centerSprites(0); + + this._layer = new cc.Layer(); + this.addChild(this._layer); + + var label1 = new cc.MenuItemLabel(new cc.LabelTTF("showInterval(click me)", "arial", 25), this.createActionInterval, this); + var label2 = new cc.MenuItemLabel(new cc.LabelTTF("showInstant(click me)", "arial", 25), this.createActionInstant, this); + var buttonTemp = new cc.Menu(label1, label2); + buttonTemp.alignItemsVerticallyWithPadding(10); + buttonTemp.setPosition(cc.p(100, cc.winSize.height / 2 + 100)); + this.addChild(buttonTemp); + + this.createActionInterval(); + + }, + initActionProperty:function(){ + this._spritePos = cc.p(25, 50); + this._layer.removeAllChildren(); + }, + createActionInstant:function(){ + this.initActionProperty(); + + /** + * group 1 + */ + var spriteTemp = this.addandCreateSpriteTemp("cc.Show"); + spriteTemp.setVisible(false); + var show = new (createCustomAction(cc.Show))(); + spriteTemp.runAction(show); + + spriteTemp = this.addandCreateSpriteTemp("cc.Hide", true); + var hide = new (createCustomAction(cc.Hide))(); + spriteTemp.runAction(hide); + + spriteTemp = this.addandCreateSpriteTemp("cc.FlipX"); + var flipX = new (createCustomAction(cc.FlipX))(true); + spriteTemp.runAction(flipX); + + /** + * group 2 + */ + + spriteTemp = this.addandCreateSpriteTemp("cc.FlipY"); + var flipY = new (createCustomAction(cc.FlipY))(true); + spriteTemp.runAction(flipY); + + // RemoveSelf action don't need test + // skip + + spriteTemp = this.addandCreateSpriteTemp("cc.Place"); + var place = new (createCustomAction(cc.Place))(spriteTemp.getPosition()); + spriteTemp.runAction(place); + + spriteTemp = this.addandCreateSpriteTemp("cc.CallFunc"); + var callFunc = new (createCustomAction(cc.CallFunc))(function(){cc.log("callfunc");}, this); + spriteTemp.runAction(callFunc); + }, + createActionInterval:function(){ + this.initActionProperty(); + + /** + * group 1 + */ + var spriteTemp = this.addandCreateSpriteTemp("cc.MoveBy"); + var move = new customMoveBy(5, cc.p(50, 0)); + spriteTemp.runAction(move); + + spriteTemp = this.addandCreateSpriteTemp("cc.MoveTo"); + var customMoveTo = new (createCustomAction(cc.MoveTo))(5, cc.p(spriteTemp.getPosition().x + 50, spriteTemp.getPosition().y)); + spriteTemp.runAction(customMoveTo); + + spriteTemp = this.addandCreateSpriteTemp("cc.sequence"); + var moveSeq = cc.sequence(new (createCustomAction(cc.MoveBy))(5, cc.p(50, 0)), cc.delayTime(1), + new (createCustomAction(cc.MoveBy))(5, cc.p(50, 0)), cc.delayTime(1)); + spriteTemp.runAction(moveSeq); + /** + * group 2 + */ + spriteTemp = this.addandCreateSpriteTemp("cc.repeat"); + var moveRepeat = cc.repeat(new (createCustomAction(cc.MoveBy))(5, cc.p(50, 0)), 2); + spriteTemp.runAction(moveRepeat); + + spriteTemp = this.addandCreateSpriteTemp("cc.repeatForever"); + var moveRepeatForever = cc.repeatForever(cc.sequence(new (createCustomAction(cc.MoveBy))(5, cc.p(50, 0)), + new (createCustomAction(cc.MoveBy))(5, cc.p(-50, 0)))); + spriteTemp.runAction(moveRepeatForever); + + spriteTemp = this.addandCreateSpriteTemp("cc.spawn"); + var moveRoationSpawn = cc.spawn(new (createCustomAction(cc.MoveBy))(5, cc.p(50, 0)), + new (createCustomAction(cc.RotateBy))(5, 360)); + spriteTemp.runAction(moveRoationSpawn); + + /** + * group 3 + */ + spriteTemp = this.addandCreateSpriteTemp("cc.RotateTo"); + var rotateTo = new (createCustomAction(cc.RotateTo))(5, 180); + spriteTemp.runAction(rotateTo); + + spriteTemp = this.addandCreateSpriteTemp("cc.RotateBy"); + var rotateBy = new (createCustomAction(cc.RotateBy))(5, 270); + spriteTemp.runAction(rotateBy); + + spriteTemp = this.addandCreateSpriteTemp("cc.SkewTo"); + var skewTo = new (createCustomAction(cc.SkewTo))(5, 20, 20); + spriteTemp.runAction(skewTo); + + /** + * group 4 + */ + spriteTemp = this.addandCreateSpriteTemp("cc.SkewBy"); + var skewBy = new (createCustomAction(cc.SkewBy))(5, 20, 20); + spriteTemp.runAction(skewBy); + + spriteTemp = this.addandCreateSpriteTemp("cc.JumpBy"); + var jumpBy = new (createCustomAction(cc.JumpBy))(5, spriteTemp.getPosition(), 50, 4); + spriteTemp.runAction(jumpBy); + + spriteTemp = this.addandCreateSpriteTemp("cc.JumpTo"); + var jumpTo = new (createCustomAction(cc.JumpTo))(5, spriteTemp.getPosition(), 50, 4); + spriteTemp.runAction(jumpTo); + + /** + * group 5 + */ + spriteTemp = this.addandCreateSpriteTemp("cc.BezierBy"); + var bezierBy = new (createCustomAction(cc.BezierBy))(5, [spriteTemp.getPosition(), cc.p(0, spriteTemp.getPosition().y), + cc.p(cc.winSize.x, spriteTemp.getPosition().y), spriteTemp.getPosition()]); + spriteTemp.runAction(bezierBy); + + spriteTemp = this.addandCreateSpriteTemp("cc.BezierTo"); + var bezierTo = new (createCustomAction(cc.BezierTo))(5, [cc.p(0, cc.winSize.height / 2), cc.p(300, -cc.winSize.height / 2), cc.p(300, 100)]); + spriteTemp.runAction(bezierTo); + + spriteTemp = this.addandCreateSpriteTemp("cc.ScaleTo"); + var scaleTo = new (createCustomAction(cc.ScaleTo))(5, 0.5); + spriteTemp.runAction(scaleTo); + + /** + * group 6 + */ + spriteTemp = this.addandCreateSpriteTemp("cc.ScaleBy"); + var scaleBy = new (createCustomAction(cc.ScaleBy))(5, 1.5); + spriteTemp.runAction(scaleBy); + + spriteTemp = this.addandCreateSpriteTemp("cc.Blink"); + var blink = new (createCustomAction(cc.Blink))(5, 2); + spriteTemp.runAction(blink); + + spriteTemp = this.addandCreateSpriteTemp("cc.FadeTo"); + var fadeTo = new (createCustomAction(cc.FadeTo))(5, 64); + spriteTemp.runAction(fadeTo); + + /** + * group 7 + */ + spriteTemp = this.addandCreateSpriteTemp("cc.FadeIn"); + spriteTemp.setOpacity(128); + var fadeIn = new (createCustomAction(cc.FadeIn))(5); + spriteTemp.runAction(fadeIn); + + spriteTemp = this.addandCreateSpriteTemp("cc.FadeOut"); + spriteTemp.setOpacity(128); + var fadeOut = new (createCustomAction(cc.FadeOut))(5); + spriteTemp.runAction(fadeOut); + + spriteTemp = this.addandCreateSpriteTemp("cc.TintTo"); + var tintTo = new (createCustomAction(cc.TintTo))(5, 255, 0, 255); + spriteTemp.runAction(tintTo); + + /** + * group 8 + */ + spriteTemp = this.addandCreateSpriteTemp("cc.TintBy"); + var tintBy = new (createCustomAction(cc.TintBy))(5, -127, -255, -127); + spriteTemp.runAction(tintBy); + + spriteTemp = this.addandCreateSpriteTemp("cc.Animate"); + var animation = new cc.Animation(); + for (var i = 1; i < 15; i++) { + var frameName = "Images/grossini_dance_" + ((i < 10) ? ("0" + i) : i) + ".png"; + animation.addSpriteFrameWithFile(frameName); + } + animation.setDelayPerUnit(5 / 14); + animation.setRestoreOriginalFrame(true); + var animate = new (createCustomAction(cc.Animate))(animation); + spriteTemp.runAction(animate); + }, + addandCreateSpriteTemp:function(actionTypeName, addLabelInLayerFlag){ + var spriteTemp = new cc.Sprite(s_pathGrossini); + this._layer.addChild(spriteTemp); + spriteTemp.setPosition(this._spritePos); + var spriteContentSize = spriteTemp.getContentSize(); + this._spritePos.y += spriteContentSize.height; + if (this._spritePos.y > cc.winSize.height - spriteContentSize.height){ + this._spritePos.x += spriteContentSize.width; + this._spritePos.y = 50; + } + + if (actionTypeName){ + var label = new cc.LabelTTF(actionTypeName, "arial", 18); + if (addLabelInLayerFlag){ + label.setPosition(spriteTemp.getPosition()); + this._layer.addChild(label); + } + else{ + label.setPosition(spriteContentSize.width/2, spriteContentSize.height / 2); + spriteTemp.addChild(label); + } + + } + + return spriteTemp; + }, + title:function () { + return "ActionCustomTest"; + }, + + subtitle:function () { + return "Tests custom action, every sprite changing rand color when they run actions"; + } +}); + +var ActionIssue13605 = ActionsDemo.extend({ + onEnter:function () { + //----start47----onEnter + this._super(); + this.centerSprites(2); + + var move = new customMoveBy(2, cc.p(50, 0)); + var move_back = move.reverse(); + var move_seq = cc.sequence(move, cc.delayTime(1), move_back, cc.delayTime(1)); + this._kathia.runAction(move_seq.repeat(2)); + + var moveClone = move.clone(); + var moveCloneBack = moveClone.reverse(); + var moveCloneSeq = cc.sequence(moveClone, cc.delayTime(1), moveCloneBack, cc.delayTime(1)); + this._tamara.runAction(moveCloneSeq.repeat(2)); + //----end47---- + }, + + title:function () { + return "action reverse and clone issue"; + }, + + subtitle:function () { + return "action move and back will change rand color"; + } +}); + + //- // // Flow control @@ -2717,7 +3007,9 @@ var arrayOfActionsTest = [ ActionAnimate, Issue1438, Issue1446, - SequenceRepeatTest + SequenceRepeatTest, + ActionCustomTest, + ActionIssue13605 ]; if("opengl" in cc.sys.capabilities){ diff --git a/tests/js-tests/src/ClickAndMoveTest/ClickAndMoveTest.js b/tests/js-tests/src/ClickAndMoveTest/ClickAndMoveTest.js deleted file mode 100644 index 3e5121e739..0000000000 --- a/tests/js-tests/src/ClickAndMoveTest/ClickAndMoveTest.js +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************** - Copyright (c) 2008-2010 Ricardo Quesada - Copyright (c) 2011-2012 cocos2d-x.org - 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. - ****************************************************************************/ -var TAG_SPRITE = 1; - -var ClickAndMoveTestScene = TestScene.extend({ - runThisTest:function () { - var layer = new ClickAndMoveTestLayer(); - - this.addChild(layer); - director.runScene(this); - } -}); - -var ClickAndMoveTestLayer = cc.Layer.extend({ - ctor:function () { - - if(window.sideIndexBar){ - window.sideIndexBar.changeTest(0, 4); - } - - this._super(); - - this.init(); - - if( 'touches' in cc.sys.capabilities ) - cc.eventManager.addListener(cc.EventListener.create({ - event: cc.EventListener.TOUCH_ALL_AT_ONCE, - onTouchesEnded:function (touches, event) { - if (touches.length <= 0) - return; - event.getCurrentTarget().moveSprite(touches[0].getLocation()); - } - }), this); - else if ('mouse' in cc.sys.capabilities ) - cc.eventManager.addListener({ - event: cc.EventListener.MOUSE, - onMouseUp: function (event) { - event.getCurrentTarget().moveSprite(event.getLocation()); - } - }, this); - - var sprite = new cc.Sprite(s_pathGrossini); - - var layer = new cc.LayerColor(cc.color(255, 255, 0, 100)); - this.addChild(layer, -1); - - this.addChild(sprite, 0, TAG_SPRITE); - sprite.x = 20; - sprite.y = 150; - - sprite.runAction(cc.jumpTo(4, cc.p(300, 48), 100, 4)); - - var fadeIn = cc.fadeIn(1); - var fadeOut = cc.fadeOut(1); - var forever = cc.sequence(fadeIn, fadeOut).repeatForever(); - layer.runAction(forever); - }, - - moveSprite:function(position) { - var sprite = this.getChildByTag(TAG_SPRITE); - sprite.stopAllActions(); - sprite.runAction(cc.moveTo(1, position)); - var o = position.x - sprite.x; - var a = position.y - sprite.y; - var at = Math.atan(o / a) * 57.29577951; // radians to degrees - - if (a < 0) { - if (o < 0) - at = 180 + Math.abs(at); - else - at = 180 - Math.abs(at); - } - - sprite.runAction(cc.rotateTo(1, at)); - } -}); - -var arrayOfClickMoveTest = [ClickAndMoveTestLayer]; \ No newline at end of file diff --git a/tests/js-tests/src/ExtensionsTest/AssetsManagerTest/AssetsManagerTest.js b/tests/js-tests/src/ExtensionsTest/AssetsManagerTest/AssetsManagerTest.js index 46436680f1..a5f327fb6c 100644 --- a/tests/js-tests/src/ExtensionsTest/AssetsManagerTest/AssetsManagerTest.js +++ b/tests/js-tests/src/ExtensionsTest/AssetsManagerTest/AssetsManagerTest.js @@ -26,9 +26,9 @@ -var sceneManifests = ["Manifests/AMTestScene1/project.manifest", "Manifests/AMTestScene2/project.manifest", "Manifests/AMTestScene3/project.manifest"]; -var storagePaths = ["JSBTests/AssetsManagerTest/scene1/", "JSBTests/AssetsManagerTest/scene2/", "JSBTests/AssetsManagerTest/scene3"]; -var backgroundPaths = ["Images/assetMgrBackground1.jpg", "Images/assetMgrBackground2.png", "Images/assetMgrBackground3.png"]; +var sceneManifests = ["Manifests/AMTestScene1/project.manifest", "Manifests/AMTestScene2/project.manifest", "Manifests/AMTestScene3/project.manifest", "Manifests/AMTestScene4/project.manifest"]; +var storagePaths = ["JSBTests/AssetsManagerTest/scene1/", "JSBTests/AssetsManagerTest/scene2/", "JSBTests/AssetsManagerTest/scene3", "JSBTests/AssetsManagerTest/scene4"]; +var backgroundPaths = ["Images/assetMgrBackground1.jpg", "Images/assetMgrBackground2.png", "Images/assetMgrBackground3.png", "Images/assetMgrBackground2.png"]; var currentScene = 0; @@ -60,7 +60,7 @@ var AssetsManagerTestLayer = BaseTestLayer.extend({ }, onNextCallback : function () { - if (currentScene < 2) + if (currentScene < sceneManifests.length - 1) { currentScene++; } @@ -74,7 +74,7 @@ var AssetsManagerTestLayer = BaseTestLayer.extend({ { currentScene--; } - else currentScene = 2; + else currentScene = sceneManifests.length - 1; var scene = new AssetsManagerLoaderScene(); scene.runThisTest(); } diff --git a/tests/js-tests/src/ExtensionsTest/NetworkTest/SocketIOTest.js b/tests/js-tests/src/ExtensionsTest/NetworkTest/SocketIOTest.js index 57af0589b1..61b185fa08 100644 --- a/tests/js-tests/src/ExtensionsTest/NetworkTest/SocketIOTest.js +++ b/tests/js-tests/src/ExtensionsTest/NetworkTest/SocketIOTest.js @@ -193,7 +193,7 @@ var SocketIOTestLayer = cc.Layer.extend({ onMenuSIOEndpointClicked: function(sender) { //repeat the same connection steps for the namespace "testpoint" - var sioendpoint = SocketIO.connect("ws://tools.itharbors.com:4000/testpoint"); + var sioendpoint = SocketIO.connect("ws://tools.itharbors.com:4000/testpoint", {"force new connection" : true}); //a tag to differentiate in shared callbacks sioendpoint.tag = "Test Endpoint"; diff --git a/tests/js-tests/src/MaterialSystemTest/MaterialSystemTest.js b/tests/js-tests/src/MaterialSystemTest/MaterialSystemTest.js index 829a59da38..3cff9e818a 100644 --- a/tests/js-tests/src/MaterialSystemTest/MaterialSystemTest.js +++ b/tests/js-tests/src/MaterialSystemTest/MaterialSystemTest.js @@ -151,6 +151,50 @@ var Material_2DEffects = MaterialSystemTestDemo.extend({ } }); +var Material_UniformCallback = MaterialSystemTestDemo.extend({ + _subtitle:"Testing uniforms call back", + + ctor:function(){ + this._super(); + var properties = cc.Properties.createNonRefCounted("Materials/auto_binding_test.material#sample"); + + var mat1 = cc.Material.createWithProperties(properties); + + var spriteBlur = new cc.Sprite("Images/grossini.png"); + spriteBlur.setNormalizedPosition(cc.p(0.2, 0.5)); + this.addChild(spriteBlur); + var spriteBlurProgram = mat1.getTechniqueByName("blur").getPassByIndex(0).getGLProgramState(); + spriteBlur.setGLProgramState(spriteBlurProgram); + spriteBlurProgram.setUniformCallback("blurRadius", function(glprogram, uniform){ + glprogram.setUniformLocationWith1f(uniform.location, Math.random() * 10); + }); + + + var spriteOutline = new cc.Sprite("Images/grossini.png"); + spriteOutline.setNormalizedPosition(cc.p(0.4, 0.5)); + this.addChild(spriteOutline); + var spriteOutlineProgram = mat1.getTechniqueByName("outline").getPassByIndex(0).getGLProgramState(); + spriteOutline.setGLProgramState(spriteOutlineProgram); + spriteOutlineProgram.setUniformCallback("u_outlineColor", function(glprogram, uniform){ + var r = Math.random(); + var g = Math.random(); + var b = Math.random(); + glprogram.setUniformLocationWith3f(uniform.location, r, g, b); + }); + + var spriteNoise = new cc.Sprite("Images/grossini.png"); + spriteNoise.setNormalizedPosition(cc.p(0.6, 0.5)); + this.addChild(spriteNoise); + spriteNoise.setGLProgramState(mat1.getTechniqueByName("noise").getPassByIndex(0).getGLProgramState()); + + var spriteEdgeDetect = new cc.Sprite("Images/grossini.png"); + spriteEdgeDetect.setNormalizedPosition(cc.p(0.8, 0.5)); + this.addChild(spriteEdgeDetect); + spriteEdgeDetect.setGLProgramState(mat1.getTechniqueByName("edge_detect").getPassByIndex(0).getGLProgramState()); + } +}); + + var Material_setTechnique = MaterialSystemTestDemo.extend({ _subtitle:"Testing setTechnique()", _techniqueState:0, @@ -307,6 +351,7 @@ var Material_parsePerformance = MaterialSystemTestDemo.extend({ // var arrayOfMaterialSystemTest = [ Material_2DEffects, + Material_UniformCallback, Material_setTechnique, Material_clone, Material_MultipleSprite3D, diff --git a/tests/js-tests/src/PerformanceTest/PerformanceAnimationTest.js b/tests/js-tests/src/PerformanceTest/PerformanceAnimationTest.js deleted file mode 100644 index a8e5939a5f..0000000000 --- a/tests/js-tests/src/PerformanceTest/PerformanceAnimationTest.js +++ /dev/null @@ -1,240 +0,0 @@ -/**************************************************************************** - Copyright (c) 2008-2010 Ricardo Quesada - Copyright (c) 2011-2012 cocos2d-x.org - 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. - ****************************************************************************/ - -var s_nAnimationCurCase = 0; -//////////////////////////////////////////////////////// -// -// AnimationLayer -// -//////////////////////////////////////////////////////// -var AnimationMenuLayer = PerformBasicLayer.extend({ - showCurrentTest:function () { - var scene = null; - switch (this._curCase) { - case 0: - scene = AnimationTest.scene(); - break; - } - s_nAnimationCurCase = this._curCase; - - if (scene) { - cc.director.runScene(scene); - } - }, - - onEnter:function () { - this._super(); - - var s = cc.director.getWinSize(); - - // Title - var label = new cc.LabelTTF(this.title(), "Arial", 40); - this.addChild(label, 1); - label.x = s.width / 2; - label.y = s.height - 32; - label.color = cc.color(255, 255, 40); - - // Subtitle - var strSubTitle = this.subtitle(); - if (strSubTitle.length) { - var l = new cc.LabelTTF(strSubTitle, "Thonburi", 16); - this.addChild(l, 1); - l.x = s.width / 2; - l.y = s.height - 80; - } - - }, - title:function () { - return "no title"; - }, - subtitle:function () { - return "no subtitle"; - }, - performTests:function () { - - } -}); - -//////////////////////////////////////////////////////// -// -// AnimationTest -// -//////////////////////////////////////////////////////// -var AnimationTest = AnimationMenuLayer.extend({ - numNodes:null, - lastRenderedCount:null, - moveLayerList:null, - init:function () { - this._super(); - - var size = cc.director.getWinSize(); - - cc.MenuItemFont.setFontSize(65); - var decrease = new cc.MenuItemFont(" - ", this.onDecrease, this); - decrease.color = cc.color(0, 200, 20); - var increase = new cc.MenuItemFont(" + ", this.onIncrease, this); - increase.color = cc.color(0, 200, 20); - - var menu = new cc.Menu(decrease, increase); - menu.alignItemsHorizontally(); - menu.x = size.width / 2; - menu.y = size.height / 2 + 100; - this.addChild(menu, 1); - - var infoLabel = new cc.LabelTTF("0 nodes", "Marker Felt", 24); - infoLabel.color = cc.color(0, 200, 20); - infoLabel.x = size.width / 2; - infoLabel.y = size.height - 90; - this.addChild(infoLabel, 1, TAG_INFO_LAYER); - this.numNodes = 0; - this.moveLayerList = []; - this.createMovieClip(); - //this.scheduleUpdate(); - }, - performTests:function () { - this.init(); - }, - title:function () { - return "Animation Performance Test"; - }, - subtitle:function () { - return ""; - }, - createMovieClip:function () { - var moveLayer = new cc.Node(); - this.addChild(moveLayer); - this.moveLayerList.push(moveLayer); - var size = cc.director.getWinSize(); - for(var i=0; i<10; i++) { - var character = new CharacterView(); - character.init(); - character.x = size.width /2 - i*15 - 200; - character.y = size.height /2 - i*15; - this.numNodes++; - cc.log("create"+this.numNodes); - moveLayer.addChild(character, 0, this.numNodes); - } - var action = cc.moveBy(1, cc.p(20,0)); - moveLayer.runAction(action.repeatForever()); - this.updateNodes(); - }, - onIncrease:function () { - this.createMovieClip(); - }, - onDecrease:function () { - if(this.numNodes > 0) { - var moveLayer = this.moveLayerList[this.moveLayerList.length-1]; - for(var i=0;i<10;i++) { - cc.log("remove"+this.numNodes); - moveLayer.removeChildByTag(this.numNodes, true); - this.numNodes--; - } - moveLayer.removeFromParent(true); - this.moveLayerList.pop(); - } - this.updateNodes(); - }, - updateNodes:function () { - if (this.numNodes != this.lastRenderedCount) { - var infoLabel = this.getChildByTag(TAG_INFO_LAYER); - var str = this.numNodes + " nodes"; - infoLabel.setString(str); - - this.lastRenderedCount = this.numNodes; - } - } -}); - -var CharacterView = cc.Node.extend({ - leftData:null, - leftItem:null, - rightData:null, - rightItem:null, - leftX:null, - - init: function() { - this._super(); - cc.spriteFrameCache.addSpriteFrames("animations/crystals.plist"); - var i = 0; - rightData = new Array(10); - for (i = 0; i < 10; i++) { - var right = new cc.Sprite("#crystals/4.png"); - right.x = 50; - right.y = i * 10 - 40; - right.rotation = -90; - right.scale = 1; - this.addChild(right); - - rightData[i] = right; - if (i == 0) { - rightItem = right; - } - } - - for(i=0; i<10; i++){ - var head = new cc.Sprite("#crystals/1.png"); - head.x = i * 5; - head.y = 50; - this.addChild(head); - head.scale = 1.5; - head.rotation = 350; - var rotateToA = cc.rotateBy(0.01, 5); - head.runAction(rotateToA.repeatForever()); - } - - leftData = new Array(10); - for(i=0; i<10; i++){ - var left = new cc.Sprite("#crystals/2.png"); - left.x = 10; - left.y = i * 5 - 20; - left.rotation = 90; - this.addChild(left); - //var moveStep = cc.moveBy(0.01, cc.p(-5,0)); - // left.runAction(moveStep); - leftData[i] = left; - if(i==0){ - leftItem = left; - } - } - - }, - - setDistance: function(){ - leftX = leftItem.x; - } -}); - -AnimationTest.scene = function () { - var scene = new cc.Scene(); - var layer = new AnimationTest(false, 1, s_nAnimationCurCase); - scene.addChild(layer); - return scene; -}; -function runAnimationTest() { - s_nAnimationCurCase = 0; - var scene = AnimationTest.scene(); - cc.director.runScene(scene); -} diff --git a/tests/js-tests/src/PerformanceTest/PerformanceNodeChildrenTest.js b/tests/js-tests/src/PerformanceTest/PerformanceNodeChildrenTest.js deleted file mode 100644 index c0a7528f14..0000000000 --- a/tests/js-tests/src/PerformanceTest/PerformanceNodeChildrenTest.js +++ /dev/null @@ -1,524 +0,0 @@ -/**************************************************************************** - Copyright (c) 2008-2010 Ricardo Quesada - Copyright (c) 2011-2012 cocos2d-x.org - 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. - ****************************************************************************/ - -var TAG_BASE = 2000; -var MAX_NODES = 1500; -var NODES_INCREASE = 50; -var s_nCurCase = 0; - -//////////////////////////////////////////////////////// -// -// NodeChildrenMenuLayer -// -//////////////////////////////////////////////////////// -var NodeChildrenMenuLayer = PerformBasicLayer.extend({ - _maxCases:4, - showCurrentTest:function () { - var nodes = (this.parent).getQuantityOfNodes(); - var scene = null; - switch (this._curCase) { - case 0: - scene = new IterateSpriteSheetCArray(); - break; - case 1: - scene = new AddSpriteSheet(); - break; - case 2: - scene = new RemoveSpriteSheet(); - break; - case 3: - scene = new ReorderSpriteSheet(); - break; - } - s_nCurCase = this._curCase; - - if (scene) { - scene.initWithQuantityOfNodes(nodes); - cc.director.runScene(scene); - } - } -}); - -//////////////////////////////////////////////////////// -// -// NodeChildrenMainScene -// -//////////////////////////////////////////////////////// -var NodeChildrenMainScene = cc.Scene.extend({ - _lastRenderedCount:null, - _quantityOfNodes:null, - _currentQuantityOfNodes:null, - - ctor:function() { - this._super(); - this.init(); - }, - - initWithQuantityOfNodes:function (nodes) { - //srand(time()); - var s = cc.director.getWinSize(); - - // Title - var label = new cc.LabelTTF(this.title(), "Arial", 40); - this.addChild(label, 1); - label.x = s.width / 2; - label.y = s.height - 32; - label.color = cc.color(255, 255, 40); - - // Subtitle - var strSubTitle = this.subtitle(); - if (strSubTitle.length) { - var l = new cc.LabelTTF(strSubTitle, "Thonburi", 16); - this.addChild(l, 1); - l.x = s.width / 2; - l.y = s.height - 80; - } - - this._lastRenderedCount = 0; - this._currentQuantityOfNodes = 0; - this._quantityOfNodes = nodes; - - cc.MenuItemFont.setFontSize(65); - var that = this; - var decrease = new cc.MenuItemFont(" - ", this.onDecrease, this); - decrease.color = cc.color(0, 200, 20); - var increase = new cc.MenuItemFont(" + ", this.onIncrease, this); - increase.color = cc.color(0, 200, 20); - - var menu = new cc.Menu(decrease, increase); - menu.alignItemsHorizontally(); - menu.x = s.width / 2; - menu.y = s.height / 2 + 15; - this.addChild(menu, 1); - - var infoLabel = new cc.LabelTTF("0 nodes", "Marker Felt", 30); - infoLabel.color = cc.color(0, 200, 20); - infoLabel.x = s.width / 2; - infoLabel.y = s.height / 2 - 15; - this.addChild(infoLabel, 1, TAG_INFO_LAYER); - - var menu = new NodeChildrenMenuLayer(true, 4, s_nCurCase); - this.addChild(menu); - - this.updateQuantityLabel(); - this.updateQuantityOfNodes(); - }, - title:function () { - return "No title"; - }, - subtitle:function () { - return ""; - }, - updateQuantityOfNodes:function () { - - }, - onDecrease:function (sender) { - this._quantityOfNodes -= NODES_INCREASE; - if (this._quantityOfNodes < 0) { - this._quantityOfNodes = 0; - } - - this.updateQuantityLabel(); - this.updateQuantityOfNodes(); - }, - onIncrease:function (sender) { - this._quantityOfNodes += NODES_INCREASE; - if (this._quantityOfNodes > MAX_NODES) { - this._quantityOfNodes = MAX_NODES - } - - this.updateQuantityLabel(); - this.updateQuantityOfNodes(); - }, - updateQuantityLabel:function () { - if (this._quantityOfNodes != this._lastRenderedCount) { - var infoLabel = this.getChildByTag(TAG_INFO_LAYER); - var str = this._quantityOfNodes + " nodes"; - infoLabel.setString(str); - - this._lastRenderedCount = this._quantityOfNodes; - } - }, - getQuantityOfNodes:function () { - return this._quantityOfNodes; - } -}); - -//////////////////////////////////////////////////////// -// -// IterateSpriteSheet -// -//////////////////////////////////////////////////////// -var IterateSpriteSheet = NodeChildrenMainScene.extend({ - _batchNode:null, - _profilingTimer:null, - ctor:function () { - this._super(); - if (cc.ENABLE_PROFILERS) { - this._profilingTimer = new cc.ProfilingTimer(); - } - }, - updateQuantityOfNodes:function () { - var s = cc.director.getWinSize(); - - // increase nodes - if (this._currentQuantityOfNodes < this._quantityOfNodes) { - for (var i = 0; i < (this._quantityOfNodes - this._currentQuantityOfNodes); i++) { - var sprite = new cc.Sprite(this._batchNode.texture, cc.rect(0, 0, 32, 32)); - this._batchNode.addChild(sprite); - sprite.x = Math.random() * s.width; - sprite.y = Math.random() * s.height; - } - } - - // decrease nodes - else if (this._currentQuantityOfNodes > this._quantityOfNodes) { - for (var i = 0; i < (this._currentQuantityOfNodes - this._quantityOfNodes); i++) { - var index = this._currentQuantityOfNodes - i - 1; - this._batchNode.removeChildAtIndex(index, true); - } - } - - this._currentQuantityOfNodes = this._quantityOfNodes; - }, - initWithQuantityOfNodes:function (nodes) { - this._batchNode = new cc.SpriteBatchNode("Images/spritesheet1.png"); - this.addChild(this._batchNode); - - this._super(nodes); - - if (cc.ENABLE_PROFILERS) { - this._profilingTimer = cc.Profiler.timerWithName(this.profilerName(), this); - } - this.scheduleUpdate(); - }, - update:function (dt) { - }, - profilerName:function () { - return "none"; - } -}); - -//////////////////////////////////////////////////////// -// -// IterateSpriteSheetFastEnum -// -//////////////////////////////////////////////////////// -var IterateSpriteSheetFastEnum = IterateSpriteSheet.extend({ - update:function (dt) { - // iterate using fast enumeration protocol - var children = this._batchNode.children; - - if (cc.ENABLE_PROFILERS) { - cc.ProfilingBeginTimingBlock(this._profilingTimer); - } - - for (var i = 0; i < children.length; i++) { - var sprite = children[i]; - sprite.visible = false; - } - - if (cc.ENABLE_PROFILERS) { - cc.ProfilingEndTimingBlock(this._profilingTimer); - } - }, - - title:function () { - return "A - Iterate SpriteSheet"; - }, - subtitle:function () { - return "Iterate children using Fast Enum API. See console"; - }, - profilerName:function () { - return "iter fast enum"; - } -}); - -//////////////////////////////////////////////////////// -// -// IterateSpriteSheetCArray -// -//////////////////////////////////////////////////////// -var IterateSpriteSheetCArray = IterateSpriteSheet.extend({ - update:function (dt) { - // iterate using fast enumeration protocol - var children = this._batchNode.children; - - if (cc.ENABLE_PROFILERS) { - cc.ProfilingBeginTimingBlock(this._profilingTimer); - } - for (var i = 0; i < children.length; i++) { - var sprite = children[i]; - sprite.visible = false; - } - - if (cc.ENABLE_PROFILERS) { - cc.ProfilingEndTimingBlock(this._profilingTimer); - } - }, - - title:function () { - return "B - Iterate SpriteSheet"; - }, - subtitle:function () { - return "Iterate children using Array API. See console"; - }, - profilerName:function () { - return "iter c-array"; - } -}); - -//////////////////////////////////////////////////////// -// -// AddRemoveSpriteSheet -// -//////////////////////////////////////////////////////// -var AddRemoveSpriteSheet = NodeChildrenMainScene.extend({ - _batchNode:null, - ctor:function () { - this._super(); - if (cc.ENABLE_PROFILERS) { - this._profilingTimer = new cc.ProfilingTimer(); - } - }, - updateQuantityOfNodes:function () { - var s = cc.director.getWinSize(); - - // increase nodes - if (this._currentQuantityOfNodes < this._quantityOfNodes) { - for (var i = 0; i < (this._quantityOfNodes - this._currentQuantityOfNodes); i++) { - var sprite = new cc.Sprite(this._batchNode.texture, cc.rect(0, 0, 32, 32)); - this._batchNode.addChild(sprite); - sprite.x = Math.random() * s.width; - sprite.y = Math.random() * s.height; - sprite.visible = false; - } - } - // decrease nodes - else if (this._currentQuantityOfNodes > this._quantityOfNodes) { - for (var i = 0; i < (this._currentQuantityOfNodes - this._quantityOfNodes); i++) { - var index = this._currentQuantityOfNodes - i - 1; - this._batchNode.removeChildAtIndex(index, true); - } - } - - this._currentQuantityOfNodes = this._quantityOfNodes; - }, - initWithQuantityOfNodes:function (nodes) { - this._batchNode = new cc.SpriteBatchNode("Images/spritesheet1.png"); - this.addChild(this._batchNode); - - this._super(nodes); - - if (cc.ENABLE_PROFILERS) { - this._profilingTimer = cc.Profiler.timerWithName(this.profilerName(), this); - } - - this.scheduleUpdate(); - }, - update:function (dt) { - }, - profilerName:function () { - return "none"; - } -}); - -//////////////////////////////////////////////////////// -// -// AddSpriteSheet -// -//////////////////////////////////////////////////////// -var AddSpriteSheet = AddRemoveSpriteSheet.extend({ - update:function (dt) { - // reset seed - //srandom(0); - - // 15 percent - var totalToAdd = this._currentQuantityOfNodes * 0.15; - - if (totalToAdd > 0) { - var sprites = []; - var zs = []; - - // Don't include the sprite creation time and random as part of the profiling - for (var i = 0; i < totalToAdd; i++) { - var sprite = new cc.Sprite(this._batchNode.texture, cc.rect(0, 0, 32, 32)); - sprites.push(sprite); - zs[i] = (Math.random()*2-1) * 50; - } - - // add them with random Z (very important!) - if (cc.ENABLE_PROFILERS) - cc.ProfilingBeginTimingBlock(this._profilingTimer); - } - - for (var i = 0; i < totalToAdd; i++) { - this._batchNode.addChild(sprites[i], zs[i], TAG_BASE + i); - } - - if (cc.ENABLE_PROFILERS) { - cc.ProfilingEndTimingBlock(this._profilingTimer); - } - - // remove them - for (var i = 0; i < totalToAdd; i++) { - this._batchNode.removeChildByTag(TAG_BASE + i, true); - } - - delete zs; - - }, - title:function () { - return "C - Add to spritesheet"; - }, - subtitle:function () { - return "Adds %10 of total sprites with random z. See console"; - }, - profilerName:function () { - return "add sprites"; - } - }) - ; - -//////////////////////////////////////////////////////// -// -// RemoveSpriteSheet -// -//////////////////////////////////////////////////////// -var RemoveSpriteSheet = AddRemoveSpriteSheet.extend({ - update:function (dt) { - //srandom(0); - - // 15 percent - var totalToAdd = this._currentQuantityOfNodes * 0.15; - - if (totalToAdd > 0) { - var sprites = []; - - // Don't include the sprite creation time as part of the profiling - for (var i = 0; i < totalToAdd; i++) { - var sprite = new cc.Sprite(this._batchNode.texture, cc.rect(0, 0, 32, 32)); - sprites.push(sprite); - } - - // add them with random Z (very important!) - for (var i = 0; i < totalToAdd; i++) { - this._batchNode.addChild(sprites[i], (Math.random()*2-1) * 50, TAG_BASE + i); - } - - // remove them - if (cc.ENABLE_PROFILERS) { - cc.ProfilingBeginTimingBlock(this._profilingTimer); - } - - for (var i = 0; i < totalToAdd; i++) { - this._batchNode.removeChildByTag(TAG_BASE + i, true); - } - - if (cc.ENABLE_PROFILERS) { - cc.ProfilingEndTimingBlock(this._profilingTimer); - } - } - }, - title:function () { - return "D - Del from spritesheet"; - }, - subtitle:function () { - return "Remove %10 of total sprites placed randomly. See console"; - }, - profilerName:function () { - return "remove sprites"; - } -}); - -//////////////////////////////////////////////////////// -// -// ReorderSpriteSheet -// -//////////////////////////////////////////////////////// -var ReorderSpriteSheet = AddRemoveSpriteSheet.extend({ - - update:function (dt) { - //srandom(0); - - // 15 percent - var totalToAdd = this._currentQuantityOfNodes * 0.15; - - if (totalToAdd > 0) { - var sprites = []; - - // Don't include the sprite creation time as part of the profiling - for (var i = 0; i < totalToAdd; i++) { - var sprite = new cc.Sprite(this._batchNode.texture, cc.rect(0, 0, 32, 32)); - sprites.push(sprite); - } - - // add them with random Z (very important!) - for (var i = 0; i < totalToAdd; i++) { - this._batchNode.addChild(sprites[i], (Math.random()*2-1) * 50, TAG_BASE + i); - } - - // [this._batchNode sortAllChildren]; - - // reorder them - if (cc.ENABLE_PROFILERS) { - cc.ProfilingBeginTimingBlock(this._profilingTimer); - } - - for (var i = 0; i < totalToAdd; i++) { - var node = this._batchNode.children[i]; - ; - this._batchNode.reorderChild(node, (Math.random()*2-1) * 50); - } - if (cc.ENABLE_PROFILERS) { - cc.ProfilingEndTimingBlock(this._profilingTimer); - } - } - - - // remove them - for (var i = 0; i < totalToAdd; i++) { - this._batchNode.removeChildByTag(TAG_BASE + i, true); - } - - }, - - title:function () { - return "E - Reorder from spritesheet"; - }, - subtitle:function () { - return "Reorder %10 of total sprites placed randomly. See console"; - }, - profilerName:function () { - return "reorder sprites"; - } -}); - -function runNodeChildrenTest() { - var scene = new IterateSpriteSheetCArray(); - scene.initWithQuantityOfNodes(NODES_INCREASE); - cc.director.runScene(scene); -} diff --git a/tests/js-tests/src/PerformanceTest/PerformanceParticleTest.js b/tests/js-tests/src/PerformanceTest/PerformanceParticleTest.js deleted file mode 100644 index b844b20101..0000000000 --- a/tests/js-tests/src/PerformanceTest/PerformanceParticleTest.js +++ /dev/null @@ -1,526 +0,0 @@ -/**************************************************************************** - Copyright (c) 2008-2010 Ricardo Quesada - Copyright (c) 2011-2012 cocos2d-x.org - 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. - ****************************************************************************/ -var TAG_PARTICLE_SYSTEM = 3; -var TAG_LABEL_ATLAS = 4; -var MAX_PARTICLES = 3000; -var PARTICLE_NODES_INCREASE = 200; -var s_nParCurIdx = 0; -var TAG_PARTICLE_MENU_LAYER = 1000; - -//////////////////////////////////////////////////////// -// -// ParticleMenuLayer -// -//////////////////////////////////////////////////////// -var ParticleMenuLayer = PerformBasicLayer.extend({ - _maxCases:4, - showCurrentTest:function () { - var scene = this.parent; - var subTest = scene.getSubTestNum(); - var parNum = scene.getParticlesNum(); - - var newScene = null; - - switch (this._curCase) { - case 0: - newScene = new ParticlePerformTest1; - break; - case 1: - newScene = new ParticlePerformTest2; - break; - case 2: - newScene = new ParticlePerformTest3; - break; - case 3: - newScene = new ParticlePerformTest4; - break; - } - - s_nParCurIdx = this._curCase; - if (newScene) { - newScene.initWithSubTest(subTest, parNum); - cc.director.runScene(newScene); - } - } -}); - -//////////////////////////////////////////////////////// -// -// ParticleMainScene -// -//////////////////////////////////////////////////////// -var ParticleMainScene = cc.Scene.extend({ - _lastRenderedCount:null, - _quantityParticles:null, - _subtestNumber:null, - ctor:function () { - this._super(); - this.init(); - }, - initWithSubTest:function (asubtest, particles) { - //srandom(0); - - this._subtestNumber = asubtest; - var s = cc.director.getWinSize(); - - this._lastRenderedCount = 0; - this._quantityParticles = particles; - - cc.MenuItemFont.setFontSize(65); - var decrease = new cc.MenuItemFont(" - ", this.onDecrease, this); - decrease.color = cc.color(0, 200, 20); - var increase = new cc.MenuItemFont(" + ", this.onIncrease, this); - increase.color = cc.color(0, 200, 20); - - var menu = new cc.Menu(decrease, increase); - menu.alignItemsHorizontally(); - menu.x = s.width / 2; - menu.y = s.height / 2 + 15; - this.addChild(menu, 1); - - var infoLabel = new cc.LabelTTF("0 nodes", "Marker Felt", 30); - infoLabel.color = cc.color(0, 200, 20); - infoLabel.x = s.width / 2; - infoLabel.y = s.height - 90; - this.addChild(infoLabel, 1, TAG_INFO_LAYER); - - // particles on stage - var labelAtlas = new cc.LabelAtlas("0000", "Images/fps_images.png", 16, 24, '.'); - // var labelAtlas = cc.LabelTTF.create("0000", "Marker Felt", 30); - this.addChild(labelAtlas, 0, TAG_LABEL_ATLAS); - labelAtlas.x = s.width - 66; - labelAtlas.y = 50; - - // Next Prev Test - var menu = new ParticleMenuLayer(true, 4, s_nParCurIdx); - this.addChild(menu, 1, TAG_PARTICLE_MENU_LAYER); - - // Sub Tests - cc.MenuItemFont.setFontSize(40); - var subMenu = new cc.Menu(); - for (var i = 1; i <= 3; ++i) { - var str = i.toString(); - var itemFont = new cc.MenuItemFont(str, this.testNCallback, this); - itemFont.tag = i; - subMenu.addChild(itemFont, 10); - - if (i <= 1) { - itemFont.color = cc.color(200, 20, 20); - } - else { - itemFont.color = cc.color(0, 200, 20); - } - } - subMenu.alignItemsHorizontally(); - subMenu.x = s.width / 2; - subMenu.y = 80; - this.addChild(subMenu, 2); - - var label = new cc.LabelTTF(this.title(), "Arial", 40); - this.addChild(label, 1); - label.x = s.width / 2; - label.y = s.height - 32; - label.color = cc.color(255, 255, 40); - - this.updateQuantityLabel(); - this.createParticleSystem(); - - this.schedule(this.step); - }, - title:function () { - return "No title"; - }, - - step:function (dt) { - var atlas = this.getChildByTag(TAG_LABEL_ATLAS); - var emitter = this.getChildByTag(TAG_PARTICLE_SYSTEM); - - var str = emitter.getParticleCount().toString(); - atlas.setString(str); - }, - createParticleSystem:function () { - /* - * Tests: - * 1 Quad Particle System using 32-bit textures (PNG) - * 2: Quad Particle System using 16-bit textures (PNG) - * 3: Quad Particle System using 8-bit textures (PNG) - * 4: Quad Particle System using 4-bit textures (PVRTC) - */ - - this.removeChildByTag(TAG_PARTICLE_SYSTEM, true); - - // remove the "fire.png" from the TextureCache cache. - //var texture = cc.textureCache.addImage("Images/fire.png"); - //cc.textureCache.removeTexture(texture); - - var particleSystem = new cc.ParticleSystem(this._quantityParticles); - - switch (this._subtestNumber) { - case 1: - if ("opengl" in cc.sys.capabilities) - cc.Texture2D.defaultPixelFormat = cc.Texture2D.PIXEL_FORMAT_RGBA8888; - particleSystem.texture = cc.textureCache.addImage("Images/fire.png"); - break; - case 2: - if ("opengl" in cc.sys.capabilities) - cc.Texture2D.defaultPixelFormat = cc.Texture2D.PIXEL_FORMAT_RGBA4444; - particleSystem.texture = cc.textureCache.addImage("Images/fire.png"); - break; - case 3: - if ("opengl" in cc.sys.capabilities) - cc.Texture2D.defaultPixelFormat = cc.Texture2D.PIXEL_FORMAT_A8; - particleSystem.texture = cc.textureCache.addImage("Images/fire.png"); - break; - default: - particleSystem = null; - cc.log("Shall not happen!"); - break; - } - this.addChild(particleSystem, 0, TAG_PARTICLE_SYSTEM); - - this.doTest(); - - // restore the default pixel format - if ("opengl" in cc.sys.capabilities) - cc.Texture2D.defaultPixelFormat = cc.Texture2D.PIXEL_FORMAT_RGBA8888; - }, - onDecrease:function (sender) { - this._quantityParticles -= PARTICLE_NODES_INCREASE; - if (this._quantityParticles < 0) - this._quantityParticles = 0; - - this.updateQuantityLabel(); - this.createParticleSystem(); - }, - onIncrease:function (sender) { - this._quantityParticles += PARTICLE_NODES_INCREASE; - if (this._quantityParticles > MAX_PARTICLES) { - this._quantityParticles = MAX_PARTICLES; - } - this.updateQuantityLabel(); - this.createParticleSystem(); - }, - testNCallback:function (sender) { - this._subtestNumber = sender.tag; - var menu = this.getChildByTag(TAG_PARTICLE_MENU_LAYER); - menu.restartCallback(sender); - }, - updateQuantityLabel:function () { - if (this._quantityParticles != this._lastRenderedCount) { - var infoLabel = this.getChildByTag(TAG_INFO_LAYER); - var str = this._quantityParticles + " particles"; - infoLabel.setString(str); - - this._lastRenderedCount = this._quantityParticles; - } - }, - getSubTestNum:function () { - return this._subtestNumber; - }, - getParticlesNum:function () { - return this._quantityParticles; - }, - doTest:function () { - } -}); - -//////////////////////////////////////////////////////// -// -// ParticlePerformTest1 -// -//////////////////////////////////////////////////////// -var ParticlePerformTest1 = ParticleMainScene.extend({ - - title:function () { - return "A " + this._subtestNumber + " size=4"; - }, - doTest:function () { - var s = cc.director.getWinSize(); - var particleSystem = this.getChildByTag(TAG_PARTICLE_SYSTEM); - - // duration - particleSystem.setDuration(-1); - - // gravity - particleSystem.setGravity(cc.p(0, -90)); - - // angle - particleSystem.setAngle(90); - particleSystem.setAngleVar(0); - - // radial - particleSystem.setRadialAccel(0); - particleSystem.setRadialAccelVar(0); - - // speed of particles - particleSystem.setSpeed(180); - particleSystem.setSpeedVar(50); - - // emitter position - particleSystem.x = s.width / 2; - particleSystem.y = 100; - particleSystem.setPosVar(cc.p(s.width / 2, 0)); - - // life of particles - particleSystem.setLife(2.0); - particleSystem.setLifeVar(1); - - // emits per frame - particleSystem.setEmissionRate(particleSystem.getTotalParticles() / particleSystem.getLife()); - - // color of particles - var startColor = cc.color(128, 128, 128, 255); - particleSystem.setStartColor(startColor); - - var startColorVar = cc.color(128, 128, 128, 255); - particleSystem.setStartColorVar(startColorVar); - - var endColor = cc.color(26, 26, 26, 51); - particleSystem.setEndColor(endColor); - - var endColorVar = cc.color(26, 26, 26, 51); - particleSystem.setEndColorVar(endColorVar); - - // size, in pixels - particleSystem.setEndSize(4.0); - particleSystem.setStartSize(4.0); - particleSystem.setEndSizeVar(0); - particleSystem.setStartSizeVar(0); - - // additive - particleSystem.setBlendAdditive(false); - } -}); - -//////////////////////////////////////////////////////// -// -// ParticlePerformTest2 -// -//////////////////////////////////////////////////////// -var ParticlePerformTest2 = ParticleMainScene.extend({ - - title:function () { - return "B " + this._subtestNumber + " size=8"; - }, - doTest:function () { - var s = cc.director.getWinSize(); - var particleSystem = this.getChildByTag(TAG_PARTICLE_SYSTEM); - - // duration - particleSystem.setDuration(-1); - - // gravity - particleSystem.setGravity(cc.p(0, -90)); - - // angle - particleSystem.setAngle(90); - particleSystem.setAngleVar(0); - - // radial - particleSystem.setRadialAccel(0); - particleSystem.setRadialAccelVar(0); - - // speed of particles - particleSystem.setSpeed(180); - particleSystem.setSpeedVar(50); - - // emitter position - particleSystem.x = s.width / 2; - particleSystem.y = 100; - particleSystem.setPosVar(cc.p(s.width / 2, 0)); - - // life of particles - particleSystem.setLife(2.0); - particleSystem.setLifeVar(1); - - // emits per frame - particleSystem.setEmissionRate(particleSystem.getTotalParticles() / particleSystem.getLife()); - - // color of particles - var startColor = cc.color(128, 128, 128, 255); - particleSystem.setStartColor(startColor); - - var startColorVar = cc.color(128, 128, 128, 255); - particleSystem.setStartColorVar(startColorVar); - - var endColor = cc.color(26, 26, 26, 51); - particleSystem.setEndColor(endColor); - - var endColorVar = cc.color(26, 26, 26, 51); - particleSystem.setEndColorVar(endColorVar); - - // size, in pixels - particleSystem.setEndSize(8.0); - particleSystem.setStartSize(8.0); - particleSystem.setEndSizeVar(0); - particleSystem.setStartSizeVar(0); - - // additive - particleSystem.setBlendAdditive(false); - } -}); - -//////////////////////////////////////////////////////// -// -// ParticlePerformTest3 -// -//////////////////////////////////////////////////////// -var ParticlePerformTest3 = ParticleMainScene.extend({ - - title:function () { - return "C " + this._subtestNumber + " size=32"; - }, - doTest:function () { - var s = cc.director.getWinSize(); - var particleSystem = this.getChildByTag(TAG_PARTICLE_SYSTEM); - - // duration - particleSystem.setDuration(-1); - - // gravity - particleSystem.setGravity(cc.p(0, -90)); - - // angle - particleSystem.setAngle(90); - particleSystem.setAngleVar(0); - - // radial - particleSystem.setRadialAccel(0); - particleSystem.setRadialAccelVar(0); - - // speed of particles - particleSystem.setSpeed(180); - particleSystem.setSpeedVar(50); - - // emitter position - particleSystem.x = s.width / 2; - particleSystem.y = 100; - particleSystem.setPosVar(cc.p(s.width / 2, 0)); - - // life of particles - particleSystem.setLife(2.0); - particleSystem.setLifeVar(1); - - // emits per frame - particleSystem.setEmissionRate(particleSystem.getTotalParticles() / particleSystem.getLife()); - - // color of particles - var startColor = cc.color(128, 128, 128, 255); - particleSystem.setStartColor(startColor); - - var startColorVar = cc.color(128, 128, 128, 255); - particleSystem.setStartColorVar(startColorVar); - - var endColor = cc.color(26, 26, 26, 51); - particleSystem.setEndColor(endColor); - - var endColorVar = cc.color(26, 26, 26, 51); - particleSystem.setEndColorVar(endColorVar); - - // size, in pixels - particleSystem.setEndSize(32.0); - particleSystem.setStartSize(32.0); - particleSystem.setEndSizeVar(0); - particleSystem.setStartSizeVar(0); - - // additive - particleSystem.setBlendAdditive(false); - } -}); - -//////////////////////////////////////////////////////// -// -// ParticlePerformTest4 -// -//////////////////////////////////////////////////////// -var ParticlePerformTest4 = ParticleMainScene.extend({ - - title:function () { - return "D " + this._subtestNumber + " size=64"; - }, - doTest:function () { - var s = cc.director.getWinSize(); - var particleSystem = this.getChildByTag(TAG_PARTICLE_SYSTEM); - - // duration - particleSystem.setDuration(-1); - - // gravity - particleSystem.setGravity(cc.p(0, -90)); - - // angle - particleSystem.setAngle(90); - particleSystem.setAngleVar(0); - - // radial - particleSystem.setRadialAccel(0); - particleSystem.setRadialAccelVar(0); - - // speed of particles - particleSystem.setSpeed(180); - particleSystem.setSpeedVar(50); - - // emitter position - particleSystem.x = s.width / 2; - particleSystem.y = 100; - particleSystem.setPosVar(cc.p(s.width / 2, 0)); - - // life of particles - particleSystem.setLife(2.0); - particleSystem.setLifeVar(1); - - // emits per frame - particleSystem.setEmissionRate(particleSystem.getTotalParticles() / particleSystem.getLife()); - - // color of particles - var startColor = cc.color(128, 128, 128, 255); - particleSystem.setStartColor(startColor); - - var startColorVar = cc.color(128, 128, 128, 255); - particleSystem.setStartColorVar(startColorVar); - - var endColor = cc.color(26, 26, 26, 51); - particleSystem.setEndColor(endColor); - - var endColorVar = cc.color(26, 26, 26, 51); - particleSystem.setEndColorVar(endColorVar); - - // size, in pixels - particleSystem.setEndSize(64.0); - particleSystem.setStartSize(64.0); - particleSystem.setEndSizeVar(0); - particleSystem.setStartSizeVar(0); - - // additive - particleSystem.setBlendAdditive(false); - } -}); - -function runParticleTest() { - var scene = new ParticlePerformTest1; - scene.initWithSubTest(1, PARTICLE_NODES_INCREASE); - cc.director.runScene(scene); -} diff --git a/tests/js-tests/src/PerformanceTest/PerformanceSpriteTest.js b/tests/js-tests/src/PerformanceTest/PerformanceSpriteTest.js deleted file mode 100644 index 004a94b8cc..0000000000 --- a/tests/js-tests/src/PerformanceTest/PerformanceSpriteTest.js +++ /dev/null @@ -1,606 +0,0 @@ -/**************************************************************************** - Copyright (c) 2008-2010 Ricardo Quesada - Copyright (c) 2011-2012 cocos2d-x.org - 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. - ****************************************************************************/ -var MAX_SPRITES = 10000; -var SPRITES_INCREASE = 500; - -if ( !cc.sys.isNative) { - if(cc.sys.isMobile){ - MAX_SPRITES = 3000; - SPRITES_INCREASE = 50; - } -} - -var TAG_INFO_LAYER = 1; -var TAG_MAIN_LAYER = 2; -var TAG_SPRITE_MENU_LAYER = (MAX_SPRITES + 1000); - -var s_nSpriteCurCase = 0; - -//////////////////////////////////////////////////////// -// -// SubTest -// -//////////////////////////////////////////////////////// -var SubTest = cc.Class.extend({ - _subtestNumber:null, - _batchNode:null, - _parent:null, - removeByTag:function (tag) { - switch (this._subtestNumber) { - case 1: - case 4: - case 7: - this._parent.removeChildByTag(tag + 100, true); - break; - case 2: - case 3: - case 5: - case 6: - case 8: - case 9: - this._batchNode.removeChildAtIndex(tag, true); - break; - default: - break; - } - }, - createSpriteWithTag:function (tag) { -// create - if( "opengl" in cc.sys.capabilities ) - cc.Texture2D.defaultPixelFormat = cc.Texture2D.PIXEL_FORMAT_RGBA8888; - - var sprite = null; - switch (this._subtestNumber) { - case 1: - { - sprite = new cc.Sprite("Images/grossinis_sister1.png"); - this._parent.addChild(sprite, 0, tag + 100); - break; - } - case 2: - case 3: - { - sprite = new cc.Sprite(this._batchNode.texture, cc.rect(0, 0, 52, 139)); - this._batchNode.addChild(sprite, 0, tag + 100); - break; - } - case 4: - { - var idx = parseInt(Math.random() * 14) + 1; - idx = idx < 10 ? "0" + idx : idx.toString(); - var str = "Images/grossini_dance_" + idx + ".png"; - sprite = new cc.Sprite(str); - this._parent.addChild(sprite, 0, tag + 100); - break; - } - case 5: - case 6: - { - var idx = 0 | (Math.random() * 14); - var x = (idx % 5) * 85; - var y = (0 | (idx / 5)) * 121; - sprite = new cc.Sprite(this._batchNode.texture, cc.rect(x, y, 85, 121)); - this._batchNode.addChild(sprite, 0, tag + 100); - break; - } - - case 7: - { - var y, x; - var r = 0 | (Math.random() * 64); - - y = parseInt(r / 8); - x = parseInt(r % 8); - - var str = "Images/sprites_test/sprite-" + x + "-" + y + ".png"; - sprite = new cc.Sprite(str); - this._parent.addChild(sprite, 0, tag + 100); - break; - } - - case 8: - case 9: - { - var y, x; - var r = 0 | (Math.random() * 64); - - y = (0 | (r / 8)) * 32; - x = (r % 8) * 32; - sprite = new cc.Sprite(this._batchNode.texture, cc.rect(x, y, 32, 32)); - this._batchNode.addChild(sprite, 0, tag + 100); - break; - } - - default: - break; - } - - if( "opengl" in cc.sys.capabilities ) - cc.Texture2D.defaultPixelFormat = cc.Texture2D.PIXEL_FORMAT_DEFAULT; - - return sprite; - }, - initWithSubTest:function (subTest, p) { - this._subtestNumber = subTest; - this._parent = p; - this._batchNode = null; - /* - * Tests: - * 1: 1 (32-bit) PNG sprite of 52 x 139 - * 2: 1 (32-bit) PNG Batch Node using 1 sprite of 52 x 139 - * 3: 1 (16-bit) PNG Batch Node using 1 sprite of 52 x 139 - * 4: 1 (4-bit) PVRTC Batch Node using 1 sprite of 52 x 139 - - * 5: 14 (32-bit) PNG sprites of 85 x 121 each - * 6: 14 (32-bit) PNG Batch Node of 85 x 121 each - * 7: 14 (16-bit) PNG Batch Node of 85 x 121 each - * 8: 14 (4-bit) PVRTC Batch Node of 85 x 121 each - - * 9: 64 (32-bit) sprites of 32 x 32 each - *10: 64 (32-bit) PNG Batch Node of 32 x 32 each - *11: 64 (16-bit) PNG Batch Node of 32 x 32 each - *12: 64 (4-bit) PVRTC Batch Node of 32 x 32 each - */ - - // purge textures - // - // [mgr removeAllTextures]; - if ( cc.sys.isNative) { - var mgr = cc.textureCache; - mgr.removeTexture(mgr.addImage("Images/grossinis_sister1.png")); - mgr.removeTexture(mgr.addImage("Images/grossini_dance_atlas.png")); - mgr.removeTexture(mgr.addImage("Images/spritesheet1.png")); - } - - switch (this._subtestNumber) { - case 1: - case 4: - case 7: - break; - /// - case 2: - if( "opengl" in cc.sys.capabilities ) - cc.Texture2D.defaultPixelFormat = cc.Texture2D.PIXEL_FORMAT_RGBA8888; - this._batchNode = new cc.SpriteBatchNode("Images/grossinis_sister1.png", 500); - p.addChild(this._batchNode, 0); - break; - case 3: - if( "opengl" in cc.sys.capabilities ) - cc.Texture2D.defaultPixelFormat = cc.Texture2D.PIXEL_FORMAT_RGBA4444; - this._batchNode = new cc.SpriteBatchNode("Images/grossinis_sister1.png", 500); - p.addChild(this._batchNode, 0); - break; - - /// - case 5: - if( "opengl" in cc.sys.capabilities ) - cc.Texture2D.defaultPixelFormat = cc.Texture2D.PIXEL_FORMAT_RGBA8888; - this._batchNode = new cc.SpriteBatchNode("Images/grossini_dance_atlas.png", 500); - p.addChild(this._batchNode, 0); - break; - case 6: - if( "opengl" in cc.sys.capabilities ) - cc.Texture2D.defaultPixelFormat = cc.Texture2D.PIXEL_FORMAT_RGBA4444; - this._batchNode = new cc.SpriteBatchNode("Images/grossini_dance_atlas.png", 500); - p.addChild(this._batchNode, 0); - break; - - /// - case 8: - if( "opengl" in cc.sys.capabilities ) - cc.Texture2D.defaultPixelFormat = cc.Texture2D.PIXEL_FORMAT_RGBA8888; - this._batchNode = new cc.SpriteBatchNode("Images/spritesheet1.png", 500); - p.addChild(this._batchNode, 0); - break; - case 9: - if( "opengl" in cc.sys.capabilities ) - cc.Texture2D.defaultPixelFormat = cc.Texture2D.PIXEL_FORMAT_RGBA4444; - this._batchNode = new cc.SpriteBatchNode("Images/spritesheet1.png", 500); - p.addChild(this._batchNode, 0); - break; - - default: - break; - } - - if( "opengl" in cc.sys.capabilities ) - cc.Texture2D.defaultPixelFormat = cc.Texture2D.PIXEL_FORMAT_DEFAULT; - } -}); - -//////////////////////////////////////////////////////// -// -// SpriteMenuLayer -// -//////////////////////////////////////////////////////// -var SpriteMenuLayer = PerformBasicLayer.extend({ - _maxCases:7, - showCurrentTest:function () { - var scene = null; - var preScene = this.parent; - var subTest = preScene.getSubTestNum(); - var nodes = preScene.getNodesNum(); - - Math.seedrandom('perftest'); - - switch (this._curCase) { - case 0: - scene = new SpritePerformTest1(); - break; - case 1: - scene = new SpritePerformTest2(); - break; - case 2: - scene = new SpritePerformTest3(); - break; - case 3: - scene = new SpritePerformTest4(); - break; - case 4: - scene = new SpritePerformTest5(); - break; - case 5: - scene = new SpritePerformTest6(); - break; - case 6: - scene = new SpritePerformTest7(); - break; - } - s_nSpriteCurCase = this._curCase; - - if (scene) { - scene.initWithSubTest(subTest, nodes); - cc.director.runScene(scene); - } - } -}); - -//////////////////////////////////////////////////////// -// -// SpriteMainScene -// -//////////////////////////////////////////////////////// -var SpriteMainScene = cc.Scene.extend({ - _lastRenderedCount:null, - _quantityNodes:null, - _subTest:null, - _subtestNumber:1, - ctor:function() { - this._super(); - this.init(); - }, - - title:function () { - return "No title"; - }, - initWithSubTest:function (asubtest, nodes) { - this._subtestNumber = asubtest; - this._subTest = new SubTest(); - this._subTest.initWithSubTest(asubtest, this); - - var s = cc.director.getWinSize(); - - this._lastRenderedCount = 0; - this._quantityNodes = 0; - - // add title label - var label = new cc.LabelTTF(this.title(), "Arial", 40); - this.addChild(label, 1); - label.x = s.width / 2; - label.y = s.height - 32; - label.color = cc.color(255, 255, 40); - - cc.MenuItemFont.setFontSize(65); - var decrease = new cc.MenuItemFont(" - ", this.onDecrease, this); - decrease.color = cc.color(0, 200, 20); - var increase = new cc.MenuItemFont(" + ", this.onIncrease, this); - increase.color = cc.color(0, 200, 20); - - var menu = new cc.Menu(decrease, increase); - menu.alignItemsHorizontally(); - - menu.x = s.width / 2; - - menu.y = s.height - 65; - this.addChild(menu, 1); - - var infoLabel = new cc.LabelTTF("0 nodes", "Marker Felt", 30); - infoLabel.color = cc.color(0, 200, 20); - infoLabel.x = s.width / 2; - infoLabel.y = s.height - 90; - this.addChild(infoLabel, 1, TAG_INFO_LAYER); - - // add menu - var menu = new SpriteMenuLayer(true, 7, s_nSpriteCurCase); - this.addChild(menu, 1, TAG_SPRITE_MENU_LAYER); - - // Sub Tests - cc.MenuItemFont.setFontSize(32); - var subMenu = new cc.Menu(); - for (var i = 1; i <= 9; ++i) { - var text = i.toString(); - var itemFont = new cc.MenuItemFont(text, this.testNCallback, this); - itemFont.tag = i; - subMenu.addChild(itemFont, 10); - - if (i <= 3) - itemFont.color = cc.color(200, 20, 20); - else if (i <= 6) - itemFont.color = cc.color(0, 200, 20); - else - itemFont.color = cc.color(0, 20, 200); - } - - subMenu.alignItemsHorizontally(); - subMenu.x = s.width / 2; - subMenu.y = 80; - this.addChild(subMenu, 2); - - while (this._quantityNodes < nodes) { - this.onIncrease(this); - } - }, - updateNodes:function () { - if (this._quantityNodes != this._lastRenderedCount) { - var infoLabel = this.getChildByTag(TAG_INFO_LAYER); - var str = this._quantityNodes + " nodes"; - infoLabel.setString(str); - - this._lastRenderedCount = this._quantityNodes; - } - }, - testNCallback:function (sender) { - this._subtestNumber = sender.tag; - var menu = this.getChildByTag(TAG_SPRITE_MENU_LAYER); - menu.restartCallback(sender); - }, - onIncrease:function (sender) { - if (this._quantityNodes >= MAX_SPRITES) - return; - - for (var i = 0; i < SPRITES_INCREASE; i++) { - var sprite = this._subTest.createSpriteWithTag(this._quantityNodes); - this.doTest(sprite); - this._quantityNodes++; - } - - this.updateNodes(); - }, - onDecrease:function (sender) { - if (this._quantityNodes <= 0) - return; - - for (var i = 0; i < SPRITES_INCREASE; i++) { - this._quantityNodes--; - this._subTest.removeByTag(this._quantityNodes); - } - - this.updateNodes(); - }, - - doTest:function (sprite) { - - }, - - getSubTestNum:function () { - return this._subtestNumber - }, - getNodesNum:function () { - return this._quantityNodes - } -}); - - -//////////////////////////////////////////////////////// -// -// For test functions -// -//////////////////////////////////////////////////////// -function performanceActions(sprite) { - var size = cc.director.getWinSize(); - sprite.x = parseInt(Math.random() * size.width); - sprite.y = parseInt(Math.random() * size.height); - - var period = 0.5 + (Math.random() * 1000) / 500.0; - var rot = cc.rotateBy(period, 360.0 * Math.random()); - var rot_back = rot.reverse(); - var permanentRotation = cc.sequence(rot, rot_back).repeatForever(); - sprite.runAction(permanentRotation); - - var growDuration = 0.5 + (Math.random() * 1000) / 500.0; - var grow = cc.scaleBy(growDuration, 0.5, 0.5); - var permanentScaleLoop = cc.sequence(grow, grow.reverse()).repeatForever(); - sprite.runAction(permanentScaleLoop); -} - -function performanceActions20(sprite) { - var size = cc.director.getWinSize(); - if (Math.random() < 0.2) { - sprite.x = parseInt(Math.random() * size.width); - sprite.y = parseInt(Math.random() * size.height); - } - else { - sprite.x = -1000; - sprite.y = -1000; - } - - var period = 0.5 + (Math.random() * 1000) / 500.0; - var rot = cc.rotateBy(period, 360.0 * Math.random()); - var rot_back = rot.reverse(); - var permanentRotation = cc.sequence(rot, rot_back).repeatForever(); - sprite.runAction(permanentRotation); - - var growDuration = 0.5 + (Math.random() * 1000) / 500.0; - var grow = cc.scaleBy(growDuration, 0.5, 0.5); - var permanentScaleLoop = cc.sequence(grow, grow.reverse()).repeatForever(); - sprite.runAction(permanentScaleLoop); -} - -function performanceRotationScale(sprite) { - var size = cc.director.getWinSize(); - sprite.x = parseInt(Math.random() * size.width); - sprite.y = parseInt(Math.random() * size.height); - sprite.rotation = Math.random() * 360; - sprite.scale = Math.random() * 2; -} - -function performancePosition(sprite) { - var size = cc.director.getWinSize(); - sprite.x = parseInt(Math.random() * size.width); - sprite.y = parseInt(Math.random() * size.height); -} - -function performanceout20(sprite) { - var size = cc.director.getWinSize(); - - if (Math.random() < 0.2) { - sprite.x = parseInt(Math.random() * size.width); - sprite.y = parseInt(Math.random() * size.height); - } - else { - sprite.x = -1000; - sprite.y = -1000; - } -} - -function performanceOut100(sprite) { - sprite.x = -1000; - sprite.y = -1000; -} - -function performanceScale(sprite) { - var size = cc.director.getWinSize(); - sprite.x = parseInt(Math.random() * size.width); - sprite.y = parseInt(Math.random() * size.height); - sprite.scale = Math.random() * 100 / 50; -} - - -//////////////////////////////////////////////////////// -// -// SpritePerformTest1 -// -//////////////////////////////////////////////////////// -var SpritePerformTest1 = SpriteMainScene.extend({ - doTest:function (sprite) { - performancePosition(sprite); - }, - title:function () { - return "A (" + this._subtestNumber + ") position"; - } -}); - -//////////////////////////////////////////////////////// -// -// SpritePerformTest2 -// -//////////////////////////////////////////////////////// -var SpritePerformTest2 = SpriteMainScene.extend({ - doTest:function (sprite) { - performanceScale(sprite); - }, - title:function () { - return "B (" + this._subtestNumber + ") scale"; - } -}); - -//////////////////////////////////////////////////////// -// -// SpritePerformTest3 -// -//////////////////////////////////////////////////////// -var SpritePerformTest3 = SpriteMainScene.extend({ - doTest:function (sprite) { - performanceRotationScale(sprite); - }, - title:function () { - return "C (" + this._subtestNumber + ") scale + rot"; - } -}); - -//////////////////////////////////////////////////////// -// -// SpritePerformTest4 -// -//////////////////////////////////////////////////////// -var SpritePerformTest4 = SpriteMainScene.extend({ - doTest:function (sprite) { - performanceOut100(sprite); - }, - title:function () { - return "D (" + this._subtestNumber + ") 100% out"; - } -}); - -//////////////////////////////////////////////////////// -// -// SpritePerformTest5 -// -//////////////////////////////////////////////////////// -var SpritePerformTest5 = SpriteMainScene.extend({ - doTest:function (sprite) { - performanceout20(sprite); - }, - title:function () { - return "E (" + this._subtestNumber + ") 80% out"; - } -}); - -//////////////////////////////////////////////////////// -// -// SpritePerformTest6 -// -//////////////////////////////////////////////////////// -var SpritePerformTest6 = SpriteMainScene.extend({ - doTest:function (sprite) { - performanceActions(sprite); - }, - title:function () { - return "F (" + this._subtestNumber + ") actions"; - } -}); - -//////////////////////////////////////////////////////// -// -// SpritePerformTest7 -// -//////////////////////////////////////////////////////// -var SpritePerformTest7 = SpriteMainScene.extend({ - doTest:function (sprite) { - performanceActions20(sprite); - }, - title:function () { - return "G (" + this._subtestNumber + ") actions 80% out"; - } -}); - -function runSpriteTest() { - Math.seedrandom('perftest'); - - var scene = new SpritePerformTest1; - scene.initWithSubTest(1, 50); - cc.director.runScene(scene); -} diff --git a/tests/js-tests/src/PerformanceTest/PerformanceSpriteTest2.js b/tests/js-tests/src/PerformanceTest/PerformanceSpriteTest2.js deleted file mode 100644 index 840f2977c5..0000000000 --- a/tests/js-tests/src/PerformanceTest/PerformanceSpriteTest2.js +++ /dev/null @@ -1,305 +0,0 @@ -/**************************************************************************** - Copyright (c) 2008-2010 Ricardo Quesada - Copyright (c) 2011-2012 cocos2d-x.org - Copyright (c) 2013-2014 Chukong Technologies Inc. - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - ****************************************************************************/ - -var SECONDS_PER_TEST = 5; -//------------------------------------------------------------------ -// -// Profiler -// -//------------------------------------------------------------------ - -function Profiling(name) { - this.name = name; - this.numberOfCalls = 0; - this.totalTime = 0; - this.minTime = 10000; - this.maxTime = 0; - this.lastUpdate = 0; - - this.beginBlock = function() { - this.lastUpdate = Date.now(); - }; - - this.endBlock = function() { - var now = Date.now(); - var diff = now-this.lastUpdate; - this.totalTime += diff; - this.numberOfCalls++; - this.minTime = Math.min(this.minTime, diff); - this.maxTime = Math.max(this.maxTime, diff); - }; - - this.beginEndBlock = function(diff) { - this.totalTime += diff; - this.numberOfCalls++; - this.minTime = Math.min(this.minTime, diff); - this.maxTime = Math.max(this.maxTime, diff); - }; - - this.reset = function() { - this.totalTime = 0; - this.minTime = 100000; - this.maxTime = 0; - this.lastUpdate = 0; - this.numberOfCalls = 0; - }; - - this.dump = function() { - cc.log('Profiling info for: ' + this.name + '\n' + - 'Number of calls: ' + this.numberOfCalls + '\n' + - 'Average Time: ' + (this.totalTime/this.numberOfCalls)/1000 + '\n' + - 'Min Time: ' + this.minTime/1000 + '\n' + - 'Max Time: ' + this.maxTime/1000 + '\n' + - 'Total Time: ' + this.totalTime/1000 + '\n' - ); - }; -} - - - -var performanceSpriteTestSceneIdx = -1; -//------------------------------------------------------------------ -// -// PerformanceSpriteTestDemo -// -//------------------------------------------------------------------ -var PerformanceTestBase = cc.Layer.extend({ - _title:"", - _subtitle:"", - - ctor:function() { - this._super(); - this.init(); - }, - onEnter:function () { - this._super(); - - var label = new cc.LabelTTF(this._title, "Arial", 28); - this.addChild(label, 1); - label.x = winSize.width / 2; - label.y = winSize.height - 50; - - if (this._subtitle !== "") { - var l = new cc.LabelTTF(this._subtitle, "Thonburi", 16); - this.addChild(l, 1); - l.x = winSize.width / 2; - l.y = winSize.height - 80; - } - - var item1 = new cc.MenuItemImage(s_pathB1, s_pathB2, this.onBackCallback, this); - var item2 = new cc.MenuItemImage(s_pathR1, s_pathR2, this.onRestartCallback, this); - var item3 = new cc.MenuItemImage(s_pathF1, s_pathF2, this.onNextCallback, this); - - var menu = new cc.Menu(item1, item2, item3); - - menu.x = 0; - - menu.y = 0; - var csw = item2.width, csh = item2.height; - item1.x = winSize.width/2 - csw*2; - item1.y = csh/2; - item2.x = winSize.width/2; - item2.y = csh/2; - item3.x = winSize.width/2 + csw*2; - item3.y = csh/2; - - this.addChild(menu, 1); - }, - - onRestartCallback:function (sender) { - var s = new PerformanceSpriteTestScene(); - s.addChild(restartPerformanceSpriteTest()); - director.runScene(s); - }, - onNextCallback:function (sender) { - var s = new PerformanceSpriteTestScene(); - s.addChild(nextPerformanceSpriteTest()); - director.runScene(s); - }, - onBackCallback:function (sender) { - var s = new PerformanceSpriteTestScene(); - s.addChild(previousPerformanceSpriteTest()); - director.runScene(s); - } -}); - -//------------------------------------------------------------------ -// -// PerformanceSpriteTest1 -// -//------------------------------------------------------------------ -var PerformanceSpriteTest1 = PerformanceTestBase.extend({ - _title:"Performance Test 1", - _subtitle:"Let it run until you see the 'done' message. See console for results.", - - ctor:function () { - this._super(); - - this.testFunctions = [this.testA, this.testB]; - this.endFunctions = [this.endA, this.endB]; - this.testSpriteTotals = [100,500,1000,2000,5000,10000]; - this.functionsIdx = 0; - this.spritesTotalsIdx = -1; - - this.runNextTest(); - - this.scheduleUpdate(); - this.schedule( this.endProfiling, SECONDS_PER_TEST); - this.firstTick = true; - }, - - runNextTest:function() { - - // cleanup current function - if( this.spritesTotalsIdx != -1) { - var cleanup = this.endFunctions[ this.functionsIdx ]; - cleanup.bind(this)(); - } - - this.spritesTotalsIdx++; - - // get next function - if( this.spritesTotalsIdx >= this.testSpriteTotals.length ) { - this.spritesTotalsIdx = 0; - this.functionsIdx++; - if( this.functionsIdx >= this.testFunctions.length ) { - cc.log("No more tests"); - return false; - } - } - var func = this.testFunctions[ this.functionsIdx ]; - var t = this.testSpriteTotals[ this.spritesTotalsIdx ]; - func.bind(this)(t); - return true; - }, - - testA:function(num) { - // Draws all sprites on the screen - // Non-batched drawing - - this.profiling = new Profiling("Test A - Total Sprites: " + num); - - // use the same seed for the tests - Math.seedrandom('perftest'); - var parent = new cc.Node(); - this.addChild(parent,0,10); - - for( var i=0; i 1.0) { - var frameRateB = (this._numberOfTouchesB / this._elapsedTime).toFixed(1); - var frameRateM = (this._numberOfTouchesM / this._elapsedTime).toFixed(1); - var frameRateE = (this._numberOfTouchesE / this._elapsedTime).toFixed(1); - var frameRateC = (this._numberOfTouchesC / this._elapsedTime).toFixed(1); - this._elapsedTime = 0; - this._numberOfTouchesB = this._numberOfTouchesM = this._numberOfTouchesE = this._numberOfTouchesC = 0; - - var str = frameRateB + " " + frameRateM + " " + frameRateE + " " + frameRateC; - this._plabel.setString(str); - } - } -}); - -//////////////////////////////////////////////////////// -// -// TouchesPerformTest1 -// -//////////////////////////////////////////////////////// -var TouchesPerformTest1 = TouchesMainScene.extend({ - onEnter:function () { - this._super(); - - var _this = this; - cc.eventManager.addListener({ - event: cc.EventListener.TOUCH_ONE_BY_ONE, - swallowTouches: true, - onTouchBegan:function (touch, event) { - _this._numberOfTouchesB++; - return true; - }, - onTouchMoved:function (touch, event) { - _this._numberOfTouchesM++; - }, - onTouchEnded:function (touch, event) { - _this._numberOfTouchesE++; - }, - onTouchCancelled:function (touch, event) { - _this._numberOfTouchesC++; - } - }, this); - }, - title:function () { - return "Targeted touches"; - } -}); - -//////////////////////////////////////////////////////// -// -// TouchesPerformTest2 -// -//////////////////////////////////////////////////////// -var TouchesPerformTest2 = TouchesMainScene.extend({ - onEnter:function () { - this._super(); - var _this = this; - cc.eventManager.addListener({ - event: cc.EventListener.TOUCH_ALL_AT_ONCE, - onTouchesBegan:function (touches, event) { - _this._numberOfTouchesB += touches.length; - }, - onTouchesMoved:function (touches, event) { - _this._numberOfTouchesM += touches.length; - }, - onTouchesEnded:function (touches, event) { - _this._numberOfTouchesE += touches.length; - }, - onTouchesCancelled:function (touches, event) { - _this._numberOfTouchesC += touches.length; - } - }, this); - }, - title:function () { - return "Standard touches"; - } -}); - -function runTouchesTest() { - s_nTouchCurCase = 0; - var scene = new cc.Scene(); - var layer = new TouchesPerformTest1(true, 2, s_nTouchCurCase); - scene.addChild(layer); - cc.director.runScene(scene); -} diff --git a/tests/js-tests/src/PerformanceTest/PerformanceVirtualMachineTest.js b/tests/js-tests/src/PerformanceTest/PerformanceVirtualMachineTest.js deleted file mode 100644 index 605fa17d4b..0000000000 --- a/tests/js-tests/src/PerformanceTest/PerformanceVirtualMachineTest.js +++ /dev/null @@ -1,550 +0,0 @@ -/**************************************************************************** - Copyright (c) 2008-2010 Ricardo Quesada - Copyright (c) 2011-2012 cocos2d-x.org - 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. - ****************************************************************************/ - -var VM_TAG_BASE = 2000; -var VM_MAX_NODES = 1500; -var VM_NODES_INCREASE = 100; -var s_nVMCurCase = 0; - -//////////////////////////////////////////////////////// -// -// VirtualMachineTestMenuLayer -// -// These are some demo test cases about low level JS engine behavior, so in -// some sense this is simliar to PerformanceNodeChildrenTest. This file is -// derived from PerformanceNodeChildrenTest.js actually. -// -// See https://github.com/oupengsoftware/v8/wiki for some of the details (V8) -// under the hood. -// Keyword: hidden class, inline cache, dictionary mode. -// -//////////////////////////////////////////////////////// -var VirtualMachineTestMenuLayer = PerformBasicLayer.extend({ - _maxCases:6, - ctor:function(){ - this._super(); - this._maxCases = (cc._renderType === cc._RENDER_TYPE_CANVAS) ? 6 : 4; - }, - showCurrentTest:function () { - var nodes = (this.parent).getQuantityOfNodes(); - var scene = null; - switch (this._curCase) { - case 0: - scene = new SpritesWithManyPropertiesTestScene1(); - break; - case 1: - scene = new SpritesWithManyPropertiesTestScene2(); - break; - case 2: - scene = new SpritesUndergoneDifferentOperationsTestScene1(); - break; - case 3: - scene = new SpritesUndergoneDifferentOperationsTestScene2(); - break; - case 4: - scene = new ClonedSpritesTestScene1(); - break; - case 5: - scene = new ClonedSpritesTestScene2(); - break; - } - s_nVMCurCase = this._curCase; - - if (scene) { - scene.initWithQuantityOfNodes(nodes); - cc.director.runScene(scene); - } - } -}); - -//////////////////////////////////////////////////////// -// -// VirtualMachineTestMainScene -// -//////////////////////////////////////////////////////// -var VirtualMachineTestMainScene = cc.Scene.extend({ - _lastRenderedCount:null, - _quantityOfNodes:null, - _currentQuantityOfNodes:null, - _batchNode:null, - - ctor:function() { - this._super(); - this.init(); - }, - - initWithQuantityOfNodes:function (nodes) { - this._batchNode = new cc.SpriteBatchNode("Images/grossinis_sister1.png"); - this.addChild(this._batchNode); - - //srand(time()); - var s = cc.director.getWinSize(); - - // Title - var label = new cc.LabelTTF(this.title(), "Arial", 40); - this.addChild(label, 1); - label.x = s.width / 2; - label.y = s.height - 32; - label.color = cc.color(255, 255, 40); - - // Subtitle - var strSubTitle = this.subtitle(); - if (strSubTitle.length) { - var l = new cc.LabelTTF(strSubTitle, "Thonburi", 16); - this.addChild(l, 1); - l.x = s.width / 2; - l.y = s.height - 80; - } - - this._lastRenderedCount = 0; - this._currentQuantityOfNodes = 0; - this._quantityOfNodes = nodes; - - cc.MenuItemFont.setFontSize(65); - var that = this; - var decrease = new cc.MenuItemFont(" - ", this.onDecrease, this); - decrease.color = cc.color(0, 200, 20); - var increase = new cc.MenuItemFont(" + ", this.onIncrease, this); - increase.color = cc.color(0, 200, 20); - - var menu = new cc.Menu(decrease, increase); - menu.alignItemsHorizontally(); - menu.x = s.width / 2; - menu.y = s.height / 2 + 15; - this.addChild(menu, 1); - - var infoLabel = new cc.LabelTTF("0 nodes", "Marker Felt", 30); - infoLabel.color = cc.color(0, 200, 20); - infoLabel.x = s.width / 2; - infoLabel.y = s.height / 2 - 15; - this.addChild(infoLabel, 1, TAG_INFO_LAYER); - - var menu = new VirtualMachineTestMenuLayer(true, 3, s_nVMCurCase); - this.addChild(menu); - - this.updateQuantityLabel(); - this.updateQuantityOfNodes(); - this.scheduleUpdate(); - }, - title:function () { - cc.Assert(0); - // override me - }, - subtitle:function () { - cc.Assert(0); - // override me - }, - updateQuantityOfNodes:function () { - cc.Assert(0); - // override me - }, - onDecrease:function (sender) { - this._quantityOfNodes -= VM_NODES_INCREASE; - if (this._quantityOfNodes < 0) { - this._quantityOfNodes = 0; - } - - this.updateQuantityLabel(); - this.updateQuantityOfNodes(); - }, - onIncrease:function (sender) { - this._quantityOfNodes += VM_NODES_INCREASE; - if (this._quantityOfNodes > VM_MAX_NODES) { - this._quantityOfNodes = VM_MAX_NODES - } - - this.updateQuantityLabel(); - this.updateQuantityOfNodes(); - }, - updateQuantityLabel:function () { - if (this._quantityOfNodes != this._lastRenderedCount) { - var infoLabel = this.getChildByTag(TAG_INFO_LAYER); - var str = this._quantityOfNodes + " nodes"; - infoLabel.setString(str); - - this._lastRenderedCount = this._quantityOfNodes; - } - }, - getQuantityOfNodes:function () { - return this._quantityOfNodes; - }, - arrayToUpdate:null, - update:function (dt) { - if (!this.arrayToUpdate) return; - for (var i = 0, imax = this.arrayToUpdate.length; i < imax; ++i) { - var child = this.arrayToUpdate[i]; - if (!(child instanceof SimpleNewtonianSprite) && - child instanceof cc.Class) continue; // old cc.clone-ed - // sprite is not a cc.Class - for (var j = 0; j < 1000; ++j ) { - child._velocityX = child._velocityX + dt * child._accelerationX; - child._velocityY = child._velocityY + dt * child._accelerationY; - child._positionX = child._positionX + dt * child._velocityX; - child._positionY = child._positionY + dt * child._velocityY; - } - } - } -}); - -// Simple sprite extension used for testing the performance of property access. -var SimpleNewtonianSprite = cc.Sprite.extend({ - ctor:function(texture, rect) { - cc.Sprite.prototype.ctor.call(this); - // Since jsb doesn't have ._position, in order not to make these - // showcase more complicated by introducing fuction calls (because - // different JS engines have different inlining strategy), we simply - // introduce ._postionX ._positionY here. These (and update()) really - // just represent *heavy property access operation* anyway (they're - // otherwise dummy). - this._positionX = 0.0; - this._positionY = 0.0; - this._velocityX = 0.0; - this._velocityY = 0.0; - this._accelerationX = 0.0; - this._accelerationY = 0.0; - - if(texture && rect) - this.initWithTexture(texture, rect); - } -}); - -//////////////////////////////////////////////////////// -// -// SpritesWithManyPropertiesTestScene -// -// Some JS engines (notably, V8) assume that objects with many properties are -// dictionary (c.f CCClass.js) and that makes bad performance. Here we -// simulate a character class with many properties of a character, but -// otherwise these properties are dummy (and probably doesn't make much -// sense) in the test of course. -// (TODO: Find a open source real world example, which shouldn't be that hard. -// :) ) -// -//////////////////////////////////////////////////////// -var SpriteWithManyProperties = SimpleNewtonianSprite.extend({ - ctor:function(texture, rect) { - SimpleNewtonianSprite.prototype.ctor.call(this, texture, rect); - this._name = ""; - this._species = ""; - this._id = -1; - this._hp = 100; - this._mp = 100; - this._exp = 100; - this._lv = 1; - this._str = 100; - this._dex = 100; - this._int = 100; - this._luk = 100; - this._gold = 10000000; // I'm rich. - this._weight = 100.0; - this._height = 100.0; - this._items = []; - this._spells = []; - this._dressing = null; - this._weapon = null; - this._mission = null; - this._friends = []; - this._groups = []; - - this._idleTime = 0.0; - this._loginTime = 0.0; - this._isAutoMove = false; - this._autoMoveTarget = false; - this._attackMode = 0; - this._active = true; - this._canBeAttack = true; - this._isLocalPlayer = false; - this._moveType = null; - this._I_AM_TIRED_OF_COMING_UP_WITH_NEW_PROPERTIES = true; - } -}); - -var SpritesWithManyPropertiesTestScene1 = VirtualMachineTestMainScene.extend({ - updateQuantityOfNodes:function () { - var s = cc.director.getWinSize(); - - // increase nodes - if (this._currentQuantityOfNodes < this._quantityOfNodes) { - for (var i = 0; - i < (this._quantityOfNodes - this._currentQuantityOfNodes); - i++) { - var sprite = - new SpriteWithManyProperties(this._batchNode.texture, - cc.rect(0, 0, 52, 139)); - this._batchNode.addChild(sprite); - sprite.x = Math.random() * s.width; - sprite.y = Math.random() * s.height; - } - } - - // decrease nodes - else if (this._currentQuantityOfNodes > this._quantityOfNodes) { - for (var i = 0; - i < (this._currentQuantityOfNodes - this._quantityOfNodes); - i++) { - var index = this._currentQuantityOfNodes - i - 1; - this._batchNode.removeChildAtIndex(index, true); - } - } - - this._currentQuantityOfNodes = this._quantityOfNodes; - }, - title:function () { - return "A1 - Sprites Have Many Properties"; - }, - subtitle:function () { - return "See fps (and source code of this test)."; - } -}); - -var SpritesWithManyPropertiesTestScene2 = - SpritesWithManyPropertiesTestScene1.extend({ - updateQuantityOfNodes:function () { - this._super(); - var arrayToUpdate = this._batchNode.children; - for (var i = 0, imax = arrayToUpdate.length; i < imax; ++i) - arrayToUpdate[i].visible = false; - this.arrayToUpdate = arrayToUpdate; - }, - title:function () { - return "A2 - Sprites Have Many Properties"; - }, - subtitle:function () { - return "No draw(). update() does heavy calculations."; - } -}); - -//////////////////////////////////////////////////////// -// -// SpritesUndergoneDifferentOperationsTestScene -// -// If properties in use are not initilized on each instance, a combinarial -// explosion of hidden classes have to be created for each possible -// permutation of operations. This increases inline cache size and -// constitutes significant performance penalty. -// -//////////////////////////////////////////////////////// - -var SpritesUndergoneDifferentOperationsTestScene1 = VirtualMachineTestMainScene.extend({ - // Adpated from http://codereview.stackexchange.com/a/7025 - possibleOperationSeries:(function permutations(array){ - var fn = function(active, rest, a) { - if (!active.length && !rest.length) { - a.push([]); - return; - } - if (!rest.length) { - if (active.length === 1) { - a.push(active); - return; - } - - var fac = 1; - for (var i = active.length; i > 0; --i) fac = fac * i; - for (var i = 0; i < fac; ++i) { - var choice_num = i; - var choice = []; - for (var j = 1; j < active.length + 1; ++j) { - choice.unshift(choice_num % j); - choice_num = (choice_num - choice_num % j) / j; - } - - var to_choose_from = active.slice(0); - var new_permutation = []; - for (var k = 0; k < active.length; ++k) - new_permutation.push(to_choose_from. - splice(choice[k], 1)[0]); - a.push(new_permutation); - } - } else { - fn(active.concat([rest[0]]), rest.slice(1), a); - fn(active, rest.slice(1), a); - } - return a; - }; - return fn([], array, []); - })([ - function() { this.children; }, // appends ._children - function() { this.tag = cc.NODE_TAG_INVALID; }, // appends .tag - function() { this.setParent(null); }, // appends ._parent - function() { this.zIndex = 0; }, // appends ._zOrder - function() { this.rotation = 0; }, // appends ._rotationX/Y - function() { this.visible = true; }, // appends ._visible - function() { this.onEnter(); } // appends ._running - ]), - updateQuantityOfNodes:function () { - var s = cc.director.getWinSize(); - - // increase nodes - if (this._currentQuantityOfNodes < this._quantityOfNodes) { - for (var i = 0; - i < (this._quantityOfNodes - this._currentQuantityOfNodes); - i++) { - var sprite = - new SimpleNewtonianSprite(this._batchNode.texture, - cc.rect(0, 0, 52, 139)); - var series = this.possibleOperationSeries[i]; - for (var op = 0, opmax = series.length; op < opmax; ++op) - series[op].call(sprite); - - this._batchNode.addChild(sprite); - sprite.x = Math.random() * s.width; - sprite.y = Math.random() * s.height; - } - } - - // decrease nodes - else if (this._currentQuantityOfNodes > this._quantityOfNodes) { - for (var i = 0; - i < (this._currentQuantityOfNodes - this._quantityOfNodes); - i++) { - var index = this._currentQuantityOfNodes - i - 1; - this._batchNode.removeChildAtIndex(index, true); - } - } - - this._currentQuantityOfNodes = this._quantityOfNodes; - }, - title:function () { - return "B1 - Sprites Undergone Different Op. Order"; - }, - subtitle:function () { - return "See fps (and source code of this test)."; - } -}); - -var SpritesUndergoneDifferentOperationsTestScene2 = - SpritesUndergoneDifferentOperationsTestScene1.extend({ - // This looks exactly like the one on ManyPropertiesTestScene2, but - // we can't just do - // 'updateQuantityOfNodes: SpritesWithManyPropertiesTestScene2.prototype.updateQuantityOfNodes' - // here becasue this._super() is different! - updateQuantityOfNodes:function () { - this._super(); - var arrayToUpdate = this._batchNode.children; - for (var i = 0, imax = arrayToUpdate.length; i < imax; ++i) - arrayToUpdate[i].visible = false; - this.arrayToUpdate = arrayToUpdate; - }, - title:function () { - return "B2 - Sprites Undergone Different Op. Order"; - }, - subtitle:function () { - return "No draw(). update() does heavy calculations."; - } -}); - -//////////////////////////////////////////////////////// -// -// ClonedSpritesTestScene -// -// cc.clone has to be written carefully or cloned objects all go to dictionary -// mode. -// -//////////////////////////////////////////////////////// -var ClonedSpritesTestScene1 = VirtualMachineTestMainScene.extend({ - template:null, - updateQuantityOfNodes:function () { - if (!this.template) - this.template = - new SimpleNewtonianSprite(this._batchNode.texture, - cc.rect(0, 0, 52, 139)); - var s = cc.director.getWinSize(); - - // increase nodes - if (this._currentQuantityOfNodes < this._quantityOfNodes) { - for (var i = 0; - i < (this._quantityOfNodes - this._currentQuantityOfNodes); - i++) { - var sprite = cc.clone(this.template); - sprite.setParent(null); // old cc.clone copies null as {}... - - // cc.SpriteBatchNode doesn't support adding non-cc.Sprite child - // and hence incompatible with old cc.clone. We add the sprite - // to the scene directly. - this.addChild(sprite, -1); // zOrder has to be less than 0 or it - // overlaps the menu. - sprite.x = Math.random() * s.width; - sprite.y = Math.random() * s.height; - } - } - - // decrease nodes - else if (this._currentQuantityOfNodes > this._quantityOfNodes) { - var children = this.children; - var lastChildToRemove = children.length; - for (var i = children.length - 1; i >= 0; --i) { - var child = children[i]; - if (child instanceof SimpleNewtonianSprite || - !(child instanceof cc.Class)) { // old cc.clone-ed - // sprite is not a cc.Class - lastChildToRemove = i; - break; - } - } - - for (var i = 0; - i < (this._currentQuantityOfNodes - this._quantityOfNodes); - i++) { - var index = lastChildToRemove - i; - this.removeChild(children[index], true); - } - } - - this._currentQuantityOfNodes = this._quantityOfNodes; - }, - title:function () { - return "C1 - Cloned Sprites"; - }, - subtitle:function () { - return "See fps (and source code of this test)."; - } -}); - -var ClonedSpritesTestScene2 = ClonedSpritesTestScene1.extend({ - updateQuantityOfNodes:function () { - if (!this.template) { - this.template = - new SimpleNewtonianSprite(this._batchNode.texture, - cc.rect(0, 0, 52, 139)); - this.template.visible = false; - } - this._super(); - this.arrayToUpdate = this.children; - }, - title:function () { - return "C2 - Cloned Sprites"; - }, - subtitle:function () { - return "No draw(). update() does heavy calculations."; - } -}); - -function runVirtualMachineTest() { - var scene = new SpritesWithManyPropertiesTestScene1(); - scene.initWithQuantityOfNodes(VM_NODES_INCREASE); - cc.director.runScene(scene); -} diff --git a/tests/js-tests/src/PerformanceTest/seedrandom.js b/tests/js-tests/src/PerformanceTest/seedrandom.js deleted file mode 100644 index 58b4a96158..0000000000 --- a/tests/js-tests/src/PerformanceTest/seedrandom.js +++ /dev/null @@ -1,272 +0,0 @@ -// seedrandom.js version 2.0. -// Author: David Bau 4/2/2011 -// -// Defines a method Math.seedrandom() that, when called, substitutes -// an explicitly seeded RC4-based algorithm for Math.random(). Also -// supports automatic seeding from local or network sources of entropy. -// -// Usage: -// -// -// -// Math.seedrandom('yipee'); Sets Math.random to a function that is -// initialized using the given explicit seed. -// -// Math.seedrandom(); Sets Math.random to a function that is -// seeded using the current time, dom state, -// and other accumulated local entropy. -// The generated seed string is returned. -// -// Math.seedrandom('yowza', true); -// Seeds using the given explicit seed mixed -// together with accumulated entropy. -// -// -// Seeds using physical random bits downloaded -// from random.org. -// -// Seeds using urandom bits from call.jsonlib.com, -// which is faster than random.org. -// -// Examples: -// -// Math.seedrandom("hello"); // Use "hello" as the seed. -// document.write(Math.random()); // Always 0.5463663768140734 -// document.write(Math.random()); // Always 0.43973793770592234 -// var rng1 = Math.random; // Remember the current prng. -// -// var autoseed = Math.seedrandom(); // New prng with an automatic seed. -// document.write(Math.random()); // Pretty much unpredictable. -// -// Math.random = rng1; // Continue "hello" prng sequence. -// document.write(Math.random()); // Always 0.554769432473455 -// -// Math.seedrandom(autoseed); // Restart at the previous seed. -// document.write(Math.random()); // Repeat the 'unpredictable' value. -// -// Notes: -// -// Each time seedrandom('arg') is called, entropy from the passed seed -// is accumulated in a pool to help generate future seeds for the -// zero-argument form of Math.seedrandom, so entropy can be injected over -// time by calling seedrandom with explicit data repeatedly. -// -// On speed - This javascript implementation of Math.random() is about -// 3-10x slower than the built-in Math.random() because it is not native -// code, but this is typically fast enough anyway. Seeding is more expensive, -// especially if you use auto-seeding. Some details (timings on Chrome 4): -// -// Our Math.random() - avg less than 0.002 milliseconds per call -// seedrandom('explicit') - avg less than 0.5 milliseconds per call -// seedrandom('explicit', true) - avg less than 2 milliseconds per call -// seedrandom() - avg about 38 milliseconds per call -// -// LICENSE (BSD): -// -// Copyright 2010 David Bau, all rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of this module nor the names of its contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/** - * All code is in an anonymous closure to keep the global namespace clean. - * - * @param {number=} overflow - * @param {number=} startdenom - */ -(function (pool, math, width, chunks, significance, overflow, startdenom) { - - -// -// seedrandom() -// This is the seedrandom function described above. -// -math.seedrandom = function seedrandom(seed, use_entropy) { - var key = []; - var arc4; - - // Flatten the seed string or build one from local entropy if needed. - seed = mixkey(flatten( - use_entropy ? [seed, pool] : - arguments.length ? seed : - [Date.now(), pool, window], 3), key); - - // Use the seed to initialize an ARC4 generator. - arc4 = new ARC4(key); - - // Mix the randomness into accumulated entropy. - mixkey(arc4.S, pool); - - // Override Math.random - - // This function returns a random double in [0, 1) that contains - // randomness in every bit of the mantissa of the IEEE 754 value. - - math.random = function random() { // Closure to return a random double: - var n = arc4.g(chunks); // Start with a numerator n < 2 ^ 48 - var d = startdenom; // and denominator d = 2 ^ 48. - var x = 0; // and no 'extra last byte'. - while (n < significance) { // Fill up all significant digits by - n = (n + x) * width; // shifting numerator and - d *= width; // denominator and generating a - x = arc4.g(1); // new least-significant-byte. - } - while (n >= overflow) { // To avoid rounding up, before adding - n /= 2; // last byte, shift everything - d /= 2; // right using integer math until - x >>>= 1; // we have exactly the desired bits. - } - return (n + x) / d; // Form the number within [0, 1). - }; - - // Return the seed that was used - return seed; -}; - -// -// ARC4 -// -// An ARC4 implementation. The constructor takes a key in the form of -// an array of at most (width) integers that should be 0 <= x < (width). -// -// The g(count) method returns a pseudorandom integer that concatenates -// the next (count) outputs from ARC4. Its return value is a number x -// that is in the range 0 <= x < (width ^ count). -// -/** @constructor */ -function ARC4(key) { - var t, u, me = this, keylen = key.length; - var i = 0, j = me.i = me.j = me.m = 0; - me.S = []; - me.c = []; - - // The empty key [] is treated as [0]. - if (!keylen) { key = [keylen++]; } - - // Set up S using the standard key scheduling algorithm. - while (i < width) { me.S[i] = i++; } - for (i = 0; i < width; i++) { - t = me.S[i]; - j = lowbits(j + t + key[i % keylen]); - u = me.S[j]; - me.S[i] = u; - me.S[j] = t; - } - - // The "g" method returns the next (count) outputs as one number. - me.g = function getnext(count) { - var s = me.S; - var i = lowbits(me.i + 1); var t = s[i]; - var j = lowbits(me.j + t); var u = s[j]; - s[i] = u; - s[j] = t; - var r = s[lowbits(t + u)]; - while (--count) { - i = lowbits(i + 1); t = s[i]; - j = lowbits(j + t); u = s[j]; - s[i] = u; - s[j] = t; - r = r * width + s[lowbits(t + u)]; - } - me.i = i; - me.j = j; - return r; - }; - // For robust unpredictability discard an initial batch of values. - // See http://www.rsa.com/rsalabs/node.asp?id=2009 - me.g(width); -} - -// -// flatten() -// Converts an object tree to nested arrays of strings. -// -/** @param {Object=} result - * @param {string=} prop - * @param {string=} typ */ -function flatten(obj, depth, result, prop, typ) { - result = []; - typ = typeof(obj); - if (depth && typ == 'object') { - for (prop in obj) { - if (prop.indexOf('S') < 5) { // Avoid FF3 bug (local/sessionStorage) - try { result.push(flatten(obj[prop], depth - 1)); } catch (e) {} - } - } - } - return (result.length ? result : obj + (typ != 'string' ? '\0' : '')); -} - -// -// mixkey() -// Mixes a string seed into a key that is an array of integers, and -// returns a shortened string seed that is equivalent to the result key. -// -/** @param {number=} smear - * @param {number=} j */ -function mixkey(seed, key, smear, j) { - seed += ''; // Ensure the seed is a string - smear = 0; - for (j = 0; j < seed.length; j++) { - key[lowbits(j)] = - lowbits((smear ^= key[lowbits(j)] * 19) + seed.charCodeAt(j)); - } - seed = ''; - for (j in key) { seed += String.fromCharCode(key[j]); } - return seed; -} - -// -// lowbits() -// A quick "n mod width" for width a power of 2. -// -function lowbits(n) { return n & (width - 1); } - -// -// The following constants are related to IEEE 754 limits. -// -startdenom = math.pow(width, chunks); -significance = math.pow(2, significance); -overflow = significance * 2; - -// -// When seedrandom.js is loaded, we immediately mix a few bits -// from the built-in RNG into the entropy pool. Because we do -// not want to intefere with determinstic PRNG state later, -// seedrandom will not call math.random on its own again after -// initialization. -// -mixkey(math.random(), pool); - -// End anonymous scope, and pass initial values. -})( - [], // pool: entropy pool starts empty - Math, // math: package containing random, pow, and seedrandom - 256, // width: each RC4 output is 0 <= x < 256 - 6, // chunks: at least six RC4 outputs for each double - 52 // significance: there are 52 significant digits in a double -); diff --git a/tests/js-tests/src/SceneTest/SceneTest.js b/tests/js-tests/src/SceneTest/SceneTest.js index cf622438d6..87a94f3c39 100644 --- a/tests/js-tests/src/SceneTest/SceneTest.js +++ b/tests/js-tests/src/SceneTest/SceneTest.js @@ -45,7 +45,12 @@ var SceneTestLayer1 = cc.Layer.extend({ }, this); var item4 = new cc.MenuItemFont("setNotificationNode", function () { var layerTemp = new cc.LayerColor(cc.color(0, 255, 255, 120)); + var sprite = new cc.Sprite(s_pathGrossini); + sprite.setPosition(cc.p(winSize.width/2,winSize.height/2)); + layerTemp.addChild(sprite); cc.director.setNotificationNode(layerTemp); + var rotation = cc.rotateBy(2,360); + sprite.runAction(rotation.repeatForever()); cc.log("setNotificationNode!"); }, this); var item5 = new cc.MenuItemFont("clearNotificationNode", function () { diff --git a/tests/js-tests/src/tests-main.js b/tests/js-tests/src/tests-main.js index 1beb3568ab..358da7221d 100644 --- a/tests/js-tests/src/tests-main.js +++ b/tests/js-tests/src/tests-main.js @@ -291,15 +291,6 @@ var testNames = [ return new ChipmunkTestScene(); } }, - //"BugsTest", - { - title:"Click and Move Test", - platforms: PLATFORM_ALL, - linksrc:"src/ClickAndMoveTest/ClickAndMoveTest.js", - testScene:function () { - return new ClickAndMoveTestScene(); - } - }, { title:"ClippingNode Test", platforms: PLATFORM_ALL, @@ -544,15 +535,6 @@ var testNames = [ return new PathTestScene(); } }, - { - title:"Performance Test", - platforms: PLATFORM_ALL, - linksrc:"", - resource:g_performace, - testScene:function () { - return new PerformanceTestScene(); - } - }, { title:"Physics3D Test", platforms: PLATFORM_JSB, diff --git a/tests/lua-tests/src/PerformanceTest/PerformanceSpriteTest.lua b/tests/lua-tests/src/PerformanceTest/PerformanceSpriteTest.lua deleted file mode 100644 index 78050ac48e..0000000000 --- a/tests/lua-tests/src/PerformanceTest/PerformanceSpriteTest.lua +++ /dev/null @@ -1,552 +0,0 @@ -local kMaxNodes = 50000 -local kBasicZOrder = 10 -local kNodesIncrease = 250 -local TEST_COUNT = 7 - -local s = cc.Director:getInstance():getWinSize() - ------------------------------------ --- For test functions ------------------------------------ -local function performanceActions(sprite) - sprite:setPosition(cc.p(math.mod(math.random(1, 99999999), s.width), math.mod(math.random(1, 99999999), s.height))) - - local period = 0.5 + math.mod(math.random(1, 99999999), 1000) / 500.0 - local rot = cc.RotateBy:create(period, 360.0 * math.random()) - local rot = cc.RotateBy:create(period, 360.0 * math.random()) - local permanentRotation = cc.RepeatForever:create(cc.Sequence:createWithTwoActions(rot, rot:reverse())) - sprite:runAction(permanentRotation) - - local growDuration = 0.5 + math.mod(math.random(1, 99999999), 1000) / 500.0 - local grow = cc.ScaleBy:create(growDuration, 0.5, 0.5) - local permanentScaleLoop = cc.RepeatForever:create(cc.Sequence:createWithTwoActions(grow, grow:reverse())) - sprite:runAction(permanentScaleLoop) -end - -local function performanceActions20(sprite) - if math.random() < 0.2 then - sprite:setPosition(cc.p(math.mod(math.random(1, 99999999), s.width), math.mod(math.random(1, 99999999), s.height))) - else - sprite:setPosition(cc.p(-1000, -1000)) - end - - local period = 0.5 + math.mod(math.random(1, 99999999), 1000) / 500.0 - local rot = cc.RotateBy:create(period, 360.0 * math.random()) - local permanentRotation = cc.RepeatForever:create(cc.Sequence:createWithTwoActions(rot, rot:reverse())) - sprite:runAction(permanentRotation) - - local growDuration = 0.5 + math.mod(math.random(1, 99999999), 1000) / 500.0 - local grow = cc.ScaleBy:create(growDuration, 0.5, 0.5) - local permanentScaleLoop = cc.RepeatForever:create(cc.Sequence:createWithTwoActions(grow, grow:reverse())) - sprite:runAction(permanentScaleLoop) -end - -local function performanceRotationScale(sprite) - sprite:setPosition(cc.p(math.mod(math.random(1, 99999999), s.width), math.mod(math.random(1, 99999999), s.height))) - sprite:setRotation(math.random() * 360) - sprite:setScale(math.random() * 2) -end - -local function performancePosition(sprite) - sprite:setPosition(cc.p(math.mod(math.random(1, 99999999), s.width), math.mod(math.random(1, 99999999), s.height))) -end - -local function performanceout20(sprite) - if math.random() < 0.2 then - sprite:setPosition(cc.p(math.mod(math.random(1, 99999999), s.width), math.mod(math.random(1, 99999999), s.height))) - else - sprite:setPosition(cc.p(-1000, -1000)) - end -end - -local function performanceOut100(sprite) - sprite:setPosition(cc.p( -1000, -1000)) -end - -local function performanceScale(sprite) - sprite:setPosition(cc.p(math.mod(math.random(1, 99999999), s.width), math.mod(math.random(1, 99999999), s.height))) - sprite:setScale(math.random() * 100 / 50) -end - ------------------------------------ --- Subtest ------------------------------------ -local subtestNumber = 1 -local batchNode = nil -- cc.SpriteBatchNode -local parent = nil -- cc.Node - -local function initWithSubTest(nSubTest, p) - subtestNumber = nSubTest - parent = p - batchNode = nil - - local mgr = cc.Director:getInstance():getTextureCache() - -- remove all texture - mgr:removeTexture(mgr:addImage("Images/grossinis_sister1.png")) - mgr:removeTexture(mgr:addImage("Images/grossini_dance_atlas.png")) - mgr:removeTexture(mgr:addImage("Images/spritesheet1.png")) - - if subtestNumber == 2 then - cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A8888) - batchNode = cc.SpriteBatchNode:create("Images/grossinis_sister1.png", 100) - p:addChild(batchNode, 0) - elseif subtestNumber == 3 then - cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A4444) - batchNode = cc.SpriteBatchNode:create("Images/grossinis_sister1.png", 100) - p:addChild(batchNode, 0) - elseif subtestNumber == 5 then - cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A8888) - batchNode = cc.SpriteBatchNode:create("Images/grossini_dance_atlas.png", 100) - p:addChild(batchNode, 0) - elseif subtestNumber == 6 then - cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A4444) - batchNode = cc.SpriteBatchNode:create("Images/grossini_dance_atlas.png", 100) - p:addChild(batchNode, 0) - elseif subtestNumber == 8 then - cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A8888) - batchNode = cc.SpriteBatchNode:create("Images/spritesheet1.png", 100) - p:addChild(batchNode, 0) - elseif subtestNumber == 9 then - cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A4444) - batchNode = cc.SpriteBatchNode:create("Images/spritesheet1.png", 100) - p:addChild(batchNode, 0) - end - - -- todo - if batchNode ~= nil then - batchNode:retain() - end - - cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE_PIXELFORMAT_DEFAULT) -end - -local function createSpriteWithTag(tag) - cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A8888) - - local sprite = nil - if subtestNumber == 1 then - sprite = cc.Sprite:create("Images/grossinis_sister1.png") - parent:addChild(sprite, -1, tag + 100) - elseif subtestNumber == 2 then - sprite = cc.Sprite:createWithTexture(batchNode:getTexture(), cc.rect(0, 0, 52, 139)) - batchNode:addChild(sprite, 0, tag + 100) - elseif subtestNumber == 3 then - sprite = cc.Sprite:createWithTexture(batchNode:getTexture(), cc.rect(0, 0, 52, 139)) - batchNode:addChild(sprite, 0, tag + 100) - elseif subtestNumber == 4 then - local idx = math.floor((math.random() * 1400 / 100)) + 1 - local num - if idx < 10 then - num = "0" .. idx - else - num = idx - end - local str = "Images/grossini_dance_" .. num .. ".png" - sprite = cc.Sprite:create(str) - parent:addChild(sprite, -1, tag + 100) - elseif subtestNumber == 5 then - local y, x - local r = math.floor(math.random() * 1400 / 100) - y = math.floor(r / 5) - x = math.mod(r, 5) - x = x * 85 - y = y * 121 - sprite = cc.Sprite:createWithTexture(batchNode:getTexture(), cc.rect(x, y, 85, 121)) - batchNode:addChild(sprite, 0, tag + 100) - elseif subtestNumber == 6 then - local y, x - local r = math.floor(math.random() * 1400 / 100) - y = math.floor(r / 5) - x = math.mod(r, 5) - x = x * 85 - y = y * 121 - sprite = cc.Sprite:createWithTexture(batchNode:getTexture(), cc.rect(x, y, 85, 121)) - batchNode:addChild(sprite, 0, tag + 100) - elseif subtestNumber == 7 then - local y, x - local r = math.floor(math.random() * 6400 / 100) - y = math.floor(r / 8) - x = math.mod(r, 8) - local str = "Images/sprites_test/sprite-"..x.."-"..y..".png" - sprite = cc.Sprite:create(str) - parent:addChild(sprite, -1, tag + 100) - elseif subtestNumber == 8 then - local y, x - local r = math.floor(math.random() * 6400 / 100) - y = math.floor(r / 8) - x = math.mod(r, 8) - x = x * 32 - y = y * 32 - sprite = cc.Sprite:createWithTexture(batchNode:getTexture(), cc.rect(x, y, 32, 32)) - batchNode:addChild(sprite, 0, tag + 100) - elseif subtestNumber == 9 then - local y, x - local r = math.floor(math.random() * 6400 / 100) - y = math.floor(r / 8) - x = math.mod(r, 8) - x = x * 32 - y = y * 32 - sprite = cc.Sprite:createWithTexture(batchNode:getTexture(), cc.rect(x, y, 32, 32)) - batchNode:addChild(sprite, 0, tag + 100) - end - - cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE_PIXELFORMAT_DEFAULT) - - return sprite -end - -local function removeByTag(tag) - if subtestNumber == 1 then - parent:removeChildByTag(tag + 100, true) - elseif subtestNumber == 4 then - parent:removeChildByTag(tag + 100, true) - elseif subtestNumber == 7 then - parent:removeChildByTag(tag + 100, true) - else - batchNode:removeChildAtIndex(tag, true) - end -end - ------------------------------------ --- PerformBasicLayer ------------------------------------ -local curCase = 0 -local maxCases = 7 - -local function showThisTest() - local scene = CreateSpriteTestScene() - cc.Director:getInstance():replaceScene(scene) -end - -local function backCallback(sender) - subtestNumber = 1 - curCase = curCase - 1 - if curCase < 0 then - curCase = curCase + maxCases - end - showThisTest() -end - -local function restartCallback(sender) - subtestNumber = 1 - showThisTest() -end - -local function nextCallback(sender) - subtestNumber = 1 - curCase = curCase + 1 - curCase = math.mod(curCase, maxCases) - showThisTest() -end - -local function toPerformanceMainLayer(sender) - cc.Director:getInstance():replaceScene(PerformanceTest()) -end - -local function initWithLayer(layer, controlMenuVisible) - cc.MenuItemFont:setFontName("Arial") - cc.MenuItemFont:setFontSize(24) - local mainItem = cc.MenuItemFont:create("Back") - mainItem:registerScriptTapHandler(toPerformanceMainLayer) - mainItem:setPosition(s.width - 50, 25) - local menu = cc.Menu:create() - menu:addChild(mainItem) - menu:setPosition(cc.p(0, 0)) - - if controlMenuVisible == true then - local item1 = cc.MenuItemImage:create(s_pPathB1, s_pPathB2) - local item2 = cc.MenuItemImage:create(s_pPathR1, s_pPathR2) - local item3 = cc.MenuItemImage:create(s_pPathF1, s_pPathF2) - item1:registerScriptTapHandler(backCallback) - item2:registerScriptTapHandler(restartCallback) - item3:registerScriptTapHandler(nextCallback) - item1:setPosition(s.width / 2 - 100, 30) - item2:setPosition(s.width / 2, 30) - item3:setPosition(s.width / 2 + 100, 30) - - menu:addChild(item1, kItemTagBasic) - menu:addChild(item2, kItemTagBasic) - menu:addChild(item3, kItemTagBasic) - end - layer:addChild(menu) -end - ------------------------------------ --- SpriteMainScene ------------------------------------ -local lastRenderedCount = nil -local quantityNodes = nil - -local infoLabel = nil -local titleLabel = nil - -local function testNCallback(tag) - subtestNumber = tag - kBasicZOrder - showThisTest() -end - -local function updateNodes() - if quantityNodes ~= lastRenderedCount then - local str = quantityNodes .. " nodes" - infoLabel:setString(str) - lastRenderedCount = quantityNodes - end -end - -local function onDecrease(sender) - if quantityNodes <= 0 then - return - end - - for i = 0, kNodesIncrease - 1 do - quantityNodes = quantityNodes - 1 - removeByTag(quantityNodes) - end - updateNodes() -end - -local function onIncrease(sender) - if quantityNodes >= kMaxNodes then - return - end - - for i = 0, kNodesIncrease - 1 do - local sprite = createSpriteWithTag(quantityNodes) - - if curCase == 0 then - doPerformSpriteTest1(sprite) - elseif curCase == 1 then - doPerformSpriteTest2(sprite) - elseif curCase == 2 then - doPerformSpriteTest3(sprite) - elseif curCase == 3 then - doPerformSpriteTest4(sprite) - elseif curCase == 4 then - doPerformSpriteTest5(sprite) - elseif curCase == 5 then - doPerformSpriteTest6(sprite) - elseif curCase == 6 then - doPerformSpriteTest7(sprite) - end - - quantityNodes = quantityNodes + 1 - end - - updateNodes() -end - -local function initWithMainTest(scene, asubtest, nNodes) - subtestNumber = asubtest - initWithSubTest(asubtest, scene) - - lastRenderedCount = 0 - quantityNodes = 0 - - cc.MenuItemFont:setFontSize(65) - local decrease = cc.MenuItemFont:create(" - ") - decrease:registerScriptTapHandler(onDecrease) - decrease:setColor(cc.c3b(0, 200, 20)) - local increase = cc.MenuItemFont:create(" + ") - increase:registerScriptTapHandler(onIncrease) - increase:setColor(cc.c3b(0, 200, 20)) - - local menu = cc.Menu:create() - menu:addChild(decrease) - menu:addChild(increase) - menu:alignItemsHorizontally() - menu:setPosition(s.width / 2, s.height - 65) - scene:addChild(menu, 1) - - infoLabel = cc.Label:createWithTTF("0 nodes", s_markerFeltFontPath, 30) - infoLabel:setColor(cc.c3b(0, 200, 20)) - infoLabel:setAnchorPoint(cc.p(0.5, 0.5)) - infoLabel:setPosition(s.width / 2, s.height - 90) - scene:addChild(infoLabel, 1) - - maxCases = TEST_COUNT - - -- Sub Tests - cc.MenuItemFont:setFontSize(32) - subMenu = cc.Menu:create() - for i = 1, 9 do - local str = i .. " " - local itemFont = cc.MenuItemFont:create(str) - itemFont:registerScriptTapHandler(testNCallback) - --itemFont:setTag(i) - subMenu:addChild(itemFont, kBasicZOrder + i, kBasicZOrder + i) - - if i <= 3 then - itemFont:setColor(cc.c3b(200, 20, 20)) - elseif i <= 6 then - itemFont:setColor(cc.c3b(0, 200, 20)) - else - itemFont:setColor(cc.c3b(0, 20, 200)) - end - end - - subMenu:alignItemsHorizontally() - subMenu:setPosition(cc.p(s.width / 2, 80)) - scene:addChild(subMenu, 1) - - -- add title label - titleLabel = cc.Label:createWithTTF("No title", s_arialPath, 40) - scene:addChild(titleLabel, 1) - titleLabel:setAnchorPoint(cc.p(0.5, 0.5)) - titleLabel:setPosition(s.width / 2, s.height - 32) - titleLabel:setColor(cc.c3b(255, 255, 40)) - - while quantityNodes < nNodes do - onIncrease() - end -end - ------------------------------------ --- SpritePerformTest1 ------------------------------------ -function doPerformSpriteTest1(sprite) - performancePosition(sprite) -end - -local function SpriteTestLayer1() - local layer = cc.Layer:create() - initWithLayer(layer, true) - - local str = "A (" .. subtestNumber .. ") position" - titleLabel:setString(str) - - return layer -end - ------------------------------------ --- SpritePerformTest2 ------------------------------------ -function doPerformSpriteTest2(sprite) - performanceScale(sprite) -end - -local function SpriteTestLayer2() - local layer = cc.Layer:create() - initWithLayer(layer, true) - - local str = "B (" .. subtestNumber .. ") scale" - titleLabel:setString(str) - - return layer -end - ------------------------------------ --- SpritePerformTest3 ------------------------------------ -function doPerformSpriteTest3(sprite) - performanceRotationScale(sprite) -end - -local function SpriteTestLayer3() - local layer = cc.Layer:create() - initWithLayer(layer, true) - - local str = "C (" .. subtestNumber .. ") scale + rot" - titleLabel:setString(str) - - return layer -end - ------------------------------------ --- SpritePerformTest4 ------------------------------------ -function doPerformSpriteTest4(sprite) - performanceOut100(sprite) -end - -local function SpriteTestLayer4() - local layer = cc.Layer:create() - initWithLayer(layer, true) - - local str = "D (" .. subtestNumber .. ") 100% out" - titleLabel:setString(str) - - return layer -end - ------------------------------------ --- SpritePerformTest5 ------------------------------------ -function doPerformSpriteTest5(sprite) - performanceout20(sprite) -end - -local function SpriteTestLayer5() - local layer = cc.Layer:create() - initWithLayer(layer, true) - - local str = "E (" .. subtestNumber .. ") 80% out" - titleLabel:setString(str) - - return layer -end - ------------------------------------ --- SpritePerformTest6 ------------------------------------ -function doPerformSpriteTest6(sprite) - performanceActions(sprite) -end - -local function SpriteTestLayer6() - local layer = cc.Layer:create() - initWithLayer(layer, true) - - local str = "F (" .. subtestNumber .. ") actions" - titleLabel:setString(str) - - return layer -end - ------------------------------------ --- SpritePerformTest7 ------------------------------------ -function doPerformSpriteTest7(sprite) - performanceActions20(sprite) -end - -local function SpriteTestLayer7() - local layer = cc.Layer:create() - initWithLayer(layer, true) - - local str = "G (" .. subtestNumber .. ") actions 80% out" - titleLabel:setString(str) - - return layer -end - ------------------------------------ --- PerformanceSpriteTest ------------------------------------ -function CreateSpriteTestScene() - local scene = cc.Scene:create() - initWithMainTest(scene, subtestNumber, kNodesIncrease) - - if curCase == 0 then - scene:addChild(SpriteTestLayer1()) - elseif curCase == 1 then - scene:addChild(SpriteTestLayer2()) - elseif curCase == 2 then - scene:addChild(SpriteTestLayer3()) - elseif curCase == 3 then - scene:addChild(SpriteTestLayer4()) - elseif curCase == 4 then - scene:addChild(SpriteTestLayer5()) - elseif curCase == 5 then - scene:addChild(SpriteTestLayer6()) - elseif curCase == 6 then - scene:addChild(SpriteTestLayer7()) - end - - return scene -end - -function PerformanceSpriteTest() - curCase = 0 - - return CreateSpriteTestScene() -end diff --git a/tests/lua-tests/src/PerformanceTest/PerformanceTest.lua b/tests/lua-tests/src/PerformanceTest/PerformanceTest.lua deleted file mode 100644 index 3963d03e34..0000000000 --- a/tests/lua-tests/src/PerformanceTest/PerformanceTest.lua +++ /dev/null @@ -1,1950 +0,0 @@ -require "PerformanceTest/PerformanceSpriteTest" - -local MAX_COUNT = 6 -local LINE_SPACE = 40 -local kItemTagBasic = 1000 - -local testsName = -{ - "PerformanceNodeChildrenTest", - "PerformanceParticleTest", - "PerformanceSpriteTest", - "PerformanceTextureTest", - "PerformanceTouchesTest", - "PerformanceFuncRelateWithTable", -} - -local s = cc.Director:getInstance():getWinSize() - ---Create toMainLayr MenuItem -function CreatePerfomBasicLayerMenu(pMenu) - if nil == pMenu then - return - end - local function toMainLayer() - local pScene = PerformanceTestMain() - if pScene ~= nil then - cc.Director:getInstance():replaceScene(pScene) - end - end - --Create BackMneu - cc.MenuItemFont:setFontName("Arial") - cc.MenuItemFont:setFontSize(24) - local pMenuItemFont = cc.MenuItemFont:create("Back") - pMenuItemFont:setPosition(cc.p(VisibleRect:rightBottom().x - 50, VisibleRect:rightBottom().y + 25)) - pMenuItemFont:registerScriptTapHandler(toMainLayer) - pMenu:addChild(pMenuItemFont) -end - ----------------------------------- ---PerformanceNodeChildrenTest ----------------------------------- -local NodeChildrenTestParam = -{ - kTagInfoLayer = 1, - kTagMainLayer = 2, - kTagLabelAtlas = 3, - kTagBase = 20000, - TEST_COUNT = 4, - kMaxNodes = 15000, - kNodesIncrease = 500, -} - -local function runNodeChildrenTest() - --NodeChildrenMainScene - local nLastRenderedCount = 0 - local nQuantityOfNodes = 0 - local nCurrentQuantityOfNodes = 0 - --IterateSpriteSheet - local pBatchNode = nil - - --BasiceLayer param - local bControlMenuVisible = false - local nMaxCases = 0 - local nCurCase = 0 - - local pNewscene = cc.Scene:create() - - local function GetTitle() - if 0 == nCurCase then - return "B - Iterate SpriteSheet" - elseif 1 == nCurCase then - return "C - Add to spritesheet" - elseif 2 == nCurCase then - return "D - Del from spritesheet" - elseif 3 == nCurCase then - return "E - Reorder from spritesheet" - end - end - - local function GetSubTitle() - if 0 == nCurCase then - return "Iterate children using C Array API. See console" - elseif 1 == nCurCase then - return "Adds %10 of total sprites with random z. See console" - elseif 2 == nCurCase then - return "Remove %10 of total sprites placed randomly. See console" - elseif 3 == nCurCase then - return "Reorder %10 of total sprites placed randomly. See console" - end - end - - local function GetProfilerName() - if 0 == nCurCase then - return "iter c-array" - elseif 1 == nCurCase then - return "add sprites" - elseif 2 == nCurCase then - return "remove sprites" - elseif 3 == nCurCase then - return "reorder sprites" - end - end - - local function CreateBasicLayerMenuItem(pMenu,bMenuVisible,nMaxCasesNum,nCurCaseIndex) - if nil ~= pMenu then - bControlMenuVisible = bMenuVisible - nMaxCases = nMaxCasesNum - nCurCase = nCurCaseIndex - if true == bControlMenuVisible then - local function backCallback() - nCurCase = nCurCase - 1 - if nCurCase < 0 then - nCurCase = nCurCase + nMaxCases - end - ShowCurrentTest() - end - - local function restartCallback() - ShowCurrentTest() - end - - local function nextCallback() - nCurCase = nCurCase + 1 - --No check nMaxCases - nCurCase = nCurCase % nMaxCases - ShowCurrentTest() - end - - local size = cc.Director:getInstance():getWinSize() - local item1 = cc.MenuItemImage:create(s_pPathB1, s_pPathB2) - item1:registerScriptTapHandler(backCallback) - pMenu:addChild(item1,kItemTagBasic) - local item2 = cc.MenuItemImage:create(s_pPathR1, s_pPathR2) - item2:registerScriptTapHandler(restartCallback) - pMenu:addChild(item2,kItemTagBasic) - local item3 = cc.MenuItemImage:create(s_pPathF1, s_pPathF2) - pMenu:addChild(item3,kItemTagBasic) - item3:registerScriptTapHandler(nextCallback) - - local size = cc.Director:getInstance():getWinSize() - item1:setPosition(cc.p(size.width / 2 - item2:getContentSize().width * 2, item2:getContentSize().height / 2)) - item2:setPosition(cc.p(size.width / 2, item2:getContentSize().height / 2)) - item3:setPosition(cc.p(size.width / 2 + item2:getContentSize().width * 2, item2:getContentSize().height / 2)) - end - end - end - - local function updateQuantityLabel() - if nQuantityOfNodes ~= nLastRenderedCount then - -- local pInfoLabel = pNewscene:getChildByTag(NodeChildrenTestParam.kTagInfoLayer) - local pInfoLabel = pNewscene:getChildByTag(NodeChildrenTestParam.kTagInfoLayer) - local strNode = nQuantityOfNodes.." nodes" - pInfoLabel:setString(strNode) - nLastRenderedCount = nQuantityOfNodes - end - end - - local function IterateSpriteSheetCArrayUpdate(t) - if nil == pBatchNode then - return - end - local pChildren = pBatchNode:getChildren() - local pObject = nil - if nil == pChildren then - return - end - local i = 0 - local len = table.getn(pChildren) - for i = 0, len - 1, 1 do - local child = pChildren[i + 1] - child:setVisible(false) - end - end - - local function AddSpriteSheetUpdate(t) - if nil == pBatchNode then - return - end - - --15 percent - local nTotalToAdd = nCurrentQuantityOfNodes * 0.15 - local zs = {} - if nTotalToAdd > 0 then - local pSprites = {} - local i = 0 - for i = 0 , nTotalToAdd - 1 do - local pSprite = cc.Sprite:createWithTexture(pBatchNode:getTexture(), cc.rect(0,0,32,32)) - pSprites[i + 1] = pSprite - zs[i] = math.random(-1,1) * 50 - end - - for i = 0 , nTotalToAdd - 1 do - local pChild = pSprites[i + 1] - pBatchNode:addChild(pChild, zs[i], NodeChildrenTestParam.kTagBase + i) - end - - pBatchNode:sortAllChildren() - - for i = 0 , nTotalToAdd - 1 do - pBatchNode:removeChildByTag( NodeChildrenTestParam.kTagBase + i, true) - end - end - end - - local function RemoveSpriteSheetUpdate(t) - if nil == pBatchNode then - return - end - local nTotalToAdd = nCurrentQuantityOfNodes * 0.15 - if nTotalToAdd > 0 then - local pSprites = {} - -- Don't include the sprite creation time as part of the profiling - local i = 0 - for i = 0, nTotalToAdd - 1 do - local pSprite = cc.Sprite:createWithTexture(pBatchNode:getTexture(), cc.rect(0,0,32,32)) - pSprites[i + 1] = pSprite - end - -- add them with random Z (very important!) - for i=0, nTotalToAdd - 1 do - local pChild = pSprites[i + 1] - pBatchNode:addChild(pChild, math.random(-1,1) * 50, NodeChildrenTestParam.kTagBase + i) - end - - for i = 0, nTotalToAdd - 1 do - pBatchNode:removeChildByTag( NodeChildrenTestParam.kTagBase + i, true) - end - end - end - - local function ReorderSpriteSheetUpdate(t) - if nil == pBatchNode then - return - end - -- 15 percent - local nTotalToAdd = nCurrentQuantityOfNodes * 0.15 - - if nTotalToAdd > 0 then - local pSprites = {} - -- Don't include the sprite creation time as part of the profiling - local i = 0 - for i = 0,nTotalToAdd - 1 do - local pSprite = cc.Sprite:createWithTexture(pBatchNode:getTexture(), cc.rect(0,0,32,32)) - pSprites[i + 1] = pSprite - end - - --dd them with random Z (very important!) - for i = 0, nTotalToAdd - 1 do - local pChild = pSprites[i + 1] - pBatchNode:addChild(pChild, math.random(-1,1) * 50, NodeChildrenTestParam.kTagBase + i) - end - - pBatchNode:sortAllChildren() - - -- reorder them - for i = 0, nTotalToAdd - 1 do - local pNode = pSprites[i + 1] - pBatchNode:reorderChild(pNode, math.random(-1,1) * 50) - end - pBatchNode:sortAllChildren() - --remove them - for i = 0, nTotalToAdd - 1 do - pBatchNode:removeChildByTag( NodeChildrenTestParam.kTagBase+i, true) - end - end - end - - local function NodeChildrenScheduleUpdate() - if 0 == nCurCase then - pNewscene:scheduleUpdateWithPriorityLua(IterateSpriteSheetCArrayUpdate,0) - elseif 1 == nCurCase then - pNewscene:scheduleUpdateWithPriorityLua(AddSpriteSheetUpdate,0) - elseif 2 == nCurCase then - pNewscene:scheduleUpdateWithPriorityLua(RemoveSpriteSheetUpdate,0) - elseif 3 == nCurCase then - pNewscene:scheduleUpdateWithPriorityLua(ReorderSpriteSheetUpdate,0) - end - end - - local function updateQuantityOfNodes() - local s = cc.Director:getInstance():getWinSize() - --increase nodes - if( nCurrentQuantityOfNodes < nQuantityOfNodes ) then - local i = 0 - for i = 0,nQuantityOfNodes - nCurrentQuantityOfNodes - 1 do - local sprite = cc.Sprite:createWithTexture(pBatchNode:getTexture(), cc.rect(0, 0, 32, 32)) - pBatchNode:addChild(sprite) - sprite:setPosition(cc.p( math.random() * s.width, math.random() * s.height)) - if 0 ~= nCurCase then - sprite:setVisible(false) - end - end - elseif (nCurrentQuantityOfNodes > nQuantityOfNodes ) then - i = 0 - for i = 0, nCurrentQuantityOfNodes - nQuantityOfNodes - 1 do - local index = nCurrentQuantityOfNodes - i - 1 - pBatchNode:removeChildAtIndex(index, true) - end - end - - - nCurrentQuantityOfNodes = nQuantityOfNodes - end - - local function onDecrease() - nQuantityOfNodes = nQuantityOfNodes - NodeChildrenTestParam.kNodesIncrease - if nQuantityOfNodes < 0 then - nQuantityOfNodes = 0 - end - - updateQuantityLabel() - updateQuantityOfNodes() - end - - local function onIncrease() - nQuantityOfNodes = nQuantityOfNodes + NodeChildrenTestParam.kNodesIncrease - if nQuantityOfNodes > NodeChildrenTestParam.kMaxNodes then - nQuantityOfNodes = NodeChildrenTestParam.kMaxNodes - end - - updateQuantityLabel() - updateQuantityOfNodes() - end - - - local function SpecialInitWithQuantityOfNodes() - -- if 0 == nCurCase then - pBatchNode = cc.SpriteBatchNode:create("Images/spritesheet1.png") - pNewscene:addChild(pBatchNode) - --[[ - else - pBatchNode = cc.SpriteBatchNode:create("Images/spritesheet1.png") - pNewscene:addChild(pBatchNode) - end - ]]-- - end - - local function MainSceneInitWithQuantityOfNodes(nNodes) - local s = cc.Director:getInstance():getWinSize() - - --Title - local pLabel = cc.Label:createWithTTF(GetTitle(), s_arialPath, 40) - pNewscene:addChild(pLabel, 1) - pLabel:setAnchorPoint(cc.p(0.5, 0.5)) - pLabel:setPosition(cc.p(s.width/2, s.height-32)) - pLabel:setColor(cc.c3b(255,255,40)) - - if (nil ~= GetSubTitle()) and ("" ~= GetSubTitle()) then - local pSubLabel = cc.Label:createWithTTF(GetSubTitle(), s_thonburiPath, 16) - pNewscene:addChild(pSubLabel, 1) - pSubLabel:setAnchorPoint(cc.p(0.5, 0.5)) - pSubLabel:setPosition(cc.p(s.width/2, s.height-80)) - end - - nLastRenderedCount = 0 - nCurrentQuantityOfNodes = 0 - nQuantityOfNodes = nNodes - - --"+","-" Menu - cc.MenuItemFont:setFontSize(65) - local pDecrease = cc.MenuItemFont:create(" - ") - pDecrease:registerScriptTapHandler(onDecrease) - pDecrease:setColor(cc.c3b(0,200,20)) - local pIncrease = cc.MenuItemFont:create(" + ") - pIncrease:registerScriptTapHandler(onIncrease) - pIncrease:setColor(cc.c3b(0,200,20)) - - local pMenuAddOrSub = cc.Menu:create() - pMenuAddOrSub:addChild(pDecrease) - pMenuAddOrSub:addChild(pIncrease) - pMenuAddOrSub:alignItemsHorizontally() - pMenuAddOrSub:setPosition(cc.p(s.width/2, s.height/2+15)) - pNewscene:addChild(pMenuAddOrSub,1) - - --InfoLayer - local pInfoLabel = cc.Label:createWithTTF("0 nodes", s_markerFeltFontPath, 30) - pInfoLabel:setColor(cc.c3b(0,200,20)) - pInfoLabel:setAnchorPoint(cc.p(0.5, 0.5)) - pInfoLabel:setPosition(cc.p(s.width/2, s.height/2-15)) - pNewscene:addChild(pInfoLabel, 1, NodeChildrenTestParam.kTagInfoLayer) - - --NodeChildrenMenuLayer - local pNodeChildrenMenuLayer = cc.Layer:create() - local pNodeChildrenMenuMenu = cc.Menu:create() - CreatePerfomBasicLayerMenu(pNodeChildrenMenuMenu) - CreateBasicLayerMenuItem(pNodeChildrenMenuMenu,true,NodeChildrenTestParam.TEST_COUNT,nCurCase) - pNodeChildrenMenuMenu:setPosition(cc.p(0, 0)) - pNodeChildrenMenuLayer:addChild(pNodeChildrenMenuMenu) - pNewscene:addChild(pNodeChildrenMenuLayer) - - updateQuantityLabel() - updateQuantityOfNodes() - - end - - function ShowCurrentTest() - if nil ~= pNewscene then - pNewscene:unscheduleUpdate() - end - - pNewscene = cc.Scene:create() - if nil ~= pNewscene then - SpecialInitWithQuantityOfNodes() - MainSceneInitWithQuantityOfNodes(nQuantityOfNodes) --- pNewscene:registerScriptHandler(onNodeEvent) - NodeChildrenScheduleUpdate() - cc.Director:getInstance():replaceScene(pNewscene) - end - end - - SpecialInitWithQuantityOfNodes() - MainSceneInitWithQuantityOfNodes(NodeChildrenTestParam.kNodesIncrease) --- pNewscene:registerScriptHandler(onNodeEvent) - NodeChildrenScheduleUpdate() - - return pNewscene -end ----------------------------------- ---PerformanceParticleTest ----------------------------------- -local ParticleTestParam = -{ - kTagInfoLayer = 1, - kTagMainLayer = 2, - kTagParticleSystem = 3, - kTagLabelAtlas = 4, - kTagMenuLayer = 1000, - - TEST_COUNT = 4, - kMaxParticles = 14000, - kNodesIncrease = 500, - - kSubMenuBasicZOrder = 10 -} - -local function runParticleTest() - --PerformanceParticle param - local nLastRenderedCount = 0 - local nQuantityParticles = 0 - local nSubtestNumber = 0 - --BasiceLayer param - local bControlMenuVisible = false - local nMaxCases = 0 - local nCurCase = 0 - - local ScheduleSelector = nil - - local pNewScene = cc.Scene:create() - - local function GetTitle() - local strTitle = nil - if 0 == nCurCase then - strTitle = string.format("A (%d) size=4",nSubtestNumber) - elseif 1 == nCurCase then - strTitle = string.format("B (%d) size=8",nSubtestNumber) - elseif 2 == nCurCase then - strTitle = string.format("C (%d) size=32",nSubtestNumber) - elseif 3 == nCurCase then - strTitle = string.format("D (%d) size=64",nSubtestNumber) - end - return strTitle - end - - local function CreateBasicLayerMenuItem(pMenu,bMenuVisible,nMaxCasesNum,nCurCaseIndex) - if nil ~= pMenu then - bControlMenuVisible = bMenuVisible - nMaxCases = nMaxCasesNum - nCurCase = nCurCaseIndex - if true == bControlMenuVisible then - local function backCallback() - nCurCase = nCurCase - 1 - if nCurCase < 0 then - nCurCase = nCurCase + nMaxCases - end - ShowCurrentTest() - end - - local function restartCallback() - ShowCurrentTest() - end - - local function nextCallback() - nCurCase = nCurCase + 1 - --No check nMaxCases - nCurCase = nCurCase % nMaxCases - ShowCurrentTest() - end - - local size = cc.Director:getInstance():getWinSize() - local item1 = cc.MenuItemImage:create(s_pPathB1, s_pPathB2) - item1:registerScriptTapHandler(backCallback) - pMenu:addChild(item1,kItemTagBasic) - local item2 = cc.MenuItemImage:create(s_pPathR1, s_pPathR2) - item2:registerScriptTapHandler(restartCallback) - pMenu:addChild(item2,kItemTagBasic) - local item3 = cc.MenuItemImage:create(s_pPathF1, s_pPathF2) - pMenu:addChild(item3,kItemTagBasic) - item3:registerScriptTapHandler(nextCallback) - - local size = cc.Director:getInstance():getWinSize() - item1:setPosition(cc.p(size.width / 2 - item2:getContentSize().width * 2, item2:getContentSize().height / 2)) - item2:setPosition(cc.p(size.width / 2, item2:getContentSize().height / 2)) - item3:setPosition(cc.p(size.width / 2 + item2:getContentSize().width * 2, item2:getContentSize().height / 2)) - end - end - end - - local function TestNCallback(tag,pMenuItem) - local nIndex = pMenuItem:getLocalZOrder() - ParticleTestParam.kSubMenuBasicZOrder - nSubtestNumber = nIndex - ShowCurrentTest() - end - - local function UpdateQuantityLabel() - if nQuantityParticles ~= nLastRenderedCount then - local pInfoLabel = pNewScene:getChildByTag(ParticleTestParam.kTagInfoLayer) - local strInfo = string.format("%u particles", nQuantityParticles) - pInfoLabel:setString(strInfo) - - nLastRenderedCount = nQuantityParticles - end - end - - local function doTest() - local s = cc.Director:getInstance():getWinSize() - local pParticleSystem = pNewScene:getChildByTag(ParticleTestParam.kTagParticleSystem) - if nil == pParticleSystem then - return - end - if 0 == nCurCase then - --duration - pParticleSystem:setDuration(-1) - - --gravity - pParticleSystem:setGravity(cc.p(0,-90)) - - --angle - pParticleSystem:setAngle(90) - pParticleSystem:setAngleVar(0) - - --radial - pParticleSystem:setRadialAccel(0) - pParticleSystem:setRadialAccelVar(0) - - -- speed of particles - pParticleSystem:setSpeed(180) - pParticleSystem:setSpeedVar(50) - - -- emitter position - pParticleSystem:setPosition(cc.p(s.width/2, 100)) - pParticleSystem:setPosVar(cc.p(s.width/2,0)) - - -- life of particles - pParticleSystem:setLife(2.0) - pParticleSystem:setLifeVar(1) - - --emits per frame - pParticleSystem:setEmissionRate(pParticleSystem:getTotalParticles() / pParticleSystem:getLife()) - - --color of particles - pParticleSystem:setStartColor(cc.c4f(0.5, 0.5, 0.5, 1.0)) - - pParticleSystem:setStartColorVar( cc.c4f(0.5, 0.5, 0.5, 1.0)) - - pParticleSystem:setEndColor(cc.c4f(0.1, 0.1, 0.1, 0.2)) - - pParticleSystem:setEndColorVar(cc.c4f(0.1, 0.1, 0.1, 0.2)) - - -- size, in pixels - pParticleSystem:setEndSize(4.0) - pParticleSystem:setStartSize(4.0) - pParticleSystem:setEndSizeVar(0) - pParticleSystem:setStartSizeVar(0) - - -- additive - pParticleSystem:setBlendAdditive(false) - - elseif 1 == nCurCase then - --duration - pParticleSystem:setDuration(-1) - - --gravity - pParticleSystem:setGravity(cc.p(0,-90)) - - --angle - pParticleSystem:setAngle(90) - pParticleSystem:setAngleVar(0) - - --radial - pParticleSystem:setRadialAccel(0) - pParticleSystem:setRadialAccelVar(0) - - -- speed of particles - pParticleSystem:setSpeed(180) - pParticleSystem:setSpeedVar(50) - - -- emitter position - pParticleSystem:setPosition(cc.p(s.width/2, 100)) - pParticleSystem:setPosVar(cc.p(s.width/2,0)) - - -- life of particles - pParticleSystem:setLife(2.0) - pParticleSystem:setLifeVar(1) - - --emits per frame - pParticleSystem:setEmissionRate(pParticleSystem:getTotalParticles() / pParticleSystem:getLife()) - - --color of particles - pParticleSystem:setStartColor(cc.c4f(0.5, 0.5, 0.5, 1.0)) - - pParticleSystem:setStartColorVar( cc.c4f(0.5, 0.5, 0.5, 1.0)) - - pParticleSystem:setEndColor(cc.c4f(0.1, 0.1, 0.1, 0.2)) - - pParticleSystem:setEndColorVar(cc.c4f(0.1, 0.1, 0.1, 0.2)) - - -- size, in pixels - pParticleSystem:setEndSize(8.0) - pParticleSystem:setStartSize(8.0) - pParticleSystem:setEndSizeVar(0) - pParticleSystem:setStartSizeVar(0) - - -- additive - pParticleSystem:setBlendAdditive(false) - elseif 2 == nCurCase then - --duration - pParticleSystem:setDuration(-1) - - --gravity - pParticleSystem:setGravity(cc.p(0,-90)) - - --angle - pParticleSystem:setAngle(90) - pParticleSystem:setAngleVar(0) - - --radial - pParticleSystem:setRadialAccel(0) - pParticleSystem:setRadialAccelVar(0) - - -- speed of particles - pParticleSystem:setSpeed(180) - pParticleSystem:setSpeedVar(50) - - -- emitter position - pParticleSystem:setPosition(cc.p(s.width/2, 100)) - pParticleSystem:setPosVar(cc.p(s.width/2,0)) - - -- life of particles - pParticleSystem:setLife(2.0) - pParticleSystem:setLifeVar(1) - - --emits per frame - pParticleSystem:setEmissionRate(pParticleSystem:getTotalParticles() / pParticleSystem:getLife()) - - --color of particles - pParticleSystem:setStartColor(cc.c4f(0.5, 0.5, 0.5, 1.0)) - - pParticleSystem:setStartColorVar( cc.c4f(0.5, 0.5, 0.5, 1.0)) - - pParticleSystem:setEndColor(cc.c4f(0.1, 0.1, 0.1, 0.2)) - - pParticleSystem:setEndColorVar(cc.c4f(0.1, 0.1, 0.1, 0.2)) - - -- size, in pixels - pParticleSystem:setEndSize(32.0) - pParticleSystem:setStartSize(32.0) - pParticleSystem:setEndSizeVar(0) - pParticleSystem:setStartSizeVar(0) - - -- additive - pParticleSystem:setBlendAdditive(false) - elseif 3 == nCurCase then - --duration - pParticleSystem:setDuration(-1) - - --gravity - pParticleSystem:setGravity(cc.p(0,-90)) - - --angle - pParticleSystem:setAngle(90) - pParticleSystem:setAngleVar(0) - - --radial - pParticleSystem:setRadialAccel(0) - pParticleSystem:setRadialAccelVar(0) - - -- speed of particles - pParticleSystem:setSpeed(180) - pParticleSystem:setSpeedVar(50) - - -- emitter position - pParticleSystem:setPosition(cc.p(s.width/2, 100)) - pParticleSystem:setPosVar(cc.p(s.width/2,0)) - - -- life of particles - pParticleSystem:setLife(2.0) - pParticleSystem:setLifeVar(1) - - --emits per frame - pParticleSystem:setEmissionRate(pParticleSystem:getTotalParticles() / pParticleSystem:getLife()) - - --color of particles - pParticleSystem:setStartColor(cc.c4f(0.5, 0.5, 0.5, 1.0)) - - pParticleSystem:setStartColorVar( cc.c4f(0.5, 0.5, 0.5, 1.0)) - - pParticleSystem:setEndColor(cc.c4f(0.1, 0.1, 0.1, 0.2)) - - pParticleSystem:setEndColorVar(cc.c4f(0.1, 0.1, 0.1, 0.2)) - - -- size, in pixels - pParticleSystem:setEndSize(64.0) - pParticleSystem:setStartSize(64.0) - pParticleSystem:setEndSizeVar(0) - pParticleSystem:setStartSizeVar(0) - - -- additive - pParticleSystem:setBlendAdditive(false) - end - end - - local function CreateParticleSystem() - local pParticleSystem = nil - --[[ - * Tests: - * 1: Point Particle System using 32-bit textures (PNG) - * 2: Point Particle System using 16-bit textures (PNG) - * 3: Point Particle System using 8-bit textures (PNG) - * 4: Point Particle System using 4-bit textures (PVRTC) - - * 5: Quad Particle System using 32-bit textures (PNG) - * 6: Quad Particle System using 16-bit textures (PNG) - * 7: Quad Particle System using 8-bit textures (PNG) - * 8: Quad Particle System using 4-bit textures (PVRTC) - ]]-- - pNewScene:removeChildByTag(ParticleTestParam.kTagParticleSystem, true) - - --remove the "fire.png" from the TextureCache cache. - local pTexture = cc.Director:getInstance():getTextureCache():addImage("Images/fire.png") - cc.Director:getInstance():getTextureCache():removeTexture(pTexture) - local pParticleSystem = cc.ParticleSystemQuad:createWithTotalParticles(nQuantityParticles) - if 1 == nSubtestNumber then - cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A8888) - elseif 2 == nSubtestNumber then - cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A4444) - elseif 3 == nSubtestNumber then - cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE2_D_PIXEL_FORMAT_A8) - elseif 4 == nSubtestNumber then - cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A8888) - elseif 5 == nSubtestNumber then - cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A4444) - elseif 6 == nSubtestNumber then - cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE2_D_PIXEL_FORMAT_A8) - else - pParticleSystem = nil - print("Shall not happen!") - end - - if nil ~= pParticleSystem then - pParticleSystem:setTexture(cc.Director:getInstance():getTextureCache():addImage("Images/fire.png")) - end - - pNewScene:addChild(pParticleSystem, 0, ParticleTestParam.kTagParticleSystem) - - doTest() - --restore the default pixel format - cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A8888) - end - - local function step(t) - local pAtlas = pNewScene:getChildByTag(ParticleTestParam.kTagLabelAtlas) - local pEmitter = pNewScene:getChildByTag(ParticleTestParam.kTagParticleSystem) - local strInfo = string.format("%4d",pEmitter:getParticleCount()) - pAtlas:setString(strInfo) - end - - local function ScheduleFuncion() - local function OnEnterOrExit(tag) - local scheduler = cc.Director:getInstance():getScheduler() - if tag == "enter" then - ScheduleSelector = scheduler:scheduleScriptFunc(step,0,false) - elseif tag == "exit" then - scheduler:unscheduleScriptEntry(ScheduleSelector) - end - end - pNewScene:registerScriptHandler(OnEnterOrExit) - end - - local function onDecrease() - nQuantityParticles = nQuantityParticles - ParticleTestParam.kNodesIncrease - if nQuantityParticles < 0 then - nQuantityParticles = 0 - end - - UpdateQuantityLabel() - CreateParticleSystem() - end - - local function onIncrease() - nQuantityParticles = nQuantityParticles + ParticleTestParam.kNodesIncrease - if nQuantityParticles > ParticleTestParam.kMaxParticles then - nQuantityParticles = ParticleTestParam.kMaxParticles - end - - UpdateQuantityLabel() - CreateParticleSystem() - end - - local function InitWithSubTest(nSubtest,nParticles) - nSubtestNumber = nSubtest - local s = cc.Director:getInstance():getWinSize() - - nLastRenderedCount = 0 - nQuantityParticles = nParticles - - --"+","-" Menu - cc.MenuItemFont:setFontSize(65) - local pDecrease = cc.MenuItemFont:create(" - ") - pDecrease:registerScriptTapHandler(onDecrease) - pDecrease:setColor(cc.c3b(0,200,20)) - local pIncrease = cc.MenuItemFont:create(" + ") - pIncrease:registerScriptTapHandler(onIncrease) - pIncrease:setColor(cc.c3b(0,200,20)) - - local pMenuAddOrSub = cc.Menu:create() - pMenuAddOrSub:addChild(pDecrease) - pMenuAddOrSub:addChild(pIncrease) - pMenuAddOrSub:alignItemsHorizontally() - pMenuAddOrSub:setPosition(cc.p(s.width/2, s.height/2+15)) - pNewScene:addChild(pMenuAddOrSub,1) - - local pInfoLabel = cc.Label:createWithTTF("0 nodes", s_markerFeltFontPath, 30) - pInfoLabel:setColor(cc.c3b(0,200,20)) - pInfoLabel:setAnchorPoint(cc.p(0.5, 0.5)) - pInfoLabel:setPosition(cc.p(s.width/2, s.height - 90)) - pNewScene:addChild(pInfoLabel, 1, ParticleTestParam.kTagInfoLayer) - - --particles on stage - local pLabelAtlas = cc.LabelAtlas:_create("0000", "fps_images.png", 12, 32, string.byte('.')) - pNewScene:addChild(pLabelAtlas, 0, ParticleTestParam.kTagLabelAtlas) - pLabelAtlas:setPosition(cc.p(s.width-66,50)) - - --ParticleTestMenuLayer - local pParticleMenuLayer = cc.Layer:create() - local pParticleMenu = cc.Menu:create() - CreatePerfomBasicLayerMenu(pParticleMenu) - CreateBasicLayerMenuItem(pParticleMenu,true,ParticleTestParam.TEST_COUNT,nCurCase) - pParticleMenu:setPosition(cc.p(0, 0)) - pParticleMenuLayer:addChild(pParticleMenu) - pNewScene:addChild(pParticleMenuLayer) - - --Sub Tests - cc.MenuItemFont:setFontSize(40) - local pSubMenu = cc.Menu:create() - local i = 1 - for i = 1, 6 do - local strNum = string.format("%d ",i) - local pItemFont = cc.MenuItemFont:create(strNum) - pItemFont:registerScriptTapHandler(TestNCallback) - pSubMenu:addChild(pItemFont, i + ParticleTestParam.kSubMenuBasicZOrder) - if i <= 3 then - pItemFont:setColor(cc.c3b(200,20,20)) - else - pItemFont:setColor(cc.c3b(0,200,20)) - end - end - pSubMenu:alignItemsHorizontally() - pSubMenu:setPosition(cc.p(s.width/2, 80)) - pNewScene:addChild(pSubMenu, 2) - - local pLabel = cc.Label:createWithTTF(GetTitle(), s_arialPath, 40) - pNewScene:addChild(pLabel, 1) - pLabel:setAnchorPoint(cc.p(0.5, 0.5)) - pLabel:setPosition(cc.p(s.width/2, s.height-32)) - pLabel:setColor(cc.c3b(255,255,40)) - - UpdateQuantityLabel() - CreateParticleSystem() - ScheduleFuncion() - end - - function ShowCurrentTest() - if nil ~= pNewScene then - cc.Director:getInstance():getScheduler():unscheduleScriptEntry(ScheduleSelector) - end - pNewScene = cc.Scene:create() - InitWithSubTest(nSubtestNumber,nQuantityParticles) - cc.Director:getInstance():replaceScene(pNewScene) - end - - - InitWithSubTest(1,ParticleTestParam.kNodesIncrease) - return pNewScene -end - ----------------------------------- ---PerformanceSpriteTest ----------------------------------- -local SpriteTestParam = -{ - kMaxNodes = 50000, - kNodesIncrease = 250, - TEST_COUNT = 7, - - kTagInfoLayer = 1, - kTagMainLayer = 2, - -- 50000 -- kMaxNodes - kTagMenuLayer = 50000 + 1000, - kInitNodes = 50, - kSubMenuBasicZOrder = 20, - - kRandMax = 32767 -} - -local function runSpriteTest() - --PerformanceParticle param - local nLastRenderedCount = 0 - local nQuantityNodes = 0 - local nSubtestNumber = 0 - --BasiceLayer param - local bControlMenuVisible = false - local nMaxCases = 0 - local nCurCase = 0 - - local ScheduleSelector = nil - - --SubTest - local pBatchNode = nil - - local function GetTitle() - local strTitle = nil - if 0 == nCurCase then - strTitle = string.format("A (%d) position",nSubtestNumber) - elseif 1 == nCurCase then - strTitle = string.format("B (%d) scale",nSubtestNumber) - elseif 2 == nCurCase then - strTitle = string.format("C (%d) scale + rot",nSubtestNumber) - elseif 3 == nCurCase then - strTitle = string.format("D (%d) 100%% out",nSubtestNumber) - elseif 4 == nCurCase then - strTitle = string.format("E (%d) 80%% out",nSubtestNumber) - elseif 5 == nCurCase then - strTitle = string.format("F (%d) actions",nSubtestNumber) - elseif 6 == nCurCase then - strTitle = string.format("G (%d) actions 80%% out",nSubtestNumber) - end - - return strTitle - end - - local pNewScene = cc.Scene:create() - - local function CreateBasicLayerMenuItem(pMenu,bMenuVisible,nMaxCasesNum,nCurCaseIndex) - if nil ~= pMenu then - bControlMenuVisible = bMenuVisible - nMaxCases = nMaxCasesNum - nCurCase = nCurCaseIndex - if true == bControlMenuVisible then - local function backCallback() - nCurCase = nCurCase - 1 - if nCurCase < 0 then - nCurCase = nCurCase + nMaxCases - end - ShowCurrentTest() - end - - local function restartCallback() - ShowCurrentTest() - end - - local function nextCallback() - nCurCase = nCurCase + 1 - --No check nMaxCases - nCurCase = nCurCase % nMaxCases - ShowCurrentTest() - end - - local size = cc.Director:getInstance():getWinSize() - local item1 = cc.MenuItemImage:create(s_pPathB1, s_pPathB2) - item1:registerScriptTapHandler(backCallback) - pMenu:addChild(item1,kItemTagBasic) - local item2 = cc.MenuItemImage:create(s_pPathR1, s_pPathR2) - item2:registerScriptTapHandler(restartCallback) - pMenu:addChild(item2,kItemTagBasic) - local item3 = cc.MenuItemImage:create(s_pPathF1, s_pPathF2) - pMenu:addChild(item3,kItemTagBasic) - item3:registerScriptTapHandler(nextCallback) - - local size = cc.Director:getInstance():getWinSize() - item1:setPosition(cc.p(size.width / 2 - item2:getContentSize().width * 2, item2:getContentSize().height / 2)) - item2:setPosition(cc.p(size.width / 2, item2:getContentSize().height / 2)) - item3:setPosition(cc.p(size.width / 2 + item2:getContentSize().width * 2, item2:getContentSize().height / 2)) - end - end - end - - local function UpdateNodes() - if nQuantityNodes ~= nLastRenderedCount then - local pInfoLabel = pNewScene:getChildByTag(SpriteTestParam.kTagInfoLayer) - local strInfo = string.format("%u nodes", nQuantityNodes) - pInfoLabel:setString(strInfo) - nLastRenderedCount = nQuantityNodes - end - end - - local function PerformancePosition(pSprite) - local size = cc.Director:getInstance():getWinSize() - pSprite:setPosition(cc.p((math.random(0,SpriteTestParam.kRandMax) % (size.width) ), (math.random(0,SpriteTestParam.kRandMax) % (size.height)))) - end - - local function PerformanceScale(pSprite) - local size = cc.Director:getInstance():getWinSize() - pSprite:setPosition(cc.p((math.random(0,SpriteTestParam.kRandMax) % (size.width) ), (math.random(0,SpriteTestParam.kRandMax) % (size.height)))) - pSprite:setScale(math.random() * 100 / 50) - end - - local function PerformanceRotationScale(pSprite) - local size = cc.Director:getInstance():getWinSize() - pSprite:setPosition(cc.p((math.random(0,SpriteTestParam.kRandMax) % (size.width) ), (math.random(0,SpriteTestParam.kRandMax) % (size.height)))) - pSprite:setRotation(math.random() * 360) - pSprite:setScale(math.random() * 2) - end - - local function PerformanceOut100(pSprite) - pSprite:setPosition(cc.p( -1000, -1000)) - end - - local function Performanceout20(pSprite) - local size = cc.Director:getInstance():getWinSize() - print("come in") - if math.random() < 0.2 then - pSprite:setPosition(cc.p((math.random(0,SpriteTestParam.kRandMax) % (size.width) ), (math.random(0,SpriteTestParam.kRandMax) % (size.height)))) - else - pSprite:setPosition(cc.p( -1000, -1000)) - end - end - - local function PerformanceActions(pSprite) - local size = cc.Director:getInstance():getWinSize() - pSprite:setPosition(cc.p((math.random(0,SpriteTestParam.kRandMax) % (size.width) ), (math.random(0,SpriteTestParam.kRandMax) % (size.height)))) - - local fPeriod = 0.5 + (math.random(0,SpriteTestParam.kRandMax) % 1000) / 500.0 - local pRot = cc.RotateBy:create(fPeriod, 360.0 * math.random() ) - local pRot_back = pRot:reverse() - local pPermanentRotation = cc.RepeatForever:create(cc.Sequence:create(pRot, pRot_back)) - pSprite:runAction(pPermanentRotation) - - local fGrowDuration = 0.5 + (math.random(0,SpriteTestParam.kRandMax) % 1000) / 500.0 - local pGrow = cc.ScaleBy:create(fGrowDuration, 0.5, 0.5) - local pPermanentScaleLoop = cc.RepeatForever:create(cc.Sequence:create(pGrow, pGrow:reverse())) - pSprite:runAction(pPermanentScaleLoop) - end - - local function PerformanceActions20(pSprite) - local size = cc.Director:getInstance():getWinSize() - - if math.random() < 0.2 then - pSprite:setPosition(cc.p((math.random(0,SpriteTestParam.kRandMax) % (size.width) ), (math.random(0,SpriteTestParam.kRandMax) % (size.height)))) - else - pSprite:setPosition(cc.p( -1000, -1000)) - end - - local pPeriod = 0.5 + (math.random(0,SpriteTestParam.kRandMax) % 1000) / 500.0 - local pRot = cc.RotateBy:create(pPeriod, 360.0 * math.random()) - local pRot_back = pRot:reverse() - local pPermanentRotation = cc.RepeatForever:create(cc.Sequence:create(pRot, pRot_back)) - pSprite:runAction(pPermanentRotation) - - - local fGrowDuration = 0.5 + (math.random(0,SpriteTestParam.kRandMax) % 1000) / 500.0 - local pGrow = cc.ScaleBy:create(fGrowDuration, 0.5, 0.5) - local pPermanentScaleLoop = cc.RepeatForever:create(cc.Sequence:create(pGrow, pGrow:reverse())) - pSprite:runAction(pPermanentScaleLoop) - - end - - local function CreateSpriteWithTag(nTag) - --create - cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A8888) - local pSprite = nil - if 1 == nSubtestNumber then - pSprite = cc.Sprite:create("Images/grossinis_sister1.png") - pNewScene:addChild(pSprite, 0, nTag+100) - elseif 2 == nSubtestNumber or 3 == nSubtestNumber then - pSprite = cc.Sprite:createWithTexture(pBatchNode:getTexture(), cc.rect(0, 0, 52, 139)) - pBatchNode:addChild(pSprite, 0, nTag+100) - elseif 4 == nSubtestNumber then - local nIndex = math.floor((math.random() * 1400 / 100)) + 1 - local strPath = string.format("Images/grossini_dance_%02d.png", nIndex) - pSprite = cc.Sprite:create(strPath) - pNewScene:addChild(pSprite, 0, nTag+100) - elseif 5 == nSubtestNumber or 6 == nSubtestNumber then - local nY = 0 - local nX = 0 - local nR = math.floor(math.random() * 1400 / 100) - - nX = nR % 5 - nY = math.floor(nR / 5) - - nX = nX * 85 - nY = nY * 121 - pSprite = cc.Sprite:createWithTexture(pBatchNode:getTexture(), cc.rect(nX,nY,85,121)) - pBatchNode:addChild(pSprite, 0, nTag+100) - elseif 7 == nSubtestNumber then - local nX = 0 - local nY = 0 - local nR = math.floor(math.random() * 6400 / 100) - - nX = nR % 8 - nY = math.floor(nR / 8) - - local strPath = string.format("Images/sprites_test/sprite-%d-%d.png", nX, nY) - pSprite = cc.Sprite:create(strPath) - pNewScene:addChild(pSprite, 0, nTag+100) - elseif 8 == nSubtestNumber or 9 == nSubtestNumber then - local nX = 0 - local nY = 0 - local nR = math.floor(math.random() * 6400 / 100) - - nX = nR % 8 - nY = math.floor(nR / 8) - - nX = nX * 32 - nY = nY * 32 - pSprite = cc.Sprite:createWithTexture(pBatchNode:getTexture(), cc.rect(nX,nY,32,32)) - pBatchNode:addChild(pSprite, 0, nTag+100) - end - cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE2_D_PIXEL_FORMAT_DEFAULT) - - return pSprite - end - - local function RemoveByTag(nTag) - if 1 == nSubtestNumber or 4 == nSubtestNumber or 7 == nSubtestNumber then - pNewScene:removeChildByTag(nTag + 100, true) - elseif 2 == nSubtestNumber or 3 == nSubtestNumber or 5 == nSubtestNumber or 6 == nSubtestNumber or 8 == nSubtestNumber or 9 == nSubtestNumber then - pBatchNode:removeChildAtIndex(nTag,true) - end - - end - - local function DoTest(pSprite) - if 0 == nCurCase then - PerformancePosition(pSprite) - elseif 1 == nCurCase then - PerformanceScale(pSprite) - elseif 2 == nCurCase then - PerformanceRotationScale(pSprite) - elseif 3 == nCurCase then - PerformanceOut100(pSprite) - elseif 4 == nCurCase then - Performanceout20(pSprite) - elseif 5 == nCurCase then - PerformanceActions(pSprite) - elseif 6 == nCurCase then - PerformanceActions20(pSprite) - end - end - - local function onDecrease() - if nQuantityNodes <= 0 then - return - end - - local i = 0 - for i = 0 , SpriteTestParam.kNodesIncrease - 1 do - nQuantityNodes = nQuantityNodes - 1 - RemoveByTag(nQuantityNodes) - end - UpdateNodes() - end - - local function onIncrease() - if nQuantityNodes >= SpriteTestParam.kMaxNodes then - return - end - - local i = 0 - for i = 0,SpriteTestParam.kNodesIncrease - 1 do - local pSprite = CreateSpriteWithTag(nQuantityNodes) - DoTest(pSprite) - nQuantityNodes = nQuantityNodes + 1 - end - UpdateNodes() - end - - local function TestNCallback(tag,pMenuItem) - local nIndex = pMenuItem:getLocalZOrder() - SpriteTestParam.kSubMenuBasicZOrder - nSubtestNumber = nIndex - ShowCurrentTest() - end - - local function InitWithSubTest(nSubTest) - pBatchNode = nil - --[[ - * Tests: - * 1: 1 (32-bit) PNG sprite of 52 x 139 - * 2: 1 (32-bit) PNG Batch Node using 1 sprite of 52 x 139 - * 3: 1 (16-bit) PNG Batch Node using 1 sprite of 52 x 139 - * 4: 1 (4-bit) PVRTC Batch Node using 1 sprite of 52 x 139 - - * 5: 14 (32-bit) PNG sprites of 85 x 121 each - * 6: 14 (32-bit) PNG Batch Node of 85 x 121 each - * 7: 14 (16-bit) PNG Batch Node of 85 x 121 each - * 8: 14 (4-bit) PVRTC Batch Node of 85 x 121 each - - * 9: 64 (32-bit) sprites of 32 x 32 each - *10: 64 (32-bit) PNG Batch Node of 32 x 32 each - *11: 64 (16-bit) PNG Batch Node of 32 x 32 each - *12: 64 (4-bit) PVRTC Batch Node of 32 x 32 each - ]]-- - --purge textures - local pMgr = cc.Director:getInstance():getTextureCache() - --[mgr removeAllTextures] - pMgr:removeTexture(pMgr:addImage("Images/grossinis_sister1.png")) - pMgr:removeTexture(pMgr:addImage("Images/grossini_dance_atlas.png")) - pMgr:removeTexture(pMgr:addImage("Images/spritesheet1.png")) - - if 1 == nSubTest or 4 == nSubTest or 7 == nSubTest then - elseif 2 == nSubTest then - cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A8888) - pBatchNode = cc.SpriteBatchNode:create("Images/grossinis_sister1.png", 100) - pNewScene:addChild(pBatchNode, 0) - elseif 3 == nSubTest then - cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A4444) - pBatchNode = cc.SpriteBatchNode:create("Images/grossinis_sister1.png", 100) - pNewScene:addChild(pBatchNode, 0) - elseif 5 == nSubTest then - cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A8888) - pBatchNode = cc.SpriteBatchNode:create("Images/grossini_dance_atlas.png", 100) - pNewScene:addChild(pBatchNode, 0) - elseif 6 == nSubTest then - cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A4444) - pBatchNode = cc.SpriteBatchNode:create("Images/grossini_dance_atlas.png", 100) - pNewScene:addChild(pBatchNode, 0) - elseif 8 == nSubTest then - cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A8888) - pBatchNode = cc.SpriteBatchNode:create("Images/spritesheet1.png", 100) - pNewScene:addChild(pBatchNode, 0) - elseif 9 == nSubTest then - cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A4444) - pBatchNode = cc.SpriteBatchNode:create("Images/spritesheet1.png", 100) - pNewScene:addChild(pBatchNode, 0) - end - - if nil ~= pBatchNode then - pBatchNode:retain() - end - - cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE2_D_PIXEL_FORMAT_DEFAULT) - end - - local function InitWithSpriteTest(nSubtest,nNodes) - nSubtestNumber = nSubtest - --about create subset - InitWithSubTest(nSubtest) - local s = cc.Director:getInstance():getWinSize() - - nLastRenderedCount = 0 - nQuantityNodes = 0 - - --"+","-" Menu - cc.MenuItemFont:setFontSize(65) - local pDecrease = cc.MenuItemFont:create(" - ") - pDecrease:registerScriptTapHandler(onDecrease) - pDecrease:setColor(cc.c3b(0,200,20)) - local pIncrease = cc.MenuItemFont:create(" + ") - pIncrease:registerScriptTapHandler(onIncrease) - pIncrease:setColor(cc.c3b(0,200,20)) - - local pMenuAddOrSub = cc.Menu:create() - pMenuAddOrSub:addChild(pDecrease) - pMenuAddOrSub:addChild(pIncrease) - pMenuAddOrSub:alignItemsHorizontally() - pMenuAddOrSub:setPosition(cc.p(s.width/2, s.height/2+15)) - pNewScene:addChild(pMenuAddOrSub,1) - - local pInfoLabel = cc.Label:createWithTTF("0 nodes", s_markerFeltFontPath, 30) - pInfoLabel:setColor(cc.c3b(0,200,20)) - pInfoLabel:setAnchorPoint(cc.p(0.5, 0.5)) - pInfoLabel:setPosition(cc.p(s.width/2, s.height - 90)) - pNewScene:addChild(pInfoLabel, 1, SpriteTestParam.kTagInfoLayer) - - --SpriteTestMenuLayer - local pSpriteMenuLayer = cc.Layer:create() - local pSpriteMenu = cc.Menu:create() - CreatePerfomBasicLayerMenu(pSpriteMenu) - CreateBasicLayerMenuItem(pSpriteMenu,true,SpriteTestParam.TEST_COUNT,nCurCase) - pSpriteMenu:setPosition(cc.p(0, 0)) - pSpriteMenuLayer:addChild(pSpriteMenu) - pNewScene:addChild(pSpriteMenuLayer,1,SpriteTestParam.kTagMenuLayer) - - - --Sub Tests - cc.MenuItemFont:setFontSize(40) - local pSubMenu = cc.Menu:create() - local i = 1 - for i = 1, 9 do - local strNum = string.format("%d ",i) - local pItemFont = cc.MenuItemFont:create(strNum) - pItemFont:registerScriptTapHandler(TestNCallback) - pSubMenu:addChild(pItemFont, i + SpriteTestParam.kSubMenuBasicZOrder) - if i <= 3 then - pItemFont:setColor(cc.c3b(200,20,20)) - elseif i <= 6 then - pItemFont:setColor(cc.c3b(0,200,20)) - else - pItemFont:setColor(cc.c3b(0,20,200)) - end - end - - - pSubMenu:alignItemsHorizontally() - pSubMenu:setPosition(cc.p(s.width/2, 80)) - pNewScene:addChild(pSubMenu, 2) - - local pLabel = cc.Label:createWithTTF(GetTitle(), s_arialPath, 40) - pNewScene:addChild(pLabel, 1) - pLabel:setAnchorPoint(cc.p(0.5, 0.5)) - pLabel:setPosition(cc.p(s.width/2, s.height-32)) - pLabel:setColor(cc.c3b(255,255,40)) - while nQuantityNodes < nNodes do - onIncrease() - end - end - - function ShowCurrentTest() - pNewScene = cc.Scene:create() - InitWithSpriteTest(nSubtestNumber,nQuantityNodes) - cc.Director:getInstance():replaceScene(pNewScene) - end - - InitWithSpriteTest(1,SpriteTestParam.kInitNodes) - - return pNewScene -end - ----------------------------------- ---PerformanceTextureTest ----------------------------------- -local TextureTestParam = -{ - TEST_COUNT = 1, -} - -local function runTextureTest() - - local function GetTitle() - return "Texture Performance Test" - end - - local function GetSubtitle() - return "See console for results" - end - - local nTexCurCase = 0 - local pNewscene = cc.Scene:create() - local pLayer = cc.Layer:create() - local s = cc.Director:getInstance():getWinSize() - - local function PerformTestsPNG(strFileName) - local time - local pTexture = nil - local pCache = cc.Director:getInstance():getTextureCache() - - local pDefaultFormat = cc.Texture2D:getDefaultAlphaPixelFormat(); - - print("RGBA 8888") - cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A8888) - pTexture = pCache:addImage(strFileName) - if nil ~= pTexture then - --os.time()--get secs,not micr sec - print("add sucess") - else - print(" ERROR") - end - pCache:removeTexture(pTexture) - - print("RGBA 4444") - cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A4444) - --gettimeofday(&now, NULL) - pTexture = pCache:addImage(strFileName) - if nil ~= pTexture then - print("add sucess") - else - print(" ERROR") - end - pCache:removeTexture(pTexture) - - print("RGBA 5551") - cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE2_D_PIXEL_FORMAT_RGB5_A1) - --gettimeofday(&now, NULL) - pTexture = pCache:addImage(strFileName) - if nil ~= pTexture then - print("add sucess") - else - print(" ERROR") - end - pCache:removeTexture(pTexture) - - print("RGB 565") - cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE2_D_PIXEL_FORMAT_RG_B565) - -- gettimeofday(&now, NULL) - pTexture = pCache:addImage(strFileName) - if nil ~= pTexture then - --log(" ms:%f", calculateDeltaTime(&now) ) - print("add sucess") - else - print(" ERROR") - end - pCache:removeTexture(pTexture) - - cc.Texture2D:setDefaultAlphaPixelFormat(pDefaultFormat) - end - local function PerformTests() - print("--------") - print("--- PNG 128x128 ---") - PerformTestsPNG("Images/test_image.png") - - print("--- PNG 512x512 ---") - PerformTestsPNG("Images/texture512x512.png") - - print("EMPTY IMAGE") - print("--- PNG 1024x1024 ---") - PerformTestsPNG("Images/texture1024x1024.png") - - print("SPRITESHEET IMAGE") - print("--- PNG 1024x1024 ---") - PerformTestsPNG("Images/PlanetCute-1024x1024.png") - - print("LANDSCAPE IMAGE") - print("--- PNG 1024x1024 ---") - PerformTestsPNG("Images/landscape-1024x1024.png") - end - - local function InitTextureMenuLayer() - if nil == pLayer then - return - end - - --Title - local pLabel = cc.Label:createWithTTF(GetTitle(), s_arialPath, 40) - pLayer:addChild(pLabel, 1) - pLabel:setAnchorPoint(cc.p(0.5, 0.5)) - pLabel:setPosition(cc.p(s.width/2, s.height-32)) - pLabel:setColor(cc.c3b(255,255,40)) - - --Subtitle - local pSubLabel = cc.Label:createWithTTF(GetSubtitle(), s_thonburiPath, 16) - pLayer:addChild(pSubLabel, 1) - pSubLabel:setAnchorPoint(cc.p(0.5, 0.5)) - pSubLabel:setPosition(cc.p(s.width/2, s.height-80)) - - --menu - local pMenu = cc.Menu:create() - CreatePerfomBasicLayerMenu(pMenu) - pMenu:setPosition(cc.p(0, 0)) - pLayer:addChild(pMenu) - - PerformTests() - end - - InitTextureMenuLayer() - pNewscene:addChild(pLayer) - return pNewscene -end ----------------------------------- ---PerformanceTouchesTest ----------------------------------- -local TouchesTestParam = -{ - TEST_COUNT = 2, -} -local function runTouchesTest() - local nTouchCurCase = 0 - --PerformBasicLayer param - local bControlMenuVisible = false - local nMaxCases = 0 - local nCurCase = 0 - --TouchesMainScene param - local pClassLabel = nil - local nNumberOfTouchesB = 0 - local nNumberOfTouchesM = 0 - local nNumberOfTouchesE = 0 - local nNumberOfTouchesC = 0 - local fElapsedTime = 0.0 - - local s = cc.Director:getInstance():getWinSize() - local pNewscene = cc.Scene:create() - local pLayer = cc.Layer:create() - - local function GetTitle() - if 0 == nCurCase then - return "Targeted touches" - elseif 1 == nCurCase then - return "Standard touches" - end - end - - local function CreateBasicLayerMenuItem(pMenu,bMenuVisible,nMaxCasesNum,nCurCaseIndex) - if nil ~= pMenu then - bControlMenuVisible = bMenuVisible - nMaxCases = nMaxCasesNum - nCurCase = nCurCaseIndex - if true == bControlMenuVisible then - local function backCallback() - nCurCase = nCurCase - 1 - if nCurCase < 0 then - nCurCase = nCurCase + nMaxCases - end - ShowCurrentTest() - end - - local function restartCallback() - ShowCurrentTest() - end - - local function nextCallback() - nCurCase = nCurCase + 1 - --No check nMaxCases - nCurCase = nCurCase % nMaxCases - ShowCurrentTest() - end - - local size = cc.Director:getInstance():getWinSize() - local item1 = cc.MenuItemImage:create(s_pPathB1, s_pPathB2) - item1:registerScriptTapHandler(backCallback) - pMenu:addChild(item1,kItemTagBasic) - local item2 = cc.MenuItemImage:create(s_pPathR1, s_pPathR2) - item2:registerScriptTapHandler(restartCallback) - pMenu:addChild(item2,kItemTagBasic) - local item3 = cc.MenuItemImage:create(s_pPathF1, s_pPathF2) - pMenu:addChild(item3,kItemTagBasic) - item3:registerScriptTapHandler(nextCallback) - - local size = cc.Director:getInstance():getWinSize() - item1:setPosition(cc.p(size.width / 2 - item2:getContentSize().width * 2, item2:getContentSize().height / 2)) - item2:setPosition(cc.p(size.width / 2, item2:getContentSize().height / 2)) - item3:setPosition(cc.p(size.width / 2 + item2:getContentSize().width * 2, item2:getContentSize().height / 2)) - end - end - end - - local function update(fTime) - fElapsedTime = fElapsedTime + fTime - - if fElapsedTime > 1.0 then - local fFrameRateB = nNumberOfTouchesB / fElapsedTime - local fFrameRateM = nNumberOfTouchesM / fElapsedTime - local fFrameRateE = nNumberOfTouchesE / fElapsedTime - local fFrameRateC = nNumberOfTouchesC / fElapsedTime - fElapsedTime = 0 - nNumberOfTouchesB = 0 - nNumberOfTouchesM = 0 - nNumberOfTouchesE = 0 - nNumberOfTouchesC = 0 - - local strInfo = string.format("%.1f %.1f %.1f %.1f",fFrameRateB, fFrameRateM, fFrameRateE, fFrameRateC) - if nil ~= pClassLabel then - pClassLabel:setString(strInfo) - end - end - - end - - -- handling touch events - local function onTouchEnded(touch, event) - nNumberOfTouchesE = nNumberOfTouchesE + 1 - end - - local function onTouchBegan(touch, event) - nNumberOfTouchesB = nNumberOfTouchesB + 1 - end - - local function onTouchMoved(touch, event) - nNumberOfTouchesM = nNumberOfTouchesM + 1 - end - - local function onTouchCancelled(touch, event) - nNumberOfTouchesC = nNumberOfTouchesC + 1 - end - - - local function onTouchesEnded(touches, event) - nNumberOfTouchesE = nNumberOfTouchesE + table.getn(touches) - end - - local function onTouchesBegan(touches, event) - nNumberOfTouchesB = nNumberOfTouchesB + table.getn(touches) - end - - local function onTouchesMoved(touches, event) - nNumberOfTouchesM = nNumberOfTouchesM + table.getn(touches) - end - - local function onTouchesCancelled(touches, event) - nNumberOfTouchesC= nNumberOfTouchesC + table.getn(touches) - end - - local function InitLayer() - --menu - local pTouchesTestMenu = cc.Menu:create() - CreatePerfomBasicLayerMenu(pTouchesTestMenu) - CreateBasicLayerMenuItem(pTouchesTestMenu,true,TouchesTestParam.TEST_COUNT,nCurCase) - pTouchesTestMenu:setPosition(cc.p(0, 0)) - pLayer:addChild(pTouchesTestMenu) - - --Title - local pLabel = cc.Label:createWithTTF(GetTitle(), s_arialPath, 40) - pLayer:addChild(pLabel, 1) - pLabel:setAnchorPoint(cc.p(0.5, 0.5)) - pLabel:setPosition(cc.p(s.width/2, s.height-32)) - pLabel:setColor(cc.c3b(255,255,40)) - - pLayer:scheduleUpdateWithPriorityLua(update,0) - - pClassLabel = cc.Label:createWithBMFont("fonts/arial16.fnt", "00.0") - pClassLabel:setAnchorPoint(cc.p(0.5, 0.5)) - pClassLabel:setPosition(cc.p(s.width/2, s.height/2)) - pLayer:addChild(pClassLabel) - - fElapsedTime = 0.0 - nNumberOfTouchesB = 0 - nNumberOfTouchesM = 0 - nNumberOfTouchesE = 0 - nNumberOfTouchesC = 0 - - if 0 == nCurCase then - local listener = cc.EventListenerTouchOneByOne:create() - listener:registerScriptHandler(onTouchBegan,cc.Handler.EVENT_TOUCH_BEGAN ) - listener:registerScriptHandler(onTouchMoved,cc.Handler.EVENT_TOUCH_MOVED ) - listener:registerScriptHandler(onTouchEnded,cc.Handler.EVENT_TOUCH_ENDED ) - listener:registerScriptHandler(onTouchCancelled,cc.Handler.EVENT_TOUCH_CANCELLED ) - local eventDispatcher = pLayer:getEventDispatcher() - eventDispatcher:addEventListenerWithSceneGraphPriority(listener, pLayer) - elseif 1 == nCurCase then - local listener = cc.EventListenerTouchAllAtOnce:create() - listener:registerScriptHandler(onTouchesBegan,cc.Handler.EVENT_TOUCHES_BEGAN ) - listener:registerScriptHandler(onTouchesMoved,cc.Handler.EVENT_TOUCHES_MOVED ) - listener:registerScriptHandler(onTouchesEnded,cc.Handler.EVENT_TOUCHES_ENDED ) - listener:registerScriptHandler(onTouchesCancelled,cc.Handler.EVENT_TOUCHES_CANCELLED ) - local eventDispatcher = pLayer:getEventDispatcher() - eventDispatcher:addEventListenerWithSceneGraphPriority(listener, pLayer) - end - end - - function ShowCurrentTest() - if nil ~= pLayer then - pLayer:unscheduleUpdate() - end - - pNewscene = cc.Scene:create() - - if nil ~= pNewscene then - pLayer = cc.Layer:create() - InitLayer() - pNewscene:addChild(pLayer) - cc.Director:getInstance():replaceScene(pNewscene) - end - end - - InitLayer() - pNewscene:addChild(pLayer) - return pNewscene -end - -local function runFuncRelateWithTable() - -- body - local newscene = cc.Scene:create() - local layer = cc.Layer:create() - local s = cc.Director:getInstance():getWinSize() - local scheduler = cc.Director:getInstance():getScheduler() - local scheduleEntryID = 0 - local quantityOfNodes = 10000 - local socket = require("socket") - local maxTime = 0.0 - local minTime = 99999 - local averageTime1 = 0.0 - local averageTime2 = 0.0 - local totalTime = 0.0 - local numberOfCalls = 0 - - local function GetTitle() - return "Func Releated Table Performance Test" - end - - local function GetSubtitle() - return "See console for results" - end - - local function initVar() - maxTime = 0.0 - minTime = 99999 - averageTime1 = 0.0 - averageTime2 = 0.0 - totalTime = 0.0 - numberOfCalls = 0 - end - - --Title - local title = cc.Label:createWithTTF(GetTitle(), s_arialPath, 28) - layer:addChild(title, 1) - title:setAnchorPoint(cc.p(0.5, 0.5)) - title:setPosition(cc.p(s.width/2, s.height-32)) - title:setColor(cc.c3b(255,255,40)) - --Subtitle - local subTitle = cc.Label:createWithTTF(GetSubtitle(), s_thonburiPath, 16) - layer:addChild(subTitle, 1) - subTitle:setAnchorPoint(cc.p(0.5, 0.5)) - subTitle:setPosition(cc.p(s.width/2, s.height-80)) - - --"+","-" Menu - local function onDecrease() - quantityOfNodes = quantityOfNodes - 100 - if quantityOfNodes == 0 then - quantityOfNodes = 100 - end - local numLabel = layer:getChildByTag(NodeChildrenTestParam.kTagInfoLayer) - local strNum = string.format("%d", quantityOfNodes) - numLabel:setString(strNum) - end - - local function onIncrease() - quantityOfNodes = quantityOfNodes + 100 - local numLabel = layer:getChildByTag(NodeChildrenTestParam.kTagInfoLayer) - local strNum = string.format("%d", quantityOfNodes) - numLabel:setString(strNum) - end - - cc.MenuItemFont:setFontSize(65) - local decrease = cc.MenuItemFont:create(" - ") - decrease:registerScriptTapHandler(onDecrease) - decrease:setColor(cc.c3b(0,200,20)) - local increase = cc.MenuItemFont:create(" + ") - increase:registerScriptTapHandler(onIncrease) - increase:setColor(cc.c3b(0,200,20)) - - local menuAddOrSub = cc.Menu:create() - menuAddOrSub:addChild(decrease) - menuAddOrSub:addChild(increase) - menuAddOrSub:alignItemsHorizontally() - menuAddOrSub:setPosition(cc.p(s.width/2, s.height/2+15)) - layer:addChild(menuAddOrSub,1) - - --num - local numLabel = cc.Label:createWithTTF("10000", s_markerFeltFontPath, 30) - numLabel:setColor(cc.c3b(0,200,20)) - numLabel:setAnchorPoint(cc.p(0.5, 0.5)) - numLabel:setPosition(cc.p(s.width/2, s.height/2-15)) - layer:addChild(numLabel, 1, NodeChildrenTestParam.kTagInfoLayer) - - --setPosition,getPosition,Point - cc.MenuItemFont:setFontSize(18) - local setPositionItem = cc.MenuItemFont:create("setPosition") - local getPositionItem = cc.MenuItemFont:create("getPosition") - local getAnchorPointItem = cc.MenuItemFont:create("getAnchorPoint") - local pointItem = cc.MenuItemFont:create("object") - local funcToggleItem = cc.MenuItemToggle:create(setPositionItem) - funcToggleItem:addSubItem(getPositionItem) - funcToggleItem:addSubItem(getAnchorPointItem) - funcToggleItem:addSubItem(pointItem) - funcToggleItem:setAnchorPoint(cc.p(0.0, 0.5)) - funcToggleItem:setPosition(cc.p(VisibleRect:left())) - local funcMenu = cc.Menu:create(funcToggleItem) - funcMenu:setPosition(cc.p(0, 0)) - layer:addChild(funcMenu) - - local testNode = cc.Node:create() - layer:addChild(testNode) - - local function step(dt) - print(string.format("push num: %d, avg1:%f, avg2:%f,min:%f, max:%f, total: %f, calls: %d",quantityOfNodes, averageTime1, averageTime2, minTime, maxTime, totalTime, numberOfCalls)) - end - - local function profileEnd(startTime) - local duration = socket.gettime() - startTime - totalTime = totalTime + duration - averageTime1 = (averageTime1 + duration) / 2 - averageTime2 = totalTime / numberOfCalls - - if maxTime < duration then - maxTime = duration - end - - if minTime > duration then - minTime = duration - end - end - - local function callSetPosition() - numberOfCalls = numberOfCalls + 1 - local startTime = socket.gettime() - for i=1,quantityOfNodes do - testNode:setPosition(cc.p(1,2)) - end - profileEnd(startTime) - end - - local function callGetPosition() - numberOfCalls = numberOfCalls + 1 - local startTime = socket.gettime() - for i=1,quantityOfNodes do - local x,y = testNode:getPosition() - end - profileEnd(startTime) - end - - local function callGetAnchorPoint() - numberOfCalls = numberOfCalls + 1 - local startTime = socket.gettime() - for i=1,quantityOfNodes do - local anchorPoint = testNode:getAnchorPoint() - end - profileEnd(startTime) - end - - local function callTableObject() - numberOfCalls = numberOfCalls + 1 - local startTime = socket.gettime() - for i=1,quantityOfNodes do - local pt = cc.p(1,2) - end - profileEnd(startTime) - end - - local function update(dt) - - local funcSelected = funcToggleItem:getSelectedIndex() - if 0 == funcSelected then - callSetPosition() - elseif 1 == funcSelected then - callGetPosition() - elseif 2 == funcSelected then - callGetAnchorPoint() - elseif 3 == funcSelected then - callTableObject() - end - end - - local function onNodeEvent(tag) - if tag == "exit" then - layer:unscheduleUpdate() - scheduler:unscheduleScriptEntry(scheduleEntryID) - end - end - - layer:registerScriptHandler(onNodeEvent) - - - local function startCallback() - initVar() - decrease:setEnabled(false) - increase:setEnabled(false) - funcToggleItem:setEnabled(false) - layer:unscheduleUpdate() - layer:scheduleUpdateWithPriorityLua(update, 0) - scheduler:unscheduleScriptEntry(scheduleEntryID) - scheduleEntryID = scheduler:scheduleScriptFunc(step,2,false) - end - - local function stopCallback() - decrease:setEnabled(true) - increase:setEnabled(true) - funcToggleItem:setEnabled(true) - layer:unscheduleUpdate() - scheduler:unscheduleScriptEntry(scheduleEntryID) - end - local startItem = cc.MenuItemFont:create("start") - startItem:registerScriptTapHandler(startCallback) - local stopItem = cc.MenuItemFont:create("stop") - stopItem:registerScriptTapHandler(stopCallback) - local startAndStop = cc.Menu:create(startItem,stopItem) - startAndStop:alignItemsVertically() - startAndStop:setPosition(VisibleRect:right().x - 50, VisibleRect:right().y) - layer:addChild(startAndStop) - - --back menu - local menu = cc.Menu:create() - CreatePerfomBasicLayerMenu(menu) - menu:setPosition(cc.p(0, 0)) - layer:addChild(menu) - - newscene:addChild(layer) - return newscene -end - - ------------------------- --- ------------------------- -local CreatePerformancesTestTable = -{ - runNodeChildrenTest, - runParticleTest, - runSpriteTest, - runTextureTest, - runTouchesTest, - runFuncRelateWithTable, -} - -local function CreatePerformancesTestScene(nPerformanceNo) - local pNewscene = CreatePerformancesTestTable[nPerformanceNo]() - return pNewscene -end -local function menuCallback(tag, pMenuItem) - local scene = nil - local nIdx = pMenuItem:getLocalZOrder() - kItemTagBasic - local PerformanceTestScene = CreatePerformancesTestScene(nIdx) - if nil ~= PerformanceTestScene then - cc.Director:getInstance():replaceScene(PerformanceTestScene) - end -end - -local function PerformanceMainLayer() - local layer = cc.Layer:create() - - local menu = cc.Menu:create() - menu:setPosition(cc.p(0, 0)) - cc.MenuItemFont:setFontName("Arial") - cc.MenuItemFont:setFontSize(24) - for i = 1, MAX_COUNT do - local item = cc.MenuItemFont:create(testsName[i]) - item:registerScriptTapHandler(menuCallback) - item:setPosition(s.width / 2, s.height - i * LINE_SPACE) - menu:addChild(item, kItemTagBasic + i) - if i == MAX_COUNT then - local targetPlatform = cc.Application:getInstance():getTargetPlatform() - if (cc.PLATFORM_OS_IPHONE ~= targetPlatform) and (cc.PLATFORM_OS_IPAD ~= targetPlatform) and - (cc.PLATFORM_OS_ANDROID ~= targetPlatform) and (cc.PLATFORM_OS_WINDOWS ~= targetPlatform) and - (cc.PLATFORM_OS_MAC ~= targetPlatform) then - item:setEnabled(false) - end - end - end - - layer:addChild(menu) - - return layer -end - -------------------------------------- --- Performance Test -------------------------------------- -function PerformanceTestMain() - local scene = cc.Scene:create() - - scene:addChild(PerformanceMainLayer()) - scene:addChild(CreateBackMenuItem()) - - return scene -end diff --git a/tests/lua-tests/src/PhysicsTest/PhysicsTest.lua b/tests/lua-tests/src/PhysicsTest/PhysicsTest.lua index 59d00d315f..54bcb41b9a 100644 --- a/tests/lua-tests/src/PhysicsTest/PhysicsTest.lua +++ b/tests/lua-tests/src/PhysicsTest/PhysicsTest.lua @@ -3,6 +3,7 @@ local MATERIAL_DEFAULT = cc.PhysicsMaterial(0.1, 0.5, 0.5) local curLayer = nil local STATIC_COLOR = cc.c4f(1.0, 0.0, 0.0, 1.0) local DRAG_BODYS_TAG = 0x80 +local PHYSICS_COMPONENT_NAME = "physics_component" local function range(from, to, step) step = step or 1 @@ -26,7 +27,7 @@ local function initWithLayer(layer, callback) cc.Director:getInstance():getRunningScene():getPhysicsWorld():setDebugDrawMask(debug and cc.PhysicsWorld.DEBUGDRAW_ALL or cc.PhysicsWorld.DEBUGDRAW_NONE) end - layer.toggleDebug = function(self) toggleDebugCallback(nil) end; + layer.toggleDebug = function(self) toggleDebugCallback(nil) end cc.MenuItemFont:setFontSize(18) local item = cc.MenuItemFont:create("Toogle debug") item:registerScriptTapHandler(toggleDebugCallback) @@ -43,6 +44,12 @@ local function initWithLayer(layer, callback) layer:registerScriptHandler(onNodeEvent) end +local function addPhysicsComponent(node, physicsBody) + local component = cc.ComponentPhysics2d:create(physicsBody) + component:setName(PHYSICS_COMPONENT_NAME) + node:addComponent(component) +end + local function addGrossiniAtPosition(layer, p, scale) scale = scale or 1.0 @@ -53,7 +60,8 @@ local function addGrossiniAtPosition(layer, p, scale) local sp = cc.Sprite:createWithTexture(layer.spriteTexture, cc.rect(posx, posy, 85, 121)) sp:setScale(scale) - sp:setPhysicsBody(cc.PhysicsBody:createBox(cc.size(48.0*scale, 108.0*scale))) + -- sp:setPhysicsBody(cc.PhysicsBody:createBox(cc.size(48.0*scale, 108.0*scale))) + addPhysicsComponent(sp, cc.PhysicsBody:createBox(cc.size(48.0, 108.0))) layer:addChild(sp) sp:setPosition(p) return sp @@ -66,31 +74,32 @@ local function onTouchBegan(touch, event) local body for _, obj in ipairs(arr) do if bit.band(obj:getBody():getTag(), DRAG_BODYS_TAG) ~= 0 then - body = obj:getBody(); - break; + body = obj:getBody() + break end end if body then - local mouse = cc.Node:create(); - mouse:setPhysicsBody(cc.PhysicsBody:create(PHYSICS_INFINITY, PHYSICS_INFINITY)); - mouse:getPhysicsBody():setDynamic(false); - mouse:setPosition(location); - curLayer:addChild(mouse); - local joint = cc.PhysicsJointPin:construct(mouse:getPhysicsBody(), body, location); - joint:setMaxForce(5000.0 * body:getMass()); - cc.Director:getInstance():getRunningScene():getPhysicsWorld():addJoint(joint); + local mouse = cc.Node:create() + local physicsBody = cc.PhysicsBody:create(PHYSICS_INFINITY, PHYSICS_INFINITY) + addPhysicsComponent(mouse, physicsBody) + physicsBody:setDynamic(false) + mouse:setPosition(location) + curLayer:addChild(mouse) + local joint = cc.PhysicsJointPin:construct(physicsBody, body, location) + joint:setMaxForce(5000.0 * body:getMass()) + cc.Director:getInstance():getRunningScene():getPhysicsWorld():addJoint(joint) touch.mouse = mouse - return true; + return true end - return false; + return false end local function onTouchMoved(touch, event) if touch.mouse then - touch.mouse:setPosition(touch:getLocation()); + touch.mouse:setPosition(touch:getLocation()) end end @@ -113,8 +122,9 @@ local function makeBall(layer, point, radius, material) ball:setScale(0.13 * radius) - local body = cc.PhysicsBody:createCircle(radius, material) - ball:setPhysicsBody(body) + local body = cc.PhysicsBody:createCircle(ball:getContentSize().width / 2, material) + -- ball:setPhysicsBody(body) + addPhysicsComponent(ball, body) ball:setPosition(point) return ball @@ -123,58 +133,61 @@ end local function makeBox(point, size, color, material) material = material or MATERIAL_DEFAULT - local yellow = false; + local yellow = false if color == 0 then - yellow = math.random() > 0.5; + yellow = math.random() > 0.5 else - yellow = color == 1; + yellow = color == 1 end - local box = yellow and cc.Sprite:create("Images/YellowSquare.png") or cc.Sprite:create("Images/CyanSquare.png"); + local box = yellow and cc.Sprite:create("Images/YellowSquare.png") or cc.Sprite:create("Images/CyanSquare.png") - box:setScaleX(size.width/100.0); - box:setScaleY(size.height/100.0); + box:setScaleX(size.width/100.0) + box:setScaleY(size.height/100.0) - local body = cc.PhysicsBody:createBox(size, material); - box:setPhysicsBody(body); - box:setPosition(cc.p(point.x, point.y)); + local body = cc.PhysicsBody:createBox(box:getContentSize(), material) + addPhysicsComponent(box, body) + box:setPosition(cc.p(point.x, point.y)) - return box; + return box end local function makeTriangle(point, size, color, material) material = material or MATERIAL_DEFAULT - local yellow = false; + local yellow = false if color == 0 then - yellow = math.random() > 0.5; + yellow = math.random() > 0.5 else - yellow = color == 1; + yellow = color == 1 end - local triangle = yellow and cc.Sprite:create("Images/YellowTriangle.png") or cc.Sprite:create("Images/CyanTriangle.png"); + local triangle = yellow and cc.Sprite:create("Images/YellowTriangle.png") or cc.Sprite:create("Images/CyanTriangle.png") if size.height == 0 then - triangle:setScale(size.width/100.0); + triangle:setScale(size.width/100.0) else triangle:setScaleX(size.width/50.0) triangle:setScaleY(size.height/43.5) end + + vers = { cc.p(0, triangle:getContentSize().height/2), + cc.p(triangle:getContentSize().width/2, -triangle:getContentSize().height/2), + cc.p(-triangle:getContentSize().width/2, -triangle:getContentSize().height/2) + } + + local body = cc.PhysicsBody:createPolygon(vers, material) + addPhysicsComponent(triangle, body) + triangle:setPosition(point) - vers = { cc.p(0, size.height/2), cc.p(size.width/2, -size.height/2), cc.p(-size.width/2, -size.height/2)}; - - local body = cc.PhysicsBody:createPolygon(vers, material); - triangle:setPhysicsBody(body); - triangle:setPosition(point); - - return triangle; + return triangle end local function PhysicsDemoClickAdd() local layer = cc.Layer:create() local function onEnter() local function onTouchEnded(touch, event) - local location = touch:getLocation(); - addGrossiniAtPosition(layer, location) + local location = touch:getLocation() + addGrossiniAtPosition(layer, location) end local touchListener = cc.EventListenerTouchOneByOne:create() @@ -186,7 +199,12 @@ local function PhysicsDemoClickAdd() addGrossiniAtPosition(layer, VisibleRect:center()) local node = cc.Node:create() - node:setPhysicsBody(cc.PhysicsBody:createEdgeBox(cc.size(VisibleRect:getVisibleRect().width, VisibleRect:getVisibleRect().height))) + addPhysicsComponent(node, + cc.PhysicsBody:createEdgeBox(cc.size(VisibleRect:getVisibleRect().width, + VisibleRect:getVisibleRect().height + ) + ) + ) node:setPosition(VisibleRect:center()) layer:addChild(node) end @@ -211,66 +229,69 @@ local function PhysicsDemoLogoSmash() 31,-1,-64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,-1,-64,0,-4,63,-1,-32,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,1,-1,-64,15,-8,127,-1,-32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,-1,-64,0,-8,-15,-1,-32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,-31,-1,-64,15,-8,-32, - -1,-32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,-15,-1,-64,9,-15,-32,-1,-32,0,0,0,0,0, + -1,-32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,-15,-1,-64,9,-15,-32,-1,-32,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,31,-15,-1,-64,0,-15,-32,-1,-32,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,63,-7,-1,-64,9,-29,-32,127,-61,-16,63,15,-61,-1,-8,31,-16,15,-8,126,7,-31, - -8,31,-65,-7,-1,-64,9,-29,-32,0,7,-8,127,-97,-25,-1,-2,63,-8,31,-4,-1,15,-13, - -4,63,-1,-3,-1,-64,9,-29,-32,0,7,-8,127,-97,-25,-1,-2,63,-8,31,-4,-1,15,-13, - -2,63,-1,-3,-1,-64,9,-29,-32,0,7,-8,127,-97,-25,-1,-1,63,-4,63,-4,-1,15,-13, - -2,63,-33,-1,-1,-32,9,-25,-32,0,7,-8,127,-97,-25,-1,-1,63,-4,63,-4,-1,15,-13, - -1,63,-33,-1,-1,-16,9,-25,-32,0,7,-8,127,-97,-25,-1,-1,63,-4,63,-4,-1,15,-13, - -1,63,-49,-1,-1,-8,9,-57,-32,0,7,-8,127,-97,-25,-8,-1,63,-2,127,-4,-1,15,-13, - -1,-65,-49,-1,-1,-4,9,-57,-32,0,7,-8,127,-97,-25,-8,-1,63,-2,127,-4,-1,15,-13, - -1,-65,-57,-1,-1,-2,9,-57,-32,0,7,-8,127,-97,-25,-8,-1,63,-2,127,-4,-1,15,-13, - -1,-1,-57,-1,-1,-1,9,-57,-32,0,7,-1,-1,-97,-25,-8,-1,63,-1,-1,-4,-1,15,-13,-1, - -1,-61,-1,-1,-1,-119,-57,-32,0,7,-1,-1,-97,-25,-8,-1,63,-1,-1,-4,-1,15,-13,-1, - -1,-61,-1,-1,-1,-55,-49,-32,0,7,-1,-1,-97,-25,-8,-1,63,-1,-1,-4,-1,15,-13,-1, - -1,-63,-1,-1,-1,-23,-49,-32,127,-57,-1,-1,-97,-25,-1,-1,63,-1,-1,-4,-1,15,-13, - -1,-1,-63,-1,-1,-1,-16,-49,-32,-1,-25,-1,-1,-97,-25,-1,-1,63,-33,-5,-4,-1,15, - -13,-1,-1,-64,-1,-9,-1,-7,-49,-32,-1,-25,-8,127,-97,-25,-1,-1,63,-33,-5,-4,-1, + -8,31,-65,-7,-1,-64,9,-29,-32,0,7,-8,127,-97,-25,-1,-2,63,-8,31,-4,-1,15,-13, + -4,63,-1,-3,-1,-64,9,-29,-32,0,7,-8,127,-97,-25,-1,-2,63,-8,31,-4,-1,15,-13, + -2,63,-1,-3,-1,-64,9,-29,-32,0,7,-8,127,-97,-25,-1,-1,63,-4,63,-4,-1,15,-13, + -2,63,-33,-1,-1,-32,9,-25,-32,0,7,-8,127,-97,-25,-1,-1,63,-4,63,-4,-1,15,-13, + -1,63,-33,-1,-1,-16,9,-25,-32,0,7,-8,127,-97,-25,-1,-1,63,-4,63,-4,-1,15,-13, + -1,63,-49,-1,-1,-8,9,-57,-32,0,7,-8,127,-97,-25,-8,-1,63,-2,127,-4,-1,15,-13, + -1,-65,-49,-1,-1,-4,9,-57,-32,0,7,-8,127,-97,-25,-8,-1,63,-2,127,-4,-1,15,-13, + -1,-65,-57,-1,-1,-2,9,-57,-32,0,7,-8,127,-97,-25,-8,-1,63,-2,127,-4,-1,15,-13, + -1,-1,-57,-1,-1,-1,9,-57,-32,0,7,-1,-1,-97,-25,-8,-1,63,-1,-1,-4,-1,15,-13,-1, + -1,-61,-1,-1,-1,-119,-57,-32,0,7,-1,-1,-97,-25,-8,-1,63,-1,-1,-4,-1,15,-13,-1, + -1,-61,-1,-1,-1,-55,-49,-32,0,7,-1,-1,-97,-25,-8,-1,63,-1,-1,-4,-1,15,-13,-1, + -1,-63,-1,-1,-1,-23,-49,-32,127,-57,-1,-1,-97,-25,-1,-1,63,-1,-1,-4,-1,15,-13, + -1,-1,-63,-1,-1,-1,-16,-49,-32,-1,-25,-1,-1,-97,-25,-1,-1,63,-33,-5,-4,-1,15, + -13,-1,-1,-64,-1,-9,-1,-7,-49,-32,-1,-25,-8,127,-97,-25,-1,-1,63,-33,-5,-4,-1, 15,-13,-1,-1,-64,-1,-13,-1,-32,-49,-32,-1,-25,-8,127,-97,-25,-1,-2,63,-49,-13, - -4,-1,15,-13,-1,-1,-64,127,-7,-1,-119,-17,-15,-1,-25,-8,127,-97,-25,-1,-2,63, - -49,-13,-4,-1,15,-13,-3,-1,-64,127,-8,-2,15,-17,-1,-1,-25,-8,127,-97,-25,-1, - -8,63,-49,-13,-4,-1,15,-13,-3,-1,-64,63,-4,120,0,-17,-1,-1,-25,-8,127,-97,-25, - -8,0,63,-57,-29,-4,-1,15,-13,-4,-1,-64,63,-4,0,15,-17,-1,-1,-25,-8,127,-97, - -25,-8,0,63,-57,-29,-4,-1,-1,-13,-4,-1,-64,31,-2,0,0,103,-1,-1,-57,-8,127,-97, - -25,-8,0,63,-57,-29,-4,-1,-1,-13,-4,127,-64,31,-2,0,15,103,-1,-1,-57,-8,127, - -97,-25,-8,0,63,-61,-61,-4,127,-1,-29,-4,127,-64,15,-8,0,0,55,-1,-1,-121,-8, + -4,-1,15,-13,-1,-1,-64,127,-7,-1,-119,-17,-15,-1,-25,-8,127,-97,-25,-1,-2,63, + -49,-13,-4,-1,15,-13,-3,-1,-64,127,-8,-2,15,-17,-1,-1,-25,-8,127,-97,-25,-1, + -8,63,-49,-13,-4,-1,15,-13,-3,-1,-64,63,-4,120,0,-17,-1,-1,-25,-8,127,-97,-25, + -8,0,63,-57,-29,-4,-1,15,-13,-4,-1,-64,63,-4,0,15,-17,-1,-1,-25,-8,127,-97, + -25,-8,0,63,-57,-29,-4,-1,-1,-13,-4,-1,-64,31,-2,0,0,103,-1,-1,-57,-8,127,-97, + -25,-8,0,63,-57,-29,-4,-1,-1,-13,-4,127,-64,31,-2,0,15,103,-1,-1,-57,-8,127, + -97,-25,-8,0,63,-61,-61,-4,127,-1,-29,-4,127,-64,15,-8,0,0,55,-1,-1,-121,-8, 127,-97,-25,-8,0,63,-61,-61,-4,127,-1,-29,-4,63,-64,15,-32,0,0,23,-1,-2,3,-16, 63,15,-61,-16,0,31,-127,-127,-8,31,-1,-127,-8,31,-128,7,-128,0,0 - }; + } local function get_pixel(x, y) - return bit.band(bit.rshift(logo_image[bit.rshift(x, 3) + y*logo_raw_length + 1], bit.band(bit.bnot(x), 0x07)), 1) + return bit.band(bit.rshift(logo_image[bit.rshift(x, 3) + y*logo_raw_length + 1], bit.band(bit.bnot(x), 0x07)), 1) end - cc.Director:getInstance():getRunningScene():getPhysicsWorld():setGravity(cc.p(0, 0)); - cc.Director:getInstance():getRunningScene():getPhysicsWorld():setUpdateRate(5.0); + cc.Director:getInstance():getRunningScene():getPhysicsWorld():setGravity(cc.p(0, 0)) + cc.Director:getInstance():getRunningScene():getPhysicsWorld():setUpdateRate(5.0) - layer.ball = cc.SpriteBatchNode:create("Images/ball.png", #logo_image); - layer:addChild(layer.ball); + layer.ball = cc.SpriteBatchNode:create("Images/ball.png", #logo_image) + layer:addChild(layer.ball) for y in range(0, logo_height-1) do - for x in range(0, logo_width-1) do - if get_pixel(x, y) == 1 then - local x_jitter = 0.05*math.random(); - local y_jitter = 0.05*math.random(); + for x in range(0, logo_width-1) do + if get_pixel(x, y) == 1 then + local x_jitter = 0.05*math.random() + local y_jitter = 0.05*math.random() - local ball = makeBall(layer, cc.p(2*(x - logo_width/2 + x_jitter) + VisibleRect:getVisibleRect().width/2, - 2*(logo_height-y + y_jitter) + VisibleRect:getVisibleRect().height/2 - logo_height/2), - 0.95, cc.PhysicsMaterial(0.01, 0.0, 0.0)); - - ball:getPhysicsBody():setMass(1.0); - ball:getPhysicsBody():setMoment(PHYSICS_INFINITY); + local ball = makeBall(layer, + cc.p(2*(x - logo_width/2 + x_jitter) + VisibleRect:getVisibleRect().width/2, + 2*(logo_height-y + y_jitter) + VisibleRect:getVisibleRect().height/2 - logo_height/2), + 0.95, + cc.PhysicsMaterial(0.01, 0.0, 0.0)) + local physicsBody = ball:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody() + physicsBody:setMass(1.0) + physicsBody:setMoment(PHYSICS_INFINITY) - layer.ball:addChild(ball); - end - end + layer.ball:addChild(ball) + end + end end - local bullet = makeBall(layer, cc.p(400, 0), 10, cc.PhysicsMaterial(PHYSICS_INFINITY, 0, 0)); - bullet:getPhysicsBody():setVelocity(cc.p(200, 0)); + local bullet = makeBall(layer, cc.p(400, 0), 10, cc.PhysicsMaterial(PHYSICS_INFINITY, 0, 0)) + + bullet:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody():setVelocity(cc.p(200, 0)) bullet:setPosition(cc.p(-500, VisibleRect:getVisibleRect().height/2)) - layer.ball:addChild(bullet); + layer.ball:addChild(bullet) end initWithLayer(layer, onEnter) @@ -282,7 +303,7 @@ end local function PhysicsDemoJoints() local layer = cc.Layer:create() local function onEnter() - layer:toggleDebug(); + layer:toggleDebug() local touchListener = cc.EventListenerTouchOneByOne:create() touchListener:registerScriptHandler(onTouchBegan, cc.Handler.EVENT_TOUCH_BEGAN) @@ -291,153 +312,239 @@ local function PhysicsDemoJoints() local eventDispatcher = layer:getEventDispatcher() eventDispatcher:addEventListenerWithSceneGraphPriority(touchListener, layer) - local width = (VisibleRect:getVisibleRect().width - 10) / 4; - local height = (VisibleRect:getVisibleRect().height - 50) / 4; + local width = (VisibleRect:getVisibleRect().width - 10) / 4 + local height = (VisibleRect:getVisibleRect().height - 50) / 4 - local node = cc.Node:create(); - local box = cc.PhysicsBody:create(); - node:setPhysicsBody(box); - box:setDynamic(false); - node:setPosition(cc.p(0, 0)); - layer:addChild(node); + local node = cc.Node:create() + local box = cc.PhysicsBody:create() + addPhysicsComponent(node, box) + box:setDynamic(false) + node:setPosition(cc.p(0, 0)) + layer:addChild(node) - local scene = cc.Director:getInstance():getRunningScene(); + local scene = cc.Director:getInstance():getRunningScene() for i in range(0, 3) do for j in range(0, 3) do - local offset = cc.p(VisibleRect:leftBottom().x + 5 + j * width + width/2, VisibleRect:leftBottom().y + 50 + i * height + height/2); - box:addShape(cc.PhysicsShapeEdgeBox:create(cc.size(width, height), cc.PHYSICSSHAPE_MATERIAL_DEFAULT, 1, offset)); + local offset = cc.p(VisibleRect:leftBottom().x + 5 + j * width + width/2, + VisibleRect:leftBottom().y + 50 + i * height + height/2) + box:addShape(cc.PhysicsShapeEdgeBox:create(cc.size(width, height), + cc.PHYSICSSHAPE_MATERIAL_DEFAULT, + 1, + offset) + ) local index = i*4 + j + if index == 0 then - local sp1 = makeBall(layer, cc.p(offset.x - 30, offset.y), 10); - sp1:getPhysicsBody():setTag(DRAG_BODYS_TAG); - local sp2 = makeBall(layer, cc.p(offset.x + 30, offset.y), 10); - sp2:getPhysicsBody():setTag(DRAG_BODYS_TAG); + local sp1 = makeBall(layer, cc.p(offset.x - 30, offset.y), 10) + local sp1PhysicsBody = sp1:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody() + sp1PhysicsBody:setTag(DRAG_BODYS_TAG) + + local sp2 = makeBall(layer, cc.p(offset.x + 30, offset.y), 10) + local sp2PhysicsBody = sp2:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody() + sp2PhysicsBody:setTag(DRAG_BODYS_TAG) - local joint = cc.PhysicsJointPin:construct(sp1:getPhysicsBody(), sp2:getPhysicsBody(), offset); - cc.Director:getInstance():getRunningScene():getPhysicsWorld():addJoint(joint); + local joint = cc.PhysicsJointPin:construct(sp1PhysicsBody, sp2PhysicsBody, offset) + cc.Director:getInstance():getRunningScene():getPhysicsWorld():addJoint(joint) - layer:addChild(sp1); - layer:addChild(sp2); + layer:addChild(sp1) + layer:addChild(sp2) elseif index == 1 then - local sp1 = makeBall(layer, cc.p(offset.x - 30, offset.y), 10); - sp1:getPhysicsBody():setTag(DRAG_BODYS_TAG); - local sp2 = makeBox(cc.p(offset.x + 30, offset.y), cc.size(30, 10)); - sp2:getPhysicsBody():setTag(DRAG_BODYS_TAG); + local sp1 = makeBall(layer, cc.p(offset.x - 30, offset.y), 10) + local sp1PhysicsBody = sp1:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody() + sp1PhysicsBody:setTag(DRAG_BODYS_TAG) + + local sp2 = makeBox(cc.p(offset.x + 30, offset.y), cc.size(30, 10)) + local sp2PhysicsBody = sp2:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody() + sp2PhysicsBody:setTag(DRAG_BODYS_TAG) - local joint = cc.PhysicsJointFixed:construct(sp1:getPhysicsBody(), sp2:getPhysicsBody(), offset); - scene:getPhysicsWorld():addJoint(joint); + local joint = cc.PhysicsJointFixed:construct(sp1PhysicsBody, sp2PhysicsBody, offset) + scene:getPhysicsWorld():addJoint(joint) - layer:addChild(sp1); - layer:addChild(sp2); + layer:addChild(sp1) + layer:addChild(sp2) elseif index == 2 then - local sp1 = makeBall(layer, cc.p(offset.x - 30, offset.y), 10); - sp1:getPhysicsBody():setTag(DRAG_BODYS_TAG); - local sp2 = makeBox(cc.p(offset.x + 30, offset.y), cc.size(30, 10)); - sp2:getPhysicsBody():setTag(DRAG_BODYS_TAG); + local sp1 = makeBall(layer, cc.p(offset.x - 30, offset.y), 10) + local sp1PhysicsBody = sp1:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody() + sp1PhysicsBody:setTag(DRAG_BODYS_TAG) + + local sp2 = makeBox(cc.p(offset.x + 30, offset.y), cc.size(30, 10)) + local sp2PhysicsBody = sp2:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody() + sp2PhysicsBody:setTag(DRAG_BODYS_TAG) - local joint = cc.PhysicsJointDistance:construct(sp1:getPhysicsBody(), sp2:getPhysicsBody(), cc.p(0, 0), cc.p(0, 0)); - scene:getPhysicsWorld():addJoint(joint); + local joint = cc.PhysicsJointDistance:construct(sp1PhysicsBody, + sp2PhysicsBody, + cc.p(0, 0), + cc.p(0, 0)) + scene:getPhysicsWorld():addJoint(joint) - layer:addChild(sp1); - layer:addChild(sp2); - elseif index == 3 then - local sp1 = makeBall(layer, cc.p(offset.x - 30, offset.y), 10); - sp1:getPhysicsBody():setTag(DRAG_BODYS_TAG); - local sp2 = makeBox(cc.p(offset.x + 30, offset.y), cc.size(30, 10)); - sp2:getPhysicsBody():setTag(DRAG_BODYS_TAG); + layer:addChild(sp1) + layer:addChild(sp2) + elseif index == 3 then + local sp1 = makeBall(layer, cc.p(offset.x - 30, offset.y), 10) + local sp1PhysicsBody = sp1:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody() + sp1PhysicsBody:setTag(DRAG_BODYS_TAG) + + local sp2 = makeBox(cc.p(offset.x + 30, offset.y), cc.size(30, 10)) + local sp2PhysicsBody = sp2:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody() + sp2PhysicsBody:setTag(DRAG_BODYS_TAG) - local joint = cc.PhysicsJointLimit:construct(sp1:getPhysicsBody(), sp2:getPhysicsBody(), cc.p(0, 0), cc.p(0, 0), 30.0, 60.0); - scene:getPhysicsWorld():addJoint(joint); + local joint = cc.PhysicsJointLimit:construct(sp1PhysicsBody, + sp2PhysicsBody, + cc.p(0, 0), + cc.p(0, 0), + 30.0, + 60.0) + scene:getPhysicsWorld():addJoint(joint) - layer:addChild(sp1); - layer:addChild(sp2); - elseif index == 4 then - local sp1 = makeBall(layer, cc.p(offset.x - 30, offset.y), 10); - sp1:getPhysicsBody():setTag(DRAG_BODYS_TAG); - local sp2 = makeBox(cc.p(offset.x + 30, offset.y), cc.size(30, 10)); - sp2:getPhysicsBody():setTag(DRAG_BODYS_TAG); + layer:addChild(sp1) + layer:addChild(sp2) + elseif index == 4 then + local sp1 = makeBall(layer, cc.p(offset.x - 30, offset.y), 10) + local sp1PhysicsBody = sp1:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody() + sp1PhysicsBody:setTag(DRAG_BODYS_TAG) + + local sp2 = makeBox(cc.p(offset.x + 30, offset.y), cc.size(30, 10)) + local sp2PhysicsBody = sp2:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody() + sp2PhysicsBody:setTag(DRAG_BODYS_TAG) - local joint = cc.PhysicsJointSpring:construct(sp1:getPhysicsBody(), sp2:getPhysicsBody(), cc.p(0, 0), cc.p(0, 0), 500.0, 0.3); - scene:getPhysicsWorld():addJoint(joint); + local joint = cc.PhysicsJointSpring:construct(sp1PhysicsBody, + sp2PhysicsBody, + cc.p(0, 0), + cc.p(0, 0), + 500.0, + 0.3) + scene:getPhysicsWorld():addJoint(joint) - layer:addChild(sp1); - layer:addChild(sp2); - elseif index == 5 then - local sp1 = makeBall(layer, cc.p(offset.x - 30, offset.y), 10); - sp1:getPhysicsBody():setTag(DRAG_BODYS_TAG); - local sp2 = makeBox(cc.p(offset.x + 30, offset.y), cc.size(30, 10)); - sp2:getPhysicsBody():setTag(DRAG_BODYS_TAG); + layer:addChild(sp1) + layer:addChild(sp2) + elseif index == 5 then + local sp1 = makeBall(layer, cc.p(offset.x - 30, offset.y), 10) + local sp1PhysicsBody = sp1:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody() + sp1PhysicsBody:setTag(DRAG_BODYS_TAG) + + local sp2 = makeBox(cc.p(offset.x + 30, offset.y), cc.size(30, 10)) + local sp2PhysicsBody = sp2:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody() + sp2PhysicsBody:setTag(DRAG_BODYS_TAG) - local joint = cc.PhysicsJointGroove:construct(sp1:getPhysicsBody(), sp2:getPhysicsBody(), cc.p(30, 15), cc.p(30, -15), cc.p(-30, 0)) - scene:getPhysicsWorld():addJoint(joint); + local joint = cc.PhysicsJointGroove:construct(sp1PhysicsBody, + sp2PhysicsBody, + cc.p(30, 15), + cc.p(30, -15), + cc.p(-30, 0)) + scene:getPhysicsWorld():addJoint(joint) - layer:addChild(sp1); - layer:addChild(sp2); - elseif index == 6 then - local sp1 = makeBox(cc.p(offset.x - 30, offset.y), cc.size(30, 10)); - sp1:getPhysicsBody():setTag(DRAG_BODYS_TAG); - local sp2 = makeBox(cc.p(offset.x + 30, offset.y), cc.size(30, 10)); - sp2:getPhysicsBody():setTag(DRAG_BODYS_TAG); - scene:getPhysicsWorld():addJoint(cc.PhysicsJointPin:construct(sp1:getPhysicsBody(), box, cc.p(sp1:getPosition()))); - scene:getPhysicsWorld():addJoint(cc.PhysicsJointPin:construct(sp2:getPhysicsBody(), box, cc.p(sp2:getPosition()))); - local joint = cc.PhysicsJointRotarySpring:construct(sp1:getPhysicsBody(), sp2:getPhysicsBody(), 3000.0, 60.0); - scene:getPhysicsWorld():addJoint(joint); + layer:addChild(sp1) + layer:addChild(sp2) + elseif index == 6 then + local sp1 = makeBox(cc.p(offset.x - 30, offset.y), cc.size(30, 10)) + local sp1PhysicsBody = sp1:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody() + sp1PhysicsBody:setTag(DRAG_BODYS_TAG) + + local sp2 = makeBox(cc.p(offset.x + 30, offset.y), cc.size(30, 10)) + local sp2PhysicsBody = sp2:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody() + sp2PhysicsBody:setTag(DRAG_BODYS_TAG) + + scene:getPhysicsWorld():addJoint(cc.PhysicsJointPin:construct(sp1PhysicsBody, + box, + cc.p(sp1:getPosition()))) + scene:getPhysicsWorld():addJoint(cc.PhysicsJointPin:construct(sp2PhysicsBody, + box, + cc.p(sp2:getPosition()))) + local joint = cc.PhysicsJointRotarySpring:construct(sp1PhysicsBody, + sp2PhysicsBody, + 3000.0, + 60.0) + scene:getPhysicsWorld():addJoint(joint) - layer:addChild(sp1); - layer:addChild(sp2); - elseif index == 7 then - local sp1 = makeBox(cc.p(offset.x - 30, offset.y), cc.size(30, 10)); - sp1:getPhysicsBody():setTag(DRAG_BODYS_TAG); - local sp2 = makeBox(cc.p(offset.x + 30, offset.y), cc.size(30, 10)); - sp2:getPhysicsBody():setTag(DRAG_BODYS_TAG); + layer:addChild(sp1) + layer:addChild(sp2) + elseif index == 7 then + local sp1 = makeBox(cc.p(offset.x - 30, offset.y), cc.size(30, 10)) + local sp1PhysicsBody = sp1:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody() + sp1PhysicsBody:setTag(DRAG_BODYS_TAG) + + local sp2 = makeBox(cc.p(offset.x + 30, offset.y), cc.size(30, 10)) + local sp2PhysicsBody = sp2:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody() + sp2PhysicsBody:setTag(DRAG_BODYS_TAG) - scene:getPhysicsWorld():addJoint(cc.PhysicsJointPin:construct(sp1:getPhysicsBody(), box, cc.p(sp1:getPosition()))); - scene:getPhysicsWorld():addJoint(cc.PhysicsJointPin:construct(sp2:getPhysicsBody(), box, cc.p(sp2:getPosition()))); - local joint = cc.PhysicsJointRotaryLimit:construct(sp1:getPhysicsBody(), sp2:getPhysicsBody(), 0.0, math.pi/2); - scene:getPhysicsWorld():addJoint(joint); + scene:getPhysicsWorld():addJoint(cc.PhysicsJointPin:construct(sp1PhysicsBody, + box, + cc.p(sp1:getPosition()))) + scene:getPhysicsWorld():addJoint(cc.PhysicsJointPin:construct(sp2PhysicsBody, + box, + cc.p(sp2:getPosition()))) + local joint = cc.PhysicsJointRotaryLimit:construct(sp1PhysicsBody, + sp2PhysicsBody, + 0.0, + math.pi/2) + scene:getPhysicsWorld():addJoint(joint) - layer:addChild(sp1); - layer:addChild(sp2); - elseif index == 8 then - local sp1 = makeBox(cc.p(offset.x - 30, offset.y), cc.size(30, 10)); - sp1:getPhysicsBody():setTag(DRAG_BODYS_TAG); - local sp2 = makeBox(cc.p(offset.x + 30, offset.y), cc.size(30, 10)); - sp2:getPhysicsBody():setTag(DRAG_BODYS_TAG); + layer:addChild(sp1) + layer:addChild(sp2) + elseif index == 8 then + local sp1 = makeBox(cc.p(offset.x - 30, offset.y), cc.size(30, 10)) + local sp1PhysicsBody = sp1:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody() + sp1PhysicsBody:setTag(DRAG_BODYS_TAG) + + local sp2 = makeBox(cc.p(offset.x + 30, offset.y), cc.size(30, 10)) + local sp2PhysicsBody = sp2:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody() + sp2PhysicsBody:setTag(DRAG_BODYS_TAG) - scene:getPhysicsWorld():addJoint(cc.PhysicsJointPin:construct(sp1:getPhysicsBody(), box, cc.p(sp1:getPosition()))); - scene:getPhysicsWorld():addJoint(cc.PhysicsJointPin:construct(sp2:getPhysicsBody(), box, cc.p(sp2:getPosition()))); - local joint = cc.PhysicsJointRatchet:construct(sp1:getPhysicsBody(), sp2:getPhysicsBody(), 0.0, math.pi/2); - scene:getPhysicsWorld():addJoint(joint); + scene:getPhysicsWorld():addJoint(cc.PhysicsJointPin:construct(sp1PhysicsBody, + box, + cc.p(sp1:getPosition()))) + scene:getPhysicsWorld():addJoint(cc.PhysicsJointPin:construct(sp2PhysicsBody, + box, + cc.p(sp2:getPosition()))) + local joint = cc.PhysicsJointRatchet:construct(sp1PhysicsBody, + sp2PhysicsBody, + 0.0, + math.pi/2) + scene:getPhysicsWorld():addJoint(joint) - layer:addChild(sp1); - layer:addChild(sp2); - elseif index == 9 then - local sp1 = makeBox(cc.p(offset.x - 30, offset.y), cc.size(30, 10)); - sp1:getPhysicsBody():setTag(DRAG_BODYS_TAG); - local sp2 = makeBox(cc.p(offset.x + 30, offset.y), cc.size(30, 10)); - sp2:getPhysicsBody():setTag(DRAG_BODYS_TAG); + layer:addChild(sp1) + layer:addChild(sp2) + elseif index == 9 then + local sp1 = makeBox(cc.p(offset.x - 30, offset.y), cc.size(30, 10)) + local sp1PhysicsBody = sp1:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody() + sp1PhysicsBody:setTag(DRAG_BODYS_TAG) + + local sp2 = makeBox(cc.p(offset.x + 30, offset.y), cc.size(30, 10)) + local sp2PhysicsBody = sp2:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody() + sp2PhysicsBody:setTag(DRAG_BODYS_TAG) - scene:getPhysicsWorld():addJoint(cc.PhysicsJointPin:construct(sp1:getPhysicsBody(), box, cc.p(sp1:getPosition()))); - scene:getPhysicsWorld():addJoint(cc.PhysicsJointPin:construct(sp2:getPhysicsBody(), box, cc.p(sp2:getPosition()))); - local joint = cc.PhysicsJointGear:construct(sp1:getPhysicsBody(), sp2:getPhysicsBody(), 0.0, 2.0); - scene:getPhysicsWorld():addJoint(joint); + scene:getPhysicsWorld():addJoint(cc.PhysicsJointPin:construct(sp1PhysicsBody, + box, + cc.p(sp1:getPosition()))) + scene:getPhysicsWorld():addJoint(cc.PhysicsJointPin:construct(sp2PhysicsBody, + box, + cc.p(sp2:getPosition()))) + local joint = cc.PhysicsJointGear:construct(sp1PhysicsBody, sp2PhysicsBody, 0.0, 2.0) + scene:getPhysicsWorld():addJoint(joint) - layer:addChild(sp1); - layer:addChild(sp2); - elseif index == 10 then - local sp1 = makeBox(cc.p(offset.x - 30, offset.y), cc.size(30, 10)); - sp1:getPhysicsBody():setTag(DRAG_BODYS_TAG); - local sp2 = makeBox(cc.p(offset.x + 30, offset.y), cc.size(30, 10)); - sp2:getPhysicsBody():setTag(DRAG_BODYS_TAG); + layer:addChild(sp1) + layer:addChild(sp2) + elseif index == 10 then + local sp1 = makeBox(cc.p(offset.x - 30, offset.y), cc.size(30, 10)) + local sp1PhysicsBody = sp1:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody() + sp1PhysicsBody:setTag(DRAG_BODYS_TAG) + + local sp2 = makeBox(cc.p(offset.x + 30, offset.y), cc.size(30, 10)) + local sp2PhysicsBody = sp2:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody() + sp2PhysicsBody:setTag(DRAG_BODYS_TAG) - scene:getPhysicsWorld():addJoint(cc.PhysicsJointPin:construct(sp1:getPhysicsBody(), box, cc.p(sp1:getPosition()))); - scene:getPhysicsWorld():addJoint(cc.PhysicsJointPin:construct(sp2:getPhysicsBody(), box, cc.p(sp2:getPosition()))); - local joint = cc.PhysicsJointMotor:construct(sp1:getPhysicsBody(), sp2:getPhysicsBody(), math.pi/2); - scene:getPhysicsWorld():addJoint(joint); + scene:getPhysicsWorld():addJoint(cc.PhysicsJointPin:construct(sp1PhysicsBody, + box, + cc.p(sp1:getPosition()))) + scene:getPhysicsWorld():addJoint(cc.PhysicsJointPin:construct(sp2PhysicsBody, + box, + cc.p(sp2:getPosition()))) + local joint = cc.PhysicsJointMotor:construct(sp1PhysicsBody, sp2PhysicsBody, math.pi/2) + scene:getPhysicsWorld():addJoint(joint) - layer:addChild(sp1); - layer:addChild(sp2); - end + layer:addChild(sp1) + layer:addChild(sp2) + end end end end @@ -451,31 +558,38 @@ local function PhysicsDemoPyramidStack() local layer = cc.Layer:create() local function onEnter() - local touchListener = cc.EventListenerTouchOneByOne:create(); - touchListener:registerScriptHandler(onTouchBegan, cc.Handler.EVENT_TOUCH_BEGAN); - touchListener:registerScriptHandler(onTouchMoved, cc.Handler.EVENT_TOUCH_MOVED); - touchListener:registerScriptHandler(onTouchEnded, cc.Handler.EVENT_TOUCH_ENDED); + local touchListener = cc.EventListenerTouchOneByOne:create() + touchListener:registerScriptHandler(onTouchBegan, cc.Handler.EVENT_TOUCH_BEGAN) + touchListener:registerScriptHandler(onTouchMoved, cc.Handler.EVENT_TOUCH_MOVED) + touchListener:registerScriptHandler(onTouchEnded, cc.Handler.EVENT_TOUCH_ENDED) local eventDispatcher = layer:getEventDispatcher() - eventDispatcher:addEventListenerWithSceneGraphPriority(touchListener, layer); + eventDispatcher:addEventListenerWithSceneGraphPriority(touchListener, layer) - local node = cc.Node:create(); - node:setPhysicsBody(cc.PhysicsBody:createEdgeSegment(cc.p(VisibleRect:leftBottom().x, VisibleRect:leftBottom().y + 50), cc.p(VisibleRect:rightBottom().x, VisibleRect:rightBottom().y + 50))); - layer:addChild(node); + local node = cc.Node:create() + addPhysicsComponent(node, + cc.PhysicsBody:createEdgeSegment(cc.p(VisibleRect:leftBottom().x, + VisibleRect:leftBottom().y + 50), + cc.p(VisibleRect:rightBottom().x, + VisibleRect:rightBottom().y + 50))) + layer:addChild(node) - local ball = cc.Sprite:create("Images/ball.png"); - ball:setScale(1); - ball:setPhysicsBody(cc.PhysicsBody:createCircle(10)); - ball:getPhysicsBody():setTag(DRAG_BODYS_TAG); - ball:setPosition(cc.p(VisibleRect:bottom().x, VisibleRect:bottom().y + 60)); - layer:addChild(ball); + local ball = cc.Sprite:create("Images/ball.png") + ball:setScale(1) + addPhysicsComponent(ball, cc.PhysicsBody:createCircle(10)) + ball:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody():setTag(DRAG_BODYS_TAG) + ball:setPosition(cc.p(VisibleRect:bottom().x, VisibleRect:bottom().y + 60)) + layer:addChild(ball) + ball:runAction(cc.Sequence:create(cc.DelayTime:create(3), + cc.ScaleTo:create(0, 3))) + for i in range(0, 13) do - for j in range(0, i) do - local x = VisibleRect:bottom().x + (i/2 - j) * 11 - local y = VisibleRect:bottom().y + (14 - i) * 23 + 100 - local sp = addGrossiniAtPosition(layer, cc.p(x, y), 0.2); - sp:getPhysicsBody():setTag(DRAG_BODYS_TAG); - end + for j in range(0, i) do + local x = VisibleRect:bottom().x + (i/2 - j) * 11 + local y = VisibleRect:bottom().y + (14 - i) * 23 + 100 + local sp = addGrossiniAtPosition(layer, cc.p(x, y), 0.2) + sp:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody():setTag(DRAG_BODYS_TAG) + end end end @@ -490,117 +604,124 @@ local function PhysicsDemoRayCast() local function onEnter() local function onTouchEnded(touch, event) - local location = touch:getLocation(); + local location = touch:getLocation() - local r = math.random(3); - if r ==1 then - layer:addChild(makeBall(layer, location, 5 + math.random()*10)); - elseif r == 2 then - layer:addChild(makeBox(location, cc.size(10 + math.random()*15, 10 + math.random()*15))); - elseif r == 3 then - layer:addChild(makeTriangle(location, cc.size(10 + math.random()*20, 10 + math.random()*20))); - end + local r = math.random(3) + if r ==1 then + layer:addChild(makeBall(layer, location, 5 + math.random()*10)) + elseif r == 2 then + layer:addChild(makeBox(location, cc.size(10 + math.random()*15, 10 + math.random()*15))) + elseif r == 3 then + layer:addChild(makeTriangle(location, cc.size(10 + math.random()*20, 10 + math.random()*20))) + end end - local touchListener = cc.EventListenerTouchOneByOne:create(); - touchListener:registerScriptHandler(function() return true end, cc.Handler.EVENT_TOUCH_BEGAN); - touchListener:registerScriptHandler(onTouchEnded, cc.Handler.EVENT_TOUCH_ENDED); + local touchListener = cc.EventListenerTouchOneByOne:create() + touchListener:registerScriptHandler(function() return true end, cc.Handler.EVENT_TOUCH_BEGAN) + touchListener:registerScriptHandler(onTouchEnded, cc.Handler.EVENT_TOUCH_ENDED) local eventDispatcher = layer:getEventDispatcher() - eventDispatcher:addEventListenerWithSceneGraphPriority(touchListener, layer); + eventDispatcher:addEventListenerWithSceneGraphPriority(touchListener, layer) - cc.Director:getInstance():getRunningScene():getPhysicsWorld():setGravity(cc.p(0,0)); + cc.Director:getInstance():getRunningScene():getPhysicsWorld():setGravity(cc.p(0,0)) - local node = cc.DrawNode:create(); - node:setPhysicsBody(cc.PhysicsBody:createEdgeSegment(cc.p(VisibleRect:leftBottom().x, VisibleRect:leftBottom().y + 50), cc.p(VisibleRect:rightBottom().x, VisibleRect:rightBottom().y + 50))) - node:drawSegment(cc.p(VisibleRect:leftBottom().x, VisibleRect:leftBottom().y + 50), cc.p(VisibleRect:rightBottom().x, VisibleRect:rightBottom().y + 50), 1, STATIC_COLOR); - layer:addChild(node); + local node = cc.DrawNode:create() + addPhysicsComponent(node, + cc.PhysicsBody:createEdgeSegment(cc.p(VisibleRect:leftBottom().x, + VisibleRect:leftBottom().y + 50), + cc.p(VisibleRect:rightBottom().x, + VisibleRect:rightBottom().y + 50))) + node:drawSegment(cc.p(VisibleRect:leftBottom().x, VisibleRect:leftBottom().y + 50), + cc.p(VisibleRect:rightBottom().x, VisibleRect:rightBottom().y + 50), + 1, + STATIC_COLOR) + layer:addChild(node) local mode = 0 - cc.MenuItemFont:setFontSize(18); + cc.MenuItemFont:setFontSize(18) local item = cc.MenuItemFont:create("Toogle debugChange Mode(any)") local function changeModeCallback(sender) - mode = (mode + 1) % 3; + mode = (mode + 1) % 3 - if mode == 0 then - item:setString("Change Mode(any)"); - elseif mode == 1 then - item:setString("Change Mode(nearest)"); - elseif mode == 2 then - item:setString("Change Mode(multiple)"); - end + if mode == 0 then + item:setString("Change Mode(any)") + elseif mode == 1 then + item:setString("Change Mode(nearest)") + elseif mode == 2 then + item:setString("Change Mode(multiple)") + end end item:registerScriptTapHandler(changeModeCallback) - local menu = cc.Menu:create(item); - layer:addChild(menu); - menu:setPosition(cc.p(VisibleRect:left().x+100, VisibleRect:top().y-10)); + local menu = cc.Menu:create(item) + layer:addChild(menu) + menu:setPosition(cc.p(VisibleRect:left().x+100, VisibleRect:top().y-10)) local angle = 0 local drawNode = nil local function update(delta) - local L = 150.0; - local point1 = VisibleRect:center() - local d = cc.p(L * math.cos(angle), L * math.sin(angle)); - local point2 = cc.p(point1.x + d.x, point1.y + d.y) + local L = 150.0 + local point1 = VisibleRect:center() + local d = cc.p(L * math.cos(angle), L * math.sin(angle)) + local point2 = cc.p(point1.x + d.x, point1.y + d.y) - if drawNode then layer:removeChild(drawNode); end - drawNode = cc.DrawNode:create(); + if drawNode then layer:removeChild(drawNode) end + drawNode = cc.DrawNode:create() if mode == 0 then - local point3 = cc.p(point2.x, point2.y) - local function func(world, info) - point3 = info.contact - return false - end + local point3 = cc.p(point2.x, point2.y) + local function func(world, info) + point3 = info.contact + return false + end - cc.Director:getInstance():getRunningScene():getPhysicsWorld():rayCast(func, point1, point2); - drawNode:drawSegment(point1, point3, 1, STATIC_COLOR); + cc.Director:getInstance():getRunningScene():getPhysicsWorld():rayCast(func, point1, point2) + drawNode:drawSegment(point1, point3, 1, STATIC_COLOR) - if point2.x ~= point3.x or point2.y ~= point3.y then - drawNode:drawDot(point3, 2, cc.c4f(1.0, 1.0, 1.0, 1.0)); - end - layer:addChild(drawNode); - elseif mode == 1 then - local point3 = cc.p(point2.x, point2.y) - local friction = 1.0; - local function func(world, info) - if friction > info.fraction then - point3 = info.contact; - friction = info.fraction; - end - return true; - end + if point2.x ~= point3.x or point2.y ~= point3.y then + drawNode:drawDot(point3, 2, cc.c4f(1.0, 1.0, 1.0, 1.0)) + end + layer:addChild(drawNode) + elseif mode == 1 then + local point3 = cc.p(point2.x, point2.y) + local friction = 1.0 + local function func(world, info) + if friction > info.fraction then + point3 = info.contact + friction = info.fraction + end + return true + end - cc.Director:getInstance():getRunningScene():getPhysicsWorld():rayCast(func, point1, point2); - drawNode:drawSegment(point1, point3, 1, STATIC_COLOR); + cc.Director:getInstance():getRunningScene():getPhysicsWorld():rayCast(func, point1, point2) + drawNode:drawSegment(point1, point3, 1, STATIC_COLOR) - if point2.x ~= point3.x or point2.y ~= point3.y then - drawNode:drawDot(point3, 2, cc.c4f(1.0, 1.0, 1.0, 1.0)); - end - layer:addChild(drawNode); + if point2.x ~= point3.x or point2.y ~= point3.y then + drawNode:drawDot(point3, 2, cc.c4f(1.0, 1.0, 1.0, 1.0)) + end + layer:addChild(drawNode) elseif mode == 2 then - local points = {} + local points = {} - local function func(world, info) - points[#points + 1] = info.contact; - return true; - end + local function func(world, info) + points[#points + 1] = info.contact + return true + end - cc.Director:getInstance():getRunningScene():getPhysicsWorld():rayCast(func, point1, point2); - drawNode:drawSegment(point1, point2, 1, STATIC_COLOR); + cc.Director:getInstance():getRunningScene():getPhysicsWorld():rayCast(func, point1, point2) + drawNode:drawSegment(point1, point2, 1, STATIC_COLOR) - for _, p in ipairs(points) do - drawNode:drawDot(p, 2, cc.c4f(1.0, 1.0, 1.0, 1.0)); - end + for _, p in ipairs(points) do + drawNode:drawDot(p, 2, cc.c4f(1.0, 1.0, 1.0, 1.0)) + end - layer:addChild(drawNode); + layer:addChild(drawNode) end - angle = angle + 0.25 * math.pi / 180.0; + angle = angle + 0.25 * math.pi / 180.0 - end + end - layer:scheduleUpdateWithPriorityLua(update, 0); + layer:scheduleUpdateWithPriorityLua(update, 0) end initWithLayer(layer, onEnter) @@ -613,35 +734,41 @@ local function PhysicsDemoOneWayPlatform() local layer = cc.Layer:create() local function onEnter() - local touchListener = cc.EventListenerTouchOneByOne:create(); - touchListener:registerScriptHandler(onTouchBegan, cc.Handler.EVENT_TOUCH_BEGAN); - touchListener:registerScriptHandler(onTouchMoved, cc.Handler.EVENT_TOUCH_MOVED); - touchListener:registerScriptHandler(onTouchEnded, cc.Handler.EVENT_TOUCH_ENDED); + local touchListener = cc.EventListenerTouchOneByOne:create() + touchListener:registerScriptHandler(onTouchBegan, cc.Handler.EVENT_TOUCH_BEGAN) + touchListener:registerScriptHandler(onTouchMoved, cc.Handler.EVENT_TOUCH_MOVED) + touchListener:registerScriptHandler(onTouchEnded, cc.Handler.EVENT_TOUCH_ENDED) local eventDispatcher = layer:getEventDispatcher() - eventDispatcher:addEventListenerWithSceneGraphPriority(touchListener, layer); + eventDispatcher:addEventListenerWithSceneGraphPriority(touchListener, layer) - local ground = cc.Node:create(); - ground:setPhysicsBody(cc.PhysicsBody:createEdgeSegment(cc.p(VisibleRect:leftBottom().x, VisibleRect:leftBottom().y + 50), cc.p(VisibleRect:rightBottom().x, VisibleRect:rightBottom().y + 50))); - layer:addChild(ground); + local ground = cc.Node:create() + addPhysicsComponent(ground, + cc.PhysicsBody:createEdgeSegment(cc.p(VisibleRect:leftBottom().x, + VisibleRect:leftBottom().y + 50), + cc.p(VisibleRect:rightBottom().x, + VisibleRect:rightBottom().y + 50))) + layer:addChild(ground) - local platform = makeBox(VisibleRect:center(), cc.size(200, 50)); - platform:getPhysicsBody():setDynamic(false); - platform:getPhysicsBody():setContactTestBitmask(1); - layer:addChild(platform); + local platform = makeBox(VisibleRect:center(), cc.size(200, 50)) + local platformPhysicsBody = platform:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody() + platformPhysicsBody:setDynamic(false) + platformPhysicsBody:setContactTestBitmask(0xFFFFFFFF) + layer:addChild(platform) - local ball = makeBall(layer, cc.p(VisibleRect:center().x, VisibleRect:center().y - 50), 20); - ball:getPhysicsBody():setVelocity(cc.p(0, 150)); - ball:getPhysicsBody():setTag(DRAG_BODYS_TAG); - ball:getPhysicsBody():setMass(1.0); - ball:getPhysicsBody():setContactTestBitmask(1); - layer:addChild(ball); + local ball = makeBall(layer, cc.p(VisibleRect:center().x, VisibleRect:center().y - 50), 20) + local ballPhysicsBody = ball:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody() + ballPhysicsBody:setVelocity(cc.p(0, 150)) + ballPhysicsBody:setTag(DRAG_BODYS_TAG) + ballPhysicsBody:setMass(1.0) + ballPhysicsBody:setContactTestBitmask(0xFFFFFFFF) + layer:addChild(ball) local function onContactBegin(contact) - return contact:getContactData().normal.y < 0; + return contact:getContactData().normal.y < 0 end - local contactListener = cc.EventListenerPhysicsContactWithBodies:create(platform:getPhysicsBody(), ball:getPhysicsBody()); - contactListener:registerScriptHandler(onContactBegin, cc.Handler.EVENT_PHYSICS_CONTACT_BEGIN); - eventDispatcher:addEventListenerWithSceneGraphPriority(contactListener, layer); + local contactListener = cc.EventListenerPhysicsContactWithBodies:create(platformPhysicsBody, ballPhysicsBody) + contactListener:registerScriptHandler(onContactBegin, cc.Handler.EVENT_PHYSICS_CONTACT_BEGIN) + eventDispatcher:addEventListenerWithSceneGraphPriority(contactListener, layer) end initWithLayer(layer, onEnter) @@ -660,27 +787,31 @@ local function PhysicsDemoActions() local eventDispatcher = layer:getEventDispatcher() eventDispatcher:addEventListenerWithSceneGraphPriority(touchListener, layer) - local node = cc.Node:create(); - node:setPhysicsBody(cc.PhysicsBody:createEdgeBox(cc.size(VisibleRect:getVisibleRect().width, VisibleRect:getVisibleRect().height))); - node:setPosition(VisibleRect:center()); - layer:addChild(node); + local node = cc.Node:create() + addPhysicsComponent(node, + cc.PhysicsBody:createEdgeBox(cc.size(VisibleRect:getVisibleRect().width, + VisibleRect:getVisibleRect().height))) + node:setPosition(VisibleRect:center()) + layer:addChild(node) - local sp1 = addGrossiniAtPosition(layer, VisibleRect:center()); - local sp2 = addGrossiniAtPosition(layer, cc.p(VisibleRect:left().x + 50, VisibleRect:left().y)); - local sp3 = addGrossiniAtPosition(layer, cc.p(VisibleRect:right().x - 20, VisibleRect:right().y)); - local sp4 = addGrossiniAtPosition(layer, cc.p(VisibleRect:leftTop().x + 50, VisibleRect:leftTop().y-50)); - sp4:getPhysicsBody():setGravityEnable(false); + local sp1 = addGrossiniAtPosition(layer, VisibleRect:center()) + local sp2 = addGrossiniAtPosition(layer, cc.p(VisibleRect:left().x + 50, VisibleRect:left().y)) + local sp3 = addGrossiniAtPosition(layer, cc.p(VisibleRect:right().x - 20, VisibleRect:right().y)) + local sp4 = addGrossiniAtPosition(layer, cc.p(VisibleRect:leftTop().x + 50, VisibleRect:leftTop().y-50)) + sp4:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody():setGravityEnable(false) - local actionTo = cc.JumpTo:create(2, cc.p(100,100), 50, 4); - local actionBy = cc.JumpBy:create(2, cc.p(300,0), 50, 4); - local actionUp = cc.JumpBy:create(2, cc.p(0,50), 80, 4); - local actionByBack = actionBy:reverse(); + local actionTo = cc.JumpTo:create(2, cc.p(100,100), 50, 4) + local actionBy = cc.JumpBy:create(2, cc.p(300,0), 50, 4) + local actionUp = cc.JumpBy:create(2, cc.p(0,50), 80, 4) + local actionByBack = actionBy:reverse() + local rotateBy = cc.RotateBy:create(2, 180) + local rotateByBack = cc.RotateBy:create(2, -180) - sp1:runAction(cc.RepeatForever:create(actionUp)); - sp2:runAction(cc.RepeatForever:create(cc.Sequence:create(actionBy, actionByBack))); - sp3:runAction(actionTo); - sp4:runAction(cc.RepeatForever:create(cc.Sequence:create(actionBy:clone(), actionByBack:clone()))); + sp1:runAction(cc.RepeatForever:create(actionUp)) + sp2:runAction(cc.RepeatForever:create(cc.Sequence:create(actionBy, actionByBack))) + sp3:runAction(actionTo) + sp4:runAction(cc.RepeatForever:create(cc.Sequence:create(rotateBy, rotateByBack))) end initWithLayer(layer, onEnter) @@ -692,24 +823,24 @@ end local function PhysicsDemoPump() local layer = cc.Layer:create() local function onEnter() - layer:toggleDebug(); + layer:toggleDebug() - local distance = 0.0; - local rotationV = 0.0; + local distance = 0.0 + local rotationV = 0.0 local function onTouchBeganEx(touch, event) onTouchBegan(touch, event) - distance = touch:getLocation().x - VisibleRect:center().x; - return true; + distance = touch:getLocation().x - VisibleRect:center().x + return true end local function onTouchMovedEx(touch, event) - onTouchMoved(touch, event); - distance = touch:getLocation().x - VisibleRect:center().x; + onTouchMoved(touch, event) + distance = touch:getLocation().x - VisibleRect:center().x end local function onTouchEndedEx(touch, event) onTouchEnded(touch, event) - distance = 0; + distance = 0 end local touchListener = cc.EventListenerTouchOneByOne:create() @@ -722,63 +853,89 @@ local function PhysicsDemoPump() local function update() for _, body in ipairs(cc.Director:getInstance():getRunningScene():getPhysicsWorld():getAllBodies()) do if body:getTag() == DRAG_BODYS_TAG and body:getPosition().y < 0.0 then - body:getNode():setPosition(cc.p(VisibleRect:leftTop().x + 75, VisibleRect:leftTop().y + math.random() * 90, 0)); - body:setVelocity(cc.p(0, 0)); + body:getNode():setPosition(cc.p(VisibleRect:leftTop().x + 75, + VisibleRect:leftTop().y + math.random() * 90)) + body:setVelocity(cc.p(0, 0)) end end - local gear = cc.Director:getInstance():getRunningScene():getPhysicsWorld():getBody(1); + local gear = cc.Director:getInstance():getRunningScene():getPhysicsWorld():getBody(1) if gear then if distance ~= 0.0 then - rotationV = rotationV + distance/2500.0; + rotationV = rotationV + distance/2500.0 end if rotationV > 30 then rotationV = 30.0 end if rotationV < -30 then rotationV = -30.0 end - gear:setAngularVelocity(rotationV); - rotationV = rotationV*0.995; + gear:setAngularVelocity(rotationV) + rotationV = rotationV * 0.995 end end - layer:scheduleUpdateWithPriorityLua(update, 0); + layer:scheduleUpdateWithPriorityLua(update, 0) - local node = cc.Node:create(); - local body = cc.PhysicsBody:create(); - body:setDynamic(false); + local node = cc.Node:create() + local body = cc.PhysicsBody:create() + body:setDynamic(false) - local staticMaterial = cc.PhysicsMaterial(cc.PHYSICS_INFINITY, 0, 0.5); - body:addShape(cc.PhysicsShapeEdgeSegment:create( - cc.p(VisibleRect:leftTop().x + 50, VisibleRect:leftTop().y), - cc.p(VisibleRect:leftTop().x + 50, VisibleRect:leftTop().y-130), staticMaterial, 2.0)); - body:addShape(cc.PhysicsShapeEdgeSegment:create( - cc.p(VisibleRect:leftTop().x + 190, VisibleRect:leftTop().y), - cc.p(VisibleRect:leftTop().x + 100, VisibleRect:leftTop().y-50), staticMaterial, 2.0)); - body:addShape(cc.PhysicsShapeEdgeSegment:create( - cc.p(VisibleRect:leftTop().x + 100, VisibleRect:leftTop().y-50), - cc.p(VisibleRect:leftTop().x + 100, VisibleRect:leftTop().y-90), staticMaterial, 2.0)); - body:addShape(cc.PhysicsShapeEdgeSegment:create( - cc.p(VisibleRect:leftTop().x + 50, VisibleRect:leftTop().y-130), - cc.p(VisibleRect:leftTop().x + 100, VisibleRect:leftTop().y-145), staticMaterial, 2.0)); - body:addShape(cc.PhysicsShapeEdgeSegment:create( - cc.p(VisibleRect:leftTop().x + 100, VisibleRect:leftTop().y-145), - cc.p(VisibleRect:leftBottom().x + 100, VisibleRect:leftBottom().y + 80), staticMaterial, 2.0)); - body:addShape(cc.PhysicsShapeEdgeSegment:create( - cc.p(VisibleRect:leftTop().x + 150, VisibleRect:leftTop().y-80), - cc.p(VisibleRect:leftBottom().x + 150, VisibleRect:leftBottom().y + 80), staticMaterial, 2.0)); - body:addShape(cc.PhysicsShapeEdgeSegment:create( - cc.p(VisibleRect:leftTop().x + 150, VisibleRect:leftTop().y-80), - cc.p(VisibleRect:rightTop().x -100, VisibleRect:rightTop().y-150), staticMaterial, 2.0)); + local staticMaterial = cc.PhysicsMaterial(cc.PHYSICS_INFINITY, 0, 0.5) + body:addShape(cc.PhysicsShapeEdgeSegment:create(cc.p(VisibleRect:leftTop().x + 50, + VisibleRect:leftTop().y), + cc.p(VisibleRect:leftTop().x + 50, + VisibleRect:leftTop().y-130), + staticMaterial, + 2.0)) + body:addShape(cc.PhysicsShapeEdgeSegment:create(cc.p(VisibleRect:leftTop().x + 190, + VisibleRect:leftTop().y), + cc.p(VisibleRect:leftTop().x + 100, + VisibleRect:leftTop().y-50), + staticMaterial, + 2.0)) + body:addShape(cc.PhysicsShapeEdgeSegment:create(cc.p(VisibleRect:leftTop().x + 100, + VisibleRect:leftTop().y-50), + cc.p(VisibleRect:leftTop().x + 100, + VisibleRect:leftTop().y-90), + staticMaterial, + 2.0)) + body:addShape(cc.PhysicsShapeEdgeSegment:create(cc.p(VisibleRect:leftTop().x + 50, + VisibleRect:leftTop().y-130), + cc.p(VisibleRect:leftTop().x + 100, + VisibleRect:leftTop().y-145), + staticMaterial, + 2.0)) + body:addShape(cc.PhysicsShapeEdgeSegment:create(cc.p(VisibleRect:leftTop().x + 100, + VisibleRect:leftTop().y-145), + cc.p(VisibleRect:leftBottom().x + 100, + VisibleRect:leftBottom().y + 80), + staticMaterial, + 2.0)) + body:addShape(cc.PhysicsShapeEdgeSegment:create(cc.p(VisibleRect:leftTop().x + 150, + VisibleRect:leftTop().y-80), + cc.p(VisibleRect:leftBottom().x + 150, + VisibleRect:leftBottom().y + 80), + staticMaterial, + 2.0)) + body:addShape(cc.PhysicsShapeEdgeSegment:create(cc.p(VisibleRect:leftTop().x + 150, + VisibleRect:leftTop().y-80), + cc.p(VisibleRect:rightTop().x -100, + VisibleRect:rightTop().y-150), + staticMaterial, + 2.0)) - body:setCategoryBitmask(1); + body:setCategoryBitmask(1) for _ in range(1, 6) do - local ball = makeBall(layer, cc.p(VisibleRect:leftTop().x + 75 + math.random() * 90, VisibleRect:leftTop().y), 22, cc.PhysicsMaterial(0.05, 0.0, 0.1)); - ball:getPhysicsBody():setTag(DRAG_BODYS_TAG); - layer:addChild(ball); + local ball = makeBall(layer, + cc.p(VisibleRect:leftTop().x + 75 + math.random() * 90, + VisibleRect:leftTop().y), + 22, + cc.PhysicsMaterial(0.05, 0.0, 0.1)) + ball:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody():setTag(DRAG_BODYS_TAG) + layer:addChild(ball) end - node:setPhysicsBody(body); - layer:addChild(node); + addPhysicsComponent(node, body) + layer:addChild(node) local vec = { @@ -786,61 +943,72 @@ local function PhysicsDemoPump() cc.p(VisibleRect:leftTop().x + 148, VisibleRect:leftTop().y-161), cc.p(VisibleRect:leftBottom().x + 148, VisibleRect:leftBottom().y + 20), cc.p(VisibleRect:leftBottom().x + 102, VisibleRect:leftBottom().y + 20) - }; + } - local world = cc.Director:getInstance():getRunningScene():getPhysicsWorld(); + local world = cc.Director:getInstance():getRunningScene():getPhysicsWorld() -- small gear - local sgear = cc.Node:create(); - local sgearB = cc.PhysicsBody:createCircle(44); - sgear:setPhysicsBody(sgearB); - sgear:setPosition(cc.p(VisibleRect:leftBottom().x + 125, VisibleRect:leftBottom().y)); - layer:addChild(sgear); - sgearB:setCategoryBitmask(4); - sgearB:setCollisionBitmask(4); - sgearB:setTag(1); - world:addJoint(cc.PhysicsJointPin:construct(body, sgearB, cc.p(sgear:getPosition()))); + local sgear = cc.Node:create() + local sgearB = cc.PhysicsBody:createCircle(44) + addPhysicsComponent(sgear, sgearB) + sgear:setPosition(cc.p(VisibleRect:leftBottom().x + 125, VisibleRect:leftBottom().y)) + layer:addChild(sgear) + sgearB:setCategoryBitmask(4) + sgearB:setCollisionBitmask(4) + sgearB:setTag(1) + world:addJoint(cc.PhysicsJointPin:construct(body, sgearB, cc.p(sgear:getPosition()))) -- big gear - local bgear = cc.Node:create(); - local bgearB = cc.PhysicsBody:createCircle(100); - bgear:setPhysicsBody(bgearB); - bgear:setPosition(cc.p(VisibleRect:leftBottom().x + 275, VisibleRect:leftBottom().y)); - layer:addChild(bgear); - bgearB:setCategoryBitmask(4); - world:addJoint(cc.PhysicsJointPin:construct(body, bgearB, cc.p(bgear:getPosition()))); + local bgear = cc.Node:create() + local bgearB = cc.PhysicsBody:createCircle(100) + addPhysicsComponent(bgear, bgearB) + bgear:setPosition(cc.p(VisibleRect:leftBottom().x + 275, VisibleRect:leftBottom().y)) + layer:addChild(bgear) + bgearB:setCategoryBitmask(4) + world:addJoint(cc.PhysicsJointPin:construct(body, bgearB, cc.p(bgear:getPosition()))) -- pump - local pump = cc.Node:create(); - local center = cc.PhysicsShape:getPolyonCenter(vec); - pump:setPosition(center); - local pumpB = cc.PhysicsBody:createPolygon(vec, cc.PHYSICSBODY_MATERIAL_DEFAULT, cc.p(-center.x, -center.y)); - pump:setPhysicsBody(pumpB); - layer:addChild(pump); - pumpB:setCategoryBitmask(2); - pumpB:setGravityEnable(false); - world:addJoint(cc.PhysicsJointDistance:construct(pumpB, sgearB, cc.p(0, 0), cc.p(0, -44))); + local pump = cc.Node:create() + local center = cc.PhysicsShape:getPolyonCenter(vec) + pump:setPosition(center) + local pumpB = cc.PhysicsBody:createPolygon(vec, + cc.PHYSICSBODY_MATERIAL_DEFAULT, + cc.p(-center.x, -center.y)) + addPhysicsComponent(pump, pumpB) + layer:addChild(pump) + pumpB:setCategoryBitmask(2) + pumpB:setGravityEnable(false) + world:addJoint(cc.PhysicsJointDistance:construct(pumpB, sgearB, cc.p(0, 0), cc.p(0, -44))) -- plugger - local seg = {cc.p(VisibleRect:leftTop().x + 75, VisibleRect:leftTop().y-120), cc.p(VisibleRect:leftBottom().x + 75, VisibleRect:leftBottom().y-100)}; - local segCenter = cc.p((seg[2].x + seg[1].x)/2, (seg[2].y + seg[1].y)/2); - seg[2] = cc.p(seg[2].x - segCenter.x, seg[2].y - segCenter.y); - seg[1] = cc.p(seg[1].x - segCenter.x, seg[1].y - segCenter.y); - local plugger = cc.Node:create(); - local pluggerB = cc.PhysicsBody:createEdgeSegment(seg[1], seg[2], cc.PhysicsMaterial(0.01, 0.0, 0.5), 20); - pluggerB:setDynamic(true); - pluggerB:setMass(30); - pluggerB:setMoment(100000); - plugger:setPhysicsBody(pluggerB); - plugger:setPosition(segCenter); - layer:addChild(plugger); - pluggerB:setCategoryBitmask(2); - sgearB:setCollisionBitmask(5); - world:addJoint(cc.PhysicsJointPin:construct(body, pluggerB, cc.p(VisibleRect:leftBottom().x + 75, VisibleRect:leftBottom().y-90))); - world:addJoint(cc.PhysicsJointDistance:construct(pluggerB, sgearB, - pluggerB:world2Local(cc.p(0,0)), cc.p(44, 0))); + local seg = {cc.p(VisibleRect:leftTop().x + 75, VisibleRect:leftTop().y-120), + cc.p(VisibleRect:leftBottom().x + 75, VisibleRect:leftBottom().y-100)} + local segCenter = cc.p((seg[2].x + seg[1].x)/2, (seg[2].y + seg[1].y)/2) + seg[2] = cc.p(seg[2].x - segCenter.x, seg[2].y - segCenter.y) + seg[1] = cc.p(seg[1].x - segCenter.x, seg[1].y - segCenter.y) + local plugger = cc.Node:create() + local pluggerB = cc.PhysicsBody:createEdgeSegment(seg[1], + seg[2], + cc.PhysicsMaterial(0.01, 0.0, 0.5), + 20) + pluggerB:setDynamic(true) + pluggerB:setMass(30) + pluggerB:setMoment(100000) + addPhysicsComponent(plugger, pluggerB) + plugger:setPosition(segCenter) + layer:addChild(plugger) + pluggerB:setCategoryBitmask(2) + sgearB:setCollisionBitmask(5) + world:addJoint(cc.PhysicsJointPin:construct(body, + pluggerB, + cc.p(VisibleRect:leftBottom().x + 75, + VisibleRect:leftBottom().y-90))) + world:addJoint(cc.PhysicsJointDistance:construct(pluggerB, + sgearB, + pluggerB:world2Local(cc.p(0,0)), + cc.p(44, 0))) end initWithLayer(layer, onEnter) @@ -854,83 +1022,90 @@ local function PhysicsDemoSlice() local layer = cc.Layer:create() local function onEnter() layer:toggleDebug() - local sliceTag = 1; + local sliceTag = 1 local function clipPoly(shape, normal, distance) - local body = shape:getBody(); - local count = shape:getPointsCount(); + local body = shape:getBody() + local count = shape:getPointsCount() local points = {} local j = count - 1 for i in range(0, count-1) do - local a = body:local2World(shape:getPoint(j)); - local aDist = cc.pDot(a, normal) - distance; + local a = body:local2World(shape:getPoint(j)) + local aDist = cc.pDot(a, normal) - distance if aDist < 0.0 then - points[#points + 1] = a; + points[#points + 1] = a end - local b = body:local2World(shape:getPoint(i)); - local bDist = cc.pDot(b, normal) - distance; + local b = body:local2World(shape:getPoint(i)) + local bDist = cc.pDot(b, normal) - distance if aDist*bDist < 0.0 then - local t = math.abs(aDist)/(math.abs(aDist) + math.abs(bDist)); - points[#points + 1] = cc.pLerp(a, b, t); + local t = math.abs(aDist)/(math.abs(aDist) + math.abs(bDist)) + points[#points + 1] = cc.pLerp(a, b, t) end j = i end - local center = cc.PhysicsShape:getPolyonCenter(points); - local node = cc.Node:create(); - local polyon = cc.PhysicsBody:createPolygon(points, cc.PHYSICSBODY_MATERIAL_DEFAULT, cc.p(-center.x, -center.y)); - node:setPosition(center); - node:setPhysicsBody(polyon); - polyon:setVelocity(body:getVelocityAtWorldPoint(center)); - polyon:setAngularVelocity(body:getAngularVelocity()); - polyon.tag = sliceTag; - layer:addChild(node); + local center = cc.PhysicsShape:getPolyonCenter(points) + local node = cc.Node:create() + local polyon = cc.PhysicsBody:createPolygon(points, + cc.PHYSICSBODY_MATERIAL_DEFAULT, + cc.p(-center.x, -center.y)) + node:setPosition(center) + addPhysicsComponent(node, polyon) + polyon:setVelocity(body:getVelocityAtWorldPoint(center)) + polyon:setAngularVelocity(body:getAngularVelocity()) + polyon.tag = sliceTag + layer:addChild(node) end local function slice(world, info) if info.shape:getBody().tag ~= sliceTag then - return true; + return true end if not info.shape:containsPoint(info.start) and not info.shape:containsPoint(info.ended) then - local normal = cc.p(info.ended.x - info.start.x, info.ended.y - info.start.y); - normal = cc.pNormalize(cc.pPerp(normal)); - local dist = cc.pDot(info.start, normal); + local normal = cc.p(info.ended.x - info.start.x, info.ended.y - info.start.y) + normal = cc.pNormalize(cc.pPerp(normal)) + local dist = cc.pDot(info.start, normal) - clipPoly(info.shape, normal, dist); - clipPoly(info.shape, cc.p(-normal.x, -normal.y), -dist); + clipPoly(info.shape, normal, dist) + clipPoly(info.shape, cc.p(-normal.x, -normal.y), -dist) - info.shape:getBody():removeFromWorld(); + info.shape:getBody():removeFromWorld() end - return true; + return true end local function onTouchEnded(touch, event) - cc.Director:getInstance():getRunningScene():getPhysicsWorld():rayCast(slice, touch:getStartLocation(), touch:getLocation()); + cc.Director:getInstance():getRunningScene():getPhysicsWorld():rayCast(slice, + touch:getStartLocation(), + touch:getLocation()) end - local touchListener = cc.EventListenerTouchOneByOne:create(); - touchListener:registerScriptHandler(function() return true end, cc.Handler.EVENT_TOUCH_BEGAN); - touchListener:registerScriptHandler(onTouchEnded, cc.Handler.EVENT_TOUCH_ENDED); + local touchListener = cc.EventListenerTouchOneByOne:create() + touchListener:registerScriptHandler(function() return true end, cc.Handler.EVENT_TOUCH_BEGAN) + touchListener:registerScriptHandler(onTouchEnded, cc.Handler.EVENT_TOUCH_ENDED) local eventDispatcher = layer:getEventDispatcher() - eventDispatcher:addEventListenerWithSceneGraphPriority(touchListener, layer); + eventDispatcher:addEventListenerWithSceneGraphPriority(touchListener, layer) - local ground = cc.Node:create(); - ground:setPhysicsBody(cc.PhysicsBody:createEdgeSegment(cc.p(VisibleRect:leftBottom().x, VisibleRect:leftBottom().y + 50), - cc.p(VisibleRect:rightBottom().x, VisibleRect:rightBottom().y + 50))); - layer:addChild(ground); + local ground = cc.Node:create() + addPhysicsComponent(ground, + cc.PhysicsBody:createEdgeSegment(cc.p(VisibleRect:leftBottom().x, + VisibleRect:leftBottom().y + 50), + cc.p(VisibleRect:rightBottom().x, + VisibleRect:rightBottom().y + 50))) + layer:addChild(ground) - local box = cc.Node:create(); - local points = {cc.p(-100, -100), cc.p(-100, 100), cc.p(100, 100), cc.p(100, -100)}; - box:setPhysicsBody(cc.PhysicsBody:createPolygon(points)); - box:setPosition(VisibleRect:center()); - box:getPhysicsBody().tag = sliceTag; - layer:addChild(box); + local box = cc.Node:create() + local points = {cc.p(-100, -100), cc.p(-100, 100), cc.p(100, 100), cc.p(100, -100)} + addPhysicsComponent(box, cc.PhysicsBody:createPolygon(points)) + box:setPosition(VisibleRect:center()) + box:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody().tag = sliceTag + layer:addChild(box) end initWithLayer(layer, onEnter) @@ -944,17 +1119,19 @@ end local function PhysicsDemoBug3988() local layer = cc.Layer:create() local function onEnter() - layer:toggleDebug(); - cc.Director:getInstance():getRunningScene():getPhysicsWorld():setGravity(cc.p(0, 0)); + layer:toggleDebug() + cc.Director:getInstance():getRunningScene():getPhysicsWorld():setGravity(cc.p(0, 0)) - local ball = cc.Sprite:create("Images/YellowSquare.png"); - ball:setPosition(cc.p(VisibleRect:center().x-100, VisibleRect:center().y)); - ball:setRotation(30.0); - layer:addChild(ball); + local ball = cc.Sprite:create("Images/YellowSquare.png") + ball:setPosition(cc.p(VisibleRect:center().x-100, VisibleRect:center().y)) + ball:setRotation(30.0) + layer:addChild(ball) - local physicsBall = makeBox(cc.p(VisibleRect:center().x+100, VisibleRect:center().y), cc.size(100, 100)); - physicsBall:setRotation(30.0); - layer:addChild(physicsBall); + local physicsBall = makeBox(cc.p(VisibleRect:center().x+100, + VisibleRect:center().y), + cc.size(100, 100)) + physicsBall:setRotation(30.0) + layer:addChild(physicsBall) end initWithLayer(layer, onEnter) @@ -967,123 +1144,134 @@ end local function PhysicsContactTest() local layer = cc.Layer:create() local function onEnter() - cc.Director:getInstance():getRunningScene():getPhysicsWorld():setGravity(cc.p(0, 0)); - local s = cc.size(VisibleRect:getVisibleRect().width, VisibleRect:getVisibleRect().height); + cc.Director:getInstance():getRunningScene():getPhysicsWorld():setGravity(cc.p(0, 0)) + local s = cc.size(VisibleRect:getVisibleRect().width, VisibleRect:getVisibleRect().height) - layer.yellowBoxNum = 50; - layer.blueBoxNum = 50; - layer.yellowTriangleNum = 50; - layer.blueTriangleNum = 50; + layer.yellowBoxNum = 50 + layer.blueBoxNum = 50 + layer.yellowTriangleNum = 50 + layer.blueTriangleNum = 50 local function onContactBegin(contact) - local a = contact:getShapeA():getBody(); - local b = contact:getShapeB():getBody(); - local body = (a:getCategoryBitmask() == 4 or a:getCategoryBitmask() == 8) and a or b; + local a = contact:getShapeA():getBody() + local b = contact:getShapeB():getBody() + local body = (a:getCategoryBitmask() == 4 or a:getCategoryBitmask() == 8) and a or b - assert(body:getCategoryBitmask() == 4 or body:getCategoryBitmask() == 8, "physics contact fail"); + assert(body:getCategoryBitmask() == 4 or body:getCategoryBitmask() == 8, "physics contact fail") - return true; + return true end local function resetTest() - layer:removeChildByTag(10); - local root = cc.Node:create(); - root:setTag(10); - layer:addChild(root); + layer:removeChildByTag(10) + local root = cc.Node:create() + root:setTag(10) + layer:addChild(root) - local s = cc.size(VisibleRect:getVisibleRect().width, VisibleRect:getVisibleRect().height); + local s = cc.size(VisibleRect:getVisibleRect().width, VisibleRect:getVisibleRect().height) - local label = cc.Label:createWithTTF(tostring(layer.yellowBoxNum), s_arialPath, 32); - root:addChild(label, 1); - label:setAnchorPoint(cc.p(0.5, 0.5)); - label:setPosition(cc.p(s.width/2, s.height-50)); + local label = cc.Label:createWithTTF(tostring(layer.yellowBoxNum), s_arialPath, 32) + root:addChild(label, 1) + label:setAnchorPoint(cc.p(0.5, 0.5)) + label:setPosition(cc.p(s.width/2, s.height-50)) - label = cc.Label:createWithTTF(tostring(layer.blueBoxNum), s_arialPath, 32); - root:addChild(label, 1); - label:setAnchorPoint(cc.p(0.5, 0.5)); - label:setPosition(cc.p(s.width/2, s.height-90)); + label = cc.Label:createWithTTF(tostring(layer.blueBoxNum), s_arialPath, 32) + root:addChild(label, 1) + label:setAnchorPoint(cc.p(0.5, 0.5)) + label:setPosition(cc.p(s.width/2, s.height-90)) - label = cc.Label:createWithTTF(tostring(layer.yellowTriangleNum), s_arialPath, 32); - root:addChild(label, 1); - label:setAnchorPoint(cc.p(0.5, 0.5)); - label:setPosition(cc.p(s.width/2, s.height-130)); + label = cc.Label:createWithTTF(tostring(layer.yellowTriangleNum), s_arialPath, 32) + root:addChild(label, 1) + label:setAnchorPoint(cc.p(0.5, 0.5)) + label:setPosition(cc.p(s.width/2, s.height-130)) - label = cc.Label:createWithTTF(tostring(layer.blueTriangleNum), s_arialPath, 32); - root:addChild(label, 1); - label:setAnchorPoint(cc.p(0.5, 0.5)); - label:setPosition(cc.p(s.width/2, s.height-170)); + label = cc.Label:createWithTTF(tostring(layer.blueTriangleNum), s_arialPath, 32) + root:addChild(label, 1) + label:setAnchorPoint(cc.p(0.5, 0.5)) + label:setPosition(cc.p(s.width/2, s.height-170)) - local wall = cc.Node:create(); - wall:setPhysicsBody(cc.PhysicsBody:createEdgeBox(s, cc.PhysicsMaterial(0.1, 1, 0.0))); - wall:setPosition(VisibleRect:center()); - root:addChild(wall); + local wall = cc.Node:create() + addPhysicsComponent(wall, cc.PhysicsBody:createEdgeBox(s, cc.PhysicsMaterial(0.1, 1, 0.0))) + wall:setPosition(VisibleRect:center()) + root:addChild(wall) -- yellow box, will collide with itself and blue box. for i = 1, layer.yellowBoxNum do - local size = cc.size(10 + math.random()*10, 10 + math.random()*10); - local winSize = cc.size(VisibleRect:getVisibleRect().width, VisibleRect:getVisibleRect().height); - local position = cc.p(winSize.width - size.width, winSize.height - size.height); - position.x = position.x * math.random(); - position.y = position.y * math.random(); - position = cc.p(VisibleRect:leftBottom().x + position.x + size.width/2, VisibleRect:leftBottom().y + position.y + size.height/2); - local velocity = cc.p((math.random() - 0.5)*200, (math.random() - 0.5)*200); - local box = makeBox(position, size, 1, cc.PhysicsMaterial(0.1, 1, 0.0)); - box:getPhysicsBody():setVelocity(velocity); - box:getPhysicsBody():setCategoryBitmask(1); -- 0001 - box:getPhysicsBody():setContactTestBitmask(4); -- 0100 - box:getPhysicsBody():setCollisionBitmask(3); -- 0011 - root:addChild(box); + local size = cc.size(10 + math.random()*10, 10 + math.random()*10) + local winSize = cc.size(VisibleRect:getVisibleRect().width, + VisibleRect:getVisibleRect().height) + local position = cc.p(winSize.width - size.width, winSize.height - size.height) + position.x = position.x * math.random() + position.y = position.y * math.random() + position = cc.p(VisibleRect:leftBottom().x + position.x + size.width/2, + VisibleRect:leftBottom().y + position.y + size.height/2) + local velocity = cc.p((math.random() - 0.5)*200, (math.random() - 0.5)*200) + local box = makeBox(position, size, 1, cc.PhysicsMaterial(0.1, 1, 0.0)) + local boxPhysicsBody = box:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody() + boxPhysicsBody:setVelocity(velocity) + boxPhysicsBody:setCategoryBitmask(1) -- 0001 + boxPhysicsBody:setContactTestBitmask(4) -- 0100 + boxPhysicsBody:setCollisionBitmask(3) -- 0011 + root:addChild(box) end -- blue box, will collide with blue box. for i = 1, layer.blueBoxNum do - local size = cc.size(10 + math.random()*10, 10 + math.random()*10); - local winSize = cc.size(VisibleRect:getVisibleRect().width, VisibleRect:getVisibleRect().height); - local position = cc.p(winSize.width - size.width, winSize.height - size.height); - position.x = position.x * math.random(); - position.y = position.y * math.random(); - position = cc.p(VisibleRect:leftBottom().x + position.x + size.width/2, VisibleRect:leftBottom().y + position.y + size.height/2); - local velocity = cc.p((math.random() - 0.5)*200, (math.random() - 0.5)*200); - local box = makeBox(position, size, 2, cc.PhysicsMaterial(0.1, 1, 0.0)); - box:getPhysicsBody():setVelocity(velocity); - box:getPhysicsBody():setCategoryBitmask(2); -- 0010 - box:getPhysicsBody():setContactTestBitmask(8); -- 1000 - box:getPhysicsBody():setCollisionBitmask(1); -- 0001 - root:addChild(box); + local size = cc.size(10 + math.random()*10, 10 + math.random()*10) + local winSize = cc.size(VisibleRect:getVisibleRect().width, VisibleRect:getVisibleRect().height) + local position = cc.p(winSize.width - size.width, winSize.height - size.height) + position.x = position.x * math.random() + position.y = position.y * math.random() + position = cc.p(VisibleRect:leftBottom().x + position.x + size.width/2, + VisibleRect:leftBottom().y + position.y + size.height/2) + local velocity = cc.p((math.random() - 0.5)*200, (math.random() - 0.5)*200) + local box = makeBox(position, size, 2, cc.PhysicsMaterial(0.1, 1, 0.0)) + local boxPhysicsBody = box:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody() + boxPhysicsBody:setVelocity(velocity) + boxPhysicsBody:setCategoryBitmask(2) -- 0010 + boxPhysicsBody:setContactTestBitmask(8) -- 1000 + boxPhysicsBody:setCollisionBitmask(1) -- 0001 + root:addChild(box) end -- yellow triangle, will collide with itself and blue box. for i = 1, layer.yellowTriangleNum do - local size = cc.size(10 + math.random()*10, 10 + math.random()*10); - local winSize = cc.size(VisibleRect:getVisibleRect().width, VisibleRect:getVisibleRect().height); - local position = cc.p(winSize.width - size.width, winSize.height - size.height); - position.x = position.x * math.random(); - position.y = position.y * math.random(); - position = cc.p(VisibleRect:leftBottom().x + position.x + size.width/2, VisibleRect:leftBottom().y + position.y + size.height/2); - local velocity = cc.p((math.random() - 0.5)*200, (math.random() - 0.5)*200); - local triangle = makeTriangle(position, size, 1, cc.PhysicsMaterial(0.1, 1, 0.0)); - triangle:getPhysicsBody():setVelocity(velocity); - triangle:getPhysicsBody():setCategoryBitmask(4); -- 0100 - triangle:getPhysicsBody():setContactTestBitmask(1); -- 0001 - triangle:getPhysicsBody():setCollisionBitmask(6); -- 0110 - root:addChild(triangle); + local size = cc.size(10 + math.random()*10, 10 + math.random()*10) + local winSize = cc.size(VisibleRect:getVisibleRect().width, + VisibleRect:getVisibleRect().height) + local position = cc.p(winSize.width - size.width, winSize.height - size.height) + position.x = position.x * math.random() + position.y = position.y * math.random() + position = cc.p(VisibleRect:leftBottom().x + position.x + size.width/2, + VisibleRect:leftBottom().y + position.y + size.height/2) + local velocity = cc.p((math.random() - 0.5)*200, (math.random() - 0.5)*200) + local triangle = makeTriangle(position, size, 1, cc.PhysicsMaterial(0.1, 1, 0.0)) + local trianglePhysicsBody = triangle:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody() + trianglePhysicsBody:setVelocity(velocity) + trianglePhysicsBody:setCategoryBitmask(4) -- 0100 + trianglePhysicsBody:setContactTestBitmask(1) -- 0001 + trianglePhysicsBody:setCollisionBitmask(6) -- 0110 + root:addChild(triangle) end -- blue triangle, will collide with yellow box. for i = 1, layer.blueTriangleNum do - local size = cc.size(10 + math.random()*10, 10 + math.random()*10); - local winSize = cc.size(VisibleRect:getVisibleRect().width, VisibleRect:getVisibleRect().height); - local position = cc.p(winSize.width - size.width, winSize.height - size.height); - position.x = position.x * math.random(); - position.y = position.y * math.random(); - position = cc.p(VisibleRect:leftBottom().x + position.x + size.width/2, VisibleRect:leftBottom().y + position.y + size.height/2); - local velocity = cc.p((math.random() - 0.5)*200, (math.random() - 0.5)*200); - local triangle = makeTriangle(position, size, 2, cc.PhysicsMaterial(0.1, 1, 0.0)); - triangle:getPhysicsBody():setVelocity(velocity); - triangle:getPhysicsBody():setCategoryBitmask(8); -- 1000 - triangle:getPhysicsBody():setContactTestBitmask(2); -- 0010 - triangle:getPhysicsBody():setCollisionBitmask(1); -- 0001 - root:addChild(triangle); + local size = cc.size(10 + math.random()*10, 10 + math.random()*10) + local winSize = cc.size(VisibleRect:getVisibleRect().width, + VisibleRect:getVisibleRect().height) + local position = cc.p(winSize.width - size.width, winSize.height - size.height) + position.x = position.x * math.random() + position.y = position.y * math.random() + position = cc.p(VisibleRect:leftBottom().x + position.x + size.width/2, + VisibleRect:leftBottom().y + position.y + size.height/2) + local velocity = cc.p((math.random() - 0.5)*200, (math.random() - 0.5)*200) + local triangle = makeTriangle(position, size, 2, cc.PhysicsMaterial(0.1, 1, 0.0)) + local trianglePhysicsBody = triangle:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody() + trianglePhysicsBody:setVelocity(velocity) + trianglePhysicsBody:setCategoryBitmask(8) -- 1000 + trianglePhysicsBody:setContactTestBitmask(2) -- 0010 + trianglePhysicsBody:setCollisionBitmask(1) -- 0001 + root:addChild(triangle) end end @@ -1112,93 +1300,93 @@ local function PhysicsContactTest() layer.blueTriangleNum = layer.blueTriangleNum + 50 end - resetTest(); + resetTest() end - cc.MenuItemFont:setFontSize(65); - local decrease1 = cc.MenuItemFont:create(" - "); - decrease1:setColor(cc.c3b(0,200,20)); - local increase1 = cc.MenuItemFont:create(" + "); - increase1:setColor(cc.c3b(0,200,20)); - decrease1:setTag(1); - increase1:setTag(1); - decrease1:registerScriptTapHandler(onDecrease); - increase1:registerScriptTapHandler(onIncrease); + cc.MenuItemFont:setFontSize(65) + local decrease1 = cc.MenuItemFont:create(" - ") + decrease1:setColor(cc.c3b(0,200,20)) + local increase1 = cc.MenuItemFont:create(" + ") + increase1:setColor(cc.c3b(0,200,20)) + decrease1:setTag(1) + increase1:setTag(1) + decrease1:registerScriptTapHandler(onDecrease) + increase1:registerScriptTapHandler(onIncrease) - local menu1 = cc.Menu:create(decrease1, increase1); - menu1:alignItemsHorizontally(); - menu1:setPosition(cc.p(s.width/2, s.height-50)); - layer:addChild(menu1, 1); + local menu1 = cc.Menu:create(decrease1, increase1) + menu1:alignItemsHorizontally() + menu1:setPosition(cc.p(s.width/2, s.height-50)) + layer:addChild(menu1, 1) - local label = cc.Label:createWithTTF("yellow box", s_arialPath, 32); - layer:addChild(label, 1); - label:setAnchorPoint(cc.p(0.5, 0.5)); - label:setPosition(cc.p(s.width/2 - 150, s.height-50)); + local label = cc.Label:createWithTTF("yellow box", s_arialPath, 32) + layer:addChild(label, 1) + label:setAnchorPoint(cc.p(0.5, 0.5)) + label:setPosition(cc.p(s.width/2 - 150, s.height-50)) - local decrease2 = cc.MenuItemFont:create(" - "); - decrease2:setColor(cc.c3b(0,200,20)); - local increase2 = cc.MenuItemFont:create(" + "); - increase2:setColor(cc.c3b(0,200,20)); - decrease2:setTag(2); - increase2:setTag(2); - decrease2:registerScriptTapHandler(onDecrease); - increase2:registerScriptTapHandler(onIncrease); + local decrease2 = cc.MenuItemFont:create(" - ") + decrease2:setColor(cc.c3b(0,200,20)) + local increase2 = cc.MenuItemFont:create(" + ") + increase2:setColor(cc.c3b(0,200,20)) + decrease2:setTag(2) + increase2:setTag(2) + decrease2:registerScriptTapHandler(onDecrease) + increase2:registerScriptTapHandler(onIncrease) - local menu2 = cc.Menu:create(decrease2, increase2); - menu2:alignItemsHorizontally(); - menu2:setPosition(cc.p(s.width/2, s.height-90)); - layer:addChild(menu2, 1); + local menu2 = cc.Menu:create(decrease2, increase2) + menu2:alignItemsHorizontally() + menu2:setPosition(cc.p(s.width/2, s.height-90)) + layer:addChild(menu2, 1) - label = cc.Label:createWithTTF("blue box", s_arialPath, 32); - layer:addChild(label, 1); - label:setAnchorPoint(cc.p(0.5, 0.5)); - label:setPosition(cc.p(s.width/2 - 150, s.height-90)); + label = cc.Label:createWithTTF("blue box", s_arialPath, 32) + layer:addChild(label, 1) + label:setAnchorPoint(cc.p(0.5, 0.5)) + label:setPosition(cc.p(s.width/2 - 150, s.height-90)) - local decrease3 = cc.MenuItemFont:create(" - "); - decrease3:setColor(cc.c3b(0,200,20)); - local increase3 = cc.MenuItemFont:create(" + "); - increase3:setColor(cc.c3b(0,200,20)); - decrease3:setTag(3); - increase3:setTag(3); - decrease3:registerScriptTapHandler(onDecrease); - increase3:registerScriptTapHandler(onIncrease); + local decrease3 = cc.MenuItemFont:create(" - ") + decrease3:setColor(cc.c3b(0,200,20)) + local increase3 = cc.MenuItemFont:create(" + ") + increase3:setColor(cc.c3b(0,200,20)) + decrease3:setTag(3) + increase3:setTag(3) + decrease3:registerScriptTapHandler(onDecrease) + increase3:registerScriptTapHandler(onIncrease) - local menu3 = cc.Menu:create(decrease3, increase3); - menu3:alignItemsHorizontally(); - menu3:setPosition(cc.p(s.width/2, s.height-130)); - layer:addChild(menu3, 1); + local menu3 = cc.Menu:create(decrease3, increase3) + menu3:alignItemsHorizontally() + menu3:setPosition(cc.p(s.width/2, s.height-130)) + layer:addChild(menu3, 1) - label = cc.Label:createWithTTF("yellow triangle", s_arialPath, 32); - layer:addChild(label, 1); - label:setAnchorPoint(cc.p(0.5, 0.5)); - label:setPosition(cc.p(s.width/2 - 150, s.height-130)); + label = cc.Label:createWithTTF("yellow triangle", s_arialPath, 32) + layer:addChild(label, 1) + label:setAnchorPoint(cc.p(0.5, 0.5)) + label:setPosition(cc.p(s.width/2 - 150, s.height-130)) - local decrease4 = cc.MenuItemFont:create(" - "); - decrease4:setColor(cc.c3b(0,200,20)); - local increase4 = cc.MenuItemFont:create(" + "); - increase4:setColor(cc.c3b(0,200,20)); - decrease4:setTag(4); - increase4:setTag(4); - decrease4:registerScriptTapHandler(onDecrease); - increase4:registerScriptTapHandler(onIncrease); + local decrease4 = cc.MenuItemFont:create(" - ") + decrease4:setColor(cc.c3b(0,200,20)) + local increase4 = cc.MenuItemFont:create(" + ") + increase4:setColor(cc.c3b(0,200,20)) + decrease4:setTag(4) + increase4:setTag(4) + decrease4:registerScriptTapHandler(onDecrease) + increase4:registerScriptTapHandler(onIncrease) - local menu4 = cc.Menu:create(decrease4, increase4); - menu4:alignItemsHorizontally(); - menu4:setPosition(cc.p(s.width/2, s.height-170)); - layer:addChild(menu4, 1); + local menu4 = cc.Menu:create(decrease4, increase4) + menu4:alignItemsHorizontally() + menu4:setPosition(cc.p(s.width/2, s.height-170)) + layer:addChild(menu4, 1) - label = cc.Label:createWithTTF("blue triangle", s_arialPath, 32); - layer:addChild(label, 1); - label:setAnchorPoint(cc.p(0.5, 0.5)); - label:setPosition(cc.p(s.width/2 - 150, s.height-170)); + label = cc.Label:createWithTTF("blue triangle", s_arialPath, 32) + layer:addChild(label, 1) + label:setAnchorPoint(cc.p(0.5, 0.5)) + label:setPosition(cc.p(s.width/2 - 150, s.height-170)) - local contactListener = cc.EventListenerPhysicsContact:create(); - contactListener:registerScriptHandler(onContactBegin, cc.Handler.EVENT_PHYSICS_CONTACT_BEGIN); + local contactListener = cc.EventListenerPhysicsContact:create() + contactListener:registerScriptHandler(onContactBegin, cc.Handler.EVENT_PHYSICS_CONTACT_BEGIN) local eventDispatcher = layer:getEventDispatcher() - eventDispatcher:addEventListenerWithSceneGraphPriority(contactListener, layer); + eventDispatcher:addEventListenerWithSceneGraphPriority(contactListener, layer) - resetTest(); + resetTest() end initWithLayer(layer, onEnter) @@ -1212,7 +1400,7 @@ local function PhysicsPositionRotationTest() local function onEnter() layer:toggleDebug() - cc.Director:getInstance():getRunningScene():getPhysicsWorld():setGravity(cc.p(0, 0)); + cc.Director:getInstance():getRunningScene():getPhysicsWorld():setGravity(cc.p(0, 0)) local touchListener = cc.EventListenerTouchOneByOne:create() touchListener:registerScriptHandler(onTouchBegan, cc.Handler.EVENT_TOUCH_BEGAN) @@ -1221,43 +1409,49 @@ local function PhysicsPositionRotationTest() local eventDispatcher = layer:getEventDispatcher() eventDispatcher:addEventListenerWithSceneGraphPriority(touchListener, layer) - local wall = cc.Node:create(); - wall:setPhysicsBody(cc.PhysicsBody:createEdgeBox(cc.size(VisibleRect:getVisibleRect().width, VisibleRect:getVisibleRect().height))); - wall:setPosition(VisibleRect:center()); - layer:addChild(wall); + local wall = cc.Node:create() + addPhysicsComponent(wall, + cc.PhysicsBody:createEdgeBox(VisibleRect:getVisibleRect())) + wall:setPosition(VisibleRect:center()) + layer:addChild(wall) -- anchor test - local anchorNode = cc.Sprite:create("Images/YellowSquare.png"); - anchorNode:setAnchorPoint(cc.p(0.1, 0.9)); - anchorNode:setPosition(100, 100); - anchorNode:setScale(0.25); - anchorNode:setPhysicsBody(cc.PhysicsBody:createBox(cc.size(anchorNode:getContentSize().width*anchorNode:getScale(), anchorNode:getContentSize().height*anchorNode:getScale()))); - anchorNode:getPhysicsBody():setTag(DRAG_BODYS_TAG); - layer:addChild(anchorNode); + local anchorNode = cc.Sprite:create("Images/YellowSquare.png") + anchorNode:setAnchorPoint(cc.p(0.1, 0.9)) + anchorNode:setPosition(100, 100) + anchorNode:setScale(0.25) + addPhysicsComponent(anchorNode, + cc.PhysicsBody:createBox(anchorNode:getContentSize())) + anchorNode:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody():setTag(DRAG_BODYS_TAG) + layer:addChild(anchorNode) --parent test - local parent = cc.Sprite:create("Images/YellowSquare.png"); - parent:setPosition(200, 100); - parent:setScale(0.25); - parent:setPhysicsBody(cc.PhysicsBody:createBox(cc.size(anchorNode:getContentSize().width*anchorNode:getScale(), anchorNode:getContentSize().height*anchorNode:getScale()))); - parent:getPhysicsBody():setTag(DRAG_BODYS_TAG); - layer:addChild(parent); + local parent = cc.Sprite:create("Images/YellowSquare.png") + parent:setPosition(200, 100) + parent:setScale(0.25) + local parentPhysicsBody = cc.PhysicsBody:createBox(anchorNode:getContentSize()) + addPhysicsComponent(parent, parentPhysicsBody) + parentPhysicsBody:setTag(DRAG_BODYS_TAG) + layer:addChild(parent) - local leftBall = cc.Sprite:create("Images/ball.png"); - leftBall:setPosition(-30, 0); - leftBall:setScale(2); - leftBall:setPhysicsBody(cc.PhysicsBody:createCircle(leftBall:getContentSize().width)); - leftBall:getPhysicsBody():setTag(DRAG_BODYS_TAG); - parent:addChild(leftBall); + local leftBall = cc.Sprite:create("Images/ball.png") + leftBall:setPosition(-30, 0) + leftBall:setScale(2) + addPhysicsComponent(leftBall, cc.PhysicsBody:createCircle(leftBall:getContentSize().width / 2)) + leftBall:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody():setTag(DRAG_BODYS_TAG) + parent:addChild(leftBall) -- offset position rotation test - local offsetPosNode = cc.Sprite:create("Images/YellowSquare.png"); - offsetPosNode:setPosition(100, 200); - offsetPosNode:setPhysicsBody(cc.PhysicsBody:createBox(cc.size(offsetPosNode:getContentSize().width/2, offsetPosNode:getContentSize().height/2))); - offsetPosNode:getPhysicsBody():setPositionOffset(cc.p(-offsetPosNode:getContentSize().width/2, -offsetPosNode:getContentSize().height/2)); - offsetPosNode:getPhysicsBody():setRotationOffset(45); - offsetPosNode:getPhysicsBody():setTag(DRAG_BODYS_TAG); - layer:addChild(offsetPosNode); + local offsetPosNode = cc.Sprite:create("Images/YellowSquare.png") + offsetPosNode:setPosition(100, 200) + local offsetPosNodePhysicsBody = cc.PhysicsBody:createBox(cc.size(offsetPosNode:getContentSize().width/2, + offsetPosNode:getContentSize().height/2)) + addPhysicsComponent(offsetPosNode, offsetPosNodePhysicsBody) + offsetPosNodePhysicsBody:setPositionOffset(cc.p(-offsetPosNode:getContentSize().width/2, + -offsetPosNode:getContentSize().height/2)) + offsetPosNodePhysicsBody:setRotationOffset(45) + offsetPosNodePhysicsBody:setTag(DRAG_BODYS_TAG) + layer:addChild(offsetPosNode) end initWithLayer(layer, onEnter) @@ -1266,6 +1460,274 @@ local function PhysicsPositionRotationTest() return layer end +local function PhysicsSetGravityEnableTest() + local layer = cc.Layer:create() + local function onEnter() + + local touchListener = cc.EventListenerTouchOneByOne:create() + touchListener:registerScriptHandler(onTouchBegan, cc.Handler.EVENT_TOUCH_BEGAN) + touchListener:registerScriptHandler(onTouchMoved, cc.Handler.EVENT_TOUCH_MOVED) + touchListener:registerScriptHandler(onTouchEnded, cc.Handler.EVENT_TOUCH_ENDED) + local eventDispatcher = layer:getEventDispatcher() + eventDispatcher:addEventListenerWithSceneGraphPriority(touchListener, layer) + + local wall = cc.Node:create() + addPhysicsComponent(wall, + cc.PhysicsBody:createEdgeBox(cc.size(VisibleRect:getVisibleRect().width, + VisibleRect:getVisibleRect().height), + cc.PhysicsMaterial(0.1, 1.0, 0.0))) + wall:setPosition(VisibleRect:center()); + layer:addChild(wall) + + local commonBox = makeBox(cc.p(100, 100), cc.size(50, 50), 1) + commonBox:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody():setTag(DRAG_BODYS_TAG) + layer:addChild(commonBox) + + local box = makeBox(cc.p(200, 100), cc.size(50, 50), 2) + local boxBody = box:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody() + boxBody:setMass(20) + boxBody:setTag(DRAG_BODYS_TAG) + boxBody:setGravityEnable(false) + layer:addChild(box) + + local ball = makeBall(layer,cc.p(200,200),50) + ball:setTag(2) + local ballBody = ball:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody() + ballBody:setTag(DRAG_BODYS_TAG) + ballBody:setGravityEnable(false) + ballBody:setMass(50) + layer:addChild(ball) + + local function onScheduleOnce() + cclog("onScheduleOnce") + local ball = layer:getChildByTag(2) + ball:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody():setMass(200) + cc.Director:getInstance():getRunningScene():getPhysicsWorld():setGravity(cc.p(0, 98)) + end + --layer:scheduleOnce(onScheduleOnce,1.0) + local action = cc.Sequence:create(cc.DelayTime:create(1.0), + cc.CallFunc:create(onScheduleOnce)) + layer:runAction(action) + end + + initWithLayer(layer, onEnter) + Helper.titleLabel:setString("Set Gravity Enable Test") + Helper.subtitleLabel:setString("only yellow box drop down") + return layer +end + +local function PhysicsDemoBug5482() + local layer = cc.Layer:create() + local function onEnter() + layer:toggleDebug() + local _bodyInA = false + + local touchListener = cc.EventListenerTouchOneByOne:create() + touchListener:registerScriptHandler(onTouchBegan, cc.Handler.EVENT_TOUCH_BEGAN) + touchListener:registerScriptHandler(onTouchMoved, cc.Handler.EVENT_TOUCH_MOVED) + touchListener:registerScriptHandler(onTouchEnded, cc.Handler.EVENT_TOUCH_ENDED) + local eventDispatcher = layer:getEventDispatcher() + eventDispatcher:addEventListenerWithSceneGraphPriority(touchListener, layer) + + -- wall + local wall = cc.Node:create() + addPhysicsComponent(wall, + cc.PhysicsBody:createEdgeBox(cc.size(VisibleRect:getVisibleRect().width, + VisibleRect:getVisibleRect().height), + cc.PhysicsMaterial(0.1, 1.0, 0.0))) + wall:setPosition(VisibleRect:center()); + layer:addChild(wall) + + local _nodeA = cc.Sprite:create("Images/YellowSquare.png") + _nodeA:setPosition(cc.p(VisibleRect:center().x-150,100)) + addPhysicsComponent(_nodeA,nil) + layer:addChild(_nodeA) + + local _nodeB = cc.Sprite:create("Images/YellowSquare.png") + _nodeB:setPosition(cc.p(VisibleRect:center().x+150,100)) + addPhysicsComponent(_nodeB,nil) + layer:addChild(_nodeB) + + local _body = cc.PhysicsBody:createBox(_nodeA:getContentSize()) + _body:setTag(DRAG_BODYS_TAG) + _body:retain() + + local function changeBodyCallback(sender) + local node = nil + if _bodyInA then + node = _nodeB + cclog("_nodeB") + else + node = _nodeA + cclog("_nodeA") + end + node:getComponent(PHYSICS_COMPONENT_NAME):setPhysicsBody(_body) + _bodyInA = not _bodyInA + end + + cc.MenuItemFont:setFontSize(18) + local _button = cc.MenuItemFont:create("Set Body To A"); + _button:registerScriptTapHandler(changeBodyCallback) + + local menu = cc.Menu:create(_button) + layer:addChild(menu) + end + + initWithLayer(layer, onEnter) + Helper.titleLabel:setString("bug 5482: setPhysicsBodyTest") + Helper.subtitleLabel:setString("change physics body to the other.") + return layer +end + +local function PhysicsDemoBug5482() + local layer = cc.Layer:create() + local function onEnter() + cc.Director:getInstance():getRunningScene():getPhysicsWorld():setDebugDrawMask(cc.PhysicsWorld.DEBUGDRAW_ALL) + cc.Director:getInstance():getRunningScene():getPhysicsWorld():setGravity(cc.p(0, 0)) + + local function addBall() + local ball = cc.Sprite:create("Images/ball.png") + ball:setPosition(cc.p(100,100)) + addPhysicsComponent(ball,cc.PhysicsBody:createCircle(ball:getContentSize().width/2, cc.PhysicsMaterial(0.1, 1, 0.0))) + ball:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody():setTag(DRAG_BODYS_TAG) + ball:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody():setVelocity(cc.p(1000,20)) + layer:addChild(ball) + end + + local function update(delta) + for i=1,3 do + cc.Director:getInstance():getRunningScene():getPhysicsWorld():step(1/180.0) + end + end + + local function updateStart(delta) + addBall() + cc.Director:getInstance():getRunningScene():getPhysicsWorld():setAutoStep(false) + layer:scheduleUpdateWithPriorityLua(update, 0) + end + + -- wall + local wall = cc.Node:create() + addPhysicsComponent(wall, + cc.PhysicsBody:createEdgeBox(cc.size(VisibleRect:getVisibleRect().width, + VisibleRect:getVisibleRect().height), + cc.PhysicsMaterial(0.1, 1.0, 0.0))) + wall:setPosition(VisibleRect:center()); + layer:addChild(wall) + + addBall() + layer:runAction(cc.Sequence:create(cc.DelayTime:create(2.0), + cc.CallFunc:create(updateStart))) + + end + + initWithLayer(layer, onEnter) + Helper.titleLabel:setString("Fixed Update Test") + Helper.subtitleLabel:setString("The secend ball should not run across the wall") + return layer +end + +local function PhysicsTransformTest() + local layer = cc.Layer:create() + local function onEnter() + layer:toggleDebug() + cc.Director:getInstance():getRunningScene():getPhysicsWorld():setGravity(cc.p(0,0)) + + local touchListener = cc.EventListenerTouchOneByOne:create() + touchListener:registerScriptHandler(onTouchBegan, cc.Handler.EVENT_TOUCH_BEGAN) + local eventDispatcher = layer:getEventDispatcher() + eventDispatcher:addEventListenerWithSceneGraphPriority(touchListener, layer) + + local _rootLayer = cc.Layer:create() + layer:addChild(_rootLayer) + + local wall = cc.Node:create() + addPhysicsComponent(wall, + cc.PhysicsBody:createEdgeBox(cc.size(VisibleRect:getVisibleRect().width, + VisibleRect:getVisibleRect().height), + cc.PhysicsMaterial(0.1, 1.0, 0.0))) + wall:setPosition(VisibleRect:center()); + _rootLayer:addChild(wall) + + local _parentSprite = cc.Sprite:create("Images/YellowSquare.png") + _parentSprite:setPosition(cc.p(200,100)) + _parentSprite:setScale(0.25) + addPhysicsComponent(_parentSprite,cc.PhysicsBody:createBox(_parentSprite:getContentSize(),cc.PhysicsMaterial(0.1, 1.0, 0.0))) + _parentSprite:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody():setTag(DRAG_BODYS_TAG) + _parentSprite:setTag(1) + _rootLayer:addChild(_parentSprite) + + local leftBall = cc.Sprite:create("Images/ball.png") + leftBall:setPosition(cc.p(-30,0)) + leftBall:setScale(2) + addPhysicsComponent(leftBall,cc.PhysicsBody:createCircle(leftBall:getContentSize().width/2,cc.PhysicsMaterial(0.1,1.0,0.0))) + leftBall:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody():setTag(DRAG_BODYS_TAG) + _parentSprite:addChild(leftBall) + + local scaleTo = cc.ScaleTo:create(2.0,0.5) + local scaleBack = cc.ScaleTo:create(2.0,1.0) + _parentSprite:runAction(cc.RepeatForever:create(cc.Sequence:create(scaleTo,scaleBack))) + + local normal = cc.Sprite:create("Images/YellowSquare.png") + normal:setPosition(cc.p(300,100)) + normal:setScale(0.25,0.5) + addPhysicsComponent(normal,cc.PhysicsBody:createBox(normal:getContentSize()),cc.PhysicsMaterial(0.1,1.0,0.0)) + normal:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody():setTag(DRAG_BODYS_TAG) + _rootLayer:addChild(normal) + + local bullet = cc.Sprite:create("Images/ball.png") + bullet:setPosition(cc.p(200,200)) + addPhysicsComponent(bullet,cc.PhysicsBody:createCircle(bullet:getContentSize().width/2,cc.PhysicsMaterial(0.1,1.0,0.0))) + bullet:getComponent(PHYSICS_COMPONENT_NAME):getPhysicsBody():setVelocity(cc.p(100,100)) + _rootLayer:addChild(bullet) + + local move = cc.MoveBy:create(2.0,cc.p(100,100)) + local move2 = cc.MoveBy:create(2.0,cc.p(-200,0)) + local move3 = cc.MoveBy:create(2.0,cc.p(100,-100)) + local scale = cc.ScaleTo:create(3.0,0.3) + local scale2 = cc.ScaleTo:create(3.0,1.0) + local rotate = cc.RotateBy:create(6.0,360) + + _rootLayer:runAction(cc.RepeatForever:create(cc.Sequence:create(move,move2,move3))) + _rootLayer:runAction(cc.RepeatForever:create(cc.Sequence:create(scale,scale2))) + _rootLayer:runAction(cc.RepeatForever:create(cc.Sequence:create(rotate))) + end + + initWithLayer(layer, onEnter) + Helper.titleLabel:setString("Reorder issue #9959") + Helper.subtitleLabel:setString("Test Scale9Sprite run scale/move/rotation action in physics scene") + return layer +end + +local function PhysicsIssue9959() + local layer = cc.Layer:create() + local function onEnter() + local origin = cc.Director:getInstance():getVisibleOrigin() + local visibleSize = cc.Director:getInstance():getVisibleSize() + + local scale9Sprite1 = ccui.Scale9Sprite:create("Images/ball.png") + scale9Sprite1:setPosition(cc.p(origin.x+visibleSize.width/2,origin.y+visibleSize.height/2)) + layer:addChild(scale9Sprite1) + scale9Sprite1:runAction(cc.RepeatForever:create(cc.Sequence:create(cc.MoveBy:create(2.0,cc.p(100.0,0.0)), + cc.MoveBy:create(2.0,cc.p(-100,0.0))))) + + local scale9Sprite2 = ccui.Scale9Sprite:create("Images/ball.png") + scale9Sprite2:setPosition(cc.p(origin.x+visibleSize.width/2,origin.y+visibleSize.height/2+50)) + layer:addChild(scale9Sprite2) + scale9Sprite2:runAction(cc.RepeatForever:create(cc.Sequence:create(cc.ScaleTo:create(2.0,1.5), + cc.ScaleTo:create(2.0,1.0)))) + + local scale9Sprite3 = ccui.Scale9Sprite:create("Images/ball.png") + scale9Sprite3:setPosition(cc.p(origin.x+visibleSize.width/2,origin.y+visibleSize.height/2-50)) + layer:addChild(scale9Sprite3) + scale9Sprite3:runAction(cc.RepeatForever:create(cc.Sequence:create(cc.RotateBy:create(2.0,360)))) + end + + initWithLayer(layer, onEnter) + Helper.titleLabel:setString("Physics transform test") + return layer +end + function PhysicsTest() cclog("PhysicsTest") local scene = cc.Scene:createWithPhysics() @@ -1285,6 +1747,11 @@ function PhysicsTest() PhysicsDemoBug3988, PhysicsContactTest, PhysicsPositionRotationTest, + PhysicsSetGravityEnableTest, + PhysicsDemoBug5482, + PhysicsFixedUpdate, + PhysicsTransformTest, + PhysicsIssue9959 } scene:addChild(Helper.createFunctionTable[1]()) diff --git a/tests/lua-tests/src/XMLHttpRequestTest/XMLHttpRequestTest.lua b/tests/lua-tests/src/XMLHttpRequestTest/XMLHttpRequestTest.lua index 5680cab279..ca4af83978 100644 --- a/tests/lua-tests/src/XMLHttpRequestTest/XMLHttpRequestTest.lua +++ b/tests/lua-tests/src/XMLHttpRequestTest/XMLHttpRequestTest.lua @@ -28,17 +28,21 @@ local function XMLHttpRequestLayer() xhr.responseType = cc.XMLHTTPREQUEST_RESPONSE_STRING xhr:open("GET", "http://httpbin.org/get") - local function onReadyStateChange() + local function onReadyStateChanged() if xhr.readyState == 4 and (xhr.status >= 200 and xhr.status < 207) then - local statusString = "Http Status Code:"..xhr.statusText - labelStatusCode:setString(statusString) print(xhr.response) + if not tolua.isnull(labelStatusCode) then + labelStatusCode:setString("Http Status Code:" .. xhr.statusText) + else + print("ERROR: labelStatusCode is invalid!") + end else print("xhr.readyState is:", xhr.readyState, "xhr.status is: ",xhr.status) end + xhr:unregisterScriptHandler() end - xhr:registerScriptHandler(onReadyStateChange) + xhr:registerScriptHandler(onReadyStateChanged) xhr:send() labelStatusCode:setString("waiting...") @@ -56,17 +60,22 @@ local function XMLHttpRequestLayer() local xhr = cc.XMLHttpRequest:new() xhr.responseType = cc.XMLHTTPREQUEST_RESPONSE_STRING xhr:open("POST", "http://httpbin.org/post") - local function onReadyStateChange() + local function onReadyStateChanged() if xhr.readyState == 4 and (xhr.status >= 200 and xhr.status < 207) then - labelStatusCode:setString("Http Status Code:"..xhr.statusText) + if not tolua.isnull(labelStatusCode) then + labelStatusCode:setString("Http Status Code:" .. xhr.statusText) + else + print("ERROR: labelStatusCode is invalid!") + end print(xhr.response) else print("xhr.readyState is:", xhr.readyState, "xhr.status is: ",xhr.status) end + xhr:unregisterScriptHandler() end - xhr:registerScriptHandler(onReadyStateChange) + xhr:registerScriptHandler(onReadyStateChanged) xhr:send() - + labelStatusCode:setString("waiting...") end @@ -83,29 +92,36 @@ local function XMLHttpRequestLayer() xhr.responseType = cc.XMLHTTPREQUEST_RESPONSE_ARRAY_BUFFER xhr:open("POST", "http://httpbin.org/post") - local function onReadyStateChange() + local function onReadyStateChanged() if xhr.readyState == 4 and (xhr.status >= 200 and xhr.status < 207) then local response = xhr.response local size = table.getn(response) local strInfo = "" - + for i = 1,size do if 0 == response[i] then strInfo = strInfo.."\'\\0\'" else strInfo = strInfo..string.char(response[i]) - end + end end - labelStatusCode:setString("Http Status Code:"..xhr.statusText) + + if not tolua.isnull(labelStatusCode) then + labelStatusCode:setString("Http Status Code:" .. xhr.statusText) + else + print("ERROR: labelStatusCode is invalid!") + end + print(strInfo) else print("xhr.readyState is:", xhr.readyState, "xhr.status is: ",xhr.status) end + xhr:unregisterScriptHandler() end - xhr:registerScriptHandler(onReadyStateChange) + xhr:registerScriptHandler(onReadyStateChanged) xhr:send() - + labelStatusCode:setString("waiting...") end @@ -123,9 +139,13 @@ local function XMLHttpRequestLayer() xhr.responseType = cc.XMLHTTPREQUEST_RESPONSE_JSON xhr:open("POST", "http://httpbin.org/post") - local function onReadyStateChange() + local function onReadyStateChanged() if xhr.readyState == 4 and (xhr.status >= 200 and xhr.status < 207) then - labelStatusCode:setString("Http Status Code:"..xhr.statusText) + if not tolua.isnull(labelStatusCode) then + labelStatusCode:setString("Http Status Code:" .. xhr.statusText) + else + print("ERROR: labelStatusCode is invalid!") + end local response = xhr.response local output = json.decode(response,1) table.foreach(output,function(i, v) print (i, v) end) @@ -134,11 +154,12 @@ local function XMLHttpRequestLayer() else print("xhr.readyState is:", xhr.readyState, "xhr.status is: ",xhr.status) end + xhr:unregisterScriptHandler() end - xhr:registerScriptHandler(onReadyStateChange) + xhr:registerScriptHandler(onReadyStateChanged) xhr:send() - + labelStatusCode:setString("waiting...") end diff --git a/tests/lua-tests/src/mainMenu.lua b/tests/lua-tests/src/mainMenu.lua index 20e116e246..1af3f93081 100644 --- a/tests/lua-tests/src/mainMenu.lua +++ b/tests/lua-tests/src/mainMenu.lua @@ -36,7 +36,6 @@ require "OpenGLTest/OpenGLTest" require "ParallaxTest/ParallaxTest" require "ParticleTest/ParticleTest" require "Particle3DTest/Particle3DTest" -require "PerformanceTest/PerformanceTest" require "RenderTextureTest/RenderTextureTest" require "RotateWorldTest/RotateWorldTest" require "Sprite3DTest/Sprite3DTest" @@ -124,7 +123,6 @@ local _allTests = { { isSupported = true, name = "ParallaxTest" , create_func = ParallaxTestMain }, { isSupported = true, name = "ParticleTest" , create_func = ParticleTest }, { isSupported = true, name = "Particle3D (PU)" , create_func = Particle3DTest }, - { isSupported = true, name = "PerformanceTest" , create_func= PerformanceTestMain }, { isSupported = true, name = "PhysicsTest" , create_func = PhysicsTest }, { isSupported = true, name = "Physics3DTest" , create_func = Physics3DTest }, { isSupported = true, name = "RenderTextureTest" , create_func = RenderTextureTestMain }, diff --git a/tests/performance-tests/.cocos-project.json b/tests/performance-tests/.cocos-project.json new file mode 100644 index 0000000000..50a3b44c7f --- /dev/null +++ b/tests/performance-tests/.cocos-project.json @@ -0,0 +1,24 @@ +{ + "win32_cfg": { + "project_path": "../../build", + "sln_file": "cocos2d-win32.sln", + "project_name": "performance-tests", + "build_cfg_path": "proj.win32" + }, + "ios_cfg": { + "project_path": "../../build", + "project_file": "cocos2d_tests.xcodeproj", + "target_name": "performance-tests iOS" + }, + "project_type": "cpp", + "mac_cfg": { + "project_path": "../../build", + "project_file": "cocos2d_tests.xcodeproj", + "target_name": "performance-tests Mac" + }, + "android_cfg": { + "project_path": "proj.android", + "studio_proj_path" : "proj.android-studio" + }, + "engine_dir": "../../" +} diff --git a/tests/performance-tests/Classes/AppDelegate.cpp b/tests/performance-tests/Classes/AppDelegate.cpp new file mode 100644 index 0000000000..20b91c9790 --- /dev/null +++ b/tests/performance-tests/Classes/AppDelegate.cpp @@ -0,0 +1,96 @@ +#include "AppDelegate.h" +#include "controller.h" + +USING_NS_CC; + +static cocos2d::Size designResolutionSize = cocos2d::Size(960, 640); +static cocos2d::Size smallResolutionSize = cocos2d::Size(960, 640); +static cocos2d::Size mediumResolutionSize = cocos2d::Size(1024, 768); +static cocos2d::Size largeResolutionSize = cocos2d::Size(2048, 1536); + +AppDelegate::AppDelegate() { + +} + +AppDelegate::~AppDelegate() +{ +} + +//if you want a different context,just modify the value of glContextAttrs +//it will takes effect on all platforms +void AppDelegate::initGLContextAttrs() +{ + //set OpenGL context attributions,now can only set six attributions: + //red,green,blue,alpha,depth,stencil + GLContextAttrs glContextAttrs = {8, 8, 8, 8, 24, 8}; + + GLView::setGLContextAttrs(glContextAttrs); +} + +// If you want to use packages manager to install more packages, +// don't modify or remove this function +static int register_all_packages() +{ + return 0; //flag for packages manager +} + +bool AppDelegate::applicationDidFinishLaunching() { + // initialize director + auto director = Director::getInstance(); + auto glview = director->getOpenGLView(); + if(!glview) { +#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX) + glview = GLViewImpl::createWithRect("performance-tests", Rect(0, 0, designResolutionSize.width, designResolutionSize.height)); +#else + glview = GLViewImpl::create("performance-tests"); +#endif + director->setOpenGLView(glview); + } + + // turn on display FPS + director->setDisplayStats(true); + + // set FPS. the default value is 1.0/60 if you don't call this + director->setAnimationInterval(1.0 / 60); + + // Set the design resolution + glview->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::NO_BORDER); + Size frameSize = glview->getFrameSize(); + // if the frame's height is larger than the height of medium size. + if (frameSize.height > mediumResolutionSize.height) + { + director->setContentScaleFactor(MIN(largeResolutionSize.height/designResolutionSize.height, largeResolutionSize.width/designResolutionSize.width)); + } + // if the frame's height is larger than the height of small size. + else if (frameSize.height > smallResolutionSize.height) + { + director->setContentScaleFactor(MIN(mediumResolutionSize.height/designResolutionSize.height, mediumResolutionSize.width/designResolutionSize.width)); + } + // if the frame's height is smaller than the height of medium size. + else + { + director->setContentScaleFactor(MIN(smallResolutionSize.height/designResolutionSize.height, smallResolutionSize.width/designResolutionSize.width)); + } + + register_all_packages(); + + TestController::getInstance(); + + return true; +} + +// This function will be called when the app is inactive. When comes a phone call,it's be invoked too +void AppDelegate::applicationDidEnterBackground() { + Director::getInstance()->stopAnimation(); + + // if you use SimpleAudioEngine, it must be pause + // SimpleAudioEngine::getInstance()->pauseBackgroundMusic(); +} + +// this function will be called when the app is active again +void AppDelegate::applicationWillEnterForeground() { + Director::getInstance()->startAnimation(); + + // if you use SimpleAudioEngine, it must resume here + // SimpleAudioEngine::getInstance()->resumeBackgroundMusic(); +} diff --git a/tests/performance-tests/Classes/AppDelegate.h b/tests/performance-tests/Classes/AppDelegate.h new file mode 100644 index 0000000000..625506cc0d --- /dev/null +++ b/tests/performance-tests/Classes/AppDelegate.h @@ -0,0 +1,40 @@ +#ifndef _APP_DELEGATE_H_ +#define _APP_DELEGATE_H_ + +#include "cocos2d.h" + +/** +@brief The cocos2d Application. + +The reason for implement as private inheritance is to hide some interface call by Director. +*/ +class AppDelegate : private cocos2d::Application +{ +public: + AppDelegate(); + virtual ~AppDelegate(); + + virtual void initGLContextAttrs(); + + /** + @brief Implement Director and Scene init code here. + @return true Initialize success, app continue. + @return false Initialize failed, app terminate. + */ + virtual bool applicationDidFinishLaunching(); + + /** + @brief The function be called when the application enter background + @param the pointer of the application + */ + virtual void applicationDidEnterBackground(); + + /** + @brief The function be called when the application enter foreground + @param the pointer of the application + */ + virtual void applicationWillEnterForeground(); +}; + +#endif // _APP_DELEGATE_H_ + diff --git a/tests/performance-tests/Classes/Profile.cpp b/tests/performance-tests/Classes/Profile.cpp new file mode 100644 index 0000000000..1836cc44c4 --- /dev/null +++ b/tests/performance-tests/Classes/Profile.cpp @@ -0,0 +1,270 @@ +#include "Profile.h" +#include "json/document.h" +#include "json/prettywriter.h" +#include "json/stringbuffer.h" +#include "platform/CCFileUtils.h" +#include "cocos2d.h" +#include + +#define LOG_FILE_NAME_FMT "PerformanceLog-%s-%s.json" +#define PLIST_FILE_NAME "PerformanceLog.plist" + +#define KEY_DEVICE "device" +#define KEY_ENGINE_VERSION "engineVersion" +#define KEY_RESULTS "results" +#define KEY_CONDITION_HEADERS "conditionHeaders" +#define KEY_RESULT_HEADERS "resultHeaders" +#define KEY_FILE_VERSION "fileVersion" +#define KEY_OS_VERSION "osVersion" +#define KEY_TIMESTAMP "timeStamp" + +#define FILE_VERSION 1 + +#define USE_PRETTY_OUTPUT_FORMAT 0 +#define USE_JSON_FORMAT 1 + + +// For different device & os, change these values +// TODO : get device info automatically +#define DEVICE_NAME "DeviceName" +#define OS_VERSION "SystemVersion" + +static Profile* s_profile = nullptr; + +USING_NS_CC; + +// tools methods +std::string genStr(const char* format, ...) +{ + va_list arg_ptr; + va_start(arg_ptr, format); + + char buf[MAX_LOG_LENGTH]; + vsnprintf(buf, MAX_LOG_LENGTH - 3, format, arg_ptr); + + va_end(arg_ptr); + + return buf; +} + +std::vector genStrVector(const char* str1, ...) +{ + std::vector ret; + va_list arg_ptr; + const char* str = str1; + va_start(arg_ptr, str1); + while (nullptr != str) { + std::string strObj = str; + ret.push_back(strObj); + str = va_arg(arg_ptr, const char*); + } + va_end(arg_ptr); + + return ret; +} + +// declare the methods +rapidjson::Value valueVectorToJson(cocos2d::ValueVector & theVector, rapidjson::Document::AllocatorType& allocator); +rapidjson::Value valueMapToJson(cocos2d::ValueMap & theMap, rapidjson::Document::AllocatorType& allocator); + +rapidjson::Value convertToJsonValue(cocos2d::Value & value, rapidjson::Document::AllocatorType& allocator) +{ + rapidjson::Value theJsonValue; + auto type = value.getType(); + switch (type) { + case cocos2d::Value::Type::STRING: + theJsonValue.SetString(value.asString().c_str(), allocator); + break; + case cocos2d::Value::Type::MAP: + theJsonValue = valueMapToJson(value.asValueMap(), allocator); + break; + case cocos2d::Value::Type::VECTOR: + theJsonValue = valueVectorToJson(value.asValueVector(), allocator); + break; + case cocos2d::Value::Type::INTEGER: + theJsonValue.SetInt(value.asInt()); + break; + case cocos2d::Value::Type::BOOLEAN: + theJsonValue.SetBool(value.asBool()); + break; + case cocos2d::Value::Type::FLOAT: + case cocos2d::Value::Type::DOUBLE: + theJsonValue.SetDouble(value.asDouble()); + break; + default: + break; + } + + return theJsonValue; +} + +rapidjson::Value valueMapToJson(cocos2d::ValueMap & theMap, rapidjson::Document::AllocatorType& allocator) +{ + rapidjson::Value ret(rapidjson::kObjectType); + + for (ValueMap::iterator iter = theMap.begin(); iter != theMap.end(); ++iter) { + auto key = iter->first; + rapidjson::Value theJsonKey(rapidjson::kStringType); + theJsonKey.SetString(key.c_str(), allocator); + + cocos2d::Value value = iter->second; + rapidjson::Value theJsonValue = convertToJsonValue(value, allocator); + ret.AddMember(theJsonKey, theJsonValue, allocator); + } + return ret; +} + +rapidjson::Value valueVectorToJson(cocos2d::ValueVector & theVector, rapidjson::Document::AllocatorType& allocator) +{ + rapidjson::Value ret(rapidjson::kArrayType); + + auto vectorSize = theVector.size(); + for (int i = 0; i < vectorSize; i++) { + cocos2d::Value value = theVector[i]; + rapidjson::Value theJsonValue = convertToJsonValue(value, allocator); + ret.PushBack(theJsonValue, allocator); + } + + return ret; +} + +Profile* Profile::getInstance() +{ + if (nullptr == s_profile) + { + s_profile = new Profile(); + } + + return s_profile; +} + +void Profile::destroyInstance() +{ + CC_SAFE_DELETE(s_profile); +} + +Profile::Profile() +{ + +} + +Profile::~Profile() +{ + +} + +void Profile::testCaseBegin(std::string testName, std::vector condHeaders, std::vector retHeaders) +{ + curTestName = testName; + + ValueVector conds; + for (int i = 0; i < condHeaders.size(); i++) { + conds.push_back(Value(condHeaders[i])); + } + + ValueVector rets; + for (int j = 0; j < retHeaders.size(); j++) { + rets.push_back(Value(retHeaders[j])); + } + + auto findValue = testData.find(curTestName); + if (findValue != testData.end()) + { + auto curMap = findValue->second.asValueMap(); + curMap[KEY_CONDITION_HEADERS] = Value(conds); + curMap[KEY_RESULT_HEADERS] = Value(rets); + + if (curMap.find(KEY_RESULTS) != curMap.end()) + curTestResults = curMap[KEY_RESULTS].asValueVector(); + else + curTestResults.clear(); + } + else + { + ValueMap theData; + theData[KEY_CONDITION_HEADERS] = conds; + theData[KEY_RESULT_HEADERS] = rets; + testData[curTestName] = Value(theData); + curTestResults.clear(); + } +} + +void Profile::addTestResult(std::vector conditions, std::vector results) +{ + ValueVector curRet; + + for (int i = 0; i < conditions.size(); i++) { + curRet.push_back(Value(conditions[i])); + } + + for (int j = 0; j < results.size(); j++) { + curRet.push_back(Value(results[j])); + } + curTestResults.push_back(Value(curRet)); +} + +void Profile::testCaseEnd() +{ + // add the result of current test case into the testData. + ValueMap theData = testData[curTestName].asValueMap(); + theData[KEY_RESULTS] = curTestResults; + testData[curTestName] = Value(theData); +} + +void Profile::flush() +{ + // record the format version + testData[KEY_FILE_VERSION] = Value(FILE_VERSION); + testData[KEY_DEVICE] = Value(DEVICE_NAME); + testData[KEY_OS_VERSION] = Value(OS_VERSION); + testData[KEY_ENGINE_VERSION] = Value(cocos2d::cocos2dVersion()); + time_t t = time(0); + localtime(&t); + testData[KEY_TIMESTAMP] = Value(genStr("%ld", t)); + +#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID + std::string checkPath = "/mnt/sdcard/PerfTest"; + auto writablePath = checkPath; + if (! cocos2d::FileUtils::getInstance()->isDirectoryExist(checkPath)) { + auto createRet = cocos2d::FileUtils::getInstance()->createDirectory(checkPath); + if (! createRet) { + writablePath = cocos2d::FileUtils::getInstance()->getWritablePath(); + } + } + cocos2d::log("write path : %s", writablePath.c_str()); +#else + auto writablePath = cocos2d::FileUtils::getInstance()->getWritablePath(); +#endif + +#if USE_JSON_FORMAT + char timeStr[64]; + strftime(timeStr, sizeof(timeStr), "%Y-%m-%d-%H%M", localtime(&t)); + std::string fileName = genStr(LOG_FILE_NAME_FMT, DEVICE_NAME, timeStr); + std::string fullPath = genStr("%s/%s", writablePath.c_str(), fileName.c_str()); + + rapidjson::Document document; + rapidjson::Document::AllocatorType& allocator = document.GetAllocator(); + rapidjson::Value theData = valueMapToJson(testData, allocator); + + rapidjson::StringBuffer buffer; + +#if USE_PRETTY_OUTPUT_FORMAT + // write pretty format json + rapidjson::PrettyWriter writer(buffer); +#else // #else USE_PRETTY_OUTPUT_FORMAT + // write json in one line + rapidjson::Writer writer(buffer); +#endif // #endif USE_PRETTY_OUTPUT_FORMAT + + theData.Accept(writer); + auto out = buffer.GetString(); + + FILE *fp = fopen(fullPath.c_str(), "w"); + fputs(out, fp); + fclose(fp); +#else // #else USE_JSON_FORMAT + // Write the test data into plist file. + std::string plistFullPath = genStr("%s/%s", writablePath.c_str(), PLIST_FILE_NAME); + cocos2d::FileUtils::getInstance()->writeValueMapToFile(testData, plistFullPath); +#endif // #endif USE_JSON_FORMAT +} diff --git a/tests/performance-tests/Classes/Profile.h b/tests/performance-tests/Classes/Profile.h new file mode 100644 index 0000000000..d011edfa89 --- /dev/null +++ b/tests/performance-tests/Classes/Profile.h @@ -0,0 +1,37 @@ +#ifndef __PROFILE_H__ +#define __PROFILE_H__ + +#include +#include +#include "base/CCMap.h" +#include "base/CCValue.h" +#include "base/CCVector.h" + +std::string genStr(const char* format, ...); +std::vector genStrVector(const char* str1, ...); + +class Profile +{ +public: + static Profile* getInstance(); + static void destroyInstance(); + + Profile(); + virtual ~Profile(); + + // methods for test cases + void testCaseBegin(std::string testName, std::vector condHeaders, std::vector retHeaders); + void addTestResult(std::vector conditions, std::vector results); + void testCaseEnd(); + + // write the test result to file + void flush(); + +protected: + cocos2d::ValueMap testData; + + std::string curTestName; + cocos2d::ValueVector curTestResults; +}; + +#endif // __PROFILE_H__ diff --git a/tests/performance-tests/Classes/tests/BaseTest.cpp b/tests/performance-tests/Classes/tests/BaseTest.cpp new file mode 100644 index 0000000000..34f74e268e --- /dev/null +++ b/tests/performance-tests/Classes/tests/BaseTest.cpp @@ -0,0 +1,485 @@ +/**************************************************************************** + Copyright (c) 2013-2015 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. + ****************************************************************************/ + +#include "BaseTest.h" +#include "testResource.h" +#include "controller.h" + +USING_NS_CC; +USING_NS_CC_EXT; + +#define TABEL_LABEL_TAG 1024 + +TestBase::TestBase() +: _parentTest(nullptr) +, _isTestList(false) +{ + +} + +TestBase::~TestBase() +{ + +} + +void TestBase::backsUpOneLevel() +{ + if (_parentTest) + { + _parentTest->runThisTest(); + this->release(); + } +} + +//TestList +class TestCustomTableView : public TableView +{ +public: + static TestCustomTableView* create(TableViewDataSource* dataSource, Size size) + { + auto table = new (std::nothrow) TestCustomTableView(); + table->initWithViewSize(size, nullptr); + table->autorelease(); + table->setDataSource(dataSource); + table->_updateCellPositions(); + table->_updateContentSize(); + + return table; + } + + virtual void onTouchEnded(Touch *touch, Event *event) override + { + if (!this->isVisible()) + { + return; + } + + if (_touchedCell) + { + auto label = (Label*)_touchedCell->getChildByTag(TABEL_LABEL_TAG); + + Rect bbox = label->getBoundingBox(); + bbox.origin = _touchedCell->convertToWorldSpace(bbox.origin); + + if (bbox.containsPoint(touch->getLocation()) && _tableViewDelegate != nullptr) + { + _tableViewDelegate->tableCellUnhighlight(this, _touchedCell); + _tableViewDelegate->tableCellTouched(this, _touchedCell); + } + + _touchedCell = nullptr; + } + + ScrollView::onTouchEnded(touch, event); + } + + void onMouseScroll(Event *event) + { + auto mouseEvent = static_cast(event); + float moveY = mouseEvent->getScrollY() * 20; + + auto minOffset = this->minContainerOffset(); + auto maxOffset = this->maxContainerOffset(); + + auto offset = this->getContentOffset(); + offset.y += moveY; + + if (offset.y < minOffset.y) + { + offset.y = minOffset.y; + } + else if (offset.y > maxOffset.y) + { + offset.y = maxOffset.y; + } + this->setContentOffset(offset); + } + +protected: + TestCustomTableView() + { + auto mouseListener = EventListenerMouse::create(); + mouseListener->onMouseScroll = CC_CALLBACK_1(TestCustomTableView::onMouseScroll, this); + _eventDispatcher->addEventListenerWithSceneGraphPriority(mouseListener, this); + } +}; + +TestList::TestList() +{ + _isTestList = true; + _shouldRestoreTableOffset = false; +} + +void TestList::addTest(const std::string& testName, std::function callback) +{ + if (!testName.empty()) + { + _childTestNames.emplace_back(StringUtils::format("%d", static_cast(_childTestNames.size() + 1)) + ":" + testName); + _testCallbacks.emplace_back(callback); + } +} + +void TestList::runThisTest() +{ + _cellTouchEnabled = true; + auto director = Director::getInstance(); + auto scene = Scene::create(); + + auto visibleSize = director->getVisibleSize(); + auto origin = director->getVisibleOrigin(); + + auto tableView = TestCustomTableView::create(this, Size(400, visibleSize.height)); + tableView->setPosition(origin.x + (visibleSize.width - 400) / 2, origin.y); + tableView->setDirection(ScrollView::Direction::VERTICAL); + tableView->setVerticalFillOrder(TableView::VerticalFillOrder::TOP_DOWN); + tableView->setDelegate(this); + scene->addChild(tableView); + tableView->reloadData(); + + if (_shouldRestoreTableOffset) + { + tableView->setContentOffset(_tableOffset); + } + + if (_parentTest) + { + //Add back button. + TTFConfig ttfConfig("fonts/arial.ttf", 25); + auto label = Label::createWithTTF(ttfConfig, "Back"); + + auto menuItem = MenuItemLabel::create(label, std::bind(&TestBase::backsUpOneLevel, this)); + auto menu = Menu::create(menuItem, nullptr); + + menu->setPosition(Vec2::ZERO); + menuItem->setPosition(Vec2(VisibleRect::right().x - 50, VisibleRect::bottom().y + 25)); + + scene->addChild(menu, 1); + } + else + { + //Add close and "Start AutoTest" button. + auto closeItem = MenuItemImage::create(s_pathClose, s_pathClose, [](Ref* sender){ + TestController::getInstance()->stopAutoTest(); + TestController::destroyInstance(); + Director::getInstance()->end(); +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) + exit(0); +#endif + }); + closeItem->setPosition(VisibleRect::right().x - 30, VisibleRect::top().y - 30); + + auto autoTestLabel = Label::createWithTTF("Start AutoTest","fonts/arial.ttf",25); + auto autoTestItem = MenuItemLabel::create(autoTestLabel, [&](Ref* sender){ + TestController::getInstance()->startAutoTest(); + }); + autoTestItem->setPosition(Vec2(VisibleRect::left().x + 80, VisibleRect::bottom().y + 100)); + + auto menu = Menu::create(closeItem, autoTestItem, nullptr); + menu->setPosition(Vec2::ZERO); + scene->addChild(menu, 1); + } + + director->replaceScene(scene); +} + +void TestList::tableCellTouched(TableView* table, TableViewCell* cell) +{ + if (_cellTouchEnabled) + { + auto index = cell->getIdx(); + if (_testCallbacks[index]) + { + auto test = _testCallbacks[index](); + if (test->getChildTestCount() > 0) + { + _tableOffset = table->getContentOffset(); + _shouldRestoreTableOffset = true; + _cellTouchEnabled = false; + test->setTestParent(this); + test->runThisTest(); + } + else + { + delete test; + } + } + } +} + +TableViewCell* TestList::tableCellAtIndex(TableView *table, ssize_t idx) +{ + auto cell = table->dequeueCell(); + if (!cell) + { + cell = TableViewCell::create(); + auto label = Label::createWithTTF(_childTestNames[idx], "fonts/arial.ttf", 25.0f); + label->setTag(TABEL_LABEL_TAG); + label->setPosition(200, 15); + cell->addChild(label); + } + else + { + auto label = (Label*)cell->getChildByTag(TABEL_LABEL_TAG); + label->setString(_childTestNames[idx]); + } + + return cell; +} + +Size TestList::tableCellSizeForIndex(TableView *table, ssize_t idx) +{ + return Size(400, 40); +} + +ssize_t TestList::numberOfCellsInTableView(TableView *table) +{ + return _childTestNames.size(); +} + +//TestSuite +void TestSuite::addTestCase(const std::string& testName, std::function callback) +{ + if (!testName.empty() && callback) + { + _childTestNames.emplace_back(testName); + _testCallbacks.emplace_back(callback); + } +} + +static TestCase* getTestCase(Scene* scene) +{ + auto transitionScene = dynamic_cast(scene); + TestCase* testCase = nullptr; + if (transitionScene) + { + testCase = dynamic_cast(transitionScene->getInScene()); + } + else + { + testCase = dynamic_cast(scene); + } + + return testCase; +} + +void TestSuite::runThisTest() +{ + if (!_childTestNames.empty()) + { + TestController::getInstance()->setCurrTestSuite(this); + + _currTestIndex = 0; + auto scene = _testCallbacks[0](); + auto testCase = getTestCase(scene); + testCase->setTestSuite(this); + testCase->setTestCaseName(_childTestNames[_currTestIndex]); + Director::getInstance()->replaceScene(scene); + } +} + +void TestSuite::restartCurrTest() +{ + auto scene = _testCallbacks[_currTestIndex](); + auto testCase = getTestCase(scene); + testCase->setTestSuite(this); + testCase->setTestCaseName(_childTestNames[_currTestIndex]); + + Director::getInstance()->replaceScene(scene); +} + +void TestSuite::enterNextTest() +{ + _currTestIndex = (_currTestIndex + 1) % _childTestNames.size(); + + auto scene = _testCallbacks[_currTestIndex](); + auto testCase = getTestCase(scene); + testCase->setTestSuite(this); + testCase->setTestCaseName(_childTestNames[_currTestIndex]); + + Director::getInstance()->replaceScene(scene); +} + +void TestSuite::enterPreviousTest() +{ + if (_currTestIndex > 0) + { + _currTestIndex -= 1; + } + else + { + _currTestIndex = (int)_childTestNames.size() - 1; + } + + auto scene = _testCallbacks[_currTestIndex](); + auto testCase = getTestCase(scene); + testCase->setTestSuite(this); + testCase->setTestCaseName(_childTestNames[_currTestIndex]); + + Director::getInstance()->replaceScene(scene); +} + +//TestCase +TestCase::TestCase() +: _priorTestItem(nullptr) +, _restartTestItem(nullptr) +, _nextTestItem(nullptr) +, _titleLabel(nullptr) +, _subtitleLabel(nullptr) +, _testSuite(nullptr) +, _isAutoTesting(false) +{ + Director::getInstance()->getTextureCache()->removeUnusedTextures(); + SpriteFrameCache::getInstance()->removeUnusedSpriteFrames(); +} + +TestCase::~TestCase() +{ + if (_testSuite) + { + _testSuite->release(); + _testSuite = nullptr; + } +} + +void TestCase::setTestSuite(TestSuite* testSuite) +{ + if (_testSuite != testSuite) + { + testSuite->retain(); + if (_testSuite) + { + _testSuite->release(); + } + _testSuite = testSuite; + } +} + +TestCase::Type TestCase::getTestType() const +{ + return Type::ROBUSTNESS; +} + +float TestCase::getDuration() const +{ + return 0.2f; +} + +bool TestCase::init() +{ + if (Scene::init()) + { + // add title and subtitle + TTFConfig ttfConfig("fonts/arial.ttf", 26); + _titleLabel = Label::createWithTTF(ttfConfig, title()); + addChild(_titleLabel, 9999); + _titleLabel->setPosition(VisibleRect::center().x, VisibleRect::top().y - 30); + + ttfConfig.fontSize = 16; + _subtitleLabel = Label::createWithTTF(ttfConfig, subtitle()); + _subtitleLabel->setMaxLineWidth(VisibleRect::getVisibleRect().size.width); + addChild(_subtitleLabel, 9999); + _subtitleLabel->setPosition(VisibleRect::center().x, VisibleRect::top().y - 60); + + _priorTestItem = MenuItemImage::create(s_pathB1, s_pathB2, CC_CALLBACK_1(TestCase::priorTestCallback, this)); + _restartTestItem = MenuItemImage::create(s_pathR1, s_pathR2, CC_CALLBACK_1(TestCase::restartTestCallback, this)); + _nextTestItem = MenuItemImage::create(s_pathF1, s_pathF2, CC_CALLBACK_1(TestCase::nextTestCallback, this)); + + ttfConfig.fontSize = 20; + auto backLabel = Label::createWithTTF(ttfConfig, "Back"); + auto backItem = MenuItemLabel::create(backLabel, CC_CALLBACK_1(TestCase::onBackCallback, this)); + + auto menu = Menu::create(_priorTestItem, _restartTestItem, _nextTestItem, backItem, nullptr); + + menu->setPosition(Vec2::ZERO); + _priorTestItem->setPosition(VisibleRect::center().x - _restartTestItem->getContentSize().width * 2, VisibleRect::bottom().y + _restartTestItem->getContentSize().height / 2); + _restartTestItem->setPosition(VisibleRect::center().x, VisibleRect::bottom().y + _restartTestItem->getContentSize().height / 2); + _nextTestItem->setPosition(VisibleRect::center().x + _restartTestItem->getContentSize().width * 2, VisibleRect::bottom().y + _restartTestItem->getContentSize().height / 2); + backItem->setPosition(Vec2(VisibleRect::right().x - 50, VisibleRect::bottom().y + 25)); + + addChild(menu, 9999); + + return true; + } + + return false; +} + +void TestCase::onEnter() +{ + Scene::onEnter(); + + if (_testSuite == nullptr) + { + setTestSuite(TestController::getInstance()->getCurrTestSuite()); + } + + if (_testSuite) + { + _titleLabel->setString(StringUtils::format("%d", static_cast(_testSuite->getCurrTestIndex() + 1)) + ":" + title()); + } + else + { + _titleLabel->setString(title()); + } + _subtitleLabel->setString(subtitle()); + + if (_testSuite && _testSuite->getChildTestCount() < 2) + { + _priorTestItem->setVisible(false); + _nextTestItem->setVisible(false); + _restartTestItem->setVisible(false); + } +} + +void TestCase::restartTestCallback(Ref* sender) +{ + if (_testSuite) + { + _testSuite->restartCurrTest(); + } +} + +void TestCase::nextTestCallback(Ref* sender) +{ + if (_testSuite) + { + _testSuite->enterNextTest(); + } +} + +void TestCase::priorTestCallback(Ref* sender) +{ + if (_testSuite) + { + _testSuite->enterPreviousTest(); + } +} + +void TestCase::onBackCallback(Ref* sender) +{ + if (_testSuite) + { + _testSuite->backsUpOneLevel(); + } +} diff --git a/tests/performance-tests/Classes/tests/BaseTest.h b/tests/performance-tests/Classes/tests/BaseTest.h new file mode 100644 index 0000000000..f56d19d537 --- /dev/null +++ b/tests/performance-tests/Classes/tests/BaseTest.h @@ -0,0 +1,233 @@ +/**************************************************************************** + Copyright (c) 2013-2015 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 _CPPTESTS_BASETEST_H__ +#define _CPPTESTS_BASETEST_H__ + +#include "cocos2d.h" +#include "extensions/cocos-ext.h" +#include "VisibleRect.h" + +class TestSuite; + +/** + * Each test case should inherit from TestCase, and add to a TestSuite object. + */ +class TestCase : public cocos2d::Scene +{ +public: + /** TestCase test type.*/ + enum class Type + { + /** For testing whether test case not crash.*/ + ROBUSTNESS, + /** + * For check the correctness of regular test cases. + * A test case passes only if the actual output equal to the expected output. + */ + UNIT, + /** @warning The test type is not achieved.*/ + GRAPHICAL_STATIC, + /** @note It's mean the test case need test manually.*/ + MANUAL + }; + TestCase(); + ~TestCase(); + + virtual std::string title() const { return ""; } + virtual std::string subtitle() const { return ""; } + + /** Returns the test type, the default type is Type::ROBUSTNESS.*/ + virtual Type getTestType() const; + /** Returns the time the test case needs.*/ + virtual float getDuration() const; + + + /** Returns the expected output.*/ + virtual std::string getExpectedOutput() const { return ""; } + /** Returns the actual output.*/ + virtual std::string getActualOutput() const { return ""; } + + /** Callback functions.*/ + virtual void restartTestCallback(cocos2d::Ref* sender); + virtual void nextTestCallback(cocos2d::Ref* sender); + virtual void priorTestCallback(cocos2d::Ref* sender); + virtual void onBackCallback(cocos2d::Ref* sender); + + /** + * You should NEVER call this method, unless you know what you are doing. + */ + void setTestSuite(TestSuite* testSuite); + TestSuite* getTestSuite() const { return _testSuite; } + + /** get/set the auto test status.*/ + inline bool isAutoTesting() { return this->_isAutoTesting; } + inline void setAutoTesting(bool value) { this->_isAutoTesting = value; } + + /** + * You should NEVER call this method, unless you know what you are doing. + */ + void setTestCaseName(const std::string& name) { _testCaseName = name; } + std::string getTestCaseName() const { return _testCaseName; } + + virtual void onEnter() override; +CC_CONSTRUCTOR_ACCESS: + virtual bool init() override; + +protected: + cocos2d::MenuItemImage* _priorTestItem; + cocos2d::MenuItemImage* _restartTestItem; + cocos2d::MenuItemImage* _nextTestItem; + + cocos2d::Label* _titleLabel; + cocos2d::Label* _subtitleLabel; + +private: + TestSuite* _testSuite; + bool _isAutoTesting; + std::string _testCaseName; +}; + +/** + * A TestBase object stores the following information about a test: + * - A pointer to the parent test(TestList or TestSuite). + * - Array of children test names. + * - A flag to indicate whether the test is a TestList object. + * + * @note You should not inherit from TestBase directly. + */ +class TestBase : public cocos2d::Ref +{ +public: + virtual ~TestBase(); + + /** Backs up one level. */ + void backsUpOneLevel(); + + virtual void runThisTest() {} + + bool isTestList() { return _isTestList; } + + ssize_t getChildTestCount() { return _childTestNames.size(); } + + /** + * You should NEVER call this method. + */ + void setTestParent(TestBase* parent) { _parentTest = parent; } + TestBase* getTestParent() { return _parentTest; } + + void setTestName(const std::string& testName) { _testName = testName; } + std::string getTestName() const { return _testName; } +protected: + TestBase(); + + std::string _testName; + TestBase* _parentTest; + bool _isTestList; + std::vector _childTestNames; +}; + +class TestController; + +/** +* TestSuite correspond to a group of test cases. +* @note Each test case should add to a TestSuite object. +*/ +class TestSuite : public TestBase +{ +public: + void addTestCase(const std::string& testName, std::function callback); + + virtual void restartCurrTest(); + virtual void enterNextTest(); + virtual void enterPreviousTest(); + + int getCurrTestIndex() { return _currTestIndex; } + virtual void runThisTest() override; + +private: + std::vector> _testCallbacks; + + int _currTestIndex; + friend class TestController; +}; + +/** + * An instance of TestList is a means for displaying hierarchical lists of TestSuite. + */ +class TestList : public TestBase, public cocos2d::extension::TableViewDataSource, public cocos2d::extension::TableViewDelegate +{ +public: + TestList(); + + void addTest(const std::string& testName, std::function callback); + + virtual void runThisTest() override; + + + virtual void tableCellTouched(cocos2d::extension::TableView* table, cocos2d::extension::TableViewCell* cell) override; + virtual cocos2d::extension::TableViewCell* tableCellAtIndex(cocos2d::extension::TableView *table, ssize_t idx) override; + virtual cocos2d::Size tableCellSizeForIndex(cocos2d::extension::TableView *table, ssize_t idx) override; + virtual ssize_t numberOfCellsInTableView(cocos2d::extension::TableView *table) override; + + virtual void scrollViewDidScroll(cocos2d::extension::ScrollView* view) override{} + virtual void scrollViewDidZoom(cocos2d::extension::ScrollView* view) override{} + +private: + std::vector> _testCallbacks; + bool _cellTouchEnabled; + bool _shouldRestoreTableOffset; + cocos2d::Vec2 _tableOffset; + friend class TestController; +}; + + +#define ADD_TEST(__className__) addTest( #__className__, [](){ return new (std::nothrow) __className__;} ); + +#define ADD_TEST_CASE(__className__) addTestCase( #__className__, [](){ return __className__::create();} ); + +#define DEFINE_TEST_LIST(__className__) class __className__ : public TestList { public: __className__();} + +#define DEFINE_TEST_SUITE(__className__) class __className__ : public TestSuite { public: __className__();} + + +/** + * BaseTest is retained for compatibility with older versions. + * @warning It should soon be removed. + */ +class BaseTest : public cocos2d::Layer +{ +public: + virtual std::string title() const { return ""; } + virtual std::string subtitle() const{ return ""; } + + virtual void restartCallback(cocos2d::Ref* sender) {} + virtual void nextCallback(cocos2d::Ref* sender){} + virtual void backCallback(cocos2d::Ref* sender){} + + virtual void onEnter() override{} + virtual void onExit() override{} +}; + +#endif /* defined(_CPPTESTS_BASETEST_H__) */ diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceAllocTest.cpp b/tests/performance-tests/Classes/tests/PerformanceAllocTest.cpp similarity index 85% rename from tests/cpp-tests/Classes/PerformanceTest/PerformanceAllocTest.cpp rename to tests/performance-tests/Classes/tests/PerformanceAllocTest.cpp index fe39b0f78a..1e1e9ca3d8 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceAllocTest.cpp +++ b/tests/performance-tests/Classes/tests/PerformanceAllocTest.cpp @@ -2,6 +2,7 @@ * */ #include "PerformanceAllocTest.h" +#include "Profile.h" #include @@ -55,11 +56,20 @@ enum { int PerformceAllocScene::quantityOfNodes = kNodesIncrease; +static int autoTestNodesNums[] = { + 1000, 2000, 3000 +}; + //////////////////////////////////////////////////////// // // PerformceAllocScene // //////////////////////////////////////////////////////// +PerformceAllocScene::PerformceAllocScene() +: autoTestIndex(0) +{ +} + bool PerformceAllocScene::init() { if (TestCase::init()) @@ -172,6 +182,18 @@ void PerformceAllocScene::onEnterTransitionDidFinish() auto director = Director::getInstance(); auto sched = director->getScheduler(); + if (this->isAutoTesting()) { + // Update the quantity of nodes if is auto testing. + quantityOfNodes = autoTestNodesNums[autoTestIndex]; + updateQuantityLabel(); + updateQuantityOfNodes(); + updateProfilerName(); + + Profile::getInstance()->testCaseBegin("AllocTest", + genStrVector("Type", "NodeCount", nullptr), + genStrVector("Avg", "Min", "Max", nullptr)); + } + CC_PROFILER_PURGE_ALL(); sched->schedule(CC_SCHEDULE_SELECTOR(PerformceAllocScene::dumpProfilerInfo), this, 2, false); } @@ -179,6 +201,34 @@ void PerformceAllocScene::onEnterTransitionDidFinish() void PerformceAllocScene::dumpProfilerInfo(float dt) { CC_PROFILER_DISPLAY_TIMERS(); + + if (this->isAutoTesting()) { + // record the test result to class Profile + auto timer = Profiler::getInstance()->_activeTimers.at(_profilerName); + auto numStr = genStr("%d", quantityOfNodes); + auto avgStr = genStr("%ldµ", timer->_averageTime2); + auto minStr = genStr("%ldµ", timer->minTime); + auto maxStr = genStr("%ldµ", timer->maxTime); + Profile::getInstance()->addTestResult(genStrVector(getTestCaseName().c_str(), numStr.c_str(), nullptr), + genStrVector(avgStr.c_str(), minStr.c_str(), maxStr.c_str(), nullptr)); + + auto testsSize = sizeof(autoTestNodesNums)/sizeof(int); + if (autoTestIndex >= (testsSize - 1)) { + // if it's the last one of auto test. End the auto test. + this->setAutoTesting(false); + Profile::getInstance()->testCaseEnd(); + } + else + { + // update the auto test index + autoTestIndex++; + quantityOfNodes = autoTestNodesNums[autoTestIndex]; + updateQuantityLabel(); + updateQuantityOfNodes(); + updateProfilerName(); + CC_PROFILER_PURGE_ALL(); + } + } } //////////////////////////////////////////////////////// diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceAllocTest.h b/tests/performance-tests/Classes/tests/PerformanceAllocTest.h similarity index 98% rename from tests/cpp-tests/Classes/PerformanceTest/PerformanceAllocTest.h rename to tests/performance-tests/Classes/tests/PerformanceAllocTest.h index 6221a6a7eb..378196da34 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceAllocTest.h +++ b/tests/performance-tests/Classes/tests/PerformanceAllocTest.h @@ -34,10 +34,12 @@ public: virtual void onEnterTransitionDidFinish() override; protected: + PerformceAllocScene(); char _profilerName[256]; int lastRenderedCount; static int quantityOfNodes; int currentQuantityOfNodes; + int autoTestIndex; }; class NodeCreateTest : public PerformceAllocScene diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceCallbackTest.cpp b/tests/performance-tests/Classes/tests/PerformanceCallbackTest.cpp similarity index 82% rename from tests/cpp-tests/Classes/PerformanceTest/PerformanceCallbackTest.cpp rename to tests/performance-tests/Classes/tests/PerformanceCallbackTest.cpp index 20da0f7f0a..111329ed86 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceCallbackTest.cpp +++ b/tests/performance-tests/Classes/tests/PerformanceCallbackTest.cpp @@ -3,6 +3,7 @@ // #include "PerformanceCallbackTest.h" +#include "Profile.h" #include USING_NS_CC; @@ -53,6 +54,12 @@ void PerformanceCallbackScene::onEnter() CC_PROFILER_PURGE_ALL(); + if (isAutoTesting()) { + Profile::getInstance()->testCaseBegin("CallbackTest", + genStrVector("Type", "LoopCount", nullptr), + genStrVector("Avg", "Min", "Max", nullptr)); + } + getScheduler()->schedule(CC_SCHEDULE_SELECTOR(PerformanceCallbackScene::onUpdate), this, 0.0f, false); getScheduler()->schedule(CC_SCHEDULE_SELECTOR(PerformanceCallbackScene::dumpProfilerInfo), this, 2, false); } @@ -70,6 +77,20 @@ std::string PerformanceCallbackScene::subtitle() const void PerformanceCallbackScene::dumpProfilerInfo(float dt) { CC_PROFILER_DISPLAY_TIMERS(); + + if (this->isAutoTesting()) { + // record the test result to class Profile + auto timer = Profiler::getInstance()->_activeTimers.at(_profileName); + auto numStr = genStr("%d", LOOP_COUNT); + auto avgStr = genStr("%ldµ", timer->_averageTime2); + auto minStr = genStr("%ldµ", timer->minTime); + auto maxStr = genStr("%ldµ", timer->maxTime); + Profile::getInstance()->addTestResult(genStrVector(_profileName.c_str(), numStr.c_str(), nullptr), + genStrVector(avgStr.c_str(), minStr.c_str(), maxStr.c_str(), nullptr)); + + this->setAutoTesting(false); + Profile::getInstance()->testCaseEnd(); + } } diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceCallbackTest.h b/tests/performance-tests/Classes/tests/PerformanceCallbackTest.h similarity index 100% rename from tests/cpp-tests/Classes/PerformanceTest/PerformanceCallbackTest.h rename to tests/performance-tests/Classes/tests/PerformanceCallbackTest.h diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceContainerTest.cpp b/tests/performance-tests/Classes/tests/PerformanceContainerTest.cpp similarity index 92% rename from tests/cpp-tests/Classes/PerformanceTest/PerformanceContainerTest.cpp rename to tests/performance-tests/Classes/tests/PerformanceContainerTest.cpp index 853e151e95..051398a702 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceContainerTest.cpp +++ b/tests/performance-tests/Classes/tests/PerformanceContainerTest.cpp @@ -2,6 +2,7 @@ * */ #include "PerformanceContainerTest.h" +#include "Profile.h" #include USING_NS_CC; @@ -54,6 +55,10 @@ enum { kNodesIncrease = 500, }; +static int autoTestCounts[] = { + 3000, 5000 +}; + int PerformanceContainerScene::quantityOfNodes = kNodesIncrease; //////////////////////////////////////////////////////// @@ -140,9 +145,7 @@ void PerformanceContainerScene::initWithQuantityOfNodes(unsigned int nNodes) auto toggle = MenuItemToggle::createWithCallback([this](Ref* sender){ auto toggle = static_cast(sender); - this->_type = toggle->getSelectedIndex(); - _subtitleLabel->setString(StringUtils::format("Test '%s', See console", this->_testFunctions[this->_type].name)); - this->updateProfilerName(); + switchTestType(toggle->getSelectedIndex()); }, toggleItems); toggle->setAnchorPoint(Vec2::ANCHOR_MIDDLE_LEFT); @@ -198,6 +201,58 @@ void PerformanceContainerScene::initWithQuantityOfNodes(unsigned int nNodes) updateProfilerName(); } +void PerformanceContainerScene::onEnter() +{ + TestCase::onEnter(); + if (isAutoTesting()) { + this->_startItem->setEnabled(false); + this->_stopItem->setEnabled(false); + this->_toggle->setEnabled(false); + this->_increase->setEnabled(false); + this->_decrease->setEnabled(false); + + autoTestCountIndex = 0; + _type = 0; + updateStatus(); + + Profile::getInstance()->testCaseBegin("ContainerTest", + genStrVector("Type", "Interface", "LoopCount", nullptr), + genStrVector("Avg", "Min", "Max", nullptr)); + + auto director = Director::getInstance(); + auto sched = director->getScheduler(); + sched->schedule(CC_SCHEDULE_SELECTOR(PerformanceContainerScene::dumpProfilerInfo), this, 2, false); + this->unscheduleUpdate(); + this->scheduleUpdate(); + } +} + +void PerformanceContainerScene::onExit() +{ + TestCase::onExit(); + auto director = Director::getInstance(); + auto sched = director->getScheduler(); + sched->unscheduleAllForTarget(this); +} + +void PerformanceContainerScene::updateStatus() +{ + quantityOfNodes = autoTestCounts[autoTestCountIndex]; + _toggle->setSelectedIndex(_type); + switchTestType(_type); + + updateQuantityLabel(); + updateQuantityOfNodes(); + CC_PROFILER_PURGE_ALL(); +} + +void PerformanceContainerScene::switchTestType(unsigned int index) +{ + this->_type = index; + _subtitleLabel->setString(StringUtils::format("Test '%s', See console", this->_testFunctions[this->_type].name)); + this->updateProfilerName(); +} + std::string PerformanceContainerScene::title() const { return "No title"; @@ -234,6 +289,37 @@ void PerformanceContainerScene::updateProfilerName() void PerformanceContainerScene::dumpProfilerInfo(float dt) { CC_PROFILER_DISPLAY_TIMERS(); + + if (this->isAutoTesting()) { + // record the test result to class Profile + auto timer = Profiler::getInstance()->_activeTimers.at(_profilerName); + auto numStr = genStr("%d", quantityOfNodes); + auto avgStr = genStr("%ldµ", timer->_averageTime2); + auto minStr = genStr("%ldµ", timer->minTime); + auto maxStr = genStr("%ldµ", timer->maxTime); + Profile::getInstance()->addTestResult(genStrVector(_typePrefix.c_str(), _testFunctions[_type].name, numStr.c_str(), nullptr), + genStrVector(avgStr.c_str(), minStr.c_str(), maxStr.c_str(), nullptr)); + + auto testsSize = sizeof(autoTestCounts)/sizeof(int); + auto typeSize = _testFunctions.size(); + if (autoTestCountIndex >= (testsSize - 1) && + _type >= (typeSize - 1)) { + // if it's the last one of auto test. End the auto test. + this->setAutoTesting(false); + Profile::getInstance()->testCaseEnd(); + return; + } + + if (autoTestCountIndex >= (testsSize - 1)) { + autoTestCountIndex = 0; + _type++; + } + else + { + autoTestCountIndex++; + } + updateStatus(); + } } void PerformanceContainerScene::update(float dt) @@ -259,6 +345,7 @@ const char* PerformanceContainerScene::testName() void TemplateVectorPerfTest::generateTestFunctions() { + _typePrefix = "Vector"; auto createVector = [this](){ Vector ret; @@ -481,6 +568,7 @@ std::string ArrayPerfTest::subtitle() const void ArrayPerfTest::generateTestFunctions() { + _typePrefix = "__Array"; auto createArray = [this](){ __Array* ret = __Array::create(); @@ -651,6 +739,7 @@ void ArrayPerfTest::generateTestFunctions() void TemplateMapStringKeyPerfTest::generateTestFunctions() { + _typePrefix = "MapStringKey"; auto createMap = [this](){ Map ret; @@ -830,6 +919,7 @@ std::string TemplateMapStringKeyPerfTest::subtitle() const void DictionaryStringKeyPerfTest::generateTestFunctions() { + _typePrefix = "__DictStringKey"; auto createDict = [this](){ __Dictionary* ret = __Dictionary::create(); @@ -1014,6 +1104,7 @@ std::string DictionaryStringKeyPerfTest::subtitle() const void TemplateMapIntKeyPerfTest::generateTestFunctions() { + _typePrefix = "MapIntKey"; auto createMap = [this](){ Map ret; @@ -1169,6 +1260,7 @@ std::string TemplateMapIntKeyPerfTest::subtitle() const void DictionaryIntKeyPerfTest::generateTestFunctions() { + _typePrefix = "__DictIntKey"; auto createDict = [this](){ __Dictionary* ret = __Dictionary::create(); diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceContainerTest.h b/tests/performance-tests/Classes/tests/PerformanceContainerTest.h similarity index 94% rename from tests/cpp-tests/Classes/PerformanceTest/PerformanceContainerTest.h rename to tests/performance-tests/Classes/tests/PerformanceContainerTest.h index 96e0747b1d..c8e38d002b 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceContainerTest.h +++ b/tests/performance-tests/Classes/tests/PerformanceContainerTest.h @@ -28,6 +28,8 @@ public: virtual std::string subtitle() const override; virtual void updateQuantityOfNodes(); + void switchTestType(unsigned int index); + void updateStatus(); const char* profilerName(); void updateProfilerName(); @@ -39,6 +41,8 @@ public: // overrides virtual void update(float dt) override; + virtual void onEnter() override; + virtual void onExit() override; protected: static int quantityOfNodes; @@ -48,12 +52,15 @@ protected: int currentQuantityOfNodes; unsigned int _type; std::vector _testFunctions; + std::string _typePrefix; cocos2d::MenuItemFont* _increase; cocos2d::MenuItemFont* _decrease; cocos2d::MenuItemFont* _startItem; cocos2d::MenuItemFont* _stopItem; cocos2d::MenuItemToggle* _toggle; + + int autoTestCountIndex; }; class TemplateVectorPerfTest : public PerformanceContainerScene diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceEventDispatcherTest.cpp b/tests/performance-tests/Classes/tests/PerformanceEventDispatcherTest.cpp similarity index 88% rename from tests/cpp-tests/Classes/PerformanceTest/PerformanceEventDispatcherTest.cpp rename to tests/performance-tests/Classes/tests/PerformanceEventDispatcherTest.cpp index 71e7b12c5b..b90250da06 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceEventDispatcherTest.cpp +++ b/tests/performance-tests/Classes/tests/PerformanceEventDispatcherTest.cpp @@ -4,6 +4,7 @@ #include "PerformanceEventDispatcherTest.h" #include +#include "Profile.h" USING_NS_CC; @@ -52,6 +53,10 @@ enum { kNodesIncrease = 500, }; +static int autoTestNodesNums[] = { + 1000, 2000, 3000 +}; + int PerformanceEventDispatcherScene::quantityOfNodes = kNodesIncrease; //////////////////////////////////////////////////////// @@ -133,31 +138,10 @@ void PerformanceEventDispatcherScene::initWithQuantityOfNodes(unsigned int nNode { toggleItems.pushBack(MenuItemFont::create(f.name)); } - - auto reset = [this](){ - // Removes all nodes - for (auto& node : _nodes) - { - node->removeFromParent(); - } - - _nodes.clear(); - - // Removes all fixed listeners - for (auto& listener : _fixedPriorityListeners) - { - Director::getInstance()->getEventDispatcher()->removeEventListener(listener); - } - - this->_lastRenderedCount = 0; - }; - + auto toggle = MenuItemToggle::createWithCallback([=](Ref* sender){ auto toggle = static_cast(sender); - this->_type = toggle->getSelectedIndex(); - _subtitleLabel->setString(StringUtils::format("Test '%s', See console", this->_testFunctions[this->_type].name)); - this->updateProfilerName(); - reset(); + switchTestType(toggle->getSelectedIndex()); }, toggleItems); toggle->setAnchorPoint(Vec2::ANCHOR_MIDDLE_LEFT); @@ -215,6 +199,78 @@ void PerformanceEventDispatcherScene::initWithQuantityOfNodes(unsigned int nNode updateProfilerName(); } +void PerformanceEventDispatcherScene::onEnter() +{ + TestCase::onEnter(); + if (isAutoTesting()) { + this->_startItem->setEnabled(false); + this->_stopItem->setEnabled(false); + this->_toggle->setEnabled(false); + this->_increase->setEnabled(false); + this->_decrease->setEnabled(false); + + autoTestCountIndex = 0; + _type = 0; + updateStatus(); + + Profile::getInstance()->testCaseBegin("EventDispatcherTest", + genStrVector("Type", "ListenerCount", nullptr), + genStrVector("Avg", "Min", "Max", nullptr)); + + auto director = Director::getInstance(); + auto sched = director->getScheduler(); + sched->schedule(CC_SCHEDULE_SELECTOR(PerformanceEventDispatcherScene::dumpProfilerInfo), this, 2, false); + this->unscheduleUpdate(); + this->scheduleUpdate(); + } +} + +void PerformanceEventDispatcherScene::onExit() +{ + TestCase::onExit(); + auto director = Director::getInstance(); + auto sched = director->getScheduler(); + sched->unscheduleAllForTarget(this); +} + +void PerformanceEventDispatcherScene::updateStatus() +{ + quantityOfNodes = autoTestNodesNums[autoTestCountIndex]; + _toggle->setSelectedIndex(_type); + switchTestType(_type); + + updateQuantityLabel(); + updateQuantityOfNodes(); + CC_PROFILER_PURGE_ALL(); +} + +void PerformanceEventDispatcherScene::reset() +{ + // Removes all nodes + for (auto& node : _nodes) + { + node->removeFromParent(); + } + + _nodes.clear(); + + // Removes all fixed listeners + for (auto& listener : _fixedPriorityListeners) + { + Director::getInstance()->getEventDispatcher()->removeEventListener(listener); + } + + this->_lastRenderedCount = 0; +} + +void PerformanceEventDispatcherScene::switchTestType(unsigned int index) +{ + this->_type = index; + _subtitleLabel->setString(StringUtils::format("Test '%s', See console", this->_testFunctions[this->_type].name)); + this->updateProfilerName(); + reset(); +} + std::string PerformanceEventDispatcherScene::title() const { return "No title"; @@ -249,6 +305,37 @@ void PerformanceEventDispatcherScene::updateProfilerName() void PerformanceEventDispatcherScene::dumpProfilerInfo(float dt) { CC_PROFILER_DISPLAY_TIMERS(); + + if (this->isAutoTesting()) { + // record the test result to class Profile + auto timer = Profiler::getInstance()->_activeTimers.at(_profilerName); + auto numStr = genStr("%d", quantityOfNodes); + auto avgStr = genStr("%ldµ", timer->_averageTime2); + auto minStr = genStr("%ldµ", timer->minTime); + auto maxStr = genStr("%ldµ", timer->maxTime); + Profile::getInstance()->addTestResult(genStrVector(_testFunctions[_type].name, numStr.c_str(), nullptr), + genStrVector(avgStr.c_str(), minStr.c_str(), maxStr.c_str(), nullptr)); + + auto testsSize = sizeof(autoTestNodesNums)/sizeof(int); + auto typeSize = _testFunctions.size(); + if (autoTestCountIndex >= (testsSize - 1) && + _type >= (typeSize - 1)) { + // if it's the last one of auto test. End the auto test. + this->setAutoTesting(false); + Profile::getInstance()->testCaseEnd(); + return; + } + + if (autoTestCountIndex >= (testsSize - 1)) { + autoTestCountIndex = 0; + _type++; + } + else + { + autoTestCountIndex++; + } + updateStatus(); + } } void PerformanceEventDispatcherScene::update(float dt) diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceEventDispatcherTest.h b/tests/performance-tests/Classes/tests/PerformanceEventDispatcherTest.h similarity index 93% rename from tests/cpp-tests/Classes/PerformanceTest/PerformanceEventDispatcherTest.h rename to tests/performance-tests/Classes/tests/PerformanceEventDispatcherTest.h index d586dc669a..b3ff14b0b8 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceEventDispatcherTest.h +++ b/tests/performance-tests/Classes/tests/PerformanceEventDispatcherTest.h @@ -27,7 +27,10 @@ public: virtual std::string title() const override; virtual std::string subtitle() const override; virtual void updateQuantityOfNodes(); - + + void updateStatus(); + void reset(); + void switchTestType(unsigned int index); const char* profilerName(); void updateProfilerName(); @@ -38,6 +41,8 @@ public: // overrides virtual void update(float dt) override; + virtual void onEnter() override; + virtual void onExit() override; protected: static int quantityOfNodes; @@ -54,6 +59,8 @@ protected: cocos2d::MenuItemFont* _startItem; cocos2d::MenuItemFont* _stopItem; cocos2d::MenuItemToggle* _toggle; + + int autoTestCountIndex; }; class TouchEventDispatchingPerfTest : public PerformanceEventDispatcherScene diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceLabelTest.cpp b/tests/performance-tests/Classes/tests/PerformanceLabelTest.cpp similarity index 65% rename from tests/cpp-tests/Classes/PerformanceTest/PerformanceLabelTest.cpp rename to tests/performance-tests/Classes/tests/PerformanceLabelTest.cpp index 019df97a28..96951f6332 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceLabelTest.cpp +++ b/tests/performance-tests/Classes/tests/PerformanceLabelTest.cpp @@ -1,12 +1,15 @@ #include "PerformanceLabelTest.h" +#include "Profile.h" USING_NS_CC; +#define DELAY_TIME 1 +#define STAT_TIME 3 + enum { kMaxNodes = 200, + kInitNodeCount = 20, kNodesIncrease = 10, - - TEST_COUNT = 5, }; enum { @@ -21,7 +24,14 @@ enum { kCaseLabelBMFontUpdate, kCaseLabelUpdate, kCaseLabelBMFontBigLabels, - kCaseLabelBigLabels + kCaseLabelBigLabels, + + kCaseCount +}; + +static int _curTestCase = kCaseLabelTTFUpdate; +static int _autoTestNodeCounts[] = { + 50, 100 }; #define LongSentencesExample "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\ @@ -30,7 +40,7 @@ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor PerformceLabelTests::PerformceLabelTests() { - LabelMainScene::_s_labelCurCase = 0; + _curTestCase = kCaseLabelTTFUpdate; addTestCase("LabelTTF Performance Test", [](){ return LabelMainScene::create(); }); addTestCase("LabelBMFont Performance Test", [](){ return LabelMainScene::create(); }); addTestCase("Label Performance Test", [](){ return LabelMainScene::create(); }); @@ -43,11 +53,6 @@ PerformceLabelTests::PerformceLabelTests() // LabelMainScene // //////////////////////////////////////////////////////// - -bool LabelMainScene::_s_autoTest = false; -int LabelMainScene::_s_labelCurCase = 0; -int LabelMainScene::NODE_TEST_COUNT = AUTO_TEST_NODE_NUM; - bool LabelMainScene::init() { //srandom(0); @@ -80,32 +85,8 @@ bool LabelMainScene::init() infoLabel->setColor(Color3B(0,200,20)); infoLabel->setPosition(Vec2(s.width/2, s.height-90)); addChild(infoLabel, 1, kTagInfoLayer); - - /** - * auto test menu - */ - - auto menuAutoTest = Menu::create(); - menuAutoTest->setPosition( Vec2::ZERO ); - MenuItemFont::setFontName("fonts/arial.ttf"); - MenuItemFont::setFontSize(24); - - MenuItemFont* autoTestItem = nullptr; - if (LabelMainScene::_s_autoTest) - { - autoTestItem = MenuItemFont::create("Auto Test On",CC_CALLBACK_1(LabelMainScene::onAutoTest, this)); - } - else - { - autoTestItem = MenuItemFont::create("Auto Test Off",CC_CALLBACK_1(LabelMainScene::onAutoTest, this)); - } - autoTestItem->setTag(1); - autoTestItem->setPosition(Vec2( s.width - 90, s.height / 2)); - autoTestItem->setColor(Color3B::RED); - menuAutoTest->addChild(autoTestItem); - addChild( menuAutoTest, 3, kTagAutoTestMenu ); - while (_quantityNodes < NODE_TEST_COUNT) + while (_quantityNodes < kInitNodeCount) onIncrease(this); return true; @@ -113,7 +94,7 @@ bool LabelMainScene::init() std::string LabelMainScene::title() const { - switch (_s_labelCurCase) + switch (_curTestCase) { case kCaseLabelTTFUpdate: return "Testing LabelTTF Update"; @@ -155,7 +136,7 @@ void LabelMainScene::onIncrease(Ref* sender) return; auto size = Director::getInstance()->getWinSize(); - switch (_s_labelCurCase) + switch (_curTestCase) { case kCaseLabelTTFUpdate: for( int i=0;i< kNodesIncrease;i++) @@ -234,49 +215,22 @@ void LabelMainScene::onDecrease(Ref* sender) updateNodes(); } -void LabelMainScene::dumpProfilerFPS() -{ - if (_vecFPS.empty()) - { - log("Error: the FPS vector is empty"); - return; - } - - auto iter = _vecFPS.begin(); - float minFPS = *iter; - float maxFPS = *iter; - float totalFPS = 0.0f; - float averagerFPS = 0.0f; - for (auto fps : _vecFPS) - { - CCLOG("fps is :%f\n",fps); - minFPS = std::min(minFPS, fps); - maxFPS = std::max(maxFPS, fps); - totalFPS += fps; - } - - averagerFPS = totalFPS / _vecFPS.size(); - log("Cur test: %d, cur label nums:%d, the min FPS value is %.1f,the max FPS value is %.1f,the averager FPS is %.1f", LabelMainScene::_s_labelCurCase, _quantityNodes, minFPS, maxFPS, averagerFPS); - -} - -void LabelMainScene::updateAutoTest(float dt) -{ - if (LabelMainScene::_s_autoTest) - { - _executeTimes += 1; - _vecFPS.push_back(Director::getInstance()->getFrameRate()); - if ( _executeTimes >= LabelMainScene::MAX_AUTO_TEST_TIMES ) - { - dumpProfilerFPS(); - nextAutoTest(); - } - } -} - void LabelMainScene::updateText(float dt) { - if(_s_labelCurCase > kCaseLabelUpdate) + if (isStating) + { + totalStatTime += dt; + statCount++; + + auto curFrameRate = Director::getInstance()->getFrameRate(); + if (maxFrameRate < 0 || curFrameRate > maxFrameRate) + maxFrameRate = curFrameRate; + + if (minFrameRate < 0 || curFrameRate < minFrameRate) + minFrameRate = curFrameRate; + } + + if(_curTestCase > kCaseLabelUpdate) return; _accumulativeTime += dt; @@ -284,8 +238,7 @@ void LabelMainScene::updateText(float dt) sprintf(text,"%.2f",_accumulativeTime); auto& children = _labelContainer->getChildren(); - - switch (_s_labelCurCase) + switch (_curTestCase) { case kCaseLabelTTFUpdate: for(const auto &child : children) { @@ -318,97 +271,115 @@ void LabelMainScene::onEnter() auto sched = director->getScheduler(); sched->schedule(CC_SCHEDULE_SELECTOR(LabelMainScene::updateText), this, 0.0f, false); - _vecFPS.clear(); - _executeTimes = 0; - sched->schedule(CC_SCHEDULE_SELECTOR(LabelMainScene::updateAutoTest), this, 0.2f, false); + if (this->isAutoTesting()) { + Profile::getInstance()->testCaseBegin("LabelTest", + genStrVector("Type", "LabelCount", nullptr), + genStrVector("Avg", "Min", "Max", nullptr)); + autoTestIndex = 0; + doAutoTest(); + } } void LabelMainScene::onExit() { auto director = Director::getInstance(); auto sched = director->getScheduler(); - sched->unschedule(CC_SCHEDULE_SELECTOR(LabelMainScene::updateText), this ); - sched->unschedule(CC_SCHEDULE_SELECTOR(LabelMainScene::updateAutoTest), this ); - + sched->unscheduleAllForTarget(this); + Scene::onExit(); } -void LabelMainScene::endAutoTest() +void LabelMainScene::doAutoTest() { - LabelMainScene::_s_autoTest = false; + isStating = false; + statCount = 0; + totalStatTime = 0.0f; + minFrameRate = -1.0f; + maxFrameRate = -1.0f; - _vecFPS.clear(); - _executeTimes = 0; + // remove all labels + _labelContainer->removeAllChildren(); + _quantityNodes = 0; + + // add labels + int newCount = _autoTestNodeCounts[autoTestIndex]; + while (_quantityNodes < newCount) { + onIncrease(this); + } + + schedule(CC_SCHEDULE_SELECTOR(LabelMainScene::beginStat), DELAY_TIME); + schedule(CC_SCHEDULE_SELECTOR(LabelMainScene::endStat), DELAY_TIME + STAT_TIME); } -void LabelMainScene::nextAutoTest() +void LabelMainScene::beginStat(float dt) { - if ( LabelMainScene::_s_labelCurCase + 1 < LabelMainScene::MAX_SUB_TEST_NUMS ) - { - nextTestCallback(nullptr); - } - else - { - finishAutoTest(); - } + unschedule(CC_SCHEDULE_SELECTOR(LabelMainScene::beginStat)); + isStating = true; } -void LabelMainScene::finishAutoTest() +void LabelMainScene::endStat(float dt) { - LabelMainScene::_s_autoTest = false; - _vecFPS.clear(); - _executeTimes = 0; - - auto autoTestMenu = dynamic_cast(getChildByTag(kTagAutoTestMenu)); - if (nullptr != autoTestMenu) - { - auto menuItemFont = dynamic_cast(autoTestMenu->getChildByTag(1)); - if (nullptr != menuItemFont) - { - menuItemFont->setString("Auto Test finish"); - } - } + unschedule(CC_SCHEDULE_SELECTOR(LabelMainScene::endStat)); + isStating = false; - log("Label performance test is finish "); -} - -void LabelMainScene::onAutoTest(Ref* sender) -{ - LabelMainScene::_s_autoTest = !LabelMainScene::_s_autoTest; - _vecFPS.clear(); - _executeTimes = 0; - MenuItemFont* menuItem = dynamic_cast(sender); - if (nullptr != menuItem) + // record test data + std::string tf; + switch (_curTestCase) { - if (LabelMainScene::_s_autoTest) - { - menuItem->setString("Auto Test On"); - } - else - { - menuItem->setString("Auto Test Off"); - endAutoTest(); - } + case kCaseLabelTTFUpdate: + tf = "LabelTTF"; + break; + case kCaseLabelBMFontUpdate: + tf = "LabelBMFont"; + break; + case kCaseLabelUpdate: + tf = "Label"; + break; + case kCaseLabelBMFontBigLabels: + tf = "LabelBMFont Big Labels"; + break; + case kCaseLabelBigLabels: + tf = "Label Big Labels"; + break; + default: + tf = "unknown"; + break; } + auto avgStr = genStr("%.2f", (float) statCount / totalStatTime); + Profile::getInstance()->addTestResult(genStrVector(tf.c_str(), genStr("%d", _quantityNodes).c_str(), nullptr), + genStrVector(avgStr.c_str(), genStr("%.2f", minFrameRate).c_str(), + genStr("%.2f", maxFrameRate).c_str(), nullptr)); + + // check the auto test is end or not + int autoTestCount = sizeof(_autoTestNodeCounts) / sizeof(int); + if (autoTestIndex >= (autoTestCount - 1)) + { + // auto test end + Profile::getInstance()->testCaseEnd(); + _curTestCase++; + setAutoTesting(false); + return; + } + + autoTestIndex++; + doAutoTest(); } void LabelMainScene::nextTestCallback(cocos2d::Ref* sender) { - NODE_TEST_COUNT = _quantityNodes; - _s_labelCurCase = (_s_labelCurCase + 1) % MAX_SUB_TEST_NUMS; + _curTestCase = (_curTestCase + 1) % kCaseCount; TestCase::nextTestCallback(sender); } void LabelMainScene::priorTestCallback(cocos2d::Ref* sender) { - NODE_TEST_COUNT = _quantityNodes; - if (_s_labelCurCase > 0) + if (_curTestCase > 0) { - _s_labelCurCase -= 1; + _curTestCase -= 1; } else { - _s_labelCurCase = MAX_SUB_TEST_NUMS - 1; + _curTestCase = kCaseCount - 1; } TestCase::priorTestCallback(sender); } diff --git a/tests/performance-tests/Classes/tests/PerformanceLabelTest.h b/tests/performance-tests/Classes/tests/PerformanceLabelTest.h new file mode 100644 index 0000000000..476a7b7905 --- /dev/null +++ b/tests/performance-tests/Classes/tests/PerformanceLabelTest.h @@ -0,0 +1,47 @@ +#ifndef __PERFORMANCE_LABEL_TEST_H__ +#define __PERFORMANCE_LABEL_TEST_H__ + +#include "BaseTest.h" + +DEFINE_TEST_SUITE(PerformceLabelTests); + +class LabelMainScene : public TestCase +{ +public: + CREATE_FUNC(LabelMainScene); + + virtual ~LabelMainScene(); + + std::string title() const override; + virtual bool init() override; + void updateNodes(); + + void onIncrease(cocos2d::Ref* sender); + void onDecrease(cocos2d::Ref* sender); + void updateText(float dt); + + virtual void onEnter() override; + virtual void onExit() override; + void beginStat(float dt); + void endStat(float dt); + void doAutoTest(); + + virtual void nextTestCallback(cocos2d::Ref* sender) override; + virtual void priorTestCallback(cocos2d::Ref* sender) override; + +private: + cocos2d::Layer* _labelContainer; + + int _lastRenderedCount; + int _quantityNodes; + float _accumulativeTime; + + bool isStating; + int autoTestIndex; + int statCount; + float totalStatTime; + float minFrameRate; + float maxFrameRate; +}; + +#endif diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceMathTest.cpp b/tests/performance-tests/Classes/tests/PerformanceMathTest.cpp similarity index 72% rename from tests/cpp-tests/Classes/PerformanceTest/PerformanceMathTest.cpp rename to tests/performance-tests/Classes/tests/PerformanceMathTest.cpp index 4cb1ba50ce..3f3879f1b6 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceMathTest.cpp +++ b/tests/performance-tests/Classes/tests/PerformanceMathTest.cpp @@ -1,4 +1,5 @@ #include "PerformanceMathTest.h" +#include "Profile.h" USING_NS_CC; @@ -31,11 +32,14 @@ USING_NS_CC; static const int K_INFO_LOOP_TAG = 1581; +static int autoTestLoopCounts[] = { + 10000, 20000, 30000 +}; + PerformceMathTests::PerformceMathTests() { ADD_TEST_CASE(PerformanceMathLayer1); ADD_TEST_CASE(PerformanceMathLayer2); - ADD_TEST_CASE(PerformanceMathLayer1); } void PerformanceMathLayer::onEnter() @@ -47,6 +51,14 @@ void PerformanceMathLayer::onEnter() CC_PROFILER_PURGE_ALL(); + if (isAutoTesting()) { + autoTestIndex = 0; + _loopCount = autoTestLoopCounts[autoTestIndex]; + Profile::getInstance()->testCaseBegin("MathTest", + genStrVector("Type", "LoopCount", nullptr), + genStrVector("Avg", "Min", "Max", nullptr)); + } + auto s = Director::getInstance()->getWinSize(); MenuItemFont::setFontSize(65); @@ -74,6 +86,7 @@ void PerformanceMathLayer::onEnter() void PerformanceMathLayer::addLoopCount(Ref *sender) { _loopCount += _stepCount; + CC_PROFILER_PURGE_ALL(); updateLoopLabel(); } @@ -81,6 +94,7 @@ void PerformanceMathLayer::subLoopCount(Ref *sender) { _loopCount -= _stepCount; _loopCount = std::max(_loopCount, 0); + CC_PROFILER_PURGE_ALL(); updateLoopLabel(); } @@ -96,6 +110,31 @@ void PerformanceMathLayer::updateLoopLabel() void PerformanceMathLayer::dumpProfilerInfo(float dt) { CC_PROFILER_DISPLAY_TIMERS(); + + if (this->isAutoTesting()) { + // record the test result to class Profile + auto timer = Profiler::getInstance()->_activeTimers.at(_profileName); + auto numStr = genStr("%d", _loopCount); + auto avgStr = genStr("%ldµ", timer->_averageTime2); + auto minStr = genStr("%ldµ", timer->minTime); + auto maxStr = genStr("%ldµ", timer->maxTime); + Profile::getInstance()->addTestResult(genStrVector(_profileName.c_str(), numStr.c_str(), nullptr), + genStrVector(avgStr.c_str(), minStr.c_str(), maxStr.c_str(), nullptr)); + + auto testsSize = sizeof(autoTestLoopCounts)/sizeof(int); + if (autoTestIndex >= (testsSize - 1)) { + this->setAutoTesting(false); + Profile::getInstance()->testCaseEnd(); + } + else + { + // update the auto test index + autoTestIndex++; + _loopCount = autoTestLoopCounts[autoTestIndex]; + updateLoopLabel(); + CC_PROFILER_PURGE_ALL(); + } + } } void PerformanceMathLayer1::doPerformanceTest(float dt) diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceMathTest.h b/tests/performance-tests/Classes/tests/PerformanceMathTest.h similarity index 93% rename from tests/cpp-tests/Classes/PerformanceTest/PerformanceMathTest.h rename to tests/performance-tests/Classes/tests/PerformanceMathTest.h index e63c60167a..1f0122b0ae 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceMathTest.h +++ b/tests/performance-tests/Classes/tests/PerformanceMathTest.h @@ -29,6 +29,7 @@ protected: void dumpProfilerInfo(float dt); void updateLoopLabel(); protected: + int autoTestIndex; int _loopCount; int _stepCount; std::string _profileName; @@ -41,7 +42,7 @@ public: PerformanceMathLayer1() { - _profileName = "profile_Mat4*Mat4"; + _profileName = "Mat4*Mat4"; } virtual void doPerformanceTest(float dt) override; @@ -57,7 +58,7 @@ public: PerformanceMathLayer2() { - _profileName = "profile_MatTransformVec4"; + _profileName = "MatTransformVec4"; } virtual void doPerformanceTest(float dt) override; diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp b/tests/performance-tests/Classes/tests/PerformanceNodeChildrenTest.cpp similarity index 91% rename from tests/cpp-tests/Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp rename to tests/performance-tests/Classes/tests/PerformanceNodeChildrenTest.cpp index 0a615d8868..72dbe44982 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp +++ b/tests/performance-tests/Classes/tests/PerformanceNodeChildrenTest.cpp @@ -1,4 +1,5 @@ #include "PerformanceNodeChildrenTest.h" +#include "Profile.h" #include USING_NS_CC; @@ -32,17 +33,17 @@ USING_NS_CC; PerformceNodeChildrenTests::PerformceNodeChildrenTests() { - ADD_TEST_CASE(IterateSpriteSheetForLoop); - ADD_TEST_CASE(IterateSpriteSheetIterator); - ADD_TEST_CASE(IterateSpriteSheetForEach); - ADD_TEST_CASE(CallFuncsSpriteSheetForEach); +// ADD_TEST_CASE(IterateSpriteSheetForLoop); +// ADD_TEST_CASE(IterateSpriteSheetIterator); +// ADD_TEST_CASE(IterateSpriteSheetForEach); +// ADD_TEST_CASE(CallFuncsSpriteSheetForEach); ADD_TEST_CASE(AddSprite); - ADD_TEST_CASE(AddSpriteSheet); +// ADD_TEST_CASE(AddSpriteSheet); ADD_TEST_CASE(GetSpriteSheet); ADD_TEST_CASE(RemoveSprite); - ADD_TEST_CASE(RemoveSpriteSheet); - ADD_TEST_CASE(ReorderSpriteSheet); - ADD_TEST_CASE(SortAllChildrenSpriteSheet); +// ADD_TEST_CASE(RemoveSpriteSheet); +// ADD_TEST_CASE(ReorderSpriteSheet); +// ADD_TEST_CASE(SortAllChildrenSpriteSheet); ADD_TEST_CASE(VisitSceneGraph); } @@ -59,11 +60,21 @@ enum { int NodeChildrenMainScene::quantityOfNodes = kNodesIncrease; +static int autoTestNodesNums[] = { + 1000, 2000, 3000 +}; + //////////////////////////////////////////////////////// // // NodeChildrenMainScene // //////////////////////////////////////////////////////// +NodeChildrenMainScene::NodeChildrenMainScene() +: autoTestIndex(0) +{ + +} + bool NodeChildrenMainScene::init() { if (TestCase::init()) @@ -88,6 +99,18 @@ void NodeChildrenMainScene::onEnterTransitionDidFinish() auto director = Director::getInstance(); auto sched = director->getScheduler(); + if (this->isAutoTesting()) { + // Update the quantity of nodes if is auto testing. + quantityOfNodes = autoTestNodesNums[autoTestIndex]; + updateQuantityLabel(); + updateQuantityOfNodes(); + updateProfilerName(); + + Profile::getInstance()->testCaseBegin("NodeChildrenTest", + genStrVector("Type", "NodeCount", nullptr), + genStrVector("Avg", "Min", "Max", nullptr)); + } + CC_PROFILER_PURGE_ALL(); sched->schedule(CC_SCHEDULE_SELECTOR(NodeChildrenMainScene::dumpProfilerInfo), this, 2, false); } @@ -95,6 +118,34 @@ void NodeChildrenMainScene::onEnterTransitionDidFinish() void NodeChildrenMainScene::dumpProfilerInfo(float dt) { CC_PROFILER_DISPLAY_TIMERS(); + + if (this->isAutoTesting()) { + // record the test result to class Profile + auto timer = Profiler::getInstance()->_activeTimers.at(_profilerName); + auto numStr = genStr("%d", quantityOfNodes); + auto avgStr = genStr("%ldµ", timer->_averageTime2); + auto minStr = genStr("%ldµ", timer->minTime); + auto maxStr = genStr("%ldµ", timer->maxTime); + Profile::getInstance()->addTestResult(genStrVector(getTestCaseName().c_str(), numStr.c_str(), nullptr), + genStrVector(avgStr.c_str(), minStr.c_str(), maxStr.c_str(), nullptr)); + + auto testsSize = sizeof(autoTestNodesNums)/sizeof(int); + if (autoTestIndex >= (testsSize - 1)) { + // if it's the last one of auto test. End the auto test. + this->setAutoTesting(false); + Profile::getInstance()->testCaseEnd(); + } + else + { + // update the auto test index + autoTestIndex++; + quantityOfNodes = autoTestNodesNums[autoTestIndex]; + updateQuantityLabel(); + updateQuantityOfNodes(); + updateProfilerName(); + CC_PROFILER_PURGE_ALL(); + } + } } void NodeChildrenMainScene::initWithQuantityOfNodes(unsigned int nNodes) diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceNodeChildrenTest.h b/tests/performance-tests/Classes/tests/PerformanceNodeChildrenTest.h similarity index 99% rename from tests/cpp-tests/Classes/PerformanceTest/PerformanceNodeChildrenTest.h rename to tests/performance-tests/Classes/tests/PerformanceNodeChildrenTest.h index 3aa3376078..ed8b6f77c4 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceNodeChildrenTest.h +++ b/tests/performance-tests/Classes/tests/PerformanceNodeChildrenTest.h @@ -27,10 +27,12 @@ public: virtual void onExitTransitionDidStart() override; virtual void onEnterTransitionDidFinish() override; protected: + NodeChildrenMainScene(); static int quantityOfNodes; char _profilerName[256]; int lastRenderedCount; int currentQuantityOfNodes; + int autoTestIndex; }; class IterateSpriteSheet : public NodeChildrenMainScene diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceParticle3DTest.cpp b/tests/performance-tests/Classes/tests/PerformanceParticle3DTest.cpp similarity index 58% rename from tests/cpp-tests/Classes/PerformanceTest/PerformanceParticle3DTest.cpp rename to tests/performance-tests/Classes/tests/PerformanceParticle3DTest.cpp index ead94295aa..261ff99696 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceParticle3DTest.cpp +++ b/tests/performance-tests/Classes/tests/PerformanceParticle3DTest.cpp @@ -1,5 +1,9 @@ #include "PerformanceParticle3DTest.h" #include "Particle3D/PU/CCPUParticleSystem3D.h" +#include "Profile.h" + +#define DELAY_TIME 4 +#define STAT_TIME 3 USING_NS_CC; using namespace cocos2d::ui; @@ -10,6 +14,10 @@ static int kTagParticleSystem = 1001; static int kMaxParticles = 14000; static int kNodesIncrease = 1; +static int autoTestParticleCounts[] = { + 200, 500, 800 +}; + PerformceParticle3DTests::PerformceParticle3DTests() { ADD_TEST_CASE(Particle3DPerformTest); @@ -17,14 +25,14 @@ PerformceParticle3DTests::PerformceParticle3DTests() //////////////////////////////////////////////////////// // -// ParticleMainScene +// Particle3DMainScene // //////////////////////////////////////////////////////// -void Particle3DMainScene::initWithSubTest(int asubtest, int particles) +void Particle3DMainScene::initScene() { //srandom(0); - _subtestNumber = asubtest; + isStating = false; auto s = Director::getInstance()->getWinSize(); _lastRenderedCount = 0; @@ -78,6 +86,89 @@ void Particle3DMainScene::initWithSubTest(int asubtest, int particles) schedule(CC_SCHEDULE_SELECTOR(Particle3DMainScene::step)); } +void Particle3DMainScene::onExitTransitionDidStart() +{ + Scene::onExitTransitionDidStart(); + + auto director = Director::getInstance(); + auto sched = director->getScheduler(); + + sched->unscheduleAllForTarget(this); +} + +void Particle3DMainScene::onEnterTransitionDidFinish() +{ + Scene::onEnterTransitionDidFinish(); + + if (this->isAutoTesting()) { + Profile::getInstance()->testCaseBegin("Particle3DTest", + genStrVector("ParticleSystemCount", nullptr), + genStrVector("Avg", "Min", "Max", nullptr)); + autoTestIndex = 0; + + doAutoTest(); + } +} + +void Particle3DMainScene::removeAllParticles() +{ + for (int i = 0; i < _quantityParticles; i++) { + removeChildByTag(kTagParticleSystem + i, true); + } + _quantityParticles = 0; +} + +void Particle3DMainScene::doAutoTest() +{ + isStating = false; + statCount = 0; + totalStatTime = 0.0f; + minFrameRate = -1.0f; + maxFrameRate = -1.0f; + + removeAllParticles(); + _quantityParticles = autoTestParticleCounts[autoTestIndex]; + updateQuantityLabel(); + for (int i = 0; i < _quantityParticles; i++) { + createParticleSystem(i); + } + + schedule(CC_SCHEDULE_SELECTOR(Particle3DMainScene::beginStat), DELAY_TIME); + schedule(CC_SCHEDULE_SELECTOR(Particle3DMainScene::endStat), DELAY_TIME + STAT_TIME); +} + +void Particle3DMainScene::beginStat(float dt) +{ + unschedule(CC_SCHEDULE_SELECTOR(Particle3DMainScene::beginStat)); + isStating = true; +} + +void Particle3DMainScene::endStat(float dt) +{ + unschedule(CC_SCHEDULE_SELECTOR(Particle3DMainScene::endStat)); + isStating = false; + + // record test data + auto avgStr = genStr("%.2f", (float) statCount / totalStatTime); + Profile::getInstance()->addTestResult(genStrVector(genStr("%d", _quantityParticles).c_str(), nullptr), + genStrVector(avgStr.c_str(), genStr("%.2f", minFrameRate).c_str(), + genStr("%.2f", maxFrameRate).c_str(), nullptr)); + + // check the auto test is end or not + int autoTestCount = sizeof(autoTestParticleCounts) / sizeof(int); + if (autoTestIndex >= (autoTestCount - 1)) + { + // auto test end + Profile::getInstance()->testCaseEnd(); + setAutoTesting(false); + } + else + { + autoTestIndex++; + } + doAutoTest(); +} + void Particle3DMainScene::step(float dt) { unsigned int count = 0; @@ -98,6 +189,19 @@ void Particle3DMainScene::step(float dt) _particleLab->setString(str); } } + + if (isStating) + { + totalStatTime += dt; + statCount++; + + auto curFrameRate = Director::getInstance()->getFrameRate(); + if (maxFrameRate < 0 || curFrameRate > maxFrameRate) + maxFrameRate = curFrameRate; + + if (minFrameRate < 0 || curFrameRate < minFrameRate) + minFrameRate = curFrameRate; + } } void Particle3DMainScene::createParticleSystem(int idx) @@ -136,7 +240,7 @@ bool Particle3DPerformTest::init() { if (Particle3DMainScene::init()) { - initWithSubTest(1, kNodesIncrease); + initScene(); return true; } diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceParticle3DTest.h b/tests/performance-tests/Classes/tests/PerformanceParticle3DTest.h similarity index 63% rename from tests/cpp-tests/Classes/PerformanceTest/PerformanceParticle3DTest.h rename to tests/performance-tests/Classes/tests/PerformanceParticle3DTest.h index 7e447fc856..1c2d8158ec 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceParticle3DTest.h +++ b/tests/performance-tests/Classes/tests/PerformanceParticle3DTest.h @@ -8,21 +8,33 @@ DEFINE_TEST_SUITE(PerformceParticle3DTests); class Particle3DMainScene : public TestCase { public: - virtual void initWithSubTest(int subtest, int particles); + virtual void initScene(); void step(float dt); void createParticleSystem(int idx); - void testNCallback(cocos2d::Ref* sender); void updateQuantityLabel(); - int getSubTestNum() { return _subtestNumber; } int getParticlesNum() { return _quantityParticles; } virtual void doTest() = 0; + // overrides + virtual void onExitTransitionDidStart() override; + virtual void onEnterTransitionDidFinish() override; + void beginStat(float dt); + void endStat(float dt); + void doAutoTest(); + void removeAllParticles(); + protected: int _lastRenderedCount; int _quantityParticles; - int _subtestNumber; cocos2d::Label *_particleLab; + + bool isStating; + int autoTestIndex; + int statCount; + float totalStatTime; + float minFrameRate; + float maxFrameRate; }; class Particle3DPerformTest : public Particle3DMainScene diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceParticleTest.cpp b/tests/performance-tests/Classes/tests/PerformanceParticleTest.cpp similarity index 61% rename from tests/cpp-tests/Classes/PerformanceTest/PerformanceParticleTest.cpp rename to tests/performance-tests/Classes/tests/PerformanceParticleTest.cpp index d225d8ea3e..78beba707b 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceParticleTest.cpp +++ b/tests/performance-tests/Classes/tests/PerformanceParticleTest.cpp @@ -1,12 +1,18 @@ #include "PerformanceParticleTest.h" +#include "Profile.h" USING_NS_CC; +#define MAX_SUB_TEST_NUM 3 +#define DELAY_TIME 4 +#define STAT_TIME 3 + enum { kTagInfoLayer = 1, kTagMainLayer = 2, kTagParticleSystem = 3, kTagLabelAtlas = 4, + kTagTitle = 5, kTagMenuLayer = 1000, TEST_COUNT = 4, @@ -20,6 +26,10 @@ enum { int ParticleMainScene::quantityParticles = kNodesIncrease; int ParticleMainScene::subtestNumber = 1; +static int autoTestParticleCounts[] = { + 1000, 2000, 3000 +}; + PerformceParticleTests::PerformceParticleTests() { ADD_TEST_CASE(ParticlePerformTest1); @@ -48,6 +58,7 @@ void ParticleMainScene::initWithSubTest(int asubtest, int particles) { //srandom(0); + isStating = false; subtestNumber = asubtest; auto s = Director::getInstance()->getWinSize(); @@ -92,7 +103,7 @@ void ParticleMainScene::initWithSubTest(int asubtest, int particles) // Sub Tests MenuItemFont::setFontSize(40); auto pSubMenu = Menu::create(); - for (int i = 1; i <= 6; ++i) + for (int i = 1; i <= MAX_SUB_TEST_NUM; ++i) { char str[10] = {0}; sprintf(str, "%d ", i); @@ -114,7 +125,7 @@ void ParticleMainScene::initWithSubTest(int asubtest, int particles) addChild(pSubMenu, 2); auto label = Label::createWithTTF(title().c_str(), "fonts/arial.ttf", 32); - addChild(label, 1); + addChild(label, 1, kTagTitle); label->setPosition(Vec2(s.width/2, s.height-50)); updateQuantityLabel(); @@ -123,6 +134,104 @@ void ParticleMainScene::initWithSubTest(int asubtest, int particles) schedule(CC_SCHEDULE_SELECTOR(ParticleMainScene::step)); } +void ParticleMainScene::onExitTransitionDidStart() +{ + Scene::onExitTransitionDidStart(); + + auto director = Director::getInstance(); + auto sched = director->getScheduler(); + + sched->unscheduleAllForTarget(this); +} + +void ParticleMainScene::onEnterTransitionDidFinish() +{ + Scene::onEnterTransitionDidFinish(); + + if (this->isAutoTesting()) { + Profile::getInstance()->testCaseBegin("ParticleTest", + genStrVector("Size", "TextureFormat", "ParticleCount", nullptr), + genStrVector("Avg", "Min", "Max", nullptr)); + autoTestIndex = 0; + subtestNumber = 1; + + doAutoTest(); + } +} + +void ParticleMainScene::doAutoTest() +{ + isStating = false; + statCount = 0; + totalStatTime = 0.0f; + minFrameRate = -1.0f; + maxFrameRate = -1.0f; + + quantityParticles = autoTestParticleCounts[autoTestIndex]; + updateQuantityLabel(); + updateTitle(); + createParticleSystem(); + + schedule(CC_SCHEDULE_SELECTOR(ParticleMainScene::beginStat), DELAY_TIME); + schedule(CC_SCHEDULE_SELECTOR(ParticleMainScene::endStat), DELAY_TIME + STAT_TIME); +} + +void ParticleMainScene::beginStat(float dt) +{ + unschedule(CC_SCHEDULE_SELECTOR(ParticleMainScene::beginStat)); + isStating = true; +} + +void ParticleMainScene::endStat(float dt) +{ + unschedule(CC_SCHEDULE_SELECTOR(ParticleMainScene::endStat)); + isStating = false; + + // record test data + std::string tf; + switch (subtestNumber) { + case 1: + tf = "RGBA8888"; + break; + case 2: + tf = "RGBA4444"; + break; + case 3: + tf = "A8"; + break; + default: + tf = "unknown"; + break; + } + auto avgStr = genStr("%.2f", (float) statCount / totalStatTime); + Profile::getInstance()->addTestResult(genStrVector(genStr("%d", particleSize).c_str(), tf.c_str(), + genStr("%d", quantityParticles).c_str(), nullptr), + genStrVector(avgStr.c_str(), genStr("%.2f", minFrameRate).c_str(), + genStr("%.2f", maxFrameRate).c_str(), nullptr)); + + // check the auto test is end or not + int autoTestCount = sizeof(autoTestParticleCounts) / sizeof(int); + if (autoTestIndex >= (autoTestCount - 1) && + subtestNumber >= MAX_SUB_TEST_NUM) + { + // auto test end + Profile::getInstance()->testCaseEnd(); + setAutoTesting(false); + return; + } + + if (autoTestIndex >= (autoTestCount - 1)) + { + autoTestIndex = 0; + subtestNumber++; + } + else + { + autoTestIndex++; + } + doAutoTest(); +} + void ParticleMainScene::step(float dt) { auto atlas = (LabelAtlas*) getChildByTag(kTagLabelAtlas); @@ -131,6 +240,19 @@ void ParticleMainScene::step(float dt) char str[10] = {0}; sprintf(str, "%4d", emitter->getParticleCount()); atlas->setString(str); + + if (isStating) + { + totalStatTime += dt; + statCount++; + + auto curFrameRate = Director::getInstance()->getFrameRate(); + if (maxFrameRate < 0 || curFrameRate > maxFrameRate) + maxFrameRate = curFrameRate; + + if (minFrameRate < 0 || curFrameRate < minFrameRate) + minFrameRate = curFrameRate; + } } void ParticleMainScene::createParticleSystem() @@ -163,7 +285,7 @@ void ParticleMainScene::createParticleSystem() { particleSystem = ParticleSystemQuad::createWithTotalParticles(quantityParticles); } - + switch( subtestNumber) { case 1: @@ -183,18 +305,18 @@ void ParticleMainScene::createParticleSystem() // ////---- particleSystem.texture = [[TextureCache sharedTextureCache] addImage:@"fire.pvr"]; // particleSystem->setTexture(Director::getInstance()->getTextureCache()->addImage("Images/fire.png")); // break; - case 4: - Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGBA8888); - particleSystem->setTexture(Director::getInstance()->getTextureCache()->addImage("Images/fire.png")); - break; - case 5: - Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGBA4444); - particleSystem->setTexture(Director::getInstance()->getTextureCache()->addImage("Images/fire.png")); - break; - case 6: - Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::A8); - particleSystem->setTexture(Director::getInstance()->getTextureCache()->addImage("Images/fire.png")); - break; +// case 4: +// Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGBA8888); +// particleSystem->setTexture(Director::getInstance()->getTextureCache()->addImage("Images/fire.png")); +// break; +// case 5: +// Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGBA4444); +// particleSystem->setTexture(Director::getInstance()->getTextureCache()->addImage("Images/fire.png")); +// break; +// case 6: +// Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::A8); +// particleSystem->setTexture(Director::getInstance()->getTextureCache()->addImage("Images/fire.png")); +// break; // case 8: // ////---- particleSystem.texture = [[TextureCache sharedTextureCache] addImage:@"fire.pvr"]; // particleSystem->setTexture(Director::getInstance()->getTextureCache()->addImage("Images/fire.png")); @@ -212,6 +334,63 @@ void ParticleMainScene::createParticleSystem() Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGBA8888); } +void ParticleMainScene::doTest() +{ + auto s = Director::getInstance()->getWinSize(); + auto particleSystem = (ParticleSystem*)getChildByTag(kTagParticleSystem); + + // duration + particleSystem->setDuration(-1); + + // gravity + particleSystem->setGravity(Vec2(0,-90)); + + // angle + particleSystem->setAngle(90); + particleSystem->setAngleVar(0); + + // radial + particleSystem->setRadialAccel(0); + particleSystem->setRadialAccelVar(0); + + // speed of particles + particleSystem->setSpeed(180); + particleSystem->setSpeedVar(50); + + // emitter position + particleSystem->setPosition(Vec2(s.width/2, 100)); + particleSystem->setPosVar(Vec2(s.width/2,0)); + + // life of particles + particleSystem->setLife(2.0f); + particleSystem->setLifeVar(1); + + // emits per frame + particleSystem->setEmissionRate(particleSystem->getTotalParticles() /particleSystem->getLife()); + + // color of particles + Color4F startColor(0.5f, 0.5f, 0.5f, 1.0f); + particleSystem->setStartColor(startColor); + + Color4F startColorVar(0.5f, 0.5f, 0.5f, 1.0f); + particleSystem->setStartColorVar( startColorVar); + + Color4F endColor(0.1f, 0.1f, 0.1f, 0.2f); + particleSystem->setEndColor(endColor); + + Color4F endColorVar(0.1f, 0.1f, 0.1f, 0.2f); + particleSystem->setEndColorVar(endColorVar); + + // size, in pixels + particleSystem->setEndSize(particleSize); + particleSystem->setStartSize(particleSize); + particleSystem->setEndSizeVar(0); + particleSystem->setStartSizeVar(0); + + // additive + particleSystem->setBlendAdditive(false); +} + void ParticleMainScene::testNCallback(Ref* sender) { subtestNumber = static_cast(sender)->getTag(); @@ -232,6 +411,12 @@ void ParticleMainScene::updateQuantityLabel() } } +void ParticleMainScene::updateTitle() +{ + auto titleLabel = (Label *) getChildByTag(kTagTitle); + titleLabel->setString(this->title()); +} + //////////////////////////////////////////////////////// // // ParticlePerformTest1 @@ -240,66 +425,15 @@ void ParticleMainScene::updateQuantityLabel() std::string ParticlePerformTest1::title() const { char str[20] = {0}; - sprintf(str, "A (%d) size=4", subtestNumber); + sprintf(str, "A (%d) size=%d", subtestNumber, particleSize); std::string strRet = str; return strRet; } -void ParticlePerformTest1::doTest() +void ParticlePerformTest1::initWithSubTest(int subtest, int particles) { - auto s = Director::getInstance()->getWinSize(); - auto particleSystem = (ParticleSystem*)getChildByTag(kTagParticleSystem); - - // duration - particleSystem->setDuration(-1); - - // gravity - particleSystem->setGravity(Vec2(0,-90)); - - // angle - particleSystem->setAngle(90); - particleSystem->setAngleVar(0); - - // radial - particleSystem->setRadialAccel(0); - particleSystem->setRadialAccelVar(0); - - // speed of particles - particleSystem->setSpeed(180); - particleSystem->setSpeedVar(50); - - // emitter position - particleSystem->setPosition(Vec2(s.width/2, 100)); - particleSystem->setPosVar(Vec2(s.width/2,0)); - - // life of particles - particleSystem->setLife(2.0f); - particleSystem->setLifeVar(1); - - // emits per frame - particleSystem->setEmissionRate(particleSystem->getTotalParticles() /particleSystem->getLife()); - - // color of particles - Color4F startColor(0.5f, 0.5f, 0.5f, 1.0f); - particleSystem->setStartColor(startColor); - - Color4F startColorVar(0.5f, 0.5f, 0.5f, 1.0f); - particleSystem->setStartColorVar( startColorVar); - - Color4F endColor(0.1f, 0.1f, 0.1f, 0.2f); - particleSystem->setEndColor(endColor); - - Color4F endColorVar(0.1f, 0.1f, 0.1f, 0.2f); - particleSystem->setEndColorVar(endColorVar); - - // size, in pixels - particleSystem->setEndSize(4.0f); - particleSystem->setStartSize(4.0f); - particleSystem->setEndSizeVar(0); - particleSystem->setStartSizeVar(0); - - // additive - particleSystem->setBlendAdditive(false); + particleSize = 4; + ParticleMainScene::initWithSubTest(subtest, particles); } //////////////////////////////////////////////////////// @@ -310,66 +444,15 @@ void ParticlePerformTest1::doTest() std::string ParticlePerformTest2::title() const { char str[20] = {0}; - sprintf(str, "B (%d) size=8", subtestNumber); + sprintf(str, "B (%d) size=%d", subtestNumber, particleSize); std::string strRet = str; return strRet; } -void ParticlePerformTest2::doTest() +void ParticlePerformTest2::initWithSubTest(int subtest, int particles) { - auto s = Director::getInstance()->getWinSize(); - auto particleSystem = (ParticleSystem*) getChildByTag(kTagParticleSystem); - - // duration - particleSystem->setDuration(-1); - - // gravity - particleSystem->setGravity(Vec2(0,-90)); - - // angle - particleSystem->setAngle(90); - particleSystem->setAngleVar(0); - - // radial - particleSystem->setRadialAccel(0); - particleSystem->setRadialAccelVar(0); - - // speed of particles - particleSystem->setSpeed(180); - particleSystem->setSpeedVar(50); - - // emitter position - particleSystem->setPosition(Vec2(s.width/2, 100)); - particleSystem->setPosVar(Vec2(s.width/2,0)); - - // life of particles - particleSystem->setLife(2.0f); - particleSystem->setLifeVar(1); - - // emits per frame - particleSystem->setEmissionRate(particleSystem->getTotalParticles() / particleSystem->getLife()); - - // color of particles - Color4F startColor(0.5f, 0.5f, 0.5f, 1.0f); - particleSystem->setStartColor(startColor); - - Color4F startColorVar(0.5f, 0.5f, 0.5f, 1.0f); - particleSystem->setStartColorVar(startColorVar); - - Color4F endColor(0.1f, 0.1f, 0.1f, 0.2f); - particleSystem->setEndColor(endColor); - - Color4F endColorVar(0.1f, 0.1f, 0.1f, 0.2f); - particleSystem->setEndColorVar(endColorVar); - - // size, in pixels - particleSystem->setEndSize(8.0f); - particleSystem->setStartSize(8.0f); - particleSystem->setEndSizeVar(0); - particleSystem->setStartSizeVar(0); - - // additive - particleSystem->setBlendAdditive(false); + particleSize = 8; + ParticleMainScene::initWithSubTest(subtest, particles); } //////////////////////////////////////////////////////// @@ -380,66 +463,15 @@ void ParticlePerformTest2::doTest() std::string ParticlePerformTest3::title() const { char str[20] = {0}; - sprintf(str, "C (%d) size=32", subtestNumber); + sprintf(str, "C (%d) size=%d", subtestNumber, particleSize); std::string strRet = str; return strRet; } -void ParticlePerformTest3::doTest() +void ParticlePerformTest3::initWithSubTest(int subtest, int particles) { - auto s = Director::getInstance()->getWinSize(); - auto particleSystem = (ParticleSystem*)getChildByTag(kTagParticleSystem); - - // duration - particleSystem->setDuration(-1); - - // gravity - particleSystem->setGravity(Vec2(0,-90)); - - // angle - particleSystem->setAngle(90); - particleSystem->setAngleVar(0); - - // radial - particleSystem->setRadialAccel(0); - particleSystem->setRadialAccelVar(0); - - // speed of particles - particleSystem->setSpeed(180); - particleSystem->setSpeedVar(50); - - // emitter position - particleSystem->setPosition(Vec2(s.width/2, 100)); - particleSystem->setPosVar(Vec2(s.width/2,0)); - - // life of particles - particleSystem->setLife(2.0f); - particleSystem->setLifeVar(1); - - // emits per frame - particleSystem->setEmissionRate(particleSystem->getTotalParticles() / particleSystem->getLife()); - - // color of particles - Color4F startColor(0.5f, 0.5f, 0.5f, 1.0f); - particleSystem->setStartColor(startColor); - - Color4F startColorVar(0.5f, 0.5f, 0.5f, 1.0f); - particleSystem->setStartColorVar(startColorVar); - - Color4F endColor(0.1f, 0.1f, 0.1f, 0.2f); - particleSystem->setEndColor(endColor); - - Color4F endColorVar(0.1f, 0.1f, 0.1f, 0.2f); - particleSystem->setEndColorVar(endColorVar); - - // size, in pixels - particleSystem->setEndSize(32.0f); - particleSystem->setStartSize(32.0f); - particleSystem->setEndSizeVar(0); - particleSystem->setStartSizeVar(0); - - // additive - particleSystem->setBlendAdditive(false); + particleSize = 32; + ParticleMainScene::initWithSubTest(subtest, particles); } //////////////////////////////////////////////////////// @@ -450,65 +482,13 @@ void ParticlePerformTest3::doTest() std::string ParticlePerformTest4::title() const { char str[20] = {0}; - sprintf(str, "D (%d) size=64", subtestNumber); + sprintf(str, "D (%d) size=%d", subtestNumber, particleSize); std::string strRet = str; return strRet; } -void ParticlePerformTest4::doTest() +void ParticlePerformTest4::initWithSubTest(int subtest, int particles) { - auto s = Director::getInstance()->getWinSize(); - auto particleSystem = (ParticleSystem*) getChildByTag(kTagParticleSystem); - - // duration - particleSystem->setDuration(-1); - - // gravity - particleSystem->setGravity(Vec2(0,-90)); - - // angle - particleSystem->setAngle(90); - particleSystem->setAngleVar(0); - - // radial - particleSystem->setRadialAccel(0); - particleSystem->setRadialAccelVar(0); - - // speed of particles - particleSystem->setSpeed(180); - particleSystem->setSpeedVar(50); - - // emitter position - particleSystem->setPosition(Vec2(s.width/2, 100)); - particleSystem->setPosVar(Vec2(s.width/2,0)); - - // life of particles - particleSystem->setLife(2.0f); - particleSystem->setLifeVar(1); - - // emits per frame - particleSystem->setEmissionRate(particleSystem->getTotalParticles() / particleSystem->getLife()); - - // color of particles - Color4F startColor(0.5f, 0.5f, 0.5f, 1.0f); - particleSystem->setStartColor(startColor); - - Color4F startColorVar(0.5f, 0.5f, 0.5f, 1.0f); - particleSystem->setStartColorVar(startColorVar); - - Color4F endColor(0.1f, 0.1f, 0.1f, 0.2f); - particleSystem->setEndColor(endColor); - - Color4F endColorVar(0.1f, 0.1f, 0.1f, 0.2f); - particleSystem->setEndColorVar(endColorVar); - - // size, in pixels - particleSystem->setEndSize(64.0f); - particleSystem->setStartSize(64.0f); - particleSystem->setEndSizeVar(0); - particleSystem->setStartSizeVar(0); - - // additive - particleSystem->setBlendAdditive(false); - + particleSize = 64; + ParticleMainScene::initWithSubTest(subtest, particles); } diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceParticleTest.h b/tests/performance-tests/Classes/tests/PerformanceParticleTest.h similarity index 59% rename from tests/cpp-tests/Classes/PerformanceTest/PerformanceParticleTest.h rename to tests/performance-tests/Classes/tests/PerformanceParticleTest.h index 0f2968aee8..b1286f62f2 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceParticleTest.h +++ b/tests/performance-tests/Classes/tests/PerformanceParticleTest.h @@ -15,12 +15,28 @@ public: void createParticleSystem(); void testNCallback(cocos2d::Ref* sender); void updateQuantityLabel(); - virtual void doTest() = 0; + void updateTitle(); + virtual void doTest(); + + // overrides + virtual void onExitTransitionDidStart() override; + virtual void onEnterTransitionDidFinish() override; + void beginStat(float dt); + void endStat(float dt); + void doAutoTest(); protected: - int lastRenderedCount; + int lastRenderedCount; static int quantityParticles; static int subtestNumber; + int particleSize; + + bool isStating; + int autoTestIndex; + int statCount; + float totalStatTime; + float minFrameRate; + float maxFrameRate; }; class ParticlePerformTest1 : public ParticleMainScene @@ -29,7 +45,7 @@ public: CREATE_FUNC(ParticlePerformTest1); virtual std::string title() const override; - virtual void doTest()override; + virtual void initWithSubTest(int subtest, int particles) override; }; class ParticlePerformTest2 : public ParticleMainScene @@ -38,7 +54,7 @@ public: CREATE_FUNC(ParticlePerformTest2); virtual std::string title() const override; - virtual void doTest()override; + virtual void initWithSubTest(int subtest, int particles) override; }; class ParticlePerformTest3 : public ParticleMainScene @@ -47,7 +63,7 @@ public: CREATE_FUNC(ParticlePerformTest3); virtual std::string title() const override; - virtual void doTest()override; + virtual void initWithSubTest(int subtest, int particles) override; }; class ParticlePerformTest4 : public ParticleMainScene @@ -56,7 +72,7 @@ public: CREATE_FUNC(ParticlePerformTest4); virtual std::string title() const override; - virtual void doTest()override; + virtual void initWithSubTest(int subtest, int particles) override; }; #endif diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceScenarioTest.cpp b/tests/performance-tests/Classes/tests/PerformanceScenarioTest.cpp similarity index 72% rename from tests/cpp-tests/Classes/PerformanceTest/PerformanceScenarioTest.cpp rename to tests/performance-tests/Classes/tests/PerformanceScenarioTest.cpp index 1f6a503333..cf1abd8ff4 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceScenarioTest.cpp +++ b/tests/performance-tests/Classes/tests/PerformanceScenarioTest.cpp @@ -1,8 +1,11 @@ #include "PerformanceScenarioTest.h" -#include "../testResource.h" +#include "Profile.h" USING_NS_CC; +#define DELAY_TIME 4 +#define STAT_TIME 3 + PerformceScenarioTests::PerformceScenarioTests() { ADD_TEST_CASE(ScenarioTest); @@ -20,6 +23,19 @@ int ScenarioTest::_spriteStepNum = 500; int ScenarioTest::_initParsysNum = 10; int ScenarioTest::_parsysStepNum = 5; +typedef struct +{ + int spriteCount; + int particleCount; + int particleSystemCount; +} TestCaseInfo; + +static TestCaseInfo autoTestCounts[] = { + { 500, 500, 50 }, + { 1000, 1000, 100 }, + { 1500, 1500, 150 } +}; + bool ScenarioTest::init() { if (TestCase::init()) @@ -91,7 +107,7 @@ void ScenarioTest::performTests() addNewSprites(_spriteStepNum); break; case 1: - addParticles(); + addParticles(_parStepNum); break; case 2: addParticleSystem(_parsysStepNum); @@ -145,9 +161,9 @@ void ScenarioTest::onTouchesMoved(const std::vector& touches, Event *ev _map2->setPosition(currentPos2 + diff); } -void ScenarioTest::addParticles() +void ScenarioTest::addParticles(int num) { - _particleNumber += _parStepNum; + _particleNumber += num; for (auto par : _parsysArray) { par->setTotalParticles(_particleNumber); @@ -296,6 +312,102 @@ void ScenarioTest::removeParticleSystem() _parsysLabel->setString(str); } +void ScenarioTest::onEnter() +{ + TestCase::onEnter(); + + if (isAutoTesting()) { + autoTestIndex = 0; + Profile::getInstance()->testCaseBegin("ScenarioTest", + genStrVector("SpriteCount", "ParticleCount", "ParticleSystemCount", nullptr), + genStrVector("Avg", "Min", "Max", nullptr)); + doAutoTest(); + scheduleUpdate(); + } +} + +void ScenarioTest::onExit() +{ + Director::getInstance()->getScheduler()->unscheduleAllForTarget(this); + TestCase::onExit(); +} + +void ScenarioTest::update(float dt) +{ + if (isStating) { + totalStatTime += dt; + statCount++; + + auto curFrameRate = Director::getInstance()->getFrameRate(); + if (maxFrameRate < 0 || curFrameRate > maxFrameRate) + maxFrameRate = curFrameRate; + + if (minFrameRate < 0 || curFrameRate < minFrameRate) + minFrameRate = curFrameRate; + } +} + +void ScenarioTest::beginStat(float dt) +{ + unschedule(CC_SCHEDULE_SELECTOR(ScenarioTest::beginStat)); + isStating = true; +} + +void ScenarioTest::endStat(float dt) +{ + unschedule(CC_SCHEDULE_SELECTOR(ScenarioTest::endStat)); + isStating = false; + + // record test data + auto avgStr = genStr("%.2f", (float) statCount / totalStatTime); + Profile::getInstance()->addTestResult(genStrVector(genStr("%d", _spriteArray.size()).c_str(), + genStr("%d", _particleNumber).c_str(), + genStr("%d", _parsysArray.size()).c_str(), + nullptr), + genStrVector(avgStr.c_str(), genStr("%.2f", minFrameRate).c_str(), + genStr("%.2f", maxFrameRate).c_str(), nullptr)); + + // check the auto test is end or not + int autoTestCount = sizeof(autoTestCounts) / sizeof(TestCaseInfo); + if (autoTestIndex >= (autoTestCount - 1)) + { + // auto test end + Profile::getInstance()->testCaseEnd(); + setAutoTesting(false); + return; + } + + autoTestIndex++; + doAutoTest(); +} + +void ScenarioTest::doAutoTest() +{ + isStating = false; + statCount = 0; + totalStatTime = 0.0f; + minFrameRate = -1.0f; + maxFrameRate = -1.0f; + + // remove all nodes + while (_spriteArray.size() > 0) { + removeSprites(); + } + while (_parsysArray.size() > 0) { + removeParticleSystem(); + } + + // add nodes + auto caseInfo = autoTestCounts[autoTestIndex]; + _particleNumber = 0; + addNewSprites(caseInfo.spriteCount); + addParticleSystem(caseInfo.particleSystemCount); + addParticles(caseInfo.particleCount); + + schedule(CC_SCHEDULE_SELECTOR(ScenarioTest::beginStat), DELAY_TIME); + schedule(CC_SCHEDULE_SELECTOR(ScenarioTest::endStat), DELAY_TIME + STAT_TIME); +} + std::string ScenarioTest::title() const { return "Scenario Performance Test"; diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceScenarioTest.h b/tests/performance-tests/Classes/tests/PerformanceScenarioTest.h similarity index 74% rename from tests/cpp-tests/Classes/PerformanceTest/PerformanceScenarioTest.h rename to tests/performance-tests/Classes/tests/PerformanceScenarioTest.h index ffecf6680b..b347a37c0f 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceScenarioTest.h +++ b/tests/performance-tests/Classes/tests/PerformanceScenarioTest.h @@ -18,11 +18,18 @@ public: static cocos2d::Scene* scene(); + virtual void onEnter() override; + virtual void onExit() override; + virtual void update(float dt) override; + void beginStat(float dt); + void endStat(float dt); + void doAutoTest(); + private: void addNewSprites(int num); void removeSprites(); - void addParticles(); + void addParticles(int num); void removeParticles(); void addParticleSystem(int num); @@ -46,6 +53,13 @@ private: cocos2d::Label* _particleLabel; cocos2d::Label* _parsysLabel; int _particleNumber; + + bool isStating; + int autoTestIndex; + int statCount; + float totalStatTime; + float minFrameRate; + float maxFrameRate; }; #endif diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceSpriteTest.cpp b/tests/performance-tests/Classes/tests/PerformanceSpriteTest.cpp similarity index 74% rename from tests/cpp-tests/Classes/PerformanceTest/PerformanceSpriteTest.cpp rename to tests/performance-tests/Classes/tests/PerformanceSpriteTest.cpp index f462ad01ad..06cf985a2f 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceSpriteTest.cpp +++ b/tests/performance-tests/Classes/tests/PerformanceSpriteTest.cpp @@ -26,6 +26,7 @@ ****************************************************************************/ #include "PerformanceSpriteTest.h" +#include "Profile.h" #include @@ -37,17 +38,19 @@ USING_NS_CC; #define CC_ROUND(__f__) roundf(__f__) #endif +#define MAX_SUB_TEST_NUM 13 +#define DELAY_TIME 2 +#define STAT_TIME 3 + enum { kMaxNodes = 50000, kNodesIncrease = 250, - - TEST_COUNT = 7, }; enum { kTagInfoLayer = 1, kTagMainLayer = 2, - kTagAutoTestMenu = 3, + kTagTitle = 3, kTagMenuLayer = (kMaxNodes + 1000), }; @@ -65,6 +68,10 @@ PerformceSpriteTests::PerformceSpriteTests() int SpriteMainScene::_quantityNodes = 50; int SpriteMainScene::_subtestNumber = 1; +static int autoTestSpriteCounts[] = { + 1000, 2000, 3000 +}; + //////////////////////////////////////////////////////// // // SubTest @@ -313,19 +320,6 @@ void SubTest::removeByTag(int tag) // //////////////////////////////////////////////////////// -// FIXME: This should be part of the class, but VC2013 doesn't support constexpr as static members yet -static const float SECONDS_PER_TESTS = 4.0f; -static const int MAX_SPRITE_TEST_CASE = 7; // A...G -static const int MAX_SUB_TEST_NUMS = 13; // 1...13 - -// 500 sprites, 1500 sprites, etc... -bool SpriteMainScene::_s_autoTest = false; -int SpriteMainScene::_s_nSpriteCurCase = 0; -int SpriteMainScene::_s_spritesQuatityIndex = 0; -int SpriteMainScene::_s_spritesQuanityArray[] = {1000, 3000, 0}; -// FIXME: to make VS2012 happy. Once VS2012 is deprecated, we can just simply replace it with {} -std::vector SpriteMainScene::_s_saved_fps = std::vector(); - bool SpriteMainScene::init() { if (TestCase::init()) @@ -375,20 +369,6 @@ void SpriteMainScene::initWithSubTest(int asubtest, int nNodes) MenuItemFont::setFontName("fonts/arial.ttf"); MenuItemFont::setFontSize(24); - MenuItemFont* autoTestItem = nullptr; - if (SpriteMainScene::_s_autoTest) - { - autoTestItem = MenuItemFont::create("Auto Test On",CC_CALLBACK_1(SpriteMainScene::onAutoTest, this)); - } - else - { - autoTestItem = MenuItemFont::create("Auto Test Off",CC_CALLBACK_1(SpriteMainScene::onAutoTest, this)); - } - autoTestItem->setTag(1); - autoTestItem->setPosition(Vec2( s.width - 90, s.height / 2)); - menuAutoTest->addChild(autoTestItem); - addChild( menuAutoTest, 3, kTagAutoTestMenu ); - // Sub Tests MenuItemFont::setFontSize(28); auto subMenu = Menu::create(); @@ -416,7 +396,7 @@ void SpriteMainScene::initWithSubTest(int asubtest, int nNodes) // add title label auto label = Label::createWithTTF(title(), "fonts/arial.ttf", 32); - addChild(label, 1); + addChild(label, 1, kTagTitle); label->setPosition(Vec2(s.width/2, s.height-50)); @@ -443,7 +423,6 @@ std::string SpriteMainScene::subtitle() const return ""; // override me } - SpriteMainScene::~SpriteMainScene() { if (_subTest) @@ -455,7 +434,7 @@ SpriteMainScene::~SpriteMainScene() void SpriteMainScene::testNCallback(Ref* sender) { - if (SpriteMainScene::_s_autoTest) + if (isAutoTesting()) { log("It's auto sprite performance testing,so this operation is invalid"); return; @@ -479,6 +458,12 @@ void SpriteMainScene::updateNodes() } } +void SpriteMainScene::updateTitle() +{ + auto titleLabel = (Label *) getChildByTag(kTagTitle); + titleLabel->setString(this->title()); +} + void SpriteMainScene::onIncrease(Ref* sender) { if( _quantityNodes >= kMaxNodes) @@ -509,210 +494,116 @@ void SpriteMainScene::onDecrease(Ref* sender) updateNodes(); } -void SpriteMainScene::dumpProfilerFPS() -{ - log("COPY & PASTE into Cocos2d-x Performance Test spreadsheet"); - log("https://docs.google.com/spreadsheets/d/1XolpgYfoWszA2rxnVRCAVS7ILAGiV049o5mpL29cwLs/edit#gid=1561044615"); - log(""); - int index = 0; - int sprites = 0; - while((sprites = _s_spritesQuanityArray[index])) { - log("Number of sprites: %d", sprites); - for(int i=0; i < MAX_SPRITE_TEST_CASE; i++) - { - char buffer[512]; - buffer[0]=0; - for(int j=0; j < MAX_SUB_TEST_NUMS; j++) - { - float fps = _s_saved_fps[j + i*MAX_SUB_TEST_NUMS + MAX_SUB_TEST_NUMS * MAX_SPRITE_TEST_CASE * index]; - char fps_str[64]; - sprintf(fps_str, "\t%d", (int)CC_ROUND(fps)); - strcat(buffer, fps_str); - } - log("%c%s", i + 'A', buffer); - } - - index++; - }; -} - -void SpriteMainScene::saveFPS() -{ - float fps = Director::getInstance()->getFrameRate(); - _s_saved_fps.push_back(fps); - log("Nodes: %d, Test: %c, SubTest: %d = %.1f", _quantityNodes, 'A'+_s_nSpriteCurCase, _subtestNumber, fps); -} - -void SpriteMainScene::updateAutoTest(float dt) -{ - saveFPS(); - nextAutoTest(); -} - void SpriteMainScene::onEnter() { Scene::onEnter(); - if ( SpriteMainScene::_s_autoTest ) + if (isAutoTesting()) { - auto director = Director::getInstance(); - auto sched = director->getScheduler(); + scheduleUpdate(); + Profile::getInstance()->testCaseBegin("SpriteTest", + genStrVector("SpriteCount", "Type", "SubTest", nullptr), + genStrVector("Avg", "Min", "Max", nullptr)); + + autoTestIndex = 0; + _subtestNumber = 1; - // schedule it only once. Call me after 3 seconds - sched->schedule(CC_SCHEDULE_SELECTOR(SpriteMainScene::updateAutoTest), this, SECONDS_PER_TESTS, 0, 0, false); + doAutoTest(); } } void SpriteMainScene::onExit() { - if ( SpriteMainScene::_s_autoTest ) - { - auto director = Director::getInstance(); - auto sched = director->getScheduler(); - sched->unschedule(CC_SCHEDULE_SELECTOR(SpriteMainScene::updateAutoTest), this ); - } - + auto director = Director::getInstance(); + auto sched = director->getScheduler(); + sched->unscheduleAllForTarget(this); Scene::onExit(); } -void SpriteMainScene::autoShowSpriteTests(int curCase, int subTest, int nodes) +void SpriteMainScene::update(float dt) { - - SpriteMainScene* scene = nullptr; - - switch (curCase) + if (isStating) { - case 0: - scene = new (std::nothrow) SpritePerformTestA; - break; - case 1: - scene = new (std::nothrow) SpritePerformTestB; - break; - case 2: - scene = new (std::nothrow) SpritePerformTestC; - break; - case 3: - scene = new (std::nothrow) SpritePerformTestD; - break; - case 4: - scene = new (std::nothrow) SpritePerformTestE; - break; - case 5: - scene = new (std::nothrow) SpritePerformTestF; - break; - case 6: - scene = new (std::nothrow) SpritePerformTestG; - break; - default: - CCASSERT(false, "Invalid scene value"); - break; - } + totalStatTime += dt; + statCount++; - if (scene) - { - scene->initWithSubTest(subTest, nodes); - Director::getInstance()->replaceScene(scene); - scene->release(); + auto curFrameRate = Director::getInstance()->getFrameRate(); + if (maxFrameRate < 0 || curFrameRate > maxFrameRate) + maxFrameRate = curFrameRate; + + if (minFrameRate < 0 || curFrameRate < minFrameRate) + minFrameRate = curFrameRate; } } -void SpriteMainScene::beginAutoTest() +void SpriteMainScene::beginStat(float dt) { - _s_spritesQuatityIndex = 0; - _s_nSpriteCurCase = 0; - _s_saved_fps.clear(); - - _subtestNumber = 0; - _quantityNodes = _s_spritesQuanityArray[_s_spritesQuatityIndex]; - - nextAutoTest(); + unschedule(CC_SCHEDULE_SELECTOR(SpriteMainScene::beginStat)); + isStating = true; } -void SpriteMainScene::endAutoTest() +void SpriteMainScene::endStat(float dt) { - SpriteMainScene::_s_autoTest = false; + unschedule(CC_SCHEDULE_SELECTOR(SpriteMainScene::endStat)); + isStating = false; - auto director = Director::getInstance(); - auto sched = director->getScheduler(); + // record test data + auto typeStr = getTestCaseName(); + auto avgStr = genStr("%.2f", (float) statCount / totalStatTime); + Profile::getInstance()->addTestResult(genStrVector(genStr("%d", _quantityNodes).c_str(), typeStr.c_str(), + genStr("%d", _subtestNumber).c_str(), nullptr), + genStrVector(avgStr.c_str(), genStr("%.2f", minFrameRate).c_str(), + genStr("%.2f", maxFrameRate).c_str(), nullptr)); - sched->unschedule( CC_SCHEDULE_SELECTOR( SpriteMainScene::updateAutoTest ), this ); -} - -void SpriteMainScene::nextAutoTest() -{ - if (SpriteMainScene::_s_nSpriteCurCase < MAX_SPRITE_TEST_CASE) + // check the auto test is end or not + int autoTestCount = sizeof(autoTestSpriteCounts) / sizeof(int); + if (autoTestIndex >= (autoTestCount - 1) && + _subtestNumber >= MAX_SUB_TEST_NUM) { - if (_subtestNumber < MAX_SUB_TEST_NUMS) - { - // Increase Sub Main Test (1, 2, 3, 4, ...) - _subtestNumber += 1; - autoShowSpriteTests(_s_nSpriteCurCase, _subtestNumber, _quantityNodes); - } - else if (_subtestNumber == MAX_SUB_TEST_NUMS) - { - if (SpriteMainScene::_s_nSpriteCurCase + 1 < MAX_SPRITE_TEST_CASE) - { - // Increase Main Test (A, B, C, ...) - _subtestNumber = 1; - _s_nSpriteCurCase++; - autoShowSpriteTests(_s_nSpriteCurCase, _subtestNumber, _quantityNodes); - } - else - { - // Increase quanity of sprites, or finish - int sprites = _s_spritesQuanityArray[++_s_spritesQuatityIndex]; - if (sprites != 0) { - _quantityNodes = sprites; - _subtestNumber = 1; - _s_nSpriteCurCase = 0; - autoShowSpriteTests(_s_nSpriteCurCase, _subtestNumber, _quantityNodes); - } - else - { - finishAutoTest(); - } - } - } - } -} - -void SpriteMainScene::finishAutoTest() -{ - SpriteMainScene::_s_autoTest = false; - auto director = Director::getInstance(); - auto sched = director->getScheduler(); - sched->unschedule( CC_SCHEDULE_SELECTOR( SpriteMainScene::updateAutoTest ), this); - - auto autoTestMenu = dynamic_cast(getChildByTag(kTagAutoTestMenu)); - if (nullptr != autoTestMenu) - { - auto menuItemFont = dynamic_cast(autoTestMenu->getChildByTag(1)); - if (nullptr != menuItemFont) - { - menuItemFont->setString("Auto Test finish"); - } + // auto test end + Profile::getInstance()->testCaseEnd(); + setAutoTesting(false); + return; } - log("Sprite performance test is finished"); - - dumpProfilerFPS(); -} - -void SpriteMainScene::onAutoTest(Ref* sender) -{ - SpriteMainScene::_s_autoTest = !SpriteMainScene::_s_autoTest; - MenuItemFont* menuItem = dynamic_cast(sender); - - if (SpriteMainScene::_s_autoTest) + if (autoTestIndex >= (autoTestCount - 1)) { - menuItem->setString("Auto Test On"); - beginAutoTest(); + autoTestIndex = 0; + _subtestNumber++; } else { - menuItem->setString("Auto Test Off"); - endAutoTest(); + autoTestIndex++; } + doAutoTest(); +} + +void SpriteMainScene::doAutoTest() +{ + isStating = false; + statCount = 0; + totalStatTime = 0.0f; + minFrameRate = -1.0f; + maxFrameRate = -1.0f; + + // recreate a SubTest object + this->removeChild(_subTest->getTheParentNode()); + CC_SAFE_DELETE(_subTest); + _subTest = new (std::nothrow) SubTest; + _subTest->initWithSubTest(_subtestNumber, this); + + // create sprites & update the label + _quantityNodes = autoTestSpriteCounts[autoTestIndex]; + for( int i = 0; i < _quantityNodes; i++) + { + auto sprite = _subTest->createSpriteWithTag(i); + doTest(sprite); + } + updateNodes(); + updateTitle(); + + schedule(CC_SCHEDULE_SELECTOR(SpriteMainScene::beginStat), DELAY_TIME); + schedule(CC_SCHEDULE_SELECTOR(SpriteMainScene::endStat), DELAY_TIME + STAT_TIME); } //////////////////////////////////////////////////////// diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceSpriteTest.h b/tests/performance-tests/Classes/tests/PerformanceSpriteTest.h similarity index 81% rename from tests/cpp-tests/Classes/PerformanceTest/PerformanceSpriteTest.h rename to tests/performance-tests/Classes/tests/PerformanceSpriteTest.h index e04c86f29c..a4b6ed59a7 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceSpriteTest.h +++ b/tests/performance-tests/Classes/tests/PerformanceSpriteTest.h @@ -41,6 +41,7 @@ public: void removeByTag(int tag); cocos2d::Sprite* createSpriteWithTag(int tag); void initWithSubTest(int nSubTest, cocos2d::Node* parent); + cocos2d::Node* getTheParentNode() { return _parentNode; } protected: int _subtestNumber; @@ -57,6 +58,7 @@ public: void initWithSubTest(int nSubTest, int nNodes); void updateNodes(); + void updateTitle(); void testNCallback(cocos2d::Ref* sender); void onIncrease(cocos2d::Ref* sender); @@ -66,30 +68,26 @@ public: virtual void onEnter() override; virtual void onExit() override; - void updateAutoTest(float dt); - void onAutoTest(cocos2d::Ref* sender); - - // auto tests - static bool _s_autoTest; - static int _s_nSpriteCurCase; - static int _s_spritesQuatityIndex; - static int _s_spritesQuanityArray[]; - static std::vector _s_saved_fps; + virtual void update(float dt) override; + virtual std::string getTestCaseName() = 0; + + void beginStat(float dt); + void endStat(float dt); + void doAutoTest(); protected: static int _quantityNodes; static int _subtestNumber; - void dumpProfilerFPS(); - void saveFPS(); - void beginAutoTest(); - void endAutoTest(); - void nextAutoTest(); - void finishAutoTest(); - void autoShowSpriteTests(int curCase, int subTest,int nodes); - int _lastRenderedCount; SubTest* _subTest; + + bool isStating; + int autoTestIndex; + int statCount; + float totalStatTime; + float minFrameRate; + float maxFrameRate; }; class SpritePerformTestA : public SpriteMainScene @@ -99,6 +97,7 @@ public: virtual void doTest(cocos2d::Sprite* sprite) override; virtual std::string title() const override; + virtual std::string getTestCaseName() override { return "A"; } }; class SpritePerformTestB : public SpriteMainScene @@ -108,6 +107,7 @@ public: virtual void doTest(cocos2d::Sprite* sprite) override; virtual std::string title() const override; + virtual std::string getTestCaseName() override { return "B"; } }; class SpritePerformTestC : public SpriteMainScene @@ -117,6 +117,7 @@ public: virtual void doTest(cocos2d::Sprite* sprite) override; virtual std::string title() const override; + virtual std::string getTestCaseName() override { return "C"; } }; class SpritePerformTestD : public SpriteMainScene @@ -126,6 +127,7 @@ public: virtual void doTest(cocos2d::Sprite* sprite) override; virtual std::string title() const override; + virtual std::string getTestCaseName() override { return "D"; } }; class SpritePerformTestE : public SpriteMainScene @@ -135,6 +137,7 @@ public: virtual void doTest(cocos2d::Sprite* sprite) override; virtual std::string title() const override; + virtual std::string getTestCaseName() override { return "E"; } }; class SpritePerformTestF : public SpriteMainScene @@ -144,6 +147,7 @@ public: virtual void doTest(cocos2d::Sprite* sprite) override; virtual std::string title() const override; + virtual std::string getTestCaseName() override { return "F"; } }; class SpritePerformTestG : public SpriteMainScene @@ -153,6 +157,7 @@ public: virtual void doTest(cocos2d::Sprite* sprite) override; virtual std::string title() const override; + virtual std::string getTestCaseName() override { return "G"; } }; #endif diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceTextureTest.cpp b/tests/performance-tests/Classes/tests/PerformanceTextureTest.cpp similarity index 77% rename from tests/cpp-tests/Classes/PerformanceTest/PerformanceTextureTest.cpp rename to tests/performance-tests/Classes/tests/PerformanceTextureTest.cpp index 22a1f76f6f..baab54810d 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceTextureTest.cpp +++ b/tests/performance-tests/Classes/tests/PerformanceTextureTest.cpp @@ -1,4 +1,5 @@ #include "PerformanceTextureTest.h" +#include "Profile.h" USING_NS_CC; @@ -23,7 +24,7 @@ static float calculateDeltaTime( struct timeval *lastUpdate ) // TexturePerformceTest // //////////////////////////////////////////////////////// -void TexturePerformceTest::performTestsPNG(const char* filename) +void TexturePerformceTest::performTestsPNG(const char* filename, const char* fileType, const char* resolution, const char* remark) { struct timeval now; Texture2D *texture; @@ -36,7 +37,13 @@ void TexturePerformceTest::performTestsPNG(const char* filename) gettimeofday(&now, nullptr); texture = cache->addImage(filename); if( texture ) - log(" ms:%f", calculateDeltaTime(&now) ); + { + auto dt = calculateDeltaTime(&now); + log(" ms:%f", dt); + if (isAutoTesting()) + Profile::getInstance()->addTestResult(genStrVector(fileType, resolution, "RGBA8888", remark, nullptr), + genStrVector(genStr("%fms", dt).c_str(), nullptr)); + } else log(" ERROR"); cache->removeTexture(texture); @@ -46,7 +53,13 @@ void TexturePerformceTest::performTestsPNG(const char* filename) gettimeofday(&now, nullptr); texture = cache->addImage(filename); if( texture ) - log(" ms:%f", calculateDeltaTime(&now) ); + { + auto dt = calculateDeltaTime(&now); + log(" ms:%f", dt); + if (isAutoTesting()) + Profile::getInstance()->addTestResult(genStrVector(fileType, resolution, "RGBA4444", remark, nullptr), + genStrVector(genStr("%fms", dt).c_str(), nullptr)); + } else log(" ERROR"); cache->removeTexture(texture); @@ -56,7 +69,13 @@ void TexturePerformceTest::performTestsPNG(const char* filename) gettimeofday(&now, nullptr); texture = cache->addImage(filename); if( texture ) - log(" ms:%f", calculateDeltaTime(&now) ); + { + auto dt = calculateDeltaTime(&now); + log(" ms:%f", dt); + if (isAutoTesting()) + Profile::getInstance()->addTestResult(genStrVector(fileType, resolution, "RGBA5551", remark, nullptr), + genStrVector(genStr("%fms", dt).c_str(), nullptr)); + } else log(" ERROR"); cache->removeTexture(texture); @@ -66,7 +85,13 @@ void TexturePerformceTest::performTestsPNG(const char* filename) gettimeofday(&now, nullptr); texture = cache->addImage(filename); if( texture ) - log(" ms:%f", calculateDeltaTime(&now) ); + { + auto dt = calculateDeltaTime(&now); + log(" ms:%f", dt); + if (isAutoTesting()) + Profile::getInstance()->addTestResult(genStrVector(fileType, resolution, "RGB565", remark, nullptr), + genStrVector(genStr("%fms", dt).c_str(), nullptr)); + } else log(" ERROR"); cache->removeTexture(texture); @@ -76,6 +101,12 @@ void TexturePerformceTest::performTestsPNG(const char* filename) void TexturePerformceTest::performTests() { + if (isAutoTesting()) { + Profile::getInstance()->testCaseBegin("TextureTest", + genStrVector("FileType", "Resolution", "TextureFormat", "Remark", nullptr), + genStrVector("Time", nullptr)); + } + // Texture2D *texture; // struct timeval now; // auto cache = Director::getInstance()->getTextureCache(); @@ -83,7 +114,7 @@ void TexturePerformceTest::performTests() log("--------"); log("--- PNG 128x128 ---"); - performTestsPNG("Images/test_image.png"); + performTestsPNG("Images/test_image.png", "png", "128x128", ""); // log("--- PVR 128x128 ---"); // log("RGBA 8888"); @@ -124,7 +155,7 @@ void TexturePerformceTest::performTests() log("--- PNG 512x512 ---"); - performTestsPNG("Images/texture512x512.png"); + performTestsPNG("Images/texture512x512.png", "png", "512x512", ""); // log("--- PVR 512x512 ---"); // log("RGBA 4444"); @@ -144,7 +175,7 @@ void TexturePerformceTest::performTests() log("EMPTY IMAGE"); log("--- PNG 1024x1024 ---"); - performTestsPNG("Images/texture1024x1024.png"); + performTestsPNG("Images/texture1024x1024.png", "png", "1024x1024", "EMPTY IMAGE"); // log("--- PVR 1024x1024 ---"); // log("RGBA 4444"); @@ -184,7 +215,7 @@ void TexturePerformceTest::performTests() log("SPRITESHEET IMAGE"); log("--- PNG 1024x1024 ---"); - performTestsPNG("Images/PlanetCute-1024x1024.png"); + performTestsPNG("Images/PlanetCute-1024x1024.png", "png", "1024x1024", "SPRITESHEET IMAGE"); // log("--- PVR 1024x1024 ---"); // log("RGBA 4444"); @@ -226,7 +257,7 @@ void TexturePerformceTest::performTests() log("LANDSCAPE IMAGE"); log("--- PNG 1024x1024 ---"); - performTestsPNG("Images/landscape-1024x1024.png"); + performTestsPNG("Images/landscape-1024x1024.png", "png", "1024x1024", "LANDSCAPE IMAGE"); // log("--- PVR 1024x1024 ---"); // log("RGBA 8888"); @@ -277,6 +308,12 @@ void TexturePerformceTest::performTests() // else // log("ERROR"); // cache->removeTexture(texture); + + if (isAutoTesting()) + { + Profile::getInstance()->testCaseEnd(); + setAutoTesting(false); + } } void TexturePerformceTest::onEnter() diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceTextureTest.h b/tests/performance-tests/Classes/tests/PerformanceTextureTest.h similarity index 78% rename from tests/cpp-tests/Classes/PerformanceTest/PerformanceTextureTest.h rename to tests/performance-tests/Classes/tests/PerformanceTextureTest.h index 83f858e07c..b4a31ee170 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceTextureTest.h +++ b/tests/performance-tests/Classes/tests/PerformanceTextureTest.h @@ -11,7 +11,7 @@ public: CREATE_FUNC(TexturePerformceTest); virtual void performTests(); - void performTestsPNG(const char* filename); + void performTestsPNG(const char* filename, const char* fileType, const char* resolution, const char* remark); virtual std::string title() const override; virtual std::string subtitle() const override; diff --git a/tests/performance-tests/Classes/tests/VisibleRect.cpp b/tests/performance-tests/Classes/tests/VisibleRect.cpp new file mode 100644 index 0000000000..639aac8ed7 --- /dev/null +++ b/tests/performance-tests/Classes/tests/VisibleRect.cpp @@ -0,0 +1,96 @@ +/**************************************************************************** + 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. + ****************************************************************************/ + +#include "VisibleRect.h" + +USING_NS_CC; + +Rect VisibleRect::s_visibleRect; + +void VisibleRect::lazyInit() +{ + // no lazy init + // Useful if we change the resolution in runtime + s_visibleRect = Director::getInstance()->getOpenGLView()->getVisibleRect(); +} + +Rect VisibleRect::getVisibleRect() +{ + lazyInit(); + return s_visibleRect; +} + +Vec2 VisibleRect::left() +{ + lazyInit(); + return Vec2(s_visibleRect.origin.x, s_visibleRect.origin.y+s_visibleRect.size.height/2); +} + +Vec2 VisibleRect::right() +{ + lazyInit(); + return Vec2(s_visibleRect.origin.x+s_visibleRect.size.width, s_visibleRect.origin.y+s_visibleRect.size.height/2); +} + +Vec2 VisibleRect::top() +{ + lazyInit(); + return Vec2(s_visibleRect.origin.x+s_visibleRect.size.width/2, s_visibleRect.origin.y+s_visibleRect.size.height); +} + +Vec2 VisibleRect::bottom() +{ + lazyInit(); + return Vec2(s_visibleRect.origin.x+s_visibleRect.size.width/2, s_visibleRect.origin.y); +} + +Vec2 VisibleRect::center() +{ + lazyInit(); + return Vec2(s_visibleRect.origin.x+s_visibleRect.size.width/2, s_visibleRect.origin.y+s_visibleRect.size.height/2); +} + +Vec2 VisibleRect::leftTop() +{ + lazyInit(); + return Vec2(s_visibleRect.origin.x, s_visibleRect.origin.y+s_visibleRect.size.height); +} + +Vec2 VisibleRect::rightTop() +{ + lazyInit(); + return Vec2(s_visibleRect.origin.x+s_visibleRect.size.width, s_visibleRect.origin.y+s_visibleRect.size.height); +} + +Vec2 VisibleRect::leftBottom() +{ + lazyInit(); + return s_visibleRect.origin; +} + +Vec2 VisibleRect::rightBottom() +{ + lazyInit(); + return Vec2(s_visibleRect.origin.x+s_visibleRect.size.width, s_visibleRect.origin.y); +} diff --git a/tests/performance-tests/Classes/tests/VisibleRect.h b/tests/performance-tests/Classes/tests/VisibleRect.h new file mode 100644 index 0000000000..625f7c3f5f --- /dev/null +++ b/tests/performance-tests/Classes/tests/VisibleRect.h @@ -0,0 +1,25 @@ +#ifndef __VISIBLERECT_H__ +#define __VISIBLERECT_H__ + +#include "cocos2d.h" + +class VisibleRect +{ +public: + static cocos2d::Rect getVisibleRect(); + + static cocos2d::Vec2 left(); + static cocos2d::Vec2 right(); + static cocos2d::Vec2 top(); + static cocos2d::Vec2 bottom(); + static cocos2d::Vec2 center(); + static cocos2d::Vec2 leftTop(); + static cocos2d::Vec2 rightTop(); + static cocos2d::Vec2 leftBottom(); + static cocos2d::Vec2 rightBottom(); +private: + static void lazyInit(); + static cocos2d::Rect s_visibleRect; +}; + +#endif /* __VISIBLERECT_H__ */ diff --git a/tests/performance-tests/Classes/tests/controller.cpp b/tests/performance-tests/Classes/tests/controller.cpp new file mode 100644 index 0000000000..60f3b868ad --- /dev/null +++ b/tests/performance-tests/Classes/tests/controller.cpp @@ -0,0 +1,471 @@ +#include "controller.h" +#include +#include +#include "BaseTest.h" +#include "tests.h" +#include "Profile.h" + +USING_NS_CC; + +#define TEST_TIME_OUT 600 +#define CREATE_TIME_OUT 25 +#define LOG_INDENTATION " " +#define LOG_TAG "[TestController]" + +static void initCrashCatch(); +static void disableCrashCatch(); + +class RootTests : public TestList +{ +public: + RootTests() + { + addTest("Alloc Tests", []() { return new PerformceAllocTests(); }); + addTest("Node Children Tests", []() { return new PerformceNodeChildrenTests(); }); + addTest("Particle Tests", []() { return new PerformceParticleTests(); }); + addTest("Particle3D Tests", []() { return new PerformceParticle3DTests(); }); + addTest("Sprite Tests", []() { return new PerformceSpriteTests(); }); + addTest("Texture Tests", []() { return new PerformceTextureTests(); }); + addTest("Label Tests", []() { return new PerformceLabelTests(); }); + addTest("EventDispatcher Tests", []() { return new PerformceEventDispatcherTests(); }); + addTest("Scenario Tests", []() { return new PerformceScenarioTests(); }); + addTest("Callback Tests", []() { return new PerformceCallbackTests(); }); + addTest("Math Tests", []() { return new PerformceMathTests(); }); + addTest("Container Tests", []() { return new PerformceContainerTests(); }); + } +}; + +TestController::TestController() +: _stopAutoTest(true) +, _isRunInBackground(false) +, _testSuite(nullptr) +{ + _director = Director::getInstance(); + _rootTestList = new (std::nothrow) RootTests; + _rootTestList->runThisTest(); +} + +TestController::~TestController() +{ + _rootTestList->release(); + _rootTestList = nullptr; +} + +void TestController::startAutoTest() +{ + if (!_autoTestThread.joinable()) + { + _stopAutoTest = false; + _logIndentation = ""; + _autoTestThread = std::thread(&TestController::traverseThreadFunc, this); + _autoTestThread.detach(); + } +} + +void TestController::stopAutoTest() +{ + _stopAutoTest = true; + + if (_autoTestThread.joinable()) { + _sleepCondition.notify_all(); + _autoTestThread.join(); + } +} + +void TestController::traverseThreadFunc() +{ + std::mutex sleepMutex; + auto lock = std::unique_lock(sleepMutex); + _sleepUniqueLock = &lock; + traverseTestList(_rootTestList); + _sleepUniqueLock = nullptr; + + // write the test data into file. + Profile::getInstance()->flush(); + Profile::destroyInstance(); +} + +void TestController::traverseTestList(TestList* testList) +{ + if (testList == _rootTestList) + { + _sleepCondition.wait_for(*_sleepUniqueLock, std::chrono::milliseconds(500)); + } + else + { + _logIndentation += LOG_INDENTATION; + _sleepCondition.wait_for(*_sleepUniqueLock, std::chrono::milliseconds(500)); + } + logEx("%s%sBegin traverse TestList:%s", LOG_TAG, _logIndentation.c_str(), testList->getTestName().c_str()); + + auto scheduler = _director->getScheduler(); + int testIndex = 0; + for (auto& callback : testList->_testCallbacks) + { + if (_stopAutoTest) break; + while (_isRunInBackground) + { + logEx("_director is paused"); + _sleepCondition.wait_for(*_sleepUniqueLock, std::chrono::milliseconds(500)); + } + if (callback) + { + auto test = callback(); + test->setTestParent(testList); + test->setTestName(testList->_childTestNames[testIndex++]); + if (test->isTestList()) + { + scheduler->performFunctionInCocosThread([&](){ + test->runThisTest(); + }); + + traverseTestList((TestList*)test); + } + else + { + traverseTestSuite((TestSuite*)test); + } + } + } + + if (testList == _rootTestList) + { + _stopAutoTest = true; + } + else + { + if (!_stopAutoTest) + { + //Backs up one level and release TestList object. + scheduler->performFunctionInCocosThread([&](){ + testList->_parentTest->runThisTest(); + }); + _sleepCondition.wait_for(*_sleepUniqueLock, std::chrono::milliseconds(500)); + testList->release(); + } + + _logIndentation.erase(_logIndentation.rfind(LOG_INDENTATION)); + } +} + +void TestController::traverseTestSuite(TestSuite* testSuite) +{ + auto scheduler = _director->getScheduler(); + int testIndex = 0; + float testCaseDuration = 0.0f; + _logIndentation += LOG_INDENTATION; + logEx("%s%sBegin traverse TestSuite:%s", LOG_TAG, _logIndentation.c_str(), testSuite->getTestName().c_str()); + + _logIndentation += LOG_INDENTATION; + testSuite->_currTestIndex = -1; + + auto logIndentation = _logIndentation; + for (auto& callback : testSuite->_testCallbacks) + { + auto testName = testSuite->_childTestNames[testIndex++]; + + Scene* testScene = nullptr; + TestCase* testCase = nullptr; + TransitionScene* transitionScene = nullptr; + + if (_stopAutoTest) break; + + while (_isRunInBackground) + { + logEx("_director is paused"); + _sleepCondition.wait_for(*_sleepUniqueLock, std::chrono::milliseconds(500)); + } + //Run test case in the cocos[GL] thread. + scheduler->performFunctionInCocosThread([&, logIndentation, testName](){ + if (_stopAutoTest) return; + logEx("%s%sRun test:%s.", LOG_TAG, logIndentation.c_str(), testName.c_str()); + + auto scene = callback(); + if (_stopAutoTest) return; + + if (scene) + { + transitionScene = dynamic_cast(scene); + if (transitionScene) + { + testCase = (TestCase*)transitionScene->getInScene(); + testCaseDuration = transitionScene->getDuration() + 0.5f; + } + else + { + testCase = (TestCase*)scene; + testCaseDuration = testCase->getDuration(); + } + testSuite->_currTestIndex++; + testCase->setTestSuite(testSuite); + testCase->setTestCaseName(testName); + testCase->setAutoTesting(true); + _director->replaceScene(scene); + + testScene = scene; + } + }); + + if (_stopAutoTest) break; + + //Wait for the test case be created. + float waitTime = 0.0f; + while (!testScene && !_stopAutoTest) + { + _sleepCondition.wait_for(*_sleepUniqueLock, std::chrono::milliseconds(50)); + if (!_isRunInBackground) + { + waitTime += 0.05f; + } + + if (waitTime > CREATE_TIME_OUT) + { + logEx("%sCreate test %s time out", LOG_TAG, testName.c_str()); + _stopAutoTest = true; + break; + } + } + + if (_stopAutoTest) break; + + //Wait for test completed. + _sleepCondition.wait_for(*_sleepUniqueLock, std::chrono::milliseconds(int(1000 * testCaseDuration))); + + if (transitionScene == nullptr) + { + waitTime = 0.0f; + while (!_stopAutoTest && testCase->isAutoTesting()) + { + _sleepCondition.wait_for(*_sleepUniqueLock, std::chrono::milliseconds(50)); + if (!_isRunInBackground) + { + waitTime += 0.05f; + } + + if (waitTime > TEST_TIME_OUT) + { + logEx("%sRun test %s time out", LOG_TAG, testName.c_str()); + _stopAutoTest = true; + break; + } + } + + if (!_stopAutoTest) + { + //Check the result of test. + checkTest(testCase); + } + } + } + + if (!_stopAutoTest) + { + //Backs up one level and release TestSuite object. + auto parentTest = testSuite->_parentTest; + scheduler->performFunctionInCocosThread([&](){ + parentTest->runThisTest(); + }); + + _sleepCondition.wait_for(*_sleepUniqueLock, std::chrono::milliseconds(1000)); + testSuite->release(); + } + + _logIndentation.erase(_logIndentation.rfind(LOG_INDENTATION)); + _logIndentation.erase(_logIndentation.rfind(LOG_INDENTATION)); +} + +bool TestController::checkTest(TestCase* testCase) +{ + if (testCase) + { + switch (testCase->getTestType()) + { + case TestCase::Type::UNIT: + { + if (testCase && testCase->getExpectedOutput() != testCase->getActualOutput()) + { + logEx("%s %s test fail", LOG_TAG, testCase->getTestCaseName().c_str()); + } + else + { + logEx("%s %s test pass", LOG_TAG, testCase->getTestCaseName().c_str()); + } + break; + } + case TestCase::Type::ROBUSTNESS: + { + break; + } + case TestCase::Type::MANUAL: + { + break; + } + default: + break; + } + } + + return true; +} + +void TestController::handleCrash() +{ + disableCrashCatch(); + + logEx("%sCatch an crash event", LOG_TAG); + + if (!_stopAutoTest) + { + stopAutoTest(); + } +} + +void TestController::onEnterBackground() +{ + _isRunInBackground = true; +} + +void TestController::onEnterForeground() +{ + _isRunInBackground = false; +} + +void TestController::logEx(const char * format, ...) +{ + char buff[1024]; + + va_list args; + va_start(args, format); + vsnprintf(buff, 1020, format, args); + strcat(buff, "\n"); + +#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID + __android_log_print(ANDROID_LOG_DEBUG, "cocos2d-x debug info", "%s", buff); + +#elif CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_WINRT + WCHAR wszBuf[1024] = { 0 }; + MultiByteToWideChar(CP_UTF8, 0, buff, -1, wszBuf, sizeof(wszBuf)); + OutputDebugStringW(wszBuf); + +#else + // Linux, Mac, iOS, etc + fprintf(stdout, "%s", buff); + fflush(stdout); +#endif + va_end(args); +} + +static TestController* s_testController = nullptr; + +TestController* TestController::getInstance() +{ + if (s_testController == nullptr) + { + s_testController = new (std::nothrow) TestController; + + initCrashCatch(); + } + + return s_testController; +} + +void TestController::destroyInstance() +{ + if (s_testController) + { + s_testController->stopAutoTest(); + delete s_testController; + s_testController = nullptr; + } + + disableCrashCatch(); +} + +bool TestController::blockTouchBegan(Touch* touch, Event* event) +{ + return !_stopAutoTest; +} + +//================================================================================================== +#if CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 +#include + +static long __stdcall windowExceptionFilter(_EXCEPTION_POINTERS* excp) +{ + if (s_testController) + { + s_testController->handleCrash(); + } + + return EXCEPTION_EXECUTE_HANDLER; +} + +static void initCrashCatch() +{ + SetUnhandledExceptionFilter(windowExceptionFilter); +} +static void disableCrashCatch() +{ + SetUnhandledExceptionFilter(UnhandledExceptionFilter); +} + +#elif CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID + +#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID +static int s_fatal_signals[] = { + SIGILL, + SIGABRT, + SIGBUS, + SIGFPE, + SIGSEGV, + SIGSTKFLT, + SIGPIPE, +}; +#else +static int s_fatal_signals[] = { + SIGABRT, + SIGBUS, + SIGFPE, + SIGILL, + SIGSEGV, + SIGTRAP, + SIGTERM, + SIGKILL, +}; +#endif + +static void signalHandler(int sig) +{ + if (s_testController) + { + s_testController->handleCrash(); + } +} + +static void initCrashCatch() +{ + for (auto sig : s_fatal_signals) + { + signal(sig, signalHandler); + } +} + +static void disableCrashCatch() +{ + for (auto sig : s_fatal_signals) + { + signal(sig, SIG_DFL); + } +} + +#else + +static void initCrashCatch() +{ +} + +static void disableCrashCatch() +{ +} + +#endif diff --git a/tests/performance-tests/Classes/tests/controller.h b/tests/performance-tests/Classes/tests/controller.h new file mode 100644 index 0000000000..53943c0666 --- /dev/null +++ b/tests/performance-tests/Classes/tests/controller.h @@ -0,0 +1,91 @@ +/**************************************************************************** +Copyright (c) 2013-2015 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 _CPPTESTS_CONTROLLER_H__ +#define _CPPTESTS_CONTROLLER_H__ + +#include +#include +#include + +class TestList; +class TestSuite; +class TestCase; + +namespace cocos2d +{ + class Director; + class Touch; + class Event; + class EventListenerTouchOneByOne; +} + +class TestController +{ +public: + static TestController* getInstance(); + static void destroyInstance(); + + ~TestController(); + + void startAutoTest(); + void stopAutoTest(); + + void handleCrash(); + + void onEnterBackground(); + void onEnterForeground(); + + bool blockTouchBegan(cocos2d::Touch* touch, cocos2d::Event* event); + + void setCurrTestSuite(TestSuite* testSuite) { _testSuite = testSuite; } + TestSuite* getCurrTestSuite() { return _testSuite; } +private: + TestController(); + + void traverseThreadFunc(); + + void traverseTestList(TestList* testList); + void traverseTestSuite(TestSuite* testSuite); + bool checkTest(TestCase* testCase); + + void logEx(const char * format, ...); + + bool _stopAutoTest; + bool _isRunInBackground; + + TestList* _rootTestList; + TestSuite* _testSuite; + + std::thread _autoTestThread; + + std::condition_variable _sleepCondition; + std::unique_lock* _sleepUniqueLock; + + cocos2d::Director* _director; + + std::string _logIndentation; +}; + +#endif diff --git a/tests/performance-tests/Classes/tests/testBasic.h b/tests/performance-tests/Classes/tests/testBasic.h new file mode 100644 index 0000000000..fd1044d2d7 --- /dev/null +++ b/tests/performance-tests/Classes/tests/testBasic.h @@ -0,0 +1,24 @@ +#ifndef _TEST_BASIC_H_ +#define _TEST_BASIC_H_ + +#include "cocos2d.h" + +/** +* TestScene is retained for compatibility with older versions. +* @warning It should soon be removed. +*/ +class TestScene : public cocos2d::Scene +{ +public: + TestScene(bool bPortrait = false, bool physics = false){} + virtual void onEnter() override {} + + virtual void runThisTest() = 0; +}; + +// C++ 11 + +#define CL(__className__) [](){ return __className__::create();} +#define CLN(__className__) [](){ auto obj = new __className__(); obj->autorelease(); return obj; } + +#endif diff --git a/tests/performance-tests/Classes/tests/testResource.h b/tests/performance-tests/Classes/tests/testResource.h new file mode 100644 index 0000000000..93be1a7bde --- /dev/null +++ b/tests/performance-tests/Classes/tests/testResource.h @@ -0,0 +1,12 @@ +#ifndef _TEST_RESOURCE_H_ +#define _TEST_RESOURCE_H_ + +static const char s_pathB1[] = "Images/b1.png"; +static const char s_pathB2[] = "Images/b2.png"; +static const char s_pathR1[] = "Images/r1.png"; +static const char s_pathR2[] = "Images/r2.png"; +static const char s_pathF1[] = "Images/f1.png"; +static const char s_pathF2[] = "Images/f2.png"; +static const char s_pathClose[] = "Images/close.png"; + +#endif diff --git a/tests/performance-tests/Classes/tests/tests.h b/tests/performance-tests/Classes/tests/tests.h new file mode 100644 index 0000000000..eb33f87fd8 --- /dev/null +++ b/tests/performance-tests/Classes/tests/tests.h @@ -0,0 +1,18 @@ +#ifndef _TESTS_H_ +#define _TESTS_H_ + +// sort them alphabetically. thanks +#include "PerformanceAllocTest.h" +#include "PerformanceNodeChildrenTest.h" +#include "PerformanceParticleTest.h" +#include "PerformanceParticle3DTest.h" +#include "PerformanceSpriteTest.h" +#include "PerformanceTextureTest.h" +#include "PerformanceLabelTest.h" +#include "PerformanceEventDispatcherTest.h" +#include "PerformanceScenarioTest.h" +#include "PerformanceCallbackTest.h" +#include "PerformanceMathTest.h" +#include "PerformanceContainerTest.h" + +#endif diff --git a/tests/performance-tests/Resources/CloseNormal.png b/tests/performance-tests/Resources/CloseNormal.png new file mode 100644 index 0000000000..b65498c941 Binary files /dev/null and b/tests/performance-tests/Resources/CloseNormal.png differ diff --git a/tests/performance-tests/Resources/CloseSelected.png b/tests/performance-tests/Resources/CloseSelected.png new file mode 100644 index 0000000000..306749ecd2 Binary files /dev/null and b/tests/performance-tests/Resources/CloseSelected.png differ diff --git a/tests/cpp-tests/Resources/Images/PlanetCute-1024x1024.png b/tests/performance-tests/Resources/Images/PlanetCute-1024x1024.png similarity index 100% rename from tests/cpp-tests/Resources/Images/PlanetCute-1024x1024.png rename to tests/performance-tests/Resources/Images/PlanetCute-1024x1024.png diff --git a/tests/performance-tests/Resources/Images/b1.png b/tests/performance-tests/Resources/Images/b1.png new file mode 100755 index 0000000000..93ee8252f0 Binary files /dev/null and b/tests/performance-tests/Resources/Images/b1.png differ diff --git a/tests/performance-tests/Resources/Images/b2.png b/tests/performance-tests/Resources/Images/b2.png new file mode 100755 index 0000000000..8cc30415fb Binary files /dev/null and b/tests/performance-tests/Resources/Images/b2.png differ diff --git a/tests/performance-tests/Resources/Images/close.png b/tests/performance-tests/Resources/Images/close.png new file mode 100755 index 0000000000..ef3b1d12ae Binary files /dev/null and b/tests/performance-tests/Resources/Images/close.png differ diff --git a/tests/performance-tests/Resources/Images/f1.png b/tests/performance-tests/Resources/Images/f1.png new file mode 100755 index 0000000000..385e22707b Binary files /dev/null and b/tests/performance-tests/Resources/Images/f1.png differ diff --git a/tests/performance-tests/Resources/Images/f2.png b/tests/performance-tests/Resources/Images/f2.png new file mode 100755 index 0000000000..388a7399c5 Binary files /dev/null and b/tests/performance-tests/Resources/Images/f2.png differ diff --git a/tests/performance-tests/Resources/Images/fire.png b/tests/performance-tests/Resources/Images/fire.png new file mode 100755 index 0000000000..dd2be34cff Binary files /dev/null and b/tests/performance-tests/Resources/Images/fire.png differ diff --git a/tests/performance-tests/Resources/Images/grossini.png b/tests/performance-tests/Resources/Images/grossini.png new file mode 100755 index 0000000000..fad80b8e9a Binary files /dev/null and b/tests/performance-tests/Resources/Images/grossini.png differ diff --git a/tests/performance-tests/Resources/Images/grossini_dance_01.png b/tests/performance-tests/Resources/Images/grossini_dance_01.png new file mode 100755 index 0000000000..93aa6e983a Binary files /dev/null and b/tests/performance-tests/Resources/Images/grossini_dance_01.png differ diff --git a/tests/performance-tests/Resources/Images/grossini_dance_02.png b/tests/performance-tests/Resources/Images/grossini_dance_02.png new file mode 100755 index 0000000000..bf03d3312c Binary files /dev/null and b/tests/performance-tests/Resources/Images/grossini_dance_02.png differ diff --git a/tests/performance-tests/Resources/Images/grossini_dance_03.png b/tests/performance-tests/Resources/Images/grossini_dance_03.png new file mode 100755 index 0000000000..e01c593b40 Binary files /dev/null and b/tests/performance-tests/Resources/Images/grossini_dance_03.png differ diff --git a/tests/performance-tests/Resources/Images/grossini_dance_04.png b/tests/performance-tests/Resources/Images/grossini_dance_04.png new file mode 100755 index 0000000000..c9b0ae2529 Binary files /dev/null and b/tests/performance-tests/Resources/Images/grossini_dance_04.png differ diff --git a/tests/performance-tests/Resources/Images/grossini_dance_05.png b/tests/performance-tests/Resources/Images/grossini_dance_05.png new file mode 100755 index 0000000000..e65e6b2feb Binary files /dev/null and b/tests/performance-tests/Resources/Images/grossini_dance_05.png differ diff --git a/tests/performance-tests/Resources/Images/grossini_dance_06.png b/tests/performance-tests/Resources/Images/grossini_dance_06.png new file mode 100755 index 0000000000..4c3be2334f Binary files /dev/null and b/tests/performance-tests/Resources/Images/grossini_dance_06.png differ diff --git a/tests/performance-tests/Resources/Images/grossini_dance_07.png b/tests/performance-tests/Resources/Images/grossini_dance_07.png new file mode 100755 index 0000000000..4c38de3a78 Binary files /dev/null and b/tests/performance-tests/Resources/Images/grossini_dance_07.png differ diff --git a/tests/performance-tests/Resources/Images/grossini_dance_08.png b/tests/performance-tests/Resources/Images/grossini_dance_08.png new file mode 100755 index 0000000000..fad80b8e9a Binary files /dev/null and b/tests/performance-tests/Resources/Images/grossini_dance_08.png differ diff --git a/tests/performance-tests/Resources/Images/grossini_dance_09.png b/tests/performance-tests/Resources/Images/grossini_dance_09.png new file mode 100755 index 0000000000..b0fa9aded3 Binary files /dev/null and b/tests/performance-tests/Resources/Images/grossini_dance_09.png differ diff --git a/tests/performance-tests/Resources/Images/grossini_dance_10.png b/tests/performance-tests/Resources/Images/grossini_dance_10.png new file mode 100755 index 0000000000..0abb6eab93 Binary files /dev/null and b/tests/performance-tests/Resources/Images/grossini_dance_10.png differ diff --git a/tests/performance-tests/Resources/Images/grossini_dance_11.png b/tests/performance-tests/Resources/Images/grossini_dance_11.png new file mode 100755 index 0000000000..7285fd6c76 Binary files /dev/null and b/tests/performance-tests/Resources/Images/grossini_dance_11.png differ diff --git a/tests/performance-tests/Resources/Images/grossini_dance_12.png b/tests/performance-tests/Resources/Images/grossini_dance_12.png new file mode 100755 index 0000000000..ce7d672004 Binary files /dev/null and b/tests/performance-tests/Resources/Images/grossini_dance_12.png differ diff --git a/tests/performance-tests/Resources/Images/grossini_dance_13.png b/tests/performance-tests/Resources/Images/grossini_dance_13.png new file mode 100755 index 0000000000..92cbbd4da1 Binary files /dev/null and b/tests/performance-tests/Resources/Images/grossini_dance_13.png differ diff --git a/tests/performance-tests/Resources/Images/grossini_dance_14.png b/tests/performance-tests/Resources/Images/grossini_dance_14.png new file mode 100755 index 0000000000..ee7d1bba0a Binary files /dev/null and b/tests/performance-tests/Resources/Images/grossini_dance_14.png differ diff --git a/tests/performance-tests/Resources/Images/grossini_dance_atlas.png b/tests/performance-tests/Resources/Images/grossini_dance_atlas.png new file mode 100755 index 0000000000..12bca1310f Binary files /dev/null and b/tests/performance-tests/Resources/Images/grossini_dance_atlas.png differ diff --git a/tests/performance-tests/Resources/Images/grossinis_sister1.png b/tests/performance-tests/Resources/Images/grossinis_sister1.png new file mode 100755 index 0000000000..5be7918a60 Binary files /dev/null and b/tests/performance-tests/Resources/Images/grossinis_sister1.png differ diff --git a/tests/cpp-tests/Resources/Images/landscape-1024x1024.png b/tests/performance-tests/Resources/Images/landscape-1024x1024.png similarity index 100% rename from tests/cpp-tests/Resources/Images/landscape-1024x1024.png rename to tests/performance-tests/Resources/Images/landscape-1024x1024.png diff --git a/tests/performance-tests/Resources/Images/r1.png b/tests/performance-tests/Resources/Images/r1.png new file mode 100755 index 0000000000..96c0708831 Binary files /dev/null and b/tests/performance-tests/Resources/Images/r1.png differ diff --git a/tests/performance-tests/Resources/Images/r2.png b/tests/performance-tests/Resources/Images/r2.png new file mode 100755 index 0000000000..1caf31f4bd Binary files /dev/null and b/tests/performance-tests/Resources/Images/r2.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-0-0.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-0-0.png new file mode 100755 index 0000000000..8256a52992 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-0-0.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-0-1.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-0-1.png new file mode 100755 index 0000000000..ea7d815696 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-0-1.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-0-2.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-0-2.png new file mode 100755 index 0000000000..fb444b3348 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-0-2.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-0-3.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-0-3.png new file mode 100755 index 0000000000..81f6c287b9 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-0-3.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-0-4.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-0-4.png new file mode 100755 index 0000000000..a0d5ba8621 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-0-4.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-0-5.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-0-5.png new file mode 100755 index 0000000000..307968b441 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-0-5.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-0-6.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-0-6.png new file mode 100755 index 0000000000..e98bbcd94e Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-0-6.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-0-7.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-0-7.png new file mode 100755 index 0000000000..5c13bee7b5 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-0-7.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-1-0.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-1-0.png new file mode 100755 index 0000000000..5583645981 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-1-0.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-1-1.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-1-1.png new file mode 100755 index 0000000000..665bb8b606 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-1-1.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-1-2.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-1-2.png new file mode 100755 index 0000000000..f73989bc71 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-1-2.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-1-3.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-1-3.png new file mode 100755 index 0000000000..92cdc270d9 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-1-3.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-1-4.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-1-4.png new file mode 100755 index 0000000000..d4c4ff36b1 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-1-4.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-1-5.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-1-5.png new file mode 100755 index 0000000000..95fb8ba7e9 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-1-5.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-1-6.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-1-6.png new file mode 100755 index 0000000000..b576d2e3e6 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-1-6.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-1-7.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-1-7.png new file mode 100755 index 0000000000..f0367c971d Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-1-7.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-2-0.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-2-0.png new file mode 100755 index 0000000000..71044a10b1 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-2-0.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-2-1.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-2-1.png new file mode 100755 index 0000000000..3feb9e940f Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-2-1.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-2-2.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-2-2.png new file mode 100755 index 0000000000..e7e8740439 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-2-2.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-2-3.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-2-3.png new file mode 100755 index 0000000000..6ef5cc5e78 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-2-3.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-2-4.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-2-4.png new file mode 100755 index 0000000000..c6ac17cac8 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-2-4.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-2-5.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-2-5.png new file mode 100755 index 0000000000..d496e3d027 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-2-5.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-2-6.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-2-6.png new file mode 100755 index 0000000000..066b38a5cf Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-2-6.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-2-7.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-2-7.png new file mode 100755 index 0000000000..78c89fc748 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-2-7.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-3-0.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-3-0.png new file mode 100755 index 0000000000..230107e65b Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-3-0.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-3-1.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-3-1.png new file mode 100755 index 0000000000..ec5990d451 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-3-1.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-3-2.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-3-2.png new file mode 100755 index 0000000000..70b510b38c Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-3-2.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-3-3.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-3-3.png new file mode 100755 index 0000000000..3b7d911e22 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-3-3.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-3-4.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-3-4.png new file mode 100755 index 0000000000..8455784e3a Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-3-4.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-3-5.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-3-5.png new file mode 100755 index 0000000000..2d28698df5 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-3-5.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-3-6.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-3-6.png new file mode 100755 index 0000000000..fdc30ee923 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-3-6.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-3-7.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-3-7.png new file mode 100755 index 0000000000..7dfd55fda3 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-3-7.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-4-0.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-4-0.png new file mode 100755 index 0000000000..6bfc144c7e Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-4-0.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-4-1.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-4-1.png new file mode 100755 index 0000000000..15d6eb1543 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-4-1.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-4-2.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-4-2.png new file mode 100755 index 0000000000..32190cb70d Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-4-2.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-4-3.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-4-3.png new file mode 100755 index 0000000000..2e0320578a Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-4-3.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-4-4.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-4-4.png new file mode 100755 index 0000000000..f0708bb421 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-4-4.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-4-5.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-4-5.png new file mode 100755 index 0000000000..6c9ec9f39f Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-4-5.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-4-6.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-4-6.png new file mode 100755 index 0000000000..d93f278fd7 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-4-6.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-4-7.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-4-7.png new file mode 100755 index 0000000000..5dce60c711 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-4-7.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-5-0.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-5-0.png new file mode 100755 index 0000000000..1adff7adee Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-5-0.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-5-1.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-5-1.png new file mode 100755 index 0000000000..c3e56fe166 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-5-1.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-5-2.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-5-2.png new file mode 100755 index 0000000000..3659a67fe5 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-5-2.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-5-3.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-5-3.png new file mode 100755 index 0000000000..5e771251db Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-5-3.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-5-4.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-5-4.png new file mode 100755 index 0000000000..907c3696c2 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-5-4.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-5-5.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-5-5.png new file mode 100755 index 0000000000..a9175a5d0b Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-5-5.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-5-6.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-5-6.png new file mode 100755 index 0000000000..14bf384a9c Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-5-6.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-5-7.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-5-7.png new file mode 100755 index 0000000000..6d30170147 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-5-7.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-6-0.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-6-0.png new file mode 100755 index 0000000000..11be173003 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-6-0.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-6-1.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-6-1.png new file mode 100755 index 0000000000..259b7aed53 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-6-1.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-6-2.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-6-2.png new file mode 100755 index 0000000000..b9bae9d703 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-6-2.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-6-3.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-6-3.png new file mode 100755 index 0000000000..a84b7b5d09 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-6-3.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-6-4.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-6-4.png new file mode 100755 index 0000000000..5ec22013c4 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-6-4.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-6-5.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-6-5.png new file mode 100755 index 0000000000..3c07dc5190 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-6-5.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-6-6.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-6-6.png new file mode 100755 index 0000000000..de9e1e6b4a Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-6-6.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-6-7.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-6-7.png new file mode 100755 index 0000000000..0cf0e8fc17 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-6-7.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-7-0.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-7-0.png new file mode 100755 index 0000000000..58964c3fd8 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-7-0.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-7-1.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-7-1.png new file mode 100755 index 0000000000..b733b95b4f Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-7-1.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-7-2.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-7-2.png new file mode 100755 index 0000000000..14404fa36b Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-7-2.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-7-3.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-7-3.png new file mode 100755 index 0000000000..1770b6982f Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-7-3.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-7-4.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-7-4.png new file mode 100755 index 0000000000..3be136596e Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-7-4.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-7-5.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-7-5.png new file mode 100755 index 0000000000..594a7a8a73 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-7-5.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-7-6.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-7-6.png new file mode 100755 index 0000000000..72a7ff1870 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-7-6.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-7-7.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-7-7.png new file mode 100755 index 0000000000..0287bd7711 Binary files /dev/null and b/tests/performance-tests/Resources/Images/sprites_test/sprite-7-7.png differ diff --git a/tests/cpp-tests/Resources/Images/spritesheet1.png b/tests/performance-tests/Resources/Images/spritesheet1.png similarity index 100% rename from tests/cpp-tests/Resources/Images/spritesheet1.png rename to tests/performance-tests/Resources/Images/spritesheet1.png diff --git a/tests/performance-tests/Resources/Images/test_image.png b/tests/performance-tests/Resources/Images/test_image.png new file mode 100755 index 0000000000..eaf9474764 Binary files /dev/null and b/tests/performance-tests/Resources/Images/test_image.png differ diff --git a/tests/performance-tests/Resources/Images/texture1024x1024.png b/tests/performance-tests/Resources/Images/texture1024x1024.png new file mode 100755 index 0000000000..12a15fae99 Binary files /dev/null and b/tests/performance-tests/Resources/Images/texture1024x1024.png differ diff --git a/tests/performance-tests/Resources/Images/texture512x512.png b/tests/performance-tests/Resources/Images/texture512x512.png new file mode 100755 index 0000000000..170c02fd82 Binary files /dev/null and b/tests/performance-tests/Resources/Images/texture512x512.png differ diff --git a/tests/performance-tests/Resources/Particle3D/materials/pu_example.material b/tests/performance-tests/Resources/Particle3D/materials/pu_example.material new file mode 100644 index 0000000000..5367f07ab4 --- /dev/null +++ b/tests/performance-tests/Resources/Particle3D/materials/pu_example.material @@ -0,0 +1,661 @@ +//----------------------------------------------------------------------------------------------------------------------- +// This script is part of the Particle Universe Media Pack product. +// +// Copyright (c) 2008 Henry van Merode +// +// Usage of this program is licensed under the terms of the Particle Universe Commercial License. +// You can find a copy of the Commercial License in the Particle Universe package. +//----------------------------------------------------------------------------------------------------------------------- + +material mp_fire_02 +{ + technique + { + pass + { + lighting off + depth_write off + scene_blend add + + texture_unit + { + texture mp_fire_02_2x2.png + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------------------------------- +material ParticleUniverse/Tornado +{ + technique + { + pass + { + lighting off + depth_write off + scene_blend alpha_blend + + texture_unit + { + texture pu_sand_336x330.png + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------------------------------- +material ParticleUniverse/Stone +{ + technique + { + pass + { + lighting off + depth_write off + texture_unit + { + texture pu_stone.jpeg + scale 0.5 0.5 + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------------------------------- +material ParticleUniverse/Circle +{ + technique + { + pass + { + depth_write off + scene_blend alpha_blend + texture_unit + { + texture pu_circle.png + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------------------------------- +material ParticleUniverse/Rain_01 +{ + technique + { + pass + { + scene_blend add + depth_write off + texture_unit + { + texture pu_rain_01.png + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------------------------------- +material ParticleUniverse/Barrel_01 +{ + technique + { + pass + { + depth_write off + depth_write off + texture_unit + { + texture pu_barrel_01.png + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------------------------------- +material ParticleUniverse/Barrel_02 +{ + technique + { + pass + { + lighting off + depth_write off + texture_unit + { + texture pu_barrel_02.png + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------------------------------- +material ParticleUniverse/Lightning +{ + technique + { + pass + { + lighting off + scene_blend alpha_blend + depth_write off + + texture_unit + { + texture pu_lightning_20x64.png + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------------------------------- +material fxpression/ac3dmat1 +{ + technique + { + pass + { + ambient 1 0.05 0 + diffuse 1 0.05 0 + texture_unit + { + texture pu_plate.jpg + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------------------------------- +material ParticleUniverse/Flame +{ + technique + { + pass + { + scene_blend add + depth_write off + texture_unit + { + texture pu_flame.png + tex_address_mode clamp + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------------------------------- +material ParticleUniverse/Fire +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + texture_unit + { + texture pu_flame.png + tex_address_mode clamp + wave_xform scroll_x sine 0 0.3 0 0.15 + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------------------------------- +material ParticleUniverse/Smoke +{ + technique + { + pass + { + lighting off + depth_write off + scene_blend alpha_blend + + texture_unit + { + texture pu_smoke_brown_336x330.png + tex_address_mode clamp + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------------------------------- +material ParticleUniverse/Smoke_02 +{ + technique + { + pass + { + depth_write off + scene_blend add + + texture_unit + { + texture pu_smoke_brown_336x330.png + tex_address_mode clamp + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------------------------------- +material ParticleUniverse/ExplosionFire +{ + technique + { + pass + { + lighting off + depth_write off + scene_blend add + fog_override true + + texture_unit + { + texture pu_smoke_02_128x128.png + tex_address_mode clamp + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------------------------------- +material ParticleUniverse/Nucleus +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pu_nucleus.png + tex_address_mode clamp + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------------------------------- +material ParticleUniverse/Debris +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pu_fire_01_64x64.png + tex_address_mode clamp + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------------------------------- +material ParticleUniverse/Dirt +{ + technique + { + pass + { + lighting off + depth_write off + scene_blend alpha_blend + texture_unit + { + texture pu_dirt_256x512.png + tex_address_mode clamp + } + } + } +} +//----------------------------------------------------------------------------- +material PUMediaPack/Smoke +{ + technique + { + pass + { + lighting off + depth_write off + scene_blend alpha_blend + texture_unit + { + texture pu_smoke_02_128x128.png + tex_address_mode clamp + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------------------------------- +material ParticleUniverse/BurstFlare +{ + technique + { + pass + { + lighting off + depth_write off + scene_blend add + texture_unit + { + texture pu_dot_03_64x64.png + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------------------------------- +material ParticleUniverse/GreenBall +{ + technique + { + pass + { + lighting off + depth_write off + scene_blend alpha_blend + texture_unit + { + texture pu_green_ball.png + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------------------------------- +material ParticleUniverse/Crate +{ + technique + { + pass + { + texture_unit + { + texture crate6.png + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------------------------------- +material ParticleUniverse/Star +{ + technique + { + pass + { + lighting off + depth_write off + scene_blend add + fog_override true + + texture_unit + { + texture pu_flare_12_256x256.png + tex_address_mode clamp + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------------------------------- +material ParticleUniverse/Hart +{ + technique + { + pass + { + lighting off + scene_blend alpha_blend + depth_write off + + texture_unit + { + texture pu_hart.png + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------------------------------- +material ParticleUniverse/Interpolate +{ + technique + { + pass + { + lighting on + depth_write off + scene_blend alpha_blend + + texture_unit + { + texture interpolate.png + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------------------------------- +material ParticleUniverse/Fish +{ + technique + { + pass + { + texture_unit + { + texture steelhead.png + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------------------------------- +material ParticleUniverse/Flare +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pu_flare.png + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------------------------------- +material ParticleUniverse/RibbonTrail +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pu_ribbontrail.png 1d + tex_address_mode clamp + filtering none + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------------------------------- +material ParticleUniverse/Rain +{ + technique + { + pass + { + scene_blend colour_blend + depth_write off + + texture_unit + { + texture pu_rain.png + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------------------------------- +material ParticleUniverse/Beam_1 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pu_beam_01.png 1d + tex_address_mode clamp + filtering none + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------------------------------- +material ParticleUniverse/Beam_2 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pu_beam_02.png 1d + tex_address_mode clamp + filtering none + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Pentagram_02 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_pentagram_02.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Flare_04 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_flare_04.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Streak_03 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_streak_03.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------- +material ParticleUniverse/Swirl_02 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_swirl_02.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Watch +{ + technique + { + pass + { + lighting off + depth_write off + scene_blend add + + texture_unit + { + texture pump_watch.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Hourglass +{ + technique + { + pass + { + lighting off + depth_write off + scene_blend add + + texture_unit + { + texture pump_hourglass.png + tex_address_mode clamp + } + } + } +} diff --git a/tests/performance-tests/Resources/Particle3D/materials/pu_mediapack_01.material b/tests/performance-tests/Resources/Particle3D/materials/pu_mediapack_01.material new file mode 100644 index 0000000000..890c4da467 --- /dev/null +++ b/tests/performance-tests/Resources/Particle3D/materials/pu_mediapack_01.material @@ -0,0 +1,1323 @@ +//----------------------------------------------------------------------------------------------------------------------- +// This script is part of the Particle Universe Media Pack product. +// +// Copyright (c) 2008 Henry van Merode +// +// Usage of this program is licensed under the terms of the Particle Universe Commercial License. +// You can find a copy of the Commercial License in the Particle Universe package. +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Bubble +{ + technique + { + pass + { + lighting off + scene_blend alpha_blend + depth_write off + + texture_unit + { + texture pump_bubble.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/BlurredBubble +{ + technique + { + pass + { + lighting off + scene_blend alpha_blend + depth_write off + + texture_unit + { + texture pump_bubble_blurred.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Streak_01 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_streak_01.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Streak_02 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + texture_unit + { + texture pump_streak_02.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Streak_03 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_streak_03.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Streak_04 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_streak_04.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Flare_01 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_flare_01.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Flare_02 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_flare_02.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Flare_03 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_flare_03.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Flare_04 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_flare_04.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Flare_05 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_flare_05.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Flare_06 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_flare_06.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Watch +{ + technique + { + pass + { + lighting off + depth_write off + scene_blend add + + texture_unit + { + texture pump_watch.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Hourglass +{ + technique + { + pass + { + lighting off + depth_write off + scene_blend add + + texture_unit + { + texture pump_hourglass.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Leave +{ + technique + { + pass + { + lighting off + scene_blend alpha_blend + depth_write off + + texture_unit + { + texture pump_leave.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Smoke_01 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_smoke_01.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Smoke_11 +{ + technique + { + pass + { + lighting off + scene_blend alpha_blend + depth_write off + + texture_unit + { + texture pump_smoke_01.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Dirt_11 +{ + technique + { + pass + { + lighting off + scene_blend alpha_blend + depth_write off + + texture_unit + { + texture pump_dirt_01.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Dirt_12 +{ + technique + { + pass + { + lighting off + scene_blend alpha_blend + depth_write off + + texture_unit + { + texture pump_dirt_02.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Lightning_01 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_lightning_01.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Lightning_02 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_lightning_02.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Lightning_03 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_lightning_03.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Lightning_04 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_lightning_04.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Spark_01 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_spark_01.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Star_01 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_star_01.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Star_02 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_star_02.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Star_03 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_star_03.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Star_04 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_star_04.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Star_05 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_star_05.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Genesis_11 +{ + technique + { + pass + { + lighting off + scene_blend alpha_blend + depth_write off + + texture_unit + { + texture pump_genesis_01.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------- +material PUMediaPack/Genesis_12 +{ + technique + { + pass + { + lighting off + scene_blend alpha_blend + depth_write off + + texture_unit + { + texture pump_genesis_02.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------- +material ParticleUniverse/Swirl_01 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_swirl_01.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------- +material ParticleUniverse/Swirl_02 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_swirl_02.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------- +material ParticleUniverse/Swirl_03 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_swirl_03.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------- +material PUMediaPack/Ring_01 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_ring_01.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------- +material PUMediaPack/Ring_02 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_ring_02.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------- +material PUMediaPack/Ring_03 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_ring_03.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------- +material PUMediaPack/Ring_14 +{ + technique + { + pass + { + lighting off + scene_blend alpha_blend + depth_write off + + texture_unit + { + texture pump_ring_04.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------- +material PUMediaPack/Ring_05 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_ring_05.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Metal_01 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_metal_01.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Metal_02 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_metal_02.png + tex_address_mode clamp + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Fire_01 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_flame_01.png + tex_address_mode clamp + } + } + } +} + +//--------------------------------------------------------------------- +material PUMediaPack/Fire_02 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_flame_02.png + tex_address_mode clamp + } + } + } +} + +//--------------------------------------------------------------------- +material PUMediaPack/Fire_03 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_flame_03.png + tex_address_mode clamp + } + } + } +} + +//--------------------------------------------------------------------- +material PUMediaPack/Fire_04 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_flame_04.png + tex_address_mode clamp + } + } + } +} + +//--------------------------------------------------------------------- +material PUMediaPack/AtlasSmoke +{ + technique + { + pass + { + lighting off + scene_blend alpha_blend + depth_write off + + texture_unit + { + texture pump_atlas_smoke.png + tex_address_mode clamp + } + } + } +} + +//--------------------------------------------------------------------- +material PUMediaPack/Snow_01 +{ + technique + { + pass + { + lighting off + scene_blend alpha_blend + depth_write off + + texture_unit + { + texture pump_snow_01.png + tex_address_mode clamp + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/BBal +{ + technique + { + pass + { + lighting off + depth_write off + + texture_unit + { + texture pu_bbal.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/BioHazzard +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_biohazzard.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/CelticKnot +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_celticknot.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Pentagram_01 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_pentagram_01.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +material PUMediaPack/Pentagram_02 +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + + texture_unit + { + texture pump_pentagram_02.png + tex_address_mode clamp + } + } + } +} + +//----------------------------------------------------------------------------------------------------------------------- +// This script is part of the Particle Universe Media Pack 1 product. +// +// Copyright (c) 2010 Henry van Merode +// +// Usage of this program is licensed under the terms of the Particle Universe Commercial License Media Pack 1. +// You can find a copy of the Commercial License in the Media Pack 1 package. +//----------------------------------------------------------------------------------------------------------------------- + +material mp_explosion_smoke_01 +{ + technique + { + pass + { + lighting off + depth_write off + scene_blend alpha_blend + + texture_unit + { + texture mp_explosion_smoke_01.dds + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------- +material mp_explosion_smoke_01_add +{ + technique + { + pass + { + lighting off + depth_write off + scene_blend add + texture_unit + { + texture mp_explosion_smoke_01_add.dds + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------- +material mp_explosion_flare_01 +{ + technique + { + pass + { + lighting off + depth_write off + scene_blend add + + texture_unit + { + texture mp_explosion_flare_01.dds + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------- +material mp_explosion_flare_02 +{ + technique + { + pass + { + lighting off + depth_write off + scene_blend add + + texture_unit + { + texture mp_explosion_flare_02.dds + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------- +material mp_explosion_dirt +{ + technique + { + pass + { + lighting off + depth_write off + scene_blend alpha_blend + + texture_unit + { + texture mp_explosion_dirt.dds + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------- +material mp_explosion_flame_01 +{ + technique + { + pass + { + lighting off + depth_write off + scene_blend add + + texture_unit + { + texture mp_explosion_flame_01.dds + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------- +material mp_explosion_flame_02 +{ + technique + { + pass + { + lighting off + depth_write off + scene_blend add + + texture_unit + { + texture mp_explosion_flame_02.dds + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------- +material mp_explosion_smoke_02 +{ + technique + { + pass + { + lighting off + depth_write off + scene_blend alpha_blend + + texture_unit + { + texture mp_explosion_smoke_02.dds + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------- +material mp_explosion_smoke_03 +{ + technique + { + pass + { + lighting off + depth_write off + scene_blend alpha_blend + + texture_unit + { + texture mp_explosion_smoke_03.dds + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------- +material mp_explosion_debris +{ + technique + { + pass + { + lighting off + depth_write off + scene_blend add + + texture_unit + { + texture mp_explosion_debris.dds + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------- +material mp_explosion_debris_large +{ + technique + { + pass + { + lighting off + depth_write off + scene_blend alpha_blend + + texture_unit + { + texture mp_explosion_debris_large_4x4.dds + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------- +material mp_explosion_04 +{ + technique + { + pass + { + lighting off + depth_write off + scene_blend add + texture_unit + { + texture mp_explosion_04.dds + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------- +material mp_explosion_trail +{ + technique + { + pass + { + lighting off + depth_write off + scene_blend add + + texture_unit + { + texture mp_explosion_trail_01.dds + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------- +material mp_explosion_water +{ + technique + { + pass + { + lighting off + depth_write off + scene_blend alpha_blend + + texture_unit + { + texture mp_explosion_water.dds + } + } + } +} +//----------------------------------------------------------------------------------------------------------------------- +material weaponTrail +{ + technique + { + pass + { + lighting off + scene_blend add + depth_write off + cull_hardware none + cull_software none + + texture_unit + { + texture weaponTrail.png + tex_address_mode clamp + } + } + } +} + diff --git a/tests/performance-tests/Resources/Particle3D/scripts/UVAnimation.pu b/tests/performance-tests/Resources/Particle3D/scripts/UVAnimation.pu new file mode 100644 index 0000000000..8622e39e1b --- /dev/null +++ b/tests/performance-tests/Resources/Particle3D/scripts/UVAnimation.pu @@ -0,0 +1,41 @@ +system example_029 +{ + category Examples_21_30 + technique + { + visual_particle_quota 2000 + emitted_affector_quota 200 + material ParticleUniverse/Interpolate + default_particle_width 1.8 + default_particle_height 1.8 + renderer Billboard + { + texture_coords_rows 6 + texture_coords_columns 6 + } + emitter Point + { + angle 360 + time_to_live dyn_random + { + min 2 + max 5 + } + velocity dyn_random + { + min 3.6 + max 4.8 + } + } + affector Scale + { + xyz_scale 0.6 + } + affector TextureAnimator + { + time_step 0.1 + end_texture_coords_range 35 + texture_start_random false + } + } +} diff --git a/tests/performance-tests/Resources/Particle3D/scripts/advancedLodSystem.pu b/tests/performance-tests/Resources/Particle3D/scripts/advancedLodSystem.pu new file mode 100644 index 0000000000..a26f690949 --- /dev/null +++ b/tests/performance-tests/Resources/Particle3D/scripts/advancedLodSystem.pu @@ -0,0 +1,57 @@ +system advancedLodSystem +{ + smooth_lod true + main_camera_name MainCamera + lod_distances 21 60 + technique + { + visual_particle_quota 100 + material ParticleUniverse/Barrel_02 + default_particle_width 0.99 + default_particle_height 1.05 + default_particle_depth 1.05 + renderer Entity + { + mesh_name sphere.mesh + } + emitter Box + { + emission_rate 5 + angle 25 + time_to_live dyn_random + { + min 2 + max 6 + } + velocity 2.4 + box_width 3 + box_height 3 + box_depth 3 + } + } + technique + { + material ParticleUniverse/Barrel_01 + lod_index 1 + default_particle_width 0.96 + default_particle_height 1.26 + default_particle_depth 1.5 + renderer Billboard + { + } + emitter Box + { + emission_rate 5 + angle 25 + time_to_live dyn_random + { + min 2 + max 6 + } + velocity 2.4 + box_width 3 + box_height 3 + box_depth 3 + } + } +} diff --git a/tests/performance-tests/Resources/Particle3D/scripts/blackHole.pu b/tests/performance-tests/Resources/Particle3D/scripts/blackHole.pu new file mode 100644 index 0000000000..3abffa71db --- /dev/null +++ b/tests/performance-tests/Resources/Particle3D/scripts/blackHole.pu @@ -0,0 +1,76 @@ +system blackHole +{ + technique + { + visual_particle_quota 2500 + material PUMediaPack/Flare_04 + default_particle_width 12 + default_particle_height 12 + renderer Billboard + { + } + emitter SphereSurface + { + emission_rate 200 + velocity 3 + radius 12 + } + affector Colour + { + time_colour 0 0 0 0.2 1 + time_colour 0.9 0.8 0.8 1 1 + time_colour 1 1 1 1 1 + } + affector Gravity + { + gravity 2700 + } + affector Scale + { + xyz_scale -4.5 + } + } + technique + { + visual_particle_quota 250 + material PUMediaPack/Streak_03 + renderer Billboard + { + billboard_type oriented_self + } + emitter Point + { + emission_rate 50 + angle 360 + time_to_live 4 + velocity 1 + particle_width dyn_random + { + min 2 + max 4 + } + particle_height dyn_random + { + min 45 + max 60 + } + colour 0.1 0.1 1 1 + } + affector Scale + { + x_scale -1.2 + } + affector Scale + { + y_scale -45 + } + affector Colour + { + time_colour 0 0 0 0 0 + time_colour 0.2 1 1 1 1 + time_colour 0.8 1 1 1 1 + time_colour 1 0 0 0 0 + colour_operation multiply + } + } +} diff --git a/tests/performance-tests/Resources/Particle3D/scripts/canOfWorms.pu b/tests/performance-tests/Resources/Particle3D/scripts/canOfWorms.pu new file mode 100644 index 0000000000..186dea1b13 --- /dev/null +++ b/tests/performance-tests/Resources/Particle3D/scripts/canOfWorms.pu @@ -0,0 +1,39 @@ +system canOfWorms +{ + category LightFX + technique + { + visual_particle_quota 2000 + emitted_emitter_quota 20 + material PUMediaPack/Flare_04 + default_particle_width 1.2 + default_particle_height 1.2 + renderer Billboard + { + } + emitter Point Core + { + emission_rate 3 + angle 360 + time_to_live 4 + velocity 9 + emits emitter_particle Worms + } + emitter Point Worms + { + emission_rate 60 + angle 360 + time_to_live 2 + velocity 0.45 + direction 0 -1 0 + colour 1 0.6 0.6 1 + } + affector SineForce + { + exclude_emitter Worms + force_vector 15 15 15 + min_frequency 5 + max_frequency 5 + } + } +} diff --git a/tests/performance-tests/Resources/Particle3D/scripts/electricBeamSystem.pu b/tests/performance-tests/Resources/Particle3D/scripts/electricBeamSystem.pu new file mode 100644 index 0000000000..4bb28cb576 --- /dev/null +++ b/tests/performance-tests/Resources/Particle3D/scripts/electricBeamSystem.pu @@ -0,0 +1,69 @@ +system electricBeamSystem +{ + technique + { + position -15 -3 0 + material ParticleUniverse/Lightning + default_particle_width 1.05 + default_particle_height 0 + renderer Billboard + { + billboard_type oriented_shape + billboard_origin bottom_center + } + emitter Line + { + emission_rate 40 + time_to_live 100 + direction 0 0 0 + end 45 9 0 + min_increment 1.5 + max_increment 4.5 + max_deviation 0.3 + } + affector Line + { + max_deviation 4 + time_step 0.03 + end 45 9 0 + drift 0.3 + } + affector Align + { + resize true + } + } + technique + { + position -15 -3 0 + material ParticleUniverse/Lightning + default_particle_width 0.45 + default_particle_height 0 + renderer Billboard + { + billboard_type oriented_shape + billboard_origin bottom_center + } + emitter Line + { + emission_rate 150 + time_to_live 100 + direction 0 0 0 + end 45 9 0 + min_increment 1.5 + max_increment 1.8 + max_deviation 0.9 + } + affector Line + { + max_deviation 4.2 + time_step 0.01 + end 45 9 0 + drift 0.1 + } + affector Align + { + resize true + } + } +} diff --git a/tests/performance-tests/Resources/Particle3D/scripts/example_004.pu b/tests/performance-tests/Resources/Particle3D/scripts/example_004.pu new file mode 100644 index 0000000000..8004bafa0d --- /dev/null +++ b/tests/performance-tests/Resources/Particle3D/scripts/example_004.pu @@ -0,0 +1,32 @@ +system example_004 +{ + category Examples_1_10 + technique + { + visual_particle_quota 100 + material ParticleUniverse/Star + default_particle_width 0.6 + default_particle_height 0.6 + renderer Billboard + { + } + emitter SphereSurface + { + emission_rate 60 + time_to_live 1.8 + velocity 0 + direction 0 0 0 + radius 3 + } + affector Colour + { + time_colour 0 1 1 0 1 + time_colour 1 1 0 0 0 + } + affector Gravity + { + mass_affector 0.03 + gravity 150 + } + } +} diff --git a/tests/performance-tests/Resources/Particle3D/scripts/explosionSystem.pu b/tests/performance-tests/Resources/Particle3D/scripts/explosionSystem.pu new file mode 100644 index 0000000000..092a2b8ad4 --- /dev/null +++ b/tests/performance-tests/Resources/Particle3D/scripts/explosionSystem.pu @@ -0,0 +1,159 @@ +system explosionSystem +{ + category Explosion + technique + { + material ParticleUniverse/ExplosionFire + default_particle_width 0.3 + default_particle_height 0.3 + renderer Billboard + { + } + emitter SphereSurface BurstEmitter + { + emission_rate 20 + time_to_live 2 + velocity 3 + direction 0 0 0 + auto_direction true + radius 0.15 + } + affector Colour + { + time_colour 0 1 1 0.95 1 + time_colour 0.5 0.18 0.05 0.01 1 + time_colour 1 0 0 0 1 + } + affector Scale + { + xyz_scale 6 + } + observer OnTime + { + handler DoEnableComponent + { + enable_component emitter_component BurstEmitter false + } + since_start_system true + on_time greater_than 0.7 + } + } + technique + { + emitted_technique_quota 6 + material BaseWhite + renderer Billboard + { + } + emitter Point NucleusEmitter + { + emission_rate 6 + angle 80 + time_to_live 10 + velocity 9 + enabled false + emits technique_particle NucleusTechnique + force_emission true + } + affector LinearForce + { + force_vector 0 -3 0 + } + observer OnTime + { + handler DoEnableComponent + { + enable_component emitter_component NucleusEmitter true + } + since_start_system true + on_time greater_than 0.3 + } + } + technique NucleusTechnique + { + material ParticleUniverse/Nucleus + default_particle_width 0.45 + default_particle_height 0.45 + renderer Billboard + { + } + emitter Point + { + emission_rate 100 + angle 360 + velocity 0.06 + direction 0 -1 0 + } + affector Colour + { + time_colour 0 0.5 0.4 0.2 1 + time_colour 0.1 0.5 0.2 0.05 1 + time_colour 0.2 0.1 0.1 0.1 1 + time_colour 1 0 0 0 1 + } + affector TextureRotator + { + use_own_rotation true + rotation dyn_random + { + min 1 + max 90 + } + rotation_speed dyn_random + { + min 0.1 + max 1 + } + } + affector Scale + { + xyz_scale -0.15 + } + } + technique + { + material ParticleUniverse/Debris + renderer Billboard + { + billboard_type oriented_self + } + emitter Point DebrisEmitter + { + emission_rate 100 + angle 360 + time_to_live 5 + velocity dyn_random + { + min 3 + max 6 + } + particle_width 0.09 + particle_height dyn_random + { + min 0.06 + max 0.6 + } + enabled false + direction 0 -1 0 + force_emission true + } + affector Colour + { + time_colour 0 1 1 1 1 + time_colour 1 0 0 0 1 + } + affector LinearForce + { + force_vector 0 -3 0 + } + observer OnTime + { + handler DoEnableComponent + { + enable_component emitter_component DebrisEmitter true + } + since_start_system true + on_time greater_than 0.3 + } + } +} diff --git a/tests/performance-tests/Resources/Particle3D/scripts/flameSystem.pu b/tests/performance-tests/Resources/Particle3D/scripts/flameSystem.pu new file mode 100644 index 0000000000..2813d44341 --- /dev/null +++ b/tests/performance-tests/Resources/Particle3D/scripts/flameSystem.pu @@ -0,0 +1,77 @@ +system flameSystem +{ + category Fire + technique + { + visual_particle_quota 2000 + emitted_affector_quota 200 + material ParticleUniverse/Flame + default_particle_width 1.35 + default_particle_height 1.8 + renderer Billboard + { + billboard_type oriented_self + } + emitter Box flamesEmitter + { + emission_rate 200 + angle 40 + time_to_live dyn_random + { + min 5 + max 9 + } + velocity dyn_random + { + min 1.8 + max 2.4 + } + box_width 3 + box_height 0.03 + box_depth 3 + } + emitter Box gravityEmitter + { + emission_rate 5 + angle 80 + time_to_live dyn_random + { + min 2 + max 5 + } + mass dyn_random + { + min 0.6 + max 1.2 + } + velocity dyn_random + { + min 2.4 + max 3.6 + } + position 0 1.8 0 + emits affector_particle gravityAffector + box_width 3 + box_height 3 + box_depth 3 + } + affector Gravity gravityAffector + { + gravity 1.2 + } + affector Scale + { + xyz_scale -0.3 + } + affector SineForce + { + force_vector 0.9 0 0 + max_frequency 3 + } + affector Colour + { + time_colour 0 1 1 1 1 + time_colour 1 0 0 0 1 + } + } +} diff --git a/tests/performance-tests/Resources/Particle3D/scripts/flareShield.pu b/tests/performance-tests/Resources/Particle3D/scripts/flareShield.pu new file mode 100644 index 0000000000..4a464a3d21 --- /dev/null +++ b/tests/performance-tests/Resources/Particle3D/scripts/flareShield.pu @@ -0,0 +1,110 @@ +system flareShield +{ + technique + { + visual_particle_quota 200 + emitted_emitter_quota 15 + material PUMediaPack/Flare_05 + renderer Billboard + { + } + emitter Point + { + emission_rate 3 + angle 0 + velocity 4.5 + duration 4 + emits emitter_particle CircleEmitter + } + emitter Circle CircleEmitter + { + emission_rate 20 + angle 360 + time_to_live dyn_random + { + min 0.2 + max 1 + } + velocity 0.15 + all_particle_dimensions dyn_random + { + min 0.9 + max 2.4 + } + keep_local true + direction 0 0 0 + colour 0.7 0.8 1 1 + radius 3 + } + affector Vortex + { + rotation_axis 0 1 0 + rotation_speed 7 + } + affector Colour + { + time_colour 0 1 1 1 1 + time_colour 0.8 1 1 1 1 + time_colour 1 0 0 0 0 + colour_operation multiply + } + observer OnTime + { + observe_until_event true + handler DoEnableComponent + { + enable_component observer_component OnExpireObserver true + } + since_start_system true + on_time greater_than 4 + } + observer OnExpire OnExpireObserver + { + enabled false + handler DoPlacementParticle + { + force_emitter ExplodeEmitter + } + } + } + technique + { + visual_particle_quota 200 + emitted_emitter_quota 30 + material PUMediaPack/Flare_05 + renderer Billboard + { + } + emitter Point ExplodeEmitter + { + emission_rate 0 + angle 0 + time_to_live dyn_random + { + min 0.3 + max 1 + } + direction 0 0 0 + emits emitter_particle ExplodeFlares + } + emitter Point ExplodeFlares + { + emission_rate 5 + angle 360 + time_to_live 1 + velocity 6 + all_particle_dimensions dyn_random + { + min 1.5 + max 1.8 + } + colour 0.7 0.8 1 1 + } + observer OnClear + { + handler DoStopSystem + { + } + } + } +} diff --git a/tests/performance-tests/Resources/Particle3D/scripts/hypno.pu b/tests/performance-tests/Resources/Particle3D/scripts/hypno.pu new file mode 100644 index 0000000000..6f410fb7f7 --- /dev/null +++ b/tests/performance-tests/Resources/Particle3D/scripts/hypno.pu @@ -0,0 +1,53 @@ +system hypno +{ + technique + { + visual_particle_quota 200 + material ParticleUniverse/Swirl_02 + default_particle_width 6 + default_particle_height 6 + renderer Billboard + { + } + emitter Circle + { + emission_rate 40 + time_to_live dyn_random + { + min 2 + max 5 + } + velocity 0.9 + all_particle_dimensions dyn_random + { + min 3 + max 12 + } + direction 0 0 0 + colour 1 0.22 0.22 1 + auto_direction true + radius 6 + normal 0 0 1 + } + affector Colour + { + time_colour 0 1 1 1 1 + time_colour 0.8 1 1 1 1 + time_colour 1 0 0 0 0 + colour_operation multiply + } + affector TextureRotator + { + rotation dyn_random + { + min 0 + max 180 + } + rotation_speed dyn_random + { + min 5 + max 20 + } + } + } +} diff --git a/tests/performance-tests/Resources/Particle3D/scripts/lightningBolt.pu b/tests/performance-tests/Resources/Particle3D/scripts/lightningBolt.pu new file mode 100644 index 0000000000..14fca93540 --- /dev/null +++ b/tests/performance-tests/Resources/Particle3D/scripts/lightningBolt.pu @@ -0,0 +1,193 @@ +system lightningBolt +{ + technique + { + visual_particle_quota 100 + material PUMediaPack/Smoke_01 + renderer Billboard + { + } + emitter Point + { + emission_rate 40 + angle 360 + time_to_live dyn_random + { + min 1 + max 3 + } + velocity 3 + duration 4 + all_particle_dimensions dyn_random + { + min 0.3 + max 0.6 + } + colour 0.46 0.06 0.82 1 + } + affector Scale + { + xyz_scale 6 + } + affector Colour + { + time_colour 0 1 1 1 1 + time_colour 1 0 0 0 0 + colour_operation multiply + } + observer OnClear + { + handler DoStopSystem + { + } + } + } + technique Lightning_1 + { + visual_particle_quota 20 + material PUMediaPack/Lightning_01 + renderer Billboard + { + billboard_type oriented_self + billboard_origin top_center + } + emitter Point + { + emission_rate 20 + angle 360 + time_to_live dyn_random + { + min 0.05 + max 0.15 + } + velocity 1e-005 + duration 2.5 + repeat_delay 2.5 + all_particle_dimensions dyn_random + { + min 7.68 + max 15.36 + } + enabled false + colour 0.46 0.06 0.82 1 + } + affector Colour + { + time_colour 0 1 1 1 1 + time_colour 0.5 1 1 1 1 + time_colour 1 0 0 0 0 + colour_operation multiply + } + } + technique Lightning_2 + { + visual_particle_quota 5 + material PUMediaPack/Lightning_02 + renderer Billboard + { + billboard_type oriented_self + billboard_origin top_center + } + emitter Point + { + emission_rate 20 + angle 360 + time_to_live dyn_random + { + min 0.05 + max 0.15 + } + velocity 1e-005 + duration 2.5 + repeat_delay 2.5 + all_particle_dimensions dyn_random + { + min 7.68 + max 15.36 + } + enabled false + colour 0.46 0.06 0.82 1 + } + affector Colour + { + time_colour 0 1 1 1 1 + time_colour 0.5 1 1 1 1 + time_colour 1 0 0 0 0 + colour_operation multiply + } + } + technique Lightning_3 + { + visual_particle_quota 5 + material PUMediaPack/Lightning_03 + renderer Billboard + { + billboard_type oriented_self + billboard_origin top_center + } + emitter Point + { + emission_rate 20 + angle 360 + time_to_live dyn_random + { + min 0.05 + max 0.15 + } + velocity 1e-005 + duration 2.5 + repeat_delay 2.5 + all_particle_dimensions dyn_random + { + min 7.68 + max 15.36 + } + enabled false + colour 0.46 0.06 0.82 1 + } + affector Colour + { + time_colour 0 1 1 1 1 + time_colour 0.5 1 1 1 1 + time_colour 1 0 0 0 0 + colour_operation multiply + } + } + technique Lightning_4 + { + visual_particle_quota 5 + material PUMediaPack/Lightning_04 + renderer Billboard + { + billboard_type oriented_self + billboard_origin top_center + } + emitter Point + { + emission_rate 20 + angle 360 + time_to_live dyn_random + { + min 0.05 + max 0.15 + } + velocity 1e-005 + duration 2.5 + repeat_delay 2.5 + all_particle_dimensions dyn_random + { + min 7.68 + max 15.36 + } + enabled false + colour 0.46 0.06 0.82 1 + } + affector Colour + { + time_colour 0 1 1 1 1 + time_colour 0.5 1 1 1 1 + time_colour 1 0 0 0 0 + colour_operation multiply + } + } +} diff --git a/tests/performance-tests/Resources/Particle3D/scripts/lineStreak.pu b/tests/performance-tests/Resources/Particle3D/scripts/lineStreak.pu new file mode 100644 index 0000000000..ea1caceff3 --- /dev/null +++ b/tests/performance-tests/Resources/Particle3D/scripts/lineStreak.pu @@ -0,0 +1,43 @@ +system lineStreak +{ + category LightFX + technique + { + keep_local true + visual_particle_quota 250 + material PUMediaPack/Pentagram_02 + renderer Billboard + { + billboard_type oriented_self + } + emitter Point + { + emission_rate 200 + angle 360 + time_to_live 1 + velocity dyn_random + { + min 3 + max 7.5 + } + particle_width dyn_random + { + min 0.3 + max 1.4 + } + particle_height dyn_random + { + min 6 + max 12 + } + colour 1 0.84 0.45 1 + } + affector Colour + { + time_colour 0 1 1 1 1 + time_colour 0.8 1 1 1 1 + time_colour 1 0 0 0 0 + colour_operation multiply + } + } +} diff --git a/tests/performance-tests/Resources/Particle3D/scripts/mp_hit_04.pu b/tests/performance-tests/Resources/Particle3D/scripts/mp_hit_04.pu new file mode 100644 index 0000000000..dbe1f2cc42 --- /dev/null +++ b/tests/performance-tests/Resources/Particle3D/scripts/mp_hit_04.pu @@ -0,0 +1,56 @@ +system mp_hit_04 +{ + keep_local true + technique + { + visual_particle_quota 10 + material PUMediaPack/Star_05 + renderer Billboard + { + billboard_type oriented_self + billboard_rotation_type vertex + } + emitter Point + { + emission_rate 6 + angle 360 + time_to_live 0.3 + velocity 1e-006 + duration 0.1 + particle_width dyn_random + { + min 60 + max 200 + } + particle_height dyn_random + { + min 100 + max 400 + } + start_colour_range 0.415686 0.678431 1 1 + end_colour_range 0.643137 0.317647 1 1 + force_emission true + } + affector Colour + { + time_colour 0 1 1 1 1 + time_colour 1 0 0 0 1 + colour_operation multiply + } + affector Scale + { + xyz_scale dyn_random + { + min 800 + max 1000 + } + } + observer OnClear + { + observe_until_event true + handler DoStopSystem + { + } + } + } +} diff --git a/tests/performance-tests/Resources/Particle3D/scripts/mp_torch.pu b/tests/performance-tests/Resources/Particle3D/scripts/mp_torch.pu new file mode 100644 index 0000000000..6f7b99de32 --- /dev/null +++ b/tests/performance-tests/Resources/Particle3D/scripts/mp_torch.pu @@ -0,0 +1,56 @@ +system mp_torch +{ + category Fire + technique + { + visual_particle_quota 20 + material mp_fire_02 + renderer Billboard + { + texture_coords_rows 2 + texture_coords_columns 2 + } + emitter Point + { + emission_rate 30 + angle 5 + time_to_live dyn_random + { + min 0.4 + max 0.6 + } + velocity dyn_random + { + min 4.8 + max 5.4 + } + all_particle_dimensions dyn_random + { + min 1.2 + max 1.8 + } + end_texture_coords_range 3 + } + affector Colour + { + time_colour 0 0 0 0 1 + time_colour 0.3 1 0.45098 0.235294 1 + time_colour 0.5 1 0.45098 0.235294 1 + time_colour 1 0 0 0 1 + } + affector Scale + { + x_scale dyn_curved_linear + { + control_point 0 0.3 + control_point 0.5 0.3 + control_point 1 -3 + } + y_scale dyn_curved_linear + { + control_point 0 15 + control_point 0.6 -3 + } + } + } +} diff --git a/tests/performance-tests/Resources/Particle3D/scripts/ribbonTrailTest.pu b/tests/performance-tests/Resources/Particle3D/scripts/ribbonTrailTest.pu new file mode 100644 index 0000000000..a450c8d5ec --- /dev/null +++ b/tests/performance-tests/Resources/Particle3D/scripts/ribbonTrailTest.pu @@ -0,0 +1,32 @@ +system ribbonTrailTest +{ + category Examples_21_30 + technique + { + visual_particle_quota 40 + material ParticleUniverse/RibbonTrail + renderer RibbonTrail + { + max_elements 60 + ribbontrail_length 18 + ribbontrail_width 0.3 + colour_change 0.8 0.8 0.8 0.8 + } + emitter Point + { + angle 360 + time_to_live 40 + velocity 45 + } + affector Gravity + { + position 0 -6 -3 + gravity 700 + } + affector Gravity + { + position 0 6 3 + gravity 700 + } + } +} diff --git a/tests/performance-tests/Resources/Particle3D/scripts/timeShift.pu b/tests/performance-tests/Resources/Particle3D/scripts/timeShift.pu new file mode 100644 index 0000000000..c569f8ed7c --- /dev/null +++ b/tests/performance-tests/Resources/Particle3D/scripts/timeShift.pu @@ -0,0 +1,93 @@ +system timeShift +{ + technique + { + visual_particle_quota 20 + material PUMediaPack/Watch + renderer Billboard + { + } + emitter Point + { + emission_rate dyn_curved_linear + { + control_point 0 0 + control_point 0.2 10 + control_point 3 0 + } + angle 360 + velocity dyn_random + { + min 0.9 + max 3 + } + all_particle_dimensions dyn_random + { + min 3 + max 12 + } + colour 1 0.88 0.26 1 + } + affector Colour + { + time_colour 0 0 0 0 0 + time_colour 0.5 1 1 1 1 + time_colour 1 0 0 0 0 + colour_operation multiply + } + affector TextureRotator + { + use_own_rotation true + rotation_speed dyn_random + { + min -2 + max 2 + } + } + } + technique + { + visual_particle_quota 20 + material PUMediaPack/Hourglass + renderer Billboard + { + } + emitter Point + { + emission_rate dyn_curved_linear + { + control_point 0 0 + control_point 0.2 5 + control_point 3 0 + } + angle 360 + velocity dyn_random + { + min 0.9 + max 3 + } + all_particle_dimensions dyn_random + { + min 3 + max 9 + } + colour 0.82 1 0.51 1 + } + affector Colour + { + time_colour 0 0 0 0 0 + time_colour 0.5 1 1 1 1 + time_colour 1 0 0 0 0 + colour_operation multiply + } + affector TextureRotator + { + use_own_rotation true + rotation_speed dyn_random + { + min -2 + max 2 + } + } + } +} diff --git a/tests/performance-tests/Resources/Particle3D/scripts/weaponTrail.pu b/tests/performance-tests/Resources/Particle3D/scripts/weaponTrail.pu new file mode 100644 index 0000000000..e29a407184 --- /dev/null +++ b/tests/performance-tests/Resources/Particle3D/scripts/weaponTrail.pu @@ -0,0 +1,28 @@ +system weaponTrail +{ + technique + { + visual_particle_quota 1 + material weaponTrail + renderer Billboard + { + texture_coords_rows 6 + texture_coords_columns 6 + billboard_rotation_type vertex + } + emitter Point Emitter32 + { + angle 0 + time_to_live 0.27 + velocity 0.001 + colour 1 0 0 0.501961 + force_emission true + } + affector TextureAnimator Affector47 + { + time_step 0.03 + end_texture_coords_range 8 + texture_start_random false + } + } +} \ No newline at end of file diff --git a/tests/performance-tests/Resources/Particle3D/textures/crate6.png b/tests/performance-tests/Resources/Particle3D/textures/crate6.png new file mode 100644 index 0000000000..a7b0b0ecb3 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/crate6.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/interpolate.png b/tests/performance-tests/Resources/Particle3D/textures/interpolate.png new file mode 100644 index 0000000000..29620cdca5 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/interpolate.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/mp_explosion_04.dds b/tests/performance-tests/Resources/Particle3D/textures/mp_explosion_04.dds new file mode 100755 index 0000000000..dc886d157e Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/mp_explosion_04.dds differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/mp_explosion_debris.dds b/tests/performance-tests/Resources/Particle3D/textures/mp_explosion_debris.dds new file mode 100644 index 0000000000..3939f109d3 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/mp_explosion_debris.dds differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/mp_explosion_smoke_01.dds b/tests/performance-tests/Resources/Particle3D/textures/mp_explosion_smoke_01.dds new file mode 100755 index 0000000000..5d9133a6c7 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/mp_explosion_smoke_01.dds differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/mp_fire_02_2x2.dds b/tests/performance-tests/Resources/Particle3D/textures/mp_fire_02_2x2.dds new file mode 100755 index 0000000000..34209cbfa5 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/mp_fire_02_2x2.dds differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/mp_fire_02_2x2.png b/tests/performance-tests/Resources/Particle3D/textures/mp_fire_02_2x2.png new file mode 100644 index 0000000000..18d6946ca4 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/mp_fire_02_2x2.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_barrel_01.png b/tests/performance-tests/Resources/Particle3D/textures/pu_barrel_01.png new file mode 100644 index 0000000000..402d821b14 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pu_barrel_01.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_barrel_02.png b/tests/performance-tests/Resources/Particle3D/textures/pu_barrel_02.png new file mode 100644 index 0000000000..b5ee14b6cd Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pu_barrel_02.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_bbal.png b/tests/performance-tests/Resources/Particle3D/textures/pu_bbal.png new file mode 100644 index 0000000000..7b76a89eb2 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pu_bbal.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_beam_01.png b/tests/performance-tests/Resources/Particle3D/textures/pu_beam_01.png new file mode 100644 index 0000000000..b11f8435de Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pu_beam_01.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_beam_02.png b/tests/performance-tests/Resources/Particle3D/textures/pu_beam_02.png new file mode 100644 index 0000000000..144fb2b9b2 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pu_beam_02.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_circle.png b/tests/performance-tests/Resources/Particle3D/textures/pu_circle.png new file mode 100644 index 0000000000..250f42b99c Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pu_circle.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_dirt_256x512.png b/tests/performance-tests/Resources/Particle3D/textures/pu_dirt_256x512.png new file mode 100644 index 0000000000..7e95b872cb Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pu_dirt_256x512.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_dot_03_64x64.png b/tests/performance-tests/Resources/Particle3D/textures/pu_dot_03_64x64.png new file mode 100644 index 0000000000..0d85ab4e2c Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pu_dot_03_64x64.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_fire_01_64x64.png b/tests/performance-tests/Resources/Particle3D/textures/pu_fire_01_64x64.png new file mode 100644 index 0000000000..f54578862d Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pu_fire_01_64x64.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_flame.png b/tests/performance-tests/Resources/Particle3D/textures/pu_flame.png new file mode 100644 index 0000000000..5b92b5e66f Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pu_flame.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_flare.png b/tests/performance-tests/Resources/Particle3D/textures/pu_flare.png new file mode 100644 index 0000000000..4909d7fbf1 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pu_flare.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_flare_12_256x256.png b/tests/performance-tests/Resources/Particle3D/textures/pu_flare_12_256x256.png new file mode 100644 index 0000000000..f2c40269ce Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pu_flare_12_256x256.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_green_ball.png b/tests/performance-tests/Resources/Particle3D/textures/pu_green_ball.png new file mode 100644 index 0000000000..bbb484f3f5 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pu_green_ball.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_hart.png b/tests/performance-tests/Resources/Particle3D/textures/pu_hart.png new file mode 100644 index 0000000000..54a02515dc Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pu_hart.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_lightning_20x64.png b/tests/performance-tests/Resources/Particle3D/textures/pu_lightning_20x64.png new file mode 100644 index 0000000000..a55a98c146 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pu_lightning_20x64.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_nucleus.png b/tests/performance-tests/Resources/Particle3D/textures/pu_nucleus.png new file mode 100644 index 0000000000..0c7bf955e4 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pu_nucleus.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_plate.jpg b/tests/performance-tests/Resources/Particle3D/textures/pu_plate.jpg new file mode 100644 index 0000000000..ee827bfb38 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pu_plate.jpg differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_rain.png b/tests/performance-tests/Resources/Particle3D/textures/pu_rain.png new file mode 100644 index 0000000000..92d77d2beb Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pu_rain.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_rain_01.png b/tests/performance-tests/Resources/Particle3D/textures/pu_rain_01.png new file mode 100644 index 0000000000..fc316b7df4 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pu_rain_01.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_ribbontrail.png b/tests/performance-tests/Resources/Particle3D/textures/pu_ribbontrail.png new file mode 100644 index 0000000000..e6966640c0 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pu_ribbontrail.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_sand_336x330.png b/tests/performance-tests/Resources/Particle3D/textures/pu_sand_336x330.png new file mode 100644 index 0000000000..ae895594ae Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pu_sand_336x330.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_smoke_02_128x128.png b/tests/performance-tests/Resources/Particle3D/textures/pu_smoke_02_128x128.png new file mode 100644 index 0000000000..d333716586 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pu_smoke_02_128x128.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_smoke_brown_336x330.png b/tests/performance-tests/Resources/Particle3D/textures/pu_smoke_brown_336x330.png new file mode 100644 index 0000000000..9d13cb3c9a Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pu_smoke_brown_336x330.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_stone.jpeg b/tests/performance-tests/Resources/Particle3D/textures/pu_stone.jpeg new file mode 100644 index 0000000000..453de47c04 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pu_stone.jpeg differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_atlas_smoke.png b/tests/performance-tests/Resources/Particle3D/textures/pump_atlas_smoke.png new file mode 100644 index 0000000000..f946f98f9b Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_atlas_smoke.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_biohazzard.png b/tests/performance-tests/Resources/Particle3D/textures/pump_biohazzard.png new file mode 100644 index 0000000000..091be2f87a Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_biohazzard.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_bubble.png b/tests/performance-tests/Resources/Particle3D/textures/pump_bubble.png new file mode 100644 index 0000000000..1eec4a3c06 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_bubble.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_bubble_blurred.png b/tests/performance-tests/Resources/Particle3D/textures/pump_bubble_blurred.png new file mode 100644 index 0000000000..a8411139e2 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_bubble_blurred.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_celticknot.png b/tests/performance-tests/Resources/Particle3D/textures/pump_celticknot.png new file mode 100644 index 0000000000..22c9cd8bbb Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_celticknot.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_dirt_01.png b/tests/performance-tests/Resources/Particle3D/textures/pump_dirt_01.png new file mode 100644 index 0000000000..c259757bb0 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_dirt_01.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_dirt_02.png b/tests/performance-tests/Resources/Particle3D/textures/pump_dirt_02.png new file mode 100644 index 0000000000..9a026c93c1 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_dirt_02.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_flame_01.png b/tests/performance-tests/Resources/Particle3D/textures/pump_flame_01.png new file mode 100644 index 0000000000..ed9dc42e1e Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_flame_01.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_flame_02.png b/tests/performance-tests/Resources/Particle3D/textures/pump_flame_02.png new file mode 100644 index 0000000000..c407c30cbc Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_flame_02.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_flame_03.png b/tests/performance-tests/Resources/Particle3D/textures/pump_flame_03.png new file mode 100644 index 0000000000..e77d9983d3 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_flame_03.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_flame_04.png b/tests/performance-tests/Resources/Particle3D/textures/pump_flame_04.png new file mode 100644 index 0000000000..592946aa63 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_flame_04.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_flare_01.png b/tests/performance-tests/Resources/Particle3D/textures/pump_flare_01.png new file mode 100644 index 0000000000..a90214bbda Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_flare_01.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_flare_02.png b/tests/performance-tests/Resources/Particle3D/textures/pump_flare_02.png new file mode 100644 index 0000000000..8ead0155b2 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_flare_02.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_flare_03.png b/tests/performance-tests/Resources/Particle3D/textures/pump_flare_03.png new file mode 100644 index 0000000000..1dc469c8e7 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_flare_03.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_flare_04.png b/tests/performance-tests/Resources/Particle3D/textures/pump_flare_04.png new file mode 100644 index 0000000000..868431ec1c Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_flare_04.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_flare_05.png b/tests/performance-tests/Resources/Particle3D/textures/pump_flare_05.png new file mode 100644 index 0000000000..469acc2de7 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_flare_05.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_flare_06.png b/tests/performance-tests/Resources/Particle3D/textures/pump_flare_06.png new file mode 100644 index 0000000000..60dadf22be Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_flare_06.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_genesis_01.png b/tests/performance-tests/Resources/Particle3D/textures/pump_genesis_01.png new file mode 100644 index 0000000000..5edcb8eebf Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_genesis_01.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_genesis_02.png b/tests/performance-tests/Resources/Particle3D/textures/pump_genesis_02.png new file mode 100644 index 0000000000..5473d523a5 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_genesis_02.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_hourglass.png b/tests/performance-tests/Resources/Particle3D/textures/pump_hourglass.png new file mode 100644 index 0000000000..b322dc56cd Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_hourglass.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_leave.png b/tests/performance-tests/Resources/Particle3D/textures/pump_leave.png new file mode 100644 index 0000000000..1cda97a7db Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_leave.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_lightning_01.png b/tests/performance-tests/Resources/Particle3D/textures/pump_lightning_01.png new file mode 100644 index 0000000000..a48297ddae Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_lightning_01.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_lightning_02.png b/tests/performance-tests/Resources/Particle3D/textures/pump_lightning_02.png new file mode 100644 index 0000000000..a9dd25c2f7 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_lightning_02.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_lightning_03.png b/tests/performance-tests/Resources/Particle3D/textures/pump_lightning_03.png new file mode 100644 index 0000000000..095c1194a5 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_lightning_03.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_lightning_04.png b/tests/performance-tests/Resources/Particle3D/textures/pump_lightning_04.png new file mode 100644 index 0000000000..01f9f07bbb Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_lightning_04.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_mcdxiiiv.png b/tests/performance-tests/Resources/Particle3D/textures/pump_mcdxiiiv.png new file mode 100644 index 0000000000..81010780e4 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_mcdxiiiv.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_metal_01.png b/tests/performance-tests/Resources/Particle3D/textures/pump_metal_01.png new file mode 100644 index 0000000000..d776586444 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_metal_01.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_metal_02.png b/tests/performance-tests/Resources/Particle3D/textures/pump_metal_02.png new file mode 100644 index 0000000000..e98fcad673 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_metal_02.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_mmviii.png b/tests/performance-tests/Resources/Particle3D/textures/pump_mmviii.png new file mode 100644 index 0000000000..5cf2fa9153 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_mmviii.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_pentagram_01.png b/tests/performance-tests/Resources/Particle3D/textures/pump_pentagram_01.png new file mode 100644 index 0000000000..836830d7c7 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_pentagram_01.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_pentagram_02.png b/tests/performance-tests/Resources/Particle3D/textures/pump_pentagram_02.png new file mode 100644 index 0000000000..49ddcbc954 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_pentagram_02.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_ring_01.png b/tests/performance-tests/Resources/Particle3D/textures/pump_ring_01.png new file mode 100644 index 0000000000..e52ae2032c Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_ring_01.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_ring_02.png b/tests/performance-tests/Resources/Particle3D/textures/pump_ring_02.png new file mode 100644 index 0000000000..c3c54817eb Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_ring_02.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_ring_03.png b/tests/performance-tests/Resources/Particle3D/textures/pump_ring_03.png new file mode 100644 index 0000000000..812453c625 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_ring_03.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_ring_04.png b/tests/performance-tests/Resources/Particle3D/textures/pump_ring_04.png new file mode 100644 index 0000000000..871a3191ff Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_ring_04.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_ring_05.png b/tests/performance-tests/Resources/Particle3D/textures/pump_ring_05.png new file mode 100644 index 0000000000..f0deb8434e Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_ring_05.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_01.png b/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_01.png new file mode 100644 index 0000000000..3e2735a056 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_01.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_02.png b/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_02.png new file mode 100644 index 0000000000..0313fadf60 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_02.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_03.png b/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_03.png new file mode 100644 index 0000000000..cd0d92f68b Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_03.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_04.png b/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_04.png new file mode 100644 index 0000000000..41bc91bf08 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_04.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_05.png b/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_05.png new file mode 100644 index 0000000000..b70942aebb Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_05.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_06.png b/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_06.png new file mode 100644 index 0000000000..6a23466c31 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_06.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_07.png b/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_07.png new file mode 100644 index 0000000000..6a05665f74 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_07.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_snow_01.png b/tests/performance-tests/Resources/Particle3D/textures/pump_snow_01.png new file mode 100644 index 0000000000..95c414e018 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_snow_01.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_spark_01.png b/tests/performance-tests/Resources/Particle3D/textures/pump_spark_01.png new file mode 100644 index 0000000000..2e826d60f4 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_spark_01.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_star_01.png b/tests/performance-tests/Resources/Particle3D/textures/pump_star_01.png new file mode 100644 index 0000000000..20b4a915f5 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_star_01.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_star_02.png b/tests/performance-tests/Resources/Particle3D/textures/pump_star_02.png new file mode 100644 index 0000000000..2ab43259b7 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_star_02.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_star_03.png b/tests/performance-tests/Resources/Particle3D/textures/pump_star_03.png new file mode 100644 index 0000000000..21a5d4eb69 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_star_03.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_star_04.png b/tests/performance-tests/Resources/Particle3D/textures/pump_star_04.png new file mode 100644 index 0000000000..8864c5b5e1 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_star_04.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_star_05.png b/tests/performance-tests/Resources/Particle3D/textures/pump_star_05.png new file mode 100644 index 0000000000..34dbd49c40 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_star_05.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_streak_01.png b/tests/performance-tests/Resources/Particle3D/textures/pump_streak_01.png new file mode 100644 index 0000000000..5b2ce2ef20 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_streak_01.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_streak_02.png b/tests/performance-tests/Resources/Particle3D/textures/pump_streak_02.png new file mode 100644 index 0000000000..893c421890 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_streak_02.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_streak_03.png b/tests/performance-tests/Resources/Particle3D/textures/pump_streak_03.png new file mode 100644 index 0000000000..a9cd103b40 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_streak_03.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_streak_04.png b/tests/performance-tests/Resources/Particle3D/textures/pump_streak_04.png new file mode 100644 index 0000000000..cf0d7c79fe Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_streak_04.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_swirl_01.png b/tests/performance-tests/Resources/Particle3D/textures/pump_swirl_01.png new file mode 100644 index 0000000000..418137432e Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_swirl_01.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_swirl_02.png b/tests/performance-tests/Resources/Particle3D/textures/pump_swirl_02.png new file mode 100644 index 0000000000..1825ba5dcc Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_swirl_02.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_swirl_03.png b/tests/performance-tests/Resources/Particle3D/textures/pump_swirl_03.png new file mode 100644 index 0000000000..35b8463fcf Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_swirl_03.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_watch.png b/tests/performance-tests/Resources/Particle3D/textures/pump_watch.png new file mode 100644 index 0000000000..038fc737d4 Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/pump_watch.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/weaponTrail.png b/tests/performance-tests/Resources/Particle3D/textures/weaponTrail.png new file mode 100644 index 0000000000..4fadb7e89f Binary files /dev/null and b/tests/performance-tests/Resources/Particle3D/textures/weaponTrail.png differ diff --git a/tests/performance-tests/Resources/Particles/BoilingFoam.plist b/tests/performance-tests/Resources/Particles/BoilingFoam.plist new file mode 100644 index 0000000000..46bb70cda1 --- /dev/null +++ b/tests/performance-tests/Resources/Particles/BoilingFoam.plist @@ -0,0 +1,102 @@ + + + + + angle + 90.099998474121094 + angleVariance + 32.049999237060547 + blendFuncDestination + 1 + blendFuncSource + 770 + duration + -1 + emitterType + 0.0 + finishColorAlpha + 1 + finishColorBlue + 1 + finishColorGreen + 0.70999997854232788 + finishColorRed + 0.5899999737739563 + finishColorVarianceAlpha + 1 + finishColorVarianceBlue + 0.20999999344348907 + finishColorVarianceGreen + 0.0 + finishColorVarianceRed + 0.0 + finishParticleSize + 40.770000457763672 + finishParticleSizeVariance + 0.0 + gravityx + 0.0 + gravityy + 0.0 + maxParticles + 269 + maxRadius + 100 + maxRadiusVariance + 0.0 + minRadius + 0.0 + particleLifespan + 0.99000000953674316 + particleLifespanVariance + 0.12999999523162842 + radialAccelVariance + 0.0 + radialAcceleration + 0.0 + rotatePerSecond + 0.0 + rotatePerSecondVariance + 0.0 + sourcePositionVariancex + 16.5 + sourcePositionVariancey + 34.799999237060547 + sourcePositionx + 162.83000183105469 + sourcePositiony + 194.32000732421875 + speed + 71 + speedVariance + 30 + startColorAlpha + 0.0 + startColorBlue + 0.0 + startColorGreen + 1 + startColorRed + 1 + startColorVarianceAlpha + 0.0 + startColorVarianceBlue + 0.34000000357627869 + startColorVarianceGreen + 0.0 + startColorVarianceRed + 0.0 + startParticleSize + 64 + startParticleSizeVariance + 5 + tangentialAccelVariance + 0.0 + tangentialAcceleration + 0.0 + textureFileName + fire.png + textureImageData + H4sIAAAAAAAAA+1bB1RURxd+byu9g1RZpINUpVtoKoiKIqJYorisdESqLRINkihGjSHEFo0EC/ZoRCRWLMRoFHuPEIMlNizY4/5z3fvic7MrmJic84vr+Tjj7My997tt5i1L796UE0UFqlD/wUsqldJvgv/CJrTr35KrjBunGfyn/nib/FvIldsMmvXJWzOYejv8X8OZzYsnB74c5N9X5pO36od/wl8Jb3m+DD8BQtgMmHXyfpH3xVvxw9/h3wLe8nxVCFQRaiyoI9hzzDoVBf546354U/4t5M3mzPDUINAk0CLQVgItXKPB8ou8L17rh3+TvxLu8rwZzgxf4KVDoEugR6BPYEBgKAcDfE8P1+rgXsYfjC8U+eFv+6Al/BXkOzvminhrof16yMuIwJjAhMCUwIzAnMACYY5zprjGGPcYoAwdlKnID/K58Eb10Bz/FsRcRY63LsaR4WyGHC0JrAisCWwIbOVgg+9Z4VoL3Mv4Qh9ls/2g8k9zoYX8FXFnYq6OOarD4m2CMbVETsDPgcCJoD2BK4EbgTvCDefa4xoH3GONMsxRJuMHHdSpzsoFhT74J/ylf815ee4QB23MUUMWbxHG0wE5AT9PAi8CXwJ/ggA5+ON7XrjWDfc6oCwRyw+GqFMbbVDmg2ZzQBn/Zrgz+a7NirkZxgpsdSRwQR7eyK0LQRBBKEF3gjCCcEQYzoXimi64xxtluKBMG9RhxsoFxgdqf8cHivi3kDuT78YYF6hbe4wZ2OxD0JkgmKAHQQRBJEEUQTRBDMFARAzOReGaCNwTjDJ8UGZ71GGFOo2lL+vhb/ngNfzZNS+f82zu0KesMT5uGLNOBCEY20jkFkswjCCOQEwgIRiFkOBcHK6JxT2RKCMEZXqjDkfUaaHAB+xaaLYXyPNXEnuB9NV6Z7i3lcpyEnqWh1RWv4EYuz4EAwiGEowkSCBIJcggyCLIIchF5OBcBq5JwD1DUUYflBmIOjxQpw3awPiA3Q/YZ6PSHFDCX547nDPqctwtUL+zVJabUK+Qr5C7/QmGYEyTCcYgzwkE+QQfE0wlKERMxbl8XJOLe5JRxhCUGYE6/FGnM9rAzgNttJU5G1/xwev4K4g9u+bhvIGeC30Has8aYwB2QP+G3tVbKqvl4QSJGM+xyAs4FhHMIphDUExQgijGuVm4ZiruGYsyElFmDOoIRZ2eaIM12mSENmpKX+0FSnNAAX9leQ/1BecO9F7oP1CDHhgLsAdydJBUlrcpUllOT8L4zkSO8wkWEZQSlBEsRZTh3CJcU4x7ClFGDsociTr6oE5/tMERbTJDG9m94LU5wPBvJvZw54LcgrPXUirrwdCHoBaDMSZgF+RqOsZtCsYSuCxEfisIVhOsJ9hAsBGxAedW45pS3FOMMqagzHTUMQh1BqMNbmiTJdqojzY3mwNy/JXFHu6dTN5DvcE5BL0Y+hHUZAzGBuwbR1CA8ZtLsISgHPltIqgi2Eawg2AnYgfOVeGa9bhnCcqYiTLHoY6RqDMCbfBGm2ykL+tAtyU5oIS/stjDHQxyDeoOziPoydCXhktl+TkW7ZwtleUx5PUa5LSVYBfBPoL9BAcIDiIO4Nw+XLMV96xBGfNRZgHqSEGd/dGGTmiTI9rYbA6w+UtfzX12z2fqnh17uIvBfQTOZKhD6M3Qn6BGp2CswF6o63UElRjjGuRaS3CM4CTBKcRJnKvFNTW4pxJlLEWZM1FHDuocgjaEoE0ucjnA9AH2WfBKDbD4K8p9pufD2WIpld3Fwc9wJ4N7CZzNUI/Qo6FPQa3OxZiB3VsIqgl+Qm4nCM4QnCe4SFCHuIhzZ3BNLe6pRhnrUOZc1DEJdYrRhnC0yRNttESbmbNAaQ0o4M/OfThL4Rkc+iqcMUzdQ9+BuxncT+CMhpyEXg39Cmp2DcYO7IfcPkpwmuACQT3BbwSXCa4gLuNcPa45jXsOoIxKlLkEdRSizmS0IRJtYvqANdpsgByU1oAS/sx9h8l9uF/A8yj0WThzoObgfgp9CO4p+VJZbkLPhr4FtbsTYwg8zmKMgeNVgt8JbhDcRNzAuau45iLuOYoydqLMctQxE3WOQRui0SZ/tNEWbWZqgLkPNcdfUd+Xz314NoO+C3d0uKfCXW0qxgXOLejd0L+ghmsxlsCnATkC39sEdwjuIu7g3E1c04B7TqOMGpS5HnUUo85ctCEWbeoi/WsNKDoH2J8TKePP1D70UrhbwD0Lns3h+RTyDZ5T4K4O91WoSehPKzBO0MOhj0EtX8CYAq9byPUeQZMc7uF7t3Dtb7j3BMrahbJXoK4i1J2KtkSibV5oqxXarqgHyPNn9z75cw8+k2NqH+4acO+C51R4VoMelC+V3Vvh7gb3FzjD92HcoJ9BTV/F2AK/+wQPCB4SPEI8xLn7uOYm7qlHGbUoswp1LEKd+WhDHNoUijYyPcBU+tdzUP6ZSBl/du+DMwU+n4L6gs8poN6g98IzGzy3wN2dyX24x8BZDufZeenL2N/GGD9Azo8JniAe49wDXHNb+jIHzqOs/SibqYE5qDsLbYlG2/zRVhup4h74Ov7yvR/u0nCWMr0Pnjngsxq4e8EzO5zDTO3D+QT32B1SWd+GM/2iVNbbb2BcmzDWDPenCMYHD3HNHdxzGWWcRJk7UEeZ9GUPyEFbYtC2AOnLHmiOHJSeAUr4M8+6sJfp/e4oG85a+MwGPreA/gNnETzDwR0F7vLQq6Fe4V4DZzucb5DPd5HbIznubB88wjV3cc8VlHEKZe5EHUtRZyHaMAptCkcb3aUvzwCGv/p7/i3m31rzv7X3v9Z6/rX2+8/7++/755/3z7+t+/OPVvv5V2v//PP959/vf//R2n//9f73n6/NgVbx+28lOdCqvv8glwPydfDOf//lNTnQar7/9AY+eCe//9ZCH7zT33+U8wG7F8j74J39/quCHJD3wTv//Wc5H7BrgX02vrPff1fiB2W58E7+/UMLfKDID+/c378o8EFzfnjn/v7pDf3A+ELeH//Xf//WQj+wfcH2h7xf5HnK8+XKyXwrvFm2vw0xjCz6Nb5Q5BNFULSHftu8WTa/TXFsufK+eJ1PlHL9NzjL2flviZbXo8wf/ylfBXZRlBZRxyX/oalA8oNmjTkvxjyKCqyguThPFtMCHHPID114H2YpFVqPtcYQx+Rd2oglsw2zPpCizVnro1gy+/+pd/snWZSQojTCyHjfC5NV8B+N/8h7vZLSR3N0KCotPTszqkewaFDsYJHwEJGkSgkoD4qKE2dl9O7fPRq2h3cLEWWRRYwHZK5+cFI2OOYS1lckekMn6oozMrOJpL5k3CFekiUm4wIyTs3LzoD5RjI2GJkCYw5wN8gkBpKxMYwTZOP2L9bIxoEwjk9LjydjsDkjPi0exnvI+NPcHAkZc3uRcWFukiSPjI+TsU1qTloSGT+CvWmSuCziPg2Yz5aIE8nYnYw1MqOjQsi4E3GiRgJrPJI1zpaMzQZSIaMzxmUmJSRmixzEjiIPPz9fUZgkL1WSne3SN06cEpcZLwoZnZYRlz6OomScX7z0wLci4mRvDz9vbxdPVw+Wo177ZgtfEFvZ6F6/FzGjjQ6+nFO0bnQpRfk2Ed/Mfjk3ch5FbZ5KUcZnX87ZfENR2iRuFYdZfIwgXxKzszP83dzy8vJckyRiV3Don69mF7TgxdLnCuL+dI8oVDIqLic1WwR+E49OHZ2TKcrKiBNLRC6vJPE/2ajYjvZRklGSTEk62RFDsiwpPYGEOz0+KTtpdLooKV1ZEP/mNrmXLK/JS7/sOWUw3JXSOWxAcW8epHj66hR36CLyDv1n3HqpxlBQeQMtr8jy/sVLQQflzIIfWUkJL/aFREWLxDmZubL3oCwpPqVGaVMGlAnVlrKmHCgXypPyoQJIo+pG9aQiqWgqlvqAElOJVBqVSeVRE6nJVCFVRM2mvqTmU4upMqqcWkttoDZTW6ld1D7qAFVLnaDOUXVUA3WdaqQeUE9pmhbSmrQ+bUJb0ra0M+1J+9Jd6G50LzqKjqVH0Al0Op1DT6Q/povoOfR8egldTn9Hb6F30fvpI/QZup6+Rt+ln3C4HA2OAceCY8dx4/hygjgRnGjOME4CZwxnPKeAM5Mzl1PKWc2p4OziHOCc4NRxrnOaSANX5xpxrbguXF9uCDeSO5g7ipvJncSdzi3hlnLXcqu4Ndxj3DruDe5jnoCnzxPxXHgBvDDeAJ6YN4Y3iTeDN5+3glfB28M7xqvnNfKe8zX55nxnvj8/nD+In8DP4xfyS/jL+Jv4e/kn+A38BwKBwEhgL/ARhAliBcmCCYIZgq8F6wQ7BUcElwRNQqHQROgs7CyMFMYJs4WFwnnC1cIdwqPCBuEjFXUVSxVPle4qg1XSVaaolKisVNmuclTlispTVR1VW1V/1UjVeNVxqrNUy1SrVA+rNqg+VdNVs1frrBatlqw2WW2u2lq1vWrn1e6pq6u3U/dT76eepP6R+lz19eo/qterP9bQ03DSCNEYqpGjMVNjucZOjTMa9zQ1Ne00AzUHa2ZrztQs19yt+YvmIy19LVetcK14rXytBVoVWke1bmmrattqB2l/oD1eu0R7o/Zh7Rs6qjp2OiE6cTqTdBbobNE5pdOkq6/roRupm6Y7Q3el7n7dq3pCPTu9bnrxegV63+rt1rukz9W31g/RF+t/rF+mv1e/wUBgYG8QbpBsUGSwxuCQQaOhnmFHwxjDsYYLDLcZ1hlxjeyMwo1SjWYZbTA6afSkjUWboDaSNtParG1ztM1DYzPjQGOJ8XTjdcYnjJ+YiEy6maSYfG6y2eSCKc/UybSfaZ7pItO9pjfMDMwCzMRm0802mJ0155g7mUeZTzD/1vygeZNFW4seFhkW8yx2W9xoa9Q2sG1y2+K229tes9S37GKZZFlsucPyd5GhKEiUKpor2iNqtDK3CrPKsVpidcjqaTv7dgPaTWm3rt0FazVrX+tR1sXW1daNNpY2vW0m2qyyOWurautrm2j7lW2N7UM7e7uBdp/Ybba7am9sH24/3n6V/XkHTYeuDmMcSh2OOwocfR1THL92rHXiOHk5JTotcDrszHH2dk5y/tr5SHt+e7/26e1L259y0XAJcsl1WeVS72rk2st1iutm11tuNm6D3T53q3F77u7lnupe5n7OQ8+jp8cUjyqPu55OnmLPBZ7HO2h26N4hv0NlhzsdnTtKOi7qeNpL36u31yde1V5/ePt4Z3qv9b7mY+MzwmehzylfA9++vjN8f/Tj+wX75ftt9Xvs7+2f7b/B/3aAS0BKwMqAq53sO0k6lXW61Lld57jOSzrXdRF1GdHlmy51Xa26xnUt7fproHVgfOCywCtBjkHJQauDbgW7B2cGbwp+GOIf8mHIzlBuaI/Q6aGHuul1G9BtfrdfurfrntB9VffGHl49JvTYGcYPiwj7POxUuEW4OLw8vLGnT88Pe+6J0IjoHzE/4tdeTr0ye1X15vTu2fuL3uf72PZJ77M5kooMj/wi8kJf+75j+v7QT9Cvb78F/S5HeURNjKrpr99/eP+V/R9EB0fPij43wGFAzoDqGO2YoTHlMQ8Hhg6cM7BukNugDwcdiDWNTYqtHCwcHDN42eCmId2GfDmkYajX0MKhJ4fZDxs7bP8Hph+kfrBtuPbwuOEbR/BHDByxcsSzuMi40rimkeEjF45sFIeIvxJfjw+ML46/JuksmSO5MqrzqDmjriZ0Tvgi4Vpi18SSxBtJIUnzk+4khyUvTn6YEpmyPEWaOjB1XZpK2oi0Lel66Snpe0a3HT129JEM54zCjLox/mO+HNOYGZG5LIvOGpZVmW1ALlMHcxxypubU53bJXZD7KC8mb+NY3bHpYw+Ocxo3bdyV8d3HL53AmyCeUD3RauLkifUfBn24ZBI9aeSk6nzr/IL8ho96fLRistrklMk/T3GfMmfK/Y8HflxVYFHwUcGlqT2mrirUKswsPPVJwCeLP+V9mvTpoWkdps2b9nx6/PSfityLSoqezRDP+Okzj8/mfiadOWrmoVnesxbNFsxOn33y866fr5ijO2f8nEtf9P6iolhUPL34/pfDv9xf0rFk8VdqX+V8VTe319zKeTbzZs97Nj9x/okFwQvWLTRfOG3hw6/jvz66KHDR2sUWi4sWP/km6ZvTS3osqSi1Ky35VvBt7reXy2LKapb6Li1fZrqsaNkfy9OX162IWrGn3Ke8fKX5ylmrOKtyVl1bPXR17ZrQNZVrXdYuWWe0rmg9tT5n/e/fjfju5IaIDdUbfTeu/d72+4Wb9DdNr6ArxlU0bk7cXFcZW3lkS88t1VUBVZt+cP1h+VarrQu2GW6btV1te8F26Y7xO5p2Zuy8sSth16Xq4dXndg/afXxPvz2H9kbs/XFf9327a4JqdvzY+cet+/33b/nJ96fNB7wPVBz0OrjpZ6+fNx3yPlRx2OdwZa1fbdWRTke2H+16dNex0GP7jocfP3Ciz4kjJwecPH1q6Km60/Gnr55JPXPnbO7Zp+c+Os8/P/2CzoWSX8x/Kb3oeHFdnXfdtvrQ+oO/9v/13CXxpeu/Zf32rKHgsublkiuWV8qvel7deq37tdrfh/zecD3j+tMbhTd1by685XDr+9uBtw82DmpsuJN5R3p3xj2Te8vvd7xf3dS36ZcHaQ+ePpz+yOTRise+j2ueDHxy5WneM+GzuX84/lH1POL5eWmaVPo/LX7Mrg5NAAA= + + diff --git a/tests/performance-tests/Resources/Particles/Comet.plist b/tests/performance-tests/Resources/Particles/Comet.plist new file mode 100644 index 0000000000..a38247277f --- /dev/null +++ b/tests/performance-tests/Resources/Particles/Comet.plist @@ -0,0 +1,102 @@ + + + + + angle + 46.849998474121094 + angleVariance + 0.0 + blendFuncDestination + 1 + blendFuncSource + 770 + duration + -1 + emitterType + 0.0 + finishColorAlpha + 1 + finishColorBlue + 0.0 + finishColorGreen + 0.0 + finishColorRed + 0.15999999642372131 + finishColorVarianceAlpha + 1 + finishColorVarianceBlue + 0.0 + finishColorVarianceGreen + 0.0 + finishColorVarianceRed + 0.0 + finishParticleSize + 64 + finishParticleSizeVariance + 0.0 + gravityx + -276.32000732421875 + gravityy + 355.260009765625 + maxParticles + 1000 + maxRadius + 100 + maxRadiusVariance + 0.0 + minRadius + 0.0 + particleLifespan + 0.19740000367164612 + particleLifespanVariance + 2.1710999011993408 + radialAccelVariance + 0.0 + radialAcceleration + 0.0 + rotatePerSecond + 0.0 + rotatePerSecondVariance + 0.0 + sourcePositionVariancex + -4.5 + sourcePositionVariancey + 0.0 + sourcePositionx + 226.5 + sourcePositiony + 156.39999389648438 + speed + 0.0 + speedVariance + 203.94999694824219 + startColorAlpha + 1 + startColorBlue + 0.14000000059604645 + startColorGreen + 0.43999999761581421 + startColorRed + 0.79000002145767212 + startColorVarianceAlpha + 0.5 + startColorVarianceBlue + 0.20000000298023224 + startColorVarianceGreen + 0.20000000298023224 + startColorVarianceRed + 0.0 + startParticleSize + 41.680000305175781 + startParticleSizeVariance + 0.0 + tangentialAccelVariance + 0.0 + tangentialAcceleration + 0.0 + textureFileName + Comet.png + textureImageData + H4sIAAAAAAAAA+1bB1RURxd+byu9g1RZpINUpVtoKoiKIqJYorisdESqLRINkihGjSHEFo0EC/ZoRCRWLMRoFHuPEIMlNizY4/5z3fvic7MrmJic84vr+Tjj7My997tt5i1L796UE0UFqlD/wUsqldJvgv/CJrTr35KrjBunGfyn/nib/FvIldsMmvXJWzOYejv8X8OZzYsnB74c5N9X5pO36od/wl8Jb3m+DD8BQtgMmHXyfpH3xVvxw9/h3wLe8nxVCFQRaiyoI9hzzDoVBf546354U/4t5M3mzPDUINAk0CLQVgItXKPB8ou8L17rh3+TvxLu8rwZzgxf4KVDoEugR6BPYEBgKAcDfE8P1+rgXsYfjC8U+eFv+6Al/BXkOzvminhrof16yMuIwJjAhMCUwIzAnMACYY5zprjGGPcYoAwdlKnID/K58Eb10Bz/FsRcRY63LsaR4WyGHC0JrAisCWwIbOVgg+9Z4VoL3Mv4Qh9ls/2g8k9zoYX8FXFnYq6OOarD4m2CMbVETsDPgcCJoD2BK4EbgTvCDefa4xoH3GONMsxRJuMHHdSpzsoFhT74J/ylf815ee4QB23MUUMWbxHG0wE5AT9PAi8CXwJ/ggA5+ON7XrjWDfc6oCwRyw+GqFMbbVDmg2ZzQBn/Zrgz+a7NirkZxgpsdSRwQR7eyK0LQRBBKEF3gjCCcEQYzoXimi64xxtluKBMG9RhxsoFxgdqf8cHivi3kDuT78YYF6hbe4wZ2OxD0JkgmKAHQQRBJEEUQTRBDMFARAzOReGaCNwTjDJ8UGZ71GGFOo2lL+vhb/ngNfzZNS+f82zu0KesMT5uGLNOBCEY20jkFkswjCCOQEwgIRiFkOBcHK6JxT2RKCMEZXqjDkfUaaHAB+xaaLYXyPNXEnuB9NV6Z7i3lcpyEnqWh1RWv4EYuz4EAwiGEowkSCBIJcggyCLIIchF5OBcBq5JwD1DUUYflBmIOjxQpw3awPiA3Q/YZ6PSHFDCX547nDPqctwtUL+zVJabUK+Qr5C7/QmGYEyTCcYgzwkE+QQfE0wlKERMxbl8XJOLe5JRxhCUGYE6/FGnM9rAzgNttJU5G1/xwev4K4g9u+bhvIGeC30Has8aYwB2QP+G3tVbKqvl4QSJGM+xyAs4FhHMIphDUExQgijGuVm4ZiruGYsyElFmDOoIRZ2eaIM12mSENmpKX+0FSnNAAX9leQ/1BecO9F7oP1CDHhgLsAdydJBUlrcpUllOT8L4zkSO8wkWEZQSlBEsRZTh3CJcU4x7ClFGDsociTr6oE5/tMERbTJDG9m94LU5wPBvJvZw54LcgrPXUirrwdCHoBaDMSZgF+RqOsZtCsYSuCxEfisIVhOsJ9hAsBGxAedW45pS3FOMMqagzHTUMQh1BqMNbmiTJdqojzY3mwNy/JXFHu6dTN5DvcE5BL0Y+hHUZAzGBuwbR1CA8ZtLsISgHPltIqgi2Eawg2AnYgfOVeGa9bhnCcqYiTLHoY6RqDMCbfBGm2ykL+tAtyU5oIS/stjDHQxyDeoOziPoydCXhktl+TkW7ZwtleUx5PUa5LSVYBfBPoL9BAcIDiIO4Nw+XLMV96xBGfNRZgHqSEGd/dGGTmiTI9rYbA6w+UtfzX12z2fqnh17uIvBfQTOZKhD6M3Qn6BGp2CswF6o63UElRjjGuRaS3CM4CTBKcRJnKvFNTW4pxJlLEWZM1FHDuocgjaEoE0ucjnA9AH2WfBKDbD4K8p9pufD2WIpld3Fwc9wJ4N7CZzNUI/Qo6FPQa3OxZiB3VsIqgl+Qm4nCM4QnCe4SFCHuIhzZ3BNLe6pRhnrUOZc1DEJdYrRhnC0yRNttESbmbNAaQ0o4M/OfThL4Rkc+iqcMUzdQ9+BuxncT+CMhpyEXg39Cmp2DcYO7IfcPkpwmuACQT3BbwSXCa4gLuNcPa45jXsOoIxKlLkEdRSizmS0IRJtYvqANdpsgByU1oAS/sx9h8l9uF/A8yj0WThzoObgfgp9CO4p+VJZbkLPhr4FtbsTYwg8zmKMgeNVgt8JbhDcRNzAuau45iLuOYoydqLMctQxE3WOQRui0SZ/tNEWbWZqgLkPNcdfUd+Xz314NoO+C3d0uKfCXW0qxgXOLejd0L+ghmsxlsCnATkC39sEdwjuIu7g3E1c04B7TqOMGpS5HnUUo85ctCEWbeoi/WsNKDoH2J8TKePP1D70UrhbwD0Lns3h+RTyDZ5T4K4O91WoSehPKzBO0MOhj0EtX8CYAq9byPUeQZMc7uF7t3Dtb7j3BMrahbJXoK4i1J2KtkSibV5oqxXarqgHyPNn9z75cw8+k2NqH+4acO+C51R4VoMelC+V3Vvh7gb3FzjD92HcoJ9BTV/F2AK/+wQPCB4SPEI8xLn7uOYm7qlHGbUoswp1LEKd+WhDHNoUijYyPcBU+tdzUP6ZSBl/du+DMwU+n4L6gs8poN6g98IzGzy3wN2dyX24x8BZDufZeenL2N/GGD9Azo8JniAe49wDXHNb+jIHzqOs/SibqYE5qDsLbYlG2/zRVhup4h74Ov7yvR/u0nCWMr0Pnjngsxq4e8EzO5zDTO3D+QT32B1SWd+GM/2iVNbbb2BcmzDWDPenCMYHD3HNHdxzGWWcRJk7UEeZ9GUPyEFbYtC2AOnLHmiOHJSeAUr4M8+6sJfp/e4oG85a+MwGPreA/gNnETzDwR0F7vLQq6Fe4V4DZzucb5DPd5HbIznubB88wjV3cc8VlHEKZe5EHUtRZyHaMAptCkcb3aUvzwCGv/p7/i3m31rzv7X3v9Z6/rX2+8/7++/755/3z7+t+/OPVvv5V2v//PP959/vf//R2n//9f73n6/NgVbx+28lOdCqvv8glwPydfDOf//lNTnQar7/9AY+eCe//9ZCH7zT33+U8wG7F8j74J39/quCHJD3wTv//Wc5H7BrgX02vrPff1fiB2W58E7+/UMLfKDID+/c378o8EFzfnjn/v7pDf3A+ELeH//Xf//WQj+wfcH2h7xf5HnK8+XKyXwrvFm2vw0xjCz6Nb5Q5BNFULSHftu8WTa/TXFsufK+eJ1PlHL9NzjL2flviZbXo8wf/ylfBXZRlBZRxyX/oalA8oNmjTkvxjyKCqyguThPFtMCHHPID114H2YpFVqPtcYQx+Rd2oglsw2zPpCizVnro1gy+/+pd/snWZSQojTCyHjfC5NV8B+N/8h7vZLSR3N0KCotPTszqkewaFDsYJHwEJGkSgkoD4qKE2dl9O7fPRq2h3cLEWWRRYwHZK5+cFI2OOYS1lckekMn6oozMrOJpL5k3CFekiUm4wIyTs3LzoD5RjI2GJkCYw5wN8gkBpKxMYwTZOP2L9bIxoEwjk9LjydjsDkjPi0exnvI+NPcHAkZc3uRcWFukiSPjI+TsU1qTloSGT+CvWmSuCziPg2Yz5aIE8nYnYw1MqOjQsi4E3GiRgJrPJI1zpaMzQZSIaMzxmUmJSRmixzEjiIPPz9fUZgkL1WSne3SN06cEpcZLwoZnZYRlz6OomScX7z0wLci4mRvDz9vbxdPVw+Wo177ZgtfEFvZ6F6/FzGjjQ6+nFO0bnQpRfk2Ed/Mfjk3ch5FbZ5KUcZnX87ZfENR2iRuFYdZfIwgXxKzszP83dzy8vJckyRiV3Don69mF7TgxdLnCuL+dI8oVDIqLic1WwR+E49OHZ2TKcrKiBNLRC6vJPE/2ajYjvZRklGSTEk62RFDsiwpPYGEOz0+KTtpdLooKV1ZEP/mNrmXLK/JS7/sOWUw3JXSOWxAcW8epHj66hR36CLyDv1n3HqpxlBQeQMtr8jy/sVLQQflzIIfWUkJL/aFREWLxDmZubL3oCwpPqVGaVMGlAnVlrKmHCgXypPyoQJIo+pG9aQiqWgqlvqAElOJVBqVSeVRE6nJVCFVRM2mvqTmU4upMqqcWkttoDZTW6ld1D7qAFVLnaDOUXVUA3WdaqQeUE9pmhbSmrQ+bUJb0ra0M+1J+9Jd6G50LzqKjqVH0Al0Op1DT6Q/povoOfR8egldTn9Hb6F30fvpI/QZup6+Rt+ln3C4HA2OAceCY8dx4/hygjgRnGjOME4CZwxnPKeAM5Mzl1PKWc2p4OziHOCc4NRxrnOaSANX5xpxrbguXF9uCDeSO5g7ipvJncSdzi3hlnLXcqu4Ndxj3DruDe5jnoCnzxPxXHgBvDDeAJ6YN4Y3iTeDN5+3glfB28M7xqvnNfKe8zX55nxnvj8/nD+In8DP4xfyS/jL+Jv4e/kn+A38BwKBwEhgL/ARhAliBcmCCYIZgq8F6wQ7BUcElwRNQqHQROgs7CyMFMYJs4WFwnnC1cIdwqPCBuEjFXUVSxVPle4qg1XSVaaolKisVNmuclTlispTVR1VW1V/1UjVeNVxqrNUy1SrVA+rNqg+VdNVs1frrBatlqw2WW2u2lq1vWrn1e6pq6u3U/dT76eepP6R+lz19eo/qterP9bQ03DSCNEYqpGjMVNjucZOjTMa9zQ1Ne00AzUHa2ZrztQs19yt+YvmIy19LVetcK14rXytBVoVWke1bmmrattqB2l/oD1eu0R7o/Zh7Rs6qjp2OiE6cTqTdBbobNE5pdOkq6/roRupm6Y7Q3el7n7dq3pCPTu9bnrxegV63+rt1rukz9W31g/RF+t/rF+mv1e/wUBgYG8QbpBsUGSwxuCQQaOhnmFHwxjDsYYLDLcZ1hlxjeyMwo1SjWYZbTA6afSkjUWboDaSNtParG1ztM1DYzPjQGOJ8XTjdcYnjJ+YiEy6maSYfG6y2eSCKc/UybSfaZ7pItO9pjfMDMwCzMRm0802mJ0155g7mUeZTzD/1vygeZNFW4seFhkW8yx2W9xoa9Q2sG1y2+K229tes9S37GKZZFlsucPyd5GhKEiUKpor2iNqtDK3CrPKsVpidcjqaTv7dgPaTWm3rt0FazVrX+tR1sXW1daNNpY2vW0m2qyyOWurautrm2j7lW2N7UM7e7uBdp/Ybba7am9sH24/3n6V/XkHTYeuDmMcSh2OOwocfR1THL92rHXiOHk5JTotcDrszHH2dk5y/tr5SHt+e7/26e1L259y0XAJcsl1WeVS72rk2st1iutm11tuNm6D3T53q3F77u7lnupe5n7OQ8+jp8cUjyqPu55OnmLPBZ7HO2h26N4hv0NlhzsdnTtKOi7qeNpL36u31yde1V5/ePt4Z3qv9b7mY+MzwmehzylfA9++vjN8f/Tj+wX75ftt9Xvs7+2f7b/B/3aAS0BKwMqAq53sO0k6lXW61Lld57jOSzrXdRF1GdHlmy51Xa26xnUt7fproHVgfOCywCtBjkHJQauDbgW7B2cGbwp+GOIf8mHIzlBuaI/Q6aGHuul1G9BtfrdfurfrntB9VffGHl49JvTYGcYPiwj7POxUuEW4OLw8vLGnT88Pe+6J0IjoHzE/4tdeTr0ye1X15vTu2fuL3uf72PZJ77M5kooMj/wi8kJf+75j+v7QT9Cvb78F/S5HeURNjKrpr99/eP+V/R9EB0fPij43wGFAzoDqGO2YoTHlMQ8Hhg6cM7BukNugDwcdiDWNTYqtHCwcHDN42eCmId2GfDmkYajX0MKhJ4fZDxs7bP8Hph+kfrBtuPbwuOEbR/BHDByxcsSzuMi40rimkeEjF45sFIeIvxJfjw+ML46/JuksmSO5MqrzqDmjriZ0Tvgi4Vpi18SSxBtJIUnzk+4khyUvTn6YEpmyPEWaOjB1XZpK2oi0Lel66Snpe0a3HT129JEM54zCjLox/mO+HNOYGZG5LIvOGpZVmW1ALlMHcxxypubU53bJXZD7KC8mb+NY3bHpYw+Ocxo3bdyV8d3HL53AmyCeUD3RauLkifUfBn24ZBI9aeSk6nzr/IL8ho96fLRistrklMk/T3GfMmfK/Y8HflxVYFHwUcGlqT2mrirUKswsPPVJwCeLP+V9mvTpoWkdps2b9nx6/PSfityLSoqezRDP+Okzj8/mfiadOWrmoVnesxbNFsxOn33y866fr5ijO2f8nEtf9P6iolhUPL34/pfDv9xf0rFk8VdqX+V8VTe319zKeTbzZs97Nj9x/okFwQvWLTRfOG3hw6/jvz66KHDR2sUWi4sWP/km6ZvTS3osqSi1Ky35VvBt7reXy2LKapb6Li1fZrqsaNkfy9OX162IWrGn3Ke8fKX5ylmrOKtyVl1bPXR17ZrQNZVrXdYuWWe0rmg9tT5n/e/fjfju5IaIDdUbfTeu/d72+4Wb9DdNr6ArxlU0bk7cXFcZW3lkS88t1VUBVZt+cP1h+VarrQu2GW6btV1te8F26Y7xO5p2Zuy8sSth16Xq4dXndg/afXxPvz2H9kbs/XFf9327a4JqdvzY+cet+/33b/nJ96fNB7wPVBz0OrjpZ6+fNx3yPlRx2OdwZa1fbdWRTke2H+16dNex0GP7jocfP3Ciz4kjJwecPH1q6Km60/Gnr55JPXPnbO7Zp+c+Os8/P/2CzoWSX8x/Kb3oeHFdnXfdtvrQ+oO/9v/13CXxpeu/Zf32rKHgsublkiuWV8qvel7deq37tdrfh/zecD3j+tMbhTd1by685XDr+9uBtw82DmpsuJN5R3p3xj2Te8vvd7xf3dS36ZcHaQ+ePpz+yOTRise+j2ueDHxy5WneM+GzuX84/lH1POL5eWmaVPo/LX7Mrg5NAAA= + + diff --git a/tests/performance-tests/Resources/Particles/Flower.plist b/tests/performance-tests/Resources/Particles/Flower.plist new file mode 100644 index 0000000000..c059b96675 --- /dev/null +++ b/tests/performance-tests/Resources/Particles/Flower.plist @@ -0,0 +1,102 @@ + + + + + angle + 90 + angleVariance + 360 + blendFuncDestination + 1 + blendFuncSource + 770 + duration + -1 + emitterType + 0.0 + finishColorAlpha + 1 + finishColorBlue + 0.0 + finishColorGreen + 0.0 + finishColorRed + 0.0 + finishColorVarianceAlpha + 0.0 + finishColorVarianceBlue + 0.0 + finishColorVarianceGreen + 0.0 + finishColorVarianceRed + 0.0 + finishParticleSize + 30 + finishParticleSizeVariance + 0.0 + gravityx + 0.0 + gravityy + 0.0 + maxParticles + 250 + maxRadius + 276.20999145507812 + maxRadiusVariance + 154.94999694824219 + minRadius + 0.0 + particleLifespan + 4 + particleLifespanVariance + 1 + radialAccelVariance + 0.0 + radialAcceleration + -60 + rotatePerSecond + 35.529998779296875 + rotatePerSecondVariance + 0.0 + sourcePositionVariancex + 0.0 + sourcePositionVariancey + 0.0 + sourcePositionx + 169.91000366210938 + sourcePositiony + 228.71000671386719 + speed + 80 + speedVariance + 10 + startColorAlpha + 1 + startColorBlue + 0.5 + startColorGreen + 0.5 + startColorRed + 0.5 + startColorVarianceAlpha + 0.0 + startColorVarianceBlue + 0.5 + startColorVarianceGreen + 0.5 + startColorVarianceRed + 0.5 + startParticleSize + 30 + startParticleSizeVariance + 10 + tangentialAccelVariance + 0.0 + tangentialAcceleration + 15 + textureFileName + Flower.png + textureImageData + H4sIAAAAAAAAAwGaBGX7iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAQAAADZc7J/AAAA5mlDQ1BJQ0MgUHJvZmlsZQAAeAFjYGCsSCwoyGESYGDIzSspcg9yjIyIjFJgv8rAzsDIAAaJycUFjgEBPhAeNvLbNYjay7ogs2ad1vz46kTgxG2Ka/z0r9ZuwKYDSYwlJbU4GcjfAsSlyQVFJQwMjDpAtnp2SJAzkB0CZPOVlxSAxFOAbBGoeiCTQdo5MSczqSixJDVFwb0osVLBOT8nv6i4IDE5FSRNXVCSWgF0AwODc35BZVFmekaJgiPQt6lAO3MLSktSi3QUPPOS9RgYkkuLyqA2MzIZMzCAwhPC/xwIDidGsTMAFkw91gWJ+yQAAANvSURBVEgNxZU7aFRREIb/uXnsZpPoxoAYxBSBKKaIKBYiqF0awTQ2iqiNoqCFnWJpkSiCFoIgIgqWKoqCxEJQQSIWBgmI+GgsBDVmNZvdTTbZ8Z85d+/mCYKFZ2DZe8/MN3PmzMwF/nHJcvaaQgShKKUiU8vpLQGgaQPqKXUJYBYzlPJSmKhK1pP2Txu1BS1oxUpKFm0uWX9qRYu2aON8fdBPvPRF5Zt0Ik1pQorSGMegMP/TmKIUUdJISnT0DX3BMAFEI3oW37EDBWSISBMRDhEAUyjR3I4W6Wod1ZPRyAKApnEX2/EGu2OExWBZMID5LxLZwDdr8Fquyq1q5HESebaMn/0y+vSY5PmUdn8GYProv4BJ5NGq9+QBDqMg0wFRBVjqVniyzuk2uYl3SwDy6NVTeCrH8Rt5OvHlAF5cMM8y81m9hCy9fPaQLYKyH2ASG/QgxmQvcvjlCK+NAAgXFy6tDSv0NFrlGb4yCxEqzECR4XfqHuTkBMZdfmEixBDqoJ6qKb/ADE/fzBQVdBd60O6yitWwieYTMpDckF2yLwJ4AKs7QxjE6qBZnmBKe9FFgJmv1x2YlOu+W62RetpxGSfi5RjCIA2UFBEZeaubdR2DnkC9dqAkD/neds23SR3tYoC1jEFMbMuUGIt81bWS1SZJsQteOTwYml5oNPcObxmD1CQKUUmRmymdlQ98DiY1HfsXA6xh50uFubcOoIpC6thc9ma+jj3NAZiBibetl26JZ8/Q+xedYS7a+K7su0Ev4GJA8GamphTKpoBmpq4s75nGN34jHSwn2512zAydVeIIOCaCsTVsybtuEu3aw8y/xBh+Ylwee110+a5pOSSMl1BIod+tYQveNJ1+7/dpbmKIG5jQfmzkLmdCjLAAmFtbFpg1bOi4DV5112g4hh8OyOG3DCKnh7HFERZD2S3DVTDXtW7crBd47gFWnY2Pue2c14vSjkMYXtSNBFTnQRceYRSDy86D87pFtuLTonlARJpG3TosQ25uc3HhRAoHHNB+6ZaP4QBWhcnSJi3IPZxJOm7xTLQUF3BF90WJXTJUyfkpR3CHZ7cBtuxU5uXu1yEtSlPwnJD0Gm7Lc+bCGsl+rXGs/vldiuvEbmo6zELdiQNy1BAJoFIXzQbm332ZqvoJIBjXfon5q29jzeJ//fsDttmrmko6AygAAAAASUVORK5CYIJuAiUFmgQAAA== + + diff --git a/tests/performance-tests/Resources/Particles/Galaxy.plist b/tests/performance-tests/Resources/Particles/Galaxy.plist new file mode 100644 index 0000000000..11f6938741 --- /dev/null +++ b/tests/performance-tests/Resources/Particles/Galaxy.plist @@ -0,0 +1,102 @@ + + + + + angle + 90 + angleVariance + 360 + blendFuncDestination + 1 + blendFuncSource + 770 + duration + -1 + emitterType + 0.0 + finishColorAlpha + 1 + finishColorBlue + 0.0 + finishColorGreen + 0.0 + finishColorRed + 0.0 + finishColorVarianceAlpha + 0.0 + finishColorVarianceBlue + 0.0 + finishColorVarianceGreen + 0.0 + finishColorVarianceRed + 0.0 + finishParticleSize + 37 + finishParticleSizeVariance + 0.0 + gravityx + 0.0 + gravityy + 0.0 + maxParticles + 934 + maxRadius + 276.20999145507812 + maxRadiusVariance + 154.94999694824219 + minRadius + 0.0 + particleLifespan + 4 + particleLifespanVariance + 1 + radialAccelVariance + 0.0 + radialAcceleration + -20 + rotatePerSecond + 35.529998779296875 + rotatePerSecondVariance + 0.0 + sourcePositionVariancex + 0.0 + sourcePositionVariancey + 0.0 + sourcePositionx + 169.91000366210938 + sourcePositiony + 228.71000671386719 + speed + 59.209999084472656 + speedVariance + 10 + startColorAlpha + 1 + startColorBlue + 0.75999999046325684 + startColorGreen + 0.25 + startColorRed + 0.11999999731779099 + startColorVarianceAlpha + 0.0 + startColorVarianceBlue + 0.0 + startColorVarianceGreen + 0.0 + startColorVarianceRed + 0.0 + startParticleSize + 37 + startParticleSizeVariance + 10 + tangentialAccelVariance + 50 + tangentialAcceleration + 50 + textureFileName + Galaxy.png + textureImageData + H4sIAAAAAAAAAwFmA5n8iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAADLUlEQVRYCcXX51JbQRCEUeOc/f6v6ZzxHKFPLAoI84epmrp7985294QVxcXl5eWjh7Sn9yB/MWcej19sXQb87/iP8f+yiztWAOmzcYL5k/F9AX9m7/fWf83zTmLOVeD5AHECWieiKpR95D8nlhPcepbH7TYBL+dI/mrWRCRkrQIBZY9Q5vzb+PdxQj2P2ikBCPnrxb0TRMQpAYiRIa9lVcregR0TgATZm/G3W7cmxn5VaA6qQNkjEkNAMbPcDOpBJfYF6DMByJC/H3+3XSfC97IziATov8FD8HUcDmzZs+bETSF0Z+cEICeCE0TYOQFlHznSZoTQkwIc5PW+FqwC7NUGVagCXTvlXzNHXnXE5LsrulYAYFduX4Ts11b4LlaWlbXBWzNH2GxojzN4jgogJgENYreganyYGELsq1YCAOp9CZX5eivEwy9mltcvPvqwirBHSGKIQE6Eitg35forO5mxSo5cDJyVHIf3TRVSIxNgiUgIUO5Abel2qII4hLJnSk5M7XC2rMPGU5s2APO++11PiKBVUECEyAq5athHyvS6TO2vhOHB72/ILK+VtHnb0+EEAkeiLZGV2UpyG94cvRbgh+KcGyzenZb5l3FPbbBfzDks3zcmE9aBCIBF1FCt16meO98M6L3BEpeohIUHP65ZXvXJM2IH8oCAATZYiJWc+a7swJF/HvddnHjnuLgwE4RvY1XAAVMuwAHvHPA61cUDNnD6DUws8k/j2kJEZ8NahdjbWIBeVvJIgSISh4yJ8931SgBwpMhVwtPZKiIeaSJmeWWrgMolENh6pSKXrTjftcKU66m9ziViFSI+AWJ3tgoQADTwrtdKLvvinE2AfcAylTXyj9tn1UiE8ztbBdhUIiD2u9ez3PS5LP0QJe6UgKpgJhpOuPBv2DEBMubAmbI3H0BqDYEJcBOAy06mqpCI/xIw5zYViFx/gZc98IZyX0DtITIR+4M4n27afgX6CgB52dffsq9FawWqkipUCWLyWR7aKQEiHVwFuHbrX7batApNRO3wPOj77O3swf8zuquAneJZaEPZ14KqcOOKrYdOre8j4BTWvfZl8qD2D7ghcomuE8XXAAAAAElFTkSuQmCCksg8PmYDAAA= + + diff --git a/tests/performance-tests/Resources/Particles/LavaFlow.plist b/tests/performance-tests/Resources/Particles/LavaFlow.plist new file mode 100644 index 0000000000..c24278f675 --- /dev/null +++ b/tests/performance-tests/Resources/Particles/LavaFlow.plist @@ -0,0 +1,102 @@ + + + + + angle + 0.0 + angleVariance + 360 + blendFuncDestination + 1 + blendFuncSource + 770 + duration + -1 + emitterType + 0.0 + finishColorAlpha + 1 + finishColorBlue + 0.0 + finishColorGreen + 1 + finishColorRed + 1 + finishColorVarianceAlpha + 0.0 + finishColorVarianceBlue + 0.0 + finishColorVarianceGreen + 0.0 + finishColorVarianceRed + 0.0 + finishParticleSize + 0.0 + finishParticleSizeVariance + 0.0 + gravityx + 0.0 + gravityy + -197.3699951171875 + maxParticles + 861 + maxRadius + 100 + maxRadiusVariance + 0.0 + minRadius + 0.0 + particleLifespan + 0.46050000190734863 + particleLifespanVariance + 0.85530000925064087 + radialAccelVariance + 0.0 + radialAcceleration + 0.0 + rotatePerSecond + 0.0 + rotatePerSecondVariance + 0.0 + sourcePositionVariancex + 7 + sourcePositionVariancey + 7 + sourcePositionx + 160 + sourcePositiony + 210 + speed + 225 + speedVariance + 6.5799999237060547 + startColorAlpha + 0.090000003576278687 + startColorBlue + 0.0 + startColorGreen + 0.0 + startColorRed + 1 + startColorVarianceAlpha + 0.0 + startColorVarianceBlue + 0.0 + startColorVarianceGreen + 0.0 + startColorVarianceRed + 0.0 + startParticleSize + 45.049999237060547 + startParticleSizeVariance + 29.049999237060547 + tangentialAccelVariance + 0.0 + tangentialAcceleration + 0.0 + textureFileName + LavaFlow.png + textureImageData + H4sIAAAAAAAAA+1bB1RURxd+byu9g1RZpINUpVtoKoiKIqJYorisdESqLRINkihGjSHEFo0EC/ZoRCRWLMRoFHuPEIMlNizY4/5z3fvic7MrmJic84vr+Tjj7My997tt5i1L796UE0UFqlD/wUsqldJvgv/CJrTr35KrjBunGfyn/nib/FvIldsMmvXJWzOYejv8X8OZzYsnB74c5N9X5pO36od/wl8Jb3m+DD8BQtgMmHXyfpH3xVvxw9/h3wLe8nxVCFQRaiyoI9hzzDoVBf546354U/4t5M3mzPDUINAk0CLQVgItXKPB8ou8L17rh3+TvxLu8rwZzgxf4KVDoEugR6BPYEBgKAcDfE8P1+rgXsYfjC8U+eFv+6Al/BXkOzvminhrof16yMuIwJjAhMCUwIzAnMACYY5zprjGGPcYoAwdlKnID/K58Eb10Bz/FsRcRY63LsaR4WyGHC0JrAisCWwIbOVgg+9Z4VoL3Mv4Qh9ls/2g8k9zoYX8FXFnYq6OOarD4m2CMbVETsDPgcCJoD2BK4EbgTvCDefa4xoH3GONMsxRJuMHHdSpzsoFhT74J/ylf815ee4QB23MUUMWbxHG0wE5AT9PAi8CXwJ/ggA5+ON7XrjWDfc6oCwRyw+GqFMbbVDmg2ZzQBn/Zrgz+a7NirkZxgpsdSRwQR7eyK0LQRBBKEF3gjCCcEQYzoXimi64xxtluKBMG9RhxsoFxgdqf8cHivi3kDuT78YYF6hbe4wZ2OxD0JkgmKAHQQRBJEEUQTRBDMFARAzOReGaCNwTjDJ8UGZ71GGFOo2lL+vhb/ngNfzZNS+f82zu0KesMT5uGLNOBCEY20jkFkswjCCOQEwgIRiFkOBcHK6JxT2RKCMEZXqjDkfUaaHAB+xaaLYXyPNXEnuB9NV6Z7i3lcpyEnqWh1RWv4EYuz4EAwiGEowkSCBIJcggyCLIIchF5OBcBq5JwD1DUUYflBmIOjxQpw3awPiA3Q/YZ6PSHFDCX547nDPqctwtUL+zVJabUK+Qr5C7/QmGYEyTCcYgzwkE+QQfE0wlKERMxbl8XJOLe5JRxhCUGYE6/FGnM9rAzgNttJU5G1/xwev4K4g9u+bhvIGeC30Has8aYwB2QP+G3tVbKqvl4QSJGM+xyAs4FhHMIphDUExQgijGuVm4ZiruGYsyElFmDOoIRZ2eaIM12mSENmpKX+0FSnNAAX9leQ/1BecO9F7oP1CDHhgLsAdydJBUlrcpUllOT8L4zkSO8wkWEZQSlBEsRZTh3CJcU4x7ClFGDsociTr6oE5/tMERbTJDG9m94LU5wPBvJvZw54LcgrPXUirrwdCHoBaDMSZgF+RqOsZtCsYSuCxEfisIVhOsJ9hAsBGxAedW45pS3FOMMqagzHTUMQh1BqMNbmiTJdqojzY3mwNy/JXFHu6dTN5DvcE5BL0Y+hHUZAzGBuwbR1CA8ZtLsISgHPltIqgi2Eawg2AnYgfOVeGa9bhnCcqYiTLHoY6RqDMCbfBGm2ykL+tAtyU5oIS/stjDHQxyDeoOziPoydCXhktl+TkW7ZwtleUx5PUa5LSVYBfBPoL9BAcIDiIO4Nw+XLMV96xBGfNRZgHqSEGd/dGGTmiTI9rYbA6w+UtfzX12z2fqnh17uIvBfQTOZKhD6M3Qn6BGp2CswF6o63UElRjjGuRaS3CM4CTBKcRJnKvFNTW4pxJlLEWZM1FHDuocgjaEoE0ucjnA9AH2WfBKDbD4K8p9pufD2WIpld3Fwc9wJ4N7CZzNUI/Qo6FPQa3OxZiB3VsIqgl+Qm4nCM4QnCe4SFCHuIhzZ3BNLe6pRhnrUOZc1DEJdYrRhnC0yRNttESbmbNAaQ0o4M/OfThL4Rkc+iqcMUzdQ9+BuxncT+CMhpyEXg39Cmp2DcYO7IfcPkpwmuACQT3BbwSXCa4gLuNcPa45jXsOoIxKlLkEdRSizmS0IRJtYvqANdpsgByU1oAS/sx9h8l9uF/A8yj0WThzoObgfgp9CO4p+VJZbkLPhr4FtbsTYwg8zmKMgeNVgt8JbhDcRNzAuau45iLuOYoydqLMctQxE3WOQRui0SZ/tNEWbWZqgLkPNcdfUd+Xz314NoO+C3d0uKfCXW0qxgXOLejd0L+ghmsxlsCnATkC39sEdwjuIu7g3E1c04B7TqOMGpS5HnUUo85ctCEWbeoi/WsNKDoH2J8TKePP1D70UrhbwD0Lns3h+RTyDZ5T4K4O91WoSehPKzBO0MOhj0EtX8CYAq9byPUeQZMc7uF7t3Dtb7j3BMrahbJXoK4i1J2KtkSibV5oqxXarqgHyPNn9z75cw8+k2NqH+4acO+C51R4VoMelC+V3Vvh7gb3FzjD92HcoJ9BTV/F2AK/+wQPCB4SPEI8xLn7uOYm7qlHGbUoswp1LEKd+WhDHNoUijYyPcBU+tdzUP6ZSBl/du+DMwU+n4L6gs8poN6g98IzGzy3wN2dyX24x8BZDufZeenL2N/GGD9Azo8JniAe49wDXHNb+jIHzqOs/SibqYE5qDsLbYlG2/zRVhup4h74Ov7yvR/u0nCWMr0Pnjngsxq4e8EzO5zDTO3D+QT32B1SWd+GM/2iVNbbb2BcmzDWDPenCMYHD3HNHdxzGWWcRJk7UEeZ9GUPyEFbYtC2AOnLHmiOHJSeAUr4M8+6sJfp/e4oG85a+MwGPreA/gNnETzDwR0F7vLQq6Fe4V4DZzucb5DPd5HbIznubB88wjV3cc8VlHEKZe5EHUtRZyHaMAptCkcb3aUvzwCGv/p7/i3m31rzv7X3v9Z6/rX2+8/7++/755/3z7+t+/OPVvv5V2v//PP959/vf//R2n//9f73n6/NgVbx+28lOdCqvv8glwPydfDOf//lNTnQar7/9AY+eCe//9ZCH7zT33+U8wG7F8j74J39/quCHJD3wTv//Wc5H7BrgX02vrPff1fiB2W58E7+/UMLfKDID+/c378o8EFzfnjn/v7pDf3A+ELeH//Xf//WQj+wfcH2h7xf5HnK8+XKyXwrvFm2vw0xjCz6Nb5Q5BNFULSHftu8WTa/TXFsufK+eJ1PlHL9NzjL2flviZbXo8wf/ylfBXZRlBZRxyX/oalA8oNmjTkvxjyKCqyguThPFtMCHHPID114H2YpFVqPtcYQx+Rd2oglsw2zPpCizVnro1gy+/+pd/snWZSQojTCyHjfC5NV8B+N/8h7vZLSR3N0KCotPTszqkewaFDsYJHwEJGkSgkoD4qKE2dl9O7fPRq2h3cLEWWRRYwHZK5+cFI2OOYS1lckekMn6oozMrOJpL5k3CFekiUm4wIyTs3LzoD5RjI2GJkCYw5wN8gkBpKxMYwTZOP2L9bIxoEwjk9LjydjsDkjPi0exnvI+NPcHAkZc3uRcWFukiSPjI+TsU1qTloSGT+CvWmSuCziPg2Yz5aIE8nYnYw1MqOjQsi4E3GiRgJrPJI1zpaMzQZSIaMzxmUmJSRmixzEjiIPPz9fUZgkL1WSne3SN06cEpcZLwoZnZYRlz6OomScX7z0wLci4mRvDz9vbxdPVw+Wo177ZgtfEFvZ6F6/FzGjjQ6+nFO0bnQpRfk2Ed/Mfjk3ch5FbZ5KUcZnX87ZfENR2iRuFYdZfIwgXxKzszP83dzy8vJckyRiV3Don69mF7TgxdLnCuL+dI8oVDIqLic1WwR+E49OHZ2TKcrKiBNLRC6vJPE/2ajYjvZRklGSTEk62RFDsiwpPYGEOz0+KTtpdLooKV1ZEP/mNrmXLK/JS7/sOWUw3JXSOWxAcW8epHj66hR36CLyDv1n3HqpxlBQeQMtr8jy/sVLQQflzIIfWUkJL/aFREWLxDmZubL3oCwpPqVGaVMGlAnVlrKmHCgXypPyoQJIo+pG9aQiqWgqlvqAElOJVBqVSeVRE6nJVCFVRM2mvqTmU4upMqqcWkttoDZTW6ld1D7qAFVLnaDOUXVUA3WdaqQeUE9pmhbSmrQ+bUJb0ra0M+1J+9Jd6G50LzqKjqVH0Al0Op1DT6Q/povoOfR8egldTn9Hb6F30fvpI/QZup6+Rt+ln3C4HA2OAceCY8dx4/hygjgRnGjOME4CZwxnPKeAM5Mzl1PKWc2p4OziHOCc4NRxrnOaSANX5xpxrbguXF9uCDeSO5g7ipvJncSdzi3hlnLXcqu4Ndxj3DruDe5jnoCnzxPxXHgBvDDeAJ6YN4Y3iTeDN5+3glfB28M7xqvnNfKe8zX55nxnvj8/nD+In8DP4xfyS/jL+Jv4e/kn+A38BwKBwEhgL/ARhAliBcmCCYIZgq8F6wQ7BUcElwRNQqHQROgs7CyMFMYJs4WFwnnC1cIdwqPCBuEjFXUVSxVPle4qg1XSVaaolKisVNmuclTlispTVR1VW1V/1UjVeNVxqrNUy1SrVA+rNqg+VdNVs1frrBatlqw2WW2u2lq1vWrn1e6pq6u3U/dT76eepP6R+lz19eo/qterP9bQ03DSCNEYqpGjMVNjucZOjTMa9zQ1Ne00AzUHa2ZrztQs19yt+YvmIy19LVetcK14rXytBVoVWke1bmmrattqB2l/oD1eu0R7o/Zh7Rs6qjp2OiE6cTqTdBbobNE5pdOkq6/roRupm6Y7Q3el7n7dq3pCPTu9bnrxegV63+rt1rukz9W31g/RF+t/rF+mv1e/wUBgYG8QbpBsUGSwxuCQQaOhnmFHwxjDsYYLDLcZ1hlxjeyMwo1SjWYZbTA6afSkjUWboDaSNtParG1ztM1DYzPjQGOJ8XTjdcYnjJ+YiEy6maSYfG6y2eSCKc/UybSfaZ7pItO9pjfMDMwCzMRm0802mJ0155g7mUeZTzD/1vygeZNFW4seFhkW8yx2W9xoa9Q2sG1y2+K229tes9S37GKZZFlsucPyd5GhKEiUKpor2iNqtDK3CrPKsVpidcjqaTv7dgPaTWm3rt0FazVrX+tR1sXW1daNNpY2vW0m2qyyOWurautrm2j7lW2N7UM7e7uBdp/Ybba7am9sH24/3n6V/XkHTYeuDmMcSh2OOwocfR1THL92rHXiOHk5JTotcDrszHH2dk5y/tr5SHt+e7/26e1L259y0XAJcsl1WeVS72rk2st1iutm11tuNm6D3T53q3F77u7lnupe5n7OQ8+jp8cUjyqPu55OnmLPBZ7HO2h26N4hv0NlhzsdnTtKOi7qeNpL36u31yde1V5/ePt4Z3qv9b7mY+MzwmehzylfA9++vjN8f/Tj+wX75ftt9Xvs7+2f7b/B/3aAS0BKwMqAq53sO0k6lXW61Lld57jOSzrXdRF1GdHlmy51Xa26xnUt7fproHVgfOCywCtBjkHJQauDbgW7B2cGbwp+GOIf8mHIzlBuaI/Q6aGHuul1G9BtfrdfurfrntB9VffGHl49JvTYGcYPiwj7POxUuEW4OLw8vLGnT88Pe+6J0IjoHzE/4tdeTr0ye1X15vTu2fuL3uf72PZJ77M5kooMj/wi8kJf+75j+v7QT9Cvb78F/S5HeURNjKrpr99/eP+V/R9EB0fPij43wGFAzoDqGO2YoTHlMQ8Hhg6cM7BukNugDwcdiDWNTYqtHCwcHDN42eCmId2GfDmkYajX0MKhJ4fZDxs7bP8Hph+kfrBtuPbwuOEbR/BHDByxcsSzuMi40rimkeEjF45sFIeIvxJfjw+ML46/JuksmSO5MqrzqDmjriZ0Tvgi4Vpi18SSxBtJIUnzk+4khyUvTn6YEpmyPEWaOjB1XZpK2oi0Lel66Snpe0a3HT129JEM54zCjLox/mO+HNOYGZG5LIvOGpZVmW1ALlMHcxxypubU53bJXZD7KC8mb+NY3bHpYw+Ocxo3bdyV8d3HL53AmyCeUD3RauLkifUfBn24ZBI9aeSk6nzr/IL8ho96fLRistrklMk/T3GfMmfK/Y8HflxVYFHwUcGlqT2mrirUKswsPPVJwCeLP+V9mvTpoWkdps2b9nx6/PSfityLSoqezRDP+Okzj8/mfiadOWrmoVnesxbNFsxOn33y866fr5ijO2f8nEtf9P6iolhUPL34/pfDv9xf0rFk8VdqX+V8VTe319zKeTbzZs97Nj9x/okFwQvWLTRfOG3hw6/jvz66KHDR2sUWi4sWP/km6ZvTS3osqSi1Ky35VvBt7reXy2LKapb6Li1fZrqsaNkfy9OX162IWrGn3Ke8fKX5ylmrOKtyVl1bPXR17ZrQNZVrXdYuWWe0rmg9tT5n/e/fjfju5IaIDdUbfTeu/d72+4Wb9DdNr6ArxlU0bk7cXFcZW3lkS88t1VUBVZt+cP1h+VarrQu2GW6btV1te8F26Y7xO5p2Zuy8sSth16Xq4dXndg/afXxPvz2H9kbs/XFf9327a4JqdvzY+cet+/33b/nJ96fNB7wPVBz0OrjpZ6+fNx3yPlRx2OdwZa1fbdWRTke2H+16dNex0GP7jocfP3Ciz4kjJwecPH1q6Km60/Gnr55JPXPnbO7Zp+c+Os8/P/2CzoWSX8x/Kb3oeHFdnXfdtvrQ+oO/9v/13CXxpeu/Zf32rKHgsublkiuWV8qvel7deq37tdrfh/zecD3j+tMbhTd1by685XDr+9uBtw82DmpsuJN5R3p3xj2Te8vvd7xf3dS36ZcHaQ+ePpz+yOTRise+j2ueDHxy5WneM+GzuX84/lH1POL5eWmaVPo/LX7Mrg5NAAA= + + diff --git a/tests/performance-tests/Resources/Particles/Phoenix.plist b/tests/performance-tests/Resources/Particles/Phoenix.plist new file mode 100644 index 0000000000..317870f79e --- /dev/null +++ b/tests/performance-tests/Resources/Particles/Phoenix.plist @@ -0,0 +1,102 @@ + + + + + angle + 349 + angleVariance + 93 + blendFuncDestination + 1 + blendFuncSource + 770 + duration + -1 + emitterType + 1 + finishColorAlpha + 0.32887318730354309 + finishColorBlue + 0.93377602100372314 + finishColorGreen + 0.95858514308929443 + finishColorRed + 0.19334913790225983 + finishColorVarianceAlpha + 0.38997083902359009 + finishColorVarianceBlue + 0.37059104442596436 + finishColorVarianceGreen + 0.81526708602905273 + finishColorVarianceRed + 0.83449059724807739 + finishParticleSize + 43 + finishParticleSizeVariance + 18 + gravityx + 1.4500000476837158 + gravityy + 1.1499999761581421 + maxParticles + 285 + maxRadius + 60 + maxRadiusVariance + 85.263160705566406 + minRadius + 0.0 + particleLifespan + 0.0 + particleLifespanVariance + 2 + radialAccelVariance + 0.0 + radialAcceleration + 0.0 + rotatePerSecond + 360 + rotatePerSecondVariance + 0.0 + sourcePositionVariancex + -4.5 + sourcePositionVariancey + 0.0 + sourcePositionx + 191.15043640136719 + sourcePositiony + 217.41175842285156 + speed + 390 + speedVariance + 179 + startColorAlpha + 0.27146226167678833 + startColorBlue + 0.91891378164291382 + startColorGreen + 0.10308317095041275 + startColorRed + 0.7686341404914856 + startColorVarianceAlpha + 0.0067866151221096516 + startColorVarianceBlue + 0.32555040717124939 + startColorVarianceGreen + 0.41684192419052124 + startColorVarianceRed + 0.79420870542526245 + startParticleSize + 3 + startParticleSizeVariance + 24 + tangentialAccelVariance + 0.0 + tangentialAcceleration + 0.0 + textureFileName + phoenixLeftWing.png + textureImageData + H4sIAAAAAAAAA+1bB1RURxd+byu9g1RZpINUpVtoKoiKIqJYorisdESqLRINkihGjSHEFo0EC/ZoRCRWLMRoFHuPEIMlNizY4/5z3fvic7MrmJic84vr+Tjj7My997tt5i1L796UE0UFqlD/wUsqldJvgv/CJrTr35KrjBunGfyn/nib/FvIldsMmvXJWzOYejv8X8OZzYsnB74c5N9X5pO36od/wl8Jb3m+DD8BQtgMmHXyfpH3xVvxw9/h3wLe8nxVCFQRaiyoI9hzzDoVBf546354U/4t5M3mzPDUINAk0CLQVgItXKPB8ou8L17rh3+TvxLu8rwZzgxf4KVDoEugR6BPYEBgKAcDfE8P1+rgXsYfjC8U+eFv+6Al/BXkOzvminhrof16yMuIwJjAhMCUwIzAnMACYY5zprjGGPcYoAwdlKnID/K58Eb10Bz/FsRcRY63LsaR4WyGHC0JrAisCWwIbOVgg+9Z4VoL3Mv4Qh9ls/2g8k9zoYX8FXFnYq6OOarD4m2CMbVETsDPgcCJoD2BK4EbgTvCDefa4xoH3GONMsxRJuMHHdSpzsoFhT74J/ylf815ee4QB23MUUMWbxHG0wE5AT9PAi8CXwJ/ggA5+ON7XrjWDfc6oCwRyw+GqFMbbVDmg2ZzQBn/Zrgz+a7NirkZxgpsdSRwQR7eyK0LQRBBKEF3gjCCcEQYzoXimi64xxtluKBMG9RhxsoFxgdqf8cHivi3kDuT78YYF6hbe4wZ2OxD0JkgmKAHQQRBJEEUQTRBDMFARAzOReGaCNwTjDJ8UGZ71GGFOo2lL+vhb/ngNfzZNS+f82zu0KesMT5uGLNOBCEY20jkFkswjCCOQEwgIRiFkOBcHK6JxT2RKCMEZXqjDkfUaaHAB+xaaLYXyPNXEnuB9NV6Z7i3lcpyEnqWh1RWv4EYuz4EAwiGEowkSCBIJcggyCLIIchF5OBcBq5JwD1DUUYflBmIOjxQpw3awPiA3Q/YZ6PSHFDCX547nDPqctwtUL+zVJabUK+Qr5C7/QmGYEyTCcYgzwkE+QQfE0wlKERMxbl8XJOLe5JRxhCUGYE6/FGnM9rAzgNttJU5G1/xwev4K4g9u+bhvIGeC30Has8aYwB2QP+G3tVbKqvl4QSJGM+xyAs4FhHMIphDUExQgijGuVm4ZiruGYsyElFmDOoIRZ2eaIM12mSENmpKX+0FSnNAAX9leQ/1BecO9F7oP1CDHhgLsAdydJBUlrcpUllOT8L4zkSO8wkWEZQSlBEsRZTh3CJcU4x7ClFGDsociTr6oE5/tMERbTJDG9m94LU5wPBvJvZw54LcgrPXUirrwdCHoBaDMSZgF+RqOsZtCsYSuCxEfisIVhOsJ9hAsBGxAedW45pS3FOMMqagzHTUMQh1BqMNbmiTJdqojzY3mwNy/JXFHu6dTN5DvcE5BL0Y+hHUZAzGBuwbR1CA8ZtLsISgHPltIqgi2Eawg2AnYgfOVeGa9bhnCcqYiTLHoY6RqDMCbfBGm2ykL+tAtyU5oIS/stjDHQxyDeoOziPoydCXhktl+TkW7ZwtleUx5PUa5LSVYBfBPoL9BAcIDiIO4Nw+XLMV96xBGfNRZgHqSEGd/dGGTmiTI9rYbA6w+UtfzX12z2fqnh17uIvBfQTOZKhD6M3Qn6BGp2CswF6o63UElRjjGuRaS3CM4CTBKcRJnKvFNTW4pxJlLEWZM1FHDuocgjaEoE0ucjnA9AH2WfBKDbD4K8p9pufD2WIpld3Fwc9wJ4N7CZzNUI/Qo6FPQa3OxZiB3VsIqgl+Qm4nCM4QnCe4SFCHuIhzZ3BNLe6pRhnrUOZc1DEJdYrRhnC0yRNttESbmbNAaQ0o4M/OfThL4Rkc+iqcMUzdQ9+BuxncT+CMhpyEXg39Cmp2DcYO7IfcPkpwmuACQT3BbwSXCa4gLuNcPa45jXsOoIxKlLkEdRSizmS0IRJtYvqANdpsgByU1oAS/sx9h8l9uF/A8yj0WThzoObgfgp9CO4p+VJZbkLPhr4FtbsTYwg8zmKMgeNVgt8JbhDcRNzAuau45iLuOYoydqLMctQxE3WOQRui0SZ/tNEWbWZqgLkPNcdfUd+Xz314NoO+C3d0uKfCXW0qxgXOLejd0L+ghmsxlsCnATkC39sEdwjuIu7g3E1c04B7TqOMGpS5HnUUo85ctCEWbeoi/WsNKDoH2J8TKePP1D70UrhbwD0Lns3h+RTyDZ5T4K4O91WoSehPKzBO0MOhj0EtX8CYAq9byPUeQZMc7uF7t3Dtb7j3BMrahbJXoK4i1J2KtkSibV5oqxXarqgHyPNn9z75cw8+k2NqH+4acO+C51R4VoMelC+V3Vvh7gb3FzjD92HcoJ9BTV/F2AK/+wQPCB4SPEI8xLn7uOYm7qlHGbUoswp1LEKd+WhDHNoUijYyPcBU+tdzUP6ZSBl/du+DMwU+n4L6gs8poN6g98IzGzy3wN2dyX24x8BZDufZeenL2N/GGD9Azo8JniAe49wDXHNb+jIHzqOs/SibqYE5qDsLbYlG2/zRVhup4h74Ov7yvR/u0nCWMr0Pnjngsxq4e8EzO5zDTO3D+QT32B1SWd+GM/2iVNbbb2BcmzDWDPenCMYHD3HNHdxzGWWcRJk7UEeZ9GUPyEFbYtC2AOnLHmiOHJSeAUr4M8+6sJfp/e4oG85a+MwGPreA/gNnETzDwR0F7vLQq6Fe4V4DZzucb5DPd5HbIznubB88wjV3cc8VlHEKZe5EHUtRZyHaMAptCkcb3aUvzwCGv/p7/i3m31rzv7X3v9Z6/rX2+8/7++/755/3z7+t+/OPVvv5V2v//PP959/vf//R2n//9f73n6/NgVbx+28lOdCqvv8glwPydfDOf//lNTnQar7/9AY+eCe//9ZCH7zT33+U8wG7F8j74J39/quCHJD3wTv//Wc5H7BrgX02vrPff1fiB2W58E7+/UMLfKDID+/c378o8EFzfnjn/v7pDf3A+ELeH//Xf//WQj+wfcH2h7xf5HnK8+XKyXwrvFm2vw0xjCz6Nb5Q5BNFULSHftu8WTa/TXFsufK+eJ1PlHL9NzjL2flviZbXo8wf/ylfBXZRlBZRxyX/oalA8oNmjTkvxjyKCqyguThPFtMCHHPID114H2YpFVqPtcYQx+Rd2oglsw2zPpCizVnro1gy+/+pd/snWZSQojTCyHjfC5NV8B+N/8h7vZLSR3N0KCotPTszqkewaFDsYJHwEJGkSgkoD4qKE2dl9O7fPRq2h3cLEWWRRYwHZK5+cFI2OOYS1lckekMn6oozMrOJpL5k3CFekiUm4wIyTs3LzoD5RjI2GJkCYw5wN8gkBpKxMYwTZOP2L9bIxoEwjk9LjydjsDkjPi0exnvI+NPcHAkZc3uRcWFukiSPjI+TsU1qTloSGT+CvWmSuCziPg2Yz5aIE8nYnYw1MqOjQsi4E3GiRgJrPJI1zpaMzQZSIaMzxmUmJSRmixzEjiIPPz9fUZgkL1WSne3SN06cEpcZLwoZnZYRlz6OomScX7z0wLci4mRvDz9vbxdPVw+Wo177ZgtfEFvZ6F6/FzGjjQ6+nFO0bnQpRfk2Ed/Mfjk3ch5FbZ5KUcZnX87ZfENR2iRuFYdZfIwgXxKzszP83dzy8vJckyRiV3Don69mF7TgxdLnCuL+dI8oVDIqLic1WwR+E49OHZ2TKcrKiBNLRC6vJPE/2ajYjvZRklGSTEk62RFDsiwpPYGEOz0+KTtpdLooKV1ZEP/mNrmXLK/JS7/sOWUw3JXSOWxAcW8epHj66hR36CLyDv1n3HqpxlBQeQMtr8jy/sVLQQflzIIfWUkJL/aFREWLxDmZubL3oCwpPqVGaVMGlAnVlrKmHCgXypPyoQJIo+pG9aQiqWgqlvqAElOJVBqVSeVRE6nJVCFVRM2mvqTmU4upMqqcWkttoDZTW6ld1D7qAFVLnaDOUXVUA3WdaqQeUE9pmhbSmrQ+bUJb0ra0M+1J+9Jd6G50LzqKjqVH0Al0Op1DT6Q/povoOfR8egldTn9Hb6F30fvpI/QZup6+Rt+ln3C4HA2OAceCY8dx4/hygjgRnGjOME4CZwxnPKeAM5Mzl1PKWc2p4OziHOCc4NRxrnOaSANX5xpxrbguXF9uCDeSO5g7ipvJncSdzi3hlnLXcqu4Ndxj3DruDe5jnoCnzxPxXHgBvDDeAJ6YN4Y3iTeDN5+3glfB28M7xqvnNfKe8zX55nxnvj8/nD+In8DP4xfyS/jL+Jv4e/kn+A38BwKBwEhgL/ARhAliBcmCCYIZgq8F6wQ7BUcElwRNQqHQROgs7CyMFMYJs4WFwnnC1cIdwqPCBuEjFXUVSxVPle4qg1XSVaaolKisVNmuclTlispTVR1VW1V/1UjVeNVxqrNUy1SrVA+rNqg+VdNVs1frrBatlqw2WW2u2lq1vWrn1e6pq6u3U/dT76eepP6R+lz19eo/qterP9bQ03DSCNEYqpGjMVNjucZOjTMa9zQ1Ne00AzUHa2ZrztQs19yt+YvmIy19LVetcK14rXytBVoVWke1bmmrattqB2l/oD1eu0R7o/Zh7Rs6qjp2OiE6cTqTdBbobNE5pdOkq6/roRupm6Y7Q3el7n7dq3pCPTu9bnrxegV63+rt1rukz9W31g/RF+t/rF+mv1e/wUBgYG8QbpBsUGSwxuCQQaOhnmFHwxjDsYYLDLcZ1hlxjeyMwo1SjWYZbTA6afSkjUWboDaSNtParG1ztM1DYzPjQGOJ8XTjdcYnjJ+YiEy6maSYfG6y2eSCKc/UybSfaZ7pItO9pjfMDMwCzMRm0802mJ0155g7mUeZTzD/1vygeZNFW4seFhkW8yx2W9xoa9Q2sG1y2+K229tes9S37GKZZFlsucPyd5GhKEiUKpor2iNqtDK3CrPKsVpidcjqaTv7dgPaTWm3rt0FazVrX+tR1sXW1daNNpY2vW0m2qyyOWurautrm2j7lW2N7UM7e7uBdp/Ybba7am9sH24/3n6V/XkHTYeuDmMcSh2OOwocfR1THL92rHXiOHk5JTotcDrszHH2dk5y/tr5SHt+e7/26e1L259y0XAJcsl1WeVS72rk2st1iutm11tuNm6D3T53q3F77u7lnupe5n7OQ8+jp8cUjyqPu55OnmLPBZ7HO2h26N4hv0NlhzsdnTtKOi7qeNpL36u31yde1V5/ePt4Z3qv9b7mY+MzwmehzylfA9++vjN8f/Tj+wX75ftt9Xvs7+2f7b/B/3aAS0BKwMqAq53sO0k6lXW61Lld57jOSzrXdRF1GdHlmy51Xa26xnUt7fproHVgfOCywCtBjkHJQauDbgW7B2cGbwp+GOIf8mHIzlBuaI/Q6aGHuul1G9BtfrdfurfrntB9VffGHl49JvTYGcYPiwj7POxUuEW4OLw8vLGnT88Pe+6J0IjoHzE/4tdeTr0ye1X15vTu2fuL3uf72PZJ77M5kooMj/wi8kJf+75j+v7QT9Cvb78F/S5HeURNjKrpr99/eP+V/R9EB0fPij43wGFAzoDqGO2YoTHlMQ8Hhg6cM7BukNugDwcdiDWNTYqtHCwcHDN42eCmId2GfDmkYajX0MKhJ4fZDxs7bP8Hph+kfrBtuPbwuOEbR/BHDByxcsSzuMi40rimkeEjF45sFIeIvxJfjw+ML46/JuksmSO5MqrzqDmjriZ0Tvgi4Vpi18SSxBtJIUnzk+4khyUvTn6YEpmyPEWaOjB1XZpK2oi0Lel66Snpe0a3HT129JEM54zCjLox/mO+HNOYGZG5LIvOGpZVmW1ALlMHcxxypubU53bJXZD7KC8mb+NY3bHpYw+Ocxo3bdyV8d3HL53AmyCeUD3RauLkifUfBn24ZBI9aeSk6nzr/IL8ho96fLRistrklMk/T3GfMmfK/Y8HflxVYFHwUcGlqT2mrirUKswsPPVJwCeLP+V9mvTpoWkdps2b9nx6/PSfityLSoqezRDP+Okzj8/mfiadOWrmoVnesxbNFsxOn33y866fr5ijO2f8nEtf9P6iolhUPL34/pfDv9xf0rFk8VdqX+V8VTe319zKeTbzZs97Nj9x/okFwQvWLTRfOG3hw6/jvz66KHDR2sUWi4sWP/km6ZvTS3osqSi1Ky35VvBt7reXy2LKapb6Li1fZrqsaNkfy9OX162IWrGn3Ke8fKX5ylmrOKtyVl1bPXR17ZrQNZVrXdYuWWe0rmg9tT5n/e/fjfju5IaIDdUbfTeu/d72+4Wb9DdNr6ArxlU0bk7cXFcZW3lkS88t1VUBVZt+cP1h+VarrQu2GW6btV1te8F26Y7xO5p2Zuy8sSth16Xq4dXndg/afXxPvz2H9kbs/XFf9327a4JqdvzY+cet+/33b/nJ96fNB7wPVBz0OrjpZ6+fNx3yPlRx2OdwZa1fbdWRTke2H+16dNex0GP7jocfP3Ciz4kjJwecPH1q6Km60/Gnr55JPXPnbO7Zp+c+Os8/P/2CzoWSX8x/Kb3oeHFdnXfdtvrQ+oO/9v/13CXxpeu/Zf32rKHgsublkiuWV8qvel7deq37tdrfh/zecD3j+tMbhTd1by685XDr+9uBtw82DmpsuJN5R3p3xj2Te8vvd7xf3dS36ZcHaQ+ePpz+yOTRise+j2ueDHxy5WneM+GzuX84/lH1POL5eWmaVPo/LX7Mrg5NAAA= + + diff --git a/tests/performance-tests/Resources/Particles/SmallSun.plist b/tests/performance-tests/Resources/Particles/SmallSun.plist new file mode 100644 index 0000000000..54be523a9b --- /dev/null +++ b/tests/performance-tests/Resources/Particles/SmallSun.plist @@ -0,0 +1,110 @@ + + + + + angle + 0.0 + angleVariance + 360 + blendFuncDestination + 1 + blendFuncSource + 770 + duration + -1 + emitterType + 0.0 + finishColorAlpha + 1 + finishColorBlue + 0.0 + finishColorGreen + 1 + finishColorRed + 1 + finishColorVarianceAlpha + 0.0 + finishColorVarianceBlue + 0.0 + finishColorVarianceGreen + 0.0 + finishColorVarianceRed + 0.0 + finishParticleSize + 0.0 + finishParticleSizeVariance + 0.0 + gravityx + 0.0 + gravityy + 0.0 + maxParticles + 500 + maxRadius + 100 + maxRadiusVariance + 0.0 + minRadius + 0.0 + particleLifespan + 0.20000000298023224 + particleLifespanVariance + 0.85530000925064087 + radialAccelVariance + 0.0 + radialAcceleration + -380 + rotatePerSecond + 0.0 + rotatePerSecondVariance + 0.0 + rotationEnd + 0.0 + rotationEndVariance + 0.0 + rotationStart + 0.0 + rotationStartVariance + 0.0 + sourcePositionVariancex + 7 + sourcePositionVariancey + 7 + sourcePositionx + 161.41999816894531 + sourcePositiony + 232.94000244140625 + speed + 128 + speedVariance + 6.5799999237060547 + startColorAlpha + 1 + startColorBlue + 0.0 + startColorGreen + 0.0 + startColorRed + 1 + startColorVarianceAlpha + 0.0 + startColorVarianceBlue + 0.0 + startColorVarianceGreen + 0.0 + startColorVarianceRed + 0.0 + startParticleSize + 22 + startParticleSizeVariance + 14 + tangentialAccelVariance + 0.0 + tangentialAcceleration + -144.74000549316406 + textureFileName + particleTexture.png + textureImageData + H4sIAAAAAAAAA+1bB1RURxd+byu9g1RZpINUpVtoKoiKIqJYorisdESqLRINkihGjSHEFo0EC/ZoRCRWLMRoFHuPEIMlNizY4/5z3fvic7MrmJic84vr+Tjj7My997tt5i1L796UE0UFqlD/wUsqldJvgv/CJrTr35KrjBunGfyn/nib/FvIldsMmvXJWzOYejv8X8OZzYsnB74c5N9X5pO36od/wl8Jb3m+DD8BQtgMmHXyfpH3xVvxw9/h3wLe8nxVCFQRaiyoI9hzzDoVBf546354U/4t5M3mzPDUINAk0CLQVgItXKPB8ou8L17rh3+TvxLu8rwZzgxf4KVDoEugR6BPYEBgKAcDfE8P1+rgXsYfjC8U+eFv+6Al/BXkOzvminhrof16yMuIwJjAhMCUwIzAnMACYY5zprjGGPcYoAwdlKnID/K58Eb10Bz/FsRcRY63LsaR4WyGHC0JrAisCWwIbOVgg+9Z4VoL3Mv4Qh9ls/2g8k9zoYX8FXFnYq6OOarD4m2CMbVETsDPgcCJoD2BK4EbgTvCDefa4xoH3GONMsxRJuMHHdSpzsoFhT74J/ylf815ee4QB23MUUMWbxHG0wE5AT9PAi8CXwJ/ggA5+ON7XrjWDfc6oCwRyw+GqFMbbVDmg2ZzQBn/Zrgz+a7NirkZxgpsdSRwQR7eyK0LQRBBKEF3gjCCcEQYzoXimi64xxtluKBMG9RhxsoFxgdqf8cHivi3kDuT78YYF6hbe4wZ2OxD0JkgmKAHQQRBJEEUQTRBDMFARAzOReGaCNwTjDJ8UGZ71GGFOo2lL+vhb/ngNfzZNS+f82zu0KesMT5uGLNOBCEY20jkFkswjCCOQEwgIRiFkOBcHK6JxT2RKCMEZXqjDkfUaaHAB+xaaLYXyPNXEnuB9NV6Z7i3lcpyEnqWh1RWv4EYuz4EAwiGEowkSCBIJcggyCLIIchF5OBcBq5JwD1DUUYflBmIOjxQpw3awPiA3Q/YZ6PSHFDCX547nDPqctwtUL+zVJabUK+Qr5C7/QmGYEyTCcYgzwkE+QQfE0wlKERMxbl8XJOLe5JRxhCUGYE6/FGnM9rAzgNttJU5G1/xwev4K4g9u+bhvIGeC30Has8aYwB2QP+G3tVbKqvl4QSJGM+xyAs4FhHMIphDUExQgijGuVm4ZiruGYsyElFmDOoIRZ2eaIM12mSENmpKX+0FSnNAAX9leQ/1BecO9F7oP1CDHhgLsAdydJBUlrcpUllOT8L4zkSO8wkWEZQSlBEsRZTh3CJcU4x7ClFGDsociTr6oE5/tMERbTJDG9m94LU5wPBvJvZw54LcgrPXUirrwdCHoBaDMSZgF+RqOsZtCsYSuCxEfisIVhOsJ9hAsBGxAedW45pS3FOMMqagzHTUMQh1BqMNbmiTJdqojzY3mwNy/JXFHu6dTN5DvcE5BL0Y+hHUZAzGBuwbR1CA8ZtLsISgHPltIqgi2Eawg2AnYgfOVeGa9bhnCcqYiTLHoY6RqDMCbfBGm2ykL+tAtyU5oIS/stjDHQxyDeoOziPoydCXhktl+TkW7ZwtleUx5PUa5LSVYBfBPoL9BAcIDiIO4Nw+XLMV96xBGfNRZgHqSEGd/dGGTmiTI9rYbA6w+UtfzX12z2fqnh17uIvBfQTOZKhD6M3Qn6BGp2CswF6o63UElRjjGuRaS3CM4CTBKcRJnKvFNTW4pxJlLEWZM1FHDuocgjaEoE0ucjnA9AH2WfBKDbD4K8p9pufD2WIpld3Fwc9wJ4N7CZzNUI/Qo6FPQa3OxZiB3VsIqgl+Qm4nCM4QnCe4SFCHuIhzZ3BNLe6pRhnrUOZc1DEJdYrRhnC0yRNttESbmbNAaQ0o4M/OfThL4Rkc+iqcMUzdQ9+BuxncT+CMhpyEXg39Cmp2DcYO7IfcPkpwmuACQT3BbwSXCa4gLuNcPa45jXsOoIxKlLkEdRSizmS0IRJtYvqANdpsgByU1oAS/sx9h8l9uF/A8yj0WThzoObgfgp9CO4p+VJZbkLPhr4FtbsTYwg8zmKMgeNVgt8JbhDcRNzAuau45iLuOYoydqLMctQxE3WOQRui0SZ/tNEWbWZqgLkPNcdfUd+Xz314NoO+C3d0uKfCXW0qxgXOLejd0L+ghmsxlsCnATkC39sEdwjuIu7g3E1c04B7TqOMGpS5HnUUo85ctCEWbeoi/WsNKDoH2J8TKePP1D70UrhbwD0Lns3h+RTyDZ5T4K4O91WoSehPKzBO0MOhj0EtX8CYAq9byPUeQZMc7uF7t3Dtb7j3BMrahbJXoK4i1J2KtkSibV5oqxXarqgHyPNn9z75cw8+k2NqH+4acO+C51R4VoMelC+V3Vvh7gb3FzjD92HcoJ9BTV/F2AK/+wQPCB4SPEI8xLn7uOYm7qlHGbUoswp1LEKd+WhDHNoUijYyPcBU+tdzUP6ZSBl/du+DMwU+n4L6gs8poN6g98IzGzy3wN2dyX24x8BZDufZeenL2N/GGD9Azo8JniAe49wDXHNb+jIHzqOs/SibqYE5qDsLbYlG2/zRVhup4h74Ov7yvR/u0nCWMr0Pnjngsxq4e8EzO5zDTO3D+QT32B1SWd+GM/2iVNbbb2BcmzDWDPenCMYHD3HNHdxzGWWcRJk7UEeZ9GUPyEFbYtC2AOnLHmiOHJSeAUr4M8+6sJfp/e4oG85a+MwGPreA/gNnETzDwR0F7vLQq6Fe4V4DZzucb5DPd5HbIznubB88wjV3cc8VlHEKZe5EHUtRZyHaMAptCkcb3aUvzwCGv/p7/i3m31rzv7X3v9Z6/rX2+8/7++/755/3z7+t+/OPVvv5V2v//PP959/vf//R2n//9f73n6/NgVbx+28lOdCqvv8glwPydfDOf//lNTnQar7/9AY+eCe//9ZCH7zT33+U8wG7F8j74J39/quCHJD3wTv//Wc5H7BrgX02vrPff1fiB2W58E7+/UMLfKDID+/c378o8EFzfnjn/v7pDf3A+ELeH//Xf//WQj+wfcH2h7xf5HnK8+XKyXwrvFm2vw0xjCz6Nb5Q5BNFULSHftu8WTa/TXFsufK+eJ1PlHL9NzjL2flviZbXo8wf/ylfBXZRlBZRxyX/oalA8oNmjTkvxjyKCqyguThPFtMCHHPID114H2YpFVqPtcYQx+Rd2oglsw2zPpCizVnro1gy+/+pd/snWZSQojTCyHjfC5NV8B+N/8h7vZLSR3N0KCotPTszqkewaFDsYJHwEJGkSgkoD4qKE2dl9O7fPRq2h3cLEWWRRYwHZK5+cFI2OOYS1lckekMn6oozMrOJpL5k3CFekiUm4wIyTs3LzoD5RjI2GJkCYw5wN8gkBpKxMYwTZOP2L9bIxoEwjk9LjydjsDkjPi0exnvI+NPcHAkZc3uRcWFukiSPjI+TsU1qTloSGT+CvWmSuCziPg2Yz5aIE8nYnYw1MqOjQsi4E3GiRgJrPJI1zpaMzQZSIaMzxmUmJSRmixzEjiIPPz9fUZgkL1WSne3SN06cEpcZLwoZnZYRlz6OomScX7z0wLci4mRvDz9vbxdPVw+Wo177ZgtfEFvZ6F6/FzGjjQ6+nFO0bnQpRfk2Ed/Mfjk3ch5FbZ5KUcZnX87ZfENR2iRuFYdZfIwgXxKzszP83dzy8vJckyRiV3Don69mF7TgxdLnCuL+dI8oVDIqLic1WwR+E49OHZ2TKcrKiBNLRC6vJPE/2ajYjvZRklGSTEk62RFDsiwpPYGEOz0+KTtpdLooKV1ZEP/mNrmXLK/JS7/sOWUw3JXSOWxAcW8epHj66hR36CLyDv1n3HqpxlBQeQMtr8jy/sVLQQflzIIfWUkJL/aFREWLxDmZubL3oCwpPqVGaVMGlAnVlrKmHCgXypPyoQJIo+pG9aQiqWgqlvqAElOJVBqVSeVRE6nJVCFVRM2mvqTmU4upMqqcWkttoDZTW6ld1D7qAFVLnaDOUXVUA3WdaqQeUE9pmhbSmrQ+bUJb0ra0M+1J+9Jd6G50LzqKjqVH0Al0Op1DT6Q/povoOfR8egldTn9Hb6F30fvpI/QZup6+Rt+ln3C4HA2OAceCY8dx4/hygjgRnGjOME4CZwxnPKeAM5Mzl1PKWc2p4OziHOCc4NRxrnOaSANX5xpxrbguXF9uCDeSO5g7ipvJncSdzi3hlnLXcqu4Ndxj3DruDe5jnoCnzxPxXHgBvDDeAJ6YN4Y3iTeDN5+3glfB28M7xqvnNfKe8zX55nxnvj8/nD+In8DP4xfyS/jL+Jv4e/kn+A38BwKBwEhgL/ARhAliBcmCCYIZgq8F6wQ7BUcElwRNQqHQROgs7CyMFMYJs4WFwnnC1cIdwqPCBuEjFXUVSxVPle4qg1XSVaaolKisVNmuclTlispTVR1VW1V/1UjVeNVxqrNUy1SrVA+rNqg+VdNVs1frrBatlqw2WW2u2lq1vWrn1e6pq6u3U/dT76eepP6R+lz19eo/qterP9bQ03DSCNEYqpGjMVNjucZOjTMa9zQ1Ne00AzUHa2ZrztQs19yt+YvmIy19LVetcK14rXytBVoVWke1bmmrattqB2l/oD1eu0R7o/Zh7Rs6qjp2OiE6cTqTdBbobNE5pdOkq6/roRupm6Y7Q3el7n7dq3pCPTu9bnrxegV63+rt1rukz9W31g/RF+t/rF+mv1e/wUBgYG8QbpBsUGSwxuCQQaOhnmFHwxjDsYYLDLcZ1hlxjeyMwo1SjWYZbTA6afSkjUWboDaSNtParG1ztM1DYzPjQGOJ8XTjdcYnjJ+YiEy6maSYfG6y2eSCKc/UybSfaZ7pItO9pjfMDMwCzMRm0802mJ0155g7mUeZTzD/1vygeZNFW4seFhkW8yx2W9xoa9Q2sG1y2+K229tes9S37GKZZFlsucPyd5GhKEiUKpor2iNqtDK3CrPKsVpidcjqaTv7dgPaTWm3rt0FazVrX+tR1sXW1daNNpY2vW0m2qyyOWurautrm2j7lW2N7UM7e7uBdp/Ybba7am9sH24/3n6V/XkHTYeuDmMcSh2OOwocfR1THL92rHXiOHk5JTotcDrszHH2dk5y/tr5SHt+e7/26e1L259y0XAJcsl1WeVS72rk2st1iutm11tuNm6D3T53q3F77u7lnupe5n7OQ8+jp8cUjyqPu55OnmLPBZ7HO2h26N4hv0NlhzsdnTtKOi7qeNpL36u31yde1V5/ePt4Z3qv9b7mY+MzwmehzylfA9++vjN8f/Tj+wX75ftt9Xvs7+2f7b/B/3aAS0BKwMqAq53sO0k6lXW61Lld57jOSzrXdRF1GdHlmy51Xa26xnUt7fproHVgfOCywCtBjkHJQauDbgW7B2cGbwp+GOIf8mHIzlBuaI/Q6aGHuul1G9BtfrdfurfrntB9VffGHl49JvTYGcYPiwj7POxUuEW4OLw8vLGnT88Pe+6J0IjoHzE/4tdeTr0ye1X15vTu2fuL3uf72PZJ77M5kooMj/wi8kJf+75j+v7QT9Cvb78F/S5HeURNjKrpr99/eP+V/R9EB0fPij43wGFAzoDqGO2YoTHlMQ8Hhg6cM7BukNugDwcdiDWNTYqtHCwcHDN42eCmId2GfDmkYajX0MKhJ4fZDxs7bP8Hph+kfrBtuPbwuOEbR/BHDByxcsSzuMi40rimkeEjF45sFIeIvxJfjw+ML46/JuksmSO5MqrzqDmjriZ0Tvgi4Vpi18SSxBtJIUnzk+4khyUvTn6YEpmyPEWaOjB1XZpK2oi0Lel66Snpe0a3HT129JEM54zCjLox/mO+HNOYGZG5LIvOGpZVmW1ALlMHcxxypubU53bJXZD7KC8mb+NY3bHpYw+Ocxo3bdyV8d3HL53AmyCeUD3RauLkifUfBn24ZBI9aeSk6nzr/IL8ho96fLRistrklMk/T3GfMmfK/Y8HflxVYFHwUcGlqT2mrirUKswsPPVJwCeLP+V9mvTpoWkdps2b9nx6/PSfityLSoqezRDP+Okzj8/mfiadOWrmoVnesxbNFsxOn33y866fr5ijO2f8nEtf9P6iolhUPL34/pfDv9xf0rFk8VdqX+V8VTe319zKeTbzZs97Nj9x/okFwQvWLTRfOG3hw6/jvz66KHDR2sUWi4sWP/km6ZvTS3osqSi1Ky35VvBt7reXy2LKapb6Li1fZrqsaNkfy9OX162IWrGn3Ke8fKX5ylmrOKtyVl1bPXR17ZrQNZVrXdYuWWe0rmg9tT5n/e/fjfju5IaIDdUbfTeu/d72+4Wb9DdNr6ArxlU0bk7cXFcZW3lkS88t1VUBVZt+cP1h+VarrQu2GW6btV1te8F26Y7xO5p2Zuy8sSth16Xq4dXndg/afXxPvz2H9kbs/XFf9327a4JqdvzY+cet+/33b/nJ96fNB7wPVBz0OrjpZ6+fNx3yPlRx2OdwZa1fbdWRTke2H+16dNex0GP7jocfP3Ciz4kjJwecPH1q6Km60/Gnr55JPXPnbO7Zp+c+Os8/P/2CzoWSX8x/Kb3oeHFdnXfdtvrQ+oO/9v/13CXxpeu/Zf32rKHgsublkiuWV8qvel7deq37tdrfh/zecD3j+tMbhTd1by685XDr+9uBtw82DmpsuJN5R3p3xj2Te8vvd7xf3dS36ZcHaQ+ePpz+yOTRise+j2ueDHxy5WneM+GzuX84/lH1POL5eWmaVPo/LX7Mrg5NAAA= + + diff --git a/tests/performance-tests/Resources/Particles/SpinningPeas.plist b/tests/performance-tests/Resources/Particles/SpinningPeas.plist new file mode 100644 index 0000000000..724564dcff --- /dev/null +++ b/tests/performance-tests/Resources/Particles/SpinningPeas.plist @@ -0,0 +1,110 @@ + + + + + angle + 90 + angleVariance + 360 + blendFuncDestination + 771 + blendFuncSource + 770 + duration + -1 + emitterType + 0 + finishColorAlpha + 0 + finishColorBlue + 1 + finishColorGreen + 1 + finishColorRed + 1 + finishColorVarianceAlpha + 0 + finishColorVarianceBlue + 0 + finishColorVarianceGreen + 0 + finishColorVarianceRed + 0 + finishParticleSize + 64 + finishParticleSizeVariance + 0 + gravityx + 0 + gravityy + 0 + maxParticles + 15 + maxRadius + 331.5799865722656 + maxRadiusVariance + 0 + minRadius + 0 + particleLifespan + 10 + particleLifespanVariance + 0 + radialAcceleration + 0 + radialAccelVariance + 0 + rotatePerSecond + 0 + rotatePerSecondVariance + 68.68000030517578 + rotationEnd + 0 + rotationEndVariance + 3600 + rotationStart + 0 + rotationStartVariance + 0 + sourcePositionVariancex + 7 + sourcePositionVariancey + 7 + sourcePositionx + 160 + sourcePositiony + 222 + speed + 20 + speedVariance + 0 + startColorAlpha + 1 + startColorBlue + 1 + startColorGreen + 1 + startColorRed + 1 + startColorVarianceAlpha + 0 + startColorVarianceBlue + 0 + startColorVarianceGreen + 0 + startColorVarianceRed + 0 + startParticleSize + 64 + startParticleSizeVariance + 0 + tangentialAcceleration + 0 + tangentialAccelVariance + 0 + textureFileName + PeasTexture.png + textureImageData + H4sIAAAAAAAAA7WYB1wU1xaHZ1ERka4UEZCOYMMkaqwPlqKioGLsKFXEDjYUMQLGqMGCUiwRjQWi2GOLGhRbVDSxxRKTvBgTjQpIEwWF/b9z7rLrkscz0ZcMv8PcuXPvud8p9+zM+PtLbpJkOkl626O7pK/rIb2n7yH11/eUwugcqyeXxut5SoOp3UO3p9TirXW/wWHkIRnReiH6cmm/sW/Dyu5T3DA40RuRaYMxY0uwOPO15zR3WPjrKoj1HI2f3qSXZP1PsBjIpY+a9W1U4ZfQCUuPx+BkyWZcrdqPWy9z8WP1WfxcnY8fX57FzRe5uEL9555mY+2luRiytCfM/XUqyX/pet0ks7+DR89DGmfo3aDwg6XdkfMgCSeercbZyk24VLUD118ewp2ak7iryMevisu4W5OP76vzcO3FQVysyhHjjj/LwO7HH2F4Wg+Y9GlYQfGNJ7VabwXTRtIm27a7hZsh5WYo9j5NwOGKZBx/no4zlRtx6UUOrtccxG2Qn3AaP+GsON9W5OJa9X7kV22jcRuQ+yyd5n2CveUJWHUnFG0nNAfF/gupvdT0TXA4P2ne2c6xLbDmcTCyy6KxuzweBysW4djzFJyqXIf86mxcwW5cxwHcxJckR8SZry/X7ML5F1uQ93wtjj1LwYGKj8X8rNKpWFMwBl3iLaAnl93Q8ZBs/xIQ8evLZfk9FpF/CgOwrng0NpeOR075LOyrIF89W4LjVWn4umYjLiIb3yAHl7FLLXydr8jCmZfr8dXzlThE49nH28tnYlNplNC3otAf8hRz5rr6V/xF8crqMMsASY+6YnmRHzKKhyKzJBRZZZOx82ksvqhIxJHKZJysycBZxac4p9iI84pNuKDYLM58zf3HX6wS/GzHDrJna9kkoSf9yRAsK+yLxIfvo2OcAWhv7v0Tnim2wTqY+YsrEh51wuICT6Q86Y/VJcOxoTQMW8snIadiJvY9n4+j1Z/ghCIFeYo0nFSk45QiQ5z5OrcmBYerFmFPxTzkPJ2BLWUTkUnzM4qHYUVRP6E34dF7mHG3NRwimoDXrY+H6khzA2/Z48hL9pjzuxviH7VD0uMuWFIor+UaRnpDsLk8CtsqorGnKg6HahbgiGIRjiqWqIWvD7xMxM5nsfj86VQaPw7rS4ORUTIUK0jP4kJPJD7ujLkP22L2AzdEfWsPWrewvjpBOZ3cKcEQsQ9aE1MbMWfeo/ZIKuiCxUUeWFHsh7SSQKwtG4kN5aHYUhGFnCpiq47Fvpo4IXtr5mDXi5n4/PkUbHoaicyyEKwtHSnmLX/Sl3g8BA/bG0drzH7giln3XdA5yYj3YrImj0FXycS4r1bF5FsOtUxuiHtIXDR33uP2SCx4Dx8X9UDyE2+klPRDWmkg1pQNw/qnQfjsWRi2VI4licTm5xHYUBGCdeWjsLpsKFJLB4nxPG9hYXckFLwreNjeORpMk27ag9fnWKnziOqie5w+Zv7mLMbMIZ/G1foqXnB1wPyCjkgq6oyPn/TAJ8VyLCvxRUqpH1aV+SO1bADSygaK86pSf9HP95cUe5It3ZFU2AkfFrgL+9hOtpftZvtn/eaCGb86wX2OPpjjVW7Lvhq0s4Waifk1fRVPuuYVdBB65xd2RGLRu1jwpAsWFnfDouIeWFzcC4tLeokzXy8s7kr3O4tx8wvdaV4HwVPXR8R0v7VYc/o9JwRso9pAHIKHcsvQV6t60k07zKB7PIbHzv7NFTE33DDxnCuirxDb/XYaXO5IKOpI8s4reaLRpnvMruKJf9ge02+1EbqmXCaWe66Yfd9V7aNpPzsi6rItmIN59LwlD7tQHUy+ZY9pdx0FU8z3LhizwxnecdboOMwUPSdbIijbBTPvtBVx/FCDTbm2pri/8g1J7M/tELzTpY6uUdnOiL75ykdT7zhgwhVb2ARpQ1cuvUO/iUPaTG2KidfsMPUHB0y/64TR252RfSIVZWVlSE1NBbkTtl31qd8Fc39X5v0rtv+WeapYPWyHMTku9eoK2uYs1or5twMm3bDDuIut4BjZBE09pd4k096NN8C4S63EvagLjvCabQ3VUVpaKvSwcH/Md27KHFPlWT0SX3s/+prba3VN+MYRU27bYzzFLeJrG7Sb1hS6XlK4gVwroTPVJe6L+tYW4bkOcCcfJycnC9vWrVun1sP9nBMi9ylX5z5qK/jqSlvlPRIe+zpdEccdMeGqLcZesEFInhXcY/XYT9NYuB1ywgpjz9sg/IQdPGe0VM/VFM+ZVmS7ck/y3uF6wXx1pLafx0y94vpaXWNP2yMyvxXCTllj9NGWcJuiK/zU1EsKch7XBEFftkRonjX5qxVGZjnCSW5URwfnAOfmrHutRa0Q9YL2c32iuj+L9hfnZn26Rm51QuQF4jltjTHHWmLE/hawC2kMXU8pgPed9QhtDN/XAkFHlFxhecSV7VR3r2Q5Y+oNZ2UNoz08i+pFrFpcNUTZx3WOx0XfdsbonLq6Rm5xQnierZpn5AFLDNlhAcshjZT7juqBgY+selC2mZqLY8v5FZ5nh7CjDog840D71RHTf3EU9YSF2V4nqnHT7zki5idHjL/ogLBjJLn2IhahpzR4dlogYJMp/xZXq36LuX52W2CID7abY/jeFhh12BLBx60QdsZaxJv3xcTv7MQeif7RQdS4acTH66nWVgvVG2bnWhfzE9nyPe91e5HLvN/ZVraZ84fjxTyDsszwfoKBuo6rfu8cqG4OINbBVOOH7bHAyIOWGH2MfWaN8LM2go335YSrdpjEfFRjeT2ud9E/KIXbLMw+mTgmXrcT9giWczZK33xlJWzmmHywwxwDt5rBP7M57CmXNH/v+LnAyFdW4bvKBAGfmSKQ4sj8PI/njzlmpWQ7YyN0C75LthhPjOOvKDlZuM0MUd8oOcaebyXsCT1pjeBcK7GPRuy3xNDdFsL2AZtN0f/T5vBabgxDH1md5wLV85NDaGP4rW4muAduMRPzhu6ywAhmO2Qp/M26mY/3b/hpG7FmRK1wm7k5d3mvcPw5Z4IOK1mG7SHf5JiLWAVsNEW/tc3QO9UEDuSjPz4/qZ4z6d3gcc+PDNEnzQT91jVHwAZTDKplY7+xzhFf0B6kuPI6o2k/MCevy77kNvexP9gG5uD8ZLs4V5llwGdK3/TNaAbfFGN0T6Rncq/6nzOVuS5NMRvQAJ5LDMX4vunN1GwDN5shMKuWL8cCQ5lxdwvByeuycJuFGXhvM0dgtrnwOfuFWTgOvSlHvJcZQ77ECBaBDf/n87gGV1arUdrwSjaC11Ij+BBbH/Iv62KdAZmmwlZmHET5ybYHagj3MQPvF7bFf31z9FvTTNjnu1LJwrq9lxnBbkzjP31vEUft+51ThA68lxsp2Uh8SJdviongY/3M2G9tc/QnPzKrEGpznx8zUGw4B3oThw/lMNunYvFdaYzWUU3+8vsdH6r3YNvR2vBeofQV61LxsX62l9fyWWEs4szCbe5T+UJzvBi3iiTVGLyX3ug9WMNf9GyVYz6wIXotprxPN6Y9YixsZP3sQ8G5tK5wH9/zYVtWKjl6p1FurjaB5zJDtBzaiPPnyJt+L9A8uI5RLAsdwhvDe6UR/NZS7NZQDDNMlJzpyjWFUJv7+B4z8Fi/T03gS32tJ+iIGvR/fVfROFTfn1inXYg2OsXroQ+t138D5X0m5VWmiVpE30bqo3O3hQZwHqcDo95af+v3pz+yqb7TUU2ptBzSEHbB2uSDJmgXoyvOzGxJ8THy1fpHv9PVe3SX9PX/JXWlNQdyfDkmXGeoPYza8iZyqeVb6zaSSVIDOsskJ/on02hriXZDSTJ7R9agtp8Gy7Rr25QTMmO+z72SjsxEY4xpbZvuysw0dJqrxptGyCylRsq2WTdZS3VbLrPS0NNaY61AjfZgNZufsEJH+Rf84pcEhlGdhRb6+w9LFjn4UhYAAA== + + diff --git a/tests/performance-tests/Resources/Particles/debian.plist b/tests/performance-tests/Resources/Particles/debian.plist new file mode 100644 index 0000000000..1caf17cd25 --- /dev/null +++ b/tests/performance-tests/Resources/Particles/debian.plist @@ -0,0 +1,104 @@ + + + + + angle + 270 + angleVariance + 0.0 + blendAdditive + 0.0 + blendFuncDestination + 1 + blendFuncSource + 770 + duration + -1 + emitterType + 0.0 + finishColorAlpha + 1 + finishColorBlue + 0.0 + finishColorGreen + 0.0 + finishColorRed + 1 + finishColorVarianceAlpha + 0.0 + finishColorVarianceBlue + 0.0 + finishColorVarianceGreen + 0.0 + finishColorVarianceRed + 0.0 + finishParticleSize + 20 + finishParticleSizeVariance + 0.0 + gravityx + 0.0 + gravityy + 0.0 + maxParticles + 500 + maxRadius + 276.20999145507812 + maxRadiusVariance + 154.94999694824219 + minRadius + 0.0 + particleLifespan + 10 + particleLifespanVariance + 0.0 + radialAccelVariance + 0.0 + radialAcceleration + -200 + rotatePerSecond + 35.529998779296875 + rotatePerSecondVariance + 0.0 + sourcePositionVariancex + 0.0 + sourcePositionVariancey + 0.0 + sourcePositionx + 175.58000183105469 + sourcePositiony + 247.05999755859375 + speed + 50 + speedVariance + 0.0 + startColorAlpha + 1 + startColorBlue + 0.0 + startColorGreen + 0.0 + startColorRed + 1 + startColorVarianceAlpha + 0.0 + startColorVarianceBlue + 0.0 + startColorVarianceGreen + 0.0 + startColorVarianceRed + 0.0 + startParticleSize + 20 + startParticleSizeVariance + 0.0 + tangentialAccelVariance + 0.0 + tangentialAcceleration + 45 + textureFileName + debian.png + textureImageData + H4sIAAAAAAAAAwFmA5n8iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAADLUlEQVRYCcXX51JbQRCEUeOc/f6v6ZzxHKFPLAoI84epmrp7985294QVxcXl5eWjh7Sn9yB/MWcej19sXQb87/iP8f+yiztWAOmzcYL5k/F9AX9m7/fWf83zTmLOVeD5AHECWieiKpR95D8nlhPcepbH7TYBL+dI/mrWRCRkrQIBZY9Q5vzb+PdxQj2P2ikBCPnrxb0TRMQpAYiRIa9lVcregR0TgATZm/G3W7cmxn5VaA6qQNkjEkNAMbPcDOpBJfYF6DMByJC/H3+3XSfC97IziATov8FD8HUcDmzZs+bETSF0Z+cEICeCE0TYOQFlHznSZoTQkwIc5PW+FqwC7NUGVagCXTvlXzNHXnXE5LsrulYAYFduX4Ts11b4LlaWlbXBWzNH2GxojzN4jgogJgENYreganyYGELsq1YCAOp9CZX5eivEwy9mltcvPvqwirBHSGKIQE6Eitg35forO5mxSo5cDJyVHIf3TRVSIxNgiUgIUO5Abel2qII4hLJnSk5M7XC2rMPGU5s2APO++11PiKBVUECEyAq5athHyvS6TO2vhOHB72/ILK+VtHnb0+EEAkeiLZGV2UpyG94cvRbgh+KcGyzenZb5l3FPbbBfzDks3zcmE9aBCIBF1FCt16meO98M6L3BEpeohIUHP65ZXvXJM2IH8oCAATZYiJWc+a7swJF/HvddnHjnuLgwE4RvY1XAAVMuwAHvHPA61cUDNnD6DUws8k/j2kJEZ8NahdjbWIBeVvJIgSISh4yJ8931SgBwpMhVwtPZKiIeaSJmeWWrgMolENh6pSKXrTjftcKU66m9ziViFSI+AWJ3tgoQADTwrtdKLvvinE2AfcAylTXyj9tn1UiE8ztbBdhUIiD2u9ez3PS5LP0QJe6UgKpgJhpOuPBv2DEBMubAmbI3H0BqDYEJcBOAy06mqpCI/xIw5zYViFx/gZc98IZyX0DtITIR+4M4n27afgX6CgB52dffsq9FawWqkipUCWLyWR7aKQEiHVwFuHbrX7batApNRO3wPOj77O3swf8zuquAneJZaEPZ14KqcOOKrYdOre8j4BTWvfZl8qD2D7ghcomuE8XXAAAAAElFTkSuQmCCksg8PmYDAAA= + + diff --git a/tests/performance-tests/Resources/Particles/lines.plist b/tests/performance-tests/Resources/Particles/lines.plist new file mode 100644 index 0000000000..a480261fcc --- /dev/null +++ b/tests/performance-tests/Resources/Particles/lines.plist @@ -0,0 +1,118 @@ + + + + + angle + 90 + angleVariance + 30 + blendAdditive + 1 + blendFuncDestination + 771 + blendFuncSource + 1 + duration + -1 + emitterType + 0 + emissionRate + 30 + finishColorAlpha + 0 + finishColorBlue + 1 + finishColorGreen + 1 + finishColorRed + 1 + finishColorVarianceAlpha + 1 + finishColorVarianceBlue + 0 + finishColorVarianceGreen + 0 + finishColorVarianceRed + 0 + rotationStart + 0 + rotationStartVariance + 0 + rotationEnd + 0 + rotationEndVariance + 0 + finishParticleSize + 5 + finishParticleSizeVariance + 0 + gravityx + 0 + gravityy + 0 + maxParticles + 100 + maxRadius + 0 + maxRadiusVariance + 0 + minRadius + 0 + minRadiusVariance + 0 + particleLifespan + 2 + particleLifespanVariance + 0.125 + radialAccelVariance + 0 + radialAcceleration + -60 + rotationIsDir + 1 + rotatePerSecond + 0 + rotatePerSecondVariance + 0 + sourcePositionVariancex + 0 + sourcePositionVariancey + 0 + sourcePositionx + 0 + sourcePositiony + 0 + speed + 150 + speedVariance + 30 + startColorAlpha + 1 + startColorBlue + 1 + startColorGreen + 1 + startColorRed + 1 + startColorVarianceAlpha + 1 + startColorVarianceBlue + 0 + startColorVarianceGreen + 0 + startColorVarianceRed + 0 + startParticleSize + 60 + startParticleSizeVariance + 10 + tangentialAccelVariance + 0 + tangentialAcceleration + 15 + textureFileName + line.png + textureImageData + H4sICE5T3E4CAGxpbmUucG5nAHWW5VsTehiGfxOkSyREBCnpTmnY6I4hI0RCGCGSSskc0nHAiTRDUOkQQYYT0NElQ0BydMcBj4Sg1OH8Aee9rue+P7/P++VNtDDTp6e5TgMAoDc00LG6sNZ/oaK4YIVXwOyFqP0N7IIAoGX+L5DhGdQJADTmXjCYhYWnX7BfkKefP48hDMbjH+jn4fXAHYDQKaw1Em69waZ+OLsPNU5AvzT2s2Kl4rGCJqNZMIKivNRMRgm8RZOslq1XdHXJOXsKE8hSU9EprJbidEk0E5TLvK9To98kJPUdL0S88RlrPlwdOGsY11ir2sPWD1ISqOgyDeQsFdB05VDuK/PR3R1dC8uSWlE0Av6Aiar+Pm/QKT8EHKHU1MT4CJSfASR0hJYKEEzzCNI34s8ZN6E5jhB0DIQQjLltTIVmAVrhqdASoKUHQWOzBa1BITlw7ndzXQIWEsBZ6OnqCEBjj3IiIMDhJS8rpBADeK66J+gAT1VQNXgnSRcgpAGLh3GHMpiQANKGth4GoLYREIhMtHWAig5IWybEigDyCODcw88fCmJyAIverq3aT7EapjXRi6Zy6tTwAsq6UQ5UEgGUtraS3MJEQ3YxFkWXSy65WpJtYTkcslHyjPN7XwEoxLBebLt3GkpkqCESFVNxDPckNr9QnPO5ui6drQxW+l8cbiEYNXQmLlV/Ha1KgfY9e31rh9zTibbw0WGyRx2jVgMo3Jiy3fP/rxvdouf4ycmV5eUJow6og0ufbeQZsu0ewfb0wW+U2snhwfznRYEo2btR+uRH821f902Kbwy+oI5xnV5N0z9ppD0/4Rrh6zB0xSNEWZYsmQNSdXJT9mSL+RKhL0Q6bw2f31+cEz8m05hTALXeGpAIjETZXTeyX8ZCTIhgwuIhALtNfq3fhanI0J7RC4Mh5z80T/ULbwG0h+GLAACcdAQk4X31mt1UAOgURonWanPut14TJ1DcaL083Up74qwYAxXoaIMyQWnuo28EOotUPYMKxw3Ucok6S33X4pInWHrGpfszSLbZfGRQ92f840JV0CrcHEVNrt1DddWFdyoB4pqE4E+lYs+JPeJtNSBnThbg6U1gseQzxigYyFglwXlsDLh21QMvKcc76n3CqPYA2Wcncc36Mi+j6izVv9M1wPBlStdj9F7TfrsfLJObxlaY9y3ww3X1FMWitW+VnoxTaRqwbmnC+jVKuY4H0pJd7dD3t8Wp09363/NV0VV2Xa+9U0XWlHjgNvg+hJw5SpdArUgeAuVx4dY2QJggzCYMynhuCMhfmaJWoiaLsWwT4ksvM/4g+OnK745rrrIy8QgDcf4x5rSrUkwRCbAOJQHmRJisEP75JcP3b+HDzMN6ww+t+DfEy/PkDa7zp/dO3fepo1R+Kc4j1hO7jF1uX5Zb5lzm3XWgwbpqBbw9sl4UturzNuJYYVqRX6Fwz5bVtnmTazVTVgS/opBmD60uwlm9s4wvuyr/KFd5IJrN0Li4+nXGyHVPds9Dr3frwZ+uzGRwm2V9sx3u39Bfz1on2w+ho49jje5OQApz5F2jvIbkCLn2LtukhGMkmaMbLq0ks5W9lsOY42eDEMWJPmHF9NFkGGUIZnCKSsHLK0oqZitobfZs+uFp5U7WkTV6NnLWS+XU3zMrbSqwFlvWnNbIctWy+ApkmR9c8y3K7jSRwq7dpN0c9tay8P29peYuHlo3jvpQcV4f+sq4R1EKHYLvByafPBZtyj7lakpWrygvUobJGcnZ1lvtvfTQpFzKDjjKDzajXhMuzdpDJc2y/BBZFOEskTfBy7g7+lRkZmUiKg0qLSv1t1oUa7ZLsSUtuk12x1EM2t1GQo5C+sg04mXsmvWk9UwpTSmbqbrKQY1khU8xZ1GTTsiXh6U72QWfndAFJn6ls2Eta39uREqdwk99/5Qe6NMhKOrpBChIdMRrap0KAX5qXFLdpJ+WsLvtWrBilwyXrIUYDH5I7c2o3l96jCleXY5LAku+Xb5dbwQpBHkFjU03TXdyrUzxJSIlqiaqJt0DXwdeD4zlKOSpy4zLruWt5Y3nzTU624fai+PKcB/dDeuW7UvsdnDND2Ptle2KETb2d+v1qrHVt8aaqptKr5TizdLNKgvGkO21P3G9uPJGjtqVCQpSDc4XF+mCdGVHNnbWtO+kt6RHfor861Sdkj5+kqGSy54LFfQhkEXljspsLjF/RzOycz9zQwqJGGQanJBbwl3tF+nwwlrnjegj2ZH4oOi9hORE42f9klkaknmcXTM9LctGwQcBdxfChw+wefV5bdtlpHc7ijteO/HTr77KvxIpsJML+tbeA5u3XBnSpH2VIe0zV4Uyh5lHIRvW+KXcpDC21eO1jcUhFYcuP9g1fmkEvlrSWFJTmpWdtbv3VYnQ2NPYb97uV3Avdg72lP/8/nn4+RAoRd+CIMkSo7SjHC4dH4U/4f2SqqlCcv9VN7mtnVKI12bVTntW/WyltZrXs+fv59W8h2vZRAzRiyHWArU+9o3SZdUluR1FJxQbH2sbp5nqn4C4PiSTpRAyNA0LmtP5o5OpM5uHlDFXfidhpCCqUSHprTal9En+k2aXpIfd11EEFmH4wPiGsqRojeLDB5/nTrb34hexi7RLEezZUj13/cOKiG37saVs5ZLM4iqZWiYJZrdf/qPNJFrGlnJr92rIrVSasDauNiSf1JDiUMIEzFGU22zXQNQ0/MXfmGaFMIFOuWLxFXyMUPnzZhN6k5k8lQK23Mc8vrLqKi0y0S8wzwOgFbym6TjkJnLV43F/lXts3Vnnw+RGKe4Myl6f+udVl+0kaHDQknW4vfC4KGUd0t3W48tAYp9yZmWB2MD21/o+0nOl/B+vzreZ25gXXuCK44xtJbgQqy1V3sp1agFhJJol1sticXcoqtQ+JuFEfUfNK7dts2pQLYLhpj5RTq19z1obID5btDY0K7GRW9Pj23fNEVJ2cw0uf+KwnBqsiUk1LCT2LNanE8LToSuc8X59X3KmX34or+zA3x/0GPbYWJ2VKHBgyKzIWs1ieEg/OfWBfu7Oh+2DX7okqawBYVJTNA6Gf/NF7WOze2kvcUBVE/4Wvg//A1fcGZ5pcBk/eji0wxnR/Ev+71GSQ/PhqUbvZ5INxMZ01GPU/djwuP5QsyaxYuMo89j3brWZb8B2N9kw2SklPwNuHP99lGtYHW6VNia2pc/QffPzGfZHiAS9Ir3NX/ldi/z+OmHLG4fUc4fc9CpTj1MiqhYoR24+5kJySXlDc3dz9fKsc48dXB0+mX/VGBrbnA0/0SfdZMyXV7MLM9qD93pNbTwbSUfuDqZgM7CRKMnf086k17iINTfinDej349PTMELw7rnyWuqzapEx92Pwbt1pJWrth9tc9+p3PPdDN5UO0sfMe9uym/KrcE7+uB3wlsaIjwONzgLlIgz+y1hP9nOx0YLlNVnWvbC/Q47Dw/m2GZQgUKnxP6myRChnepm8+Z7+1rb2pOwmfhRTYez6Ykf00+9CSGFe0PT+ocUsdGDZ5iDNEbY5bSctP44+ritgtsaysqLmoGnGyelsMH7g4IF7Gevz/pr2NmkUEejW+PEoeyhoqzdrPQvvk+KTzcJWxzvSF1tXdyfe0PlZJz27xxvt4ZMh3D9eDPHaL78hOep8Lnn7/cH1t9Kj9M50tPPycmy907c5CRIF/8mj5uBlSkA4bcAQEcD8Pv8whsAPJIGYNMZAJVsANj9Xtzr1AMA4mCoow0Pnfp7Ssa4XYuF8POctchCR5zmcSBr/ozjyToKIFt1a5OFrXSneCXXAmMtpEIS5533nhq/6I9ePp3FqHrCUjAy3TGYeHCJigf9fyB4LvLIKZKVEHilzcchE2dxYxql0neS7M9+oXbwsFcNEI3h94bdfAQZf4Z8CDth5aaSi6c2bIk7FDih3W+iOWpBDdpnfvXV4K7DPNVHstkTCjryBDdKqggLN3GFYNm6mngN4GKenIZfXb0TRYEge0W4+k+2XQW0+0HvX1mBbvpmE2E/f3GjsUGy+O0t9wp3+ien649XNaFB8+S3TfsXXls5nnT+cRL7jNvoaw1eUS9VJ4j9w1DlDT48fjpiROnNJf4oeH2fPpbD8hilIBIygqT4yMikBSDk/4uJ7iNu4DSAkJVXzsgHF2Ooa6ZTA3V+9i9i6w2wMAwAAA== + + \ No newline at end of file diff --git a/tests/performance-tests/Resources/TileMaps/iso-test.png b/tests/performance-tests/Resources/TileMaps/iso-test.png new file mode 100755 index 0000000000..00e694810e Binary files /dev/null and b/tests/performance-tests/Resources/TileMaps/iso-test.png differ diff --git a/tests/performance-tests/Resources/TileMaps/iso-test.tmx b/tests/performance-tests/Resources/TileMaps/iso-test.tmx new file mode 100755 index 0000000000..1e878f87dd --- /dev/null +++ b/tests/performance-tests/Resources/TileMaps/iso-test.tmx @@ -0,0 +1,16 @@ + + + + + + + + H4sIAAAAAAAAA+3DwQkAAAwDoYPsv3PH6EfBVVNVVVVVVVVVVVVVVVVVVVVfH73hYN0AQAAA + + + + + H4sIAAAAAAAAA+2Y2Y7DIAxFeeD/v3nEQ6UMYvGW4Gt8pKptAgnXZrFdSpLQqKcHkCTJJ9Tyf73X7js6vc6vdJ+27+3vP0m/5m4DQfubPkLxv+UYR/ssgg0sqN2nvz5rG4Gd5t42ddIuGhRtUWww0kDVFsEGKw1UG6AzswHFv4j6OWPe2QBN/26+c9YC4vrXrOlT+agVWn8h+vsHd+yaM8Er3LHP6k/ISG2APvdX/2d90OP9le8ixjVPqPnsqj8y1Hglao7PiekjrPURXBuUwfX+vmc4a3w3D3bv8GgPie8o9lrVBz3ZQbKfc2o9q3se7CA90yk5PkItSDpGS32n5wJXh1VeyG3zJhw/ScZKPSNOYrWnrWII7fvfRlvref7mxgoe9DcoedCs3+o5s3bUe18iqWFYtPOiv2G1z3PmgId9UArXr9J90ivSWJrzHFS0+RQ6nHwhov4Gcp3Agqi6qET2LRVNLh0BSf0wEpo6QgSeZ9xt2hvRzzgKN2tPkiRJEg1/QULzBABAAAA= + + + diff --git a/tests/performance-tests/Resources/TileMaps/iso-test2.png b/tests/performance-tests/Resources/TileMaps/iso-test2.png new file mode 100755 index 0000000000..8668e0fe20 Binary files /dev/null and b/tests/performance-tests/Resources/TileMaps/iso-test2.png differ diff --git a/tests/performance-tests/Resources/TileMaps/iso-test2.tmx b/tests/performance-tests/Resources/TileMaps/iso-test2.tmx new file mode 100755 index 0000000000..a015f57ccc --- /dev/null +++ b/tests/performance-tests/Resources/TileMaps/iso-test2.tmx @@ -0,0 +1,17 @@ + + + + + + + + + H4sIAAAAAAAAAO3DwQkAAAwDoSP7D90x+lFw1VRVVVVVVVVVVVVVVVVVVdXXB2sNXEYAQAAA + + + + + H4sIAAAAAAAAAO2Z4QqDMAyEBd//ncd+lA1pYtpGyfXugzLZquR6TYzuOIQQ59/w5vSO0blqsbSdxic6Z2d4c3vHApeRfR3ZI2hE9d/ViWgOVWM0/3tzeucgrcEK0XqJglXjLc931X/d655+b1THi9mrcWIPov1v+82q/5HvKhLN2Uj9G1nLKqz6752PoD8D5DoZjRFxb0dYzf8KrPQeIzoq7utd+s/ZWNH7zwZavLPc+ZW5BhXXM6I/K25U/ZnXQwEt3mxWtF/fUyD6Pwvy80ZGvKj5Xz2+J8m8B6D5n33/R+z/mf1vVI/vDZjr/9NIOzcsa6D8F4IX9vxH7P8zYfdf2LD7z6Bf+S8s2P1n0K/858b7/4vBf+lX/jMj/3+w6f0i/+f5ADmHbJ0AQAAA + + + diff --git a/tests/performance-tests/Resources/fonts/Marker Felt.ttf b/tests/performance-tests/Resources/fonts/Marker Felt.ttf new file mode 100755 index 0000000000..3752ef3110 Binary files /dev/null and b/tests/performance-tests/Resources/fonts/Marker Felt.ttf differ diff --git a/tests/performance-tests/Resources/fonts/arial.ttf b/tests/performance-tests/Resources/fonts/arial.ttf new file mode 100755 index 0000000000..abc899cd55 Binary files /dev/null and b/tests/performance-tests/Resources/fonts/arial.ttf differ diff --git a/tests/performance-tests/Resources/fonts/bitmapFontTest3.fnt b/tests/performance-tests/Resources/fonts/bitmapFontTest3.fnt new file mode 100755 index 0000000000..53c9bc1343 --- /dev/null +++ b/tests/performance-tests/Resources/fonts/bitmapFontTest3.fnt @@ -0,0 +1,102 @@ +info face="ActionJackson" size=28 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=1,1 +common lineHeight=30 base=26 scaleW=512 scaleH=512 pages=1 packed=0 +page id=0 file="bitmapFontTest3.png" +chars count=94 +char id=32 x=0 y=0 width=0 height=0 xoffset=0 yoffset=24 xadvance=23 page=0 chnl=0 +char id=114 x=0 y=0 width=16 height=25 xoffset=0 yoffset=1 xadvance=14 page=0 chnl=0 +char id=82 x=16 y=0 width=16 height=25 xoffset=0 yoffset=1 xadvance=14 page=0 chnl=0 +char id=62 x=32 y=0 width=9 height=24 xoffset=0 yoffset=2 xadvance=7 page=0 chnl=0 +char id=60 x=41 y=0 width=10 height=24 xoffset=0 yoffset=2 xadvance=8 page=0 chnl=0 +char id=125 x=51 y=0 width=9 height=24 xoffset=0 yoffset=2 xadvance=7 page=0 chnl=0 +char id=123 x=60 y=0 width=10 height=24 xoffset=0 yoffset=2 xadvance=8 page=0 chnl=0 +char id=93 x=70 y=0 width=9 height=24 xoffset=0 yoffset=2 xadvance=7 page=0 chnl=0 +char id=91 x=79 y=0 width=10 height=24 xoffset=0 yoffset=2 xadvance=8 page=0 chnl=0 +char id=41 x=89 y=0 width=9 height=24 xoffset=0 yoffset=2 xadvance=7 page=0 chnl=0 +char id=40 x=98 y=0 width=10 height=24 xoffset=0 yoffset=2 xadvance=8 page=0 chnl=0 +char id=56 x=108 y=0 width=17 height=24 xoffset=0 yoffset=1 xadvance=15 page=0 chnl=0 +char id=105 x=125 y=0 width=19 height=24 xoffset=0 yoffset=1 xadvance=17 page=0 chnl=0 +char id=101 x=144 y=0 width=18 height=24 xoffset=0 yoffset=1 xadvance=16 page=0 chnl=0 +char id=73 x=162 y=0 width=19 height=24 xoffset=0 yoffset=1 xadvance=17 page=0 chnl=0 +char id=69 x=181 y=0 width=18 height=24 xoffset=0 yoffset=1 xadvance=16 page=0 chnl=0 +char id=59 x=199 y=0 width=11 height=23 xoffset=0 yoffset=7 xadvance=9 page=0 chnl=0 +char id=63 x=210 y=0 width=16 height=23 xoffset=0 yoffset=2 xadvance=14 page=0 chnl=0 +char id=33 x=226 y=0 width=8 height=23 xoffset=1 yoffset=2 xadvance=8 page=0 chnl=0 +char id=48 x=234 y=0 width=18 height=23 xoffset=0 yoffset=2 xadvance=16 page=0 chnl=0 +char id=57 x=252 y=0 width=16 height=23 xoffset=0 yoffset=2 xadvance=14 page=0 chnl=0 +char id=54 x=268 y=0 width=17 height=23 xoffset=0 yoffset=2 xadvance=15 page=0 chnl=0 +char id=53 x=285 y=0 width=19 height=23 xoffset=0 yoffset=2 xadvance=17 page=0 chnl=0 +char id=52 x=304 y=0 width=18 height=23 xoffset=0 yoffset=2 xadvance=16 page=0 chnl=0 +char id=51 x=322 y=0 width=16 height=23 xoffset=0 yoffset=2 xadvance=14 page=0 chnl=0 +char id=49 x=338 y=0 width=16 height=23 xoffset=1 yoffset=2 xadvance=15 page=0 chnl=0 +char id=122 x=354 y=0 width=19 height=23 xoffset=0 yoffset=2 xadvance=17 page=0 chnl=0 +char id=121 x=373 y=0 width=20 height=23 xoffset=0 yoffset=2 xadvance=18 page=0 chnl=0 +char id=118 x=393 y=0 width=21 height=23 xoffset=0 yoffset=2 xadvance=19 page=0 chnl=0 +char id=116 x=414 y=0 width=21 height=23 xoffset=0 yoffset=2 xadvance=19 page=0 chnl=0 +char id=113 x=435 y=0 width=17 height=23 xoffset=0 yoffset=2 xadvance=15 page=0 chnl=0 +char id=112 x=452 y=0 width=17 height=23 xoffset=0 yoffset=2 xadvance=15 page=0 chnl=0 +char id=110 x=469 y=0 width=20 height=23 xoffset=0 yoffset=2 xadvance=18 page=0 chnl=0 +char id=109 x=0 y=25 width=25 height=23 xoffset=0 yoffset=2 xadvance=22 page=0 chnl=0 +char id=108 x=25 y=25 width=21 height=23 xoffset=1 yoffset=2 xadvance=19 page=0 chnl=0 +char id=107 x=46 y=25 width=19 height=23 xoffset=1 yoffset=2 xadvance=18 page=0 chnl=0 +char id=106 x=65 y=25 width=20 height=23 xoffset=0 yoffset=2 xadvance=18 page=0 chnl=0 +char id=100 x=85 y=25 width=19 height=23 xoffset=0 yoffset=2 xadvance=16 page=0 chnl=0 +char id=98 x=104 y=25 width=18 height=23 xoffset=0 yoffset=2 xadvance=16 page=0 chnl=0 +char id=97 x=122 y=25 width=21 height=23 xoffset=0 yoffset=2 xadvance=19 page=0 chnl=0 +char id=90 x=143 y=25 width=19 height=23 xoffset=0 yoffset=2 xadvance=17 page=0 chnl=0 +char id=89 x=162 y=25 width=20 height=23 xoffset=0 yoffset=2 xadvance=18 page=0 chnl=0 +char id=86 x=182 y=25 width=21 height=23 xoffset=0 yoffset=2 xadvance=19 page=0 chnl=0 +char id=84 x=203 y=25 width=21 height=23 xoffset=0 yoffset=2 xadvance=19 page=0 chnl=0 +char id=81 x=224 y=25 width=17 height=23 xoffset=0 yoffset=2 xadvance=15 page=0 chnl=0 +char id=80 x=241 y=25 width=17 height=23 xoffset=0 yoffset=2 xadvance=15 page=0 chnl=0 +char id=78 x=258 y=25 width=20 height=23 xoffset=0 yoffset=2 xadvance=18 page=0 chnl=0 +char id=77 x=278 y=25 width=25 height=23 xoffset=0 yoffset=2 xadvance=22 page=0 chnl=0 +char id=76 x=303 y=25 width=21 height=23 xoffset=1 yoffset=2 xadvance=19 page=0 chnl=0 +char id=75 x=324 y=25 width=19 height=23 xoffset=1 yoffset=2 xadvance=18 page=0 chnl=0 +char id=74 x=343 y=25 width=20 height=23 xoffset=0 yoffset=2 xadvance=18 page=0 chnl=0 +char id=68 x=363 y=25 width=19 height=23 xoffset=0 yoffset=2 xadvance=16 page=0 chnl=0 +char id=66 x=382 y=25 width=18 height=23 xoffset=0 yoffset=2 xadvance=16 page=0 chnl=0 +char id=65 x=400 y=25 width=20 height=23 xoffset=0 yoffset=2 xadvance=19 page=0 chnl=0 +char id=55 x=420 y=25 width=18 height=22 xoffset=0 yoffset=3 xadvance=16 page=0 chnl=0 +char id=50 x=438 y=25 width=18 height=22 xoffset=1 yoffset=2 xadvance=17 page=0 chnl=0 +char id=120 x=456 y=25 width=23 height=22 xoffset=0 yoffset=3 xadvance=21 page=0 chnl=0 +char id=117 x=479 y=25 width=22 height=22 xoffset=0 yoffset=2 xadvance=20 page=0 chnl=0 +char id=115 x=0 y=48 width=16 height=22 xoffset=0 yoffset=2 xadvance=14 page=0 chnl=0 +char id=111 x=16 y=48 width=17 height=22 xoffset=0 yoffset=2 xadvance=16 page=0 chnl=0 +char id=102 x=33 y=48 width=20 height=22 xoffset=0 yoffset=2 xadvance=17 page=0 chnl=0 +char id=88 x=53 y=48 width=23 height=22 xoffset=0 yoffset=3 xadvance=21 page=0 chnl=0 +char id=85 x=76 y=48 width=22 height=22 xoffset=0 yoffset=2 xadvance=20 page=0 chnl=0 +char id=83 x=98 y=48 width=16 height=22 xoffset=0 yoffset=2 xadvance=14 page=0 chnl=0 +char id=79 x=114 y=48 width=17 height=22 xoffset=0 yoffset=2 xadvance=16 page=0 chnl=0 +char id=70 x=131 y=48 width=20 height=22 xoffset=0 yoffset=2 xadvance=17 page=0 chnl=0 +char id=92 x=151 y=48 width=12 height=21 xoffset=0 yoffset=3 xadvance=10 page=0 chnl=0 +char id=119 x=163 y=48 width=24 height=21 xoffset=0 yoffset=2 xadvance=21 page=0 chnl=0 +char id=104 x=187 y=48 width=20 height=21 xoffset=1 yoffset=3 xadvance=19 page=0 chnl=0 +char id=103 x=207 y=48 width=22 height=21 xoffset=0 yoffset=3 xadvance=20 page=0 chnl=0 +char id=87 x=229 y=48 width=24 height=21 xoffset=0 yoffset=2 xadvance=21 page=0 chnl=0 +char id=72 x=253 y=48 width=20 height=21 xoffset=1 yoffset=3 xadvance=19 page=0 chnl=0 +char id=71 x=273 y=48 width=22 height=21 xoffset=0 yoffset=3 xadvance=20 page=0 chnl=0 +char id=47 x=295 y=48 width=11 height=20 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=0 +char id=124 x=306 y=48 width=11 height=20 xoffset=1 yoffset=3 xadvance=10 page=0 chnl=0 +char id=99 x=317 y=48 width=18 height=20 xoffset=0 yoffset=2 xadvance=16 page=0 chnl=0 +char id=67 x=335 y=48 width=18 height=20 xoffset=0 yoffset=2 xadvance=16 page=0 chnl=0 +char id=126 x=353 y=48 width=17 height=18 xoffset=1 yoffset=5 xadvance=16 page=0 chnl=0 +char id=38 x=370 y=48 width=17 height=18 xoffset=1 yoffset=5 xadvance=16 page=0 chnl=0 +char id=35 x=387 y=48 width=17 height=18 xoffset=1 yoffset=5 xadvance=16 page=0 chnl=0 +char id=37 x=404 y=48 width=17 height=18 xoffset=1 yoffset=5 xadvance=16 page=0 chnl=0 +char id=36 x=421 y=48 width=17 height=18 xoffset=1 yoffset=5 xadvance=16 page=0 chnl=0 +char id=94 x=438 y=48 width=17 height=18 xoffset=1 yoffset=5 xadvance=16 page=0 chnl=0 +char id=64 x=455 y=48 width=17 height=18 xoffset=1 yoffset=5 xadvance=16 page=0 chnl=0 +char id=43 x=472 y=48 width=17 height=17 xoffset=0 yoffset=2 xadvance=15 page=0 chnl=0 +char id=58 x=489 y=48 width=9 height=17 xoffset=0 yoffset=8 xadvance=7 page=0 chnl=0 +char id=61 x=0 y=70 width=17 height=14 xoffset=1 yoffset=6 xadvance=16 page=0 chnl=0 +char id=44 x=17 y=70 width=11 height=14 xoffset=0 yoffset=16 xadvance=9 page=0 chnl=0 +char id=39 x=28 y=70 width=11 height=14 xoffset=0 yoffset=0 xadvance=9 page=0 chnl=0 +char id=96 x=39 y=70 width=10 height=13 xoffset=1 yoffset=0 xadvance=9 page=0 chnl=0 +char id=34 x=49 y=70 width=20 height=13 xoffset=0 yoffset=0 xadvance=17 page=0 chnl=0 +char id=95 x=69 y=70 width=16 height=8 xoffset=1 yoffset=17 xadvance=16 page=0 chnl=0 +char id=45 x=85 y=70 width=17 height=8 xoffset=1 yoffset=10 xadvance=16 page=0 chnl=0 +char id=42 x=102 y=70 width=8 height=7 xoffset=1 yoffset=3 xadvance=6 page=0 chnl=0 +char id=46 x=110 y=70 width=9 height=7 xoffset=0 yoffset=18 xadvance=7 page=0 chnl=0 +kernings count=1 +kerning first=79 second=66 amount=-1 +kerning first=79 second=89 amount=-3 diff --git a/tests/performance-tests/Resources/fonts/bitmapFontTest3.png b/tests/performance-tests/Resources/fonts/bitmapFontTest3.png new file mode 100755 index 0000000000..d19379f5e7 Binary files /dev/null and b/tests/performance-tests/Resources/fonts/bitmapFontTest3.png differ diff --git a/tests/performance-tests/Resources/fonts/tahoma.ttf b/tests/performance-tests/Resources/fonts/tahoma.ttf new file mode 100755 index 0000000000..3f8554bba4 Binary files /dev/null and b/tests/performance-tests/Resources/fonts/tahoma.ttf differ diff --git a/tests/performance-tests/Resources/fps_images.png b/tests/performance-tests/Resources/fps_images.png new file mode 100644 index 0000000000..c7449025bf Binary files /dev/null and b/tests/performance-tests/Resources/fps_images.png differ diff --git a/tests/performance-tests/proj.android-studio/.gitignore b/tests/performance-tests/proj.android-studio/.gitignore new file mode 100644 index 0000000000..9c4de5825b --- /dev/null +++ b/tests/performance-tests/proj.android-studio/.gitignore @@ -0,0 +1,7 @@ +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures diff --git a/tests/performance-tests/proj.android-studio/app/.gitignore b/tests/performance-tests/proj.android-studio/app/.gitignore new file mode 100644 index 0000000000..1de99493d6 --- /dev/null +++ b/tests/performance-tests/proj.android-studio/app/.gitignore @@ -0,0 +1,2 @@ +/build +/jniLibs diff --git a/tests/performance-tests/proj.android-studio/app/AndroidManifest.xml b/tests/performance-tests/proj.android-studio/app/AndroidManifest.xml new file mode 100644 index 0000000000..2bc6807a36 --- /dev/null +++ b/tests/performance-tests/proj.android-studio/app/AndroidManifest.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/performance-tests/proj.android-studio/app/build.gradle b/tests/performance-tests/proj.android-studio/app/build.gradle new file mode 100644 index 0000000000..78266c7d2f --- /dev/null +++ b/tests/performance-tests/proj.android-studio/app/build.gradle @@ -0,0 +1,49 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 22 + buildToolsVersion "22.0.1" + + defaultConfig { + applicationId "org.cocos2dx.performance_tests" + minSdkVersion 10 + targetSdkVersion 22 + versionCode 1 + versionName "1.0" + } + + sourceSets.main { + java.srcDir "src" + res.srcDir "res" + jniLibs.srcDir "libs" + manifest.srcFile "AndroidManifest.xml" + assets.srcDir "assets" + } + + signingConfigs { + + release { + if (project.hasProperty("RELEASE_STORE_FILE")) { + storeFile file(RELEASE_STORE_FILE) + storePassword RELEASE_STORE_PASSWORD + keyAlias RELEASE_KEY_ALIAS + keyPassword RELEASE_KEY_PASSWORD + } + } + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + if (project.hasProperty("RELEASE_STORE_FILE")) { + signingConfig signingConfigs.release + } + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + compile project(':libcocos2dx') +} diff --git a/tests/performance-tests/proj.android-studio/app/jni/Android.mk b/tests/performance-tests/proj.android-studio/app/jni/Android.mk new file mode 100644 index 0000000000..87b657d1c0 --- /dev/null +++ b/tests/performance-tests/proj.android-studio/app/jni/Android.mk @@ -0,0 +1,46 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_MODULE := cocos2dcpp_shared + +LOCAL_MODULE_FILENAME := libcocos2dcpp + +LOCAL_SRC_FILES := hellocpp/main.cpp \ + ../../../Classes/AppDelegate.cpp \ + ../../../Classes/Profile.cpp \ + ../../../Classes/tests/BaseTest.cpp \ + ../../../Classes/tests/PerformanceParticle3DTest.cpp \ + ../../../Classes/tests/PerformanceAllocTest.cpp \ + ../../../Classes/tests/PerformanceParticleTest.cpp \ + ../../../Classes/tests/PerformanceCallbackTest.cpp \ + ../../../Classes/tests/PerformanceScenarioTest.cpp \ + ../../../Classes/tests/PerformanceContainerTest.cpp \ + ../../../Classes/tests/PerformanceSpriteTest.cpp \ + ../../../Classes/tests/PerformanceEventDispatcherTest.cpp \ + ../../../Classes/tests/PerformanceTextureTest.cpp \ + ../../../Classes/tests/PerformanceLabelTest.cpp \ + ../../../Classes/tests/VisibleRect.cpp \ + ../../../Classes/tests/PerformanceMathTest.cpp \ + ../../../Classes/tests/controller.cpp \ + ../../../Classes/tests/PerformanceNodeChildrenTest.cpp + +LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../Classes \ + $(LOCAL_PATH)/../../../Classes/tests + +# _COCOS_HEADER_ANDROID_BEGIN +# _COCOS_HEADER_ANDROID_END + + +LOCAL_STATIC_LIBRARIES := cocos2dx_static +LOCAL_WHOLE_STATIC_LIBRARIES := cocos3d_static + +# _COCOS_LIB_ANDROID_BEGIN +# _COCOS_LIB_ANDROID_END + +include $(BUILD_SHARED_LIBRARY) + +$(call import-module, cocos) + +# _COCOS_LIB_IMPORT_ANDROID_BEGIN +# _COCOS_LIB_IMPORT_ANDROID_END diff --git a/tests/performance-tests/proj.android-studio/app/jni/Application.mk b/tests/performance-tests/proj.android-studio/app/jni/Application.mk new file mode 100644 index 0000000000..07aa592b13 --- /dev/null +++ b/tests/performance-tests/proj.android-studio/app/jni/Application.mk @@ -0,0 +1,13 @@ +APP_STL := gnustl_static + +APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char +APP_LDFLAGS := -latomic + + +ifeq ($(NDK_DEBUG),1) + APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 + APP_OPTIM := debug +else + APP_CPPFLAGS += -DNDEBUG + APP_OPTIM := release +endif diff --git a/tests/performance-tests/proj.android-studio/app/jni/hellocpp/main.cpp b/tests/performance-tests/proj.android-studio/app/jni/hellocpp/main.cpp new file mode 100644 index 0000000000..2c27096ca3 --- /dev/null +++ b/tests/performance-tests/proj.android-studio/app/jni/hellocpp/main.cpp @@ -0,0 +1,15 @@ +#include "AppDelegate.h" +#include "cocos2d.h" +#include "platform/android/jni/JniHelper.h" +#include +#include + +#define LOG_TAG "main" +#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__) + +using namespace cocos2d; + +void cocos_android_app_init (JNIEnv* env) { + LOGD("cocos_android_app_init"); + AppDelegate *pAppDelegate = new AppDelegate(); +} diff --git a/tests/performance-tests/proj.android-studio/app/proguard-rules.pro b/tests/performance-tests/proj.android-studio/app/proguard-rules.pro new file mode 100644 index 0000000000..6618e28017 --- /dev/null +++ b/tests/performance-tests/proj.android-studio/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in E:\developSoftware\Android\SDK/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/tests/performance-tests/proj.android-studio/app/project.properties b/tests/performance-tests/proj.android-studio/app/project.properties new file mode 100644 index 0000000000..f049142c17 --- /dev/null +++ b/tests/performance-tests/proj.android-studio/app/project.properties @@ -0,0 +1,11 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system use, +# "ant.properties", and override values to adapt the script to your +# project structure. + +# Project target. +target=android-10 diff --git a/tests/performance-tests/proj.android-studio/app/res/mipmap-hdpi/ic_launcher.png b/tests/performance-tests/proj.android-studio/app/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000000..45ee51d15f Binary files /dev/null and b/tests/performance-tests/proj.android-studio/app/res/mipmap-hdpi/ic_launcher.png differ diff --git a/tests/performance-tests/proj.android-studio/app/res/mipmap-mdpi/ic_launcher.png b/tests/performance-tests/proj.android-studio/app/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000000..0dd2a60899 Binary files /dev/null and b/tests/performance-tests/proj.android-studio/app/res/mipmap-mdpi/ic_launcher.png differ diff --git a/tests/performance-tests/proj.android-studio/app/res/mipmap-xhdpi/ic_launcher.png b/tests/performance-tests/proj.android-studio/app/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000000..a32f16f930 Binary files /dev/null and b/tests/performance-tests/proj.android-studio/app/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/tests/performance-tests/proj.android-studio/app/res/mipmap-xxhdpi/ic_launcher.png b/tests/performance-tests/proj.android-studio/app/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000000..332f268edc Binary files /dev/null and b/tests/performance-tests/proj.android-studio/app/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/tests/performance-tests/proj.android-studio/app/res/values/strings.xml b/tests/performance-tests/proj.android-studio/app/res/values/strings.xml new file mode 100644 index 0000000000..4349c5f669 --- /dev/null +++ b/tests/performance-tests/proj.android-studio/app/res/values/strings.xml @@ -0,0 +1,3 @@ + + PerformanceTests + diff --git a/tests/performance-tests/proj.android-studio/app/src/org/cocos2dx/cpp/AppActivity.java b/tests/performance-tests/proj.android-studio/app/src/org/cocos2dx/cpp/AppActivity.java new file mode 100644 index 0000000000..26813bbcf9 --- /dev/null +++ b/tests/performance-tests/proj.android-studio/app/src/org/cocos2dx/cpp/AppActivity.java @@ -0,0 +1,29 @@ +/**************************************************************************** +Copyright (c) 2015 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. +****************************************************************************/ +package org.cocos2dx.cpp; + +import org.cocos2dx.lib.Cocos2dxActivity; + +public class AppActivity extends Cocos2dxActivity { +} diff --git a/tests/performance-tests/proj.android-studio/build-cfg.json b/tests/performance-tests/proj.android-studio/build-cfg.json new file mode 100644 index 0000000000..732443b304 --- /dev/null +++ b/tests/performance-tests/proj.android-studio/build-cfg.json @@ -0,0 +1,13 @@ +{ + "ndk_module_path" :[ + "../../..", + "../../../cocos", + "../../../external" + ], + "copy_resources": [ + { + "from": "../Resources", + "to": "" + } + ] +} diff --git a/tests/performance-tests/proj.android-studio/build.gradle b/tests/performance-tests/proj.android-studio/build.gradle new file mode 100644 index 0000000000..1b7886d148 --- /dev/null +++ b/tests/performance-tests/proj.android-studio/build.gradle @@ -0,0 +1,19 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + repositories { + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:1.3.0' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + jcenter() + } +} diff --git a/tests/performance-tests/proj.android-studio/gradle.properties b/tests/performance-tests/proj.android-studio/gradle.properties new file mode 100644 index 0000000000..1d3591c8a4 --- /dev/null +++ b/tests/performance-tests/proj.android-studio/gradle.properties @@ -0,0 +1,18 @@ +# Project-wide Gradle settings. + +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. + +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +# Default value: -Xmx10248m -XX:MaxPermSize=256m +# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 + +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true \ No newline at end of file diff --git a/tests/performance-tests/proj.android-studio/gradle/wrapper/gradle-wrapper.jar b/tests/performance-tests/proj.android-studio/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000..8c0fb64a86 Binary files /dev/null and b/tests/performance-tests/proj.android-studio/gradle/wrapper/gradle-wrapper.jar differ diff --git a/tests/performance-tests/proj.android-studio/gradle/wrapper/gradle-wrapper.properties b/tests/performance-tests/proj.android-studio/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000..1d87c27c59 --- /dev/null +++ b/tests/performance-tests/proj.android-studio/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Fri Jul 31 20:40:49 CST 2015 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip diff --git a/tests/performance-tests/proj.android-studio/gradlew b/tests/performance-tests/proj.android-studio/gradlew new file mode 100755 index 0000000000..91a7e269e1 --- /dev/null +++ b/tests/performance-tests/proj.android-studio/gradlew @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/tests/performance-tests/proj.android-studio/gradlew.bat b/tests/performance-tests/proj.android-studio/gradlew.bat new file mode 100644 index 0000000000..8a0b282aa6 --- /dev/null +++ b/tests/performance-tests/proj.android-studio/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/tests/performance-tests/proj.android-studio/settings.gradle b/tests/performance-tests/proj.android-studio/settings.gradle new file mode 100644 index 0000000000..9261b5b19a --- /dev/null +++ b/tests/performance-tests/proj.android-studio/settings.gradle @@ -0,0 +1,4 @@ +include ':libcocos2dx' +project(':libcocos2dx').projectDir = new File(settingsDir, '../../../cocos/platform/android/libcocos2dx') +include ':performance-tests' +project(':performance-tests').projectDir = new File(settingsDir, 'app') diff --git a/tests/performance-tests/proj.android/.classpath b/tests/performance-tests/proj.android/.classpath new file mode 100644 index 0000000000..d57ec02513 --- /dev/null +++ b/tests/performance-tests/proj.android/.classpath @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/tests/performance-tests/proj.android/.project b/tests/performance-tests/proj.android/.project new file mode 100644 index 0000000000..5e14e854a7 --- /dev/null +++ b/tests/performance-tests/proj.android/.project @@ -0,0 +1,71 @@ + + + performance-tests + + + libcocos2dx + + + + com.android.ide.eclipse.adt.ResourceManagerBuilder + + + + + com.android.ide.eclipse.adt.PreCompilerBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.ui.externaltools.ExternalToolBuilder + full,incremental, + + + LaunchConfigHandle + <project>/.externalToolBuilders/org.eclipse.cdt.managedbuilder.core.genmakebuilder.launch + + + + + com.android.ide.eclipse.adt.ApkBuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + com.android.ide.eclipse.adt.AndroidNature + org.eclipse.jdt.core.javanature + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + Classes + 2 + $%7BPARENT-1-PROJECT_LOC%7D/Classes + + + cocos2d + 2 + $%7BPARENT-1-PROJECT_LOC%7D/cocos2d + + + libcocos2d + 2 + PARENT-1-PROJECT_LOC/cocos2d/cocos/platform/android/java/src + + + diff --git a/tests/performance-tests/proj.android/AndroidManifest.xml b/tests/performance-tests/proj.android/AndroidManifest.xml new file mode 100644 index 0000000000..fbdd4178eb --- /dev/null +++ b/tests/performance-tests/proj.android/AndroidManifest.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/performance-tests/proj.android/ant.properties b/tests/performance-tests/proj.android/ant.properties new file mode 100644 index 0000000000..b0971e891e --- /dev/null +++ b/tests/performance-tests/proj.android/ant.properties @@ -0,0 +1,17 @@ +# This file is used to override default values used by the Ant build system. +# +# This file must be checked into Version Control Systems, as it is +# integral to the build system of your project. + +# This file is only used by the Ant script. + +# You can use this to override default values such as +# 'source.dir' for the location of your java source folder and +# 'out.dir' for the location of your output folder. + +# You can also use it define how the release builds are signed by declaring +# the following properties: +# 'key.store' for the location of your keystore and +# 'key.alias' for the name of the key to use. +# The password will be asked during the build when you use the 'release' target. + diff --git a/tests/performance-tests/proj.android/build-cfg.json b/tests/performance-tests/proj.android/build-cfg.json new file mode 100644 index 0000000000..732443b304 --- /dev/null +++ b/tests/performance-tests/proj.android/build-cfg.json @@ -0,0 +1,13 @@ +{ + "ndk_module_path" :[ + "../../..", + "../../../cocos", + "../../../external" + ], + "copy_resources": [ + { + "from": "../Resources", + "to": "" + } + ] +} diff --git a/tests/performance-tests/proj.android/build.xml b/tests/performance-tests/proj.android/build.xml new file mode 100644 index 0000000000..d365b75f48 --- /dev/null +++ b/tests/performance-tests/proj.android/build.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/performance-tests/proj.android/jni/Android.mk b/tests/performance-tests/proj.android/jni/Android.mk new file mode 100644 index 0000000000..1635a48031 --- /dev/null +++ b/tests/performance-tests/proj.android/jni/Android.mk @@ -0,0 +1,46 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_MODULE := cocos2dcpp_shared + +LOCAL_MODULE_FILENAME := libcocos2dcpp + +LOCAL_SRC_FILES := hellocpp/main.cpp \ + ../../Classes/AppDelegate.cpp \ + ../../Classes/Profile.cpp \ + ../../Classes/tests/BaseTest.cpp \ + ../../Classes/tests/PerformanceParticle3DTest.cpp \ + ../../Classes/tests/PerformanceAllocTest.cpp \ + ../../Classes/tests/PerformanceParticleTest.cpp \ + ../../Classes/tests/PerformanceCallbackTest.cpp \ + ../../Classes/tests/PerformanceScenarioTest.cpp \ + ../../Classes/tests/PerformanceContainerTest.cpp \ + ../../Classes/tests/PerformanceSpriteTest.cpp \ + ../../Classes/tests/PerformanceEventDispatcherTest.cpp \ + ../../Classes/tests/PerformanceTextureTest.cpp \ + ../../Classes/tests/PerformanceLabelTest.cpp \ + ../../Classes/tests/VisibleRect.cpp \ + ../../Classes/tests/PerformanceMathTest.cpp \ + ../../Classes/tests/controller.cpp \ + ../../Classes/tests/PerformanceNodeChildrenTest.cpp + +LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes \ + $(LOCAL_PATH)/../../Classes/tests + +# _COCOS_HEADER_ANDROID_BEGIN +# _COCOS_HEADER_ANDROID_END + + +LOCAL_STATIC_LIBRARIES := cocos2dx_static +LOCAL_WHOLE_STATIC_LIBRARIES := cocos3d_static + +# _COCOS_LIB_ANDROID_BEGIN +# _COCOS_LIB_ANDROID_END + +include $(BUILD_SHARED_LIBRARY) + +$(call import-module, cocos) + +# _COCOS_LIB_IMPORT_ANDROID_BEGIN +# _COCOS_LIB_IMPORT_ANDROID_END diff --git a/tests/performance-tests/proj.android/jni/Application.mk b/tests/performance-tests/proj.android/jni/Application.mk new file mode 100644 index 0000000000..07aa592b13 --- /dev/null +++ b/tests/performance-tests/proj.android/jni/Application.mk @@ -0,0 +1,13 @@ +APP_STL := gnustl_static + +APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char +APP_LDFLAGS := -latomic + + +ifeq ($(NDK_DEBUG),1) + APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 + APP_OPTIM := debug +else + APP_CPPFLAGS += -DNDEBUG + APP_OPTIM := release +endif diff --git a/tests/performance-tests/proj.android/jni/hellocpp/main.cpp b/tests/performance-tests/proj.android/jni/hellocpp/main.cpp new file mode 100644 index 0000000000..2c27096ca3 --- /dev/null +++ b/tests/performance-tests/proj.android/jni/hellocpp/main.cpp @@ -0,0 +1,15 @@ +#include "AppDelegate.h" +#include "cocos2d.h" +#include "platform/android/jni/JniHelper.h" +#include +#include + +#define LOG_TAG "main" +#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__) + +using namespace cocos2d; + +void cocos_android_app_init (JNIEnv* env) { + LOGD("cocos_android_app_init"); + AppDelegate *pAppDelegate = new AppDelegate(); +} diff --git a/tests/performance-tests/proj.android/proguard-project.txt b/tests/performance-tests/proj.android/proguard-project.txt new file mode 100644 index 0000000000..f2fe1559a2 --- /dev/null +++ b/tests/performance-tests/proj.android/proguard-project.txt @@ -0,0 +1,20 @@ +# To enable ProGuard in your project, edit project.properties +# to define the proguard.config property as described in that file. +# +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in ${sdk.dir}/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the ProGuard +# include property in project.properties. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/tests/performance-tests/proj.android/project.properties b/tests/performance-tests/proj.android/project.properties new file mode 100644 index 0000000000..572f7c30de --- /dev/null +++ b/tests/performance-tests/proj.android/project.properties @@ -0,0 +1,13 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system use, +# "ant.properties", and override values to adapt the script to your +# project structure. + +# Project target. +target=android-10 + +android.library.reference.1=../../../cocos/platform/android/java diff --git a/tests/performance-tests/proj.android/res/drawable-hdpi/icon.png b/tests/performance-tests/proj.android/res/drawable-hdpi/icon.png new file mode 100644 index 0000000000..8aa4767c2f Binary files /dev/null and b/tests/performance-tests/proj.android/res/drawable-hdpi/icon.png differ diff --git a/tests/performance-tests/proj.android/res/drawable-ldpi/icon.png b/tests/performance-tests/proj.android/res/drawable-ldpi/icon.png new file mode 100644 index 0000000000..17ce11a085 Binary files /dev/null and b/tests/performance-tests/proj.android/res/drawable-ldpi/icon.png differ diff --git a/tests/performance-tests/proj.android/res/drawable-mdpi/icon.png b/tests/performance-tests/proj.android/res/drawable-mdpi/icon.png new file mode 100644 index 0000000000..3780aac46c Binary files /dev/null and b/tests/performance-tests/proj.android/res/drawable-mdpi/icon.png differ diff --git a/tests/performance-tests/proj.android/res/values/strings.xml b/tests/performance-tests/proj.android/res/values/strings.xml new file mode 100644 index 0000000000..cac3a6eaea --- /dev/null +++ b/tests/performance-tests/proj.android/res/values/strings.xml @@ -0,0 +1,4 @@ + + + PerformanceTests + diff --git a/tests/performance-tests/proj.android/src/org/cocos2dx/cpp/AppActivity.java b/tests/performance-tests/proj.android/src/org/cocos2dx/cpp/AppActivity.java new file mode 100644 index 0000000000..d757972356 --- /dev/null +++ b/tests/performance-tests/proj.android/src/org/cocos2dx/cpp/AppActivity.java @@ -0,0 +1,32 @@ +/**************************************************************************** +Copyright (c) 2008-2010 Ricardo Quesada +Copyright (c) 2010-2012 cocos2d-x.org +Copyright (c) 2011 Zynga Inc. +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. +****************************************************************************/ +package org.cocos2dx.cpp; + +import org.cocos2dx.lib.Cocos2dxActivity; + +public class AppActivity extends Cocos2dxActivity { +} diff --git a/tests/performance-tests/proj.ios/AppController.h b/tests/performance-tests/proj.ios/AppController.h new file mode 100644 index 0000000000..978e6e36c4 --- /dev/null +++ b/tests/performance-tests/proj.ios/AppController.h @@ -0,0 +1,12 @@ +#import + +@class RootViewController; + +@interface AppController : NSObject { + UIWindow *window; +} + +@property(nonatomic, readonly) RootViewController* viewController; + +@end + diff --git a/tests/performance-tests/proj.ios/AppController.mm b/tests/performance-tests/proj.ios/AppController.mm new file mode 100644 index 0000000000..4bb313aa66 --- /dev/null +++ b/tests/performance-tests/proj.ios/AppController.mm @@ -0,0 +1,149 @@ +/**************************************************************************** + Copyright (c) 2010 cocos2d-x.org + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#import "AppController.h" +#import "platform/ios/CCEAGLView-ios.h" +#import "cocos2d.h" +#import "AppDelegate.h" +#import "RootViewController.h" + +@implementation AppController + +#pragma mark - +#pragma mark Application lifecycle + +// cocos2d application instance +static AppDelegate s_sharedApplication; + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + + cocos2d::Application *app = cocos2d::Application::getInstance(); + app->initGLContextAttrs(); + cocos2d::GLViewImpl::convertAttrs(); + + // Override point for customization after application launch. + + // Add the view controller's view to the window and display. + window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]]; + + // Init the CCEAGLView + CCEAGLView *eaglView = [CCEAGLView viewWithFrame: [window bounds] + pixelFormat: (NSString*)cocos2d::GLViewImpl::_pixelFormat + depthFormat: cocos2d::GLViewImpl::_depthFormat + preserveBackbuffer: NO + sharegroup: nil + multiSampling: NO + numberOfSamples: 0 ]; + + // Enable or disable multiple touches + [eaglView setMultipleTouchEnabled:NO]; + + // Use RootViewController manage CCEAGLView + _viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil]; + _viewController.wantsFullScreenLayout = YES; + _viewController.view = eaglView; + + // Set RootViewController to window + if ( [[UIDevice currentDevice].systemVersion floatValue] < 6.0) + { + // warning: addSubView doesn't work on iOS6 + [window addSubview: _viewController.view]; + } + else + { + // use this method on ios6 + [window setRootViewController:_viewController]; + } + + [window makeKeyAndVisible]; + + [[UIApplication sharedApplication] setStatusBarHidden:true]; + + // IMPORTANT: Setting the GLView should be done after creating the RootViewController + cocos2d::GLView *glview = cocos2d::GLViewImpl::createWithEAGLView(eaglView); + cocos2d::Director::getInstance()->setOpenGLView(glview); + + app->run(); + + return YES; +} + + +- (void)applicationWillResignActive:(UIApplication *)application { + /* + Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. + */ + //We don't need to call this method any more. It will interupt user defined game pause&resume logic + /* cocos2d::Director::getInstance()->pause(); */ +} + +- (void)applicationDidBecomeActive:(UIApplication *)application { + /* + Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. + */ + //We don't need to call this method any more. It will interupt user defined game pause&resume logic + /* cocos2d::Director::getInstance()->resume(); */ +} + +- (void)applicationDidEnterBackground:(UIApplication *)application { + /* + Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + If your application supports background execution, called instead of applicationWillTerminate: when the user quits. + */ + cocos2d::Application::getInstance()->applicationDidEnterBackground(); +} + +- (void)applicationWillEnterForeground:(UIApplication *)application { + /* + Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background. + */ + cocos2d::Application::getInstance()->applicationWillEnterForeground(); +} + +- (void)applicationWillTerminate:(UIApplication *)application { + /* + Called when the application is about to terminate. + See also applicationDidEnterBackground:. + */ +} + + +#pragma mark - +#pragma mark Memory management + +- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application { + /* + Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later. + */ +} + + +- (void)dealloc { + [window release]; + [super dealloc]; +} + + +@end diff --git a/tests/performance-tests/proj.ios/Default-568h@2x.png b/tests/performance-tests/proj.ios/Default-568h@2x.png new file mode 100644 index 0000000000..66c6d1cead Binary files /dev/null and b/tests/performance-tests/proj.ios/Default-568h@2x.png differ diff --git a/tests/performance-tests/proj.ios/Default-667h@2x.png b/tests/performance-tests/proj.ios/Default-667h@2x.png new file mode 100644 index 0000000000..a0f61ec8e6 Binary files /dev/null and b/tests/performance-tests/proj.ios/Default-667h@2x.png differ diff --git a/tests/performance-tests/proj.ios/Default-736h@3x.png b/tests/performance-tests/proj.ios/Default-736h@3x.png new file mode 100644 index 0000000000..dadccee686 Binary files /dev/null and b/tests/performance-tests/proj.ios/Default-736h@3x.png differ diff --git a/tests/performance-tests/proj.ios/Default.png b/tests/performance-tests/proj.ios/Default.png new file mode 100644 index 0000000000..dcb80725de Binary files /dev/null and b/tests/performance-tests/proj.ios/Default.png differ diff --git a/tests/performance-tests/proj.ios/Default@2x.png b/tests/performance-tests/proj.ios/Default@2x.png new file mode 100644 index 0000000000..84689888a1 Binary files /dev/null and b/tests/performance-tests/proj.ios/Default@2x.png differ diff --git a/tests/performance-tests/proj.ios/Icon-100.png b/tests/performance-tests/proj.ios/Icon-100.png new file mode 100644 index 0000000000..ef38d4500a Binary files /dev/null and b/tests/performance-tests/proj.ios/Icon-100.png differ diff --git a/tests/performance-tests/proj.ios/Icon-114.png b/tests/performance-tests/proj.ios/Icon-114.png new file mode 100644 index 0000000000..c3807861ad Binary files /dev/null and b/tests/performance-tests/proj.ios/Icon-114.png differ diff --git a/tests/performance-tests/proj.ios/Icon-120.png b/tests/performance-tests/proj.ios/Icon-120.png new file mode 100644 index 0000000000..a5b49ccbb1 Binary files /dev/null and b/tests/performance-tests/proj.ios/Icon-120.png differ diff --git a/tests/performance-tests/proj.ios/Icon-144.png b/tests/performance-tests/proj.ios/Icon-144.png new file mode 100644 index 0000000000..1526615c02 Binary files /dev/null and b/tests/performance-tests/proj.ios/Icon-144.png differ diff --git a/tests/performance-tests/proj.ios/Icon-152.png b/tests/performance-tests/proj.ios/Icon-152.png new file mode 100644 index 0000000000..8aa82506d0 Binary files /dev/null and b/tests/performance-tests/proj.ios/Icon-152.png differ diff --git a/tests/performance-tests/proj.ios/Icon-29.png b/tests/performance-tests/proj.ios/Icon-29.png new file mode 100644 index 0000000000..0500184c86 Binary files /dev/null and b/tests/performance-tests/proj.ios/Icon-29.png differ diff --git a/tests/performance-tests/proj.ios/Icon-40.png b/tests/performance-tests/proj.ios/Icon-40.png new file mode 100644 index 0000000000..775685daca Binary files /dev/null and b/tests/performance-tests/proj.ios/Icon-40.png differ diff --git a/tests/performance-tests/proj.ios/Icon-50.png b/tests/performance-tests/proj.ios/Icon-50.png new file mode 100644 index 0000000000..ac381bc20e Binary files /dev/null and b/tests/performance-tests/proj.ios/Icon-50.png differ diff --git a/tests/performance-tests/proj.ios/Icon-57.png b/tests/performance-tests/proj.ios/Icon-57.png new file mode 100644 index 0000000000..4fcc6fddff Binary files /dev/null and b/tests/performance-tests/proj.ios/Icon-57.png differ diff --git a/tests/performance-tests/proj.ios/Icon-58.png b/tests/performance-tests/proj.ios/Icon-58.png new file mode 100644 index 0000000000..f0f8b7fe98 Binary files /dev/null and b/tests/performance-tests/proj.ios/Icon-58.png differ diff --git a/tests/performance-tests/proj.ios/Icon-72.png b/tests/performance-tests/proj.ios/Icon-72.png new file mode 100644 index 0000000000..2c573c8df4 Binary files /dev/null and b/tests/performance-tests/proj.ios/Icon-72.png differ diff --git a/tests/performance-tests/proj.ios/Icon-76.png b/tests/performance-tests/proj.ios/Icon-76.png new file mode 100644 index 0000000000..8a1fa1850c Binary files /dev/null and b/tests/performance-tests/proj.ios/Icon-76.png differ diff --git a/tests/performance-tests/proj.ios/Icon-80.png b/tests/performance-tests/proj.ios/Icon-80.png new file mode 100644 index 0000000000..d9c7ab446b Binary files /dev/null and b/tests/performance-tests/proj.ios/Icon-80.png differ diff --git a/tests/performance-tests/proj.ios/Info.plist b/tests/performance-tests/proj.ios/Info.plist new file mode 100644 index 0000000000..94fed7c6da --- /dev/null +++ b/tests/performance-tests/proj.ios/Info.plist @@ -0,0 +1,155 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleDisplayName + ${PRODUCT_NAME} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + Icon-57.png + CFBundleIconFiles + + Icon-29 + Icon-80 + Icon-58 + Icon-120 + Icon.png + Icon@2x.png + Icon-57.png + Icon-114.png + Icon-72.png + Icon-144.png + + CFBundleIconFiles~ipad + + Icon-29 + Icon-50 + Icon-58 + Icon-80 + Icon-40 + Icon-100 + Icon-152 + Icon-76 + Icon-120 + Icon.png + Icon@2x.png + Icon-57.png + Icon-114.png + Icon-72.png + Icon-144.png + + CFBundleIdentifier + org.cocos2dx.performance-tests + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + + CFBundleSignature + ???? + CFBundleVersion + 1.0 + UILaunchImages + + + UILaunchImageMinimumOSVersion + 8.0 + UILaunchImageName + Default + UILaunchImageOrientation + Portrait + UILaunchImageSize + {320, 480} + + + UILaunchImageMinimumOSVersion + 8.0 + UILaunchImageName + Default + UILaunchImageOrientation + Landscape + UILaunchImageSize + {320, 480} + + + UILaunchImageMinimumOSVersion + 8.0 + UILaunchImageName + Default-568h + UILaunchImageOrientation + Portrait + UILaunchImageSize + {320, 568} + + + UILaunchImageMinimumOSVersion + 8.0 + UILaunchImageName + Default-568h + UILaunchImageOrientation + Landscape + UILaunchImageSize + {320, 568} + + + UILaunchImageMinimumOSVersion + 8.0 + UILaunchImageName + Default-667h + UILaunchImageOrientation + Portrait + UILaunchImageSize + {375, 667} + + + UILaunchImageMinimumOSVersion + 8.0 + UILaunchImageName + Default-667h + UILaunchImageOrientation + Landscape + UILaunchImageSize + {375, 667} + + + UILaunchImageMinimumOSVersion + 8.0 + UILaunchImageName + Default-736h + UILaunchImageOrientation + Portrait + UILaunchImageSize + {414, 736} + + + UILaunchImageMinimumOSVersion + 8.0 + UILaunchImageName + Default-736h + UILaunchImageOrientation + Landscape + UILaunchImageSize + {414, 736} + + + LSRequiresIPhoneOS + + UIAppFonts + + UIPrerenderedIcon + + UISupportedInterfaceOrientations + + UIInterfaceOrientationLandscapeRight + UIInterfaceOrientationLandscapeLeft + + UIFileSharingEnabled + + + diff --git a/tests/performance-tests/proj.ios/Prefix.pch b/tests/performance-tests/proj.ios/Prefix.pch new file mode 100644 index 0000000000..3da08ad7ff --- /dev/null +++ b/tests/performance-tests/proj.ios/Prefix.pch @@ -0,0 +1,12 @@ +// +// Prefix header for all source files of the 'iphone' target in the 'iphone' project +// + +#ifdef __OBJC__ + #import + #import +#endif + +#ifdef __cplusplus + #include "cocos2d.h" +#endif \ No newline at end of file diff --git a/tests/performance-tests/proj.ios/RootViewController.h b/tests/performance-tests/proj.ios/RootViewController.h new file mode 100644 index 0000000000..a1669019e2 --- /dev/null +++ b/tests/performance-tests/proj.ios/RootViewController.h @@ -0,0 +1,34 @@ +/**************************************************************************** + Copyright (c) 2013 cocos2d-x.org + 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. + ****************************************************************************/ + +#import + + +@interface RootViewController : UIViewController { + +} +- (BOOL) prefersStatusBarHidden; + +@end diff --git a/tests/performance-tests/proj.ios/RootViewController.mm b/tests/performance-tests/proj.ios/RootViewController.mm new file mode 100644 index 0000000000..c4989af5fa --- /dev/null +++ b/tests/performance-tests/proj.ios/RootViewController.mm @@ -0,0 +1,114 @@ +/**************************************************************************** + Copyright (c) 2013 cocos2d-x.org + 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. + ****************************************************************************/ + +#import "RootViewController.h" +#import "cocos2d.h" +#import "platform/ios/CCEAGLView-ios.h" + +@implementation RootViewController + +/* + // The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad. +- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { + if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { + // Custom initialization + } + return self; +} +*/ + +/* +// Implement loadView to create a view hierarchy programmatically, without using a nib. +- (void)loadView { +} +*/ + +/* +// Implement viewDidLoad to do additional setup after loading the view, typically from a nib. +- (void)viewDidLoad { + [super viewDidLoad]; +} + +*/ +// Override to allow orientations other than the default portrait orientation. +// This method is deprecated on ios6 +- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { + return UIInterfaceOrientationIsLandscape( interfaceOrientation ); +} + +// For ios6, use supportedInterfaceOrientations & shouldAutorotate instead +- (NSUInteger) supportedInterfaceOrientations{ +#ifdef __IPHONE_6_0 + return UIInterfaceOrientationMaskAllButUpsideDown; +#endif +} + +- (BOOL) shouldAutorotate { + return YES; +} + +- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { + [super didRotateFromInterfaceOrientation:fromInterfaceOrientation]; + + auto glview = cocos2d::Director::getInstance()->getOpenGLView(); + + if (glview) + { + CCEAGLView *eaglview = (CCEAGLView*) glview->getEAGLView(); + + if (eaglview) + { + CGSize s = CGSizeMake([eaglview getWidth], [eaglview getHeight]); + cocos2d::Application::getInstance()->applicationScreenSizeChanged((int) s.width, (int) s.height); + } + } +} + +//fix not hide status on ios7 +- (BOOL)prefersStatusBarHidden +{ + return YES; +} + +- (void)didReceiveMemoryWarning { + // Releases the view if it doesn't have a superview. + [super didReceiveMemoryWarning]; + + // Release any cached data, images, etc that aren't in use. +} + +- (void)viewDidUnload { + [super viewDidUnload]; + // Release any retained subviews of the main view. + // e.g. self.myOutlet = nil; +} + + +- (void)dealloc { + [super dealloc]; +} + + +@end diff --git a/tests/performance-tests/proj.ios/main.m b/tests/performance-tests/proj.ios/main.m new file mode 100644 index 0000000000..8daa43e017 --- /dev/null +++ b/tests/performance-tests/proj.ios/main.m @@ -0,0 +1,9 @@ +#import + +int main(int argc, char *argv[]) { + + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; + int retVal = UIApplicationMain(argc, argv, nil, @"AppController"); + [pool release]; + return retVal; +} diff --git a/tests/performance-tests/proj.mac/Icon.icns b/tests/performance-tests/proj.mac/Icon.icns new file mode 100644 index 0000000000..2040fc6fe6 Binary files /dev/null and b/tests/performance-tests/proj.mac/Icon.icns differ diff --git a/tests/performance-tests/proj.mac/Info.plist b/tests/performance-tests/proj.mac/Info.plist new file mode 100644 index 0000000000..e2439bd321 --- /dev/null +++ b/tests/performance-tests/proj.mac/Info.plist @@ -0,0 +1,36 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + Icon + CFBundleIdentifier + org.cocos2dx.performance-tests + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSApplicationCategoryType + public.app-category.games + LSMinimumSystemVersion + ${MACOSX_DEPLOYMENT_TARGET} + NSHumanReadableCopyright + Copyright © 2013. All rights reserved. + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/tests/performance-tests/proj.mac/Prefix.pch b/tests/performance-tests/proj.mac/Prefix.pch new file mode 100644 index 0000000000..aa71e76645 --- /dev/null +++ b/tests/performance-tests/proj.mac/Prefix.pch @@ -0,0 +1,11 @@ +// +// Prefix header for all source files of the 'Paralaxer' target in the 'Paralaxer' project +// + +#ifdef __OBJC__ + #import +#endif + +#ifdef __cplusplus + #include "cocos2d.h" +#endif \ No newline at end of file diff --git a/tests/performance-tests/proj.mac/main.cpp b/tests/performance-tests/proj.mac/main.cpp new file mode 100644 index 0000000000..96f027e13d --- /dev/null +++ b/tests/performance-tests/proj.mac/main.cpp @@ -0,0 +1,34 @@ +/**************************************************************************** + Copyright (c) 2010 cocos2d-x.org + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#include "AppDelegate.h" +#include "cocos2d.h" + +USING_NS_CC; + +int main(int argc, char *argv[]) +{ + AppDelegate app; + return Application::getInstance()->run(); +} diff --git a/tests/performance-tests/proj.win32/build-cfg.json b/tests/performance-tests/proj.win32/build-cfg.json new file mode 100644 index 0000000000..aae4d7a054 --- /dev/null +++ b/tests/performance-tests/proj.win32/build-cfg.json @@ -0,0 +1,8 @@ +{ + "copy_resources": [ + { + "from": "../Resources", + "to": "" + } + ] +} diff --git a/tests/performance-tests/proj.win32/game.rc b/tests/performance-tests/proj.win32/game.rc new file mode 100644 index 0000000000..1e0a2a0da2 --- /dev/null +++ b/tests/performance-tests/proj.win32/game.rc @@ -0,0 +1,86 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +#endif // APSTUDIO_INVOKED + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +GLFW_ICON ICON "res\\game.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "\0" + VALUE "FileDescription", "game Module\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "game\0" + VALUE "LegalCopyright", "Copyright \0" + VALUE "OriginalFilename", "game.exe\0" + VALUE "ProductName", "game Module\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 0x04B0 + END +END + +///////////////////////////////////////////////////////////////////////////// +#endif // !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) diff --git a/tests/performance-tests/proj.win32/main.cpp b/tests/performance-tests/proj.win32/main.cpp new file mode 100644 index 0000000000..61ae71ffc2 --- /dev/null +++ b/tests/performance-tests/proj.win32/main.cpp @@ -0,0 +1,18 @@ +#include "main.h" +#include "AppDelegate.h" +#include "cocos2d.h" + +USING_NS_CC; + +int APIENTRY _tWinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPTSTR lpCmdLine, + int nCmdShow) +{ + UNREFERENCED_PARAMETER(hPrevInstance); + UNREFERENCED_PARAMETER(lpCmdLine); + + // create the application instance + AppDelegate app; + return Application::getInstance()->run(); +} diff --git a/tests/performance-tests/proj.win32/main.h b/tests/performance-tests/proj.win32/main.h new file mode 100644 index 0000000000..e74708bdf2 --- /dev/null +++ b/tests/performance-tests/proj.win32/main.h @@ -0,0 +1,13 @@ +#ifndef __MAIN_H__ +#define __MAIN_H__ + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +// Windows Header Files: +#include +#include + +// C RunTime Header Files +#include "CCStdC.h" + +#endif // __MAIN_H__ diff --git a/tests/performance-tests/proj.win32/performance-tests.vcxproj b/tests/performance-tests/proj.win32/performance-tests.vcxproj new file mode 100644 index 0000000000..bb037c5a25 --- /dev/null +++ b/tests/performance-tests/proj.win32/performance-tests.vcxproj @@ -0,0 +1,201 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {2778C02D-DDD0-4A92-A6AA-C3E2B7EDE3FF} + test_win32 + Win32Proj + + + + Application + Unicode + true + v120 + v120_xp + v140 + v140_xp + + + Application + Unicode + v120 + v120_xp + v140 + v140_xp + + + + + + + + + + + + + + + + + <_ProjectFileVersion>12.0.21005.1 + $(SolutionDir)$(Configuration).win32\ + $(Configuration).win32\ + true + $(SolutionDir)$(Configuration).win32\ + $(Configuration).win32\ + false + AllRules.ruleset + + + AllRules.ruleset + + + + + $(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\lib;$(LibraryPath) + + + $(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\lib;$(LibraryPath) + + + + Disabled + $(EngineRoot)cocos\audio\include;$(EngineRoot)external;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)extensions;$(EngineRoot);..\Classes;..\Classes\tests;..;%(AdditionalIncludeDirectories);$(_COCOS_HEADER_WIN32_BEGIN);$(_COCOS_HEADER_WIN32_END) + WIN32;_DEBUG;_WINDOWS;_USE_MATH_DEFINES;GL_GLEXT_PROTOTYPES;CC_ENABLE_CHIPMUNK_INTEGRATION=1;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + false + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + 4267;4251;4244;%(DisableSpecificWarnings) + true + + + %(AdditionalDependencies);$(_COCOS_LIB_WIN32_BEGIN);$(_COCOS_LIB_WIN32_END) + $(OutDir)$(ProjectName).exe + $(OutDir);%(AdditionalLibraryDirectories);$(_COCOS_LIB_PATH_WIN32_BEGIN);$(_COCOS_LIB_PATH_WIN32_END) + true + Windows + MachineX86 + + + + + + + + + + + + + if not exist "$(OutDir)" mkdir "$(OutDir)" +xcopy "$(ProjectDir)..\Resources" "$(OutDir)" /D /E /I /F /Y + + $(TargetName).cab + $(TargetFileName) + + + + + MaxSpeed + true + $(EngineRoot)cocos\audio\include;$(EngineRoot)external;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)extensions;$(EngineRoot);..\Classes;..\Classes\tests;..;%(AdditionalIncludeDirectories);$(_COCOS_HEADER_WIN32_BEGIN);$(_COCOS_HEADER_WIN32_END) + WIN32;NDEBUG;_WINDOWS;_USE_MATH_DEFINES;GL_GLEXT_PROTOTYPES;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + 4267;4251;4244;%(DisableSpecificWarnings) + true + + + libcurl_imp.lib;websockets.lib;%(AdditionalDependencies);$(_COCOS_LIB_WIN32_BEGIN);$(_COCOS_LIB_WIN32_END) + $(OutDir)$(ProjectName).exe + $(OutDir);%(AdditionalLibraryDirectories);$(_COCOS_LIB_PATH_WIN32_BEGIN);$(_COCOS_LIB_PATH_WIN32_END) + true + Windows + true + true + MachineX86 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {98a51ba8-fc3a-415b-ac8f-8c7bd464e93e} + false + + + + + + + + + \ No newline at end of file diff --git a/tests/performance-tests/proj.win32/performance-tests.vcxproj.filters b/tests/performance-tests/proj.win32/performance-tests.vcxproj.filters new file mode 100644 index 0000000000..63d352e9ce --- /dev/null +++ b/tests/performance-tests/proj.win32/performance-tests.vcxproj.filters @@ -0,0 +1,143 @@ + + + + + {84a8ebd7-7cf0-47f6-b75e-d441df67da40} + + + {715254bc-d70b-4ec5-bf29-467dd3ace079} + + + {bb6c862e-70e9-49d9-81b7-3829a6f50471} + + + {ebaec0f2-1dda-4fde-89cb-d7a47793f34a} + + + + + win32 + + + src + + + src + + + src\tests + + + src\tests + + + src\tests + + + src\tests + + + src\tests + + + src\tests + + + src\tests + + + src\tests + + + src\tests + + + src\tests + + + src\tests + + + src\tests + + + src\tests + + + src\tests + + + src\tests + + + + + win32 + + + src + + + src + + + src\tests + + + src\tests + + + src\tests + + + src\tests + + + src\tests + + + src\tests + + + src\tests + + + src\tests + + + src\tests + + + src\tests + + + src\tests + + + src\tests + + + src\tests + + + src\tests + + + src\tests + + + src\tests + + + src\tests + + + src\tests + + + + + resource + + + \ No newline at end of file diff --git a/tests/performance-tests/proj.win32/res/game.ico b/tests/performance-tests/proj.win32/res/game.ico new file mode 100644 index 0000000000..feaf932a74 Binary files /dev/null and b/tests/performance-tests/proj.win32/res/game.ico differ diff --git a/tests/performance-tests/proj.win32/resource.h b/tests/performance-tests/proj.win32/resource.h new file mode 100644 index 0000000000..376870ba13 --- /dev/null +++ b/tests/performance-tests/proj.win32/resource.h @@ -0,0 +1,20 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by game.RC +// + +#define IDS_PROJNAME 100 +#define IDR_TESTJS 100 + +#define ID_FILE_NEW_WINDOW 32771 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 201 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 32775 +#endif +#endif diff --git a/tools/performance-analyze/README.md b/tools/performance-analyze/README.md new file mode 100644 index 0000000000..7bf235c11b --- /dev/null +++ b/tools/performance-analyze/README.md @@ -0,0 +1,107 @@ +# Performance Test Data Convertor + +## Overview + +Performance Test Data Convertor is used for converting the json files to excel files. The json files are generated from project `tests/performance-tests`. + +## Requirement + +* Python 2.7 is required. (Python 2.7.5 is well tested) +* [xlwt](https://pypi.python.org/pypi/xlwt/) for python to write excel files. + +## Generate test data + +1. Change the device name in the tests source code. +Now you should modify the device name in `tests/performance-tests/Classes/Profile.cpp` before running the tests. Sample code: + + ``` + // For different device & os, change these values + // TODO : get device info automatically + #define DEVICE_NAME "TheDeviceName" + #define OS_VERSION "SystemVersion" + ``` + +2. Run the performance-tests project on devices. +Once the project started, you will see a scene like this: +![test-scene][test-scene.jpg] + +3. Click the menu `Start AutoTest`. Then the performance tests will running automatically. Once the scene stopped at the scene again. It's mean the autotesting is end. + +## Get the generated json files + +After the test data generated, you can get the json file from the device. +The json file will be named with format : `PerformanceLog-[DEVICE_NAME]-[TIMESTAMP].json`. + +For different OS, you can get the json files by different steps: + +### From iOS devices + +The json files will generated in the `Document` folder of the app. So you can get the json files by iTunes by steps: +![itunes][itunes.jpg] + +### From Android devices + +The json files will be generated in the path `/mnt/sdcard/PerfTest`. So you can get the json files by commands like this: + +* Windows System + + Run the command in cmd: + ``` + %ANDROID_SDK_ROOT%\platform-tools\adb pull /mnt/sdcard/PerfTest C:\Users\USER_NAME\MY_LOG_FOLDER + ``` + +* Mac System + + Run the command in terminal: + ``` + $ANDROID_SDK_ROOT/platform-tools/adb pull /mnt/sdcard/PerfTest ~/MY_LOG_FOLDER + ``` + +### From Mac devices + +The json files will be generated in the path `~/Document`. + +### From Win32 devices + +The json files will be generated in the AppData path. For different system versions, it will be different path. +The path will be `C:\Users\USER_NAME\AppData\Local\performance-tests` on Win8.1. + +## Convert json files to excel files + +When the json files are ready, you can convert the json files to excel files by `tools/performance-analyze/convertor.py`. +The usage of the tool: + +``` +usage: convertor.py [-h] -s SRC_PATH [-o OUTPUT_PATH] + +Performance test data convertor. + +optional arguments: + -h, --help show this help message and exit + -s SRC_PATH Specify the json file path or the folder path of json files. + -o OUTPUT_PATH Specify the output path of excel files. +``` + +Tips: + +* The value of `-s` can be a json file or a folder which contains many json files. If it's a folder, then the json files in the folder will be converted to excel files one by one. + + +* You can specify the output path by `-o`. If it's not specified, the excel files will be placed in the same folder of json files. + + +* Each json file will generate an excel file. The excel file name will be same with the json file. For example: +`python convertor.py -s PerformanceLog-iphone4s-2015-09-11-1745.json` will generate a `PerformanceLog-iphone4s-2015-09-11-1745.xls` file. + + +* The format of the excel file will be looks like this: + + ![excel format][excel.jpg] + + 1. Each sheet shows the result of a test case. + 2. The cells with GREEN background color are the conditions of the test case. + 3. The cells with YELLOW background color are the result data of the test case. + +[test-scene.jpg]: http://i60.tinypic.com/ou86bs.jpg +[itunes.jpg]: http://i60.tinypic.com/33z4r53.jpg +[excel.jpg]: http://i57.tinypic.com/wvx500.jpg \ No newline at end of file diff --git a/tools/performance-analyze/convertor.py b/tools/performance-analyze/convertor.py new file mode 100755 index 0000000000..b2637fb1b0 --- /dev/null +++ b/tools/performance-analyze/convertor.py @@ -0,0 +1,155 @@ +#!/usr/bin/python +#-*- coding: UTF-8 -*- +# ---------------------------------------------------------------------------- +# Convert the performance test result from json files to excel. +# +# Author: Bill Zhang +# +# License: MIT +# ---------------------------------------------------------------------------- +''' +Convert the performance test result from json files to excel. +''' + +import xlwt +import os +import json + +from argparse import ArgumentParser + +DEFAULT_STYLE = 'borders: left thin, right thin, top thin, bottom thin;' +CONDITION_STYLE = 'pattern: pattern solid, fore_color light_green;' +RESULT_STYLE = 'pattern: pattern solid, fore_color light_yellow;' + +BASE_KEYS = [ + 'osVersion', + 'fileVersion', + 'timeStamp', + 'engineVersion', + 'device' +] + +KEY_CONDITION_HEADERS = "conditionHeaders" +KEY_RESULT_HEADERS = "resultHeaders" +KEY_RESULTS = "results" + +START_COL_INDEX = 0 +START_ROW_INDEX = 0 + +class KnownException(Exception): + pass + +class Convertor: + + def __init__(self, src_path, output_path=None): + self.src_path = self.change_to_abspath(src_path) + if not os.path.exists(self.src_path): + raise KnownException('%s is not existed!' % self.src_path) + + if output_path is None: + # not specified output path, default use source path + if os.path.isfile(self.src_path): + self.output_path = os.path.dirname(self.src_path) + else: + self.output_path = self.src_path + else: + self.output_path = self.change_to_abspath(output_path) + + def change_to_abspath(self, path): + ret = os.path.expanduser(path) + if not os.path.isabs(ret): + ret = os.path.abspath(ret) + + ret = os.path.normpath(ret) + return ret + + def get_col_width(self, col_str): + return 256 * (len(col_str) + 1) + + def convert_file(self, file_path): + f = open(file_path) + testData = json.load(f) + f.close() + + basename, ext = os.path.splitext(os.path.basename(file_path)) + dst_file_path = os.path.join(self.output_path, "%s.xls" % basename) + if os.path.isfile(dst_file_path): + os.remove(dst_file_path) + + workbook = xlwt.Workbook(encoding = 'ascii') + + default_style = xlwt.Style.easyxf(DEFAULT_STYLE) + con_style = xlwt.Style.easyxf("%s%s" % (DEFAULT_STYLE, CONDITION_STYLE)) + ret_style = xlwt.Style.easyxf("%s%s" % (DEFAULT_STYLE, RESULT_STYLE)) + + for key in testData.keys(): + if key in BASE_KEYS: + continue + + # create a sheet for the test case + sheetObj = workbook.add_sheet(key) + + # get test case data + caseInfo = testData[key] + + # Add headers for the test case + condHeaders = caseInfo[KEY_CONDITION_HEADERS] + retHeaders = caseInfo[KEY_RESULT_HEADERS] + curRow = START_ROW_INDEX + curCol = START_COL_INDEX + + col_widths = {} + for header in (condHeaders + retHeaders): + sheetObj.write(curRow, curCol, header, default_style) + col_width = self.get_col_width(header) + col_widths[curCol] = col_width + sheetObj.col(curCol).width = col_width + curCol += 1 + + rets = caseInfo[KEY_RESULTS] + for retInfo in rets: + curRow += 1 + curCol = START_COL_INDEX + for ret in retInfo: + if (curCol - START_COL_INDEX) < len(condHeaders): + use_style = con_style + else: + use_style = ret_style + sheetObj.write(curRow, curCol, ret, use_style) + new_width = self.get_col_width(ret) + old_width = col_widths[curCol] + if new_width > old_width: + sheetObj.col(curCol).width = new_width + col_widths[curCol] = new_width + curCol += 1 + + workbook.save(dst_file_path) + print("%s is generated." % dst_file_path) + + def do_convert(self): + if not os.path.exists(self.output_path): + os.makedirs(self.output_path) + + if os.path.isfile(self.src_path): + self.convert_file(self.src_path) + else: + for f in os.listdir(self.src_path): + full_path = os.path.join(self.src_path, f) + ignore, ext = os.path.splitext(f) + if os.path.isfile(full_path) and ext == '.json': + self.convert_file(full_path) + +if __name__ == '__main__': + parser = ArgumentParser(description="Performance test data convertor.") + parser.add_argument('-s', dest='src_path', required=True, help='Specify the json file path or the folder path of json files.') + parser.add_argument('-o', dest='output_path', help='Specify the output path of excel files.') + (args, unknown) = parser.parse_known_args() + + try: + convertor = Convertor(args.src_path, args.output_path) + convertor.do_convert() + except Exception as e: + if e.__class__.__name__ == "KnownException": + print(' '.join(e.args)) + else: + raise diff --git a/tools/simulator/frameworks/runtime-src/proj.ios_mac/mac/SimulatorApp.mm b/tools/simulator/frameworks/runtime-src/proj.ios_mac/mac/SimulatorApp.mm index 6d91ad8139..67470ca27f 100755 --- a/tools/simulator/frameworks/runtime-src/proj.ios_mac/mac/SimulatorApp.mm +++ b/tools/simulator/frameworks/runtime-src/proj.ios_mac/mac/SimulatorApp.mm @@ -204,11 +204,35 @@ static void glfwDropFunc(GLFWwindow *window, int count, const char **files) } // set project directory as search root path - FileUtils::getInstance()->setDefaultResourceRootPath(tmpConfig.getProjectDir()); - + string solutionDir = tmpConfig.getProjectDir(); + if (!solutionDir.empty()) + { + for (int i = 0; i < solutionDir.size(); ++i) + { + if (solutionDir[i] == '\\') + { + solutionDir[i] = '/'; + } + } + int nPos = -1; + if (solutionDir[solutionDir.length() - 1] == '/') + nPos = solutionDir.rfind('/', solutionDir.length() - 2); + else + nPos = solutionDir.rfind('/'); + if (nPos > 0) + solutionDir = solutionDir.substr(0, nPos + 1); + FileUtils::getInstance()->setDefaultResourceRootPath(solutionDir); + FileUtils::getInstance()->addSearchPath(solutionDir); + FileUtils::getInstance()->addSearchPath(tmpConfig.getProjectDir()); + } + else + { + FileUtils::getInstance()->setDefaultResourceRootPath(tmpConfig.getProjectDir()); + } + // parse config.json auto parser = ConfigParser::getInstance(); - auto configPath = tmpConfig.getProjectDir().append(CONFIG_FILE); + auto configPath = solutionDir.append(CONFIG_FILE); parser->readConfig(configPath); // set information diff --git a/tools/simulator/frameworks/runtime-src/proj.win32/SimulatorWin.cpp b/tools/simulator/frameworks/runtime-src/proj.win32/SimulatorWin.cpp index 16bf32bb20..45086dfe2d 100644 --- a/tools/simulator/frameworks/runtime-src/proj.win32/SimulatorWin.cpp +++ b/tools/simulator/frameworks/runtime-src/proj.win32/SimulatorWin.cpp @@ -719,11 +719,35 @@ void SimulatorWin::parseCocosProjectConfig(ProjectConfig &config) } // set project directory as search root path - FileUtils::getInstance()->setDefaultResourceRootPath(tmpConfig.getProjectDir().c_str()); + string solutionDir = tmpConfig.getProjectDir(); + if (!solutionDir.empty()) + { + for (int i = 0; i < solutionDir.size(); ++i) + { + if (solutionDir[i] == '\\') + { + solutionDir[i] = '/'; + } + } + int nPos = -1; + if (solutionDir[solutionDir.length() - 1] == '/') + nPos = solutionDir.rfind('/', solutionDir.length() - 2); + else + nPos = solutionDir.rfind('/'); + if (nPos > 0) + solutionDir = solutionDir.substr(0, nPos + 1); + FileUtils::getInstance()->setDefaultResourceRootPath(solutionDir); + FileUtils::getInstance()->addSearchPath(solutionDir); + FileUtils::getInstance()->addSearchPath(tmpConfig.getProjectDir().c_str()); + } + else + { + FileUtils::getInstance()->setDefaultResourceRootPath(tmpConfig.getProjectDir().c_str()); + } // parse config.json auto parser = ConfigParser::getInstance(); - auto configPath = tmpConfig.getProjectDir().append(CONFIG_FILE); + auto configPath = solutionDir.append(CONFIG_FILE); parser->readConfig(configPath); // set information diff --git a/tools/simulator/frameworks/runtime-src/proj.win32/game.rc b/tools/simulator/frameworks/runtime-src/proj.win32/game.rc index ee1ca41456..4733633d7b 100755 --- a/tools/simulator/frameworks/runtime-src/proj.win32/game.rc +++ b/tools/simulator/frameworks/runtime-src/proj.win32/game.rc @@ -64,7 +64,7 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSM CAPTION "About Simulator" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - CTEXT "Version 3.7 (20150227)",IDC_ABOUT_VERSION,35,70,173,17 + CTEXT "Version 3.8 (20150227)",IDC_ABOUT_VERSION,35,70,173,17 CTEXT "Cocos Simulator",IDC_ABOUT_TITLE,35,49,173,17 CTEXT "Copyright (C) 2015. All rights reserved.",IDC_STATIC,35,94,173,17 ICON "GLFW_ICON",IDC_STATIC,111,15,20,20 diff --git a/tools/tojs/cocos2dx.ini b/tools/tojs/cocos2dx.ini index 612e9e6aa8..c1500ee27a 100644 --- a/tools/tojs/cocos2dx.ini +++ b/tools/tojs/cocos2dx.ini @@ -29,7 +29,7 @@ headers = %(cocosdir)s/cocos/cocos2d.h %(cocosdir)s/cocos/audio/include/SimpleAu classes = New.* Sprite SpriteBatchNode SpriteFrame SpriteFrameCache Scene Node.* Director Layer.* Menu.* Touch .*Action.* Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Transition.* Spawn ReverseTime Animate AnimationFrame Animation AnimationCache Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* PointArray ToggleVisibility.* RemoveSelf Hide Particle.* Label.* Atlas.* TextureCache.* Texture2D Cardinal.* CatmullRom.* ParallaxNode TileMap.* TMX.* CallFunc CallFuncN RenderTexture GridAction Grid3DAction Grid3D TiledGrid3D GridBase$ .+Grid Shaky3D Waves3D FlipX3D FlipY3D Lens3D Ripple3D PageTurn3D ShakyTiles3D ShatteredTiles3D WavesTiles3D JumpTiles3D Speed ActionManager Set SimpleAudioEngine Scheduler Orbit.* Follow.* Bezier.* CardinalSpline.* Camera.* DrawNode Liquid$ Waves$ ShuffleTiles$ TurnOffTiles$ Split.* Twirl$ FileUtils$ GLProgram GLProgramCache Application ClippingNode MotionStreak TextFieldTTF GLViewProtocol GLView Component ComponentContainer __NodeRGBA __LayerRGBA SAXParser Event(?!.*(Physics).*).* Device Configuration ProtectedNode GLProgramState Image .*Light$ AsyncTaskPool Properties Material Technique RenderState Pass -classes_need_extend = Node __NodeRGBA Layer.* Sprite SpriteBatchNode SpriteFrame Menu MenuItem.* Scene DrawNode Component .*Action.* GridBase Grid3D TiledGrid3D MotionStreak ParticleBatchNode ParticleSystem TextFieldTTF RenderTexture TileMapAtlas TMXLayer TMXTiledMap TMXMapInfo TransitionScene ProgressTimer ParallaxNode Label.* GLProgram +classes_need_extend = Node __NodeRGBA Layer.* Sprite SpriteBatchNode SpriteFrame Menu MenuItem.* Scene DrawNode Component .*Action.* GridBase Grid3D TiledGrid3D MotionStreak ParticleBatchNode ParticleSystem TextFieldTTF RenderTexture TileMapAtlas TMXLayer TMXTiledMap TMXMapInfo TransitionScene ProgressTimer ParallaxNode Label.* GLProgram Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Transition.* Spawn ReverseTime Animate AnimationFrame Animation AnimationCache Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* Orbit.* Follow.* Bezier.* Hide CallFunc CallFuncN # 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 diff --git a/tools/tolua/cocos2dx_physics.ini b/tools/tolua/cocos2dx_physics.ini index 6a763b9d9d..ef1bede544 100644 --- a/tools/tolua/cocos2dx_physics.ini +++ b/tools/tolua/cocos2dx_physics.ini @@ -29,7 +29,7 @@ headers = %(cocosdir)s/cocos/cocos2d.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 = Event(.*(Physics).*) Physics.* +classes = Event(.*(Physics).*) Physics.* ComponentPhysics2d # 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 @@ -46,7 +46,9 @@ skip = PhysicsBody::[getJoints createPolygon createEdgeChain createEdgePolygon], PhysicsShapeEdgePolygon::[create ^getPoints$], PhysicsShapeEdgeChain::[create ^getPoints$], PhysicsWorld::[getScene queryPoint queryRect rayCast], - PhysicsContact::[getData setData] + PhysicsContact::[getData setData], + PhysicsManager::[PhysicsManager update], + ComponentPhysics2d::[beforeSimulation afterSimulation] rename_functions =