mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 16:12:40 +08:00
Merge pull request #67 from zilongshanren/syncMasterBranch
Sync master branch
This commit is contained in:
@@ -622,11 +622,9 @@
|
||||
292DB14019B4574100A80320 /* UIEditBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 292DB13019B4574100A80320 /* UIEditBox.h */; };
|
||||
292DB14119B4574100A80320 /* UIEditBoxImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 292DB13119B4574100A80320 /* UIEditBoxImpl.h */; };
|
||||
292DB14219B4574100A80320 /* UIEditBoxImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 292DB13119B4574100A80320 /* UIEditBoxImpl.h */; };
|
||||
292DB14719B4574100A80320 /* UIEditBoxImpl-ios.h in Headers */ = {isa = PBXBuildFile; fileRef = 292DB13419B4574100A80320 /* UIEditBoxImpl-ios.h */; };
|
||||
292DB14819B4574100A80320 /* UIEditBoxImpl-ios.h in Headers */ = {isa = PBXBuildFile; fileRef = 292DB13419B4574100A80320 /* UIEditBoxImpl-ios.h */; };
|
||||
292DB14A19B4574100A80320 /* UIEditBoxImpl-ios.mm in Sources */ = {isa = PBXBuildFile; fileRef = 292DB13519B4574100A80320 /* UIEditBoxImpl-ios.mm */; };
|
||||
292DB14B19B4574100A80320 /* UIEditBoxImpl-mac.h in Headers */ = {isa = PBXBuildFile; fileRef = 292DB13619B4574100A80320 /* UIEditBoxImpl-mac.h */; };
|
||||
292DB14C19B4574100A80320 /* UIEditBoxImpl-mac.h in Headers */ = {isa = PBXBuildFile; fileRef = 292DB13619B4574100A80320 /* UIEditBoxImpl-mac.h */; };
|
||||
292DB14D19B4574100A80320 /* UIEditBoxImpl-mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 292DB13719B4574100A80320 /* UIEditBoxImpl-mac.mm */; };
|
||||
29394CF019B01DBA00D2DE1A /* UIWebView.h in Headers */ = {isa = PBXBuildFile; fileRef = 29394CEC19B01DBA00D2DE1A /* UIWebView.h */; };
|
||||
29394CF119B01DBA00D2DE1A /* UIWebView.h in Headers */ = {isa = PBXBuildFile; fileRef = 29394CEC19B01DBA00D2DE1A /* UIWebView.h */; };
|
||||
@@ -1147,6 +1145,17 @@
|
||||
A60A9D661C200E5A0070800A /* libchipmunk.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A60A9D651C200E5A0070800A /* libchipmunk.a */; };
|
||||
A614E2E01C8E72360065A737 /* CCLabelTTF.h in Headers */ = {isa = PBXBuildFile; fileRef = A614E2DE1C8E72360065A737 /* CCLabelTTF.h */; };
|
||||
A614E2E11C8E761D0065A737 /* CCLabelTTF.h in Headers */ = {isa = PBXBuildFile; fileRef = A614E2DE1C8E72360065A737 /* CCLabelTTF.h */; };
|
||||
A63CF0041CD9CF3500A6971D /* CCUIEditBoxMac.h in Headers */ = {isa = PBXBuildFile; fileRef = A63CEFF91CD9CF3500A6971D /* CCUIEditBoxMac.h */; };
|
||||
A63CF0051CD9CF3500A6971D /* CCUIEditBoxMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A63CEFFA1CD9CF3500A6971D /* CCUIEditBoxMac.mm */; };
|
||||
A63CF0061CD9CF3500A6971D /* CCUIMultilineTextField.h in Headers */ = {isa = PBXBuildFile; fileRef = A63CEFFB1CD9CF3500A6971D /* CCUIMultilineTextField.h */; };
|
||||
A63CF0071CD9CF3500A6971D /* CCUIMultilineTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = A63CEFFC1CD9CF3500A6971D /* CCUIMultilineTextField.m */; };
|
||||
A63CF0081CD9CF3500A6971D /* CCUIPasswordTextField.h in Headers */ = {isa = PBXBuildFile; fileRef = A63CEFFD1CD9CF3500A6971D /* CCUIPasswordTextField.h */; };
|
||||
A63CF0091CD9CF3500A6971D /* CCUIPasswordTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = A63CEFFE1CD9CF3500A6971D /* CCUIPasswordTextField.m */; };
|
||||
A63CF00A1CD9CF3500A6971D /* CCUISingleLineTextField.h in Headers */ = {isa = PBXBuildFile; fileRef = A63CEFFF1CD9CF3500A6971D /* CCUISingleLineTextField.h */; };
|
||||
A63CF00B1CD9CF3500A6971D /* CCUISingleLineTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = A63CF0001CD9CF3500A6971D /* CCUISingleLineTextField.m */; };
|
||||
A63CF00C1CD9CF3500A6971D /* CCUITextFieldFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = A63CF0011CD9CF3500A6971D /* CCUITextFieldFormatter.h */; };
|
||||
A63CF00D1CD9CF3500A6971D /* CCUITextFieldFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = A63CF0021CD9CF3500A6971D /* CCUITextFieldFormatter.m */; };
|
||||
A63CF00E1CD9CF3500A6971D /* CCUITextInput.h in Headers */ = {isa = PBXBuildFile; fileRef = A63CF0031CD9CF3500A6971D /* CCUITextInput.h */; };
|
||||
A679D0D91C71D90A00620A6C /* libssl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A6A554241C2A7C4400FDD954 /* libssl.a */; };
|
||||
A679D0DA1C71D93200620A6C /* libcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A6A554221C2A7C3100FDD954 /* libcrypto.a */; };
|
||||
A679D0F51C74BA3600620A6C /* CCArmature.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A679D0E71C74BA3600620A6C /* CCArmature.cpp */; };
|
||||
@@ -2076,6 +2085,17 @@
|
||||
A60A9D5E1C200DE10070800A /* CCPhysicsSprite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCPhysicsSprite.h; path = "physics-nodes/CCPhysicsSprite.h"; sourceTree = "<group>"; };
|
||||
A60A9D651C200E5A0070800A /* libchipmunk.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libchipmunk.a; path = ../external/ios/libs/libchipmunk.a; sourceTree = "<group>"; };
|
||||
A614E2DE1C8E72360065A737 /* CCLabelTTF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCLabelTTF.h; sourceTree = "<group>"; };
|
||||
A63CEFF91CD9CF3500A6971D /* CCUIEditBoxMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCUIEditBoxMac.h; path = Mac/CCUIEditBoxMac.h; sourceTree = "<group>"; };
|
||||
A63CEFFA1CD9CF3500A6971D /* CCUIEditBoxMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = CCUIEditBoxMac.mm; path = Mac/CCUIEditBoxMac.mm; sourceTree = "<group>"; };
|
||||
A63CEFFB1CD9CF3500A6971D /* CCUIMultilineTextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCUIMultilineTextField.h; path = Mac/CCUIMultilineTextField.h; sourceTree = "<group>"; };
|
||||
A63CEFFC1CD9CF3500A6971D /* CCUIMultilineTextField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CCUIMultilineTextField.m; path = Mac/CCUIMultilineTextField.m; sourceTree = "<group>"; };
|
||||
A63CEFFD1CD9CF3500A6971D /* CCUIPasswordTextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCUIPasswordTextField.h; path = Mac/CCUIPasswordTextField.h; sourceTree = "<group>"; };
|
||||
A63CEFFE1CD9CF3500A6971D /* CCUIPasswordTextField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CCUIPasswordTextField.m; path = Mac/CCUIPasswordTextField.m; sourceTree = "<group>"; };
|
||||
A63CEFFF1CD9CF3500A6971D /* CCUISingleLineTextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCUISingleLineTextField.h; path = Mac/CCUISingleLineTextField.h; sourceTree = "<group>"; };
|
||||
A63CF0001CD9CF3500A6971D /* CCUISingleLineTextField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CCUISingleLineTextField.m; path = Mac/CCUISingleLineTextField.m; sourceTree = "<group>"; };
|
||||
A63CF0011CD9CF3500A6971D /* CCUITextFieldFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCUITextFieldFormatter.h; path = Mac/CCUITextFieldFormatter.h; sourceTree = "<group>"; };
|
||||
A63CF0021CD9CF3500A6971D /* CCUITextFieldFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CCUITextFieldFormatter.m; path = Mac/CCUITextFieldFormatter.m; sourceTree = "<group>"; };
|
||||
A63CF0031CD9CF3500A6971D /* CCUITextInput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCUITextInput.h; path = Mac/CCUITextInput.h; sourceTree = "<group>"; };
|
||||
A679D0E71C74BA3600620A6C /* CCArmature.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CCArmature.cpp; path = Armature/CCArmature.cpp; sourceTree = "<group>"; };
|
||||
A679D0E81C74BA3600620A6C /* CCArmature.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCArmature.h; path = Armature/CCArmature.h; sourceTree = "<group>"; };
|
||||
A679D0E91C74BA3600620A6C /* CCArmatureAnimation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CCArmatureAnimation.cpp; path = Armature/CCArmatureAnimation.cpp; sourceTree = "<group>"; };
|
||||
@@ -2929,6 +2949,7 @@
|
||||
292DB12E19B4574100A80320 /* UIEditBox */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A63CEFF81CD9CF2700A6971D /* Mac */,
|
||||
2980F0161BA9A5550059E678 /* iOS */,
|
||||
A0E749F51BA8FD7F001A8332 /* UIEditBoxImpl-common.cpp */,
|
||||
A0E749F61BA8FD7F001A8332 /* UIEditBoxImpl-common.h */,
|
||||
@@ -3498,6 +3519,24 @@
|
||||
name = PhysicsSprite;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
A63CEFF81CD9CF2700A6971D /* Mac */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A63CEFF91CD9CF3500A6971D /* CCUIEditBoxMac.h */,
|
||||
A63CEFFA1CD9CF3500A6971D /* CCUIEditBoxMac.mm */,
|
||||
A63CEFFB1CD9CF3500A6971D /* CCUIMultilineTextField.h */,
|
||||
A63CEFFC1CD9CF3500A6971D /* CCUIMultilineTextField.m */,
|
||||
A63CEFFD1CD9CF3500A6971D /* CCUIPasswordTextField.h */,
|
||||
A63CEFFE1CD9CF3500A6971D /* CCUIPasswordTextField.m */,
|
||||
A63CEFFF1CD9CF3500A6971D /* CCUISingleLineTextField.h */,
|
||||
A63CF0001CD9CF3500A6971D /* CCUISingleLineTextField.m */,
|
||||
A63CF0011CD9CF3500A6971D /* CCUITextFieldFormatter.h */,
|
||||
A63CF0021CD9CF3500A6971D /* CCUITextFieldFormatter.m */,
|
||||
A63CF0031CD9CF3500A6971D /* CCUITextInput.h */,
|
||||
);
|
||||
name = Mac;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
A679D0E61C74BA1700620A6C /* Armature */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -3642,6 +3681,7 @@
|
||||
A679D1221C74BB3A00620A6C /* CCUtilMath.h in Headers */,
|
||||
50ABBD461925AB0000A911A9 /* CCVertex.h in Headers */,
|
||||
B63990CE1A490AFE00B07923 /* CCAsyncTaskPool.h in Headers */,
|
||||
A63CF0041CD9CF3500A6971D /* CCUIEditBoxMac.h in Headers */,
|
||||
B29A7E3119EE1B7700872B35 /* SkinnedMeshAttachment.h in Headers */,
|
||||
15AE1B6F19AADA9900C27E9E /* GUIDefine.h in Headers */,
|
||||
A679D1141C74BB3A00620A6C /* CCDataReaderHelper.h in Headers */,
|
||||
@@ -3652,6 +3692,7 @@
|
||||
50ABBED31925AB6F00A911A9 /* uthash.h in Headers */,
|
||||
B29A7E0119EE1B7700872B35 /* extension.h in Headers */,
|
||||
15AE196D19AAD35700C27E9E /* CCActionTimeline.h in Headers */,
|
||||
A63CF00A1CD9CF3500A6971D /* CCUISingleLineTextField.h in Headers */,
|
||||
3E2F27A719CFBFE400E7C490 /* AudioEngine.h in Headers */,
|
||||
15AE18A319AAD33D00C27E9E /* CCParticleSystemQuadLoader.h in Headers */,
|
||||
15FB20761AE7BF8600C31518 /* CCAutoPolygon.h in Headers */,
|
||||
@@ -3723,6 +3764,7 @@
|
||||
1A57011D180BC90D0088DEC7 /* CCGrabber.h in Headers */,
|
||||
B29A7E2B19EE1B7700872B35 /* AtlasAttachmentLoader.h in Headers */,
|
||||
15AE1B6819AADA9900C27E9E /* UIScale9Sprite.h in Headers */,
|
||||
A63CF00C1CD9CF3500A6971D /* CCUITextFieldFormatter.h in Headers */,
|
||||
1A570121180BC90D0088DEC7 /* CCGrid.h in Headers */,
|
||||
5034CA2D191D591100CE6051 /* ccShader_PositionTextureA8Color.frag in Headers */,
|
||||
B29A7E0F19EE1B7700872B35 /* SkeletonJson.h in Headers */,
|
||||
@@ -3774,6 +3816,7 @@
|
||||
50ABBD401925AB0000A911A9 /* CCMath.h in Headers */,
|
||||
B29A7E1F19EE1B7700872B35 /* BoneData.h in Headers */,
|
||||
1A5701FD180BCBAD0088DEC7 /* CCMenuItem.h in Headers */,
|
||||
A63CF00E1CD9CF3500A6971D /* CCUITextInput.h in Headers */,
|
||||
ED3057831BEC76C90083C3ED /* unzip.h in Headers */,
|
||||
1A570204180BCBD40088DEC7 /* CCClippingNode.h in Headers */,
|
||||
50643BE419BFCF1800EF68ED /* CCPlatformMacros.h in Headers */,
|
||||
@@ -3804,6 +3847,7 @@
|
||||
15AE188519AAD33D00C27E9E /* CCBSequence.h in Headers */,
|
||||
50643BE219BFCF1800EF68ED /* CCPlatformConfig.h in Headers */,
|
||||
B29A7DF519EE1B7700872B35 /* Skeleton.h in Headers */,
|
||||
A63CF0061CD9CF3500A6971D /* CCUIMultilineTextField.h in Headers */,
|
||||
5034CA49191D591100CE6051 /* ccShader_Label_df.frag in Headers */,
|
||||
292DB14119B4574100A80320 /* UIEditBoxImpl.h in Headers */,
|
||||
B29A7DD919EE1B7700872B35 /* SkeletonRenderer.h in Headers */,
|
||||
@@ -3815,7 +3859,6 @@
|
||||
5034CA3D191D591100CE6051 /* ccShader_PositionColor.frag in Headers */,
|
||||
A0534A6A1B87306E006B03E5 /* CCIDownloaderImpl.h in Headers */,
|
||||
1A570280180BCC900088DEC7 /* CCSprite.h in Headers */,
|
||||
292DB14719B4574100A80320 /* UIEditBoxImpl-ios.h in Headers */,
|
||||
15AE1B4E19AADA9900C27E9E /* UIListView.h in Headers */,
|
||||
1A570284180BCC900088DEC7 /* CCSpriteBatchNode.h in Headers */,
|
||||
5034CA2B191D591100CE6051 /* ccShader_PositionTextureA8Color.vert in Headers */,
|
||||
@@ -3944,6 +3987,7 @@
|
||||
50ABBEBD1925AB6F00A911A9 /* ccUtils.h in Headers */,
|
||||
A0534A651B872FFD006B03E5 /* CCDownloader-apple.h in Headers */,
|
||||
50ABC0231926664800A911A9 /* CCGLViewImpl-desktop.h in Headers */,
|
||||
A63CF0081CD9CF3500A6971D /* CCUIPasswordTextField.h in Headers */,
|
||||
15AE188D19AAD33D00C27E9E /* CCLabelBMFontLoader.h in Headers */,
|
||||
15AE1B5019AADA9900C27E9E /* UILoadingBar.h in Headers */,
|
||||
4649FF021BBA9FBE0001CC6F /* CCVertexAttribBinding.h in Headers */,
|
||||
@@ -4100,7 +4144,6 @@
|
||||
1A570094180BC5A10088DEC7 /* CCActionTween.h in Headers */,
|
||||
1A57009B180BC5C10088DEC7 /* CCAtlasNode.h in Headers */,
|
||||
1A5700A1180BC5D20088DEC7 /* CCNode.h in Headers */,
|
||||
292DB14C19B4574100A80320 /* UIEditBoxImpl-mac.h in Headers */,
|
||||
15AE1BF019AAE01E00C27E9E /* CCControlHuePicker.h in Headers */,
|
||||
15AE18B819AAD33D00C27E9E /* CCBSequenceProperty.h in Headers */,
|
||||
503DD8E41926736A00CD74DD /* CCDirectorCaller-ios.h in Headers */,
|
||||
@@ -4480,6 +4523,7 @@
|
||||
50ABBDB11925AB4100A911A9 /* ccShaders.cpp in Sources */,
|
||||
15AE18E419AAD35000C27E9E /* CCActionFrame.cpp in Sources */,
|
||||
15AE18FD19AAD35000C27E9E /* CCComAttribute.cpp in Sources */,
|
||||
A63CF00D1CD9CF3500A6971D /* CCUITextFieldFormatter.m in Sources */,
|
||||
50ABBE991925AB6F00A911A9 /* CCRef.cpp in Sources */,
|
||||
15AE186319AAD31D00C27E9E /* CDAudioManager.m in Sources */,
|
||||
ED9C6A9418599AD8000A5232 /* CCNodeGrid.cpp in Sources */,
|
||||
@@ -4496,6 +4540,7 @@
|
||||
15AE186A19AAD31D00C27E9E /* CocosDenshion.m in Sources */,
|
||||
ED30579A1BEC77B70083C3ED /* ConvertUTF.c in Sources */,
|
||||
15AE1B6319AADA9900C27E9E /* UICheckBox.cpp in Sources */,
|
||||
A63CF0051CD9CF3500A6971D /* CCUIEditBoxMac.mm in Sources */,
|
||||
15EFA211198A2BB5000C57D3 /* CCProtectedNode.cpp in Sources */,
|
||||
50ABBEB71925AB6F00A911A9 /* ccUTF8.cpp in Sources */,
|
||||
15AE189819AAD33D00C27E9E /* CCMenuItemLoader.cpp in Sources */,
|
||||
@@ -4615,6 +4660,7 @@
|
||||
B29A7DD119EE1B7700872B35 /* Skin.c in Sources */,
|
||||
1A5701FB180BCBAD0088DEC7 /* CCMenuItem.cpp in Sources */,
|
||||
1A570202180BCBD40088DEC7 /* CCClippingNode.cpp in Sources */,
|
||||
A63CF0091CD9CF3500A6971D /* CCUIPasswordTextField.m in Sources */,
|
||||
1A570208180BCBDF0088DEC7 /* CCMotionStreak.cpp in Sources */,
|
||||
1A570210180BCBF40088DEC7 /* CCProgressTimer.cpp in Sources */,
|
||||
292DB14D19B4574100A80320 /* UIEditBoxImpl-mac.mm in Sources */,
|
||||
@@ -4690,6 +4736,7 @@
|
||||
5012168E1AC47380009A4BEA /* CCRenderState.cpp in Sources */,
|
||||
B29A7DFB19EE1B7700872B35 /* spine-cocos2dx.cpp in Sources */,
|
||||
A679D12B1C74BD0200620A6C /* CCProcessBase.cpp in Sources */,
|
||||
A63CF00B1CD9CF3500A6971D /* CCUISingleLineTextField.m in Sources */,
|
||||
50ABC0011926664800A911A9 /* CCLock-apple.cpp in Sources */,
|
||||
A679D1211C74BB3A00620A6C /* CCUtilMath.cpp in Sources */,
|
||||
50ABBD931925AB4100A911A9 /* CCGLProgramState.cpp in Sources */,
|
||||
@@ -4753,6 +4800,7 @@
|
||||
50ABC0211926664800A911A9 /* CCGLViewImpl-desktop.cpp in Sources */,
|
||||
50ABC00D1926664800A911A9 /* CCFileUtils.cpp in Sources */,
|
||||
50ABBE4D1925AB6F00A911A9 /* CCEventCustom.cpp in Sources */,
|
||||
A63CF0071CD9CF3500A6971D /* CCUIMultilineTextField.m in Sources */,
|
||||
B5668D7D1B3838E4003CBD5E /* UIScrollViewBar.cpp in Sources */,
|
||||
50ABBE9F1925AB6F00A911A9 /* CCScheduler.cpp in Sources */,
|
||||
50ABC0151926664800A911A9 /* CCImage.cpp in Sources */,
|
||||
|
||||
@@ -130,8 +130,8 @@ void FlipX3D::update(float time)
|
||||
|
||||
Vec3 v0, v1, v, diff;
|
||||
|
||||
v0 = getOriginalVertex(Vec2(1.0f, 1.0f));
|
||||
v1 = getOriginalVertex(Vec2());
|
||||
v0 = getOriginalVertex(Vec2::ONE);
|
||||
v1 = getOriginalVertex(Vec2::ZERO);
|
||||
|
||||
float x0 = v0.x;
|
||||
float x1 = v1.x;
|
||||
@@ -224,8 +224,8 @@ void FlipY3D::update(float time)
|
||||
|
||||
Vec3 v0, v1, v, diff;
|
||||
|
||||
v0 = getOriginalVertex(Vec2(1.0f, 1.0f));
|
||||
v1 = getOriginalVertex(Vec2());
|
||||
v0 = getOriginalVertex(Vec2::ONE);
|
||||
v1 = getOriginalVertex(Vec2::ZERO);
|
||||
|
||||
float y0 = v0.y;
|
||||
float y1 = v1.y;
|
||||
|
||||
@@ -446,6 +446,11 @@ void ActionManager::update(float dt)
|
||||
{
|
||||
deleteHashElement(_currentTarget);
|
||||
}
|
||||
////if some node refrence 'target', it's refrence count >= 2 (issues #14050)
|
||||
else if(_currentTarget->target->getReferenceCount() == 1)
|
||||
{
|
||||
deleteHashElement(_currentTarget);
|
||||
}
|
||||
}
|
||||
|
||||
// issue #635
|
||||
|
||||
@@ -107,9 +107,7 @@ bool ClippingNode::init()
|
||||
|
||||
bool ClippingNode::init(Node *stencil)
|
||||
{
|
||||
CC_SAFE_RELEASE(_stencil);
|
||||
_stencil = stencil;
|
||||
CC_SAFE_RETAIN(_stencil);
|
||||
setStencil(stencil);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ bool ComponentContainer::add(Component *com)
|
||||
CCASSERT(com->getOwner() == nullptr, "Component already added. It can't be added again");
|
||||
do
|
||||
{
|
||||
if (com == nullptr || com->getOwner() == nullptr) {
|
||||
if (com == nullptr || com->getOwner() != nullptr) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -326,9 +326,7 @@ void DrawNode::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
||||
|
||||
void DrawNode::onDraw(const Mat4 &transform, uint32_t flags)
|
||||
{
|
||||
auto glProgram = getGLProgram();
|
||||
glProgram->use();
|
||||
glProgram->setUniformsForBuiltins(transform);
|
||||
getGLProgramState()->apply(transform);
|
||||
|
||||
GL::blendFunc(_blendFunc.src, _blendFunc.dst);
|
||||
|
||||
|
||||
@@ -823,7 +823,7 @@ void TMXLayer::setupTileSprite(Sprite* sprite, Vec2 pos, int gid)
|
||||
if (gid & kTMXTileDiagonalFlag)
|
||||
{
|
||||
// put the anchor in the middle for ease of rotation.
|
||||
sprite->setAnchorPoint(Vec2(0.5f,0.5f));
|
||||
sprite->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
|
||||
sprite->setPosition(getPositionAt(pos).x + sprite->getContentSize().height/2,
|
||||
getPositionAt(pos).y + sprite->getContentSize().width/2 );
|
||||
|
||||
|
||||
@@ -779,15 +779,17 @@ FontAtlas * FontFNT::createFontAtlas()
|
||||
// Purge uniform hash
|
||||
HASH_ITER(hh, _configuration->_fontDefDictionary, currentElement, tmp)
|
||||
{
|
||||
|
||||
FontLetterDefinition tempDefinition;
|
||||
|
||||
fontDef = currentElement->fontDef;
|
||||
if (fontDef.charID > 65535) {
|
||||
CCLOGWARN("Warning: 65535 < fontDef.charID (%u), ignored", fontDef.charID);
|
||||
continue;
|
||||
}
|
||||
|
||||
Rect tempRect;
|
||||
|
||||
tempRect = fontDef.rect;
|
||||
tempRect = CC_RECT_PIXELS_TO_POINTS(tempRect);
|
||||
|
||||
FontLetterDefinition tempDefinition;
|
||||
tempDefinition.offsetX = fontDef.xOffset;
|
||||
tempDefinition.offsetY = fontDef.yOffset;
|
||||
|
||||
|
||||
@@ -857,7 +857,6 @@ bool Label::updateQuads()
|
||||
batchNode->getTextureAtlas()->removeAllQuads();
|
||||
}
|
||||
|
||||
bool letterClamp = false;
|
||||
for (int ctr = 0; ctr < _lengthOfString; ++ctr)
|
||||
{
|
||||
if (_lettersInfo[ctr].valid)
|
||||
@@ -893,7 +892,6 @@ bool Label::updateQuads()
|
||||
_reusedRect.size.width = 0;
|
||||
}else if(_overflow == Overflow::SHRINK){
|
||||
if (_contentSize.width > letterDef.width) {
|
||||
letterClamp = true;
|
||||
ret = false;
|
||||
break;
|
||||
}else{
|
||||
|
||||
@@ -48,7 +48,7 @@ NS_CC_BEGIN
|
||||
Layer::Layer()
|
||||
{
|
||||
_ignoreAnchorPointForPosition = true;
|
||||
setAnchorPoint(Vec2(0.5f, 0.5f));
|
||||
setAnchorPoint(Vec2::ANCHOR_MIDDLE);
|
||||
}
|
||||
|
||||
Layer::~Layer()
|
||||
|
||||
@@ -137,7 +137,7 @@ bool Menu::initWithArray(const Vector<MenuItem*>& arrayOfItems)
|
||||
Size s = _director->getWinSize();
|
||||
|
||||
this->ignoreAnchorPointForPosition(true);
|
||||
setAnchorPoint(Vec2(0.5f, 0.5f));
|
||||
setAnchorPoint(Vec2::ANCHOR_MIDDLE);
|
||||
this->setContentSize(s);
|
||||
|
||||
setPosition(s.width/2, s.height/2);
|
||||
|
||||
@@ -60,7 +60,7 @@ MenuItem* MenuItem::create( const ccMenuCallback& callback)
|
||||
|
||||
bool MenuItem::initWithCallback(const ccMenuCallback& callback)
|
||||
{
|
||||
setAnchorPoint(Vec2(0.5f, 0.5f));
|
||||
setAnchorPoint(Vec2::ANCHOR_MIDDLE);
|
||||
_callback = callback;
|
||||
_enabled = true;
|
||||
_selected = false;
|
||||
@@ -89,14 +89,6 @@ void MenuItem::activate()
|
||||
{
|
||||
_callback(this);
|
||||
}
|
||||
#if CC_ENABLE_SCRIPT_BINDING
|
||||
if (kScriptTypeNone != _scriptType && ScriptEngineManager::ShareInstance)
|
||||
{
|
||||
BasicScriptData data(this);
|
||||
ScriptEvent scriptEvent(kMenuClickedEvent,&data);
|
||||
ScriptEngineManager::ShareInstance->getScriptEngine()->sendEvent(&scriptEvent);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -391,7 +383,8 @@ void MenuItemSprite::setNormalImage(Node* image)
|
||||
if (image)
|
||||
{
|
||||
addChild(image);
|
||||
image->setAnchorPoint(Vec2(0, 0));
|
||||
image->setAnchorPoint(Vec2::ANCHOR_BOTTOM_LEFT);
|
||||
setContentSize(image->getContentSize());
|
||||
}
|
||||
|
||||
if (_normalImage)
|
||||
@@ -400,7 +393,6 @@ void MenuItemSprite::setNormalImage(Node* image)
|
||||
}
|
||||
|
||||
_normalImage = image;
|
||||
this->setContentSize(_normalImage->getContentSize());
|
||||
this->updateImagesVisibility();
|
||||
}
|
||||
}
|
||||
@@ -412,7 +404,7 @@ void MenuItemSprite::setSelectedImage(Node* image)
|
||||
if (image)
|
||||
{
|
||||
addChild(image);
|
||||
image->setAnchorPoint(Vec2(0, 0));
|
||||
image->setAnchorPoint(Vec2::ANCHOR_BOTTOM_LEFT);
|
||||
}
|
||||
|
||||
if (_selectedImage)
|
||||
@@ -432,7 +424,7 @@ void MenuItemSprite::setDisabledImage(Node* image)
|
||||
if (image)
|
||||
{
|
||||
addChild(image);
|
||||
image->setAnchorPoint(Vec2(0, 0));
|
||||
image->setAnchorPoint(Vec2::ANCHOR_BOTTOM_LEFT);
|
||||
}
|
||||
|
||||
if (_disabledImage)
|
||||
@@ -544,7 +536,7 @@ void MenuItemSprite::updateImagesVisibility()
|
||||
{
|
||||
if (_enabled)
|
||||
{
|
||||
if (_normalImage) _normalImage->setVisible(true);
|
||||
if (_normalImage) _normalImage->setVisible(true);
|
||||
if (_selectedImage) _selectedImage->setVisible(false);
|
||||
if (_disabledImage) _disabledImage->setVisible(false);
|
||||
}
|
||||
@@ -552,13 +544,13 @@ void MenuItemSprite::updateImagesVisibility()
|
||||
{
|
||||
if (_disabledImage)
|
||||
{
|
||||
if (_normalImage) _normalImage->setVisible(false);
|
||||
if (_normalImage) _normalImage->setVisible(false);
|
||||
if (_selectedImage) _selectedImage->setVisible(false);
|
||||
if (_disabledImage) _disabledImage->setVisible(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_normalImage) _normalImage->setVisible(true);
|
||||
if (_normalImage) _normalImage->setVisible(true);
|
||||
if (_selectedImage) _selectedImage->setVisible(false);
|
||||
if (_disabledImage) _disabledImage->setVisible(false);
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ Node::~Node()
|
||||
#endif
|
||||
|
||||
if (_running) {
|
||||
log("Node still marked as running on node destruction! Was base class onExit() called in derived class onExit() implementations?");
|
||||
CCLOG("Node still marked as running on node destruction! Was base class onExit() called in derived class onExit() implementations?");
|
||||
}
|
||||
CC_SAFE_RELEASE(_eventDispatcher);
|
||||
}
|
||||
@@ -730,6 +730,8 @@ Node* Node::getChildByTag(int tag) const
|
||||
Node* Node::getChildByName(const std::string& name) const
|
||||
{
|
||||
CCASSERT(!name.empty(), "Invalid name");
|
||||
if (name.empty())
|
||||
return nullptr;
|
||||
|
||||
std::hash<std::string> h;
|
||||
size_t hash = h(name);
|
||||
@@ -883,6 +885,11 @@ void Node::addChildHelper(Node* child, int localZOrder, int tag, const std::stri
|
||||
if (child == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (child->_parent != nullptr)
|
||||
{
|
||||
log("child already added. It can't be added again");
|
||||
return;
|
||||
}
|
||||
if (_children.empty())
|
||||
{
|
||||
this->childrenAlloc();
|
||||
|
||||
@@ -307,7 +307,7 @@ bool ParticleSun::initWithTotalParticles(int numberOfParticles)
|
||||
setEmitterMode(Mode::GRAVITY);
|
||||
|
||||
// Gravity Mode: gravity
|
||||
setGravity(Vec2(0,0));
|
||||
setGravity(Vec2::ZERO);
|
||||
|
||||
// Gravity mode: radial acceleration
|
||||
setRadialAccel(0);
|
||||
@@ -411,7 +411,7 @@ bool ParticleGalaxy::initWithTotalParticles(int numberOfParticles)
|
||||
setEmitterMode(Mode::GRAVITY);
|
||||
|
||||
// Gravity Mode: gravity
|
||||
setGravity(Vec2(0,0));
|
||||
setGravity(Vec2::ZERO);
|
||||
|
||||
// Gravity Mode: speed of particles
|
||||
setSpeed(60);
|
||||
@@ -520,7 +520,7 @@ bool ParticleFlower::initWithTotalParticles(int numberOfParticles)
|
||||
setEmitterMode(Mode::GRAVITY);
|
||||
|
||||
// Gravity Mode: gravity
|
||||
setGravity(Vec2(0,0));
|
||||
setGravity(Vec2::ZERO);
|
||||
|
||||
// Gravity Mode: speed of particles
|
||||
setSpeed(80);
|
||||
@@ -737,7 +737,7 @@ bool ParticleSpiral::initWithTotalParticles(int numberOfParticles)
|
||||
setEmitterMode(Mode::GRAVITY);
|
||||
|
||||
// Gravity Mode: gravity
|
||||
setGravity(Vec2(0,0));
|
||||
setGravity(Vec2::ZERO);
|
||||
|
||||
// Gravity Mode: speed of particles
|
||||
setSpeed(150);
|
||||
@@ -845,7 +845,7 @@ bool ParticleExplosion::initWithTotalParticles(int numberOfParticles)
|
||||
setEmitterMode(Mode::GRAVITY);
|
||||
|
||||
// Gravity Mode: gravity
|
||||
setGravity(Vec2(0,0));
|
||||
setGravity(Vec2::ZERO);
|
||||
|
||||
// Gravity Mode: speed of particles
|
||||
setSpeed(70);
|
||||
@@ -954,7 +954,7 @@ bool ParticleSmoke::initWithTotalParticles(int numberOfParticles)
|
||||
setEmitterMode(Mode::GRAVITY);
|
||||
|
||||
// Gravity Mode: gravity
|
||||
setGravity(Vec2(0,0));
|
||||
setGravity(Vec2::ZERO);
|
||||
|
||||
// Gravity Mode: radial acceleration
|
||||
setRadialAccel(0);
|
||||
|
||||
@@ -73,11 +73,11 @@ bool ProgressTimer::initWithSprite(Sprite* sp)
|
||||
_vertexData = nullptr;
|
||||
_vertexDataCount = 0;
|
||||
|
||||
setAnchorPoint(Vec2(0.5f,0.5f));
|
||||
setAnchorPoint(Vec2::ANCHOR_MIDDLE);
|
||||
_type = Type::RADIAL;
|
||||
_reverseDirection = false;
|
||||
setMidpoint(Vec2(0.5f, 0.5f));
|
||||
setBarChangeRate(Vec2(1,1));
|
||||
setMidpoint(Vec2::ANCHOR_MIDDLE);
|
||||
setBarChangeRate(Vec2::ONE);
|
||||
setSprite(sp);
|
||||
|
||||
// shader state
|
||||
@@ -246,7 +246,7 @@ GLubyte ProgressTimer::getOpacity() const
|
||||
|
||||
void ProgressTimer::setMidpoint(const Vec2& midPoint)
|
||||
{
|
||||
_midpoint = midPoint.getClampPoint(Vec2::ZERO, Vec2(1, 1));
|
||||
_midpoint = midPoint.getClampPoint(Vec2::ZERO, Vec2::ONE);
|
||||
}
|
||||
|
||||
///
|
||||
@@ -448,20 +448,20 @@ void ProgressTimer::updateBar()
|
||||
_vertexData = (V2F_C4B_T2F*)malloc(_vertexDataCount * sizeof(V2F_C4B_T2F));
|
||||
CCASSERT( _vertexData, "CCProgressTimer. Not enough memory");
|
||||
// TOPLEFT 1
|
||||
_vertexData[0].texCoords = textureCoordFromAlphaPoint(Vec2(0,1));
|
||||
_vertexData[0].vertices = vertexFromAlphaPoint(Vec2(0,1));
|
||||
_vertexData[0].texCoords = textureCoordFromAlphaPoint(Vec2::UNIT_Y);
|
||||
_vertexData[0].vertices = vertexFromAlphaPoint(Vec2::UNIT_Y);
|
||||
|
||||
// BOTLEFT 1
|
||||
_vertexData[1].texCoords = textureCoordFromAlphaPoint(Vec2(0,0));
|
||||
_vertexData[1].vertices = vertexFromAlphaPoint(Vec2(0,0));
|
||||
_vertexData[1].texCoords = textureCoordFromAlphaPoint(Vec2::ZERO);
|
||||
_vertexData[1].vertices = vertexFromAlphaPoint(Vec2::ZERO);
|
||||
|
||||
// TOPRIGHT 2
|
||||
_vertexData[6].texCoords = textureCoordFromAlphaPoint(Vec2(1,1));
|
||||
_vertexData[6].vertices = vertexFromAlphaPoint(Vec2(1,1));
|
||||
_vertexData[6].texCoords = textureCoordFromAlphaPoint(Vec2::ONE);
|
||||
_vertexData[6].vertices = vertexFromAlphaPoint(Vec2::ONE);
|
||||
|
||||
// BOTRIGHT 2
|
||||
_vertexData[7].texCoords = textureCoordFromAlphaPoint(Vec2(1,0));
|
||||
_vertexData[7].vertices = vertexFromAlphaPoint(Vec2(1,0));
|
||||
_vertexData[7].texCoords = textureCoordFromAlphaPoint(Vec2::UNIT_X);
|
||||
_vertexData[7].vertices = vertexFromAlphaPoint(Vec2::UNIT_X);
|
||||
}
|
||||
|
||||
// TOPRIGHT 1
|
||||
|
||||
@@ -531,7 +531,7 @@ Image* RenderTexture::newImage(bool fliimage)
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, _FBO);
|
||||
|
||||
// TODO: move this to configuration, so we don't check it every time
|
||||
/* Certain Qualcomm Andreno gpu's will retain data in memory after a frame buffer switch which corrupts the render to the texture. The solution is to clear the frame buffer before rendering to the texture. However, calling glClear has the unintended result of clearing the current texture. Create a temporary texture to overcome this. At the end of RenderTexture::begin(), switch the attached texture to the second one, call glClear, and then switch back to the original texture. This solution is unnecessary for other devices as they don't have the same issue with switching frame buffers.
|
||||
/* Certain Qualcomm Adreno GPU's will retain data in memory after a frame buffer switch which corrupts the render to the texture. The solution is to clear the frame buffer before rendering to the texture. However, calling glClear has the unintended result of clearing the current texture. Create a temporary texture to overcome this. At the end of RenderTexture::begin(), switch the attached texture to the second one, call glClear, and then switch back to the original texture. This solution is unnecessary for other devices as they don't have the same issue with switching frame buffers.
|
||||
*/
|
||||
if (Configuration::getInstance()->checkForGLExtension("GL_QCOM"))
|
||||
{
|
||||
@@ -613,7 +613,7 @@ void RenderTexture::onBegin()
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, _FBO);
|
||||
|
||||
// TODO: move this to configuration, so we don't check it every time
|
||||
/* Certain Qualcomm Andreno gpu's will retain data in memory after a frame buffer switch which corrupts the render to the texture. The solution is to clear the frame buffer before rendering to the texture. However, calling glClear has the unintended result of clearing the current texture. Create a temporary texture to overcome this. At the end of RenderTexture::begin(), switch the attached texture to the second one, call glClear, and then switch back to the original texture. This solution is unnecessary for other devices as they don't have the same issue with switching frame buffers.
|
||||
/* Certain Qualcomm Adreno GPU's will retain data in memory after a frame buffer switch which corrupts the render to the texture. The solution is to clear the frame buffer before rendering to the texture. However, calling glClear has the unintended result of clearing the current texture. Create a temporary texture to overcome this. At the end of RenderTexture::begin(), switch the attached texture to the second one, call glClear, and then switch back to the original texture. This solution is unnecessary for other devices as they don't have the same issue with switching frame buffers.
|
||||
*/
|
||||
if (Configuration::getInstance()->checkForGLExtension("GL_QCOM"))
|
||||
{
|
||||
|
||||
@@ -144,7 +144,7 @@ Sprite* Sprite::create()
|
||||
|
||||
bool Sprite::init()
|
||||
{
|
||||
return initWithTexture(nullptr, Rect::ZERO );
|
||||
return initWithTexture(nullptr, Rect::ZERO, false);
|
||||
}
|
||||
|
||||
bool Sprite::initWithTexture(Texture2D *texture)
|
||||
@@ -158,7 +158,7 @@ bool Sprite::initWithTexture(Texture2D *texture)
|
||||
Rect rect = Rect::ZERO;
|
||||
rect.size = texture->getContentSize();
|
||||
|
||||
return initWithTexture(texture, rect);
|
||||
return initWithTexture(texture, rect, false);
|
||||
}
|
||||
|
||||
bool Sprite::initWithTexture(Texture2D *texture, const Rect& rect)
|
||||
@@ -175,7 +175,7 @@ bool Sprite::initWithFile(const std::string& filename)
|
||||
{
|
||||
Rect rect = Rect::ZERO;
|
||||
rect.size = texture->getContentSize();
|
||||
return initWithTexture(texture, rect);
|
||||
return initWithTexture(texture, rect, false);
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -188,7 +188,7 @@ bool Sprite::initWithFile(const std::string &filename, const Rect& rect)
|
||||
Texture2D *texture = _director->getTextureCache()->addImage(filename);
|
||||
if (texture)
|
||||
{
|
||||
return initWithTexture(texture, rect);
|
||||
return initWithTexture(texture, rect, false);
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -253,7 +253,7 @@ bool Sprite::initWithTexture(Texture2D *texture, const Rect& rect, bool rotated)
|
||||
_flippedX = _flippedY = false;
|
||||
|
||||
// default transform anchor: center
|
||||
setAnchorPoint(Vec2(0.5f, 0.5f));
|
||||
setAnchorPoint(Vec2::ANCHOR_MIDDLE);
|
||||
|
||||
// zwoptex default values
|
||||
_offsetPosition.setZero();
|
||||
@@ -336,7 +336,7 @@ void Sprite::setTexture(const std::string &filename)
|
||||
Texture2D *texture = _director->getTextureCache()->addImage(filename);
|
||||
|
||||
setTexture(texture);
|
||||
|
||||
_unflippedOffsetPositionFromCenter = Vec2::ZERO;
|
||||
Rect rect = Rect::ZERO;
|
||||
if (texture)
|
||||
rect.size = texture->getContentSize();
|
||||
|
||||
@@ -120,7 +120,7 @@ bool TextFieldTTF::initWithPlaceHolder(const std::string& placeholder, const Siz
|
||||
}
|
||||
bool TextFieldTTF::initWithPlaceHolder(const std::string& placeholder, const std::string& fontName, float fontSize)
|
||||
{
|
||||
_placeHolder = std::string(placeholder);
|
||||
_placeHolder = placeholder;
|
||||
setSystemFontName(fontName);
|
||||
setSystemFontSize(fontSize);
|
||||
Label::setTextColor(_colorSpaceHolder);
|
||||
|
||||
@@ -279,8 +279,8 @@ void TransitionRotoZoom:: onEnter()
|
||||
_inScene->setScale(0.001f);
|
||||
_outScene->setScale(1.0f);
|
||||
|
||||
_inScene->setAnchorPoint(Vec2(0.5f, 0.5f));
|
||||
_outScene->setAnchorPoint(Vec2(0.5f, 0.5f));
|
||||
_inScene->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
|
||||
_outScene->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
|
||||
|
||||
ActionInterval *rotozoom = (ActionInterval*)(Sequence::create
|
||||
(
|
||||
@@ -335,8 +335,8 @@ void TransitionJumpZoom::onEnter()
|
||||
|
||||
_inScene->setScale(0.5f);
|
||||
_inScene->setPosition(s.width, 0);
|
||||
_inScene->setAnchorPoint(Vec2(0.5f, 0.5f));
|
||||
_outScene->setAnchorPoint(Vec2(0.5f, 0.5f));
|
||||
_inScene->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
|
||||
_outScene->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
|
||||
|
||||
ActionInterval *jump = JumpBy::create(_duration/4, Vec2(-s.width,0), s.width/4, 2);
|
||||
ActionInterval *scaleIn = ScaleTo::create(_duration/4, 1.0f);
|
||||
@@ -403,7 +403,7 @@ void TransitionMoveInL::onEnter()
|
||||
|
||||
ActionInterval* TransitionMoveInL::action()
|
||||
{
|
||||
return MoveTo::create(_duration, Vec2(0,0));
|
||||
return MoveTo::create(_duration, Vec2::ZERO);
|
||||
}
|
||||
|
||||
ActionInterval* TransitionMoveInL::easeActionWithAction(ActionInterval* action)
|
||||
@@ -1308,9 +1308,9 @@ void TransitionCrossFade::onEnter()
|
||||
return;
|
||||
}
|
||||
|
||||
inTexture->getSprite()->setAnchorPoint( Vec2(0.5f,0.5f) );
|
||||
inTexture->getSprite()->setAnchorPoint( Vec2::ANCHOR_MIDDLE );
|
||||
inTexture->setPosition(size.width/2, size.height/2);
|
||||
inTexture->setAnchorPoint( Vec2(0.5f,0.5f) );
|
||||
inTexture->setAnchorPoint( Vec2::ANCHOR_MIDDLE );
|
||||
|
||||
// render inScene to its texturebuffer
|
||||
inTexture->begin();
|
||||
@@ -1319,9 +1319,9 @@ void TransitionCrossFade::onEnter()
|
||||
|
||||
// create the second render texture for outScene
|
||||
RenderTexture* outTexture = RenderTexture::create((int)size.width, (int)size.height,Texture2D::PixelFormat::RGBA8888,GL_DEPTH24_STENCIL8);
|
||||
outTexture->getSprite()->setAnchorPoint( Vec2(0.5f,0.5f) );
|
||||
outTexture->getSprite()->setAnchorPoint( Vec2::ANCHOR_MIDDLE );
|
||||
outTexture->setPosition(size.width/2, size.height/2);
|
||||
outTexture->setAnchorPoint( Vec2(0.5f,0.5f) );
|
||||
outTexture->setAnchorPoint( Vec2::ANCHOR_MIDDLE );
|
||||
|
||||
// render outScene to its texturebuffer
|
||||
outTexture->begin();
|
||||
|
||||
@@ -72,9 +72,9 @@ void TransitionProgress::onEnter()
|
||||
|
||||
// create the second render texture for outScene
|
||||
RenderTexture *texture = RenderTexture::create((int)size.width, (int)size.height,Texture2D::PixelFormat::RGBA8888,GL_DEPTH24_STENCIL8);
|
||||
texture->getSprite()->setAnchorPoint(Vec2(0.5f,0.5f));
|
||||
texture->getSprite()->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
|
||||
texture->setPosition(size.width/2, size.height/2);
|
||||
texture->setAnchorPoint(Vec2(0.5f,0.5f));
|
||||
texture->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
|
||||
|
||||
// render outScene to its texturebuffer
|
||||
texture->beginWithClear(0, 0, 0, 1);
|
||||
@@ -145,7 +145,7 @@ ProgressTimer* TransitionProgressRadialCCW::progressTimerNodeWithRenderTexture(R
|
||||
node->setReverseDirection(false);
|
||||
node->setPercentage(100);
|
||||
node->setPosition(size.width/2, size.height/2);
|
||||
node->setAnchorPoint(Vec2(0.5f,0.5f));
|
||||
node->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
|
||||
|
||||
return node;
|
||||
}
|
||||
@@ -189,7 +189,7 @@ ProgressTimer* TransitionProgressRadialCW::progressTimerNodeWithRenderTexture(Re
|
||||
node->setReverseDirection(true);
|
||||
node->setPercentage(100);
|
||||
node->setPosition(size.width/2, size.height/2);
|
||||
node->setAnchorPoint(Vec2(0.5f,0.5f));
|
||||
node->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
|
||||
|
||||
return node;
|
||||
}
|
||||
@@ -217,12 +217,12 @@ ProgressTimer* TransitionProgressHorizontal::progressTimerNodeWithRenderTexture(
|
||||
node->getSprite()->setFlippedY(true);
|
||||
node->setType( ProgressTimer::Type::BAR);
|
||||
|
||||
node->setMidpoint(Vec2(1, 0));
|
||||
node->setBarChangeRate(Vec2(1,0));
|
||||
node->setMidpoint(Vec2::UNIT_X);
|
||||
node->setBarChangeRate(Vec2::UNIT_X);
|
||||
|
||||
node->setPercentage(100);
|
||||
node->setPosition(size.width/2, size.height/2);
|
||||
node->setAnchorPoint(Vec2(0.5f,0.5f));
|
||||
node->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
|
||||
|
||||
return node;
|
||||
}
|
||||
@@ -250,12 +250,12 @@ ProgressTimer* TransitionProgressVertical::progressTimerNodeWithRenderTexture(Re
|
||||
node->getSprite()->setFlippedY(true);
|
||||
node->setType(ProgressTimer::Type::BAR);
|
||||
|
||||
node->setMidpoint(Vec2(0, 0));
|
||||
node->setBarChangeRate(Vec2(0,1));
|
||||
node->setMidpoint(Vec2::ZERO);
|
||||
node->setBarChangeRate(Vec2::UNIT_Y);
|
||||
|
||||
node->setPercentage(100);
|
||||
node->setPosition(size.width/2, size.height/2);
|
||||
node->setAnchorPoint(Vec2(0.5f,0.5f));
|
||||
node->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
|
||||
|
||||
return node;
|
||||
}
|
||||
@@ -296,12 +296,12 @@ ProgressTimer* TransitionProgressInOut::progressTimerNodeWithRenderTexture(Rende
|
||||
node->getSprite()->setFlippedY(true);
|
||||
node->setType( ProgressTimer::Type::BAR);
|
||||
|
||||
node->setMidpoint(Vec2(0.5f, 0.5f));
|
||||
node->setBarChangeRate(Vec2(1, 1));
|
||||
node->setMidpoint(Vec2::ANCHOR_MIDDLE);
|
||||
node->setBarChangeRate(Vec2::ONE);
|
||||
|
||||
node->setPercentage(0);
|
||||
node->setPosition(size.width/2, size.height/2);
|
||||
node->setAnchorPoint(Vec2(0.5f,0.5f));
|
||||
node->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
|
||||
|
||||
return node;
|
||||
}
|
||||
@@ -330,12 +330,12 @@ ProgressTimer* TransitionProgressOutIn::progressTimerNodeWithRenderTexture(Rende
|
||||
node->getSprite()->setFlippedY(true);
|
||||
node->setType( ProgressTimer::Type::BAR );
|
||||
|
||||
node->setMidpoint(Vec2(0.5f, 0.5f));
|
||||
node->setBarChangeRate(Vec2(1, 1));
|
||||
node->setMidpoint(Vec2::ANCHOR_MIDDLE);
|
||||
node->setBarChangeRate(Vec2::ONE);
|
||||
|
||||
node->setPercentage(100);
|
||||
node->setPosition(size.width/2, size.height/2);
|
||||
node->setAnchorPoint(Vec2(0.5f,0.5f));
|
||||
node->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
@@ -203,9 +203,9 @@ LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dxandroid_static
|
||||
|
||||
# define the macro to compile through support/zip_support/ioapi.c
|
||||
LOCAL_CFLAGS := -DUSE_FILE32API -fexceptions
|
||||
LOCAL_CPPFLAGS := -Wno-deprecated-declarations -Wno-extern-c-compat
|
||||
LOCAL_CPPFLAGS := -Wno-deprecated-declarations
|
||||
LOCAL_EXPORT_CFLAGS := -DUSE_FILE32API
|
||||
LOCAL_EXPORT_CPPFLAGS := -Wno-deprecated-declarations -Wno-extern-c-compat
|
||||
LOCAL_EXPORT_CPPFLAGS := -Wno-deprecated-declarations
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
|
||||
@@ -321,7 +321,7 @@ void AudioEngineImpl::setVolume(int audioID,float volume)
|
||||
}
|
||||
auto result = (*player._fdPlayerVolume)->SetVolumeLevel(player._fdPlayerVolume, dbVolume);
|
||||
if(SL_RESULT_SUCCESS != result){
|
||||
log("%s error:%lu",__func__, result);
|
||||
log("%s error:%u",__func__, result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -341,7 +341,7 @@ void AudioEngineImpl::pause(int audioID)
|
||||
auto& player = _audioPlayers[audioID];
|
||||
auto result = (*player._fdPlayerPlay)->SetPlayState(player._fdPlayerPlay, SL_PLAYSTATE_PAUSED);
|
||||
if(SL_RESULT_SUCCESS != result){
|
||||
log("%s error:%lu",__func__, result);
|
||||
log("%s error:%u",__func__, result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -350,7 +350,7 @@ void AudioEngineImpl::resume(int audioID)
|
||||
auto& player = _audioPlayers[audioID];
|
||||
auto result = (*player._fdPlayerPlay)->SetPlayState(player._fdPlayerPlay, SL_PLAYSTATE_PLAYING);
|
||||
if(SL_RESULT_SUCCESS != result){
|
||||
log("%s error:%lu",__func__, result);
|
||||
log("%s error:%u",__func__, result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -359,7 +359,7 @@ void AudioEngineImpl::stop(int audioID)
|
||||
auto& player = _audioPlayers[audioID];
|
||||
auto result = (*player._fdPlayerPlay)->SetPlayState(player._fdPlayerPlay, SL_PLAYSTATE_STOPPED);
|
||||
if(SL_RESULT_SUCCESS != result){
|
||||
log("%s error:%lu",__func__, result);
|
||||
log("%s error:%u",__func__, result);
|
||||
}
|
||||
|
||||
/*If destroy openSL object immediately,it may cause dead lock.
|
||||
|
||||
@@ -82,6 +82,7 @@ NS_CC_BEGIN
|
||||
extern const char* cocos2dVersion();
|
||||
|
||||
Director* Director::DirectorInstance = nullptr;
|
||||
bool Director::PurgeDirectorInNextLoop = false;
|
||||
|
||||
const char *Director::EVENT_PROJECTION_CHANGED = "director_projection_changed";
|
||||
const char *Director::EVENT_AFTER_DRAW = "director_after_draw";
|
||||
@@ -131,7 +132,7 @@ bool Director::init()
|
||||
_paused = false;
|
||||
|
||||
// purge ?
|
||||
_purgeDirectorInNextLoop = false;
|
||||
PurgeDirectorInNextLoop = false;
|
||||
|
||||
// restart ?
|
||||
_restartDirectorInNextLoop = false;
|
||||
@@ -183,17 +184,8 @@ Director::~Director()
|
||||
CC_SAFE_RELEASE(_runningScene);
|
||||
CC_SAFE_RELEASE(_notificationNode);
|
||||
|
||||
if (_scheduler)
|
||||
{
|
||||
delete _scheduler;
|
||||
_scheduler = nullptr;
|
||||
}
|
||||
|
||||
if (_actionManager)
|
||||
{
|
||||
delete _actionManager;
|
||||
_actionManager = nullptr;
|
||||
}
|
||||
CC_SAFE_RELEASE(_scheduler);
|
||||
CC_SAFE_RELEASE(_actionManager);
|
||||
|
||||
delete _eventBeforeUpdate;
|
||||
delete _eventAfterUpdate;
|
||||
@@ -206,11 +198,7 @@ Director::~Director()
|
||||
|
||||
delete _console;
|
||||
|
||||
if (_eventDispatcher)
|
||||
{
|
||||
delete _eventDispatcher;
|
||||
_eventDispatcher = nullptr;
|
||||
}
|
||||
CC_SAFE_RELEASE(_eventDispatcher);
|
||||
|
||||
// delete _lastUpdate
|
||||
CC_SAFE_DELETE(_lastUpdate);
|
||||
@@ -913,7 +901,7 @@ void Director::popToSceneStackLevel(int level)
|
||||
|
||||
void Director::end()
|
||||
{
|
||||
_purgeDirectorInNextLoop = true;
|
||||
PurgeDirectorInNextLoop = true;
|
||||
}
|
||||
|
||||
void Director::restart()
|
||||
@@ -1334,10 +1322,10 @@ void DisplayLinkDirector::startAnimation()
|
||||
|
||||
void DisplayLinkDirector::mainLoop()
|
||||
{
|
||||
if (_purgeDirectorInNextLoop)
|
||||
if (PurgeDirectorInNextLoop)
|
||||
{
|
||||
_purgeDirectorInNextLoop = false;
|
||||
purgeDirector();
|
||||
PurgeDirectorInNextLoop = false;
|
||||
}
|
||||
else if (_restartDirectorInNextLoop)
|
||||
{
|
||||
|
||||
@@ -490,13 +490,13 @@ public:
|
||||
*/
|
||||
const std::thread::id& getCocos2dThreadId() const { return _cocos2d_thread_id; }
|
||||
|
||||
bool isPurgeDirectorInNextLoop() const { return _purgeDirectorInNextLoop; }
|
||||
static bool isPurgeDirectorInNextLoop() { return PurgeDirectorInNextLoop; }
|
||||
|
||||
void purgeDirector();
|
||||
protected:
|
||||
void reset();
|
||||
|
||||
bool _purgeDirectorInNextLoop; // this flag will be set to true in end()
|
||||
static bool PurgeDirectorInNextLoop; // this flag will be set to true in end()
|
||||
|
||||
void restartDirector();
|
||||
bool _restartDirectorInNextLoop; // this flag will be set to true in restart()
|
||||
|
||||
@@ -635,7 +635,9 @@ void EventDispatcher::removeEventListener(EventListener* listener)
|
||||
|
||||
if (iter->second->empty())
|
||||
{
|
||||
_priorityDirtyFlagMap.erase(listener->getTypeKey());
|
||||
auto typeKey = listener->getTypeKey();
|
||||
if(_priorityDirtyFlagMap.find(typeKey) != _priorityDirtyFlagMap.end())
|
||||
_priorityDirtyFlagMap.erase(typeKey);
|
||||
auto list = iter->second;
|
||||
iter = _listenerMap.erase(iter);
|
||||
CC_SAFE_DELETE(list);
|
||||
@@ -767,7 +769,6 @@ void EventDispatcher::dispatchEventToListeners(EventListenerVector* listeners, c
|
||||
|
||||
if (l->isEnabled() && !l->isPaused() && l->isRegistered() && onEvent(l))
|
||||
{
|
||||
shouldStopPropagation = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -873,7 +874,7 @@ void EventDispatcher::dispatchTouchEvent(EventTouch* event)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (listener->_claimedTouches.size() > 0
|
||||
else if (!listener->_claimedTouches.empty()
|
||||
&& ((removedIter = std::find(listener->_claimedTouches.begin(), listener->_claimedTouches.end(), *touchesIter)) != listener->_claimedTouches.end()))
|
||||
{
|
||||
isClaimed = true;
|
||||
@@ -950,7 +951,7 @@ void EventDispatcher::dispatchTouchEvent(EventTouch* event)
|
||||
//
|
||||
// process standard handlers 2nd
|
||||
//
|
||||
if (allAtOnceListeners && mutableTouches.size() > 0)
|
||||
if (allAtOnceListeners && !mutableTouches.empty())
|
||||
{
|
||||
|
||||
auto onTouchesEvent = [&](EventListener* l) -> bool{
|
||||
|
||||
@@ -140,7 +140,7 @@ static bool isVariable(const char* str, char* outName, size_t outSize)
|
||||
size_t size = len - 3;
|
||||
if (size > (outSize - 1))
|
||||
size = outSize - 1;
|
||||
strncpy(outName, str + 2, len - 3);
|
||||
strncpy(outName, str + 2, size);
|
||||
outName[len - 3] = 0;
|
||||
return true;
|
||||
}
|
||||
@@ -667,7 +667,7 @@ Properties* Properties::getNamespace(const char* id, bool searchNames, bool recu
|
||||
{
|
||||
CCASSERT(id, "invalid id");
|
||||
|
||||
for (std::vector<Properties*>::const_iterator it = _namespaces.begin(); it < _namespaces.end(); ++it)
|
||||
for (auto it = _namespaces.begin(); it < _namespaces.end(); ++it)
|
||||
{
|
||||
Properties* p = *it;
|
||||
if (strcmp(searchNames ? p->_namespace.c_str() : p->_id.c_str(), id) == 0)
|
||||
@@ -700,7 +700,7 @@ bool Properties::exists(const char* name) const
|
||||
if (name == NULL)
|
||||
return false;
|
||||
|
||||
for (std::vector<Property>::const_iterator itr = _properties.begin(); itr != _properties.end(); ++itr)
|
||||
for (auto itr = _properties.begin(); itr != _properties.end(); ++itr)
|
||||
{
|
||||
if (itr->name == name)
|
||||
return true;
|
||||
@@ -790,7 +790,7 @@ const char* Properties::getString(const char* name, const char* defaultValue) co
|
||||
return getVariable(variable, defaultValue);
|
||||
}
|
||||
|
||||
for (std::vector<Property>::const_iterator itr = _properties.begin(); itr != _properties.end(); ++itr)
|
||||
for (auto itr = _properties.begin(); itr != _properties.end(); ++itr)
|
||||
{
|
||||
if (itr->name == name)
|
||||
{
|
||||
@@ -824,7 +824,7 @@ bool Properties::setString(const char* name, const char* value)
|
||||
{
|
||||
if (name)
|
||||
{
|
||||
for (std::vector<Property>::iterator itr = _properties.begin(); itr != _properties.end(); ++itr)
|
||||
for (auto itr = _properties.begin(); itr != _properties.end(); ++itr)
|
||||
{
|
||||
if (itr->name == name)
|
||||
{
|
||||
|
||||
@@ -159,8 +159,6 @@ class Data;
|
||||
*/
|
||||
class CC_DLL Properties
|
||||
{
|
||||
friend class Game;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
|
||||
@@ -167,7 +167,10 @@ void ScriptEngineManager::destroyInstance()
|
||||
|
||||
bool ScriptEngineManager::sendActionEventToJS(Action* actionObject, int eventType, void* param)
|
||||
{
|
||||
auto scriptEngine = getInstance()->getScriptEngine();
|
||||
if (ShareInstance == nullptr)
|
||||
return false;
|
||||
|
||||
auto scriptEngine = ShareInstance->getScriptEngine();
|
||||
|
||||
ActionObjectScriptData data(actionObject,(int*)&eventType, param);
|
||||
ScriptEvent scriptEvent(kScriptActionEvent,(void*)&data);
|
||||
@@ -179,7 +182,10 @@ bool ScriptEngineManager::sendActionEventToJS(Action* actionObject, int eventTyp
|
||||
|
||||
bool ScriptEngineManager::sendNodeEventToJS(Node* node, int action)
|
||||
{
|
||||
auto scriptEngine = getInstance()->getScriptEngine();
|
||||
if (ShareInstance == nullptr)
|
||||
return false;
|
||||
|
||||
auto scriptEngine = ShareInstance->getScriptEngine();
|
||||
|
||||
if (scriptEngine->isCalledFromScript())
|
||||
{
|
||||
@@ -199,7 +205,10 @@ bool ScriptEngineManager::sendNodeEventToJS(Node* node, int action)
|
||||
|
||||
bool ScriptEngineManager::sendNodeEventToJSExtended(Node* node, int action)
|
||||
{
|
||||
auto scriptEngine = getInstance()->getScriptEngine();
|
||||
if (ShareInstance == nullptr)
|
||||
return false;
|
||||
|
||||
auto scriptEngine = ShareInstance->getScriptEngine();
|
||||
|
||||
if (!scriptEngine->isCalledFromScript())
|
||||
{
|
||||
@@ -214,7 +223,10 @@ bool ScriptEngineManager::sendNodeEventToJSExtended(Node* node, int action)
|
||||
|
||||
void ScriptEngineManager::sendNodeEventToLua(Node* node, int action)
|
||||
{
|
||||
auto scriptEngine = getInstance()->getScriptEngine();
|
||||
if (ShareInstance == nullptr)
|
||||
return;
|
||||
|
||||
auto scriptEngine = ShareInstance->getScriptEngine();
|
||||
|
||||
BasicScriptData data(node,(void*)&action);
|
||||
ScriptEvent scriptEvent(kNodeEvent,(void*)&data);
|
||||
|
||||
@@ -620,7 +620,7 @@ unsigned char *ZipFile::getFileData(const std::string &fileName, ssize_t *size)
|
||||
CC_BREAK_IF(!_data->zipFile);
|
||||
CC_BREAK_IF(fileName.empty());
|
||||
|
||||
ZipFilePrivate::FileListContainer::const_iterator it = _data->fileList.find(fileName);
|
||||
auto it = _data->fileList.find(fileName);
|
||||
CC_BREAK_IF(it == _data->fileList.end());
|
||||
|
||||
ZipEntryInfo fileInfo = it->second;
|
||||
|
||||
@@ -167,14 +167,21 @@ long getCharacterCountInUTF8String(const std::string& utf8)
|
||||
|
||||
} //namespace StringUtils {
|
||||
|
||||
namespace
|
||||
{
|
||||
int wcslen_internal(const unsigned short* str)
|
||||
{
|
||||
if (str == nullptr)
|
||||
return -1;
|
||||
int i=0;
|
||||
while(*str++) i++;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
int cc_wcslen(const unsigned short* str)
|
||||
{
|
||||
if (str == nullptr)
|
||||
return -1;
|
||||
int i=0;
|
||||
while(*str++) i++;
|
||||
return i;
|
||||
return wcslen_internal(str);
|
||||
}
|
||||
|
||||
void cc_utf8_trim_ws(std::vector<unsigned short>* str)
|
||||
@@ -224,7 +231,7 @@ std::vector<unsigned short> cc_utf16_vec_from_utf16_str(const unsigned short* st
|
||||
if (str == nullptr)
|
||||
return str_new;
|
||||
|
||||
int len = cc_wcslen(str);
|
||||
int len = wcslen_internal(str);
|
||||
|
||||
for (int i = 0; i < len; ++i)
|
||||
{
|
||||
@@ -267,7 +274,7 @@ char * cc_utf16_to_utf8 (const unsigned short *str,
|
||||
|
||||
|
||||
std::u16string utf16;
|
||||
int utf16Len = len < 0 ? cc_wcslen(str) : len;
|
||||
int utf16Len = len < 0 ? wcslen_internal(str) : len;
|
||||
|
||||
for (int i = 0; i < utf16Len; ++i)
|
||||
{
|
||||
|
||||
@@ -186,7 +186,7 @@ std::vector<Node*> findChildren(const Node &node, const std::string &name)
|
||||
return vec;
|
||||
}
|
||||
|
||||
#define MAX_ITOA_BUFFER_SIZE 256
|
||||
#define MAX_ITOA_BUFFER_SIZE 128
|
||||
double atof(const char* str)
|
||||
{
|
||||
if (str == nullptr)
|
||||
@@ -194,17 +194,25 @@ double atof(const char* str)
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
char buf[MAX_ITOA_BUFFER_SIZE];
|
||||
strncpy(buf, str, MAX_ITOA_BUFFER_SIZE);
|
||||
|
||||
// strip string, only remain 7 numbers after '.'
|
||||
char* dot = strchr(buf, '.');
|
||||
if (dot != nullptr && dot - buf + 8 < MAX_ITOA_BUFFER_SIZE)
|
||||
auto dot = strchr(str, '.');
|
||||
if (dot == nullptr)
|
||||
{
|
||||
dot[8] = '\0';
|
||||
return std::atof(str);
|
||||
}
|
||||
else
|
||||
{
|
||||
char buf[MAX_ITOA_BUFFER_SIZE];
|
||||
strncpy(buf, str, MAX_ITOA_BUFFER_SIZE);
|
||||
|
||||
// strip string, only remain 7 numbers after '.'
|
||||
auto index = dot - str + 8;
|
||||
if (index < MAX_ITOA_BUFFER_SIZE)
|
||||
{
|
||||
buf[index] = '\0';
|
||||
}
|
||||
|
||||
return std::atof(buf);
|
||||
}
|
||||
|
||||
return ::atof(buf);
|
||||
}
|
||||
|
||||
double gettime()
|
||||
|
||||
@@ -116,7 +116,7 @@ void CCBAnimationManager::addDocumentCallbackNode(Node *node)
|
||||
_documentCallbackNodes.pushBack(node);
|
||||
}
|
||||
|
||||
void CCBAnimationManager::addDocumentCallbackName(std::string name)
|
||||
void CCBAnimationManager::addDocumentCallbackName(const std::string& name)
|
||||
{
|
||||
_documentCallbackNames.push_back(Value(name));
|
||||
}
|
||||
@@ -146,7 +146,7 @@ void CCBAnimationManager::addDocumentOutletNode(Node *node)
|
||||
_documentOutletNodes.pushBack(node);
|
||||
}
|
||||
|
||||
void CCBAnimationManager::addDocumentOutletName(std::string name)
|
||||
void CCBAnimationManager::addDocumentOutletName(const std::string& name)
|
||||
{
|
||||
_documentOutletNames.push_back(Value(name));
|
||||
}
|
||||
|
||||
@@ -52,11 +52,11 @@ public:
|
||||
|
||||
|
||||
void addDocumentCallbackNode(cocos2d::Node *node);
|
||||
void addDocumentCallbackName(std::string name);
|
||||
void addDocumentCallbackName(const std::string& name);
|
||||
void addDocumentCallbackControlEvents(cocos2d::extension::Control::EventType eventType);
|
||||
|
||||
void addDocumentOutletNode(cocos2d::Node *node);
|
||||
void addDocumentOutletName(std::string name);
|
||||
void addDocumentOutletName(const std::string& name);
|
||||
|
||||
void setDocumentControllerName(const std::string &name);
|
||||
|
||||
|
||||
@@ -655,7 +655,7 @@ Node * CCBReader::readNodeGraph(Node * pParent)
|
||||
|
||||
if(!assigned && this->_CCBMemberVariableAssigner != nullptr)
|
||||
{
|
||||
assigned = this->_CCBMemberVariableAssigner->onAssignCCBMemberVariable(target, memberVarAssignmentName.c_str(), node);
|
||||
_CCBMemberVariableAssigner->onAssignCCBMemberVariable(target, memberVarAssignmentName.c_str(), node);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -696,7 +696,7 @@ Node * CCBReader::readNodeGraph(Node * pParent)
|
||||
|
||||
if(!customAssigned && this->_CCBMemberVariableAssigner != nullptr)
|
||||
{
|
||||
customAssigned = this->_CCBMemberVariableAssigner->onAssignCCBCustomProperty(target, iter->first.c_str(), iter->second);
|
||||
_CCBMemberVariableAssigner->onAssignCCBCustomProperty(target, iter->first.c_str(), iter->second);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1061,7 +1061,7 @@ Vector<CCBAnimationManager*>& CCBReader::getAnimationManagersForNodes()
|
||||
return _animationManagersForNodes;
|
||||
}
|
||||
|
||||
void CCBReader::addOwnerOutletName(std::string name)
|
||||
void CCBReader::addOwnerOutletName(const std::string& name)
|
||||
{
|
||||
_ownerOutletNames.push_back(name);
|
||||
}
|
||||
|
||||
@@ -342,7 +342,7 @@ public:
|
||||
*/
|
||||
cocos2d::Node* readFileWithCleanUp(bool bCleanUp, CCBAnimationManagerMapPtr am);
|
||||
|
||||
void addOwnerOutletName(std::string name);
|
||||
void addOwnerOutletName(const std::string& name);
|
||||
void addOwnerOutletNode(cocos2d::Node *node);
|
||||
|
||||
private:
|
||||
|
||||
@@ -93,7 +93,7 @@ bool ActionTimeline::init()
|
||||
return true;
|
||||
}
|
||||
|
||||
void ActionTimeline::play(std::string name, bool loop)
|
||||
void ActionTimeline::play(const std::string& name, bool loop)
|
||||
{
|
||||
if (name.empty() || _animationInfos.find(name) == _animationInfos.end())
|
||||
{
|
||||
@@ -193,7 +193,7 @@ ActionTimeline* ActionTimeline::clone() const
|
||||
|
||||
void ActionTimeline::step(float delta)
|
||||
{
|
||||
if (!_playing || _timelineMap.size() == 0 || _duration == 0)
|
||||
if (!_playing || _timelineMap.empty() || _duration == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -310,7 +310,7 @@ void ActionTimeline::addAnimationInfo(const AnimationInfo& animationInfo)
|
||||
addFrameEndCallFunc(animationInfo.endIndex, animationInfo.name, animationInfo.clipEndCallBack);
|
||||
}
|
||||
|
||||
void ActionTimeline::removeAnimationInfo(std::string animationName)
|
||||
void ActionTimeline::removeAnimationInfo(const std::string& animationName)
|
||||
{
|
||||
auto clipIter = _animationInfos.find(animationName);
|
||||
if (clipIter == _animationInfos.end())
|
||||
|
||||
@@ -80,7 +80,7 @@ public:
|
||||
ActionTimeline();
|
||||
virtual ~ActionTimeline();
|
||||
|
||||
virtual void play(std::string animationName, bool loop);
|
||||
virtual void play(const std::string& animationName, bool loop);
|
||||
|
||||
virtual bool init();
|
||||
|
||||
@@ -153,7 +153,7 @@ public:
|
||||
|
||||
/** AnimationInfo*/
|
||||
virtual void addAnimationInfo(const AnimationInfo& animationInfo);
|
||||
virtual void removeAnimationInfo(std::string animationName);
|
||||
virtual void removeAnimationInfo(const std::string& animationName);
|
||||
virtual bool IsAnimationInfoExists(const std::string& animationName);
|
||||
virtual const AnimationInfo& getAnimationInfo(const std::string& animationName);
|
||||
/**add a frame end call back to animation's end frame
|
||||
|
||||
@@ -121,7 +121,7 @@ public:
|
||||
virtual void onEnter(Frame *nextFrame, int currentFrameIndex) override;
|
||||
virtual Frame* clone() override;
|
||||
|
||||
inline void setTextureName(std::string textureName) { _textureName = textureName;}
|
||||
inline void setTextureName(const std::string& textureName) { _textureName = textureName;}
|
||||
inline std::string getTextureName() const { return _textureName; }
|
||||
|
||||
protected:
|
||||
@@ -371,7 +371,7 @@ public:
|
||||
virtual void onEnter(Frame *nextFrame, int currentFrameIndex) override;
|
||||
virtual Frame* clone() override;
|
||||
|
||||
inline void setEvent(std::string event) { _event = event;}
|
||||
inline void setEvent(const std::string& event) { _event = event;}
|
||||
inline std::string getEvent() const { return _event; }
|
||||
|
||||
protected:
|
||||
|
||||
@@ -312,7 +312,7 @@ const cocos2d::Map<std::string, BoneNode*>& SkeletonNode::getAllSubBonesMap() co
|
||||
return _subBonesMap;
|
||||
}
|
||||
|
||||
void SkeletonNode::addSkinGroup(std::string groupName, std::map<std::string, std::string> boneSkinNameMap)
|
||||
void SkeletonNode::addSkinGroup(const std::string& groupName, const std::map<std::string, std::string>& boneSkinNameMap)
|
||||
{
|
||||
_skinGroupMap.insert(std::make_pair(groupName, boneSkinNameMap));
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
*@param: groupName, key
|
||||
*@param: boneSkinNameMap, map <name of bone, name of skin to display which added to bone>
|
||||
*/
|
||||
void addSkinGroup(std::string groupName, std::map<std::string, std::string> boneSkinNameMap);
|
||||
void addSkinGroup(const std::string& groupName, const std::map<std::string, std::string>& boneSkinNameMap);
|
||||
|
||||
cocos2d::Rect getBoundingBox() const override;
|
||||
|
||||
|
||||
@@ -94,22 +94,22 @@ void ArmatureDataManager::removeArmatureFileInfo(const std::string& configFilePa
|
||||
{
|
||||
if (RelativeData *data = getRelativeData(configFilePath))
|
||||
{
|
||||
for (std::string str : data->armatures)
|
||||
for (auto&& str : data->armatures)
|
||||
{
|
||||
removeArmatureData(str);
|
||||
}
|
||||
|
||||
for (std::string str : data->animations)
|
||||
for (auto&& str : data->animations)
|
||||
{
|
||||
removeAnimationData(str);
|
||||
}
|
||||
|
||||
for (std::string str : data->textures)
|
||||
for (auto&& str : data->textures)
|
||||
{
|
||||
removeTextureData(str);
|
||||
}
|
||||
|
||||
for (std::string str : data->plistFiles)
|
||||
for (auto&& str : data->plistFiles)
|
||||
{
|
||||
SpriteFrameCacheHelper::getInstance()->removeSpriteFrameFromFile(str);
|
||||
}
|
||||
|
||||
@@ -522,7 +522,7 @@ void DataReaderHelper::addDataAsyncCallBack(float dt)
|
||||
void DataReaderHelper::removeConfigFile(const std::string& configFile)
|
||||
{
|
||||
std::vector<std::string>::iterator it = _configFileList.end();
|
||||
for (std::vector<std::string>::iterator i = _configFileList.begin(); i != _configFileList.end(); i++)
|
||||
for (auto i = _configFileList.begin(); i != _configFileList.end(); i++)
|
||||
{
|
||||
if (*i == configFile)
|
||||
{
|
||||
|
||||
@@ -436,13 +436,13 @@ Rect DisplayManager::getBoundingBox() const
|
||||
|
||||
Vec2 DisplayManager::getAnchorPoint() const
|
||||
{
|
||||
CS_RETURN_IF(!_displayRenderNode) Vec2(0, 0);
|
||||
CS_RETURN_IF(!_displayRenderNode) Vec2::ANCHOR_BOTTOM_LEFT;
|
||||
return _displayRenderNode->getAnchorPoint();
|
||||
}
|
||||
|
||||
Vec2 DisplayManager::getAnchorPointInPoints() const
|
||||
{
|
||||
CS_RETURN_IF(!_displayRenderNode) Vec2(0, 0);
|
||||
CS_RETURN_IF(!_displayRenderNode) Vec2::ANCHOR_BOTTOM_LEFT;
|
||||
return _displayRenderNode->getAnchorPointInPoints();
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ ActionInterval* ActionFrame::getAction(float fDuration,ActionFrame* srcFrame)
|
||||
return this->getAction(fDuration);
|
||||
}
|
||||
|
||||
void ActionFrame::setEasingParameter(std::vector<float>& parameter)
|
||||
void ActionFrame::setEasingParameter(const std::vector<float>& parameter)
|
||||
{
|
||||
_Parameter.clear();
|
||||
|
||||
@@ -221,7 +221,7 @@ ActionInterval* ActionFrame::getEasingAction(ActionInterval* action)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ActionMoveFrame::ActionMoveFrame()
|
||||
: _position(Vec2(0.0f,0.0f))
|
||||
: _position(Vec2::ZERO)
|
||||
{
|
||||
_frameType = (int)kKeyframeMove;
|
||||
}
|
||||
@@ -229,7 +229,7 @@ ActionMoveFrame::~ActionMoveFrame()
|
||||
{
|
||||
|
||||
}
|
||||
void ActionMoveFrame::setPosition(Vec2 pos)
|
||||
void ActionMoveFrame::setPosition(const Vec2& pos)
|
||||
{
|
||||
_position = pos;
|
||||
}
|
||||
@@ -357,7 +357,7 @@ ActionTintFrame::~ActionTintFrame()
|
||||
|
||||
}
|
||||
|
||||
void ActionTintFrame::setColor(Color3B ccolor)
|
||||
void ActionTintFrame::setColor(const Color3B& ccolor)
|
||||
{
|
||||
_color = ccolor;
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ public:
|
||||
*@parame parameter the parameter for frame ease
|
||||
*
|
||||
*/
|
||||
virtual void setEasingParameter(std::vector<float>& parameter);
|
||||
virtual void setEasingParameter(const std::vector<float>& parameter);
|
||||
protected:
|
||||
/**
|
||||
* Gets the Easing Action of ActionFrame.
|
||||
@@ -230,7 +230,7 @@ public:
|
||||
*
|
||||
* @param the move action position.
|
||||
*/
|
||||
void setPosition(cocos2d::Vec2 pos);
|
||||
void setPosition(const cocos2d::Vec2& pos);
|
||||
|
||||
/**
|
||||
* Gets the move action position.
|
||||
@@ -429,7 +429,7 @@ public:
|
||||
*
|
||||
* @param ccolor the tint action color
|
||||
*/
|
||||
void setColor(cocos2d::Color3B ccolor);
|
||||
void setColor(const cocos2d::Color3B& ccolor);
|
||||
|
||||
/**
|
||||
* Gets the tint action color.
|
||||
|
||||
@@ -196,7 +196,7 @@ bool ComAttribute::serialize(void* r)
|
||||
{
|
||||
filePath.assign(cocos2d::FileUtils::getInstance()->fullPathForFilename(file));
|
||||
}
|
||||
if (parse(filePath.c_str()))
|
||||
if (parse(filePath))
|
||||
{
|
||||
ret = true;
|
||||
}
|
||||
|
||||
@@ -172,16 +172,16 @@ CocoLoader::~CocoLoader()
|
||||
|
||||
}
|
||||
|
||||
bool CocoLoader::ReadCocoBinBuff(char* pBinBuff)
|
||||
bool CocoLoader::ReadCocoBinBuff(char* pBinBuff)
|
||||
{
|
||||
if(m_pMemoryBuff)return true;
|
||||
char* pTempBuff = pBinBuff;
|
||||
|
||||
m_pFileHeader = (stCocoFileHeader*)pTempBuff;
|
||||
pTempBuff += sizeof(stCocoFileHeader);
|
||||
char* pStartAddr = m_pMemoryBuff = pTempBuff;
|
||||
char* pStartAddr = m_pMemoryBuff = pTempBuff;
|
||||
|
||||
char* pDestBuff = new char[m_pFileHeader->m_nDataSize];
|
||||
char* pDestBuff = new char[m_pFileHeader->m_nDataSize];
|
||||
if (m_pFileHeader->m_nCompressSize > 0)
|
||||
{
|
||||
uLongf dwSrcSize = m_pFileHeader->m_nCompressSize;
|
||||
|
||||
@@ -181,17 +181,15 @@ public:
|
||||
}
|
||||
|
||||
std::vector<cocos2d::Vec2> _calculateVertices(cocos2d::SpriteFrame* spriteFrame, const cocos2d::Size& contentSize, float insetLeft, float insetRight, float insetTop, float insetBottom) {
|
||||
float leftWidth, centerWidth, rightWidth;
|
||||
float topHeight, centerHeight, bottomHeight;
|
||||
float leftWidth, rightWidth;
|
||||
float topHeight, bottomHeight;
|
||||
|
||||
auto rect = spriteFrame->getRect();
|
||||
leftWidth = insetLeft;
|
||||
rightWidth = insetRight;
|
||||
centerWidth = rect.size.width - leftWidth - rightWidth;
|
||||
|
||||
topHeight = insetTop;
|
||||
bottomHeight = insetBottom;
|
||||
centerHeight = rect.size.height - topHeight - bottomHeight;
|
||||
|
||||
auto preferSize = contentSize;
|
||||
auto sizableWidth = preferSize.width - leftWidth - rightWidth;
|
||||
@@ -859,12 +857,12 @@ _quadsDirty(true),
|
||||
_isTriangle(false),
|
||||
_isTrimmedContentSize(true),
|
||||
_fillType(Scale9SpriteV2::FillType::HORIZONTAL),
|
||||
_fillCenter(cocos2d::Vec2(0,0)),
|
||||
_fillCenter(cocos2d::Vec2::ZERO),
|
||||
_fillStart(0),
|
||||
_fillRange(0),
|
||||
_needRebuildRenderCommand(true)
|
||||
{
|
||||
this->setAnchorPoint(cocos2d::Vec2(0.5,0.5));
|
||||
this->setAnchorPoint(cocos2d::Vec2::ANCHOR_MIDDLE);
|
||||
this->setGLProgramState(cocos2d::GLProgramState::getOrCreateWithGLProgramName(cocos2d::GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP));
|
||||
}
|
||||
|
||||
@@ -1081,7 +1079,7 @@ void Scale9SpriteV2::draw(cocos2d::Renderer *renderer, const cocos2d::Mat4 &tran
|
||||
|
||||
}
|
||||
|
||||
if (this->_indices.size() > 0 && this->_verts.size() > 0) {
|
||||
if (!_indices.empty() && !_verts.empty()) {
|
||||
cocos2d::TrianglesCommand::Triangles triangles;
|
||||
triangles.indices = &this->_indices[0];
|
||||
triangles.verts = &this->_verts[0];
|
||||
|
||||
@@ -187,11 +187,14 @@
|
||||
CFDataRef errDataRef = SecTrustCopyExceptions(serverTrust);
|
||||
SecTrustSetExceptions(serverTrust, errDataRef);
|
||||
SecTrustEvaluate(serverTrust, &trustResult);
|
||||
[(id)errDataRef release];
|
||||
CFRelease(errDataRef);
|
||||
}
|
||||
[certData release];
|
||||
[(id)certArrayRef release];
|
||||
[(id)certArrayRef release];
|
||||
if (cert)
|
||||
CFRelease(cert);
|
||||
if (certArrayRef)
|
||||
CFRelease(certArrayRef);
|
||||
|
||||
//Did our custom trust chain evaluate successfully?
|
||||
return trustResult = kSecTrustResultUnspecified || trustResult == kSecTrustResultProceed;
|
||||
}
|
||||
|
||||
@@ -50,8 +50,7 @@ void HttpClient::networkThread()
|
||||
{
|
||||
increaseThreadCount();
|
||||
|
||||
while (true) @autoreleasepool {
|
||||
|
||||
while (true) {
|
||||
HttpRequest *request;
|
||||
|
||||
// step 1: send http request if the requestQueue isn't empty
|
||||
@@ -68,22 +67,20 @@ void HttpClient::networkThread()
|
||||
break;
|
||||
}
|
||||
|
||||
// Create a HttpResponse object, the default setting is http access failed
|
||||
HttpResponse *response = new (std::nothrow) HttpResponse(request);
|
||||
|
||||
processResponse(response, _responseMessage);
|
||||
|
||||
// add response packet into queue
|
||||
_responseQueueMutex.lock();
|
||||
_responseQueue.pushBack(response);
|
||||
_responseQueueMutex.unlock();
|
||||
|
||||
_schedulerMutex.lock();
|
||||
if (Director::DirectorInstance)
|
||||
if (Director::DirectorInstance && !Director::isPurgeDirectorInNextLoop())
|
||||
{
|
||||
// Create a HttpResponse object, the default setting is http access failed
|
||||
HttpResponse *response = new (std::nothrow) HttpResponse(request);
|
||||
|
||||
processResponse(response, _responseMessage);
|
||||
|
||||
// add response packet into queue
|
||||
_responseQueueMutex.lock();
|
||||
_responseQueue.pushBack(response);
|
||||
_responseQueueMutex.unlock();
|
||||
|
||||
Director::DirectorInstance->getScheduler()->performFunctionInCocosThread(CC_CALLBACK_0(HttpClient::dispatchResponseCallbacks, this));
|
||||
}
|
||||
_schedulerMutex.unlock();
|
||||
}
|
||||
|
||||
// cleanup: if worker thread received quit signal, clean up un-completed request queue
|
||||
@@ -106,8 +103,7 @@ void HttpClient::networkThreadAlone(HttpRequest* request, HttpResponse* response
|
||||
char responseMessage[RESPONSE_BUFFER_SIZE] = { 0 };
|
||||
processResponse(response, responseMessage);
|
||||
|
||||
_schedulerMutex.lock();
|
||||
if (Director::DirectorInstance)
|
||||
if (Director::DirectorInstance && !Director::isPurgeDirectorInNextLoop())
|
||||
{
|
||||
Director::DirectorInstance->getScheduler()->performFunctionInCocosThread([this, response, request]{
|
||||
const ccHttpRequestCallback& callback = request->getCallback();
|
||||
@@ -127,7 +123,6 @@ void HttpClient::networkThreadAlone(HttpRequest* request, HttpResponse* response
|
||||
request->release();
|
||||
});
|
||||
}
|
||||
_schedulerMutex.unlock();
|
||||
decreaseThreadCountAndMayDeleteThis();
|
||||
}
|
||||
|
||||
@@ -156,7 +151,7 @@ static int processTask(HttpClient* client, HttpRequest* request, NSString* reque
|
||||
if(!headers.empty())
|
||||
{
|
||||
/* append custom headers one by one */
|
||||
for (std::vector<std::string>::iterator it = headers.begin(); it != headers.end(); ++it)
|
||||
for (auto it = headers.begin(); it != headers.end(); ++it)
|
||||
{
|
||||
unsigned long i = it->find(':', 0);
|
||||
unsigned long length = it->size();
|
||||
@@ -287,13 +282,13 @@ static int processTask(HttpClient* client, HttpRequest* request, NSString* reque
|
||||
[header deleteCharactersInRange:range];
|
||||
}
|
||||
NSData *headerData = [header dataUsingEncoding:NSUTF8StringEncoding];
|
||||
std::vector<char> *headerBuffer = (std::vector<char>*)headerStream;
|
||||
auto headerBuffer = (std::vector<char>*)headerStream;
|
||||
const void* headerptr = [headerData bytes];
|
||||
long headerlen = [headerData length];
|
||||
headerBuffer->insert(headerBuffer->end(), (char*)headerptr, (char*)headerptr+headerlen);
|
||||
|
||||
//handle response data
|
||||
std::vector<char> *recvBuffer = (std::vector<char>*)stream;
|
||||
auto recvBuffer = (std::vector<char>*)stream;
|
||||
const void* ptr = [httpAsynConn.responseData bytes];
|
||||
long len = [httpAsynConn.responseData length];
|
||||
recvBuffer->insert(recvBuffer->end(), (char*)ptr, (char*)ptr+len);
|
||||
|
||||
@@ -46,7 +46,7 @@ typedef size_t (*write_callback)(void *ptr, size_t size, size_t nmemb, void *str
|
||||
// Callback function used by libcurl for collect response data
|
||||
static size_t writeData(void *ptr, size_t size, size_t nmemb, void *stream)
|
||||
{
|
||||
std::vector<char> *recvBuffer = (std::vector<char>*)stream;
|
||||
auto recvBuffer = (std::vector<char>*)stream;
|
||||
size_t sizes = size * nmemb;
|
||||
|
||||
// add data to the end of recvBuffer
|
||||
@@ -59,7 +59,7 @@ static size_t writeData(void *ptr, size_t size, size_t nmemb, void *stream)
|
||||
// Callback function used by libcurl for collect header data
|
||||
static size_t writeHeaderData(void *ptr, size_t size, size_t nmemb, void *stream)
|
||||
{
|
||||
std::vector<char> *recvBuffer = (std::vector<char>*)stream;
|
||||
auto recvBuffer = (std::vector<char>*)stream;
|
||||
size_t sizes = size * nmemb;
|
||||
|
||||
// add data to the end of recvBuffer
|
||||
@@ -253,7 +253,7 @@ public:
|
||||
if(!headers.empty())
|
||||
{
|
||||
/* append custom headers one by one */
|
||||
for (std::vector<std::string>::iterator it = headers.begin(); it != headers.end(); ++it)
|
||||
for (auto it = headers.begin(); it != headers.end(); ++it)
|
||||
_headers = curl_slist_append(_headers,it->c_str());
|
||||
/* set custom headers for curl */
|
||||
if (!setOption(CURLOPT_HTTPHEADER, _headers))
|
||||
|
||||
@@ -152,7 +152,7 @@ void HttpCookie::writeFile()
|
||||
fclose(out);
|
||||
}
|
||||
|
||||
void HttpCookie::setCookieFileName(std::string filename)
|
||||
void HttpCookie::setCookieFileName(const std::string& filename)
|
||||
{
|
||||
_cookieFileName = filename;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
void readFile();
|
||||
|
||||
void writeFile();
|
||||
void setCookieFileName(const std::string fileName);
|
||||
void setCookieFileName(const std::string& fileName);
|
||||
|
||||
const std::vector<CookiesInfo>* getCookies()const;
|
||||
const CookiesInfo* getMatchCookie(const std::string& url) const;
|
||||
|
||||
@@ -76,7 +76,7 @@ public:
|
||||
std::vector<std::string> getData()const{ return _args; };
|
||||
virtual std::string stringify()const;
|
||||
|
||||
static SocketIOPacket * createPacketWithType(std::string type, SocketIOVersion version);
|
||||
static SocketIOPacket * createPacketWithType(const std::string& type, SocketIOVersion version);
|
||||
static SocketIOPacket * createPacketWithTypeIndex(int type, SocketIOVersion version);
|
||||
protected:
|
||||
std::string _pId;//id message
|
||||
@@ -171,7 +171,7 @@ std::string SocketIOPacket::toString()const
|
||||
int SocketIOPacket::typeAsNumber()const
|
||||
{
|
||||
std::string::size_type num = 0;
|
||||
std::vector<std::string>::const_iterator item = std::find(_types.begin(), _types.end(), _type);
|
||||
auto item = std::find(_types.begin(), _types.end(), _type);
|
||||
if (item != _types.end())
|
||||
{
|
||||
num = item - _types.begin();
|
||||
@@ -251,7 +251,7 @@ SocketIOPacketV10x::SocketIOPacketV10x()
|
||||
int SocketIOPacketV10x::typeAsNumber()const
|
||||
{
|
||||
std::vector<std::string>::size_type num = 0;
|
||||
std::vector<std::string>::const_iterator item = std::find(_typesMessage.begin(), _typesMessage.end(), _type);
|
||||
auto item = std::find(_typesMessage.begin(), _typesMessage.end(), _type);
|
||||
if (item != _typesMessage.end())
|
||||
{//it's a message
|
||||
num = item - _typesMessage.begin();
|
||||
@@ -302,7 +302,7 @@ SocketIOPacketV10x::~SocketIOPacketV10x()
|
||||
_endpoint = "";
|
||||
}
|
||||
|
||||
SocketIOPacket * SocketIOPacket::createPacketWithType(std::string type, SocketIOPacket::SocketIOVersion version)
|
||||
SocketIOPacket * SocketIOPacket::createPacketWithType(const std::string& type, SocketIOPacket::SocketIOVersion version)
|
||||
{
|
||||
SocketIOPacket *ret;
|
||||
switch (version)
|
||||
@@ -986,6 +986,12 @@ void SIOClientImpl::onClose(WebSocket* ws)
|
||||
{
|
||||
iter->second->socketClosed();
|
||||
}
|
||||
// discard this client
|
||||
_connected = false;
|
||||
if (Director::DirectorInstance)
|
||||
Director::DirectorInstance->getScheduler()->unscheduleAllForTarget(this);
|
||||
|
||||
SocketIO::getInstance()->removeSocket(_uri);
|
||||
}
|
||||
|
||||
this->release();
|
||||
|
||||
+115
-142
@@ -35,6 +35,7 @@
|
||||
#include <mutex>
|
||||
#include <queue>
|
||||
#include <list>
|
||||
#include <unordered_set>
|
||||
|
||||
#include "base/CCDirector.h"
|
||||
#include "base/CCScheduler.h"
|
||||
@@ -122,8 +123,6 @@ public:
|
||||
|
||||
// Creates a new thread
|
||||
bool createWebSocketThread(const WebSocket& ws);
|
||||
// Quits websocket thread.
|
||||
void quitWebSocketThread();
|
||||
|
||||
// Sends message to Cocos thread. It's needed to be invoked in Websocket thread.
|
||||
void sendMessageToCocosThread(const std::function<void()>& cb);
|
||||
@@ -137,11 +136,11 @@ public:
|
||||
protected:
|
||||
void wsThreadEntryFunc();
|
||||
private:
|
||||
std::list<WsMessage*>* _subThreadWsMessageQueue;
|
||||
std::list<WsMessage*> _subThreadWsMessageQueue;
|
||||
std::mutex _subThreadWsMessageQueueMutex;
|
||||
std::thread* _subThreadInstance;
|
||||
std::thread _subThreadInstance;
|
||||
WebSocket* _ws;
|
||||
std::atomic<bool> _needQuit;
|
||||
|
||||
friend class WebSocket;
|
||||
};
|
||||
|
||||
@@ -166,71 +165,43 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
// Implementation of WsThreadHelper
|
||||
WsThreadHelper::WsThreadHelper()
|
||||
: _subThreadInstance(nullptr)
|
||||
, _ws(nullptr)
|
||||
, _needQuit(false)
|
||||
: _ws(nullptr)
|
||||
{
|
||||
_subThreadWsMessageQueue = new (std::nothrow) std::list<WsMessage*>();
|
||||
}
|
||||
|
||||
WsThreadHelper::~WsThreadHelper()
|
||||
{
|
||||
joinWebSocketThread();
|
||||
CC_SAFE_DELETE(_subThreadInstance);
|
||||
delete _subThreadWsMessageQueue;
|
||||
}
|
||||
|
||||
bool WsThreadHelper::createWebSocketThread(const WebSocket& ws)
|
||||
{
|
||||
_ws = const_cast<WebSocket*>(&ws);
|
||||
|
||||
// Creates websocket thread
|
||||
_subThreadInstance = new (std::nothrow) std::thread(&WsThreadHelper::wsThreadEntryFunc, this);
|
||||
_subThreadInstance = std::thread(&WebSocket::onSubThreadLoop, _ws);
|
||||
return true;
|
||||
}
|
||||
|
||||
void WsThreadHelper::quitWebSocketThread()
|
||||
{
|
||||
_needQuit = true;
|
||||
}
|
||||
|
||||
void WsThreadHelper::wsThreadEntryFunc()
|
||||
{
|
||||
LOGD("WebSocket thread start, helper instance: %p\n", this);
|
||||
_ws->onSubThreadStarted();
|
||||
|
||||
while (!_needQuit)
|
||||
{
|
||||
_ws->onSubThreadLoop();
|
||||
}
|
||||
|
||||
_ws->onSubThreadEnded();
|
||||
|
||||
LOGD("WebSocket thread exit, helper instance: %p\n", this);
|
||||
}
|
||||
|
||||
void WsThreadHelper::sendMessageToCocosThread(const std::function<void()>& cb)
|
||||
{
|
||||
Director::getInstance()->getScheduler()->performFunctionInCocosThread(cb);
|
||||
if (Director::DirectorInstance)
|
||||
Director::DirectorInstance->getScheduler()->performFunctionInCocosThread(cb);
|
||||
}
|
||||
|
||||
void WsThreadHelper::sendMessageToWebSocketThread(WsMessage *msg)
|
||||
{
|
||||
std::lock_guard<std::mutex> lk(_subThreadWsMessageQueueMutex);
|
||||
_subThreadWsMessageQueue->push_back(msg);
|
||||
_subThreadWsMessageQueue.push_back(msg);
|
||||
}
|
||||
|
||||
void WsThreadHelper::joinWebSocketThread()
|
||||
{
|
||||
if (_subThreadInstance->joinable())
|
||||
if (_subThreadInstance.joinable())
|
||||
{
|
||||
_subThreadInstance->join();
|
||||
_subThreadInstance.join();
|
||||
}
|
||||
}
|
||||
|
||||
// Define a WebSocket frame
|
||||
class WebSocketFrame
|
||||
{
|
||||
public:
|
||||
@@ -281,28 +252,25 @@ private:
|
||||
ssize_t _frameLength;
|
||||
std::vector<unsigned char> _data;
|
||||
};
|
||||
//
|
||||
|
||||
|
||||
enum WS_MSG {
|
||||
WS_MSG_TO_SUBTRHEAD_SENDING_STRING = 0,
|
||||
WS_MSG_TO_SUBTRHEAD_SENDING_BINARY,
|
||||
};
|
||||
|
||||
static std::vector<WebSocket*>* __websocketInstances = nullptr;
|
||||
static std::unordered_set<WebSocket*>* __websocketInstances = nullptr;
|
||||
|
||||
void WebSocket::closeAllConnections()
|
||||
{
|
||||
if (__websocketInstances != nullptr)
|
||||
{
|
||||
ssize_t count = __websocketInstances->size();
|
||||
for (ssize_t i = count-1; i >=0 ; i--)
|
||||
auto copyInstances = *__websocketInstances;
|
||||
for (auto&& instance : copyInstances)
|
||||
{
|
||||
WebSocket* instance = __websocketInstances->at(i);
|
||||
instance->close();
|
||||
}
|
||||
|
||||
__websocketInstances->clear();
|
||||
|
||||
delete __websocketInstances;
|
||||
__websocketInstances = nullptr;
|
||||
}
|
||||
}
|
||||
@@ -313,7 +281,6 @@ WebSocket::WebSocket()
|
||||
, _wsHelper(nullptr)
|
||||
, _wsInstance(nullptr)
|
||||
, _wsContext(nullptr)
|
||||
, _isDestroyed(std::make_shared<std::atomic<bool>>(false))
|
||||
, _delegate(nullptr)
|
||||
, _SSLConnection(0)
|
||||
, _wsProtocols(nullptr)
|
||||
@@ -322,24 +289,41 @@ WebSocket::WebSocket()
|
||||
_receivedData.reserve(WS_RESERVE_RECEIVE_BUFFER_SIZE);
|
||||
if (__websocketInstances == nullptr)
|
||||
{
|
||||
__websocketInstances = new (std::nothrow) std::vector<WebSocket*>();
|
||||
__websocketInstances = new (std::nothrow) std::unordered_set<WebSocket*>();
|
||||
}
|
||||
|
||||
__websocketInstances->push_back(this);
|
||||
__websocketInstances->insert(this);
|
||||
|
||||
auto eventDispatcher = Director::getInstance()->getEventDispatcher();
|
||||
auto isDestroyed = _isDestroyed;
|
||||
auto instance = this;
|
||||
_resetDirectorListener = eventDispatcher->addCustomEventListener(Director::EVENT_RESET,
|
||||
[this, isDestroyed](EventCustom*)
|
||||
[instance](EventCustom*)
|
||||
{
|
||||
if (*isDestroyed)
|
||||
return;
|
||||
close();
|
||||
if (__websocketInstances && __websocketInstances->find(instance) != __websocketInstances->end())
|
||||
{
|
||||
instance->close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
WebSocket::~WebSocket()
|
||||
{
|
||||
if (__websocketInstances != nullptr)
|
||||
{
|
||||
auto iter = __websocketInstances->find(this);
|
||||
if (iter != __websocketInstances->end())
|
||||
{
|
||||
__websocketInstances->erase(iter);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGD("ERROR: WebSocket instance (%p) wasn't added to the container which saves websocket instances!\n", this);
|
||||
}
|
||||
}
|
||||
|
||||
if (Director::DirectorInstance) {
|
||||
Director::DirectorInstance->getEventDispatcher()->removeEventListener(_resetDirectorListener);
|
||||
}
|
||||
|
||||
LOGD("In the destructor of WebSocket (%p)\n", this);
|
||||
CC_SAFE_DELETE(_wsHelper);
|
||||
|
||||
@@ -351,24 +335,6 @@ WebSocket::~WebSocket()
|
||||
}
|
||||
}
|
||||
CC_SAFE_DELETE_ARRAY(_wsProtocols);
|
||||
|
||||
if (__websocketInstances != nullptr)
|
||||
{
|
||||
auto iter = std::find(__websocketInstances->begin(), __websocketInstances->end(), this);
|
||||
if (iter != __websocketInstances->end())
|
||||
{
|
||||
__websocketInstances->erase(iter);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGD("ERROR: WebSocket instance (%p) wasn't added to the container which saves websocket instances!\n", this);
|
||||
}
|
||||
}
|
||||
|
||||
if (Director::DirectorInstance) {
|
||||
Director::DirectorInstance->getEventDispatcher()->removeEventListener(_resetDirectorListener);
|
||||
}
|
||||
*_isDestroyed = true;
|
||||
}
|
||||
|
||||
bool WebSocket::init(const Delegate& delegate,
|
||||
@@ -416,7 +382,7 @@ bool WebSocket::init(const Delegate& delegate,
|
||||
LOGD("[WebSocket::init] _host: %s, _port: %d, _path: %s\n", _host.c_str(), _port, _path.c_str());
|
||||
|
||||
size_t protocolCount = 0;
|
||||
if (protocols && protocols->size() > 0)
|
||||
if (protocols && !protocols->empty())
|
||||
{
|
||||
protocolCount = protocols->size();
|
||||
}
|
||||
@@ -428,10 +394,10 @@ bool WebSocket::init(const Delegate& delegate,
|
||||
_wsProtocols = new (std::nothrow) lws_protocols[protocolCount+1];
|
||||
memset(_wsProtocols, 0, sizeof(lws_protocols)*(protocolCount+1));
|
||||
|
||||
if (protocols && protocols->size() > 0)
|
||||
if (protocols && !protocols->empty())
|
||||
{
|
||||
int i = 0;
|
||||
for (std::vector<std::string>::const_iterator iter = protocols->begin(); iter != protocols->end(); ++iter, ++i)
|
||||
for (auto iter = protocols->begin(); iter != protocols->end(); ++iter, ++i)
|
||||
{
|
||||
char* name = new (std::nothrow) char[(*iter).length()+1];
|
||||
strcpy(name, (*iter).c_str());
|
||||
@@ -518,6 +484,7 @@ void WebSocket::close()
|
||||
_readStateMutex.unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
// Sets the state to 'closed' to make sure 'onConnectionClosed' which is
|
||||
// invoked by websocket thread don't post 'close' message to Cocos thread since
|
||||
// WebSocket instance is destroyed at next frame.
|
||||
@@ -525,9 +492,9 @@ void WebSocket::close()
|
||||
_readyState = State::CLOSED;
|
||||
_readStateMutex.unlock();
|
||||
|
||||
_wsHelper->quitWebSocketThread();
|
||||
LOGD("Waiting WebSocket (%p) to exit!\n", this);
|
||||
_wsHelper->joinWebSocketThread();
|
||||
|
||||
// Since 'onConnectionClosed' didn't post message to Cocos Thread for invoking 'onClose' callback, do it here.
|
||||
// onClose must be invoked at the end of this method.
|
||||
_delegate->onClose(this);
|
||||
@@ -535,7 +502,10 @@ void WebSocket::close()
|
||||
|
||||
void WebSocket::closeAsync()
|
||||
{
|
||||
_wsHelper->quitWebSocketThread();
|
||||
_readStateMutex.lock();
|
||||
if (_readyState != State::CLOSING && _readyState != State::CLOSED)
|
||||
_readyState = State::CLOSING;
|
||||
_readStateMutex.unlock();
|
||||
}
|
||||
|
||||
WebSocket::State WebSocket::getReadyState()
|
||||
@@ -546,30 +516,38 @@ WebSocket::State WebSocket::getReadyState()
|
||||
|
||||
void WebSocket::onSubThreadLoop()
|
||||
{
|
||||
_readStateMutex.lock();
|
||||
if (_wsContext && _readyState != State::CLOSED && _readyState != State::CLOSING)
|
||||
{
|
||||
_readStateMutex.unlock();
|
||||
_wsHelper->_subThreadWsMessageQueueMutex.lock();
|
||||
bool isEmpty = _wsHelper->_subThreadWsMessageQueue->empty();
|
||||
_wsHelper->_subThreadWsMessageQueueMutex.unlock();
|
||||
if (!isEmpty)
|
||||
onSubThreadStarted();
|
||||
|
||||
while (true) {
|
||||
_readStateMutex.lock();
|
||||
if (_wsContext && (_readyState == State::CONNECTING || _readyState == State::OPEN))
|
||||
{
|
||||
lws_callback_on_writable(_wsInstance);
|
||||
_readStateMutex.unlock();
|
||||
_wsHelper->_subThreadWsMessageQueueMutex.lock();
|
||||
bool isEmpty = _wsHelper->_subThreadWsMessageQueue.empty();
|
||||
_wsHelper->_subThreadWsMessageQueueMutex.unlock();
|
||||
if (!isEmpty)
|
||||
{
|
||||
lws_callback_on_writable(_wsInstance);
|
||||
}
|
||||
|
||||
lws_service(_wsContext, 50);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGD("Ready state is closing or was closed, code=%d, quit websocket thread!\n", _readyState);
|
||||
_readStateMutex.unlock();
|
||||
break;
|
||||
}
|
||||
|
||||
lws_service(_wsContext, 50);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGD("Ready state is closing or was closed, code=%d, quit websocket thread!\n", _readyState);
|
||||
_readStateMutex.unlock();
|
||||
_wsHelper->quitWebSocketThread();
|
||||
}
|
||||
|
||||
onSubThreadEnded();
|
||||
}
|
||||
|
||||
void WebSocket::onSubThreadStarted()
|
||||
{
|
||||
LOGD("WebSocket::onSubThreadStarted, instance: %p\n", this);
|
||||
|
||||
static const struct lws_extension exts[] = {
|
||||
{
|
||||
"permessage-deflate",
|
||||
@@ -603,7 +581,7 @@ void WebSocket::onSubThreadStarted()
|
||||
info.options = 0;
|
||||
info.user = this;
|
||||
|
||||
int log_level = LLL_ERR | LLL_WARN | LLL_NOTICE/* | LLL_INFO | LLL_DEBUG | LLL_PARSER*/ | LLL_HEADER | LLL_EXT | LLL_CLIENT | LLL_LATENCY;
|
||||
int log_level = LLL_ERR | LLL_WARN | LLL_NOTICE | LLL_HEADER | LLL_EXT | LLL_CLIENT | LLL_LATENCY;
|
||||
lws_set_log_level(log_level, printWebSocketLog);
|
||||
|
||||
_wsContext = lws_create_context(&info);
|
||||
@@ -625,10 +603,11 @@ void WebSocket::onSubThreadStarted()
|
||||
char portStr[10];
|
||||
sprintf(portStr, "%d", _port);
|
||||
std::string ads_port = _host + ":" + portStr;
|
||||
|
||||
_wsInstance = lws_client_connect(_wsContext, _host.c_str(), _port, _SSLConnection,
|
||||
_path.c_str(), ads_port.c_str(), ads_port.c_str(),
|
||||
name.c_str(), -1);
|
||||
|
||||
lws_client_connect_info cInfo = {_wsContext, _host.c_str(), (int)_port, _SSLConnection,
|
||||
_path.c_str(), ads_port.c_str(), ads_port.c_str(),
|
||||
name.c_str(), -1,nullptr,nullptr};
|
||||
_wsInstance = lws_client_connect_via_info(&cInfo);
|
||||
|
||||
if (nullptr == _wsInstance)
|
||||
{
|
||||
@@ -646,22 +625,25 @@ void WebSocket::onSubThreadEnded()
|
||||
if (_wsContext != nullptr)
|
||||
{
|
||||
lws_context_destroy(_wsContext);
|
||||
_wsContext = nullptr;
|
||||
}
|
||||
|
||||
LOGD("WebSocket::onSubThreadEnded, instance: %p\n", this);
|
||||
}
|
||||
|
||||
void WebSocket::onClientWritable()
|
||||
{
|
||||
std::lock_guard<std::mutex> lk(_wsHelper->_subThreadWsMessageQueueMutex);
|
||||
|
||||
if (_wsHelper->_subThreadWsMessageQueue->empty())
|
||||
if (_wsHelper->_subThreadWsMessageQueue.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::list<WsMessage*>::iterator iter = _wsHelper->_subThreadWsMessageQueue->begin();
|
||||
std::list<WsMessage*>::iterator iter = _wsHelper->_subThreadWsMessageQueue.begin();
|
||||
|
||||
ssize_t bytesWrite = 0;
|
||||
if (iter != _wsHelper->_subThreadWsMessageQueue->end())
|
||||
if (iter != _wsHelper->_subThreadWsMessageQueue.end())
|
||||
{
|
||||
WsMessage* subThreadMsg = *iter;
|
||||
Data* data = (Data*)subThreadMsg->obj;
|
||||
@@ -692,7 +674,7 @@ void WebSocket::onClientWritable()
|
||||
delete frame;
|
||||
CC_SAFE_FREE(data->bytes);
|
||||
CC_SAFE_DELETE(data);
|
||||
_wsHelper->_subThreadWsMessageQueue->erase(iter);
|
||||
_wsHelper->_subThreadWsMessageQueue.erase(iter);
|
||||
CC_SAFE_DELETE(subThreadMsg);
|
||||
return;
|
||||
}
|
||||
@@ -734,7 +716,7 @@ void WebSocket::onClientWritable()
|
||||
delete ((WebSocketFrame*)data->ext);
|
||||
data->ext = nullptr;
|
||||
CC_SAFE_DELETE(data);
|
||||
_wsHelper->_subThreadWsMessageQueue->erase(iter);
|
||||
_wsHelper->_subThreadWsMessageQueue.erase(iter);
|
||||
CC_SAFE_DELETE(subThreadMsg);
|
||||
|
||||
closeAsync();
|
||||
@@ -773,7 +755,7 @@ void WebSocket::onClientWritable()
|
||||
delete ((WebSocketFrame*)data->ext);
|
||||
data->ext = nullptr;
|
||||
CC_SAFE_DELETE(data);
|
||||
_wsHelper->_subThreadWsMessageQueue->erase(iter);
|
||||
_wsHelper->_subThreadWsMessageQueue.erase(iter);
|
||||
CC_SAFE_DELETE(subThreadMsg);
|
||||
|
||||
LOGD("-----------------------------------------------------------\n");
|
||||
@@ -801,7 +783,6 @@ void WebSocket::onClientReceivedData(void* in, ssize_t len)
|
||||
// If no more data pending, send it to the client thread
|
||||
size_t remainingSize = lws_remaining_packet_payload(_wsInstance);
|
||||
int isFinalFragment = lws_is_final_fragment(_wsInstance);
|
||||
// LOGD("remainingSize: %d, isFinalFragment: %d\n", (int)remainingSize, isFinalFragment);
|
||||
|
||||
if (remainingSize == 0 && isFinalFragment)
|
||||
{
|
||||
@@ -819,8 +800,8 @@ void WebSocket::onClientReceivedData(void* in, ssize_t len)
|
||||
frameData->push_back('\0');
|
||||
}
|
||||
|
||||
auto isDestroyed = _isDestroyed;
|
||||
_wsHelper->sendMessageToCocosThread([this, frameData, frameSize, isBinary, isDestroyed](){
|
||||
auto instance = this;
|
||||
_wsHelper->sendMessageToCocosThread([instance, frameData, frameSize, isBinary](){
|
||||
// In UI thread
|
||||
LOGD("Notify data len %d to Cocos thread.\n", (int)frameSize);
|
||||
|
||||
@@ -829,13 +810,9 @@ void WebSocket::onClientReceivedData(void* in, ssize_t len)
|
||||
data.bytes = (char*)frameData->data();
|
||||
data.len = frameSize;
|
||||
|
||||
if (*isDestroyed)
|
||||
if (__websocketInstances && __websocketInstances->find(instance) != __websocketInstances->end())
|
||||
{
|
||||
LOGD("WebSocket instance was destroyed!\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
_delegate->onMessage(this, data);
|
||||
instance->_delegate->onMessage(instance, data);
|
||||
}
|
||||
|
||||
delete frameData;
|
||||
@@ -855,12 +832,11 @@ void WebSocket::onConnectionOpened()
|
||||
_readyState = State::OPEN;
|
||||
_readStateMutex.unlock();
|
||||
|
||||
auto isDestroyed = _isDestroyed;
|
||||
_wsHelper->sendMessageToCocosThread([this, isDestroyed](){
|
||||
if (*isDestroyed) {
|
||||
LOGD("WebSocket instance was destroyed!\n");
|
||||
} else {
|
||||
_delegate->onOpen(this);
|
||||
auto instance = this;
|
||||
_wsHelper->sendMessageToCocosThread([instance](){
|
||||
if (__websocketInstances && __websocketInstances->find(instance) != __websocketInstances->end())
|
||||
{
|
||||
instance->_delegate->onOpen(instance);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -873,12 +849,11 @@ void WebSocket::onConnectionError()
|
||||
_readyState = State::CLOSING;
|
||||
_readStateMutex.unlock();
|
||||
|
||||
auto isDestroyed = _isDestroyed;
|
||||
_wsHelper->sendMessageToCocosThread([this, isDestroyed](){
|
||||
if (*isDestroyed) {
|
||||
LOGD("WebSocket instance was destroyed!\n");
|
||||
} else {
|
||||
_delegate->onError(this, ErrorCode::CONNECTION_FAILURE);
|
||||
auto instance = this;
|
||||
_wsHelper->sendMessageToCocosThread([instance](){
|
||||
if (__websocketInstances && __websocketInstances->find(instance) != __websocketInstances->end())
|
||||
{
|
||||
instance->_delegate->onError(instance, ErrorCode::CONNECTION_FAILURE);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -896,16 +871,14 @@ void WebSocket::onConnectionClosed()
|
||||
LOGD("WebSocket (%p) onConnectionClosed ...\n", this);
|
||||
_readyState = State::CLOSED;
|
||||
_readStateMutex.unlock();
|
||||
|
||||
_wsHelper->quitWebSocketThread();
|
||||
auto isDestroyed = _isDestroyed;
|
||||
_wsHelper->sendMessageToCocosThread([this, isDestroyed](){
|
||||
if (*isDestroyed) {
|
||||
LOGD("WebSocket instance was destroyed!\n");
|
||||
} else {
|
||||
|
||||
auto instance = this;
|
||||
_wsHelper->sendMessageToCocosThread([instance](){
|
||||
if (__websocketInstances && __websocketInstances->find(instance) != __websocketInstances->end())
|
||||
{
|
||||
//Waiting for the subThread safety exit
|
||||
_wsHelper->joinWebSocketThread();
|
||||
_delegate->onClose(this);
|
||||
instance->_wsHelper->joinWebSocketThread();
|
||||
instance->_delegate->onClose(instance);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -914,8 +887,6 @@ int WebSocket::onSocketCallback(struct lws *wsi,
|
||||
int reason,
|
||||
void *user, void *in, ssize_t len)
|
||||
{
|
||||
//LOGD("socket callback for %d reason\n", reason);
|
||||
|
||||
switch (reason)
|
||||
{
|
||||
case LWS_CALLBACK_CLIENT_ESTABLISHED:
|
||||
@@ -938,9 +909,11 @@ int WebSocket::onSocketCallback(struct lws *wsi,
|
||||
case LWS_CALLBACK_CLIENT_WRITEABLE:
|
||||
onClientWritable();
|
||||
break;
|
||||
|
||||
|
||||
case LWS_CALLBACK_GET_THREAD_ID:
|
||||
break;
|
||||
default:
|
||||
// LOGD("Unhandled websocket event: %d\n", reason);
|
||||
//LOGD("Unhandled websocket event: %d\n", reason);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#ifndef __CC_WEBSOCKET_H__
|
||||
#define __CC_WEBSOCKET_H__
|
||||
|
||||
#include <atomic>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <mutex>
|
||||
@@ -227,7 +226,7 @@ private:
|
||||
std::mutex _readStateMutex;
|
||||
State _readyState;
|
||||
std::string _host;
|
||||
unsigned int _port;
|
||||
int _port;
|
||||
std::string _path;
|
||||
|
||||
std::vector<char> _receivedData;
|
||||
@@ -238,7 +237,7 @@ private:
|
||||
|
||||
struct lws* _wsInstance;
|
||||
struct lws_context* _wsContext;
|
||||
std::shared_ptr<std::atomic<bool>> _isDestroyed;
|
||||
|
||||
Delegate* _delegate;
|
||||
int _SSLConnection;
|
||||
struct lws_protocols* _wsProtocols;
|
||||
|
||||
@@ -46,18 +46,18 @@ public:
|
||||
*/
|
||||
enum class Platform
|
||||
{
|
||||
OS_WINDOWS,/** Windows */
|
||||
OS_LINUX,/** Linux */
|
||||
OS_MAC,/** Mac*/
|
||||
OS_ANDROID,/** Android */
|
||||
OS_IPHONE,/** Iphone */
|
||||
OS_IPAD,/** Ipad */
|
||||
OS_BLACKBERRY,/** BLACKBERRY */
|
||||
OS_NACL,/** Nacl */
|
||||
OS_EMSCRIPTEN,/** Emscripten */
|
||||
OS_TIZEN,/** Tizen */
|
||||
OS_WINRT,/** Windows Store Applications */
|
||||
OS_WP8/** Windows Phone Applications */
|
||||
OS_WINDOWS, /**< Windows */
|
||||
OS_LINUX, /**< Linux */
|
||||
OS_MAC, /**< Mac OS X*/
|
||||
OS_ANDROID, /**< Android */
|
||||
OS_IPHONE, /**< iPhone */
|
||||
OS_IPAD, /**< iPad */
|
||||
OS_BLACKBERRY, /**< BlackBerry */
|
||||
OS_NACL, /**< Native Client in Chrome */
|
||||
OS_EMSCRIPTEN, /**< Emscripten */
|
||||
OS_TIZEN, /**< Tizen */
|
||||
OS_WINRT, /**< Windows Runtime Applications */
|
||||
OS_WP8 /**< Windows Phone 8 Applications */
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -221,10 +221,10 @@ Vec2 GLView::getVisibleOrigin() const
|
||||
|
||||
void GLView::setViewPortInPoints(float x , float y , float w , float h)
|
||||
{
|
||||
glViewport((float)(x * _scaleX + _viewPortRect.origin.x),
|
||||
(float)(y * _scaleY + _viewPortRect.origin.y),
|
||||
(float)(w * _scaleX),
|
||||
(float)(h * _scaleY));
|
||||
glViewport((GLint)(x * _scaleX + _viewPortRect.origin.x),
|
||||
(GLint)(y * _scaleY + _viewPortRect.origin.y),
|
||||
(GLsizei)(w * _scaleX),
|
||||
(GLsizei)(h * _scaleY));
|
||||
}
|
||||
|
||||
void GLView::setScissorInPoints(float x , float y , float w , float h)
|
||||
|
||||
@@ -34,8 +34,4 @@ LOCAL_EXPORT_LDLIBS := -lGLESv1_CM \
|
||||
-llog \
|
||||
-landroid
|
||||
|
||||
LOCAL_CPPFLAGS := -Wno-extern-c-compat
|
||||
|
||||
LOCAL_EXPORT_CPPFLAGS := -Wno-extern-c-compat
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
@@ -61,7 +61,6 @@ Application::Application()
|
||||
Application::~Application()
|
||||
{
|
||||
sm_pSharedApplication = nullptr;
|
||||
JniHelper::callStaticVoidMethod("org/cocos2dx/lib/Cocos2dxHelper", "terminateProcess");
|
||||
}
|
||||
|
||||
int Application::run()
|
||||
|
||||
@@ -110,7 +110,7 @@ bool GLViewImpl::isOpenGLReady()
|
||||
|
||||
void GLViewImpl::end()
|
||||
{
|
||||
|
||||
JniHelper::callStaticVoidMethod("org/cocos2dx/lib/Cocos2dxHelper", "terminateProcess");
|
||||
}
|
||||
|
||||
void GLViewImpl::swapBuffers()
|
||||
|
||||
@@ -57,9 +57,12 @@ public:
|
||||
|
||||
virtual ValueVector getValueVectorFromFile(const std::string& filename) override;
|
||||
void setBundle(NSBundle* bundle);
|
||||
private:
|
||||
|
||||
virtual bool isDirectoryExistInternal(const std::string& dirPath) const override;
|
||||
virtual bool isFileExistInternal(const std::string& filePath) const override;
|
||||
virtual bool removeDirectory(const std::string& dirPath) override;
|
||||
private:
|
||||
bool isFileExistInternal(const std::string& filePath,bool& isDirectory) const;
|
||||
|
||||
NSBundle* getBundle() const;
|
||||
NSBundle* _bundle;
|
||||
|
||||
@@ -359,46 +359,43 @@ std::string FileUtilsApple::getWritablePath() const
|
||||
return strRet;
|
||||
}
|
||||
|
||||
bool FileUtilsApple::isFileExistInternal(const std::string& filePath) const
|
||||
bool FileUtilsApple::isDirectoryExistInternal(const std::string &dirPath) const
|
||||
{
|
||||
bool isDirectory = false;
|
||||
auto isExist = isFileExistInternal(dirPath, isDirectory);
|
||||
return isExist && isDirectory;
|
||||
}
|
||||
|
||||
bool FileUtilsApple::isFileExistInternal(const std::string &filePath) const
|
||||
{
|
||||
bool isDirectory = false;
|
||||
auto isExist = isFileExistInternal(filePath, isDirectory);
|
||||
return isExist && !isDirectory;
|
||||
}
|
||||
|
||||
bool FileUtilsApple::isFileExistInternal(const std::string& filePath, bool& isDirectory) const
|
||||
{
|
||||
if (filePath.empty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ret = false;
|
||||
|
||||
|
||||
isDirectory = false;
|
||||
|
||||
NSString* path = nil;
|
||||
if (filePath[0] != '/')
|
||||
{
|
||||
std::string path;
|
||||
std::string file;
|
||||
size_t pos = filePath.find_last_of("/");
|
||||
if (pos != std::string::npos)
|
||||
{
|
||||
file = filePath.substr(pos+1);
|
||||
path = filePath.substr(0, pos+1);
|
||||
}
|
||||
else
|
||||
{
|
||||
file = filePath;
|
||||
}
|
||||
|
||||
NSString* fullpath = [getBundle() pathForResource:[NSString stringWithUTF8String:file.c_str()]
|
||||
ofType:nil
|
||||
inDirectory:[NSString stringWithUTF8String:path.c_str()]];
|
||||
if (fullpath != nil) {
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
path = [[getBundle() resourcePath] stringByAppendingPathComponent:
|
||||
[NSString stringWithUTF8String:filePath.c_str()]];
|
||||
else
|
||||
{
|
||||
// Search path is an absolute path.
|
||||
if ([s_fileManager fileExistsAtPath:[NSString stringWithUTF8String:filePath.c_str()]]) {
|
||||
ret = true;
|
||||
}
|
||||
path = [NSString stringWithUTF8String:filePath.c_str()];
|
||||
|
||||
BOOL isDir = NO;
|
||||
// Search path is an absolute path.
|
||||
if ([s_fileManager fileExistsAtPath:path isDirectory:&isDir]) {
|
||||
if (isDir)
|
||||
isDirectory = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
return ret;
|
||||
return false;
|
||||
}
|
||||
|
||||
static int unlink_cb(const char *fpath, const struct stat *sb, int typeflag, struct FTW *ftwbuf)
|
||||
|
||||
@@ -301,6 +301,10 @@ void GLProgramCache::reloadDefaultGLPrograms()
|
||||
p = getGLProgram(GLProgram::SHADER_CAMERA_CLEAR);
|
||||
p->reset();
|
||||
loadDefaultGLProgram(p, kShaderType_CameraClear);
|
||||
|
||||
p = getGLProgram(GLProgram::SHADER_NAME_POSITION_GRAYSCALE);
|
||||
p->reset();
|
||||
loadDefaultGLProgram(p, kShaderType_UIGrayScale);
|
||||
}
|
||||
|
||||
void GLProgramCache::reloadDefaultGLProgramsRelativeToLights()
|
||||
|
||||
@@ -87,7 +87,8 @@ void GroupCommand::init(float globalOrder)
|
||||
|
||||
GroupCommand::~GroupCommand()
|
||||
{
|
||||
Director::DirectorInstance->getRenderer()->getGroupCommandManager()->releaseGroupID(_renderQueueID);
|
||||
if(Director::DirectorInstance)
|
||||
Director::DirectorInstance->getRenderer()->getGroupCommandManager()->releaseGroupID(_renderQueueID);
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
@@ -781,7 +781,7 @@ void VolatileTextureMgr::reloadAllTextures()
|
||||
break;
|
||||
case VolatileTexture::kString:
|
||||
{
|
||||
vt->_texture->initWithString(vt->_text.c_str(), vt->_fontDefinition);
|
||||
vt->_texture->initWithString(vt->_text, vt->_fontDefinition);
|
||||
}
|
||||
break;
|
||||
case VolatileTexture::kImage:
|
||||
|
||||
@@ -90,26 +90,6 @@ hasPremultipliedAlpha : function (
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method initWithMipmaps
|
||||
* @param {cc._MipmapInfo} arg0
|
||||
* @param {int} arg1
|
||||
* @param {cc.Texture2D::PixelFormat} arg2
|
||||
* @param {int} arg3
|
||||
* @param {int} arg4
|
||||
* @return {bool}
|
||||
*/
|
||||
initWithMipmaps : function (
|
||||
map,
|
||||
int,
|
||||
pixelformat,
|
||||
int,
|
||||
int
|
||||
)
|
||||
{
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getPixelsHigh
|
||||
* @return {int}
|
||||
@@ -955,16 +935,6 @@ getTag : function (
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getonEnterTransitionDidFinishCallback
|
||||
* @return {function}
|
||||
*/
|
||||
getonEnterTransitionDidFinishCallback : function (
|
||||
)
|
||||
{
|
||||
return std::function<void ()>;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getNodeToWorldAffineTransform
|
||||
* @return {cc.AffineTransform}
|
||||
@@ -1161,16 +1131,6 @@ node
|
||||
return cc.AffineTransform;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getOnEnterCallback
|
||||
* @return {function}
|
||||
*/
|
||||
getOnEnterCallback : function (
|
||||
)
|
||||
{
|
||||
return std::function<void ()>;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method isOpacityModifyRGB
|
||||
* @return {bool}
|
||||
@@ -1714,16 +1674,6 @@ float
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getOnExitCallback
|
||||
* @return {function}
|
||||
*/
|
||||
getOnExitCallback : function (
|
||||
)
|
||||
{
|
||||
return std::function<void ()>;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getChildByTag
|
||||
* @param {int} arg0
|
||||
@@ -1904,16 +1854,6 @@ func
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getonExitTransitionDidStartCallback
|
||||
* @return {function}
|
||||
*/
|
||||
getonExitTransitionDidStartCallback : function (
|
||||
)
|
||||
{
|
||||
return std::function<void ()>;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method removeFromParentAndCleanup
|
||||
* @param {bool} bool
|
||||
@@ -2430,16 +2370,6 @@ glcontextattrs
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getGLContextAttrs
|
||||
* @return {GLContextAttrs}
|
||||
*/
|
||||
getGLContextAttrs : function (
|
||||
)
|
||||
{
|
||||
return GLContextAttrs;
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -2455,16 +2385,6 @@ pause : function (
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method isPurgeDirectorInNextLoop
|
||||
* @return {bool}
|
||||
*/
|
||||
isPurgeDirectorInNextLoop : function (
|
||||
)
|
||||
{
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setEventDispatcher
|
||||
* @param {cc.EventDispatcher} arg0
|
||||
@@ -3075,6 +2995,16 @@ getActionManager : function (
|
||||
return cc.ActionManager;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method isPurgeDirectorInNextLoop
|
||||
* @return {bool}
|
||||
*/
|
||||
isPurgeDirectorInNextLoop : function (
|
||||
)
|
||||
{
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getInstance
|
||||
* @return {cc.Director}
|
||||
@@ -7218,20 +7148,6 @@ ActionCamera : function (
|
||||
*/
|
||||
cc.OrbitCamera = {
|
||||
|
||||
/**
|
||||
* @method sphericalRadius
|
||||
* @param {float} arg0
|
||||
* @param {float} arg1
|
||||
* @param {float} arg2
|
||||
*/
|
||||
sphericalRadius : function (
|
||||
float,
|
||||
float,
|
||||
float
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method initWithDuration
|
||||
* @param {float} arg0
|
||||
@@ -10021,30 +9937,6 @@ ShatteredTiles3D : function (
|
||||
*/
|
||||
cc.ShuffleTiles = {
|
||||
|
||||
/**
|
||||
* @method placeTile
|
||||
* @param {vec2_object} arg0
|
||||
* @param {cc.Tile} arg1
|
||||
*/
|
||||
placeTile : function (
|
||||
vec2,
|
||||
tile
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method shuffle
|
||||
* @param {unsigned int} arg0
|
||||
* @param {unsigned int} arg1
|
||||
*/
|
||||
shuffle : function (
|
||||
int,
|
||||
int
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method initWithDuration
|
||||
* @param {float} arg0
|
||||
@@ -10291,18 +10183,6 @@ vec2
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method shuffle
|
||||
* @param {unsigned int} arg0
|
||||
* @param {unsigned int} arg1
|
||||
*/
|
||||
shuffle : function (
|
||||
int,
|
||||
int
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method initWithDuration
|
||||
* @param {float} arg0
|
||||
@@ -10852,20 +10732,6 @@ glprogram
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setUniformFloatv
|
||||
* @param {int|String} int
|
||||
* @param {int|int} int
|
||||
* @param {float|float} float
|
||||
*/
|
||||
setUniformFloatv : function(
|
||||
str,
|
||||
int,
|
||||
float
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getGLProgram
|
||||
* @return {cc.GLProgram}
|
||||
@@ -16519,48 +16385,6 @@ getRenderFormat : function (
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getData
|
||||
* @return {unsigned char}
|
||||
*/
|
||||
getData : function (
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getMipmaps
|
||||
* @return {cc._MipmapInfo}
|
||||
*/
|
||||
getMipmaps : function (
|
||||
)
|
||||
{
|
||||
return cc._MipmapInfo;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method initWithRawData
|
||||
* @param {unsigned char} arg0
|
||||
* @param {int} arg1
|
||||
* @param {int} arg2
|
||||
* @param {int} arg3
|
||||
* @param {int} arg4
|
||||
* @param {bool} arg5
|
||||
* @return {bool}
|
||||
*/
|
||||
initWithRawData : function (
|
||||
char,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
bool
|
||||
)
|
||||
{
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setPVRImagesHavePremultipliedAlpha
|
||||
* @param {bool} arg0
|
||||
@@ -18561,16 +18385,6 @@ int
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getUniformFlags
|
||||
* @return {cc.GLProgram::UniformFlags}
|
||||
*/
|
||||
getUniformFlags : function (
|
||||
)
|
||||
{
|
||||
return cc.GLProgram::UniformFlags;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getUniformLocationForName
|
||||
* @param {char} arg0
|
||||
@@ -18767,18 +18581,6 @@ str
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getVertexAttrib
|
||||
* @param {String} arg0
|
||||
* @return {cc.VertexAttrib}
|
||||
*/
|
||||
getVertexAttrib : function (
|
||||
str
|
||||
)
|
||||
{
|
||||
return cc.VertexAttrib;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setUniformLocationWith2f
|
||||
* @param {int} arg0
|
||||
@@ -20014,16 +19816,6 @@ TextFieldTTF : function (
|
||||
*/
|
||||
cc.ParallaxNode = {
|
||||
|
||||
/**
|
||||
* @method getParallaxArray
|
||||
* @return {cc._ccArray|cc._ccArray}
|
||||
*/
|
||||
getParallaxArray : function(
|
||||
)
|
||||
{
|
||||
return cc._ccArray;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method addChild
|
||||
* @param {cc.Node} arg0
|
||||
@@ -20050,16 +19842,6 @@ bool
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setParallaxArray
|
||||
* @param {cc._ccArray} arg0
|
||||
*/
|
||||
setParallaxArray : function (
|
||||
_ccarray
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method create
|
||||
* @return {cc.ParallaxNode}
|
||||
@@ -20668,16 +20450,6 @@ releaseMap : function (
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getTGAInfo
|
||||
* @return {cc.sImageTGA}
|
||||
*/
|
||||
getTGAInfo : function (
|
||||
)
|
||||
{
|
||||
return cc.sImageTGA;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getTileAt
|
||||
* @param {vec2_object} arg0
|
||||
@@ -20702,16 +20474,6 @@ vec2
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setTGAInfo
|
||||
* @param {cc.sImageTGA} arg0
|
||||
*/
|
||||
setTGAInfo : function (
|
||||
simagetga
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method create
|
||||
* @param {String} arg0
|
||||
@@ -20816,16 +20578,6 @@ releaseMap : function (
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setTiles
|
||||
* @param {unsigned int} arg0
|
||||
*/
|
||||
setTiles : function (
|
||||
int
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getLayerSize
|
||||
* @return {size_object}
|
||||
|
||||
@@ -50,18 +50,6 @@ setBonesToSetupPose : function (
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method initWithData
|
||||
* @param {spSkeletonData} arg0
|
||||
* @param {bool} arg1
|
||||
*/
|
||||
initWithData : function (
|
||||
spskeletondata,
|
||||
bool
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setDebugSlotsEnabled
|
||||
* @param {bool} arg0
|
||||
@@ -272,46 +260,6 @@ getState : function (
|
||||
return spAnimationState;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setTrackCompleteListener
|
||||
* @param {spTrackEntry} arg0
|
||||
* @param {function} arg1
|
||||
*/
|
||||
setTrackCompleteListener : function (
|
||||
sptrackentry,
|
||||
func
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method onTrackEntryEvent
|
||||
* @param {int} arg0
|
||||
* @param {spEventType} arg1
|
||||
* @param {spEvent} arg2
|
||||
* @param {int} arg3
|
||||
*/
|
||||
onTrackEntryEvent : function (
|
||||
int,
|
||||
speventtype,
|
||||
spevent,
|
||||
int
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setTrackStartListener
|
||||
* @param {spTrackEntry} arg0
|
||||
* @param {function} arg1
|
||||
*/
|
||||
setTrackStartListener : function (
|
||||
sptrackentry,
|
||||
func
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method update
|
||||
* @param {float} arg0
|
||||
@@ -332,18 +280,6 @@ func
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setTrackEndListener
|
||||
* @param {spTrackEntry} arg0
|
||||
* @param {function} arg1
|
||||
*/
|
||||
setTrackEndListener : function (
|
||||
sptrackentry,
|
||||
func
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setEventListener
|
||||
* @param {function} arg0
|
||||
@@ -402,22 +338,6 @@ clearTrack : function (
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method onAnimationStateEvent
|
||||
* @param {int} arg0
|
||||
* @param {spEventType} arg1
|
||||
* @param {spEvent} arg2
|
||||
* @param {int} arg3
|
||||
*/
|
||||
onAnimationStateEvent : function (
|
||||
int,
|
||||
speventtype,
|
||||
spevent,
|
||||
int
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method createWithFile
|
||||
* @param {String|String} str
|
||||
|
||||
@@ -114,20 +114,6 @@ getLoop : function (
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method initWithBinary
|
||||
* @param {ccs.CocoLoader} arg0
|
||||
* @param {ccs.stExpCocoNode} arg1
|
||||
* @param {cc.Ref} arg2
|
||||
*/
|
||||
initWithBinary : function (
|
||||
cocoloader,
|
||||
stexpcoconode,
|
||||
ref
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method addActionNode
|
||||
* @param {ccs.ActionNode} arg0
|
||||
@@ -232,22 +218,6 @@ char
|
||||
return ccs.ActionObject;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method initWithBinary
|
||||
* @param {char} arg0
|
||||
* @param {cc.Ref} arg1
|
||||
* @param {ccs.CocoLoader} arg2
|
||||
* @param {ccs.stExpCocoNode} arg3
|
||||
*/
|
||||
initWithBinary : function (
|
||||
char,
|
||||
ref,
|
||||
cocoloader,
|
||||
stexpcoconode
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method playActionByName
|
||||
* @param {char|char} char
|
||||
|
||||
@@ -426,14 +426,15 @@ bool js_cocos2dx_audioengine_AudioEngine_setVolume(JSContext *cx, uint32_t argc,
|
||||
bool js_cocos2dx_audioengine_AudioEngine_preload(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 2) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
std::function<void (bool)> arg1;
|
||||
ok = true;
|
||||
do {
|
||||
if(JS_TypeOfValue(cx, args.get(1)) == JSTYPE_FUNCTION)
|
||||
{
|
||||
@@ -457,17 +458,18 @@ bool js_cocos2dx_audioengine_AudioEngine_preload(JSContext *cx, uint32_t argc, j
|
||||
}
|
||||
} while(0)
|
||||
;
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::experimental::AudioEngine::preload(arg0, arg1);
|
||||
return true;
|
||||
}
|
||||
} while (0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::experimental::AudioEngine::preload(arg0);
|
||||
return true;
|
||||
}
|
||||
@@ -686,13 +688,13 @@ bool js_cocos2dx_audioengine_AudioEngine_setFinishCallback(JSContext *cx, uint32
|
||||
bool js_cocos2dx_audioengine_AudioEngine_getProfile(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::experimental::AudioProfile* ret = cocos2d::experimental::AudioEngine::getProfile(arg0);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
do {
|
||||
@@ -709,10 +711,11 @@ bool js_cocos2dx_audioengine_AudioEngine_getProfile(JSContext *cx, uint32_t argc
|
||||
} while (0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
int arg0 = 0;
|
||||
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::experimental::AudioProfile* ret = cocos2d::experimental::AudioEngine::getProfile(arg0);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
do {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -20,7 +20,6 @@ bool js_cocos2dx_Texture2D_setGLProgram(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
bool js_cocos2dx_Texture2D_getMaxS(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Texture2D_releaseGLTexture(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Texture2D_hasPremultipliedAlpha(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Texture2D_initWithMipmaps(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Texture2D_getPixelsHigh(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Texture2D_getBitsPerPixelForFormat(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Texture2D_getName(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
@@ -147,7 +146,6 @@ bool js_cocos2dx_Node_removeAllComponents(JSContext *cx, uint32_t argc, jsval *v
|
||||
bool js_cocos2dx_Node_getOpacity(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Node_setCameraMask(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Node_getTag(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Node_getonEnterTransitionDidFinishCallback(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Node_getNodeToWorldAffineTransform(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Node_removeChild(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Node_getScene(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
@@ -167,7 +165,6 @@ bool js_cocos2dx_Node_isCascadeOpacityEnabled(JSContext *cx, uint32_t argc, jsva
|
||||
bool js_cocos2dx_Node_setParent(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Node_getName(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Node_getNodeToParentAffineTransform(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Node_getOnEnterCallback(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Node_isOpacityModifyRGB(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Node_stopActionByTag(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Node_reorderChild(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
@@ -220,7 +217,6 @@ bool js_cocos2dx_Node_getParentToNodeAffineTransform(JSContext *cx, uint32_t arg
|
||||
bool js_cocos2dx_Node_getPositionZ(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Node_setGlobalZOrder(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Node_setScale(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Node_getOnExitCallback(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Node_getChildByTag(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Node_setOrderOfArrival(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Node_getScaleZ(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
@@ -238,7 +234,6 @@ bool js_cocos2dx_Node_getGlobalZOrder(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Node_draw(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Node_setUserObject(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Node_enumerateChildren(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Node_getonExitTransitionDidStartCallback(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Node_removeFromParentAndCleanup(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Node_convertTouchToNodeSpaceAR(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Node_update(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
@@ -303,7 +298,6 @@ bool js_cocos2dx_GLView_getVisibleSize(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_GLView_isScissorEnabled(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_GLView_pollEvents(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_GLView_setGLContextAttrs(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_GLView_getGLContextAttrs(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
|
||||
extern JSClass *jsb_cocos2d_Director_class;
|
||||
extern JSObject *jsb_cocos2d_Director_prototype;
|
||||
@@ -313,7 +307,6 @@ void js_cocos2dx_Director_finalize(JSContext *cx, JSObject *obj);
|
||||
void js_register_cocos2dx_Director(JSContext *cx, JS::HandleObject global);
|
||||
void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj);
|
||||
bool js_cocos2dx_Director_pause(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Director_isPurgeDirectorInNextLoop(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Director_setEventDispatcher(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Director_setContentScaleFactor(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Director_getContentScaleFactor(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
@@ -377,6 +370,7 @@ bool js_cocos2dx_Director_getEventDispatcher(JSContext *cx, uint32_t argc, jsval
|
||||
bool js_cocos2dx_Director_replaceScene(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Director_setAnimationInterval(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Director_getActionManager(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Director_isPurgeDirectorInNextLoop(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Director_getInstance(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
|
||||
extern JSClass *jsb_cocos2d_Scheduler_class;
|
||||
@@ -1147,7 +1141,6 @@ bool js_cocos2dx_OrbitCamera_constructor(JSContext *cx, uint32_t argc, jsval *vp
|
||||
void js_cocos2dx_OrbitCamera_finalize(JSContext *cx, JSObject *obj);
|
||||
void js_register_cocos2dx_OrbitCamera(JSContext *cx, JS::HandleObject global);
|
||||
void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj);
|
||||
bool js_cocos2dx_OrbitCamera_sphericalRadius(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_OrbitCamera_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_OrbitCamera_create(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_OrbitCamera_OrbitCamera(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
@@ -1930,8 +1923,6 @@ bool js_cocos2dx_ShuffleTiles_constructor(JSContext *cx, uint32_t argc, jsval *v
|
||||
void js_cocos2dx_ShuffleTiles_finalize(JSContext *cx, JSObject *obj);
|
||||
void js_register_cocos2dx_ShuffleTiles(JSContext *cx, JS::HandleObject global);
|
||||
void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj);
|
||||
bool js_cocos2dx_ShuffleTiles_placeTile(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ShuffleTiles_shuffle(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ShuffleTiles_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ShuffleTiles_getDelta(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ShuffleTiles_create(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
@@ -1990,7 +1981,6 @@ void js_register_cocos2dx_TurnOffTiles(JSContext *cx, JS::HandleObject global);
|
||||
void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj);
|
||||
bool js_cocos2dx_TurnOffTiles_turnOnTile(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_TurnOffTiles_turnOffTile(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_TurnOffTiles_shuffle(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_TurnOffTiles_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_TurnOffTiles_create(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_TurnOffTiles_TurnOffTiles(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
@@ -2081,7 +2071,6 @@ bool js_cocos2dx_GLProgramState_getUniformCount(JSContext *cx, uint32_t argc, js
|
||||
bool js_cocos2dx_GLProgramState_applyAttributes(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_GLProgramState_clone(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_GLProgramState_setGLProgram(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_GLProgramState_setUniformFloatv(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_GLProgramState_getGLProgram(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_GLProgramState_setUniformTexture(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_GLProgramState_applyUniforms(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
@@ -2895,9 +2884,6 @@ bool js_cocos2dx_Image_getBitPerPixel(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Image_getFileType(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Image_getNumberOfMipmaps(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Image_getRenderFormat(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Image_getData(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Image_getMipmaps(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Image_initWithRawData(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Image_setPVRImagesHavePremultipliedAlpha(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Image_setPNGPremultipliedAlphaEnabled(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_Image_Image(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
@@ -3384,7 +3370,6 @@ void js_register_cocos2dx_GLProgram(JSContext *cx, JS::HandleObject global);
|
||||
void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj);
|
||||
bool js_cocos2dx_GLProgram_getFragmentShaderLog(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_GLProgram_bindAttribLocation(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_GLProgram_getUniformFlags(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_GLProgram_getUniformLocationForName(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_GLProgram_use(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_GLProgram_getVertexShaderLog(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
@@ -3401,7 +3386,6 @@ bool js_cocos2dx_GLProgram_getUniformLocation(JSContext *cx, uint32_t argc, jsva
|
||||
bool js_cocos2dx_GLProgram_link(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_GLProgram_reset(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_GLProgram_getAttribLocation(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_GLProgram_getVertexAttrib(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_GLProgram_setUniformLocationWith2f(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_GLProgram_setUniformLocationWith4i(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_GLProgram_setUniformLocationWith1i(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
@@ -3597,10 +3581,8 @@ bool js_cocos2dx_ParallaxNode_constructor(JSContext *cx, uint32_t argc, jsval *v
|
||||
void js_cocos2dx_ParallaxNode_finalize(JSContext *cx, JSObject *obj);
|
||||
void js_register_cocos2dx_ParallaxNode(JSContext *cx, JS::HandleObject global);
|
||||
void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj);
|
||||
bool js_cocos2dx_ParallaxNode_getParallaxArray(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ParallaxNode_addChild(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ParallaxNode_removeAllChildrenWithCleanup(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ParallaxNode_setParallaxArray(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ParallaxNode_create(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_ParallaxNode_ParallaxNode(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
|
||||
@@ -3696,10 +3678,8 @@ void js_register_cocos2dx_TileMapAtlas(JSContext *cx, JS::HandleObject global);
|
||||
void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj);
|
||||
bool js_cocos2dx_TileMapAtlas_initWithTileFile(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_TileMapAtlas_releaseMap(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_TileMapAtlas_getTGAInfo(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_TileMapAtlas_getTileAt(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_TileMapAtlas_setTile(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_TileMapAtlas_setTGAInfo(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_TileMapAtlas_create(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_TileMapAtlas_TileMapAtlas(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
|
||||
@@ -3716,7 +3696,6 @@ bool js_cocos2dx_TMXLayer_getPositionAt(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
bool js_cocos2dx_TMXLayer_setLayerOrientation(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_TMXLayer_initWithTilesetInfo(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_TMXLayer_releaseMap(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_TMXLayer_setTiles(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_TMXLayer_getLayerSize(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_TMXLayer_setMapTileSize(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_TMXLayer_getLayerOrientation(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
|
||||
@@ -1420,6 +1420,7 @@ bool js_cocos2dx_builder_CCBReader_constructor(JSContext *cx, uint32_t argc, jsv
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx);
|
||||
do {
|
||||
ok = true;
|
||||
if (argc == 1) {
|
||||
cocosbuilder::CCBReader* arg0 = nullptr;
|
||||
do {
|
||||
@@ -1431,7 +1432,7 @@ bool js_cocos2dx_builder_CCBReader_constructor(JSContext *cx, uint32_t argc, jsv
|
||||
arg0 = (cocosbuilder::CCBReader*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cobj = new (std::nothrow) cocosbuilder::CCBReader(arg0);
|
||||
cocos2d::Ref *_ccobj = dynamic_cast<cocos2d::Ref *>(cobj);
|
||||
if (_ccobj) {
|
||||
@@ -1456,6 +1457,7 @@ bool js_cocos2dx_builder_CCBReader_constructor(JSContext *cx, uint32_t argc, jsv
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
ok = true;
|
||||
if (argc == 4) {
|
||||
cocosbuilder::NodeLoaderLibrary* arg0 = nullptr;
|
||||
do {
|
||||
@@ -1467,8 +1469,9 @@ bool js_cocos2dx_builder_CCBReader_constructor(JSContext *cx, uint32_t argc, jsv
|
||||
arg0 = (cocosbuilder::NodeLoaderLibrary*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocosbuilder::CCBMemberVariableAssigner* arg1 = nullptr;
|
||||
ok = true;
|
||||
do {
|
||||
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
||||
if (!args.get(1).isObject()) { ok = false; break; }
|
||||
@@ -1478,8 +1481,9 @@ bool js_cocos2dx_builder_CCBReader_constructor(JSContext *cx, uint32_t argc, jsv
|
||||
arg1 = (cocosbuilder::CCBMemberVariableAssigner*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocosbuilder::CCBSelectorResolver* arg2 = nullptr;
|
||||
ok = true;
|
||||
do {
|
||||
if (args.get(2).isNull()) { arg2 = nullptr; break; }
|
||||
if (!args.get(2).isObject()) { ok = false; break; }
|
||||
@@ -1489,8 +1493,9 @@ bool js_cocos2dx_builder_CCBReader_constructor(JSContext *cx, uint32_t argc, jsv
|
||||
arg2 = (cocosbuilder::CCBSelectorResolver*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocosbuilder::NodeLoaderListener* arg3 = nullptr;
|
||||
ok = true;
|
||||
do {
|
||||
if (args.get(3).isNull()) { arg3 = nullptr; break; }
|
||||
if (!args.get(3).isObject()) { ok = false; break; }
|
||||
@@ -1500,7 +1505,7 @@ bool js_cocos2dx_builder_CCBReader_constructor(JSContext *cx, uint32_t argc, jsv
|
||||
arg3 = (cocosbuilder::NodeLoaderListener*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg3, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cobj = new (std::nothrow) cocosbuilder::CCBReader(arg0, arg1, arg2, arg3);
|
||||
cocos2d::Ref *_ccobj = dynamic_cast<cocos2d::Ref *>(cobj);
|
||||
if (_ccobj) {
|
||||
@@ -1525,6 +1530,7 @@ bool js_cocos2dx_builder_CCBReader_constructor(JSContext *cx, uint32_t argc, jsv
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
ok = true;
|
||||
if (argc == 0) {
|
||||
cobj = new (std::nothrow) cocosbuilder::CCBReader();
|
||||
cocos2d::Ref *_ccobj = dynamic_cast<cocos2d::Ref *>(cobj);
|
||||
|
||||
@@ -1176,7 +1176,6 @@ bool js_cocos2dx_extension_ControlButton_setMargins(JSContext *cx, uint32_t argc
|
||||
}
|
||||
bool js_cocos2dx_extension_ControlButton_getCurrentTitle(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
bool ok = true;
|
||||
cocos2d::extension::ControlButton* cobj = nullptr;
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -1293,9 +1292,9 @@ bool js_cocos2dx_extension_ControlButton_getTitleForState(JSContext *cx, uint32_
|
||||
bool js_cocos2dx_extension_ControlButton_create(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
cocos2d::ui::Scale9Sprite* arg0 = nullptr;
|
||||
do {
|
||||
@@ -1307,7 +1306,7 @@ bool js_cocos2dx_extension_ControlButton_create(JSContext *cx, uint32_t argc, js
|
||||
arg0 = (cocos2d::ui::Scale9Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::extension::ControlButton* ret = cocos2d::extension::ControlButton::create(arg0);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
do {
|
||||
@@ -1341,6 +1340,7 @@ bool js_cocos2dx_extension_ControlButton_create(JSContext *cx, uint32_t argc, js
|
||||
} while (0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 2) {
|
||||
cocos2d::Node* arg0 = nullptr;
|
||||
do {
|
||||
@@ -1352,8 +1352,9 @@ bool js_cocos2dx_extension_ControlButton_create(JSContext *cx, uint32_t argc, js
|
||||
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::ui::Scale9Sprite* arg1 = nullptr;
|
||||
ok = true;
|
||||
do {
|
||||
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
||||
if (!args.get(1).isObject()) { ok = false; break; }
|
||||
@@ -1363,7 +1364,7 @@ bool js_cocos2dx_extension_ControlButton_create(JSContext *cx, uint32_t argc, js
|
||||
arg1 = (cocos2d::ui::Scale9Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::extension::ControlButton* ret = cocos2d::extension::ControlButton::create(arg0, arg1);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
do {
|
||||
@@ -1380,16 +1381,19 @@ bool js_cocos2dx_extension_ControlButton_create(JSContext *cx, uint32_t argc, js
|
||||
} while (0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 3) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
std::string arg1;
|
||||
ok = true;
|
||||
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
double arg2 = 0;
|
||||
ok = true;
|
||||
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::extension::ControlButton* ret = cocos2d::extension::ControlButton::create(arg0, arg1, arg2);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
do {
|
||||
@@ -1406,6 +1410,7 @@ bool js_cocos2dx_extension_ControlButton_create(JSContext *cx, uint32_t argc, js
|
||||
} while (0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 3) {
|
||||
cocos2d::Node* arg0 = nullptr;
|
||||
do {
|
||||
@@ -1417,8 +1422,9 @@ bool js_cocos2dx_extension_ControlButton_create(JSContext *cx, uint32_t argc, js
|
||||
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::ui::Scale9Sprite* arg1 = nullptr;
|
||||
ok = true;
|
||||
do {
|
||||
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
||||
if (!args.get(1).isObject()) { ok = false; break; }
|
||||
@@ -1428,10 +1434,11 @@ bool js_cocos2dx_extension_ControlButton_create(JSContext *cx, uint32_t argc, js
|
||||
arg1 = (cocos2d::ui::Scale9Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
bool arg2;
|
||||
ok = true;
|
||||
arg2 = JS::ToBoolean(args.get(2));
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::extension::ControlButton* ret = cocos2d::extension::ControlButton::create(arg0, arg1, arg2);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
do {
|
||||
@@ -3196,7 +3203,6 @@ bool js_cocos2dx_extension_ControlSlider_getMaximumAllowedValue(JSContext *cx, u
|
||||
}
|
||||
bool js_cocos2dx_extension_ControlSlider_initWithSprites(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
bool ok = true;
|
||||
cocos2d::extension::ControlSlider* cobj = nullptr;
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -3206,6 +3212,7 @@ bool js_cocos2dx_extension_ControlSlider_initWithSprites(JSContext *cx, uint32_t
|
||||
cobj = (cocos2d::extension::ControlSlider *)(proxy ? proxy->ptr : nullptr);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlSlider_initWithSprites : Invalid Native Object");
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 4) {
|
||||
cocos2d::Sprite* arg0 = nullptr;
|
||||
do {
|
||||
@@ -3217,8 +3224,9 @@ bool js_cocos2dx_extension_ControlSlider_initWithSprites(JSContext *cx, uint32_t
|
||||
arg0 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::Sprite* arg1 = nullptr;
|
||||
ok = true;
|
||||
do {
|
||||
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
||||
if (!args.get(1).isObject()) { ok = false; break; }
|
||||
@@ -3228,8 +3236,9 @@ bool js_cocos2dx_extension_ControlSlider_initWithSprites(JSContext *cx, uint32_t
|
||||
arg1 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::Sprite* arg2 = nullptr;
|
||||
ok = true;
|
||||
do {
|
||||
if (args.get(2).isNull()) { arg2 = nullptr; break; }
|
||||
if (!args.get(2).isObject()) { ok = false; break; }
|
||||
@@ -3239,8 +3248,9 @@ bool js_cocos2dx_extension_ControlSlider_initWithSprites(JSContext *cx, uint32_t
|
||||
arg2 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::Sprite* arg3 = nullptr;
|
||||
ok = true;
|
||||
do {
|
||||
if (args.get(3).isNull()) { arg3 = nullptr; break; }
|
||||
if (!args.get(3).isObject()) { ok = false; break; }
|
||||
@@ -3250,7 +3260,7 @@ bool js_cocos2dx_extension_ControlSlider_initWithSprites(JSContext *cx, uint32_t
|
||||
arg3 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg3, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
bool ret = cobj->initWithSprites(arg0, arg1, arg2, arg3);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = BOOLEAN_TO_JSVAL(ret);
|
||||
@@ -3260,6 +3270,7 @@ bool js_cocos2dx_extension_ControlSlider_initWithSprites(JSContext *cx, uint32_t
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 3) {
|
||||
cocos2d::Sprite* arg0 = nullptr;
|
||||
do {
|
||||
@@ -3271,8 +3282,9 @@ bool js_cocos2dx_extension_ControlSlider_initWithSprites(JSContext *cx, uint32_t
|
||||
arg0 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::Sprite* arg1 = nullptr;
|
||||
ok = true;
|
||||
do {
|
||||
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
||||
if (!args.get(1).isObject()) { ok = false; break; }
|
||||
@@ -3282,8 +3294,9 @@ bool js_cocos2dx_extension_ControlSlider_initWithSprites(JSContext *cx, uint32_t
|
||||
arg1 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::Sprite* arg2 = nullptr;
|
||||
ok = true;
|
||||
do {
|
||||
if (args.get(2).isNull()) { arg2 = nullptr; break; }
|
||||
if (!args.get(2).isObject()) { ok = false; break; }
|
||||
@@ -3293,7 +3306,7 @@ bool js_cocos2dx_extension_ControlSlider_initWithSprites(JSContext *cx, uint32_t
|
||||
arg2 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
bool ret = cobj->initWithSprites(arg0, arg1, arg2);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = BOOLEAN_TO_JSVAL(ret);
|
||||
@@ -3694,9 +3707,9 @@ bool js_cocos2dx_extension_ControlSlider_setMaximumAllowedValue(JSContext *cx, u
|
||||
bool js_cocos2dx_extension_ControlSlider_create(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 3) {
|
||||
cocos2d::Sprite* arg0 = nullptr;
|
||||
do {
|
||||
@@ -3708,8 +3721,9 @@ bool js_cocos2dx_extension_ControlSlider_create(JSContext *cx, uint32_t argc, js
|
||||
arg0 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::Sprite* arg1 = nullptr;
|
||||
ok = true;
|
||||
do {
|
||||
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
||||
if (!args.get(1).isObject()) { ok = false; break; }
|
||||
@@ -3719,8 +3733,9 @@ bool js_cocos2dx_extension_ControlSlider_create(JSContext *cx, uint32_t argc, js
|
||||
arg1 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::Sprite* arg2 = nullptr;
|
||||
ok = true;
|
||||
do {
|
||||
if (args.get(2).isNull()) { arg2 = nullptr; break; }
|
||||
if (!args.get(2).isObject()) { ok = false; break; }
|
||||
@@ -3730,7 +3745,7 @@ bool js_cocos2dx_extension_ControlSlider_create(JSContext *cx, uint32_t argc, js
|
||||
arg2 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::extension::ControlSlider* ret = cocos2d::extension::ControlSlider::create(arg0, arg1, arg2);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
do {
|
||||
@@ -3747,16 +3762,19 @@ bool js_cocos2dx_extension_ControlSlider_create(JSContext *cx, uint32_t argc, js
|
||||
} while (0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 3) {
|
||||
const char* arg0 = nullptr;
|
||||
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
const char* arg1 = nullptr;
|
||||
ok = true;
|
||||
std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str();
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
const char* arg2 = nullptr;
|
||||
ok = true;
|
||||
std::string arg2_tmp; ok &= jsval_to_std_string(cx, args.get(2), &arg2_tmp); arg2 = arg2_tmp.c_str();
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::extension::ControlSlider* ret = cocos2d::extension::ControlSlider::create(arg0, arg1, arg2);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
do {
|
||||
@@ -3773,19 +3791,23 @@ bool js_cocos2dx_extension_ControlSlider_create(JSContext *cx, uint32_t argc, js
|
||||
} while (0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 4) {
|
||||
const char* arg0 = nullptr;
|
||||
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
const char* arg1 = nullptr;
|
||||
ok = true;
|
||||
std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str();
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
const char* arg2 = nullptr;
|
||||
ok = true;
|
||||
std::string arg2_tmp; ok &= jsval_to_std_string(cx, args.get(2), &arg2_tmp); arg2 = arg2_tmp.c_str();
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
const char* arg3 = nullptr;
|
||||
ok = true;
|
||||
std::string arg3_tmp; ok &= jsval_to_std_string(cx, args.get(3), &arg3_tmp); arg3 = arg3_tmp.c_str();
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::extension::ControlSlider* ret = cocos2d::extension::ControlSlider::create(arg0, arg1, arg2, arg3);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
do {
|
||||
@@ -3802,6 +3824,7 @@ bool js_cocos2dx_extension_ControlSlider_create(JSContext *cx, uint32_t argc, js
|
||||
} while (0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 4) {
|
||||
cocos2d::Sprite* arg0 = nullptr;
|
||||
do {
|
||||
@@ -3813,8 +3836,9 @@ bool js_cocos2dx_extension_ControlSlider_create(JSContext *cx, uint32_t argc, js
|
||||
arg0 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::Sprite* arg1 = nullptr;
|
||||
ok = true;
|
||||
do {
|
||||
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
||||
if (!args.get(1).isObject()) { ok = false; break; }
|
||||
@@ -3824,8 +3848,9 @@ bool js_cocos2dx_extension_ControlSlider_create(JSContext *cx, uint32_t argc, js
|
||||
arg1 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::Sprite* arg2 = nullptr;
|
||||
ok = true;
|
||||
do {
|
||||
if (args.get(2).isNull()) { arg2 = nullptr; break; }
|
||||
if (!args.get(2).isObject()) { ok = false; break; }
|
||||
@@ -3835,8 +3860,9 @@ bool js_cocos2dx_extension_ControlSlider_create(JSContext *cx, uint32_t argc, js
|
||||
arg2 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::Sprite* arg3 = nullptr;
|
||||
ok = true;
|
||||
do {
|
||||
if (args.get(3).isNull()) { arg3 = nullptr; break; }
|
||||
if (!args.get(3).isObject()) { ok = false; break; }
|
||||
@@ -3846,7 +3872,7 @@ bool js_cocos2dx_extension_ControlSlider_create(JSContext *cx, uint32_t argc, js
|
||||
arg3 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg3, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::extension::ControlSlider* ret = cocos2d::extension::ControlSlider::create(arg0, arg1, arg2, arg3);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
do {
|
||||
@@ -4602,7 +4628,6 @@ JSObject *jsb_cocos2d_extension_ControlSwitch_prototype;
|
||||
|
||||
bool js_cocos2dx_extension_ControlSwitch_setOn(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
bool ok = true;
|
||||
cocos2d::extension::ControlSwitch* cobj = nullptr;
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -4612,6 +4637,7 @@ bool js_cocos2dx_extension_ControlSwitch_setOn(JSContext *cx, uint32_t argc, jsv
|
||||
cobj = (cocos2d::extension::ControlSwitch *)(proxy ? proxy->ptr : nullptr);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlSwitch_setOn : Invalid Native Object");
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
bool arg0;
|
||||
arg0 = JS::ToBoolean(args.get(0));
|
||||
@@ -4622,6 +4648,7 @@ bool js_cocos2dx_extension_ControlSwitch_setOn(JSContext *cx, uint32_t argc, jsv
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 2) {
|
||||
bool arg0;
|
||||
arg0 = JS::ToBoolean(args.get(0));
|
||||
@@ -4686,7 +4713,6 @@ bool js_cocos2dx_extension_ControlSwitch_isOn(JSContext *cx, uint32_t argc, jsva
|
||||
}
|
||||
bool js_cocos2dx_extension_ControlSwitch_initWithMaskSprite(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
bool ok = true;
|
||||
cocos2d::extension::ControlSwitch* cobj = nullptr;
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -4696,6 +4722,7 @@ bool js_cocos2dx_extension_ControlSwitch_initWithMaskSprite(JSContext *cx, uint3
|
||||
cobj = (cocos2d::extension::ControlSwitch *)(proxy ? proxy->ptr : nullptr);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlSwitch_initWithMaskSprite : Invalid Native Object");
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 6) {
|
||||
cocos2d::Sprite* arg0 = nullptr;
|
||||
do {
|
||||
@@ -4707,8 +4734,9 @@ bool js_cocos2dx_extension_ControlSwitch_initWithMaskSprite(JSContext *cx, uint3
|
||||
arg0 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::Sprite* arg1 = nullptr;
|
||||
ok = true;
|
||||
do {
|
||||
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
||||
if (!args.get(1).isObject()) { ok = false; break; }
|
||||
@@ -4718,8 +4746,9 @@ bool js_cocos2dx_extension_ControlSwitch_initWithMaskSprite(JSContext *cx, uint3
|
||||
arg1 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::Sprite* arg2 = nullptr;
|
||||
ok = true;
|
||||
do {
|
||||
if (args.get(2).isNull()) { arg2 = nullptr; break; }
|
||||
if (!args.get(2).isObject()) { ok = false; break; }
|
||||
@@ -4729,8 +4758,9 @@ bool js_cocos2dx_extension_ControlSwitch_initWithMaskSprite(JSContext *cx, uint3
|
||||
arg2 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::Sprite* arg3 = nullptr;
|
||||
ok = true;
|
||||
do {
|
||||
if (args.get(3).isNull()) { arg3 = nullptr; break; }
|
||||
if (!args.get(3).isObject()) { ok = false; break; }
|
||||
@@ -4740,8 +4770,9 @@ bool js_cocos2dx_extension_ControlSwitch_initWithMaskSprite(JSContext *cx, uint3
|
||||
arg3 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg3, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::Label* arg4 = nullptr;
|
||||
ok = true;
|
||||
do {
|
||||
if (args.get(4).isNull()) { arg4 = nullptr; break; }
|
||||
if (!args.get(4).isObject()) { ok = false; break; }
|
||||
@@ -4751,8 +4782,9 @@ bool js_cocos2dx_extension_ControlSwitch_initWithMaskSprite(JSContext *cx, uint3
|
||||
arg4 = (cocos2d::Label*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg4, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::Label* arg5 = nullptr;
|
||||
ok = true;
|
||||
do {
|
||||
if (args.get(5).isNull()) { arg5 = nullptr; break; }
|
||||
if (!args.get(5).isObject()) { ok = false; break; }
|
||||
@@ -4762,7 +4794,7 @@ bool js_cocos2dx_extension_ControlSwitch_initWithMaskSprite(JSContext *cx, uint3
|
||||
arg5 = (cocos2d::Label*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg5, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
bool ret = cobj->initWithMaskSprite(arg0, arg1, arg2, arg3, arg4, arg5);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = BOOLEAN_TO_JSVAL(ret);
|
||||
@@ -4772,6 +4804,7 @@ bool js_cocos2dx_extension_ControlSwitch_initWithMaskSprite(JSContext *cx, uint3
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 4) {
|
||||
cocos2d::Sprite* arg0 = nullptr;
|
||||
do {
|
||||
@@ -4783,8 +4816,9 @@ bool js_cocos2dx_extension_ControlSwitch_initWithMaskSprite(JSContext *cx, uint3
|
||||
arg0 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::Sprite* arg1 = nullptr;
|
||||
ok = true;
|
||||
do {
|
||||
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
||||
if (!args.get(1).isObject()) { ok = false; break; }
|
||||
@@ -4794,8 +4828,9 @@ bool js_cocos2dx_extension_ControlSwitch_initWithMaskSprite(JSContext *cx, uint3
|
||||
arg1 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::Sprite* arg2 = nullptr;
|
||||
ok = true;
|
||||
do {
|
||||
if (args.get(2).isNull()) { arg2 = nullptr; break; }
|
||||
if (!args.get(2).isObject()) { ok = false; break; }
|
||||
@@ -4805,8 +4840,9 @@ bool js_cocos2dx_extension_ControlSwitch_initWithMaskSprite(JSContext *cx, uint3
|
||||
arg2 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::Sprite* arg3 = nullptr;
|
||||
ok = true;
|
||||
do {
|
||||
if (args.get(3).isNull()) { arg3 = nullptr; break; }
|
||||
if (!args.get(3).isObject()) { ok = false; break; }
|
||||
@@ -4816,7 +4852,7 @@ bool js_cocos2dx_extension_ControlSwitch_initWithMaskSprite(JSContext *cx, uint3
|
||||
arg3 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg3, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
bool ret = cobj->initWithMaskSprite(arg0, arg1, arg2, arg3);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = BOOLEAN_TO_JSVAL(ret);
|
||||
@@ -4849,9 +4885,9 @@ bool js_cocos2dx_extension_ControlSwitch_hasMoved(JSContext *cx, uint32_t argc,
|
||||
bool js_cocos2dx_extension_ControlSwitch_create(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 4) {
|
||||
cocos2d::Sprite* arg0 = nullptr;
|
||||
do {
|
||||
@@ -4863,8 +4899,9 @@ bool js_cocos2dx_extension_ControlSwitch_create(JSContext *cx, uint32_t argc, js
|
||||
arg0 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::Sprite* arg1 = nullptr;
|
||||
ok = true;
|
||||
do {
|
||||
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
||||
if (!args.get(1).isObject()) { ok = false; break; }
|
||||
@@ -4874,8 +4911,9 @@ bool js_cocos2dx_extension_ControlSwitch_create(JSContext *cx, uint32_t argc, js
|
||||
arg1 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::Sprite* arg2 = nullptr;
|
||||
ok = true;
|
||||
do {
|
||||
if (args.get(2).isNull()) { arg2 = nullptr; break; }
|
||||
if (!args.get(2).isObject()) { ok = false; break; }
|
||||
@@ -4885,8 +4923,9 @@ bool js_cocos2dx_extension_ControlSwitch_create(JSContext *cx, uint32_t argc, js
|
||||
arg2 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::Sprite* arg3 = nullptr;
|
||||
ok = true;
|
||||
do {
|
||||
if (args.get(3).isNull()) { arg3 = nullptr; break; }
|
||||
if (!args.get(3).isObject()) { ok = false; break; }
|
||||
@@ -4896,7 +4935,7 @@ bool js_cocos2dx_extension_ControlSwitch_create(JSContext *cx, uint32_t argc, js
|
||||
arg3 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg3, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::extension::ControlSwitch* ret = cocos2d::extension::ControlSwitch::create(arg0, arg1, arg2, arg3);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
do {
|
||||
@@ -4913,6 +4952,7 @@ bool js_cocos2dx_extension_ControlSwitch_create(JSContext *cx, uint32_t argc, js
|
||||
} while (0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 6) {
|
||||
cocos2d::Sprite* arg0 = nullptr;
|
||||
do {
|
||||
@@ -4924,8 +4964,9 @@ bool js_cocos2dx_extension_ControlSwitch_create(JSContext *cx, uint32_t argc, js
|
||||
arg0 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::Sprite* arg1 = nullptr;
|
||||
ok = true;
|
||||
do {
|
||||
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
||||
if (!args.get(1).isObject()) { ok = false; break; }
|
||||
@@ -4935,8 +4976,9 @@ bool js_cocos2dx_extension_ControlSwitch_create(JSContext *cx, uint32_t argc, js
|
||||
arg1 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::Sprite* arg2 = nullptr;
|
||||
ok = true;
|
||||
do {
|
||||
if (args.get(2).isNull()) { arg2 = nullptr; break; }
|
||||
if (!args.get(2).isObject()) { ok = false; break; }
|
||||
@@ -4946,8 +4988,9 @@ bool js_cocos2dx_extension_ControlSwitch_create(JSContext *cx, uint32_t argc, js
|
||||
arg2 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::Sprite* arg3 = nullptr;
|
||||
ok = true;
|
||||
do {
|
||||
if (args.get(3).isNull()) { arg3 = nullptr; break; }
|
||||
if (!args.get(3).isObject()) { ok = false; break; }
|
||||
@@ -4957,8 +5000,9 @@ bool js_cocos2dx_extension_ControlSwitch_create(JSContext *cx, uint32_t argc, js
|
||||
arg3 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg3, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::Label* arg4 = nullptr;
|
||||
ok = true;
|
||||
do {
|
||||
if (args.get(4).isNull()) { arg4 = nullptr; break; }
|
||||
if (!args.get(4).isObject()) { ok = false; break; }
|
||||
@@ -4968,8 +5012,9 @@ bool js_cocos2dx_extension_ControlSwitch_create(JSContext *cx, uint32_t argc, js
|
||||
arg4 = (cocos2d::Label*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg4, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::Label* arg5 = nullptr;
|
||||
ok = true;
|
||||
do {
|
||||
if (args.get(5).isNull()) { arg5 = nullptr; break; }
|
||||
if (!args.get(5).isObject()) { ok = false; break; }
|
||||
@@ -4979,7 +5024,7 @@ bool js_cocos2dx_extension_ControlSwitch_create(JSContext *cx, uint32_t argc, js
|
||||
arg5 = (cocos2d::Label*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg5, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::extension::ControlSwitch* ret = cocos2d::extension::ControlSwitch::create(arg0, arg1, arg2, arg3, arg4, arg5);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
do {
|
||||
@@ -5755,7 +5800,6 @@ bool js_cocos2dx_extension_ScrollView_minContainerOffset(JSContext *cx, uint32_t
|
||||
}
|
||||
bool js_cocos2dx_extension_ScrollView_setZoomScale(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
bool ok = true;
|
||||
cocos2d::extension::ScrollView* cobj = nullptr;
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -5765,10 +5809,11 @@ bool js_cocos2dx_extension_ScrollView_setZoomScale(JSContext *cx, uint32_t argc,
|
||||
cobj = (cocos2d::extension::ScrollView *)(proxy ? proxy->ptr : nullptr);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ScrollView_setZoomScale : Invalid Native Object");
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 2) {
|
||||
double arg0 = 0;
|
||||
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
bool arg1;
|
||||
arg1 = JS::ToBoolean(args.get(1));
|
||||
cobj->setZoomScale(arg0, arg1);
|
||||
@@ -5778,10 +5823,11 @@ bool js_cocos2dx_extension_ScrollView_setZoomScale(JSContext *cx, uint32_t argc,
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
double arg0 = 0;
|
||||
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cobj->setZoomScale(arg0);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
@@ -5794,7 +5840,6 @@ bool js_cocos2dx_extension_ScrollView_setZoomScale(JSContext *cx, uint32_t argc,
|
||||
bool js_cocos2dx_extension_ScrollView_create(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
|
||||
do {
|
||||
if (argc == 0) {
|
||||
@@ -5814,11 +5859,13 @@ bool js_cocos2dx_extension_ScrollView_create(JSContext *cx, uint32_t argc, jsval
|
||||
} while (0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 2) {
|
||||
cocos2d::Size arg0;
|
||||
ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::Node* arg1 = nullptr;
|
||||
ok = true;
|
||||
do {
|
||||
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
||||
if (!args.get(1).isObject()) { ok = false; break; }
|
||||
@@ -5828,7 +5875,7 @@ bool js_cocos2dx_extension_ScrollView_create(JSContext *cx, uint32_t argc, jsval
|
||||
arg1 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::extension::ScrollView* ret = cocos2d::extension::ScrollView::create(arg0, arg1);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
do {
|
||||
|
||||
@@ -85,7 +85,6 @@ bool js_cocos2dx_spine_SkeletonRenderer_getDebugSlotsEnabled(JSContext *cx, uint
|
||||
}
|
||||
bool js_cocos2dx_spine_SkeletonRenderer_setAttachment(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
bool ok = true;
|
||||
spine::SkeletonRenderer* cobj = nullptr;
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -95,13 +94,15 @@ bool js_cocos2dx_spine_SkeletonRenderer_setAttachment(JSContext *cx, uint32_t ar
|
||||
cobj = (spine::SkeletonRenderer *)(proxy ? proxy->ptr : nullptr);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonRenderer_setAttachment : Invalid Native Object");
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 2) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
const char* arg1 = nullptr;
|
||||
ok = true;
|
||||
std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str();
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
bool ret = cobj->setAttachment(arg0, arg1);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = BOOLEAN_TO_JSVAL(ret);
|
||||
@@ -111,13 +112,15 @@ bool js_cocos2dx_spine_SkeletonRenderer_setAttachment(JSContext *cx, uint32_t ar
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 2) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
std::string arg1;
|
||||
ok = true;
|
||||
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
bool ret = cobj->setAttachment(arg0, arg1);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = BOOLEAN_TO_JSVAL(ret);
|
||||
@@ -145,38 +148,6 @@ bool js_cocos2dx_spine_SkeletonRenderer_setBonesToSetupPose(JSContext *cx, uint3
|
||||
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonRenderer_setBonesToSetupPose : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_spine_SkeletonRenderer_initWithData(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonRenderer_initWithData : Invalid Native Object");
|
||||
if (argc == 1) {
|
||||
spSkeletonData* arg0 = nullptr;
|
||||
#pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData*
|
||||
ok = false;
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_spine_SkeletonRenderer_initWithData : Error processing arguments");
|
||||
cobj->initWithData(arg0);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
if (argc == 2) {
|
||||
spSkeletonData* arg0 = nullptr;
|
||||
bool arg1;
|
||||
#pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData*
|
||||
ok = false;
|
||||
arg1 = JS::ToBoolean(args.get(1));
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_spine_SkeletonRenderer_initWithData : Error processing arguments");
|
||||
cobj->initWithData(arg0, arg1);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonRenderer_initWithData : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_spine_SkeletonRenderer_setDebugSlotsEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -359,7 +330,6 @@ bool js_cocos2dx_spine_SkeletonRenderer_getTimeScale(JSContext *cx, uint32_t arg
|
||||
}
|
||||
bool js_cocos2dx_spine_SkeletonRenderer_initWithFile(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
bool ok = true;
|
||||
spine::SkeletonRenderer* cobj = nullptr;
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -369,13 +339,15 @@ bool js_cocos2dx_spine_SkeletonRenderer_initWithFile(JSContext *cx, uint32_t arg
|
||||
cobj = (spine::SkeletonRenderer *)(proxy ? proxy->ptr : nullptr);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonRenderer_initWithFile : Invalid Native Object");
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 2) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
std::string arg1;
|
||||
ok = true;
|
||||
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cobj->initWithFile(arg0, arg1);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
@@ -383,16 +355,19 @@ bool js_cocos2dx_spine_SkeletonRenderer_initWithFile(JSContext *cx, uint32_t arg
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 3) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
std::string arg1;
|
||||
ok = true;
|
||||
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
double arg2 = 0;
|
||||
ok = true;
|
||||
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cobj->initWithFile(arg0, arg1, arg2);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
@@ -400,14 +375,16 @@ bool js_cocos2dx_spine_SkeletonRenderer_initWithFile(JSContext *cx, uint32_t arg
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 2) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
spAtlas* arg1 = nullptr;
|
||||
ok = true;
|
||||
#pragma warning NO CONVERSION TO NATIVE FOR spAtlas*
|
||||
ok = false;
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cobj->initWithFile(arg0, arg1);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
@@ -415,17 +392,20 @@ bool js_cocos2dx_spine_SkeletonRenderer_initWithFile(JSContext *cx, uint32_t arg
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 3) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
spAtlas* arg1 = nullptr;
|
||||
ok = true;
|
||||
#pragma warning NO CONVERSION TO NATIVE FOR spAtlas*
|
||||
ok = false;
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
double arg2 = 0;
|
||||
ok = true;
|
||||
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cobj->initWithFile(arg0, arg1, arg2);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
@@ -457,7 +437,6 @@ bool js_cocos2dx_spine_SkeletonRenderer_setBlendFunc(JSContext *cx, uint32_t arg
|
||||
}
|
||||
bool js_cocos2dx_spine_SkeletonRenderer_setSkin(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
bool ok = true;
|
||||
spine::SkeletonRenderer* cobj = nullptr;
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -467,10 +446,11 @@ bool js_cocos2dx_spine_SkeletonRenderer_setSkin(JSContext *cx, uint32_t argc, js
|
||||
cobj = (spine::SkeletonRenderer *)(proxy ? proxy->ptr : nullptr);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonRenderer_setSkin : Invalid Native Object");
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
const char* arg0 = nullptr;
|
||||
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
bool ret = cobj->setSkin(arg0);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = BOOLEAN_TO_JSVAL(ret);
|
||||
@@ -480,10 +460,11 @@ bool js_cocos2dx_spine_SkeletonRenderer_setSkin(JSContext *cx, uint32_t argc, js
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
bool ret = cobj->setSkin(arg0);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = BOOLEAN_TO_JSVAL(ret);
|
||||
@@ -516,16 +497,17 @@ bool js_cocos2dx_spine_SkeletonRenderer_getSkeleton(JSContext *cx, uint32_t argc
|
||||
bool js_cocos2dx_spine_SkeletonRenderer_createWithFile(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 2) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
std::string arg1;
|
||||
ok = true;
|
||||
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
spine::SkeletonRenderer* ret = spine::SkeletonRenderer::createWithFile(arg0, arg1);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
do {
|
||||
@@ -541,16 +523,19 @@ bool js_cocos2dx_spine_SkeletonRenderer_createWithFile(JSContext *cx, uint32_t a
|
||||
}
|
||||
} while (0);
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 3) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
std::string arg1;
|
||||
ok = true;
|
||||
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
double arg2 = 0;
|
||||
ok = true;
|
||||
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
spine::SkeletonRenderer* ret = spine::SkeletonRenderer::createWithFile(arg0, arg1, arg2);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
do {
|
||||
@@ -567,14 +552,16 @@ bool js_cocos2dx_spine_SkeletonRenderer_createWithFile(JSContext *cx, uint32_t a
|
||||
} while (0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 2) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
spAtlas* arg1 = nullptr;
|
||||
ok = true;
|
||||
#pragma warning NO CONVERSION TO NATIVE FOR spAtlas*
|
||||
ok = false;
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
spine::SkeletonRenderer* ret = spine::SkeletonRenderer::createWithFile(arg0, arg1);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
do {
|
||||
@@ -590,17 +577,20 @@ bool js_cocos2dx_spine_SkeletonRenderer_createWithFile(JSContext *cx, uint32_t a
|
||||
}
|
||||
} while (0);
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 3) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
spAtlas* arg1 = nullptr;
|
||||
ok = true;
|
||||
#pragma warning NO CONVERSION TO NATIVE FOR spAtlas*
|
||||
ok = false;
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
double arg2 = 0;
|
||||
ok = true;
|
||||
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
spine::SkeletonRenderer* ret = spine::SkeletonRenderer::createWithFile(arg0, arg1, arg2);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
do {
|
||||
@@ -626,11 +616,12 @@ bool js_cocos2dx_spine_SkeletonRenderer_constructor(JSContext *cx, uint32_t argc
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx);
|
||||
do {
|
||||
ok = true;
|
||||
if (argc == 1) {
|
||||
spSkeletonData* arg0 = nullptr;
|
||||
#pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData*
|
||||
ok = false;
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cobj = new (std::nothrow) spine::SkeletonRenderer(arg0);
|
||||
cocos2d::Ref *_ccobj = dynamic_cast<cocos2d::Ref *>(cobj);
|
||||
if (_ccobj) {
|
||||
@@ -655,11 +646,12 @@ bool js_cocos2dx_spine_SkeletonRenderer_constructor(JSContext *cx, uint32_t argc
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
ok = true;
|
||||
if (argc == 2) {
|
||||
spSkeletonData* arg0 = nullptr;
|
||||
#pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData*
|
||||
ok = false;
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
bool arg1;
|
||||
arg1 = JS::ToBoolean(args.get(1));
|
||||
cobj = new (std::nothrow) spine::SkeletonRenderer(arg0, arg1);
|
||||
@@ -686,6 +678,7 @@ bool js_cocos2dx_spine_SkeletonRenderer_constructor(JSContext *cx, uint32_t argc
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
ok = true;
|
||||
if (argc == 0) {
|
||||
cobj = new (std::nothrow) spine::SkeletonRenderer();
|
||||
cocos2d::Ref *_ccobj = dynamic_cast<cocos2d::Ref *>(cobj);
|
||||
@@ -711,14 +704,16 @@ bool js_cocos2dx_spine_SkeletonRenderer_constructor(JSContext *cx, uint32_t argc
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
ok = true;
|
||||
if (argc == 2) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
spAtlas* arg1 = nullptr;
|
||||
ok = true;
|
||||
#pragma warning NO CONVERSION TO NATIVE FOR spAtlas*
|
||||
ok = false;
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cobj = new (std::nothrow) spine::SkeletonRenderer(arg0, arg1);
|
||||
cocos2d::Ref *_ccobj = dynamic_cast<cocos2d::Ref *>(cobj);
|
||||
if (_ccobj) {
|
||||
@@ -743,17 +738,20 @@ bool js_cocos2dx_spine_SkeletonRenderer_constructor(JSContext *cx, uint32_t argc
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
ok = true;
|
||||
if (argc == 3) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
spAtlas* arg1 = nullptr;
|
||||
ok = true;
|
||||
#pragma warning NO CONVERSION TO NATIVE FOR spAtlas*
|
||||
ok = false;
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
double arg2 = 0;
|
||||
ok = true;
|
||||
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cobj = new (std::nothrow) spine::SkeletonRenderer(arg0, arg1, arg2);
|
||||
cocos2d::Ref *_ccobj = dynamic_cast<cocos2d::Ref *>(cobj);
|
||||
if (_ccobj) {
|
||||
@@ -778,13 +776,15 @@ bool js_cocos2dx_spine_SkeletonRenderer_constructor(JSContext *cx, uint32_t argc
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
ok = true;
|
||||
if (argc == 2) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
std::string arg1;
|
||||
ok = true;
|
||||
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cobj = new (std::nothrow) spine::SkeletonRenderer(arg0, arg1);
|
||||
cocos2d::Ref *_ccobj = dynamic_cast<cocos2d::Ref *>(cobj);
|
||||
if (_ccobj) {
|
||||
@@ -809,16 +809,19 @@ bool js_cocos2dx_spine_SkeletonRenderer_constructor(JSContext *cx, uint32_t argc
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
ok = true;
|
||||
if (argc == 3) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
std::string arg1;
|
||||
ok = true;
|
||||
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
double arg2 = 0;
|
||||
ok = true;
|
||||
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cobj = new (std::nothrow) spine::SkeletonRenderer(arg0, arg1, arg2);
|
||||
cocos2d::Ref *_ccobj = dynamic_cast<cocos2d::Ref *>(cobj);
|
||||
if (_ccobj) {
|
||||
@@ -882,7 +885,6 @@ void js_register_cocos2dx_spine_SkeletonRenderer(JSContext *cx, JS::HandleObject
|
||||
JS_FN("getDebugSlotsEnabled", js_cocos2dx_spine_SkeletonRenderer_getDebugSlotsEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setAttachment", js_cocos2dx_spine_SkeletonRenderer_setAttachment, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setBonesToSetupPose", js_cocos2dx_spine_SkeletonRenderer_setBonesToSetupPose, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("initWithData", js_cocos2dx_spine_SkeletonRenderer_initWithData, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setDebugSlotsEnabled", js_cocos2dx_spine_SkeletonRenderer_setDebugSlotsEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setSlotsToSetupPose", js_cocos2dx_spine_SkeletonRenderer_setSlotsToSetupPose, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setToSetupPose", js_cocos2dx_spine_SkeletonRenderer_setToSetupPose, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
@@ -1029,124 +1031,6 @@ bool js_cocos2dx_spine_SkeletonAnimation_getState(JSContext *cx, uint32_t argc,
|
||||
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonAnimation_getState : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_spine_SkeletonAnimation_setTrackCompleteListener(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonAnimation_setTrackCompleteListener : Invalid Native Object");
|
||||
if (argc == 2) {
|
||||
spTrackEntry* arg0 = nullptr;
|
||||
std::function<void (int, int)> arg1;
|
||||
#pragma warning NO CONVERSION TO NATIVE FOR spTrackEntry*
|
||||
ok = false;
|
||||
do {
|
||||
if(JS_TypeOfValue(cx, args.get(1)) == JSTYPE_FUNCTION)
|
||||
{
|
||||
JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull());
|
||||
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, jstarget, args.get(1)));
|
||||
auto lambda = [=](int larg0, int larg1) -> void {
|
||||
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
||||
jsval largv[2];
|
||||
largv[0] = int32_to_jsval(cx, larg0);
|
||||
largv[1] = int32_to_jsval(cx, larg1);
|
||||
JS::RootedValue rval(cx);
|
||||
bool succeed = func->invoke(2, &largv[0], &rval);
|
||||
if (!succeed && JS_IsExceptionPending(cx)) {
|
||||
JS_ReportPendingException(cx);
|
||||
}
|
||||
};
|
||||
arg1 = lambda;
|
||||
}
|
||||
else
|
||||
{
|
||||
arg1 = nullptr;
|
||||
}
|
||||
} while(0)
|
||||
;
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_spine_SkeletonAnimation_setTrackCompleteListener : Error processing arguments");
|
||||
cobj->setTrackCompleteListener(arg0, arg1);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonAnimation_setTrackCompleteListener : wrong number of arguments: %d, was expecting %d", argc, 2);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_spine_SkeletonAnimation_onTrackEntryEvent(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonAnimation_onTrackEntryEvent : Invalid Native Object");
|
||||
if (argc == 4) {
|
||||
int arg0 = 0;
|
||||
spEventType arg1;
|
||||
spEvent* arg2 = nullptr;
|
||||
int arg3 = 0;
|
||||
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
||||
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
||||
#pragma warning NO CONVERSION TO NATIVE FOR spEvent*
|
||||
ok = false;
|
||||
ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3);
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_spine_SkeletonAnimation_onTrackEntryEvent : Error processing arguments");
|
||||
cobj->onTrackEntryEvent(arg0, arg1, arg2, arg3);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonAnimation_onTrackEntryEvent : wrong number of arguments: %d, was expecting %d", argc, 4);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_spine_SkeletonAnimation_setTrackStartListener(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonAnimation_setTrackStartListener : Invalid Native Object");
|
||||
if (argc == 2) {
|
||||
spTrackEntry* arg0 = nullptr;
|
||||
std::function<void (int)> arg1;
|
||||
#pragma warning NO CONVERSION TO NATIVE FOR spTrackEntry*
|
||||
ok = false;
|
||||
do {
|
||||
if(JS_TypeOfValue(cx, args.get(1)) == JSTYPE_FUNCTION)
|
||||
{
|
||||
JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull());
|
||||
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, jstarget, args.get(1)));
|
||||
auto lambda = [=](int larg0) -> void {
|
||||
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
||||
jsval largv[1];
|
||||
largv[0] = int32_to_jsval(cx, larg0);
|
||||
JS::RootedValue rval(cx);
|
||||
bool succeed = func->invoke(1, &largv[0], &rval);
|
||||
if (!succeed && JS_IsExceptionPending(cx)) {
|
||||
JS_ReportPendingException(cx);
|
||||
}
|
||||
};
|
||||
arg1 = lambda;
|
||||
}
|
||||
else
|
||||
{
|
||||
arg1 = nullptr;
|
||||
}
|
||||
} while(0)
|
||||
;
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_spine_SkeletonAnimation_setTrackStartListener : Error processing arguments");
|
||||
cobj->setTrackStartListener(arg0, arg1);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonAnimation_setTrackStartListener : wrong number of arguments: %d, was expecting %d", argc, 2);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_spine_SkeletonAnimation_update(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -1210,51 +1094,6 @@ bool js_cocos2dx_spine_SkeletonAnimation_setCompleteListener(JSContext *cx, uint
|
||||
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonAnimation_setCompleteListener : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_spine_SkeletonAnimation_setTrackEndListener(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonAnimation_setTrackEndListener : Invalid Native Object");
|
||||
if (argc == 2) {
|
||||
spTrackEntry* arg0 = nullptr;
|
||||
std::function<void (int)> arg1;
|
||||
#pragma warning NO CONVERSION TO NATIVE FOR spTrackEntry*
|
||||
ok = false;
|
||||
do {
|
||||
if(JS_TypeOfValue(cx, args.get(1)) == JSTYPE_FUNCTION)
|
||||
{
|
||||
JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull());
|
||||
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, jstarget, args.get(1)));
|
||||
auto lambda = [=](int larg0) -> void {
|
||||
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
||||
jsval largv[1];
|
||||
largv[0] = int32_to_jsval(cx, larg0);
|
||||
JS::RootedValue rval(cx);
|
||||
bool succeed = func->invoke(1, &largv[0], &rval);
|
||||
if (!succeed && JS_IsExceptionPending(cx)) {
|
||||
JS_ReportPendingException(cx);
|
||||
}
|
||||
};
|
||||
arg1 = lambda;
|
||||
}
|
||||
else
|
||||
{
|
||||
arg1 = nullptr;
|
||||
}
|
||||
} while(0)
|
||||
;
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_spine_SkeletonAnimation_setTrackEndListener : Error processing arguments");
|
||||
cobj->setTrackEndListener(arg0, arg1);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonAnimation_setTrackEndListener : wrong number of arguments: %d, was expecting %d", argc, 2);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_spine_SkeletonAnimation_setEventListener(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -1421,46 +1260,20 @@ bool js_cocos2dx_spine_SkeletonAnimation_clearTrack(JSContext *cx, uint32_t argc
|
||||
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonAnimation_clearTrack : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_spine_SkeletonAnimation_onAnimationStateEvent(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonAnimation_onAnimationStateEvent : Invalid Native Object");
|
||||
if (argc == 4) {
|
||||
int arg0 = 0;
|
||||
spEventType arg1;
|
||||
spEvent* arg2 = nullptr;
|
||||
int arg3 = 0;
|
||||
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
||||
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
||||
#pragma warning NO CONVERSION TO NATIVE FOR spEvent*
|
||||
ok = false;
|
||||
ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3);
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_spine_SkeletonAnimation_onAnimationStateEvent : Error processing arguments");
|
||||
cobj->onAnimationStateEvent(arg0, arg1, arg2, arg3);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonAnimation_onAnimationStateEvent : wrong number of arguments: %d, was expecting %d", argc, 4);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_spine_SkeletonAnimation_createWithFile(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 2) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
std::string arg1;
|
||||
ok = true;
|
||||
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
spine::SkeletonAnimation* ret = spine::SkeletonAnimation::createWithFile(arg0, arg1);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
do {
|
||||
@@ -1476,16 +1289,19 @@ bool js_cocos2dx_spine_SkeletonAnimation_createWithFile(JSContext *cx, uint32_t
|
||||
}
|
||||
} while (0);
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 3) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
std::string arg1;
|
||||
ok = true;
|
||||
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
double arg2 = 0;
|
||||
ok = true;
|
||||
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
spine::SkeletonAnimation* ret = spine::SkeletonAnimation::createWithFile(arg0, arg1, arg2);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
do {
|
||||
@@ -1502,14 +1318,16 @@ bool js_cocos2dx_spine_SkeletonAnimation_createWithFile(JSContext *cx, uint32_t
|
||||
} while (0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 2) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
spAtlas* arg1 = nullptr;
|
||||
ok = true;
|
||||
#pragma warning NO CONVERSION TO NATIVE FOR spAtlas*
|
||||
ok = false;
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
spine::SkeletonAnimation* ret = spine::SkeletonAnimation::createWithFile(arg0, arg1);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
do {
|
||||
@@ -1525,17 +1343,20 @@ bool js_cocos2dx_spine_SkeletonAnimation_createWithFile(JSContext *cx, uint32_t
|
||||
}
|
||||
} while (0);
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 3) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
spAtlas* arg1 = nullptr;
|
||||
ok = true;
|
||||
#pragma warning NO CONVERSION TO NATIVE FOR spAtlas*
|
||||
ok = false;
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
double arg2 = 0;
|
||||
ok = true;
|
||||
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
spine::SkeletonAnimation* ret = spine::SkeletonAnimation::createWithFile(arg0, arg1, arg2);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
do {
|
||||
@@ -1561,11 +1382,12 @@ bool js_cocos2dx_spine_SkeletonAnimation_constructor(JSContext *cx, uint32_t arg
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx);
|
||||
do {
|
||||
ok = true;
|
||||
if (argc == 1) {
|
||||
spSkeletonData* arg0 = nullptr;
|
||||
#pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData*
|
||||
ok = false;
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cobj = new (std::nothrow) spine::SkeletonAnimation(arg0);
|
||||
cocos2d::Ref *_ccobj = dynamic_cast<cocos2d::Ref *>(cobj);
|
||||
if (_ccobj) {
|
||||
@@ -1590,11 +1412,12 @@ bool js_cocos2dx_spine_SkeletonAnimation_constructor(JSContext *cx, uint32_t arg
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
ok = true;
|
||||
if (argc == 2) {
|
||||
spSkeletonData* arg0 = nullptr;
|
||||
#pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData*
|
||||
ok = false;
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
bool arg1;
|
||||
arg1 = JS::ToBoolean(args.get(1));
|
||||
cobj = new (std::nothrow) spine::SkeletonAnimation(arg0, arg1);
|
||||
@@ -1621,6 +1444,7 @@ bool js_cocos2dx_spine_SkeletonAnimation_constructor(JSContext *cx, uint32_t arg
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
ok = true;
|
||||
if (argc == 0) {
|
||||
cobj = new (std::nothrow) spine::SkeletonAnimation();
|
||||
cocos2d::Ref *_ccobj = dynamic_cast<cocos2d::Ref *>(cobj);
|
||||
@@ -1646,14 +1470,16 @@ bool js_cocos2dx_spine_SkeletonAnimation_constructor(JSContext *cx, uint32_t arg
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
ok = true;
|
||||
if (argc == 2) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
spAtlas* arg1 = nullptr;
|
||||
ok = true;
|
||||
#pragma warning NO CONVERSION TO NATIVE FOR spAtlas*
|
||||
ok = false;
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cobj = new (std::nothrow) spine::SkeletonAnimation(arg0, arg1);
|
||||
cocos2d::Ref *_ccobj = dynamic_cast<cocos2d::Ref *>(cobj);
|
||||
if (_ccobj) {
|
||||
@@ -1678,17 +1504,20 @@ bool js_cocos2dx_spine_SkeletonAnimation_constructor(JSContext *cx, uint32_t arg
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
ok = true;
|
||||
if (argc == 3) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
spAtlas* arg1 = nullptr;
|
||||
ok = true;
|
||||
#pragma warning NO CONVERSION TO NATIVE FOR spAtlas*
|
||||
ok = false;
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
double arg2 = 0;
|
||||
ok = true;
|
||||
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cobj = new (std::nothrow) spine::SkeletonAnimation(arg0, arg1, arg2);
|
||||
cocos2d::Ref *_ccobj = dynamic_cast<cocos2d::Ref *>(cobj);
|
||||
if (_ccobj) {
|
||||
@@ -1713,13 +1542,15 @@ bool js_cocos2dx_spine_SkeletonAnimation_constructor(JSContext *cx, uint32_t arg
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
ok = true;
|
||||
if (argc == 2) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
std::string arg1;
|
||||
ok = true;
|
||||
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cobj = new (std::nothrow) spine::SkeletonAnimation(arg0, arg1);
|
||||
cocos2d::Ref *_ccobj = dynamic_cast<cocos2d::Ref *>(cobj);
|
||||
if (_ccobj) {
|
||||
@@ -1744,16 +1575,19 @@ bool js_cocos2dx_spine_SkeletonAnimation_constructor(JSContext *cx, uint32_t arg
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
ok = true;
|
||||
if (argc == 3) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
std::string arg1;
|
||||
ok = true;
|
||||
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
double arg2 = 0;
|
||||
ok = true;
|
||||
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cobj = new (std::nothrow) spine::SkeletonAnimation(arg0, arg1, arg2);
|
||||
cocos2d::Ref *_ccobj = dynamic_cast<cocos2d::Ref *>(cobj);
|
||||
if (_ccobj) {
|
||||
@@ -1795,11 +1629,12 @@ bool js_cocos2dx_spine_SkeletonAnimation_ctor(JSContext *cx, uint32_t argc, jsva
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
do {
|
||||
ok = true;
|
||||
if (argc == 1) {
|
||||
spSkeletonData* arg0 = nullptr;
|
||||
#pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData*
|
||||
ok = false;
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cobj = new (std::nothrow) spine::SkeletonAnimation(arg0);
|
||||
cocos2d::Ref *_ccobj = dynamic_cast<cocos2d::Ref *>(cobj);
|
||||
if (_ccobj) {
|
||||
@@ -1813,11 +1648,12 @@ bool js_cocos2dx_spine_SkeletonAnimation_ctor(JSContext *cx, uint32_t argc, jsva
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
ok = true;
|
||||
if (argc == 2) {
|
||||
spSkeletonData* arg0 = nullptr;
|
||||
#pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData*
|
||||
ok = false;
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
bool arg1;
|
||||
arg1 = JS::ToBoolean(args.get(1));
|
||||
cobj = new (std::nothrow) spine::SkeletonAnimation(arg0, arg1);
|
||||
@@ -1833,6 +1669,7 @@ bool js_cocos2dx_spine_SkeletonAnimation_ctor(JSContext *cx, uint32_t argc, jsva
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
ok = true;
|
||||
if (argc == 0) {
|
||||
cobj = new (std::nothrow) spine::SkeletonAnimation();
|
||||
cocos2d::Ref *_ccobj = dynamic_cast<cocos2d::Ref *>(cobj);
|
||||
@@ -1847,14 +1684,16 @@ bool js_cocos2dx_spine_SkeletonAnimation_ctor(JSContext *cx, uint32_t argc, jsva
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
ok = true;
|
||||
if (argc == 2) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
spAtlas* arg1 = nullptr;
|
||||
ok = true;
|
||||
#pragma warning NO CONVERSION TO NATIVE FOR spAtlas*
|
||||
ok = false;
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cobj = new (std::nothrow) spine::SkeletonAnimation(arg0, arg1);
|
||||
cocos2d::Ref *_ccobj = dynamic_cast<cocos2d::Ref *>(cobj);
|
||||
if (_ccobj) {
|
||||
@@ -1868,17 +1707,20 @@ bool js_cocos2dx_spine_SkeletonAnimation_ctor(JSContext *cx, uint32_t argc, jsva
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
ok = true;
|
||||
if (argc == 3) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
spAtlas* arg1 = nullptr;
|
||||
ok = true;
|
||||
#pragma warning NO CONVERSION TO NATIVE FOR spAtlas*
|
||||
ok = false;
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
double arg2 = 0;
|
||||
ok = true;
|
||||
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cobj = new (std::nothrow) spine::SkeletonAnimation(arg0, arg1, arg2);
|
||||
cocos2d::Ref *_ccobj = dynamic_cast<cocos2d::Ref *>(cobj);
|
||||
if (_ccobj) {
|
||||
@@ -1892,13 +1734,15 @@ bool js_cocos2dx_spine_SkeletonAnimation_ctor(JSContext *cx, uint32_t argc, jsva
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
ok = true;
|
||||
if (argc == 2) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
std::string arg1;
|
||||
ok = true;
|
||||
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cobj = new (std::nothrow) spine::SkeletonAnimation(arg0, arg1);
|
||||
cocos2d::Ref *_ccobj = dynamic_cast<cocos2d::Ref *>(cobj);
|
||||
if (_ccobj) {
|
||||
@@ -1912,16 +1756,19 @@ bool js_cocos2dx_spine_SkeletonAnimation_ctor(JSContext *cx, uint32_t argc, jsva
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
ok = true;
|
||||
if (argc == 3) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
std::string arg1;
|
||||
ok = true;
|
||||
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
double arg2 = 0;
|
||||
ok = true;
|
||||
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cobj = new (std::nothrow) spine::SkeletonAnimation(arg0, arg1, arg2);
|
||||
cocos2d::Ref *_ccobj = dynamic_cast<cocos2d::Ref *>(cobj);
|
||||
if (_ccobj) {
|
||||
@@ -1974,19 +1821,14 @@ void js_register_cocos2dx_spine_SkeletonAnimation(JSContext *cx, JS::HandleObjec
|
||||
JS_FN("setStartListener", js_cocos2dx_spine_SkeletonAnimation_setStartListener, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setTrackEventListener", js_cocos2dx_spine_SkeletonAnimation_setTrackEventListener, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getState", js_cocos2dx_spine_SkeletonAnimation_getState, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setTrackCompleteListener", js_cocos2dx_spine_SkeletonAnimation_setTrackCompleteListener, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("onTrackEntryEvent", js_cocos2dx_spine_SkeletonAnimation_onTrackEntryEvent, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setTrackStartListener", js_cocos2dx_spine_SkeletonAnimation_setTrackStartListener, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("update", js_cocos2dx_spine_SkeletonAnimation_update, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setCompleteListener", js_cocos2dx_spine_SkeletonAnimation_setCompleteListener, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setTrackEndListener", js_cocos2dx_spine_SkeletonAnimation_setTrackEndListener, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setEventListener", js_cocos2dx_spine_SkeletonAnimation_setEventListener, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setMix", js_cocos2dx_spine_SkeletonAnimation_setMix, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setEndListener", js_cocos2dx_spine_SkeletonAnimation_setEndListener, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("initialize", js_cocos2dx_spine_SkeletonAnimation_initialize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("clearTracks", js_cocos2dx_spine_SkeletonAnimation_clearTracks, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("clearTrack", js_cocos2dx_spine_SkeletonAnimation_clearTrack, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("onAnimationStateEvent", js_cocos2dx_spine_SkeletonAnimation_onAnimationStateEvent, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("ctor", js_cocos2dx_spine_SkeletonAnimation_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FS_END
|
||||
};
|
||||
|
||||
@@ -16,7 +16,6 @@ bool js_cocos2dx_spine_SkeletonRenderer_setTimeScale(JSContext *cx, uint32_t arg
|
||||
bool js_cocos2dx_spine_SkeletonRenderer_getDebugSlotsEnabled(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_spine_SkeletonRenderer_setAttachment(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_spine_SkeletonRenderer_setBonesToSetupPose(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_spine_SkeletonRenderer_initWithData(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_spine_SkeletonRenderer_setDebugSlotsEnabled(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_spine_SkeletonRenderer_setSlotsToSetupPose(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_spine_SkeletonRenderer_setToSetupPose(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
@@ -44,19 +43,14 @@ void register_all_cocos2dx_spine(JSContext* cx, JS::HandleObject obj);
|
||||
bool js_cocos2dx_spine_SkeletonAnimation_setStartListener(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_spine_SkeletonAnimation_setTrackEventListener(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_spine_SkeletonAnimation_getState(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_spine_SkeletonAnimation_setTrackCompleteListener(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_spine_SkeletonAnimation_onTrackEntryEvent(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_spine_SkeletonAnimation_setTrackStartListener(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_spine_SkeletonAnimation_update(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_spine_SkeletonAnimation_setCompleteListener(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_spine_SkeletonAnimation_setTrackEndListener(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_spine_SkeletonAnimation_setEventListener(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_spine_SkeletonAnimation_setMix(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_spine_SkeletonAnimation_setEndListener(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_spine_SkeletonAnimation_initialize(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_spine_SkeletonAnimation_clearTracks(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_spine_SkeletonAnimation_clearTrack(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_spine_SkeletonAnimation_onAnimationStateEvent(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_spine_SkeletonAnimation_createWithFile(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_spine_SkeletonAnimation_SkeletonAnimation(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
|
||||
|
||||
@@ -176,7 +176,6 @@ bool js_cocos2dx_studio_ActionObject_stop(JSContext *cx, uint32_t argc, jsval *v
|
||||
}
|
||||
bool js_cocos2dx_studio_ActionObject_play(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
bool ok = true;
|
||||
cocostudio::ActionObject* cobj = nullptr;
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -186,6 +185,7 @@ bool js_cocos2dx_studio_ActionObject_play(JSContext *cx, uint32_t argc, jsval *v
|
||||
cobj = (cocostudio::ActionObject *)(proxy ? proxy->ptr : nullptr);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ActionObject_play : Invalid Native Object");
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
cocos2d::CallFunc* arg0 = nullptr;
|
||||
do {
|
||||
@@ -197,7 +197,7 @@ bool js_cocos2dx_studio_ActionObject_play(JSContext *cx, uint32_t argc, jsval *v
|
||||
arg0 = (cocos2d::CallFunc*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cobj->play(arg0);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
@@ -279,47 +279,6 @@ bool js_cocos2dx_studio_ActionObject_getLoop(JSContext *cx, uint32_t argc, jsval
|
||||
JS_ReportError(cx, "js_cocos2dx_studio_ActionObject_getLoop : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_studio_ActionObject_initWithBinary(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocostudio::ActionObject* cobj = (cocostudio::ActionObject *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ActionObject_initWithBinary : Invalid Native Object");
|
||||
if (argc == 3) {
|
||||
cocostudio::CocoLoader* arg0 = nullptr;
|
||||
cocostudio::stExpCocoNode* arg1 = nullptr;
|
||||
cocos2d::Ref* arg2 = nullptr;
|
||||
do {
|
||||
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
||||
if (!args.get(0).isObject()) { ok = false; break; }
|
||||
js_proxy_t *jsProxy;
|
||||
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
||||
jsProxy = jsb_get_js_proxy(tmpObj);
|
||||
arg0 = (cocostudio::CocoLoader*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
#pragma warning NO CONVERSION TO NATIVE FOR stExpCocoNode*
|
||||
ok = false;
|
||||
do {
|
||||
if (args.get(2).isNull()) { arg2 = nullptr; break; }
|
||||
if (!args.get(2).isObject()) { ok = false; break; }
|
||||
js_proxy_t *jsProxy;
|
||||
JS::RootedObject tmpObj(cx, args.get(2).toObjectOrNull());
|
||||
jsProxy = jsb_get_js_proxy(tmpObj);
|
||||
arg2 = (cocos2d::Ref*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ActionObject_initWithBinary : Error processing arguments");
|
||||
cobj->initWithBinary(arg0, arg1, arg2);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_studio_ActionObject_initWithBinary : wrong number of arguments: %d, was expecting %d", argc, 3);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_studio_ActionObject_addActionNode(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -505,7 +464,6 @@ void js_register_cocos2dx_studio_ActionObject(JSContext *cx, JS::HandleObject gl
|
||||
JS_FN("getCurrentTime", js_cocos2dx_studio_ActionObject_getCurrentTime, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("removeActionNode", js_cocos2dx_studio_ActionObject_removeActionNode, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getLoop", js_cocos2dx_studio_ActionObject_getLoop, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("initWithBinary", js_cocos2dx_studio_ActionObject_initWithBinary, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("addActionNode", js_cocos2dx_studio_ActionObject_addActionNode, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getUnitTime", js_cocos2dx_studio_ActionObject_getUnitTime, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("isPlaying", js_cocos2dx_studio_ActionObject_isPlaying, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
@@ -596,52 +554,8 @@ bool js_cocos2dx_studio_ActionManagerEx_getActionByName(JSContext *cx, uint32_t
|
||||
JS_ReportError(cx, "js_cocos2dx_studio_ActionManagerEx_getActionByName : wrong number of arguments: %d, was expecting %d", argc, 2);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_studio_ActionManagerEx_initWithBinary(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocostudio::ActionManagerEx* cobj = (cocostudio::ActionManagerEx *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ActionManagerEx_initWithBinary : Invalid Native Object");
|
||||
if (argc == 4) {
|
||||
const char* arg0 = nullptr;
|
||||
cocos2d::Ref* arg1 = nullptr;
|
||||
cocostudio::CocoLoader* arg2 = nullptr;
|
||||
cocostudio::stExpCocoNode* arg3 = nullptr;
|
||||
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
||||
do {
|
||||
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
||||
if (!args.get(1).isObject()) { ok = false; break; }
|
||||
js_proxy_t *jsProxy;
|
||||
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
||||
jsProxy = jsb_get_js_proxy(tmpObj);
|
||||
arg1 = (cocos2d::Ref*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
do {
|
||||
if (args.get(2).isNull()) { arg2 = nullptr; break; }
|
||||
if (!args.get(2).isObject()) { ok = false; break; }
|
||||
js_proxy_t *jsProxy;
|
||||
JS::RootedObject tmpObj(cx, args.get(2).toObjectOrNull());
|
||||
jsProxy = jsb_get_js_proxy(tmpObj);
|
||||
arg2 = (cocostudio::CocoLoader*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
#pragma warning NO CONVERSION TO NATIVE FOR stExpCocoNode*
|
||||
ok = false;
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_studio_ActionManagerEx_initWithBinary : Error processing arguments");
|
||||
cobj->initWithBinary(arg0, arg1, arg2, arg3);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_studio_ActionManagerEx_initWithBinary : wrong number of arguments: %d, was expecting %d", argc, 4);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_studio_ActionManagerEx_playActionByName(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
bool ok = true;
|
||||
cocostudio::ActionManagerEx* cobj = nullptr;
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -651,14 +565,17 @@ bool js_cocos2dx_studio_ActionManagerEx_playActionByName(JSContext *cx, uint32_t
|
||||
cobj = (cocostudio::ActionManagerEx *)(proxy ? proxy->ptr : nullptr);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ActionManagerEx_playActionByName : Invalid Native Object");
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 3) {
|
||||
const char* arg0 = nullptr;
|
||||
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
const char* arg1 = nullptr;
|
||||
ok = true;
|
||||
std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str();
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocos2d::CallFunc* arg2 = nullptr;
|
||||
ok = true;
|
||||
do {
|
||||
if (args.get(2).isNull()) { arg2 = nullptr; break; }
|
||||
if (!args.get(2).isObject()) { ok = false; break; }
|
||||
@@ -668,7 +585,7 @@ bool js_cocos2dx_studio_ActionManagerEx_playActionByName(JSContext *cx, uint32_t
|
||||
arg2 = (cocos2d::CallFunc*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocostudio::ActionObject* ret = cobj->playActionByName(arg0, arg1, arg2);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
do {
|
||||
@@ -685,13 +602,15 @@ bool js_cocos2dx_studio_ActionManagerEx_playActionByName(JSContext *cx, uint32_t
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 2) {
|
||||
const char* arg0 = nullptr;
|
||||
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
const char* arg1 = nullptr;
|
||||
ok = true;
|
||||
std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str();
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocostudio::ActionObject* ret = cobj->playActionByName(arg0, arg1);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
do {
|
||||
@@ -782,7 +701,6 @@ void js_register_cocos2dx_studio_ActionManagerEx(JSContext *cx, JS::HandleObject
|
||||
static JSFunctionSpec funcs[] = {
|
||||
JS_FN("stopActionByName", js_cocos2dx_studio_ActionManagerEx_stopActionByName, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getActionByName", js_cocos2dx_studio_ActionManagerEx_getActionByName, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("initWithBinary", js_cocos2dx_studio_ActionManagerEx_initWithBinary, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("playActionByName", js_cocos2dx_studio_ActionManagerEx_playActionByName, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("releaseActions", js_cocos2dx_studio_ActionManagerEx_releaseActions, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FS_END
|
||||
@@ -2433,7 +2351,6 @@ bool js_cocos2dx_studio_ColliderDetector_removeAll(JSContext *cx, uint32_t argc,
|
||||
}
|
||||
bool js_cocos2dx_studio_ColliderDetector_init(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
bool ok = true;
|
||||
cocostudio::ColliderDetector* cobj = nullptr;
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -2443,6 +2360,7 @@ bool js_cocos2dx_studio_ColliderDetector_init(JSContext *cx, uint32_t argc, jsva
|
||||
cobj = (cocostudio::ColliderDetector *)(proxy ? proxy->ptr : nullptr);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ColliderDetector_init : Invalid Native Object");
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
cocostudio::Bone* arg0 = nullptr;
|
||||
do {
|
||||
@@ -2454,7 +2372,7 @@ bool js_cocos2dx_studio_ColliderDetector_init(JSContext *cx, uint32_t argc, jsva
|
||||
arg0 = (cocostudio::Bone*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
bool ret = cobj->init(arg0);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = BOOLEAN_TO_JSVAL(ret);
|
||||
@@ -2527,9 +2445,9 @@ bool js_cocos2dx_studio_ColliderDetector_setBone(JSContext *cx, uint32_t argc, j
|
||||
bool js_cocos2dx_studio_ColliderDetector_create(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
cocostudio::Bone* arg0 = nullptr;
|
||||
do {
|
||||
@@ -2541,7 +2459,7 @@ bool js_cocos2dx_studio_ColliderDetector_create(JSContext *cx, uint32_t argc, js
|
||||
arg0 = (cocostudio::Bone*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocostudio::ColliderDetector* ret = cocostudio::ColliderDetector::create(arg0);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
do {
|
||||
@@ -3106,7 +3024,6 @@ bool js_cocos2dx_studio_DisplayManager_getBoundingBox(JSContext *cx, uint32_t ar
|
||||
}
|
||||
bool js_cocos2dx_studio_DisplayManager_addDisplay(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
bool ok = true;
|
||||
cocostudio::DisplayManager* cobj = nullptr;
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -3116,6 +3033,7 @@ bool js_cocos2dx_studio_DisplayManager_addDisplay(JSContext *cx, uint32_t argc,
|
||||
cobj = (cocostudio::DisplayManager *)(proxy ? proxy->ptr : nullptr);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_DisplayManager_addDisplay : Invalid Native Object");
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 2) {
|
||||
cocos2d::Node* arg0 = nullptr;
|
||||
do {
|
||||
@@ -3127,10 +3045,11 @@ bool js_cocos2dx_studio_DisplayManager_addDisplay(JSContext *cx, uint32_t argc,
|
||||
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
int arg1 = 0;
|
||||
ok = true;
|
||||
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cobj->addDisplay(arg0, arg1);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
@@ -3138,6 +3057,7 @@ bool js_cocos2dx_studio_DisplayManager_addDisplay(JSContext *cx, uint32_t argc,
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 2) {
|
||||
cocostudio::DisplayData* arg0 = nullptr;
|
||||
do {
|
||||
@@ -3149,10 +3069,11 @@ bool js_cocos2dx_studio_DisplayManager_addDisplay(JSContext *cx, uint32_t argc,
|
||||
arg0 = (cocostudio::DisplayData*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
int arg1 = 0;
|
||||
ok = true;
|
||||
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cobj->addDisplay(arg0, arg1);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
@@ -3164,7 +3085,6 @@ bool js_cocos2dx_studio_DisplayManager_addDisplay(JSContext *cx, uint32_t argc,
|
||||
}
|
||||
bool js_cocos2dx_studio_DisplayManager_containPoint(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
bool ok = true;
|
||||
cocostudio::DisplayManager* cobj = nullptr;
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -3174,13 +3094,15 @@ bool js_cocos2dx_studio_DisplayManager_containPoint(JSContext *cx, uint32_t argc
|
||||
cobj = (cocostudio::DisplayManager *)(proxy ? proxy->ptr : nullptr);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_DisplayManager_containPoint : Invalid Native Object");
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 2) {
|
||||
double arg0 = 0;
|
||||
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
double arg1 = 0;
|
||||
ok = true;
|
||||
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
bool ret = cobj->containPoint(arg0, arg1);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = BOOLEAN_TO_JSVAL(ret);
|
||||
@@ -3190,10 +3112,11 @@ bool js_cocos2dx_studio_DisplayManager_containPoint(JSContext *cx, uint32_t argc
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
cocos2d::Vec2 arg0;
|
||||
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
bool ret = cobj->containPoint(arg0);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = BOOLEAN_TO_JSVAL(ret);
|
||||
@@ -3917,7 +3840,6 @@ bool js_cocos2dx_studio_Bone_setParentBone(JSContext *cx, uint32_t argc, jsval *
|
||||
}
|
||||
bool js_cocos2dx_studio_Bone_addDisplay(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
bool ok = true;
|
||||
cocostudio::Bone* cobj = nullptr;
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -3927,6 +3849,7 @@ bool js_cocos2dx_studio_Bone_addDisplay(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
cobj = (cocostudio::Bone *)(proxy ? proxy->ptr : nullptr);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Bone_addDisplay : Invalid Native Object");
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 2) {
|
||||
cocos2d::Node* arg0 = nullptr;
|
||||
do {
|
||||
@@ -3938,10 +3861,11 @@ bool js_cocos2dx_studio_Bone_addDisplay(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
int arg1 = 0;
|
||||
ok = true;
|
||||
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cobj->addDisplay(arg0, arg1);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
@@ -3949,6 +3873,7 @@ bool js_cocos2dx_studio_Bone_addDisplay(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 2) {
|
||||
cocostudio::DisplayData* arg0 = nullptr;
|
||||
do {
|
||||
@@ -3960,10 +3885,11 @@ bool js_cocos2dx_studio_Bone_addDisplay(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
arg0 = (cocostudio::DisplayData*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
int arg1 = 0;
|
||||
ok = true;
|
||||
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cobj->addDisplay(arg0, arg1);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
@@ -4302,13 +4228,13 @@ bool js_cocos2dx_studio_Bone_getArmature(JSContext *cx, uint32_t argc, jsval *vp
|
||||
bool js_cocos2dx_studio_Bone_create(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocostudio::Bone* ret = cocostudio::Bone::create(arg0);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
do {
|
||||
@@ -5102,7 +5028,6 @@ bool js_cocos2dx_studio_ArmatureDataManager_addArmatureData(JSContext *cx, uint3
|
||||
}
|
||||
bool js_cocos2dx_studio_ArmatureDataManager_addArmatureFileInfo(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
bool ok = true;
|
||||
cocostudio::ArmatureDataManager* cobj = nullptr;
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -5112,16 +5037,19 @@ bool js_cocos2dx_studio_ArmatureDataManager_addArmatureFileInfo(JSContext *cx, u
|
||||
cobj = (cocostudio::ArmatureDataManager *)(proxy ? proxy->ptr : nullptr);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ArmatureDataManager_addArmatureFileInfo : Invalid Native Object");
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 3) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
std::string arg1;
|
||||
ok = true;
|
||||
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
std::string arg2;
|
||||
ok = true;
|
||||
ok &= jsval_to_std_string(cx, args.get(2), &arg2);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cobj->addArmatureFileInfo(arg0, arg1, arg2);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
@@ -5129,10 +5057,11 @@ bool js_cocos2dx_studio_ArmatureDataManager_addArmatureFileInfo(JSContext *cx, u
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cobj->addArmatureFileInfo(arg0);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
@@ -5809,7 +5738,6 @@ bool js_cocos2dx_studio_Armature_getBatchNode(JSContext *cx, uint32_t argc, jsva
|
||||
}
|
||||
bool js_cocos2dx_studio_Armature_init(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
bool ok = true;
|
||||
cocostudio::Armature* cobj = nullptr;
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -5819,11 +5747,13 @@ bool js_cocos2dx_studio_Armature_init(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
cobj = (cocostudio::Armature *)(proxy ? proxy->ptr : nullptr);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_Armature_init : Invalid Native Object");
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 2) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocostudio::Bone* arg1 = nullptr;
|
||||
ok = true;
|
||||
do {
|
||||
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
||||
if (!args.get(1).isObject()) { ok = false; break; }
|
||||
@@ -5833,7 +5763,7 @@ bool js_cocos2dx_studio_Armature_init(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
arg1 = (cocostudio::Bone*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
bool ret = cobj->init(arg0, arg1);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = BOOLEAN_TO_JSVAL(ret);
|
||||
@@ -5843,10 +5773,11 @@ bool js_cocos2dx_studio_Armature_init(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
bool ret = cobj->init(arg0);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = BOOLEAN_TO_JSVAL(ret);
|
||||
@@ -6082,13 +6013,13 @@ bool js_cocos2dx_studio_Armature_getBoneDic(JSContext *cx, uint32_t argc, jsval
|
||||
bool js_cocos2dx_studio_Armature_create(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocostudio::Armature* ret = cocostudio::Armature::create(arg0);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
do {
|
||||
@@ -6122,11 +6053,13 @@ bool js_cocos2dx_studio_Armature_create(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
} while (0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 2) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocostudio::Bone* arg1 = nullptr;
|
||||
ok = true;
|
||||
do {
|
||||
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
||||
if (!args.get(1).isObject()) { ok = false; break; }
|
||||
@@ -6136,7 +6069,7 @@ bool js_cocos2dx_studio_Armature_create(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
arg1 = (cocostudio::Bone*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocostudio::Armature* ret = cocostudio::Armature::create(arg0, arg1);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
do {
|
||||
@@ -6378,13 +6311,13 @@ bool js_cocos2dx_studio_Skin_setBone(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
bool js_cocos2dx_studio_Skin_create(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocostudio::Skin* ret = cocostudio::Skin::create(arg0);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
do {
|
||||
@@ -7008,7 +6941,6 @@ bool js_cocos2dx_studio_ComAudio_end(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
}
|
||||
bool js_cocos2dx_studio_ComAudio_stopBackgroundMusic(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
bool ok = true;
|
||||
cocostudio::ComAudio* cobj = nullptr;
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -7026,6 +6958,7 @@ bool js_cocos2dx_studio_ComAudio_stopBackgroundMusic(JSContext *cx, uint32_t arg
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
bool arg0;
|
||||
arg0 = JS::ToBoolean(args.get(0));
|
||||
@@ -7144,7 +7077,6 @@ bool js_cocos2dx_studio_ComAudio_preloadBackgroundMusic(JSContext *cx, uint32_t
|
||||
}
|
||||
bool js_cocos2dx_studio_ComAudio_playBackgroundMusic(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
bool ok = true;
|
||||
cocostudio::ComAudio* cobj = nullptr;
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -7154,10 +7086,11 @@ bool js_cocos2dx_studio_ComAudio_playBackgroundMusic(JSContext *cx, uint32_t arg
|
||||
cobj = (cocostudio::ComAudio *)(proxy ? proxy->ptr : nullptr);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ComAudio_playBackgroundMusic : Invalid Native Object");
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
const char* arg0 = nullptr;
|
||||
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cobj->playBackgroundMusic(arg0);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
@@ -7165,10 +7098,11 @@ bool js_cocos2dx_studio_ComAudio_playBackgroundMusic(JSContext *cx, uint32_t arg
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 2) {
|
||||
const char* arg0 = nullptr;
|
||||
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
bool arg1;
|
||||
arg1 = JS::ToBoolean(args.get(1));
|
||||
cobj->playBackgroundMusic(arg0, arg1);
|
||||
@@ -7190,7 +7124,6 @@ bool js_cocos2dx_studio_ComAudio_playBackgroundMusic(JSContext *cx, uint32_t arg
|
||||
}
|
||||
bool js_cocos2dx_studio_ComAudio_playEffect(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
bool ok = true;
|
||||
cocostudio::ComAudio* cobj = nullptr;
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -7200,10 +7133,11 @@ bool js_cocos2dx_studio_ComAudio_playEffect(JSContext *cx, uint32_t argc, jsval
|
||||
cobj = (cocostudio::ComAudio *)(proxy ? proxy->ptr : nullptr);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ComAudio_playEffect : Invalid Native Object");
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
const char* arg0 = nullptr;
|
||||
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
unsigned int ret = cobj->playEffect(arg0);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = uint32_to_jsval(cx, ret);
|
||||
@@ -7213,10 +7147,11 @@ bool js_cocos2dx_studio_ComAudio_playEffect(JSContext *cx, uint32_t argc, jsval
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 2) {
|
||||
const char* arg0 = nullptr;
|
||||
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
bool arg1;
|
||||
arg1 = JS::ToBoolean(args.get(1));
|
||||
unsigned int ret = cobj->playEffect(arg0, arg1);
|
||||
@@ -7971,9 +7906,9 @@ bool js_cocos2dx_studio_ComRender_getNode(JSContext *cx, uint32_t argc, jsval *v
|
||||
bool js_cocos2dx_studio_ComRender_create(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 2) {
|
||||
cocos2d::Node* arg0 = nullptr;
|
||||
do {
|
||||
@@ -7985,10 +7920,11 @@ bool js_cocos2dx_studio_ComRender_create(JSContext *cx, uint32_t argc, jsval *vp
|
||||
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
const char* arg1 = nullptr;
|
||||
ok = true;
|
||||
std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str();
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocostudio::ComRender* ret = cocostudio::ComRender::create(arg0, arg1);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
do {
|
||||
@@ -8031,6 +7967,7 @@ bool js_cocos2dx_studio_ComRender_constructor(JSContext *cx, uint32_t argc, jsva
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx);
|
||||
do {
|
||||
ok = true;
|
||||
if (argc == 2) {
|
||||
cocos2d::Node* arg0 = nullptr;
|
||||
do {
|
||||
@@ -8042,10 +7979,11 @@ bool js_cocos2dx_studio_ComRender_constructor(JSContext *cx, uint32_t argc, jsva
|
||||
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
const char* arg1 = nullptr;
|
||||
ok = true;
|
||||
std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str();
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cobj = new (std::nothrow) cocostudio::ComRender(arg0, arg1);
|
||||
cocos2d::Ref *_ccobj = dynamic_cast<cocos2d::Ref *>(cobj);
|
||||
if (_ccobj) {
|
||||
@@ -8070,6 +8008,7 @@ bool js_cocos2dx_studio_ComRender_constructor(JSContext *cx, uint32_t argc, jsva
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
ok = true;
|
||||
if (argc == 0) {
|
||||
cobj = new (std::nothrow) cocostudio::ComRender();
|
||||
cocos2d::Ref *_ccobj = dynamic_cast<cocos2d::Ref *>(cobj);
|
||||
@@ -11887,7 +11826,6 @@ bool js_cocos2dx_studio_ActionTimeline_removeFrameEndCallFuncs(JSContext *cx, ui
|
||||
}
|
||||
bool js_cocos2dx_studio_ActionTimeline_gotoFrameAndPlay(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
bool ok = true;
|
||||
cocostudio::timeline::ActionTimeline* cobj = nullptr;
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -11897,10 +11835,11 @@ bool js_cocos2dx_studio_ActionTimeline_gotoFrameAndPlay(JSContext *cx, uint32_t
|
||||
cobj = (cocostudio::timeline::ActionTimeline *)(proxy ? proxy->ptr : nullptr);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ActionTimeline_gotoFrameAndPlay : Invalid Native Object");
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 2) {
|
||||
int arg0 = 0;
|
||||
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
bool arg1;
|
||||
arg1 = JS::ToBoolean(args.get(1));
|
||||
cobj->gotoFrameAndPlay(arg0, arg1);
|
||||
@@ -11910,10 +11849,11 @@ bool js_cocos2dx_studio_ActionTimeline_gotoFrameAndPlay(JSContext *cx, uint32_t
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
int arg0 = 0;
|
||||
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cobj->gotoFrameAndPlay(arg0);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
@@ -11921,13 +11861,15 @@ bool js_cocos2dx_studio_ActionTimeline_gotoFrameAndPlay(JSContext *cx, uint32_t
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 3) {
|
||||
int arg0 = 0;
|
||||
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
int arg1 = 0;
|
||||
ok = true;
|
||||
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
bool arg2;
|
||||
arg2 = JS::ToBoolean(args.get(2));
|
||||
cobj->gotoFrameAndPlay(arg0, arg1, arg2);
|
||||
@@ -11937,16 +11879,19 @@ bool js_cocos2dx_studio_ActionTimeline_gotoFrameAndPlay(JSContext *cx, uint32_t
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 4) {
|
||||
int arg0 = 0;
|
||||
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
int arg1 = 0;
|
||||
ok = true;
|
||||
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
int arg2 = 0;
|
||||
ok = true;
|
||||
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
bool arg3;
|
||||
arg3 = JS::ToBoolean(args.get(3));
|
||||
cobj->gotoFrameAndPlay(arg0, arg1, arg2, arg3);
|
||||
@@ -12239,7 +12184,6 @@ bool js_cocos2dx_studio_BoneNode_getDebugDrawWidth(JSContext *cx, uint32_t argc,
|
||||
}
|
||||
bool js_cocos2dx_studio_BoneNode_getChildBones(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
bool ok = true;
|
||||
cocostudio::timeline::BoneNode* cobj = nullptr;
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -12385,7 +12329,6 @@ bool js_cocos2dx_studio_BoneNode_getAllSubSkins(JSContext *cx, uint32_t argc, js
|
||||
}
|
||||
bool js_cocos2dx_studio_BoneNode_displaySkin(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
bool ok = true;
|
||||
cocostudio::timeline::BoneNode* cobj = nullptr;
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -12395,10 +12338,11 @@ bool js_cocos2dx_studio_BoneNode_displaySkin(JSContext *cx, uint32_t argc, jsval
|
||||
cobj = (cocostudio::timeline::BoneNode *)(proxy ? proxy->ptr : nullptr);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_BoneNode_displaySkin : Invalid Native Object");
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 2) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
bool arg1;
|
||||
arg1 = JS::ToBoolean(args.get(1));
|
||||
cobj->displaySkin(arg0, arg1);
|
||||
@@ -12408,6 +12352,7 @@ bool js_cocos2dx_studio_BoneNode_displaySkin(JSContext *cx, uint32_t argc, jsval
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 2) {
|
||||
cocos2d::Node* arg0 = nullptr;
|
||||
do {
|
||||
@@ -12419,7 +12364,7 @@ bool js_cocos2dx_studio_BoneNode_displaySkin(JSContext *cx, uint32_t argc, jsval
|
||||
arg0 = (cocostudio::timeline::SkinNode*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
bool arg1;
|
||||
arg1 = JS::ToBoolean(args.get(1));
|
||||
cobj->displaySkin(arg0, arg1);
|
||||
@@ -12451,7 +12396,6 @@ bool js_cocos2dx_studio_BoneNode_isDebugDrawEnabled(JSContext *cx, uint32_t argc
|
||||
}
|
||||
bool js_cocos2dx_studio_BoneNode_addSkin(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
bool ok = true;
|
||||
cocostudio::timeline::BoneNode* cobj = nullptr;
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -12461,6 +12405,7 @@ bool js_cocos2dx_studio_BoneNode_addSkin(JSContext *cx, uint32_t argc, jsval *vp
|
||||
cobj = (cocostudio::timeline::BoneNode *)(proxy ? proxy->ptr : nullptr);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_BoneNode_addSkin : Invalid Native Object");
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 3) {
|
||||
cocos2d::Node* arg0 = nullptr;
|
||||
do {
|
||||
@@ -12472,7 +12417,7 @@ bool js_cocos2dx_studio_BoneNode_addSkin(JSContext *cx, uint32_t argc, jsval *vp
|
||||
arg0 = (cocostudio::timeline::SkinNode*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
bool arg1;
|
||||
arg1 = JS::ToBoolean(args.get(1));
|
||||
bool arg2;
|
||||
@@ -12484,6 +12429,7 @@ bool js_cocos2dx_studio_BoneNode_addSkin(JSContext *cx, uint32_t argc, jsval *vp
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 2) {
|
||||
cocos2d::Node* arg0 = nullptr;
|
||||
do {
|
||||
@@ -12495,7 +12441,7 @@ bool js_cocos2dx_studio_BoneNode_addSkin(JSContext *cx, uint32_t argc, jsval *vp
|
||||
arg0 = (cocostudio::timeline::SkinNode*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
bool arg1;
|
||||
arg1 = JS::ToBoolean(args.get(1));
|
||||
cobj->addSkin(arg0, arg1);
|
||||
@@ -12554,7 +12500,6 @@ bool js_cocos2dx_studio_BoneNode_setDebugDrawLength(JSContext *cx, uint32_t argc
|
||||
}
|
||||
bool js_cocos2dx_studio_BoneNode_getSkins(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
bool ok = true;
|
||||
cocostudio::timeline::BoneNode* cobj = nullptr;
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -12683,13 +12628,13 @@ bool js_cocos2dx_studio_BoneNode_getDebugDrawColor(JSContext *cx, uint32_t argc,
|
||||
bool js_cocos2dx_studio_BoneNode_create(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
int arg0 = 0;
|
||||
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cocostudio::timeline::BoneNode* ret = cocostudio::timeline::BoneNode::create(arg0);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
do {
|
||||
@@ -12870,7 +12815,6 @@ bool js_cocos2dx_studio_SkeletonNode_getBoneNode(JSContext *cx, uint32_t argc, j
|
||||
}
|
||||
bool js_cocos2dx_studio_SkeletonNode_changeSkins(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
bool ok = true;
|
||||
cocostudio::timeline::SkeletonNode* cobj = nullptr;
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -12880,10 +12824,11 @@ bool js_cocos2dx_studio_SkeletonNode_changeSkins(JSContext *cx, uint32_t argc, j
|
||||
cobj = (cocostudio::timeline::SkeletonNode *)(proxy ? proxy->ptr : nullptr);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_SkeletonNode_changeSkins : Invalid Native Object");
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cobj->changeSkins(arg0);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
@@ -12891,10 +12836,11 @@ bool js_cocos2dx_studio_SkeletonNode_changeSkins(JSContext *cx, uint32_t argc, j
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
std::map<std::string, std::string> arg0;
|
||||
ok &= jsval_to_std_map_string_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cobj->changeSkins(arg0);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
|
||||
@@ -23,7 +23,6 @@ bool js_cocos2dx_studio_ActionObject_play(JSContext *cx, uint32_t argc, jsval *v
|
||||
bool js_cocos2dx_studio_ActionObject_getCurrentTime(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_studio_ActionObject_removeActionNode(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_studio_ActionObject_getLoop(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_studio_ActionObject_initWithBinary(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_studio_ActionObject_addActionNode(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_studio_ActionObject_getUnitTime(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_studio_ActionObject_isPlaying(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
@@ -41,7 +40,6 @@ void js_register_cocos2dx_studio_ActionManagerEx(JSContext *cx, JS::HandleObject
|
||||
void register_all_cocos2dx_studio(JSContext* cx, JS::HandleObject obj);
|
||||
bool js_cocos2dx_studio_ActionManagerEx_stopActionByName(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_studio_ActionManagerEx_getActionByName(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_studio_ActionManagerEx_initWithBinary(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_studio_ActionManagerEx_playActionByName(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_studio_ActionManagerEx_releaseActions(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
bool js_cocos2dx_studio_ActionManagerEx_destroyInstance(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -46,7 +46,6 @@ JSObject *jsb_creator_Scale9SpriteV2_prototype;
|
||||
|
||||
bool js_creator_Scale9SpriteV2_setTexture(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
bool ok = true;
|
||||
creator::Scale9SpriteV2* cobj = nullptr;
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -56,6 +55,7 @@ bool js_creator_Scale9SpriteV2_setTexture(JSContext *cx, uint32_t argc, jsval *v
|
||||
cobj = (creator::Scale9SpriteV2 *)(proxy ? proxy->ptr : nullptr);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_creator_Scale9SpriteV2_setTexture : Invalid Native Object");
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
cocos2d::Texture2D* arg0 = nullptr;
|
||||
do {
|
||||
@@ -67,7 +67,7 @@ bool js_creator_Scale9SpriteV2_setTexture(JSContext *cx, uint32_t argc, jsval *v
|
||||
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
bool ret = cobj->setTexture(arg0);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = BOOLEAN_TO_JSVAL(ret);
|
||||
@@ -77,10 +77,11 @@ bool js_creator_Scale9SpriteV2_setTexture(JSContext *cx, uint32_t argc, jsval *v
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
bool ret = cobj->setTexture(arg0);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = BOOLEAN_TO_JSVAL(ret);
|
||||
@@ -284,7 +285,6 @@ bool js_creator_Scale9SpriteV2_setRenderingType(JSContext *cx, uint32_t argc, js
|
||||
}
|
||||
bool js_creator_Scale9SpriteV2_setFillCenter(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
bool ok = true;
|
||||
creator::Scale9SpriteV2* cobj = nullptr;
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -294,13 +294,15 @@ bool js_creator_Scale9SpriteV2_setFillCenter(JSContext *cx, uint32_t argc, jsval
|
||||
cobj = (creator::Scale9SpriteV2 *)(proxy ? proxy->ptr : nullptr);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_creator_Scale9SpriteV2_setFillCenter : Invalid Native Object");
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 2) {
|
||||
double arg0 = 0;
|
||||
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
double arg1 = 0;
|
||||
ok = true;
|
||||
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cobj->setFillCenter(arg0, arg1);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
@@ -308,10 +310,11 @@ bool js_creator_Scale9SpriteV2_setFillCenter(JSContext *cx, uint32_t argc, jsval
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
cocos2d::Vec2 arg0;
|
||||
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cobj->setFillCenter(arg0);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
@@ -323,7 +326,6 @@ bool js_creator_Scale9SpriteV2_setFillCenter(JSContext *cx, uint32_t argc, jsval
|
||||
}
|
||||
bool js_creator_Scale9SpriteV2_setSpriteFrame(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
bool ok = true;
|
||||
creator::Scale9SpriteV2* cobj = nullptr;
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -333,6 +335,7 @@ bool js_creator_Scale9SpriteV2_setSpriteFrame(JSContext *cx, uint32_t argc, jsva
|
||||
cobj = (creator::Scale9SpriteV2 *)(proxy ? proxy->ptr : nullptr);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_creator_Scale9SpriteV2_setSpriteFrame : Invalid Native Object");
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
cocos2d::SpriteFrame* arg0 = nullptr;
|
||||
do {
|
||||
@@ -344,7 +347,7 @@ bool js_creator_Scale9SpriteV2_setSpriteFrame(JSContext *cx, uint32_t argc, jsva
|
||||
arg0 = (cocos2d::SpriteFrame*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
bool ret = cobj->setSpriteFrame(arg0);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = BOOLEAN_TO_JSVAL(ret);
|
||||
@@ -354,10 +357,11 @@ bool js_creator_Scale9SpriteV2_setSpriteFrame(JSContext *cx, uint32_t argc, jsva
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
bool ret = cobj->setSpriteFrame(arg0);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = BOOLEAN_TO_JSVAL(ret);
|
||||
@@ -389,7 +393,6 @@ bool js_creator_Scale9SpriteV2_getBlendFunc(JSContext *cx, uint32_t argc, jsval
|
||||
}
|
||||
bool js_creator_Scale9SpriteV2_initWithTexture(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
bool ok = true;
|
||||
creator::Scale9SpriteV2* cobj = nullptr;
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -399,10 +402,11 @@ bool js_creator_Scale9SpriteV2_initWithTexture(JSContext *cx, uint32_t argc, jsv
|
||||
cobj = (creator::Scale9SpriteV2 *)(proxy ? proxy->ptr : nullptr);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_creator_Scale9SpriteV2_initWithTexture : Invalid Native Object");
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
bool ret = cobj->initWithTexture(arg0);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = BOOLEAN_TO_JSVAL(ret);
|
||||
@@ -412,6 +416,7 @@ bool js_creator_Scale9SpriteV2_initWithTexture(JSContext *cx, uint32_t argc, jsv
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
cocos2d::Texture2D* arg0 = nullptr;
|
||||
do {
|
||||
@@ -423,7 +428,7 @@ bool js_creator_Scale9SpriteV2_initWithTexture(JSContext *cx, uint32_t argc, jsv
|
||||
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
bool ret = cobj->initWithTexture(arg0);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = BOOLEAN_TO_JSVAL(ret);
|
||||
@@ -529,7 +534,6 @@ bool js_creator_Scale9SpriteV2_getInsetRight(JSContext *cx, uint32_t argc, jsval
|
||||
}
|
||||
bool js_creator_Scale9SpriteV2_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
bool ok = true;
|
||||
creator::Scale9SpriteV2* cobj = nullptr;
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -539,13 +543,15 @@ bool js_creator_Scale9SpriteV2_setBlendFunc(JSContext *cx, uint32_t argc, jsval
|
||||
cobj = (creator::Scale9SpriteV2 *)(proxy ? proxy->ptr : nullptr);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_creator_Scale9SpriteV2_setBlendFunc : Invalid Native Object");
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 2) {
|
||||
unsigned int arg0 = 0;
|
||||
ok &= jsval_to_uint32(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
unsigned int arg1 = 0;
|
||||
ok = true;
|
||||
ok &= jsval_to_uint32(cx, args.get(1), &arg1);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cobj->setBlendFunc(arg0, arg1);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
@@ -553,10 +559,11 @@ bool js_creator_Scale9SpriteV2_setBlendFunc(JSContext *cx, uint32_t argc, jsval
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
cocos2d::BlendFunc arg0;
|
||||
ok &= jsval_to_blendfunc(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
cobj->setBlendFunc(arg0);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
@@ -624,7 +631,6 @@ bool js_creator_Scale9SpriteV2_setInsetLeft(JSContext *cx, uint32_t argc, jsval
|
||||
}
|
||||
bool js_creator_Scale9SpriteV2_initWithSpriteFrame(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
bool ok = true;
|
||||
creator::Scale9SpriteV2* cobj = nullptr;
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -634,10 +640,11 @@ bool js_creator_Scale9SpriteV2_initWithSpriteFrame(JSContext *cx, uint32_t argc,
|
||||
cobj = (creator::Scale9SpriteV2 *)(proxy ? proxy->ptr : nullptr);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_creator_Scale9SpriteV2_initWithSpriteFrame : Invalid Native Object");
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
std::string arg0;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
bool ret = cobj->initWithSpriteFrame(arg0);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = BOOLEAN_TO_JSVAL(ret);
|
||||
@@ -647,6 +654,7 @@ bool js_creator_Scale9SpriteV2_initWithSpriteFrame(JSContext *cx, uint32_t argc,
|
||||
} while(0);
|
||||
|
||||
do {
|
||||
bool ok = true;
|
||||
if (argc == 1) {
|
||||
cocos2d::SpriteFrame* arg0 = nullptr;
|
||||
do {
|
||||
@@ -658,7 +666,7 @@ bool js_creator_Scale9SpriteV2_initWithSpriteFrame(JSContext *cx, uint32_t argc,
|
||||
arg0 = (cocos2d::SpriteFrame*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
if (!ok) { ok = true; break; }
|
||||
if (!ok) { break; }
|
||||
bool ret = cobj->initWithSpriteFrame(arg0);
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = BOOLEAN_TO_JSVAL(ret);
|
||||
@@ -747,7 +755,7 @@ bool js_creator_Scale9SpriteV2_constructor(JSContext *cx, uint32_t argc, jsval *
|
||||
JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
|
||||
args.rval().set(OBJECT_TO_JSVAL(obj));
|
||||
// link the native object with the javascript object
|
||||
js_proxy_t* p = jsb_new_proxy(cobj, obj);
|
||||
jsb_new_proxy(cobj, obj);
|
||||
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
|
||||
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
||||
return true;
|
||||
|
||||
@@ -600,7 +600,7 @@ void ScriptingCore::createGlobalContext() {
|
||||
|
||||
runScript("script/jsb_prepare.js", globalRef, _cx);
|
||||
|
||||
for (std::vector<sc_register_sth>::iterator it = registrationList.begin(); it != registrationList.end(); it++) {
|
||||
for (auto it = registrationList.begin(); it != registrationList.end(); it++) {
|
||||
sc_register_sth callback = *it;
|
||||
callback(_cx, _global.ref());
|
||||
}
|
||||
@@ -704,6 +704,7 @@ JS::PersistentRootedScript* ScriptingCore::compileScript(const std::string& path
|
||||
if (compileSucceed) {
|
||||
return script;
|
||||
} else {
|
||||
cocos2d::log("ScriptingCore:: compileScript fail:%s", path.c_str());
|
||||
CC_SAFE_DELETE(script);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -663,7 +663,10 @@ bool jsval_to_array_of_cpvect( JSContext *cx, jsval vp, cpVect**verts, int *numV
|
||||
|
||||
double value = 0;
|
||||
ok = JS::ToNumber(cx, valarg, &value);
|
||||
JSB_PRECONDITION( ok, "Error converting value to nsobject");
|
||||
if (!ok) {
|
||||
free(array);
|
||||
}
|
||||
JSB_PRECONDITION(ok, "Error converting value to nsobject");
|
||||
|
||||
if(i%2==0)
|
||||
array[i/2].x = value;
|
||||
|
||||
@@ -2620,8 +2620,10 @@ bool js_cocos2dx_ActionInterval_easing(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
JS_ValueToObject(cx, vpi, &tmp) &&
|
||||
JS_GetProperty(cx, tmp, "tag", &jsTag) &&
|
||||
JS::ToNumber(cx, jsTag, &tag);
|
||||
JS_GetProperty(cx, tmp, "param", &jsParam) && JS::ToNumber(cx, jsParam, ¶meter);
|
||||
bool hasParam = (parameter == parameter);
|
||||
|
||||
bool hasParam = JS_GetProperty(cx, tmp, "param", &jsParam) && !jsParam.isUndefined();
|
||||
JS::ToNumber(cx, jsParam, ¶meter);
|
||||
|
||||
if (!ok) continue;
|
||||
|
||||
cocos2d::ActionEase* action;
|
||||
@@ -4001,7 +4003,7 @@ static jsval string_vector_to_jsval(JSContext* cx, const std::vector<std::string
|
||||
JS::RootedObject jsretArr(cx, JS_NewArrayObject(cx, 0));
|
||||
|
||||
int i = 0;
|
||||
for(std::vector<std::string>::const_iterator iter = arr.begin(); iter != arr.end(); ++iter, ++i) {
|
||||
for(auto iter = arr.begin(); iter != arr.end(); ++iter, ++i) {
|
||||
JS::RootedValue arrElement(cx, std_string_to_jsval(cx, *iter));
|
||||
if(!JS_SetElement(cx, jsretArr, i, arrElement)) {
|
||||
break;
|
||||
@@ -4643,48 +4645,6 @@ void __JSPlistDelegator::textHandler(void *ctx, const char *ch, int len) {
|
||||
}
|
||||
}
|
||||
|
||||
bool jsval_to_TTFConfig(JSContext *cx, jsval v, TTFConfig* ret) {
|
||||
JS::RootedObject tmp(cx);
|
||||
JS::RootedValue js_fontFilePath(cx);
|
||||
JS::RootedValue js_fontSize(cx);
|
||||
JS::RootedValue js_outlineSize(cx);
|
||||
JS::RootedValue js_glyphs(cx);
|
||||
JS::RootedValue js_customGlyphs(cx);
|
||||
JS::RootedValue js_distanceFieldEnable(cx);
|
||||
|
||||
std::string fontFilePath,customGlyphs;
|
||||
double fontSize, glyphs, outlineSize;
|
||||
|
||||
JS::RootedValue jsv(cx, v);
|
||||
bool ok = jsv.isObject() &&
|
||||
JS_ValueToObject(cx, jsv, &tmp) &&
|
||||
JS_GetProperty(cx, tmp, "fontFilePath", &js_fontFilePath) &&
|
||||
JS_GetProperty(cx, tmp, "fontSize", &js_fontSize) &&
|
||||
JS_GetProperty(cx, tmp, "outlineSize", &js_outlineSize) &&
|
||||
JS_GetProperty(cx, tmp, "glyphs", &js_glyphs) &&
|
||||
JS_GetProperty(cx, tmp, "customGlyphs", &js_customGlyphs) &&
|
||||
JS_GetProperty(cx, tmp, "distanceFieldEnable", &js_distanceFieldEnable) &&
|
||||
JS::ToNumber(cx, js_fontSize, &fontSize) &&
|
||||
JS::ToNumber(cx, js_outlineSize, &outlineSize) &&
|
||||
JS::ToNumber(cx, js_glyphs, &glyphs) &&
|
||||
jsval_to_std_string(cx,js_fontFilePath,&ret->fontFilePath) &&
|
||||
jsval_to_std_string(cx,js_customGlyphs,&customGlyphs);
|
||||
bool distanceFieldEnable = JS::ToBoolean(js_distanceFieldEnable);
|
||||
|
||||
JSB_PRECONDITION3(ok, cx, false, "Error processing arguments");
|
||||
|
||||
ret->fontSize = (int)fontSize;
|
||||
ret->outlineSize = (int)outlineSize;
|
||||
ret->glyphs = GlyphCollection((int)glyphs);
|
||||
ret->distanceFieldEnabled = distanceFieldEnable;
|
||||
if(ret->glyphs == GlyphCollection::CUSTOM && customGlyphs.length() > 0)
|
||||
ret->customGlyphs = customGlyphs.c_str();
|
||||
else
|
||||
ret->customGlyphs = nullptr;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool js_cocos2dx_Label_createWithTTF(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
if (argc < 2)
|
||||
@@ -5104,7 +5064,7 @@ void js_register_cocos2dx_EventKeyboard(JSContext *cx, JS::HandleObject global)
|
||||
bool js_console_log(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
if (argc == 1) {
|
||||
if (argc >= 1) {
|
||||
std::string msg;
|
||||
bool ok = jsval_to_std_string(cx, args.get(0), &msg);
|
||||
if (!ok) {
|
||||
@@ -5117,7 +5077,6 @@ bool js_console_log(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_console_log : wrong number of arguments");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -633,70 +633,64 @@ bool jsval_to_quaternion( JSContext *cx, JS::HandleValue v, cocos2d::Quaternion*
|
||||
return true;
|
||||
}
|
||||
|
||||
//bool jsval_to_obb(JSContext *cx, JS::HandleValue v, cocos2d::OBB* ret)
|
||||
//{
|
||||
// JS::RootedObject tmp(cx);
|
||||
// JS::RootedValue jscenter(cx);
|
||||
// JS::RootedValue jsxAxis(cx);
|
||||
// JS::RootedValue jsyAxis(cx);
|
||||
// JS::RootedValue jszAxis(cx);
|
||||
// JS::RootedValue jsextents(cx);
|
||||
// JS::RootedValue jsextentx(cx);
|
||||
// JS::RootedValue jsextenty(cx);
|
||||
// JS::RootedValue jsextentz(cx);
|
||||
//
|
||||
// cocos2d::Vec3 center, xAxis, yAxis, zAxis, extents, extentx, extenty, extentz;
|
||||
// bool ok = v.isObject() &&
|
||||
// JS_ValueToObject(cx, v, &tmp) &&
|
||||
// JS_GetProperty(cx, tmp, "center", &jscenter) &&
|
||||
// JS_GetProperty(cx, tmp, "xAxis", &jsxAxis) &&
|
||||
// JS_GetProperty(cx, tmp, "yAxis", &jsyAxis) &&
|
||||
// JS_GetProperty(cx, tmp, "zAxis", &jszAxis) &&
|
||||
// JS_GetProperty(cx, tmp, "extents", &jsextents) &&
|
||||
// JS_GetProperty(cx, tmp, "extentX", &jsextentx) &&
|
||||
// JS_GetProperty(cx, tmp, "extentY", &jsextenty) &&
|
||||
// JS_GetProperty(cx, tmp, "extentZ", &jsextentz) &&
|
||||
// jsval_to_vector3(cx, jscenter, ¢er) &&
|
||||
// jsval_to_vector3(cx, jsxAxis, &xAxis) &&
|
||||
// jsval_to_vector3(cx, jsyAxis, &yAxis) &&
|
||||
// jsval_to_vector3(cx, jszAxis, &zAxis) &&
|
||||
// jsval_to_vector3(cx, jsextents, &extents) &&
|
||||
// jsval_to_vector3(cx, jsextentx, &extentx) &&
|
||||
// jsval_to_vector3(cx, jsextenty, &extenty) &&
|
||||
// jsval_to_vector3(cx, jsextentz, &extentz);
|
||||
//
|
||||
// JSB_PRECONDITION3(ok, cx, false, "Error processing arguments");
|
||||
//
|
||||
// ret->_center.set(center);
|
||||
// ret->_xAxis.set(xAxis);
|
||||
// ret->_yAxis.set(yAxis);
|
||||
// ret->_zAxis.set(zAxis);
|
||||
// ret->_extents.set(extents);
|
||||
// ret->_extentX.set(extentx);
|
||||
// ret->_extentY.set(extenty);
|
||||
// ret->_extentZ.set(extentz);
|
||||
// return true;
|
||||
//}
|
||||
|
||||
//bool jsval_to_ray(JSContext *cx, JS::HandleValue v, cocos2d::Ray* ret)
|
||||
//{
|
||||
// JS::RootedObject tmp(cx);
|
||||
// JS::RootedValue jsorigin(cx);
|
||||
// JS::RootedValue jsdirection(cx);
|
||||
//
|
||||
// cocos2d::Vec3 origin, direction;
|
||||
// bool ok = v.isObject() &&
|
||||
// JS_ValueToObject(cx, v, &tmp) &&
|
||||
// JS_GetProperty(cx, tmp, "origin", &jsorigin) &&
|
||||
// JS_GetProperty(cx, tmp, "direction", &jsdirection) &&
|
||||
// jsval_to_vector3(cx, jsorigin, &origin) &&
|
||||
// jsval_to_vector3(cx, jsdirection, &direction);
|
||||
//
|
||||
// JSB_PRECONDITION3(ok, cx, false, "Error processing arguments");
|
||||
//
|
||||
// ret->set(origin, direction);
|
||||
// return true;
|
||||
//}
|
||||
bool jsval_to_TTFConfig(JSContext *cx, JS::HandleValue v, cocos2d::TTFConfig* ret) {
|
||||
JS::RootedObject tmp(cx);
|
||||
JS::RootedValue js_fontFilePath(cx);
|
||||
JS::RootedValue js_fontSize(cx);
|
||||
JS::RootedValue js_outlineSize(cx);
|
||||
JS::RootedValue js_glyphs(cx);
|
||||
JS::RootedValue js_customGlyphs(cx);
|
||||
JS::RootedValue js_distanceFieldEnable(cx);
|
||||
|
||||
std::string fontFilePath,customGlyphs;
|
||||
double fontSize, glyphs, outlineSize;
|
||||
|
||||
JS::RootedValue jsv(cx, v);
|
||||
bool ok = jsv.isObject() && JS_ValueToObject(cx, jsv, &tmp);
|
||||
if (ok)
|
||||
{
|
||||
if (JS_GetProperty(cx, tmp, "fontFilePath", &js_fontFilePath) && !js_fontFilePath.isUndefined())
|
||||
{
|
||||
jsval_to_std_string(cx,js_fontFilePath,&ret->fontFilePath);
|
||||
}
|
||||
|
||||
if (JS_GetProperty(cx, tmp, "fontSize", &js_fontSize) && !js_fontSize.isUndefined())
|
||||
{
|
||||
if (JS::ToNumber(cx, js_fontSize, &fontSize))
|
||||
ret->fontSize = (int)fontSize;
|
||||
}
|
||||
|
||||
if (JS_GetProperty(cx, tmp, "outlineSize", &js_outlineSize) && !js_outlineSize.isUndefined())
|
||||
{
|
||||
if (JS::ToNumber(cx, js_outlineSize, &outlineSize))
|
||||
ret->outlineSize = (int)outlineSize;
|
||||
}
|
||||
|
||||
if (JS_GetProperty(cx, tmp, "glyphs", &js_glyphs) && !js_glyphs.isUndefined())
|
||||
{
|
||||
if (JS::ToNumber(cx, js_glyphs, &glyphs))
|
||||
ret->glyphs = (GlyphCollection)glyphs;
|
||||
}
|
||||
|
||||
if (JS_GetProperty(cx, tmp, "customGlyphs", &js_customGlyphs) && !js_customGlyphs.isUndefined())
|
||||
{
|
||||
jsval_to_std_string(cx,js_customGlyphs,&customGlyphs);
|
||||
}
|
||||
if(ret->glyphs == GlyphCollection::CUSTOM && !customGlyphs.empty())
|
||||
ret->customGlyphs = customGlyphs.c_str();
|
||||
else
|
||||
ret->customGlyphs = "";
|
||||
|
||||
if (JS_GetProperty(cx, tmp, "distanceFieldEnable", &js_distanceFieldEnable) && !js_distanceFieldEnable.isUndefined())
|
||||
{
|
||||
ret->distanceFieldEnabled = JS::ToBoolean(js_distanceFieldEnable);
|
||||
}
|
||||
}
|
||||
|
||||
JSB_PRECONDITION3(ok, cx, false, "Error processing arguments");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool jsvals_variadic_to_ccvaluevector( JSContext *cx, jsval *vp, int argc, cocos2d::ValueVector* ret)
|
||||
{
|
||||
@@ -917,6 +911,8 @@ bool jsval_to_ccarray_of_CCPoint(JSContext* cx, JS::HandleValue v, Point **point
|
||||
JS_GetElement(cx, jsobj, i, &valarg);
|
||||
|
||||
ok = jsval_to_ccpoint(cx, valarg, &array[i]);
|
||||
if(!ok)
|
||||
delete [] array;
|
||||
JSB_PRECONDITION3(ok, cx, false, "Error processing arguments");
|
||||
}
|
||||
|
||||
@@ -1970,198 +1966,117 @@ bool jsval_to_FontDefinition( JSContext *cx, JS::HandleValue vp, FontDefinition
|
||||
JSB_PRECONDITION( jsobj, "Not a valid JS object");
|
||||
|
||||
// defaul values
|
||||
const char * defautlFontName = "Arial";
|
||||
const int defaultFontSize = 32;
|
||||
TextHAlignment defaultTextAlignment = TextHAlignment::LEFT;
|
||||
TextVAlignment defaultTextVAlignment = TextVAlignment::TOP;
|
||||
|
||||
// by default shadow and stroke are off
|
||||
out->_shadow._shadowEnabled = false;
|
||||
out->_stroke._strokeEnabled = false;
|
||||
|
||||
// white text by default
|
||||
out->_fontFillColor = Color3B::WHITE;
|
||||
out->_fontName = "Arial";
|
||||
out->_fontSize = 32;
|
||||
out->_alignment = TextHAlignment::LEFT;
|
||||
out->_vertAlignment = TextVAlignment::TOP;
|
||||
|
||||
// font name
|
||||
JS::RootedValue jsr(cx);
|
||||
JS_GetProperty(cx, jsobj, "fontName", &jsr);
|
||||
JS::ToString(cx, jsr);
|
||||
JSStringWrapper wrapper(jsr);
|
||||
const char* fontName = wrapper.get();
|
||||
|
||||
if (fontName && strlen(fontName) > 0)
|
||||
{
|
||||
out->_fontName = fontName;
|
||||
}
|
||||
else
|
||||
{
|
||||
out->_fontName = defautlFontName;
|
||||
}
|
||||
JS::RootedValue jsFontName(cx);
|
||||
if (JS_GetProperty(cx, jsobj, "fontName", &jsFontName) && !jsFontName.isNullOrUndefined())
|
||||
jsval_to_std_string(cx, jsFontName, &(out->_fontName));
|
||||
|
||||
// font size
|
||||
bool hasProperty, hasSecondProp;
|
||||
JS_HasProperty(cx, jsobj, "fontSize", &hasProperty);
|
||||
if ( hasProperty )
|
||||
JS::RootedValue jsFontSize(cx);
|
||||
if (JS_GetProperty(cx, jsobj, "fontSize", &jsFontSize) && !jsFontSize.isNullOrUndefined())
|
||||
{
|
||||
JS_GetProperty(cx, jsobj, "fontSize", &jsr);
|
||||
double fontSize = 0.0;
|
||||
JS::ToNumber(cx, jsr, &fontSize);
|
||||
out->_fontSize = fontSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
out->_fontSize = defaultFontSize;
|
||||
JS::ToNumber(cx, jsFontSize, &fontSize);
|
||||
out->_fontSize = fontSize;
|
||||
}
|
||||
|
||||
// font alignment horizontal
|
||||
JS_HasProperty(cx, jsobj, "textAlign", &hasProperty);
|
||||
if ( hasProperty )
|
||||
JS::RootedValue jsTextAlign(cx);
|
||||
if (JS_GetProperty(cx, jsobj, "textAlign", &jsTextAlign) && !jsTextAlign.isNullOrUndefined())
|
||||
{
|
||||
JS_GetProperty(cx, jsobj, "textAlign", &jsr);
|
||||
double fontAlign = 0.0;
|
||||
JS::ToNumber(cx, jsr, &fontAlign);
|
||||
out->_alignment = (TextHAlignment)(int)fontAlign;
|
||||
}
|
||||
else
|
||||
{
|
||||
out->_alignment = defaultTextAlignment;
|
||||
double textAlign = 0.0;
|
||||
JS::ToNumber(cx, jsTextAlign, &textAlign);
|
||||
out->_alignment = (TextHAlignment)(int)textAlign;
|
||||
}
|
||||
|
||||
// font alignment vertical
|
||||
JS_HasProperty(cx, jsobj, "verticalAlign", &hasProperty);
|
||||
if ( hasProperty )
|
||||
JS::RootedValue jsVerticalAlign(cx);
|
||||
if (JS_GetProperty(cx, jsobj, "verticalAlign", &jsVerticalAlign) && !jsVerticalAlign.isNullOrUndefined())
|
||||
{
|
||||
JS_GetProperty(cx, jsobj, "verticalAlign", &jsr);
|
||||
double fontAlign = 0.0;
|
||||
JS::ToNumber(cx, jsr, &fontAlign);
|
||||
out->_vertAlignment = (TextVAlignment)(int)fontAlign;
|
||||
}
|
||||
else
|
||||
{
|
||||
out->_vertAlignment = defaultTextVAlignment;
|
||||
double verticalAlign = 0.0;
|
||||
JS::ToNumber(cx, jsVerticalAlign, &verticalAlign);
|
||||
out->_vertAlignment = (TextVAlignment)(int)verticalAlign;
|
||||
}
|
||||
|
||||
// font fill color
|
||||
JS_HasProperty(cx, jsobj, "fillStyle", &hasProperty);
|
||||
if ( hasProperty )
|
||||
JS::RootedValue jsFillColor(cx);
|
||||
if (JS_GetProperty(cx, jsobj, "fillStyle", &jsFillColor) && !jsFillColor.isNullOrUndefined())
|
||||
{
|
||||
JS_GetProperty(cx, jsobj, "fillStyle", &jsr);
|
||||
|
||||
JS::RootedObject jsobjColor(cx);
|
||||
JS::RootedValue jsvalColor(cx, jsr);
|
||||
if (!JS_ValueToObject(cx, jsvalColor, &jsobjColor))
|
||||
return false;
|
||||
|
||||
out->_fontFillColor = getColorFromJSObject(cx, jsobjColor);
|
||||
jsval_to_cccolor3b(cx, jsFillColor, &(out->_fontFillColor));
|
||||
}
|
||||
|
||||
// font rendering box dimensions
|
||||
JS_HasProperty(cx, jsobj, "boundingWidth", &hasProperty);
|
||||
JS_HasProperty(cx, jsobj, "boundingHeight", &hasSecondProp);
|
||||
if ( hasProperty && hasSecondProp )
|
||||
JS::RootedValue jsWidth(cx);
|
||||
if (JS_GetProperty(cx, jsobj, "boundingWidth", &jsWidth) && !jsWidth.isNullOrUndefined())
|
||||
{
|
||||
JS_GetProperty(cx, jsobj, "boundingWidth", &jsr);
|
||||
double boundingW = 0.0;
|
||||
JS::ToNumber(cx, jsr, &boundingW);
|
||||
|
||||
JS_GetProperty(cx, jsobj, "boundingHeight", &jsr);
|
||||
double boundingH = 0.0;
|
||||
JS::ToNumber(cx, jsr, &boundingH);
|
||||
|
||||
Size dimension;
|
||||
dimension.width = boundingW;
|
||||
dimension.height = boundingH;
|
||||
out->_dimensions = dimension;
|
||||
double boundingWidth = 0.0;
|
||||
JS::ToNumber(cx, jsWidth, &boundingWidth);
|
||||
out->_dimensions.width = boundingWidth;
|
||||
}
|
||||
JS::RootedValue jsHeight(cx);
|
||||
if (JS_GetProperty(cx, jsobj, "boundingHeight", &jsHeight) && !jsHeight.isNullOrUndefined())
|
||||
{
|
||||
double boundingHeight = 0.0;
|
||||
JS::ToNumber(cx, jsHeight, &boundingHeight);
|
||||
out->_dimensions.height = boundingHeight;
|
||||
}
|
||||
|
||||
// shadow
|
||||
JS_HasProperty(cx, jsobj, "shadowEnabled", &hasProperty);
|
||||
if ( hasProperty )
|
||||
JS::RootedValue jsShadowEnabled(cx);
|
||||
if (JS_GetProperty(cx, jsobj, "shadowEnabled", &jsShadowEnabled) && !jsShadowEnabled.isNullOrUndefined())
|
||||
{
|
||||
JS_GetProperty(cx, jsobj, "shadowEnabled", &jsr);
|
||||
out->_shadow._shadowEnabled = ToBoolean(jsr);
|
||||
|
||||
if ( out->_shadow._shadowEnabled )
|
||||
out->_shadow._shadowEnabled = ToBoolean(jsShadowEnabled);
|
||||
if (out->_shadow._shadowEnabled)
|
||||
{
|
||||
// default shadow values
|
||||
out->_shadow._shadowOffset = Size(5, 5);
|
||||
out->_shadow._shadowBlur = 1;
|
||||
out->_shadow._shadowOpacity = 1;
|
||||
|
||||
// shado offset
|
||||
JS_HasProperty(cx, jsobj, "shadowOffsetX", &hasProperty);
|
||||
JS_HasProperty(cx, jsobj, "shadowOffsetY", &hasSecondProp);
|
||||
if ( hasProperty && hasSecondProp )
|
||||
JS::RootedValue jsOffsetX(cx);
|
||||
if (JS_GetProperty(cx, jsobj, "shadowOffsetX", &jsOffsetX) && !jsOffsetX.isNullOrUndefined())
|
||||
{
|
||||
JS_GetProperty(cx, jsobj, "shadowOffsetX", &jsr);
|
||||
double offx = 0.0;
|
||||
JS::ToNumber(cx, jsr, &offx);
|
||||
|
||||
JS_GetProperty(cx, jsobj, "shadowOffsetY", &jsr);
|
||||
double offy = 0.0;
|
||||
JS::ToNumber(cx, jsr, &offy);
|
||||
|
||||
Size offset;
|
||||
offset.width = offx;
|
||||
offset.height = offy;
|
||||
out->_shadow._shadowOffset = offset;
|
||||
double shadowOffsetX = 0.0;
|
||||
JS::ToNumber(cx, jsOffsetX, &shadowOffsetX);
|
||||
out->_shadow._shadowOffset.width = shadowOffsetX;
|
||||
}
|
||||
|
||||
// shadow blur
|
||||
JS_HasProperty(cx, jsobj, "shadowBlur", &hasProperty);
|
||||
if ( hasProperty )
|
||||
JS::RootedValue jsOffsetY(cx);
|
||||
if (JS_GetProperty(cx, jsobj, "shadowOffsetY", &jsOffsetY) && !jsOffsetY.isNullOrUndefined())
|
||||
{
|
||||
JS_GetProperty(cx, jsobj, "shadowBlur", &jsr);
|
||||
double shadowBlur = 0.0;
|
||||
JS::ToNumber(cx, jsr, &shadowBlur);
|
||||
out->_shadow._shadowBlur = shadowBlur;
|
||||
double shadowOffsetY = 0.0;
|
||||
JS::ToNumber(cx, jsOffsetY, &shadowOffsetY);
|
||||
out->_shadow._shadowOffset.height = shadowOffsetY;
|
||||
}
|
||||
|
||||
// shadow intensity
|
||||
JS_HasProperty(cx, jsobj, "shadowOpacity", &hasProperty);
|
||||
if ( hasProperty )
|
||||
|
||||
JS::RootedValue jsOpacity(cx);
|
||||
if (JS_GetProperty(cx, jsobj, "shadowOpacity", &jsOpacity) && !jsOpacity.isNullOrUndefined())
|
||||
{
|
||||
JS_GetProperty(cx, jsobj, "shadowOpacity", &jsr);
|
||||
double shadowOpacity = 0.0;
|
||||
JS::ToNumber(cx, jsr, &shadowOpacity);
|
||||
JS::ToNumber(cx, jsOpacity, &shadowOpacity);
|
||||
out->_shadow._shadowOpacity = shadowOpacity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// stroke
|
||||
JS_HasProperty(cx, jsobj, "strokeEnabled", &hasProperty);
|
||||
if ( hasProperty )
|
||||
JS::RootedValue jsStrokeEnabled(cx);
|
||||
if (JS_GetProperty(cx, jsobj, "shadowEnabled", &jsStrokeEnabled) && !jsStrokeEnabled.isNullOrUndefined())
|
||||
{
|
||||
JS_GetProperty(cx, jsobj, "strokeEnabled", &jsr);
|
||||
out->_stroke._strokeEnabled = ToBoolean(jsr);
|
||||
|
||||
if ( out->_stroke._strokeEnabled )
|
||||
out->_stroke._strokeEnabled = ToBoolean(jsStrokeEnabled);
|
||||
if (out->_stroke._strokeEnabled)
|
||||
{
|
||||
// default stroke values
|
||||
out->_stroke._strokeSize = 1;
|
||||
out->_stroke._strokeColor = Color3B::BLUE;
|
||||
|
||||
// stroke color
|
||||
JS_HasProperty(cx, jsobj, "strokeStyle", &hasProperty);
|
||||
if ( hasProperty )
|
||||
JS::RootedValue jsStrokeColor(cx);
|
||||
if (JS_GetProperty(cx, jsobj, "strokeStyle", &jsStrokeColor) && !jsStrokeColor.isNullOrUndefined())
|
||||
{
|
||||
JS_GetProperty(cx, jsobj, "strokeStyle", &jsr);
|
||||
|
||||
JS::RootedObject jsobjStrokeColor(cx);
|
||||
if (!JS_ValueToObject( cx, jsr, &jsobjStrokeColor ) )
|
||||
return false;
|
||||
out->_stroke._strokeColor = getColorFromJSObject(cx, jsobjStrokeColor);
|
||||
jsval_to_cccolor3b(cx, jsStrokeColor, &(out->_stroke._strokeColor));
|
||||
}
|
||||
|
||||
// stroke size
|
||||
JS_HasProperty(cx, jsobj, "lineWidth", &hasProperty);
|
||||
if ( hasProperty )
|
||||
|
||||
JS::RootedValue jsLineWidth(cx);
|
||||
if (JS_GetProperty(cx, jsobj, "lineWidth", &jsLineWidth) && !jsLineWidth.isNullOrUndefined())
|
||||
{
|
||||
JS_GetProperty(cx, jsobj, "lineWidth", &jsr);
|
||||
double strokeSize = 0.0;
|
||||
JS::ToNumber(cx, jsr, &strokeSize);
|
||||
out->_stroke._strokeSize = strokeSize;
|
||||
double lineWidth = 0.0;
|
||||
JS::ToNumber(cx, jsLineWidth, &lineWidth);
|
||||
out->_stroke._strokeSize = lineWidth;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,6 +106,7 @@ bool jsval_cccolor_to_opacity(JSContext *cx, JS::HandleValue v, int32_t* ret);
|
||||
bool jsval_to_ccarray_of_CCPoint(JSContext* cx, JS::HandleValue v, cocos2d::Point **points, int *numPoints);
|
||||
bool jsval_to_ccacceleration(JSContext* cx, JS::HandleValue v, cocos2d::Acceleration* ret);
|
||||
bool jsval_to_quaternion(JSContext *cx, JS::HandleValue vp, cocos2d::Quaternion* ret);
|
||||
bool jsval_to_TTFConfig(JSContext *cx, JS::HandleValue, cocos2d::TTFConfig* ret);
|
||||
|
||||
// forward declaration
|
||||
js_proxy_t* jsb_get_js_proxy(JS::HandleObject jsObj);
|
||||
|
||||
@@ -159,9 +159,8 @@ public:
|
||||
JS::RootedValue args(cx, OBJECT_TO_JSVAL(jsobj));
|
||||
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(_JSDelegate.ref()), "onclose", 1, args.address());
|
||||
|
||||
auto copy = &p->obj;
|
||||
JS::RemoveObjectRoot(cx, &p->obj);
|
||||
jsb_remove_proxy(p);
|
||||
JS::RemoveObjectRoot(cx, copy);
|
||||
}
|
||||
|
||||
// Delete WebSocket instance
|
||||
@@ -175,7 +174,7 @@ public:
|
||||
js_proxy_t * p = jsb_get_native_proxy(ws);
|
||||
if (!p) return;
|
||||
|
||||
if (Director::DirectorInstance == nullptr || ScriptEngineManager::ShareInstance == nullptr)
|
||||
if (Director::DirectorInstance == nullptr || ScriptEngineManager::ShareInstance == nullptr || Director::DirectorInstance->getRunningScene() == nullptr)
|
||||
return;
|
||||
|
||||
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
||||
@@ -283,7 +282,6 @@ bool js_cocos2dx_extension_WebSocket_constructor(JSContext *cx, uint32_t argc, j
|
||||
|
||||
if (argc == 1 || argc == 2)
|
||||
{
|
||||
|
||||
std::string url;
|
||||
|
||||
do {
|
||||
@@ -293,12 +291,8 @@ bool js_cocos2dx_extension_WebSocket_constructor(JSContext *cx, uint32_t argc, j
|
||||
|
||||
JS::RootedObject proto(cx, js_cocos2dx_websocket_prototype);
|
||||
JS::RootedObject obj(cx, JS_NewObject(cx, js_cocos2dx_websocket_class, proto, JS::NullPtr()));
|
||||
//JS::RootedObject obj(cx, JS_NewObjectForConstructor(cx, js_cocos2dx_websocket_class, args));
|
||||
|
||||
WebSocket* cobj = new (std::nothrow) WebSocket();
|
||||
auto delegate = new (std::nothrow) JSB_WebSocketDelegate(cx);
|
||||
delegate->setJSDelegate(obj);
|
||||
|
||||
WebSocket* cobj = nullptr;
|
||||
if (argc == 2)
|
||||
{
|
||||
std::vector<std::string> protocols;
|
||||
@@ -334,14 +328,20 @@ bool js_cocos2dx_extension_WebSocket_constructor(JSContext *cx, uint32_t argc, j
|
||||
protocols.push_back(protocol);
|
||||
}
|
||||
}
|
||||
|
||||
cobj = new (std::nothrow) WebSocket();
|
||||
auto delegate = new (std::nothrow) JSB_WebSocketDelegate(cx);
|
||||
delegate->setJSDelegate(obj);
|
||||
cobj->init(*delegate, url, &protocols);
|
||||
}
|
||||
else
|
||||
{
|
||||
cobj = new (std::nothrow) WebSocket();
|
||||
auto delegate = new (std::nothrow) JSB_WebSocketDelegate(cx);
|
||||
delegate->setJSDelegate(obj);
|
||||
cobj->init(*delegate, url);
|
||||
}
|
||||
|
||||
|
||||
JS_DefineProperty(cx, obj, "URL", args.get(0), JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY);
|
||||
|
||||
//protocol not support yet (always return "")
|
||||
@@ -377,8 +377,8 @@ static bool js_cocos2dx_extension_WebSocket_get_readyState(JSContext *cx, uint32
|
||||
}
|
||||
}
|
||||
|
||||
void register_jsb_websocket(JSContext *cx, JS::HandleObject global) {
|
||||
|
||||
void register_jsb_websocket(JSContext *cx, JS::HandleObject global)
|
||||
{
|
||||
js_cocos2dx_websocket_class = (JSClass *)calloc(1, sizeof(JSClass));
|
||||
js_cocos2dx_websocket_class->name = "WebSocket";
|
||||
js_cocos2dx_websocket_class->addProperty = JS_PropertyStub;
|
||||
|
||||
@@ -129,14 +129,10 @@ ccui.TextField.prototype._ctor = function(placeholder, fontName, fontSize){
|
||||
|
||||
ccui.RichElementText.prototype._ctor = function(tag, color, opacity, text, fontName, fontSize, flags, url)
|
||||
{
|
||||
if(fontName == undefined)
|
||||
fontName = "Helvetica";
|
||||
if(text == undefined)
|
||||
text = "";
|
||||
if (flags == undefined)
|
||||
flags = 0;
|
||||
if (url == undefined)
|
||||
url = "";
|
||||
fontName = fontName || '';
|
||||
text = text || '';
|
||||
flags = flags || 0;
|
||||
url = url || '';
|
||||
|
||||
fontSize !== undefined && this.init(tag, color, opacity, text, fontName, fontSize, flags, url);
|
||||
};
|
||||
@@ -153,7 +149,8 @@ if (ccui.WebView)
|
||||
{
|
||||
ccui.WebView.prototype._ctor = function(url){
|
||||
this.init();
|
||||
url !== undefined && this.loadURL(url);
|
||||
if(url)
|
||||
this.loadURL(url);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -161,7 +158,8 @@ if (ccui.VideoPlayer)
|
||||
{
|
||||
ccui.VideoPlayer.prototype._ctor = function(url){
|
||||
this.init();
|
||||
url !== undefined && this.setURL(url);
|
||||
if(url)
|
||||
this.setURL(url);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -500,6 +500,19 @@ if (ccui.VideoPlayer)
|
||||
this["VideoPlayer_"+event] = callback;
|
||||
};
|
||||
}
|
||||
|
||||
ccui.Text.prototype._setString = ccui.Text.prototype.setString;
|
||||
ccui.Text.prototype.setString = function(text)
|
||||
{
|
||||
var textType = typeof text;
|
||||
if(textType === 'string')
|
||||
this._setString(text);
|
||||
else if(textType === 'number')
|
||||
this._setString('' + text);
|
||||
else
|
||||
cc.log('ccui.Text.setString error: text is not string,is ' + (typeof text));
|
||||
};
|
||||
|
||||
/*
|
||||
* UIWidget temporary solution to addChild
|
||||
* addNode and addChild function should be merged in ccui.Widget
|
||||
|
||||
@@ -1306,7 +1306,7 @@ cc._initSys = function(config, CONFIG_KEY){
|
||||
str += "os : " + self.os + "\r\n";
|
||||
str += "platform : " + self.platform + "\r\n";
|
||||
cc.log(str);
|
||||
}
|
||||
};
|
||||
|
||||
platform = locSys.platform;
|
||||
locSys.isMobile = ( platform === locSys.ANDROID ||
|
||||
@@ -1410,9 +1410,9 @@ cc._initDebugSetting = function (mode) {
|
||||
//+++++++++++++++++++++++++something about CCGame begin+++++++++++++++++++++++++++
|
||||
|
||||
/**
|
||||
* @type {Object}
|
||||
* @name cc.game
|
||||
* An object to boot the game.
|
||||
* @class
|
||||
* @name cc.game
|
||||
*/
|
||||
cc.game = {
|
||||
DEBUG_MODE_NONE : 0,
|
||||
@@ -1446,7 +1446,7 @@ cc.game = {
|
||||
|
||||
_prepareCalled : false,//whether the prepare function has been called
|
||||
_prepared : false,//whether the engine has prepared
|
||||
_paused : true,//whether the game is paused
|
||||
_paused : false,//whether the game is paused
|
||||
|
||||
_intervalId : null,//interval target of main
|
||||
|
||||
|
||||
@@ -1661,7 +1661,7 @@ cc.visibleRect.init();
|
||||
// Predefined font definition
|
||||
cc.FontDefinition = function () {
|
||||
this.fontName = "Arial";
|
||||
this.fontSize = 12;
|
||||
this.fontSize = 18;
|
||||
this.textAlign = cc.TEXT_ALIGNMENT_CENTER;
|
||||
this.verticalAlign = cc.VERTICAL_TEXT_ALIGNMENT_TOP;
|
||||
this.fillStyle = cc.color(255, 255, 255, 255);
|
||||
@@ -2963,6 +2963,15 @@ cc.GLProgram.prototype.setUniformLocationWithMatrix4fv = function(){
|
||||
this.setUniformLocationWithMatrixfvUnion.apply(this, tempArray);
|
||||
}
|
||||
|
||||
cc.Node.prototype._setPositionX = cc.Node.prototype.setPositionX;
|
||||
cc.Node.prototype.setPositionX = function(posX)
|
||||
{
|
||||
if (typeof posX === 'number') {
|
||||
this._setPositionX(posX);
|
||||
}
|
||||
else
|
||||
cc.log('cc.Node.setPositionX error:value is not number');
|
||||
};
|
||||
|
||||
//
|
||||
// Script Component
|
||||
|
||||
@@ -235,32 +235,33 @@ _p._ctor = function(normalImage, selectedImage, three, four, five) {
|
||||
callback = null,
|
||||
target = null;
|
||||
|
||||
if (normalImage === undefined) {
|
||||
if (!normalImage) {
|
||||
//undefined || null || ''
|
||||
cc.MenuItemImage.prototype.init.call(this);
|
||||
}
|
||||
else {
|
||||
if (four === undefined) {
|
||||
callback = three;
|
||||
}
|
||||
else if (five === undefined) {
|
||||
if (typeof three === 'function') {
|
||||
callback = three;
|
||||
target = four;
|
||||
}
|
||||
else {
|
||||
disabledImage = three;
|
||||
callback = four;
|
||||
var imageIndex = 0;
|
||||
var imageArray = new Array();
|
||||
for (var i = 0; i < arguments.length && i < 5; ++i) {
|
||||
if(typeof arguments[i] === 'function')
|
||||
callback = arguments[i];
|
||||
else if (typeof arguments[i] === 'object')
|
||||
target = arguments[i];
|
||||
else if (typeof arguments[i] === 'string')
|
||||
{
|
||||
imageArray[imageIndex] = arguments[i];
|
||||
imageIndex += 1;
|
||||
}
|
||||
}
|
||||
else if (five) {
|
||||
disabledImage = three;
|
||||
callback = four;
|
||||
target = five;
|
||||
}
|
||||
callback = callback ? callback.bind(target) : null;
|
||||
|
||||
if(!callback)
|
||||
callback = null;
|
||||
else if(callback && target)
|
||||
callback = callback.bind(target);
|
||||
|
||||
var normalSprite = new cc.Sprite(normalImage);
|
||||
var selectedSprite = new cc.Sprite(selectedImage);
|
||||
var disabledSprite = disabledImage ? new cc.Sprite(disabledImage) : new cc.Sprite(normalImage);
|
||||
var selectedSprite = imageArray[1] ? new cc.Sprite(imageArray[1]) : new cc.Sprite(normalImage);
|
||||
var disabledSprite = imageArray[2] ? new cc.Sprite(imageArray[2]) : new cc.Sprite(normalImage);
|
||||
this.initWithNormalSprite(normalSprite, selectedSprite, disabledSprite, callback);
|
||||
}
|
||||
};
|
||||
@@ -813,7 +814,8 @@ cc.LabelTTF.prototype._ctor = function(text, fontName, fontSize, dimensions, hAl
|
||||
}
|
||||
else {
|
||||
fontName = fontName || '';
|
||||
fontSize = fontSize || 16;
|
||||
if(!fontSize)
|
||||
fontSize = 16;
|
||||
dimensions = dimensions || cc.size(0,0);
|
||||
hAlignment = hAlignment ? hAlignment : cc.TEXT_ALIGNMENT_LEFT;
|
||||
vAlignment = vAlignment ? vAlignment : cc.VERTICAL_TEXT_ALIGNMENT_TOP;
|
||||
|
||||
@@ -149,7 +149,8 @@
|
||||
frame.setAnchorPoint(cc.p(anchorx, anchory));
|
||||
return frame;
|
||||
}
|
||||
},{
|
||||
},
|
||||
{
|
||||
name: "AnchorPoint",
|
||||
handle: function(options){
|
||||
var frame = new ccs.AnchorPointFrame();
|
||||
@@ -158,7 +159,8 @@
|
||||
frame.setAnchorPoint(cc.p(anchorx, anchory));
|
||||
return frame;
|
||||
}
|
||||
},{
|
||||
},
|
||||
{
|
||||
name: "InnerAction",
|
||||
handle: function(options){
|
||||
var frame = new ccs.InnerActionFrame();
|
||||
@@ -197,7 +199,7 @@
|
||||
var frame, texture, plist, path, spriteFrame;
|
||||
frame = new ccs.TextureFrame();
|
||||
texture = options["TextureFile"];
|
||||
if(texture != null) {
|
||||
if(texture) {
|
||||
plist = texture["Plist"];
|
||||
path = texture["Path"];
|
||||
spriteFrame = cc.spriteFrameCache.getSpriteFrame(path);
|
||||
|
||||
@@ -42,8 +42,12 @@
|
||||
*/
|
||||
widgetFromJsonFile: function(file){
|
||||
var json = cc.loader.getRes(cc.path.join(cc.loader.resPath, file));
|
||||
if(json)
|
||||
if(json) {
|
||||
this._fileDesignSizes[file] = cc.size(json["designWidth"]||0, json["designHeight"]||0);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
|
||||
var version = json["Version"] || json["version"];
|
||||
var versionNum = ccs.uiReader.getVersionInteger(version);
|
||||
|
||||
@@ -167,7 +167,7 @@
|
||||
var filePath = options["fileName"];
|
||||
|
||||
var node;
|
||||
if (filePath && "" !== filePath){
|
||||
if (filePath){
|
||||
node = this.createNode(filePath);
|
||||
}else{
|
||||
node = new ccs.Node();
|
||||
@@ -219,9 +219,9 @@
|
||||
var path = options["resourcePath"];
|
||||
|
||||
var tmx = null;
|
||||
if (tmxFile && "" !== tmxFile){
|
||||
if (tmxFile){
|
||||
tmx = new cc.TMXTiledMap(tmxFile);
|
||||
}else if (tmxString && "" !== tmxString && path && "" !== path){
|
||||
}else if (tmxString && path){
|
||||
tmx = new cc.TMXTiledMap(tmxString, path);
|
||||
}
|
||||
return tmx;
|
||||
|
||||
@@ -42,8 +42,9 @@
|
||||
|
||||
getNodeJson: function(json){
|
||||
var content = json["Content"];
|
||||
if(content["ObjectData"])
|
||||
return content["ObjectData"];
|
||||
var ObjectData = content["ObjectData"];
|
||||
if(ObjectData !== undefined && ObjectData !== null)
|
||||
return ObjectData;
|
||||
|
||||
return content["Content"]["ObjectData"];
|
||||
},
|
||||
@@ -57,7 +58,7 @@
|
||||
|
||||
|
||||
var getParam = function(value, dValue){
|
||||
if(value === undefined)
|
||||
if(value === undefined || value === null)
|
||||
return dValue;
|
||||
else
|
||||
return value;
|
||||
@@ -84,28 +85,26 @@
|
||||
}
|
||||
|
||||
var rotationSkewX = json["RotationSkewX"];
|
||||
if (cc.isValidValue(rotationSkewX))
|
||||
if (rotationSkewX)
|
||||
node.setRotationX(rotationSkewX);
|
||||
|
||||
var rotationSkewY = json["RotationSkewY"];
|
||||
if (cc.isValidValue(rotationSkewY))
|
||||
if (rotationSkewY)
|
||||
node.setRotationY(rotationSkewY);
|
||||
|
||||
var anchor = json["AnchorPoint"];
|
||||
if(anchor){
|
||||
if(anchor["ScaleX"] == null)
|
||||
anchor["ScaleX"] = 0;
|
||||
if(anchor["ScaleY"] == null)
|
||||
anchor["ScaleY"] = 0;
|
||||
if(anchor["ScaleX"] != 0.5 || anchor["ScaleY"] != 0.5)
|
||||
node.setAnchorPoint(cc.p(anchor["ScaleX"] || 0, anchor["ScaleY"] || 0));
|
||||
var anchorX = anchor["ScaleX"] || 0;
|
||||
var anchorY = anchor["ScaleY"] || 0;
|
||||
node.setAnchorPoint(cc.p(anchorX, anchorY));
|
||||
}
|
||||
|
||||
if (cc.isValidValue(json["ZOrder"]))
|
||||
if (json["ZOrder"])
|
||||
node.setLocalZOrder(json["ZOrder"]);
|
||||
|
||||
var visible = getParam(json["VisibleForFrame"], true);
|
||||
node.setVisible(visible);
|
||||
var visible = json["VisibleForFrame"];
|
||||
if(cc.isValidValue(visible))
|
||||
node.setVisible(visible);
|
||||
|
||||
var size = json["Size"];
|
||||
if(size)
|
||||
@@ -119,7 +118,7 @@
|
||||
var actionTag = json["ActionTag"] || 0;
|
||||
var extensionData = new ccs.ComExtensionData();
|
||||
var customProperty = json["UserData"];
|
||||
if(customProperty !== undefined)
|
||||
if(customProperty !== undefined && customProperty !== null)
|
||||
extensionData.setCustomProperty(customProperty);
|
||||
extensionData.setActionTag(actionTag);
|
||||
if (node.getComponent("ComExtensionData"))
|
||||
@@ -282,7 +281,6 @@
|
||||
if (rotationSkewY)
|
||||
widget.setRotationY(rotationSkewY);
|
||||
|
||||
//var rotation = json["Rotation"];
|
||||
|
||||
var flipX = json["FlipX"];
|
||||
if (flipX)
|
||||
@@ -293,16 +291,14 @@
|
||||
widget.setFlippedY(true);
|
||||
|
||||
var zOrder = json["zOrder"];
|
||||
if (cc.isValidValue(zOrder))
|
||||
if (zOrder)
|
||||
widget.setLocalZOrder(zOrder);
|
||||
|
||||
//var visible = json["Visible"];
|
||||
|
||||
var visible = getParam(json["VisibleForFrame"], true);
|
||||
widget.setVisible(visible);
|
||||
|
||||
var alpha = json["Alpha"];
|
||||
if (cc.isValidValue(alpha))
|
||||
if (cc.isValidValue(alpha) && alpha !== 255)
|
||||
widget.setOpacity(alpha);
|
||||
|
||||
widget.setTag(json["Tag"] || 0);
|
||||
@@ -310,8 +306,6 @@
|
||||
var touchEnabled = json["TouchEnable"] || false;
|
||||
widget.setTouchEnabled(touchEnabled);
|
||||
|
||||
// -- var frameEvent = json["FrameEvent"];
|
||||
|
||||
var callBackType = json["CallBackType"];
|
||||
if (cc.isValidValue(callBackType))
|
||||
widget.setCallbackType(callBackType);
|
||||
@@ -361,13 +355,12 @@
|
||||
};
|
||||
|
||||
var setLayoutComponent = function(widget, json){
|
||||
|
||||
var layoutComponent = ccui.LayoutComponent.bindLayoutComponent(widget);
|
||||
if(!layoutComponent)
|
||||
return;
|
||||
|
||||
var positionXPercentEnabled = json["PositionPercentXEnable"] || json["PositionPercentXEnabled"] || false;
|
||||
var positionYPercentEnabled = json["PositionPercentYEnable"] || json["PositionPercentYEnabled"] || false;
|
||||
var positionXPercentEnabled = json["PositionPercentXEnable"]|| false;
|
||||
var positionYPercentEnabled = json["PositionPercentYEnable"] || false;
|
||||
var positionXPercent = 0,
|
||||
positionYPercent = 0,
|
||||
PrePosition = json["PrePosition"];
|
||||
@@ -375,19 +368,19 @@
|
||||
positionXPercent = PrePosition["X"] || 0;
|
||||
positionYPercent = PrePosition["Y"] || 0;
|
||||
}
|
||||
var sizeXPercentEnable = json["PercentWidthEnable"] || json["PercentWidthEnabled"] || false;
|
||||
var sizeYPercentEnable = json["PercentHeightEnable"]|| json["PercentHeightEnabled"] || false;
|
||||
var sizeXPercentEnable = json["PercentWidthEnable"] || false;
|
||||
var sizeYPercentEnable = json["PercentHeightEnable"] || false;
|
||||
var sizeXPercent = 0,
|
||||
sizeYPercent = 0,
|
||||
PreSize = json["PreSize"];
|
||||
if (PrePosition) {
|
||||
if (PreSize) {
|
||||
sizeXPercent = PreSize["X"] || 0;
|
||||
sizeYPercent = PreSize["Y"] || 0;
|
||||
}
|
||||
var stretchHorizontalEnabled = json["StretchWidthEnable"] || false;
|
||||
var stretchVerticalEnabled = json["StretchHeightEnable"] || false;
|
||||
var horizontalEdge = json["HorizontalEdge"];// = ccui.LayoutComponent.horizontalEdge.LEFT;
|
||||
var verticalEdge = json["VerticalEdge"]; // = ccui.LayoutComponent.verticalEdge.TOP;
|
||||
var horizontalEdge = json["HorizontalEdge"];
|
||||
var verticalEdge = json["VerticalEdge"];
|
||||
var leftMargin = json["LeftMargin"] || 0;
|
||||
var rightMargin = json["RightMargin"] || 0;
|
||||
var topMargin = json["TopMargin"] || 0;
|
||||
@@ -401,7 +394,6 @@
|
||||
layoutComponent.setPercentHeightEnabled(sizeYPercentEnable);
|
||||
layoutComponent.setPercentWidth(sizeXPercent);
|
||||
layoutComponent.setPercentHeight(sizeYPercent);
|
||||
layoutComponent.setPercentWidthEnabled(sizeXPercentEnable || sizeYPercentEnable);
|
||||
layoutComponent.setStretchWidthEnabled(stretchHorizontalEnabled);
|
||||
layoutComponent.setStretchHeightEnabled(stretchVerticalEnabled);
|
||||
|
||||
@@ -425,26 +417,20 @@
|
||||
}
|
||||
layoutComponent.setVerticalEdge(verticalEdgeType);
|
||||
|
||||
layoutComponent.setTopMargin(topMargin);
|
||||
layoutComponent.setBottomMargin(bottomMargin);
|
||||
layoutComponent.setLeftMargin(leftMargin);
|
||||
layoutComponent.setRightMargin(rightMargin);
|
||||
|
||||
layoutComponent.setVerticalEdge(verticalEdgeType);
|
||||
|
||||
layoutComponent.setTopMargin(topMargin);
|
||||
layoutComponent.setBottomMargin(bottomMargin);
|
||||
layoutComponent.setLeftMargin(leftMargin);
|
||||
layoutComponent.setRightMargin(rightMargin);
|
||||
if(topMargin !== 0)
|
||||
layoutComponent.setTopMargin(topMargin);
|
||||
if(bottomMargin !== 0)
|
||||
layoutComponent.setBottomMargin(bottomMargin);
|
||||
if(leftMargin !== 0)
|
||||
layoutComponent.setLeftMargin(leftMargin);
|
||||
if(rightMargin !== 0)
|
||||
layoutComponent.setRightMargin(rightMargin);
|
||||
};
|
||||
|
||||
var setLayoutBackground = function(layout, single, first, end){
|
||||
if( layout.getBackGroundColorType() === 2 ){
|
||||
first = first || {};
|
||||
end = end || {};
|
||||
layout.setBackGroundColor(getColor(first), getColor(end));
|
||||
}else{
|
||||
single = single || {};
|
||||
layout.setBackGroundColor(getColor(single));
|
||||
}
|
||||
};
|
||||
@@ -463,31 +449,30 @@
|
||||
*/
|
||||
parser.initPanel = function(json, resourcePath){
|
||||
var widget = new ccui.Layout();
|
||||
|
||||
this.widgetAttributes(widget, json);
|
||||
|
||||
var clipEnabled = json["ClipAble"] || false;
|
||||
if(clipEnabled != null)
|
||||
if(clipEnabled)
|
||||
widget.setClippingEnabled(clipEnabled);
|
||||
|
||||
var colorType = getParam(json["ComboBoxIndex"], 0);
|
||||
widget.setBackGroundColorType(colorType);
|
||||
var backGroundScale9Enabled = json["Scale9Enable"] || false;
|
||||
if(backGroundScale9Enabled)
|
||||
widget.setBackGroundImageScale9Enabled(true);
|
||||
|
||||
var bgColorType = getParam(json["ComboBoxIndex"], 0);
|
||||
if(bgColorType !== 0) {
|
||||
widget.setBackGroundColorType(bgColorType);
|
||||
}
|
||||
setLayoutBackgroundVector(widget, json["ColorVector"]);
|
||||
setLayoutBackground(widget, json["SingleColor"], json["FirstColor"], json["EndColor"]);
|
||||
var bgColorOpacity = getParam(json["BackColorAlpha"], 255);
|
||||
if(bgColorOpacity != null)
|
||||
if(bgColorOpacity !== 255)
|
||||
widget.setBackGroundColorOpacity(bgColorOpacity);
|
||||
|
||||
var backGroundScale9Enabled = json["Scale9Enable"];
|
||||
if(backGroundScale9Enabled != null)
|
||||
widget.setBackGroundImageScale9Enabled(backGroundScale9Enabled);
|
||||
|
||||
var opacity = getParam(json["Alpha"], 255);
|
||||
widget.setOpacity(opacity);
|
||||
|
||||
loadTexture(json["FileData"], resourcePath, function(path, type){
|
||||
loadTexture(json["FileData"], resourcePath, function(path, type) {
|
||||
widget.setBackGroundImage(path, type);
|
||||
});
|
||||
|
||||
|
||||
if(backGroundScale9Enabled){
|
||||
var scale9OriginX = json["Scale9OriginX"] || 0;
|
||||
var scale9OriginY = json["Scale9OriginY"] || 0;
|
||||
@@ -498,18 +483,8 @@
|
||||
widget.setBackGroundImageCapInsets(cc.rect(
|
||||
scale9OriginX, scale9OriginY, scale9Width, scale9Height
|
||||
));
|
||||
|
||||
setContentSize(widget, json["Size"]);
|
||||
}else{
|
||||
if (!widget.isIgnoreContentAdaptWithSize()){
|
||||
setContentSize(widget, json["Size"]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
setLayoutBackground(widget, json["SingleColor"], json["FirstColor"], json["EndColor"]);
|
||||
setLayoutBackgroundVector(widget, json["ColorVector"]);
|
||||
|
||||
return widget;
|
||||
};
|
||||
|
||||
@@ -519,7 +494,6 @@
|
||||
* @param resourcePath
|
||||
*/
|
||||
parser.initText = function(json, resourcePath){
|
||||
|
||||
var widget = new ccui.Text();
|
||||
|
||||
var touchScaleEnabled = json["TouchScaleChangeAble"];
|
||||
@@ -527,15 +501,15 @@
|
||||
widget.setTouchScaleChangeEnabled(touchScaleEnabled);
|
||||
|
||||
var text = json["LabelText"];
|
||||
if(text != null)
|
||||
if(text)
|
||||
widget.setString(text);
|
||||
|
||||
var fontSize = json["FontSize"];
|
||||
if(fontSize != null)
|
||||
if(typeof fontSize === 'number')
|
||||
widget.setFontSize(fontSize);
|
||||
|
||||
var fontName = json["FontName"];
|
||||
if(fontName && '' !== fontName)
|
||||
if(fontName)
|
||||
widget.setFontName(fontName);
|
||||
|
||||
var areaWidth = json["AreaWidth"];
|
||||
@@ -570,7 +544,6 @@
|
||||
var fontResource = json["FontResource"];
|
||||
if(fontResource != null){
|
||||
var path = fontResource["Path"];
|
||||
//resoutceType = fontResource["Type"];
|
||||
if(path){
|
||||
if (cc.sys.isNative) {
|
||||
fontName = cc.path.join(cc.loader.resPath, resourcePath, path);
|
||||
@@ -604,7 +577,6 @@
|
||||
this.widgetAttributes(widget, json, widget.isIgnoreContentAdaptWithSize());
|
||||
json["CColor"] = color;
|
||||
return widget;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -613,7 +585,6 @@
|
||||
* @param resourcePath
|
||||
*/
|
||||
parser.initButton = function(json, resourcePath){
|
||||
|
||||
var widget = new ccui.Button();
|
||||
|
||||
loadTexture(json["NormalFileData"], resourcePath, function(path, type){
|
||||
@@ -640,7 +611,7 @@
|
||||
widget.setTitleFontSize(fontSize);
|
||||
|
||||
var fontName = json["FontName"];
|
||||
if(fontName && '' !== fontName)
|
||||
if(fontName)
|
||||
widget.setTitleFontName(fontName);
|
||||
|
||||
var textColor = json["TextColor"];
|
||||
@@ -654,7 +625,6 @@
|
||||
var fontResource = json["FontResource"];
|
||||
if(fontResource != null){
|
||||
var path = fontResource["Path"];
|
||||
//resoutceType = fontResource["Type"];
|
||||
if(path){
|
||||
if (cc.sys.isNative) {
|
||||
fontName = cc.path.join(cc.loader.resPath, resourcePath, path);
|
||||
@@ -671,7 +641,7 @@
|
||||
label.enableShadow(
|
||||
getColor(json["ShadowColor"]),
|
||||
cc.size(getParam(json["ShadowOffsetX"], 2), getParam(json["ShadowOffsetY"], -2)),
|
||||
json["ShadowBlurRadius"] || 0
|
||||
0
|
||||
);
|
||||
}
|
||||
if(label && json["OutlineEnabled"] && json["OutlineColor"] && label.enableStroke)
|
||||
@@ -689,13 +659,11 @@
|
||||
json["Scale9Height"] || 0
|
||||
);
|
||||
widget.setCapInsets(capInsets);
|
||||
|
||||
}
|
||||
|
||||
setContentSize(widget, json["Size"]);
|
||||
|
||||
return widget;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -704,7 +672,6 @@
|
||||
* @param resourcePath
|
||||
*/
|
||||
parser.initCheckBox = function(json, resourcePath){
|
||||
|
||||
var widget = new ccui.CheckBox();
|
||||
|
||||
this.widgetAttributes(widget, json);
|
||||
@@ -761,7 +728,6 @@
|
||||
if(backGroundScale9Enabled){
|
||||
widget.setBackGroundImageScale9Enabled(true);
|
||||
|
||||
|
||||
var scale9OriginX = json["Scale9OriginX"] || 0;
|
||||
var scale9OriginY = json["Scale9OriginY"] || 0;
|
||||
var scale9Width = json["Scale9Width"] || 0;
|
||||
@@ -802,7 +768,6 @@
|
||||
* @param resourcePath
|
||||
*/
|
||||
parser.initImageView = function(json, resourcePath){
|
||||
|
||||
var widget = new ccui.ImageView();
|
||||
|
||||
loadTexture(json["FileData"], resourcePath, function(path, type){
|
||||
@@ -828,7 +793,8 @@
|
||||
scale9Width,
|
||||
scale9Height
|
||||
));
|
||||
} else
|
||||
}
|
||||
else
|
||||
setContentSize(widget, json["Size"]);
|
||||
|
||||
this.widgetAttributes(widget, json);
|
||||
@@ -843,7 +809,6 @@
|
||||
* @returns {ccui.LoadingBar}
|
||||
*/
|
||||
parser.initLoadingBar = function(json, resourcePath){
|
||||
|
||||
var widget = new ccui.LoadingBar();
|
||||
|
||||
this.widgetAttributes(widget, json);
|
||||
@@ -860,7 +825,6 @@
|
||||
widget.setPercent(percent);
|
||||
|
||||
return widget;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -869,7 +833,6 @@
|
||||
* @param resourcePath
|
||||
*/
|
||||
parser.initSlider = function(json, resourcePath){
|
||||
|
||||
var widget = new ccui.Slider();
|
||||
var loader = cc.loader;
|
||||
|
||||
@@ -904,7 +867,6 @@
|
||||
* @param resourcePath
|
||||
*/
|
||||
parser.initPageView = function(json, resourcePath){
|
||||
|
||||
var widget = new ccui.PageView();
|
||||
|
||||
this.widgetAttributes(widget, json);
|
||||
@@ -945,7 +907,6 @@
|
||||
setContentSize(widget, json["Size"]);
|
||||
|
||||
return widget;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -955,7 +916,6 @@
|
||||
* @returns {ccui.ListView}
|
||||
*/
|
||||
parser.initListView = function(json, resourcePath){
|
||||
|
||||
var widget = new ccui.ListView();
|
||||
|
||||
this.widgetAttributes(widget, json);
|
||||
@@ -971,6 +931,9 @@
|
||||
widget.setBackGroundColorType(colorType);
|
||||
|
||||
var bgColorOpacity = getParam(json["BackColorAlpha"], 255);
|
||||
if(bgColorOpacity !== 255)
|
||||
widget.setBackGroundColorOpacity(bgColorOpacity);
|
||||
|
||||
var backGroundScale9Enabled = json["Scale9Enable"];
|
||||
if(backGroundScale9Enabled){
|
||||
widget.setBackGroundImageScale9Enabled(true);
|
||||
@@ -1008,7 +971,6 @@
|
||||
widget.setGravity(ccui.ListView.GRAVITY_CENTER_HORIZONTAL);
|
||||
}
|
||||
|
||||
|
||||
var bounceEnabled = getParam(json["IsBounceEnabled"], false);
|
||||
widget.setBounceEnabled(bounceEnabled);
|
||||
|
||||
@@ -1017,15 +979,12 @@
|
||||
|
||||
var innerSize = json["InnerNodeSize"];
|
||||
//Width
|
||||
if(innerSize != null)
|
||||
if(innerSize)
|
||||
widget.setInnerContainerSize(cc.size(innerSize["Widget"]||0, innerSize["Height"]||0));
|
||||
|
||||
setLayoutBackground(widget, json["SingleColor"], json["FirstColor"], json["EndColor"]);
|
||||
setLayoutBackgroundVector(widget, json["ColorVector"]);
|
||||
|
||||
if(bgColorOpacity != null)
|
||||
widget.setBackGroundColorOpacity(bgColorOpacity);
|
||||
|
||||
setContentSize(widget, json["Size"]);
|
||||
|
||||
return widget;
|
||||
@@ -1038,7 +997,6 @@
|
||||
* @returns {ccui.TextAtlas}
|
||||
*/
|
||||
parser.initTextAtlas = function(json, resourcePath){
|
||||
|
||||
var widget = new ccui.TextAtlas();
|
||||
|
||||
var stringValue = json["LabelText"];
|
||||
@@ -1064,12 +1022,12 @@
|
||||
* @returns {ccui.TextBMFont}
|
||||
*/
|
||||
parser.initTextBMFont = function(json, resourcePath){
|
||||
|
||||
var widget = new ccui.TextBMFont();
|
||||
this.widgetAttributes(widget, json);
|
||||
|
||||
var text = json["LabelText"];
|
||||
widget.setString(text);
|
||||
if(text)
|
||||
widget.setString(text);
|
||||
|
||||
loadTexture(json["LabelBMFontFile_CNB"], resourcePath, function(path, type){
|
||||
widget.setFntFile(path);
|
||||
@@ -1095,15 +1053,15 @@
|
||||
}
|
||||
|
||||
var placeHolder = json["PlaceHolderText"];
|
||||
if(placeHolder != null)
|
||||
if(placeHolder)
|
||||
widget.setPlaceHolder(placeHolder);
|
||||
|
||||
var fontSize = json["FontSize"];
|
||||
if(fontSize != null)
|
||||
if(typeof fontSize === 'number')
|
||||
widget.setFontSize(fontSize);
|
||||
|
||||
var fontName = json["FontName"];
|
||||
if(fontName && '' !== fontName)
|
||||
if(fontName)
|
||||
widget.setFontName(fontName);
|
||||
|
||||
var maxLengthEnabled = json["MaxLengthEnable"];
|
||||
@@ -1117,13 +1075,12 @@
|
||||
this.widgetAttributes(widget, json);
|
||||
|
||||
var text = json["LabelText"];
|
||||
if(text != null)
|
||||
if(text)
|
||||
widget.setString(text);
|
||||
|
||||
var fontResource = json["FontResource"];
|
||||
if(fontResource != null){
|
||||
if(fontResource){
|
||||
var path = fontResource["Path"];
|
||||
//resoutceType = fontResource["Type"];
|
||||
if(path){
|
||||
if (cc.sys.isNative) {
|
||||
fontName = cc.path.join(cc.loader.resPath, resourcePath, path);
|
||||
@@ -1148,9 +1105,7 @@
|
||||
widget.getVirtualRenderer().setLineBreakWithoutSpace(true);
|
||||
}
|
||||
|
||||
|
||||
return widget;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1159,7 +1114,6 @@
|
||||
* @param resourcePath
|
||||
*/
|
||||
parser.initSimpleAudio = function(json, resourcePath){
|
||||
|
||||
var node = new ccs.ComAudio();
|
||||
var loop = json["Loop"] || false;
|
||||
//var volume = json["Volume"] || 0;
|
||||
@@ -1168,7 +1122,6 @@
|
||||
loadTexture(json["FileData"], resourcePath, function(path, type){
|
||||
node.setFile(path);
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1178,7 +1131,6 @@
|
||||
* @returns {*}
|
||||
*/
|
||||
parser.initGameMap = function(json, resourcePath){
|
||||
|
||||
var node = null;
|
||||
|
||||
loadTexture(json["FileData"], resourcePath, function(path, type){
|
||||
@@ -1199,7 +1151,7 @@
|
||||
*/
|
||||
parser.initProjectNode = function(json, resourcePath){
|
||||
var projectFile = json["FileData"];
|
||||
if(projectFile != null && projectFile["Path"]){
|
||||
if(projectFile && projectFile["Path"]){
|
||||
var file = resourcePath + projectFile["Path"];
|
||||
if(cc.loader.getRes(file)){
|
||||
var obj = ccs.load(file, resourcePath);
|
||||
@@ -1259,7 +1211,6 @@
|
||||
node.getAnimation().play(currentAnimationName);
|
||||
node.getAnimation().gotoAndPause(0);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
parser.generalAttributes(node, json);
|
||||
@@ -1296,7 +1247,7 @@
|
||||
|
||||
var loadedPlist = {};
|
||||
var loadTexture = function(json, resourcePath, cb){
|
||||
if(json != null){
|
||||
if(json !== undefined && json !== null){
|
||||
var path = json["Path"];
|
||||
var type;
|
||||
if(json["Type"] === "Default" || json["Type"] === "Normal")
|
||||
@@ -1321,7 +1272,7 @@
|
||||
}
|
||||
else {
|
||||
var filePath = resourcePath + path;
|
||||
if(path && "" !== path && jsb.fileUtils.isFileExist(filePath))
|
||||
if(path && jsb.fileUtils.isFileExist(filePath))
|
||||
cb(filePath, type);
|
||||
else
|
||||
cb("", type);
|
||||
@@ -1330,11 +1281,14 @@
|
||||
};
|
||||
|
||||
var getColor = function(json){
|
||||
if(!json) return;
|
||||
if(json === undefined || json === null)
|
||||
return cc.color(255,255,255,255);
|
||||
|
||||
var r = cc.isValidValue(json["R"]) ? json["R"] : 255;
|
||||
var g = cc.isValidValue(json["G"]) ? json["G"] : 255;
|
||||
var b = cc.isValidValue(json["B"]) ? json["B"] : 255;
|
||||
var a = cc.isValidValue(json["A"]) ? json["A"] : 255;
|
||||
|
||||
return cc.color(r, g, b, a);
|
||||
};
|
||||
|
||||
|
||||
@@ -98,14 +98,14 @@
|
||||
widget.setScaleY(scaleY);
|
||||
|
||||
var rotation = options["rotation"];
|
||||
if(cc.isValidValue(rotation) && rotation !== 0)
|
||||
if(rotation)
|
||||
widget.setRotation(rotation);
|
||||
|
||||
if(options["visible"] === false)
|
||||
widget.setVisible(false);
|
||||
|
||||
var ZOrder = options["ZOrder"];
|
||||
if(cc.isValidValue(ZOrder) && ZOrder !== 0)
|
||||
if(ZOrder)
|
||||
widget.setLocalZOrder(ZOrder);
|
||||
|
||||
var layout = options["layoutParameter"];
|
||||
@@ -302,7 +302,7 @@
|
||||
var sw = options["scale9Width"];
|
||||
var sh = options["scale9Height"];
|
||||
if (cc.isValidValue(sw) && cc.isValidValue(sh))
|
||||
button.setSize(cc.size(sw, sh));
|
||||
button.setContentSize(cc.size(sw, sh));
|
||||
}
|
||||
var text = options["text"];
|
||||
if (text)
|
||||
@@ -389,7 +389,7 @@
|
||||
var sw = options["scale9Width"];
|
||||
var sh = options["scale9Height"];
|
||||
if (cc.isValidValue(sw) && cc.isValidValue(sh)) {
|
||||
widget.setSize(cc.size(sw, sh));
|
||||
widget.setContentSize(cc.size(sw, sh));
|
||||
}
|
||||
|
||||
var cx = options["capInsetsX"];
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2013-2016 zilongshanren
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <AppKit/AppKit.h>
|
||||
#include "ui/UIEditBox/UIEditBoxImpl-mac.h"
|
||||
#include "ui/UIEditBox/Mac/CCUITextInput.h"
|
||||
|
||||
#pragma mark - UIEditBox mac implementation
|
||||
|
||||
@class NSFont;
|
||||
|
||||
@interface UIEditBoxImplMac : NSObject <NSTextFieldDelegate, NSTextViewDelegate>
|
||||
{
|
||||
BOOL _editState;
|
||||
NSView<CCUITextInput> * _textInput;
|
||||
void * _editBox;
|
||||
}
|
||||
|
||||
@property (nonatomic, retain) NSView<CCUITextInput> *textInput;
|
||||
@property (nonatomic, readonly) NSWindow *window;
|
||||
|
||||
@property (nonatomic, readonly, getter = isEditState) BOOL editState;
|
||||
@property (nonatomic, assign) void *editBox;
|
||||
@property (nonatomic, assign) NSString *text;
|
||||
@property (nonatomic, assign) NSRect frameRect;
|
||||
@property (nonatomic, assign) cocos2d::ui::EditBox::InputFlag dataInputMode;
|
||||
@property (nonatomic, assign) cocos2d::ui::EditBox::KeyboardReturnType keyboardReturnType;
|
||||
|
||||
- (instancetype)initWithFrame:(NSRect)frameRect editBox:(void *)editBox;
|
||||
- (void)setMaxLength:(int)maxLength;
|
||||
- (void)updateFrame:(CGRect)rect;
|
||||
|
||||
- (void)openKeyboard;
|
||||
- (void)closeKeyboard;
|
||||
|
||||
- (NSString *)getDefaultFontName;
|
||||
|
||||
- (void)setInputMode:(cocos2d::ui::EditBox::InputMode)inputMode;
|
||||
- (void)setInputFlag:(cocos2d::ui::EditBox::InputFlag)inputFlag;
|
||||
- (void)setReturnType:(cocos2d::ui::EditBox::KeyboardReturnType)returnType;
|
||||
|
||||
- (void)setPlaceHolder:(const char *)text;
|
||||
- (void)setVisible:(BOOL)visible;
|
||||
- (void)setTextColor:(NSColor*)color;
|
||||
- (void)setFont:(NSFont *)font;
|
||||
- (void)setPlaceholderFontColor:(NSColor*)color;
|
||||
- (void)setPlaceholderFont:(NSFont*)font;
|
||||
@end
|
||||
@@ -0,0 +1,339 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2013-2016 zilongshanren
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#import "ui/UIEditBox/Mac/CCUIEditBoxMac.h"
|
||||
#include "base/CCDirector.h"
|
||||
#include "ui/UIEditBox/Mac/CCUISingleLineTextField.h"
|
||||
#include "ui/UIEditBox/Mac/CCUIPasswordTextField.h"
|
||||
#include "ui/UIEditBox/Mac/CCUIMultilineTextField.h"
|
||||
|
||||
#define getEditBoxImplMac() ((cocos2d::ui::EditBoxImplMac *)_editBox)
|
||||
|
||||
|
||||
@implementation UIEditBoxImplMac
|
||||
|
||||
- (instancetype)initWithFrame:(NSRect)frameRect editBox:(void *)editBox
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
if (self) {
|
||||
|
||||
_editState = NO;
|
||||
self.frameRect = frameRect;
|
||||
|
||||
self.editBox = editBox;
|
||||
self.dataInputMode = cocos2d::ui::EditBox::InputFlag::INITIAL_CAPS_ALL_CHARACTERS;
|
||||
self.keyboardReturnType = cocos2d::ui::EditBox::KeyboardReturnType::DEFAULT;
|
||||
|
||||
[self createMultiLineTextField];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)createSingleLineTextField
|
||||
{
|
||||
CCUISingleLineTextField *textField = [[[CCUISingleLineTextField alloc] initWithFrame:self.frameRect] autorelease];
|
||||
|
||||
self.textInput = textField;
|
||||
}
|
||||
|
||||
- (void)createMultiLineTextField
|
||||
{
|
||||
CCUIMultilineTextField *textView = [[[CCUIMultilineTextField alloc] initWithFrame:self.frameRect] autorelease];
|
||||
self.textInput = textView;
|
||||
}
|
||||
|
||||
- (void)createPasswordTextField
|
||||
{
|
||||
CCUIPasswordTextField *textField = [[[CCUIPasswordTextField alloc] initWithFrame:self.frameRect] autorelease];
|
||||
|
||||
self.textInput = textField;
|
||||
}
|
||||
|
||||
- (void)setTextInput:(NSView<CCUITextInput> *)textInput
|
||||
{
|
||||
if (_textInput == textInput) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Migrate properties
|
||||
textInput.ccui_textColor = _textInput.ccui_textColor ?: [NSColor whiteColor];
|
||||
textInput.ccui_text = _textInput.ccui_text ?: @"";
|
||||
textInput.ccui_placeholder = _textInput.ccui_placeholder ?: @"";
|
||||
textInput.ccui_font = _textInput.ccui_font ?: [NSFont systemFontOfSize:self.frameRect.size.height*3/2];
|
||||
textInput.ccui_maxLength = getEditBoxImplMac()->getMaxLength();
|
||||
|
||||
[_textInput removeFromSuperview];
|
||||
[_textInput release];
|
||||
|
||||
_textInput = [textInput retain];
|
||||
|
||||
[_textInput performSelector:@selector(setTextColor:) withObject:_textInput.ccui_textColor];
|
||||
[_textInput performSelector:@selector(setBackgroundColor:) withObject:[NSColor clearColor]];
|
||||
|
||||
if (![_textInput isKindOfClass:[NSTextView class]]) {
|
||||
[_textInput performSelector:@selector(setBordered:)
|
||||
withObject:[NSNumber numberWithBool:NO]];
|
||||
}
|
||||
_textInput.hidden = NO;
|
||||
_textInput.wantsLayer = YES;
|
||||
|
||||
[_textInput ccui_setDelegate:self];
|
||||
|
||||
[self setInputFlag:self.dataInputMode];
|
||||
[self setReturnType:self.keyboardReturnType];
|
||||
}
|
||||
|
||||
- (void)updateFrame:(CGRect)rect
|
||||
{
|
||||
NSRect frame = self.textInput.frame;
|
||||
frame.origin.x = rect.origin.x;
|
||||
frame.origin.y = rect.origin.y;
|
||||
frame.size.height = rect.size.height;
|
||||
frame.size.width = rect.size.width;
|
||||
|
||||
self.textInput.frame = frame;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
self.textInput = nil;
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSWindow *)window
|
||||
{
|
||||
auto glview = cocos2d::Director::getInstance()->getOpenGLView();
|
||||
return glview->getCocoaWindow();
|
||||
}
|
||||
|
||||
- (void)openKeyboard
|
||||
{
|
||||
[self.window.contentView addSubview:self.textInput];
|
||||
if (![self.textInput isKindOfClass:[NSTextView class]]) {
|
||||
[self.textInput becomeFirstResponder];
|
||||
}else {
|
||||
[self.window makeFirstResponder:self.textInput];
|
||||
}
|
||||
|
||||
auto editbox = getEditBoxImplMac()->getEditBox();
|
||||
auto oldPos = editbox->getPosition();
|
||||
editbox->setPosition(oldPos + cocos2d::Vec2(10,20));
|
||||
editbox->setPosition(oldPos);
|
||||
}
|
||||
|
||||
- (void)closeKeyboard
|
||||
{
|
||||
if (![self.textInput isKindOfClass:[NSTextView class]]) {
|
||||
[self.textInput resignFirstResponder];
|
||||
}
|
||||
|
||||
[self.textInput removeFromSuperview];
|
||||
}
|
||||
|
||||
|
||||
- (const char*) getText
|
||||
{
|
||||
return [self.textInput.ccui_text UTF8String];
|
||||
}
|
||||
|
||||
- (void)controlTextDidBeginEditing:(NSNotification *)notification
|
||||
{
|
||||
_editState = YES;
|
||||
|
||||
getEditBoxImplMac()->editBoxEditingDidBegin();
|
||||
}
|
||||
|
||||
- (void)controlTextDidEndEditing:(NSNotification *)notification
|
||||
{
|
||||
_editState = NO;
|
||||
|
||||
getEditBoxImplMac()->editBoxEditingDidEnd([self getText]);
|
||||
}
|
||||
|
||||
- (void)setMaxLength:(int)length
|
||||
{
|
||||
self.textInput.ccui_maxLength = length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called each time when the text field's text has changed.
|
||||
*/
|
||||
- (void)controlTextDidChange:(NSNotification *)notification
|
||||
{
|
||||
getEditBoxImplMac()->editBoxEditingChanged([self getText]);
|
||||
}
|
||||
|
||||
- (NSString *)getDefaultFontName
|
||||
{
|
||||
return self.textInput.ccui_font.fontName ?: @"";
|
||||
}
|
||||
|
||||
- (void)setInputMode:(cocos2d::ui::EditBox::InputMode)inputMode
|
||||
{
|
||||
//multiline input
|
||||
if (inputMode == cocos2d::ui::EditBox::InputMode::ANY) {
|
||||
if (![self.textInput isKindOfClass:[NSTextView class]]) {
|
||||
[self createMultiLineTextField];
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (self.dataInputMode != cocos2d::ui::EditBox::InputFlag::PASSWORD) {
|
||||
if (![self.textInput isKindOfClass:[NSTextField class]]) {
|
||||
[self createSingleLineTextField];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setInputFlag:(cocos2d::ui::EditBox::InputFlag)inputFlag
|
||||
{
|
||||
if (self.dataInputMode == inputFlag) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.dataInputMode == cocos2d::ui::EditBox::InputFlag::PASSWORD
|
||||
&& inputFlag != cocos2d::ui::EditBox::InputFlag::PASSWORD) {
|
||||
[self createSingleLineTextField];
|
||||
}
|
||||
|
||||
if (self.dataInputMode != cocos2d::ui::EditBox::InputFlag::PASSWORD
|
||||
&& inputFlag == cocos2d::ui::EditBox::InputFlag::PASSWORD) {
|
||||
[self createPasswordTextField];
|
||||
}
|
||||
|
||||
switch (inputFlag)
|
||||
{
|
||||
case cocos2d::ui::EditBox::InputFlag::PASSWORD:
|
||||
self.dataInputMode = inputFlag;
|
||||
break;
|
||||
case cocos2d::ui::EditBox::InputFlag::INITIAL_CAPS_WORD:
|
||||
CCLOG("INITIAL_CAPS_WORD not implemented");
|
||||
break;
|
||||
case cocos2d::ui::EditBox::InputFlag::INITIAL_CAPS_SENTENCE:
|
||||
CCLOG("INITIAL_CAPS_SENTENCE not implemented");
|
||||
break;
|
||||
case cocos2d::ui::EditBox::InputFlag::INITIAL_CAPS_ALL_CHARACTERS:
|
||||
CCLOG("INITIAL_CAPS_ALL_CHARACTERS not implemented");
|
||||
break;
|
||||
case cocos2d::ui::EditBox::InputFlag::SENSITIVE:
|
||||
CCLOG("SENSITIVE not implemented");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setReturnType:(cocos2d::ui::EditBox::KeyboardReturnType)returnType
|
||||
{
|
||||
CCLOG("setReturnType not implemented");
|
||||
}
|
||||
|
||||
- (void)setPlaceHolder:(const char *)text
|
||||
{
|
||||
self.textInput.ccui_placeholder = [NSString stringWithUTF8String:text];
|
||||
}
|
||||
|
||||
- (void)setVisible:(BOOL)visible
|
||||
{
|
||||
self.textInput.hidden = !visible;
|
||||
}
|
||||
|
||||
- (void)setTextColor:(NSColor*)color
|
||||
{
|
||||
self.textInput.ccui_textColor = color;
|
||||
}
|
||||
|
||||
- (void)setFont:(NSFont *)font
|
||||
{
|
||||
if (font != nil) {
|
||||
self.textInput.ccui_font = font;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setPlaceholderFontColor:(NSColor *)color
|
||||
{
|
||||
self.textInput.ccui_placeholderColor = color;
|
||||
}
|
||||
|
||||
- (void)setPlaceholderFont:(NSFont*)font
|
||||
{
|
||||
self.textInput.ccui_placeholderFont = font;
|
||||
}
|
||||
- (void)setText:(NSString *)text
|
||||
{
|
||||
self.textInput.ccui_text = text;
|
||||
}
|
||||
|
||||
- (BOOL)textShouldBeginEditing:(NSText *)textObject; // YES means do it
|
||||
{
|
||||
_editState = YES;
|
||||
|
||||
getEditBoxImplMac()->editBoxEditingDidBegin();
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)textDidEndEditing:(NSNotification *)notification
|
||||
{
|
||||
_editState = NO;
|
||||
|
||||
getEditBoxImplMac()->editBoxEditingDidEnd([self getText]);
|
||||
}
|
||||
|
||||
- (void)textDidChange:(NSNotification *)notification
|
||||
{
|
||||
NSTextView* textView = notification.object;
|
||||
|
||||
const char* inputText = [textView.string UTF8String];
|
||||
|
||||
getEditBoxImplMac()->editBoxEditingChanged(inputText);
|
||||
}
|
||||
|
||||
- (BOOL)textView:(NSTextView *)textView shouldChangeTextInRange:(NSRange)affectedCharRange replacementString:(NSString *)replacementString
|
||||
{
|
||||
int maxLength = getEditBoxImplMac()->getMaxLength();
|
||||
if (maxLength < 0)
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
if (affectedCharRange.length + affectedCharRange.location > textView.string.length) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
NSUInteger oldLength = textView.string.length;
|
||||
NSUInteger replacementLength = replacementString.length;
|
||||
NSUInteger rangeLength = affectedCharRange.length;
|
||||
|
||||
NSUInteger newLength = oldLength - rangeLength + replacementLength;
|
||||
|
||||
return newLength <= maxLength;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,34 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2013-2016 zilongshanren
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
#include "ui/UIEditBox/Mac/CCUITextInput.h"
|
||||
|
||||
@interface CCUIMultilineTextField : NSTextView <CCUITextInput>
|
||||
{
|
||||
NSString* _placeHolder;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,121 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2013-2016 zilongshanren
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#import "ui/UIEditBox/Mac/CCUIMultilineTextField.h"
|
||||
|
||||
@interface CCUIMultilineTextField()
|
||||
@property(nonatomic, copy)NSString* placeHolder;
|
||||
@end
|
||||
|
||||
@implementation CCUIMultilineTextField
|
||||
{
|
||||
}
|
||||
|
||||
@synthesize placeHolder = _placeHolder;
|
||||
|
||||
-(void)dealloc
|
||||
{
|
||||
self.placeHolder = nil;
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
-(void)ccui_setPlaceholderFont:(NSFont *)font
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
-(NSFont*)ccui_placeholderFont
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
-(void)ccui_setPlaceholder:(NSString *)text
|
||||
{
|
||||
self.placeHolder = text;
|
||||
}
|
||||
|
||||
-(NSString*)ccui_placeholder
|
||||
{
|
||||
return self.placeHolder;
|
||||
}
|
||||
|
||||
-(void)ccui_setPlaceholderColor:(NSColor *)color
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
-(NSColor*)ccui_placeholderColor
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - CCUITextInput
|
||||
- (NSString *)ccui_text
|
||||
{
|
||||
return self.string;
|
||||
}
|
||||
|
||||
- (void)ccui_setText:(NSString *)ccui_text
|
||||
{
|
||||
self.string = ccui_text;
|
||||
}
|
||||
|
||||
- (NSColor *)ccui_textColor
|
||||
{
|
||||
return self.textColor;
|
||||
}
|
||||
|
||||
- (void)ccui_setTextColor:(NSColor *)ccui_textColor
|
||||
{
|
||||
self.textColor = ccui_textColor;
|
||||
}
|
||||
|
||||
- (NSFont *)ccui_font
|
||||
{
|
||||
return self.font;
|
||||
}
|
||||
|
||||
- (void)ccui_setFont:(NSFont *)ccui_font
|
||||
{
|
||||
self.font = ccui_font;
|
||||
}
|
||||
|
||||
|
||||
- (void)ccui_setDelegate:(id<NSTextFieldDelegate,NSTextViewDelegate>)delegate
|
||||
{
|
||||
self.delegate = delegate;
|
||||
}
|
||||
|
||||
- (void)ccui_setMaxLength:(int)ccui_maxLength
|
||||
{
|
||||
//noop
|
||||
}
|
||||
-(int)ccui_maxLength
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@end
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user