diff --git a/CHANGELOG b/CHANGELOG index eed371a35f..ad5c3e1d42 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,7 +1,11 @@ cocos2d-x-3.2 ?? + [FIX] Animation3D: getOrCreate is deprecated and replaced with Animation3D::create + [FIX] Animate3D: setSpeed() accept negtive value, which means play reverse, getPlayback and setPlayBack are deprecated [FIX] GLView: cursor position is not correct if design resolution is different from device resolution [FIX] Label: color can not be set correctly if using system font + [FIX] Lua-binding: support UIVideoPlayer [FIX] Node: setRotation3D not work based on anchor point + [FIX] Node: modify regular of enumerateChildren, now it just searchs its children [FIX] Setup.py: not work if using zsh [FIX] SpriteBatchNode: opacity can not work [FIX] Sprite3D: may crash on Android if playing animation and replace Scene after come from background diff --git a/build/cocos2d_tests.xcodeproj/project.pbxproj b/build/cocos2d_tests.xcodeproj/project.pbxproj index 2f6bd7cfd1..4ccecae7a2 100644 --- a/build/cocos2d_tests.xcodeproj/project.pbxproj +++ b/build/cocos2d_tests.xcodeproj/project.pbxproj @@ -27,7 +27,6 @@ buildPhases = ( ); dependencies = ( - 15A1D3C8196BDC58009C3B59 /* PBXTargetDependency */, 1ADA8BAC18CF277C00AE24B9 /* PBXTargetDependency */, 1ADA8BAE18CF277C00AE24B9 /* PBXTargetDependency */, 1ADA8BB018CF277C00AE24B9 /* PBXTargetDependency */, @@ -59,39 +58,13 @@ 1503FAC418DA8B6C00F6518C /* tp.lua in Resources */ = {isa = PBXBuildFile; fileRef = 1503FAB118DA8B6C00F6518C /* tp.lua */; }; 1503FAC518DA8B6C00F6518C /* url.lua in Resources */ = {isa = PBXBuildFile; fileRef = 1503FAB218DA8B6C00F6518C /* url.lua */; }; 1503FAC618DA8B6C00F6518C /* url.lua in Resources */ = {isa = PBXBuildFile; fileRef = 1503FAB218DA8B6C00F6518C /* url.lua */; }; - 15225DC1196BE61F0032C34F /* AppController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 15A1D85D196BDF32009C3B59 /* AppController.mm */; }; - 15225DC2196BE61F0032C34F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 15A1D86A196BDF32009C3B59 /* main.m */; }; - 15225DC3196BE61F0032C34F /* RootViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 15A1D86C196BDF32009C3B59 /* RootViewController.mm */; }; - 15225DC4196BE64D0032C34F /* AppDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15A1D3CE196BDF30009C3B59 /* AppDelegate.cpp */; }; - 15225DC6196BE77C0032C34F /* src in Resources */ = {isa = PBXBuildFile; fileRef = 15225DC5196BE77C0032C34F /* src */; }; - 15225DCD196BEEB40032C34F /* Cocos2d.lua in Resources */ = {isa = PBXBuildFile; fileRef = 1ABCA36818CD9E180087CE3A /* Cocos2d.lua */; }; - 15225DCE196BEEB40032C34F /* Cocos2dConstants.lua in Resources */ = {isa = PBXBuildFile; fileRef = 1ABCA36918CD9E180087CE3A /* Cocos2dConstants.lua */; }; - 15225DCF196BEEB40032C34F /* extern.lua in Resources */ = {isa = PBXBuildFile; fileRef = 1ABCA37018CD9E180087CE3A /* extern.lua */; }; - 15225DD2196BEF080032C34F /* CocoStudio.lua in Resources */ = {isa = PBXBuildFile; fileRef = 1ABCA36A18CD9E180087CE3A /* CocoStudio.lua */; }; - 15225DD4196BEFC30032C34F /* fonts in Resources */ = {isa = PBXBuildFile; fileRef = 3E6177F01960FEFE00DE83F5 /* fonts */; }; - 15225DD5196BEFC30032C34F /* ipad in Resources */ = {isa = PBXBuildFile; fileRef = 3E6177F11960FEFE00DE83F5 /* ipad */; }; - 15225DD6196BEFC30032C34F /* ipadhd in Resources */ = {isa = PBXBuildFile; fileRef = 3E6177F21960FEFE00DE83F5 /* ipadhd */; }; - 15225DD7196BEFC30032C34F /* iphone in Resources */ = {isa = PBXBuildFile; fileRef = 3E6177F31960FEFE00DE83F5 /* iphone */; }; - 15225DDD196C47CB0032C34F /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E61773C1960FBD100DE83F5 /* GameController.framework */; }; - 15225DDE196C51A00032C34F /* Deprecated.lua in Resources */ = {isa = PBXBuildFile; fileRef = 1ABCA36B18CD9E180087CE3A /* Deprecated.lua */; }; - 15225DDF196C51A00032C34F /* DeprecatedClass.lua in Resources */ = {isa = PBXBuildFile; fileRef = 1ABCA36C18CD9E180087CE3A /* DeprecatedClass.lua */; }; - 15225DE0196C51A00032C34F /* DeprecatedEnum.lua in Resources */ = {isa = PBXBuildFile; fileRef = 1ABCA36D18CD9E180087CE3A /* DeprecatedEnum.lua */; }; - 15225DE1196C52180032C34F /* json.lua in Resources */ = {isa = PBXBuildFile; fileRef = 1ABCA37218CD9E180087CE3A /* json.lua */; }; - 15A1D388196BDBE9009C3B59 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 1ABCA3AF18CDA06D0087CE3A /* libz.dylib */; }; - 15A1D389196BDBE9009C3B59 /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D60AE43317F7FFE100757E4B /* CoreMotion.framework */; }; - 15A1D38A196BDBE9009C3B59 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1ABCA3A818CD9F130087CE3A /* AudioToolbox.framework */; }; - 15A1D38B196BDBE9009C3B59 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1ABCA3A618CD9F0D0087CE3A /* OpenAL.framework */; }; - 15A1D38C196BDBE9009C3B59 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1ABCA3A418CD9F060087CE3A /* QuartzCore.framework */; }; - 15A1D38D196BDBE9009C3B59 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1ABCA3A218CD9EFE0087CE3A /* CoreGraphics.framework */; }; - 15A1D38E196BDBE9009C3B59 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1ABCA3A018CD9EF60087CE3A /* OpenGLES.framework */; }; - 15A1D38F196BDBE9009C3B59 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1ABCA39E18CD9EE50087CE3A /* UIKit.framework */; }; - 15A1D390196BDBE9009C3B59 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1ABCA39C18CD9ED80087CE3A /* AVFoundation.framework */; }; - 15A1D391196BDBE9009C3B59 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C64832165F3AFD007D4F18 /* Foundation.framework */; }; - 15A1D392196BDBE9009C3B59 /* libchipmunk iOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 46A15FC21807A4F9005B8026 /* libchipmunk iOS.a */; }; - 15A1D393196BDBE9009C3B59 /* libcocos2dx iOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 46A15FBE1807A4F9005B8026 /* libcocos2dx iOS.a */; }; - 15A1D394196BDBE9009C3B59 /* libcocos2dx-extensions iOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 46A15FC01807A4F9005B8026 /* libcocos2dx-extensions iOS.a */; }; - 15A1D395196BDBE9009C3B59 /* libCocosDenshion iOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 46A15FC61807A4F9005B8026 /* libCocosDenshion iOS.a */; }; - 15A1D396196BDBE9009C3B59 /* libluabindings iOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1ABCA28018CD90A50087CE3A /* libluabindings iOS.a */; }; + 15AECE0B195C0F8A00907DB0 /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3EA0FB65191B933000B170C8 /* MediaPlayer.framework */; }; + 15AECE0F195C1FDD00907DB0 /* cocosvideo.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 3EA0FB5D191B92F100B170C8 /* cocosvideo.mp4 */; }; + 15AECE1F195D0EC500907DB0 /* experimentalConstants.lua in Resources */ = {isa = PBXBuildFile; fileRef = 15AECE1E195D0EC500907DB0 /* experimentalConstants.lua */; }; + 15AECE22195D122400907DB0 /* experimentalConstants.lua in Resources */ = {isa = PBXBuildFile; fileRef = 15AECE1E195D0EC500907DB0 /* experimentalConstants.lua */; }; + 15AECE23195D122600907DB0 /* experimentalConstants.lua in Resources */ = {isa = PBXBuildFile; fileRef = 15AECE1E195D0EC500907DB0 /* experimentalConstants.lua */; }; + 15AECE24195D122700907DB0 /* experimentalConstants.lua in Resources */ = {isa = PBXBuildFile; fileRef = 15AECE1E195D0EC500907DB0 /* experimentalConstants.lua */; }; + 15AECE25195D467D00907DB0 /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3EA0FB65191B933000B170C8 /* MediaPlayer.framework */; }; 15B0870D195AD52000D6F62B /* ActionTimeline in Resources */ = {isa = PBXBuildFile; fileRef = 38FA2E75194AECF800FF2BE4 /* ActionTimeline */; }; 15C64825165F3934007D4F18 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C64824165F3934007D4F18 /* OpenGL.framework */; }; 15C64827165F394E007D4F18 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C64826165F394E007D4F18 /* QuartzCore.framework */; }; @@ -912,48 +885,6 @@ /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - 15A1D379196BDBE9009C3B59 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 46A15F9C1807A4F8005B8026 /* cocos2d_libs.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = A07A4C241783777C0073F6A7; - remoteInfo = "cocos2dx iOS"; - }; - 15A1D37B196BDBE9009C3B59 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 46A15F9C1807A4F8005B8026 /* cocos2d_libs.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = A07A4E111783867C0073F6A7; - remoteInfo = "cocos2dx-extensions iOS"; - }; - 15A1D37D196BDBE9009C3B59 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 46A15F9C1807A4F8005B8026 /* cocos2d_libs.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = A07A4EFD178387670073F6A7; - remoteInfo = "chipmunk iOS"; - }; - 15A1D37F196BDBE9009C3B59 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 46A15F9C1807A4F8005B8026 /* cocos2d_libs.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = A07A4F9F178387730073F6A7; - remoteInfo = "CocosDenshion iOS"; - }; - 15A1D381196BDBE9009C3B59 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 1ABCA27618CD90A40087CE3A /* cocos2d_lua_bindings.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 1A119716178526AA00D62A44; - remoteInfo = "luabindings iOS"; - }; - 15A1D3C7196BDC58009C3B59 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */; - proxyType = 1; - remoteGlobalIDString = 15A1D377196BDBE9009C3B59; - remoteInfo = "lua-game-controller-test iOS"; - }; 1A0EE1C818CDF6DA004CD58F /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 46A15F9C1807A4F8005B8026 /* cocos2d_libs.xcodeproj */; @@ -1387,30 +1318,7 @@ 1503FAB018DA8B6C00F6518C /* socket.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = socket.lua; path = ../external/lua/luasocket/socket.lua; sourceTree = ""; }; 1503FAB118DA8B6C00F6518C /* tp.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = tp.lua; path = ../external/lua/luasocket/tp.lua; sourceTree = ""; }; 1503FAB218DA8B6C00F6518C /* url.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = url.lua; path = ../external/lua/luasocket/url.lua; sourceTree = ""; }; - 15225DC5196BE77C0032C34F /* src */ = {isa = PBXFileReference; lastKnownFileType = folder; path = src; sourceTree = ""; }; - 15225DD8196BF0AF0032C34F /* AppMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppMacros.h; sourceTree = ""; }; - 15225DF6196D3FFF0032C34F /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/System/Library/Frameworks/QuartzCore.framework; sourceTree = DEVELOPER_DIR; }; - 15225DF8196D401A0032C34F /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/System/Library/Frameworks/AudioToolbox.framework; sourceTree = DEVELOPER_DIR; }; - 15A1D3C3196BDBE9009C3B59 /* lua-game-controller-test iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "lua-game-controller-test iOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; - 15A1D3CE196BDF30009C3B59 /* AppDelegate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AppDelegate.cpp; sourceTree = ""; }; - 15A1D3CF196BDF30009C3B59 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; - 15A1D85C196BDF32009C3B59 /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppController.h; sourceTree = ""; }; - 15A1D85D196BDF32009C3B59 /* AppController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AppController.mm; sourceTree = ""; }; - 15A1D85E196BDF32009C3B59 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; - 15A1D85F196BDF32009C3B59 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = ""; }; - 15A1D860196BDF32009C3B59 /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = ""; }; - 15A1D861196BDF32009C3B59 /* HelloLua_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HelloLua_Prefix.pch; sourceTree = ""; }; - 15A1D862196BDF32009C3B59 /* Icon-114.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-114.png"; sourceTree = ""; }; - 15A1D863196BDF32009C3B59 /* Icon-120.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-120.png"; sourceTree = ""; }; - 15A1D864196BDF32009C3B59 /* Icon-144.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-144.png"; sourceTree = ""; }; - 15A1D865196BDF32009C3B59 /* Icon-152.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-152.png"; sourceTree = ""; }; - 15A1D866196BDF32009C3B59 /* Icon-57.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-57.png"; sourceTree = ""; }; - 15A1D867196BDF32009C3B59 /* Icon-72.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-72.png"; sourceTree = ""; }; - 15A1D868196BDF32009C3B59 /* Icon-76.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-76.png"; sourceTree = ""; }; - 15A1D869196BDF32009C3B59 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 15A1D86A196BDF32009C3B59 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 15A1D86B196BDF32009C3B59 /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = ""; }; - 15A1D86C196BDF32009C3B59 /* RootViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RootViewController.mm; sourceTree = ""; }; + 15AECE1E195D0EC500907DB0 /* experimentalConstants.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = experimentalConstants.lua; path = "../cocos/scripting/lua-bindings/script/experimentalConstants.lua"; sourceTree = ""; }; 15C64822165F391E007D4F18 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/Cocoa.framework; sourceTree = DEVELOPER_DIR; }; 15C64824165F3934007D4F18 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/OpenGL.framework; sourceTree = DEVELOPER_DIR; }; 15C64826165F394E007D4F18 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/QuartzCore.framework; sourceTree = DEVELOPER_DIR; }; @@ -2075,29 +1983,6 @@ /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - 15A1D387196BDBE9009C3B59 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 15225DDD196C47CB0032C34F /* GameController.framework in Frameworks */, - 15A1D388196BDBE9009C3B59 /* libz.dylib in Frameworks */, - 15A1D389196BDBE9009C3B59 /* CoreMotion.framework in Frameworks */, - 15A1D38A196BDBE9009C3B59 /* AudioToolbox.framework in Frameworks */, - 15A1D38B196BDBE9009C3B59 /* OpenAL.framework in Frameworks */, - 15A1D38C196BDBE9009C3B59 /* QuartzCore.framework in Frameworks */, - 15A1D38D196BDBE9009C3B59 /* CoreGraphics.framework in Frameworks */, - 15A1D38E196BDBE9009C3B59 /* OpenGLES.framework in Frameworks */, - 15A1D38F196BDBE9009C3B59 /* UIKit.framework in Frameworks */, - 15A1D390196BDBE9009C3B59 /* AVFoundation.framework in Frameworks */, - 15A1D391196BDBE9009C3B59 /* Foundation.framework in Frameworks */, - 15A1D392196BDBE9009C3B59 /* libchipmunk iOS.a in Frameworks */, - 15A1D393196BDBE9009C3B59 /* libcocos2dx iOS.a in Frameworks */, - 15A1D394196BDBE9009C3B59 /* libcocos2dx-extensions iOS.a in Frameworks */, - 15A1D395196BDBE9009C3B59 /* libCocosDenshion iOS.a in Frameworks */, - 15A1D396196BDBE9009C3B59 /* libluabindings iOS.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 1A0EE29F18CDF6DA004CD58F /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -2164,6 +2049,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 15AECE25195D467D00907DB0 /* MediaPlayer.framework in Frameworks */, 1A0EE42C18CDF799004CD58F /* libz.dylib in Frameworks */, 1A0EE42D18CDF799004CD58F /* CoreMotion.framework in Frameworks */, 1A0EE42E18CDF799004CD58F /* AudioToolbox.framework in Frameworks */, @@ -2208,6 +2094,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 15AECE0B195C0F8A00907DB0 /* MediaPlayer.framework in Frameworks */, 1ABCA3B018CDA06D0087CE3A /* libz.dylib in Frameworks */, 1ABCA3AA18CD9F1A0087CE3A /* CoreMotion.framework in Frameworks */, 1ABCA3A918CD9F130087CE3A /* AudioToolbox.framework in Frameworks */, @@ -2295,67 +2182,6 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 15A1D3CB196BDF30009C3B59 /* lua-game-controller-test */ = { - isa = PBXGroup; - children = ( - 15A1D3CC196BDF30009C3B59 /* project */, - 15A1D8AB196BDF32009C3B59 /* res */, - 15225DC5196BE77C0032C34F /* src */, - ); - name = "lua-game-controller-test"; - path = "../tests/lua-game-controller-test"; - sourceTree = ""; - }; - 15A1D3CC196BDF30009C3B59 /* project */ = { - isa = PBXGroup; - children = ( - 15A1D3CD196BDF30009C3B59 /* Classes */, - 15A1D85B196BDF32009C3B59 /* proj.ios */, - ); - path = project; - sourceTree = ""; - }; - 15A1D3CD196BDF30009C3B59 /* Classes */ = { - isa = PBXGroup; - children = ( - 15225DD8196BF0AF0032C34F /* AppMacros.h */, - 15A1D3CE196BDF30009C3B59 /* AppDelegate.cpp */, - 15A1D3CF196BDF30009C3B59 /* AppDelegate.h */, - ); - path = Classes; - sourceTree = ""; - }; - 15A1D85B196BDF32009C3B59 /* proj.ios */ = { - isa = PBXGroup; - children = ( - 15A1D85C196BDF32009C3B59 /* AppController.h */, - 15A1D85D196BDF32009C3B59 /* AppController.mm */, - 15A1D85E196BDF32009C3B59 /* Default-568h@2x.png */, - 15A1D85F196BDF32009C3B59 /* Default.png */, - 15A1D860196BDF32009C3B59 /* Default@2x.png */, - 15A1D861196BDF32009C3B59 /* HelloLua_Prefix.pch */, - 15A1D862196BDF32009C3B59 /* Icon-114.png */, - 15A1D863196BDF32009C3B59 /* Icon-120.png */, - 15A1D864196BDF32009C3B59 /* Icon-144.png */, - 15A1D865196BDF32009C3B59 /* Icon-152.png */, - 15A1D866196BDF32009C3B59 /* Icon-57.png */, - 15A1D867196BDF32009C3B59 /* Icon-72.png */, - 15A1D868196BDF32009C3B59 /* Icon-76.png */, - 15A1D869196BDF32009C3B59 /* Info.plist */, - 15A1D86A196BDF32009C3B59 /* main.m */, - 15A1D86B196BDF32009C3B59 /* RootViewController.h */, - 15A1D86C196BDF32009C3B59 /* RootViewController.mm */, - ); - path = proj.ios; - sourceTree = ""; - }; - 15A1D8AB196BDF32009C3B59 /* res */ = { - isa = PBXGroup; - children = ( - ); - path = res; - sourceTree = ""; - }; 19C28FACFE9D520D11CA2CBB /* Products */ = { isa = PBXGroup; children = ( @@ -2368,7 +2194,6 @@ 1A0EE41318CDF775004CD58F /* cpp-empty-test iOS.app */, 1A0EE47E18CDF799004CD58F /* lua-empty-test iOS.app */, 3E6177311960FAED00DE83F5 /* game-controller-test IOS.app */, - 15A1D3C3196BDBE9009C3B59 /* lua-game-controller-test iOS.app */, ); name = Products; sourceTree = ""; @@ -2395,6 +2220,7 @@ 1ABCA36418CD9E060087CE3A /* Lua Common */ = { isa = PBXGroup; children = ( + 15AECE1E195D0EC500907DB0 /* experimentalConstants.lua */, 1503FAA918DA8B6C00F6518C /* ftp.lua */, 1503FAAA18DA8B6C00F6518C /* headers.lua */, 1503FAAB18DA8B6C00F6518C /* http.lua */, @@ -3748,7 +3574,6 @@ 1AC35E0318CEE78300F37B72 /* tests */ = { isa = PBXGroup; children = ( - 15A1D3CB196BDF30009C3B59 /* lua-game-controller-test */, 3E6176B51960FA6300DE83F5 /* game-controller-test */, 1AC358B618CEC19F00F37B72 /* cpp-empty-test */, 1AC3592118CECEFF00F37B72 /* cpp-tests */, @@ -4043,8 +3868,6 @@ 29B97323FDCFA39411CA2CEA /* Frameworks */ = { isa = PBXGroup; children = ( - 15225DF8196D401A0032C34F /* AudioToolbox.framework */, - 15225DF6196D3FFF0032C34F /* QuartzCore.framework */, 3E61773C1960FBD100DE83F5 /* GameController.framework */, 3E61773A1960FBC300DE83F5 /* CFNetwork.framework */, 3E6177381960FBB800DE83F5 /* SystemConfiguration.framework */, @@ -4193,28 +4016,6 @@ /* End PBXGroup section */ /* Begin PBXNativeTarget section */ - 15A1D377196BDBE9009C3B59 /* lua-game-controller-test iOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 15A1D3C0196BDBE9009C3B59 /* Build configuration list for PBXNativeTarget "lua-game-controller-test iOS" */; - buildPhases = ( - 15A1D382196BDBE9009C3B59 /* Sources */, - 15A1D387196BDBE9009C3B59 /* Frameworks */, - 15A1D397196BDBE9009C3B59 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 15A1D378196BDBE9009C3B59 /* PBXTargetDependency */, - 15A1D37A196BDBE9009C3B59 /* PBXTargetDependency */, - 15A1D37C196BDBE9009C3B59 /* PBXTargetDependency */, - 15A1D37E196BDBE9009C3B59 /* PBXTargetDependency */, - 15A1D380196BDBE9009C3B59 /* PBXTargetDependency */, - ); - name = "lua-game-controller-test iOS"; - productName = "Test lua iOS"; - productReference = 15A1D3C3196BDBE9009C3B59 /* lua-game-controller-test iOS.app */; - productType = "com.apple.product-type.application"; - }; 1A0EE1C618CDF6DA004CD58F /* cpp-empty-test Mac */ = { isa = PBXNativeTarget; buildConfigurationList = 1A0EE2AF18CDF6DA004CD58F /* Build configuration list for PBXNativeTarget "cpp-empty-test Mac" */; @@ -4453,7 +4254,6 @@ 1ABCA2CC18CD93580087CE3A /* lua-tests iOS */, 1A0EE41918CDF799004CD58F /* lua-empty-test iOS */, 3E6176FF1960FAED00DE83F5 /* game-controller-test IOS */, - 15A1D377196BDBE9009C3B59 /* lua-game-controller-test iOS */, ); }; /* End PBXProject section */ @@ -4546,26 +4346,6 @@ /* End PBXReferenceProxy section */ /* Begin PBXResourcesBuildPhase section */ - 15A1D397196BDBE9009C3B59 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 15225DE1196C52180032C34F /* json.lua in Resources */, - 15225DDE196C51A00032C34F /* Deprecated.lua in Resources */, - 15225DDF196C51A00032C34F /* DeprecatedClass.lua in Resources */, - 15225DE0196C51A00032C34F /* DeprecatedEnum.lua in Resources */, - 15225DD4196BEFC30032C34F /* fonts in Resources */, - 15225DD5196BEFC30032C34F /* ipad in Resources */, - 15225DD6196BEFC30032C34F /* ipadhd in Resources */, - 15225DD7196BEFC30032C34F /* iphone in Resources */, - 15225DD2196BEF080032C34F /* CocoStudio.lua in Resources */, - 15225DCD196BEEB40032C34F /* Cocos2d.lua in Resources */, - 15225DCE196BEEB40032C34F /* Cocos2dConstants.lua in Resources */, - 15225DCF196BEEB40032C34F /* extern.lua in Resources */, - 15225DC6196BE77C0032C34F /* src in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 1A0EE1D118CDF6DA004CD58F /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -4591,6 +4371,7 @@ 1AC35D5D18CEDE9E00F37B72 /* MainMenu.xib in Resources */, 1503FABD18DA8B6C00F6518C /* mime.lua in Resources */, 1A0EE56F18CDFBBE004CD58F /* CCBReaderLoad.lua in Resources */, + 15AECE23195D122600907DB0 /* experimentalConstants.lua in Resources */, 1A0EE57018CDFBBE004CD58F /* Cocos2d.lua in Resources */, 1A0EE57B18CDFBBE004CD58F /* luaj.lua in Resources */, 1A0EE57918CDFBBE004CD58F /* GuiConstants.lua in Resources */, @@ -4660,6 +4441,7 @@ 1A0EE56018CDFBBD004CD58F /* CocoStudio.lua in Resources */, 1A0EE56318CDFBBD004CD58F /* DeprecatedEnum.lua in Resources */, 1503FAB818DA8B6C00F6518C /* http.lua in Resources */, + 15AECE22195D122400907DB0 /* experimentalConstants.lua in Resources */, 1AC35D4B18CEDE9400F37B72 /* Icon-144.png in Resources */, 1503FAC618DA8B6C00F6518C /* url.lua in Resources */, 1AC35D4618CEDE9400F37B72 /* Default-568h@2x.png in Resources */, @@ -4704,6 +4486,7 @@ 1AC35DBB18CEE65100F37B72 /* components in Resources */, 1AC35DE218CEE65900F37B72 /* effect2.ogg in Resources */, 1ABCA39A18CD9E180087CE3A /* StudioConstants.lua in Resources */, + 15AECE24195D122700907DB0 /* experimentalConstants.lua in Resources */, 15C90B4318E66C1700D69802 /* mime.lua in Resources */, 1AC35DB118CEE5DA00F37B72 /* InfoPlist.strings in Resources */, 1AC35DDD18CEE65900F37B72 /* CocosBuilderExample.ccbproj in Resources */, @@ -4766,6 +4549,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 15AECE0F195C1FDD00907DB0 /* cocosvideo.mp4 in Resources */, 15B0870D195AD52000D6F62B /* ActionTimeline in Resources */, 15E66FC8192D957100C20A52 /* Sprite3DTest in Resources */, 15C90B4418E66C1800D69802 /* mime.lua in Resources */, @@ -4782,6 +4566,7 @@ 1AC35DD718CEE65200F37B72 /* Particles in Resources */, 1AC35D9D18CEE5D100F37B72 /* Icon-120.png in Resources */, 15C90B3E18E66BF200D69802 /* http.lua in Resources */, + 15AECE1F195D0EC500907DB0 /* experimentalConstants.lua in Resources */, 1AC35DA018CEE5D100F37B72 /* Icon-57.png in Resources */, 1ABCA37F18CD9E180087CE3A /* Cocos2dConstants.lua in Resources */, 1AC35DF118CEE65B00F37B72 /* fileLookup.plist in Resources */, @@ -4960,17 +4745,6 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ - 15A1D382196BDBE9009C3B59 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 15225DC4196BE64D0032C34F /* AppDelegate.cpp in Sources */, - 15225DC1196BE61F0032C34F /* AppController.mm in Sources */, - 15225DC2196BE61F0032C34F /* main.m in Sources */, - 15225DC3196BE61F0032C34F /* RootViewController.mm in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 1A0EE1F618CDF6DA004CD58F /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -5415,36 +5189,6 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ - 15A1D378196BDBE9009C3B59 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "cocos2dx iOS"; - targetProxy = 15A1D379196BDBE9009C3B59 /* PBXContainerItemProxy */; - }; - 15A1D37A196BDBE9009C3B59 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "cocos2dx-extensions iOS"; - targetProxy = 15A1D37B196BDBE9009C3B59 /* PBXContainerItemProxy */; - }; - 15A1D37C196BDBE9009C3B59 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "chipmunk iOS"; - targetProxy = 15A1D37D196BDBE9009C3B59 /* PBXContainerItemProxy */; - }; - 15A1D37E196BDBE9009C3B59 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "CocosDenshion iOS"; - targetProxy = 15A1D37F196BDBE9009C3B59 /* PBXContainerItemProxy */; - }; - 15A1D380196BDBE9009C3B59 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "luabindings iOS"; - targetProxy = 15A1D381196BDBE9009C3B59 /* PBXContainerItemProxy */; - }; - 15A1D3C8196BDC58009C3B59 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 15A1D377196BDBE9009C3B59 /* lua-game-controller-test iOS */; - targetProxy = 15A1D3C7196BDC58009C3B59 /* PBXContainerItemProxy */; - }; 1A0EE1C718CDF6DA004CD58F /* PBXTargetDependency */ = { isa = PBXTargetDependency; name = "cocos2dx Mac"; @@ -5755,49 +5499,6 @@ /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ - 15A1D3C1196BDBE9009C3B59 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = "iPhone Developer"; - GCC_PREPROCESSOR_DEFINITIONS = ( - "$(inherited)", - CC_TARGET_OS_IPHONE, - ); - INFOPLIST_FILE = "$(SRCROOT)/../tests/lua-game-controller-test/project/proj.ios/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 5.1.1; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "/Users/cocos2d/MyWork/cocos2d-x-develop/tests/lua-game-controller-test/project/proj.android/obj/local/armeabi", - ); - PRODUCT_NAME = "lua-game-controller-test iOS"; - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/.. $(SRCROOT)/../cocos/platform/ios $(SRCROOT)/../external $(SRCROOT)/../external/lua/luajit/include $(SRCROOT)/../external/lua/tolua $(SRCROOT)/../cocos/scripting/lua-bindings/manual $(SRCROOT)/../cocos/scripting/lua-bindings/auto"; - }; - name = Debug; - }; - 15A1D3C2196BDBE9009C3B59 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = "iPhone Developer"; - GCC_PREPROCESSOR_DEFINITIONS = ( - "$(inherited)", - CC_TARGET_OS_IPHONE, - ); - INFOPLIST_FILE = "$(SRCROOT)/../tests/lua-game-controller-test/project/proj.ios/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 5.1.1; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "/Users/cocos2d/MyWork/cocos2d-x-develop/tests/lua-game-controller-test/project/proj.android/obj/local/armeabi", - ); - PRODUCT_NAME = "lua-game-controller-test iOS"; - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/.. $(SRCROOT)/../cocos/platform/ios $(SRCROOT)/../external $(SRCROOT)/../external/lua/luajit/include $(SRCROOT)/../external/lua/tolua $(SRCROOT)/../cocos/scripting/lua-bindings/manual $(SRCROOT)/../cocos/scripting/lua-bindings/auto"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; 1A0EE2B018CDF6DA004CD58F /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -6191,15 +5892,6 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 15A1D3C0196BDBE9009C3B59 /* Build configuration list for PBXNativeTarget "lua-game-controller-test iOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 15A1D3C1196BDBE9009C3B59 /* Debug */, - 15A1D3C2196BDBE9009C3B59 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; 1A0EE2AF18CDF6DA004CD58F /* Build configuration list for PBXNativeTarget "cpp-empty-test Mac" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/cocos/2d/CCActionInterval.h b/cocos/2d/CCActionInterval.h index b735a1fb3b..d112f04e1f 100644 --- a/cocos/2d/CCActionInterval.h +++ b/cocos/2d/CCActionInterval.h @@ -585,7 +585,7 @@ public: virtual JumpTo* clone() const override; virtual JumpTo* reverse(void) const override; -private: +CC_CONSTRUCTOR_ACCESS: JumpTo() {} virtual ~JumpTo() {} CC_DISALLOW_COPY_AND_ASSIGN(JumpTo); @@ -750,7 +750,7 @@ public: virtual ScaleBy* clone() const override; virtual ScaleBy* reverse(void) const override; -protected: +CC_CONSTRUCTOR_ACCESS: ScaleBy() {} virtual ~ScaleBy() {} @@ -842,7 +842,7 @@ public: void setReverseAction(FadeTo* ac); -protected: +CC_CONSTRUCTOR_ACCESS: FadeIn():_reverseAction(nullptr) {} virtual ~FadeIn() {} @@ -869,7 +869,7 @@ public: void setReverseAction(FadeTo* ac); -protected: +CC_CONSTRUCTOR_ACCESS: FadeOut():_reverseAction(nullptr) {} virtual ~FadeOut() {} private: @@ -961,7 +961,7 @@ public: virtual DelayTime* reverse() const override; virtual DelayTime* clone() const override; -protected: +CC_CONSTRUCTOR_ACCESS: DelayTime() {} virtual ~DelayTime() {} diff --git a/cocos/2d/CCLayer.cpp b/cocos/2d/CCLayer.cpp index 558cbdde19..753f744c88 100644 --- a/cocos/2d/CCLayer.cpp +++ b/cocos/2d/CCLayer.cpp @@ -884,7 +884,7 @@ LayerMultiplex * LayerMultiplex::create(Layer * layer, ...) LayerMultiplex * LayerMultiplex::createWithLayer(Layer* layer) { - return LayerMultiplex::create(layer, NULL); + return LayerMultiplex::create(layer, nullptr); } LayerMultiplex* LayerMultiplex::create() diff --git a/cocos/2d/CCNode.cpp b/cocos/2d/CCNode.cpp index 70240cc3de..2a52bd1a2d 100644 --- a/cocos/2d/CCNode.cpp +++ b/cocos/2d/CCNode.cpp @@ -842,23 +842,13 @@ void Node::enumerateChildren(const std::string &name, std::function 2 && name[0] == '/' && name[1] == '/') { - if (length > 2 && name[1] == '/') - { - searchFromRootRecursive = true; - subStrStartPos = 2; - subStrlength -= 2; - } - else - { - searchFromRoot = true; - subStrStartPos = 1; - subStrlength -= 1; - } + searchRecursively = true; + subStrStartPos = 2; + subStrlength -= 2; } // End with '/..'? @@ -872,7 +862,7 @@ void Node::enumerateChildren(const std::string &name, std::functiondoEnumerate(newName, callback); - } - } - else if (searchFromRootRecursive) + + if (searchRecursively) { // name is '//xxx' - auto root = getScene(); - if (root) - { - doEnumerateRecursive(root, newName, callback); - } + doEnumerateRecursive(this, newName, callback); } else { diff --git a/cocos/2d/CCNode.h b/cocos/2d/CCNode.h index 80007d7758..7b26969cea 100644 --- a/cocos/2d/CCNode.h +++ b/cocos/2d/CCNode.h @@ -714,23 +714,19 @@ public: virtual Node* getChildByName(const std::string& name) const; /** Search the children of the receiving node to perform processing for nodes which share a name. * - * @param name The name to search for, supports c++11 regular expression + * @param name The name to search for, supports c++11 regular expression. * Search syntax options: - * `/` : When placed at the start of the search string, this indicates that the search should be performed on the tree's node. - * `//`: Can only be placed at the begin of the search string. This indicates that the search should be performed on the tree's node - * and be performed recursively across the entire node tree. + * `//`: Can only be placed at the begin of the search string. This indicates that it will search recursively. * `..`: The search should move up to the node's parent. Can only be placed at the end of string - * `/` : When placed anywhere but the start of the search string, this indicates that the search should move to the node's children + * `/` : When placed anywhere but the start of the search string, this indicates that the search should move to the node's children. * * @code - * enumerateChildren("/MyName", ...): This searches the root's children and matches any node with the name `MyName`. - * enumerateChildren("//MyName", ...): This searches the root's children recursively and matches any node with the name `MyName`. + * enumerateChildren("//MyName", ...): This searches the children recursively and matches any node with the name `MyName`. * enumerateChildren("[[:alnum:]]+", ...): This search string matches every node of its children. - * enumerateChildren("/MyName", ...): This searches the node tree and matches the parent node of every node named `MyName`. * enumerateChildren("A[[:digit:]]", ...): This searches the node's children and returns any child named `A0`, `A1`, ..., `A9` * enumerateChildren("Abby/Normal", ...): This searches the node's grandchildren and returns any node whose name is `Normal` * and whose parent is named `Abby`. - * enumerateChildren("//Abby/Normal", ...): This searches the node tree and returns any node whose name is `Normal` and whose + * enumerateChildren("//Abby/Normal", ...): This searches recursively and returns any node whose name is `Normal` and whose * parent is named `Abby`. * @endcode * diff --git a/cocos/3d/CCAnimate3D.cpp b/cocos/3d/CCAnimate3D.cpp index 5f13d70cc7..da1e2c6a80 100644 --- a/cocos/3d/CCAnimate3D.cpp +++ b/cocos/3d/CCAnimate3D.cpp @@ -66,12 +66,12 @@ Animate3D* Animate3D::clone() const auto animate = const_cast(this); auto copy = Animate3D::create(animate->_animation); - copy->_speed = _speed; + copy->_absSpeed = _absSpeed; copy->_weight = _weight; copy->_elapsed = _elapsed; copy->_start = _start; copy->_last = _last; - copy->_playBack = _playBack; + copy->_playReverse = _playReverse; copy->setDuration(animate->getDuration()); return copy; @@ -81,7 +81,7 @@ Animate3D* Animate3D::clone() const Animate3D* Animate3D::reverse() const { auto animate = clone(); - animate->_playBack = !animate->_playBack; + animate->_playReverse = !animate->_playReverse; return animate; } @@ -112,16 +112,16 @@ void Animate3D::startWithTarget(Node *target) //! called every frame with it's delta time. DON'T override unless you know what you are doing. void Animate3D::step(float dt) { - ActionInterval::step(dt * _speed); + ActionInterval::step(dt * _absSpeed); } void Animate3D::update(float t) { - if (_target) + if (_target && _weight > 0.f) { float transDst[3], rotDst[4], scaleDst[3]; float* trans = nullptr, *rot = nullptr, *scale = nullptr; - if (_playBack) + if (_playReverse) t = 1 - t; t = _start + t * _last; @@ -149,13 +149,29 @@ void Animate3D::update(float t) } +float Animate3D::getSpeed() const +{ + return _playReverse ? -_absSpeed : _absSpeed; +} +void Animate3D::setSpeed(float speed) +{ + _absSpeed = fabsf(speed); + _playReverse = speed < 0; +} + +void Animate3D::setWeight(float weight) +{ + CCASSERT(weight >= 0.0f, "invalid weight"); + _weight = fabsf(weight); +} + Animate3D::Animate3D() -: _speed(1) +: _absSpeed(1.f) , _weight(1.f) , _start(0.f) , _last(1.f) , _animation(nullptr) -, _playBack(false) +, _playReverse(false) { } diff --git a/cocos/3d/CCAnimate3D.h b/cocos/3d/CCAnimate3D.h index fbda6328b5..b8011e3946 100644 --- a/cocos/3d/CCAnimate3D.h +++ b/cocos/3d/CCAnimate3D.h @@ -32,6 +32,7 @@ #include "base/ccMacros.h" #include "base/CCRef.h" #include "base/ccTypes.h" +#include "base/CCPlatformMacros.h" #include "2d/CCActionInterval.h" NS_CC_BEGIN @@ -66,17 +67,17 @@ public: virtual void update(float t) override; - /**get & set speed */ - float getSpeed() const { return _speed; } - void setSpeed(float speed) { _speed = speed; } + /**get & set speed, negative speed means playing reverse */ + float getSpeed() const; + void setSpeed(float speed); - /**get & set blend weight*/ + /**get & set blend weight, weight must positive*/ float getWeight() const { return _weight; } - void setWeight(float weight) { _weight = weight; } + void setWeight(float weight); - /**get & set play back*/ - bool getPlayBack() const { return _playBack; } - void setPlayBack(bool playBack) { _playBack = playBack; } + /**get & set play reverse, these are deprecated, use set negative speed instead*/ + CC_DEPRECATED_ATTRIBUTE bool getPlayBack() const { return _playReverse; } + CC_DEPRECATED_ATTRIBUTE void setPlayBack(bool reverse) { _playReverse = reverse; } CC_CONSTRUCTOR_ACCESS: @@ -86,11 +87,11 @@ CC_CONSTRUCTOR_ACCESS: protected: Animation3D* _animation; //animation data - float _speed; //playing speed + float _absSpeed; //playing speed float _weight; //blend weight float _start; //start time 0 - 1, used to generate sub Animate3D float _last; //last time 0 - 1, used to generate sub Animate3D - bool _playBack; // is playing back + bool _playReverse; // is playing reverse std::map _boneCurves; //weak ref }; diff --git a/cocos/3d/CCAnimation3D.cpp b/cocos/3d/CCAnimation3D.cpp index 9455a3e47e..611b130fe1 100644 --- a/cocos/3d/CCAnimation3D.cpp +++ b/cocos/3d/CCAnimation3D.cpp @@ -30,7 +30,7 @@ NS_CC_BEGIN -Animation3D* Animation3D::getOrCreate(const std::string& fileName, const std::string& animationName) +Animation3D* Animation3D::create(const std::string& fileName, const std::string& animationName) { std::string fullPath = FileUtils::getInstance()->fullPathForFilename(fileName); std::string key = fullPath + "#" + animationName; diff --git a/cocos/3d/CCAnimation3D.h b/cocos/3d/CCAnimation3D.h index a6f2a30a96..1d18cf6b0a 100644 --- a/cocos/3d/CCAnimation3D.h +++ b/cocos/3d/CCAnimation3D.h @@ -59,8 +59,10 @@ public: ~Curve(); }; - /**read all animation or only the animation with given animationName? animationName == "" read all.*/ - static Animation3D* getOrCreate(const std::string& filename, const std::string& animationName = ""); + /**read all animation or only the animation with given animationName? animationName == "" read the first.*/ + static Animation3D* create(const std::string& filename, const std::string& animationName = ""); + + CC_DEPRECATED_ATTRIBUTE static Animation3D* getOrCreate(const std::string& filename, const std::string& animationName = ""){ return create(filename, animationName); } /**get duration*/ float getDuration() const { return _duration; } diff --git a/cocos/3d/CCBundleReader.cpp b/cocos/3d/CCBundleReader.cpp index 6cdcbbd0e9..b3974b07f5 100644 --- a/cocos/3d/CCBundleReader.cpp +++ b/cocos/3d/CCBundleReader.cpp @@ -5,7 +5,7 @@ NS_CC_BEGIN BundleReader::BundleReader() { - m_buffer = NULL; + m_buffer = nullptr; m_position = 0; m_length = 0; }; @@ -123,7 +123,7 @@ bool BundleReader::seek(long int offset, int origin) bool BundleReader::rewind() { - if (m_buffer != NULL) + if (m_buffer != nullptr) { m_position = 0; return true; diff --git a/cocos/3d/CCMesh.cpp b/cocos/3d/CCMesh.cpp index ddfe7d21f3..c499f00d93 100644 --- a/cocos/3d/CCMesh.cpp +++ b/cocos/3d/CCMesh.cpp @@ -125,7 +125,7 @@ bool RenderMeshData::init(const std::vector& positions, return true; } -bool RenderMeshData::init(const std::vector& vertices, int vertexSizeInFloat, const std::vector& indices, int numIndex, const std::vector& attribs, int attribCount) +bool RenderMeshData::init(const std::vector& vertices, int vertexSizeInFloat, const std::vector& indices, const std::vector& attribs) { _vertexs = vertices; _indices = indices; @@ -174,10 +174,10 @@ Mesh* Mesh::create(const std::vector& positions, const std::vector return nullptr; } -Mesh* Mesh::create(const std::vector &vertices, int vertexSizeInFloat, const std::vector &indices, int numIndex, const std::vector &attribs, int attribCount) +Mesh* Mesh::create(const std::vector &vertices, int vertexSizeInFloat, const std::vector &indices, const std::vector &attribs) { auto mesh = new Mesh(); - if (mesh && mesh->init(vertices, vertexSizeInFloat, indices, numIndex, attribs, attribCount)) + if (mesh && mesh->init(vertices, vertexSizeInFloat, indices, attribs)) { mesh->autorelease(); return mesh; @@ -196,9 +196,9 @@ bool Mesh::init(const std::vector& positions, const std::vector& n return true; } -bool Mesh::init(const std::vector& vertices, int vertexSizeInFloat, const std::vector& indices, int numIndex, const std::vector& attribs, int attribCount) +bool Mesh::init(const std::vector& vertices, int vertexSizeInFloat, const std::vector& indices, const std::vector& attribs) { - bool bRet = _renderdata.init(vertices, vertexSizeInFloat, indices, numIndex, attribs, attribCount); + bool bRet = _renderdata.init(vertices, vertexSizeInFloat, indices, attribs); if (!bRet) return false; diff --git a/cocos/3d/CCMesh.h b/cocos/3d/CCMesh.h index 176e802105..51deec7242 100644 --- a/cocos/3d/CCMesh.h +++ b/cocos/3d/CCMesh.h @@ -49,7 +49,7 @@ public: } bool hasVertexAttrib(int attrib); bool init(const std::vector& positions, const std::vector& normals, const std::vector& texs, const std::vector& indices); - bool init(const std::vector& vertices, int vertexSizeInFloat, const std::vector& indices, int numIndex, const std::vector& attribs, int attribCount); + bool init(const std::vector& vertices, int vertexSizeInFloat, const std::vector& indices, const std::vector& attribs); protected: @@ -90,7 +90,10 @@ public: static Mesh* create(const std::vector& positions, const std::vector& normals, const std::vector& texs, const std::vector& indices); /**create mesh with vertex attributes*/ - static Mesh* create(const std::vector& vertices, int vertexSizeInFloat, const std::vector& indices, int numIndex, const std::vector& attribs, int attribCount); + CC_DEPRECATED_ATTRIBUTE static Mesh* create(const std::vector& vertices, int vertexSizeInFloat, const std::vector& indices, int numIndex, const std::vector& attribs, int attribCount) { return create(vertices, vertexSizeInFloat, indices, attribs); } + + /**create mesh with vertex attributes*/ + static Mesh* create(const std::vector& vertices, int vertexSizeInFloat, const std::vector& indices, const std::vector& attribs); /**get vertex buffer*/ inline GLuint getVertexBuffer() const { return _vertexBuffer; } @@ -124,7 +127,7 @@ CC_CONSTRUCTOR_ACCESS: bool init(const std::vector& positions, const std::vector& normals, const std::vector& texs, const std::vector& indices); /**init mesh*/ - bool init(const std::vector& vertices, int vertexSizeInFloat, const std::vector& indices, int numIndex, const std::vector& attribs, int attribCount); + bool init(const std::vector& vertices, int vertexSizeInFloat, const std::vector& indices, const std::vector& attribs); /**build buffer*/ void buildBuffer(); diff --git a/cocos/3d/CCSprite3D.cpp b/cocos/3d/CCSprite3D.cpp index f92e4dc475..a1244d2efb 100644 --- a/cocos/3d/CCSprite3D.cpp +++ b/cocos/3d/CCSprite3D.cpp @@ -193,7 +193,7 @@ bool Sprite3D::loadFromC3x(const std::string& path) return false; } - _mesh = Mesh::create(meshdata.vertex, meshdata.vertexSizeInFloat, meshdata.indices, meshdata.numIndex, meshdata.attribs, meshdata.attribCount); + _mesh = Mesh::create(meshdata.vertex, meshdata.vertexSizeInFloat, meshdata.indices, meshdata.attribs); CC_SAFE_RETAIN(_mesh); _skin = MeshSkin::create(fullPath, ""); @@ -342,7 +342,7 @@ void Sprite3D::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) _meshCommand.setDepthTestEnabled(true); if (_skin) { - _meshCommand.setMatrixPaletteSize(_skin->getMatrixPaletteSize()); + _meshCommand.setMatrixPaletteSize((int)_skin->getMatrixPaletteSize()); _meshCommand.setMatrixPalette(_skin->getMatrixPalette()); } //support tint and fade diff --git a/cocos/base/CCConsole.cpp b/cocos/base/CCConsole.cpp index 744d31ac80..e06185654c 100644 --- a/cocos/base/CCConsole.cpp +++ b/cocos/base/CCConsole.cpp @@ -222,7 +222,7 @@ static void _log(const char *format, va_list args) WCHAR wszBuf[MAX_LOG_LENGTH] = {0}; MultiByteToWideChar(CP_UTF8, 0, buf, -1, wszBuf, sizeof(wszBuf)); OutputDebugStringW(wszBuf); - WideCharToMultiByte(CP_ACP, 0, wszBuf, -1, buf, sizeof(buf), NULL, FALSE); + WideCharToMultiByte(CP_ACP, 0, wszBuf, -1, buf, sizeof(buf), nullptr, FALSE); printf("%s", buf); fflush(stdout); #else @@ -337,7 +337,7 @@ bool Console::listenOnTCP(int port) #endif #endif - if ( (n = getaddrinfo(NULL, serv, &hints, &res)) != 0) { + if ( (n = getaddrinfo(nullptr, serv, &hints, &res)) != 0) { fprintf(stderr,"net_listen error for %s: %s", serv, gai_strerror(n)); return false; } @@ -359,9 +359,9 @@ bool Console::listenOnTCP(int port) #else close(listenfd); #endif - } while ( (res = res->ai_next) != NULL); + } while ( (res = res->ai_next) != nullptr); - if (res == NULL) { + if (res == nullptr) { perror("net_listen:"); freeaddrinfo(ressave); return false; @@ -372,14 +372,14 @@ bool Console::listenOnTCP(int port) if (res->ai_family == AF_INET) { char buf[INET_ADDRSTRLEN] = ""; struct sockaddr_in *sin = (struct sockaddr_in*) res->ai_addr; - if( inet_ntop(res->ai_family, &sin->sin_addr, buf, sizeof(buf)) != NULL ) + if( inet_ntop(res->ai_family, &sin->sin_addr, buf, sizeof(buf)) != nullptr ) cocos2d::log("Console: listening on %s : %d", buf, ntohs(sin->sin_port)); else perror("inet_ntop"); } else if (res->ai_family == AF_INET6) { char buf[INET6_ADDRSTRLEN] = ""; struct sockaddr_in6 *sin = (struct sockaddr_in6*) res->ai_addr; - if( inet_ntop(res->ai_family, &sin->sin6_addr, buf, sizeof(buf)) != NULL ) + if( inet_ntop(res->ai_family, &sin->sin6_addr, buf, sizeof(buf)) != nullptr ) cocos2d::log("Console: listening on %s : %d", buf, ntohs(sin->sin6_port)); else perror("inet_ntop"); @@ -1042,7 +1042,7 @@ void Console::loop() copy_set = _read_set; timeout_copy = timeout; - int nready = select(_maxfd+1, ©_set, NULL, NULL, &timeout_copy); + int nready = select(_maxfd+1, ©_set, nullptr, nullptr, &timeout_copy); if( nready == -1 ) { diff --git a/cocos/base/CCEventDispatcher.cpp b/cocos/base/CCEventDispatcher.cpp index e7bc3ae889..a3f033a34a 100644 --- a/cocos/base/CCEventDispatcher.cpp +++ b/cocos/base/CCEventDispatcher.cpp @@ -613,7 +613,7 @@ void EventDispatcher::removeEventListener(EventListener* listener) if (l->getAssociatedNode() != nullptr) { dissociateNodeAndEventListener(l->getAssociatedNode(), l); - l->setAssociatedNode(nullptr); // NULL out the node pointer so we don't have any dangling pointers to destroyed nodes. + l->setAssociatedNode(nullptr); // nullptr out the node pointer so we don't have any dangling pointers to destroyed nodes. } if (_inDispatch == 0) @@ -1276,7 +1276,7 @@ void EventDispatcher::removeEventListenersForListenerID(const EventListener::Lis if (l->getAssociatedNode() != nullptr) { dissociateNodeAndEventListener(l->getAssociatedNode(), l); - l->setAssociatedNode(nullptr); // NULL out the node pointer so we don't have any dangling pointers to destroyed nodes. + l->setAssociatedNode(nullptr); // nullptr out the node pointer so we don't have any dangling pointers to destroyed nodes. } if (_inDispatch == 0) diff --git a/cocos/base/CCRef.cpp b/cocos/base/CCRef.cpp index 140bde422b..747b08ccdf 100644 --- a/cocos/base/CCRef.cpp +++ b/cocos/base/CCRef.cpp @@ -65,7 +65,7 @@ Ref::~Ref() else { ScriptEngineProtocol* pEngine = ScriptEngineManager::getInstance()->getScriptEngine(); - if (pEngine != NULL && pEngine->getScriptType() == kScriptTypeJavascript) + if (pEngine != nullptr && pEngine->getScriptType() == kScriptTypeJavascript) { pEngine->removeScriptObjectByObject(this); } diff --git a/cocos/base/CCUserDefault.h b/cocos/base/CCUserDefault.h index 6d98743da2..8ba6bcf7d8 100644 --- a/cocos/base/CCUserDefault.h +++ b/cocos/base/CCUserDefault.h @@ -173,7 +173,7 @@ public: /** * @js NA */ - const static std::string& getXMLFilePath(); + static const std::string& getXMLFilePath(); /** * @js NA */ diff --git a/cocos/base/TGAlib.cpp b/cocos/base/TGAlib.cpp index 5c097f6c46..16462d5a60 100644 --- a/cocos/base/TGAlib.cpp +++ b/cocos/base/TGAlib.cpp @@ -181,7 +181,7 @@ void tgaFlipImage( tImageTGA *info ) unsigned char *row = (unsigned char *)malloc(rowbytes); int y; - if (row == NULL) return; + if (row == nullptr) return; for( y = 0; y < (info->height/2); y++ ) { @@ -233,7 +233,7 @@ tImageTGA* tgaLoadBuffer(unsigned char* buffer, long size) info->imageData = (unsigned char *)malloc(sizeof(unsigned char) * total); // check to make sure we have the memory required - if (info->imageData == NULL) + if (info->imageData == nullptr) { info->status = TGA_ERROR_MEMORY; break; diff --git a/cocos/base/ccTypes.h b/cocos/base/ccTypes.h index 7911e37f22..0aa38f29bc 100644 --- a/cocos/base/ccTypes.h +++ b/cocos/base/ccTypes.h @@ -66,15 +66,15 @@ struct Color3B GLubyte g; GLubyte b; - const static Color3B WHITE; - const static Color3B YELLOW; - const static Color3B BLUE; - const static Color3B GREEN; - const static Color3B RED; - const static Color3B MAGENTA; - const static Color3B BLACK; - const static Color3B ORANGE; - const static Color3B GRAY; + static const Color3B WHITE; + static const Color3B YELLOW; + static const Color3B BLUE; + static const Color3B GREEN; + static const Color3B RED; + static const Color3B MAGENTA; + static const Color3B BLACK; + static const Color3B ORANGE; + static const Color3B GRAY; }; /** RGBA color composed of 4 bytes @@ -99,15 +99,15 @@ struct Color4B GLubyte b; GLubyte a; - const static Color4B WHITE; - const static Color4B YELLOW; - const static Color4B BLUE; - const static Color4B GREEN; - const static Color4B RED; - const static Color4B MAGENTA; - const static Color4B BLACK; - const static Color4B ORANGE; - const static Color4B GRAY; + static const Color4B WHITE; + static const Color4B YELLOW; + static const Color4B BLUE; + static const Color4B GREEN; + static const Color4B RED; + static const Color4B MAGENTA; + static const Color4B BLACK; + static const Color4B ORANGE; + static const Color4B GRAY; }; @@ -138,15 +138,15 @@ struct Color4F GLfloat b; GLfloat a; - const static Color4F WHITE; - const static Color4F YELLOW; - const static Color4F BLUE; - const static Color4F GREEN; - const static Color4F RED; - const static Color4F MAGENTA; - const static Color4F BLACK; - const static Color4F ORANGE; - const static Color4F GRAY; + static const Color4F WHITE; + static const Color4F YELLOW; + static const Color4F BLUE; + static const Color4F GREEN; + static const Color4F RED; + static const Color4F MAGENTA; + static const Color4F BLACK; + static const Color4F ORANGE; + static const Color4F GRAY; }; /** A vertex composed of 2 floats: x, y @@ -335,13 +335,13 @@ struct BlendFunc GLenum dst; //! Blending disabled. Uses {GL_ONE, GL_ZERO} - const static BlendFunc DISABLE; + static const BlendFunc DISABLE; //! Blending enabled for textures with Alpha premultiplied. Uses {GL_ONE, GL_ONE_MINUS_SRC_ALPHA} - const static BlendFunc ALPHA_PREMULTIPLIED; + static const BlendFunc ALPHA_PREMULTIPLIED; //! Blending enabled for textures with Alpha NON premultiplied. Uses {GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA} - const static BlendFunc ALPHA_NON_PREMULTIPLIED; + static const BlendFunc ALPHA_NON_PREMULTIPLIED; //! Enables Additive blending. Uses {GL_SRC_ALPHA, GL_ONE} - const static BlendFunc ADDITIVE; + static const BlendFunc ADDITIVE; bool operator==(const BlendFunc &a) const { diff --git a/cocos/deprecated/CCDeprecated.h b/cocos/deprecated/CCDeprecated.h index 685a47fc4b..b1837b6d17 100644 --- a/cocos/deprecated/CCDeprecated.h +++ b/cocos/deprecated/CCDeprecated.h @@ -1020,7 +1020,7 @@ CC_DEPRECATED_ATTRIBUTE inline void CC_DLL ccGLEnableVertexAttribs(unsigned int CC_DEPRECATED_ATTRIBUTE inline void CC_DLL ccGLBindTexture2D(GLuint textureId) { GL::bindTexture2D(textureId); } CC_DEPRECATED_ATTRIBUTE inline void CC_DLL ccGLBindTexture2DN(GLuint textureUnit, GLuint textureId) { GL::bindTexture2DN(textureUnit, textureId); } CC_DEPRECATED_ATTRIBUTE inline void CC_DLL ccGLDeleteTexture(GLuint textureId) { GL::deleteTexture(textureId); } -CC_DEPRECATED_ATTRIBUTE inline void CC_DLL ccGLDeleteTextureN(GLuint textureUnit, GLuint textureId) { GL::deleteTextureN(textureUnit, textureId); } +CC_DEPRECATED_ATTRIBUTE inline void CC_DLL ccGLDeleteTextureN(GLuint textureUnit, GLuint textureId) { GL::deleteTexture(textureId); } CC_DEPRECATED_ATTRIBUTE inline void CC_DLL ccGLBindVAO(GLuint vaoId) { GL::bindVAO(vaoId); } CC_DEPRECATED_ATTRIBUTE inline void CC_DLL ccGLEnable( int flags ) { /* ignore */ }; CC_DEPRECATED_ATTRIBUTE typedef int ccGLServerState; diff --git a/cocos/deprecated/CCDictionary.cpp b/cocos/deprecated/CCDictionary.cpp index 96ae7dcc7a..23919b6daf 100644 --- a/cocos/deprecated/CCDictionary.cpp +++ b/cocos/deprecated/CCDictionary.cpp @@ -97,7 +97,7 @@ unsigned int __Dictionary::count() __Array* __Dictionary::allKeys() { int iKeyCount = this->count(); - if (iKeyCount <= 0) return NULL; + if (iKeyCount <= 0) return nullptr; __Array* array = __Array::createWithCapacity(iKeyCount); @@ -127,7 +127,7 @@ __Array* __Dictionary::allKeys() __Array* __Dictionary::allKeysForObject(Ref* object) { int iKeyCount = this->count(); - if (iKeyCount <= 0) return NULL; + if (iKeyCount <= 0) return nullptr; __Array* array = __Array::create(); DictElement *pElement, *tmp; @@ -161,16 +161,16 @@ __Array* __Dictionary::allKeysForObject(Ref* object) Ref* __Dictionary::objectForKey(const std::string& key) { - // if dictionary wasn't initialized, return NULL directly. - if (_dictType == kDictUnknown) return NULL; + // if dictionary wasn't initialized, return nullptr directly. + if (_dictType == kDictUnknown) return nullptr; // __Dictionary only supports one kind of key, string or integer. // This method uses string as key, therefore we should make sure that the key type of this __Dictionary is string. CCASSERT(_dictType == kDictStr, "this dictionary does not use string as key."); - Ref* pRetObject = NULL; - DictElement *pElement = NULL; + Ref* pRetObject = nullptr; + DictElement *pElement = nullptr; HASH_FIND_STR(_elements, key.c_str(), pElement); - if (pElement != NULL) + if (pElement != nullptr) { pRetObject = pElement->_object; } @@ -179,16 +179,16 @@ Ref* __Dictionary::objectForKey(const std::string& key) Ref* __Dictionary::objectForKey(intptr_t key) { - // if dictionary wasn't initialized, return NULL directly. - if (_dictType == kDictUnknown) return NULL; + // if dictionary wasn't initialized, return nullptr directly. + if (_dictType == kDictUnknown) return nullptr; // __Dictionary only supports one kind of key, string or integer. // This method uses integer as key, therefore we should make sure that the key type of this __Dictionary is integer. CCASSERT(_dictType == kDictInt, "this dictionary does not use integer as key."); - Ref* pRetObject = NULL; - DictElement *pElement = NULL; + Ref* pRetObject = nullptr; + DictElement *pElement = nullptr; HASH_FIND_PTR(_elements, &key, pElement); - if (pElement != NULL) + if (pElement != nullptr) { pRetObject = pElement->_object; } @@ -198,7 +198,7 @@ Ref* __Dictionary::objectForKey(intptr_t key) const __String* __Dictionary::valueForKey(const std::string& key) { __String* pStr = dynamic_cast<__String*>(objectForKey(key)); - if (pStr == NULL) + if (pStr == nullptr) { pStr = __String::create(""); } @@ -208,7 +208,7 @@ const __String* __Dictionary::valueForKey(const std::string& key) const __String* __Dictionary::valueForKey(intptr_t key) { __String* pStr = dynamic_cast<__String*>(objectForKey(key)); - if (pStr == NULL) + if (pStr == nullptr) { pStr = __String::create(""); } @@ -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 != NULL, "Invalid Argument!"); + CCASSERT(key.length() > 0 && pObject != nullptr, "Invalid Argument!"); if (_dictType == kDictUnknown) { _dictType = kDictStr; @@ -225,9 +225,9 @@ void __Dictionary::setObject(Ref* pObject, const std::string& key) CCASSERT(_dictType == kDictStr, "this dictionary doesn't use string as key."); - DictElement *pElement = NULL; + DictElement *pElement = nullptr; HASH_FIND_STR(_elements, key.c_str(), pElement); - if (pElement == NULL) + if (pElement == nullptr) { setObjectUnSafe(pObject, key); } @@ -243,7 +243,7 @@ void __Dictionary::setObject(Ref* pObject, const std::string& key) void __Dictionary::setObject(Ref* pObject, intptr_t key) { - CCASSERT(pObject != NULL, "Invalid Argument!"); + CCASSERT(pObject != nullptr, "Invalid Argument!"); if (_dictType == kDictUnknown) { _dictType = kDictInt; @@ -251,9 +251,9 @@ void __Dictionary::setObject(Ref* pObject, intptr_t key) CCASSERT(_dictType == kDictInt, "this dictionary doesn't use integer as key."); - DictElement *pElement = NULL; + DictElement *pElement = nullptr; HASH_FIND_PTR(_elements, &key, pElement); - if (pElement == NULL) + if (pElement == nullptr) { setObjectUnSafe(pObject, key); } @@ -277,7 +277,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!"); - DictElement *pElement = NULL; + DictElement *pElement = nullptr; HASH_FIND_STR(_elements, key.c_str(), pElement); removeObjectForElememt(pElement); } @@ -290,7 +290,7 @@ void __Dictionary::removeObjectForKey(intptr_t key) } CCASSERT(_dictType == kDictInt, "this dictionary doesn't use integer as its key"); - DictElement *pElement = NULL; + DictElement *pElement = nullptr; HASH_FIND_PTR(_elements, &key, pElement); removeObjectForElememt(pElement); } @@ -311,7 +311,7 @@ void __Dictionary::setObjectUnSafe(Ref* pObject, const intptr_t key) void __Dictionary::removeObjectsForKeys(__Array* pKey__Array) { - Ref* pObj = NULL; + Ref* pObj = nullptr; CCARRAY_FOREACH(pKey__Array, pObj) { __String* pStr = static_cast<__String*>(pObj); @@ -321,7 +321,7 @@ void __Dictionary::removeObjectsForKeys(__Array* pKey__Array) void __Dictionary::removeObjectForElememt(DictElement* pElement) { - if (pElement != NULL) + if (pElement != nullptr) { HASH_DEL(_elements, pElement); pElement->_object->release(); @@ -345,7 +345,7 @@ Ref* __Dictionary::randomObject() { if (_dictType == kDictUnknown) { - return NULL; + return nullptr; } Ref* key = allKeys()->getRandomObject(); @@ -360,7 +360,7 @@ Ref* __Dictionary::randomObject() } else { - return NULL; + return nullptr; } } @@ -566,9 +566,9 @@ __Dictionary* __Dictionary::clone() const { __Dictionary* newDict = __Dictionary::create(); - DictElement* element = NULL; - Ref* tmpObj = NULL; - Clonable* obj = NULL; + DictElement* element = nullptr; + Ref* tmpObj = nullptr; + Clonable* obj = nullptr; if (_dictType == kDictInt) { CCDICT_FOREACH(this, element) diff --git a/cocos/deprecated/CCSet.cpp b/cocos/deprecated/CCSet.cpp index 081b7a5de6..28c1d9bedb 100644 --- a/cocos/deprecated/CCSet.cpp +++ b/cocos/deprecated/CCSet.cpp @@ -66,7 +66,7 @@ __Set * __Set::create() { __Set * pRet = new __Set(); - if (pRet != NULL) + if (pRet != nullptr) { pRet->autorelease(); } diff --git a/cocos/deprecated/CCString.cpp b/cocos/deprecated/CCString.cpp index 8492573d70..06bf28d7de 100644 --- a/cocos/deprecated/CCString.cpp +++ b/cocos/deprecated/CCString.cpp @@ -69,7 +69,7 @@ bool __String::initWithFormatAndValist(const char* format, va_list ap) { bool bRet = false; char* pBuf = (char*)malloc(kMaxStringLen); - if (pBuf != NULL) + if (pBuf != nullptr) { vsnprintf(pBuf, kMaxStringLen, format, ap); _string = pBuf; @@ -170,7 +170,7 @@ void __String::appendWithFormat(const char* format, ...) va_start(ap, format); char* pBuf = (char*)malloc(kMaxStringLen); - if (pBuf != NULL) + if (pBuf != nullptr) { vsnprintf(pBuf, kMaxStringLen, format, ap); _string.append(pBuf); @@ -207,7 +207,7 @@ bool __String::isEqual(const Ref* pObject) { bool bRet = false; const __String* pStr = dynamic_cast(pObject); - if (pStr != NULL) + if (pStr != nullptr) { if (0 == _string.compare(pStr->_string)) { @@ -226,11 +226,11 @@ __String* __String::create(const std::string& str) __String* __String::createWithData(const unsigned char* data, size_t nLen) { - __String* ret = NULL; - if (data != NULL) + __String* ret = nullptr; + if (data != nullptr) { char* pStr = (char*)malloc(nLen+1); - if (pStr != NULL) + if (pStr != nullptr) { pStr[nLen] = '\0'; if (nLen > 0) diff --git a/cocos/editor-support/cocosbuilder/CCControlButtonLoader.cpp b/cocos/editor-support/cocosbuilder/CCControlButtonLoader.cpp index ba20f8fd13..7cd0f56cf4 100644 --- a/cocos/editor-support/cocosbuilder/CCControlButtonLoader.cpp +++ b/cocos/editor-support/cocosbuilder/CCControlButtonLoader.cpp @@ -86,15 +86,15 @@ void ControlButtonLoader::onHandlePropTypeSize(Node * pNode, Node * pParent, con void ControlButtonLoader::onHandlePropTypeSpriteFrame(Node * pNode, Node * pParent, const char * pPropertyName, SpriteFrame * pSpriteFrame, CCBReader * ccbReader) { if(strcmp(pPropertyName, PROPERTY_BACKGROUNDSPRITEFRAME_NORMAL) == 0) { - if(pSpriteFrame != NULL) { + if(pSpriteFrame != nullptr) { ((ControlButton *)pNode)->setBackgroundSpriteFrameForState(pSpriteFrame, Control::State::NORMAL); } } else if(strcmp(pPropertyName, PROPERTY_BACKGROUNDSPRITEFRAME_HIGHLIGHTED) == 0) { - if(pSpriteFrame != NULL) { + if(pSpriteFrame != nullptr) { ((ControlButton *)pNode)->setBackgroundSpriteFrameForState(pSpriteFrame, Control::State::HIGH_LIGHTED); } } else if(strcmp(pPropertyName, PROPERTY_BACKGROUNDSPRITEFRAME_DISABLED) == 0) { - if(pSpriteFrame != NULL) { + if(pSpriteFrame != nullptr) { ((ControlButton *)pNode)->setBackgroundSpriteFrameForState(pSpriteFrame, Control::State::DISABLED); } } else { diff --git a/cocos/editor-support/cocosbuilder/CCMenuItemImageLoader.cpp b/cocos/editor-support/cocosbuilder/CCMenuItemImageLoader.cpp index 21bb3b0b6b..cd093fdb59 100644 --- a/cocos/editor-support/cocosbuilder/CCMenuItemImageLoader.cpp +++ b/cocos/editor-support/cocosbuilder/CCMenuItemImageLoader.cpp @@ -10,15 +10,15 @@ namespace cocosbuilder { void MenuItemImageLoader::onHandlePropTypeSpriteFrame(Node * pNode, Node * pParent, const char * pPropertyName, SpriteFrame * pSpriteFrame, CCBReader * ccbReader) { if(strcmp(pPropertyName, PROPERTY_NORMALDISPLAYFRAME) == 0) { - if(pSpriteFrame != NULL) { + if(pSpriteFrame != nullptr) { ((MenuItemImage *)pNode)->setNormalSpriteFrame(pSpriteFrame); } } else if(strcmp(pPropertyName, PROPERTY_SELECTEDDISPLAYFRAME) == 0) { - if(pSpriteFrame != NULL) { + if(pSpriteFrame != nullptr) { ((MenuItemImage *)pNode)->setSelectedSpriteFrame(pSpriteFrame); } } else if(strcmp(pPropertyName, PROPERTY_DISABLEDDISPLAYFRAME) == 0) { - if(pSpriteFrame != NULL) { + if(pSpriteFrame != nullptr) { ((MenuItemImage *)pNode)->setDisabledSpriteFrame(pSpriteFrame); } } else { diff --git a/cocos/editor-support/cocosbuilder/CCMenuItemLoader.cpp b/cocos/editor-support/cocosbuilder/CCMenuItemLoader.cpp index 1388c3f4ef..6afd3304e2 100644 --- a/cocos/editor-support/cocosbuilder/CCMenuItemLoader.cpp +++ b/cocos/editor-support/cocosbuilder/CCMenuItemLoader.cpp @@ -9,7 +9,7 @@ namespace cocosbuilder { void MenuItemLoader::onHandlePropTypeBlock(Node * pNode, Node * pParent, const char * pPropertyName, BlockData * pBlockData, CCBReader * ccbReader) { if(strcmp(pPropertyName, PROPERTY_BLOCK) == 0) { - if (NULL != pBlockData) // Add this condition to allow MenuItemImage without target/selector predefined + if (nullptr != pBlockData) // Add this condition to allow MenuItemImage without target/selector predefined { ((MenuItem *)pNode)->setCallback( std::bind( pBlockData->mSELMenuHandler, pBlockData->_target, std::placeholders::_1) ); // ((MenuItem *)pNode)->setTarget(pBlockData->_target, pBlockData->mSELMenuHandler); diff --git a/cocos/editor-support/cocosbuilder/CCNodeLoader.cpp b/cocos/editor-support/cocosbuilder/CCNodeLoader.cpp index f97adba07f..fd8b7a9765 100644 --- a/cocos/editor-support/cocosbuilder/CCNodeLoader.cpp +++ b/cocos/editor-support/cocosbuilder/CCNodeLoader.cpp @@ -71,7 +71,7 @@ void NodeLoader::parseProperties(Node * pNode, Node * pParent, CCBReader * ccbRe // #endif // Forward properties for sub ccb files - if (dynamic_cast(pNode) != NULL) + if (dynamic_cast(pNode) != nullptr) { CCBFile *ccbNode = (CCBFile*)pNode; if (ccbNode->getCCBFileNode() && isExtraProp) @@ -80,7 +80,7 @@ void NodeLoader::parseProperties(Node * pNode, Node * pParent, CCBReader * ccbRe // Skip properties that doesn't have a value to override __Array *extraPropsNames = (__Array*)pNode->getUserObject(); - Ref* pObj = NULL; + Ref* pObj = nullptr; bool bFound = false; CCARRAY_FOREACH(extraPropsNames, pObj) { @@ -346,7 +346,7 @@ void NodeLoader::parseProperties(Node * pNode, Node * pParent, CCBReader * ccbRe case CCBReader::PropertyType::BLOCK_CONTROL: { BlockControlData * blockControlData = this->parsePropTypeBlockControl(pNode, pParent, ccbReader); - if(setProp && blockControlData != NULL) { + if(setProp && blockControlData != nullptr) { this->onHandlePropTypeBlockControl(pNode, pParent, propertyName.c_str(), blockControlData, ccbReader); } CC_SAFE_DELETE(blockControlData); @@ -574,14 +574,14 @@ SpriteFrame * NodeLoader::parsePropTypeSpriteFrame(Node * pNode, Node * pParent, std::string spriteSheet = ccbReader->readCachedString(); std::string spriteFile = ccbReader->readCachedString(); - SpriteFrame *spriteFrame = NULL; + SpriteFrame *spriteFrame = nullptr; if (spriteFile.length() != 0) { if (spriteSheet.length() == 0) { spriteFile = ccbReader->getCCBRootPath() + spriteFile; Texture2D * texture = Director::getInstance()->getTextureCache()->addImage(spriteFile.c_str()); - if(texture != NULL) { + if(texture != nullptr) { Rect bounds = Rect(0, 0, texture->getContentSize().width, texture->getContentSize().height); spriteFrame = SpriteFrame::createWithTexture(texture, bounds); } @@ -613,7 +613,7 @@ Animation * NodeLoader::parsePropTypeAnimation(Node * pNode, Node * pParent, CCB std::string animationFile = ccbReader->getCCBRootPath() + ccbReader->readCachedString(); std::string animation = ccbReader->readCachedString(); - Animation * ccAnimation = NULL; + Animation * ccAnimation = nullptr; // Support for stripping relative file paths, since ios doesn't currently // know what to do with them, since its pulling from bundle. @@ -642,7 +642,7 @@ Texture2D * NodeLoader::parsePropTypeTexture(Node * pNode, Node * pParent, CCBRe } else { - return NULL; + return nullptr; } } @@ -761,7 +761,7 @@ BlockData * NodeLoader::parsePropTypeBlock(Node * pNode, Node * pParent, CCBRead if(selectorTarget != CCBReader::TargetType::NONE) { - Ref* target = NULL; + Ref* target = nullptr; if(!ccbReader->isJSControlled()) { if(selectorTarget == CCBReader::TargetType::DOCUMENT_ROOT) @@ -773,7 +773,7 @@ BlockData * NodeLoader::parsePropTypeBlock(Node * pNode, Node * pParent, CCBRead target = ccbReader->getOwner(); } - if(target != NULL) + if(target != nullptr) { if(selectorName.length() > 0) { @@ -781,7 +781,7 @@ BlockData * NodeLoader::parsePropTypeBlock(Node * pNode, Node * pParent, CCBRead CCBSelectorResolver * targetAsCCBSelectorResolver = dynamic_cast(target); - if(targetAsCCBSelectorResolver != NULL) + if(targetAsCCBSelectorResolver != nullptr) { selMenuHandler = targetAsCCBSelectorResolver->onResolveCCBCCMenuItemSelector(target, selectorName.c_str()); } @@ -789,7 +789,7 @@ BlockData * NodeLoader::parsePropTypeBlock(Node * pNode, Node * pParent, CCBRead if(selMenuHandler == 0) { CCBSelectorResolver * ccbSelectorResolver = ccbReader->getCCBSelectorResolver(); - if(ccbSelectorResolver != NULL) + if(ccbSelectorResolver != nullptr) { selMenuHandler = ccbSelectorResolver->onResolveCCBCCMenuItemSelector(target, selectorName.c_str()); } @@ -809,7 +809,7 @@ BlockData * NodeLoader::parsePropTypeBlock(Node * pNode, Node * pParent, CCBRead CCLOG("Unexpected empty selector."); } } else { - CCLOG("Unexpected NULL target for selector."); + CCLOG("Unexpected nullptr target for selector."); } } else @@ -831,7 +831,7 @@ BlockData * NodeLoader::parsePropTypeBlock(Node * pNode, Node * pParent, CCBRead } } - return NULL; + return nullptr; } BlockControlData * NodeLoader::parsePropTypeBlockControl(Node * pNode, Node * pParent, CCBReader * ccbReader) @@ -844,7 +844,7 @@ BlockControlData * NodeLoader::parsePropTypeBlockControl(Node * pNode, Node * pP { if(!ccbReader->isJSControlled()) { - Ref* target = NULL; + Ref* target = nullptr; if(selectorTarget == CCBReader::TargetType::DOCUMENT_ROOT) { target = ccbReader->getAnimationManager()->getRootNode(); @@ -854,7 +854,7 @@ BlockControlData * NodeLoader::parsePropTypeBlockControl(Node * pNode, Node * pP target = ccbReader->getOwner(); } - if(target != NULL) + if(target != nullptr) { if(selectorName.length() > 0) { @@ -862,7 +862,7 @@ BlockControlData * NodeLoader::parsePropTypeBlockControl(Node * pNode, Node * pP CCBSelectorResolver * targetAsCCBSelectorResolver = dynamic_cast(target); - if(targetAsCCBSelectorResolver != NULL) + if(targetAsCCBSelectorResolver != nullptr) { selControlHandler = targetAsCCBSelectorResolver->onResolveCCBCCControlSelector(target, selectorName.c_str()); } @@ -870,7 +870,7 @@ BlockControlData * NodeLoader::parsePropTypeBlockControl(Node * pNode, Node * pP if(selControlHandler == 0) { CCBSelectorResolver * ccbSelectorResolver = ccbReader->getCCBSelectorResolver(); - if(ccbSelectorResolver != NULL) + if(ccbSelectorResolver != nullptr) { selControlHandler = ccbSelectorResolver->onResolveCCBCCControlSelector(target, selectorName.c_str()); } @@ -894,7 +894,7 @@ BlockControlData * NodeLoader::parsePropTypeBlockControl(Node * pNode, Node * pP CCLOG("Unexpected empty selector."); } } else { - CCLOG("Unexpected NULL target for selector."); + CCLOG("Unexpected nullptr target for selector."); } } else @@ -914,7 +914,7 @@ BlockControlData * NodeLoader::parsePropTypeBlockControl(Node * pNode, Node * pP } } - return NULL; + return nullptr; } Node * NodeLoader::parsePropTypeCCBFile(Node * pNode, Node * pParent, CCBReader * pCCBReader) { @@ -960,7 +960,7 @@ Node * NodeLoader::parsePropTypeCCBFile(Node * pNode, Node * pParent, CCBReader reader->getAnimationManager()->runAnimationsForSequenceIdTweenDuration(reader->getAnimationManager()->getAutoPlaySequenceId(), 0); } - if (reader->isJSControlled() && pCCBReader->isJSControlled() && NULL == reader->_owner) + if (reader->isJSControlled() && pCCBReader->isJSControlled() && nullptr == reader->_owner) { //set variables and callback to owner //set callback diff --git a/cocos/editor-support/cocosbuilder/CCNodeLoaderLibrary.cpp b/cocos/editor-support/cocosbuilder/CCNodeLoaderLibrary.cpp index ff497635e0..339058bce8 100644 --- a/cocos/editor-support/cocosbuilder/CCNodeLoaderLibrary.cpp +++ b/cocos/editor-support/cocosbuilder/CCNodeLoaderLibrary.cpp @@ -79,10 +79,10 @@ void NodeLoaderLibrary::purge(bool pReleaseNodeLoaders) { -static NodeLoaderLibrary * sSharedNodeLoaderLibrary = NULL; +static NodeLoaderLibrary * sSharedNodeLoaderLibrary = nullptr; NodeLoaderLibrary * NodeLoaderLibrary::getInstance() { - if(sSharedNodeLoaderLibrary == NULL) { + if(sSharedNodeLoaderLibrary == nullptr) { sSharedNodeLoaderLibrary = new NodeLoaderLibrary(); sSharedNodeLoaderLibrary->registerDefaultNodeLoaders(); diff --git a/cocos/editor-support/cocosbuilder/CCSpriteLoader.cpp b/cocos/editor-support/cocosbuilder/CCSpriteLoader.cpp index 0194ffd6b2..ab6df19a96 100644 --- a/cocos/editor-support/cocosbuilder/CCSpriteLoader.cpp +++ b/cocos/editor-support/cocosbuilder/CCSpriteLoader.cpp @@ -12,10 +12,10 @@ namespace cocosbuilder { void SpriteLoader::onHandlePropTypeSpriteFrame(Node * pNode, Node * pParent, const char * pPropertyName, SpriteFrame * pSpriteFrame, CCBReader * ccbReader) { if(strcmp(pPropertyName, PROPERTY_DISPLAYFRAME) == 0) { - if(pSpriteFrame != NULL) { + if(pSpriteFrame != nullptr) { ((Sprite *)pNode)->setSpriteFrame(pSpriteFrame); } else { - CCLOG("ERROR: SpriteFrame NULL"); + CCLOG("ERROR: SpriteFrame nullptr"); } } else { NodeLoader::onHandlePropTypeSpriteFrame(pNode, pParent, pPropertyName, pSpriteFrame, ccbReader); diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.cpp index 657db83656..5ccc31f8d9 100644 --- a/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.cpp +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.cpp @@ -68,7 +68,7 @@ VisibleFrame* VisibleFrame::create() return frame; } CC_SAFE_DELETE(frame); - return NULL; + return nullptr; } VisibleFrame::VisibleFrame() @@ -104,7 +104,7 @@ TextureFrame* TextureFrame::create() return frame; } CC_SAFE_DELETE(frame); - return NULL; + return nullptr; } TextureFrame::TextureFrame() @@ -155,7 +155,7 @@ RotationFrame* RotationFrame::create() return frame; } CC_SAFE_DELETE(frame); - return NULL; + return nullptr; } RotationFrame::RotationFrame() @@ -204,7 +204,7 @@ SkewFrame* SkewFrame::create() return frame; } CC_SAFE_DELETE(frame); - return NULL; + return nullptr; } SkewFrame::SkewFrame() @@ -261,7 +261,7 @@ RotationSkewFrame* RotationSkewFrame::create() return frame; } CC_SAFE_DELETE(frame); - return NULL; + return nullptr; } RotationSkewFrame::RotationSkewFrame() @@ -314,7 +314,7 @@ PositionFrame* PositionFrame::create() return frame; } CC_SAFE_DELETE(frame); - return NULL; + return nullptr; } PositionFrame::PositionFrame() @@ -366,7 +366,7 @@ ScaleFrame* ScaleFrame::create() return frame; } CC_SAFE_DELETE(frame); - return NULL; + return nullptr; } ScaleFrame::ScaleFrame() @@ -421,7 +421,7 @@ AnchorPointFrame* AnchorPointFrame::create() return frame; } CC_SAFE_DELETE(frame); - return NULL; + return nullptr; } AnchorPointFrame::AnchorPointFrame() @@ -457,7 +457,7 @@ InnerActionFrame* InnerActionFrame::create() return frame; } CC_SAFE_DELETE(frame); - return NULL; + return nullptr; } InnerActionFrame::InnerActionFrame() @@ -493,7 +493,7 @@ ColorFrame* ColorFrame::create() return frame; } CC_SAFE_DELETE(frame); - return NULL; + return nullptr; } ColorFrame::ColorFrame() @@ -559,7 +559,7 @@ EventFrame* EventFrame::create() return frame; } CC_SAFE_DELETE(frame); - return NULL; + return nullptr; } EventFrame::EventFrame() @@ -594,7 +594,7 @@ ZOrderFrame* ZOrderFrame::create() return frame; } CC_SAFE_DELETE(frame); - return NULL; + return nullptr; } ZOrderFrame::ZOrderFrame() @@ -605,7 +605,7 @@ ZOrderFrame::ZOrderFrame() void ZOrderFrame::onEnter(Frame *nextFrame) { if(_node) - _node->setZOrder(_zorder); + _node->setLocalZOrder(_zorder); } diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCNodeReader.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CCNodeReader.cpp index f8efb43a4c..6d180fc4e2 100644 --- a/cocos/editor-support/cocostudio/ActionTimeline/CCNodeReader.cpp +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCNodeReader.cpp @@ -284,9 +284,9 @@ void NodeReader::initNode(Node* node, const rapidjson::Value& json) if (rotation != 0) node->setRotation(rotation); if(rotationSkewX != 0) - node->setRotationX(rotationSkewX); + node->setRotationSkewX(rotationSkewX); if(rotationSkewY != 0) - node->setRotationY(rotationSkewY); + node->setRotationSkewY(rotationSkewY); if(skewx != 0) node->setSkewX(skewx); if(skewy != 0) @@ -296,7 +296,7 @@ void NodeReader::initNode(Node* node, const rapidjson::Value& json) if(width != 0 || height != 0) node->setContentSize(Size(width, height)); if(zorder != 0) - node->setZOrder(zorder); + node->setLocalZOrder(zorder); if(visible != true) node->setVisible(visible); diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCTimeLine.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CCTimeLine.cpp index 7516cbc255..c9f04cc985 100644 --- a/cocos/editor-support/cocostudio/ActionTimeline/CCTimeLine.cpp +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCTimeLine.cpp @@ -104,7 +104,7 @@ void Timeline::insertFrame(Frame* frame, int index) void Timeline::removeFrame(Frame* frame) { _frames.eraseObject(frame); - frame->setTimeline(NULL); + frame->setTimeline(nullptr); } void Timeline::setNode(Node* node) @@ -131,8 +131,8 @@ void Timeline::apply(int frameIndex) void Timeline::binarySearchKeyFrame(int frameIndex) { - Frame *from = NULL; - Frame *to = NULL; + Frame *from = nullptr; + Frame *to = nullptr; long length = _frames.size(); bool needEnterFrame = false; diff --git a/cocos/editor-support/cocostudio/CCBone.cpp b/cocos/editor-support/cocostudio/CCBone.cpp index 5c0daf2e79..7a446d1521 100644 --- a/cocos/editor-support/cocostudio/CCBone.cpp +++ b/cocos/editor-support/cocostudio/CCBone.cpp @@ -201,8 +201,8 @@ void Bone::update(float delta) _worldInfo->y = _tweenData->y + _position.y; _worldInfo->scaleX = _tweenData->scaleX * _scaleX; _worldInfo->scaleY = _tweenData->scaleY * _scaleY; - _worldInfo->skewX = _tweenData->skewX + _skewX + _rotationX; - _worldInfo->skewY = _tweenData->skewY + _skewY - _rotationY; + _worldInfo->skewX = _tweenData->skewX + _skewX + _rotationZ_X; + _worldInfo->skewY = _tweenData->skewY + _skewY - _rotationZ_Y; if(_parentBone) { diff --git a/cocos/editor-support/cocostudio/CCDataReaderHelper.cpp b/cocos/editor-support/cocostudio/CCDataReaderHelper.cpp index 64ca8917b9..88be54e2cb 100644 --- a/cocos/editor-support/cocostudio/CCDataReaderHelper.cpp +++ b/cocos/editor-support/cocostudio/CCDataReaderHelper.cpp @@ -1311,7 +1311,7 @@ void DataReaderHelper::addDataFromJsonCache(const std::string& fileContent, Data length = DICTOOL->getArrayCount_json(json, CONFIG_FILE_PATH); // json[CONFIG_FILE_PATH].IsNull() ? 0 : json[CONFIG_FILE_PATH].Size(); for (int i = 0; i < length; i++) { - const char *path = DICTOOL->getStringValueFromArray_json(json, CONFIG_FILE_PATH, i); // json[CONFIG_FILE_PATH][i].IsNull() ? NULL : json[CONFIG_FILE_PATH][i].GetString(); + const char *path = DICTOOL->getStringValueFromArray_json(json, CONFIG_FILE_PATH, i); // json[CONFIG_FILE_PATH][i].IsNull() ? nullptr : json[CONFIG_FILE_PATH][i].GetString(); if (path == nullptr) { CCLOG("load CONFIG_FILE_PATH error."); @@ -2426,21 +2426,21 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json, } else if (key.compare(A_HEIGHT) == 0) { - if(str != NULL) + if(str != nullptr) { textureData->height = atof(str); } } else if (key.compare(A_PIVOT_X) == 0) { - if(str != NULL) + if(str != nullptr) { textureData->pivotX = atof(str); } } else if (key.compare(A_PIVOT_Y) == 0) { - if(str != NULL) + if(str != nullptr) { textureData->pivotY = atof(str); } diff --git a/cocos/editor-support/cocostudio/CCSGUIReader.cpp b/cocos/editor-support/cocostudio/CCSGUIReader.cpp index 9204b255de..7221c51809 100644 --- a/cocos/editor-support/cocostudio/CCSGUIReader.cpp +++ b/cocos/editor-support/cocostudio/CCSGUIReader.cpp @@ -351,7 +351,7 @@ Widget* GUIReader::widgetFromBinaryFile(const char *fileName) const char* fileVersion = ""; ui::Widget* widget = nullptr; - if (pBuffer != NULL && nSize > 0) + if (pBuffer != nullptr && nSize > 0) { CocoLoader tCocoLoader; if(true == tCocoLoader.ReadCocoBinBuff((char*)pBuffer)) @@ -494,7 +494,7 @@ Widget* WidgetPropertiesReader0250::createWidget(const rapidjson::Value& data, c if (widget->getContentSize().equals(Size::ZERO)) { Layout* rootWidget = dynamic_cast(widget); - rootWidget->setSize(Size(fileDesignWidth, fileDesignHeight)); + rootWidget->setContentSize(Size(fileDesignWidth, fileDesignHeight)); } /* ********************** */ @@ -608,7 +608,7 @@ void WidgetPropertiesReader0250::setPropsForWidgetFromJsonDictionary(Widget*widg float w = DICTOOL->getFloatValue_json(options, "width"); float h = DICTOOL->getFloatValue_json(options, "height"); - widget->setSize(Size(w, h)); + widget->setContentSize(Size(w, h)); widget->setTag(DICTOOL->getIntValue_json(options, "tag")); widget->setActionTag(DICTOOL->getIntValue_json(options, "actiontag")); @@ -707,7 +707,7 @@ void WidgetPropertiesReader0250::setPropsForButtonFromJsonDictionary(Widget*widg { float swf = DICTOOL->getFloatValue_json(options, "scale9Width"); float shf = DICTOOL->getFloatValue_json(options, "scale9Height"); - button->setSize(Size(swf, shf)); + button->setContentSize(Size(swf, shf)); } } else @@ -823,7 +823,7 @@ void WidgetPropertiesReader0250::setPropsForImageViewFromJsonDictionary(Widget*w { float swf = DICTOOL->getFloatValue_json(options, "scale9Width"); float shf = DICTOOL->getFloatValue_json(options, "scale9Height"); - imageView->setSize(Size(swf, shf)); + imageView->setContentSize(Size(swf, shf)); } float cx = DICTOOL->getFloatValue_json(options, "capInsetsX"); @@ -1016,7 +1016,7 @@ void WidgetPropertiesReader0250::setPropsForSliderFromJsonDictionary(Widget*widg { slider->loadBarTexture(imageFileName_tp); } - slider->setSize(Size(barLength, slider->getContentSize().height)); + slider->setContentSize(Size(barLength, slider->getContentSize().height)); } else { @@ -1204,7 +1204,7 @@ Widget* WidgetPropertiesReader0300::createWidget(const rapidjson::Value& data, c if (widget->getContentSize().equals(Size::ZERO)) { Layout* rootWidget = dynamic_cast(widget); - rootWidget->setSize(Size(fileDesignWidth, fileDesignHeight)); + rootWidget->setContentSize(Size(fileDesignWidth, fileDesignHeight)); } /* ********************** */ @@ -1268,7 +1268,7 @@ Widget* WidgetPropertiesReader0300::createWidget(const rapidjson::Value& data, c if (widget->getContentSize().equals(Size::ZERO)) { Layout* rootWidget = dynamic_cast(widget); - rootWidget->setSize(Size(fileDesignWidth, fileDesignHeight)); + rootWidget->setContentSize(Size(fileDesignWidth, fileDesignHeight)); } } } @@ -1340,7 +1340,7 @@ Widget* WidgetPropertiesReader0300::widgetFromBinary(CocoLoader* cocoLoader, st setPropsForAllWidgetFromBinary(reader, widget, cocoLoader, optionsNode); // 2nd., custom widget parse with custom reader //2nd. parse custom property - const char* customProperty = NULL; + const char* customProperty = nullptr; stExpCocoNode *optionChildNode = optionsNode->GetChildArray(cocoLoader); for (int k = 0; k < optionsNode->GetChildNum(); ++k) { std::string key = optionChildNode[k].GetName(cocoLoader); diff --git a/cocos/editor-support/cocostudio/CCSSceneReader.cpp b/cocos/editor-support/cocostudio/CCSSceneReader.cpp index c6ca142de4..92177e9284 100644 --- a/cocos/editor-support/cocostudio/CCSSceneReader.cpp +++ b/cocos/editor-support/cocostudio/CCSSceneReader.cpp @@ -531,7 +531,7 @@ void SceneReader::setPropertyFromJsonDict(CocoLoader *cocoLoader, stExpCocoNode else if (key == "zorder") { nZorder = atoi(value.c_str()); - node->setZOrder(nZorder); + node->setLocalZOrder(nZorder); } else if(key == "scalex") { diff --git a/cocos/editor-support/cocostudio/CocoLoader.cpp b/cocos/editor-support/cocostudio/CocoLoader.cpp index f4e5234e48..334858fe0c 100644 --- a/cocos/editor-support/cocostudio/CocoLoader.cpp +++ b/cocos/editor-support/cocostudio/CocoLoader.cpp @@ -92,7 +92,7 @@ Type stExpCocoNode::GetType(CocoLoader* pCoco) char* stExpCocoNode::GetName(CocoLoader* pCoco) { - char* szName = NULL ; + char* szName = nullptr ; if(m_ObjIndex >= 0) { stExpCocoObjectDesc* tpCocoObjectDesc = pCoco->GetCocoObjectDescArray(); @@ -130,10 +130,19 @@ char* stExpCocoNode::GetName(CocoLoader* pCoco) } -char* stExpCocoNode::GetValue(CocoLoader* pCoco) -{ - return ( pCoco->GetMemoryAddr_String() + m_szValue ); -} + char* stExpCocoNode::GetValue(CocoLoader* pCoco) + { + char* szValue = ( pCoco->GetMemoryAddr_String() + m_szValue ); + if(GetType(pCoco) == kStringType ) + { + if(szValue && 0==strcmp(szValue,"null")) + { + strcpy(szValue,""); + } + } + return szValue; + } + int stExpCocoNode::GetChildNum() { @@ -147,9 +156,9 @@ stExpCocoNode* stExpCocoNode::GetChildArray(CocoLoader* pCoco) CocoLoader::CocoLoader() { - m_pRootNode = NULL; - m_pObjectDescArray = NULL; - m_pMemoryBuff = NULL; + m_pRootNode = nullptr; + m_pObjectDescArray = nullptr; + m_pMemoryBuff = nullptr; } CocoLoader::~CocoLoader() @@ -157,7 +166,7 @@ CocoLoader::~CocoLoader() if(m_pMemoryBuff) { delete[] m_pMemoryBuff; - m_pMemoryBuff = NULL; + m_pMemoryBuff = nullptr; } } @@ -198,7 +207,7 @@ stExpCocoObjectDesc* CocoLoader::GetCocoObjectDesc(const char* szObjDesc) return &m_pObjectDescArray[i]; } } - return NULL; + return nullptr; } stExpCocoObjectDesc* CocoLoader::GetCocoObjectDesc(int vIndex) @@ -207,7 +216,7 @@ stExpCocoObjectDesc* CocoLoader::GetCocoObjectDesc(int vIndex) { return &m_pObjectDescArray[vIndex]; } - return NULL; + return nullptr; } char* CocoLoader::GetMemoryAddr_AttribDesc() diff --git a/cocos/editor-support/cocostudio/TriggerMng.cpp b/cocos/editor-support/cocostudio/TriggerMng.cpp index 5e90a13d71..779b5dca86 100755 --- a/cocos/editor-support/cocostudio/TriggerMng.cpp +++ b/cocos/editor-support/cocostudio/TriggerMng.cpp @@ -115,7 +115,7 @@ void TriggerMng::parse(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCoc #if CC_ENABLE_SCRIPT_BINDING ScriptEngineProtocol* engine = ScriptEngineManager::getInstance()->getScriptEngine(); - bool useBindings = engine != NULL; + bool useBindings = engine != nullptr; if (useBindings) { @@ -234,7 +234,7 @@ bool TriggerMng::isEmpty(void) const const char *str2 = pActionArray[i3].GetValue(pCocoLoader); if (key2.compare("classname") == 0) { - if (str2 != NULL) + if (str2 != nullptr) { action.AddMember("classname", str2, allocator); } @@ -255,7 +255,7 @@ bool TriggerMng::isEmpty(void) const const char *str3 = pDataItemArray[i5].GetValue(pCocoLoader); if (key3.compare("key") == 0) { - if (str3 != NULL) + if (str3 != nullptr) { dataitem.AddMember("key", str3, allocator); } @@ -310,7 +310,7 @@ bool TriggerMng::isEmpty(void) const const char *str4 = pConditionArray[i7].GetValue(pCocoLoader); if (key4.compare("classname") == 0) { - if (str4 != NULL) + if (str4 != nullptr) { cond.AddMember("classname", str4, allocator); } @@ -331,7 +331,7 @@ bool TriggerMng::isEmpty(void) const const char *str5 = pDataItemArray[i9].GetValue(pCocoLoader); if (key5.compare("key") == 0) { - if (str5 != NULL) + if (str5 != nullptr) { dataitem.AddMember("key", str5, allocator); } @@ -380,7 +380,7 @@ bool TriggerMng::isEmpty(void) const stExpCocoNode *pEventArray = pEventsArray->GetChildArray(pCocoLoader); std::string key6 = pEventArray[0].GetName(pCocoLoader); const char *str6 = pEventArray[0].GetValue(pCocoLoader); - if (key6.compare("id") == 0 && str6 != NULL) + if (key6.compare("id") == 0 && str6 != nullptr) { event.AddMember("id", atoi(str6), allocator); eventsItem.PushBack(event, allocator); @@ -390,7 +390,7 @@ bool TriggerMng::isEmpty(void) const } else if (key1.compare("id") == 0) { - if (str1 != NULL) + if (str1 != nullptr) { vElemItem.AddMember("id", atoi(str1), allocator); } diff --git a/cocos/editor-support/cocostudio/TriggerObj.cpp b/cocos/editor-support/cocostudio/TriggerObj.cpp index 444780de5e..7fec68a848 100755 --- a/cocos/editor-support/cocostudio/TriggerObj.cpp +++ b/cocos/editor-support/cocostudio/TriggerObj.cpp @@ -253,7 +253,7 @@ void TriggerObj::serialize(const rapidjson::Value &val) const char* str0 = pTriggerObjArray[i0].GetValue(pCocoLoader); if (key.compare("id") == 0) { - if (str0 != NULL) + if (str0 != nullptr) { _id = atoi(str0); //(unsigned int)(DICTOOL->getIntValue_json(val, "id")); } @@ -292,7 +292,7 @@ void TriggerObj::serialize(const rapidjson::Value &val) continue; } BaseTriggerAction *act = dynamic_cast(ObjectFactory::getInstance()->createObject(classname)); - CCAssert(act != NULL, "class named classname can not implement!"); + CCAssert(act != nullptr, "class named classname can not implement!"); act->serialize(pCocoLoader, &pActionArray[1]); act->init(); _acts.pushBack(act); diff --git a/cocos/editor-support/cocostudio/WidgetReader/ButtonReader/ButtonReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/ButtonReader/ButtonReader.cpp index c96a1dfbe7..0587e91454 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/ButtonReader/ButtonReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/ButtonReader/ButtonReader.cpp @@ -152,7 +152,7 @@ namespace cocostudio if (button->isScale9Enabled()) { button->setCapInsets(Rect(capsx, capsy, capsWidth, capsHeight)); - button->setSize(Size(scale9Width, scale9Height)); + button->setContentSize(Size(scale9Width, scale9Height)); } button->setTitleColor(Color3B(cri, cgi, cbi)); @@ -203,7 +203,7 @@ namespace cocostudio { float swf = DICTOOL->getFloatValue_json(options, P_Scale9Width); float shf = DICTOOL->getFloatValue_json(options, P_Scale9Height); - button->setSize(Size(swf, shf)); + button->setContentSize(Size(swf, shf)); } } bool tt = DICTOOL->checkObjectExist_json(options, P_Text); diff --git a/cocos/editor-support/cocostudio/WidgetReader/CheckBoxReader/CheckBoxReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/CheckBoxReader/CheckBoxReader.cpp index 691097d1eb..85a6775411 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/CheckBoxReader/CheckBoxReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/CheckBoxReader/CheckBoxReader.cpp @@ -15,7 +15,7 @@ namespace cocostudio static const char* P_BackGroundBoxDisabledData = "backGroundBoxDisabledData"; static const char* P_FrontCrossDisabledData = "frontCrossDisabledData"; - static CheckBoxReader* instanceCheckBoxReader = NULL; + static CheckBoxReader* instanceCheckBoxReader = nullptr; IMPLEMENT_CLASS_WIDGET_READER_INFO(CheckBoxReader) diff --git a/cocos/editor-support/cocostudio/WidgetReader/ImageViewReader/ImageViewReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/ImageViewReader/ImageViewReader.cpp index 4e8be4ac45..2558a17d85 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/ImageViewReader/ImageViewReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/ImageViewReader/ImageViewReader.cpp @@ -19,7 +19,7 @@ namespace cocostudio static const char* P_Scale9Height = "scale9Height"; - static ImageViewReader* instanceImageViewReader = NULL; + static ImageViewReader* instanceImageViewReader = nullptr; IMPLEMENT_CLASS_WIDGET_READER_INFO(ImageViewReader) @@ -128,7 +128,7 @@ namespace cocostudio float swf = DICTOOL->getFloatValue_json(options, P_Scale9Width,80.0f); float shf = DICTOOL->getFloatValue_json(options, P_Scale9Height,80.0f); - imageView->setSize(Size(swf, shf)); + imageView->setContentSize(Size(swf, shf)); float cx = DICTOOL->getFloatValue_json(options, P_CapInsetsX); diff --git a/cocos/editor-support/cocostudio/WidgetReader/LayoutReader/LayoutReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/LayoutReader/LayoutReader.cpp index 155e41d523..42c504a1d2 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/LayoutReader/LayoutReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/LayoutReader/LayoutReader.cpp @@ -34,7 +34,7 @@ namespace cocostudio static const char* P_BackGroundImageData = "backGroundImageData"; static const char* P_LayoutType = "layoutType"; - static LayoutReader* instanceLayoutReader = NULL; + static LayoutReader* instanceLayoutReader = nullptr; IMPLEMENT_CLASS_WIDGET_READER_INFO(LayoutReader) diff --git a/cocos/editor-support/cocostudio/WidgetReader/ListViewReader/ListViewReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/ListViewReader/ListViewReader.cpp index 0870898954..89e5c72344 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/ListViewReader/ListViewReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/ListViewReader/ListViewReader.cpp @@ -12,7 +12,7 @@ namespace cocostudio static const char* P_Direction = "direction"; static const char* P_ItemMargin = "itemMargin"; - static ListViewReader* instanceListViewReader = NULL; + static ListViewReader* instanceListViewReader = nullptr; IMPLEMENT_CLASS_WIDGET_READER_INFO(ListViewReader) diff --git a/cocos/editor-support/cocostudio/WidgetReader/LoadingBarReader/LoadingBarReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/LoadingBarReader/LoadingBarReader.cpp index 3c09400c96..f283ac4c56 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/LoadingBarReader/LoadingBarReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/LoadingBarReader/LoadingBarReader.cpp @@ -19,7 +19,7 @@ namespace cocostudio static const char* P_Direction = "direction"; static const char* P_Percent = "percent"; - static LoadingBarReader* instanceLoadingBar = NULL; + static LoadingBarReader* instanceLoadingBar = nullptr; IMPLEMENT_CLASS_WIDGET_READER_INFO(LoadingBarReader) @@ -130,7 +130,7 @@ namespace cocostudio float width = DICTOOL->getFloatValue_json(options, P_Width); float height = DICTOOL->getFloatValue_json(options, P_Height); - loadingBar->setSize(Size(width, height)); + loadingBar->setContentSize(Size(width, height)); /**/ diff --git a/cocos/editor-support/cocostudio/WidgetReader/SliderReader/SliderReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/SliderReader/SliderReader.cpp index d2cb6d13ab..e15cd2b52f 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/SliderReader/SliderReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/SliderReader/SliderReader.cpp @@ -18,7 +18,7 @@ namespace cocostudio static const char* P_BallDisabledData = "ballDisabledData"; static const char* P_ProgressBarData = "progressBarData"; - static SliderReader* instanceSliderReader = NULL; + static SliderReader* instanceSliderReader = nullptr; IMPLEMENT_CLASS_WIDGET_READER_INFO(SliderReader) @@ -123,7 +123,7 @@ namespace cocostudio } //end of for loop if (slider->isScale9Enabled()) { - slider->setSize(Size(barLength, slider->getContentSize().height)); + slider->setContentSize(Size(barLength, slider->getContentSize().height)); } slider->setPercent(percent); diff --git a/cocos/editor-support/cocostudio/WidgetReader/TextAtlasReader/TextAtlasReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/TextAtlasReader/TextAtlasReader.cpp index 858668e6a8..45fccfda69 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/TextAtlasReader/TextAtlasReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/TextAtlasReader/TextAtlasReader.cpp @@ -15,7 +15,7 @@ namespace cocostudio static const char* P_ItemHeight = "itemHeight"; static const char* P_StartCharMap = "startCharMap"; - static TextAtlasReader* instanceTextAtalsReader = NULL; + static TextAtlasReader* instanceTextAtalsReader = nullptr; IMPLEMENT_CLASS_WIDGET_READER_INFO(TextAtlasReader) diff --git a/cocos/editor-support/cocostudio/WidgetReader/TextBMFontReader/TextBMFontReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/TextBMFontReader/TextBMFontReader.cpp index 99c6f3735a..a13dffde8a 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/TextBMFontReader/TextBMFontReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/TextBMFontReader/TextBMFontReader.cpp @@ -12,7 +12,7 @@ namespace cocostudio static const char* P_FileNameData = "fileNameData"; static const char* P_Text = "text"; - static TextBMFontReader* instanceTextBMFontReader = NULL; + static TextBMFontReader* instanceTextBMFontReader = nullptr; IMPLEMENT_CLASS_WIDGET_READER_INFO(TextBMFontReader) diff --git a/cocos/editor-support/cocostudio/WidgetReader/TextFieldReader/TextFieldReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/TextFieldReader/TextFieldReader.cpp index 5d844a5cff..117a4d3216 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/TextFieldReader/TextFieldReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/TextFieldReader/TextFieldReader.cpp @@ -9,7 +9,7 @@ using namespace ui; namespace cocostudio { - static TextFieldReader* instanceTextFieldReader = NULL; + static TextFieldReader* instanceTextFieldReader = nullptr; static const char* P_PlaceHolder = "placeHolder"; static const char* P_Text = "text"; diff --git a/cocos/editor-support/cocostudio/WidgetReader/TextReader/TextReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/TextReader/TextReader.cpp index 9f8ff87c42..786856e408 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/TextReader/TextReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/TextReader/TextReader.cpp @@ -18,7 +18,7 @@ namespace cocostudio static const char* P_HAlignment = "hAlignment"; static const char* P_VAlignment = "vAlignment"; - static TextReader* instanceTextReader = NULL; + static TextReader* instanceTextReader = nullptr; IMPLEMENT_CLASS_WIDGET_READER_INFO(TextReader) diff --git a/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.cpp index 01652acff0..f68f2af107 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.cpp @@ -59,7 +59,7 @@ namespace cocostudio const char* P_Path = "path"; - static WidgetReader* instanceWidgetReader = NULL; + static WidgetReader* instanceWidgetReader = nullptr; IMPLEMENT_CLASS_WIDGET_READER_INFO(WidgetReader) @@ -139,7 +139,7 @@ namespace cocostudio w = DICTOOL->getFloatValue_json(options, P_Width); h = DICTOOL->getFloatValue_json(options, P_Height); } - widget->setSize(Size(w, h)); + widget->setContentSize(Size(w, h)); widget->setTag(DICTOOL->getIntValue_json(options, P_Tag)); widget->setActionTag(DICTOOL->getIntValue_json(options, P_ActionTag)); @@ -259,7 +259,7 @@ namespace cocostudio widget->setOpacity(_opacity); //the setSize method will be conflict with scale9Width & scale9Height if (!widget->isIgnoreContentAdaptWithSize()) { - widget->setSize(Size(_width, _height)); + widget->setContentSize(Size(_width, _height)); } widget->setPosition(_position); widget->setAnchorPoint(_originalAnchorPoint); diff --git a/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.h b/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.h index 319b525190..ca62aab066 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.h @@ -174,7 +174,7 @@ namespace cocostudio }else if(key == P_Visbile){ \ widget->setVisible(valueToBool(value)); \ }else if(key == P_ZOrder){ \ - widget->setZOrder(valueToInt(value)); \ + widget->setLocalZOrder(valueToInt(value)); \ }else if(key == P_LayoutParameter){ \ stExpCocoNode *layoutCocosNode = stChildArray[i].GetChildArray(cocoLoader); \ ui::LinearLayoutParameter *linearParameter = ui::LinearLayoutParameter::create(); \ diff --git a/cocos/math/Mat4.cpp b/cocos/math/Mat4.cpp index cd6217f1ad..ff598d3da8 100644 --- a/cocos/math/Mat4.cpp +++ b/cocos/math/Mat4.cpp @@ -156,7 +156,7 @@ void Mat4::createOrthographicOffCenter(float left, float right, float bottom, fl void Mat4::createBillboard(const Vec3& objectPosition, const Vec3& cameraPosition, const Vec3& cameraUpVector, Mat4* dst) { - createBillboardHelper(objectPosition, cameraPosition, cameraUpVector, NULL, dst); + createBillboardHelper(objectPosition, cameraPosition, cameraUpVector, nullptr, dst); } void Mat4::createBillboard(const Vec3& objectPosition, const Vec3& cameraPosition, @@ -441,7 +441,7 @@ bool Mat4::decompose(Vec3* scale, Quaternion* rotation, Vec3* translation) const } // Nothing left to do. - if (scale == NULL && rotation == NULL) + if (scale == nullptr && rotation == nullptr) return true; // Extract the scale. @@ -469,7 +469,7 @@ bool Mat4::decompose(Vec3* scale, Quaternion* rotation, Vec3* translation) const } // Nothing left to do. - if (rotation == NULL) + if (rotation == nullptr) return true; // Scale too close to zero, can't decompose rotation. @@ -559,17 +559,17 @@ float Mat4::determinant() const void Mat4::getScale(Vec3* scale) const { - decompose(scale, NULL, NULL); + decompose(scale, nullptr, nullptr); } bool Mat4::getRotation(Quaternion* rotation) const { - return decompose(NULL, rotation, NULL); + return decompose(nullptr, rotation, nullptr); } void Mat4::getTranslation(Vec3* translation) const { - decompose(NULL, NULL, translation); + decompose(nullptr, nullptr, translation); } void Mat4::getUpVector(Vec3* dst) const diff --git a/cocos/network/SocketIO.cpp b/cocos/network/SocketIO.cpp index 0afb564976..ac36095145 100644 --- a/cocos/network/SocketIO.cpp +++ b/cocos/network/SocketIO.cpp @@ -401,9 +401,9 @@ void SIOClientImpl::onMessage(WebSocket* ws, const WebSocket::Data& data) s_data = payload; - SIOClient *c = NULL; + SIOClient *c = nullptr; c = getClient(endpoint); - if (c == NULL) log("SIOClientImpl::onMessage client lookup returned NULL"); + if (c == nullptr) log("SIOClientImpl::onMessage client lookup returned nullptr"); switch(control) { @@ -671,7 +671,7 @@ SIOClient* SocketIO::connect(const std::string& uri, SocketIO::SIODelegate& dele //check if already connected to endpoint, handle c = socket->getClient(path); - if(c == NULL) + if(c == nullptr) { c = new SIOClient(host, port, path, socket, delegate); diff --git a/cocos/network/WebSocket.cpp b/cocos/network/WebSocket.cpp index 4035af022d..e0729b7f98 100644 --- a/cocos/network/WebSocket.cpp +++ b/cocos/network/WebSocket.cpp @@ -445,7 +445,7 @@ void WebSocket::onSubThreadStarted() _path.c_str(), _host.c_str(), _host.c_str(), name.c_str(), -1); - if(NULL == _wsInstance) { + if(nullptr == _wsInstance) { WsMessage* msg = new WsMessage(); msg->what = WS_MSG_TO_UITHREAD_ERROR; _readyState = State::CLOSING; diff --git a/cocos/platform/desktop/CCGLView.cpp b/cocos/platform/desktop/CCGLView.cpp index b4ba261a84..a934875204 100644 --- a/cocos/platform/desktop/CCGLView.cpp +++ b/cocos/platform/desktop/CCGLView.cpp @@ -703,9 +703,9 @@ static bool glew_dynamic_binding() const char *gl_extensions = (const char*)glGetString(GL_EXTENSIONS); // If the current opengl driver doesn't have framebuffers methods, check if an extension exists - if (glGenFramebuffers == NULL) + if (glGenFramebuffers == nullptr) { - log("OpenGL: glGenFramebuffers is NULL, try to detect an extension"); + log("OpenGL: glGenFramebuffers is nullptr, try to detect an extension"); if (strstr(gl_extensions, "ARB_framebuffer_object")) { log("OpenGL: ARB_framebuffer_object is supported"); diff --git a/cocos/platform/win32/CCApplication.cpp b/cocos/platform/win32/CCApplication.cpp index 2afa94595b..1192732492 100644 --- a/cocos/platform/win32/CCApplication.cpp +++ b/cocos/platform/win32/CCApplication.cpp @@ -55,7 +55,7 @@ Application::Application() Application::~Application() { CC_ASSERT(this == sm_pSharedApplication); - sm_pSharedApplication = NULL; + sm_pSharedApplication = nullptr; } int Application::run() @@ -248,7 +248,7 @@ static void PVRFrameEnableControlWindow(bool bEnable) KEY_ALL_ACCESS, 0, &hKey, - NULL)) + nullptr)) { return; } @@ -257,7 +257,7 @@ static void PVRFrameEnableControlWindow(bool bEnable) const WCHAR* wszNewData = (bEnable) ? L"NO" : L"YES"; WCHAR wszOldData[256] = {0}; DWORD dwSize = sizeof(wszOldData); - LSTATUS status = RegQueryValueExW(hKey, wszValue, 0, NULL, (LPBYTE)wszOldData, &dwSize); + LSTATUS status = RegQueryValueExW(hKey, wszValue, 0, nullptr, (LPBYTE)wszOldData, &dwSize); if (ERROR_FILE_NOT_FOUND == status // the key not exist || (ERROR_SUCCESS == status // or the hide_gui value is exist && 0 != wcscmp(wszNewData, wszOldData))) // but new data and old data not equal diff --git a/cocos/platform/win32/CCCommon.cpp b/cocos/platform/win32/CCCommon.cpp index a95ed75d00..a1e2319055 100644 --- a/cocos/platform/win32/CCCommon.cpp +++ b/cocos/platform/win32/CCCommon.cpp @@ -35,12 +35,12 @@ NS_CC_BEGIN void MessageBox(const char * pszMsg, const char * pszTitle) { - MessageBoxA(NULL, pszMsg, pszTitle, MB_OK); + MessageBoxA(nullptr, pszMsg, pszTitle, MB_OK); } void LuaLog(const char *pszMsg) { - int bufflen = MultiByteToWideChar(CP_UTF8, 0, pszMsg, -1, NULL, 0); + int bufflen = MultiByteToWideChar(CP_UTF8, 0, pszMsg, -1, nullptr, 0); WCHAR* widebuff = new WCHAR[bufflen + 1]; memset(widebuff, 0, sizeof(WCHAR) * (bufflen + 1)); MultiByteToWideChar(CP_UTF8, 0, pszMsg, -1, widebuff, bufflen); @@ -48,10 +48,10 @@ void LuaLog(const char *pszMsg) OutputDebugStringW(widebuff); OutputDebugStringA("\n"); - bufflen = WideCharToMultiByte(CP_ACP, 0, widebuff, -1, NULL, 0, NULL, NULL); + bufflen = WideCharToMultiByte(CP_ACP, 0, widebuff, -1, nullptr, 0, nullptr, nullptr); char* buff = new char[bufflen + 1]; memset(buff, 0, sizeof(char) * (bufflen + 1)); - WideCharToMultiByte(CP_ACP, 0, widebuff, -1, buff, bufflen, NULL, NULL); + WideCharToMultiByte(CP_ACP, 0, widebuff, -1, buff, bufflen, nullptr, nullptr); puts(buff); delete[] widebuff; diff --git a/cocos/platform/win32/CCDevice.cpp b/cocos/platform/win32/CCDevice.cpp index ab9b3e489b..778b58aaa7 100644 --- a/cocos/platform/win32/CCDevice.cpp +++ b/cocos/platform/win32/CCDevice.cpp @@ -37,10 +37,10 @@ int Device::getDPI() static int dpi = -1; if (dpi == -1) { - HDC hScreenDC = GetDC( NULL ); + HDC hScreenDC = GetDC( nullptr ); int PixelsX = GetDeviceCaps( hScreenDC, HORZRES ); int MMX = GetDeviceCaps( hScreenDC, HORZSIZE ); - ReleaseDC( NULL, hScreenDC ); + ReleaseDC( nullptr, hScreenDC ); dpi = 254.0f*PixelsX/MMX/10; } return dpi; @@ -55,7 +55,7 @@ void Device::setAccelerometerInterval(float interval) class BitmapDC { public: - BitmapDC(HWND hWnd = NULL) + BitmapDC(HWND hWnd = nullptr) : _DC(nullptr) , _bmp(nullptr) , _font((HFONT)GetStockObject(DEFAULT_GUI_FONT)) @@ -79,7 +79,7 @@ public: wchar_t * utf8ToUtf16(const std::string& str) { - wchar_t * pwszBuffer = NULL; + wchar_t * pwszBuffer = nullptr; do { if (str.empty()) @@ -99,7 +99,7 @@ public: } - bool setFont(const char * pFontName = NULL, int nSize = 0) + bool setFont(const char * pFontName = nullptr, int nSize = 0) { bool bRet = false; do @@ -154,7 +154,7 @@ public: SendMessage( _wnd, WM_FONTCHANGE, 0, 0); } delete [] pwszBuffer; - pwszBuffer = NULL; + pwszBuffer = nullptr; } } @@ -214,11 +214,11 @@ public: if (_bmp) { DeleteObject(_bmp); - _bmp = NULL; + _bmp = nullptr; } if (nWidth > 0 && nHeight > 0) { - _bmp = CreateBitmap(nWidth, nHeight, 1, 32, NULL); + _bmp = CreateBitmap(nWidth, nHeight, 1, 32, nullptr); if (! _bmp) { return false; @@ -364,7 +364,7 @@ private: RemoveFontResource(pwszBuffer); SendMessage( _wnd, WM_FONTCHANGE, 0, 0); delete [] pwszBuffer; - pwszBuffer = NULL; + pwszBuffer = nullptr; } _curFontPath.clear(); } @@ -404,7 +404,7 @@ Data Device::getTextureDataForText(const char * text, const FontDefinition& text } bi = {0}; bi.bmiHeader.biSize = sizeof(bi.bmiHeader); CC_BREAK_IF(! GetDIBits(dc.getDC(), dc.getBitmap(), 0, 0, - NULL, (LPBITMAPINFO)&bi, DIB_RGB_COLORS)); + nullptr, (LPBITMAPINFO)&bi, DIB_RGB_COLORS)); width = (short)size.cx; height = (short)size.cy; @@ -416,7 +416,7 @@ Data Device::getTextureDataForText(const char * text, const FontDefinition& text (LPBITMAPINFO)&bi, DIB_RGB_COLORS); // change pixel's alpha value to 255, when it's RGB != 0 - COLORREF * pPixel = NULL; + COLORREF * pPixel = nullptr; for (int y = 0; y < height; ++y) { pPixel = (COLORREF *)dataBuf + y * width; diff --git a/cocos/platform/win32/CCFileUtilsWin32.cpp b/cocos/platform/win32/CCFileUtilsWin32.cpp index 2d036c5dfc..a652850879 100644 --- a/cocos/platform/win32/CCFileUtilsWin32.cpp +++ b/cocos/platform/win32/CCFileUtilsWin32.cpp @@ -63,7 +63,7 @@ static void _checkPath() GetCurrentDirectoryW(sizeof(utf16Path)-1, utf16Path); char utf8Path[CC_MAX_PATH] = {0}; - int nNum = WideCharToMultiByte(CP_UTF8, 0, utf16Path, -1, utf8Path, sizeof(utf8Path), NULL, NULL); + int nNum = WideCharToMultiByte(CP_UTF8, 0, utf16Path, -1, utf8Path, sizeof(utf8Path), nullptr, nullptr); s_resourcePath = convertPathFormatToUnixStyle(utf8Path); s_resourcePath.append("/"); @@ -72,13 +72,13 @@ static void _checkPath() FileUtils* FileUtils::getInstance() { - if (s_sharedFileUtils == NULL) + if (s_sharedFileUtils == nullptr) { s_sharedFileUtils = new FileUtilsWin32(); if(!s_sharedFileUtils->init()) { delete s_sharedFileUtils; - s_sharedFileUtils = NULL; + s_sharedFileUtils = nullptr; CCLOG("ERROR: Could not init CCFileUtilsWin32"); } } @@ -147,10 +147,10 @@ static Data getData(const std::string& filename, bool forString) WCHAR wszBuf[CC_MAX_PATH] = {0}; MultiByteToWideChar(CP_UTF8, 0, fullPath.c_str(), -1, wszBuf, sizeof(wszBuf)/sizeof(wszBuf[0])); - HANDLE fileHandle = ::CreateFileW(wszBuf, GENERIC_READ, 0, NULL, OPEN_EXISTING, NULL, NULL); + HANDLE fileHandle = ::CreateFileW(wszBuf, GENERIC_READ, 0, NULL, OPEN_EXISTING, NULL, nullptr); CC_BREAK_IF(fileHandle == INVALID_HANDLE_VALUE); - size = ::GetFileSize(fileHandle, NULL); + size = ::GetFileSize(fileHandle, nullptr); if (forString) { @@ -163,7 +163,7 @@ static Data getData(const std::string& filename, bool forString) } DWORD sizeRead = 0; BOOL successed = FALSE; - successed = ::ReadFile(fileHandle, buffer, size, &sizeRead, NULL); + successed = ::ReadFile(fileHandle, buffer, size, &sizeRead, nullptr); ::CloseHandle(fileHandle); if (!successed) @@ -212,7 +212,7 @@ Data FileUtilsWin32::getDataFromFile(const std::string& filename) unsigned char* FileUtilsWin32::getFileData(const std::string& filename, const char* mode, ssize_t* size) { - unsigned char * pBuffer = NULL; + unsigned char * pBuffer = nullptr; *size = 0; do { @@ -222,15 +222,15 @@ unsigned char* FileUtilsWin32::getFileData(const std::string& filename, const ch WCHAR wszBuf[CC_MAX_PATH] = {0}; MultiByteToWideChar(CP_UTF8, 0, fullPath.c_str(), -1, wszBuf, sizeof(wszBuf)/sizeof(wszBuf[0])); - HANDLE fileHandle = ::CreateFileW(wszBuf, GENERIC_READ, 0, NULL, OPEN_EXISTING, NULL, NULL); + HANDLE fileHandle = ::CreateFileW(wszBuf, GENERIC_READ, 0, NULL, OPEN_EXISTING, NULL, nullptr); CC_BREAK_IF(fileHandle == INVALID_HANDLE_VALUE); - *size = ::GetFileSize(fileHandle, NULL); + *size = ::GetFileSize(fileHandle, nullptr); pBuffer = (unsigned char*) malloc(*size); DWORD sizeRead = 0; BOOL successed = FALSE; - successed = ::ReadFile(fileHandle, pBuffer, *size, &sizeRead, NULL); + successed = ::ReadFile(fileHandle, pBuffer, *size, &sizeRead, nullptr); ::CloseHandle(fileHandle); if (!successed) @@ -275,7 +275,7 @@ string FileUtilsWin32::getWritablePath() const { // Get full path of executable, e.g. c:\Program Files (x86)\My Game Folder\MyGame.exe char full_path[CC_MAX_PATH + 1]; - ::GetModuleFileNameA(NULL, full_path, CC_MAX_PATH + 1); + ::GetModuleFileNameA(nullptr, full_path, CC_MAX_PATH + 1); // Debug app uses executable directory; Non-debug app uses local app data directory #ifndef _DEBUG @@ -287,7 +287,7 @@ string FileUtilsWin32::getWritablePath() const char app_data_path[CC_MAX_PATH + 1]; // Get local app data directory, e.g. C:\Documents and Settings\username\Local Settings\Application Data - if (SUCCEEDED(SHGetFolderPathA(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, app_data_path))) + if (SUCCEEDED(SHGetFolderPathA(nullptr, CSIDL_LOCAL_APPDATA, nullptr, SHGFP_TYPE_CURRENT, app_data_path))) { string ret((char*)app_data_path); @@ -300,7 +300,7 @@ string FileUtilsWin32::getWritablePath() const ret += "\\"; // Create directory - if (SUCCEEDED(SHCreateDirectoryExA(NULL, ret.c_str(), NULL))) + if (SUCCEEDED(SHCreateDirectoryExA(nullptr, ret.c_str(), nullptr))) { return convertPathFormatToUnixStyle(ret); } diff --git a/cocos/renderer/CCGLProgram.cpp b/cocos/renderer/CCGLProgram.cpp index d5b492e941..7533d991be 100644 --- a/cocos/renderer/CCGLProgram.cpp +++ b/cocos/renderer/CCGLProgram.cpp @@ -254,7 +254,7 @@ bool GLProgram::initWithPrecompiledProgramByteArray(const GLchar* vShaderByteArr haveProgram = CCPrecompiledShaders::getInstance()->loadProgram(_program, vShaderByteArray, fShaderByteArray); CHECK_GL_ERROR_DEBUG(); - _hashForUniforms = NULL; + _hashForUniforms = nullptr; CHECK_GL_ERROR_DEBUG(); @@ -311,7 +311,7 @@ void GLProgram::parseVertexAttribs() for(int i = 0; i < activeAttributes; ++i) { // Query attribute info. - glGetActiveAttrib(_program, i, length, NULL, &attribute.size, &attribute.type, attribName); + glGetActiveAttrib(_program, i, length, nullptr, &attribute.size, &attribute.type, attribName); attribName[length] = '\0'; attribute.name = std::string(attribName); @@ -343,7 +343,7 @@ void GLProgram::parseUniforms() for(int i = 0; i < activeUniforms; ++i) { // Query uniform info. - glGetActiveUniform(_program, i, length, NULL, &uniform.size, &uniform.type, uniformName); + glGetActiveUniform(_program, i, length, nullptr, &uniform.size, &uniform.type, uniformName); uniformName[length] = '\0'; // Only add uniforms that are not built-in. diff --git a/cocos/scripting/lua-bindings/Android.mk b/cocos/scripting/lua-bindings/Android.mk index f0c57e30f6..c926b1d11c 100644 --- a/cocos/scripting/lua-bindings/Android.mk +++ b/cocos/scripting/lua-bindings/Android.mk @@ -23,7 +23,7 @@ LOCAL_SRC_FILES := manual/CCLuaBridge.cpp \ manual/lua_cocos2dx_ui_manual.cpp \ manual/lua_cocos2dx_spine_manual.cpp \ manual/lua_cocos2dx_physics_manual.cpp \ - manual/lua_cocos2dx_controller_manual.cpp \ + manual/lua_cocos2dx_experimental_video_manual.cpp \ manual/lua_cocos2dx_deprecated.cpp \ manual/lua_xml_http_request.cpp \ manual/platform/android/CCLuaJavaBridge.cpp \ @@ -36,7 +36,7 @@ LOCAL_SRC_FILES := manual/CCLuaBridge.cpp \ auto/lua_cocos2dx_ui_auto.cpp \ auto/lua_cocos2dx_spine_auto.cpp \ auto/lua_cocos2dx_physics_auto.cpp \ - auto/lua_cocos2dx_controller_auto.cpp \ + auto/lua_cocos2dx_experimental_video_auto.cpp \ ../../../external/lua/tolua/tolua_event.c \ ../../../external/lua/tolua/tolua_is.c \ ../../../external/lua/tolua/tolua_map.c \ @@ -70,7 +70,6 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../external/lua/tolua \ $(LOCAL_PATH)/../../ui \ $(LOCAL_PATH)/../../2d \ $(LOCAL_PATH)/../../3d \ - $(LOCAL_PATH)/../../base \ $(LOCAL_PATH)/auto \ $(LOCAL_PATH)/manual \ $(LOCAL_PATH)/manual/platform/android \ diff --git a/cocos/scripting/lua-bindings/auto/api/Animate3D.lua b/cocos/scripting/lua-bindings/auto/api/Animate3D.lua index ce1be4d011..4657cc4cb8 100644 --- a/cocos/scripting/lua-bindings/auto/api/Animate3D.lua +++ b/cocos/scripting/lua-bindings/auto/api/Animate3D.lua @@ -5,9 +5,9 @@ -- @parent_module cc -------------------------------- --- @function [parent=#Animate3D] getSpeed +-- @function [parent=#Animate3D] setSpeed -- @param self --- @return float#float ret (return value: float) +-- @param #float float -------------------------------- -- @function [parent=#Animate3D] setWeight @@ -15,19 +15,9 @@ -- @param #float float -------------------------------- --- @function [parent=#Animate3D] getPlayBack +-- @function [parent=#Animate3D] getSpeed -- @param self --- @return bool#bool ret (return value: bool) - --------------------------------- --- @function [parent=#Animate3D] setPlayBack --- @param self --- @param #bool bool - --------------------------------- --- @function [parent=#Animate3D] setSpeed --- @param self --- @param #float float +-- @return float#float ret (return value: float) -------------------------------- -- @function [parent=#Animate3D] getWeight diff --git a/cocos/scripting/lua-bindings/auto/api/Animation3D.lua b/cocos/scripting/lua-bindings/auto/api/Animation3D.lua index 8fa94f84ef..7eacf8e403 100644 --- a/cocos/scripting/lua-bindings/auto/api/Animation3D.lua +++ b/cocos/scripting/lua-bindings/auto/api/Animation3D.lua @@ -10,7 +10,7 @@ -- @return float#float ret (return value: float) -------------------------------- --- @function [parent=#Animation3D] getOrCreate +-- @function [parent=#Animation3D] create -- @param self -- @param #string str -- @param #string str diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp index aa4cc7d4ca..3a95708463 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp @@ -63125,7 +63125,7 @@ int lua_cocos2dx_Animation3D_getDuration(lua_State* tolua_S) return 0; } -int lua_cocos2dx_Animation3D_getOrCreate(lua_State* tolua_S) +int lua_cocos2dx_Animation3D_create(lua_State* tolua_S) { int argc = 0; bool ok = true; @@ -63146,7 +63146,7 @@ int lua_cocos2dx_Animation3D_getOrCreate(lua_State* tolua_S) ok &= luaval_to_std_string(tolua_S, 2,&arg0); if(!ok) return 0; - cocos2d::Animation3D* ret = cocos2d::Animation3D::getOrCreate(arg0); + cocos2d::Animation3D* ret = cocos2d::Animation3D::create(arg0); object_to_luaval(tolua_S, "cc.Animation3D",(cocos2d::Animation3D*)ret); return 1; } @@ -63158,15 +63158,15 @@ int lua_cocos2dx_Animation3D_getOrCreate(lua_State* tolua_S) ok &= luaval_to_std_string(tolua_S, 3,&arg1); if(!ok) return 0; - cocos2d::Animation3D* ret = cocos2d::Animation3D::getOrCreate(arg0, arg1); + cocos2d::Animation3D* ret = cocos2d::Animation3D::create(arg0, arg1); object_to_luaval(tolua_S, "cc.Animation3D",(cocos2d::Animation3D*)ret); return 1; } - CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "getOrCreate",argc, 1); + CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "create",argc, 1); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animation3D_getOrCreate'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animation3D_create'.",&tolua_err); #endif return 0; } @@ -63183,7 +63183,7 @@ int lua_register_cocos2dx_Animation3D(lua_State* tolua_S) tolua_beginmodule(tolua_S,"Animation3D"); tolua_function(tolua_S,"getDuration",lua_cocos2dx_Animation3D_getDuration); - tolua_function(tolua_S,"getOrCreate", lua_cocos2dx_Animation3D_getOrCreate); + tolua_function(tolua_S,"create", lua_cocos2dx_Animation3D_create); tolua_endmodule(tolua_S); std::string typeName = typeid(cocos2d::Animation3D).name(); g_luaType[typeName] = "cc.Animation3D"; @@ -63191,7 +63191,7 @@ int lua_register_cocos2dx_Animation3D(lua_State* tolua_S) return 1; } -int lua_cocos2dx_Animate3D_getSpeed(lua_State* tolua_S) +int lua_cocos2dx_Animate3D_setSpeed(lua_State* tolua_S) { int argc = 0; cocos2d::Animate3D* cobj = nullptr; @@ -63211,26 +63211,28 @@ int lua_cocos2dx_Animate3D_getSpeed(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Animate3D_getSpeed'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Animate3D_setSpeed'", nullptr); return 0; } #endif argc = lua_gettop(tolua_S)-1; - if (argc == 0) + if (argc == 1) { + double arg0; + + ok &= luaval_to_number(tolua_S, 2,&arg0); if(!ok) return 0; - double ret = cobj->getSpeed(); - tolua_pushnumber(tolua_S,(lua_Number)ret); - return 1; + cobj->setSpeed(arg0); + return 0; } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getSpeed",argc, 0); + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setSpeed",argc, 1); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animate3D_getSpeed'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animate3D_setSpeed'.",&tolua_err); #endif return 0; @@ -63281,7 +63283,7 @@ int lua_cocos2dx_Animate3D_setWeight(lua_State* tolua_S) return 0; } -int lua_cocos2dx_Animate3D_getPlayBack(lua_State* tolua_S) +int lua_cocos2dx_Animate3D_getSpeed(lua_State* tolua_S) { int argc = 0; cocos2d::Animate3D* cobj = nullptr; @@ -63301,7 +63303,7 @@ int lua_cocos2dx_Animate3D_getPlayBack(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Animate3D_getPlayBack'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Animate3D_getSpeed'", nullptr); return 0; } #endif @@ -63311,108 +63313,16 @@ int lua_cocos2dx_Animate3D_getPlayBack(lua_State* tolua_S) { if(!ok) return 0; - bool ret = cobj->getPlayBack(); - tolua_pushboolean(tolua_S,(bool)ret); + double ret = cobj->getSpeed(); + tolua_pushnumber(tolua_S,(lua_Number)ret); return 1; } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getPlayBack",argc, 0); + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getSpeed",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animate3D_getPlayBack'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Animate3D_setPlayBack(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Animate3D* 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.Animate3D",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Animate3D*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Animate3D_setPlayBack'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - bool arg0; - - ok &= luaval_to_boolean(tolua_S, 2,&arg0); - if(!ok) - return 0; - cobj->setPlayBack(arg0); - return 0; - } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setPlayBack",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animate3D_setPlayBack'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Animate3D_setSpeed(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Animate3D* 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.Animate3D",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Animate3D*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Animate3D_setSpeed'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - double arg0; - - ok &= luaval_to_number(tolua_S, 2,&arg0); - if(!ok) - return 0; - cobj->setSpeed(arg0); - return 0; - } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setSpeed",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animate3D_setSpeed'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animate3D_getSpeed'.",&tolua_err); #endif return 0; @@ -63527,11 +63437,9 @@ int lua_register_cocos2dx_Animate3D(lua_State* tolua_S) tolua_cclass(tolua_S,"Animate3D","cc.Animate3D","cc.ActionInterval",nullptr); tolua_beginmodule(tolua_S,"Animate3D"); - tolua_function(tolua_S,"getSpeed",lua_cocos2dx_Animate3D_getSpeed); - tolua_function(tolua_S,"setWeight",lua_cocos2dx_Animate3D_setWeight); - tolua_function(tolua_S,"getPlayBack",lua_cocos2dx_Animate3D_getPlayBack); - tolua_function(tolua_S,"setPlayBack",lua_cocos2dx_Animate3D_setPlayBack); tolua_function(tolua_S,"setSpeed",lua_cocos2dx_Animate3D_setSpeed); + tolua_function(tolua_S,"setWeight",lua_cocos2dx_Animate3D_setWeight); + tolua_function(tolua_S,"getSpeed",lua_cocos2dx_Animate3D_getSpeed); tolua_function(tolua_S,"getWeight",lua_cocos2dx_Animate3D_getWeight); tolua_function(tolua_S,"create", lua_cocos2dx_Animate3D_create); tolua_endmodule(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 f3ff1fe181..a2d480bf97 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp @@ -1571,8 +1571,6 @@ int register_all_cocos2dx(lua_State* tolua_S); - - diff --git a/cocos/scripting/lua-bindings/manual/CCLuaStack.cpp b/cocos/scripting/lua-bindings/manual/CCLuaStack.cpp index d76d0d4ea1..d2cb9508bb 100644 --- a/cocos/scripting/lua-bindings/manual/CCLuaStack.cpp +++ b/cocos/scripting/lua-bindings/manual/CCLuaStack.cpp @@ -76,6 +76,8 @@ extern "C" { #include "lua_cocos2dx_physics_manual.hpp" #include "lua_cocos2dx_ui_auto.hpp" #include "lua_cocos2dx_ui_manual.hpp" +#include "lua_cocos2dx_experimental_video_auto.hpp" +#include "lua_cocos2dx_experimental_video_manual.hpp" namespace { int lua_print(lua_State * luastate) @@ -190,6 +192,11 @@ bool LuaStack::init(void) LuaObjcBridge::luaopen_luaoc(_state); #endif +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) + register_all_cocos2dx_experimental_video(_state); + register_all_cocos2dx_experimental_video_manual(_state); +#endif + #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) LuaJavaBridge::luaopen_luaj(_state); #endif diff --git a/cocos/scripting/lua-bindings/manual/lua_cocos2dx_experimental_video_manual.cpp b/cocos/scripting/lua-bindings/manual/lua_cocos2dx_experimental_video_manual.cpp new file mode 100644 index 0000000000..9b144fa828 --- /dev/null +++ b/cocos/scripting/lua-bindings/manual/lua_cocos2dx_experimental_video_manual.cpp @@ -0,0 +1,87 @@ +#include "lua_cocos2dx_experimental_video_manual.hpp" + +#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) + +#include "UIVideoPlayer.h" +#include "tolua_fix.h" +#include "LuaBasicConversions.h" +#include "CCLuaValue.h" +#include "CCLuaEngine.h" + + + +static int lua_cocos2dx_experimental_video_VideoPlayer_addEventListener(lua_State* L) +{ + + int argc = 0; + cocos2d::experimental::ui::VideoPlayer* self = nullptr; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; + if (!tolua_isusertype(L,1,"ccexp.VideoPlayer",0,&tolua_err)) goto tolua_lerror; +#endif + + self = static_cast(tolua_tousertype(L,1,0)); + +#if COCOS2D_DEBUG >= 1 + if (nullptr == self) { + tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_Widget_addTouchEventListener'\n", nullptr); + return 0; + } +#endif + + argc = lua_gettop(L) - 1; + + if (argc == 1) + { +#if COCOS2D_DEBUG >= 1 + if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err)) + { + goto tolua_lerror; + } +#endif + + LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0)); + + self->addEventListener([=](cocos2d::Ref* ref, cocos2d::experimental::ui::VideoPlayer::EventType eventType){ + LuaStack* stack = LuaEngine::getInstance()->getLuaStack(); + + stack->pushObject(ref, "cc.Ref"); + stack->pushInt((int)eventType); + + stack->executeFunctionByHandler(handler, 2); + }); + + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "addEventListener",argc, 0); + return 0; +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(L, "#ferror in function 'lua_cocos2dx_experimental_VideoPlayer_addEventListener'.", &tolua_err); +#endif + return 0; +} + +static void extendVideoPlayer(lua_State* L) +{ + lua_pushstring(L, "ccexp.VideoPlayer"); + lua_rawget(L, LUA_REGISTRYINDEX); + if (lua_istable(L,-1)) + { + tolua_function(L, "addEventListener", lua_cocos2dx_experimental_video_VideoPlayer_addEventListener); + } + lua_pop(L, 1); +} + +int register_all_cocos2dx_experimental_video_manual(lua_State* L) +{ + if (nullptr == L) + return 0; + + extendVideoPlayer(L); + + return 0; +} + +#endif diff --git a/cocos/scripting/lua-bindings/manual/lua_cocos2dx_experimental_video_manual.hpp b/cocos/scripting/lua-bindings/manual/lua_cocos2dx_experimental_video_manual.hpp new file mode 100644 index 0000000000..fa4072a24e --- /dev/null +++ b/cocos/scripting/lua-bindings/manual/lua_cocos2dx_experimental_video_manual.hpp @@ -0,0 +1,41 @@ +/**************************************************************************** + 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 "base/ccConfig.h" +#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) + +#ifndef COCOS_SCRIPTING_LUA_BINDINGS_LUA_COCOS2DX_EXPERIMENTAL_VIDEO_MANUAL_H +#define COCOS_SCRIPTING_LUA_BINDINGS_LUA_COCOS2DX_EXPERIMENTAL_VIDEO_MANUAL_H + +#ifdef __cplusplus +extern "C" { +#endif +#include "tolua++.h" +#ifdef __cplusplus +} +#endif + +TOLUA_API int register_all_cocos2dx_experimental_video_manual(lua_State* L); + +#endif // COCOS_SCRIPTING_LUA_BINDINGS_LUA_COCOS2DX_EXPERIMENTAL_VIDEO_MANUAL_H +#endif //#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) diff --git a/cocos/scripting/lua-bindings/proj.ios_mac/cocos2d_lua_bindings.xcodeproj/project.pbxproj b/cocos/scripting/lua-bindings/proj.ios_mac/cocos2d_lua_bindings.xcodeproj/project.pbxproj index c14432dc4c..8306a270c4 100644 --- a/cocos/scripting/lua-bindings/proj.ios_mac/cocos2d_lua_bindings.xcodeproj/project.pbxproj +++ b/cocos/scripting/lua-bindings/proj.ios_mac/cocos2d_lua_bindings.xcodeproj/project.pbxproj @@ -15,14 +15,14 @@ 1503FAA618DA8A1C00F6518C /* io.c in Sources */ = {isa = PBXBuildFile; fileRef = 1503FA9F18DA8A1C00F6518C /* io.c */; }; 1503FAA718DA8A1C00F6518C /* io.h in Headers */ = {isa = PBXBuildFile; fileRef = 1503FAA018DA8A1C00F6518C /* io.h */; }; 1503FAA818DA8A1C00F6518C /* io.h in Headers */ = {isa = PBXBuildFile; fileRef = 1503FAA018DA8A1C00F6518C /* io.h */; }; - 15225DDB196C27440032C34F /* lua_cocos2dx_controller_manual.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15225DD9196C27440032C34F /* lua_cocos2dx_controller_manual.cpp */; }; - 15225DDC196C27440032C34F /* lua_cocos2dx_controller_manual.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 15225DDA196C27440032C34F /* lua_cocos2dx_controller_manual.hpp */; }; 1540AF57193EC30500717D8E /* xxtea.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1540AF55193EC30500717D8E /* xxtea.cpp */; }; 1540AF58193EC30500717D8E /* xxtea.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1540AF55193EC30500717D8E /* xxtea.cpp */; }; 1540AF59193EC30500717D8E /* xxtea.h in Headers */ = {isa = PBXBuildFile; fileRef = 1540AF56193EC30500717D8E /* xxtea.h */; }; 1540AF5A193EC30500717D8E /* xxtea.h in Headers */ = {isa = PBXBuildFile; fileRef = 1540AF56193EC30500717D8E /* xxtea.h */; }; - 15A1D372196BD878009C3B59 /* lua_cocos2dx_controller_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15A1D370196BD878009C3B59 /* lua_cocos2dx_controller_auto.cpp */; }; - 15A1D373196BD878009C3B59 /* lua_cocos2dx_controller_auto.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 15A1D371196BD878009C3B59 /* lua_cocos2dx_controller_auto.hpp */; }; + 15AECE12195C277100907DB0 /* lua_cocos2dx_experimental_video_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15AECE10195C277100907DB0 /* lua_cocos2dx_experimental_video_auto.cpp */; }; + 15AECE13195C277100907DB0 /* lua_cocos2dx_experimental_video_auto.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 15AECE11195C277100907DB0 /* lua_cocos2dx_experimental_video_auto.hpp */; }; + 15AECE16195C28DF00907DB0 /* lua_cocos2dx_experimental_video_manual.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15AECE14195C28DF00907DB0 /* lua_cocos2dx_experimental_video_manual.cpp */; }; + 15AECE17195C28DF00907DB0 /* lua_cocos2dx_experimental_video_manual.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 15AECE15195C28DF00907DB0 /* lua_cocos2dx_experimental_video_manual.hpp */; }; 1A262AB818BEEF5900D2DB92 /* tolua_fix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A262AB718BEEF5900D2DB92 /* tolua_fix.cpp */; }; 1A262AB918BEEF5900D2DB92 /* tolua_fix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A262AB718BEEF5900D2DB92 /* tolua_fix.cpp */; }; 1AACE7B518BC45C200215002 /* lua_cocos2dx_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AACE74918BC45C200215002 /* lua_cocos2dx_auto.cpp */; }; @@ -222,12 +222,12 @@ 1503FA9E18DA8A1C00F6518C /* buffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = buffer.h; sourceTree = ""; }; 1503FA9F18DA8A1C00F6518C /* io.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = io.c; sourceTree = ""; }; 1503FAA018DA8A1C00F6518C /* io.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = io.h; sourceTree = ""; }; - 15225DD9196C27440032C34F /* lua_cocos2dx_controller_manual.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lua_cocos2dx_controller_manual.cpp; sourceTree = ""; }; - 15225DDA196C27440032C34F /* lua_cocos2dx_controller_manual.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = lua_cocos2dx_controller_manual.hpp; sourceTree = ""; }; 1540AF55193EC30500717D8E /* xxtea.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xxtea.cpp; sourceTree = ""; }; 1540AF56193EC30500717D8E /* xxtea.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xxtea.h; sourceTree = ""; }; - 15A1D370196BD878009C3B59 /* lua_cocos2dx_controller_auto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lua_cocos2dx_controller_auto.cpp; sourceTree = ""; }; - 15A1D371196BD878009C3B59 /* lua_cocos2dx_controller_auto.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = lua_cocos2dx_controller_auto.hpp; sourceTree = ""; }; + 15AECE10195C277100907DB0 /* lua_cocos2dx_experimental_video_auto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lua_cocos2dx_experimental_video_auto.cpp; sourceTree = ""; }; + 15AECE11195C277100907DB0 /* lua_cocos2dx_experimental_video_auto.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = lua_cocos2dx_experimental_video_auto.hpp; sourceTree = ""; }; + 15AECE14195C28DF00907DB0 /* lua_cocos2dx_experimental_video_manual.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lua_cocos2dx_experimental_video_manual.cpp; sourceTree = ""; }; + 15AECE15195C28DF00907DB0 /* lua_cocos2dx_experimental_video_manual.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = lua_cocos2dx_experimental_video_manual.hpp; sourceTree = ""; }; 1A262AB718BEEF5900D2DB92 /* tolua_fix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = tolua_fix.cpp; sourceTree = ""; }; 1AACE74618BC45A000215002 /* libluabindings Mac.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libluabindings Mac.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 1AACE74718BC45A000215002 /* libluabindings iOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libluabindings iOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -373,8 +373,8 @@ 1AACE74818BC45C200215002 /* auto */ = { isa = PBXGroup; children = ( - 15A1D370196BD878009C3B59 /* lua_cocos2dx_controller_auto.cpp */, - 15A1D371196BD878009C3B59 /* lua_cocos2dx_controller_auto.hpp */, + 15AECE10195C277100907DB0 /* lua_cocos2dx_experimental_video_auto.cpp */, + 15AECE11195C277100907DB0 /* lua_cocos2dx_experimental_video_auto.hpp */, 2905FACE18CF12E600240AA3 /* lua_cocos2dx_ui_auto.cpp */, 2905FACF18CF12E600240AA3 /* lua_cocos2dx_ui_auto.hpp */, 1AACE74918BC45C200215002 /* lua_cocos2dx_auto.cpp */, @@ -395,8 +395,8 @@ 1AACE75B18BC45C200215002 /* manual */ = { isa = PBXGroup; children = ( - 15225DD9196C27440032C34F /* lua_cocos2dx_controller_manual.cpp */, - 15225DDA196C27440032C34F /* lua_cocos2dx_controller_manual.hpp */, + 15AECE14195C28DF00907DB0 /* lua_cocos2dx_experimental_video_manual.cpp */, + 15AECE15195C28DF00907DB0 /* lua_cocos2dx_experimental_video_manual.hpp */, 2905FAD418CF143800240AA3 /* lua_cocos2dx_ui_manual.cpp */, 2905FAD518CF143800240AA3 /* lua_cocos2dx_ui_manual.hpp */, 1AACE75E18BC45C200215002 /* CCBProxy.cpp */, @@ -616,17 +616,17 @@ 1ABCA23818CD8F7D0087CE3A /* except.h in Headers */, 1ABCA26418CD8F7D0087CE3A /* timeout.h in Headers */, 1AACE81418BC45C200215002 /* Lua_web_socket.h in Headers */, - 15A1D373196BD878009C3B59 /* lua_cocos2dx_controller_auto.hpp in Headers */, 1AACE81C18BC45C200215002 /* LuaBasicConversions.h in Headers */, 1AACE7CA18BC45C200215002 /* lua_cocos2dx_physics_auto.hpp in Headers */, 1AACE7F818BC45C200215002 /* lua_cocos2dx_deprecated.h in Headers */, 1ABCA24C18CD8F7D0087CE3A /* mime.h in Headers */, 1ABCA1ED18CD8F470087CE3A /* lua.h in Headers */, - 15225DDC196C27440032C34F /* lua_cocos2dx_controller_manual.hpp in Headers */, 1AACE7F418BC45C200215002 /* lua_cocos2dx_coco_studio_manual.hpp in Headers */, 1ABCA26818CD8F7D0087CE3A /* udp.h in Headers */, + 15AECE17195C28DF00907DB0 /* lua_cocos2dx_experimental_video_manual.hpp in Headers */, 1ABCA25418CD8F7D0087CE3A /* select.h in Headers */, 1AACE7D618BC45C200215002 /* lua_cocos2dx_studio_auto.hpp in Headers */, + 15AECE13195C277100907DB0 /* lua_cocos2dx_experimental_video_auto.hpp in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -766,9 +766,11 @@ 1AACE81E18BC45C200215002 /* LuaOpengl.cpp in Sources */, 1AACE7CE18BC45C200215002 /* lua_cocos2dx_spine_auto.cpp in Sources */, 1AACE80218BC45C200215002 /* lua_cocos2dx_manual.cpp in Sources */, + 15AECE16195C28DF00907DB0 /* lua_cocos2dx_experimental_video_manual.cpp in Sources */, 1ABCA23E18CD8F7D0087CE3A /* luasocket.c in Sources */, 1ABCA25218CD8F7D0087CE3A /* select.c in Sources */, 1ABCA24A18CD8F7D0087CE3A /* mime.c in Sources */, + 15AECE12195C277100907DB0 /* lua_cocos2dx_experimental_video_auto.cpp in Sources */, 1540AF58193EC30500717D8E /* xxtea.cpp in Sources */, 1ABCA26218CD8F7D0087CE3A /* timeout.c in Sources */, 1503FAA618DA8A1C00F6518C /* io.c in Sources */, @@ -777,7 +779,6 @@ 1ABCA23618CD8F7D0087CE3A /* except.c in Sources */, 2905FAD718CF143800240AA3 /* lua_cocos2dx_ui_manual.cpp in Sources */, 1ABCA26A18CD8F7D0087CE3A /* unix.c in Sources */, - 15A1D372196BD878009C3B59 /* lua_cocos2dx_controller_auto.cpp in Sources */, 1AACE7F218BC45C200215002 /* lua_cocos2dx_coco_studio_manual.cpp in Sources */, 1503FAA218DA8A1C00F6518C /* buffer.c in Sources */, 1AACE80E18BC45C200215002 /* lua_extensions.c in Sources */, @@ -786,7 +787,6 @@ 1AACE7BC18BC45C200215002 /* lua_cocos2dx_extension_auto.cpp in Sources */, 1ABCA20918CD8F6E0087CE3A /* tolua_push.c in Sources */, 1AACE82618BC45C200215002 /* LuaSkeletonAnimation.cpp in Sources */, - 15225DDB196C27440032C34F /* lua_cocos2dx_controller_manual.cpp in Sources */, 1ABCA25E18CD8F7D0087CE3A /* tcp.c in Sources */, 1AACE80A18BC45C200215002 /* lua_cocos2dx_spine_manual.cpp in Sources */, 1AACE81A18BC45C200215002 /* LuaBasicConversions.cpp in Sources */, diff --git a/cocos/scripting/lua-bindings/script/experimentalConstants.lua b/cocos/scripting/lua-bindings/script/experimentalConstants.lua new file mode 100644 index 0000000000..9fea50ca3b --- /dev/null +++ b/cocos/scripting/lua-bindings/script/experimentalConstants.lua @@ -0,0 +1,9 @@ +ccexprimental = ccexprimental or {} + + +ccexprimental.VideoPlayerEvent = { + PLAYING = 0, + PAUSED = 1, + STOPPED= 2, + COMPLETED =3, +} diff --git a/cocos/storage/local-storage/LocalStorage.cpp b/cocos/storage/local-storage/LocalStorage.cpp index 3c485fa226..f925b12d71 100644 --- a/cocos/storage/local-storage/LocalStorage.cpp +++ b/cocos/storage/local-storage/LocalStorage.cpp @@ -48,7 +48,7 @@ static void localStorageCreateTable() { const char *sql_createtable = "CREATE TABLE IF NOT EXISTS data(key TEXT PRIMARY KEY,value TEXT);"; sqlite3_stmt *stmt; - int ok=sqlite3_prepare_v2(_db, sql_createtable, -1, &stmt, NULL); + int ok=sqlite3_prepare_v2(_db, sql_createtable, -1, &stmt, nullptr); ok |= sqlite3_step(stmt); ok |= sqlite3_finalize(stmt); @@ -71,15 +71,15 @@ void localStorageInit( const std::string& fullpath/* = "" */) // SELECT const char *sql_select = "SELECT value FROM data WHERE key=?;"; - ret |= sqlite3_prepare_v2(_db, sql_select, -1, &_stmt_select, NULL); + ret |= sqlite3_prepare_v2(_db, sql_select, -1, &_stmt_select, nullptr); // REPLACE const char *sql_update = "REPLACE INTO data (key, value) VALUES (?,?);"; - ret |= sqlite3_prepare_v2(_db, sql_update, -1, &_stmt_update, NULL); + ret |= sqlite3_prepare_v2(_db, sql_update, -1, &_stmt_update, nullptr); // DELETE const char *sql_remove = "DELETE FROM data WHERE key=?;"; - ret |= sqlite3_prepare_v2(_db, sql_remove, -1, &_stmt_remove, NULL); + ret |= sqlite3_prepare_v2(_db, sql_remove, -1, &_stmt_remove, nullptr); if( ret != SQLITE_OK ) { printf("Error initializing DB\n"); diff --git a/cocos/ui/UICheckBox.h b/cocos/ui/UICheckBox.h index 05c77d836b..b1b6a28177 100644 --- a/cocos/ui/UICheckBox.h +++ b/cocos/ui/UICheckBox.h @@ -33,13 +33,13 @@ class Sprite; namespace ui { -CC_DEPRECATED_ATTRIBUTE typedef enum +typedef enum { CHECKBOX_STATE_EVENT_SELECTED, CHECKBOX_STATE_EVENT_UNSELECTED }CheckBoxEventType; -CC_DEPRECATED_ATTRIBUTE typedef void (Ref::*SEL_SelectedStateEvent)(Ref*,CheckBoxEventType); +typedef void (Ref::*SEL_SelectedStateEvent)(Ref*,CheckBoxEventType); #define checkboxselectedeventselector(_SELECTOR) (SEL_SelectedStateEvent)(&_SELECTOR) /** diff --git a/cocos/ui/UILayout.cpp b/cocos/ui/UILayout.cpp index cf3f8acc7d..7064ec73d5 100644 --- a/cocos/ui/UILayout.cpp +++ b/cocos/ui/UILayout.cpp @@ -1648,7 +1648,7 @@ bool Layout::isLastWidgetInContainer(Widget* widget, FocusDirection direction)c if (direction == FocusDirection::LEFT) { if (index == 0) { - return true * isLastWidgetInContainer(parent, direction); + return isLastWidgetInContainer(parent, direction); } else { @@ -1658,7 +1658,7 @@ bool Layout::isLastWidgetInContainer(Widget* widget, FocusDirection direction)c if (direction == FocusDirection::RIGHT) { if (index == container.size()-1) { - return true * isLastWidgetInContainer(parent, direction); + return isLastWidgetInContainer(parent, direction); } else { @@ -1681,7 +1681,7 @@ bool Layout::isLastWidgetInContainer(Widget* widget, FocusDirection direction)c { if (index == 0) { - return true * isLastWidgetInContainer(parent, direction); + return isLastWidgetInContainer(parent, direction); } else @@ -1693,7 +1693,7 @@ bool Layout::isLastWidgetInContainer(Widget* widget, FocusDirection direction)c { if (index == container.size() - 1) { - return true * isLastWidgetInContainer(parent, direction); + return isLastWidgetInContainer(parent, direction); } else { diff --git a/cocos/ui/UIListView.h b/cocos/ui/UIListView.h index 42a4d5050d..2409bd3763 100644 --- a/cocos/ui/UIListView.h +++ b/cocos/ui/UIListView.h @@ -32,13 +32,13 @@ NS_CC_BEGIN namespace ui{ -CC_DEPRECATED_ATTRIBUTE typedef enum +typedef enum { LISTVIEW_ONSELECTEDITEM_START, LISTVIEW_ONSELECTEDITEM_END }ListViewEventType; -CC_DEPRECATED_ATTRIBUTE typedef void (Ref::*SEL_ListViewEvent)(Ref*,ListViewEventType); +typedef void (Ref::*SEL_ListViewEvent)(Ref*,ListViewEventType); #define listvieweventselector(_SELECTOR) (SEL_ListViewEvent)(&_SELECTOR) class ListView : public ScrollView diff --git a/cocos/ui/UIPageView.h b/cocos/ui/UIPageView.h index f3544f0a47..70c764ee6a 100644 --- a/cocos/ui/UIPageView.h +++ b/cocos/ui/UIPageView.h @@ -31,12 +31,12 @@ NS_CC_BEGIN namespace ui { -CC_DEPRECATED_ATTRIBUTE typedef enum +typedef enum { PAGEVIEW_EVENT_TURNING, }PageViewEventType; -CC_DEPRECATED_ATTRIBUTE typedef void (Ref::*SEL_PageViewEvent)(Ref*, PageViewEventType); +typedef void (Ref::*SEL_PageViewEvent)(Ref*, PageViewEventType); #define pagevieweventselector(_SELECTOR)(SEL_PageViewEvent)(&_SELECTOR) class PageView : public Layout diff --git a/cocos/ui/UIRichText.cpp b/cocos/ui/UIRichText.cpp index 1f4050039f..6bff82c007 100644 --- a/cocos/ui/UIRichText.cpp +++ b/cocos/ui/UIRichText.cpp @@ -66,7 +66,7 @@ RichElementText* RichElementText::create(int tag, const Color3B &color, GLubyte return element; } CC_SAFE_DELETE(element); - return NULL; + return nullptr; } bool RichElementText::init(int tag, const Color3B &color, GLubyte opacity, const std::string& text, const std::string& fontName, float fontSize) @@ -90,7 +90,7 @@ RichElementImage* RichElementImage::create(int tag, const Color3B &color, GLubyt return element; } CC_SAFE_DELETE(element); - return NULL; + return nullptr; } bool RichElementImage::init(int tag, const Color3B &color, GLubyte opacity, const std::string& filePath) @@ -112,7 +112,7 @@ RichElementCustomNode* RichElementCustomNode::create(int tag, const Color3B &col return element; } CC_SAFE_DELETE(element); - return NULL; + return nullptr; } bool RichElementCustomNode::init(int tag, const Color3B &color, GLubyte opacity, cocos2d::Node *customNode) @@ -149,7 +149,7 @@ RichText* RichText::create() return widget; } CC_SAFE_DELETE(widget); - return NULL; + return nullptr; } bool RichText::init() @@ -204,7 +204,7 @@ void RichText::formatText() for (ssize_t i=0; i<_richElements.size(); i++) { RichElement* element = _richElements.at(i); - Node* elementRenderer = NULL; + Node* elementRenderer = nullptr; switch (element->_type) { case RichElement::Type::TEXT: diff --git a/cocos/ui/UIScrollView.h b/cocos/ui/UIScrollView.h index 39ec4dc8bd..c02d68fd1e 100644 --- a/cocos/ui/UIScrollView.h +++ b/cocos/ui/UIScrollView.h @@ -33,7 +33,7 @@ class EventFocusListener; namespace ui { -CC_DEPRECATED_ATTRIBUTE typedef enum +typedef enum { SCROLLVIEW_EVENT_SCROLL_TO_TOP, SCROLLVIEW_EVENT_SCROLL_TO_BOTTOM, @@ -46,7 +46,7 @@ CC_DEPRECATED_ATTRIBUTE typedef enum SCROLLVIEW_EVENT_BOUNCE_RIGHT }ScrollviewEventType; -CC_DEPRECATED_ATTRIBUTE typedef void (Ref::*SEL_ScrollViewEvent)(Ref*, ScrollviewEventType); +typedef void (Ref::*SEL_ScrollViewEvent)(Ref*, ScrollviewEventType); #define scrollvieweventselector(_SELECTOR) (SEL_ScrollViewEvent)(&_SELECTOR) diff --git a/cocos/ui/UISlider.h b/cocos/ui/UISlider.h index 451cd6ca2c..f8a711dcf1 100644 --- a/cocos/ui/UISlider.h +++ b/cocos/ui/UISlider.h @@ -33,12 +33,12 @@ class Sprite; namespace ui { -CC_DEPRECATED_ATTRIBUTE typedef enum +typedef enum { SLIDER_PERCENTCHANGED }SliderEventType; -CC_DEPRECATED_ATTRIBUTE typedef void (Ref::*SEL_SlidPercentChangedEvent)(Ref*,SliderEventType); +typedef void (Ref::*SEL_SlidPercentChangedEvent)(Ref*,SliderEventType); #define sliderpercentchangedselector(_SELECTOR) (SEL_SlidPercentChangedEvent)(&_SELECTOR) /** diff --git a/cocos/ui/UITextField.h b/cocos/ui/UITextField.h index b343ed4a7d..cc7ef355a8 100644 --- a/cocos/ui/UITextField.h +++ b/cocos/ui/UITextField.h @@ -91,7 +91,7 @@ protected: bool _deleteBackward; }; -CC_DEPRECATED_ATTRIBUTE typedef enum +typedef enum { TEXTFIELD_EVENT_ATTACH_WITH_IME, TEXTFIELD_EVENT_DETACH_WITH_IME, @@ -99,7 +99,7 @@ CC_DEPRECATED_ATTRIBUTE typedef enum TEXTFIELD_EVENT_DELETE_BACKWARD, }TextFiledEventType; -CC_DEPRECATED_ATTRIBUTE typedef void (Ref::*SEL_TextFieldEvent)(Ref*, TextFiledEventType); +typedef void (Ref::*SEL_TextFieldEvent)(Ref*, TextFiledEventType); #define textfieldeventselector(_SELECTOR) (SEL_TextFieldEvent)(&_SELECTOR) /** class UITextField : public Widget diff --git a/cocos/ui/UIWidget.h b/cocos/ui/UIWidget.h index a0cc42b27a..935d6f8628 100644 --- a/cocos/ui/UIWidget.h +++ b/cocos/ui/UIWidget.h @@ -37,7 +37,7 @@ class EventListenerTouchOneByOne; namespace ui { -CC_DEPRECATED_ATTRIBUTE typedef enum +typedef enum { TOUCH_EVENT_BEGAN, TOUCH_EVENT_MOVED, @@ -45,7 +45,7 @@ CC_DEPRECATED_ATTRIBUTE typedef enum TOUCH_EVENT_CANCELED }TouchEventType; -CC_DEPRECATED_ATTRIBUTE typedef void (Ref::*SEL_TouchEvent)(Ref*,TouchEventType); +typedef void (Ref::*SEL_TouchEvent)(Ref*,TouchEventType); #define toucheventselector(_SELECTOR) (SEL_TouchEvent)(&_SELECTOR) diff --git a/extensions/GUI/CCControlExtension/CCControl.cpp b/extensions/GUI/CCControlExtension/CCControl.cpp index 128443fa5f..3975d514e0 100644 --- a/extensions/GUI/CCControlExtension/CCControl.cpp +++ b/extensions/GUI/CCControlExtension/CCControl.cpp @@ -59,7 +59,7 @@ Control* Control::create() else { CC_SAFE_DELETE(pRet); - return NULL; + return nullptr; } } @@ -154,7 +154,7 @@ void Control::addTargetWithActionForControlEvents(Ref* target, Handler action, E * * @param target The target object that is, the object to which the action * message is sent. It cannot be nil. The target is not retained. - * @param action A selector identifying an action message. It cannot be NULL. + * @param action A selector identifying an action message. It cannot be nullptr. * @param controlEvent A control event for which the action message is sent. * See "CCControlEvent" for constants. */ @@ -320,7 +320,7 @@ bool Control::isHighlighted() const bool Control::hasVisibleParents() const { auto parent = this->getParent(); - for( auto c = parent; c != NULL; c = c->getParent() ) + for( auto c = parent; c != nullptr; c = c->getParent() ) { if( !c->isVisible() ) { diff --git a/extensions/GUI/CCControlExtension/CCControlColourPicker.cpp b/extensions/GUI/CCControlExtension/CCControlColourPicker.cpp index 6d342e7946..19978cfd65 100644 --- a/extensions/GUI/CCControlExtension/CCControlColourPicker.cpp +++ b/extensions/GUI/CCControlExtension/CCControlColourPicker.cpp @@ -135,7 +135,7 @@ void ControlColourPicker::setColor(const Color3B& color) void ControlColourPicker::setEnabled(bool enabled) { Control::setEnabled(enabled); - if (_huePicker != NULL) + if (_huePicker != nullptr) { _huePicker->setEnabled(enabled); } diff --git a/extensions/GUI/CCControlExtension/CCControlHuePicker.cpp b/extensions/GUI/CCControlExtension/CCControlHuePicker.cpp index 9850aacff8..96721a80b6 100644 --- a/extensions/GUI/CCControlExtension/CCControlHuePicker.cpp +++ b/extensions/GUI/CCControlExtension/CCControlHuePicker.cpp @@ -118,7 +118,7 @@ void ControlHuePicker::setHuePercentage(float hueValueInPercent) void ControlHuePicker::setEnabled(bool enabled) { Control::setEnabled(enabled); - if (_slider != NULL) + if (_slider != nullptr) { _slider->setOpacity(enabled ? 255 : 128); } diff --git a/extensions/GUI/CCControlExtension/CCControlPotentiometer.cpp b/extensions/GUI/CCControlExtension/CCControlPotentiometer.cpp index 13698bcbdf..b77cfeb9e8 100644 --- a/extensions/GUI/CCControlExtension/CCControlPotentiometer.cpp +++ b/extensions/GUI/CCControlExtension/CCControlPotentiometer.cpp @@ -48,7 +48,7 @@ ControlPotentiometer::~ControlPotentiometer() ControlPotentiometer* ControlPotentiometer::create(const char* backgroundFile, const char* progressFile, const char* thumbFile) { ControlPotentiometer* pRet = new ControlPotentiometer(); - if (pRet != NULL) + if (pRet != nullptr) { // Prepare track for potentiometer Sprite *backgroundSprite = Sprite::create(backgroundFile); @@ -97,7 +97,7 @@ bool ControlPotentiometer::initWithTrackSprite_ProgressTimer_ThumbSprite(Sprite* void ControlPotentiometer::setEnabled(bool enabled) { Control::setEnabled(enabled); - if (_thumbSprite != NULL) + if (_thumbSprite != nullptr) { _thumbSprite->setOpacity((enabled) ? 255 : 128); } diff --git a/extensions/GUI/CCControlExtension/CCControlSaturationBrightnessPicker.cpp b/extensions/GUI/CCControlExtension/CCControlSaturationBrightnessPicker.cpp index d23eba4ab2..ade1f462d4 100644 --- a/extensions/GUI/CCControlExtension/CCControlSaturationBrightnessPicker.cpp +++ b/extensions/GUI/CCControlExtension/CCControlSaturationBrightnessPicker.cpp @@ -50,10 +50,10 @@ ControlSaturationBrightnessPicker::~ControlSaturationBrightnessPicker() { removeAllChildrenWithCleanup(true); - _background = NULL; - _overlay = NULL; - _shadow = NULL; - _slider = NULL; + _background = nullptr; + _overlay = nullptr; + _shadow = nullptr; + _slider = nullptr; } bool ControlSaturationBrightnessPicker::initWithTargetAndPos(Node* target, Vec2 pos) @@ -88,7 +88,7 @@ ControlSaturationBrightnessPicker* ControlSaturationBrightnessPicker::create(Nod void ControlSaturationBrightnessPicker::setEnabled(bool enabled) { Control::setEnabled(enabled); - if (_slider != NULL) + if (_slider != nullptr) { _slider->setOpacity(enabled ? 255 : 128); } diff --git a/extensions/GUI/CCControlExtension/CCControlSlider.cpp b/extensions/GUI/CCControlExtension/CCControlSlider.cpp index 42cf2dae6a..4e64f1e462 100644 --- a/extensions/GUI/CCControlExtension/CCControlSlider.cpp +++ b/extensions/GUI/CCControlExtension/CCControlSlider.cpp @@ -169,7 +169,7 @@ bool ControlSlider::initWithSprites(Sprite * backgroundSprite, Sprite* progressS void ControlSlider::setEnabled(bool enabled) { Control::setEnabled(enabled); - if (_thumbSprite != NULL) + if (_thumbSprite != nullptr) { _thumbSprite->setOpacity((enabled) ? 255 : 128); } @@ -271,8 +271,8 @@ void ControlSlider::onTouchEnded(Touch *pTouch, Event *pEvent) void ControlSlider::needsLayout() { - if (NULL == _thumbSprite || NULL == _selectedThumbSprite || NULL == _backgroundSprite - || NULL == _progressSprite) + if (nullptr == _thumbSprite || nullptr == _selectedThumbSprite || nullptr == _backgroundSprite + || nullptr == _progressSprite) { return; } diff --git a/extensions/GUI/CCControlExtension/CCControlStepper.cpp b/extensions/GUI/CCControlExtension/CCControlStepper.cpp index f96d27496d..dfb3a86564 100644 --- a/extensions/GUI/CCControlExtension/CCControlStepper.cpp +++ b/extensions/GUI/CCControlExtension/CCControlStepper.cpp @@ -118,7 +118,7 @@ bool ControlStepper::initWithMinusSpriteAndPlusSprite(Sprite *minusSprite, Sprit ControlStepper* ControlStepper::create(Sprite *minusSprite, Sprite *plusSprite) { ControlStepper* pRet = new ControlStepper(); - if (pRet != NULL && pRet->initWithMinusSpriteAndPlusSprite(minusSprite, plusSprite)) + if (pRet != nullptr && pRet->initWithMinusSpriteAndPlusSprite(minusSprite, plusSprite)) { pRet->autorelease(); } diff --git a/extensions/GUI/CCControlExtension/CCControlSwitch.cpp b/extensions/GUI/CCControlExtension/CCControlSwitch.cpp index d8b73a587e..3f3aad0743 100644 --- a/extensions/GUI/CCControlExtension/CCControlSwitch.cpp +++ b/extensions/GUI/CCControlExtension/CCControlSwitch.cpp @@ -291,13 +291,13 @@ ControlSwitch::~ControlSwitch() bool ControlSwitch::initWithMaskSprite(Sprite *maskSprite, Sprite * onSprite, Sprite * offSprite, Sprite * thumbSprite) { - return initWithMaskSprite(maskSprite, onSprite, offSprite, thumbSprite, NULL, NULL); + return initWithMaskSprite(maskSprite, onSprite, offSprite, thumbSprite, nullptr, nullptr); } ControlSwitch* ControlSwitch::create(Sprite *maskSprite, Sprite * onSprite, Sprite * offSprite, Sprite * thumbSprite) { ControlSwitch* pRet = new ControlSwitch(); - if (pRet && pRet->initWithMaskSprite(maskSprite, onSprite, offSprite, thumbSprite, NULL, NULL)) + if (pRet && pRet->initWithMaskSprite(maskSprite, onSprite, offSprite, thumbSprite, nullptr, nullptr)) { pRet->autorelease(); } @@ -382,7 +382,7 @@ void ControlSwitch::setOn(bool isOn, bool animated) void ControlSwitch::setEnabled(bool enabled) { _enabled = enabled; - if (_switchSprite != NULL) + if (_switchSprite != nullptr) { _switchSprite->setOpacity((enabled) ? 255 : 128); } diff --git a/extensions/GUI/CCControlExtension/CCControlUtils.cpp b/extensions/GUI/CCControlExtension/CCControlUtils.cpp index 414e43bd86..f2c868d20c 100644 --- a/extensions/GUI/CCControlExtension/CCControlUtils.cpp +++ b/extensions/GUI/CCControlExtension/CCControlUtils.cpp @@ -31,7 +31,7 @@ Sprite* ControlUtils::addSpriteToTargetWithPosAndAnchor(const char* spriteName, Sprite *sprite =Sprite::createWithSpriteFrameName(spriteName); if (!sprite) - return NULL; + return nullptr; sprite->setPosition(pos); sprite->setAnchorPoint(anchor); diff --git a/extensions/GUI/CCControlExtension/CCInvocation.cpp b/extensions/GUI/CCControlExtension/CCInvocation.cpp index a93429303e..f105392831 100644 --- a/extensions/GUI/CCControlExtension/CCInvocation.cpp +++ b/extensions/GUI/CCControlExtension/CCInvocation.cpp @@ -31,7 +31,7 @@ NS_CC_EXT_BEGIN Invocation* Invocation::create(Ref* target, Control::Handler action, Control::EventType controlEvent) { Invocation* pRet = new Invocation(target, action, controlEvent); - if (pRet != NULL) + if (pRet != nullptr) { pRet->autorelease(); } diff --git a/extensions/GUI/CCControlExtension/CCScale9Sprite.cpp b/extensions/GUI/CCControlExtension/CCScale9Sprite.cpp index 43664de763..8d55e46003 100644 --- a/extensions/GUI/CCControlExtension/CCScale9Sprite.cpp +++ b/extensions/GUI/CCControlExtension/CCScale9Sprite.cpp @@ -71,7 +71,7 @@ Scale9Sprite::~Scale9Sprite() bool Scale9Sprite::init() { - return this->initWithBatchNode(NULL, Rect::ZERO, Rect::ZERO); + return this->initWithBatchNode(nullptr, Rect::ZERO, Rect::ZERO); } bool Scale9Sprite::initWithBatchNode(SpriteBatchNode* batchnode, const Rect& rect, const Rect& capInsets) @@ -389,13 +389,13 @@ void Scale9Sprite::setContentSize(const Size &size) void Scale9Sprite::updatePositions() { - // Check that instances are non-NULL + // Check that instances are non-nullptr if(!((_topLeft) && (_topRight) && (_bottomRight) && (_bottomLeft) && (_centre))) { - // if any of the above sprites are NULL, return + // if any of the above sprites are nullptr, return return; } @@ -462,7 +462,7 @@ Scale9Sprite* Scale9Sprite::create(const std::string& file, const Rect& rect, c return pReturn; } CC_SAFE_DELETE(pReturn); - return NULL; + return nullptr; } bool Scale9Sprite::initWithFile(const std::string& file, const Rect& rect) @@ -480,7 +480,7 @@ Scale9Sprite* Scale9Sprite::create(const std::string& file, const Rect& rect) return pReturn; } CC_SAFE_DELETE(pReturn); - return NULL; + return nullptr; } @@ -499,7 +499,7 @@ Scale9Sprite* Scale9Sprite::create(const Rect& capInsets, const std::string& fil return pReturn; } CC_SAFE_DELETE(pReturn); - return NULL; + return nullptr; } bool Scale9Sprite::initWithFile(const std::string& file) @@ -518,16 +518,16 @@ Scale9Sprite* Scale9Sprite::create(const std::string& file) return pReturn; } CC_SAFE_DELETE(pReturn); - return NULL; + return nullptr; } bool Scale9Sprite::initWithSpriteFrame(SpriteFrame* spriteFrame, const Rect& capInsets) { Texture2D* texture = spriteFrame->getTexture(); - CCASSERT(texture != NULL, "CCTexture must be not nil"); + CCASSERT(texture != nullptr, "CCTexture must be not nil"); SpriteBatchNode *batchnode = SpriteBatchNode::createWithTexture(texture, 9); - CCASSERT(batchnode != NULL, "CCSpriteBatchNode must be not nil"); + CCASSERT(batchnode != nullptr, "CCSpriteBatchNode must be not nil"); bool pReturn = this->initWithBatchNode(batchnode, spriteFrame->getRect(), spriteFrame->isRotated(), capInsets); return pReturn; @@ -542,11 +542,11 @@ Scale9Sprite* Scale9Sprite::createWithSpriteFrame(SpriteFrame* spriteFrame, cons return pReturn; } CC_SAFE_DELETE(pReturn); - return NULL; + return nullptr; } bool Scale9Sprite::initWithSpriteFrame(SpriteFrame* spriteFrame) { - CCASSERT(spriteFrame != NULL, "Invalid spriteFrame for sprite"); + CCASSERT(spriteFrame != nullptr, "Invalid spriteFrame for sprite"); bool pReturn = this->initWithSpriteFrame(spriteFrame, Rect::ZERO); return pReturn; } @@ -560,17 +560,17 @@ Scale9Sprite* Scale9Sprite::createWithSpriteFrame(SpriteFrame* spriteFrame) return pReturn; } CC_SAFE_DELETE(pReturn); - return NULL; + return nullptr; } bool Scale9Sprite::initWithSpriteFrameName(const std::string& spriteFrameName, const Rect& capInsets) { - CCASSERT((SpriteFrameCache::getInstance()) != NULL, "SpriteFrameCache::getInstance() must be non-NULL"); + CCASSERT((SpriteFrameCache::getInstance()) != nullptr, "SpriteFrameCache::getInstance() must be non-nullptr"); SpriteFrame *frame = SpriteFrameCache::getInstance()->getSpriteFrameByName(spriteFrameName); - CCASSERT(frame != NULL, "CCSpriteFrame must be non-NULL"); + CCASSERT(frame != nullptr, "CCSpriteFrame must be non-nullptr"); - if (NULL == frame) return false; + if (nullptr == frame) return false; bool pReturn = this->initWithSpriteFrame(frame, capInsets); return pReturn; @@ -585,7 +585,7 @@ Scale9Sprite* Scale9Sprite::createWithSpriteFrameName(const std::string& spriteF return pReturn; } CC_SAFE_DELETE(pReturn); - return NULL; + return nullptr; } bool Scale9Sprite::initWithSpriteFrameName(const std::string& spriteFrameName) @@ -605,7 +605,7 @@ Scale9Sprite* Scale9Sprite::createWithSpriteFrameName(const std::string& spriteF CC_SAFE_DELETE(pReturn); log("Could not allocate Scale9Sprite()"); - return NULL; + return nullptr; } @@ -618,7 +618,7 @@ Scale9Sprite* Scale9Sprite::resizableSpriteWithCapInsets(const Rect& capInsets) return pReturn; } CC_SAFE_DELETE(pReturn); - return NULL; + return nullptr; } Scale9Sprite* Scale9Sprite::create() @@ -630,7 +630,7 @@ Scale9Sprite* Scale9Sprite::create() return pReturn; } CC_SAFE_DELETE(pReturn); - return NULL; + return nullptr; } /** sets the opacity. diff --git a/extensions/GUI/CCEditBox/CCEditBox.cpp b/extensions/GUI/CCEditBox/CCEditBox.cpp index ceea82382d..97c34951c7 100644 --- a/extensions/GUI/CCEditBox/CCEditBox.cpp +++ b/extensions/GUI/CCEditBox/CCEditBox.cpp @@ -62,18 +62,18 @@ void EditBox::touchDownAction(Ref *sender, Control::EventType controlEvent) _editBoxImpl->openKeyboard(); } -EditBox* EditBox::create(const Size& size, Scale9Sprite* pNormal9SpriteBg, Scale9Sprite* pPressed9SpriteBg/* = NULL*/, Scale9Sprite* pDisabled9SpriteBg/* = NULL*/) +EditBox* EditBox::create(const Size& size, Scale9Sprite* pNormal9SpriteBg, Scale9Sprite* pPressed9SpriteBg/* = nullptr*/, Scale9Sprite* pDisabled9SpriteBg/* = nullptr*/) { EditBox* pRet = new EditBox(); - if (pRet != NULL && pRet->initWithSizeAndBackgroundSprite(size, pNormal9SpriteBg)) + if (pRet != nullptr && pRet->initWithSizeAndBackgroundSprite(size, pNormal9SpriteBg)) { - if (pPressed9SpriteBg != NULL) + if (pPressed9SpriteBg != nullptr) { pRet->setBackgroundSpriteForState(pPressed9SpriteBg, Control::State::HIGH_LIGHTED); } - if (pDisabled9SpriteBg != NULL) + if (pDisabled9SpriteBg != nullptr) { pRet->setBackgroundSpriteForState(pDisabled9SpriteBg, Control::State::DISABLED); } @@ -108,7 +108,7 @@ bool EditBox::initWithSizeAndBackgroundSprite(const Size& size, Scale9Sprite* pP void EditBox::setDelegate(EditBoxDelegate* pDelegate) { _delegate = pDelegate; - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { _editBoxImpl->setDelegate(pDelegate); } @@ -121,10 +121,10 @@ EditBoxDelegate* EditBox::getDelegate() void EditBox::setText(const char* pText) { - if (pText != NULL) + if (pText != nullptr) { _text = pText; - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { _editBoxImpl->setText(pText); } @@ -133,10 +133,10 @@ void EditBox::setText(const char* pText) const char* EditBox::getText(void) { - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { const char* pText = _editBoxImpl->getText(); - if(pText != NULL) + if(pText != nullptr) return pText; } @@ -147,9 +147,9 @@ void EditBox::setFont(const char* pFontName, int fontSize) { _fontName = pFontName; _fontSize = fontSize; - if (pFontName != NULL) + if (pFontName != nullptr) { - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { _editBoxImpl->setFont(pFontName, fontSize); } @@ -159,7 +159,7 @@ void EditBox::setFont(const char* pFontName, int fontSize) void EditBox::setFontName(const char* pFontName) { _fontName = pFontName; - if (_editBoxImpl != NULL && _fontSize != -1) + if (_editBoxImpl != nullptr && _fontSize != -1) { _editBoxImpl->setFont(pFontName, _fontSize); } @@ -168,7 +168,7 @@ void EditBox::setFontName(const char* pFontName) void EditBox::setFontSize(int fontSize) { _fontSize = fontSize; - if (_editBoxImpl != NULL && _fontName.length() > 0) + if (_editBoxImpl != nullptr && _fontName.length() > 0) { _editBoxImpl->setFont(_fontName.c_str(), _fontSize); } @@ -177,7 +177,7 @@ void EditBox::setFontSize(int fontSize) void EditBox::setFontColor(const Color3B& color) { _colText = color; - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { _editBoxImpl->setFontColor(color); } @@ -187,9 +187,9 @@ void EditBox::setPlaceholderFont(const char* pFontName, int fontSize) { _placeholderFontName = pFontName; _placeholderFontSize = fontSize; - if (pFontName != NULL) + if (pFontName != nullptr) { - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { _editBoxImpl->setPlaceholderFont(pFontName, fontSize); } @@ -199,7 +199,7 @@ void EditBox::setPlaceholderFont(const char* pFontName, int fontSize) void EditBox::setPlaceholderFontName(const char* pFontName) { _placeholderFontName = pFontName; - if (_editBoxImpl != NULL && _placeholderFontSize != -1) + if (_editBoxImpl != nullptr && _placeholderFontSize != -1) { _editBoxImpl->setPlaceholderFont(pFontName, _fontSize); } @@ -208,7 +208,7 @@ void EditBox::setPlaceholderFontName(const char* pFontName) void EditBox::setPlaceholderFontSize(int fontSize) { _placeholderFontSize = fontSize; - if (_editBoxImpl != NULL && _placeholderFontName.length() > 0) + if (_editBoxImpl != nullptr && _placeholderFontName.length() > 0) { _editBoxImpl->setPlaceholderFont(_placeholderFontName.c_str(), _fontSize); } @@ -217,7 +217,7 @@ void EditBox::setPlaceholderFontSize(int fontSize) void EditBox::setPlaceholderFontColor(const Color3B& color) { _colText = color; - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { _editBoxImpl->setPlaceholderFontColor(color); } @@ -225,10 +225,10 @@ void EditBox::setPlaceholderFontColor(const Color3B& color) void EditBox::setPlaceHolder(const char* pText) { - if (pText != NULL) + if (pText != nullptr) { _placeHolder = pText; - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { _editBoxImpl->setPlaceHolder(pText); } @@ -243,7 +243,7 @@ const char* EditBox::getPlaceHolder(void) void EditBox::setInputMode(EditBox::InputMode inputMode) { _editBoxInputMode = inputMode; - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { _editBoxImpl->setInputMode(inputMode); } @@ -252,7 +252,7 @@ void EditBox::setInputMode(EditBox::InputMode inputMode) void EditBox::setMaxLength(int maxLength) { _maxLength = maxLength; - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { _editBoxImpl->setMaxLength(maxLength); } @@ -267,7 +267,7 @@ int EditBox::getMaxLength() void EditBox::setInputFlag(EditBox::InputFlag inputFlag) { _editBoxInputFlag = inputFlag; - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { _editBoxImpl->setInputFlag(inputFlag); } @@ -275,7 +275,7 @@ void EditBox::setInputFlag(EditBox::InputFlag inputFlag) void EditBox::setReturnType(EditBox::KeyboardReturnType returnType) { - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { _editBoxImpl->setReturnType(returnType); } @@ -285,7 +285,7 @@ void EditBox::setReturnType(EditBox::KeyboardReturnType returnType) void EditBox::setPosition(const Vec2& pos) { ControlButton::setPosition(pos); - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { _editBoxImpl->setPosition(pos); } @@ -294,7 +294,7 @@ void EditBox::setPosition(const Vec2& pos) void EditBox::setVisible(bool visible) { ControlButton::setVisible(visible); - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { _editBoxImpl->setVisible(visible); } @@ -303,7 +303,7 @@ void EditBox::setVisible(bool visible) void EditBox::setContentSize(const Size& size) { ControlButton::setContentSize(size); - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { _editBoxImpl->setContentSize(size); } @@ -312,7 +312,7 @@ void EditBox::setContentSize(const Size& size) void EditBox::setAnchorPoint(const Vec2& anchorPoint) { ControlButton::setAnchorPoint(anchorPoint); - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { _editBoxImpl->setAnchorPoint(anchorPoint); } @@ -321,7 +321,7 @@ void EditBox::setAnchorPoint(const Vec2& anchorPoint) void EditBox::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags) { ControlButton::visit(renderer, parentTransform, parentFlags); - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { _editBoxImpl->visit(); } @@ -338,7 +338,7 @@ void EditBox::onEnter(void) #endif ControlButton::onEnter(); - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { _editBoxImpl->onEnter(); } @@ -358,7 +358,7 @@ void EditBox::updatePosition(float dt) void EditBox::onExit(void) { ControlButton::onExit(); - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { // remove system edit control _editBoxImpl->closeKeyboard(); @@ -390,7 +390,7 @@ void EditBox::keyboardWillShow(IMEKeyboardNotificationInfo& info) _adjustHeight = info.end.getMaxY() - rectTracked.getMinY(); // CCLOG("CCEditBox:needAdjustVerticalPosition(%f)", _adjustHeight); - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { _editBoxImpl->doAnimationWhenKeyboardMove(info.duration, _adjustHeight); } @@ -404,7 +404,7 @@ void EditBox::keyboardDidShow(IMEKeyboardNotificationInfo& info) void EditBox::keyboardWillHide(IMEKeyboardNotificationInfo& info) { // CCLOG("CCEditBox::keyboardWillHide"); - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { _editBoxImpl->doAnimationWhenKeyboardMove(info.duration, -_adjustHeight); } diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp b/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp index d98082746f..3ae5275689 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp +++ b/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp @@ -93,12 +93,12 @@ bool EditBoxImplWin::initWithSize(const Size& size) void EditBoxImplWin::setFont(const char* pFontName, int fontSize) { - if(_label != NULL) { + if(_label != nullptr) { _label->setSystemFontName(pFontName); _label->setSystemFontSize(fontSize); } - if(_labelPlaceHolder != NULL) { + if(_labelPlaceHolder != nullptr) { _labelPlaceHolder->setSystemFontName(pFontName); _labelPlaceHolder->setSystemFontSize(fontSize); } @@ -112,7 +112,7 @@ void EditBoxImplWin::setFontColor(const Color3B& color) void EditBoxImplWin::setPlaceholderFont(const char* pFontName, int fontSize) { - if(_labelPlaceHolder != NULL) { + if(_labelPlaceHolder != nullptr) { _labelPlaceHolder->setSystemFontName(pFontName); _labelPlaceHolder->setSystemFontSize(fontSize); } @@ -156,7 +156,7 @@ bool EditBoxImplWin::isEditing() void EditBoxImplWin::setText(const char* pText) { - if (pText != NULL) + if (pText != nullptr) { _text = pText; @@ -199,7 +199,7 @@ const char* EditBoxImplWin::getText(void) void EditBoxImplWin::setPlaceHolder(const char* pText) { - if (pText != NULL) + if (pText != nullptr) { _placeHolder = pText; if (_placeHolder.length() > 0 && _text.length() == 0) @@ -236,13 +236,13 @@ void EditBoxImplWin::visit(void) void EditBoxImplWin::openKeyboard() { - if (_delegate != NULL) + if (_delegate != nullptr) { _delegate->editBoxEditingDidBegin(_editBox); } EditBox* pEditBox = this->getEditBox(); - if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler()) + if (nullptr != pEditBox && 0 != pEditBox->getScriptEditBoxHandler()) { CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "began",pEditBox); ScriptEvent event(kCommonEvent,(void*)&data); @@ -265,7 +265,7 @@ void EditBoxImplWin::openKeyboard() if (didChange) setText(pText); - if (_delegate != NULL) { + if (_delegate != nullptr) { if (didChange) _delegate->editBoxTextChanged(_editBox, getText()); _delegate->editBoxEditingDidEnd(_editBox); diff --git a/extensions/GUI/CCScrollView/CCScrollView.cpp b/extensions/GUI/CCScrollView/CCScrollView.cpp index 69a1742b40..d45c9f62a8 100644 --- a/extensions/GUI/CCScrollView/CCScrollView.cpp +++ b/extensions/GUI/CCScrollView/CCScrollView.cpp @@ -75,7 +75,7 @@ ScrollView::~ScrollView() } -ScrollView* ScrollView::create(Size size, Node* container/* = NULL*/) +ScrollView* ScrollView::create(Size size, Node* container/* = nullptr*/) { ScrollView* pRet = new ScrollView(); if (pRet && pRet->initWithViewSize(size, container)) @@ -104,7 +104,7 @@ ScrollView* ScrollView::create() } -bool ScrollView::initWithViewSize(Size size, Node *container/* = NULL*/) +bool ScrollView::initWithViewSize(Size size, Node *container/* = nullptr*/) { if (Layer::init()) { @@ -123,7 +123,7 @@ bool ScrollView::initWithViewSize(Size size, Node *container/* = NULL*/) _touches.reserve(EventTouch::MAX_TOUCHES); - _delegate = NULL; + _delegate = nullptr; _bounceable = true; _clippingToBounds = true; //_container->setContentSize(Size::ZERO); @@ -142,7 +142,7 @@ bool ScrollView::initWithViewSize(Size size, Node *container/* = NULL*/) bool ScrollView::init() { - return this->initWithViewSize(Size(200, 200), NULL); + return this->initWithViewSize(Size(200, 200), nullptr); } bool ScrollView::isNodeVisible(Node* node) @@ -225,7 +225,7 @@ void ScrollView::setContentOffset(Vec2 offset, bool animated/* = false*/) _container->setPosition(offset); - if (_delegate != NULL) + if (_delegate != nullptr) { _delegate->scrollViewDidScroll(this); } @@ -269,7 +269,7 @@ void ScrollView::setZoomScale(float s) newCenter = _container->convertToWorldSpace(oldCenter); const Vec2 offset = center - newCenter; - if (_delegate != NULL) + if (_delegate != nullptr) { _delegate->scrollViewDidZoom(this); } @@ -329,9 +329,9 @@ Node * ScrollView::getContainer() void ScrollView::setContainer(Node * pContainer) { - // Make sure that '_container' has a non-NULL value since there are + // Make sure that '_container' has a non-nullptr value since there are // lots of logic that use '_container'. - if (NULL == pContainer) + if (nullptr == pContainer) return; this->removeAllChildrenWithCleanup(true); @@ -430,7 +430,7 @@ void ScrollView::stoppedAnimatedScroll(Node * node) { this->unschedule(schedule_selector(ScrollView::performedAnimatedScroll)); // After the animation stopped, "scrollViewDidScroll" should be invoked, this could fix the bug of lack of tableview cells. - if (_delegate != NULL) + if (_delegate != nullptr) { _delegate->scrollViewDidScroll(this); } @@ -444,7 +444,7 @@ void ScrollView::performedAnimatedScroll(float dt) return; } - if (_delegate != NULL) + if (_delegate != nullptr) { _delegate->scrollViewDidScroll(this); } @@ -458,7 +458,7 @@ const Size& ScrollView::getContentSize() const void ScrollView::setContentSize(const Size & size) { - if (this->getContainer() != NULL) + if (this->getContainer() != nullptr) { this->getContainer()->setContentSize(size); this->updateInset(); @@ -467,7 +467,7 @@ void ScrollView::setContentSize(const Size & size) void ScrollView::updateInset() { - if (this->getContainer() != NULL) + if (this->getContainer() != nullptr) { _maxInset = this->maxContainerOffset(); _maxInset = Vec2(_maxInset.x + _viewSize.width * INSET_RATIO, @@ -812,7 +812,7 @@ Rect ScrollView::getViewRect() float scaleX = this->getScaleX(); float scaleY = this->getScaleY(); - for (Node *p = _parent; p != NULL; p = p->getParent()) { + for (Node *p = _parent; p != nullptr; p = p->getParent()) { scaleX *= p->getScaleX(); scaleY *= p->getScaleY(); } diff --git a/extensions/GUI/CCScrollView/CCTableView.cpp b/extensions/GUI/CCScrollView/CCTableView.cpp index 3ba3c9c216..b074fc4e88 100644 --- a/extensions/GUI/CCScrollView/CCTableView.cpp +++ b/extensions/GUI/CCScrollView/CCTableView.cpp @@ -35,7 +35,7 @@ TableView* TableView::create() TableView* TableView::create(TableViewDataSource* dataSource, Size size) { - return TableView::create(dataSource, size, NULL); + return TableView::create(dataSource, size, nullptr); } TableView* TableView::create(TableViewDataSource* dataSource, Size size, Node *container) @@ -50,7 +50,7 @@ TableView* TableView::create(TableViewDataSource* dataSource, Size size, Node *c return table; } -bool TableView::initWithViewSize(Size size, Node* container/* = NULL*/) +bool TableView::initWithViewSize(Size size, Node* container/* = nullptr*/) { if (ScrollView::initWithViewSize(size,container)) { @@ -103,7 +103,7 @@ void TableView::reloadData() _oldDirection = Direction::NONE; for(const auto &cell : _cellsUsed) { - if(_tableViewDelegate != NULL) { + if(_tableViewDelegate != nullptr) { _tableViewDelegate->tableCellWillRecycle(this, cell); } @@ -242,7 +242,7 @@ TableViewCell *TableView::dequeueCell() TableViewCell *cell; if (_cellsFreed.empty()) { - cell = NULL; + cell = nullptr; } else { cell = _cellsFreed.at(0); cell->retain(); @@ -396,7 +396,7 @@ long TableView::__indexFromOffset(Vec2 offset) void TableView::_moveCellOutOfSight(TableViewCell *cell) { - if(_tableViewDelegate != NULL) { + if(_tableViewDelegate != nullptr) { _tableViewDelegate->tableCellWillRecycle(this, cell); } @@ -464,7 +464,7 @@ void TableView::scrollViewDidScroll(ScrollView* view) }); } - if(_tableViewDelegate != NULL) { + if(_tableViewDelegate != nullptr) { _tableViewDelegate->scrollViewDidScroll(this); } @@ -577,13 +577,13 @@ void TableView::onTouchEnded(Touch *pTouch, Event *pEvent) Rect bb = this->getBoundingBox(); bb.origin = _parent->convertToWorldSpace(bb.origin); - if (bb.containsPoint(pTouch->getLocation()) && _tableViewDelegate != NULL) + if (bb.containsPoint(pTouch->getLocation()) && _tableViewDelegate != nullptr) { _tableViewDelegate->tableCellUnhighlight(this, _touchedCell); _tableViewDelegate->tableCellTouched(this, _touchedCell); } - _touchedCell = NULL; + _touchedCell = nullptr; } ScrollView::onTouchEnded(pTouch, pEvent); @@ -608,26 +608,26 @@ bool TableView::onTouchBegan(Touch *pTouch, Event *pEvent) index = this->_indexFromOffset(point); if (index == CC_INVALID_INDEX) { - _touchedCell = NULL; + _touchedCell = nullptr; } else { _touchedCell = this->cellAtIndex(index); } - if (_touchedCell && _tableViewDelegate != NULL) + if (_touchedCell && _tableViewDelegate != nullptr) { _tableViewDelegate->tableCellHighlight(this, _touchedCell); } } else if (_touchedCell) { - if(_tableViewDelegate != NULL) + if(_tableViewDelegate != nullptr) { _tableViewDelegate->tableCellUnhighlight(this, _touchedCell); } - _touchedCell = NULL; + _touchedCell = nullptr; } return touchResult; @@ -639,12 +639,12 @@ void TableView::onTouchMoved(Touch *pTouch, Event *pEvent) if (_touchedCell && isTouchMoved()) { - if(_tableViewDelegate != NULL) + if(_tableViewDelegate != nullptr) { _tableViewDelegate->tableCellUnhighlight(this, _touchedCell); } - _touchedCell = NULL; + _touchedCell = nullptr; } } @@ -654,12 +654,12 @@ void TableView::onTouchCancelled(Touch *pTouch, Event *pEvent) if (_touchedCell) { - if(_tableViewDelegate != NULL) + if(_tableViewDelegate != nullptr) { _tableViewDelegate->tableCellUnhighlight(this, _touchedCell); } - _touchedCell = NULL; + _touchedCell = nullptr; } } diff --git a/extensions/assets-manager/AssetsManager.cpp b/extensions/assets-manager/AssetsManager.cpp index 637cd18c98..52073d2f07 100644 --- a/extensions/assets-manager/AssetsManager.cpp +++ b/extensions/assets-manager/AssetsManager.cpp @@ -77,7 +77,7 @@ struct ProgressMessage // Implementation of AssetsManager -AssetsManager::AssetsManager(const char* packageUrl/* =NULL */, const char* versionFileUrl/* =NULL */, const char* storagePath/* =NULL */) +AssetsManager::AssetsManager(const char* packageUrl/* =nullptr */, const char* versionFileUrl/* =nullptr */, const char* storagePath/* =nullptr */) : _storagePath(storagePath) , _version("") , _packageUrl(packageUrl) @@ -309,9 +309,9 @@ bool AssetsManager::uncompress() &fileInfo, fileName, MAX_FILENAME, - NULL, + nullptr, 0, - NULL, + nullptr, 0) != UNZ_OK) { CCLOG("can not read file info"); @@ -455,7 +455,7 @@ bool AssetsManager::createDirectory(const char *path) return true; #else - BOOL ret = CreateDirectoryA(path, NULL); + BOOL ret = CreateDirectoryA(path, nullptr); if (!ret && ERROR_ALREADY_EXISTS != GetLastError()) { return false; @@ -632,7 +632,7 @@ void AssetsManager::createStoragePath() { // Remove downloaded files #if (CC_TARGET_PLATFORM != CC_PLATFORM_WIN32) - DIR *dir = NULL; + DIR *dir = nullptr; dir = opendir (_storagePath.c_str()); if (!dir) diff --git a/extensions/physics-nodes/CCPhysicsDebugNode.cpp b/extensions/physics-nodes/CCPhysicsDebugNode.cpp index 18f55cefe4..2fbc2c4fb9 100644 --- a/extensions/physics-nodes/CCPhysicsDebugNode.cpp +++ b/extensions/physics-nodes/CCPhysicsDebugNode.cpp @@ -70,7 +70,7 @@ static Vec2 cpVert2Point(const cpVect &vert) static Vec2* cpVertArray2ccpArrayN(const cpVect* cpVertArray, unsigned int count) { - if (count == 0) return NULL; + if (count == 0) return nullptr; Vec2* pPoints = new Vec2[count]; for (unsigned int i = 0; i < count; ++i) diff --git a/extensions/physics-nodes/CCPhysicsSprite.cpp b/extensions/physics-nodes/CCPhysicsSprite.cpp index 0c896a5677..a335a1b385 100644 --- a/extensions/physics-nodes/CCPhysicsSprite.cpp +++ b/extensions/physics-nodes/CCPhysicsSprite.cpp @@ -172,7 +172,7 @@ const Vec2& PhysicsSprite::getPosition() const void PhysicsSprite::getPosition(float* x, float* y) const { - if (x == NULL || y == NULL) { + if (x == nullptr || y == nullptr) { return; } const Vec2& pos = getPosFromPhysics(); diff --git a/extensions/proj.win32/Win32InputBox.cpp b/extensions/proj.win32/Win32InputBox.cpp index bc115dfc54..da1cb12301 100644 --- a/extensions/proj.win32/Win32InputBox.cpp +++ b/extensions/proj.win32/Win32InputBox.cpp @@ -138,11 +138,11 @@ INT_PTR CWin32InputBox::InputBoxEx(WIN32INPUTBOX_PARAM *param) #else HRSRC rcDlg = ::FindResource(hModule, MAKEINTRESOURCE(param->DlgTemplateName), RT_DIALOG); #endif - if (rcDlg == NULL) + if (rcDlg == nullptr) return 0; HGLOBAL hglobalDlg = ::LoadResource(hModule, rcDlg); - if (hglobalDlg == NULL) + if (hglobalDlg == nullptr) return 0; dlgTemplate = (LPDLGTEMPLATE) hglobalDlg; @@ -336,16 +336,16 @@ std::string CWin32InputBox::AnsiToUtf8(std::string strAnsi) std::string ret; if (strAnsi.length() > 0) { - int nWideStrLength = MultiByteToWideChar(CP_ACP, 0, strAnsi.c_str(), -1, NULL, 0); + int nWideStrLength = MultiByteToWideChar(CP_ACP, 0, strAnsi.c_str(), -1, nullptr, 0); WCHAR* pwszBuf = (WCHAR*)malloc((nWideStrLength+1)*sizeof(WCHAR)); memset(pwszBuf, 0, (nWideStrLength+1)*sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, strAnsi.c_str(), -1, pwszBuf, (nWideStrLength+1)*sizeof(WCHAR)); - int nUtf8Length = WideCharToMultiByte( CP_UTF8,0,pwszBuf,-1,NULL,0,NULL,FALSE ); + int nUtf8Length = WideCharToMultiByte( CP_UTF8,0,pwszBuf,-1,nullptr,0,nullptr,FALSE ); char* pszUtf8Buf = (char*)malloc((nUtf8Length+1)*sizeof(char)); memset(pszUtf8Buf, 0, (nUtf8Length+1)*sizeof(char)); - WideCharToMultiByte(CP_UTF8, 0, pwszBuf, -1, pszUtf8Buf, (nUtf8Length+1)*sizeof(char), NULL, FALSE); + WideCharToMultiByte(CP_UTF8, 0, pwszBuf, -1, pszUtf8Buf, (nUtf8Length+1)*sizeof(char), nullptr, FALSE); ret = pszUtf8Buf; free(pszUtf8Buf); @@ -359,16 +359,16 @@ std::string CWin32InputBox::Utf8ToAnsi(std::string strUTF8) std::string ret; if (strUTF8.length() > 0) { - int nWideStrLength = MultiByteToWideChar(CP_UTF8, 0, strUTF8.c_str(), -1, NULL, 0); + int nWideStrLength = MultiByteToWideChar(CP_UTF8, 0, strUTF8.c_str(), -1, nullptr, 0); WCHAR* pwszBuf = (WCHAR*)malloc((nWideStrLength+1)*sizeof(WCHAR)); memset(pwszBuf, 0, (nWideStrLength+1)*sizeof(WCHAR)); MultiByteToWideChar(CP_UTF8, 0, strUTF8.c_str(), -1, pwszBuf, (nWideStrLength+1)*sizeof(WCHAR)); - int nAnsiStrLength = WideCharToMultiByte( CP_ACP,0,pwszBuf,-1,NULL,0,NULL,FALSE ); + int nAnsiStrLength = WideCharToMultiByte( CP_ACP,0,pwszBuf,-1,nullptr,0,nullptr,FALSE ); char* pszAnsiBuf = (char*)malloc((nAnsiStrLength+1)*sizeof(char)); memset(pszAnsiBuf, 0, (nAnsiStrLength+1)*sizeof(char)); - WideCharToMultiByte(CP_ACP, 0, pwszBuf, -1, pszAnsiBuf, (nAnsiStrLength+1)*sizeof(char), NULL, FALSE); + WideCharToMultiByte(CP_ACP, 0, pwszBuf, -1, pszAnsiBuf, (nAnsiStrLength+1)*sizeof(char), nullptr, FALSE); ret = pszAnsiBuf; free(pszAnsiBuf); diff --git a/templates/cocos2dx_files.json b/templates/cocos2dx_files.json index 7665651405..f87244b758 100644 --- a/templates/cocos2dx_files.json +++ b/templates/cocos2dx_files.json @@ -3980,6 +3980,8 @@ "cocos/scripting/lua-bindings/manual/lua_cocos2dx_coco_studio_manual.hpp", "cocos/scripting/lua-bindings/manual/lua_cocos2dx_deprecated.cpp", "cocos/scripting/lua-bindings/manual/lua_cocos2dx_deprecated.h", + "cocos/scripting/lua-bindings/manual/lua_cocos2dx_experimental_video_manual.cpp", + "cocos/scripting/lua-bindings/manual/lua_cocos2dx_experimental_video_manual.hpp", "cocos/scripting/lua-bindings/manual/lua_cocos2dx_extension_manual.cpp", "cocos/scripting/lua-bindings/manual/lua_cocos2dx_extension_manual.h", "cocos/scripting/lua-bindings/manual/lua_cocos2dx_manual.cpp", @@ -4022,6 +4024,7 @@ "cocos/scripting/lua-bindings/script/Opengl.lua", "cocos/scripting/lua-bindings/script/OpenglConstants.lua", "cocos/scripting/lua-bindings/script/StudioConstants.lua", + "cocos/scripting/lua-bindings/script/experimentalConstants.lua", "cocos/scripting/lua-bindings/script/extern.lua", "cocos/scripting/lua-bindings/script/json.lua", "cocos/scripting/lua-bindings/script/luaj.lua", @@ -4406,6 +4409,7 @@ "tools/bindings-generator/tools/win32/cygwin1.dll", "tools/tolua/README.mdown", "tools/tolua/cocos2dx.ini", + "tools/tolua/cocos2dx_experimental_video.ini", "tools/tolua/cocos2dx_extension.ini", "tools/tolua/cocos2dx_physics.ini", "tools/tolua/cocos2dx_spine.ini", diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/HelloLua.xcodeproj/project.pbxproj b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/HelloLua.xcodeproj/project.pbxproj index 067c0a1743..bdde18eec0 100644 --- a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/HelloLua.xcodeproj/project.pbxproj +++ b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/HelloLua.xcodeproj/project.pbxproj @@ -17,6 +17,7 @@ 15A8A4841834C73500142BE0 /* libcocos2dx-extensions Mac.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 15A8A4191834BDA200142BE0 /* libcocos2dx-extensions Mac.a */; }; 15A8A4851834C73500142BE0 /* libCocosDenshion Mac.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 15A8A41F1834BDA200142BE0 /* libCocosDenshion Mac.a */; }; 15A8A4881834C90F00142BE0 /* libcurl.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 15A8A4871834C90E00142BE0 /* libcurl.dylib */; }; + 15AECE29195D482800907DB0 /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15AECE28195D482800907DB0 /* MediaPlayer.framework */; }; 1AF4C403178663F200122817 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AF4C402178663F200122817 /* libz.dylib */; }; 5023811817EBBCAC00990C9B /* AppController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5023810817EBBCAC00990C9B /* AppController.mm */; }; 5023811917EBBCAC00990C9B /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 5023810917EBBCAC00990C9B /* Default-568h@2x.png */; }; @@ -277,6 +278,7 @@ /* Begin PBXFileReference section */ 15A8A4031834BDA200142BE0 /* cocos2d_libs.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = cocos2d_libs.xcodeproj; path = "../../cocos2d-x/build/cocos2d_libs.xcodeproj"; sourceTree = ""; }; 15A8A4871834C90E00142BE0 /* libcurl.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libcurl.dylib; path = usr/lib/libcurl.dylib; sourceTree = SDKROOT; }; + 15AECE28195D482800907DB0 /* MediaPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaPlayer.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/System/Library/Frameworks/MediaPlayer.framework; sourceTree = DEVELOPER_DIR; }; 15C1568D1683131500D239F2 /* libcurl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcurl.a; path = "../../cocos2d-x/cocos2dx/platform/third_party/ios/libraries/libcurl.a"; sourceTree = ""; }; 1AF4C402178663F200122817 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; 5023810717EBBCAC00990C9B /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppController.h; sourceTree = ""; }; @@ -375,6 +377,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 15AECE29195D482800907DB0 /* MediaPlayer.framework in Frameworks */, C03781F618BF65B100FE4F13 /* libluabindings iOS.a in Frameworks */, 15A8A4441834C43700142BE0 /* libchipmunk iOS.a in Frameworks */, 15A8A4451834C43700142BE0 /* libcocos2dx iOS.a in Frameworks */, @@ -523,6 +526,7 @@ F293B3CB15EB7BE500256477 /* Frameworks */ = { isa = PBXGroup; children = ( + 15AECE28195D482800907DB0 /* MediaPlayer.framework */, 15A8A4871834C90E00142BE0 /* libcurl.dylib */, D6B061341803AC000077942B /* CoreMotion.framework */, 50D7C96F17EBBEEC005D0B91 /* IOKit.framework */, diff --git a/tests/cpp-tests/Classes/ActionManagerTest/ActionManagerTest.cpp b/tests/cpp-tests/Classes/ActionManagerTest/ActionManagerTest.cpp index 0ae621cd24..9f3943f535 100644 --- a/tests/cpp-tests/Classes/ActionManagerTest/ActionManagerTest.cpp +++ b/tests/cpp-tests/Classes/ActionManagerTest/ActionManagerTest.cpp @@ -28,7 +28,7 @@ Layer* createActionManagerLayer(int nIndex) case 4: return new ResumeTest(); } - return NULL; + return nullptr; } Layer* nextActionManagerAction() @@ -129,14 +129,14 @@ void CrashTest::onEnter() child->runAction(Sequence::create( DelayTime::create(1.4f), FadeOut::create(1.1f), - NULL) + nullptr) ); //After 1.5 second, self will be removed. runAction( Sequence::create( DelayTime::create(1.4f), CallFunc::create( CC_CALLBACK_0(CrashTest::removeThis,this)), - NULL) + nullptr) ); } @@ -168,7 +168,7 @@ void LogicTest::onEnter() grossini->runAction( Sequence::create( MoveBy::create(1, Vec2(150,0)), CallFuncN::create(CC_CALLBACK_1(LogicTest::bugMe,this)), - NULL) + nullptr) ); } @@ -246,7 +246,7 @@ void StopActionTest::onEnter() auto pMove = MoveBy::create(2, Vec2(200, 0)); auto pCallback = CallFunc::create(CC_CALLBACK_0(StopActionTest::stopAction,this)); - auto pSequence = Sequence::create(pMove, pCallback, NULL); + auto pSequence = Sequence::create(pMove, pCallback, nullptr); pSequence->setTag(kTagSequence); auto pChild = Sprite::create(s_pathGrossini); diff --git a/tests/cpp-tests/Classes/ActionsEaseTest/ActionsEaseTest.cpp b/tests/cpp-tests/Classes/ActionsEaseTest/ActionsEaseTest.cpp index 30a1355732..83232ee376 100644 --- a/tests/cpp-tests/Classes/ActionsEaseTest/ActionsEaseTest.cpp +++ b/tests/cpp-tests/Classes/ActionsEaseTest/ActionsEaseTest.cpp @@ -93,9 +93,9 @@ void SpriteEase::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), NULL); - auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), NULL); + auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), nullptr); + auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), nullptr); auto a2 = _grossini->runAction(RepeatForever::create(seq1)); @@ -149,9 +149,9 @@ void SpriteEaseInOut::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create( move_ease_inout1, delay, move_ease_inout_back1, delay->clone(), NULL); - auto seq2 = Sequence::create( move_ease_inout2, delay->clone(), move_ease_inout_back2, delay->clone(), NULL); - auto seq3 = Sequence::create( move_ease_inout3, delay->clone(), move_ease_inout_back3, delay->clone(), NULL); + auto seq1 = Sequence::create( move_ease_inout1, delay, move_ease_inout_back1, delay->clone(), nullptr); + auto seq2 = Sequence::create( move_ease_inout2, delay->clone(), move_ease_inout_back2, delay->clone(), nullptr); + auto seq3 = Sequence::create( move_ease_inout3, delay->clone(), move_ease_inout_back3, delay->clone(), nullptr); _tamara->runAction(RepeatForever::create(seq1)); _kathia->runAction(RepeatForever::create(seq2)); @@ -185,9 +185,9 @@ void SpriteEaseExponential::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), NULL); - auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), NULL); + auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), nullptr); + auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), nullptr); _grossini->runAction( RepeatForever::create(seq1)); @@ -218,8 +218,8 @@ void SpriteEaseExponentialInOut::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create( move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create( move_ease, delay, move_ease_back, delay->clone(), NULL); + auto seq1 = Sequence::create( move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create( move_ease, delay, move_ease_back, delay->clone(), nullptr); this->positionForTwo(); @@ -254,9 +254,9 @@ void SpriteEaseSine::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), NULL); - auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), NULL); + auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), nullptr); + auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), nullptr); _grossini->runAction( RepeatForever::create(seq1)); @@ -288,8 +288,8 @@ void SpriteEaseSineInOut::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), NULL); + auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), nullptr); this->positionForTwo(); @@ -323,9 +323,9 @@ void SpriteEaseElastic::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), NULL); - auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), NULL); + auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), nullptr); + auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), nullptr); _grossini->runAction( RepeatForever::create(seq1)); _tamara->runAction( RepeatForever::create(seq2)); @@ -361,9 +361,9 @@ void SpriteEaseElasticInOut::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move_ease_inout1, delay, move_ease_inout_back1, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease_inout2, delay->clone(), move_ease_inout_back2, delay->clone(), NULL); - auto seq3 = Sequence::create(move_ease_inout3, delay->clone(), move_ease_inout_back3, delay->clone(), NULL); + auto seq1 = Sequence::create(move_ease_inout1, delay, move_ease_inout_back1, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease_inout2, delay->clone(), move_ease_inout_back2, delay->clone(), nullptr); + auto seq3 = Sequence::create(move_ease_inout3, delay->clone(), move_ease_inout_back3, delay->clone(), nullptr); _tamara->runAction( RepeatForever::create(seq1)); _kathia->runAction( RepeatForever::create(seq2)); @@ -398,9 +398,9 @@ void SpriteEaseBounce::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), NULL); - auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), NULL); + auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), nullptr); + auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), nullptr); _grossini->runAction( RepeatForever::create(seq1)); _tamara->runAction( RepeatForever::create(seq2)); @@ -432,8 +432,8 @@ void SpriteEaseBounceInOut::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), NULL); + auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), nullptr); this->positionForTwo(); @@ -468,9 +468,9 @@ void SpriteEaseBack::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), NULL); - auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), NULL); + auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), nullptr); + auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), nullptr); _grossini->runAction(RepeatForever::create(seq1)); _tamara->runAction(RepeatForever::create(seq2)); @@ -501,8 +501,8 @@ void SpriteEaseBackInOut::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), NULL); + auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), nullptr); this->positionForTwo(); @@ -546,7 +546,7 @@ void SpriteEaseBezier::onEnter() bezierEaseForward->setBezierParamer(0.5, 0.5, 1.0, 1.0); auto bezierEaseBack = bezierEaseForward->reverse(); - auto rep = RepeatForever::create(Sequence::create( bezierEaseForward, bezierEaseBack, NULL)); + auto rep = RepeatForever::create(Sequence::create( bezierEaseForward, bezierEaseBack, nullptr)); // sprite 2 @@ -599,9 +599,9 @@ void SpriteEaseQuadratic::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), NULL); - auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), NULL); + auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), nullptr); + auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), nullptr); _grossini->runAction( RepeatForever::create(seq1)); _tamara->runAction( RepeatForever::create(seq2)); @@ -631,8 +631,8 @@ void SpriteEaseQuadraticInOut::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), NULL); + auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), nullptr); this->positionForTwo(); @@ -667,9 +667,9 @@ void SpriteEaseQuartic::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), NULL); - auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), NULL); + auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), nullptr); + auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), nullptr); _grossini->runAction( RepeatForever::create(seq1)); _tamara->runAction( RepeatForever::create(seq2)); @@ -699,8 +699,8 @@ void SpriteEaseQuarticInOut::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), NULL); + auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), nullptr); this->positionForTwo(); @@ -734,9 +734,9 @@ void SpriteEaseQuintic::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), NULL); - auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), NULL); + auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), nullptr); + auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), nullptr); _grossini->runAction( RepeatForever::create(seq1)); _tamara->runAction( RepeatForever::create(seq2)); @@ -767,8 +767,8 @@ void SpriteEaseQuinticInOut::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), NULL); + auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), nullptr); this->positionForTwo(); @@ -802,9 +802,9 @@ void SpriteEaseCircle::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), NULL); - auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), NULL); + auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), nullptr); + auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), nullptr); _grossini->runAction( RepeatForever::create(seq1)); _tamara->runAction( RepeatForever::create(seq2)); @@ -835,8 +835,8 @@ void SpriteEaseCircleInOut::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), NULL); + auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), nullptr); this->positionForTwo(); @@ -870,9 +870,9 @@ void SpriteEaseCubic::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), NULL); - auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), NULL); + auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), nullptr); + auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), nullptr); _grossini->runAction( RepeatForever::create(seq1)); _tamara->runAction( RepeatForever::create(seq2)); @@ -903,8 +903,8 @@ void SpriteEaseCubicInOut::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), NULL); + auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), nullptr); this->positionForTwo(); @@ -934,9 +934,9 @@ void SpeedTest::onEnter() auto rot1 = RotateBy::create(4, 360*2); auto rot2 = rot1->reverse(); - auto seq3_1 = Sequence::create(jump2, jump1, NULL); - auto seq3_2 = Sequence::create( rot1, rot2, NULL); - auto spawn = Spawn::create(seq3_1, seq3_2, NULL); + auto seq3_1 = Sequence::create(jump2, jump1, nullptr); + auto seq3_2 = Sequence::create( rot1, rot2, nullptr); + auto spawn = Spawn::create(seq3_1, seq3_2, nullptr); auto action = Speed::create(RepeatForever::create(spawn), 1.0f); action->setTag(kTagAction1); @@ -1017,7 +1017,7 @@ Layer* createEaseLayer(int nIndex) } - return NULL; + return nullptr; } Layer* nextEaseAction() diff --git a/tests/cpp-tests/Classes/ActionsProgressTest/ActionsProgressTest.cpp b/tests/cpp-tests/Classes/ActionsProgressTest/ActionsProgressTest.cpp index 8783884961..2b83ab8e3b 100644 --- a/tests/cpp-tests/Classes/ActionsProgressTest/ActionsProgressTest.cpp +++ b/tests/cpp-tests/Classes/ActionsProgressTest/ActionsProgressTest.cpp @@ -47,7 +47,7 @@ Layer* createLayer(int nIndex) case 6: return new SpriteProgressWithSpriteFrame(); } - return NULL; + return nullptr; } Layer* nextAction() @@ -371,10 +371,10 @@ void SpriteProgressBarTintAndFade::onEnter() auto tint = Sequence::create(TintTo::create(1, 255, 0, 0), TintTo::create(1, 0, 255, 0), TintTo::create(1, 0, 0, 255), - NULL); + nullptr); auto fade = Sequence::create(FadeTo::create(1.0f, 0), FadeTo::create(1.0f, 255), - NULL); + nullptr); auto left = ProgressTimer::create(Sprite::create(s_pathSister1)); left->setType(ProgressTimer::Type::BAR); diff --git a/tests/cpp-tests/Classes/ActionsTest/ActionsTest.cpp b/tests/cpp-tests/Classes/ActionsTest/ActionsTest.cpp index 608ce735d2..6a3dcf8813 100644 --- a/tests/cpp-tests/Classes/ActionsTest/ActionsTest.cpp +++ b/tests/cpp-tests/Classes/ActionsTest/ActionsTest.cpp @@ -290,7 +290,7 @@ void ActionMove::onEnter() auto actionByBack = actionBy->reverse(); _tamara->runAction( actionTo); - _grossini->runAction( Sequence::create(actionBy, actionByBack, NULL)); + _grossini->runAction( Sequence::create(actionBy, actionByBack, nullptr)); _kathia->runAction(MoveTo::create(1, Vec2(40,40))); } @@ -315,8 +315,8 @@ void ActionScale::onEnter() auto actionBy2 = ScaleBy::create(2.0f, 5.0f, 1.0f); _grossini->runAction( actionTo); - _tamara->runAction( Sequence::create(actionBy, actionBy->reverse(), NULL)); - _kathia->runAction( Sequence::create(actionBy2, actionBy2->reverse(), NULL)); + _tamara->runAction( Sequence::create(actionBy, actionBy->reverse(), nullptr)); + _kathia->runAction( Sequence::create(actionBy2, actionBy2->reverse(), nullptr)); } std::string ActionScale::subtitle() const @@ -341,10 +341,10 @@ void ActionSkew::onEnter() auto actionBy2 = SkewBy::create(2, 45.0f, 45.0f); auto actionByBack = actionBy->reverse(); - _tamara->runAction(Sequence::create(actionTo, actionToBack, NULL)); - _grossini->runAction(Sequence::create(actionBy, actionByBack, NULL)); + _tamara->runAction(Sequence::create(actionTo, actionToBack, nullptr)); + _grossini->runAction(Sequence::create(actionBy, actionByBack, nullptr)); - _kathia->runAction(Sequence::create(actionBy2, actionBy2->reverse(), NULL)); + _kathia->runAction(Sequence::create(actionBy2, actionBy2->reverse(), nullptr)); } std::string ActionSkew::subtitle() const @@ -367,9 +367,9 @@ void ActionRotationalSkew::onEnter() auto actionBy2 = RotateBy::create(2, 360, 0); auto actionBy2Back = actionBy2->reverse(); - _tamara->runAction( Sequence::create(actionBy, actionByBack, NULL) ); - _grossini->runAction( Sequence::create(actionTo, actionToBack, NULL) ); - _kathia->runAction( Sequence::create(actionBy2, actionBy2Back, NULL) ); + _tamara->runAction( Sequence::create(actionBy, actionByBack, nullptr) ); + _grossini->runAction( Sequence::create(actionTo, actionToBack, nullptr) ); + _kathia->runAction( Sequence::create(actionBy2, actionBy2Back, nullptr) ); } std::string ActionRotationalSkew::subtitle() const @@ -406,7 +406,7 @@ void ActionRotationalSkewVSStandardSkew::onEnter() auto actionTo = SkewBy::create(2, 360, 0); auto actionToBack = SkewBy::create(2, -360, 0); - box->runAction(Sequence::create(actionTo, actionToBack, NULL)); + box->runAction(Sequence::create(actionTo, actionToBack, nullptr)); box = LayerColor::create(Color4B(255,255,0,255)); box->setAnchorPoint(Vec2(0.5,0.5)); @@ -420,7 +420,7 @@ void ActionRotationalSkewVSStandardSkew::onEnter() this->addChild(label); auto actionTo2 = RotateBy::create(2, 360, 0); auto actionToBack2 = RotateBy::create(2, -360, 0); - box->runAction(Sequence::create(actionTo2, actionToBack2, NULL)); + box->runAction(Sequence::create(actionTo2, actionToBack2, nullptr)); } std::string ActionRotationalSkewVSStandardSkew::subtitle() const { @@ -465,9 +465,9 @@ void ActionSkewRotateScale::onEnter() auto rotateToBack = RotateTo::create(2, 0); auto actionToBack = SkewTo::create(2, 0, 0); - box->runAction(Sequence::create(actionTo, actionToBack, NULL)); - box->runAction(Sequence::create(rotateTo, rotateToBack, NULL)); - box->runAction(Sequence::create(actionScaleTo, actionScaleToBack, NULL)); + box->runAction(Sequence::create(actionTo, actionToBack, nullptr)); + box->runAction(Sequence::create(rotateTo, rotateToBack, nullptr)); + box->runAction(Sequence::create(actionScaleTo, actionScaleToBack, nullptr)); } std::string ActionSkewRotateScale::subtitle() const @@ -489,13 +489,13 @@ void ActionRotate::onEnter() auto actionTo = RotateTo::create( 2, 45); auto actionTo2 = RotateTo::create( 2, -45); auto actionTo0 = RotateTo::create(2 , 0); - _tamara->runAction( Sequence::create(actionTo, actionTo0, NULL)); + _tamara->runAction( Sequence::create(actionTo, actionTo0, nullptr)); auto actionBy = RotateBy::create(2 , 360); auto actionByBack = actionBy->reverse(); - _grossini->runAction( Sequence::create(actionBy, actionByBack, NULL)); + _grossini->runAction( Sequence::create(actionBy, actionByBack, nullptr)); - _kathia->runAction( Sequence::create(actionTo2, actionTo0->clone(), NULL)); + _kathia->runAction( Sequence::create(actionTo2, actionTo0->clone(), nullptr)); } std::string ActionRotate::subtitle() const @@ -545,7 +545,7 @@ void ActionJump::onEnter() auto actionByBack = actionBy->reverse(); _tamara->runAction( actionTo); - _grossini->runAction( Sequence::create(actionBy, actionByBack, NULL)); + _grossini->runAction( Sequence::create(actionBy, actionByBack, nullptr)); _kathia->runAction( RepeatForever::create(actionUp)); } std::string ActionJump::subtitle() const @@ -579,7 +579,7 @@ void ActionBezier::onEnter() auto bezierForward = BezierBy::create(3, bezier); auto bezierBack = bezierForward->reverse(); - auto rep = RepeatForever::create(Sequence::create( bezierForward, bezierBack, NULL)); + auto rep = RepeatForever::create(Sequence::create( bezierForward, bezierBack, nullptr)); // sprite 2 @@ -650,9 +650,9 @@ void ActionFade::onEnter() auto action2BackReverseReverse = action2BackReverse->reverse(); _tamara->setOpacity(122); - _tamara->runAction( Sequence::create( action1, action1Back, NULL)); + _tamara->runAction( Sequence::create( action1, action1Back, nullptr)); _kathia->setOpacity(122); - _kathia->runAction( Sequence::create( action2, action2Back,action2BackReverse,action2BackReverseReverse, NULL)); + _kathia->runAction( Sequence::create( action2, action2Back,action2BackReverse,action2BackReverseReverse, nullptr)); } std::string ActionFade::subtitle() const @@ -677,7 +677,7 @@ void ActionTint::onEnter() auto action2Back = action2->reverse(); _tamara->runAction( action1); - _kathia->runAction( Sequence::create( action2, action2Back, NULL)); + _kathia->runAction( Sequence::create( action2, action2Back, nullptr)); } std::string ActionTint::subtitle() const @@ -711,7 +711,7 @@ void ActionAnimate::onEnter() animation->setRestoreOriginalFrame(true); auto action = Animate::create(animation); - _grossini->runAction(Sequence::create(action, action->reverse(), NULL)); + _grossini->runAction(Sequence::create(action, action->reverse(), nullptr)); // // File animation @@ -722,7 +722,7 @@ void ActionAnimate::onEnter() auto animation2 = cache->getAnimation("dance_1"); auto action2 = Animate::create(animation2); - _tamara->runAction(Sequence::create(action2, action2->reverse(), NULL)); + _tamara->runAction(Sequence::create(action2, action2->reverse(), nullptr)); _frameDisplayedListener = EventListenerCustom::create(AnimationFrameDisplayedNotification, [](EventCustom * event){ auto userData = static_cast(event->getUserData()); @@ -774,7 +774,7 @@ void ActionSequence::onEnter() auto action = Sequence::create( MoveBy::create( 2, Vec2(240,0)), RotateBy::create( 2, 540), - NULL); + nullptr); _grossini->runAction(action); } @@ -804,7 +804,7 @@ void ActionSequence2::onEnter() CallFunc::create( CC_CALLBACK_0(ActionSequence2::callback1,this)), CallFunc::create( CC_CALLBACK_0(ActionSequence2::callback2,this,_grossini)), CallFunc::create( CC_CALLBACK_0(ActionSequence2::callback3,this,_grossini,0xbebabeba)), - NULL); + nullptr); _grossini->runAction(action); } @@ -855,7 +855,7 @@ void ActionCallFuncN::onEnter() auto action = Sequence::create( MoveBy::create(2.0f, Vec2(150,0)), CallFuncN::create( CC_CALLBACK_1(ActionCallFuncN::callback, this)), - NULL); + nullptr); _grossini->runAction(action); } @@ -890,7 +890,7 @@ void ActionCallFuncND::onEnter() auto action = Sequence::create( MoveBy::create(2.0f, Vec2(200,0)), CallFuncN::create( CC_CALLBACK_1(ActionCallFuncND::doRemoveFromParentAndCleanup, this, true)), - NULL); + nullptr); _grossini->runAction(action); } @@ -925,7 +925,7 @@ void ActionCallFuncO::onEnter() auto action = Sequence::create( MoveBy::create(2.0f, Vec2(200,0)), CallFunc::create( CC_CALLBACK_0(ActionCallFuncO::callback, this, _grossini, true)), - NULL); + nullptr); _grossini->runAction(action); } @@ -967,19 +967,19 @@ void ActionCallFunction::onEnter() label->setPosition(Vec2( s.width/4*1,s.height/2-40)); this->addChild(label); } ), - NULL); + nullptr); auto action2 = Sequence::create( ScaleBy::create(2 , 2), FadeOut::create(2), CallFunc::create( std::bind(&ActionCallFunction::callback2, this, _tamara) ), - NULL); + nullptr); auto action3 = Sequence::create( RotateBy::create(3 , 360), FadeOut::create(2), CallFunc::create( std::bind(&ActionCallFunction::callback3, this, _kathia, 42) ), - NULL); + nullptr); _grossini->runAction(action1); _tamara->runAction(action2); @@ -1036,7 +1036,7 @@ void ActionSpawn::onEnter() auto action = Spawn::create( JumpBy::create(2, Vec2(300,0), 50, 4), RotateBy::create( 2, 720), - NULL); + nullptr); _grossini->runAction(action); } @@ -1061,7 +1061,7 @@ void ActionRepeatForever::onEnter() auto action = Sequence::create( DelayTime::create(1), CallFunc::create( std::bind( &ActionRepeatForever::repeatForever, this, _grossini) ), - NULL); + nullptr); _grossini->runAction(action); } @@ -1092,7 +1092,7 @@ void ActionRotateToRepeat::onEnter() auto act1 = RotateTo::create(1, 90); auto act2 = RotateTo::create(1, 0); - auto seq = Sequence::create(act1, act2, NULL); + auto seq = Sequence::create(act1, act2, nullptr); auto rep1 = RepeatForever::create(seq); auto rep2 = Repeat::create( seq->clone(), 10); @@ -1120,7 +1120,7 @@ void ActionRotateJerk::onEnter() auto seq = Sequence::create( RotateTo::create(0.5f, -20), RotateTo::create(0.5f, 20), - NULL); + nullptr); auto rep1 = Repeat::create(seq, 10); auto rep2 = RepeatForever::create( seq->clone() ); @@ -1146,7 +1146,7 @@ void ActionReverse::onEnter() alignSpritesLeft(1); auto jump = JumpBy::create(2, Vec2(300,0), 50, 4); - auto action = Sequence::create( jump, jump->reverse(), NULL); + auto action = Sequence::create( jump, jump->reverse(), nullptr); _grossini->runAction(action); } @@ -1169,7 +1169,7 @@ void ActionDelayTime::onEnter() alignSpritesLeft(1); auto move = MoveBy::create(1, Vec2(150,0)); - auto action = Sequence::create( move, DelayTime::create(2), move, NULL); + auto action = Sequence::create( move, DelayTime::create(2), move, nullptr); _grossini->runAction(action); } @@ -1193,8 +1193,8 @@ void ActionReverseSequence::onEnter() auto move1 = MoveBy::create(1, Vec2(250,0)); auto move2 = MoveBy::create(1, Vec2(0,50)); - auto seq = Sequence::create( move1, move2, move1->reverse(), NULL); - auto action = Sequence::create( seq, seq->reverse(), NULL); + auto seq = Sequence::create( move1, move2, move1->reverse(), nullptr); + auto action = Sequence::create( seq, seq->reverse(), nullptr); _grossini->runAction(action); } @@ -1223,8 +1223,8 @@ void ActionReverseSequence2::onEnter() auto move2 = MoveBy::create(1, Vec2(0,50)); auto tog1 = ToggleVisibility::create(); auto tog2 = ToggleVisibility::create(); - auto seq = Sequence::create( move1, tog1, move2, tog2, move1->reverse(), NULL); - auto action = Repeat::create(Sequence::create( seq, seq->reverse(), NULL), 3); + auto seq = Sequence::create( move1, tog1, move2, tog2, move1->reverse(), nullptr); + auto action = Repeat::create(Sequence::create( seq, seq->reverse(), nullptr), 3); // Test: @@ -1234,9 +1234,9 @@ void ActionReverseSequence2::onEnter() auto move_tamara = MoveBy::create(1, Vec2(100,0)); auto move_tamara2 = MoveBy::create(1, Vec2(50,0)); auto hide = Hide::create(); - auto seq_tamara = Sequence::create( move_tamara, hide, move_tamara2, NULL); + auto seq_tamara = Sequence::create( move_tamara, hide, move_tamara2, nullptr); auto seq_back = seq_tamara->reverse(); - _tamara->runAction( Sequence::create( seq_tamara, seq_back, NULL)); + _tamara->runAction( Sequence::create( seq_tamara, seq_back, nullptr)); } std::string ActionReverseSequence2::subtitle() const { @@ -1257,10 +1257,10 @@ void ActionRepeat::onEnter() auto a1 = MoveBy::create(1, Vec2(150,0)); auto action1 = Repeat::create( - Sequence::create( Place::create(Vec2(60,60)), a1, NULL) , + Sequence::create( Place::create(Vec2(60,60)), a1, nullptr) , 3); auto action2 = RepeatForever::create( - Sequence::create(a1->clone(), a1->reverse(), NULL) + Sequence::create(a1->clone(), a1->reverse(), nullptr) ); _kathia->runAction(action1); @@ -1308,7 +1308,7 @@ void ActionOrbit::onEnter() auto move = MoveBy::create(3, Vec2(100,-100)); auto move_back = move->reverse(); - auto seq = Sequence::create(move, move_back, NULL); + auto seq = Sequence::create(move, move_back, nullptr); auto rfe = RepeatForever::create(seq); _kathia->runAction(rfe); _tamara->runAction(rfe->clone() ); @@ -1342,7 +1342,7 @@ void ActionFollow::onEnter() _grossini->setPosition(Vec2(-200, s.height / 2)); auto move = MoveBy::create(2, Vec2(s.width * 3, 0)); auto move_back = move->reverse(); - auto seq = Sequence::create(move, move_back, NULL); + auto seq = Sequence::create(move, move_back, nullptr); auto rep = RepeatForever::create(seq); _grossini->runAction(rep); @@ -1395,7 +1395,7 @@ void ActionTargeted::onEnter() auto t1 = TargetedAction::create(_kathia, jump2); auto t2 = TargetedAction::create(_kathia, rot2); - auto seq = Sequence::create(jump1, t1, rot1, t2, NULL); + auto seq = Sequence::create(jump1, t1, rot1, t2, nullptr); auto always = RepeatForever::create(seq); _tamara->runAction(always); @@ -1426,7 +1426,7 @@ void ActionTargetedReverse::onEnter() auto t1 = TargetedAction::create(_kathia, jump2); auto t2 = TargetedAction::create(_kathia, rot2); - auto seq = Sequence::create(jump1, t1->reverse(), rot1, t2->reverse(), NULL); + auto seq = Sequence::create(jump1, t1->reverse(), rot1, t2->reverse(), nullptr); auto always = RepeatForever::create(seq); _tamara->runAction(always); @@ -1506,14 +1506,14 @@ void ActionMoveStacked::runActionsInSprite(Sprite *sprite) Sequence::create( MoveBy::create(0.05f, Vec2(10,10)), MoveBy::create(0.05f, Vec2(-10,-10)), - NULL))); + nullptr))); auto action = MoveBy::create(2.0f, Vec2(400,0)); auto action_back = action->reverse(); sprite->runAction( RepeatForever::create( - Sequence::create(action, action_back, NULL) + Sequence::create(action, action_back, nullptr) )); } @@ -1532,14 +1532,14 @@ void ActionMoveJumpStacked::runActionsInSprite(Sprite *sprite) Sequence::create( MoveBy::create(0.05f, Vec2(10,2)), MoveBy::create(0.05f, Vec2(-10,-2)), - NULL))); + nullptr))); auto jump = JumpBy::create(2.0f, Vec2(400,0), 100, 5); auto jump_back = jump->reverse(); sprite->runAction( RepeatForever::create( - Sequence::create(jump, jump_back, NULL) + Sequence::create(jump, jump_back, nullptr) )); } @@ -1562,7 +1562,7 @@ void ActionMoveBezierStacked::runActionsInSprite(Sprite *sprite) auto bezierForward = BezierBy::create(3, bezier); auto bezierBack = bezierForward->reverse(); - auto seq = Sequence::create(bezierForward, bezierBack, NULL); + auto seq = Sequence::create(bezierForward, bezierBack, nullptr); auto rep = RepeatForever::create(seq); sprite->runAction(rep); @@ -1571,7 +1571,7 @@ void ActionMoveBezierStacked::runActionsInSprite(Sprite *sprite) Sequence::create( MoveBy::create(0.05f, Vec2(10,0)), MoveBy::create(0.05f, Vec2(-10,0)), - NULL))); + nullptr))); } std::string ActionMoveBezierStacked::title() const @@ -1612,7 +1612,7 @@ void ActionCatmullRomStacked::onEnter() auto action = CatmullRomBy::create(3, array); auto reverse = action->reverse(); - auto seq = Sequence::create(action, reverse, NULL); + auto seq = Sequence::create(action, reverse, nullptr); _tamara->runAction(seq); @@ -1621,7 +1621,7 @@ void ActionCatmullRomStacked::onEnter() Sequence::create( MoveBy::create(0.05f, Vec2(10,0)), MoveBy::create(0.05f, Vec2(-10,0)), - NULL))); + nullptr))); // // sprite 2 (To) @@ -1641,7 +1641,7 @@ void ActionCatmullRomStacked::onEnter() auto action2 = CatmullRomTo::create(3, array2); auto reverse2 = action2->reverse(); - auto seq2 = Sequence::create(action2, reverse2, NULL); + auto seq2 = Sequence::create(action2, reverse2, nullptr); _kathia->runAction(seq2); @@ -1650,7 +1650,7 @@ void ActionCatmullRomStacked::onEnter() Sequence::create( MoveBy::create(0.05f, Vec2(10,0)), MoveBy::create(0.05f, Vec2(-10,0)), - NULL))); + nullptr))); array->retain(); _array1 = array; @@ -1741,7 +1741,7 @@ void ActionCardinalSplineStacked::onEnter() auto action = CardinalSplineBy::create(3, array, 0); auto reverse = action->reverse(); - auto seq = Sequence::create(action, reverse, NULL); + auto seq = Sequence::create(action, reverse, nullptr); _tamara->setPosition(Vec2(50,50)); _tamara->runAction(seq); @@ -1751,7 +1751,7 @@ void ActionCardinalSplineStacked::onEnter() Sequence::create( MoveBy::create(0.05f, Vec2(10,0)), MoveBy::create(0.05f, Vec2(-10,0)), - NULL))); + nullptr))); // // sprite 2 (By) @@ -1762,7 +1762,7 @@ void ActionCardinalSplineStacked::onEnter() auto *action2 = CardinalSplineBy::create(3, array, 1); auto reverse2 = action2->reverse(); - auto seq2 = Sequence::create(action2, reverse2, NULL); + auto seq2 = Sequence::create(action2, reverse2, nullptr); _kathia->setPosition(Vec2(s.width/2,50)); @@ -1773,7 +1773,7 @@ void ActionCardinalSplineStacked::onEnter() Sequence::create( MoveBy::create(0.05f, Vec2(10,0)), MoveBy::create(0.05f, Vec2(-10,0)), - NULL))); + nullptr))); array->retain(); _array = array; @@ -1925,7 +1925,7 @@ void Issue1305_2::onEnter() auto act7 = MoveBy::create(2, Vec2(-100, 0)); auto act8 = CallFunc::create( std::bind( &Issue1305_2::printLog4, this)); - auto actF = Sequence::create(act1, act2, act3, act4, act5, act6, act7, act8, NULL); + auto actF = Sequence::create(act1, act2, act3, act4, act5, act6, act7, act8, nullptr); // [spr runAction:actF); Director::getInstance()->getActionManager()->addAction(actF ,spr, false); @@ -1973,7 +1973,7 @@ void Issue1288::onEnter() auto act1 = MoveBy::create(0.5, Vec2(100, 0)); auto act2 = act1->reverse(); - auto act3 = Sequence::create(act1, act2, NULL); + auto act3 = Sequence::create(act1, act2, nullptr); auto act4 = Repeat::create(act3, 2); spr->runAction(act4); @@ -2032,7 +2032,7 @@ void Issue1327::onEnter() auto act8 = RotateBy::create(0.25, 45); auto act9 = CallFunc::create( std::bind(&Issue1327::logSprRotation, this, spr)); - auto actF = Sequence::create(act1, act2, act3, act4, act5, act6, act7, act8, act9, NULL); + auto actF = Sequence::create(act1, act2, act3, act4, act5, act6, act7, act8, act9, nullptr); spr->runAction(actF); } @@ -2076,7 +2076,7 @@ void Issue1398::onEnter() CallFunc::create( std::bind(&Issue1398::incrementIntegerCallback, this, (void*)"6")), CallFunc::create( std::bind(&Issue1398::incrementIntegerCallback, this, (void*)"7")), CallFunc::create( std::bind(&Issue1398::incrementIntegerCallback, this, (void*)"8")), - NULL)); + nullptr)); } void Issue1398::incrementIntegerCallback(void* data) @@ -2159,7 +2159,7 @@ void ActionCatmullRom::onEnter() auto action = CatmullRomBy::create(3, array); auto reverse = action->reverse(); - auto seq = Sequence::create(action, reverse, NULL); + auto seq = Sequence::create(action, reverse, nullptr); _tamara->runAction(seq); @@ -2182,7 +2182,7 @@ void ActionCatmullRom::onEnter() auto action2 = CatmullRomTo::create(3, array2); auto reverse2 = action2->reverse(); - auto seq2 = Sequence::create(action2, reverse2, NULL); + auto seq2 = Sequence::create(action2, reverse2, nullptr); _kathia->runAction(seq2); @@ -2275,7 +2275,7 @@ void ActionCardinalSpline::onEnter() auto action = CardinalSplineBy::create(3, array, 0); auto reverse = action->reverse(); - auto seq = Sequence::create(action, reverse, NULL); + auto seq = Sequence::create(action, reverse, nullptr); _tamara->setPosition(Vec2(50, 50)); _tamara->runAction(seq); @@ -2289,7 +2289,7 @@ void ActionCardinalSpline::onEnter() auto action2 = CardinalSplineBy::create(3, array, 1); auto reverse2 = action2->reverse(); - auto seq2 = Sequence::create(action2, reverse2, NULL); + auto seq2 = Sequence::create(action2, reverse2, nullptr); _kathia->setPosition(Vec2(s.width/2, 50)); _kathia->runAction(seq2); @@ -2428,7 +2428,7 @@ void ActionRemoveSelf::onEnter() RotateBy::create( 2, 540), ScaleTo::create(1,0.1f), RemoveSelf::create(), - NULL); + nullptr); _grossini->runAction(action); } diff --git a/tests/cpp-tests/Classes/BaseTest.cpp b/tests/cpp-tests/Classes/BaseTest.cpp index 75c4bc275a..cf288559cb 100644 --- a/tests/cpp-tests/Classes/BaseTest.cpp +++ b/tests/cpp-tests/Classes/BaseTest.cpp @@ -58,7 +58,7 @@ void BaseTest::onEnter() auto item2 = MenuItemImage::create(s_pathR1, s_pathR2, CC_CALLBACK_1(BaseTest::restartCallback, this) ); auto item3 = MenuItemImage::create(s_pathF1, s_pathF2, CC_CALLBACK_1(BaseTest::nextCallback, this) ); - auto menu = Menu::create(item1, item2, item3, NULL); + auto menu = Menu::create(item1, item2, item3, nullptr); menu->setPosition(Vec2::ZERO); item1->setPosition(Vec2(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); diff --git a/tests/cpp-tests/Classes/Box2DTest/Box2dTest.cpp b/tests/cpp-tests/Classes/Box2DTest/Box2dTest.cpp index 5cac77d929..55acd668e8 100644 --- a/tests/cpp-tests/Classes/Box2DTest/Box2dTest.cpp +++ b/tests/cpp-tests/Classes/Box2DTest/Box2dTest.cpp @@ -130,7 +130,7 @@ void Box2DTestLayer::createResetButton() s->release(); }); - auto menu = Menu::create(reset, NULL); + auto menu = Menu::create(reset, nullptr); menu->setPosition(Vec2(VisibleRect::bottom().x, VisibleRect::bottom().y + 30)); this->addChild(menu, -1); diff --git a/tests/cpp-tests/Classes/Box2DTestBed/Box2dView.cpp b/tests/cpp-tests/Classes/Box2DTestBed/Box2dView.cpp index dfadb55929..1c815f3341 100644 --- a/tests/cpp-tests/Classes/Box2DTestBed/Box2dView.cpp +++ b/tests/cpp-tests/Classes/Box2DTestBed/Box2dView.cpp @@ -67,7 +67,7 @@ bool MenuLayer::initWithEntryID(int entryId) auto item2 = MenuItemImage::create("Images/r1.png","Images/r2.png", CC_CALLBACK_1( MenuLayer::restartCallback, this) ); auto item3 = MenuItemImage::create("Images/f1.png", "Images/f2.png", CC_CALLBACK_1(MenuLayer::nextCallback, this) ); - auto menu = Menu::create(item1, item2, item3, NULL); + auto menu = Menu::create(item1, item2, item3, nullptr); menu->setPosition( Vec2::ZERO ); item1->setPosition(Vec2(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); diff --git a/tests/cpp-tests/Classes/Box2DTestBed/Test.cpp b/tests/cpp-tests/Classes/Box2DTestBed/Test.cpp index be95c13f45..556ab4f9a3 100644 --- a/tests/cpp-tests/Classes/Box2DTestBed/Test.cpp +++ b/tests/cpp-tests/Classes/Box2DTestBed/Test.cpp @@ -25,7 +25,7 @@ void DestructionListener::SayGoodbye(b2Joint* joint) { if (test->m_mouseJoint == joint) { - test->m_mouseJoint = NULL; + test->m_mouseJoint = nullptr; } else { @@ -38,9 +38,9 @@ Test::Test() b2Vec2 gravity; gravity.Set(0.0f, -10.0f); m_world = new b2World(gravity); - m_bomb = NULL; + m_bomb = nullptr; m_textLine = 30; - m_mouseJoint = NULL; + m_mouseJoint = nullptr; m_pointCount = 0; m_destructionListener.test = this; @@ -63,7 +63,7 @@ Test::~Test() { // By deleting the world, we delete the bomb, mouse joint, etc. delete m_world; - m_world = NULL; + m_world = nullptr; } void Test::PreSolve(b2Contact* contact, const b2Manifold* oldManifold) @@ -111,7 +111,7 @@ public: QueryCallback(const b2Vec2& point) { m_point = point; - m_fixture = NULL; + m_fixture = nullptr; } bool ReportFixture(b2Fixture* fixture) @@ -141,7 +141,7 @@ bool Test::MouseDown(const b2Vec2& p) { m_mouseWorld = p; - if (m_mouseJoint != NULL) + if (m_mouseJoint != nullptr) { return false; } @@ -197,7 +197,7 @@ void Test::ShiftMouseDown(const b2Vec2& p) { m_mouseWorld = p; - if (m_mouseJoint != NULL) + if (m_mouseJoint != nullptr) { return; } @@ -210,7 +210,7 @@ void Test::MouseUp(const b2Vec2& p) if (m_mouseJoint) { m_world->DestroyJoint(m_mouseJoint); - m_mouseJoint = NULL; + m_mouseJoint = nullptr; } if (m_bombSpawning) @@ -241,7 +241,7 @@ void Test::LaunchBomb(const b2Vec2& position, const b2Vec2& velocity) if (m_bomb) { m_world->DestroyBody(m_bomb); - m_bomb = NULL; + m_bomb = nullptr; } b2BodyDef bd; diff --git a/tests/cpp-tests/Classes/BugsTest/Bug-1159.cpp b/tests/cpp-tests/Classes/BugsTest/Bug-1159.cpp index 2a6ef994e9..87e1d9f3ef 100644 --- a/tests/cpp-tests/Classes/BugsTest/Bug-1159.cpp +++ b/tests/cpp-tests/Classes/BugsTest/Bug-1159.cpp @@ -37,7 +37,7 @@ bool Bug1159Layer::init() sprite_a->runAction(RepeatForever::create(Sequence::create( MoveTo::create(1.0f, Vec2(1024.0f, 384.0f)), MoveTo::create(1.0f, Vec2(0.0f, 384.0f)), - NULL))); + nullptr))); auto sprite_b = LayerColor::create(Color4B(0, 0, 255, 255), 400, 400); sprite_b->setAnchorPoint(Vec2(0.5f, 0.5f)); @@ -46,7 +46,7 @@ bool Bug1159Layer::init() addChild(sprite_b); auto label = MenuItemLabel::create(Label::createWithSystemFont("Flip Me", "Helvetica", 24), CC_CALLBACK_1(Bug1159Layer::callBack, this) ); - auto menu = Menu::create(label, NULL); + auto menu = Menu::create(label, nullptr); menu->setPosition(Vec2(s.width - 200.0f, 50.0f)); addChild(menu); diff --git a/tests/cpp-tests/Classes/BugsTest/Bug-422.cpp b/tests/cpp-tests/Classes/BugsTest/Bug-422.cpp index 70897f806d..1cfa8861ff 100644 --- a/tests/cpp-tests/Classes/BugsTest/Bug-422.cpp +++ b/tests/cpp-tests/Classes/BugsTest/Bug-422.cpp @@ -34,7 +34,7 @@ void Bug422Layer::reset() auto item1 = MenuItemFont::create("One", CC_CALLBACK_1(Bug422Layer::menuCallback, this) ); log("MenuItemFont: %p", item1); MenuItem *item2 = MenuItemFont::create("Two", CC_CALLBACK_1(Bug422Layer::menuCallback, this) ); - auto menu = Menu::create(item1, item2, NULL); + auto menu = Menu::create(item1, item2, nullptr); menu->alignItemsVertically(); float x = CCRANDOM_0_1() * 50; diff --git a/tests/cpp-tests/Classes/BugsTest/Bug-458/Bug-458.cpp b/tests/cpp-tests/Classes/BugsTest/Bug-458/Bug-458.cpp index 46d61358cc..b8fa720c69 100644 --- a/tests/cpp-tests/Classes/BugsTest/Bug-458/Bug-458.cpp +++ b/tests/cpp-tests/Classes/BugsTest/Bug-458/Bug-458.cpp @@ -28,7 +28,7 @@ bool Bug458Layer::init() auto layer2 = LayerColor::create(Color4B(255,0,0,255), 100, 100); auto sprite2 = MenuItemSprite::create(layer, layer2, CC_CALLBACK_1(Bug458Layer::selectAnswer, this) ); - auto menu = Menu::create(sprite, sprite2, NULL); + auto menu = Menu::create(sprite, sprite2, nullptr); menu->alignItemsVerticallyWithPadding(100); menu->setPosition(Vec2(size.width / 2, size.height / 2)); diff --git a/tests/cpp-tests/Classes/BugsTest/Bug-914.cpp b/tests/cpp-tests/Classes/BugsTest/Bug-914.cpp index 75c601d90f..5084bc63a1 100644 --- a/tests/cpp-tests/Classes/BugsTest/Bug-914.cpp +++ b/tests/cpp-tests/Classes/BugsTest/Bug-914.cpp @@ -52,7 +52,7 @@ bool Bug914Layer::init() auto label = Label::createWithTTF("Hello World", "fonts/Marker Felt.ttf", 64.0f); auto item1 = MenuItemFont::create("restart", CC_CALLBACK_1(Bug914Layer::restart, this)); - auto menu = Menu::create(item1, NULL); + auto menu = Menu::create(item1, nullptr); menu->alignItemsVertically(); menu->setPosition(Vec2(size.width/2, 100)); addChild(menu); diff --git a/tests/cpp-tests/Classes/BugsTest/BugsTest.cpp b/tests/cpp-tests/Classes/BugsTest/BugsTest.cpp index 63ed76bcc5..aee50d9cee 100644 --- a/tests/cpp-tests/Classes/BugsTest/BugsTest.cpp +++ b/tests/cpp-tests/Classes/BugsTest/BugsTest.cpp @@ -120,7 +120,7 @@ void BugsTestBaseLayer::onEnter() MenuItemFont::setFontSize(24); auto pMainItem = MenuItemFont::create("Back", CC_CALLBACK_1(BugsTestBaseLayer::backCallback, this)); pMainItem->setPosition(Vec2(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25)); - auto menu = Menu::create(pMainItem, NULL); + auto menu = Menu::create(pMainItem, nullptr); menu->setPosition( Vec2::ZERO ); addChild(menu); } diff --git a/tests/cpp-tests/Classes/ChipmunkTest/ChipmunkTest.cpp b/tests/cpp-tests/Classes/ChipmunkTest/ChipmunkTest.cpp index 6db9ab2492..c6b1672922 100644 --- a/tests/cpp-tests/Classes/ChipmunkTest/ChipmunkTest.cpp +++ b/tests/cpp-tests/Classes/ChipmunkTest/ChipmunkTest.cpp @@ -58,7 +58,7 @@ ChipmunkTestLayer::ChipmunkTestLayer() MenuItemFont::setFontSize(18); auto item = MenuItemFont::create("Toggle debug", CC_CALLBACK_1(ChipmunkTestLayer::toggleDebugCallback, this)); - auto menu = Menu::create(item, NULL); + auto menu = Menu::create(item, nullptr); this->addChild(menu); menu->setPosition(cocos2d::Vec2(VisibleRect::right().x-100, VisibleRect::top().y-60)); @@ -158,7 +158,7 @@ void ChipmunkTestLayer::createResetButton() { auto reset = MenuItemImage::create("Images/r1.png", "Images/r2.png", CC_CALLBACK_1(ChipmunkTestLayer::reset, this)); - auto menu = Menu::create(reset, NULL); + auto menu = Menu::create(reset, nullptr); menu->setPosition(cocos2d::Vec2(VisibleRect::center().x, VisibleRect::bottom().y + 30)); this->addChild(menu, -1); diff --git a/tests/cpp-tests/Classes/ClickAndMoveTest/ClickAndMoveTest.cpp b/tests/cpp-tests/Classes/ClickAndMoveTest/ClickAndMoveTest.cpp index aadceb2063..25fc7850d6 100644 --- a/tests/cpp-tests/Classes/ClickAndMoveTest/ClickAndMoveTest.cpp +++ b/tests/cpp-tests/Classes/ClickAndMoveTest/ClickAndMoveTest.cpp @@ -36,7 +36,7 @@ MainLayer::MainLayer() Sequence::create( FadeIn::create(1), FadeOut::create(1), - NULL) + nullptr) )); } diff --git a/tests/cpp-tests/Classes/ClippingNodeTest/ClippingNodeTest.cpp b/tests/cpp-tests/Classes/ClippingNodeTest/ClippingNodeTest.cpp index 9e5aae0d4b..5f40e0dbc7 100644 --- a/tests/cpp-tests/Classes/ClippingNodeTest/ClippingNodeTest.cpp +++ b/tests/cpp-tests/Classes/ClippingNodeTest/ClippingNodeTest.cpp @@ -170,7 +170,7 @@ Action* BasicTest::actionRotate() Action* BasicTest::actionScale() { auto scale = ScaleBy::create(1.33f, 1.5f); - return RepeatForever::create(Sequence::create(scale, scale->reverse(), NULL)); + return RepeatForever::create(Sequence::create(scale, scale->reverse(), nullptr)); } DrawNode* BasicTest::shape() @@ -195,7 +195,7 @@ Sprite* BasicTest::grossini() Node* BasicTest::stencil() { - return NULL; + return nullptr; } ClippingNode* BasicTest::clipper() @@ -205,7 +205,7 @@ ClippingNode* BasicTest::clipper() Node* BasicTest::content() { - return NULL; + return nullptr; } diff --git a/tests/cpp-tests/Classes/CocosDenshionTest/CocosDenshionTest.cpp b/tests/cpp-tests/Classes/CocosDenshionTest/CocosDenshionTest.cpp index 7e81abb0db..249517baed 100644 --- a/tests/cpp-tests/Classes/CocosDenshionTest/CocosDenshionTest.cpp +++ b/tests/cpp-tests/Classes/CocosDenshionTest/CocosDenshionTest.cpp @@ -36,7 +36,7 @@ public: auto b = new Button(); if (b && !b->initSpriteButton(filePath)) { delete b; - b = NULL; + b = nullptr; } b->autorelease(); return b; @@ -47,7 +47,7 @@ public: auto b = new Button(); if (b && !b->initTextButton(text)) { delete b; - b = NULL; + b = nullptr; } b->autorelease(); return b; @@ -150,7 +150,7 @@ public: auto ret = new AudioSlider(direction); if (ret && !ret->init()) { delete ret; - ret = NULL; + ret = nullptr; } ret->autorelease(); return ret; diff --git a/tests/cpp-tests/Classes/ConsoleTest/ConsoleTest.cpp b/tests/cpp-tests/Classes/ConsoleTest/ConsoleTest.cpp index 579ac9f61f..24dad2067e 100644 --- a/tests/cpp-tests/Classes/ConsoleTest/ConsoleTest.cpp +++ b/tests/cpp-tests/Classes/ConsoleTest/ConsoleTest.cpp @@ -258,7 +258,7 @@ void ConsoleUploadFile::uploadFile() If socket(2) (or connect(2)) fails, we (close the socket and) try the next address. */ - for (rp = result; rp != NULL; rp = rp->ai_next) { + for (rp = result; rp != nullptr; rp = rp->ai_next) { sfd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol); if (sfd == -1) @@ -274,7 +274,7 @@ void ConsoleUploadFile::uploadFile() #endif } - if (rp == NULL) { /* No address succeeded */ + if (rp == nullptr) { /* No address succeeded */ CCLOG("ConsoleUploadFile: could not connect!"); return; } diff --git a/tests/cpp-tests/Classes/EffectsAdvancedTest/EffectsAdvancedTest.cpp b/tests/cpp-tests/Classes/EffectsAdvancedTest/EffectsAdvancedTest.cpp index f6b936ac1a..23ef32b8f2 100644 --- a/tests/cpp-tests/Classes/EffectsAdvancedTest/EffectsAdvancedTest.cpp +++ b/tests/cpp-tests/Classes/EffectsAdvancedTest/EffectsAdvancedTest.cpp @@ -37,8 +37,8 @@ void Effect1::onEnter() // auto orbit = OrbitCamera::create(5, 1, 2, 0, 180, 0, -90); // auto orbit_back = orbit->reverse(); - //_bgNode->runAction( RepeatForever::create( Sequence::create( orbit, orbit_back, NULL) ) ); - _bgNode->runAction( Sequence::create(lens, delay, reuse, waves, NULL) ); + //_bgNode->runAction( RepeatForever::create( Sequence::create( orbit, orbit_back, nullptr) ) ); + _bgNode->runAction( Sequence::create(lens, delay, reuse, waves, nullptr) ); } std::string Effect1::title() const @@ -79,7 +79,7 @@ void Effect2::onEnter() // id orbit_back = [orbit reverse]; // // [target runAction: [RepeatForever::create: [Sequence actions: orbit, orbit_back, nil]]]; - _bgNode->runAction(Sequence::create( shaky, delay, reuse, shuffle, delay->clone(), turnoff, turnon, NULL) ); + _bgNode->runAction(Sequence::create( shaky, delay, reuse, shuffle, delay->clone(), turnoff, turnon, nullptr) ); } std::string Effect2::title() const @@ -107,7 +107,7 @@ void Effect3::onEnter() // moving background. Testing issue #244 auto move = MoveBy::create(3, Vec2(200,0) ); - _bgNode->runAction(RepeatForever::create( Sequence::create(move, move->reverse(), NULL) )); + _bgNode->runAction(RepeatForever::create( Sequence::create(move, move->reverse(), nullptr) )); } std::string Effect3::title() const @@ -159,7 +159,7 @@ void Effect4::onEnter() auto lens = Lens3D::create(10, Size(32,24), Vec2(100,180), 150); auto move = JumpBy::create(5, Vec2(380,0), 100, 4); auto move_back = move->reverse(); - auto seq = Sequence::create( move, move_back, NULL); + auto seq = Sequence::create( move, move_back, nullptr); /* In cocos2d-iphone, the type of action's target is 'id', so it supports using the instance of 'Lens3D' as its target. While in cocos2d-x, the target of action only supports Node or its subclass, @@ -201,7 +201,7 @@ void Effect5::onEnter() StopGrid::create(), // [DelayTime::create:2], // [[effect copy] autorelease], - NULL); + nullptr); //auto bg = getChildByTag(kTagBackground); _bgNode->runAction(stopEffect); @@ -228,7 +228,7 @@ void Issue631::onEnter() { EffectAdvanceTextLayer::onEnter(); - auto effect = Sequence::create( DelayTime::create(2.0f), Shaky3D::create(5.0f, Size(5, 5), 16, false), NULL); + auto effect = Sequence::create( DelayTime::create(2.0f), Shaky3D::create(5.0f, Size(5, 5), 16, false), nullptr); // cleanup //auto bg = getChildByTag(kTagBackground); @@ -298,7 +298,7 @@ Layer* createEffectAdvanceLayer(int nIndex) case 5: return new Issue631(); } - return NULL; + return nullptr; } Layer* nextEffectAdvanceAction() @@ -356,7 +356,7 @@ void EffectAdvanceTextLayer::onEnter(void) _target1->setPosition( Vec2(VisibleRect::left().x+VisibleRect::getVisibleRect().size.width/3.0f, VisibleRect::bottom().y+ 200) ); auto sc = ScaleBy::create(2, 5); auto sc_back = sc->reverse(); - _target1->runAction( RepeatForever::create(Sequence::create(sc, sc_back, NULL) ) ); + _target1->runAction( RepeatForever::create(Sequence::create(sc, sc_back, nullptr) ) ); _target2 = NodeGrid::create(); @@ -367,7 +367,7 @@ void EffectAdvanceTextLayer::onEnter(void) _target2->setPosition( Vec2(VisibleRect::left().x+2*VisibleRect::getVisibleRect().size.width/3.0f,VisibleRect::bottom().y+200) ); auto sc2 = ScaleBy::create(2, 5); auto sc2_back = sc2->reverse(); - _target2->runAction( RepeatForever::create(Sequence::create(sc2, sc2_back, NULL) ) ); + _target2->runAction( RepeatForever::create(Sequence::create(sc2, sc2_back, nullptr) ) ); } diff --git a/tests/cpp-tests/Classes/EffectsTest/EffectsTest.cpp b/tests/cpp-tests/Classes/EffectsTest/EffectsTest.cpp index 4ef67521fe..724fb9846e 100644 --- a/tests/cpp-tests/Classes/EffectsTest/EffectsTest.cpp +++ b/tests/cpp-tests/Classes/EffectsTest/EffectsTest.cpp @@ -63,7 +63,7 @@ public: auto flipx_back = flipx->reverse(); auto delay = DelayTime::create(2); - return Sequence::create(flipx, delay, flipx_back, NULL); + return Sequence::create(flipx, delay, flipx_back, nullptr); } }; @@ -76,7 +76,7 @@ public: auto flipy_back = flipy->reverse(); auto delay = DelayTime::create(2); - return Sequence::create(flipy, delay, flipy_back, NULL); + return Sequence::create(flipy, delay, flipy_back, nullptr); } }; @@ -162,7 +162,7 @@ public: auto shuffle_back = shuffle->reverse(); auto delay = DelayTime::create(2); - return Sequence::create(shuffle, delay, shuffle_back, NULL); + return Sequence::create(shuffle, delay, shuffle_back, nullptr); } }; @@ -176,7 +176,7 @@ public: auto back = fadeout->reverse(); auto delay = DelayTime::create(0.5f); - return Sequence::create(fadeout, delay, back, NULL); + return Sequence::create(fadeout, delay, back, nullptr); } }; @@ -190,7 +190,7 @@ public: auto back = fadeout->reverse(); auto delay = DelayTime::create(0.5f); - return Sequence::create(fadeout, delay, back, NULL); + return Sequence::create(fadeout, delay, back, nullptr); } }; @@ -204,7 +204,7 @@ public: auto back = fadeout->reverse(); auto delay = DelayTime::create(0.5f); - return Sequence::create(fadeout, delay, back, NULL); + return Sequence::create(fadeout, delay, back, nullptr); } }; @@ -217,7 +217,7 @@ public: auto back = fadeout->reverse(); auto delay = DelayTime::create(0.5f); - return Sequence::create(fadeout, delay, back, NULL); + return Sequence::create(fadeout, delay, back, nullptr); } }; @@ -230,7 +230,7 @@ public: auto back = fadeout->reverse(); auto delay = DelayTime::create(0.5f); - return Sequence::create(fadeout, delay, back, NULL); + return Sequence::create(fadeout, delay, back, nullptr); } }; @@ -318,7 +318,7 @@ ActionInterval* createEffect(int nIndex, float t) case 21: return PageTurn3DDemo::create(t); } - return NULL; + return nullptr; } ActionInterval* getAction() @@ -357,14 +357,14 @@ TextLayer::TextLayer(void) grossini->setPosition( Vec2(VisibleRect::left().x+VisibleRect::getVisibleRect().size.width/3,VisibleRect::center().y) ); auto sc = ScaleBy::create(2, 5); auto sc_back = sc->reverse(); - grossini->runAction( RepeatForever::create(Sequence::create(sc, sc_back, NULL) ) ); + grossini->runAction( RepeatForever::create(Sequence::create(sc, sc_back, nullptr) ) ); auto tamara = Sprite::create(s_pathSister1); _gridNodeTarget->addChild(tamara, 1); tamara->setPosition( Vec2(VisibleRect::left().x+2*VisibleRect::getVisibleRect().size.width/3,VisibleRect::center().y) ); auto sc2 = ScaleBy::create(2, 5); auto sc2_back = sc2->reverse(); - tamara->runAction( RepeatForever::create(Sequence::create(sc2, sc2_back, NULL)) ); + tamara->runAction( RepeatForever::create(Sequence::create(sc2, sc2_back, nullptr)) ); auto label = Label::createWithTTF((effectsList[actionIdx]).c_str(), "fonts/Marker Felt.ttf", 32); @@ -378,7 +378,7 @@ TextLayer::TextLayer(void) void TextLayer::checkAnim(float dt) { //auto s2 = getChildByTag(kTagBackground); - if ( _gridNodeTarget->getNumberOfRunningActions() == 0 && _gridNodeTarget->getGrid() != NULL) + if ( _gridNodeTarget->getNumberOfRunningActions() == 0 && _gridNodeTarget->getGrid() != nullptr) _gridNodeTarget->setGrid(nullptr);; } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp index 161ddb3d61..b2cff48fa8 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp @@ -1387,7 +1387,7 @@ void TestPlaySeveralMovement::onEnter() // int index[] = {0, 1, 2}; // std::vector indexes(index, index+3); - Armature *armature = NULL; + Armature *armature = nullptr; armature = Armature::create("Cowboy"); armature->getAnimation()->playWithNames(names); // armature->getAnimation()->playWithIndexes(indexes); @@ -1458,7 +1458,7 @@ void TestChangeAnimationInternal::onEnter() listener->onTouchesEnded = CC_CALLBACK_2(TestPlaySeveralMovement::onTouchesEnded, this); _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); - Armature *armature = NULL; + Armature *armature = nullptr; armature = Armature::create("Cowboy"); armature->getAnimation()->playWithIndex(0); armature->setScale(0.2f); @@ -1558,7 +1558,7 @@ void TestLoadFromBinary::onTouchesEnded(const std::vector& touches, Even m_armatureIndex = -2; // is loading } - else if(m_armatureIndex>=0 && m_armature != NULL) + else if(m_armatureIndex>=0 && m_armature != nullptr) { this->removeChild(m_armature); m_armatureIndex = m_armatureIndex==BINARYFILECOUNT-1 ? 0 : m_armatureIndex+1; diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/ProjectileController.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/ProjectileController.cpp index 8953849118..4c5589b3d0 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/ProjectileController.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/ProjectileController.cpp @@ -133,7 +133,7 @@ void ProjectileController::move(float flocationX, float flocationY) Sequence::create( MoveTo::create(realMoveDuration, realDest), callfunc, - NULL) + nullptr) ); } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/SceneEditorTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/SceneEditorTest.cpp index e560953416..453b2189f9 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/SceneEditorTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/SceneEditorTest.cpp @@ -131,7 +131,7 @@ void SceneEditorTestLayer::onEnter() _loadtypelb = cocos2d::Label::createWithSystemFont(_loadtypeStr[0], "Arial", 12); // #endif MenuItemLabel* itemlb = CCMenuItemLabel::create(_loadtypelb, CC_CALLBACK_1(SceneEditorTestLayer::changeLoadTypeCallback, this)); - Menu* loadtypemenu = CCMenu::create(itemlb, NULL); + Menu* loadtypemenu = CCMenu::create(itemlb, nullptr); loadtypemenu->setPosition(Point(VisibleRect::rightTop().x -50,VisibleRect::rightTop().y -20)); addChild(loadtypemenu,100); @@ -212,11 +212,11 @@ void SceneEditorTestLayer::changeLoadTypeCallback(cocos2d::Ref *pSender) _loadtypelb->setString(_loadtypeStr[(int)_isCsbLoad]); loadFileChangeHelper(_filePath); - if(_rootNode != NULL) + if(_rootNode != nullptr) { this->removeChild(_rootNode); _rootNode = SceneReader::getInstance()->createNodeWithSceneFile(_filePath.c_str()); - if (_rootNode == NULL) + if (_rootNode == nullptr) { return ; } @@ -277,9 +277,9 @@ cocos2d::Node* LoadSceneEdtiorFileTest::createGameScene() { _filePath = "scenetest/LoadSceneEdtiorFileTest/FishJoy2.json"; //default is json _rootNode = SceneReader::getInstance()->createNodeWithSceneFile(_filePath.c_str()); - if (_rootNode == NULL) + if (_rootNode == nullptr) { - return NULL; + return nullptr; } defaultPlay(); return _rootNode; @@ -329,9 +329,9 @@ cocos2d::Node* SpriteComponentTest::createGameScene() { _filePath = "scenetest/SpriteComponentTest/SpriteComponentTest.json"; _rootNode = SceneReader::getInstance()->createNodeWithSceneFile(_filePath.c_str()); - if (_rootNode == NULL) + if (_rootNode == nullptr) { - return NULL; + return nullptr; } defaultPlay(); @@ -391,9 +391,9 @@ cocos2d::Node* ArmatureComponentTest::createGameScene() { _filePath = "scenetest/ArmatureComponentTest/ArmatureComponentTest.json"; _rootNode = SceneReader::getInstance()->createNodeWithSceneFile(_filePath.c_str()); - if (_rootNode == NULL) + if (_rootNode == nullptr) { - return NULL; + return nullptr; } defaultPlay(); return _rootNode; @@ -447,9 +447,9 @@ cocos2d::Node* UIComponentTest::createGameScene() { _filePath = "scenetest/UIComponentTest/UIComponentTest.json"; _rootNode = SceneReader::getInstance()->createNodeWithSceneFile(_filePath.c_str()); - if (_rootNode == NULL) + if (_rootNode == nullptr) { - return NULL; + return nullptr; } defaultPlay(); @@ -522,9 +522,9 @@ cocos2d::Node* TmxMapComponentTest::createGameScene() { _filePath = "scenetest/TmxMapComponentTest/TmxMapComponentTest.json"; _rootNode = SceneReader::getInstance()->createNodeWithSceneFile(_filePath.c_str()); - if (_rootNode == NULL) + if (_rootNode == nullptr) { - return NULL; + return nullptr; } defaultPlay(); return _rootNode; @@ -541,9 +541,9 @@ void TmxMapComponentTest::defaultPlay() ActionInterval *rotateToBack = CCRotateTo::create(2, 0); ActionInterval *actionToBack = CCSkewTo::create(2, 0, 0); - tmxMap->getNode()->runAction(CCSequence::create(actionTo, actionToBack, NULL)); - tmxMap->getNode()->runAction(CCSequence::create(rotateTo, rotateToBack, NULL)); - tmxMap->getNode()->runAction(CCSequence::create(actionScaleTo, actionScaleToBack, NULL)); + tmxMap->getNode()->runAction(CCSequence::create(actionTo, actionToBack, nullptr)); + tmxMap->getNode()->runAction(CCSequence::create(rotateTo, rotateToBack, nullptr)); + tmxMap->getNode()->runAction(CCSequence::create(actionScaleTo, actionScaleToBack, nullptr)); } ParticleComponentTest::ParticleComponentTest() @@ -584,9 +584,9 @@ cocos2d::Node* ParticleComponentTest::createGameScene() { _filePath = "scenetest/ParticleComponentTest/ParticleComponentTest.json"; _rootNode = SceneReader::getInstance()->createNodeWithSceneFile(_filePath.c_str()); - if (_rootNode == NULL) + if (_rootNode == nullptr) { - return NULL; + return nullptr; } defaultPlay(); return _rootNode; @@ -596,7 +596,7 @@ void ParticleComponentTest::defaultPlay() { ComRender* Particle = static_cast(_rootNode->getChildByTag(10020)->getComponent("CCParticleSystemQuad")); ActionInterval* jump = CCJumpBy::create(5, Point(-500,0), 50, 4); - FiniteTimeAction* action = CCSequence::create( jump, jump->reverse(), NULL); + FiniteTimeAction* action = CCSequence::create( jump, jump->reverse(), nullptr); Particle->getNode()->runAction(action); } @@ -639,9 +639,9 @@ cocos2d::Node* EffectComponentTest::createGameScene() { _filePath = "scenetest/EffectComponentTest/EffectComponentTest.json"; _rootNode = SceneReader::getInstance()->createNodeWithSceneFile(_filePath.c_str()); - if (_rootNode == NULL) + if (_rootNode == nullptr) { - return NULL; + return nullptr; } defaultPlay(); return _rootNode; @@ -706,9 +706,9 @@ cocos2d::Node* BackgroundComponentTest::createGameScene() { _filePath = "scenetest/BackgroundComponentTest/BackgroundComponentTest.json"; _rootNode = SceneReader::getInstance()->createNodeWithSceneFile(_filePath.c_str()); - if (_rootNode == NULL) + if (_rootNode == nullptr) { - return NULL; + return nullptr; } defaultPlay(); return _rootNode; @@ -775,9 +775,9 @@ cocos2d::Node* AttributeComponentTest::createGameScene() { _filePath = "scenetest/AttributeComponentTest/AttributeComponentTest.json"; _rootNode = SceneReader::getInstance()->createNodeWithSceneFile(_filePath.c_str()); - if (_rootNode == NULL) + if (_rootNode == nullptr) { - return NULL; + return nullptr; } return _rootNode; } @@ -869,9 +869,9 @@ cocos2d::Node* TriggerTest::createGameScene() { _filePath = "scenetest/TriggerTest/TriggerTest.json"; _rootNode = SceneReader::getInstance()->createNodeWithSceneFile(_filePath.c_str()); - if (_rootNode == NULL) + if (_rootNode == nullptr) { - return NULL; + return nullptr; } defaultPlay(); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/TriggerCode/acts.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/TriggerCode/acts.cpp index f9c9f39337..d48f64e1e7 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/TriggerCode/acts.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/TriggerCode/acts.cpp @@ -71,7 +71,7 @@ void PlayMusic::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExp int count = 0; stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader); std::string key; - const char *str = NULL; + const char *str = nullptr; for (int i = 0; i < length; ++i) { count = pDataItemsArray[i].GetChildNum(); @@ -80,14 +80,14 @@ void PlayMusic::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExp str = pDataItemArray[1].GetValue(pCocoLoader); if (key == "Tag") { - if (str != NULL) + if (str != nullptr) { _tag = atoi(str);//DICTOOL->getIntValue_json(subDict, "value"); } } else if (key == "componentName") { - if (str != NULL) + if (str != nullptr) { _comName = str; //DICTOOL->getStringValue_json(subDict, "value"); } @@ -95,7 +95,7 @@ void PlayMusic::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExp } else if (key == "type") { - if (str != NULL) + if (str != nullptr) { _type = atoi(str); //DICTOOL->getIntValue_json(subDict, "value"); } @@ -171,7 +171,7 @@ void TMoveTo::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCo int count = 0; stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader); std::string key; - const char *str = NULL; + const char *str = nullptr; for (int i = 0; i < length; ++i) { count = pDataItemsArray[i].GetChildNum(); @@ -180,14 +180,14 @@ void TMoveTo::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCo str = pDataItemArray[1].GetValue(pCocoLoader); if (key == "Tag") { - if (str != NULL) + if (str != nullptr) { _tag = atoi(str); } } else if (key == "Duration") { - if (str != NULL) + if (str != nullptr) { _duration = atof(str); } @@ -195,14 +195,14 @@ void TMoveTo::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCo } else if (key == "x") { - if (str != NULL) + if (str != nullptr) { _pos.x = atof(str); } } else if (key == "y") { - if (str != NULL) + if (str != nullptr) { _pos.y = atoi(str); } @@ -293,7 +293,7 @@ void TMoveBy::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCo int count = 0; stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader); std::string key; - const char *str = NULL; + const char *str = nullptr; for (int i = 0; i < length; ++i) { count = pDataItemsArray[i].GetChildNum(); @@ -302,14 +302,14 @@ void TMoveBy::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCo str = pDataItemArray[1].GetValue(pCocoLoader); if (key == "Tag") { - if (str != NULL) + if (str != nullptr) { _tag = atoi(str); } } else if (key == "Duration") { - if (str != NULL) + if (str != nullptr) { _duration = atof(str); } @@ -317,21 +317,21 @@ void TMoveBy::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCo } else if (key == "x") { - if (str != NULL) + if (str != nullptr) { _pos.x = atof(str); } } else if (key == "y") { - if (str != NULL) + if (str != nullptr) { _pos.y = atof(str); } } else if (key == "IsReverse") { - if (str != NULL) + if (str != nullptr) { _reverse = atoi(str)!=0?true:false; //DICTOOL->getIntValue_json(subDict, "value") != 0? true: false; } @@ -406,7 +406,7 @@ void TRotateTo::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExp int count = 0; stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader); std::string key; - const char *str = NULL; + const char *str = nullptr; for (int i = 0; i < length; ++i) { count = pDataItemsArray[i].GetChildNum(); @@ -415,14 +415,14 @@ void TRotateTo::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExp str = pDataItemArray[1].GetValue(pCocoLoader); if (key == "Tag") { - if (str != NULL) + if (str != nullptr) { _tag = atoi(str); } } else if (key == "Duration") { - if (str != NULL) + if (str != nullptr) { _duration = atof(str); } @@ -430,7 +430,7 @@ void TRotateTo::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExp } else if (key == "DeltaAngle") { - if (str != NULL) + if (str != nullptr) { _deltaAngle = atof(str); } @@ -519,7 +519,7 @@ void TRotateBy::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExp int count = 0; stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader); std::string key; - const char *str = NULL; + const char *str = nullptr; for (int i = 0; i < length; ++i) { count = pDataItemsArray[i].GetChildNum(); @@ -528,14 +528,14 @@ void TRotateBy::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExp str = pDataItemArray[1].GetValue(pCocoLoader); if (key == "Tag") { - if (str != NULL) + if (str != nullptr) { _tag = atoi(str); } } else if (key == "Duration") { - if (str != NULL) + if (str != nullptr) { _duration = atof(str); } @@ -543,14 +543,14 @@ void TRotateBy::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExp } else if (key == "DeltaAngle") { - if (str != NULL) + if (str != nullptr) { _deltaAngle = atof(str); } } else if (key == "IsReverse") { - if (str != NULL) + if (str != nullptr) { _reverse = atoi(str)!=0?true:false; } @@ -629,7 +629,7 @@ void TScaleTo::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpC int count = 0; stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader); std::string key; - const char *str = NULL; + const char *str = nullptr; for (int i = 0; i < length; ++i) { count = pDataItemsArray[i].GetChildNum(); @@ -638,14 +638,14 @@ void TScaleTo::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpC str = pDataItemArray[1].GetValue(pCocoLoader); if (key == "Tag") { - if (str != NULL) + if (str != nullptr) { _tag = atoi(str); } } else if (key == "Duration") { - if (str != NULL) + if (str != nullptr) { _duration = atof(str); } @@ -653,14 +653,14 @@ void TScaleTo::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpC } else if (key == "ScaleX") { - if (str != NULL) + if (str != nullptr) { _scale.x = atof(str); } } else if (key == "ScaleY") { - if (str != NULL) + if (str != nullptr) { _scale.y = atof(str); } @@ -753,7 +753,7 @@ void TScaleBy::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpC int count = 0; stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader); std::string key; - const char *str = NULL; + const char *str = nullptr; for (int i = 0; i < length; ++i) { count = pDataItemsArray[i].GetChildNum(); @@ -762,14 +762,14 @@ void TScaleBy::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpC str = pDataItemArray[1].GetValue(pCocoLoader); if (key == "Tag") { - if (str != NULL) + if (str != nullptr) { _tag = atoi(str); } } else if (key == "Duration") { - if (str != NULL) + if (str != nullptr) { _duration = atof(str); } @@ -777,21 +777,21 @@ void TScaleBy::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpC } else if (key == "ScaleX") { - if (str != NULL) + if (str != nullptr) { _scale.x = atof(str); } } else if (key == "ScaleY") { - if (str != NULL) + if (str != nullptr) { _scale.y = atof(str); } } else if (key == "IsReverse") { - if (str != NULL) + if (str != nullptr) { _reverse = atoi(str)!=0?true:false; //DICTOOL->getIntValue_json(subDict, "value")!= 0? true:false; } @@ -871,7 +871,7 @@ void TSkewTo::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCo int count = 0; stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader); std::string key; - const char *str = NULL; + const char *str = nullptr; for (int i = 0; i < length; ++i) { count = pDataItemsArray[i].GetChildNum(); @@ -880,14 +880,14 @@ void TSkewTo::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCo str = pDataItemArray[1].GetValue(pCocoLoader); if (key == "Tag") { - if (str != NULL) + if (str != nullptr) { _tag = atoi(str); } } else if (key == "Duration") { - if (str != NULL) + if (str != nullptr) { _duration = atof(str); } @@ -895,14 +895,14 @@ void TSkewTo::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCo } else if (key == "SkewX") { - if (str != NULL) + if (str != nullptr) { _skew.x = atof(str); } } else if (key == "SkewY") { - if (str != NULL) + if (str != nullptr) { _skew.y = atof(str); } @@ -994,7 +994,7 @@ void TSkewBy::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCo int count = 0; stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader); std::string key; - const char *str = NULL; + const char *str = nullptr; for (int i = 0; i < length; ++i) { count = pDataItemsArray[i].GetChildNum(); @@ -1003,14 +1003,14 @@ void TSkewBy::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCo str = pDataItemArray[1].GetValue(pCocoLoader); if (key == "Tag") { - if (str != NULL) + if (str != nullptr) { _tag = atoi(str); } } else if (key == "Duration") { - if (str != NULL) + if (str != nullptr) { _duration = atof(str); } @@ -1018,14 +1018,14 @@ void TSkewBy::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCo } else if (key == "SkewX") { - if (str != NULL) + if (str != nullptr) { _skew.x = atof(str); } } else if (key == "SkewY") { - if (str != NULL) + if (str != nullptr) { _skew.y = atof(str); } @@ -1108,7 +1108,7 @@ void TriggerState::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::st int count = 0; stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader); std::string key; - const char *str = NULL; + const char *str = nullptr; for (int i = 0; i < length; ++i) { count = pDataItemsArray[i].GetChildNum(); @@ -1117,14 +1117,14 @@ void TriggerState::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::st str = pDataItemArray[1].GetValue(pCocoLoader); if (key == "ID") { - if (str != NULL) + if (str != nullptr) { _id = atoi(str); } } else if (key == "State") { - if (str != NULL) + if (str != nullptr) { _state = atoi(str); } @@ -1197,7 +1197,7 @@ void ArmaturePlayAction::serialize(cocostudio::CocoLoader *pCocoLoader, cocostud int count = 0; stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader); std::string key; - const char *str = NULL; + const char *str = nullptr; for (int i = 0; i < length; ++i) { count = pDataItemsArray[i].GetChildNum(); @@ -1206,14 +1206,14 @@ void ArmaturePlayAction::serialize(cocostudio::CocoLoader *pCocoLoader, cocostud str = pDataItemArray[1].GetValue(pCocoLoader); if (key == "Tag") { - if (str != NULL) + if (str != nullptr) { _tag = atoi(str);//DICTOOL->getIntValue_json(subDict, "value"); } } else if (key == "componentName") { - if (str != NULL) + if (str != nullptr) { _comName = str; //DICTOOL->getStringValue_json(subDict, "value"); } @@ -1221,7 +1221,7 @@ void ArmaturePlayAction::serialize(cocostudio::CocoLoader *pCocoLoader, cocostud } else if (key == "AnimationName") { - if (str != NULL) + if (str != nullptr) { _aniname = str; //DICTOOL->getStringValue_json(subDict, "value"); } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/TriggerCode/cons.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/TriggerCode/cons.cpp index a33b2bd455..9ed21d1579 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/TriggerCode/cons.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/TriggerCode/cons.cpp @@ -53,7 +53,7 @@ void TimeElapsed::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stE int count = 0; stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader); std::string key; - const char *str = NULL; + const char *str = nullptr; for (int i = 0; i < length; ++i) { count = pDataItemsArray[i].GetChildNum(); @@ -62,7 +62,7 @@ void TimeElapsed::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stE str = pDataItemArray[1].GetValue(pCocoLoader); if (key == "TotalTime") { - if (str != NULL) + if (str != nullptr) { _totalTime = atof(str); //DICTOOL->getFloatValue_json(subDict, "value"); } @@ -153,7 +153,7 @@ void ArmatureActionState::serialize(cocostudio::CocoLoader *pCocoLoader, cocostu int count = 0; stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader); std::string key; - const char *str = NULL; + const char *str = nullptr; for (int i = 0; i < length; ++i) { count = pDataItemsArray[i].GetChildNum(); @@ -162,14 +162,14 @@ void ArmatureActionState::serialize(cocostudio::CocoLoader *pCocoLoader, cocostu str = pDataItemArray[1].GetValue(pCocoLoader); if (key == "Tag") { - if (str != NULL) + if (str != nullptr) { _tag = atoi(str);//DICTOOL->getIntValue_json(subDict, "value"); } } else if (key == "componentName") { - if (str != NULL) + if (str != nullptr) { _comName = str; //DICTOOL->getStringValue_json(subDict, "value"); } @@ -177,14 +177,14 @@ void ArmatureActionState::serialize(cocostudio::CocoLoader *pCocoLoader, cocostu } else if (key == "AnimationName") { - if (str != NULL) + if (str != nullptr) { _aniname = str; //DICTOOL->getStringValue_json(subDict, "value"); } } else if (key == "ActionType") { - if (str != NULL) + if (str != nullptr) { _state = atoi(str); //DICTOOL->getIntValue_json(subDict, "value"); } @@ -281,7 +281,7 @@ void NodeInRect::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stEx int count = 0; stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader); std::string key; - const char *str = NULL; + const char *str = nullptr; for (int i = 0; i < length; ++i) { count = pDataItemsArray[i].GetChildNum(); @@ -290,35 +290,35 @@ void NodeInRect::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stEx str = pDataItemArray[1].GetValue(pCocoLoader); if (key == "Tag") { - if (str != NULL) + if (str != nullptr) { _tag = atoi(str);//DICTOOL->getIntValue_json(subDict, "value"); } } else if (key == "originX") { - if (str != NULL) + if (str != nullptr) { _origin.x = atoi(str); //DICTOOL->getIntValue_json(subDict, "value"); } } else if (key == "originY") { - if (str != NULL) + if (str != nullptr) { _origin.y = atoi(str); //DICTOOL->getIntValue_json(subDict, "value"); } } else if (key == "sizeWidth") { - if (str != NULL) + if (str != nullptr) { _size.width = atoi(str); //DICTOOL->getIntValue_json(subDict, "value"); } } else if (key == "sizeHeight") { - if (str != NULL) + if (str != nullptr) { _size.height = atoi(str); //DICTOOL->getIntValue_json(subDict, "value"); } @@ -383,7 +383,7 @@ void NodeVisible::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stE int count = 0; stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader); std::string key; - const char *str = NULL; + const char *str = nullptr; for (int i = 0; i < length; ++i) { count = pDataItemsArray[i].GetChildNum(); @@ -392,14 +392,14 @@ void NodeVisible::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stE str = pDataItemArray[1].GetValue(pCocoLoader); if (key == "Tag") { - if (str != NULL) + if (str != nullptr) { _tag = atoi(str);//DICTOOL->getIntValue_json(subDict, "value"); } } else if (key == "Visible") { - if (str != NULL) + if (str != nullptr) { _visible = atoi(str) != 0? true:false;//DICTOOL->getIntValue_json(subDict, "value") != 0? true:false; } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/AnimationsTest/AnimationsTestLayer.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/AnimationsTest/AnimationsTestLayer.cpp index 5be1a5b633..b073dc712e 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/AnimationsTest/AnimationsTestLayer.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/AnimationsTest/AnimationsTestLayer.cpp @@ -15,7 +15,7 @@ AnimationsTestLayer::~AnimationsTestLayer() SEL_MenuHandler AnimationsTestLayer::onResolveCCBCCMenuItemSelector(Ref * pTarget, const char * pSelectorName) { - return NULL; + return nullptr; } Control::Handler AnimationsTestLayer::onResolveCCBCCControlSelector(Ref *pTarget, const char*pSelectorName) @@ -25,7 +25,7 @@ Control::Handler AnimationsTestLayer::onResolveCCBCCControlSelector(Ref *pTarget CCB_SELECTORRESOLVER_CCCONTROL_GLUE(this, "onCCControlButtonJumpClicked", AnimationsTestLayer::onControlButtonJumpClicked); CCB_SELECTORRESOLVER_CCCONTROL_GLUE(this, "onCCControlButtonFunkyClicked", AnimationsTestLayer::onControlButtonFunkyClicked); - return NULL; + return nullptr; } bool AnimationsTestLayer::onAssignCCBMemberVariable(Ref * pTarget, const char * pMemberVariableName, Node * pNode) { diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/ButtonTest/ButtonTestLayer.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/ButtonTest/ButtonTestLayer.cpp index 13b7d55000..340ac0773f 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/ButtonTest/ButtonTestLayer.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/ButtonTest/ButtonTestLayer.cpp @@ -14,13 +14,13 @@ ButtonTestLayer::~ButtonTestLayer() } SEL_MenuHandler ButtonTestLayer::onResolveCCBCCMenuItemSelector(Ref * pTarget, const char * pSelectorName) { - return NULL; + return nullptr; } Control::Handler ButtonTestLayer::onResolveCCBCCControlSelector(Ref * pTarget, const char * pSelectorName) { CCB_SELECTORRESOLVER_CCCONTROL_GLUE(this, "onCCControlButtonClicked", ButtonTestLayer::onControlButtonClicked); - return NULL; + return nullptr; } bool ButtonTestLayer::onAssignCCBMemberVariable(Ref * pTarget, const char * pMemberVariableName, Node * pNode) { diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/CocosBuilderTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/CocosBuilderTest.cpp index f63af2aca5..c367915891 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/CocosBuilderTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/CocosBuilderTest.cpp @@ -44,7 +44,7 @@ void CocosBuilderTestScene::runThisTest() { ccbReader->release(); - if(node != NULL) { + if(node != nullptr) { this->addChild(node); } @@ -65,7 +65,7 @@ void CocosBuilderTestScene::runThisTest() { // /* Read a ccbi file. */ // auto node = ccbReader->readNodeGraphFromFile("ccb/simple/pub/", "ccb/test.ccbi", ccbiReaderLayer); // -// if(node != NULL) { +// if(node != nullptr) { // ccbiReaderLayer->addChild(node); // } // diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/HelloCocosBuilder/HelloCocosBuilderLayer.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/HelloCocosBuilder/HelloCocosBuilderLayer.cpp index 36a83eb5cc..b8769819da 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/HelloCocosBuilder/HelloCocosBuilderLayer.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/HelloCocosBuilder/HelloCocosBuilderLayer.cpp @@ -30,7 +30,7 @@ void HelloCocosBuilderLayer::openTest(const char * pCCBFileName, const char * no NodeLoaderLibrary * ccNodeLoaderLibrary = NodeLoaderLibrary::newDefaultNodeLoaderLibrary(); ccNodeLoaderLibrary->registerNodeLoader("TestHeaderLayer", TestHeaderLayerLoader::loader()); - if(nodeName != NULL && nodeLoader != NULL) { + if(nodeName != nullptr && nodeLoader != nullptr) { ccNodeLoaderLibrary->registerNodeLoader(nodeName, nodeLoader); } @@ -48,7 +48,7 @@ void HelloCocosBuilderLayer::openTest(const char * pCCBFileName, const char * no this->mTestTitleLabelTTF->setString(pCCBFileName); auto scene = Scene::create(); - if(node != NULL) { + if(node != nullptr) { scene->addChild(node); } @@ -70,7 +70,7 @@ void HelloCocosBuilderLayer::onNodeLoaded(cocos2d::Node * node, cocosbuilder::N SEL_MenuHandler HelloCocosBuilderLayer::onResolveCCBCCMenuItemSelector(Ref * pTarget, const char * pSelectorName) { - return NULL; + return nullptr; } Control::Handler HelloCocosBuilderLayer::onResolveCCBCCControlSelector(Ref * pTarget, const char * pSelectorName) { @@ -82,7 +82,7 @@ Control::Handler HelloCocosBuilderLayer::onResolveCCBCCControlSelector(Ref * pTa CCB_SELECTORRESOLVER_CCCONTROL_GLUE(this, "onScrollViewTestClicked", HelloCocosBuilderLayer::onScrollViewTestClicked); CCB_SELECTORRESOLVER_CCCONTROL_GLUE(this, "onTimelineCallbackSoundClicked", HelloCocosBuilderLayer::onTimelineCallbackSoundClicked); - return NULL; + return nullptr; } bool HelloCocosBuilderLayer::onAssignCCBMemberVariable(Ref * pTarget, const char * pMemberVariableName, Node * pNode) { @@ -164,7 +164,7 @@ void HelloCocosBuilderLayer::onAnimationsTestClicked(Ref * sender, Control::Even this->mTestTitleLabelTTF->setString("TestAnimations.ccbi"); auto scene = Scene::create(); - if(animationsTest != NULL) { + if(animationsTest != nullptr) { scene->addChild(animationsTest); } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/TestHeader/TestHeaderLayer.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/TestHeader/TestHeaderLayer.cpp index 822c007ed4..c01c44fd94 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/TestHeader/TestHeaderLayer.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/TestHeader/TestHeaderLayer.cpp @@ -7,12 +7,12 @@ using namespace cocosbuilder; SEL_MenuHandler TestHeaderLayer::onResolveCCBCCMenuItemSelector(Ref * pTarget, const char * pSelectorName) { CCB_SELECTORRESOLVER_CCMENUITEM_GLUE(this, "onBackClicked", TestHeaderLayer::onBackClicked); - return NULL; + return nullptr; } Control::Handler TestHeaderLayer::onResolveCCBCCControlSelector(Ref * pTarget, const char * pSelectorName) { - return NULL; + return nullptr; } void TestHeaderLayer::onNodeLoaded(cocos2d::Node * node, cocosbuilder::NodeLoader * nodeLoader) diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/TimelineCallbackTest/TimelineCallbackTestLayer.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/TimelineCallbackTest/TimelineCallbackTestLayer.cpp index f4c16a3956..41776bb373 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/TimelineCallbackTest/TimelineCallbackTestLayer.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/TimelineCallbackTest/TimelineCallbackTestLayer.cpp @@ -15,18 +15,18 @@ TimelineCallbackTestLayer::~TimelineCallbackTestLayer() } SEL_MenuHandler TimelineCallbackTestLayer::onResolveCCBCCMenuItemSelector(Ref * pTarget, const char * pSelectorName) { - return NULL; + return nullptr; } Control::Handler TimelineCallbackTestLayer::onResolveCCBCCControlSelector(Ref * pTarget, const char * pSelectorName) { - return NULL; + return nullptr; } SEL_CallFuncN TimelineCallbackTestLayer::onResolveCCBCCCallFuncSelector(Ref * pTarget, const char* pSelectorName) { CCB_SELECTORRESOLVER_CALLFUNC_GLUE(this, "onCallback1", TimelineCallbackTestLayer::onCallback1); CCB_SELECTORRESOLVER_CALLFUNC_GLUE(this, "onCallback2", TimelineCallbackTestLayer::onCallback2); - return NULL; + return nullptr; } bool TimelineCallbackTestLayer::onAssignCCBMemberVariable(Ref * pTarget, const char * pMemberVariableName, Node * pNode) { diff --git a/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlScene.cpp b/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlScene.cpp index 53f0a9028c..764bd139f3 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlScene.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlScene.cpp @@ -44,7 +44,7 @@ bool ControlScene::init() { auto pBackItem = MenuItemFont::create("Back", CC_CALLBACK_1(ControlScene::toExtensionsMainLayer, this)); pBackItem->setPosition(Vec2(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25)); - auto pBackMenu = Menu::create(pBackItem, NULL); + auto pBackMenu = Menu::create(pBackItem, nullptr); pBackMenu->setPosition( Vec2::ZERO ); addChild(pBackMenu, 10); @@ -69,7 +69,7 @@ bool ControlScene::init() auto item2 = MenuItemImage::create("Images/r1.png", "Images/r2.png", CC_CALLBACK_1(ControlScene::restartCallback, this)); auto item3 = MenuItemImage::create("Images/f1.png", "Images/f2.png", CC_CALLBACK_1(ControlScene::nextCallback, this)); - auto menu = Menu::create(item1, item3, item2, NULL); + auto menu = Menu::create(item1, item3, item2, nullptr); menu->setPosition(Vec2::ZERO); item1->setPosition(Vec2(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); item2->setPosition(Vec2(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2)); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlSceneManager.cpp b/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlSceneManager.cpp index 2c5105c8c1..fb0f2d7128 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlSceneManager.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlSceneManager.cpp @@ -58,7 +58,7 @@ static const char* s_testArray[] = { "CCControlStepperTest" }; -static ControlSceneManager *sharedInstance = NULL; +static ControlSceneManager *sharedInstance = nullptr; ControlSceneManager::ControlSceneManager() @@ -73,7 +73,7 @@ ControlSceneManager::~ControlSceneManager() ControlSceneManager * ControlSceneManager::sharedControlSceneManager() { - if (sharedInstance == NULL) + if (sharedInstance == nullptr) { sharedInstance = new ControlSceneManager(); } @@ -111,5 +111,5 @@ Scene *ControlSceneManager::currentControlScene() case kControlPotentiometerTest:return ControlPotentiometerTest::sceneWithTitle(s_testArray[_currentControlSceneId]); case kControlStepperTest:return ControlStepperTest::sceneWithTitle(s_testArray[_currentControlSceneId]); } - return NULL; + return nullptr; } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/EditBoxTest/EditBoxTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/EditBoxTest/EditBoxTest.cpp index 8d465d6390..b54a42aa32 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/EditBoxTest/EditBoxTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/EditBoxTest/EditBoxTest.cpp @@ -30,7 +30,7 @@ EditBoxTest::EditBoxTest() // Back Menu auto itemBack = MenuItemFont::create("Back", CC_CALLBACK_1(EditBoxTest::toExtensionsMainLayer, this)); itemBack->setPosition(Vec2(visibleOrigin.x+visibleSize.width - 50, visibleOrigin.y+25)); - auto menuBack = Menu::create(itemBack, NULL); + auto menuBack = Menu::create(itemBack, nullptr); menuBack->setPosition(Vec2::ZERO); addChild(menuBack); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp index 46ff3e394e..ed957a8ef4 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp @@ -93,7 +93,7 @@ HttpClientTest::HttpClientTest() // Back Menu auto itemBack = MenuItemFont::create("Back", CC_CALLBACK_1(HttpClientTest::toExtensionsMainLayer, this)); itemBack->setPosition(Vec2(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25)); - auto menuBack = Menu::create(itemBack, NULL); + auto menuBack = Menu::create(itemBack, nullptr); menuBack->setPosition(Vec2::ZERO); addChild(menuBack); } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/SocketIOTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/SocketIOTest.cpp index 8d6688c96f..7cb06136ad 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/SocketIOTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/SocketIOTest.cpp @@ -18,7 +18,7 @@ SocketIOTestLayer::SocketIOTestLayer(void) : _sioClient(nullptr) , _sioEndpoint(nullptr) { - //set the clients to NULL until we are ready to connect + //set the clients to nullptr until we are ready to connect Size winSize = Director::getInstance()->getWinSize(); @@ -90,7 +90,7 @@ SocketIOTestLayer::SocketIOTestLayer(void) // Back Menu auto itemBack = MenuItemFont::create("Back", CC_CALLBACK_1(SocketIOTestLayer::toExtensionsMainLayer, this)); itemBack->setPosition(Vec2(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25)); - auto menuBack = Menu::create(itemBack, NULL); + auto menuBack = Menu::create(itemBack, nullptr); menuBack->setPosition(Vec2::ZERO); addChild(menuBack); @@ -163,45 +163,45 @@ void SocketIOTestLayer::onMenuSIOEndpointClicked(cocos2d::Ref *sender) void SocketIOTestLayer::onMenuTestMessageClicked(cocos2d::Ref *sender) { - //check that the socket is != NULL before sending or emitting events - //the client should be NULL either before initialization and connection or after disconnect - if(_sioClient != NULL) _sioClient->send("Hello Socket.IO!"); + //check that the socket is != nullptr before sending or emitting events + //the client should be nullptr either before initialization and connection or after disconnect + if(_sioClient != nullptr) _sioClient->send("Hello Socket.IO!"); } void SocketIOTestLayer::onMenuTestMessageEndpointClicked(cocos2d::Ref *sender) { - if(_sioEndpoint != NULL) _sioEndpoint->send("Hello Socket.IO!"); + if(_sioEndpoint != nullptr) _sioEndpoint->send("Hello Socket.IO!"); } void SocketIOTestLayer::onMenuTestEventClicked(cocos2d::Ref *sender) { - //check that the socket is != NULL before sending or emitting events - //the client should be NULL either before initialization and connection or after disconnect - if(_sioClient != NULL) _sioClient->emit("echotest","[{\"name\":\"myname\",\"type\":\"mytype\"}]"); + //check that the socket is != nullptr before sending or emitting events + //the client should be nullptr either before initialization and connection or after disconnect + if(_sioClient != nullptr) _sioClient->emit("echotest","[{\"name\":\"myname\",\"type\":\"mytype\"}]"); } void SocketIOTestLayer::onMenuTestEventEndpointClicked(cocos2d::Ref *sender) { - if(_sioEndpoint != NULL) _sioEndpoint->emit("echotest","[{\"name\":\"myname\",\"type\":\"mytype\"}]"); + if(_sioEndpoint != nullptr) _sioEndpoint->emit("echotest","[{\"name\":\"myname\",\"type\":\"mytype\"}]"); } void SocketIOTestLayer::onMenuTestClientDisconnectClicked(cocos2d::Ref *sender) { - if(_sioClient != NULL) _sioClient->disconnect(); + if(_sioClient != nullptr) _sioClient->disconnect(); } void SocketIOTestLayer::onMenuTestEndpointDisconnectClicked(cocos2d::Ref *sender) { - if(_sioEndpoint != NULL) _sioEndpoint->disconnect(); + if(_sioEndpoint != nullptr) _sioEndpoint->disconnect(); } @@ -235,14 +235,14 @@ void SocketIOTestLayer::onClose(network::SIOClient* client) s << client->getTag() << " closed!"; _sioClientStatus->setString(s.str().c_str()); - //set the local pointer to NULL or connect to another client + //set the local pointer to nullptr or connect to another client //the client object will be released on its own after this method completes if(client == _sioClient) { - _sioClient = NULL; + _sioClient = nullptr; } else if(client == _sioEndpoint) { - _sioEndpoint = NULL; + _sioEndpoint = nullptr; } } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/WebSocketTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/WebSocketTest.cpp index b33ddc961d..8c51def727 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/WebSocketTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/WebSocketTest.cpp @@ -69,7 +69,7 @@ WebSocketTestLayer::WebSocketTestLayer() // Back Menu auto itemBack = MenuItemFont::create("Back", CC_CALLBACK_1(WebSocketTestLayer::toExtensionsMainLayer, this)); itemBack->setPosition(Vec2(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25)); - auto menuBack = Menu::create(itemBack, NULL); + auto menuBack = Menu::create(itemBack, nullptr); menuBack->setPosition(Vec2::ZERO); addChild(menuBack); @@ -166,15 +166,15 @@ void WebSocketTestLayer::onClose(network::WebSocket* ws) log("websocket instance (%p) closed.", ws); if (ws == _wsiSendText) { - _wsiSendText = NULL; + _wsiSendText = nullptr; } else if (ws == _wsiSendBinary) { - _wsiSendBinary = NULL; + _wsiSendBinary = nullptr; } else if (ws == _wsiError) { - _wsiError = NULL; + _wsiError = nullptr; } // Delete websocket instance. CC_SAFE_DELETE(ws); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/NotificationCenterTest/NotificationCenterTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/NotificationCenterTest/NotificationCenterTest.cpp index 1a37df2876..5df50ea32d 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/NotificationCenterTest/NotificationCenterTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/NotificationCenterTest/NotificationCenterTest.cpp @@ -49,7 +49,7 @@ void Light::setIsConnectToSwitch(bool bConnectToSwitch) _connected = bConnectToSwitch; if (_connected) { - NotificationCenter::getInstance()->addObserver(this, callfuncO_selector(Light::switchStateChanged), MSG_SWITCH_STATE, NULL); + NotificationCenter::getInstance()->addObserver(this, callfuncO_selector(Light::switchStateChanged), MSG_SWITCH_STATE, nullptr); } else { @@ -83,7 +83,7 @@ NotificationCenterTest::NotificationCenterTest() auto pBackItem = MenuItemFont::create("Back", CC_CALLBACK_1(NotificationCenterTest::toExtensionsMainLayer, this)); pBackItem->setPosition(Vec2(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25)); - auto pBackMenu = Menu::create(pBackItem, NULL); + auto pBackMenu = Menu::create(pBackItem, nullptr); pBackMenu->setPosition( Vec2::ZERO ); addChild(pBackMenu); @@ -91,10 +91,10 @@ NotificationCenterTest::NotificationCenterTest() auto label2 = Label::createWithTTF("switch on", "fonts/Marker Felt.ttf", 26); auto item1 = MenuItemLabel::create(label1); auto item2 = MenuItemLabel::create(label2); - auto item = MenuItemToggle::createWithCallback( CC_CALLBACK_1(NotificationCenterTest::toggleSwitch, this), item1, item2, NULL); + auto item = MenuItemToggle::createWithCallback( CC_CALLBACK_1(NotificationCenterTest::toggleSwitch, this), item1, item2, nullptr); // turn on item->setSelectedIndex(1); - auto menu = Menu::create(item, NULL); + auto menu = Menu::create(item, nullptr); menu->setPosition(Vec2(s.width/2+100, s.height/2)); addChild(menu); @@ -113,7 +113,7 @@ NotificationCenterTest::NotificationCenterTest() auto label2 = Label::createWithTTF("connected", "fonts/Marker Felt.ttf", 26); auto item1 = MenuItemLabel::create(label1); auto item2 = MenuItemLabel::create(label2); - auto item = MenuItemToggle::createWithCallback( CC_CALLBACK_1(NotificationCenterTest::connectToSwitch, this), item1, item2, NULL); + auto item = MenuItemToggle::createWithCallback( CC_CALLBACK_1(NotificationCenterTest::connectToSwitch, this), item1, item2, nullptr); item->setTag(kTagConnect+i); item->setPosition(Vec2(light->getPosition().x, light->getPosition().y+50)); menuConnect->addChild(item, 0); @@ -128,9 +128,9 @@ NotificationCenterTest::NotificationCenterTest() NotificationCenter::getInstance()->postNotification(MSG_SWITCH_STATE, (Ref*)(intptr_t)item->getSelectedIndex()); /* for testing removeAllObservers */ - NotificationCenter::getInstance()->addObserver(this, callfuncO_selector(NotificationCenterTest::doNothing), "random-observer1", NULL); - NotificationCenter::getInstance()->addObserver(this, callfuncO_selector(NotificationCenterTest::doNothing), "random-observer2", NULL); - NotificationCenter::getInstance()->addObserver(this, callfuncO_selector(NotificationCenterTest::doNothing), "random-observer3", NULL); + NotificationCenter::getInstance()->addObserver(this, callfuncO_selector(NotificationCenterTest::doNothing), "random-observer1", nullptr); + NotificationCenter::getInstance()->addObserver(this, callfuncO_selector(NotificationCenterTest::doNothing), "random-observer2", nullptr); + NotificationCenter::getInstance()->addObserver(this, callfuncO_selector(NotificationCenterTest::doNothing), "random-observer3", nullptr); } void NotificationCenterTest::toExtensionsMainLayer(cocos2d::Ref* sender) diff --git a/tests/cpp-tests/Classes/ExtensionsTest/Scale9SpriteTest/Scale9SpriteTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/Scale9SpriteTest/Scale9SpriteTest.cpp index 07982e6498..8f86aae1c7 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/Scale9SpriteTest/Scale9SpriteTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/Scale9SpriteTest/Scale9SpriteTest.cpp @@ -662,7 +662,7 @@ void S9CascadeOpacityAndColor::onEnter() TintTo::create(1, 0, 255, 0), TintTo::create(1, 255, 255, 255), FadeOut::create(1), - NULL); + nullptr); auto repeat = RepeatForever::create(actions); rgba->runAction(repeat); log("this->addChild"); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp b/tests/cpp-tests/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp index 0bf1dc7681..e472e9e912 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp @@ -41,7 +41,7 @@ bool TableViewTestLayer::init() // Back Menu MenuItemFont *itemBack = MenuItemFont::create("Back", CC_CALLBACK_1(TableViewTestLayer::toExtensionsMainLayer, this)); itemBack->setPosition(Vec2(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25)); - Menu *menuBack = Menu::create(itemBack, NULL); + Menu *menuBack = Menu::create(itemBack, nullptr); menuBack->setPosition(Vec2::ZERO); addChild(menuBack); diff --git a/tests/cpp-tests/Classes/IntervalTest/IntervalTest.cpp b/tests/cpp-tests/Classes/IntervalTest/IntervalTest.cpp index 5a84b24595..09192591eb 100644 --- a/tests/cpp-tests/Classes/IntervalTest/IntervalTest.cpp +++ b/tests/cpp-tests/Classes/IntervalTest/IntervalTest.cpp @@ -55,7 +55,7 @@ IntervalLayer::IntervalLayer() auto jump = JumpBy::create(3, Vec2(s.width-80,0), 50, 4); addChild(sprite); - sprite->runAction( RepeatForever::create(Sequence::create(jump, jump->reverse(), NULL) )); + sprite->runAction( RepeatForever::create(Sequence::create(jump, jump->reverse(), nullptr) )); // pause button auto item1 = MenuItemFont::create("Pause", [&](Ref* sender) { if(Director::getInstance()->isPaused()) @@ -63,7 +63,7 @@ IntervalLayer::IntervalLayer() else Director::getInstance()->pause(); }); - auto menu = Menu::create(item1, NULL); + auto menu = Menu::create(item1, nullptr); menu->setPosition( Vec2(s.width/2, s.height-50) ); addChild( menu ); diff --git a/tests/cpp-tests/Classes/LabelTest/LabelTest.cpp b/tests/cpp-tests/Classes/LabelTest/LabelTest.cpp index 2dc431e502..b641d89676 100644 --- a/tests/cpp-tests/Classes/LabelTest/LabelTest.cpp +++ b/tests/cpp-tests/Classes/LabelTest/LabelTest.cpp @@ -307,7 +307,7 @@ LabelAtlasColorTest::LabelAtlasColorTest() auto fade = FadeOut::create(1.0f); auto fade_in = fade->reverse(); auto cb = CallFunc::create(CC_CALLBACK_0(LabelAtlasColorTest::actionFinishCallback, this)); - auto seq = Sequence::create(fade, fade_in, cb, NULL); + auto seq = Sequence::create(fade, fade_in, cb, nullptr); auto repeat = RepeatForever::create( seq ); label2->runAction( repeat ); @@ -426,7 +426,7 @@ Atlas3::Atlas3() auto tint = Sequence::create(TintTo::create(1, 255, 0, 0), TintTo::create(1, 0, 255, 0), TintTo::create(1, 0, 0, 255), - NULL); + nullptr); label2->runAction( RepeatForever::create(tint) ); auto label3 = LabelBMFont::create("Test", "fonts/bitmapFontTest2.fnt"); @@ -504,7 +504,7 @@ Atlas4::Atlas4() auto scale = ScaleBy::create(2, 1.5f); auto scale_back = scale->reverse(); - auto scale_seq = Sequence::create(scale, scale_back,NULL); + auto scale_seq = Sequence::create(scale, scale_back,nullptr); auto scale_4ever = RepeatForever::create(scale_seq); auto jump = JumpBy::create(0.5f, Vec2::ZERO, 60, 1); @@ -512,7 +512,7 @@ Atlas4::Atlas4() auto fade_out = FadeOut::create(1); auto fade_in = FadeIn::create(1); - auto seq = Sequence::create(fade_out, fade_in, NULL); + auto seq = Sequence::create(fade_out, fade_in, nullptr); auto fade_4ever = RepeatForever::create(seq); BChar->runAction(rot_4ever); @@ -623,7 +623,7 @@ Atlas6::Atlas6() { auto s = Director::getInstance()->getWinSize(); - LabelBMFont* label = NULL; + LabelBMFont* label = nullptr; label = LabelBMFont::create("FaFeFiFoFu", "fonts/bitmapFontTest5.fnt"); addChild(label); label->setPosition( Vec2(s.width/2, s.height/2+50) ); @@ -964,7 +964,7 @@ LabelTTFTest::LabelTTFTest() MenuItemFont::create("Left", CC_CALLBACK_1(LabelTTFTest::setAlignmentLeft, this)), MenuItemFont::create("Center", CC_CALLBACK_1(LabelTTFTest::setAlignmentCenter, this)), MenuItemFont::create("Right", CC_CALLBACK_1(LabelTTFTest::setAlignmentRight, this)), - NULL); + nullptr); menu->alignItemsVerticallyWithPadding(4); menu->setPosition(Vec2(50, s.height / 2 - 20)); this->addChild(menu); @@ -973,7 +973,7 @@ LabelTTFTest::LabelTTFTest() MenuItemFont::create("Top", CC_CALLBACK_1(LabelTTFTest::setAlignmentTop, this)), MenuItemFont::create("Middle", CC_CALLBACK_1(LabelTTFTest::setAlignmentMiddle, this)), MenuItemFont::create("Bottom", CC_CALLBACK_1(LabelTTFTest::setAlignmentBottom, this)), - NULL); + nullptr); menu->alignItemsVerticallyWithPadding(4); menu->setPosition(Vec2(s.width - 50, s.height / 2 - 20)); this->addChild(menu); @@ -1050,8 +1050,8 @@ void LabelTTFTest::setAlignmentBottom(Ref* sender) const char* LabelTTFTest::getCurrentAlignment() { - const char* vertical = NULL; - const char* horizontal = NULL; + const char* vertical = nullptr; + const char* horizontal = nullptr; switch (_vertAlign) { case TextVAlignment::TOP: vertical = "Top"; @@ -1184,7 +1184,7 @@ BitmapFontMultiLineAlignment::BitmapFontMultiLineAlignment() auto longSentences = MenuItemFont::create("Long Flowing Sentences", CC_CALLBACK_1(BitmapFontMultiLineAlignment::stringChanged, this)); auto lineBreaks = MenuItemFont::create("Short Sentences With Intentional Line Breaks", CC_CALLBACK_1(BitmapFontMultiLineAlignment::stringChanged, this)); auto mixed = MenuItemFont::create("Long Sentences Mixed With Intentional Line Breaks", CC_CALLBACK_1(BitmapFontMultiLineAlignment::stringChanged, this)); - auto stringMenu = Menu::create(longSentences, lineBreaks, mixed, NULL); + auto stringMenu = Menu::create(longSentences, lineBreaks, mixed, nullptr); stringMenu->alignItemsVertically(); longSentences->setColor(Color3B::RED); @@ -1198,7 +1198,7 @@ BitmapFontMultiLineAlignment::BitmapFontMultiLineAlignment() auto left = MenuItemFont::create("Left", CC_CALLBACK_1(BitmapFontMultiLineAlignment::alignmentChanged, this)); auto center = MenuItemFont::create("Center", CC_CALLBACK_1(BitmapFontMultiLineAlignment::alignmentChanged, this)); auto right = MenuItemFont::create("Right", CC_CALLBACK_1(BitmapFontMultiLineAlignment::alignmentChanged, this)); - auto alignmentMenu = Menu::create(left, center, right, NULL); + auto alignmentMenu = Menu::create(left, center, right, nullptr); alignmentMenu->alignItemsHorizontallyWithPadding(alignmentItemPadding); center->setColor(Color3B::RED); @@ -1359,7 +1359,7 @@ LabelTTFA8Test::LabelTTFA8Test() auto fadeOut = FadeOut::create(2); auto fadeIn = FadeIn::create(2); - auto seq = Sequence::create(fadeOut, fadeIn, NULL); + auto seq = Sequence::create(fadeOut, fadeIn, nullptr); auto forever = RepeatForever::create(seq); label1->runAction(forever); } diff --git a/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp b/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp index df69db7b8a..9dca43b4ae 100644 --- a/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp +++ b/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp @@ -210,7 +210,7 @@ LabelFNTColorAndOpacity::LabelFNTColorAndOpacity() addChild(label1, 0, kTagBitmapAtlas1); auto fade = FadeOut::create(1.0f); auto fade_in = fade->reverse(); - auto seq = Sequence::create(fade, fade_in, NULL); + auto seq = Sequence::create(fade, fade_in, nullptr); auto repeat = RepeatForever::create(seq); label1->runAction(repeat); @@ -220,7 +220,7 @@ LabelFNTColorAndOpacity::LabelFNTColorAndOpacity() auto tint = Sequence::create(TintTo::create(1, 255, 0, 0), TintTo::create(1, 0, 255, 0), TintTo::create(1, 0, 0, 255), - NULL); + nullptr); label2->runAction( RepeatForever::create(tint) ); auto label3 = Label::createWithBMFont("fonts/bitmapFontTest2.fnt", "Test"); @@ -282,7 +282,7 @@ LabelFNTSpriteActions::LabelFNTSpriteActions() auto scale = ScaleBy::create(2, 1.5f); auto scale_back = scale->reverse(); - auto scale_seq = Sequence::create(scale, scale_back,NULL); + auto scale_seq = Sequence::create(scale, scale_back,nullptr); auto scale_4ever = RepeatForever::create(scale_seq); auto jump = JumpBy::create(0.5f, Vec2::ZERO, 60, 1); @@ -290,7 +290,7 @@ LabelFNTSpriteActions::LabelFNTSpriteActions() auto fade_out = FadeOut::create(1); auto fade_in = FadeIn::create(1); - auto seq = Sequence::create(fade_out, fade_in, NULL); + auto seq = Sequence::create(fade_out, fade_in, nullptr); auto fade_4ever = RepeatForever::create(seq); BChar->runAction(rot_4ever); @@ -689,7 +689,7 @@ LabelFNTMultiLineAlignment::LabelFNTMultiLineAlignment() auto longSentences = MenuItemFont::create("Long Flowing Sentences", CC_CALLBACK_1(LabelFNTMultiLineAlignment::stringChanged, this)); auto lineBreaks = MenuItemFont::create("Short Sentences With Intentional Line Breaks", CC_CALLBACK_1(LabelFNTMultiLineAlignment::stringChanged, this)); auto mixed = MenuItemFont::create("Long Sentences Mixed With Intentional Line Breaks", CC_CALLBACK_1(LabelFNTMultiLineAlignment::stringChanged, this)); - auto stringMenu = Menu::create(longSentences, lineBreaks, mixed, NULL); + auto stringMenu = Menu::create(longSentences, lineBreaks, mixed, nullptr); stringMenu->alignItemsVertically(); longSentences->setColor(Color3B::RED); @@ -703,7 +703,7 @@ LabelFNTMultiLineAlignment::LabelFNTMultiLineAlignment() auto left = MenuItemFont::create("Left", CC_CALLBACK_1(LabelFNTMultiLineAlignment::alignmentChanged, this)); auto center = MenuItemFont::create("Center", CC_CALLBACK_1(LabelFNTMultiLineAlignment::alignmentChanged, this)); auto right = MenuItemFont::create("Right", CC_CALLBACK_1(LabelFNTMultiLineAlignment::alignmentChanged, this)); - auto alignmentMenu = Menu::create(left, center, right, NULL); + auto alignmentMenu = Menu::create(left, center, right, nullptr); alignmentMenu->alignItemsHorizontallyWithPadding(alignmentItemPadding); center->setColor(Color3B::RED); @@ -1008,7 +1008,7 @@ LabelTTFDynamicAlignment::LabelTTFDynamicAlignment() MenuItemFont::create("Left", CC_CALLBACK_1(LabelTTFDynamicAlignment::setAlignmentLeft, this)), MenuItemFont::create("Center", CC_CALLBACK_1(LabelTTFDynamicAlignment::setAlignmentCenter, this)), MenuItemFont::create("Right", CC_CALLBACK_1(LabelTTFDynamicAlignment::setAlignmentRight, this)), - NULL); + nullptr); menu->alignItemsVerticallyWithPadding(4); menu->setPosition(Vec2(50, size.height / 4 )); @@ -1436,7 +1436,7 @@ LabelCharMapColorTest::LabelCharMapColorTest() auto fade = FadeOut::create(1.0f); auto fade_in = fade->reverse(); auto cb = CallFunc::create(CC_CALLBACK_0(LabelCharMapColorTest::actionFinishCallback, this)); - auto seq = Sequence::create(fade, fade_in, cb, NULL); + auto seq = Sequence::create(fade, fade_in, cb, nullptr); auto repeat = RepeatForever::create( seq ); label2->runAction( repeat ); @@ -1612,7 +1612,7 @@ LabelAlignmentTest::LabelAlignmentTest() MenuItemFont::create("Left", CC_CALLBACK_1(LabelAlignmentTest::setAlignmentLeft, this)), MenuItemFont::create("Center", CC_CALLBACK_1(LabelAlignmentTest::setAlignmentCenter, this)), MenuItemFont::create("Right", CC_CALLBACK_1(LabelAlignmentTest::setAlignmentRight, this)), - NULL); + nullptr); menu->alignItemsVerticallyWithPadding(4); menu->setPosition(Vec2(50, s.height / 2 - 20)); this->addChild(menu); @@ -1621,7 +1621,7 @@ LabelAlignmentTest::LabelAlignmentTest() MenuItemFont::create("Top", CC_CALLBACK_1(LabelAlignmentTest::setAlignmentTop, this)), MenuItemFont::create("Middle", CC_CALLBACK_1(LabelAlignmentTest::setAlignmentMiddle, this)), MenuItemFont::create("Bottom", CC_CALLBACK_1(LabelAlignmentTest::setAlignmentBottom, this)), - NULL); + nullptr); menu->alignItemsVerticallyWithPadding(4); menu->setPosition(Vec2(s.width - 50, s.height / 2 - 20)); this->addChild(menu); @@ -1690,8 +1690,8 @@ void LabelAlignmentTest::setAlignmentBottom(Ref* sender) const char* LabelAlignmentTest::getCurrentAlignment() { - const char* vertical = NULL; - const char* horizontal = NULL; + const char* vertical = nullptr; + const char* horizontal = nullptr; switch (_vertAlign) { case TextVAlignment::TOP: vertical = "Top"; diff --git a/tests/cpp-tests/Classes/LayerTest/LayerTest.cpp b/tests/cpp-tests/Classes/LayerTest/LayerTest.cpp index 431daeba67..58f958c477 100644 --- a/tests/cpp-tests/Classes/LayerTest/LayerTest.cpp +++ b/tests/cpp-tests/Classes/LayerTest/LayerTest.cpp @@ -151,7 +151,7 @@ void LayerTestCascadingOpacityA::onEnter() FadeTo::create(4, 0), FadeTo::create(4, 255), DelayTime::create(1), - NULL))); + nullptr))); sister1->runAction( RepeatForever::create( @@ -161,7 +161,7 @@ void LayerTestCascadingOpacityA::onEnter() FadeTo::create(2, 0), FadeTo::create(2, 255), DelayTime::create(1), - NULL))); + nullptr))); // Enable cascading in scene setEnableRecursiveCascading(this, true); @@ -203,7 +203,7 @@ void LayerTestCascadingOpacityB::onEnter() FadeTo::create(4, 0), FadeTo::create(4, 255), DelayTime::create(1), - NULL))); + nullptr))); sister1->runAction( RepeatForever::create( @@ -213,7 +213,7 @@ void LayerTestCascadingOpacityB::onEnter() FadeTo::create(2, 0), FadeTo::create(2, 255), DelayTime::create(1), - NULL))); + nullptr))); // Enable cascading in scene setEnableRecursiveCascading(this, true); @@ -256,7 +256,7 @@ void LayerTestCascadingOpacityC::onEnter() FadeTo::create(4, 0), FadeTo::create(4, 255), DelayTime::create(1), - NULL))); + nullptr))); sister1->runAction( RepeatForever::create( @@ -266,7 +266,7 @@ void LayerTestCascadingOpacityC::onEnter() FadeTo::create(2, 0), FadeTo::create(2, 255), DelayTime::create(1), - NULL))); + nullptr))); } std::string LayerTestCascadingOpacityC::subtitle() const @@ -304,7 +304,7 @@ void LayerTestCascadingColorA::onEnter() TintTo::create(6, 255, 0, 255), TintTo::create(6, 255, 255, 255), DelayTime::create(1), - NULL))); + nullptr))); sister1->runAction( RepeatForever::create( @@ -316,7 +316,7 @@ void LayerTestCascadingColorA::onEnter() TintTo::create(2, 255, 0, 255), TintTo::create(2, 255, 255, 255), DelayTime::create(1), - NULL))); + nullptr))); // Enable cascading in scene setEnableRecursiveCascading(this, true); @@ -357,7 +357,7 @@ void LayerTestCascadingColorB::onEnter() TintTo::create(6, 255, 0, 255), TintTo::create(6, 255, 255, 255), DelayTime::create(1), - NULL))); + nullptr))); sister1->runAction( RepeatForever::create( @@ -369,7 +369,7 @@ void LayerTestCascadingColorB::onEnter() TintTo::create(2, 255, 0, 255), TintTo::create(2, 255, 255, 255), DelayTime::create(1), - NULL))); + nullptr))); // Enable cascading in scene setEnableRecursiveCascading(this, true); @@ -409,7 +409,7 @@ void LayerTestCascadingColorC::onEnter() TintTo::create(6, 255, 0, 255), TintTo::create(6, 255, 255, 255), DelayTime::create(1), - NULL))); + nullptr))); sister1->runAction( RepeatForever::create( @@ -421,7 +421,7 @@ void LayerTestCascadingColorC::onEnter() TintTo::create(2, 255, 0, 255), TintTo::create(2, 255, 255, 255), DelayTime::create(1), - NULL))); + nullptr))); } std::string LayerTestCascadingColorC::subtitle() const @@ -508,12 +508,12 @@ void LayerTest2::onEnter() auto actionTint = TintBy::create(2, -255, -127, 0); auto actionTintBack = actionTint->reverse(); - auto seq1 = Sequence::create( actionTint, actionTintBack, NULL); + auto seq1 = Sequence::create( actionTint, actionTintBack, nullptr); layer1->runAction(seq1); auto actionFade = FadeOut::create(2.0f); auto actionFadeBack = actionFade->reverse(); - auto seq2 = Sequence::create(actionFade, actionFadeBack, NULL); + auto seq2 = Sequence::create(actionFade, actionFadeBack, nullptr); layer2->runAction(seq2); } @@ -592,9 +592,9 @@ LayerGradientTest::LayerGradientTest() auto label2 = Label::createWithTTF("Compressed Interpolation: Disabled", "fonts/Marker Felt.ttf", 26); auto item1 = MenuItemLabel::create(label1); auto item2 = MenuItemLabel::create(label2); - auto item = MenuItemToggle::createWithCallback( CC_CALLBACK_1(LayerGradientTest::toggleItem, this), item1, item2, NULL); + auto item = MenuItemToggle::createWithCallback( CC_CALLBACK_1(LayerGradientTest::toggleItem, this), item1, item2, nullptr); - auto menu = Menu::create(item, NULL); + auto menu = Menu::create(item, nullptr); addChild(menu); auto s = Director::getInstance()->getWinSize(); menu->setPosition(Vec2(s.width / 2, 100)); @@ -690,7 +690,7 @@ void LayerIgnoreAnchorPointPos::onEnter() auto move = MoveBy::create(2, Vec2(100,2)); auto back = (MoveBy *)move->reverse(); - auto seq = Sequence::create(move, back, NULL); + auto seq = Sequence::create(move, back, nullptr); l->runAction(RepeatForever::create(seq)); this->addChild(l, 0, kLayerIgnoreAnchorPoint); @@ -701,7 +701,7 @@ void LayerIgnoreAnchorPointPos::onEnter() auto item = MenuItemFont::create("Toggle ignore anchor point", CC_CALLBACK_1(LayerIgnoreAnchorPointPos::onToggle, this)); - auto menu = Menu::create(item, NULL); + auto menu = Menu::create(item, nullptr); this->addChild(menu); menu->setPosition(Vec2(s.width/2, s.height/2)); @@ -749,7 +749,7 @@ void LayerIgnoreAnchorPointRot::onEnter() auto item = MenuItemFont::create("Toogle ignore anchor point", CC_CALLBACK_1(LayerIgnoreAnchorPointRot::onToggle, this)); - auto menu = Menu::create(item, NULL); + auto menu = Menu::create(item, nullptr); this->addChild(menu); menu->setPosition(Vec2(s.width/2, s.height/2)); @@ -787,7 +787,7 @@ void LayerIgnoreAnchorPointScale::onEnter() auto scale = ScaleBy::create(2, 2); auto back = (ScaleBy*)scale->reverse(); - auto seq = Sequence::create(scale, back, NULL); + auto seq = Sequence::create(scale, back, nullptr); l->runAction(RepeatForever::create(seq)); @@ -800,7 +800,7 @@ void LayerIgnoreAnchorPointScale::onEnter() auto item = MenuItemFont::create("Toogle ignore anchor point", CC_CALLBACK_1(LayerIgnoreAnchorPointScale::onToggle, this)); - auto menu = Menu::create(item, NULL); + auto menu = Menu::create(item, nullptr); this->addChild(menu); menu->setPosition(Vec2(s.width/2, s.height/2)); diff --git a/tests/cpp-tests/Classes/MenuTest/MenuTest.cpp b/tests/cpp-tests/Classes/MenuTest/MenuTest.cpp index bb00913264..3fba8b87f5 100644 --- a/tests/cpp-tests/Classes/MenuTest/MenuTest.cpp +++ b/tests/cpp-tests/Classes/MenuTest/MenuTest.cpp @@ -102,10 +102,10 @@ MenuLayerMainMenu::MenuLayerMainMenu() auto color_action = TintBy::create(0.5f, 0, -255, -255); auto color_back = color_action->reverse(); - auto seq = Sequence::create(color_action, color_back, NULL); + auto seq = Sequence::create(color_action, color_back, nullptr); item7->runAction(RepeatForever::create(seq)); - auto menu = Menu::create( item1, item2, item3, item4, item5, item6, item7, item8, NULL); + auto menu = Menu::create( item1, item2, item3, item4, item5, item6, item7, item8, nullptr); menu->alignItemsVertically(); @@ -221,7 +221,7 @@ MenuLayer2::MenuLayer2() item2->setScaleX( 0.5f ); item3->setScaleX( 0.5f ); - auto menu = Menu::create(item1, item2, item3, NULL); + auto menu = Menu::create(item1, item2, item3, nullptr); auto s = Director::getInstance()->getWinSize(); menu->setPosition(Vec2(s.width/2, s.height/2)); @@ -344,7 +344,7 @@ MenuLayer3::MenuLayer3() _disabledItem = item3; item3->retain(); _disabledItem->setEnabled( false ); - auto menu = Menu::create( item1, item2, item3, NULL); + auto menu = Menu::create( item1, item2, item3, nullptr); menu->setPosition( Vec2(0,0) ); auto s = Director::getInstance()->getWinSize(); @@ -354,7 +354,7 @@ MenuLayer3::MenuLayer3() item3->setPosition( Vec2(s.width/2, s.height/2 - 100) ); auto jump = JumpBy::create(3, Vec2(400,0), 50, 4); - item2->runAction( RepeatForever::create(Sequence::create( jump, jump->reverse(), NULL))); + item2->runAction( RepeatForever::create(Sequence::create( jump, jump->reverse(), nullptr))); auto spin1 = RotateBy::create(3, 360); auto spin2 = spin1->clone(); @@ -390,7 +390,7 @@ MenuLayer4::MenuLayer4() auto item1 = MenuItemToggle::createWithCallback( CC_CALLBACK_1(MenuLayer4::menuCallback, this), MenuItemFont::create( "On" ), MenuItemFont::create( "Off"), - NULL ); + nullptr ); MenuItemFont::setFontName( "American Typewriter" ); MenuItemFont::setFontSize(18); @@ -401,7 +401,7 @@ MenuLayer4::MenuLayer4() auto item2 = MenuItemToggle::createWithCallback(CC_CALLBACK_1(MenuLayer4::menuCallback, this), MenuItemFont::create( "On" ), MenuItemFont::create( "Off"), - NULL ); + nullptr ); MenuItemFont::setFontName( "American Typewriter" ); MenuItemFont::setFontSize(18); @@ -412,7 +412,7 @@ MenuLayer4::MenuLayer4() auto item3 = MenuItemToggle::createWithCallback(CC_CALLBACK_1(MenuLayer4::menuCallback, this), MenuItemFont::create( "High" ), MenuItemFont::create( "Low" ), - NULL ); + nullptr ); MenuItemFont::setFontName( "American Typewriter" ); MenuItemFont::setFontSize(18); @@ -422,7 +422,7 @@ MenuLayer4::MenuLayer4() MenuItemFont::setFontSize(34); auto item4 = MenuItemToggle::createWithCallback(CC_CALLBACK_1(MenuLayer4::menuCallback, this), MenuItemFont::create( "Off" ), - NULL ); + nullptr ); // TIP: you can manipulate the items like any other MutableArray item4->getSubItems().pushBack( MenuItemFont::create( "33%" ) ); @@ -443,9 +443,9 @@ MenuLayer4::MenuLayer4() item1, item2, title3, title4, item3, item4, - back, NULL ); // 9 items. + back, nullptr ); // 9 items. - menu->alignItemsInColumns(2, 2, 2, 2, 1, NULL); + menu->alignItemsInColumns(2, 2, 2, 2, 1, nullptr); addChild( menu ); @@ -474,7 +474,7 @@ BugsTest::BugsTest() auto issue1410_2 = MenuItemFont::create("Issue 1410 #2", CC_CALLBACK_1(BugsTest::issue1410v2MenuCallback, this)); auto back = MenuItemFont::create("Back", CC_CALLBACK_1(BugsTest::backMenuCallback, this)); - auto menu = Menu::create(issue1410, issue1410_2, back, NULL); + auto menu = Menu::create(issue1410, issue1410_2, back, nullptr); addChild(menu); menu->alignItemsVertically(); @@ -518,7 +518,7 @@ RemoveMenuItemWhenMove::RemoveMenuItemWhenMove() auto back = MenuItemFont::create("go back", CC_CALLBACK_1(RemoveMenuItemWhenMove::goBack, this)); - auto menu = Menu::create(item, back, NULL); + auto menu = Menu::create(item, back, nullptr); addChild(menu); menu->alignItemsVertically(); @@ -557,7 +557,7 @@ void RemoveMenuItemWhenMove::onTouchMoved(Touch *touch, Event *event) { item->removeFromParentAndCleanup(true); item->release(); - item = NULL; + item = nullptr; } } @@ -572,7 +572,7 @@ void MenuTestScene::runThisTest() auto layer5 = new BugsTest(); auto layer6 = new RemoveMenuItemWhenMove(); - auto layer = LayerMultiplex::create(layer1, layer2, layer3, layer4, layer5, layer6, NULL); + auto layer = LayerMultiplex::create(layer1, layer2, layer3, layer4, layer5, layer6, nullptr); addChild(layer, 0); layer1->release(); diff --git a/tests/cpp-tests/Classes/MotionStreakTest/MotionStreakTest.cpp b/tests/cpp-tests/Classes/MotionStreakTest/MotionStreakTest.cpp index 233603da5d..6e6c0986c7 100644 --- a/tests/cpp-tests/Classes/MotionStreakTest/MotionStreakTest.cpp +++ b/tests/cpp-tests/Classes/MotionStreakTest/MotionStreakTest.cpp @@ -79,7 +79,7 @@ void MotionStreakTest1::onEnter() auto action1 = RepeatForever::create(a1); auto motion = MoveBy::create(2, Vec2(100,0) ); - _root->runAction( RepeatForever::create(Sequence::create(motion, motion->reverse(), NULL) ) ); + _root->runAction( RepeatForever::create(Sequence::create(motion, motion->reverse(), nullptr) ) ); _root->runAction( action1 ); auto colorAction = RepeatForever::create(Sequence::create( @@ -90,7 +90,7 @@ void MotionStreakTest1::onEnter() TintTo::create(0.2f, 255, 255, 0), TintTo::create(0.2f, 255, 0, 255), TintTo::create(0.2f, 255, 255, 255), - NULL)); + nullptr)); streak->runAction(colorAction); } @@ -214,9 +214,9 @@ void MotionStreakTest::onEnter() auto itemMode = MenuItemToggle::createWithCallback( CC_CALLBACK_1(MotionStreakTest::modeCallback, this), MenuItemFont::create("Use High Quality Mode"), MenuItemFont::create("Use Fast Mode"), - NULL); + nullptr); - auto menuMode = Menu::create(itemMode, NULL); + auto menuMode = Menu::create(itemMode, nullptr); addChild(menuMode); menuMode->setPosition(Vec2(s.width/2, s.height/4)); diff --git a/tests/cpp-tests/Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp b/tests/cpp-tests/Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp index 0355b21751..453d368bca 100644 --- a/tests/cpp-tests/Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp +++ b/tests/cpp-tests/Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp @@ -201,7 +201,7 @@ void TouchableSpriteTest::onEnter() nextItem->setFontSizeObj(16); nextItem->setPosition(VisibleRect::right() + Vec2(-100, -30)); - auto menu2 = Menu::create(nextItem, NULL); + auto menu2 = Menu::create(nextItem, nullptr); menu2->setPosition(Vec2(0, 0)); menu2->setAnchorPoint(Vec2(0, 0)); this->addChild(menu2); @@ -405,7 +405,7 @@ void RemoveListenerWhenDispatching::onEnter() (*enable) = true; } - }, MenuItemFont::create("Enabled"), MenuItemFont::create("Disabled"), NULL); + }, MenuItemFont::create("Enabled"), MenuItemFont::create("Disabled"), nullptr); toggleItem->setPosition(origin + Vec2(size.width/2, 80)); auto menu = Menu::create(toggleItem, nullptr); @@ -1153,7 +1153,7 @@ PauseResumeTargetTest::PauseResumeTargetTest() closeItem->setPosition(VisibleRect::center()); - auto closeMenu = Menu::create(closeItem, NULL); + auto closeMenu = Menu::create(closeItem, nullptr); closeMenu->setAnchorPoint(Vec2::ANCHOR_BOTTOM_LEFT); closeMenu->setPosition(Vec2::ZERO); @@ -1216,7 +1216,7 @@ Issue4129::Issue4129() nextItem->setFontSizeObj(16); nextItem->setPosition(VisibleRect::right() + Vec2(-100, -30)); - auto menu2 = Menu::create(nextItem, NULL); + auto menu2 = Menu::create(nextItem, nullptr); menu2->setPosition(Vec2(0, 0)); menu2->setAnchorPoint(Vec2(0, 0)); this->addChild(menu2); diff --git a/tests/cpp-tests/Classes/NodeTest/NodeTest.cpp b/tests/cpp-tests/Classes/NodeTest/NodeTest.cpp index 1ad294deec..729ac092ed 100644 --- a/tests/cpp-tests/Classes/NodeTest/NodeTest.cpp +++ b/tests/cpp-tests/Classes/NodeTest/NodeTest.cpp @@ -183,12 +183,12 @@ void Test2::onEnter() auto a1 = RotateBy::create(2, 360); auto a2 = ScaleBy::create(2, 2); - auto action1 = RepeatForever::create( Sequence::create(a1, a2, a2->reverse(), NULL) ); + auto action1 = RepeatForever::create( Sequence::create(a1, a2, a2->reverse(), nullptr) ); auto action2 = RepeatForever::create( Sequence::create( a1->clone(), a2->clone(), a2->reverse(), - NULL) + nullptr) ); sp2->setAnchorPoint(Vec2(0,0)); @@ -260,7 +260,7 @@ Test5::Test5() auto rot = RotateBy::create(2, 360); auto rot_back = rot->reverse(); - auto forever = RepeatForever::create(Sequence::create(rot, rot_back, NULL)); + auto forever = RepeatForever::create(Sequence::create(rot, rot_back, nullptr)); auto forever2 = forever->clone(); forever->setTag(101); forever2->setTag(102); @@ -315,7 +315,7 @@ Test6::Test6() auto rot = RotateBy::create(2, 360); auto rot_back = rot->reverse(); - auto forever1 = RepeatForever::create(Sequence::create(rot, rot_back, NULL)); + auto forever1 = RepeatForever::create(Sequence::create(rot, rot_back, nullptr)); auto forever11 = forever1->clone(); auto forever2 = forever1->clone(); @@ -394,7 +394,7 @@ void StressTest1::shouldNotCrash(float dt) runAction( Sequence::create( RotateBy::create(2, 360), CallFuncN::create(CC_CALLBACK_1(StressTest1::removeMe, this)), - NULL) ); + nullptr) ); addChild(explosion); } @@ -429,7 +429,7 @@ StressTest2::StressTest2() auto move = MoveBy::create(3, Vec2(350,0)); auto move_ease_inout3 = EaseInOut::create(move->clone(), 2.0f); auto move_ease_inout_back3 = move_ease_inout3->reverse(); - auto seq3 = Sequence::create( move_ease_inout3, move_ease_inout_back3, NULL); + auto seq3 = Sequence::create( move_ease_inout3, move_ease_inout_back3, nullptr); sp1->runAction( RepeatForever::create(seq3) ); sublayer->addChild(sp1, 1); @@ -508,7 +508,7 @@ NodeToWorld::NodeToWorld() auto backSize = back->getContentSize(); auto item = MenuItemImage::create(s_PlayNormal, s_PlaySelect); - auto menu = Menu::create(item, NULL); + auto menu = Menu::create(item, nullptr); menu->alignItemsVertically(); menu->setPosition( Vec2(backSize.width/2, backSize.height/2)); back->addChild(menu); @@ -519,7 +519,7 @@ NodeToWorld::NodeToWorld() auto move = MoveBy::create(3, Vec2(200,0)); auto move_back = move->reverse(); - auto seq = Sequence::create( move, move_back, NULL); + auto seq = Sequence::create( move, move_back, nullptr); auto fe2 = RepeatForever::create(seq); back->runAction(fe2); } @@ -554,7 +554,7 @@ NodeToWorld3D::NodeToWorld3D() auto backSize = back->getContentSize(); auto item = MenuItemImage::create(s_PlayNormal, s_PlaySelect); - auto menu = Menu::create(item, NULL); + auto menu = Menu::create(item, nullptr); menu->alignItemsVertically(); menu->setPosition( Vec2(backSize.width/2, backSize.height/2)); back->addChild(menu); @@ -565,7 +565,7 @@ NodeToWorld3D::NodeToWorld3D() auto move = MoveBy::create(3, Vec2(200,0)); auto move_back = move->reverse(); - auto seq = Sequence::create( move, move_back, NULL); + auto seq = Sequence::create( move, move_back, nullptr); auto fe2 = RepeatForever::create(seq); back->runAction(fe2); @@ -885,7 +885,7 @@ std::string ConvertToNode::subtitle() const NodeOpaqueTest::NodeOpaqueTest() { - Sprite *background = NULL; + Sprite *background = nullptr; for (int i = 0; i < 50; i++) { @@ -910,7 +910,7 @@ std::string NodeOpaqueTest::subtitle() const NodeNonOpaqueTest::NodeNonOpaqueTest() { - Sprite *background = NULL; + Sprite *background = nullptr; for (int i = 0; i < 50; i++) { @@ -1379,8 +1379,8 @@ void NodeNameTest::test(float dt) }); CCAssert(i == 10000, ""); - // name = /xxx : search from root - parent = getScene(); + // name = //xxx : search recursively + parent = Node::create(); for (int j = 0; j < 100; j++) { auto node = Node::create(); @@ -1398,35 +1398,21 @@ void NodeNameTest::test(float dt) } i = 0; - enumerateChildren("/node[[:digit:]]+", [&i](Node* node) -> bool { - ++i; - return false; - }); - CCAssert(i == 100, ""); - - i = 0; - enumerateChildren("/node[[:digit:]]+", [&i](Node* node) -> bool { - ++i; - return true; - }); - CCAssert(i == 1, ""); - - i = 0; - enumerateChildren("//node[[:digit:]]+", [&i](Node* node) -> bool { + parent->enumerateChildren("//node[[:digit:]]+", [&i](Node* node) -> bool { ++i; return false; }); CCAssert(i == 10100, ""); // 10000(children) + 100(parent) i = 0; - enumerateChildren("//node[[:digit:]]+", [&i](Node* node) -> bool { + parent->enumerateChildren("//node[[:digit:]]+", [&i](Node* node) -> bool { ++i; return true; }); CCAssert(i == 1, ""); i = 0; - enumerateChildren("//node[[:digit:]]+/..", [&i](Node* node) -> bool { + parent->enumerateChildren("//node[[:digit:]]+/..", [&i](Node* node) -> bool { ++i; return false; }); diff --git a/tests/cpp-tests/Classes/ParallaxTest/ParallaxTest.cpp b/tests/cpp-tests/Classes/ParallaxTest/ParallaxTest.cpp index 2e650c23d2..ae0683541f 100644 --- a/tests/cpp-tests/Classes/ParallaxTest/ParallaxTest.cpp +++ b/tests/cpp-tests/Classes/ParallaxTest/ParallaxTest.cpp @@ -68,7 +68,7 @@ Parallax1::Parallax1() auto goDown = goUp->reverse(); auto go = MoveBy::create(8, Vec2(-1000,0) ); auto goBack = go->reverse(); - auto seq = Sequence::create(goUp, go, goDown, goBack, NULL); + auto seq = Sequence::create(goUp, go, goDown, goBack, nullptr); voidNode->runAction( (RepeatForever::create(seq) )); addChild( voidNode ); @@ -247,7 +247,7 @@ Layer* createParallaxTestLayer(int nIndex) case 2: return new Issue2572(); } - return NULL; + return nullptr; } Layer* nextParallaxAction() diff --git a/tests/cpp-tests/Classes/ParticleTest/ParticleTest.cpp b/tests/cpp-tests/Classes/ParticleTest/ParticleTest.cpp index e78a9b133b..5f3beb9d31 100644 --- a/tests/cpp-tests/Classes/ParticleTest/ParticleTest.cpp +++ b/tests/cpp-tests/Classes/ParticleTest/ParticleTest.cpp @@ -588,7 +588,7 @@ void ParallaxParticle::onEnter() ParticleDemo::onEnter(); _background->getParent()->removeChild(_background, true); - _background = NULL; + _background = nullptr; auto p = ParallaxNode::create(); addChild(p, 5); @@ -612,7 +612,7 @@ void ParallaxParticle::onEnter() auto move = MoveBy::create(4, Vec2(300,0)); auto move_back = move->reverse(); - auto seq = Sequence::create( move, move_back, NULL); + auto seq = Sequence::create( move, move_back, nullptr); p->runAction(RepeatForever::create(seq)); } @@ -632,7 +632,7 @@ void RadiusMode1::onEnter() _color->setColor(Color3B::BLACK); removeChild(_background, true); - _background = NULL; + _background = nullptr; _emitter = ParticleSystemQuad::createWithTotalParticles(200); _emitter->retain(); @@ -716,7 +716,7 @@ void RadiusMode2::onEnter() _color->setColor(Color3B::BLACK); removeChild(_background, true); - _background = NULL; + _background = nullptr; _emitter = ParticleSystemQuad::createWithTotalParticles(200); _emitter->retain(); @@ -800,7 +800,7 @@ void Issue704::onEnter() _color->setColor(Color3B::BLACK); removeChild(_background, true); - _background = NULL; + _background = nullptr; _emitter = ParticleSystemQuad::createWithTotalParticles(100); _emitter->retain(); @@ -892,7 +892,7 @@ void Issue870::onEnter() _color->setColor(Color3B::BLACK); removeChild(_background, true); - _background = NULL; + _background = nullptr; _emitter = ParticleSystemQuad::create("Particles/SpinningPeas.plist"); _emitter->setTextureWithRect(Director::getInstance()->getTextureCache()->addImage("Images/particles.png"), Rect(0,0,32,32)); @@ -932,7 +932,7 @@ void DemoParticleFromFile::onEnter() _color->setColor(Color3B::BLACK); removeChild(_background, true); - _background = NULL; + _background = nullptr; std::string filename = "Particles/" + _title + ".plist"; _emitter = ParticleSystemQuad::create(filename); @@ -1016,7 +1016,7 @@ Layer* createParticleLayer(int nIndex) break; } - return NULL; + return nullptr; } #define MAX_LAYER 49 @@ -1065,7 +1065,7 @@ void ParticleDemo::onEnter(void) _color = LayerColor::create( Color4B(127,127,127,255) ); this->addChild(_color); - _emitter = NULL; + _emitter = nullptr; auto listener = EventListenerTouchAllAtOnce::create(); listener->onTouchesBegan = CC_CALLBACK_2(ParticleDemo::onTouchesBegan, this); @@ -1079,9 +1079,9 @@ void ParticleDemo::onEnter(void) MenuItemFont::create( "Free Movement" ), MenuItemFont::create( "Relative Movement" ), MenuItemFont::create( "Grouped Movement" ), - NULL ); + nullptr ); - auto menu = Menu::create(item4, NULL); + auto menu = Menu::create(item4, nullptr); menu->setPosition( Vec2::ZERO ); item4->setPosition( Vec2( VisibleRect::left().x, VisibleRect::bottom().y+ 100) ); @@ -1100,7 +1100,7 @@ void ParticleDemo::onEnter(void) auto move = MoveBy::create(4, Vec2(300,0) ); auto move_back = move->reverse(); - auto seq = Sequence::create( move, move_back, NULL); + auto seq = Sequence::create( move, move_back, nullptr); _background->runAction( RepeatForever::create(seq) ); @@ -1139,7 +1139,7 @@ void ParticleDemo::onTouchesEnded(const std::vector& touches, Event *ev pos = _background->convertToWorldSpace(Vec2::ZERO); } - if (_emitter != NULL) + if (_emitter != nullptr) { _emitter->setPosition(location -pos); } @@ -1158,7 +1158,7 @@ void ParticleDemo::update(float dt) void ParticleDemo::toggleCallback(Ref* sender) { - if (_emitter != NULL) + if (_emitter != nullptr) { if (_emitter->getPositionType() == ParticleSystem::PositionType::GROUPED) _emitter->setPositionType(ParticleSystem::PositionType::FREE); @@ -1171,7 +1171,7 @@ void ParticleDemo::toggleCallback(Ref* sender) void ParticleDemo::restartCallback(Ref* sender) { - if (_emitter != NULL) + if (_emitter != nullptr) { _emitter->resetSystem(); } @@ -1196,7 +1196,7 @@ void ParticleDemo::backCallback(Ref* sender) void ParticleDemo::setEmitterPosition() { auto s = Director::getInstance()->getWinSize(); - if (_emitter != NULL) + if (_emitter != nullptr) { _emitter->setPosition( Vec2(s.width / 2, s.height / 2) ); } @@ -1210,7 +1210,7 @@ void ParticleBatchHybrid::onEnter() _color->setColor(Color3B::BLACK); removeChild(_background, true); - _background = NULL; + _background = nullptr; _emitter = ParticleSystemQuad::create("Particles/LavaFlow.plist"); _emitter->retain(); @@ -1231,7 +1231,7 @@ void ParticleBatchHybrid::onEnter() void ParticleBatchHybrid::switchRender(float dt) { - bool usingBatch = ( _emitter->getBatchNode() != NULL ); + bool usingBatch = ( _emitter->getBatchNode() != nullptr ); _emitter->removeFromParentAndCleanup(false); auto newParent = (usingBatch ? _parent2 : _parent1 ); @@ -1258,7 +1258,7 @@ void ParticleBatchMultipleEmitters::onEnter() _color->setColor(Color3B::BLACK); removeChild(_background, true); - _background = NULL; + _background = nullptr; auto emitter1 = ParticleSystemQuad::create("Particles/LavaFlow.plist"); emitter1->setStartColor(Color4F(1,0,0,1)); @@ -1301,7 +1301,7 @@ void ParticleReorder::onEnter() _order = 0; _color->setColor(Color3B::BLACK); removeChild(_background, true); - _background = NULL; + _background = nullptr; auto ignore = ParticleSystemQuad::create("Particles/SmallSun.plist"); auto parent1 = Node::create(); @@ -1471,7 +1471,7 @@ void Issue1201::onEnter() _color->setColor(Color3B::BLACK); removeChild(_background, true); - _background = NULL; + _background = nullptr; RainbowEffect *particle = new RainbowEffect(); particle->initWithTotalParticles(50); @@ -1501,7 +1501,7 @@ void MultipleParticleSystems::onEnter() _color->setColor(Color3B::BLACK); removeChild(_background, true); - _background = NULL; + _background = nullptr; Director::getInstance()->getTextureCache()->addImage("Images/particles.png"); @@ -1514,7 +1514,7 @@ void MultipleParticleSystems::onEnter() addChild(particleSystem); } - _emitter = NULL; + _emitter = nullptr; } @@ -1536,7 +1536,7 @@ void MultipleParticleSystems::update(float dt) for(const auto &child : _children) { auto item = dynamic_cast(child); - if (item != NULL) + if (item != nullptr) { count += item->getParticleCount(); } @@ -1555,7 +1555,7 @@ void MultipleParticleSystemsBatched::onEnter() _color->setColor(Color3B::BLACK); removeChild(_background, true); - _background = NULL; + _background = nullptr; ParticleBatchNode *batchNode = ParticleBatchNode::createWithTexture(nullptr, 3000); @@ -1572,7 +1572,7 @@ void MultipleParticleSystemsBatched::onEnter() batchNode->addChild(particleSystem); } - _emitter = NULL; + _emitter = nullptr; } void MultipleParticleSystemsBatched::update(float dt) @@ -1584,7 +1584,7 @@ void MultipleParticleSystemsBatched::update(float dt) auto batchNode = getChildByTag(2); for(const auto &child : batchNode->getChildren()) { auto item = dynamic_cast(child); - if (item != NULL) + if (item != nullptr) { count += item->getParticleCount(); } @@ -1613,10 +1613,10 @@ void AddAndDeleteParticleSystems::onEnter() _color->setColor(Color3B::BLACK); removeChild(_background, true); - _background = NULL; + _background = nullptr; //adds the texture inside the plist to the texture cache - _batchNode = ParticleBatchNode::createWithTexture((Texture2D*)NULL, 16000); + _batchNode = ParticleBatchNode::createWithTexture((Texture2D*)nullptr, 16000); addChild(_batchNode, 1, 2); @@ -1636,7 +1636,7 @@ void AddAndDeleteParticleSystems::onEnter() } schedule(schedule_selector(AddAndDeleteParticleSystems::removeSystem), 0.5f); - _emitter = NULL; + _emitter = nullptr; } @@ -1672,7 +1672,7 @@ void AddAndDeleteParticleSystems::update(float dt) auto batchNode = getChildByTag(2); for(const auto &child : batchNode->getChildren()) { auto item = dynamic_cast(child); - if (item != NULL) + if (item != nullptr) { count += item->getParticleCount(); } @@ -1701,7 +1701,7 @@ void ReorderParticleSystems::onEnter() _color->setColor(Color3B::BLACK); removeChild(_background ,true); - _background = NULL; + _background = nullptr; _batchNode = ParticleBatchNode::create("Images/stars-grayscale.png" ,3000); @@ -1787,7 +1787,7 @@ void ReorderParticleSystems::onEnter() } schedule(schedule_selector(ReorderParticleSystems::reorderSystem), 2.0f); - _emitter = NULL; + _emitter = nullptr; } @@ -1859,7 +1859,7 @@ void PremultipliedAlphaTest::onEnter() _color->setColor(Color3B::BLUE); this->removeChild(_background, true); - _background = NULL; + _background = nullptr; _emitter = ParticleSystemQuad::create("Particles/BoilingFoam.plist"); _emitter->retain(); @@ -1893,7 +1893,7 @@ void PremultipliedAlphaTest2::onEnter() _color->setColor(Color3B::BLACK); this->removeChild(_background, true); - _background = NULL; + _background = nullptr; _emitter = ParticleSystemQuad::create("Particles/TestPremultipliedAlpha.plist"); _emitter->retain(); @@ -1919,7 +1919,7 @@ void Issue3990::onEnter() _color->setColor(Color3B::BLACK); this->removeChild(_background, true); - _background = NULL; + _background = nullptr; _emitter = ParticleSystemQuad::create("Particles/Spiral.plist"); @@ -1983,7 +1983,7 @@ void ParticleAutoBatching::onEnter() _color->setColor(Color3B::BLACK); this->removeChild(_background, true); - _background = NULL; + _background = nullptr; Size s = Director::getInstance()->getWinSize(); diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceAllocTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceAllocTest.cpp index b7ba926f88..141f7c9c33 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceAllocTest.cpp +++ b/tests/cpp-tests/Classes/PerformanceTest/PerformanceAllocTest.cpp @@ -137,7 +137,7 @@ void PerformceAllocScene::initWithQuantityOfNodes(unsigned int nNodes) }); increase->setColor(Color3B(0,200,20)); - auto menu = Menu::create(decrease, increase, NULL); + auto menu = Menu::create(decrease, increase, nullptr); menu->alignItemsHorizontally(); menu->setPosition(Vec2(s.width/2, s.height/2+15)); addChild(menu, 1); diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceContainerTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceContainerTest.cpp index b56c156732..fd5ddf10a2 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceContainerTest.cpp +++ b/tests/cpp-tests/Classes/PerformanceTest/PerformanceContainerTest.cpp @@ -142,7 +142,7 @@ void PerformanceContainerScene::initWithQuantityOfNodes(unsigned int nNodes) increase->setColor(Color3B(0,200,20)); _increase = increase; - auto menu = Menu::create(decrease, increase, NULL); + auto menu = Menu::create(decrease, increase, nullptr); menu->alignItemsHorizontally(); menu->setPosition(Vec2(s.width/2, s.height/2+15)); addChild(menu, 1); @@ -223,7 +223,7 @@ void PerformanceContainerScene::initWithQuantityOfNodes(unsigned int nNodes) stop->setPosition(VisibleRect::right() + Vec2(0, -40)); _stopItem = stop; - auto menu2 = Menu::create(toggle, start, stop, NULL); + auto menu2 = Menu::create(toggle, start, stop, nullptr); menu2->setPosition(Vec2::ZERO); addChild(menu2); diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceEventDispatcherTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceEventDispatcherTest.cpp index 3eb36c686f..f786ba12ad 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceEventDispatcherTest.cpp +++ b/tests/cpp-tests/Classes/PerformanceTest/PerformanceEventDispatcherTest.cpp @@ -140,7 +140,7 @@ void PerformanceEventDispatcherScene::initWithQuantityOfNodes(unsigned int nNode increase->setColor(Color3B(0,200,20)); _increase = increase; - auto menu = Menu::create(decrease, increase, NULL); + auto menu = Menu::create(decrease, increase, nullptr); menu->alignItemsHorizontally(); menu->setPosition(Vec2(s.width/2, s.height/2+15)); addChild(menu, 1); @@ -240,7 +240,7 @@ void PerformanceEventDispatcherScene::initWithQuantityOfNodes(unsigned int nNode stop->setPosition(VisibleRect::right() + Vec2(0, -40)); _stopItem = stop; - auto menu2 = Menu::create(toggle, start, stop, NULL); + auto menu2 = Menu::create(toggle, start, stop, nullptr); menu2->setPosition(Vec2::ZERO); addChild(menu2); diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceLabelTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceLabelTest.cpp index a384b31d2f..0948b6ccfa 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceLabelTest.cpp +++ b/tests/cpp-tests/Classes/PerformanceTest/PerformanceLabelTest.cpp @@ -97,7 +97,7 @@ void LabelMainScene::initWithSubTest(int nodes) auto increase = MenuItemFont::create(" + ", CC_CALLBACK_1(LabelMainScene::onIncrease, this)); increase->setColor(Color3B(0,200,20)); - auto menu = Menu::create(decrease, increase, NULL); + auto menu = Menu::create(decrease, increase, nullptr); menu->alignItemsHorizontally(); menu->setPosition(Vec2(s.width/2, s.height-65)); addChild(menu, 1); @@ -121,7 +121,7 @@ void LabelMainScene::initWithSubTest(int nodes) MenuItemFont::setFontName("fonts/arial.ttf"); MenuItemFont::setFontSize(24); - MenuItemFont* autoTestItem = NULL; + MenuItemFont* autoTestItem = nullptr; if (LabelMainScene::_s_autoTest) { autoTestItem = MenuItemFont::create("Auto Test On",CC_CALLBACK_1(LabelMainScene::onAutoTest, this)); diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp index f7835b201c..d715fc8b9a 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp +++ b/tests/cpp-tests/Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp @@ -166,7 +166,7 @@ void NodeChildrenMainScene::initWithQuantityOfNodes(unsigned int nNodes) }); increase->setColor(Color3B(0,200,20)); - auto menu = Menu::create(decrease, increase, NULL); + auto menu = Menu::create(decrease, increase, nullptr); menu->alignItemsHorizontally(); menu->setPosition(Vec2(s.width/2, s.height/2+15)); addChild(menu, 1); diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceParticleTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceParticleTest.cpp index b001e31f5d..7f43d0ae6e 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceParticleTest.cpp +++ b/tests/cpp-tests/Classes/PerformanceTest/PerformanceParticleTest.cpp @@ -35,7 +35,7 @@ void ParticleMenuLayer::showCurrentTest() int subTest = scene->getSubTestNum(); int parNum = scene->getParticlesNum(); - ParticleMainScene* pNewScene = NULL; + ParticleMainScene* pNewScene = nullptr; switch (_curCase) { @@ -98,7 +98,7 @@ void ParticleMainScene::initWithSubTest(int asubtest, int particles) }); increase->setColor(Color3B(0,200,20)); - auto menu = Menu::create(decrease, increase, NULL); + auto menu = Menu::create(decrease, increase, nullptr); menu->alignItemsHorizontally(); menu->setPosition(Vec2(s.width/2, s.height/2+15)); addChild(menu, 1); @@ -234,7 +234,7 @@ void ParticleMainScene::createParticleSystem() // particleSystem->setTexture(Director::getInstance()->getTextureCache()->addImage("Images/fire.png")); // break; default: - particleSystem = NULL; + particleSystem = nullptr; CCLOG("Shall not happen!"); break; } diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceScenarioTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceScenarioTest.cpp index 0fdeac4065..d26defbd55 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceScenarioTest.cpp +++ b/tests/cpp-tests/Classes/PerformanceTest/PerformanceScenarioTest.cpp @@ -15,7 +15,7 @@ static int s_nScenarioCurCase = 0; //////////////////////////////////////////////////////// void ScenarioMenuLayer::showCurrentTest() { - Scene* scene = NULL; + Scene* scene = nullptr; switch (_curCase) { @@ -105,7 +105,7 @@ void ScenarioTest::performTests() MenuItemFont::create( "Add/Remove Sprite" ), MenuItemFont::create( "Add/Remove Particle"), MenuItemFont::create( "Add/Remove Particle System"), - NULL); + nullptr); _itemToggle->setAnchorPoint(Vec2(0.0f, 0.5f)); _itemToggle->setPosition(Vec2(origin.x, origin.y + s.height / 2)); @@ -148,7 +148,7 @@ void ScenarioTest::performTests() increase->setColor(Color3B(0,200,20)); increase->setPosition(Vec2(origin.x + s.width / 2 + 80, origin.y + 80)); - auto menu = Menu::create(_itemToggle, decrease, increase, NULL); + auto menu = Menu::create(_itemToggle, decrease, increase, nullptr); menu->setPosition(Vec2(0.0f, 0.0f)); addChild(menu, 10); @@ -252,7 +252,7 @@ void ScenarioTest::addNewSprites(int num) else action = FadeOut::create(2); auto action_back = action->reverse(); - auto seq = Sequence::create( action, action_back, NULL ); + auto seq = Sequence::create( action, action_back, nullptr ); sprite->runAction( RepeatForever::create(seq) ); diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceSpriteTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceSpriteTest.cpp index 8625056b41..51194ee6a0 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceSpriteTest.cpp +++ b/tests/cpp-tests/Classes/PerformanceTest/PerformanceSpriteTest.cpp @@ -146,7 +146,7 @@ Sprite* SubTest::createSpriteWithTag(int tag) { TextureCache *cache = Director::getInstance()->getTextureCache(); - Sprite* sprite = NULL; + Sprite* sprite = nullptr; switch (subtestNumber) { /// @@ -319,7 +319,7 @@ void SpriteMenuLayer::backCallback(Ref* sender) void SpriteMenuLayer::showCurrentTest() { - SpriteMainScene* scene = NULL; + SpriteMainScene* scene = nullptr; auto pPreScene = (SpriteMainScene*) getParent(); int nSubTest = pPreScene->getSubTestNum(); int nNodes = pPreScene->getNodesNum(); @@ -386,7 +386,7 @@ void SpriteMainScene::initWithSubTest(int asubtest, int nNodes) auto increase = MenuItemFont::create(" + ", CC_CALLBACK_1(SpriteMainScene::onIncrease, this)); increase->setColor(Color3B(0,200,20)); - auto menu = Menu::create(decrease, increase, NULL); + auto menu = Menu::create(decrease, increase, nullptr); menu->alignItemsHorizontally(); menu->setPosition(Vec2(s.width/2, s.height-65)); addChild(menu, 1); @@ -410,7 +410,7 @@ void SpriteMainScene::initWithSubTest(int asubtest, int nNodes) MenuItemFont::setFontName("fonts/arial.ttf"); MenuItemFont::setFontSize(24); - MenuItemFont* autoTestItem = NULL; + MenuItemFont* autoTestItem = nullptr; if (SpriteMainScene::_s_autoTest) { autoTestItem = MenuItemFont::create("Auto Test On",CC_CALLBACK_1(SpriteMainScene::onAutoTest, this)); @@ -484,7 +484,7 @@ SpriteMainScene::~SpriteMainScene() if (_subTest) { delete _subTest; - _subTest = NULL; + _subTest = nullptr; } } @@ -617,7 +617,7 @@ void SpriteMainScene::onExit() void SpriteMainScene::autoShowSpriteTests(int curCase, int subTest,int nodes) { - SpriteMainScene* scene = NULL; + SpriteMainScene* scene = nullptr; switch (curCase) { @@ -760,12 +760,12 @@ void performanceActions(Sprite* sprite) float period = 0.5f + (rand() % 1000) / 500.0f; auto rot = RotateBy::create(period, 360.0f * CCRANDOM_0_1()); auto rot_back = rot->reverse(); - auto permanentRotation = RepeatForever::create(Sequence::create(rot, rot_back, NULL)); + auto permanentRotation = RepeatForever::create(Sequence::create(rot, rot_back, nullptr)); sprite->runAction(permanentRotation); float growDuration = 0.5f + (rand() % 1000) / 500.0f; auto grow = ScaleBy::create(growDuration, 0.5f, 0.5f); - auto permanentScaleLoop = RepeatForever::create(Sequence::create(grow, grow->reverse(), NULL)); + auto permanentScaleLoop = RepeatForever::create(Sequence::create(grow, grow->reverse(), nullptr)); sprite->runAction(permanentScaleLoop); } @@ -780,7 +780,7 @@ void performanceActions20(Sprite* sprite) float period = 0.5f + (rand() % 1000) / 500.0f; auto rot = RotateBy::create(period, 360.0f * CCRANDOM_0_1()); auto rot_back = rot->reverse(); - auto permanentRotation = RepeatForever::create(Sequence::create(rot, rot_back, NULL)); + auto permanentRotation = RepeatForever::create(Sequence::create(rot, rot_back, nullptr)); sprite->runAction(permanentRotation); float growDuration = 0.5f + (rand() % 1000) / 500.0f; diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceTest.cpp index 745be44c23..e86037c4dd 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceTest.cpp +++ b/tests/cpp-tests/Classes/PerformanceTest/PerformanceTest.cpp @@ -155,7 +155,7 @@ void PerformBasicLayer::onEnter() MenuItemFont::setFontSize(24); auto pMainItem = MenuItemFont::create("Back", CC_CALLBACK_1(PerformBasicLayer::toMainLayer, this)); pMainItem->setPosition(Vec2(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25)); - auto menu = Menu::create(pMainItem, NULL); + auto menu = Menu::create(pMainItem, nullptr); menu->setPosition( Vec2::ZERO ); if (_controlMenuVisible) diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceTextureTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceTextureTest.cpp index fe02765945..13ea612adc 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceTextureTest.cpp +++ b/tests/cpp-tests/Classes/PerformanceTest/PerformanceTextureTest.cpp @@ -11,7 +11,7 @@ float calculateDeltaTime( struct timeval *lastUpdate ) { struct timeval now; - gettimeofday( &now, NULL); + gettimeofday( &now, nullptr); float dt = (now.tv_sec - lastUpdate->tv_sec) + (now.tv_usec - lastUpdate->tv_usec) / 1000000.0f; @@ -25,7 +25,7 @@ float calculateDeltaTime( struct timeval *lastUpdate ) //////////////////////////////////////////////////////// void TextureMenuLayer::showCurrentTest() { - Scene* scene = NULL; + Scene* scene = nullptr; switch (_curCase) { @@ -89,7 +89,7 @@ void TextureTest::performTestsPNG(const char* filename) log("RGBA 8888"); Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGBA8888); - gettimeofday(&now, NULL); + gettimeofday(&now, nullptr); texture = cache->addImage(filename); if( texture ) log(" ms:%f", calculateDeltaTime(&now) ); @@ -99,7 +99,7 @@ void TextureTest::performTestsPNG(const char* filename) log("RGBA 4444"); Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGBA4444); - gettimeofday(&now, NULL); + gettimeofday(&now, nullptr); texture = cache->addImage(filename); if( texture ) log(" ms:%f", calculateDeltaTime(&now) ); @@ -109,7 +109,7 @@ void TextureTest::performTestsPNG(const char* filename) log("RGBA 5551"); Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGB5A1); - gettimeofday(&now, NULL); + gettimeofday(&now, nullptr); texture = cache->addImage(filename); if( texture ) log(" ms:%f", calculateDeltaTime(&now) ); @@ -119,7 +119,7 @@ void TextureTest::performTestsPNG(const char* filename) log("RGB 565"); Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGB565); - gettimeofday(&now, NULL); + gettimeofday(&now, nullptr); texture = cache->addImage(filename); if( texture ) log(" ms:%f", calculateDeltaTime(&now) ); @@ -143,7 +143,7 @@ void TextureTest::performTests() // log("--- PVR 128x128 ---"); // log("RGBA 8888"); -// gettimeofday(&now, NULL); +// gettimeofday(&now, nullptr); // texture = cache->addImage("Images/test_image_rgba8888.pvr"); // if( texture ) // log(" ms:%f", calculateDeltaTime(&now) ); @@ -152,7 +152,7 @@ void TextureTest::performTests() // cache->removeTexture(texture); // // log("BGRA 8888"); -// gettimeofday(&now, NULL); +// gettimeofday(&now, nullptr); // texture = cache->addImage("Images/test_image_bgra8888.pvr"); // if( texture ) // log(" ms:%f", calculateDeltaTime(&now) ); @@ -161,7 +161,7 @@ void TextureTest::performTests() // cache->removeTexture(texture); // // log("RGBA 4444"); -// gettimeofday(&now, NULL); +// gettimeofday(&now, nullptr); // texture = cache->addImage("Images/test_image_rgba4444.pvr"); // if( texture ) // log(" ms:%f", calculateDeltaTime(&now) ); @@ -170,7 +170,7 @@ void TextureTest::performTests() // cache->removeTexture(texture); // // log("RGB 565"); -// gettimeofday(&now, NULL); +// gettimeofday(&now, nullptr); // texture = cache->addImage("Images/test_image_rgb565.pvr"); // if( texture ) // log(" ms:%f", calculateDeltaTime(&now) ); @@ -184,7 +184,7 @@ void TextureTest::performTests() // log("--- PVR 512x512 ---"); // log("RGBA 4444"); -// gettimeofday(&now, NULL); +// gettimeofday(&now, nullptr); // texture = cache->addImage("Images/texture512x512_rgba4444.pvr"); // if( texture ) // log(" ms:%f", calculateDeltaTime(&now) ); @@ -204,7 +204,7 @@ void TextureTest::performTests() // log("--- PVR 1024x1024 ---"); // log("RGBA 4444"); -// gettimeofday(&now, NULL); +// gettimeofday(&now, nullptr); // texture = cache->addImage("Images/texture1024x1024_rgba4444.pvr"); // if( texture ) // log(" ms:%f", calculateDeltaTime(&now) ); @@ -214,7 +214,7 @@ void TextureTest::performTests() // // log("--- PVR.GZ 1024x1024 ---"); // log("RGBA 4444"); -// gettimeofday(&now, NULL); +// gettimeofday(&now, nullptr); // texture = cache->addImage("Images/texture1024x1024_rgba4444.pvr.gz"); // if( texture ) // log(" ms:%f", calculateDeltaTime(&now) ); @@ -224,7 +224,7 @@ void TextureTest::performTests() // // log("--- PVR.CCZ 1024x1024 ---"); // log("RGBA 4444"); -// gettimeofday(&now, NULL); +// gettimeofday(&now, nullptr); // texture = cache->addImage("Images/texture1024x1024_rgba4444.pvr.ccz"); // if( texture ) // log(" ms:%f", calculateDeltaTime(&now) ); @@ -244,7 +244,7 @@ void TextureTest::performTests() // log("--- PVR 1024x1024 ---"); // log("RGBA 4444"); -// gettimeofday(&now, NULL); +// gettimeofday(&now, nullptr); // texture = cache->addImage("Images/PlanetCute-1024x1024-rgba4444.pvr"); // if( texture ) // log(" ms:%f", calculateDeltaTime(&now) ); @@ -254,7 +254,7 @@ void TextureTest::performTests() // // log("--- PVR.GZ 1024x1024 ---"); // log("RGBA 4444"); -// gettimeofday(&now, NULL); +// gettimeofday(&now, nullptr); // texture = cache->addImage("Images/PlanetCute-1024x1024-rgba4444.pvr.gz"); // if( texture ) // log(" ms:%f", calculateDeltaTime(&now) ); @@ -264,7 +264,7 @@ void TextureTest::performTests() // // log("--- PVR.CCZ 1024x1024 ---"); // log("RGBA 4444"); -// gettimeofday(&now, NULL); +// gettimeofday(&now, nullptr); // texture = cache->addImage("Images/PlanetCute-1024x1024-rgba4444.pvr.ccz"); // if( texture ) // log(" ms:%f", calculateDeltaTime(&now) ); @@ -286,7 +286,7 @@ void TextureTest::performTests() // log("--- PVR 1024x1024 ---"); // log("RGBA 8888"); -// gettimeofday(&now, NULL); +// gettimeofday(&now, nullptr); // texture = cache->addImage("Images/landscape-1024x1024-rgba8888.pvr"); // if( texture ) // log(" ms:%f", calculateDeltaTime(&now) ); @@ -296,7 +296,7 @@ void TextureTest::performTests() // // log("--- PVR.GZ 1024x1024 ---"); // log("RGBA 8888"); -// gettimeofday(&now, NULL); +// gettimeofday(&now, nullptr); // texture = cache->addImage("Images/landscape-1024x1024-rgba8888.pvr.gz"); // if( texture ) // log(" ms:%f", calculateDeltaTime(&now) ); @@ -306,7 +306,7 @@ void TextureTest::performTests() // // log("--- PVR.CCZ 1024x1024 ---"); // log("RGBA 8888"); -// gettimeofday(&now, NULL); +// gettimeofday(&now, nullptr); // texture = cache->addImage("Images/landscape-1024x1024-rgba8888.pvr.ccz"); // if( texture ) // log(" ms:%f", calculateDeltaTime(&now) ); @@ -326,7 +326,7 @@ void TextureTest::performTests() // log("--- PVR 2048x2048 ---"); // log("RGBA 4444"); -// gettimeofday(&now, NULL); +// gettimeofday(&now, nullptr); // texture = cache->addImage("Images/texture2048x2048_rgba4444.pvr"); // if( texture ) // log(" ms:%f", calculateDeltaTime(&now) ); diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceTouchesTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceTouchesTest.cpp index cb3f16091b..e510dcc78e 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceTouchesTest.cpp +++ b/tests/cpp-tests/Classes/PerformanceTest/PerformanceTouchesTest.cpp @@ -41,7 +41,7 @@ static int s_nTouchCurCase = 0; //////////////////////////////////////////////////////// void TouchesMainScene::showCurrentTest() { - Layer* layer = NULL; + Layer* layer = nullptr; switch (_curCase) { case 0: @@ -283,7 +283,7 @@ void TouchesPerformTest3::onEnter() }); menuItem->setPosition(Vec2(0, -20)); - auto menu = Menu::create(menuItem, NULL); + auto menu = Menu::create(menuItem, nullptr); addChild(menu); } @@ -294,7 +294,7 @@ std::string TouchesPerformTest3::title() const void TouchesPerformTest3::showCurrentTest() { - Layer* layer = NULL; + Layer* layer = nullptr; switch (_curCase) { case 0: diff --git a/tests/cpp-tests/Classes/PhysicsTest/PhysicsTest.cpp b/tests/cpp-tests/Classes/PhysicsTest/PhysicsTest.cpp index 926d5a1ccb..5826130538 100644 --- a/tests/cpp-tests/Classes/PhysicsTest/PhysicsTest.cpp +++ b/tests/cpp-tests/Classes/PhysicsTest/PhysicsTest.cpp @@ -156,7 +156,7 @@ void PhysicsDemo::onEnter() MenuItemFont::setFontSize(18); auto item = MenuItemFont::create("Toggle debug", CC_CALLBACK_1(PhysicsDemo::toggleDebugCallback, this)); - auto menu = Menu::create(item, NULL); + auto menu = Menu::create(item, nullptr); this->addChild(menu); menu->setPosition(Vec2(VisibleRect::right().x-50, VisibleRect::top().y-10)); } @@ -552,7 +552,7 @@ void PhysicsDemoRayCast::onEnter() MenuItemFont::setFontSize(18); auto item = MenuItemFont::create("Change Mode(any)", CC_CALLBACK_1(PhysicsDemoRayCast::changeModeCallback, this)); - auto menu = Menu::create(item, NULL); + auto menu = Menu::create(item, nullptr); this->addChild(menu); menu->setPosition(Vec2(VisibleRect::left().x+100, VisibleRect::top().y-10)); @@ -950,9 +950,9 @@ void PhysicsDemoActions::onEnter() auto rotateByBack = RotateBy::create(2, -180); sp1->runAction(RepeatForever::create(actionUp)); - sp2->runAction(RepeatForever::create(Sequence::create(actionBy, actionByBack, NULL))); + sp2->runAction(RepeatForever::create(Sequence::create(actionBy, actionByBack, nullptr))); sp3->runAction(actionTo); - sp4->runAction(RepeatForever::create(Sequence::create(rotateBy, rotateByBack, NULL))); + sp4->runAction(RepeatForever::create(Sequence::create(rotateBy, rotateByBack, nullptr))); } std::string PhysicsDemoActions::title() const @@ -1315,7 +1315,7 @@ void PhysicsContactTest::onEnter() decrease1->setTag(1); increase1->setTag(1); - auto menu1 = Menu::create(decrease1, increase1, NULL); + auto menu1 = Menu::create(decrease1, increase1, nullptr); menu1->alignItemsHorizontally(); menu1->setPosition(Vec2(s.width/2, s.height-50)); addChild(menu1, 1); @@ -1331,7 +1331,7 @@ void PhysicsContactTest::onEnter() decrease2->setTag(2); increase2->setTag(2); - auto menu2 = Menu::create(decrease2, increase2, NULL); + auto menu2 = Menu::create(decrease2, increase2, nullptr); menu2->alignItemsHorizontally(); menu2->setPosition(Vec2(s.width/2, s.height-90)); addChild(menu2, 1); @@ -1347,7 +1347,7 @@ void PhysicsContactTest::onEnter() decrease3->setTag(3); increase3->setTag(3); - auto menu3 = Menu::create(decrease3, increase3, NULL); + auto menu3 = Menu::create(decrease3, increase3, nullptr); menu3->alignItemsHorizontally(); menu3->setPosition(Vec2(s.width/2, s.height-130)); addChild(menu3, 1); @@ -1363,7 +1363,7 @@ void PhysicsContactTest::onEnter() decrease4->setTag(4); increase4->setTag(4); - auto menu4 = Menu::create(decrease4, increase4, NULL); + auto menu4 = Menu::create(decrease4, increase4, nullptr); menu4->alignItemsHorizontally(); menu4->setPosition(Vec2(s.width/2, s.height-170)); addChild(menu4, 1); @@ -1794,13 +1794,13 @@ void PhysicsTransformTest::onEnter() this->addChild(bullet); - MoveBy* move = MoveBy::create(2.0, Vec2(100, 100)); - MoveBy* move2 = MoveBy::create(2.0, Vec2(-200, 0)); - MoveBy* move3 = MoveBy::create(2.0, Vec2(100, -100)); - ScaleTo* scale = ScaleTo::create(3.0, 0.3); - ScaleTo* scale2 = ScaleTo::create(3.0, 1.0); + 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)); + ScaleTo* scale = ScaleTo::create(3.0f, 0.3f); + ScaleTo* scale2 = ScaleTo::create(3.0f, 1.0f); - RotateBy* rotate = RotateBy::create(6.0, 360); + RotateBy* rotate = RotateBy::create(6.0f, 360); this->runAction(RepeatForever::create(Sequence::create(move, move2, move3, nullptr))); this->runAction(RepeatForever::create(Sequence::create(scale, scale2, nullptr))); diff --git a/tests/cpp-tests/Classes/RenderTextureTest/RenderTextureTest.cpp b/tests/cpp-tests/Classes/RenderTextureTest/RenderTextureTest.cpp index 406514ff4b..334d578b79 100644 --- a/tests/cpp-tests/Classes/RenderTextureTest/RenderTextureTest.cpp +++ b/tests/cpp-tests/Classes/RenderTextureTest/RenderTextureTest.cpp @@ -108,7 +108,7 @@ RenderTextureSave::RenderTextureSave() MenuItemFont::setFontSize(16); auto item1 = MenuItemFont::create("Save Image", CC_CALLBACK_1(RenderTextureSave::saveImage, this)); auto item2 = MenuItemFont::create("Clear", CC_CALLBACK_1(RenderTextureSave::clearImage, this)); - auto menu = Menu::create(item1, item2, NULL); + auto menu = Menu::create(item1, item2, nullptr); this->addChild(menu); menu->alignItemsVertically(); menu->setPosition(Vec2(VisibleRect::rightTop().x - 80, VisibleRect::rightTop().y - 30)); @@ -151,7 +151,7 @@ void RenderTextureSave::saveImage(cocos2d::Ref *sender) sprite->setPosition(Vec2(40, 40)); sprite->setRotation(counter * 3); }; - runAction(Sequence::create(action1, CallFunc::create(func), NULL)); + runAction(Sequence::create(action1, CallFunc::create(func), nullptr)); CCLOG("Image saved %s and %s", png, jpg); @@ -239,7 +239,7 @@ RenderTextureIssue937::RenderTextureIssue937() /* A2 & B2 setup */ auto rend = RenderTexture::create(32, 64, Texture2D::PixelFormat::RGBA8888); - if (NULL == rend) + if (nullptr == rend) { return; } @@ -404,7 +404,7 @@ void RenderTextureZbuffer::onTouchesEnded(const std::vector& touches, Ev void RenderTextureZbuffer::renderScreenShot() { auto texture = RenderTexture::create(512, 512); - if (NULL == texture) + if (nullptr == texture) { return; } @@ -425,7 +425,7 @@ void RenderTextureZbuffer::renderScreenShot() sprite->runAction(Sequence::create(FadeTo::create(2, 0), Hide::create(), - NULL)); + nullptr)); } RenderTexturePartTest::RenderTexturePartTest() @@ -465,7 +465,7 @@ RenderTexturePartTest::RenderTexturePartTest() _spriteDraw->setPosition(0,size.height/2); _spriteDraw->setScaleY(-1); _spriteDraw->runAction(RepeatForever::create(Sequence::create - (baseAction,baseAction->reverse(), NULL))); + (baseAction,baseAction->reverse(), nullptr))); addChild(_spriteDraw); } @@ -623,7 +623,7 @@ RenderTextureTargetNode::RenderTextureTargetNode() // Toggle clear on / off auto item = MenuItemFont::create("Clear On/Off", CC_CALLBACK_1(RenderTextureTargetNode::touched, this)); - auto menu = Menu::create(item, NULL); + auto menu = Menu::create(item, nullptr); addChild(menu); menu->setPosition(Vec2(s.width/2, s.height/2)); @@ -722,7 +722,7 @@ SpriteRenderTextureBug::SimpleSprite* SpriteRenderTextureBug::addNewSpriteWithCo sprite->setPosition(p); - FiniteTimeAction *action = NULL; + FiniteTimeAction *action = nullptr; float rd = CCRANDOM_0_1(); if (rd < 0.20) @@ -737,12 +737,12 @@ SpriteRenderTextureBug::SimpleSprite* SpriteRenderTextureBug::addNewSpriteWithCo action = FadeOut::create(2); auto action_back = action->reverse(); - auto seq = Sequence::create(action, action_back, NULL); + auto seq = Sequence::create(action, action_back, nullptr); sprite->runAction(RepeatForever::create(seq)); //return sprite; - return NULL; + return nullptr; } void SpriteRenderTextureBug::onTouchesEnded(const std::vector& touches, Event* event) diff --git a/tests/cpp-tests/Classes/RotateWorldTest/RotateWorldTest.cpp b/tests/cpp-tests/Classes/RotateWorldTest/RotateWorldTest.cpp index e031b10f92..8351125918 100644 --- a/tests/cpp-tests/Classes/RotateWorldTest/RotateWorldTest.cpp +++ b/tests/cpp-tests/Classes/RotateWorldTest/RotateWorldTest.cpp @@ -67,11 +67,11 @@ void SpriteLayer::onEnter() auto rot1 = RotateBy::create(4, 360*2); auto rot2 = rot1->reverse(); - spriteSister1->runAction(Repeat::create( Sequence::create(jump2, jump1, NULL), 5 )); - spriteSister2->runAction(Repeat::create( Sequence::create(jump1->clone(), jump2->clone(), NULL), 5 )); + spriteSister1->runAction(Repeat::create( Sequence::create(jump2, jump1, nullptr), 5 )); + spriteSister2->runAction(Repeat::create( Sequence::create(jump1->clone(), jump2->clone(), nullptr), 5 )); - spriteSister1->runAction(Repeat::create( Sequence::create(rot1, rot2, NULL), 5 )); - spriteSister2->runAction(Repeat::create( Sequence::create(rot2->clone(), rot1->clone(), NULL), 5 )); + spriteSister1->runAction(Repeat::create( Sequence::create(rot1, rot2, nullptr), 5 )); + spriteSister2->runAction(Repeat::create( Sequence::create(rot2->clone(), rot1->clone(), nullptr), 5 )); } //------------------------------------------------------------------ diff --git a/tests/cpp-tests/Classes/SceneTest/SceneTest.cpp b/tests/cpp-tests/Classes/SceneTest/SceneTest.cpp index 715bc91a87..862943dd89 100644 --- a/tests/cpp-tests/Classes/SceneTest/SceneTest.cpp +++ b/tests/cpp-tests/Classes/SceneTest/SceneTest.cpp @@ -22,7 +22,7 @@ SceneTestLayer1::SceneTestLayer1() auto item2 = MenuItemFont::create( "Test pushScene w/transition", CC_CALLBACK_1(SceneTestLayer1::onPushSceneTran, this)); auto item3 = MenuItemFont::create( "Quit", CC_CALLBACK_1(SceneTestLayer1::onQuit, this)); - auto menu = Menu::create( item1, item2, item3, NULL ); + auto menu = Menu::create( item1, item2, item3, nullptr ); menu->alignItemsVertically(); addChild( menu ); @@ -107,7 +107,7 @@ SceneTestLayer2::SceneTestLayer2() auto item2 = MenuItemFont::create( "replaceScene w/transition", CC_CALLBACK_1(SceneTestLayer2::onReplaceSceneTran, this)); auto item3 = MenuItemFont::create( "Go Back", CC_CALLBACK_1(SceneTestLayer2::onGoBack, this)); - auto menu = Menu::create( item1, item2, item3, NULL ); + auto menu = Menu::create( item1, item2, item3, nullptr ); menu->alignItemsVertically(); addChild( menu ); @@ -176,7 +176,7 @@ bool SceneTestLayer3::init() auto item2 = MenuItemFont::create("Touch to popToRootScene", CC_CALLBACK_1(SceneTestLayer3::item2Clicked, this)); auto item3 = MenuItemFont::create("Touch to popToSceneStackLevel(2)", CC_CALLBACK_1(SceneTestLayer3::item3Clicked, this)); - auto menu = Menu::create(item0, item1, item2, item3, NULL); + auto menu = Menu::create(item0, item1, item2, item3, nullptr); this->addChild(menu); menu->alignItemsVertically(); diff --git a/tests/cpp-tests/Classes/SchedulerTest/SchedulerTest.cpp b/tests/cpp-tests/Classes/SchedulerTest/SchedulerTest.cpp index 198ff3998b..070c31febc 100644 --- a/tests/cpp-tests/Classes/SchedulerTest/SchedulerTest.cpp +++ b/tests/cpp-tests/Classes/SchedulerTest/SchedulerTest.cpp @@ -852,9 +852,9 @@ void SchedulerTimeScale::onEnter() auto rot1 = RotateBy::create(4, 360*2); auto rot2 = rot1->reverse(); - auto seq3_1 = Sequence::create(jump2, jump1, NULL); - auto seq3_2 = Sequence::create(rot1, rot2, NULL); - auto spawn = Spawn::create(seq3_1, seq3_2, NULL); + auto seq3_1 = Sequence::create(jump2, jump1, nullptr); + auto seq3_2 = Sequence::create(rot1, rot2, nullptr); + auto spawn = Spawn::create(seq3_1, seq3_2, nullptr); auto action = Repeat::create(spawn, 50); auto action2 = action->clone(); @@ -946,7 +946,7 @@ void TwoSchedulers::onEnter() auto jump1 = JumpBy::create(4, Vec2(0,0), 100, 4); auto jump2 = jump1->reverse(); - auto seq = Sequence::create(jump2, jump1, NULL); + auto seq = Sequence::create(jump2, jump1, nullptr); auto action = RepeatForever::create(seq); // diff --git a/tests/cpp-tests/Classes/ShaderTest/ShaderTest.cpp b/tests/cpp-tests/Classes/ShaderTest/ShaderTest.cpp index b4150a8383..346a62eef3 100644 --- a/tests/cpp-tests/Classes/ShaderTest/ShaderTest.cpp +++ b/tests/cpp-tests/Classes/ShaderTest/ShaderTest.cpp @@ -22,7 +22,7 @@ static Layer* createShaderLayer(int nIndex) case 9: return new ShaderGlow(); case 10: return new ShaderMultiTexture(); } - return NULL; + return nullptr; } static Layer* nextAction(void) diff --git a/tests/cpp-tests/Classes/ShaderTest/ShaderTest2.cpp b/tests/cpp-tests/Classes/ShaderTest/ShaderTest2.cpp index 5c7fa92f11..8667a0294b 100644 --- a/tests/cpp-tests/Classes/ShaderTest/ShaderTest2.cpp +++ b/tests/cpp-tests/Classes/ShaderTest/ShaderTest2.cpp @@ -297,8 +297,8 @@ public: { initGLProgramState("Shaders/example_outline.fsh"); - Vec3 color(1.0, 0.2, 0.3); - GLfloat radius = 0.01; + Vec3 color(1.0f, 0.2f, 0.3f); + GLfloat radius = 0.01f; GLfloat threshold = 1.75; _glprogramstate->setUniformVec3("u_outlineColor", color); @@ -456,7 +456,7 @@ EffectSpriteTest::EffectSpriteTest() _sprite->setEffect(_effects.at(_vectorIndex)); }); - auto menu = Menu::create(itemPrev, itemNext, NULL); + auto menu = Menu::create(itemPrev, itemNext, nullptr); menu->alignItemsHorizontally(); menu->setScale(0.5); menu->setAnchorPoint(Vec2(0,0)); @@ -469,9 +469,9 @@ EffectSpriteTest::EffectSpriteTest() auto jump = JumpBy::create(4, Vec2(s.width,0), 100, 4); auto rot = RotateBy::create(4, 720); - auto spawn = Spawn::create(jump, rot, NULL); + auto spawn = Spawn::create(jump, rot, nullptr); auto rev = spawn->reverse(); - auto seq = Sequence::create(spawn, rev, NULL); + auto seq = Sequence::create(spawn, rev, nullptr); auto repeat = RepeatForever::create(seq); _sprite->runAction(repeat); diff --git a/tests/cpp-tests/Classes/SpineTest/SpineTest.cpp b/tests/cpp-tests/Classes/SpineTest/SpineTest.cpp index 4b57f848f4..e0887829ab 100644 --- a/tests/cpp-tests/Classes/SpineTest/SpineTest.cpp +++ b/tests/cpp-tests/Classes/SpineTest/SpineTest.cpp @@ -67,7 +67,7 @@ bool SpineTestLayer::init () { skeletonNode->runAction(CCRepeatForever::create(CCSequence::create(CCFadeOut::create(1), CCFadeIn::create(1), CCDelayTime::create(5), - NULL))); + nullptr))); Size windowSize = Director::getInstance()->getWinSize(); skeletonNode->setPosition(Vec2(windowSize.width / 2, 20)); diff --git a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp index ac8281b9f6..d442d51ab1 100644 --- a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp +++ b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp @@ -184,7 +184,7 @@ void Sprite3DBasicTest::addNewSpriteWithCoords(Vec2 p) else action = FadeOut::create(2); auto action_back = action->reverse(); - auto seq = Sequence::create( action, action_back, NULL ); + auto seq = Sequence::create( action, action_back, nullptr ); sprite->runAction( RepeatForever::create(seq) ); } @@ -504,7 +504,7 @@ void Sprite3DEffectTest::addNewSpriteWithCoords(Vec2 p) else action = FadeOut::create(2); auto action_back = action->reverse(); - auto seq = Sequence::create( action, action_back, NULL ); + auto seq = Sequence::create( action, action_back, nullptr ); sprite->runAction( RepeatForever::create(seq) ); } @@ -546,24 +546,23 @@ void Sprite3DWithSkinTest::addNewSpriteWithCoords(Vec2 p) addChild(sprite); sprite->setPosition( Vec2( p.x, p.y) ); - auto animation = Animation3D::getOrCreate(fileName); + auto animation = Animation3D::create(fileName); if (animation) { auto animate = Animate3D::create(animation); - if(std::rand() %3 == 0) - { - animate->setPlayBack(true); - } + bool inverse = (std::rand() % 3 == 0); int rand2 = std::rand(); + float speed = 1.0f; if(rand2 % 3 == 1) { - animate->setSpeed(animate->getSpeed() + CCRANDOM_0_1()); + speed = animate->getSpeed() + CCRANDOM_0_1(); } else if(rand2 % 3 == 2) { - animate->setSpeed(animate->getSpeed() - 0.5 * CCRANDOM_0_1()); + speed = animate->getSpeed() - 0.5 * CCRANDOM_0_1(); } + animate->setSpeed(inverse ? -speed : speed); sprite->runAction(RepeatForever::create(animate)); } @@ -652,7 +651,7 @@ void Animate3DTest::addSprite3D() sprite->setPosition(Vec2(s.width * 4.f / 5.f, s.height / 2.f)); addChild(sprite); _sprite = sprite; - auto animation = Animation3D::getOrCreate(fileName); + auto animation = Animation3D::create(fileName); if (animation) { auto animate = Animate3D::create(animation, 0.f, 1.933f); @@ -706,7 +705,7 @@ void Animate3DTest::onTouchesEnded(const std::vector& touches, Event* ev { _sprite->runAction(_hurt); auto delay = DelayTime::create(_hurt->getDuration() - 0.1f); - auto seq = Sequence::create(delay, CallFunc::create(CC_CALLBACK_0(Animate3DTest::renewCallBack, this)), NULL); + auto seq = Sequence::create(delay, CallFunc::create(CC_CALLBACK_0(Animate3DTest::renewCallBack, this)), nullptr); seq->setTag(101); _sprite->runAction(seq); _state = State::SWIMMING_TO_HURT; diff --git a/tests/cpp-tests/Classes/SpriteTest/SpriteTest.cpp b/tests/cpp-tests/Classes/SpriteTest/SpriteTest.cpp index ac86c35262..af90d8c5f5 100644 --- a/tests/cpp-tests/Classes/SpriteTest/SpriteTest.cpp +++ b/tests/cpp-tests/Classes/SpriteTest/SpriteTest.cpp @@ -260,7 +260,7 @@ void Sprite1::addNewSpriteWithCoords(Vec2 p) else action = FadeOut::create(2); auto action_back = action->reverse(); - auto seq = Sequence::create( action, action_back, NULL ); + auto seq = Sequence::create( action, action_back, nullptr ); sprite->runAction( RepeatForever::create(seq) ); } @@ -333,7 +333,7 @@ void SpriteBatchNode1::addNewSpriteWithCoords(Vec2 p) action = FadeOut::create(2); auto action_back = action->reverse(); - auto seq = Sequence::create(action, action_back, NULL); + auto seq = Sequence::create(action, action_back, nullptr); sprite->runAction( RepeatForever::create(seq)); } @@ -390,19 +390,19 @@ SpriteColorOpacity::SpriteColorOpacity() auto action = FadeIn::create(2); auto action_back = action->reverse(); - auto fade = RepeatForever::create( Sequence::create( action, action_back, NULL) ); + auto fade = RepeatForever::create( Sequence::create( action, action_back, nullptr) ); auto tintred = TintBy::create(2, 0, -255, -255); auto tintred_back = tintred->reverse(); - auto red = RepeatForever::create( Sequence::create( tintred, tintred_back, NULL) ); + auto red = RepeatForever::create( Sequence::create( tintred, tintred_back, nullptr) ); auto tintgreen = TintBy::create(2, -255, 0, -255); auto tintgreen_back = tintgreen->reverse(); - auto green = RepeatForever::create( Sequence::create( tintgreen, tintgreen_back, NULL) ); + auto green = RepeatForever::create( Sequence::create( tintgreen, tintgreen_back, nullptr) ); auto tintblue = TintBy::create(2, -255, -255, 0); auto tintblue_back = tintblue->reverse(); - auto blue = RepeatForever::create( Sequence::create( tintblue, tintblue_back, NULL) ); + auto blue = RepeatForever::create( Sequence::create( tintblue, tintblue_back, nullptr) ); sprite5->runAction(red); sprite6->runAction(green); @@ -481,19 +481,19 @@ SpriteBatchNodeColorOpacity::SpriteBatchNodeColorOpacity() auto action = FadeIn::create(2); auto action_back = action->reverse(); - auto fade = RepeatForever::create( Sequence::create( action, action_back,NULL) ); + auto fade = RepeatForever::create( Sequence::create( action, action_back,nullptr) ); auto tintred = TintBy::create(2, 0, -255, -255); auto tintred_back = tintred->reverse(); - auto red = RepeatForever::create( Sequence::create( tintred, tintred_back,NULL) ); + auto red = RepeatForever::create( Sequence::create( tintred, tintred_back,nullptr) ); auto tintgreen = TintBy::create(2, -255, 0, -255); auto tintgreen_back = tintgreen->reverse(); - auto green = RepeatForever::create( Sequence::create( tintgreen, tintgreen_back,NULL) ); + auto green = RepeatForever::create( Sequence::create( tintgreen, tintgreen_back,nullptr) ); auto tintblue = TintBy::create(2, -255, -255, 0); auto tintblue_back = tintblue->reverse(); - auto blue = RepeatForever::create( Sequence::create( tintblue, tintblue_back,NULL) ); + auto blue = RepeatForever::create( Sequence::create( tintblue, tintblue_back,nullptr) ); sprite5->runAction(red); @@ -1227,12 +1227,12 @@ Sprite6::Sprite6() // SpriteBatchNode actions auto rotate_back = rotate->reverse(); - auto rotate_seq = Sequence::create(rotate, rotate_back, NULL); + auto rotate_seq = Sequence::create(rotate, rotate_back, nullptr); auto rotate_forever = RepeatForever::create(rotate_seq); auto scale = ScaleBy::create(5, 1.5f); auto scale_back = scale->reverse(); - auto scale_seq = Sequence::create( scale, scale_back, NULL); + auto scale_seq = Sequence::create( scale, scale_back, nullptr); auto scale_forever = RepeatForever::create(scale_seq); float step = s.width/4; @@ -1369,7 +1369,7 @@ SpriteAliased::SpriteAliased() auto scale = ScaleBy::create(2, 5); auto scale_back = scale->reverse(); - auto seq = Sequence::create( scale, scale_back, NULL); + auto seq = Sequence::create( scale, scale_back, nullptr); auto repeat = RepeatForever::create(seq); auto repeat2 = repeat->clone(); @@ -1434,7 +1434,7 @@ SpriteBatchNodeAliased::SpriteBatchNodeAliased() auto scale = ScaleBy::create(2, 5); auto scale_back = scale->reverse(); - auto seq = Sequence::create( scale, scale_back, NULL); + auto seq = Sequence::create( scale, scale_back, nullptr); auto repeat = RepeatForever::create(seq); auto repeat2 = repeat->clone(); @@ -1533,7 +1533,7 @@ void SpriteNewTexture::addNewSprite() action = FadeOut::create(2); auto action_back = action->reverse(); - auto seq = Sequence::create(action, action_back, NULL); + auto seq = Sequence::create(action, action_back, nullptr); sprite->runAction( RepeatForever::create(seq) ); } @@ -1638,7 +1638,7 @@ void SpriteBatchNodeNewTexture::addNewSprite() else action = FadeOut::create(2); auto action_back = action->reverse(); - auto seq = Sequence::create(action, action_back, NULL); + auto seq = Sequence::create(action, action_back, nullptr); sprite->runAction( RepeatForever::create(seq) ); } @@ -2095,7 +2095,7 @@ SpriteOffsetAnchorScale::SpriteOffsetAnchorScale() auto scale = ScaleBy::create(2, 2); auto scale_back = scale->reverse(); - auto seq_scale = Sequence::create(scale, scale_back, NULL); + auto seq_scale = Sequence::create(scale, scale_back, nullptr); sprite->runAction(RepeatForever::create(seq_scale)); addChild(sprite, 0); @@ -2177,7 +2177,7 @@ SpriteBatchNodeOffsetAnchorScale::SpriteBatchNodeOffsetAnchorScale() auto scale = ScaleBy::create(2, 2); auto scale_back = scale->reverse(); - auto seq_scale = Sequence::create(scale, scale_back, NULL); + auto seq_scale = Sequence::create(scale, scale_back, nullptr); sprite->runAction(RepeatForever::create(seq_scale) ); spritesheet->addChild(sprite, i); @@ -2245,7 +2245,7 @@ SpriteAnimationSplit::SpriteAnimationSplit() FlipX::create(true), animate->clone(), FlipX::create(false), - NULL); + nullptr); sprite->runAction(RepeatForever::create( seq ) ); } @@ -2406,8 +2406,8 @@ SpriteBatchNodeChildren::SpriteBatchNodeChildren() sprite2->runAction( RepeatForever::create(seq2) ); sprite1->runAction( RepeatForever::create(action_rot)); - sprite1->runAction( RepeatForever::create(Sequence::create(action, action_back,NULL)) ); - sprite1->runAction( RepeatForever::create(Sequence::create(action_s, action_s_back,NULL)) ); + sprite1->runAction( RepeatForever::create(Sequence::create(action, action_back,nullptr)) ); + sprite1->runAction( RepeatForever::create(Sequence::create(action_s, action_s_back,nullptr)) ); } @@ -3215,7 +3215,7 @@ SpriteBatchNodeSkewNegativeScaleChildren::SpriteBatchNodeSkewNegativeScaleChildr sprite->setScale(-1.0f); } - auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, NULL); + auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, nullptr); sprite->runAction(RepeatForever::create(seq_skew)); auto child1 = Sprite::createWithSpriteFrameName("grossini_dance_01.png"); @@ -3274,7 +3274,7 @@ SpriteSkewNegativeScaleChildren::SpriteSkewNegativeScaleChildren() sprite->setScale(-1.0f); } - auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, NULL); + auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, nullptr); sprite->runAction(RepeatForever::create(seq_skew)); auto child1 = Sprite::createWithSpriteFrameName("grossini_dance_01.png"); @@ -3315,7 +3315,7 @@ SpriteNilTexture::SpriteNilTexture() { auto s = Director::getInstance()->getWinSize(); - Sprite* sprite = NULL; + Sprite* sprite = nullptr; // TEST: If no texture is given, then Opacity + Color should work. @@ -3515,7 +3515,7 @@ SpriteDoubleResolution::SpriteDoubleResolution() // Actions auto scale = ScaleBy::create(2, 0.5); auto scale_back = scale->reverse(); - auto seq = Sequence::create(scale, scale_back, NULL); + auto seq = Sequence::create(scale, scale_back, nullptr); auto seq_copy = seq->clone(); @@ -3611,7 +3611,7 @@ AnimationCacheTest::AnimationCacheTest() auto animG = Animate::create(dance_grey); auto animB = Animate::create(dance_blue); - auto seq = Sequence::create(animN, animG, animB, NULL); + auto seq = Sequence::create(animN, animG, animB, nullptr); // create an sprite without texture auto grossini = Sprite::create(); @@ -3667,7 +3667,7 @@ AnimationCacheFile::AnimationCacheFile() auto animG = Animate::create(dance_grey); auto animB = Animate::create(dance_blue); - auto seq = Sequence::create(animN, animG, animB, NULL); + auto seq = Sequence::create(animN, animG, animB, nullptr); // create an sprite without texture auto grossini = Sprite::create(); @@ -3799,7 +3799,7 @@ SpriteOffsetAnchorSkew::SpriteOffsetAnchorSkew() auto skewY = SkewBy::create(2, 0, 45); auto skewY_back = skewY->reverse(); - auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, NULL); + auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, nullptr); sprite->runAction(RepeatForever::create(seq_skew)); addChild(sprite, 0); @@ -3882,7 +3882,7 @@ SpriteBatchNodeOffsetAnchorSkew::SpriteBatchNodeOffsetAnchorSkew() auto skewY = SkewBy::create(2, 0, 45); auto skewY_back = skewY->reverse(); - auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, NULL); + auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, nullptr); sprite->runAction(RepeatForever::create(seq_skew)); spritebatch->addChild(sprite, i); @@ -3963,13 +3963,13 @@ SpriteOffsetAnchorSkewScale::SpriteOffsetAnchorSkewScale() auto skewY = SkewBy::create(2, 0, 45); auto skewY_back = skewY->reverse(); - auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, NULL); + auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, nullptr); sprite->runAction(RepeatForever::create(seq_skew)); // Scale auto scale = ScaleBy::create(2, 2); auto scale_back = scale->reverse(); - auto seq_scale = Sequence::create(scale, scale_back, NULL); + auto seq_scale = Sequence::create(scale, scale_back, nullptr); sprite->runAction(RepeatForever::create(seq_scale)); addChild(sprite, 0); @@ -4052,13 +4052,13 @@ SpriteBatchNodeOffsetAnchorSkewScale::SpriteBatchNodeOffsetAnchorSkewScale() auto skewY = SkewBy::create(2, 0, 45); auto skewY_back = skewY->reverse(); - auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, NULL); + auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, nullptr); sprite->runAction(RepeatForever::create(seq_skew)); // scale auto scale = ScaleBy::create(2, 2); auto scale_back = scale->reverse(); - auto seq_scale = Sequence::create(scale, scale_back, NULL); + auto seq_scale = Sequence::create(scale, scale_back, nullptr); sprite->runAction(RepeatForever::create(seq_scale)); spritebatch->addChild(sprite, i); @@ -4137,7 +4137,7 @@ SpriteOffsetAnchorFlip::SpriteOffsetAnchorFlip() auto flip = FlipY::create(true); auto flip_back = FlipY::create(false); auto delay = DelayTime::create(1); - auto seq = Sequence::create(delay, flip, delay->clone(), flip_back, NULL); + auto seq = Sequence::create(delay, flip, delay->clone(), flip_back, nullptr); sprite->runAction(RepeatForever::create(seq)); addChild(sprite, 0); @@ -4219,7 +4219,7 @@ SpriteBatchNodeOffsetAnchorFlip::SpriteBatchNodeOffsetAnchorFlip() auto flip = FlipY::create(true); auto flip_back = FlipY::create(false); auto delay = DelayTime::create(1); - auto seq = Sequence::create(delay, flip, delay->clone(), flip_back, NULL); + auto seq = Sequence::create(delay, flip, delay->clone(), flip_back, nullptr); sprite->runAction(RepeatForever::create(seq)); spritebatch->addChild(sprite, i); @@ -4503,7 +4503,7 @@ SpriteOffsetAnchorRotationalSkew::SpriteOffsetAnchorRotationalSkew() auto skewY = RotateBy::create(2, 0, 45); auto skewY_back = skewY->reverse(); - auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, NULL); + auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, nullptr); sprite->runAction(RepeatForever::create(seq_skew)); addChild(sprite, 0); @@ -4586,7 +4586,7 @@ SpriteBatchNodeOffsetAnchorRotationalSkew::SpriteBatchNodeOffsetAnchorRotational auto skewY = RotateBy::create(2, 0, 45); auto skewY_back = skewY->reverse(); - auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, NULL); + auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, nullptr); sprite->runAction(RepeatForever::create(seq_skew)); spritebatch->addChild(sprite, i); @@ -4667,13 +4667,13 @@ SpriteOffsetAnchorRotationalSkewScale::SpriteOffsetAnchorRotationalSkewScale() auto skewY = RotateBy::create(2, 0, 45); auto skewY_back = skewY->reverse(); - auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, NULL); + auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, nullptr); sprite->runAction(RepeatForever::create(seq_skew)); // Scale auto scale = ScaleBy::create(2, 2); auto scale_back = scale->reverse(); - auto seq_scale = Sequence::create(scale, scale_back, NULL); + auto seq_scale = Sequence::create(scale, scale_back, nullptr); sprite->runAction(RepeatForever::create(seq_scale)); addChild(sprite, i); @@ -4755,13 +4755,13 @@ SpriteBatchNodeOffsetAnchorRotationalSkewScale::SpriteBatchNodeOffsetAnchorRotat auto skewY = RotateBy::create(2, 0, 45); auto skewY_back = skewY->reverse(); - auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, NULL); + auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, nullptr); sprite->runAction(RepeatForever::create(seq_skew)); // Scale auto scale = ScaleBy::create(2, 2); auto scale_back = scale->reverse(); - auto seq_scale = Sequence::create(scale, scale_back, NULL); + auto seq_scale = Sequence::create(scale, scale_back, nullptr); sprite->runAction(RepeatForever::create(seq_scale)); spritebatch->addChild(sprite, i); @@ -4821,7 +4821,7 @@ SpriteRotationalSkewNegativeScaleChildren::SpriteRotationalSkewNegativeScaleChil sprite->setScale(-1.0f); } - auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, NULL); + auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, nullptr); sprite->runAction(RepeatForever::create(seq_skew)); auto child1 = Sprite::create("Images/grossini_dance_01.png"); @@ -4888,7 +4888,7 @@ SpriteBatchNodeRotationalSkewNegativeScaleChildren::SpriteBatchNodeRotationalSke sprite->setScale(-1.0f); } - auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, NULL); + auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, nullptr); sprite->runAction(RepeatForever::create(seq_skew)); auto child1 = Sprite::create("Images/grossini_dance_01.png"); diff --git a/tests/cpp-tests/Classes/TextInputTest/TextInputTest.cpp b/tests/cpp-tests/Classes/TextInputTest/TextInputTest.cpp index 92aacdd67c..ea29b7a992 100644 --- a/tests/cpp-tests/Classes/TextInputTest/TextInputTest.cpp +++ b/tests/cpp-tests/Classes/TextInputTest/TextInputTest.cpp @@ -302,7 +302,7 @@ void TextFieldTTFActionTest::onEnter() Sequence::create( FadeOut::create(0.25), FadeIn::create(0.25), - NULL + nullptr )); _textFieldAction->retain(); _action = false; @@ -394,9 +394,9 @@ bool TextFieldTTFActionTest::onTextFieldInsertText(TextFieldTTF * sender, const MoveTo::create(duration, endPos), ScaleTo::create(duration, 1), FadeOut::create(duration), - NULL), + nullptr), CallFuncN::create(CC_CALLBACK_1(TextFieldTTFActionTest::callbackRemoveNodeWhenDidAction, this)), - NULL); + nullptr); label->runAction(seq); return false; } @@ -428,9 +428,9 @@ bool TextFieldTTFActionTest::onTextFieldDeleteBackward(TextFieldTTF * sender, co RotateBy::create(rotateDuration, (rand()%2) ? 360 : -360), repeatTime), FadeOut::create(duration), - NULL), + nullptr), CallFuncN::create(CC_CALLBACK_1(TextFieldTTFActionTest::callbackRemoveNodeWhenDidAction, this)), - NULL); + nullptr); label->runAction(seq); return false; } diff --git a/tests/cpp-tests/Classes/Texture2dTest/Texture2dTest.cpp b/tests/cpp-tests/Classes/Texture2dTest/Texture2dTest.cpp index 60f7a34c4b..eb3a4e1e65 100644 --- a/tests/cpp-tests/Classes/Texture2dTest/Texture2dTest.cpp +++ b/tests/cpp-tests/Classes/Texture2dTest/Texture2dTest.cpp @@ -370,8 +370,8 @@ void TextureMipMap::onEnter() auto scale2 = scale1->clone(); auto sc_back2 = scale2->reverse(); - img0->runAction(RepeatForever::create(Sequence::create(scale1, sc_back, NULL))); - img1->runAction(RepeatForever::create(Sequence::create(scale2, sc_back2, NULL))); + img0->runAction(RepeatForever::create(Sequence::create(scale1, sc_back, nullptr))); + img1->runAction(RepeatForever::create(Sequence::create(scale2, sc_back2, nullptr))); log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str()); } @@ -420,8 +420,8 @@ void TexturePVRMipMap::onEnter() auto scale2 = scale1->clone(); auto sc_back2 = scale2->reverse(); - imgMipMap->runAction(RepeatForever::create(Sequence::create(scale1, sc_back, NULL))); - img->runAction(RepeatForever::create(Sequence::create(scale2, sc_back2, NULL))); + imgMipMap->runAction(RepeatForever::create(Sequence::create(scale1, sc_back, nullptr))); + img->runAction(RepeatForever::create(Sequence::create(scale2, sc_back2, nullptr))); } log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str()); } @@ -463,8 +463,8 @@ void TexturePVRMipMap2::onEnter() auto scale2 = scale1->clone(); auto sc_back2 = scale2->reverse(); - imgMipMap->runAction(RepeatForever::create(Sequence::create(scale1, sc_back, NULL))); - img->runAction(RepeatForever::create(Sequence::create(scale2, sc_back2, NULL))); + imgMipMap->runAction(RepeatForever::create(Sequence::create(scale1, sc_back, nullptr))); + img->runAction(RepeatForever::create(Sequence::create(scale2, sc_back2, nullptr))); log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str()); } @@ -760,7 +760,7 @@ void TexturePVRRGB888::onEnter() auto s = Director::getInstance()->getWinSize(); auto img = Sprite::create("Images/test_image_rgb888.pvr"); - if (img != NULL) + if (img != nullptr) { img->setPosition(Vec2( s.width/2.0f, s.height/2.0f)); addChild(img); @@ -1361,7 +1361,7 @@ void TextureAlias::onEnter() // scale them to show auto sc = ScaleBy::create(3, 8.0f); auto sc_back = sc->reverse(); - auto scaleforever = RepeatForever::create(Sequence::create(sc, sc_back, NULL)); + auto scaleforever = RepeatForever::create(Sequence::create(sc, sc_back, nullptr)); auto scaleToo = scaleforever->clone(); sprite2->runAction(scaleforever); @@ -1456,7 +1456,7 @@ void TexturePixelFormat::onEnter() auto fadeout = FadeOut::create(2); auto fadein = FadeIn::create(2); - auto seq = Sequence::create(DelayTime::create(2), fadeout, fadein, NULL); + auto seq = Sequence::create(DelayTime::create(2), fadeout, fadein, nullptr); auto seq_4ever = RepeatForever::create(seq); auto seq_4ever2 = seq_4ever->clone(); auto seq_4ever3 = seq_4ever->clone(); @@ -1551,7 +1551,7 @@ void TextureAsync::onEnter() auto scale = ScaleBy::create(0.3f, 2); auto scale_back = scale->reverse(); - auto seq = Sequence::create(scale, scale_back, NULL); + auto seq = Sequence::create(scale, scale_back, nullptr); label->runAction(RepeatForever::create(seq)); scheduleOnce(schedule_selector(TextureAsync::loadImages), 1.0f); @@ -1638,7 +1638,7 @@ void TextureGlClamp::onEnter() sprite->runAction(rotate); auto scale = ScaleBy::create(2, 0.04f); auto scaleBack = scale->reverse(); - auto seq = Sequence::create(scale, scaleBack, NULL); + auto seq = Sequence::create(scale, scaleBack, nullptr); sprite->runAction(seq); } @@ -1675,7 +1675,7 @@ void TextureGlRepeat::onEnter() sprite->runAction(rotate); auto scale = ScaleBy::create(2, 0.04f); auto scaleBack = scale->reverse(); - auto seq = Sequence::create(scale, scaleBack, NULL); + auto seq = Sequence::create(scale, scaleBack, nullptr); sprite->runAction(seq); } @@ -1697,7 +1697,7 @@ TextureGlRepeat::~TextureGlRepeat() void TextureSizeTest::onEnter() { TextureDemo::onEnter(); - Sprite *sprite = NULL; + Sprite *sprite = nullptr; log("Loading 512x512 image..."); sprite = Sprite::create("Images/texture512x512.png"); @@ -1920,7 +1920,7 @@ void TextureTestScene::runThisTest() void TextureMemoryAlloc::onEnter() { TextureDemo::onEnter(); - _background = NULL; + _background = nullptr; MenuItemFont::setFontSize(24); @@ -1939,14 +1939,14 @@ void TextureMemoryAlloc::onEnter() auto item5 = MenuItemFont::create("A8", CC_CALLBACK_1(TextureMemoryAlloc::updateImage, this)); item5->setTag(4); - auto menu = Menu::create(item1, item2, item3, item4, item5, NULL); + auto menu = Menu::create(item1, item2, item3, item4, item5, nullptr); menu->alignItemsHorizontally(); addChild(menu); auto warmup = MenuItemFont::create("warm up texture", CC_CALLBACK_1(TextureMemoryAlloc::changeBackgroundVisible, this)); - auto menu2 = Menu::create(warmup, NULL); + auto menu2 = Menu::create(warmup, nullptr); menu2->alignItemsHorizontally(); @@ -2074,7 +2074,7 @@ void TexturePVRv3Premult::transformSprite(cocos2d::Sprite *sprite) auto fade = FadeOut::create(2); auto dl = DelayTime::create(2); auto fadein = fade->reverse(); - auto seq = Sequence::create(fade, fadein, dl, NULL); + auto seq = Sequence::create(fade, fadein, dl, nullptr); auto repeat = RepeatForever::create(seq); sprite->runAction(repeat); } diff --git a/tests/cpp-tests/Classes/TileMapTest/TileMapTest.cpp b/tests/cpp-tests/Classes/TileMapTest/TileMapTest.cpp index 016d5da895..2eb4483885 100644 --- a/tests/cpp-tests/Classes/TileMapTest/TileMapTest.cpp +++ b/tests/cpp-tests/Classes/TileMapTest/TileMapTest.cpp @@ -195,7 +195,7 @@ TileMapTest::TileMapTest() auto scale = ScaleBy::create(4, 0.8f); auto scaleBack = scale->reverse(); - auto seq = Sequence::create(scale, scaleBack, NULL); + auto seq = Sequence::create(scale, scaleBack, nullptr); map->runAction(RepeatForever::create(seq)); } @@ -291,7 +291,7 @@ TMXOrthoTest::TMXOrthoTest() auto scale = ScaleBy::create(10, 0.1f); auto back = scale->reverse(); - auto seq = Sequence::create(scale, back, NULL); + auto seq = Sequence::create(scale, back, nullptr); auto repeat = RepeatForever::create(seq); map->runAction(repeat); @@ -332,7 +332,7 @@ TMXOrthoTest2::TMXOrthoTest2() CCLOG("ContentSize: %f, %f", s.width,s.height); auto& children = map->getChildren(); - SpriteBatchNode* child = NULL; + SpriteBatchNode* child = nullptr; for(const auto &obj : children) { child = static_cast(obj); @@ -361,7 +361,7 @@ TMXOrthoTest3::TMXOrthoTest3() CCLOG("ContentSize: %f, %f", s.width,s.height); auto& children = map->getChildren(); - SpriteBatchNode* child = NULL; + SpriteBatchNode* child = nullptr; for(const auto &node : children) { child = static_cast(node); @@ -483,7 +483,7 @@ TMXReadWriteTest::TMXReadWriteTest() auto fadein = FadeIn::create(2); auto scaleback = ScaleTo::create(1, 1); auto finish = CallFuncN::create(CC_CALLBACK_1(TMXReadWriteTest::removeSprite, this)); - auto seq0 = Sequence::create(move, rotate, scale, opacity, fadein, scaleback, finish, NULL); + auto seq0 = Sequence::create(move, rotate, scale, opacity, fadein, scaleback, finish, nullptr); auto seq1 = seq0->clone(); auto seq2 = seq0->clone(); auto seq3 = seq0->clone(); @@ -947,7 +947,7 @@ TMXIsoZorder::TMXIsoZorder() auto move = MoveBy::create(10, Vec2(300,250)); auto back = move->reverse(); - auto seq = Sequence::create(move, back,NULL); + auto seq = Sequence::create(move, back,nullptr); _tamara->runAction( RepeatForever::create(seq) ); schedule( schedule_selector(TMXIsoZorder::repositionSprite) ); @@ -1013,7 +1013,7 @@ TMXOrthoZorder::TMXOrthoZorder() auto move = MoveBy::create(10, Vec2(400,450)); auto back = move->reverse(); - auto seq = Sequence::create(move, back,NULL); + auto seq = Sequence::create(move, back,nullptr); _tamara->runAction( RepeatForever::create(seq)); schedule( schedule_selector(TMXOrthoZorder::repositionSprite)); @@ -1075,7 +1075,7 @@ TMXIsoVertexZ::TMXIsoVertexZ() auto move = MoveBy::create(10, Vec2(300,250) * (1/CC_CONTENT_SCALE_FACTOR())); auto back = move->reverse(); - auto seq = Sequence::create(move, back,NULL); + auto seq = Sequence::create(move, back,nullptr); _tamara->runAction( RepeatForever::create(seq) ); schedule( schedule_selector(TMXIsoVertexZ::repositionSprite)); @@ -1147,7 +1147,7 @@ TMXOrthoVertexZ::TMXOrthoVertexZ() auto move = MoveBy::create(10, Vec2(400,450) * (1/CC_CONTENT_SCALE_FACTOR())); auto back = move->reverse(); - auto seq = Sequence::create(move, back,NULL); + auto seq = Sequence::create(move, back,nullptr); _tamara->runAction( RepeatForever::create(seq)); schedule(schedule_selector(TMXOrthoVertexZ::repositionSprite)); @@ -1389,7 +1389,7 @@ TMXOrthoFromXMLTest::TMXOrthoFromXMLTest() std::string file = resources + "/orthogonal-test1.tmx"; auto str = String::createWithContentsOfFile(FileUtils::getInstance()->fullPathForFilename(file.c_str()).c_str()); - CCASSERT(str != NULL, "Unable to open file"); + CCASSERT(str != nullptr, "Unable to open file"); auto map = TMXTiledMap::createWithXML(str->getCString() ,resources.c_str()); addChild(map, 0, kTagTileMap); diff --git a/tests/cpp-tests/Classes/TileMapTest/TileMapTest2.cpp b/tests/cpp-tests/Classes/TileMapTest/TileMapTest2.cpp index 9b895e65bf..f89cb73e62 100644 --- a/tests/cpp-tests/Classes/TileMapTest/TileMapTest2.cpp +++ b/tests/cpp-tests/Classes/TileMapTest/TileMapTest2.cpp @@ -200,7 +200,7 @@ TileMapTestNew::TileMapTestNew() auto scale = ScaleBy::create(4, 0.8f); auto scaleBack = scale->reverse(); - auto seq = Sequence::create(scale, scaleBack, NULL); + auto seq = Sequence::create(scale, scaleBack, nullptr); map->runAction(RepeatForever::create(seq)); } @@ -296,7 +296,7 @@ TMXOrthoTestNew::TMXOrthoTestNew() auto scale = ScaleBy::create(10, 0.1f); auto back = scale->reverse(); - auto seq = Sequence::create(scale, back, NULL); + auto seq = Sequence::create(scale, back, nullptr); auto repeat = RepeatForever::create(seq); map->runAction(repeat); @@ -462,7 +462,7 @@ TMXReadWriteTestNew::TMXReadWriteTestNew() auto fadein = FadeIn::create(2); auto scaleback = ScaleTo::create(1, 1); auto finish = CallFuncN::create(CC_CALLBACK_1(TMXReadWriteTestNew::removeSprite, this)); - auto seq0 = Sequence::create(move, rotate, scale, opacity, fadein, scaleback, finish, NULL); + auto seq0 = Sequence::create(move, rotate, scale, opacity, fadein, scaleback, finish, nullptr); auto seq1 = seq0->clone(); auto seq2 = seq0->clone(); auto seq3 = seq0->clone(); @@ -917,7 +917,7 @@ TMXIsoZorderNew::TMXIsoZorderNew() auto move = MoveBy::create(10, Vec2(300,250)); auto back = move->reverse(); - auto seq = Sequence::create(move, back,NULL); + auto seq = Sequence::create(move, back,nullptr); _tamara->runAction( RepeatForever::create(seq) ); schedule( schedule_selector(TMXIsoZorderNew::repositionSprite) ); @@ -983,7 +983,7 @@ TMXOrthoZorderNew::TMXOrthoZorderNew() auto move = MoveBy::create(10, Vec2(400,450)); auto back = move->reverse(); - auto seq = Sequence::create(move, back,NULL); + auto seq = Sequence::create(move, back,nullptr); _tamara->runAction( RepeatForever::create(seq)); schedule( schedule_selector(TMXOrthoZorderNew::repositionSprite)); @@ -1045,7 +1045,7 @@ TMXIsoVertexZNew::TMXIsoVertexZNew() auto move = MoveBy::create(10, Vec2(300,250) * (1/CC_CONTENT_SCALE_FACTOR())); auto back = move->reverse(); - auto seq = Sequence::create(move, back,NULL); + auto seq = Sequence::create(move, back,nullptr); _tamara->runAction( RepeatForever::create(seq) ); schedule( schedule_selector(TMXIsoVertexZNew::repositionSprite)); @@ -1117,7 +1117,7 @@ TMXOrthoVertexZNew::TMXOrthoVertexZNew() auto move = MoveBy::create(10, Vec2(400,450) * (1/CC_CONTENT_SCALE_FACTOR())); auto back = move->reverse(); - auto seq = Sequence::create(move, back,NULL); + auto seq = Sequence::create(move, back,nullptr); _tamara->runAction( RepeatForever::create(seq)); schedule(schedule_selector(TMXOrthoVertexZNew::repositionSprite)); @@ -1347,7 +1347,7 @@ TMXOrthoFromXMLTestNew::TMXOrthoFromXMLTestNew() std::string file = resources + "/orthogonal-test1.tmx"; auto str = String::createWithContentsOfFile(FileUtils::getInstance()->fullPathForFilename(file.c_str()).c_str()); - CCASSERT(str != NULL, "Unable to open file"); + CCASSERT(str != nullptr, "Unable to open file"); auto map = FastTMXTiledMap::createWithXML(str->getCString() ,resources.c_str()); addChild(map, 0, kTagTileMap); diff --git a/tests/cpp-tests/Classes/TransitionsTest/TransitionsTest.cpp b/tests/cpp-tests/Classes/TransitionsTest/TransitionsTest.cpp index 5091bc29a5..7f9ec9103b 100644 --- a/tests/cpp-tests/Classes/TransitionsTest/TransitionsTest.cpp +++ b/tests/cpp-tests/Classes/TransitionsTest/TransitionsTest.cpp @@ -280,7 +280,7 @@ TestLayer1::TestLayer1(void) auto item2 = MenuItemImage::create(s_pathR1, s_pathR2, CC_CALLBACK_1(TestLayer1::restartCallback, this) ); auto item3 = MenuItemImage::create(s_pathF1, s_pathF2, CC_CALLBACK_1(TestLayer1::nextCallback, this) ); - auto menu = Menu::create(item1, item2, item3, NULL); + auto menu = Menu::create(item1, item2, item3, nullptr); menu->setPosition( Vec2::ZERO ); item1->setPosition(Vec2(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); @@ -410,7 +410,7 @@ TestLayer2::TestLayer2() auto item2 = MenuItemImage::create(s_pathR1, s_pathR2, CC_CALLBACK_1(TestLayer2::restartCallback, this) ); auto item3 = MenuItemImage::create(s_pathF1, s_pathF2, CC_CALLBACK_1(TestLayer2::nextCallback, this) ); - auto menu = Menu::create(item1, item2, item3, NULL); + auto menu = Menu::create(item1, item2, item3, nullptr); menu->setPosition( Vec2::ZERO ); item1->setPosition(Vec2(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CocoStudioGUITest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CocoStudioGUITest.cpp index 0cb3dcabcc..86e911a64a 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CocoStudioGUITest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CocoStudioGUITest.cpp @@ -109,7 +109,7 @@ void CocoStudioGUITestScene::onEnter() //#endif MenuItemLabel* pMenuItem = MenuItemLabel::create(label, CC_CALLBACK_1(CocoStudioGUITestScene::BackCallback, this)); - Menu* pMenu = Menu::create(pMenuItem, NULL); + Menu* pMenu = Menu::create(pMenuItem, nullptr); pMenu->setPosition( Vec2::ZERO ); pMenuItem->setPosition( Vec2( VisibleRect::right().x - 50, VisibleRect::bottom().y + 25) ); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CocosGUIScene.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CocosGUIScene.cpp index 6dfc88a1b9..e413761014 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CocosGUIScene.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CocosGUIScene.cpp @@ -310,7 +310,7 @@ void CocosGUITestScene::onEnter() //#endif auto pMenuItem = MenuItemLabel::create(label, CC_CALLBACK_1(CocosGUITestScene::BackCallback, this)); - Menu* pMenu =Menu::create(pMenuItem, NULL); + Menu* pMenu =Menu::create(pMenuItem, nullptr); pMenu->setPosition( Vec2::ZERO ); pMenuItem->setPosition( Vec2( VisibleRect::right().x - 50, VisibleRect::bottom().y + 25) ); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomGUIScene.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomGUIScene.cpp index ab993ab32f..a82f5c9384 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomGUIScene.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomGUIScene.cpp @@ -122,7 +122,7 @@ void CustomGUITestScene::onEnter() //#endif MenuItemLabel* pMenuItem = MenuItemLabel::create(label, CC_CALLBACK_1(CustomGUITestScene::BackCallback, this)); - Menu* pMenu = Menu::create(pMenuItem, NULL); + Menu* pMenu = Menu::create(pMenuItem, nullptr); pMenu->setPosition( Vec2::ZERO ); pMenuItem->setPosition( Vec2( VisibleRect::right().x - 50, VisibleRect::bottom().y + 25) ); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomTest/CustomImageTest/CustomImageTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomTest/CustomImageTest/CustomImageTest.cpp index 0bd735b7b4..c59549a914 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomTest/CustomImageTest/CustomImageTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomTest/CustomImageTest/CustomImageTest.cpp @@ -40,7 +40,7 @@ void CustomImageScene::onEnter() //#endif MenuItemLabel* pMenuItem = MenuItemLabel::create(label, CC_CALLBACK_1(CustomImageScene::BackCallback, this)); - Menu* pMenu = Menu::create(pMenuItem, NULL); + Menu* pMenu = Menu::create(pMenuItem, nullptr); pMenu->setPosition( Vec2::ZERO ); pMenuItem->setPosition( Vec2( VisibleRect::right().x - 50, VisibleRect::bottom().y + 25) ); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomTest/CustomParticleWidgetTest/CustomParticleWidgetTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomTest/CustomParticleWidgetTest/CustomParticleWidgetTest.cpp index ea7463c809..2898a95f57 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomTest/CustomParticleWidgetTest/CustomParticleWidgetTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomTest/CustomParticleWidgetTest/CustomParticleWidgetTest.cpp @@ -54,7 +54,7 @@ void CustomParticleWidgetScene::onEnter() //#endif MenuItemLabel* pMenuItem = MenuItemLabel::create(label, CC_CALLBACK_1(CustomParticleWidgetScene::BackCallback, this)); - Menu* pMenu = Menu::create(pMenuItem, NULL); + Menu* pMenu = Menu::create(pMenuItem, nullptr); pMenu->setPosition( Vec2::ZERO ); pMenuItem->setPosition( Vec2( VisibleRect::right().x - 50, VisibleRect::bottom().y + 25) ); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomImageView.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomImageView.cpp index 7f3e2af5ea..6c392cc8a6 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomImageView.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomImageView.cpp @@ -32,7 +32,7 @@ CustomImageView* CustomImageView::create() return custom; } CC_SAFE_DELETE(custom); - return NULL; + return nullptr; } bool CustomImageView::init() diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomImageViewReader.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomImageViewReader.cpp index d026cba12e..b2d9e6586e 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomImageViewReader.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomImageViewReader.cpp @@ -8,7 +8,7 @@ USING_NS_CC_EXT; using namespace cocos2d::ui; using namespace cocostudio; -static CustomImageViewReader* _instanceCustomImageViewReader = NULL; +static CustomImageViewReader* _instanceCustomImageViewReader = nullptr; CustomImageViewReader::CustomImageViewReader() { diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomParticleWidget.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomParticleWidget.cpp index 7e9aacd47c..0faa26e259 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomParticleWidget.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomParticleWidget.cpp @@ -40,7 +40,7 @@ CustomParticleWidget* CustomParticleWidget::create() return custom; } CC_SAFE_DELETE(custom); - return NULL; + return nullptr; } bool CustomParticleWidget::init() diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomParticleWidgetReader.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomParticleWidgetReader.cpp index 1e8c955e3d..8105b7669f 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomParticleWidgetReader.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomParticleWidgetReader.cpp @@ -25,7 +25,7 @@ CustomParticleWidgetReader::~CustomParticleWidgetReader() } -static CustomParticleWidgetReader* _instanceCustomParticleWidgetReader = NULL; +static CustomParticleWidgetReader* _instanceCustomParticleWidgetReader = nullptr; CustomParticleWidgetReader* CustomParticleWidgetReader::getInstance() { diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomReader.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomReader.cpp index 99cfc80547..13e7e8b804 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomReader.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomReader.cpp @@ -3,7 +3,7 @@ #include "CustomReader.h" #include "CustomImageView.h" -static CustomReader* _instanceCustomReader = NULL; +static CustomReader* _instanceCustomReader = nullptr; CustomReader::CustomReader() { diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest.cpp index ed58bea441..35c713551b 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest.cpp @@ -79,7 +79,7 @@ void UIButtonTest::touchEvent(Ref *pSender, Widget::TouchEventType type) imageView->loadTexture("cocosui/ccicon.png"); imageView->setOpacity(0); imageView->setVisible(true); - imageView->runAction(Sequence::create(FadeIn::create(0.5),DelayTime::create(1.0),FadeOut::create(0.5), NULL)); + imageView->runAction(Sequence::create(FadeIn::create(0.5),DelayTime::create(1.0),FadeOut::create(0.5), nullptr)); } break; @@ -165,7 +165,7 @@ void UIButtonTest_Scale9::touchEvent(Ref *pSender, Widget::TouchEventType type) Button *btn = (Button*)_uiLayer->getChildByName("normal"); btn->loadTextureNormal("cocosui/animationbuttonnormal.png"); btn->loadTexturePressed("cocosui/animationbuttonpressed.png"); - btn->runAction(Sequence::create(FadeIn::create(0.5),DelayTime::create(1.0),FadeOut::create(0.5), NULL)); + btn->runAction(Sequence::create(FadeIn::create(0.5),DelayTime::create(1.0),FadeOut::create(0.5), nullptr)); } break; diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIFocusTest/UIFocusTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIFocusTest/UIFocusTest.cpp index 030c136b4c..42ffc6e318 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIFocusTest/UIFocusTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIFocusTest/UIFocusTest.cpp @@ -302,7 +302,7 @@ bool UIFocusTestNestedLayout1::init() //add HBox into VBox HBox *hbox = HBox::create(); - hbox->setScale(0.8); + hbox->setScale(0.8f); hbox->setTag(101); _verticalLayout->addChild(hbox); @@ -384,7 +384,7 @@ bool UIFocusTestNestedLayout2::init() _horizontalLayout = HBox::create(); _horizontalLayout->setPosition(Vec2(winSize.width/2 - 200, winSize.height - 70)); _uiLayer->addChild(_horizontalLayout); - _horizontalLayout->setScale(0.6); + _horizontalLayout->setScale(0.6f); _horizontalLayout->setFocused(true); _horizontalLayout->setLoopFocus(true); @@ -397,14 +397,14 @@ bool UIFocusTestNestedLayout2::init() w->setAnchorPoint(Vec2(0,1)); w->setTouchEnabled(true); w->setTag(i+count1); - w->setScaleY(2.4); + w->setScaleY(2.4f); w->addTouchEventListener(CC_CALLBACK_2(UIFocusTestNestedLayout2::onImageViewClicked, this)); _horizontalLayout->addChild(w); } //add HBox into VBox VBox *vbox = VBox::create(); - vbox->setScale(0.8); + vbox->setScale(0.8f); vbox->setTag(101); _horizontalLayout->addChild(vbox); @@ -486,7 +486,7 @@ bool UIFocusTestNestedLayout3::init() _verticalLayout = VBox::create(); _verticalLayout->setPosition(Vec2(40, winSize.height - 70)); _uiLayer->addChild(_verticalLayout); - _verticalLayout->setScale(0.8); + _verticalLayout->setScale(0.8f); _verticalLayout->setFocused(true); _verticalLayout->setLoopFocus(true); @@ -602,7 +602,7 @@ bool UIFocusTestListView::init() _listView->setPosition(Vec2(40, 70)); _uiLayer->addChild(_listView); - _listView->setScale(0.8); + _listView->setScale(0.8f); _listView->setFocused(true); _listView->setLoopFocus(true); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIListViewTest/UIListViewTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIListViewTest/UIListViewTest.cpp index f10366869d..8de636b9de 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIListViewTest/UIListViewTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIListViewTest/UIListViewTest.cpp @@ -57,7 +57,7 @@ bool UIListViewTest_Vertical::init() listView->setBounceEnabled(true); listView->setBackGroundImage("cocosui/green_edit.png"); listView->setBackGroundImageScale9Enabled(true); - listView->setSize(Size(240, 130)); + 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 + @@ -74,7 +74,7 @@ bool UIListViewTest_Vertical::init() Layout* default_item = Layout::create(); default_item->setTouchEnabled(true); - default_item->setSize(default_button->getContentSize()); + default_item->setContentSize(default_button->getContentSize()); default_button->setPosition(Vec2(default_item->getContentSize().width / 2.0f, default_item->getContentSize().height / 2.0f)); default_item->addChild(default_button); @@ -106,10 +106,10 @@ bool UIListViewTest_Vertical::init() Button* custom_button = Button::create("cocosui/button.png", "cocosui/buttonHighlighted.png"); custom_button->setName("Title Button"); custom_button->setScale9Enabled(true); - custom_button->setSize(default_button->getContentSize()); + custom_button->setContentSize(default_button->getContentSize()); Layout *custom_item = Layout::create(); - custom_item->setSize(custom_button->getContentSize()); + custom_item->setContentSize(custom_button->getContentSize()); custom_button->setPosition(Vec2(custom_item->getContentSize().width / 2.0f, custom_item->getContentSize().height / 2.0f)); custom_item->addChild(custom_button); @@ -123,10 +123,10 @@ bool UIListViewTest_Vertical::init() Button* custom_button = Button::create("cocosui/button.png", "cocosui/buttonHighlighted.png"); custom_button->setName("Title Button"); custom_button->setScale9Enabled(true); - custom_button->setSize(default_button->getContentSize()); + custom_button->setContentSize(default_button->getContentSize()); Layout *custom_item = Layout::create(); - custom_item->setSize(custom_button->getContentSize()); + custom_item->setContentSize(custom_button->getContentSize()); custom_button->setPosition(Vec2(custom_item->getContentSize().width / 2.0f, custom_item->getContentSize().height / 2.0f)); custom_item->addChild(custom_button); custom_item->setTag(1); @@ -255,7 +255,7 @@ bool UIListViewTest_Horizontal::init() listView->setBounceEnabled(true); listView->setBackGroundImage("cocosui/green_edit.png"); listView->setBackGroundImageScale9Enabled(true); - listView->setSize(Size(240, 130)); + 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 + @@ -270,7 +270,7 @@ bool UIListViewTest_Horizontal::init() Layout *default_item = Layout::create(); default_item->setTouchEnabled(true); - default_item->setSize(default_button->getContentSize()); + default_item->setContentSize(default_button->getContentSize()); default_button->setPosition(Vec2(default_item->getContentSize().width / 2.0f, default_item->getContentSize().height / 2.0f)); default_item->addChild(default_button); @@ -295,10 +295,10 @@ bool UIListViewTest_Horizontal::init() Button* custom_button = Button::create("cocosui/button.png", "cocosui/buttonHighlighted.png"); custom_button->setName("Title Button"); custom_button->setScale9Enabled(true); - custom_button->setSize(default_button->getContentSize()); + custom_button->setContentSize(default_button->getContentSize()); Layout* custom_item = Layout::create(); - custom_item->setSize(custom_button->getContentSize()); + custom_item->setContentSize(custom_button->getContentSize()); custom_button->setPosition(Vec2(custom_item->getContentSize().width / 2.0f, custom_item->getContentSize().height / 2.0f)); custom_item->addChild(custom_button); @@ -312,10 +312,10 @@ bool UIListViewTest_Horizontal::init() Button* custom_button = Button::create("cocosui/button.png", "cocosui/buttonHighlighted.png"); custom_button->setName("Title Button"); custom_button->setScale9Enabled(true); - custom_button->setSize(default_button->getContentSize()); + custom_button->setContentSize(default_button->getContentSize()); Layout* custom_item = Layout::create(); - custom_item->setSize(custom_button->getContentSize()); + custom_item->setContentSize(custom_button->getContentSize()); custom_button->setPosition(Vec2(custom_item->getContentSize().width / 2.0f, custom_item->getContentSize().height / 2.0f)); custom_item->addChild(custom_button); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISceneManager.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISceneManager.cpp index 7c590f4810..69ad20c90a 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISceneManager.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISceneManager.cpp @@ -125,7 +125,7 @@ static const char* s_testArray[] = #endif }; -static UISceneManager *sharedInstance = NULL; +static UISceneManager *sharedInstance = nullptr; UISceneManager::UISceneManager() @@ -140,7 +140,7 @@ UISceneManager::~UISceneManager() UISceneManager * UISceneManager::sharedUISceneManager() { - if (sharedInstance == NULL) + if (sharedInstance == nullptr) { sharedInstance = new UISceneManager(); } @@ -391,5 +391,5 @@ Scene *UISceneManager::currentUIScene() return VideoPlayerTest::sceneWithTitle(s_testArray[_currentUISceneId]); #endif } - return NULL; + return nullptr; } diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISceneManager_Editor.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISceneManager_Editor.cpp index fcbc977ebf..38d81fc076 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISceneManager_Editor.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISceneManager_Editor.cpp @@ -48,7 +48,7 @@ static const char* s_testArray[] = "UIScrollViewTest_Both_Editor", }; -static UISceneManager_Editor* sharedInstance = NULL; +static UISceneManager_Editor* sharedInstance = nullptr; UISceneManager_Editor::UISceneManager_Editor() { @@ -62,7 +62,7 @@ UISceneManager_Editor::~UISceneManager_Editor() UISceneManager_Editor* UISceneManager_Editor::sharedUISceneManager_Editor() { - if (sharedInstance == NULL) + if (sharedInstance == nullptr) { sharedInstance = new UISceneManager_Editor(); } @@ -181,5 +181,5 @@ Scene* UISceneManager_Editor::currentUIScene() break; } - return NULL; + return nullptr; } diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScene_Editor.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScene_Editor.cpp index b7e12095d0..0f9a93c5af 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScene_Editor.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScene_Editor.cpp @@ -41,7 +41,7 @@ bool UIScene_Editor::init() pToggleItem->setPosition(Vec2(VisibleRect::right().x - 150, VisibleRect::top().y - 50));; - Menu* pMenu =Menu::create(pToggleItem, NULL); + Menu* pMenu =Menu::create(pToggleItem, nullptr); pMenu->setPosition( Vec2::ZERO ); addChild(pMenu, 1); diff --git a/tests/cpp-tests/Classes/ZwoptexTest/ZwoptexTest.cpp b/tests/cpp-tests/Classes/ZwoptexTest/ZwoptexTest.cpp index 333a0c0f8b..e2b4704a86 100644 --- a/tests/cpp-tests/Classes/ZwoptexTest/ZwoptexTest.cpp +++ b/tests/cpp-tests/Classes/ZwoptexTest/ZwoptexTest.cpp @@ -16,7 +16,7 @@ Layer* createZwoptexLayer(int nIndex) case 0: return new ZwoptexGenericTest(); } - return NULL; + return nullptr; } Layer* nextZwoptexTest() diff --git a/tests/cpp-tests/Classes/controller.cpp b/tests/cpp-tests/Classes/controller.cpp index 9eb2ea5447..b11d648d94 100644 --- a/tests/cpp-tests/Classes/controller.cpp +++ b/tests/cpp-tests/Classes/controller.cpp @@ -126,7 +126,7 @@ TestController::TestController() { // add close menu auto closeItem = MenuItemImage::create(s_pathClose, s_pathClose, CC_CALLBACK_1(TestController::closeCallback, this) ); - auto menu =Menu::create(closeItem, NULL); + auto menu =Menu::create(closeItem, nullptr); menu->setPosition( Vec2::ZERO ); closeItem->setPosition(Vec2( VisibleRect::right().x - 30, VisibleRect::top().y - 30)); @@ -533,7 +533,7 @@ void TestController::autorun() If socket(2) (or connect(2)) fails, we (close the socket and) try the next address. */ - for (rp = result; rp != NULL; rp = rp->ai_next) { + for (rp = result; rp != nullptr; rp = rp->ai_next) { sfd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol); if (sfd == -1) @@ -549,7 +549,7 @@ void TestController::autorun() #endif } - if (rp == NULL) { /* No address succeeded */ + if (rp == nullptr) { /* No address succeeded */ CCLOG("autotest: could not connect!"); return; } diff --git a/tests/cpp-tests/Classes/testBasic.cpp b/tests/cpp-tests/Classes/testBasic.cpp index 9c0ea38104..e60f288055 100644 --- a/tests/cpp-tests/Classes/testBasic.cpp +++ b/tests/cpp-tests/Classes/testBasic.cpp @@ -41,7 +41,7 @@ void TestScene::onEnter() auto label = Label::createWithTTF(ttfConfig,"MainMenu"); auto menuItem = MenuItemLabel::create(label, testScene_callback ); - auto menu = Menu::create(menuItem, NULL); + auto menu = Menu::create(menuItem, nullptr); menu->setPosition( Vec2::ZERO ); menuItem->setPosition( Vec2( VisibleRect::right().x - 50, VisibleRect::bottom().y + 25) ); diff --git a/tests/cpp-tests/Resources/ccs-res b/tests/cpp-tests/Resources/ccs-res index 6b28e94848..c307f62357 160000 --- a/tests/cpp-tests/Resources/ccs-res +++ b/tests/cpp-tests/Resources/ccs-res @@ -1 +1 @@ -Subproject commit 6b28e948482ca7ed44c31daf3fef2e42ad6b59fb +Subproject commit c307f62357e42d2e7e671f4741f855dc8a5fde3a diff --git a/tests/lua-tests/src/VideoPlayerTest/VideoPlayerTest.lua b/tests/lua-tests/src/VideoPlayerTest/VideoPlayerTest.lua new file mode 100644 index 0000000000..022745d079 --- /dev/null +++ b/tests/lua-tests/src/VideoPlayerTest/VideoPlayerTest.lua @@ -0,0 +1,148 @@ +require("experimentalConstants") + + +local visibleRect = cc.Director:getInstance():getOpenGLView():getVisibleRect() +local centerPos = cc.p(visibleRect.x + visibleRect.width / 2,visibleRect.y + visibleRect.height /2) + +local function VideoPlayerTest() + local layer = cc.Layer:create() --createTestLayer("VideoPlayerTest", "") + titleLabel = cc.Label:createWithTTF("VideoPlayerTest", s_arialPath, 28) + titleLabel:setAnchorPoint(cc.p(0.5, 0.5)) + layer:addChild(titleLabel, 1) + + cc.MenuItemFont:setFontSize(16) + + widget = ccs.GUIReader:getInstance():widgetFromJsonFile("cocosui/UITest/UITest.json") + layer:addChild(widget) + + local videoStateLabel = cc.Label:createWithSystemFont("IDLE","Arial",16) + videoStateLabel:setAnchorPoint(cc.p(1, 0.5)) + videoStateLabel:setPosition(cc.p(visibleRect.x + visibleRect.width - 10,visibleRect.y + 200)) + layer:addChild(videoStateLabel) + + local function onVideoEventCallback(sener, eventType) + if eventType == ccexprimental.VideoPlayerEvent.PLAYING then + videoStateLabel:setString("PLAYING") + elseif eventType == ccexprimental.VideoPlayerEvent.PAUSED then + videoStateLabel:setString("PAUSED") + elseif eventType == ccexprimental.VideoPlayerEvent.STOPPED then + videoStateLabel:setString("STOPPED") + elseif eventType == ccexprimental.VideoPlayerEvent.COMPLETED then + videoStateLabel:setString("COMPLETED") + end + end + local widgetSize = widget:getContentSize() + local videoPlayer = ccexprimental.VideoPlayer:create() + videoPlayer:setPosition(centerPos) + videoPlayer:setAnchorPoint(cc.p(0.5, 0.5)) + videoPlayer:setContentSize(cc.size(widgetSize.width * 0.4,widgetSize.height * 0.4)) + videoPlayer:addEventListener(onVideoEventCallback) + layer:addChild(videoPlayer) + + local screenSize = cc.Director:getInstance():getWinSize() + local rootSize = widget:getContentSize() + layer:setPosition(cc.p((screenSize.width - rootSize.width) / 2,(screenSize.height - rootSize.height) / 2)) + + local function menuFullScreenCallback(tag, sender) + if nil ~= videoPlayer then + videoPlayer:setFullScreenEnabled(not videoPlayer:isFullScreenEnabled()) + end + end + local fullSwitch = cc.MenuItemFont:create("FullScreenSwitch") + fullSwitch:setAnchorPoint(cc.p(0.0, 0.0)) + fullSwitch:setPosition(cc.p(visibleRect.x + 10,visibleRect.y + 50)) + fullSwitch:registerScriptTapHandler(menuFullScreenCallback) + + local function menuPauseCallback(tag, sender) + if nil ~= videoPlayer then + videoPlayer:pause() + end + end + local pauseItem = cc.MenuItemFont:create("Pause") + pauseItem:setAnchorPoint(cc.p(0.0, 0.0)) + pauseItem:setPosition(cc.p(visibleRect.x + 10,visibleRect.y + 100)) + pauseItem:registerScriptTapHandler(menuPauseCallback) + + local function menuResumeCallback(tag, sender) + if nil ~= videoPlayer then + videoPlayer:resume() + end + end + local resumeItem = cc.MenuItemFont:create("Resume") + resumeItem:setAnchorPoint(cc.p(0.0, 0.0)) + resumeItem:setPosition(cc.p(visibleRect.x + 10,visibleRect.y + 150)) + resumeItem:registerScriptTapHandler(menuResumeCallback) + + local function menuStopCallback(tag, sender) + if nil ~= videoPlayer then + videoPlayer:stop() + end + end + local stopItem = cc.MenuItemFont:create("Stop") + stopItem:setAnchorPoint(cc.p(0.0, 0.0)) + stopItem:setPosition(cc.p(visibleRect.x + 10,visibleRect.y + 200)) + stopItem:registerScriptTapHandler(menuStopCallback) + + local function menuHintCallback(tag, sender) + if nil ~= videoPlayer then + videoPlayer:setVisible(not videoPlayer:isVisible()) + end + end + local hintItem = cc.MenuItemFont:create("Hint") + hintItem:setAnchorPoint(cc.p(0.0, 0.0)) + hintItem:setPosition(cc.p(visibleRect.x + 10,visibleRect.y + 250)) + hintItem:registerScriptTapHandler(menuHintCallback) + + ------------------------------------------------------------ + local function menuResourceVideoCallback(tag, sender) + if nil ~= videoPlayer then + videoPlayer:setFileName("res/cocosvideo.mp4") + videoPlayer:play() + end + end + + local resourceVideo = cc.MenuItemFont:create("Play resource video") + resourceVideo:setAnchorPoint(cc.p(1, 0.5)) + resourceVideo:setPosition(cc.p(visibleRect.x + visibleRect.width - 10,visibleRect.y + 50)) + resourceVideo:registerScriptTapHandler(menuResourceVideoCallback) + + local function menuOnlineVideoCallback(tag, sender) + if nil ~= videoPlayer then + videoPlayer:setURL("http://video001.smgbb.cn/gslb/program/FDN/FDN1190949/HLSVodService.m3u8?_mdCode=6065719&_cdnCode=B2B_XL_TEST&_type=0&_rCode=TerOut_18865&_userId=020341000456068&_categoryCode=SMG_HUAYU&_categoryPath=SMG_1002,SMG_HUAYU,&_adPositionId=01001000&_adCategorySource=0&_flag=.m3u8&_enCode=m3u8&taskID=ysh_ps_002-ott_1397459105893_020341000456068&_client=103&_cms=ctv&_CDNToken=76C043FD4969501754DC19E54EC8DC2C") + videoPlayer:play() + end + end + local onlineVideo = cc.MenuItemFont:create("Play online video") + onlineVideo:setAnchorPoint(cc.p(1, 0.5)) + onlineVideo:setPosition(cc.p(visibleRect.x + visibleRect.width - 10,visibleRect.y + 100)) + onlineVideo:registerScriptTapHandler(menuOnlineVideoCallback) + + local function menuRatioCallback(tag, sender) + if nil ~= videoPlayer then + videoPlayer:setKeepAspectRatioEnabled(not videoPlayer:isKeepAspectRatioEnabled()) + end + end + local ratioSwitch = cc.MenuItemFont:create("KeepRatioSwitch") + ratioSwitch:setAnchorPoint(cc.p(1, 0.5)) + ratioSwitch:setPosition(cc.p(visibleRect.x + visibleRect.width - 10,visibleRect.y + 150)) + ratioSwitch:registerScriptTapHandler(menuRatioCallback) + + local menu = cc.Menu:create(fullSwitch, pauseItem, resumeItem, stopItem, hintItem, resourceVideo, onlineVideo, ratioSwitch) + menu:setPosition(cc.p(0.0, 0.0)) + layer:addChild(menu) + + return layer +end + + + +function VideoPlayerTestMain() + Helper.index = 1 + local scene = cc.Scene:create() + Helper.createFunctionTable = { + VideoPlayerTest + } + scene:addChild(VideoPlayerTest()) + scene:addChild(CreateBackMenuItem()) + return scene +end \ No newline at end of file diff --git a/tests/lua-tests/src/mainMenu.lua b/tests/lua-tests/src/mainMenu.lua index 436b473cca..e52de85e36 100644 --- a/tests/lua-tests/src/mainMenu.lua +++ b/tests/lua-tests/src/mainMenu.lua @@ -54,6 +54,7 @@ require "src/LuaBridgeTest/LuaBridgeTest" require "src/XMLHttpRequestTest/XMLHttpRequestTest" require "src/PhysicsTest/PhysicsTest" require "src/CaptureScreenTest/CaptureScreenTest" +require "src/VideoPlayerTest/VideoPlayerTest" local LINE_SPACE = 40 @@ -116,6 +117,7 @@ local _allTests = { { isSupported = true, name = "TouchesTest" , create_func = TouchesTest }, { isSupported = true, name = "TransitionsTest" , create_func = TransitionsTest }, { isSupported = true, name = "UserDefaultTest" , create_func= UserDefaultTestMain }, + { isSupported = true, name = "VideoPlayerTest" , create_func= VideoPlayerTestMain }, { isSupported = true, name = "XMLHttpRequestTest" , create_func = XMLHttpRequestTestMain }, { isSupported = true, name = "ZwoptexTest" , create_func = ZwoptexTestMain } } @@ -171,6 +173,13 @@ function CreateTestMenu() if not obj.isSupported then testMenuItem:setEnabled(false) end + + if obj.name == "VideoPlayerTest" then + if cc.PLATFORM_OS_IPHONE ~= targetPlatform and cc.PLATFORM_OS_ANDROID ~= targetPlatform then + testMenuItem:setEnabled(false) + end + end + testMenuItem:registerScriptTapHandler(menuCallback) testMenuItem:setPosition(cc.p(s.width / 2, (s.height - (index) * LINE_SPACE))) MainMenu:addChild(testMenuItem, index + 10000, index + 10000) diff --git a/tools/bindings-generator b/tools/bindings-generator index 0c16c3107b..132282d67a 160000 --- a/tools/bindings-generator +++ b/tools/bindings-generator @@ -1 +1 @@ -Subproject commit 0c16c3107b5c8b54e7414d7e984e21c3f242f33c +Subproject commit 132282d67aff8da7113f4a00596aac75e7b4528d diff --git a/tools/cocos2d-console b/tools/cocos2d-console index 7fc616bcbc..ce3e25bcd2 160000 --- a/tools/cocos2d-console +++ b/tools/cocos2d-console @@ -1 +1 @@ -Subproject commit 7fc616bcbcfd9b60e8b1188ba974e4f66621beb8 +Subproject commit ce3e25bcd273eaacd516d179587997ce8f62df70 diff --git a/tools/tolua/cocos2dx_experimental_video.ini b/tools/tolua/cocos2dx_experimental_video.ini new file mode 100644 index 0000000000..80bf9a254a --- /dev/null +++ b/tools/tolua/cocos2dx_experimental_video.ini @@ -0,0 +1,62 @@ +[cocos2dx_experimental_video] +# the prefix to be added to the generated functions. You might or might not use this in your own +# templates +prefix = cocos2dx_experimental_video + +# create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`) +# all classes will be embedded in that namespace +target_namespace = ccexprimental + +macro_judgement = #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) + +android_headers = -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.8/include +android_flags = -D_SIZE_T_DEFINED_ + +clang_headers = -I%(clangllvmdir)s/lib/clang/3.3/include +clang_flags = -nostdinc -x c++ -std=c++11 + +cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/editor-support -I%(cocosdir)s/cocos/platform/android + +cocos_flags = -DANDROID + +cxxgenerator_headers = + +# extra arguments for clang +extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s + +# what headers to parse +headers = %(cocosdir)s/cocos/ui/UIVideoPlayer.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 = VideoPlayer + +# what should we skip? in the format ClassName::[function function] +# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also +# regular expressions, they will not be surrounded by "^$". If you want to skip a whole class, just +# add a single "*" as functions. See bellow for several examples. A special class name is "*", which +# will apply to all class names. This is a convenience wildcard to be able to skip similar named +# functions from all classes. + +skip = VideoPlayer::[addEventListener] + +rename_functions = + +rename_classes = + +# for all class names, should we remove something when registering in the target VM? +remove_prefix = + +# classes for which there will be no "parent" lookup +classes_have_no_parents = + +# base classes which will be skipped when their sub-classes found them. +base_classes_to_skip = + +# classes that create no constructor +# Set is special and we will use a hand-written constructor +abstract_classes = + +# Determining whether to use script object(js object) to control the lifecycle of native(cpp) object or the other way around. Supported values are 'yes' or 'no'. +script_control_cpp = no + diff --git a/tools/tolua/cocos2dx_physics.ini b/tools/tolua/cocos2dx_physics.ini index 6911e254cb..dca3e11f6f 100644 --- a/tools/tolua/cocos2dx_physics.ini +++ b/tools/tolua/cocos2dx_physics.ini @@ -7,6 +7,8 @@ prefix = cocos2dx_physics # all classes will be embedded in that namespace target_namespace = cc +macro_judgement = #if CC_USE_PHYSICS + android_headers = -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.8/include android_flags = -D_SIZE_T_DEFINED_ diff --git a/tools/tolua/genbindings.py b/tools/tolua/genbindings.py index 37b823c89b..1fc2d34868 100755 --- a/tools/tolua/genbindings.py +++ b/tools/tolua/genbindings.py @@ -127,12 +127,12 @@ def main(): output_dir = '%s/cocos/scripting/lua-bindings/auto' % project_root cmd_args = {'cocos2dx.ini' : ('cocos2d-x', 'lua_cocos2dx_auto'), \ - #'cocos2dx_extension.ini' : ('cocos2dx_extension', 'lua_cocos2dx_extension_auto'), \ - #'cocos2dx_ui.ini' : ('cocos2dx_ui', 'lua_cocos2dx_ui_auto'), \ - #'cocos2dx_studio.ini' : ('cocos2dx_studio', 'lua_cocos2dx_studio_auto'), \ - #'cocos2dx_spine.ini' : ('cocos2dx_spine', 'lua_cocos2dx_spine_auto'), \ - #'cocos2dx_physics.ini' : ('cocos2dx_physics', 'lua_cocos2dx_physics_auto'), \ - #'cocos2dx_controller.ini' : ('cocos2dx_controller', 'lua_cocos2dx_controller_auto'), \ + 'cocos2dx_extension.ini' : ('cocos2dx_extension', 'lua_cocos2dx_extension_auto'), \ + 'cocos2dx_ui.ini' : ('cocos2dx_ui', 'lua_cocos2dx_ui_auto'), \ + 'cocos2dx_studio.ini' : ('cocos2dx_studio', 'lua_cocos2dx_studio_auto'), \ + 'cocos2dx_spine.ini' : ('cocos2dx_spine', 'lua_cocos2dx_spine_auto'), \ + 'cocos2dx_physics.ini' : ('cocos2dx_physics', 'lua_cocos2dx_physics_auto'), \ + 'cocos2dx_experimental_video.ini' : ('cocos2dx_experimental_video', 'lua_cocos2dx_experimental_video_auto'), \ } target = 'lua' generator_py = '%s/generator.py' % cxx_generator_root