Merge branch 'v3' into v3_pr

Conflicts:
	cocos/2d/libcocos2d.vcxproj.filters
This commit is contained in:
huangshiwu 2014-08-01 15:11:34 +08:00
commit 575c9787c0
60 changed files with 1600 additions and 1471 deletions

View File

@ -943,6 +943,9 @@ Developers:
reckhou
Optimize FPS control on Android
dzl-ian
Added getter and setter for TextColor for UIText
Retired Core Developers:
WenSheng Yang
Author of windows port, CCTextField,

View File

@ -4,6 +4,8 @@ cocos2d-x-3.3 ??
getFileSize()
[NEW] FileUtilsApple: allow setting bundle to use in file utils on iOS and Mac OS X
[NEW] Image: support of software PVRTC v1 decompression
[NEW] UIText: added getter and setter for TextColor
[NEW] TextField: support utf8
[FIX] EditBox: font size is not scaled when glview is scaled on Mac OS X
[FIX] Label: can not set charmap after it is created

View File

@ -13,6 +13,11 @@
buildPhases = (
);
dependencies = (
B2F0AFEC198794EE002FE562 /* PBXTargetDependency */,
B2F0AFEE198794EE002FE562 /* PBXTargetDependency */,
B2F0AFF0198794EE002FE562 /* PBXTargetDependency */,
B2F0AFF2198794EE002FE562 /* PBXTargetDependency */,
B2F0AFF4198794EE002FE562 /* PBXTargetDependency */,
A03F31FF178147CB006731B9 /* PBXTargetDependency */,
A03F2FC01781458C006731B9 /* PBXTargetDependency */,
A03F2E93178141D1006731B9 /* PBXTargetDependency */,
@ -28,6 +33,11 @@
buildPhases = (
);
dependencies = (
B2F0AFF619879508002FE562 /* PBXTargetDependency */,
B2F0AFF819879508002FE562 /* PBXTargetDependency */,
B2F0AFFA19879508002FE562 /* PBXTargetDependency */,
B2F0AFFC19879508002FE562 /* PBXTargetDependency */,
B2F0AFFE19879508002FE562 /* PBXTargetDependency */,
A07A4E10178386520073F6A7 /* PBXTargetDependency */,
A07A5047178389710073F6A7 /* PBXTargetDependency */,
A07A5049178389710073F6A7 /* PBXTargetDependency */,
@ -40,6 +50,10 @@
/* End PBXAggregateTarget section */
/* Begin PBXBuildFile section */
15EFA211198A2BB5000C57D3 /* CCProtectedNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15EFA20F198A2BB5000C57D3 /* CCProtectedNode.cpp */; };
15EFA212198A2BB5000C57D3 /* CCProtectedNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15EFA20F198A2BB5000C57D3 /* CCProtectedNode.cpp */; };
15EFA213198A2BB5000C57D3 /* CCProtectedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 15EFA210198A2BB5000C57D3 /* CCProtectedNode.h */; };
15EFA214198A2BB5000C57D3 /* CCProtectedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 15EFA210198A2BB5000C57D3 /* CCProtectedNode.h */; };
1A01C68418F57BE800EFE3A6 /* CCArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A01C67618F57BE800EFE3A6 /* CCArray.cpp */; };
1A01C68518F57BE800EFE3A6 /* CCArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A01C67618F57BE800EFE3A6 /* CCArray.cpp */; };
1A01C68618F57BE800EFE3A6 /* CCArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A01C67718F57BE800EFE3A6 /* CCArray.h */; };
@ -1330,7 +1344,6 @@
B2C59A2919777E7A00B452DF /* CocosGUI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2905F9E918CF08D000240AA3 /* CocosGUI.cpp */; };
B2C59A2A19777E8300B452DF /* UIDeprecated.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29BDBA52195D597A003225C9 /* UIDeprecated.cpp */; };
B2C59A2B19777E8300B452DF /* UIWidget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2905FA1318CF08D100240AA3 /* UIWidget.cpp */; };
B2C59A2C19777E8300B452DF /* CCProtectedNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50E6D30C18DADB5D0051CA34 /* CCProtectedNode.cpp */; };
B2C59A2D19777E8300B452DF /* UIHelper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2905F9F418CF08D000240AA3 /* UIHelper.cpp */; };
B2C59A2E19777E8C00B452DF /* UIHBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50E6D32E18E174130051CA34 /* UIHBox.cpp */; };
B2C59A2F19777E8C00B452DF /* UIRelativeBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50E6D33018E174130051CA34 /* UIRelativeBox.cpp */; };
@ -1354,7 +1367,6 @@
B2C59A4119777EBC00B452DF /* UIVideoPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 3EA0FB69191C841D00B170C8 /* UIVideoPlayer.h */; };
B2C59A4219777EC700B452DF /* UIDeprecated.h in Headers */ = {isa = PBXBuildFile; fileRef = 29080DEB191B82CE0066F8DF /* UIDeprecated.h */; };
B2C59A4319777EC700B452DF /* UIWidget.h in Headers */ = {isa = PBXBuildFile; fileRef = 2905FA1418CF08D100240AA3 /* UIWidget.h */; };
B2C59A4419777EC700B452DF /* CCProtectedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 50E6D30D18DADB5D0051CA34 /* CCProtectedNode.h */; };
B2C59A4519777EC700B452DF /* UIHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 2905F9F518CF08D000240AA3 /* UIHelper.h */; };
B2C59A4619777EC700B452DF /* GUIDefine.h in Headers */ = {isa = PBXBuildFile; fileRef = 2905F9EB18CF08D000240AA3 /* GUIDefine.h */; };
B2C59A4719777ECF00B452DF /* UIHBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 50E6D32F18E174130051CA34 /* UIHBox.h */; };
@ -1539,11 +1551,9 @@
B2CC507C19776DD10041958E /* CCPhysicsJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46A170721807CE7A005B8026 /* CCPhysicsJoint.cpp */; };
B2D3D3B91948613300BA4831 /* CCBundle3DData.h in Headers */ = {isa = PBXBuildFile; fileRef = B2D3D3B81948613300BA4831 /* CCBundle3DData.h */; };
B2D3D3BA1948613300BA4831 /* CCBundle3DData.h in Headers */ = {isa = PBXBuildFile; fileRef = B2D3D3B81948613300BA4831 /* CCBundle3DData.h */; };
B2DB4763197661CD00411E16 /* CCProtectedNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50E6D30C18DADB5D0051CA34 /* CCProtectedNode.cpp */; };
B2DB4764197661D500411E16 /* UIWidget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2905FA1318CF08D100240AA3 /* UIWidget.cpp */; };
B2DB4765197661E400411E16 /* UIHBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50E6D32E18E174130051CA34 /* UIHBox.cpp */; };
B2DB4766197661EE00411E16 /* UILayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2905F9F818CF08D000240AA3 /* UILayout.cpp */; };
B2DB4767197664EE00411E16 /* CCProtectedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 50E6D30D18DADB5D0051CA34 /* CCProtectedNode.h */; };
B2DB47681976650A00411E16 /* UIWidget.h in Headers */ = {isa = PBXBuildFile; fileRef = 2905FA1418CF08D100240AA3 /* UIWidget.h */; };
B2DB47691976651E00411E16 /* UIHBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 50E6D32F18E174130051CA34 /* UIHBox.h */; };
B2DB476A1976653000411E16 /* UILayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 2905F9F918CF08D000240AA3 /* UILayout.h */; };
@ -1936,6 +1946,76 @@
remoteGlobalIDString = A07A4F9F178387730073F6A7;
remoteInfo = "CocosDenshion iOS";
};
B2F0AFEB198794EE002FE562 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1551A336158F2AB200E66CFE /* Project object */;
proxyType = 1;
remoteGlobalIDString = B245F10019766132001920FD;
remoteInfo = "libui Mac";
};
B2F0AFED198794EE002FE562 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1551A336158F2AB200E66CFE /* Project object */;
proxyType = 1;
remoteGlobalIDString = B2DB48161976716E00411E16;
remoteInfo = "libcocostudio Mac";
};
B2F0AFEF198794EE002FE562 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1551A336158F2AB200E66CFE /* Project object */;
proxyType = 1;
remoteGlobalIDString = B2DB479B197669A100411E16;
remoteInfo = "libcocosbuilder Mac";
};
B2F0AFF1198794EE002FE562 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1551A336158F2AB200E66CFE /* Project object */;
proxyType = 1;
remoteGlobalIDString = B2DB48CA19767F1F00411E16;
remoteInfo = "libspine Mac";
};
B2F0AFF3198794EE002FE562 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1551A336158F2AB200E66CFE /* Project object */;
proxyType = 1;
remoteGlobalIDString = B2DB498D197686CB00411E16;
remoteInfo = "libnetwork Mac";
};
B2F0AFF519879508002FE562 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1551A336158F2AB200E66CFE /* Project object */;
proxyType = 1;
remoteGlobalIDString = B24EEA2C19775E92004493CC;
remoteInfo = "libui iOS";
};
B2F0AFF719879508002FE562 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1551A336158F2AB200E66CFE /* Project object */;
proxyType = 1;
remoteGlobalIDString = B24EEA6719775EBB004493CC;
remoteInfo = "libcocostudio iOS";
};
B2F0AFF919879508002FE562 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1551A336158F2AB200E66CFE /* Project object */;
proxyType = 1;
remoteGlobalIDString = B24EEA6F19775ECE004493CC;
remoteInfo = "libcocosbuilder iOS";
};
B2F0AFFB19879508002FE562 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1551A336158F2AB200E66CFE /* Project object */;
proxyType = 1;
remoteGlobalIDString = B24EEA7719775EE1004493CC;
remoteInfo = "libspine iOS";
};
B2F0AFFD19879508002FE562 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1551A336158F2AB200E66CFE /* Project object */;
proxyType = 1;
remoteGlobalIDString = B24EEA7F19775EF3004493CC;
remoteInfo = "libnetwork iOS";
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
@ -1958,6 +2038,8 @@
06CAAAC1186AD63B0012A414 /* TriggerObj.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TriggerObj.h; sourceTree = "<group>"; };
1551A33F158F2AB200E66CFE /* libcocos2d Mac.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libcocos2d Mac.a"; sourceTree = BUILT_PRODUCTS_DIR; };
1551A342158F2AB200E66CFE /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
15EFA20F198A2BB5000C57D3 /* CCProtectedNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCProtectedNode.cpp; sourceTree = "<group>"; };
15EFA210198A2BB5000C57D3 /* CCProtectedNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCProtectedNode.h; sourceTree = "<group>"; };
1A01C67618F57BE800EFE3A6 /* CCArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCArray.cpp; sourceTree = "<group>"; };
1A01C67718F57BE800EFE3A6 /* CCArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCArray.h; sourceTree = "<group>"; };
1A01C67818F57BE800EFE3A6 /* CCBool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCBool.h; sourceTree = "<group>"; };
@ -2833,8 +2915,6 @@
50ABBF541926664700A911A9 /* CCPlatformDefine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCPlatformDefine.h; sourceTree = "<group>"; };
50ABBF551926664700A911A9 /* CCStdC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCStdC.h; sourceTree = "<group>"; };
50DC5180187B817900A9C23F /* RELEASE_NOTES.md */ = {isa = PBXFileReference; lastKnownFileType = text; name = RELEASE_NOTES.md; path = ../docs/RELEASE_NOTES.md; sourceTree = "<group>"; };
50E6D30C18DADB5D0051CA34 /* CCProtectedNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCProtectedNode.cpp; sourceTree = "<group>"; };
50E6D30D18DADB5D0051CA34 /* CCProtectedNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCProtectedNode.h; sourceTree = "<group>"; };
50E6D32E18E174130051CA34 /* UIHBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIHBox.cpp; sourceTree = "<group>"; };
50E6D32F18E174130051CA34 /* UIHBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIHBox.h; sourceTree = "<group>"; };
50E6D33018E174130051CA34 /* UIRelativeBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIRelativeBox.cpp; sourceTree = "<group>"; };
@ -3276,6 +3356,8 @@
1A570095180BC5B00088DEC7 /* base-nodes */ = {
isa = PBXGroup;
children = (
15EFA20F198A2BB5000C57D3 /* CCProtectedNode.cpp */,
15EFA210198A2BB5000C57D3 /* CCProtectedNode.h */,
1A57009C180BC5D20088DEC7 /* CCNode.cpp */,
1A57009D180BC5D20088DEC7 /* CCNode.h */,
1A570096180BC5C10088DEC7 /* CCAtlasNode.cpp */,
@ -4208,8 +4290,6 @@
29BDBA52195D597A003225C9 /* UIDeprecated.cpp */,
2905FA1318CF08D100240AA3 /* UIWidget.cpp */,
2905FA1418CF08D100240AA3 /* UIWidget.h */,
50E6D30C18DADB5D0051CA34 /* CCProtectedNode.cpp */,
50E6D30D18DADB5D0051CA34 /* CCProtectedNode.h */,
2905F9F418CF08D000240AA3 /* UIHelper.cpp */,
2905F9F518CF08D000240AA3 /* UIHelper.h */,
2905F9EB18CF08D000240AA3 /* GUIDefine.h */,
@ -5242,6 +5322,7 @@
50ABBE431925AB6F00A911A9 /* CCDirector.h in Headers */,
1A12775B18DFCC540005F345 /* CCTweenFunction.h in Headers */,
1A5702CA180BCE370088DEC7 /* CCTextFieldTTF.h in Headers */,
15EFA213198A2BB5000C57D3 /* CCProtectedNode.h in Headers */,
1A5702EC180BCE750088DEC7 /* CCTileMapAtlas.h in Headers */,
1A5702F0180BCE750088DEC7 /* CCTMXLayer.h in Headers */,
50ABC01B1926664800A911A9 /* CCSAXParser.h in Headers */,
@ -5597,6 +5678,7 @@
5034CA2C191D591100CE6051 /* ccShader_PositionTextureA8Color.vert in Headers */,
50ABBE981925AB6F00A911A9 /* CCProtocols.h in Headers */,
50ABBD431925AB0000A911A9 /* CCMathBase.h in Headers */,
15EFA214198A2BB5000C57D3 /* CCProtectedNode.h in Headers */,
50ABBE441925AB6F00A911A9 /* CCDirector.h in Headers */,
5034CA4A191D591100CE6051 /* ccShader_Label_df.frag in Headers */,
1A570281180BCC900088DEC7 /* CCSprite.h in Headers */,
@ -5858,7 +5940,6 @@
B2DB47881976663A00411E16 /* UIRichText.h in Headers */,
B2DB47801976660200411E16 /* UIButton.h in Headers */,
B2DB47821976660C00411E16 /* UICheckBox.h in Headers */,
B2DB4767197664EE00411E16 /* CCProtectedNode.h in Headers */,
B2DB47861976662D00411E16 /* UILoadingBar.h in Headers */,
B2DB47681976650A00411E16 /* UIWidget.h in Headers */,
2958244D19873D8E00F9746D /* UIScale9Sprite.h in Headers */,
@ -5900,7 +5981,6 @@
B2C59A4119777EBC00B452DF /* UIVideoPlayer.h in Headers */,
B2C59A4219777EC700B452DF /* UIDeprecated.h in Headers */,
B2C59A4319777EC700B452DF /* UIWidget.h in Headers */,
B2C59A4419777EC700B452DF /* CCProtectedNode.h in Headers */,
B2C59A4519777EC700B452DF /* UIHelper.h in Headers */,
B2C59A4619777EC700B452DF /* GUIDefine.h in Headers */,
B2C59A4719777ECF00B452DF /* UIHBox.h in Headers */,
@ -6616,6 +6696,7 @@
50ABBDA71925AB4100A911A9 /* CCRenderCommand.cpp in Sources */,
50ABBD501925AB0000A911A9 /* Quaternion.cpp in Sources */,
50ABBEBB1925AB6F00A911A9 /* ccUtils.cpp in Sources */,
15EFA211198A2BB5000C57D3 /* CCProtectedNode.cpp in Sources */,
50ABBEB71925AB6F00A911A9 /* ccUTF8.cpp in Sources */,
50ABBE271925AB6F00A911A9 /* CCAutoreleasePool.cpp in Sources */,
50ABBE8B1925AB6F00A911A9 /* CCNS.cpp in Sources */,
@ -7103,6 +7184,7 @@
1A1645B3191B726C008C7C7F /* ConvertUTFWrapper.cpp in Sources */,
1ABA68AF1888D700007D1BB4 /* CCFontCharMap.cpp in Sources */,
50ABBE7A1925AB6F00A911A9 /* CCEventMouse.cpp in Sources */,
15EFA212198A2BB5000C57D3 /* CCProtectedNode.cpp in Sources */,
50ABBD981925AB4100A911A9 /* CCGLProgramStateCache.cpp in Sources */,
B6B26344193884D60088FE25 /* CCAnimation3D.cpp in Sources */,
B6ACD898193D6693005E0B8A /* CCMeshSkin.cpp in Sources */,
@ -7246,7 +7328,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
B2DB4763197661CD00411E16 /* CCProtectedNode.cpp in Sources */,
B2DB4764197661D500411E16 /* UIWidget.cpp in Sources */,
B2DB4765197661E400411E16 /* UIHBox.cpp in Sources */,
B2DB4766197661EE00411E16 /* UILayout.cpp in Sources */,
@ -7295,7 +7376,6 @@
B2C59A2819777E7500B452DF /* UIImageView.cpp in Sources */,
B2C59A2A19777E8300B452DF /* UIDeprecated.cpp in Sources */,
B2C59A2B19777E8300B452DF /* UIWidget.cpp in Sources */,
B2C59A2C19777E8300B452DF /* CCProtectedNode.cpp in Sources */,
B2C59A2D19777E8300B452DF /* UIHelper.cpp in Sources */,
B2C59A2E19777E8C00B452DF /* UIHBox.cpp in Sources */,
B2C59A2F19777E8C00B452DF /* UIRelativeBox.cpp in Sources */,
@ -7634,6 +7714,56 @@
target = A07A4F9F178387730073F6A7 /* libcocosdenshion iOS */;
targetProxy = A07A504C178389710073F6A7 /* PBXContainerItemProxy */;
};
B2F0AFEC198794EE002FE562 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = B245F10019766132001920FD /* libui Mac */;
targetProxy = B2F0AFEB198794EE002FE562 /* PBXContainerItemProxy */;
};
B2F0AFEE198794EE002FE562 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = B2DB48161976716E00411E16 /* libcocostudio Mac */;
targetProxy = B2F0AFED198794EE002FE562 /* PBXContainerItemProxy */;
};
B2F0AFF0198794EE002FE562 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = B2DB479B197669A100411E16 /* libcocosbuilder Mac */;
targetProxy = B2F0AFEF198794EE002FE562 /* PBXContainerItemProxy */;
};
B2F0AFF2198794EE002FE562 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = B2DB48CA19767F1F00411E16 /* libspine Mac */;
targetProxy = B2F0AFF1198794EE002FE562 /* PBXContainerItemProxy */;
};
B2F0AFF4198794EE002FE562 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = B2DB498D197686CB00411E16 /* libnetwork Mac */;
targetProxy = B2F0AFF3198794EE002FE562 /* PBXContainerItemProxy */;
};
B2F0AFF619879508002FE562 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = B24EEA2C19775E92004493CC /* libui iOS */;
targetProxy = B2F0AFF519879508002FE562 /* PBXContainerItemProxy */;
};
B2F0AFF819879508002FE562 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = B24EEA6719775EBB004493CC /* libcocostudio iOS */;
targetProxy = B2F0AFF719879508002FE562 /* PBXContainerItemProxy */;
};
B2F0AFFA19879508002FE562 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = B24EEA6F19775ECE004493CC /* libcocosbuilder iOS */;
targetProxy = B2F0AFF919879508002FE562 /* PBXContainerItemProxy */;
};
B2F0AFFC19879508002FE562 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = B24EEA7719775EE1004493CC /* libspine iOS */;
targetProxy = B2F0AFFB19879508002FE562 /* PBXContainerItemProxy */;
};
B2F0AFFE19879508002FE562 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = B24EEA7F19775EF3004493CC /* libnetwork iOS */;
targetProxy = B2F0AFFD19879508002FE562 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
@ -7714,7 +7844,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
ARCHS = "$(ARCHS_STANDARD)";
EXECUTABLE_EXTENSION = a;
EXECUTABLE_PREFIX = "";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
@ -7747,7 +7877,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
ARCHS = "$(ARCHS_STANDARD)";
EXECUTABLE_EXTENSION = a;
EXECUTABLE_PREFIX = "";
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
@ -7780,6 +7910,7 @@
A03F2CB61780BD04006731B9 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD)";
EXECUTABLE_PREFIX = "";
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO;
HEADER_SEARCH_PATHS = "";
@ -7790,6 +7921,7 @@
A03F2CB71780BD04006731B9 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD)";
EXECUTABLE_PREFIX = "";
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO;
@ -7801,6 +7933,7 @@
A03F2D991780BDF7006731B9 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD)";
CLANG_WARN_BOOL_CONVERSION = NO;
CLANG_WARN_CONSTANT_CONVERSION = NO;
EXECUTABLE_PREFIX = "";
@ -7816,6 +7949,7 @@
A03F2D9A1780BDF7006731B9 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD)";
CLANG_WARN_BOOL_CONVERSION = NO;
CLANG_WARN_CONSTANT_CONVERSION = NO;
EXECUTABLE_PREFIX = "";
@ -7832,6 +7966,7 @@
A03F2E90178141C1006731B9 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD)";
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"COCOS2D_DEBUG=1",
@ -7848,6 +7983,7 @@
A03F2E91178141C1006731B9 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD)";
HEADER_SEARCH_PATHS = (
"$(inherited)",
"/Applications/Xcode\\ 2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include",
@ -7859,6 +7995,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ARCHS = "$(ARCHS_STANDARD)";
EXECUTABLE_PREFIX = "";
GCC_PREPROCESSOR_DEFINITIONS = CC_TARGET_OS_MAC;
GCC_TREAT_WARNINGS_AS_ERRORS = NO;
@ -7871,6 +8008,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ARCHS = "$(ARCHS_STANDARD)";
EXECUTABLE_PREFIX = "";
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_PREPROCESSOR_DEFINITIONS = CC_TARGET_OS_MAC;
@ -7884,6 +8022,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ARCHS = "$(ARCHS_STANDARD)";
CODE_SIGN_IDENTITY = "";
EXECUTABLE_PREFIX = "";
GCC_PREPROCESSOR_DEFINITIONS = (
@ -7902,6 +8041,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ARCHS = "$(ARCHS_STANDARD)";
CODE_SIGN_IDENTITY = "";
EXECUTABLE_PREFIX = "";
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
@ -8148,6 +8288,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ARCHS = "$(ARCHS_STANDARD)";
EXECUTABLE_PREFIX = "";
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
@ -8166,6 +8307,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ARCHS = "$(ARCHS_STANDARD)";
EXECUTABLE_PREFIX = "";
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_PREPROCESSOR_DEFINITIONS = (
@ -8406,6 +8548,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ARCHS = "$(ARCHS_STANDARD)";
EXECUTABLE_PREFIX = "";
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
@ -8424,6 +8567,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ARCHS = "$(ARCHS_STANDARD)";
EXECUTABLE_PREFIX = "";
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_PREPROCESSOR_DEFINITIONS = (
@ -8443,6 +8587,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ARCHS = "$(ARCHS_STANDARD)";
EXECUTABLE_PREFIX = "";
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
@ -8461,6 +8606,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ARCHS = "$(ARCHS_STANDARD)";
EXECUTABLE_PREFIX = "";
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_PREPROCESSOR_DEFINITIONS = (
@ -8480,6 +8626,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ARCHS = "$(ARCHS_STANDARD)";
EXECUTABLE_PREFIX = "";
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
@ -8498,6 +8645,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ARCHS = "$(ARCHS_STANDARD)";
EXECUTABLE_PREFIX = "";
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_PREPROCESSOR_DEFINITIONS = (
@ -8517,6 +8665,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ARCHS = "$(ARCHS_STANDARD)";
EXECUTABLE_PREFIX = "";
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
@ -8538,6 +8687,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ARCHS = "$(ARCHS_STANDARD)";
EXECUTABLE_PREFIX = "";
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_PREPROCESSOR_DEFINITIONS = (

View File

@ -916,10 +916,6 @@
A07A52BF1783AF210073F6A7 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A07A52B91783AE900073F6A7 /* OpenGLES.framework */; };
A07A52C01783AF250073F6A7 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A07A52B71783AE6D0073F6A7 /* UIKit.framework */; };
A07A52C31783B02C0073F6A7 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A07A52C11783B01F0073F6A7 /* AVFoundation.framework */; };
B24024DB1978DE1000FDE433 /* libcocos2d Mac.a in CopyFiles */ = {isa = PBXBuildFile; fileRef = 46A15FB01807A4F9005B8026 /* libcocos2d Mac.a */; };
B24024DD1978EC0700FDE433 /* libcocos2d Mac.a in CopyFiles */ = {isa = PBXBuildFile; fileRef = 46A15FB01807A4F9005B8026 /* libcocos2d Mac.a */; };
B24024E31978ED5200FDE433 /* libcocos2d Mac.a in CopyFiles */ = {isa = PBXBuildFile; fileRef = 46A15FB01807A4F9005B8026 /* libcocos2d Mac.a */; };
B24024E51978ED5F00FDE433 /* libcocos2d Mac.a in CopyFiles */ = {isa = PBXBuildFile; fileRef = 46A15FB01807A4F9005B8026 /* libcocos2d Mac.a */; };
B2411C9E19822FBD00E093E2 /* libcocostudio iOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B2CC503B197763A20041958E /* libcocostudio iOS.a */; };
B2411CA119822FDD00E093E2 /* libcocosbuilder iOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B2CC503D197763A20041958E /* libcocosbuilder iOS.a */; };
B2411CA419822FF100E093E2 /* libspine iOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B2CC503F197763A20041958E /* libspine iOS.a */; };
@ -1726,49 +1722,6 @@
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
B24024D81978DE0800FDE433 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
B24024DB1978DE1000FDE433 /* libcocos2d Mac.a in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
B24024DC1978EBFE00FDE433 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 12;
dstPath = "";
dstSubfolderSpec = 10;
files = (
B24024DD1978EC0700FDE433 /* libcocos2d Mac.a in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
B24024E21978ED4B00FDE433 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
B24024E31978ED5200FDE433 /* libcocos2d Mac.a in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
B24024E41978ED5800FDE433 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
B24024E51978ED5F00FDE433 /* libcocos2d Mac.a in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
1503FAA918DA8B6C00F6518C /* ftp.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = ftp.lua; path = ../external/lua/luasocket/ftp.lua; sourceTree = "<group>"; };
1503FAAA18DA8B6C00F6518C /* headers.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = headers.lua; path = ../external/lua/luasocket/headers.lua; sourceTree = "<group>"; };
@ -7830,7 +7783,6 @@
1A0EE1D118CDF6DA004CD58F /* Resources */,
1A0EE1F618CDF6DA004CD58F /* Sources */,
1A0EE29F18CDF6DA004CD58F /* Frameworks */,
B24024D81978DE0800FDE433 /* CopyFiles */,
);
buildRules = (
);
@ -7851,7 +7803,6 @@
1A0EE2C318CDF733004CD58F /* Sources */,
1A0EE2C818CDF733004CD58F /* Frameworks */,
1A0EE2D818CDF733004CD58F /* Resources */,
B24024E21978ED4B00FDE433 /* CopyFiles */,
);
buildRules = (
);
@ -7926,7 +7877,6 @@
1ABCA28218CD91510087CE3A /* Sources */,
1ABCA28318CD91510087CE3A /* Frameworks */,
1ABCA28418CD91510087CE3A /* Resources */,
B24024E41978ED5800FDE433 /* CopyFiles */,
);
buildRules = (
);
@ -7981,7 +7931,6 @@
1D60588D0D05DD3D006BFB54 /* Resources */,
1D60588E0D05DD3D006BFB54 /* Sources */,
1D60588F0D05DD3D006BFB54 /* Frameworks */,
B24024DC1978EBFE00FDE433 /* CopyFiles */,
);
buildRules = (
);
@ -9697,7 +9646,7 @@
1A0EE2B018CDF6DA004CD58F /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
ARCHS = "$(ARCHS_STANDARD)";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
@ -9712,7 +9661,7 @@
1A0EE2B118CDF6DA004CD58F /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
ARCHS = "$(ARCHS_STANDARD)";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
@ -9728,7 +9677,7 @@
1A0EE31218CDF733004CD58F /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
ARCHS = "$(ARCHS_STANDARD)";
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
CC_TARGET_OS_MAC,
@ -9748,7 +9697,7 @@
1A0EE31318CDF733004CD58F /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
ARCHS = "$(ARCHS_STANDARD)";
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
CC_TARGET_OS_MAC,
@ -9835,7 +9784,7 @@
1ABCA2B318CD91520087CE3A /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
ARCHS = "$(ARCHS_STANDARD)";
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
CC_TARGET_OS_MAC,
@ -9855,7 +9804,7 @@
1ABCA2B418CD91520087CE3A /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
ARCHS = "$(ARCHS_STANDARD)";
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
CC_TARGET_OS_MAC,
@ -9909,7 +9858,7 @@
1D6058940D05DD3E006BFB54 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
ARCHS = "$(ARCHS_STANDARD)";
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
CC_TARGET_OS_MAC,
@ -9923,7 +9872,7 @@
1D6058950D05DD3E006BFB54 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
ARCHS = "$(ARCHS_STANDARD)";
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
CC_TARGET_OS_MAC,

View File

@ -31,11 +31,10 @@
#include "2d/CCNode.h"
#include "ui/GUIExport.h"
NS_CC_BEGIN
class CC_GUI_DLL ProtectedNode : public Node
class CC_DLL ProtectedNode : public Node
{
public:
static ProtectedNode * create(void);

View File

@ -58,6 +58,7 @@ set(COCOS_2D_SRC
2d/CCParticleSystem.cpp
2d/CCParticleSystemQuad.cpp
2d/CCProgressTimer.cpp
2d/CCProtectedNode.cpp
2d/CCRenderTexture.cpp
2d/CCScene.cpp
2d/CCSpriteBatchNode.cpp

View File

@ -406,6 +406,7 @@
<ClCompile Include="CCParticleSystem.cpp" />
<ClCompile Include="CCParticleSystemQuad.cpp" />
<ClCompile Include="CCProgressTimer.cpp" />
<ClCompile Include="CCProtectedNode.cpp" />
<ClCompile Include="CCRenderTexture.cpp" />
<ClCompile Include="CCScene.cpp" />
<ClCompile Include="CCSprite.cpp" />
@ -622,6 +623,7 @@
<ClInclude Include="CCParticleSystem.h" />
<ClInclude Include="CCParticleSystemQuad.h" />
<ClInclude Include="CCProgressTimer.h" />
<ClInclude Include="CCProtectedNode.h" />
<ClInclude Include="CCRenderTexture.h" />
<ClInclude Include="CCScene.h" />
<ClInclude Include="CCSprite.h" />

View File

@ -490,9 +490,6 @@
<ClCompile Include="..\base\CCUserDefault.cpp">
<Filter>base</Filter>
</ClCompile>
<ClCompile Include="..\base\CCUserDefaultAndroid.cpp">
<Filter>base</Filter>
</ClCompile>
<ClCompile Include="..\base\ccUTF8.cpp">
<Filter>base</Filter>
</ClCompile>
@ -617,6 +614,9 @@
<ClCompile Include="CCFastTMXTiledMap.cpp">
<Filter>2d</Filter>
</ClCompile>
<ClCompile Include="CCProtectedNode.cpp">
<Filter>2d</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\physics\CCPhysicsBody.h">
@ -1259,6 +1259,9 @@
<ClInclude Include="CCFastTMXTiledMap.h">
<Filter>2d</Filter>
</ClInclude>
<ClInclude Include="CCProtectedNode.h">
<Filter>2d</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\math\Mat4.inl">

View File

@ -339,6 +339,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou
<ClCompile Include="CCParticleSystem.cpp" />
<ClCompile Include="CCParticleSystemQuad.cpp" />
<ClCompile Include="CCProgressTimer.cpp" />
<ClCompile Include="CCProtectedNode.cpp" />
<ClCompile Include="CCRenderTexture.cpp" />
<ClCompile Include="CCScene.cpp" />
<ClCompile Include="CCSprite.cpp" />
@ -546,6 +547,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou
<ClInclude Include="CCParticleSystem.h" />
<ClInclude Include="CCParticleSystemQuad.h" />
<ClInclude Include="CCProgressTimer.h" />
<ClInclude Include="CCProtectedNode.h" />
<ClInclude Include="CCRenderTexture.h" />
<ClInclude Include="CCScene.h" />
<ClInclude Include="CCSprite.h" />

View File

@ -595,6 +595,9 @@
<ClCompile Include="..\platform\CCGLView.cpp">
<Filter>platform</Filter>
</ClCompile>
<ClCompile Include="CCProtectedNode.cpp">
<Filter>2d</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\physics\CCPhysicsBody.h">
@ -1210,6 +1213,9 @@
<ClInclude Include="..\platform\CCGLView.h">
<Filter>platform</Filter>
</ClInclude>
<ClInclude Include="CCProtectedNode.h">
<Filter>2d</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\math\Mat4.inl">

View File

@ -55,6 +55,7 @@ cocos2d.cpp \
2d/CCParticleSystem.cpp \
2d/CCParticleSystemQuad.cpp \
2d/CCProgressTimer.cpp \
2d/CCProtectedNode.cpp \
2d/CCRenderTexture.cpp \
2d/CCScene.cpp \
2d/CCSprite.cpp \

View File

@ -268,9 +268,6 @@ THE SOFTWARE.
#include "3d/CCAnimation3D.h"
#include "3d/CCSprite3DMaterial.h"
// Audio
#include "audio/include/SimpleAudioEngine.h"
// Deprecated include
#include "deprecated/CCDictionary.h"
#include "deprecated/CCArray.h"

View File

@ -82,7 +82,7 @@
<SDLCheck>
</SDLCheck>
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)extensions;$(EngineRoot)cocos\audio\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINDOWS;_LIB;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;CC_CONSTRUCTOR_ACCESS=public;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WINDOWS;_LIB;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DebugInformationFormat>None</DebugInformationFormat>
<WholeProgramOptimization>false</WholeProgramOptimization>
</ClCompile>

View File

@ -222,7 +222,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>
</SDLCheck>
<PreprocessorDefinitions>WIN32;_WINDOWS;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;CC_CONSTRUCTOR_ACCESS=public;_USRSTUDIODLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WINDOWS;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_USRSTUDIODLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support;$(EngineRoot)external;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)extensions;$(EngineRoot)external\win32-specific\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DebugInformationFormat>None</DebugInformationFormat>
<WholeProgramOptimization>false</WholeProgramOptimization>

View File

@ -140,7 +140,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>
</SDLCheck>
<PreprocessorDefinitions>WIN32;_WINDOWS;_LIB;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;CC_CONSTRUCTOR_ACCESS=public;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WINDOWS;_LIB;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DebugInformationFormat>None</DebugInformationFormat>
<WholeProgramOptimization>false</WholeProgramOptimization>

View File

@ -3,6 +3,14 @@
-- @module Helper
-- @parent_module ccui
--------------------------------
-- @function [parent=#Helper] getSubStringOfUTF8String
-- @param self
-- @param #string str
-- @param #unsigned long long
-- @param #unsigned long long
-- @return string#string ret (return value: string)
--------------------------------
-- @function [parent=#Helper] seekWidgetByTag
-- @param self

View File

@ -5,9 +5,32 @@
-- @parent_module ccui
--------------------------------
-- @function [parent=#Text] getStringLength
-- @function [parent=#Text] enableShadow
-- @param self
-- @return long#long ret (return value: long)
--------------------------------
-- @function [parent=#Text] getFontSize
-- @param self
-- @return int#int ret (return value: int)
--------------------------------
-- @function [parent=#Text] getString
-- @param self
-- @return string#string ret (return value: string)
--------------------------------
-- @function [parent=#Text] disableEffect
-- @param self
--------------------------------
-- @function [parent=#Text] getTextColor
-- @param self
-- @return color4b_table#color4b_table ret (return value: color4b_table)
--------------------------------
-- @function [parent=#Text] setTextVerticalAlignment
-- @param self
-- @param #int textvalignment
--------------------------------
-- @function [parent=#Text] setFontName
@ -19,80 +42,16 @@
-- @param self
-- @param #bool bool
--------------------------------
-- @function [parent=#Text] getFontSize
-- @param self
-- @return int#int ret (return value: int)
--------------------------------
-- @function [parent=#Text] enableOutline
-- @param self
-- @param #color4b_table color4b
-- @param #int int
--------------------------------
-- @function [parent=#Text] getTextVerticalAlignment
-- @param self
-- @return int#int ret (return value: int)
--------------------------------
-- @function [parent=#Text] getString
-- @param self
-- @return string#string ret (return value: string)
--------------------------------
-- @function [parent=#Text] enableShadow
-- @param self
--------------------------------
-- @function [parent=#Text] setString
-- @param self
-- @param #string str
--------------------------------
-- @function [parent=#Text] getTextHorizontalAlignment
-- @param self
-- @return int#int ret (return value: int)
--------------------------------
-- @function [parent=#Text] setTextVerticalAlignment
-- @param self
-- @param #int textvalignment
--------------------------------
-- @function [parent=#Text] enableGlow
-- @param self
-- @param #color4b_table color4b
--------------------------------
-- @function [parent=#Text] getTextAreaSize
-- @param self
-- @return size_table#size_table ret (return value: size_table)
--------------------------------
-- @function [parent=#Text] setTextHorizontalAlignment
-- @param self
-- @param #int texthalignment
--------------------------------
-- @function [parent=#Text] setFontSize
-- @param self
-- @param #int int
--------------------------------
-- @function [parent=#Text] isTouchScaleChangeEnabled
-- @param self
-- @return bool#bool ret (return value: bool)
--------------------------------
-- @function [parent=#Text] getType
-- @param self
-- @return int#int ret (return value: int)
--------------------------------
-- @function [parent=#Text] disableEffect
-- @param self
--------------------------------
-- @function [parent=#Text] getFontName
-- @param self
@ -103,6 +62,57 @@
-- @param self
-- @param #size_table size
--------------------------------
-- @function [parent=#Text] getStringLength
-- @param self
-- @return long#long ret (return value: long)
--------------------------------
-- @function [parent=#Text] enableOutline
-- @param self
-- @param #color4b_table color4b
-- @param #int int
--------------------------------
-- @function [parent=#Text] getType
-- @param self
-- @return int#int ret (return value: int)
--------------------------------
-- @function [parent=#Text] getTextHorizontalAlignment
-- @param self
-- @return int#int ret (return value: int)
--------------------------------
-- @function [parent=#Text] setFontSize
-- @param self
-- @param #int int
--------------------------------
-- @function [parent=#Text] setTextColor
-- @param self
-- @param #color4b_table color4b
--------------------------------
-- @function [parent=#Text] enableGlow
-- @param self
-- @param #color4b_table color4b
--------------------------------
-- @function [parent=#Text] getTextVerticalAlignment
-- @param self
-- @return int#int ret (return value: int)
--------------------------------
-- @function [parent=#Text] getTextAreaSize
-- @param self
-- @return size_table#size_table ret (return value: size_table)
--------------------------------
-- @function [parent=#Text] setTextHorizontalAlignment
-- @param self
-- @param #int texthalignment
--------------------------------
-- @overload self, string, string, int
-- @overload self

File diff suppressed because it is too large Load Diff

View File

@ -395,6 +395,9 @@ int register_all_cocos2dx_ui(lua_State* tolua_S);

View File

@ -25,7 +25,6 @@ UILoadingBar.cpp \
UISlider.cpp \
UITextField.cpp \
UIRichText.cpp \
CCProtectedNode.cpp \
UIHBox.cpp \
UIVBox.cpp \
UIRelativeBox.cpp \

View File

@ -1,5 +1,4 @@
set(COCOS_UI_SRC
ui/CCProtectedNode.cpp
ui/CocosGUI.cpp
ui/UIButton.cpp
ui/UICheckBox.cpp

View File

@ -135,9 +135,13 @@ bool Button::init()
void Button::initRenderer()
{
_buttonNormalRenderer = Sprite::create();
_buttonClickedRenderer = Sprite::create();
_buttonDisableRenderer = Sprite::create();
_buttonNormalRenderer = Scale9Sprite::create();
_buttonClickedRenderer = Scale9Sprite::create();
_buttonDisableRenderer = Scale9Sprite::create();
_buttonClickedRenderer->setScale9Enabled(false);
_buttonNormalRenderer->setScale9Enabled(false);
_buttonDisableRenderer->setScale9Enabled(false);
_titleRenderer = Label::create();
_titleRenderer->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
@ -153,33 +157,13 @@ void Button::setScale9Enabled(bool able)
{
return;
}
_brightStyle = BrightStyle::NONE;
_scale9Enabled = able;
removeProtectedChild(_buttonNormalRenderer);
removeProtectedChild(_buttonClickedRenderer);
removeProtectedChild(_buttonDisableRenderer);
_buttonNormalRenderer = nullptr;
_buttonClickedRenderer = nullptr;
_buttonDisableRenderer = nullptr;
if (_scale9Enabled)
{
_buttonNormalRenderer = Scale9Sprite::create();
_buttonClickedRenderer = Scale9Sprite::create();
_buttonDisableRenderer = Scale9Sprite::create();
}
else
{
_buttonNormalRenderer = Sprite::create();
_buttonClickedRenderer = Sprite::create();
_buttonDisableRenderer = Sprite::create();
}
loadTextureNormal(_normalFileName, _normalTexType);
loadTexturePressed(_clickedFileName, _pressedTexType);
loadTextureDisabled(_disabledFileName, _disabledTexType);
addProtectedChild(_buttonNormalRenderer, NORMAL_RENDERER_Z, -1);
addProtectedChild(_buttonClickedRenderer, PRESSED_RENDERER_Z, -1);
addProtectedChild(_buttonDisableRenderer, DISABLED_RENDERER_Z, -1);
_scale9Enabled = able;
_buttonNormalRenderer->setScale9Enabled(_scale9Enabled);
_buttonClickedRenderer->setScale9Enabled(_scale9Enabled);
_buttonDisableRenderer->setScale9Enabled(_scale9Enabled);
if (_scale9Enabled)
{
bool ignoreBefore = _ignoreSize;
@ -190,9 +174,12 @@ void Button::setScale9Enabled(bool able)
{
ignoreContentAdaptWithSize(_prevIgnoreSize);
}
setCapInsetsNormalRenderer(_capInsetsNormal);
setCapInsetsPressedRenderer(_capInsetsPressed);
setCapInsetsDisabledRenderer(_capInsetsDisabled);
_brightStyle = BrightStyle::NONE;
setBright(_bright);
}
@ -228,37 +215,19 @@ void Button::loadTextureNormal(const std::string& normal,TextureResType texType)
}
_normalFileName = normal;
_normalTexType = texType;
if (_scale9Enabled)
{
Scale9Sprite* normalRendererScale9 = static_cast<Scale9Sprite*>(_buttonNormalRenderer);
switch (_normalTexType)
{
case TextureResType::LOCAL:
normalRendererScale9->initWithFile(normal);
_buttonNormalRenderer->initWithFile(normal);
break;
case TextureResType::PLIST:
normalRendererScale9->initWithSpriteFrameName(normal);
_buttonNormalRenderer->initWithSpriteFrameName(normal);
break;
default:
break;
}
normalRendererScale9->setCapInsets(_capInsetsNormal);
}
else
{
Sprite* normalRenderer = static_cast<Sprite*>(_buttonNormalRenderer);
switch (_normalTexType)
{
case TextureResType::LOCAL:
normalRenderer->setTexture(normal);
break;
case TextureResType::PLIST:
normalRenderer->setSpriteFrame(normal);
break;
default:
break;
}
}
_normalTextureSize = _buttonNormalRenderer->getContentSize();
updateFlippedX();
updateFlippedY();
@ -276,38 +245,21 @@ void Button::loadTexturePressed(const std::string& selected,TextureResType texTy
}
_clickedFileName = selected;
_pressedTexType = texType;
if (_scale9Enabled)
{
Scale9Sprite* clickedRendererScale9 = static_cast<Scale9Sprite*>(_buttonClickedRenderer);
switch (_pressedTexType)
{
case TextureResType::LOCAL:
clickedRendererScale9->initWithFile(selected);
_buttonClickedRenderer->initWithFile(selected);
break;
case TextureResType::PLIST:
clickedRendererScale9->initWithSpriteFrameName(selected);
_buttonClickedRenderer->initWithSpriteFrameName(selected);
break;
default:
break;
}
clickedRendererScale9->setCapInsets(_capInsetsPressed);
}
else
{
Sprite* clickedRenderer = static_cast<Sprite*>(_buttonClickedRenderer);
switch (_pressedTexType)
{
case TextureResType::LOCAL:
clickedRenderer->setTexture(selected);
break;
case TextureResType::PLIST:
clickedRenderer->setSpriteFrame(selected);
break;
default:
break;
}
}
_pressedTextureSize = _buttonClickedRenderer->getContentSize();
//TODO: mark as dirty
updateFlippedX();
updateFlippedY();
@ -323,37 +275,19 @@ void Button::loadTextureDisabled(const std::string& disabled,TextureResType texT
}
_disabledFileName = disabled;
_disabledTexType = texType;
if (_scale9Enabled)
{
Scale9Sprite* disabledScale9 = static_cast<Scale9Sprite*>(_buttonDisableRenderer);
switch (_disabledTexType)
{
case TextureResType::LOCAL:
disabledScale9->initWithFile(disabled);
_buttonDisableRenderer->initWithFile(disabled);
break;
case TextureResType::PLIST:
disabledScale9->initWithSpriteFrameName(disabled);
_buttonDisableRenderer->initWithSpriteFrameName(disabled);
break;
default:
break;
}
disabledScale9->setCapInsets(_capInsetsDisabled);
}
else
{
Sprite* disabledRenderer = static_cast<Sprite*>(_buttonDisableRenderer);
switch (_disabledTexType)
{
case TextureResType::LOCAL:
disabledRenderer->setTexture(disabled);
break;
case TextureResType::PLIST:
disabledRenderer->setSpriteFrame(disabled);
break;
default:
break;
}
}
_disabledTextureSize = _buttonDisableRenderer->getContentSize();
updateFlippedX();
updateFlippedY();
@ -376,7 +310,7 @@ void Button::setCapInsetsNormalRenderer(const Rect &capInsets)
{
return;
}
static_cast<Scale9Sprite*>(_buttonNormalRenderer)->setCapInsets(capInsets);
_buttonNormalRenderer->setCapInsets(capInsets);
}
const Rect& Button::getCapInsetsNormalRenderer()const
@ -391,7 +325,7 @@ void Button::setCapInsetsPressedRenderer(const Rect &capInsets)
{
return;
}
static_cast<Scale9Sprite*>(_buttonClickedRenderer)->setCapInsets(capInsets);
_buttonClickedRenderer->setCapInsets(capInsets);
}
const Rect& Button::getCapInsetsPressedRenderer()const
@ -406,7 +340,7 @@ void Button::setCapInsetsDisabledRenderer(const Rect &capInsets)
{
return;
}
static_cast<Scale9Sprite*>(_buttonDisableRenderer)->setCapInsets(capInsets);
_buttonDisableRenderer->setCapInsets(capInsets);
}
const Rect& Button::getCapInsetsDisabledRenderer()const
@ -431,28 +365,10 @@ void Button::onPressStateChangedToNormal()
}
}
else
{
if (_scale9Enabled)
{
updateTexturesRGBA();
}
else
{
_buttonNormalRenderer->stopAllActions();
_buttonNormalRenderer->setScale(_normalTextureScaleXInSize, _normalTextureScaleYInSize);
}
}
}
void Button::updateTexturesRGBA()
{
_buttonNormalRenderer->setColor(this->getColor());
_buttonClickedRenderer->setColor(this->getColor());
_buttonDisableRenderer->setColor(this->getColor());
_buttonNormalRenderer->setOpacity(this->getOpacity());
_buttonClickedRenderer->setOpacity(this->getOpacity());
_buttonDisableRenderer->setOpacity(this->getOpacity());
}
void Button::onPressStateChangedToPressed()
@ -462,6 +378,7 @@ void Button::onPressStateChangedToPressed()
_buttonNormalRenderer->setVisible(false);
_buttonClickedRenderer->setVisible(true);
_buttonDisableRenderer->setVisible(false);
if (_pressedActionEnabled)
{
_buttonNormalRenderer->stopAllActions();
@ -501,36 +418,19 @@ void Button::updateFlippedX()
{
float flip = _flippedX ? -1.0f : 1.0f;
_titleRenderer->setScaleX(flip);
if (_scale9Enabled)
{
_buttonNormalRenderer->setScaleX(flip);
_buttonClickedRenderer->setScaleX(flip);
_buttonDisableRenderer->setScaleX(flip);
}
else
{
static_cast<Sprite*>(_buttonNormalRenderer)->setFlippedX(_flippedX);
static_cast<Sprite*>(_buttonClickedRenderer)->setFlippedX(_flippedX);
static_cast<Sprite*>(_buttonDisableRenderer)->setFlippedX(_flippedX);
}
_buttonNormalRenderer->setFlippedX(_flippedX);
_buttonClickedRenderer->setFlippedX(_flippedX);
_buttonDisableRenderer->setFlippedX(_flippedX);
}
void Button::updateFlippedY()
{
float flip = _flippedY ? -1.0f : 1.0f;
_titleRenderer->setScaleY(flip);
if (_scale9Enabled)
{
_buttonNormalRenderer->setScaleY(flip);
_buttonClickedRenderer->setScaleY(flip);
_buttonDisableRenderer->setScaleY(flip);
}
else
{
static_cast<Sprite*>(_buttonNormalRenderer)->setFlippedY(_flippedY);
static_cast<Sprite*>(_buttonClickedRenderer)->setFlippedY(_flippedY);
static_cast<Sprite*>(_buttonDisableRenderer)->setFlippedY(_flippedY);
}
_buttonNormalRenderer->setFlippedY(_flippedY);
_buttonClickedRenderer->setFlippedY(_flippedY);
_buttonDisableRenderer->setFlippedY(_flippedY);
}
void Button::updateTitleLocation()
@ -605,8 +505,9 @@ void Button::normalTextureScaleChangedWithSize()
{
if (_scale9Enabled)
{
static_cast<Scale9Sprite*>(_buttonNormalRenderer)->setPreferredSize(_contentSize);
_buttonNormalRenderer->setPreferredSize(_contentSize);
_normalTextureScaleXInSize = _normalTextureScaleYInSize = 1.0f;
_buttonNormalRenderer->setScale(_normalTextureScaleXInSize,_normalTextureScaleYInSize);
}
else
{
@ -641,8 +542,9 @@ void Button::pressedTextureScaleChangedWithSize()
{
if (_scale9Enabled)
{
static_cast<Scale9Sprite*>(_buttonClickedRenderer)->setPreferredSize(_contentSize);
_buttonClickedRenderer->setPreferredSize(_contentSize);
_pressedTextureScaleXInSize = _pressedTextureScaleYInSize = 1.0f;
_buttonClickedRenderer->setScale(_pressedTextureScaleXInSize,_pressedTextureScaleYInSize);
}
else
{
@ -676,7 +578,8 @@ void Button::disabledTextureScaleChangedWithSize()
{
if (_scale9Enabled)
{
static_cast<Scale9Sprite*>(_buttonDisableRenderer)->setPreferredSize(_contentSize);
_buttonDisableRenderer->setScale(1.0);
_buttonDisableRenderer->setPreferredSize(_contentSize);
}
else
{

View File

@ -34,6 +34,7 @@ class Label;
namespace ui{
class Scale9Sprite;
/**
* @js NA
* @lua NA
@ -206,8 +207,6 @@ protected:
virtual void updateFlippedX() override;
virtual void updateFlippedY() override;
void updateTexturesRGBA();
void normalTextureScaleChangedWithSize();
void pressedTextureScaleChangedWithSize();
void disabledTextureScaleChangedWithSize();
@ -219,10 +218,11 @@ protected:
virtual void copySpecialProperties(Widget* model) override;
protected:
Node* _buttonNormalRenderer;
Node* _buttonClickedRenderer;
Node* _buttonDisableRenderer;
Scale9Sprite* _buttonNormalRenderer;
Scale9Sprite* _buttonClickedRenderer;
Scale9Sprite* _buttonDisableRenderer;
Label* _titleRenderer;
std::string _normalFileName;
std::string _clickedFileName;
std::string _disabledFileName;

View File

@ -109,6 +109,43 @@ Widget* Helper::seekActionWidgetByActionTag(Widget* root, int tag)
return nullptr;
}
std::string Helper::getSubStringOfUTF8String(const std::string& str, std::string::size_type start, std::string::size_type length)
{
if (length==0)
{
return "";
}
std::string::size_type c, i, ix, q, min=std::string::npos, max=std::string::npos;
for (q=0, i=0, ix=str.length(); i < ix; i++, q++)
{
if (q==start)
{
min = i;
}
if (q <= start+length || length==std::string::npos)
{
max = i;
}
c = (unsigned char) str[i];
if (c<=127) i+=0;
else if ((c & 0xE0) == 0xC0) i+=1;
else if ((c & 0xF0) == 0xE0) i+=2;
else if ((c & 0xF8) == 0xF0) i+=3;
else return "";//invalid utf8
}
if (q <= start+length || length == std::string::npos)
{
max = i;
}
if (min==std::string::npos || max==std::string::npos)
{
return "";
}
return str.substr(min,max);
}
}
NS_CC_END

View File

@ -66,6 +66,18 @@ public:
/*temp action*/
static Widget* seekActionWidgetByActionTag(Widget* root, int tag);
/**
* @brief Get a UTF8 substring from a std::string with a given start position and length
* Sample: std::string str = "中国中国中国”; substr = getSubStringOfUTF8String(str,0,2) will = ""
* @param start The start position of the substring.
* @param length The length of the substring in UTF8 count
* @return a UTF8 substring
*/
static std::string getSubStringOfUTF8String(const std::string& str,
std::string::size_type start,
std::string::size_type length);
};
}

View File

@ -30,10 +30,6 @@ NS_CC_BEGIN
namespace ui {
#define STATIC_CAST_CCSPRITE static_cast<Sprite*>(_imageRenderer)
#define STATIC_CAST_SCALE9SPRITE static_cast<Scale9Sprite*>(_imageRenderer)
static const int IMAGE_RENDERER_Z = (-1);
IMPLEMENT_CLASS_GUI_INFO(ImageView)
@ -108,7 +104,9 @@ bool ImageView::init(const std::string &imageFileName, TextureResType texType)
void ImageView::initRenderer()
{
_imageRenderer = Sprite::create();
_imageRenderer = Scale9Sprite::create();
_imageRenderer->setScale9Enabled(false);
addProtectedChild(_imageRenderer, IMAGE_RENDERER_Z, -1);
}
@ -123,34 +121,15 @@ void ImageView::loadTexture(const std::string& fileName, TextureResType texType)
switch (_imageTexType)
{
case TextureResType::LOCAL:
if (_scale9Enabled)
{
Scale9Sprite* imageRendererScale9 = STATIC_CAST_SCALE9SPRITE;
imageRendererScale9->initWithFile(fileName);
imageRendererScale9->setCapInsets(_capInsets);
}
else
{
Sprite* imageRenderer = STATIC_CAST_CCSPRITE;
imageRenderer->setTexture(fileName);
}
_imageRenderer->initWithFile(fileName);
break;
case TextureResType::PLIST:
if (_scale9Enabled)
{
Scale9Sprite* imageRendererScale9 = STATIC_CAST_SCALE9SPRITE;
imageRendererScale9->initWithSpriteFrameName(fileName);
imageRendererScale9->setCapInsets(_capInsets);
}
else
{
Sprite* imageRenderer = STATIC_CAST_CCSPRITE;
imageRenderer->setSpriteFrame(fileName);
}
_imageRenderer->initWithSpriteFrameName(fileName);
break;
default:
break;
}
_imageTextureSize = _imageRenderer->getContentSize();
updateFlippedX();
updateFlippedY();
@ -161,39 +140,32 @@ void ImageView::loadTexture(const std::string& fileName, TextureResType texType)
void ImageView::setTextureRect(const Rect &rect)
{
//This API should be refactor
if (_scale9Enabled)
{
}
else
{
STATIC_CAST_CCSPRITE->setTextureRect(rect);
auto sprite = _imageRenderer->getSprite();
if (sprite)
{
sprite->setTextureRect(rect);
}
else
{
CCLOG("Warning!! you should load texture before set the texture's rect!");
}
}
}
void ImageView::updateFlippedX()
{
if (_scale9Enabled)
{
int flip = _flippedX ? -1 : 1;
STATIC_CAST_SCALE9SPRITE->setScaleX(flip);
}
else
{
STATIC_CAST_CCSPRITE->setFlippedX(_flippedX);
}
_imageRenderer->setFlippedX(_flippedX);
}
void ImageView::updateFlippedY()
{
if (_scale9Enabled)
{
int flip = _flippedY ? -1 : 1;
STATIC_CAST_SCALE9SPRITE->setScaleY(flip);
}
else
{
STATIC_CAST_CCSPRITE->setFlippedY(_flippedY);
}
_imageRenderer->setFlippedY(_flippedY);
}
@ -206,18 +178,8 @@ void ImageView::setScale9Enabled(bool able)
_scale9Enabled = able;
removeProtectedChild(_imageRenderer);
_imageRenderer = nullptr;
if (_scale9Enabled)
{
_imageRenderer = Scale9Sprite::create();
}
else
{
_imageRenderer = Sprite::create();
}
loadTexture(_textureFile,_imageTexType);
addProtectedChild(_imageRenderer, IMAGE_RENDERER_Z, -1);
_imageRenderer->setScale9Enabled(_scale9Enabled);
if (_scale9Enabled)
{
bool ignoreBefore = _ignoreSize;
@ -252,7 +214,7 @@ void ImageView::setCapInsets(const Rect &capInsets)
{
return;
}
STATIC_CAST_SCALE9SPRITE->setCapInsets(capInsets);
_imageRenderer->setCapInsets(capInsets);
}
const Rect& ImageView::getCapInsets()const
@ -298,7 +260,7 @@ void ImageView::imageTextureScaleChangedWithSize()
{
if (_scale9Enabled)
{
static_cast<Scale9Sprite*>(_imageRenderer)->setPreferredSize(_contentSize);
_imageRenderer->setPreferredSize(_contentSize);
}
else
{

View File

@ -31,7 +31,7 @@ THE SOFTWARE.
NS_CC_BEGIN
namespace ui {
class Scale9Sprite;
/**
* @js NA
* @lua NA
@ -132,7 +132,7 @@ protected:
bool _scale9Enabled;
bool _prevIgnoreSize;
Rect _capInsets;
Node* _imageRenderer;
Scale9Sprite* _imageRenderer;
std::string _textureFile;
TextureResType _imageTexType;
Size _imageTextureSize;

View File

@ -576,7 +576,7 @@ void Layout::onSizeChanged()
_backGroundImage->setPosition(Vec2(_contentSize.width/2.0f, _contentSize.height/2.0f));
if (_backGroundScale9Enabled && _backGroundImage)
{
static_cast<Scale9Sprite*>(_backGroundImage)->setPreferredSize(_contentSize);
_backGroundImage->setPreferredSize(_contentSize);
}
}
if (_colorRender)
@ -595,11 +595,13 @@ void Layout::setBackGroundImageScale9Enabled(bool able)
{
return;
}
removeProtectedChild(_backGroundImage);
_backGroundImage = nullptr;
_backGroundScale9Enabled = able;
if (nullptr == _backGroundImage)
{
addBackGroundImage();
setBackGroundImage(_backGroundImageFileName,_bgImageTexType);
}
_backGroundImage->setScale9Enabled(_backGroundScale9Enabled);
setBackGroundImageCapInsets(_backGroundImageCapInsets);
}
@ -620,36 +622,22 @@ void Layout::setBackGroundImage(const std::string& fileName,TextureResType texTy
}
_backGroundImageFileName = fileName;
_bgImageTexType = texType;
if (_backGroundScale9Enabled)
{
Scale9Sprite* bgiScale9 = static_cast<Scale9Sprite*>(_backGroundImage);
switch (_bgImageTexType)
{
case TextureResType::LOCAL:
bgiScale9->initWithFile(fileName);
_backGroundImage->initWithFile(fileName);
break;
case TextureResType::PLIST:
bgiScale9->initWithSpriteFrameName(fileName);
break;
default:
break;
}
bgiScale9->setPreferredSize(_contentSize);
}
else
{
switch (_bgImageTexType)
{
case TextureResType::LOCAL:
static_cast<Sprite*>(_backGroundImage)->setTexture(fileName);
break;
case TextureResType::PLIST:
static_cast<Sprite*>(_backGroundImage)->setSpriteFrame(fileName);
_backGroundImage->initWithSpriteFrameName(fileName);
break;
default:
break;
}
if (_backGroundScale9Enabled) {
_backGroundImage->setPreferredSize(_contentSize);
}
_backGroundImageTextureSize = _backGroundImage->getContentSize();
_backGroundImage->setPosition(Vec2(_contentSize.width/2.0f, _contentSize.height/2.0f));
updateBackGroundImageRGBA();
@ -660,7 +648,7 @@ void Layout::setBackGroundImageCapInsets(const Rect &capInsets)
_backGroundImageCapInsets = capInsets;
if (_backGroundScale9Enabled && _backGroundImage)
{
static_cast<Scale9Sprite*>(_backGroundImage)->setCapInsets(capInsets);
_backGroundImage->setCapInsets(capInsets);
}
}
@ -705,17 +693,11 @@ void Layout::supplyTheLayoutParameterLackToChild(Widget *child)
void Layout::addBackGroundImage()
{
if (_backGroundScale9Enabled)
{
_backGroundImage = Scale9Sprite::create();
_backGroundImage->setScale9Enabled(false);
addProtectedChild(_backGroundImage, BACKGROUNDIMAGE_Z, -1);
static_cast<Scale9Sprite*>(_backGroundImage)->setPreferredSize(_contentSize);
}
else
{
_backGroundImage = Sprite::create();
addProtectedChild(_backGroundImage, BACKGROUNDIMAGE_Z, -1);
}
_backGroundImage->setPosition(Vec2(_contentSize.width/2.0f, _contentSize.height/2.0f));
}

View File

@ -36,10 +36,11 @@ class DrawNode;
class LayerColor;
class LayerGradient;
namespace ui {
class LayoutManager;
class Scale9Sprite;
class CC_GUI_DLL LayoutProtocol
{
@ -466,7 +467,7 @@ protected:
//background
bool _backGroundScale9Enabled;
Node* _backGroundImage;
Scale9Sprite* _backGroundImage;
std::string _backGroundImageFileName;
Rect _backGroundImageCapInsets;
BackGroundColorType _colorType;

View File

@ -24,7 +24,6 @@ THE SOFTWARE.
#include "ui/UIListView.h"
#include "ui/UIHelper.h"
#include "ui/UIScale9Sprite.h"
NS_CC_BEGIN

View File

@ -81,7 +81,8 @@ LoadingBar* LoadingBar::create(const std::string &textureName, float percentage)
void LoadingBar::initRenderer()
{
_barRenderer = Sprite::create();
_barRenderer = Scale9Sprite::create();
_barRenderer->setScale9Enabled(false);
addProtectedChild(_barRenderer, BAR_RENDERER_Z, -1);
_barRenderer->setAnchorPoint(Vec2(0.0,0.5));
}
@ -100,17 +101,15 @@ void LoadingBar::setDirection(cocos2d::ui::LoadingBar::Direction direction)
case Direction::LEFT:
_barRenderer->setAnchorPoint(Vec2(0.0f,0.5f));
_barRenderer->setPosition(Vec2(-_totalLength*0.5f,0.0f));
if (!_scale9Enabled)
{
static_cast<Sprite*>(_barRenderer)->setFlippedX(false);
if (!_scale9Enabled) {
_barRenderer->setFlippedX(false);
}
break;
case Direction::RIGHT:
_barRenderer->setAnchorPoint(Vec2(1.0f,0.5f));
_barRenderer->setPosition(Vec2(_totalLength*0.5f,0.0f));
if (!_scale9Enabled)
{
static_cast<Sprite*>(_barRenderer)->setFlippedX(true);
if (!_scale9Enabled) {
_barRenderer->setFlippedX(true);
}
break;
}
@ -134,28 +133,10 @@ void LoadingBar::loadTexture(const std::string& texture,TextureResType texType)
switch (_renderBarTexType)
{
case TextureResType::LOCAL:
if (_scale9Enabled)
{
Scale9Sprite* barRendererScale9 = static_cast<Scale9Sprite*>(_barRenderer);
barRendererScale9->initWithFile(texture);
barRendererScale9->setCapInsets(_capInsets);
}
else
{
static_cast<Sprite*>(_barRenderer)->setTexture(texture);
}
_barRenderer->initWithFile(texture);
break;
case TextureResType::PLIST:
if (_scale9Enabled)
{
Scale9Sprite* barRendererScale9 = static_cast<Scale9Sprite*>(_barRenderer);
barRendererScale9->initWithSpriteFrameName(texture);
barRendererScale9->setCapInsets(_capInsets);
}
else
{
static_cast<Sprite*>(_barRenderer)->setSpriteFrame(texture);
}
_barRenderer->initWithSpriteFrameName(texture);
break;
default:
break;
@ -167,19 +148,19 @@ void LoadingBar::loadTexture(const std::string& texture,TextureResType texType)
{
case Direction::LEFT:
_barRenderer->setAnchorPoint(Vec2(0.0f,0.5f));
if (!_scale9Enabled)
{
static_cast<Sprite*>(_barRenderer)->setFlippedX(false);
if (!_scale9Enabled) {
_barRenderer->setFlippedX(false);
}
break;
case Direction::RIGHT:
_barRenderer->setAnchorPoint(Vec2(1.0f,0.5f));
if (!_scale9Enabled)
{
static_cast<Sprite*>(_barRenderer)->setFlippedX(true);
if (!_scale9Enabled) {
_barRenderer->setFlippedX(true);
}
break;
}
_barRenderer->setCapInsets(_capInsets);
barRendererScaleChangedWithSize();
updateContentSizeWithTextureSize(_barRendererTextureSize);
_barRendererAdaptDirty = true;
@ -192,18 +173,8 @@ void LoadingBar::setScale9Enabled(bool enabled)
return;
}
_scale9Enabled = enabled;
removeProtectedChild(_barRenderer);
_barRenderer = nullptr;
if (_scale9Enabled)
{
_barRenderer = Scale9Sprite::create();
}
else
{
_barRenderer = Sprite::create();
}
loadTexture(_textureFile,_renderBarTexType);
addProtectedChild(_barRenderer, BAR_RENDERER_Z, -1);
_barRenderer->setScale9Enabled(_scale9Enabled);
if (_scale9Enabled)
{
bool ignoreBefore = _ignoreSize;
@ -230,7 +201,7 @@ void LoadingBar::setCapInsets(const Rect &capInsets)
{
return;
}
static_cast<Scale9Sprite*>(_barRenderer)->setCapInsets(capInsets);
_barRenderer->setCapInsets(capInsets);
}
const Rect& LoadingBar::getCapInsets()const
@ -257,7 +228,7 @@ void LoadingBar::setPercent(float percent)
}
else
{
Sprite* spriteRenderer = static_cast<Sprite*>(_barRenderer);
Sprite* spriteRenderer = _barRenderer->getSprite();
Rect rect = spriteRenderer->getTextureRect();
rect.size.width = _barRendererTextureSize.width * res;
spriteRenderer->setTextureRect(rect, spriteRenderer->isTextureRectRotated(), rect.size);
@ -351,7 +322,7 @@ void LoadingBar::barRendererScaleChangedWithSize()
void LoadingBar::setScale9Scale()
{
float width = (float)(_percent) / 100.0f * _totalLength;
static_cast<Scale9Sprite*>(_barRenderer)->setPreferredSize(Size(width, _contentSize.height));
_barRenderer->setPreferredSize(Size(width, _contentSize.height));
}
std::string LoadingBar::getDescription() const

View File

@ -31,7 +31,7 @@ THE SOFTWARE.
NS_CC_BEGIN
namespace ui {
class Scale9Sprite;
/**
* @js NA
* @lua NA
@ -154,7 +154,7 @@ protected:
Direction _direction;
float _percent;
float _totalLength;
Node* _barRenderer;
Scale9Sprite* _barRenderer;
TextureResType _renderBarTexType;
Size _barRendererTextureSize;
bool _scale9Enabled;

View File

@ -27,47 +27,12 @@
#include "2d/CCLabel.h"
#include "2d/CCSprite.h"
#include "base/ccUTF8.h"
#include "ui/UIHelper.h"
NS_CC_BEGIN
namespace ui {
static std::string utf8_substr(const std::string& str, unsigned long start, unsigned long leng)
{
if (leng==0)
{
return "";
}
unsigned long c, i, ix, q, min=std::string::npos, max=std::string::npos;
for (q=0, i=0, ix=str.length(); i < ix; i++, q++)
{
if (q==start)
{
min = i;
}
if (q <= start+leng || leng==std::string::npos)
{
max = i;
}
c = (unsigned char) str[i];
if (c<=127) i+=0;
else if ((c & 0xE0) == 0xC0) i+=1;
else if ((c & 0xF0) == 0xE0) i+=2;
else if ((c & 0xF8) == 0xF0) i+=3;
else return "";//invalid utf8
}
if (q <= start+leng || leng == std::string::npos)
{
max = i;
}
if (min==std::string::npos || max==std::string::npos)
{
return "";
}
return str.substr(min,max);
}
bool RichElement::init(int tag, const Color3B &color, GLubyte opacity)
{
@ -318,18 +283,18 @@ void RichText::handleTextRenderer(const std::string& text, const std::string& fo
std::string curText = text;
size_t stringLength = StringUtils::getCharacterCountInUTF8String(text);
int leftLength = stringLength * (1.0f - overstepPercent);
std::string leftWords = utf8_substr(curText,0,leftLength);
std::string cutWords = utf8_substr(curText, leftLength, stringLength - leftLength);
std::string leftWords = Helper::getSubStringOfUTF8String(curText,0,leftLength);
std::string cutWords = Helper::getSubStringOfUTF8String(curText, leftLength, stringLength - leftLength);
if (leftLength > 0)
{
Label* leftRenderer = nullptr;
if (fileExist)
{
leftRenderer = Label::createWithTTF(utf8_substr(leftWords, 0, leftLength), fontName, fontSize);
leftRenderer = Label::createWithTTF(Helper::getSubStringOfUTF8String(leftWords, 0, leftLength), fontName, fontSize);
}
else
{
leftRenderer = Label::createWithSystemFont(utf8_substr(leftWords, 0, leftLength), fontName, fontSize);
leftRenderer = Label::createWithSystemFont(Helper::getSubStringOfUTF8String(leftWords, 0, leftLength), fontName, fontSize);
}
if (leftRenderer)
{

View File

@ -62,15 +62,58 @@ namespace ui {
void Scale9Sprite::cleanupSlicedSprites()
{
CC_SAFE_RELEASE(_topLeft);
CC_SAFE_RELEASE(_top);
CC_SAFE_RELEASE(_topRight);
CC_SAFE_RELEASE(_left);
CC_SAFE_RELEASE(_centre);
CC_SAFE_RELEASE(_right);
CC_SAFE_RELEASE(_bottomLeft);
CC_SAFE_RELEASE(_bottom);
CC_SAFE_RELEASE(_bottomRight);
if (_topLeft && _top->isRunning())
{
_topLeft->onExit();
}
if (_top && _top->isRunning())
{
_top->onExit();
}
if (_topRight && _top->isRunning())
{
_topRight->onExit();
}
if (_left && _top->isRunning())
{
_left->onExit();
}
if (_centre && _top->isRunning())
{
_centre->onExit();
}
if (_right && _top->isRunning())
{
_right->onExit();
}
if (_bottomLeft && _top->isRunning())
{
_bottomLeft->onExit();
}
if (_bottomRight && _top->isRunning())
{
_bottomRight->onExit();
}
if (_bottom && _top->isRunning())
{
_bottom->onExit();
}
CC_SAFE_RELEASE_NULL(_topLeft);
CC_SAFE_RELEASE_NULL(_top);
CC_SAFE_RELEASE_NULL(_topRight);
CC_SAFE_RELEASE_NULL(_left);
CC_SAFE_RELEASE_NULL(_centre);
CC_SAFE_RELEASE_NULL(_right);
CC_SAFE_RELEASE_NULL(_bottomLeft);
CC_SAFE_RELEASE_NULL(_bottom);
CC_SAFE_RELEASE_NULL(_bottomRight);
}
bool Scale9Sprite::init()
@ -145,8 +188,9 @@ y+=ytranslate; \
_preferredSize = _originalSize;
_capInsetsInternal = capInsets;
if (_scale9Enabled) {
this->createSlicedSprites(rect, rotated);
}
this->setContentSize(rect.size);
@ -347,6 +391,25 @@ y+=ytranslate; \
this->_positionsAreDirty = true;
}
void Scale9Sprite::setAnchorPoint(const cocos2d::Vec2 &anchorPoint)
{
Node::setAnchorPoint(anchorPoint);
if (_scale9Enabled) {
for(const auto& node : _protectedChildren)
{
node->setAnchorPoint(anchorPoint);
}
}
else
{
if (_scale9Image) {
_scale9Image->setAnchorPoint(anchorPoint);
}
}
}
void Scale9Sprite::updatePositions()
{
// Check that instances are non-NULL
@ -722,10 +785,6 @@ y+=ytranslate; \
}
}
//
// draw self
//
@ -744,7 +803,6 @@ y+=ytranslate; \
}
for(auto it=_children.cbegin()+i; it != _children.cend(); ++it)
(*it)->visit(renderer, _modelViewTransform, flags);
@ -795,10 +853,13 @@ y+=ytranslate; \
void Scale9Sprite::setScale9Enabled(bool enabled)
{
_scale9Enabled = enabled;
if (!_scale9Enabled) {
this->cleanupSlicedSprites();
}
_reorderProtectedChildDirty = true;
}
bool Scale9Sprite::getScale9Enabled() const
bool Scale9Sprite::isScale9Enabled() const
{
return _scale9Enabled;
}
@ -828,7 +889,8 @@ y+=ytranslate; \
void Scale9Sprite::adjustScale9ImagePosition()
{
if (_scale9Image) {
_scale9Image->setPosition(_scale9Image->getPosition() + Vec2(_originalSize.width/2, _originalSize.height/2));
_scale9Image->setPosition(Vec2(_contentSize.width * _anchorPoint.x,
_contentSize.height * _anchorPoint.y));
}
}
@ -882,21 +944,22 @@ y+=ytranslate; \
_displayedColor.b = _realColor.b * parentColor.b/255.0;
updateColor();
if (_scale9Image) {
if (_scale9Image)
{
_scale9Image->updateDisplayedColor(_displayedColor);
}
for(const auto &child : _protectedChildren){
for(const auto &child : _protectedChildren)
{
child->updateDisplayedColor(_displayedColor);
}
if (_cascadeColorEnabled)
{
for(const auto &child : _children){
for(const auto &child : _children)
{
child->updateDisplayedColor(_displayedColor);
}
}
}
@ -905,33 +968,37 @@ y+=ytranslate; \
_displayedOpacity = _realOpacity * parentOpacity/255.0;
updateColor();
if (_scale9Image) {
if (_scale9Image)
{
_scale9Image->updateDisplayedOpacity(_displayedOpacity);
}
for(auto child : _protectedChildren){
for(auto child : _protectedChildren)
{
child->updateDisplayedOpacity(_displayedOpacity);
}
if (_cascadeOpacityEnabled)
{
for(auto child : _children){
for(auto child : _children)
{
child->updateDisplayedOpacity(_displayedOpacity);
}
}
}
void Scale9Sprite::disableCascadeColor()
{
for(auto child : _children){
for(auto child : _children)
{
child->updateDisplayedColor(Color3B::WHITE);
}
for(auto child : _protectedChildren){
for(auto child : _protectedChildren)
{
child->updateDisplayedColor(Color3B::WHITE);
}
if (_scale9Image) {
if (_scale9Image)
{
_scale9Image->updateDisplayedColor(Color3B::WHITE);
}
}
@ -944,22 +1011,34 @@ y+=ytranslate; \
void Scale9Sprite::setFlippedX(bool flippedX)
{
_flippedX = flippedX;
if (_scale9Enabled) {
if (_scale9Enabled)
{
this->setScaleX(-1);
}else{
}
else
{
if (_scale9Image)
{
_scale9Image->setFlippedX(flippedX);
}
}
}
void Scale9Sprite::setFlippedY(bool flippedY)
{
_flippedY = flippedY;
if (_scale9Enabled) {
if (_scale9Enabled)
{
this->setScaleY(-1);
}else{
}
else
{
if (_scale9Image)
{
_scale9Image->setFlippedY(flippedY);
}
}
}
bool Scale9Sprite::isFlippedX()const
{

View File

@ -41,6 +41,8 @@ namespace ui {
* to specific areas of a sprite. With 9-slice scaling (3x3 grid),
* you can ensure that the sprite does not become distorted when
* scaled.
* Note: When you set _scale9Enabled to false, then you could call scale9Sprite->getSprite() to return a new Sprite pointer.
* Then you could call any methods of Sprite class with the return pointers.
*
*/
class CC_GUI_DLL Scale9Sprite : public Node
@ -246,7 +248,7 @@ namespace ui {
// overrides
virtual void setContentSize(const Size & size) override;
virtual void setAnchorPoint(const Vec2& anchorPoint) override;
Size getOriginalSize() const;
void setPreferredSize(const Size& size);
@ -262,7 +264,7 @@ namespace ui {
void setInsetBottom(float bottomInset);
float getInsetBottom()const;
void setScale9Enabled(bool enabled);
bool getScale9Enabled()const;
bool isScale9Enabled()const;

View File

@ -98,20 +98,28 @@ bool Slider::init()
void Slider::initRenderer()
{
_barRenderer = Sprite::create();
_progressBarRenderer = Sprite::create();
_barRenderer = Scale9Sprite::create();
_progressBarRenderer = Scale9Sprite::create();
_barRenderer->setScale9Enabled(false);
_progressBarRenderer->setScale9Enabled(false);
_progressBarRenderer->setAnchorPoint(Vec2(0.0f, 0.5f));
addProtectedChild(_barRenderer, BASEBAR_RENDERER_Z, -1);
addProtectedChild(_progressBarRenderer, PROGRESSBAR_RENDERER_Z, -1);
_slidBallNormalRenderer = Sprite::create();
_slidBallPressedRenderer = Sprite::create();
_slidBallPressedRenderer->setVisible(false);
_slidBallDisabledRenderer = Sprite::create();
_slidBallDisabledRenderer->setVisible(false);
_slidBallRenderer = Node::create();
_slidBallRenderer->addChild(_slidBallNormalRenderer);
_slidBallRenderer->addChild(_slidBallPressedRenderer);
_slidBallRenderer->addChild(_slidBallDisabledRenderer);
addProtectedChild(_slidBallRenderer, SLIDBALL_RENDERER_Z, -1);
}
@ -126,24 +134,10 @@ void Slider::loadBarTexture(const std::string& fileName, TextureResType texType)
switch (_barTexType)
{
case TextureResType::LOCAL:
if (_scale9Enabled)
{
static_cast<Scale9Sprite*>(_barRenderer)->initWithFile(fileName);
}
else
{
static_cast<Sprite*>(_barRenderer)->setTexture(fileName);
}
_barRenderer->initWithFile(fileName);
break;
case TextureResType::PLIST:
if (_scale9Enabled)
{
static_cast<Scale9Sprite*>(_barRenderer)->initWithSpriteFrameName(fileName);
}
else
{
static_cast<Sprite*>(_barRenderer)->setSpriteFrame(fileName);
}
_barRenderer->initWithSpriteFrameName(fileName);
break;
default:
break;
@ -165,24 +159,10 @@ void Slider::loadProgressBarTexture(const std::string& fileName, TextureResType
switch (_progressBarTexType)
{
case TextureResType::LOCAL:
if (_scale9Enabled)
{
static_cast<Scale9Sprite*>(_progressBarRenderer)->initWithFile(fileName);
}
else
{
static_cast<Sprite*>(_progressBarRenderer)->setTexture(fileName);
}
_progressBarRenderer->initWithFile(fileName);
break;
case TextureResType::PLIST:
if (_scale9Enabled)
{
static_cast<Scale9Sprite*>(_progressBarRenderer)->initWithSpriteFrameName(fileName);
}
else
{
static_cast<Sprite*>(_progressBarRenderer)->setSpriteFrame(fileName);
}
_progressBarRenderer->initWithSpriteFrameName(fileName);
break;
default:
break;
@ -201,24 +181,9 @@ void Slider::setScale9Enabled(bool able)
}
_scale9Enabled = able;
removeProtectedChild(_barRenderer);
removeProtectedChild(_progressBarRenderer);
_barRenderer = nullptr;
_progressBarRenderer = nullptr;
if (_scale9Enabled)
{
_barRenderer = Scale9Sprite::create();
_progressBarRenderer = Scale9Sprite::create();
}
else
{
_barRenderer = Sprite::create();
_progressBarRenderer = Sprite::create();
}
loadBarTexture(_textureFile, _barTexType);
loadProgressBarTexture(_progressBarTextureFile, _progressBarTexType);
addProtectedChild(_barRenderer, BASEBAR_RENDERER_Z, -1);
addProtectedChild(_progressBarRenderer, PROGRESSBAR_RENDERER_Z, -1);
_barRenderer->setScale9Enabled(_scale9Enabled);
_progressBarRenderer->setScale9Enabled(_scale9Enabled);
if (_scale9Enabled)
{
bool ignoreBefore = _ignoreSize;
@ -260,7 +225,7 @@ void Slider::setCapInsetsBarRenderer(const Rect &capInsets)
{
return;
}
static_cast<Scale9Sprite*>(_barRenderer)->setCapInsets(capInsets);
_barRenderer->setCapInsets(capInsets);
}
const Rect& Slider::getCapInsetsBarRenderer()const
@ -275,7 +240,7 @@ void Slider::setCapInsetProgressBarRebderer(const Rect &capInsets)
{
return;
}
static_cast<Scale9Sprite*>(_progressBarRenderer)->setCapInsets(capInsets);
_progressBarRenderer->setCapInsets(capInsets);
}
const Rect& Slider::getCapInsetsProgressBarRebderer()const
@ -369,15 +334,18 @@ void Slider::setPercent(int percent)
_slidBallRenderer->setPosition(Vec2(dis, _contentSize.height / 2.0f));
if (_scale9Enabled)
{
static_cast<Scale9Sprite*>(_progressBarRenderer)->setPreferredSize(Size(dis,_progressBarTextureSize.height));
_progressBarRenderer->setPreferredSize(Size(dis,_progressBarTextureSize.height));
}
else
{
Sprite* spriteRenderer = static_cast<Sprite*>(_progressBarRenderer);
Sprite* spriteRenderer = _progressBarRenderer->getSprite();
if (nullptr != spriteRenderer) {
Rect rect = spriteRenderer->getTextureRect();
rect.size.width = _progressBarTextureSize.width * res;
spriteRenderer->setTextureRect(rect, spriteRenderer->isTextureRectRotated(), rect.size);
}
}
}
bool Slider::hitTest(const cocos2d::Vec2 &pt)
@ -497,7 +465,7 @@ void Slider::barRendererScaleChangedWithSize()
_barLength = _contentSize.width;
if (_scale9Enabled)
{
static_cast<Scale9Sprite*>(_barRenderer)->setPreferredSize(_contentSize);
_barRenderer->setPreferredSize(_contentSize);
}
else
{
@ -534,7 +502,7 @@ void Slider::progressBarRendererScaleChangedWithSize()
{
if (_scale9Enabled)
{
static_cast<Scale9Sprite*>(_progressBarRenderer)->setPreferredSize(_contentSize);
_progressBarRenderer->setPreferredSize(_contentSize);
_progressBarTextureSize = _progressBarRenderer->getContentSize();
}
else

View File

@ -33,6 +33,7 @@ NS_CC_BEGIN
class Sprite;
namespace ui {
class Scale9Sprite;
typedef enum
{
@ -226,8 +227,8 @@ protected:
virtual void copySpecialProperties(Widget* model) override;
virtual void adaptRenderers() override;
protected:
Node* _barRenderer;
Node* _progressBarRenderer;
Scale9Sprite* _barRenderer;
Scale9Sprite* _progressBarRenderer;
Size _progressBarTextureSize;
Sprite* _slidBallNormalRenderer;

View File

@ -208,6 +208,16 @@ TextVAlignment Text::getTextVerticalAlignment()const
return _labelRenderer->getVerticalAlignment();
}
void Text::setTextColor(const Color4B color)
{
_labelRenderer->setTextColor(color);
}
const Color4B& Text::getTextColor() const
{
return _labelRenderer->getTextColor();
}
void Text::setTouchScaleChangeEnabled(bool enable)
{
_touchScaleChangeEnabled = enable;

View File

@ -161,6 +161,10 @@ public:
TextVAlignment getTextVerticalAlignment()const;
void setTextColor(const Color4B color);
const Color4B& getTextColor() const;
/**
* Enable shadow for the label
*

View File

@ -24,28 +24,13 @@ THE SOFTWARE.
#include "ui/UITextField.h"
#include "platform/CCFileUtils.h"
#include "ui/UIHelper.h"
#include "base/ccUTF8.h"
NS_CC_BEGIN
namespace ui {
static int _calcCharCount(const char * pszText)
{
int n = 0;
char ch = 0;
while ((ch = *pszText))
{
CC_BREAK_IF(! ch);
if (0x80 != (0xC0 & ch))
{
++n;
}
++pszText;
}
return n;
}
UICCTextField::UICCTextField()
: _maxLengthEnabled(false)
, _maxLength(0)
@ -130,7 +115,7 @@ void UICCTextField::insertText(const char* text, size_t len)
{
if (_maxLengthEnabled)
{
int text_count = _calcCharCount(getString().c_str());
long text_count = StringUtils::getCharacterCountInUTF8String(getString());
if (text_count >= _maxLength)
{
// password
@ -141,69 +126,16 @@ void UICCTextField::insertText(const char* text, size_t len)
return;
}
#if ((CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32))
int input_count = _calcCharCount(text);
int total = total = text_count + input_count;
long input_count = StringUtils::getCharacterCountInUTF8String(text);
long total = text_count + input_count;
if (total > _maxLength)
{
int end = 0;
int length = _maxLength - text_count;
long length = _maxLength - text_count;
for (int i = 0; i < length; ++i)
{
char value = text[i];
if (value >= 0 && value <= 127) // ascii
{
end++;
input_text = Helper::getSubStringOfUTF8String(input_text, 0, length);
len = input_text.length();
}
else
{
end += 3;
}
}
input_text = input_text.substr(0, end);
len = end;
}
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
int input_count = _calcCharCount(text);
int total = text_count + input_count;
if (total > _maxLength)
{
int ascii = 0;
int unicode = 0;
int end = 0;
int count = 0;
for (int i = 0; i < total * 3; ++i)
{
char value = text[i];
if (value >= 0 && value <= 127) // ascii
{
ascii++;
count++;
}
else
{
unicode++;
if (unicode % 3 == 0)
{
count++;
}
}
if (count == _maxLength)
{
break;
}
}
end = ascii + unicode;
input_text = input_text.substr(0, end);
len = end;
}
#endif
}
}
TextFieldTTF::insertText(input_text.c_str(), len);
@ -294,8 +226,8 @@ void UICCTextField::setPasswordStyleText(const std::string& styleText)
void UICCTextField::setPasswordText(const std::string& text)
{
std::string tempStr = "";
int text_count = _calcCharCount(text.c_str());
int max = text_count;
long text_count = StringUtils::getCharacterCountInUTF8String(text);
long max = text_count;
if (_maxLengthEnabled)
{
@ -479,40 +411,11 @@ void TextField::setText(const std::string& text)
if (isMaxLengthEnabled())
{
int max = _textFieldRenderer->getMaxLength();
int text_count = _calcCharCount(text.c_str());
int total = text_count + _calcCharCount(getStringValue().c_str());
long text_count = StringUtils::getCharacterCountInUTF8String(text);
long total = text_count + StringUtils::getCharacterCountInUTF8String(getStringValue());
if (total > max)
{
int ascii = 0;
int unicode = 0;
int end = 0;
int count = 0;
for (int i = 0; i < total * 3; ++i)
{
char value = text[i];
if (value >= 0 && value <= 127) // ascii
{
ascii++;
count++;
}
else
{
unicode++;
if (unicode % 3 == 0)
{
count++;
}
}
if (count == max)
{
break;
}
}
end = ascii + unicode;
strText = strText.substr(0, end);
strText = Helper::getSubStringOfUTF8String(strText, 0, max);
}
}

View File

@ -25,7 +25,7 @@ THE SOFTWARE.
#ifndef __UIWIDGET_H__
#define __UIWIDGET_H__
#include "ui/CCProtectedNode.h"
#include "2d/CCProtectedNode.h"
#include "ui/UILayoutParameter.h"
#include "ui/GUIDefine.h"
#include "ui/GUIExport.h"

View File

@ -11,7 +11,6 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\CCProtectedNode.h" />
<ClInclude Include="..\CocosGUI.h" />
<ClInclude Include="..\GUIExport.h" />
<ClInclude Include="..\UIButton.h" />
@ -39,7 +38,6 @@
<ClInclude Include="..\UIWidget.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\CCProtectedNode.cpp" />
<ClCompile Include="..\CocosGUI.cpp" />
<ClCompile Include="..\UIButton.cpp" />
<ClCompile Include="..\UICheckBox.cpp" />
@ -147,7 +145,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>
</SDLCheck>
<PreprocessorDefinitions>WIN32;_WINDOWS;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;CC_CONSTRUCTOR_ACCESS=public;_USEGUIDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WINDOWS;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_USEGUIDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support;$(EngineRoot)external;$(EngineRoot)extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DebugInformationFormat>None</DebugInformationFormat>
<WholeProgramOptimization>false</WholeProgramOptimization>

View File

@ -72,9 +72,6 @@
<ClInclude Include="..\UIRichText.h">
<Filter>UIWidgets</Filter>
</ClInclude>
<ClInclude Include="..\CCProtectedNode.h">
<Filter>BaseClasses</Filter>
</ClInclude>
<ClInclude Include="..\UIHBox.h">
<Filter>Layouts</Filter>
</ClInclude>
@ -152,9 +149,6 @@
<ClCompile Include="..\UIRichText.cpp">
<Filter>UIWidgets</Filter>
</ClCompile>
<ClCompile Include="..\CCProtectedNode.cpp">
<Filter>BaseClasses</Filter>
</ClCompile>
<ClCompile Include="..\UIHBox.cpp">
<Filter>Layouts</Filter>
</ClCompile>

View File

@ -165,7 +165,6 @@
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<ItemGroup>
<ClInclude Include="..\..\ui\CCProtectedNode.h" />
<ClInclude Include="..\..\ui\CocosGUI.h" />
<ClInclude Include="..\..\ui\UIButton.h" />
<ClInclude Include="..\..\ui\UIHelper.h" />
@ -191,7 +190,6 @@
<ClInclude Include="..\UIScale9Sprite.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\ui\CCProtectedNode.cpp" />
<ClCompile Include="..\..\ui\CocosGUI.cpp" />
<ClCompile Include="..\..\ui\UIButton.cpp" />
<ClCompile Include="..\..\ui\UICheckBox.cpp" />

View File

@ -69,9 +69,6 @@
<ClInclude Include="..\..\ui\UIWidget.h">
<Filter>BaseClasses</Filter>
</ClInclude>
<ClInclude Include="..\..\ui\CCProtectedNode.h">
<Filter>BaseClasses</Filter>
</ClInclude>
<ClInclude Include="..\..\ui\UIVBox.h">
<Filter>Layouts</Filter>
</ClInclude>
@ -146,9 +143,6 @@
<ClCompile Include="..\..\ui\UIWidget.cpp">
<Filter>BaseClasses</Filter>
</ClCompile>
<ClCompile Include="..\..\ui\CCProtectedNode.cpp">
<Filter>BaseClasses</Filter>
</ClCompile>
<ClCompile Include="..\..\ui\UIVBox.cpp">
<Filter>Layouts</Filter>
</ClCompile>

View File

@ -95,7 +95,7 @@
<Optimization>MinSpace</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\include;$(EngineRoot);$(EngineRoot)cocos\audio\include;$(EngineRoot)external;$(EngineRoot)external\unzip;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\curl\include\win32;$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\libwebsockets\win32\include;$(EngineRoot)external\win32-specific\zlib\include;..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;CC_CONSTRUCTOR_ACCESS=public;_USREXDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_USREXDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>

View File

@ -147,6 +147,8 @@
"cocos/2d/CCParticleSystemQuad.h",
"cocos/2d/CCProgressTimer.cpp",
"cocos/2d/CCProgressTimer.h",
"cocos/2d/CCProtectedNode.cpp",
"cocos/2d/CCProtectedNode.h",
"cocos/2d/CCRenderTexture.cpp",
"cocos/2d/CCRenderTexture.h",
"cocos/2d/CCScene.cpp",
@ -984,8 +986,6 @@
"cocos/storage/local-storage/proj.wp8/libLocalStorage.vcxproj",
"cocos/storage/local-storage/proj.wp8/libLocalStorage.vcxproj.filters",
"cocos/ui/Android.mk",
"cocos/ui/CCProtectedNode.cpp",
"cocos/ui/CCProtectedNode.h",
"cocos/ui/CMakeLists.txt",
"cocos/ui/CocosGUI.cpp",
"cocos/ui/CocosGUI.h",

View File

@ -2,6 +2,7 @@
#define _TIMELINE_TESTLAYER_H_
#include "cocos2d.h"
#include "audio/include/SimpleAudioEngine.h"
#include "extensions/cocos-ext.h"
#include "cocosbuilder/CocosBuilder.h"

View File

@ -63,7 +63,7 @@ g_guisTests[] =
UISceneManager* sceneManager = UISceneManager::sharedUISceneManager();
sceneManager->setCurrentUISceneId(kUIButtonTest);
sceneManager->setMinUISceneId(kUIButtonTest);
sceneManager->setMaxUISceneId(kUIButtonTest_RemoveSelf);
sceneManager->setMaxUISceneId(kUIButtonTestSwitchScale9);
Scene* scene = sceneManager->currentUIScene();
Director::getInstance()->replaceScene(scene);
}

View File

@ -378,13 +378,23 @@ bool UIButtonTestRemoveSelf::init()
_uiLayer->addChild(alert);
Layout *layout = Layout::create();
layout->setContentSize(widgetSize * 0.6);
layout->setBackGroundColor(Color3B::GREEN);
layout->setBackGroundColorType(Layout::BackGroundColorType::SOLID);
layout->setBackGroundColorOpacity(100);
layout->setPosition(Size(widgetSize.width/2, widgetSize.height/2));
layout->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
layout->setTag(12);
_uiLayer->addChild(layout);
// Create the button
Button* button = Button::create("cocosui/animationbuttonnormal.png",
"cocosui/animationbuttonpressed.png");
button->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
button->setPosition(Vec2(layout->getContentSize().width / 2.0f, layout->getContentSize().height / 2.0f));
// button->addTouchEventListener(this, toucheventselector(UIButtonTest::touchEvent));
button->addTouchEventListener(CC_CALLBACK_2(UIButtonTestRemoveSelf::touchEvent, this));
_uiLayer->addChild(button);
layout->addChild(button);
@ -408,8 +418,86 @@ void UIButtonTestRemoveSelf::touchEvent(Ref *pSender, Widget::TouchEventType typ
case Widget::TouchEventType::ENDED:
{
_displayValueLabel->setString(String::createWithFormat("Touch Up")->getCString());
_uiLayer->removeFromParentAndCleanup(true);
auto layout = _uiLayer->getChildByTag(12);
layout->removeFromParentAndCleanup(true);
}
break;
case Widget::TouchEventType::CANCELED:
_displayValueLabel->setString(String::createWithFormat("Touch Cancelled")->getCString());
break;
default:
break;
}
}
// UIButtonTestSwitchScale9
UIButtonTestSwitchScale9::UIButtonTestSwitchScale9()
: _displayValueLabel(nullptr)
{
}
UIButtonTestSwitchScale9::~UIButtonTestSwitchScale9()
{
}
bool UIButtonTestSwitchScale9::init()
{
if (UIScene::init())
{
Size widgetSize = _widget->getContentSize();
// Add a label in which the button events will be displayed
_displayValueLabel = Text::create("No Event", "fonts/Marker Felt.ttf",32);
_displayValueLabel->setAnchorPoint(Vec2(0.5f, -1.0f));
_displayValueLabel->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
_uiLayer->addChild(_displayValueLabel);
// Add the alert
Text* alert = Text::create("Button","fonts/Marker Felt.ttf",30);
alert->setColor(Color3B(159, 168, 176));
alert->setPosition(Vec2(widgetSize.width / 2.0f,
widgetSize.height / 2.0f - alert->getContentSize().height * 1.75f));
_uiLayer->addChild(alert);
// Create the button
Button* button = Button::create("cocosui/animationbuttonnormal.png",
"cocosui/animationbuttonpressed.png");
button->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
button->addTouchEventListener(CC_CALLBACK_2(UIButtonTestSwitchScale9::touchEvent, this));
button->ignoreContentAdaptWithSize(false);
_uiLayer->addChild(button);
return true;
}
return false;
}
void UIButtonTestSwitchScale9::touchEvent(Ref *pSender, Widget::TouchEventType type)
{
switch (type)
{
case Widget::TouchEventType::BEGAN:
_displayValueLabel->setString(String::createWithFormat("Touch Down")->getCString());
break;
case Widget::TouchEventType::MOVED:
_displayValueLabel->setString(String::createWithFormat("Touch Move")->getCString());
break;
case Widget::TouchEventType::ENDED:
{
_displayValueLabel->setString(String::createWithFormat("Touch Up")->getCString());
auto btn = ((Button*)pSender);
btn->setScale9Enabled(!btn->isScale9Enabled());
btn->setContentSize(Size(200,100));
}
break;

View File

@ -92,4 +92,17 @@ protected:
Text* _displayValueLabel;
};
class UIButtonTestSwitchScale9 : public UIScene
{
public:
UIButtonTestSwitchScale9();
~UIButtonTestSwitchScale9();
bool init();
void touchEvent(Ref *pSender, Widget::TouchEventType type);
protected:
UI_SCENE_CREATE_FUNC(UIButtonTestSwitchScale9)
Text* _displayValueLabel;
};
#endif /* defined(__TestCpp__UIButtonTest__) */

View File

@ -20,6 +20,19 @@ bool UIRichTextTest::init()
{
Size widgetSize = _widget->getContentSize();
std::string str1 = "中国中国中";
std::string str2 = "ご静聴ありがとうございました!!ご静聴ありがとうございました!!";
CCLOG("str1:%s ascii length = %ld, utf8 length = %ld, substr = %s",
str1.c_str(),
str1.length(),
StringUtils::getCharacterCountInUTF8String(str1),
Helper::getSubStringOfUTF8String(str1, 0, 5).c_str());
CCLOG("str2:%s ascii length = %ld, utf8 length = %ld, substr = %s",
str2.c_str(),
str2.length(),
StringUtils::getCharacterCountInUTF8String(str2),
Helper::getSubStringOfUTF8String(str2, 0, 2).c_str());
// Add the alert
Text *alert = Text::create("RichText", "fonts/Marker Felt.ttf", 30);
alert->setColor(Color3B(159, 168, 176));
@ -31,7 +44,6 @@ bool UIRichTextTest::init()
button->setTouchEnabled(true);
button->setTitleText("switch");
button->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f + button->getContentSize().height * 2.5));
// button->addTouchEventListener(this, toucheventselector(UIRichTextTest::touchEvent));
button->addTouchEventListener(CC_CALLBACK_2(UIRichTextTest::touchEvent, this));
button->setLocalZOrder(10);
_widget->addChild(button);
@ -45,7 +57,7 @@ bool UIRichTextTest::init()
RichElementText* re1 = RichElementText::create(1, Color3B::WHITE, 255, "中国中国中国中国中国中国中国中国中国中国", "Marker Felt", 10);
RichElementText* re2 = RichElementText::create(2, Color3B::YELLOW, 255, "And this is yellow. ", "Helvetica", 10);
RichElementText* re3 = RichElementText::create(3, Color3B::GRAY, 255, "ご静聴ありがとうございました!!ご静聴ありがとうございました!!", "Helvetica", 10);
RichElementText* re4 = RichElementText::create(4, Color3B::GREEN, 255, "And green. ", "Helvetica", 10);
RichElementText* re4 = RichElementText::create(4, Color3B::GREEN, 255, "And green with TTF support. ", "fonts/Marker Felt.ttf", 10);
RichElementText* re5 = RichElementText::create(5, Color3B::RED, 255, "Last one is red ", "Helvetica", 10);
RichElementImage* reimg = RichElementImage::create(6, Color3B::WHITE, 255, "cocosui/sliderballnormal.png");

View File

@ -22,21 +22,7 @@
#include "UIVideoPlayerTest/UIVideoPlayerTest.h"
#endif
#include "UIScale9SpriteTest.h"
/*
#include "UISwitchTest/UISwitchTest.h"
*/
/*
#include "UIProgressTimerTest/UIProgressTimerTest.h"
*/
/*
#include "UIPotentiometerTest/UIPotentiometerTest.h"
*/
/*
#include "UIGridViewTest/UIGridViewTest.h"
*/
/*
#include "UIPickerViewTest/UIPickerViewTest.h"
*/
USING_NS_CC;
@ -47,17 +33,11 @@ static const char* s_testArray[] =
"UIButtonTest_PressedAction",
"UIButtonTest_Title",
"UIButtonTest_RemoveSelf",
"UIButtonTestSwitchScale9",
"UICheckBoxTest",
"UISliderTest",
"UISliderTest_Scale9",
/*
"UIPotentiometerTest",
*/
/*
"UISwitchTest_Horizontal",
"UISwitchTest_Vertical",
"UISwitchTest_VerticalAndTitleVertical",
*/
"UIImageViewTest",
"UIImageViewTest_Scale9",
"UIImageViewTest_ContentSize",
@ -65,15 +45,7 @@ static const char* s_testArray[] =
"UILoadingBarTest_Right",
"UILoadingBarTest_Left_Scale9",
"UILoadingBarTest_Right_Scale9",
/*
"UIProgressTimerTest_Radial",
"UIProgressTimerTest_Horizontal",
"UIProgressTimerTest_Vertical",
"UIProgressTimerTest_RadialMidpointChanged",
"UIProgressTimerTest_BarVarious",
"UIProgressTimerTest_BarTintAndFade",
"UIProgressTimerTest_WithSpriteFrame",
*/
"UITextAtlasTest",
"UITextTest",
"UITextTest_LineWrap",
@ -96,9 +68,7 @@ static const char* s_testArray[] =
"UILayoutTest_Layout_Linear_Horizontal",
"UILayoutTest_Layout_Relative_Align_Parent",
"UILayoutTest_Layout_Relative_Location",
/*
"UILayoutTest_Layout_Grid",
*/
"UIScrollViewTest_Vertical",
"UIScrollViewTest_Horizontal",
"UIScrollViewTest_Both",
@ -108,14 +78,7 @@ static const char* s_testArray[] =
"UIPageViewButtonTest",
"UIListViewTest_Vertical",
"UIListViewTest_Horizontal",
/*
"UIGridViewTest_Mode_Column",
"UIGridViewTest_Mode_Row",
*/
/*
"UIPickerViewTest_Vertical",
"UIPickerViewTest_Horizontal",
*/
"UIWidgetAddNodeTest",
"UIRichTextTest",
"UIFocusTest-HBox",
@ -214,6 +177,8 @@ Scene *UISceneManager::currentUIScene()
return UIButtonTest_Title::sceneWithTitle(s_testArray[_currentUISceneId]);
case kUIButtonTest_RemoveSelf:
return UIButtonTestRemoveSelf::sceneWithTitle(s_testArray[_currentUISceneId]);
case kUIButtonTestSwitchScale9:
return UIButtonTestSwitchScale9::sceneWithTitle(s_testArray[_currentUISceneId]);
case kUICheckBoxTest:
return UICheckBoxTest::sceneWithTitle(s_testArray[_currentUISceneId]);

View File

@ -36,6 +36,7 @@ enum
kUIButtonTest_PressedAction,
kUIButtonTest_Title,
kUIButtonTest_RemoveSelf,
kUIButtonTestSwitchScale9,
kUICheckBoxTest,
kUISliderTest,
kUISliderTest_Scale9,

View File

@ -32,7 +32,7 @@ bool UITextFieldTest::init()
_uiLayer->addChild(alert);
// Create the textfield
TextField* textField = TextField::create("input words here","fonts/Marker Felt.ttf",30);
TextField* textField = TextField::create("input words here","Arial",30);
textField->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
textField->addEventListener(CC_CALLBACK_2(UITextFieldTest::textFieldEvent, this));
@ -110,7 +110,7 @@ bool UITextFieldTest_MaxLength::init()
_uiLayer->addChild(alert);
// Create the textfield
TextField* textField = TextField::create("input words here","fonts/Marker Felt.ttf",30);
TextField* textField = TextField::create("input words here","Arial",30);
textField->setMaxLengthEnabled(true);
textField->setMaxLength(3);
textField->setPosition(Vec2(screenSize.width / 2.0f, screenSize.height / 2.0f));
@ -194,7 +194,7 @@ bool UITextFieldTest_Password::init()
_uiLayer->addChild(alert);
// Create the textfield
TextField* textField = TextField::create("input password here","fonts/Marker Felt.ttf",30);
TextField* textField = TextField::create("input password here","Arial",30);
textField->setPasswordEnabled(true);
textField->setPasswordStyleText("*");
textField->setPosition(Vec2(screenSize.width / 2.0f, screenSize.height / 2.0f));
@ -276,7 +276,8 @@ bool UITextFieldTest_LineWrap::init()
TextField* textField = TextField::create("input words here","fonts/Marker Felt.ttf",30);
textField->ignoreContentAdaptWithSize(false);
((Label*)(textField->getVirtualRenderer()))->setLineBreakWithoutSpace(true);
textField->setContentSize(Size(240, 70));
textField->setContentSize(Size(240, 170));
textField->setText("input words here");
textField->setTextHorizontalAlignment(TextHAlignment::CENTER);
textField->setTextVerticalAlignment(TextVAlignment::CENTER);
textField->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
@ -297,7 +298,7 @@ void UITextFieldTest_LineWrap::textFieldEvent(Ref *pSender, TextField::EventType
TextField* textField = dynamic_cast<TextField*>(pSender);
Size widgetSize = _widget->getContentSize();
textField->runAction(CCMoveTo::create(0.225f,
Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f + textField->getContentSize().height / 2)));
Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f + 30)));
textField->setTextHorizontalAlignment(TextHAlignment::LEFT);
textField->setTextVerticalAlignment(TextVAlignment::TOP);

View File

@ -2,6 +2,7 @@
#define _TEST_BASIC_H_
#include "cocos2d.h"
#include "audio/include/SimpleAudioEngine.h"
#include "VisibleRect.h"
USING_NS_CC;

View File

@ -106,7 +106,7 @@
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>..\Classes;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\network;$(EngineRoot)external;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\curl\include\win32;$(EngineRoot)external\websockets\win32\include;$(EngineRoot)extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USE_MATH_DEFINES;GL_GLEXT_PROTOTYPES;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;CC_CONSTRUCTOR_ACCESS=public;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USE_MATH_DEFINES;GL_GLEXT_PROTOTYPES;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>

View File

@ -1,5 +1,5 @@
#put xctool.sh into your PATH
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
COCOS2DX_ROOT="$DIR"/../..
xcodebuild -project "$COCOS2DX_ROOT"/build/cocos2d_tests.xcodeproj -target "build all tests iOS" -destination "platform=iOS Simulator,name=iPhone Retina (4-inch)" clean
xcodebuild -project "$COCOS2DX_ROOT"/build/cocos2d_tests.xcodeproj -target "build all tests iOS" -destination "platform=iOS Simulator,name=iPhone Retina (4-inch)" build
xcodebuild -project "$COCOS2DX_ROOT"/build/cocos2d_tests.xcodeproj -scheme "build all tests iOS" -destination "platform=iOS Simulator,name=iPhone Retina (4-inch)" clean
xcodebuild -project "$COCOS2DX_ROOT"/build/cocos2d_tests.xcodeproj -scheme "build all tests iOS" -destination "platform=iOS Simulator,name=iPhone Retina (4-inch)" build

View File

@ -22,7 +22,7 @@ cxxgenerator_headers =
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
# what headers to parse
headers = %(cocosdir)s/cocos/cocos2d.h %(cocosdir)s/cocos/audio/include/SimpleAudioEngine.h %(cocosdir)s/cocos/ui/CCProtectedNode.h %(cocosdir)s/cocos/3d/CCAnimation3D.h %(cocosdir)s/cocos/3d/CCAnimate3D.h
headers = %(cocosdir)s/cocos/cocos2d.h %(cocosdir)s/cocos/audio/include/SimpleAudioEngine.h %(cocosdir)s/cocos/2d/CCProtectedNode.h %(cocosdir)s/cocos/3d/CCAnimation3D.h %(cocosdir)s/cocos/3d/CCAnimate3D.h
# what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^Menu*$".