mirror of https://github.com/axmolengine/axmol.git
commit
c1c942d673
|
@ -3,8 +3,10 @@ cocos2d-x-3.3?? ??
|
|||
[NEW] Node: added stopAllActionsByTag()
|
||||
[NEW] UI: added `WebView` on iOS and Android
|
||||
|
||||
[FIX] EditBox: moved to ui:EditBox
|
||||
[FIX] Node: create unneeded temple `Vec2` object in `setPosition(int, int)`, `setPositionX()` and `setPositionY()`
|
||||
[FIX] Node: skew effect is wrong
|
||||
[FIX] Node: setNormalizedPosition can not take effect if parent position is not changed
|
||||
[FIX] TextureAtlas: may crash if only drawing part of it
|
||||
|
||||
cocos2d-x-3.3alpha0 Aug.28 2014
|
||||
|
|
|
@ -969,8 +969,6 @@
|
|||
15AE1BDD19AAE01E00C27E9E /* CCControlUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 46A168491807AF4E005B8026 /* CCControlUtils.h */; };
|
||||
15AE1BDE19AAE01E00C27E9E /* CCInvocation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46A1684A1807AF4E005B8026 /* CCInvocation.cpp */; };
|
||||
15AE1BDF19AAE01E00C27E9E /* CCInvocation.h in Headers */ = {isa = PBXBuildFile; fileRef = 46A1684B1807AF4E005B8026 /* CCInvocation.h */; };
|
||||
15AE1BE019AAE01E00C27E9E /* CCScale9Sprite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46A1684C1807AF4E005B8026 /* CCScale9Sprite.cpp */; };
|
||||
15AE1BE119AAE01E00C27E9E /* CCScale9Sprite.h in Headers */ = {isa = PBXBuildFile; fileRef = 46A1684D1807AF4E005B8026 /* CCScale9Sprite.h */; };
|
||||
15AE1BE219AAE01E00C27E9E /* CCScrollView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46A1685E1807AF4E005B8026 /* CCScrollView.cpp */; };
|
||||
15AE1BE319AAE01E00C27E9E /* CCScrollView.h in Headers */ = {isa = PBXBuildFile; fileRef = 46A1685F1807AF4E005B8026 /* CCScrollView.h */; };
|
||||
15AE1BE419AAE01E00C27E9E /* CCTableView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46A168621807AF4E005B8026 /* CCTableView.cpp */; };
|
||||
|
@ -1000,24 +998,12 @@
|
|||
15AE1BFC19AAE01E00C27E9E /* CCControlUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 46A168491807AF4E005B8026 /* CCControlUtils.h */; };
|
||||
15AE1BFD19AAE01E00C27E9E /* CCInvocation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46A1684A1807AF4E005B8026 /* CCInvocation.cpp */; };
|
||||
15AE1BFE19AAE01E00C27E9E /* CCInvocation.h in Headers */ = {isa = PBXBuildFile; fileRef = 46A1684B1807AF4E005B8026 /* CCInvocation.h */; };
|
||||
15AE1BFF19AAE01E00C27E9E /* CCScale9Sprite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46A1684C1807AF4E005B8026 /* CCScale9Sprite.cpp */; };
|
||||
15AE1C0019AAE01E00C27E9E /* CCScale9Sprite.h in Headers */ = {isa = PBXBuildFile; fileRef = 46A1684D1807AF4E005B8026 /* CCScale9Sprite.h */; };
|
||||
15AE1C0119AAE01E00C27E9E /* CCScrollView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46A1685E1807AF4E005B8026 /* CCScrollView.cpp */; };
|
||||
15AE1C0219AAE01E00C27E9E /* CCScrollView.h in Headers */ = {isa = PBXBuildFile; fileRef = 46A1685F1807AF4E005B8026 /* CCScrollView.h */; };
|
||||
15AE1C0319AAE01E00C27E9E /* CCTableView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46A168621807AF4E005B8026 /* CCTableView.cpp */; };
|
||||
15AE1C0419AAE01E00C27E9E /* CCTableView.h in Headers */ = {isa = PBXBuildFile; fileRef = 46A168631807AF4E005B8026 /* CCTableView.h */; };
|
||||
15AE1C0519AAE01E00C27E9E /* CCTableViewCell.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46A168641807AF4E005B8026 /* CCTableViewCell.cpp */; };
|
||||
15AE1C0619AAE01E00C27E9E /* CCTableViewCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 46A168651807AF4E005B8026 /* CCTableViewCell.h */; };
|
||||
15AE1C0719AAE02500C27E9E /* CCEditBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46A1684F1807AF4E005B8026 /* CCEditBox.cpp */; };
|
||||
15AE1C0819AAE02500C27E9E /* CCEditBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 46A168501807AF4E005B8026 /* CCEditBox.h */; };
|
||||
15AE1C0919AAE02500C27E9E /* CCEditBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46A1684F1807AF4E005B8026 /* CCEditBox.cpp */; };
|
||||
15AE1C0A19AAE02500C27E9E /* CCEditBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 46A168501807AF4E005B8026 /* CCEditBox.h */; };
|
||||
15AE1C0B19AAE02D00C27E9E /* CCEditBoxImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 46A168511807AF4E005B8026 /* CCEditBoxImpl.h */; };
|
||||
15AE1C0C19AAE02D00C27E9E /* CCEditBoxImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 46A168511807AF4E005B8026 /* CCEditBoxImpl.h */; };
|
||||
15AE1C0D19AAE03400C27E9E /* CCEditBoxImplMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = B282B47C1980E02B00666787 /* CCEditBoxImplMac.mm */; };
|
||||
15AE1C0E19AAE03400C27E9E /* CCEditBoxImplMac.h in Headers */ = {isa = PBXBuildFile; fileRef = B282B47D1980E02B00666787 /* CCEditBoxImplMac.h */; };
|
||||
15AE1C0F19AAE03E00C27E9E /* CCEditBoxImplIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 46A168541807AF4E005B8026 /* CCEditBoxImplIOS.h */; };
|
||||
15AE1C1019AAE03E00C27E9E /* CCEditBoxImplIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 46A168551807AF4E005B8026 /* CCEditBoxImplIOS.mm */; };
|
||||
15AE1C1119AAE2C600C27E9E /* CCPhysicsDebugNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AD71EEC180E27CF00808F54 /* CCPhysicsDebugNode.cpp */; };
|
||||
15AE1C1219AAE2C600C27E9E /* CCPhysicsDebugNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AD71EED180E27CF00808F54 /* CCPhysicsDebugNode.h */; };
|
||||
15AE1C1319AAE2C600C27E9E /* CCPhysicsSprite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AD71EEE180E27CF00808F54 /* CCPhysicsSprite.cpp */; };
|
||||
|
@ -1350,6 +1336,30 @@
|
|||
1ABA68B11888D700007D1BB4 /* CCFontCharMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABA68AD1888D700007D1BB4 /* CCFontCharMap.h */; };
|
||||
1AC0269C1914068200FA920D /* ConvertUTF.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC026991914068200FA920D /* ConvertUTF.h */; };
|
||||
1AC0269D1914068200FA920D /* ConvertUTF.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC026991914068200FA920D /* ConvertUTF.h */; };
|
||||
292DB13D19B4574100A80320 /* UIEditBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 292DB12F19B4574100A80320 /* UIEditBox.cpp */; };
|
||||
292DB13E19B4574100A80320 /* UIEditBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 292DB12F19B4574100A80320 /* UIEditBox.cpp */; };
|
||||
292DB13F19B4574100A80320 /* UIEditBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 292DB13019B4574100A80320 /* UIEditBox.h */; };
|
||||
292DB14019B4574100A80320 /* UIEditBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 292DB13019B4574100A80320 /* UIEditBox.h */; };
|
||||
292DB14119B4574100A80320 /* UIEditBoxImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 292DB13119B4574100A80320 /* UIEditBoxImpl.h */; };
|
||||
292DB14219B4574100A80320 /* UIEditBoxImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 292DB13119B4574100A80320 /* UIEditBoxImpl.h */; };
|
||||
292DB14319B4574100A80320 /* UIEditBoxImplAndroid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 292DB13219B4574100A80320 /* UIEditBoxImplAndroid.cpp */; };
|
||||
292DB14419B4574100A80320 /* UIEditBoxImplAndroid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 292DB13219B4574100A80320 /* UIEditBoxImplAndroid.cpp */; };
|
||||
292DB14519B4574100A80320 /* UIEditBoxImplAndroid.h in Headers */ = {isa = PBXBuildFile; fileRef = 292DB13319B4574100A80320 /* UIEditBoxImplAndroid.h */; };
|
||||
292DB14619B4574100A80320 /* UIEditBoxImplAndroid.h in Headers */ = {isa = PBXBuildFile; fileRef = 292DB13319B4574100A80320 /* UIEditBoxImplAndroid.h */; };
|
||||
292DB14719B4574100A80320 /* UIEditBoxImplIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 292DB13419B4574100A80320 /* UIEditBoxImplIOS.h */; };
|
||||
292DB14819B4574100A80320 /* UIEditBoxImplIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 292DB13419B4574100A80320 /* UIEditBoxImplIOS.h */; };
|
||||
292DB14919B4574100A80320 /* UIEditBoxImplIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 292DB13519B4574100A80320 /* UIEditBoxImplIOS.mm */; };
|
||||
292DB14A19B4574100A80320 /* UIEditBoxImplIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 292DB13519B4574100A80320 /* UIEditBoxImplIOS.mm */; };
|
||||
292DB14B19B4574100A80320 /* UIEditBoxImplMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 292DB13619B4574100A80320 /* UIEditBoxImplMac.h */; };
|
||||
292DB14C19B4574100A80320 /* UIEditBoxImplMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 292DB13619B4574100A80320 /* UIEditBoxImplMac.h */; };
|
||||
292DB14D19B4574100A80320 /* UIEditBoxImplMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 292DB13719B4574100A80320 /* UIEditBoxImplMac.mm */; };
|
||||
292DB14E19B4574100A80320 /* UIEditBoxImplMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 292DB13719B4574100A80320 /* UIEditBoxImplMac.mm */; };
|
||||
292DB14F19B4574100A80320 /* UIEditBoxImplNone.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 292DB13819B4574100A80320 /* UIEditBoxImplNone.cpp */; };
|
||||
292DB15019B4574100A80320 /* UIEditBoxImplNone.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 292DB13819B4574100A80320 /* UIEditBoxImplNone.cpp */; };
|
||||
292DB15F19B461CA00A80320 /* ExtensionDeprecated.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 292DB15D19B461CA00A80320 /* ExtensionDeprecated.cpp */; };
|
||||
292DB16019B461CA00A80320 /* ExtensionDeprecated.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 292DB15D19B461CA00A80320 /* ExtensionDeprecated.cpp */; };
|
||||
292DB16119B461CA00A80320 /* ExtensionDeprecated.h in Headers */ = {isa = PBXBuildFile; fileRef = 292DB15E19B461CA00A80320 /* ExtensionDeprecated.h */; };
|
||||
292DB16219B461CA00A80320 /* ExtensionDeprecated.h in Headers */ = {isa = PBXBuildFile; fileRef = 292DB15E19B461CA00A80320 /* ExtensionDeprecated.h */; };
|
||||
29394CF019B01DBA00D2DE1A /* UIWebView.h in Headers */ = {isa = PBXBuildFile; fileRef = 29394CEC19B01DBA00D2DE1A /* UIWebView.h */; };
|
||||
29394CF119B01DBA00D2DE1A /* UIWebView.h in Headers */ = {isa = PBXBuildFile; fileRef = 29394CEC19B01DBA00D2DE1A /* UIWebView.h */; };
|
||||
29394CF219B01DBA00D2DE1A /* UIWebView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29394CED19B01DBA00D2DE1A /* UIWebView.mm */; };
|
||||
|
@ -2304,6 +2314,18 @@
|
|||
2905FA1318CF08D100240AA3 /* UIWidget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIWidget.cpp; sourceTree = "<group>"; };
|
||||
2905FA1418CF08D100240AA3 /* UIWidget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIWidget.h; sourceTree = "<group>"; };
|
||||
29080DEB191B82CE0066F8DF /* UIDeprecated.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UIDeprecated.h; sourceTree = "<group>"; };
|
||||
292DB12F19B4574100A80320 /* UIEditBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIEditBox.cpp; sourceTree = "<group>"; };
|
||||
292DB13019B4574100A80320 /* UIEditBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIEditBox.h; sourceTree = "<group>"; };
|
||||
292DB13119B4574100A80320 /* UIEditBoxImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIEditBoxImpl.h; sourceTree = "<group>"; };
|
||||
292DB13219B4574100A80320 /* UIEditBoxImplAndroid.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIEditBoxImplAndroid.cpp; sourceTree = "<group>"; };
|
||||
292DB13319B4574100A80320 /* UIEditBoxImplAndroid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIEditBoxImplAndroid.h; sourceTree = "<group>"; };
|
||||
292DB13419B4574100A80320 /* UIEditBoxImplIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIEditBoxImplIOS.h; sourceTree = "<group>"; };
|
||||
292DB13519B4574100A80320 /* UIEditBoxImplIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UIEditBoxImplIOS.mm; sourceTree = "<group>"; };
|
||||
292DB13619B4574100A80320 /* UIEditBoxImplMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIEditBoxImplMac.h; sourceTree = "<group>"; };
|
||||
292DB13719B4574100A80320 /* UIEditBoxImplMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UIEditBoxImplMac.mm; sourceTree = "<group>"; };
|
||||
292DB13819B4574100A80320 /* UIEditBoxImplNone.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIEditBoxImplNone.cpp; sourceTree = "<group>"; };
|
||||
292DB15D19B461CA00A80320 /* ExtensionDeprecated.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExtensionDeprecated.cpp; sourceTree = "<group>"; };
|
||||
292DB15E19B461CA00A80320 /* ExtensionDeprecated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExtensionDeprecated.h; sourceTree = "<group>"; };
|
||||
29394CEC19B01DBA00D2DE1A /* UIWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIWebView.h; sourceTree = "<group>"; };
|
||||
29394CED19B01DBA00D2DE1A /* UIWebView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UIWebView.mm; sourceTree = "<group>"; };
|
||||
29394CEE19B01DBA00D2DE1A /* UIWebViewImpl_iOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIWebViewImpl_iOS.h; sourceTree = "<group>"; };
|
||||
|
@ -2405,18 +2427,6 @@
|
|||
46A168491807AF4E005B8026 /* CCControlUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CCControlUtils.h; sourceTree = "<group>"; };
|
||||
46A1684A1807AF4E005B8026 /* CCInvocation.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CCInvocation.cpp; sourceTree = "<group>"; };
|
||||
46A1684B1807AF4E005B8026 /* CCInvocation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CCInvocation.h; sourceTree = "<group>"; };
|
||||
46A1684C1807AF4E005B8026 /* CCScale9Sprite.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CCScale9Sprite.cpp; sourceTree = "<group>"; };
|
||||
46A1684D1807AF4E005B8026 /* CCScale9Sprite.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CCScale9Sprite.h; sourceTree = "<group>"; };
|
||||
46A1684F1807AF4E005B8026 /* CCEditBox.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CCEditBox.cpp; sourceTree = "<group>"; };
|
||||
46A168501807AF4E005B8026 /* CCEditBox.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CCEditBox.h; sourceTree = "<group>"; };
|
||||
46A168511807AF4E005B8026 /* CCEditBoxImpl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CCEditBoxImpl.h; sourceTree = "<group>"; };
|
||||
46A168521807AF4E005B8026 /* CCEditBoxImplAndroid.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CCEditBoxImplAndroid.cpp; sourceTree = "<group>"; };
|
||||
46A168531807AF4E005B8026 /* CCEditBoxImplAndroid.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CCEditBoxImplAndroid.h; sourceTree = "<group>"; };
|
||||
46A168541807AF4E005B8026 /* CCEditBoxImplIOS.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CCEditBoxImplIOS.h; sourceTree = "<group>"; };
|
||||
46A168551807AF4E005B8026 /* CCEditBoxImplIOS.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = CCEditBoxImplIOS.mm; sourceTree = "<group>"; };
|
||||
46A168581807AF4E005B8026 /* CCEditBoxImplNone.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CCEditBoxImplNone.cpp; sourceTree = "<group>"; };
|
||||
46A1685B1807AF4E005B8026 /* CCEditBoxImplWin.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CCEditBoxImplWin.cpp; sourceTree = "<group>"; };
|
||||
46A1685C1807AF4E005B8026 /* CCEditBoxImplWin.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CCEditBoxImplWin.h; sourceTree = "<group>"; };
|
||||
46A1685E1807AF4E005B8026 /* CCScrollView.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = CCScrollView.cpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
|
||||
46A1685F1807AF4E005B8026 /* CCScrollView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CCScrollView.h; sourceTree = "<group>"; };
|
||||
46A168621807AF4E005B8026 /* CCTableView.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CCTableView.cpp; sourceTree = "<group>"; };
|
||||
|
@ -2867,8 +2877,6 @@
|
|||
B276EF5C1988D1D500CD400F /* CCVertexIndexData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCVertexIndexData.cpp; sourceTree = "<group>"; };
|
||||
B276EF5D1988D1D500CD400F /* CCVertexIndexBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCVertexIndexBuffer.h; sourceTree = "<group>"; };
|
||||
B276EF5E1988D1D500CD400F /* CCVertexIndexBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCVertexIndexBuffer.cpp; sourceTree = "<group>"; };
|
||||
B282B47C1980E02B00666787 /* CCEditBoxImplMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CCEditBoxImplMac.mm; sourceTree = "<group>"; };
|
||||
B282B47D1980E02B00666787 /* CCEditBoxImplMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCEditBoxImplMac.h; sourceTree = "<group>"; };
|
||||
B29594AF1926D5D9003EEF37 /* ccShader_3D_Color.frag */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = ccShader_3D_Color.frag; sourceTree = "<group>"; };
|
||||
B29594B01926D5D9003EEF37 /* ccShader_3D_ColorTex.frag */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = ccShader_3D_ColorTex.frag; sourceTree = "<group>"; };
|
||||
B29594B11926D5D9003EEF37 /* ccShader_3D_PositionTex.vert */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = ccShader_3D_PositionTex.vert; sourceTree = "<group>"; };
|
||||
|
@ -3979,6 +3987,23 @@
|
|||
path = ../cocos/ui;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
292DB12E19B4574100A80320 /* UIEditBox */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
292DB12F19B4574100A80320 /* UIEditBox.cpp */,
|
||||
292DB13019B4574100A80320 /* UIEditBox.h */,
|
||||
292DB13119B4574100A80320 /* UIEditBoxImpl.h */,
|
||||
292DB13219B4574100A80320 /* UIEditBoxImplAndroid.cpp */,
|
||||
292DB13319B4574100A80320 /* UIEditBoxImplAndroid.h */,
|
||||
292DB13419B4574100A80320 /* UIEditBoxImplIOS.h */,
|
||||
292DB13519B4574100A80320 /* UIEditBoxImplIOS.mm */,
|
||||
292DB13619B4574100A80320 /* UIEditBoxImplMac.h */,
|
||||
292DB13719B4574100A80320 /* UIEditBoxImplMac.mm */,
|
||||
292DB13819B4574100A80320 /* UIEditBoxImplNone.cpp */,
|
||||
);
|
||||
path = UIEditBox;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
29CB8F501929D63600C841D6 /* layout */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -4030,6 +4055,7 @@
|
|||
29CB8F531929D67D00C841D6 /* widgets */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
292DB12E19B4574100A80320 /* UIEditBox */,
|
||||
2905F9FE18CF08D000240AA3 /* UIListView.cpp */,
|
||||
2905F9FF18CF08D000240AA3 /* UIListView.h */,
|
||||
2905FA0018CF08D000240AA3 /* UILoadingBar.cpp */,
|
||||
|
@ -4129,6 +4155,8 @@
|
|||
46A167981807AF4D005B8026 /* extensions */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
292DB15D19B461CA00A80320 /* ExtensionDeprecated.cpp */,
|
||||
292DB15E19B461CA00A80320 /* ExtensionDeprecated.h */,
|
||||
46A167D21807AF4D005B8026 /* cocos-ext.h */,
|
||||
46A168321807AF4E005B8026 /* ExtensionMacros.h */,
|
||||
1AAF5350180E305F000584C8 /* assets-manager */,
|
||||
|
@ -4143,7 +4171,6 @@
|
|||
isa = PBXGroup;
|
||||
children = (
|
||||
46A168341807AF4E005B8026 /* CCControlExtension */,
|
||||
46A1684E1807AF4E005B8026 /* CCEditBox */,
|
||||
46A1685D1807AF4E005B8026 /* CCScrollView */,
|
||||
);
|
||||
path = GUI;
|
||||
|
@ -4175,31 +4202,10 @@
|
|||
46A168491807AF4E005B8026 /* CCControlUtils.h */,
|
||||
46A1684A1807AF4E005B8026 /* CCInvocation.cpp */,
|
||||
46A1684B1807AF4E005B8026 /* CCInvocation.h */,
|
||||
46A1684C1807AF4E005B8026 /* CCScale9Sprite.cpp */,
|
||||
46A1684D1807AF4E005B8026 /* CCScale9Sprite.h */,
|
||||
);
|
||||
path = CCControlExtension;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
46A1684E1807AF4E005B8026 /* CCEditBox */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B282B47C1980E02B00666787 /* CCEditBoxImplMac.mm */,
|
||||
B282B47D1980E02B00666787 /* CCEditBoxImplMac.h */,
|
||||
46A1684F1807AF4E005B8026 /* CCEditBox.cpp */,
|
||||
46A168501807AF4E005B8026 /* CCEditBox.h */,
|
||||
46A168511807AF4E005B8026 /* CCEditBoxImpl.h */,
|
||||
46A168521807AF4E005B8026 /* CCEditBoxImplAndroid.cpp */,
|
||||
46A168531807AF4E005B8026 /* CCEditBoxImplAndroid.h */,
|
||||
46A168541807AF4E005B8026 /* CCEditBoxImplIOS.h */,
|
||||
46A168551807AF4E005B8026 /* CCEditBoxImplIOS.mm */,
|
||||
46A168581807AF4E005B8026 /* CCEditBoxImplNone.cpp */,
|
||||
46A1685B1807AF4E005B8026 /* CCEditBoxImplWin.cpp */,
|
||||
46A1685C1807AF4E005B8026 /* CCEditBoxImplWin.h */,
|
||||
);
|
||||
path = CCEditBox;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
46A1685D1807AF4E005B8026 /* CCScrollView */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -4943,9 +4949,11 @@
|
|||
50ABBE851925AB6F00A911A9 /* ccFPSImages.h in Headers */,
|
||||
15AE1A5319AAD40300C27E9E /* b2Draw.h in Headers */,
|
||||
5034CA39191D591100CE6051 /* ccShader_PositionColorLengthTexture.frag in Headers */,
|
||||
292DB14B19B4574100A80320 /* UIEditBoxImplMac.h in Headers */,
|
||||
50ABBE891925AB6F00A911A9 /* CCMap.h in Headers */,
|
||||
50ABBE8D1925AB6F00A911A9 /* CCNS.h in Headers */,
|
||||
50ABBEA51925AB6F00A911A9 /* CCScriptSupport.h in Headers */,
|
||||
292DB14519B4574100A80320 /* UIEditBoxImplAndroid.h in Headers */,
|
||||
15AE1B9A19AADFDF00C27E9E /* UIHBox.h in Headers */,
|
||||
15AE18EB19AAD35000C27E9E /* CCActionNode.h in Headers */,
|
||||
15AE1A3819AAD3D500C27E9E /* b2Shape.h in Headers */,
|
||||
|
@ -5020,7 +5028,6 @@
|
|||
15AE199919AAD39600C27E9E /* LoadingBarReader.h in Headers */,
|
||||
15AE1A8F19AAD40300C27E9E /* b2RopeJoint.h in Headers */,
|
||||
15AE18ED19AAD35000C27E9E /* CCActionObject.h in Headers */,
|
||||
15AE1C0C19AAE02D00C27E9E /* CCEditBoxImpl.h in Headers */,
|
||||
ED9C6A9618599AD8000A5232 /* CCNodeGrid.h in Headers */,
|
||||
15AE18A719AAD33D00C27E9E /* CCScrollViewLoader.h in Headers */,
|
||||
15AE184819AAD2F700C27E9E /* cocos3d.h in Headers */,
|
||||
|
@ -5030,7 +5037,6 @@
|
|||
50ABBEA11925AB6F00A911A9 /* CCScheduler.h in Headers */,
|
||||
15AE1B6219AADA9900C27E9E /* UIButton.h in Headers */,
|
||||
50ABBDB71925AB4100A911A9 /* CCTexture2D.h in Headers */,
|
||||
15AE1BE119AAE01E00C27E9E /* CCScale9Sprite.h in Headers */,
|
||||
50ABBE811925AB6F00A911A9 /* CCEventType.h in Headers */,
|
||||
1A57008F180BC5A10088DEC7 /* CCActionTiledGrid.h in Headers */,
|
||||
15AE19A319AAD39600C27E9E /* TextBMFontReader.h in Headers */,
|
||||
|
@ -5175,6 +5181,7 @@
|
|||
15AE188519AAD33D00C27E9E /* CCBSequence.h in Headers */,
|
||||
15AE1AE219AAD42500C27E9E /* cpDampedRotarySpring.h in Headers */,
|
||||
5034CA49191D591100CE6051 /* ccShader_Label_df.frag in Headers */,
|
||||
292DB14119B4574100A80320 /* UIEditBoxImpl.h in Headers */,
|
||||
1A01C68C18F57BE800EFE3A6 /* CCDeprecated.h in Headers */,
|
||||
50ABBD561925AB0000A911A9 /* TransformUtils.h in Headers */,
|
||||
299754F6193EC95400A54AC3 /* ObjectFactory.h in Headers */,
|
||||
|
@ -5183,6 +5190,7 @@
|
|||
15AE18FB19AAD35000C27E9E /* CCColliderDetector.h in Headers */,
|
||||
15AE19E119AAD3A700C27E9E /* Skeleton.h in Headers */,
|
||||
1A570280180BCC900088DEC7 /* CCSprite.h in Headers */,
|
||||
292DB14719B4574100A80320 /* UIEditBoxImplIOS.h in Headers */,
|
||||
15AE1A9119AAD40300C27E9E /* b2WeldJoint.h in Headers */,
|
||||
15AE1A5419AAD40300C27E9E /* b2GrowableStack.h in Headers */,
|
||||
15AE1B4E19AADA9900C27E9E /* UIListView.h in Headers */,
|
||||
|
@ -5286,7 +5294,6 @@
|
|||
15AE1BCA19AAE01E00C27E9E /* CCControl.h in Headers */,
|
||||
50ABBDBF1925AB4100A911A9 /* CCTextureCache.h in Headers */,
|
||||
15AE186719AAD31D00C27E9E /* CDXMacOSXSupport.h in Headers */,
|
||||
15AE1C0A19AAE02500C27E9E /* CCEditBox.h in Headers */,
|
||||
B37510741823AC9F00B3BA6A /* CCPhysicsContactInfo_chipmunk.h in Headers */,
|
||||
15AE1ADF19AAD42500C27E9E /* chipmunk_types.h in Headers */,
|
||||
5034CA35191D591100CE6051 /* ccShader_PositionTexture.frag in Headers */,
|
||||
|
@ -5336,6 +5343,7 @@
|
|||
15AE18A919AAD33D00C27E9E /* CCSpriteLoader.h in Headers */,
|
||||
15AE198419AAD36400C27E9E /* WidgetReaderProtocol.h in Headers */,
|
||||
50ABBEC91925AB6F00A911A9 /* firePngData.h in Headers */,
|
||||
292DB16119B461CA00A80320 /* ExtensionDeprecated.h in Headers */,
|
||||
503DD8F51926B0DB00CD74DD /* CCIMEDelegate.h in Headers */,
|
||||
50ABBD5A1925AB0000A911A9 /* Vec2.h in Headers */,
|
||||
15AE1BDB19AAE01E00C27E9E /* CCControlSwitch.h in Headers */,
|
||||
|
@ -5365,6 +5373,7 @@
|
|||
15AE1AEC19AAD42500C27E9E /* util.h in Headers */,
|
||||
15AE19DD19AAD3A700C27E9E /* Json.h in Headers */,
|
||||
15AE191A19AAD35000C27E9E /* CCSSceneReader.h in Headers */,
|
||||
292DB13F19B4574100A80320 /* UIEditBox.h in Headers */,
|
||||
50ABBE671925AB6F00A911A9 /* CCEventListenerCustom.h in Headers */,
|
||||
15AE18E219AAD35000C27E9E /* TriggerMng.h in Headers */,
|
||||
15AE1B2B19AAD43700C27E9E /* prime.h in Headers */,
|
||||
|
@ -5417,7 +5426,6 @@
|
|||
50ABBE771925AB6F00A911A9 /* CCEventListenerTouch.h in Headers */,
|
||||
5034CA33191D591100CE6051 /* ccShader_PositionTexture_uColor.frag in Headers */,
|
||||
50ABC0171926664800A911A9 /* CCImage.h in Headers */,
|
||||
15AE1C0E19AAE03400C27E9E /* CCEditBoxImplMac.h in Headers */,
|
||||
15AE1AED19AAD42500C27E9E /* cpArbiter.h in Headers */,
|
||||
50ABBDA91925AB4100A911A9 /* CCRenderCommand.h in Headers */,
|
||||
50ABBD951925AB4100A911A9 /* CCGLProgramState.h in Headers */,
|
||||
|
@ -5448,6 +5456,7 @@
|
|||
15AE183319AAD2F700C27E9E /* CCOBB.h in Headers */,
|
||||
15AE18B119AAD33D00C27E9E /* CCBMemberVariableAssigner.h in Headers */,
|
||||
15AE1AFA19AAD42500C27E9E /* cpConstraint.h in Headers */,
|
||||
292DB14019B4574100A80320 /* UIEditBox.h in Headers */,
|
||||
50ABBD3B1925AB0000A911A9 /* CCAffineTransform.h in Headers */,
|
||||
15AE1A0A19AAD3A700C27E9E /* CCSkeleton.h in Headers */,
|
||||
5034CA38191D591100CE6051 /* ccShader_PositionColorLengthTexture.vert in Headers */,
|
||||
|
@ -5456,6 +5465,7 @@
|
|||
46A171011807CECB005B8026 /* CCPhysicsJoint.h in Headers */,
|
||||
46A170FD1807CECB005B8026 /* CCPhysicsBody.h in Headers */,
|
||||
50ABBE9C1925AB6F00A911A9 /* CCRef.h in Headers */,
|
||||
292DB16219B461CA00A80320 /* ExtensionDeprecated.h in Headers */,
|
||||
50ABBD961925AB4100A911A9 /* CCGLProgramState.h in Headers */,
|
||||
46A171061807CECB005B8026 /* CCPhysicsWorld.h in Headers */,
|
||||
50ABBDB41925AB4100A911A9 /* ccShaders.h in Headers */,
|
||||
|
@ -5543,6 +5553,7 @@
|
|||
15AE19F819AAD3A700C27E9E /* Animation.h in Headers */,
|
||||
1A5700A1180BC5D20088DEC7 /* CCNode.h in Headers */,
|
||||
15AE181919AAD2F700C27E9E /* CCAttachNode.h in Headers */,
|
||||
292DB14C19B4574100A80320 /* UIEditBoxImplMac.h in Headers */,
|
||||
15AE1BF019AAE01E00C27E9E /* CCControlHuePicker.h in Headers */,
|
||||
15AE18B819AAD33D00C27E9E /* CCBSequenceProperty.h in Headers */,
|
||||
503DD8E41926736A00CD74DD /* CCDirectorCaller.h in Headers */,
|
||||
|
@ -5572,6 +5583,7 @@
|
|||
50ABBD5B1925AB0000A911A9 /* Vec2.h in Headers */,
|
||||
50ABBD411925AB0000A911A9 /* CCMath.h in Headers */,
|
||||
1A5701A0180BCB590088DEC7 /* CCFont.h in Headers */,
|
||||
292DB14819B4574100A80320 /* UIEditBoxImplIOS.h in Headers */,
|
||||
15AE1A0819AAD3A700C27E9E /* BoneData.h in Headers */,
|
||||
50ABBD9A1925AB4100A911A9 /* CCGLProgramStateCache.h in Headers */,
|
||||
15AE181D19AAD2F700C27E9E /* CCBundle3D.h in Headers */,
|
||||
|
@ -5603,6 +5615,7 @@
|
|||
15AE196B19AAD35100C27E9E /* DictionaryHelper.h in Headers */,
|
||||
15AE1AA619AAD40300C27E9E /* b2Fixture.h in Headers */,
|
||||
15AE1BBA19AADFF000C27E9E /* HttpClient.h in Headers */,
|
||||
292DB14619B4574100A80320 /* UIEditBoxImplAndroid.h in Headers */,
|
||||
15AE1AF819AAD42500C27E9E /* chipmunk_types.h in Headers */,
|
||||
15AE1B9419AADA9A00C27E9E /* GUIDefine.h in Headers */,
|
||||
15AE183B19AAD2F700C27E9E /* CCRay.h in Headers */,
|
||||
|
@ -5745,6 +5758,7 @@
|
|||
15AE1B8D19AADA9A00C27E9E /* UIScale9Sprite.h in Headers */,
|
||||
15AE18AC19AAD33D00C27E9E /* CCBAnimationManager.h in Headers */,
|
||||
15AE1A1A19AAD3A700C27E9E /* Skin.h in Headers */,
|
||||
292DB14219B4574100A80320 /* UIEditBoxImpl.h in Headers */,
|
||||
1A570303180BCE890088DEC7 /* CCParallaxNode.h in Headers */,
|
||||
50ABBE2A1925AB6F00A911A9 /* CCAutoreleasePool.h in Headers */,
|
||||
1A57030F180BCF190088DEC7 /* CCComponent.h in Headers */,
|
||||
|
@ -5766,7 +5780,6 @@
|
|||
15AE1BFE19AAE01E00C27E9E /* CCInvocation.h in Headers */,
|
||||
15AE1A9E19AAD40300C27E9E /* b2StackAllocator.h in Headers */,
|
||||
1A570357180BD0B00088DEC7 /* ioapi.h in Headers */,
|
||||
15AE1C0F19AAE03E00C27E9E /* CCEditBoxImplIOS.h in Headers */,
|
||||
15AE1A1619AAD3A700C27E9E /* SkeletonData.h in Headers */,
|
||||
50ABBD4B1925AB0000A911A9 /* Mat4.h in Headers */,
|
||||
15AE1BBE19AADFF000C27E9E /* SocketIO.h in Headers */,
|
||||
|
@ -5827,7 +5840,6 @@
|
|||
15AE198019AAD35700C27E9E /* CCTimeLine.h in Headers */,
|
||||
50ABBD4F1925AB0000A911A9 /* MathUtil.h in Headers */,
|
||||
1A01C69718F57BE800EFE3A6 /* CCInteger.h in Headers */,
|
||||
15AE1C0019AAE01E00C27E9E /* CCScale9Sprite.h in Headers */,
|
||||
15AE1C0619AAE01E00C27E9E /* CCTableViewCell.h in Headers */,
|
||||
15AE19AB19AAD39700C27E9E /* ListViewReader.h in Headers */,
|
||||
50ABBEBE1925AB6F00A911A9 /* ccUtils.h in Headers */,
|
||||
|
@ -5883,13 +5895,11 @@
|
|||
B276EF641988D1D500CD400F /* CCVertexIndexBuffer.h in Headers */,
|
||||
15AE1A0619AAD3A700C27E9E /* Bone.h in Headers */,
|
||||
ED9C6A9718599AD8000A5232 /* CCNodeGrid.h in Headers */,
|
||||
15AE1C0819AAE02500C27E9E /* CCEditBox.h in Headers */,
|
||||
50ABC0201926664800A911A9 /* CCThread.h in Headers */,
|
||||
15AE1B8519AADA9A00C27E9E /* UITextField.h in Headers */,
|
||||
1A01C69318F57BE800EFE3A6 /* CCDouble.h in Headers */,
|
||||
15AE184B19AAD30500C27E9E /* Export.h in Headers */,
|
||||
15AE196019AAD35100C27E9E /* CCSpriteFrameCacheHelper.h in Headers */,
|
||||
15AE1C0B19AAE02D00C27E9E /* CCEditBoxImpl.h in Headers */,
|
||||
50ABBE221925AB6F00A911A9 /* atitc.h in Headers */,
|
||||
15AE1AB719AAD40300C27E9E /* b2ContactSolver.h in Headers */,
|
||||
15AE193319AAD35100C27E9E /* CCActionNode.h in Headers */,
|
||||
|
@ -6002,6 +6012,7 @@
|
|||
15AE1B1E19AAD43700C27E9E /* cpBody.c in Sources */,
|
||||
15AE1BDE19AAE01E00C27E9E /* CCInvocation.cpp in Sources */,
|
||||
3EA3EDBC1991CDFA00645534 /* CCCamera.cpp in Sources */,
|
||||
292DB14F19B4574100A80320 /* UIEditBoxImplNone.cpp in Sources */,
|
||||
15AE199419AAD39600C27E9E /* LayoutReader.cpp in Sources */,
|
||||
1A01C68A18F57BE800EFE3A6 /* CCDeprecated.cpp in Sources */,
|
||||
1A1645B0191B726C008C7C7F /* ConvertUTF.c in Sources */,
|
||||
|
@ -6033,7 +6044,6 @@
|
|||
15AE186319AAD31D00C27E9E /* CDAudioManager.m in Sources */,
|
||||
15AE1B2219AAD43700C27E9E /* cpShape.c in Sources */,
|
||||
ED9C6A9418599AD8000A5232 /* CCNodeGrid.cpp in Sources */,
|
||||
15AE1C0D19AAE03400C27E9E /* CCEditBoxImplMac.mm in Sources */,
|
||||
15AE1A2C19AAD3D500C27E9E /* b2DynamicTree.cpp in Sources */,
|
||||
15AE184019AAD2F700C27E9E /* CCSprite3D.cpp in Sources */,
|
||||
46A170E61807CECA005B8026 /* CCPhysicsBody.cpp in Sources */,
|
||||
|
@ -6045,7 +6055,6 @@
|
|||
50ABBEBB1925AB6F00A911A9 /* ccUtils.cpp in Sources */,
|
||||
15AE186A19AAD31D00C27E9E /* CocosDenshion.m in Sources */,
|
||||
15AE198C19AAD36E00C27E9E /* CheckBoxReader.cpp in Sources */,
|
||||
15AE1C0919AAE02500C27E9E /* CCEditBox.cpp in Sources */,
|
||||
15AE1B6319AADA9900C27E9E /* UICheckBox.cpp in Sources */,
|
||||
15EFA211198A2BB5000C57D3 /* CCProtectedNode.cpp in Sources */,
|
||||
50ABBEB71925AB6F00A911A9 /* ccUTF8.cpp in Sources */,
|
||||
|
@ -6122,6 +6131,7 @@
|
|||
50ABBE391925AB6F00A911A9 /* CCData.cpp in Sources */,
|
||||
1A57010E180BC8EE0088DEC7 /* CCDrawingPrimitives.cpp in Sources */,
|
||||
50ABBED71925AB6F00A911A9 /* ZipUtils.cpp in Sources */,
|
||||
292DB14919B4574100A80320 /* UIEditBoxImplIOS.mm in Sources */,
|
||||
15AE181019AAD2F700C27E9E /* CCAnimation3D.cpp in Sources */,
|
||||
1A01C68418F57BE800EFE3A6 /* CCArray.cpp in Sources */,
|
||||
1A570112180BC8EE0088DEC7 /* CCDrawNode.cpp in Sources */,
|
||||
|
@ -6152,6 +6162,7 @@
|
|||
15AE1B5319AADA9900C27E9E /* UIRichText.cpp in Sources */,
|
||||
15AE19DC19AAD3A700C27E9E /* Json.cpp in Sources */,
|
||||
15AE1B2419AAD43700C27E9E /* cpSpaceComponent.c in Sources */,
|
||||
292DB13D19B4574100A80320 /* UIEditBox.cpp in Sources */,
|
||||
50ABBE551925AB6F00A911A9 /* CCEventFocus.cpp in Sources */,
|
||||
15AE1A8819AAD40300C27E9E /* b2PrismaticJoint.cpp in Sources */,
|
||||
50ABBE491925AB6F00A911A9 /* CCEventAcceleration.cpp in Sources */,
|
||||
|
@ -6200,6 +6211,8 @@
|
|||
1A570202180BCBD40088DEC7 /* CCClippingNode.cpp in Sources */,
|
||||
1A570208180BCBDF0088DEC7 /* CCMotionStreak.cpp in Sources */,
|
||||
1A570210180BCBF40088DEC7 /* CCProgressTimer.cpp in Sources */,
|
||||
292DB15F19B461CA00A80320 /* ExtensionDeprecated.cpp in Sources */,
|
||||
292DB14D19B4574100A80320 /* UIEditBoxImplMac.mm in Sources */,
|
||||
50ABBDB51925AB4100A911A9 /* CCTexture2D.cpp in Sources */,
|
||||
1A570214180BCBF40088DEC7 /* CCRenderTexture.cpp in Sources */,
|
||||
15AE1BD019AAE01E00C27E9E /* CCControlHuePicker.cpp in Sources */,
|
||||
|
@ -6218,7 +6231,6 @@
|
|||
1A570286180BCC900088DEC7 /* CCSpriteFrame.cpp in Sources */,
|
||||
B24AA989195A675C007B4522 /* CCFastTMXTiledMap.cpp in Sources */,
|
||||
15AE199619AAD39600C27E9E /* ListViewReader.cpp in Sources */,
|
||||
15AE1BE019AAE01E00C27E9E /* CCScale9Sprite.cpp in Sources */,
|
||||
50ABC0191926664800A911A9 /* CCSAXParser.cpp in Sources */,
|
||||
15AE1B1419AAD43700C27E9E /* cpPinJoint.c in Sources */,
|
||||
15AE189219AAD33D00C27E9E /* CCLayerGradientLoader.cpp in Sources */,
|
||||
|
@ -6338,6 +6350,7 @@
|
|||
50ABC0631926664800A911A9 /* CCDevice.mm in Sources */,
|
||||
15AE1A2819AAD3D500C27E9E /* b2Collision.cpp in Sources */,
|
||||
15AE1B6719AADA9900C27E9E /* UIScale9Sprite.cpp in Sources */,
|
||||
292DB14319B4574100A80320 /* UIEditBoxImplAndroid.cpp in Sources */,
|
||||
15AE1A5219AAD40300C27E9E /* b2Draw.cpp in Sources */,
|
||||
50ABBE1F1925AB6F00A911A9 /* atitc.cpp in Sources */,
|
||||
1A01C69818F57BE800EFE3A6 /* CCSet.cpp in Sources */,
|
||||
|
@ -6451,6 +6464,7 @@
|
|||
46A171031807CECB005B8026 /* CCPhysicsShape.cpp in Sources */,
|
||||
50ABC0161926664800A911A9 /* CCImage.cpp in Sources */,
|
||||
1A01C6A518F58F7500EFE3A6 /* CCNotificationCenter.cpp in Sources */,
|
||||
292DB14E19B4574100A80320 /* UIEditBoxImplMac.mm in Sources */,
|
||||
15AE1BFB19AAE01E00C27E9E /* CCControlUtils.cpp in Sources */,
|
||||
15AE1B9019AADA9A00C27E9E /* UIWidget.cpp in Sources */,
|
||||
ED9C6A9518599AD8000A5232 /* CCNodeGrid.cpp in Sources */,
|
||||
|
@ -6502,6 +6516,7 @@
|
|||
15AE198E19AAD36E00C27E9E /* CheckBoxReader.cpp in Sources */,
|
||||
50ABBE621925AB6F00A911A9 /* CCEventListenerAcceleration.cpp in Sources */,
|
||||
15AE1AB619AAD40300C27E9E /* b2ContactSolver.cpp in Sources */,
|
||||
292DB13E19B4574100A80320 /* UIEditBox.cpp in Sources */,
|
||||
3E6176681960F89B00DE83F5 /* CCController-iOS.mm in Sources */,
|
||||
15AE19EF19AAD3A700C27E9E /* SkeletonBounds.cpp in Sources */,
|
||||
15AE18B219AAD33D00C27E9E /* CCBReader.cpp in Sources */,
|
||||
|
@ -6547,6 +6562,7 @@
|
|||
15AE1B4319AAD43700C27E9E /* cpSpaceHash.c in Sources */,
|
||||
15AE1A1D19AAD3A700C27E9E /* SlotData.cpp in Sources */,
|
||||
50ABBD551925AB0000A911A9 /* TransformUtils.cpp in Sources */,
|
||||
292DB14419B4574100A80320 /* UIEditBoxImplAndroid.cpp in Sources */,
|
||||
15AE193619AAD35100C27E9E /* CCArmature.cpp in Sources */,
|
||||
1A57007A180BC5A10088DEC7 /* CCActionInstant.cpp in Sources */,
|
||||
15AE1AC419AAD40300C27E9E /* b2FrictionJoint.cpp in Sources */,
|
||||
|
@ -6566,7 +6582,6 @@
|
|||
1A570086180BC5A10088DEC7 /* CCActionPageTurn3D.cpp in Sources */,
|
||||
15AE1AB819AAD40300C27E9E /* b2EdgeAndCircleContact.cpp in Sources */,
|
||||
15AE19FF19AAD3A700C27E9E /* AtlasAttachmentLoader.cpp in Sources */,
|
||||
15AE1C0719AAE02500C27E9E /* CCEditBox.cpp in Sources */,
|
||||
1A57008A180BC5A10088DEC7 /* CCActionProgressTimer.cpp in Sources */,
|
||||
15AE18AF19AAD33D00C27E9E /* CCBKeyframe.cpp in Sources */,
|
||||
15AE19FB19AAD3A700C27E9E /* AnimationStateData.cpp in Sources */,
|
||||
|
@ -6596,6 +6611,7 @@
|
|||
15AE195F19AAD35100C27E9E /* CCSpriteFrameCacheHelper.cpp in Sources */,
|
||||
15AE193019AAD35100C27E9E /* CCActionManagerEx.cpp in Sources */,
|
||||
503DD8E21926736A00CD74DD /* CCCommon.mm in Sources */,
|
||||
292DB14A19B4574100A80320 /* UIEditBoxImplIOS.mm in Sources */,
|
||||
15AE1A9419AAD40300C27E9E /* b2BlockAllocator.cpp in Sources */,
|
||||
15AE1B4419AAD43700C27E9E /* cpSpaceQuery.c in Sources */,
|
||||
15AE1A4D19AAD3D500C27E9E /* b2PolygonShape.cpp in Sources */,
|
||||
|
@ -6612,6 +6628,7 @@
|
|||
15AE1AB019AAD40300C27E9E /* b2ChainAndPolygonContact.cpp in Sources */,
|
||||
1A5701B2180BCB590088DEC7 /* CCFontFNT.cpp in Sources */,
|
||||
1A5701B6180BCB590088DEC7 /* CCFontFreeType.cpp in Sources */,
|
||||
292DB16019B461CA00A80320 /* ExtensionDeprecated.cpp in Sources */,
|
||||
50ABBEAC1925AB6F00A911A9 /* ccTypes.cpp in Sources */,
|
||||
15AE196A19AAD35100C27E9E /* DictionaryHelper.cpp in Sources */,
|
||||
15AE1A3F19AAD3D500C27E9E /* b2Collision.cpp in Sources */,
|
||||
|
@ -6672,6 +6689,7 @@
|
|||
15AE194019AAD35100C27E9E /* CCBone.cpp in Sources */,
|
||||
1A570215180BCBF40088DEC7 /* CCRenderTexture.cpp in Sources */,
|
||||
1A570222180BCC1A0088DEC7 /* CCParticleBatchNode.cpp in Sources */,
|
||||
292DB15019B4574100A80320 /* UIEditBoxImplNone.cpp in Sources */,
|
||||
15AE19F119AAD3A700C27E9E /* Event.cpp in Sources */,
|
||||
15AE185F19AAD31200C27E9E /* SimpleAudioEngine.mm in Sources */,
|
||||
15AE1BE819AAE01E00C27E9E /* CCControl.cpp in Sources */,
|
||||
|
@ -6681,7 +6699,6 @@
|
|||
15AE182919AAD2F700C27E9E /* CCMeshSkin.cpp in Sources */,
|
||||
15AE1BBD19AADFF000C27E9E /* SocketIO.cpp in Sources */,
|
||||
15AE1A4319AAD3D500C27E9E /* b2DynamicTree.cpp in Sources */,
|
||||
15AE1BFF19AAE01E00C27E9E /* CCScale9Sprite.cpp in Sources */,
|
||||
15AE1A3A19AAD3D500C27E9E /* b2BroadPhase.cpp in Sources */,
|
||||
15AE19B619AAD39700C27E9E /* TextBMFontReader.cpp in Sources */,
|
||||
15AE1BFD19AAE01E00C27E9E /* CCInvocation.cpp in Sources */,
|
||||
|
@ -6715,7 +6732,6 @@
|
|||
15AE19AE19AAD39700C27E9E /* PageViewReader.cpp in Sources */,
|
||||
3EA3EDBD1991CDFA00645534 /* CCCamera.cpp in Sources */,
|
||||
1A570297180BCCAB0088DEC7 /* CCAnimationCache.cpp in Sources */,
|
||||
15AE1C1019AAE03E00C27E9E /* CCEditBoxImplIOS.mm in Sources */,
|
||||
50ABBE321925AB6F00A911A9 /* CCConfiguration.cpp in Sources */,
|
||||
15AE1A9F19AAD40300C27E9E /* b2Timer.cpp in Sources */,
|
||||
15AE1AD419AAD40300C27E9E /* b2WeldJoint.cpp in Sources */,
|
||||
|
|
|
@ -472,8 +472,6 @@
|
|||
1AC35BEE18CECF0C00F37B72 /* CCControlStepperTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35A7318CECF0B00F37B72 /* CCControlStepperTest.cpp */; };
|
||||
1AC35BEF18CECF0C00F37B72 /* CCControlSwitchTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35A7618CECF0B00F37B72 /* CCControlSwitchTest.cpp */; };
|
||||
1AC35BF018CECF0C00F37B72 /* CCControlSwitchTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35A7618CECF0B00F37B72 /* CCControlSwitchTest.cpp */; };
|
||||
1AC35BF118CECF0C00F37B72 /* EditBoxTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35A7918CECF0B00F37B72 /* EditBoxTest.cpp */; };
|
||||
1AC35BF218CECF0C00F37B72 /* EditBoxTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35A7918CECF0B00F37B72 /* EditBoxTest.cpp */; };
|
||||
1AC35BF318CECF0C00F37B72 /* ExtensionsTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35A7B18CECF0B00F37B72 /* ExtensionsTest.cpp */; };
|
||||
1AC35BF418CECF0C00F37B72 /* ExtensionsTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35A7B18CECF0B00F37B72 /* ExtensionsTest.cpp */; };
|
||||
1AC35BF518CECF0C00F37B72 /* HttpClientTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35A7E18CECF0B00F37B72 /* HttpClientTest.cpp */; };
|
||||
|
@ -484,8 +482,6 @@
|
|||
1AC35BFA18CECF0C00F37B72 /* WebSocketTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35A8218CECF0B00F37B72 /* WebSocketTest.cpp */; };
|
||||
1AC35BFB18CECF0C00F37B72 /* NotificationCenterTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35A8518CECF0B00F37B72 /* NotificationCenterTest.cpp */; };
|
||||
1AC35BFC18CECF0C00F37B72 /* NotificationCenterTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35A8518CECF0B00F37B72 /* NotificationCenterTest.cpp */; };
|
||||
1AC35BFD18CECF0C00F37B72 /* Scale9SpriteTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35A8818CECF0B00F37B72 /* Scale9SpriteTest.cpp */; };
|
||||
1AC35BFE18CECF0C00F37B72 /* Scale9SpriteTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35A8818CECF0B00F37B72 /* Scale9SpriteTest.cpp */; };
|
||||
1AC35BFF18CECF0C00F37B72 /* CustomTableViewCell.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35A8B18CECF0B00F37B72 /* CustomTableViewCell.cpp */; };
|
||||
1AC35C0018CECF0C00F37B72 /* CustomTableViewCell.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35A8B18CECF0B00F37B72 /* CustomTableViewCell.cpp */; };
|
||||
1AC35C0118CECF0C00F37B72 /* TableViewTestScene.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35A8D18CECF0B00F37B72 /* TableViewTestScene.cpp */; };
|
||||
|
@ -863,6 +859,8 @@
|
|||
29080DE6191B595E0066F8DF /* UIWidgetAddNodeTest_Editor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29080D8B191B595E0066F8DF /* UIWidgetAddNodeTest_Editor.cpp */; };
|
||||
290E94B5196FC16900694919 /* CocostudioParserTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 290E94B3196FC16900694919 /* CocostudioParserTest.cpp */; };
|
||||
290E94B6196FC16900694919 /* CocostudioParserTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 290E94B3196FC16900694919 /* CocostudioParserTest.cpp */; };
|
||||
292CF01419A1965E00E8E6A0 /* UIEditBoxTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 292CF01219A1965E00E8E6A0 /* UIEditBoxTest.cpp */; };
|
||||
292CF01519A1965E00E8E6A0 /* UIEditBoxTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 292CF01219A1965E00E8E6A0 /* UIEditBoxTest.cpp */; };
|
||||
295824591987415900F9746D /* UIScale9SpriteTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 295824571987415900F9746D /* UIScale9SpriteTest.cpp */; };
|
||||
2958245A1987415900F9746D /* UIScale9SpriteTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 295824571987415900F9746D /* UIScale9SpriteTest.cpp */; };
|
||||
298D7F6F19AC31F300FF096D /* UIWebViewTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 298D7F6D19AC31F300FF096D /* UIWebViewTest.cpp */; };
|
||||
|
@ -2555,8 +2553,6 @@
|
|||
1AC35A7418CECF0B00F37B72 /* CCControlStepperTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCControlStepperTest.h; sourceTree = "<group>"; };
|
||||
1AC35A7618CECF0B00F37B72 /* CCControlSwitchTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCControlSwitchTest.cpp; sourceTree = "<group>"; };
|
||||
1AC35A7718CECF0B00F37B72 /* CCControlSwitchTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCControlSwitchTest.h; sourceTree = "<group>"; };
|
||||
1AC35A7918CECF0B00F37B72 /* EditBoxTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EditBoxTest.cpp; sourceTree = "<group>"; };
|
||||
1AC35A7A18CECF0B00F37B72 /* EditBoxTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditBoxTest.h; sourceTree = "<group>"; };
|
||||
1AC35A7B18CECF0B00F37B72 /* ExtensionsTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExtensionsTest.cpp; sourceTree = "<group>"; };
|
||||
1AC35A7C18CECF0B00F37B72 /* ExtensionsTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExtensionsTest.h; sourceTree = "<group>"; };
|
||||
1AC35A7E18CECF0B00F37B72 /* HttpClientTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HttpClientTest.cpp; sourceTree = "<group>"; };
|
||||
|
@ -2567,8 +2563,6 @@
|
|||
1AC35A8318CECF0B00F37B72 /* WebSocketTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSocketTest.h; sourceTree = "<group>"; };
|
||||
1AC35A8518CECF0B00F37B72 /* NotificationCenterTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NotificationCenterTest.cpp; sourceTree = "<group>"; };
|
||||
1AC35A8618CECF0B00F37B72 /* NotificationCenterTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotificationCenterTest.h; sourceTree = "<group>"; };
|
||||
1AC35A8818CECF0B00F37B72 /* Scale9SpriteTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Scale9SpriteTest.cpp; sourceTree = "<group>"; };
|
||||
1AC35A8918CECF0B00F37B72 /* Scale9SpriteTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Scale9SpriteTest.h; sourceTree = "<group>"; };
|
||||
1AC35A8B18CECF0B00F37B72 /* CustomTableViewCell.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CustomTableViewCell.cpp; sourceTree = "<group>"; };
|
||||
1AC35A8C18CECF0B00F37B72 /* CustomTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustomTableViewCell.h; sourceTree = "<group>"; };
|
||||
1AC35A8D18CECF0B00F37B72 /* TableViewTestScene.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TableViewTestScene.cpp; sourceTree = "<group>"; };
|
||||
|
@ -2886,6 +2880,8 @@
|
|||
29080D8C191B595E0066F8DF /* UIWidgetAddNodeTest_Editor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIWidgetAddNodeTest_Editor.h; sourceTree = "<group>"; };
|
||||
290E94B3196FC16900694919 /* CocostudioParserTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CocostudioParserTest.cpp; path = ../CocostudioParserTest.cpp; sourceTree = "<group>"; };
|
||||
290E94B4196FC16900694919 /* CocostudioParserTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CocostudioParserTest.h; path = ../CocostudioParserTest.h; sourceTree = "<group>"; };
|
||||
292CF01219A1965E00E8E6A0 /* UIEditBoxTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIEditBoxTest.cpp; sourceTree = "<group>"; };
|
||||
292CF01319A1965E00E8E6A0 /* UIEditBoxTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIEditBoxTest.h; sourceTree = "<group>"; };
|
||||
295824571987415900F9746D /* UIScale9SpriteTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIScale9SpriteTest.cpp; sourceTree = "<group>"; };
|
||||
295824581987415900F9746D /* UIScale9SpriteTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIScale9SpriteTest.h; sourceTree = "<group>"; };
|
||||
298D7F6D19AC31F300FF096D /* UIWebViewTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UIWebViewTest.cpp; path = UIWebViewTest/UIWebViewTest.cpp; sourceTree = "<group>"; };
|
||||
|
@ -5773,12 +5769,10 @@
|
|||
1AC359DF18CECF0B00F37B72 /* CocoStudioComponentsTest */,
|
||||
1AC35A5818CECF0B00F37B72 /* CocoStudioSceneTest */,
|
||||
1AC35A6118CECF0B00F37B72 /* ControlExtensionTest */,
|
||||
1AC35A7818CECF0B00F37B72 /* EditBoxTest */,
|
||||
1AC35A7B18CECF0B00F37B72 /* ExtensionsTest.cpp */,
|
||||
1AC35A7C18CECF0B00F37B72 /* ExtensionsTest.h */,
|
||||
1AC35A7D18CECF0B00F37B72 /* NetworkTest */,
|
||||
1AC35A8418CECF0B00F37B72 /* NotificationCenterTest */,
|
||||
1AC35A8718CECF0B00F37B72 /* Scale9SpriteTest */,
|
||||
1AC35A8A18CECF0B00F37B72 /* TableViewTest */,
|
||||
);
|
||||
path = ExtensionsTest;
|
||||
|
@ -6020,15 +6014,6 @@
|
|||
path = CCControlSwitchTest;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1AC35A7818CECF0B00F37B72 /* EditBoxTest */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1AC35A7918CECF0B00F37B72 /* EditBoxTest.cpp */,
|
||||
1AC35A7A18CECF0B00F37B72 /* EditBoxTest.h */,
|
||||
);
|
||||
path = EditBoxTest;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1AC35A7D18CECF0B00F37B72 /* NetworkTest */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -6051,15 +6036,6 @@
|
|||
path = NotificationCenterTest;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1AC35A8718CECF0B00F37B72 /* Scale9SpriteTest */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1AC35A8818CECF0B00F37B72 /* Scale9SpriteTest.cpp */,
|
||||
1AC35A8918CECF0B00F37B72 /* Scale9SpriteTest.h */,
|
||||
);
|
||||
path = Scale9SpriteTest;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1AC35A8A18CECF0B00F37B72 /* TableViewTest */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -7006,6 +6982,8 @@
|
|||
298D7F6C19AC31C000FF096D /* UIWebViewTest */,
|
||||
295824571987415900F9746D /* UIScale9SpriteTest.cpp */,
|
||||
295824581987415900F9746D /* UIScale9SpriteTest.h */,
|
||||
292CF01219A1965E00E8E6A0 /* UIEditBoxTest.cpp */,
|
||||
292CF01319A1965E00E8E6A0 /* UIEditBoxTest.h */,
|
||||
29080D1F191B595E0066F8DF /* CocosGUIScene.cpp */,
|
||||
29080D20191B595E0066F8DF /* CocosGUIScene.h */,
|
||||
29080D37191B595E0066F8DF /* GUIEditorTest.cpp */,
|
||||
|
@ -7970,7 +7948,6 @@
|
|||
1AC35B6718CECF0C00F37B72 /* AnimationsTestLayer.cpp in Sources */,
|
||||
29080DB7191B595E0066F8DF /* UIListViewTest_Editor.cpp in Sources */,
|
||||
1AC35BF918CECF0C00F37B72 /* WebSocketTest.cpp in Sources */,
|
||||
1AC35BF118CECF0C00F37B72 /* EditBoxTest.cpp in Sources */,
|
||||
1AC35B3918CECF0C00F37B72 /* Bug-1174.cpp in Sources */,
|
||||
1AC35BE318CECF0C00F37B72 /* CCControlColourPickerTest.cpp in Sources */,
|
||||
29080DB1191B595E0066F8DF /* UILayoutTest.cpp in Sources */,
|
||||
|
@ -8021,7 +7998,6 @@
|
|||
29080DD1191B595E0066F8DF /* UISliderTest_Editor.cpp in Sources */,
|
||||
1AC35B2718CECF0C00F37B72 /* ActionsTest.cpp in Sources */,
|
||||
1AC35C4918CECF0C00F37B72 /* ShaderTest.cpp in Sources */,
|
||||
1AC35BFD18CECF0C00F37B72 /* Scale9SpriteTest.cpp in Sources */,
|
||||
1AC35B4318CECF0C00F37B72 /* Bug-624.cpp in Sources */,
|
||||
1AC35BF718CECF0C00F37B72 /* SocketIOTest.cpp in Sources */,
|
||||
1AC35C4F18CECF0C00F37B72 /* SpriteTest.cpp in Sources */,
|
||||
|
@ -8040,6 +8016,7 @@
|
|||
1AC35B7D18CECF0C00F37B72 /* PlayerController.cpp in Sources */,
|
||||
29080D9F191B595E0066F8DF /* CustomReader.cpp in Sources */,
|
||||
1AC35BE718CECF0C00F37B72 /* CCControlScene.cpp in Sources */,
|
||||
292CF01419A1965E00E8E6A0 /* UIEditBoxTest.cpp in Sources */,
|
||||
29080DBF191B595E0066F8DF /* UIPageViewTest_Editor.cpp in Sources */,
|
||||
1AC35B5F18CECF0C00F37B72 /* DataVisitorTest.cpp in Sources */,
|
||||
1AC35B5D18CECF0C00F37B72 /* CurrentLanguageTest.cpp in Sources */,
|
||||
|
@ -8166,7 +8143,6 @@
|
|||
1AC35B6818CECF0C00F37B72 /* AnimationsTestLayer.cpp in Sources */,
|
||||
29080D8E191B595E0066F8DF /* CocosGUIScene.cpp in Sources */,
|
||||
1AC35BFA18CECF0C00F37B72 /* WebSocketTest.cpp in Sources */,
|
||||
1AC35BF218CECF0C00F37B72 /* EditBoxTest.cpp in Sources */,
|
||||
38FA2E74194AEBE100FF2BE4 /* ActionTimelineTestScene.cpp in Sources */,
|
||||
2958245A1987415900F9746D /* UIScale9SpriteTest.cpp in Sources */,
|
||||
1AC35B3A18CECF0C00F37B72 /* Bug-1174.cpp in Sources */,
|
||||
|
@ -8221,9 +8197,9 @@
|
|||
1AC35C0618CECF0C00F37B72 /* FontTest.cpp in Sources */,
|
||||
1AC35C3818CECF0C00F37B72 /* PerformanceTest.cpp in Sources */,
|
||||
1F33635018E37E840074764D /* RefPtrTest.cpp in Sources */,
|
||||
292CF01519A1965E00E8E6A0 /* UIEditBoxTest.cpp in Sources */,
|
||||
1AC35B2818CECF0C00F37B72 /* ActionsTest.cpp in Sources */,
|
||||
1AC35C4A18CECF0C00F37B72 /* ShaderTest.cpp in Sources */,
|
||||
1AC35BFE18CECF0C00F37B72 /* Scale9SpriteTest.cpp in Sources */,
|
||||
C04F935B1941B05400E9FEAB /* TileMapTest2.cpp in Sources */,
|
||||
1AC35B4418CECF0C00F37B72 /* Bug-624.cpp in Sources */,
|
||||
1AC35BF818CECF0C00F37B72 /* SocketIOTest.cpp in Sources */,
|
||||
|
|
|
@ -126,6 +126,7 @@ Node::Node(void)
|
|||
, _cascadeColorEnabled(false)
|
||||
, _cascadeOpacityEnabled(false)
|
||||
, _usingNormalizedPosition(false)
|
||||
, _normalizedPositionDirty(false)
|
||||
, _name("")
|
||||
, _hashOfName(0)
|
||||
, _cameraMask(1)
|
||||
|
@ -613,6 +614,7 @@ void Node::setNormalizedPosition(const Vec2& position)
|
|||
|
||||
_normalizedPosition = position;
|
||||
_usingNormalizedPosition = true;
|
||||
_normalizedPositionDirty = true;
|
||||
_transformUpdated = _transformDirty = _inverseDirty = true;
|
||||
}
|
||||
|
||||
|
@ -1210,17 +1212,21 @@ void Node::visit()
|
|||
|
||||
uint32_t Node::processParentFlags(const Mat4& parentTransform, uint32_t parentFlags)
|
||||
{
|
||||
if(_usingNormalizedPosition) {
|
||||
CCASSERT(_parent, "setNormalizedPosition() doesn't work with orphan nodes");
|
||||
if ((parentFlags & FLAGS_CONTENT_SIZE_DIRTY) || _normalizedPositionDirty) {
|
||||
auto s = _parent->getContentSize();
|
||||
_position.x = _normalizedPosition.x * s.width;
|
||||
_position.y = _normalizedPosition.y * s.height;
|
||||
_transformUpdated = _transformDirty = _inverseDirty = true;
|
||||
_normalizedPositionDirty = false;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t flags = parentFlags;
|
||||
flags |= (_transformUpdated ? FLAGS_TRANSFORM_DIRTY : 0);
|
||||
flags |= (_contentSizeDirty ? FLAGS_CONTENT_SIZE_DIRTY : 0);
|
||||
|
||||
if(_usingNormalizedPosition && (flags & FLAGS_CONTENT_SIZE_DIRTY)) {
|
||||
CCASSERT(_parent, "setNormalizedPosition() doesn't work with orphan nodes");
|
||||
auto s = _parent->getContentSize();
|
||||
_position.x = _normalizedPosition.x * s.width;
|
||||
_position.y = _normalizedPosition.y * s.height;
|
||||
_transformUpdated = _transformDirty = _inverseDirty = true;
|
||||
}
|
||||
|
||||
|
||||
if(flags & FLAGS_DIRTY_MASK)
|
||||
_modelViewTransform = this->transform(parentTransform);
|
||||
|
|
|
@ -1555,6 +1555,7 @@ protected:
|
|||
float _positionZ; ///< OpenGL real Z position
|
||||
Vec2 _normalizedPosition;
|
||||
bool _usingNormalizedPosition;
|
||||
bool _normalizedPositionDirty;
|
||||
|
||||
float _skewX; ///< skew angle on x-axis
|
||||
float _skewY; ///< skew angle on y-axis
|
||||
|
|
|
@ -192,15 +192,11 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\spine\prebuilt\release-l
|
|||
<ClCompile Include="..\..\extensions\GUI\CCControlExtension\CCControlSwitch.cpp" />
|
||||
<ClCompile Include="..\..\extensions\GUI\CCControlExtension\CCControlUtils.cpp" />
|
||||
<ClCompile Include="..\..\extensions\GUI\CCControlExtension\CCInvocation.cpp" />
|
||||
<ClCompile Include="..\..\extensions\GUI\CCControlExtension\CCScale9Sprite.cpp" />
|
||||
<ClCompile Include="..\..\extensions\GUI\CCEditBox\CCEditBox.cpp" />
|
||||
<ClCompile Include="..\..\extensions\GUI\CCEditBox\CCEditBoxImplWin.cpp" />
|
||||
<ClCompile Include="..\..\extensions\GUI\CCScrollView\CCScrollView.cpp" />
|
||||
<ClCompile Include="..\..\extensions\GUI\CCScrollView\CCTableView.cpp" />
|
||||
<ClCompile Include="..\..\extensions\GUI\CCScrollView\CCTableViewCell.cpp" />
|
||||
<ClCompile Include="..\..\extensions\physics-nodes\CCPhysicsDebugNode.cpp" />
|
||||
<ClCompile Include="..\..\extensions\physics-nodes\CCPhysicsSprite.cpp" />
|
||||
<ClCompile Include="..\..\extensions\proj.win32\Win32InputBox.cpp" />
|
||||
<ClCompile Include="..\..\external\ConvertUTF\ConvertUTF.c" />
|
||||
<ClCompile Include="..\..\external\ConvertUTF\ConvertUTFWrapper.cpp" />
|
||||
<ClCompile Include="..\..\external\edtaa3func\edtaa3func.cpp" />
|
||||
|
@ -409,9 +405,12 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\spine\prebuilt\release-l
|
|||
<ClCompile Include="..\renderer\CCVertexIndexData.cpp" />
|
||||
<ClCompile Include="..\storage\local-storage\LocalStorage.cpp" />
|
||||
<ClCompile Include="..\ui\CocosGUI.cpp" />
|
||||
<ClCompile Include="..\ui\proj.win32\Win32InputBox.cpp" />
|
||||
<ClCompile Include="..\ui\UIButton.cpp" />
|
||||
<ClCompile Include="..\ui\UICheckBox.cpp" />
|
||||
<ClCompile Include="..\ui\UIDeprecated.cpp" />
|
||||
<ClCompile Include="..\ui\UIEditBox\UIEditBox.cpp" />
|
||||
<ClCompile Include="..\ui\UIEditBox\UIEditBoxImplWin.cpp" />
|
||||
<ClCompile Include="..\ui\UIHBox.cpp" />
|
||||
<ClCompile Include="..\ui\UIHelper.cpp" />
|
||||
<ClCompile Include="..\ui\UIImageView.cpp" />
|
||||
|
@ -516,16 +515,11 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\spine\prebuilt\release-l
|
|||
<ClInclude Include="..\..\extensions\GUI\CCControlExtension\CCControlSwitch.h" />
|
||||
<ClInclude Include="..\..\extensions\GUI\CCControlExtension\CCControlUtils.h" />
|
||||
<ClInclude Include="..\..\extensions\GUI\CCControlExtension\CCInvocation.h" />
|
||||
<ClInclude Include="..\..\extensions\GUI\CCControlExtension\CCScale9Sprite.h" />
|
||||
<ClInclude Include="..\..\extensions\GUI\CCEditBox\CCEditBox.h" />
|
||||
<ClInclude Include="..\..\extensions\GUI\CCEditBox\CCEditBoxImpl.h" />
|
||||
<ClInclude Include="..\..\extensions\GUI\CCEditBox\CCEditBoxImplWin.h" />
|
||||
<ClInclude Include="..\..\extensions\GUI\CCScrollView\CCScrollView.h" />
|
||||
<ClInclude Include="..\..\extensions\GUI\CCScrollView\CCTableView.h" />
|
||||
<ClInclude Include="..\..\extensions\GUI\CCScrollView\CCTableViewCell.h" />
|
||||
<ClInclude Include="..\..\extensions\physics-nodes\CCPhysicsDebugNode.h" />
|
||||
<ClInclude Include="..\..\extensions\physics-nodes\CCPhysicsSprite.h" />
|
||||
<ClInclude Include="..\..\extensions\proj.win32\Win32InputBox.h" />
|
||||
<ClInclude Include="..\..\external\ConvertUTF\ConvertUTF.h" />
|
||||
<ClInclude Include="..\..\external\edtaa3func\edtaa3func.h" />
|
||||
<ClInclude Include="..\..\external\json\document.h" />
|
||||
|
@ -786,9 +780,13 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\spine\prebuilt\release-l
|
|||
<ClInclude Include="..\storage\local-storage\LocalStorage.h" />
|
||||
<ClInclude Include="..\ui\CocosGUI.h" />
|
||||
<ClInclude Include="..\ui\GUIExport.h" />
|
||||
<ClInclude Include="..\ui\proj.win32\Win32InputBox.h" />
|
||||
<ClInclude Include="..\ui\UIButton.h" />
|
||||
<ClInclude Include="..\ui\UICheckBox.h" />
|
||||
<ClInclude Include="..\ui\UIDeprecated.h" />
|
||||
<ClInclude Include="..\ui\UIEditBox\UIEditBox.h" />
|
||||
<ClInclude Include="..\ui\UIEditBox\UIEditBoxImpl.h" />
|
||||
<ClInclude Include="..\ui\UIEditBox\UIEditBoxImplWin.h" />
|
||||
<ClInclude Include="..\ui\UIHBox.h" />
|
||||
<ClInclude Include="..\ui\UIHelper.h" />
|
||||
<ClInclude Include="..\ui\UIImageView.h" />
|
||||
|
|
|
@ -76,15 +76,9 @@
|
|||
<Filter Include="extension\GUI">
|
||||
<UniqueIdentifier>{b27aba95-51a2-413c-8570-0aff9adf2b6b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="extension\GUI\CCControlExtension">
|
||||
<UniqueIdentifier>{220cf2ee-61b0-40cf-a88a-8627e4e609f1}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="extension\GUI\CCScrollView">
|
||||
<UniqueIdentifier>{a1f539bc-d5be-4224-a4d2-01c0b6f17d6e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="extension\GUI\CCEditBox">
|
||||
<UniqueIdentifier>{dc45cd54-4576-4401-87b7-a276f91a45bd}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="extension\physics_nodes">
|
||||
<UniqueIdentifier>{1de7fce7-0dee-4571-8fcd-43eb617aaf8b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
|
@ -211,6 +205,12 @@
|
|||
<Filter Include="cocosbuilder\Source Files">
|
||||
<UniqueIdentifier>{8579ed15-b266-4f80-818d-a3a9251c4248}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="ui\UIWidgets\EditBox">
|
||||
<UniqueIdentifier>{89eb6312-dc7f-4fda-b9b2-ab67c31ddd55}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="extension\GUI\CCControlExtensions">
|
||||
<UniqueIdentifier>{118d80ca-ccf2-480c-b87d-25220af23440}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\physics\CCPhysicsBody.cpp">
|
||||
|
@ -787,42 +787,6 @@
|
|||
<ClCompile Include="..\..\extensions\assets-manager\AssetsManager.cpp">
|
||||
<Filter>extension\AssetsManager</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\extensions\GUI\CCControlExtension\CCControl.cpp">
|
||||
<Filter>extension\GUI\CCControlExtension</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\extensions\GUI\CCControlExtension\CCControlButton.cpp">
|
||||
<Filter>extension\GUI\CCControlExtension</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\extensions\GUI\CCControlExtension\CCControlColourPicker.cpp">
|
||||
<Filter>extension\GUI\CCControlExtension</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\extensions\GUI\CCControlExtension\CCControlHuePicker.cpp">
|
||||
<Filter>extension\GUI\CCControlExtension</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\extensions\GUI\CCControlExtension\CCControlPotentiometer.cpp">
|
||||
<Filter>extension\GUI\CCControlExtension</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\extensions\GUI\CCControlExtension\CCControlSaturationBrightnessPicker.cpp">
|
||||
<Filter>extension\GUI\CCControlExtension</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\extensions\GUI\CCControlExtension\CCControlSlider.cpp">
|
||||
<Filter>extension\GUI\CCControlExtension</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\extensions\GUI\CCControlExtension\CCControlStepper.cpp">
|
||||
<Filter>extension\GUI\CCControlExtension</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\extensions\GUI\CCControlExtension\CCControlSwitch.cpp">
|
||||
<Filter>extension\GUI\CCControlExtension</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\extensions\GUI\CCControlExtension\CCControlUtils.cpp">
|
||||
<Filter>extension\GUI\CCControlExtension</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\extensions\GUI\CCControlExtension\CCInvocation.cpp">
|
||||
<Filter>extension\GUI\CCControlExtension</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\extensions\GUI\CCControlExtension\CCScale9Sprite.cpp">
|
||||
<Filter>extension\GUI\CCControlExtension</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\extensions\GUI\CCScrollView\CCScrollView.cpp">
|
||||
<Filter>extension\GUI\CCScrollView</Filter>
|
||||
</ClCompile>
|
||||
|
@ -832,15 +796,6 @@
|
|||
<ClCompile Include="..\..\extensions\GUI\CCScrollView\CCTableViewCell.cpp">
|
||||
<Filter>extension\GUI\CCScrollView</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\extensions\GUI\CCEditBox\CCEditBox.cpp">
|
||||
<Filter>extension\GUI\CCEditBox</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\extensions\GUI\CCEditBox\CCEditBoxImplWin.cpp">
|
||||
<Filter>extension\GUI\CCEditBox</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\extensions\proj.win32\Win32InputBox.cpp">
|
||||
<Filter>extension\GUI\CCEditBox</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\extensions\physics-nodes\CCPhysicsDebugNode.cpp">
|
||||
<Filter>extension\physics_nodes</Filter>
|
||||
</ClCompile>
|
||||
|
@ -1165,6 +1120,48 @@
|
|||
<ClCompile Include="..\editor-support\cocosbuilder\CCSpriteLoader.cpp">
|
||||
<Filter>cocosbuilder\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\ui\UIEditBox\UIEditBox.cpp">
|
||||
<Filter>ui\UIWidgets\EditBox</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\ui\UIEditBox\UIEditBoxImplWin.cpp">
|
||||
<Filter>ui\UIWidgets\EditBox</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\extensions\GUI\CCControlExtension\CCControl.cpp">
|
||||
<Filter>extension\GUI\CCControlExtensions</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\extensions\GUI\CCControlExtension\CCControlButton.cpp">
|
||||
<Filter>extension\GUI\CCControlExtensions</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\extensions\GUI\CCControlExtension\CCControlColourPicker.cpp">
|
||||
<Filter>extension\GUI\CCControlExtensions</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\extensions\GUI\CCControlExtension\CCControlHuePicker.cpp">
|
||||
<Filter>extension\GUI\CCControlExtensions</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\extensions\GUI\CCControlExtension\CCControlPotentiometer.cpp">
|
||||
<Filter>extension\GUI\CCControlExtensions</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\extensions\GUI\CCControlExtension\CCControlSaturationBrightnessPicker.cpp">
|
||||
<Filter>extension\GUI\CCControlExtensions</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\extensions\GUI\CCControlExtension\CCControlSlider.cpp">
|
||||
<Filter>extension\GUI\CCControlExtensions</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\extensions\GUI\CCControlExtension\CCControlStepper.cpp">
|
||||
<Filter>extension\GUI\CCControlExtensions</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\extensions\GUI\CCControlExtension\CCControlSwitch.cpp">
|
||||
<Filter>extension\GUI\CCControlExtensions</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\extensions\GUI\CCControlExtension\CCControlUtils.cpp">
|
||||
<Filter>extension\GUI\CCControlExtensions</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\extensions\GUI\CCControlExtension\CCInvocation.cpp">
|
||||
<Filter>extension\GUI\CCControlExtensions</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\ui\proj.win32\Win32InputBox.cpp">
|
||||
<Filter>ui\UIWidgets\EditBox</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\physics\CCPhysicsBody.h">
|
||||
|
@ -1825,45 +1822,6 @@
|
|||
<ClInclude Include="..\..\extensions\assets-manager\AssetsManager.h">
|
||||
<Filter>extension\AssetsManager</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\extensions\GUI\CCControlExtension\CCControl.h">
|
||||
<Filter>extension\GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\extensions\GUI\CCControlExtension\CCControlButton.h">
|
||||
<Filter>extension\GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\extensions\GUI\CCControlExtension\CCControlColourPicker.h">
|
||||
<Filter>extension\GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\extensions\GUI\CCControlExtension\CCControlExtensions.h">
|
||||
<Filter>extension\GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\extensions\GUI\CCControlExtension\CCControlHuePicker.h">
|
||||
<Filter>extension\GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\extensions\GUI\CCControlExtension\CCControlPotentiometer.h">
|
||||
<Filter>extension\GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\extensions\GUI\CCControlExtension\CCControlSaturationBrightnessPicker.h">
|
||||
<Filter>extension\GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\extensions\GUI\CCControlExtension\CCControlSlider.h">
|
||||
<Filter>extension\GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\extensions\GUI\CCControlExtension\CCControlStepper.h">
|
||||
<Filter>extension\GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\extensions\GUI\CCControlExtension\CCControlSwitch.h">
|
||||
<Filter>extension\GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\extensions\GUI\CCControlExtension\CCControlUtils.h">
|
||||
<Filter>extension\GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\extensions\GUI\CCControlExtension\CCInvocation.h">
|
||||
<Filter>extension\GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\extensions\GUI\CCControlExtension\CCScale9Sprite.h">
|
||||
<Filter>extension\GUI\CCControlExtension</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\extensions\GUI\CCScrollView\CCScrollView.h">
|
||||
<Filter>extension\GUI\CCScrollView</Filter>
|
||||
</ClInclude>
|
||||
|
@ -1873,18 +1831,6 @@
|
|||
<ClInclude Include="..\..\extensions\GUI\CCScrollView\CCTableViewCell.h">
|
||||
<Filter>extension\GUI\CCScrollView</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\extensions\GUI\CCEditBox\CCEditBox.h">
|
||||
<Filter>extension\GUI\CCEditBox</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\extensions\GUI\CCEditBox\CCEditBoxImpl.h">
|
||||
<Filter>extension\GUI\CCEditBox</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\extensions\GUI\CCEditBox\CCEditBoxImplWin.h">
|
||||
<Filter>extension\GUI\CCEditBox</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\extensions\proj.win32\Win32InputBox.h">
|
||||
<Filter>extension\GUI\CCEditBox</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\extensions\physics-nodes\CCPhysicsDebugNode.h">
|
||||
<Filter>extension\physics_nodes</Filter>
|
||||
</ClInclude>
|
||||
|
@ -2290,6 +2236,54 @@
|
|||
<ClInclude Include="..\editor-support\cocosbuilder\CocosBuilder.h">
|
||||
<Filter>cocosbuilder\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ui\UIEditBox\UIEditBox.h">
|
||||
<Filter>ui\UIWidgets\EditBox</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ui\UIEditBox\UIEditBoxImpl.h">
|
||||
<Filter>ui\UIWidgets\EditBox</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ui\UIEditBox\UIEditBoxImplWin.h">
|
||||
<Filter>ui\UIWidgets\EditBox</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\extensions\GUI\CCControlExtension\CCControl.h">
|
||||
<Filter>extension\GUI\CCControlExtensions</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\extensions\GUI\CCControlExtension\CCControlButton.h">
|
||||
<Filter>extension\GUI\CCControlExtensions</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\extensions\GUI\CCControlExtension\CCControlColourPicker.h">
|
||||
<Filter>extension\GUI\CCControlExtensions</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\extensions\GUI\CCControlExtension\CCControlExtensions.h">
|
||||
<Filter>extension\GUI\CCControlExtensions</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\extensions\GUI\CCControlExtension\CCControlHuePicker.h">
|
||||
<Filter>extension\GUI\CCControlExtensions</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\extensions\GUI\CCControlExtension\CCControlPotentiometer.h">
|
||||
<Filter>extension\GUI\CCControlExtensions</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\extensions\GUI\CCControlExtension\CCControlSaturationBrightnessPicker.h">
|
||||
<Filter>extension\GUI\CCControlExtensions</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\extensions\GUI\CCControlExtension\CCControlSlider.h">
|
||||
<Filter>extension\GUI\CCControlExtensions</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\extensions\GUI\CCControlExtension\CCControlStepper.h">
|
||||
<Filter>extension\GUI\CCControlExtensions</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\extensions\GUI\CCControlExtension\CCControlSwitch.h">
|
||||
<Filter>extension\GUI\CCControlExtensions</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\extensions\GUI\CCControlExtension\CCControlUtils.h">
|
||||
<Filter>extension\GUI\CCControlExtensions</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\extensions\GUI\CCControlExtension\CCInvocation.h">
|
||||
<Filter>extension\GUI\CCControlExtensions</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ui\proj.win32\Win32InputBox.h">
|
||||
<Filter>ui\UIWidgets\EditBox</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\math\Mat4.inl">
|
||||
|
|
|
@ -760,7 +760,17 @@ bool Bundle3D::loadNodes(NodeDatas& nodedatas)
|
|||
if (_version == "0.1" || _version == "1.2" || _version == "0.2")
|
||||
{
|
||||
SkinData skinData;
|
||||
loadSkinData("", &skinData);
|
||||
if (!loadSkinData("", &skinData))
|
||||
{
|
||||
auto node= new (std::nothrow) NodeData();
|
||||
auto modelnode = new (std::nothrow) ModelData();
|
||||
modelnode->matrialId = "";
|
||||
modelnode->subMeshId = "";
|
||||
node->modelNodeDatas.push_back(modelnode);
|
||||
nodedatas.nodes.push_back(node);
|
||||
return true;
|
||||
}
|
||||
|
||||
auto nodeDatas = new (std::nothrow) NodeData*[skinData.skinBoneNames.size() + skinData.nodeBoneNames.size()];
|
||||
int index = 0;
|
||||
size_t i;
|
||||
|
|
|
@ -231,6 +231,7 @@ Sprite3D* Sprite3D::createSprite3DNode(NodeData* nodedata,ModelData* modeldata,c
|
|||
auto sprite = new (std::nothrow) Sprite3D();
|
||||
if (sprite)
|
||||
{
|
||||
sprite->setName(nodedata->id);
|
||||
auto mesh = Mesh::create(nodedata->id, getMeshIndexData(modeldata->subMeshId));
|
||||
if (modeldata->matrialId == "" && matrialdatas.materials.size())
|
||||
{
|
||||
|
@ -399,6 +400,7 @@ void Sprite3D::createNode(NodeData* nodedata, Node* root, const MaterialDatas& m
|
|||
node= Node::create();
|
||||
if(node)
|
||||
{
|
||||
node->setName(nodedata->id);
|
||||
node->setAdditionalTransform(&nodedata->transform);
|
||||
if(root)
|
||||
{
|
||||
|
|
|
@ -90,9 +90,6 @@ list(REMOVE_ITEM cocos2d_source_files
|
|||
"${CMAKE_CURRENT_SOURCE_DIR}/storage/local-storage/LocalStorageAndroid.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/base/CCEventController.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/base/CCEventListenerController.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../extensions/GUI/CCEditBox/CCEditBoxImplWp8.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/editor-support/cocostudio/proj.wp8/pch.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../extensions/proj.wp8/pch.cpp")
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include <functional>
|
||||
#include "base/ObjectFactory.h"
|
||||
|
||||
|
||||
|
@ -30,12 +31,22 @@ NS_CC_BEGIN
|
|||
ObjectFactory::TInfo::TInfo(void)
|
||||
:_class("")
|
||||
,_fun(nullptr)
|
||||
,_func(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
ObjectFactory::TInfo::TInfo(const std::string& type, Instance ins)
|
||||
:_class(type)
|
||||
,_fun(ins)
|
||||
,_func(nullptr)
|
||||
{
|
||||
ObjectFactory::getInstance()->registerType(*this);
|
||||
}
|
||||
|
||||
ObjectFactory::TInfo::TInfo(const std::string& type, InstanceFunc ins)
|
||||
:_class(type)
|
||||
,_fun(nullptr)
|
||||
,_func(ins)
|
||||
{
|
||||
ObjectFactory::getInstance()->registerType(*this);
|
||||
}
|
||||
|
@ -44,18 +55,21 @@ ObjectFactory::TInfo::TInfo(const TInfo &t)
|
|||
{
|
||||
_class = t._class;
|
||||
_fun = t._fun;
|
||||
_func = t._func;
|
||||
}
|
||||
|
||||
ObjectFactory::TInfo::~TInfo(void)
|
||||
{
|
||||
_class = "";
|
||||
_fun = nullptr;
|
||||
_func = nullptr;
|
||||
}
|
||||
|
||||
ObjectFactory::TInfo& ObjectFactory::TInfo::operator= (const TInfo &t)
|
||||
{
|
||||
_class = t._class;
|
||||
_fun = t._fun;
|
||||
_func = t._func;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -88,13 +102,18 @@ void ObjectFactory::destroyInstance()
|
|||
|
||||
Ref* ObjectFactory::createObject(const std::string &name)
|
||||
{
|
||||
Ref *o = nullptr;
|
||||
do
|
||||
{
|
||||
const TInfo t = _typeMap[name];
|
||||
CC_BREAK_IF(t._fun == nullptr);
|
||||
o = t._fun();
|
||||
} while (0);
|
||||
Ref *o = nullptr;
|
||||
do
|
||||
{
|
||||
const TInfo t = _typeMap[name];
|
||||
if (t._fun != nullptr)
|
||||
{
|
||||
o = t._fun();
|
||||
}else if (t._func != nullptr)
|
||||
{
|
||||
o = t._func();
|
||||
}
|
||||
} while (0);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ THE SOFTWARE.
|
|||
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <functional>
|
||||
#include "base/CCRef.h"
|
||||
#include "base/CCPlatformMacros.h"
|
||||
|
||||
|
@ -36,15 +37,18 @@ class CC_DLL ObjectFactory
|
|||
{
|
||||
public:
|
||||
typedef cocos2d::Ref* (*Instance)(void);
|
||||
typedef std::function<cocos2d::Ref* (void)> InstanceFunc;
|
||||
struct CC_DLL TInfo
|
||||
{
|
||||
TInfo(void);
|
||||
TInfo(const std::string& type, Instance ins = NULL);
|
||||
TInfo(const std::string& type, Instance ins = nullptr);
|
||||
TInfo(const std::string& type, InstanceFunc ins = nullptr);
|
||||
TInfo(const TInfo &t);
|
||||
~TInfo(void);
|
||||
TInfo& operator= (const TInfo &t);
|
||||
std::string _class;
|
||||
Instance _fun;
|
||||
InstanceFunc _func;
|
||||
};
|
||||
typedef std::unordered_map<std::string, TInfo> FactoryMap;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace cocosbuilder {
|
|||
|
||||
void Scale9SpriteLoader::onHandlePropTypeSpriteFrame(Node * pNode, Node * pParent, const char * pPropertyName, SpriteFrame * pSpriteFrame, CCBReader * ccbReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_SPRITEFRAME) == 0) {
|
||||
((Scale9Sprite *)pNode)->setSpriteFrame(pSpriteFrame);
|
||||
((cocos2d::ui::Scale9Sprite *)pNode)->setSpriteFrame(pSpriteFrame);
|
||||
} else {
|
||||
NodeLoader::onHandlePropTypeSpriteFrame(pNode, pParent, pPropertyName, pSpriteFrame, ccbReader);
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ void Scale9SpriteLoader::onHandlePropTypeSpriteFrame(Node * pNode, Node * pParen
|
|||
|
||||
void Scale9SpriteLoader::onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, Color3B pColor3B, CCBReader * ccbReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_COLOR) == 0) {
|
||||
((Scale9Sprite *)pNode)->setColor(pColor3B);
|
||||
((cocos2d::ui::Scale9Sprite *)pNode)->setColor(pColor3B);
|
||||
} else {
|
||||
NodeLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pColor3B, ccbReader);
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ void Scale9SpriteLoader::onHandlePropTypeColor3(Node * pNode, Node * pParent, co
|
|||
|
||||
void Scale9SpriteLoader::onHandlePropTypeByte(Node * pNode, Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * ccbReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_OPACITY) == 0) {
|
||||
((Scale9Sprite *)pNode)->setOpacity(pByte);
|
||||
((cocos2d::ui::Scale9Sprite *)pNode)->setOpacity(pByte);
|
||||
} else {
|
||||
NodeLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, ccbReader);
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ void Scale9SpriteLoader::onHandlePropTypeSize(Node * pNode, Node * pParent, cons
|
|||
if(strcmp(pPropertyName, PROPERTY_CONTENTSIZE) == 0) {
|
||||
//((Scale9Sprite *)pNode)->setContentSize(pSize);
|
||||
} else if(strcmp(pPropertyName, PROPERTY_PREFEREDSIZE) == 0) {
|
||||
((Scale9Sprite *)pNode)->setPreferredSize(pSize);
|
||||
((cocos2d::ui::Scale9Sprite *)pNode)->setPreferredSize(pSize);
|
||||
} else {
|
||||
NodeLoader::onHandlePropTypeSize(pNode, pParent, pPropertyName, pSize, ccbReader);
|
||||
}
|
||||
|
@ -62,13 +62,13 @@ void Scale9SpriteLoader::onHandlePropTypeSize(Node * pNode, Node * pParent, cons
|
|||
|
||||
void Scale9SpriteLoader::onHandlePropTypeFloat(Node * pNode, Node * pParent, const char * pPropertyName, float pFloat, CCBReader * ccbReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_INSETLEFT) == 0) {
|
||||
((Scale9Sprite *)pNode)->setInsetLeft(pFloat);
|
||||
((cocos2d::ui::Scale9Sprite *)pNode)->setInsetLeft(pFloat);
|
||||
} else if(strcmp(pPropertyName, PROPERTY_INSETTOP) == 0) {
|
||||
((Scale9Sprite *)pNode)->setInsetTop(pFloat);
|
||||
((cocos2d::ui::Scale9Sprite *)pNode)->setInsetTop(pFloat);
|
||||
} else if(strcmp(pPropertyName, PROPERTY_INSETRIGHT) == 0) {
|
||||
((Scale9Sprite *)pNode)->setInsetRight(pFloat);
|
||||
((cocos2d::ui::Scale9Sprite *)pNode)->setInsetRight(pFloat);
|
||||
} else if(strcmp(pPropertyName, PROPERTY_INSETBOTTOM) == 0) {
|
||||
((Scale9Sprite *)pNode)->setInsetBottom(pFloat);
|
||||
((cocos2d::ui::Scale9Sprite *)pNode)->setInsetBottom(pFloat);
|
||||
} else {
|
||||
NodeLoader::onHandlePropTypeFloat(pNode, pParent, pPropertyName, pFloat, ccbReader);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "CCNodeLoader.h"
|
||||
#include "CCScale9SpriteLoader.h"
|
||||
#include "extensions/GUI/CCControlExtension/CCScale9Sprite.h"
|
||||
#include "ui/UIScale9Sprite.h"
|
||||
|
||||
namespace cocosbuilder {
|
||||
|
||||
|
@ -28,8 +28,8 @@ protected:
|
|||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual cocos2d::extension::Scale9Sprite * createNode(cocos2d::Node * pParent, cocosbuilder::CCBReader * ccbReader) {
|
||||
cocos2d::extension::Scale9Sprite* pNode = cocos2d::extension::Scale9Sprite::create();
|
||||
virtual cocos2d::ui::Scale9Sprite * createNode(cocos2d::Node * pParent, cocosbuilder::CCBReader * ccbReader) {
|
||||
cocos2d::ui::Scale9Sprite* pNode = cocos2d::ui::Scale9Sprite::create();
|
||||
|
||||
pNode->setAnchorPoint(cocos2d::Vec2::ZERO);
|
||||
|
||||
|
|
|
@ -176,6 +176,27 @@ void GUIReader::registerTypeAndCallBack(const std::string& classType,
|
|||
}
|
||||
}
|
||||
|
||||
void GUIReader::registerTypeAndCallBack(const std::string& classType,
|
||||
ObjectFactory::InstanceFunc ins,
|
||||
Ref *object,
|
||||
SEL_ParseEvent callBack)
|
||||
{
|
||||
ObjectFactory* factoryCreate = ObjectFactory::getInstance();
|
||||
|
||||
ObjectFactory::TInfo t(classType, ins);
|
||||
factoryCreate->registerType(t);
|
||||
|
||||
if (object)
|
||||
{
|
||||
_mapObject.insert(ParseObjectMap::value_type(classType, object));
|
||||
}
|
||||
|
||||
if (callBack)
|
||||
{
|
||||
_mapParseSelector.insert(ParseCallBackMap::value_type(classType, callBack));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Widget* GUIReader::widgetFromJsonFile(const char *fileName)
|
||||
{
|
||||
|
@ -1511,11 +1532,11 @@ void WidgetPropertiesReader0300::setPropsForAllCustomWidgetFromJsonDictionary(co
|
|||
{
|
||||
GUIReader* guiReader = GUIReader::getInstance();
|
||||
|
||||
std::map<std::string, Ref*> object_map = GUIReader::getInstance()->getParseObjectMap();
|
||||
Ref* object = object_map[classType];
|
||||
std::map<std::string, Ref*> *object_map = guiReader->getParseObjectMap();
|
||||
Ref* object = (*object_map)[classType];
|
||||
|
||||
std::map<std::string, SEL_ParseEvent> selector_map = guiReader->getParseCallBackMap();
|
||||
SEL_ParseEvent selector = selector_map[classType];
|
||||
std::map<std::string, SEL_ParseEvent> *selector_map = guiReader->getParseCallBackMap();
|
||||
SEL_ParseEvent selector = (*selector_map)[classType];
|
||||
|
||||
if (object && selector)
|
||||
{
|
||||
|
|
|
@ -72,6 +72,11 @@ public:
|
|||
cocos2d::ObjectFactory::Instance ins,
|
||||
Ref* object,
|
||||
SEL_ParseEvent callBack);
|
||||
|
||||
void registerTypeAndCallBack(const std::string& classType,
|
||||
cocos2d::ObjectFactory::InstanceFunc ins,
|
||||
Ref* object,
|
||||
SEL_ParseEvent callBack);
|
||||
protected:
|
||||
GUIReader();
|
||||
~GUIReader();
|
||||
|
@ -85,8 +90,8 @@ protected:
|
|||
ParseObjectMap _mapObject;
|
||||
|
||||
public:
|
||||
ParseCallBackMap getParseCallBackMap() { return _mapParseSelector; };
|
||||
ParseObjectMap getParseObjectMap() { return _mapObject; };
|
||||
ParseCallBackMap* getParseCallBackMap() { return &_mapParseSelector; };
|
||||
ParseObjectMap* getParseObjectMap() { return &_mapObject; };
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -1,109 +0,0 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
package org.cocos2dx.lib;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.AssetManager;
|
||||
import android.opengl.ETC1Util;
|
||||
import android.util.Log;
|
||||
|
||||
public class Cocos2dxETCLoader {
|
||||
private static final String ASSETS_PATH = "assets/";
|
||||
private static Context context;
|
||||
|
||||
public static boolean loadTexture(String filePath) {
|
||||
if (! ETC1Util.isETC1Supported()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (filePath.length() == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create ETC1Texture
|
||||
InputStream inputStream = null;
|
||||
ETC1Util.ETC1Texture texture = null;
|
||||
AssetManager assetManager = null;
|
||||
try {
|
||||
if (filePath.charAt(0) == '/') {
|
||||
// absolute path
|
||||
inputStream = new FileInputStream(filePath);
|
||||
} else {
|
||||
// remove prefix: "assets/"
|
||||
if (filePath.startsWith(ASSETS_PATH)) {
|
||||
filePath = filePath.substring(ASSETS_PATH.length());
|
||||
}
|
||||
assetManager = context.getAssets();
|
||||
inputStream = assetManager.open(filePath);
|
||||
}
|
||||
|
||||
texture = ETC1Util.createTexture(inputStream);
|
||||
inputStream.close();
|
||||
} catch (Exception e) {
|
||||
Log.d("Cocos2dx", "Unable to create texture for " + filePath);
|
||||
|
||||
texture = null;
|
||||
}
|
||||
|
||||
if (texture != null) {
|
||||
boolean ret = true;
|
||||
|
||||
try {
|
||||
final int width = texture.getWidth();
|
||||
final int height = texture.getHeight();
|
||||
final int length = texture.getData().remaining();
|
||||
|
||||
final byte[] data = new byte[length];
|
||||
final ByteBuffer buf = ByteBuffer.wrap(data);
|
||||
buf.order(ByteOrder.nativeOrder());
|
||||
buf.put(texture.getData());
|
||||
|
||||
nativeSetTextureInfo(width,
|
||||
height,
|
||||
data,
|
||||
length);
|
||||
} catch (Exception e)
|
||||
{
|
||||
Log.d("invoke native function error", e.toString());
|
||||
ret = false;
|
||||
}
|
||||
|
||||
return ret;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void setContext(Context context) {
|
||||
Cocos2dxETCLoader.context = context;
|
||||
}
|
||||
|
||||
private static native void nativeSetTextureInfo(final int width, final int height, final byte[] data,
|
||||
final int dataLength);
|
||||
}
|
|
@ -374,7 +374,8 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
|
|||
|
||||
for(UIView* view in subviews)
|
||||
{
|
||||
if([view isKindOfClass:NSClassFromString(@"CCCustomUITextField")])
|
||||
if([view isKindOfClass:NSClassFromString(@"CCCustomUITextField")] ||
|
||||
[view isKindOfClass:NSClassFromString(@"UICustomUITextField")])
|
||||
{
|
||||
if ([view isFirstResponder])
|
||||
{
|
||||
|
|
|
@ -147,7 +147,7 @@ static Data getData(const std::string& filename, bool forString)
|
|||
WCHAR wszBuf[CC_MAX_PATH] = {0};
|
||||
MultiByteToWideChar(CP_UTF8, 0, fullPath.c_str(), -1, wszBuf, sizeof(wszBuf)/sizeof(wszBuf[0]));
|
||||
|
||||
HANDLE fileHandle = ::CreateFileW(wszBuf, GENERIC_READ, 0, NULL, OPEN_EXISTING, NULL, nullptr);
|
||||
HANDLE fileHandle = ::CreateFileW(wszBuf, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, nullptr);
|
||||
CC_BREAK_IF(fileHandle == INVALID_HANDLE_VALUE);
|
||||
|
||||
size = ::GetFileSize(fileHandle, nullptr);
|
||||
|
@ -222,7 +222,7 @@ unsigned char* FileUtilsWin32::getFileData(const std::string& filename, const ch
|
|||
WCHAR wszBuf[CC_MAX_PATH] = {0};
|
||||
MultiByteToWideChar(CP_UTF8, 0, fullPath.c_str(), -1, wszBuf, sizeof(wszBuf)/sizeof(wszBuf[0]));
|
||||
|
||||
HANDLE fileHandle = ::CreateFileW(wszBuf, GENERIC_READ, 0, NULL, OPEN_EXISTING, NULL, nullptr);
|
||||
HANDLE fileHandle = ::CreateFileW(wszBuf, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, nullptr);
|
||||
CC_BREAK_IF(fileHandle == INVALID_HANDLE_VALUE);
|
||||
|
||||
*size = ::GetFileSize(fileHandle, nullptr);
|
||||
|
|
|
@ -122,7 +122,7 @@
|
|||
-- @function [parent=#ControlButton] getBackgroundSpriteForState
|
||||
-- @param self
|
||||
-- @param #int state
|
||||
-- @return Scale9Sprite#Scale9Sprite ret (return value: cc.Scale9Sprite)
|
||||
-- @return Scale9Sprite#Scale9Sprite ret (return value: ccui.Scale9Sprite)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
|
@ -159,7 +159,7 @@
|
|||
--
|
||||
-- @function [parent=#ControlButton] getBackgroundSprite
|
||||
-- @param self
|
||||
-- @return Scale9Sprite#Scale9Sprite ret (return value: cc.Scale9Sprite)
|
||||
-- @return Scale9Sprite#Scale9Sprite ret (return value: ccui.Scale9Sprite)
|
||||
|
||||
--------------------------------
|
||||
-- Returns the title color used for a state.<br>
|
||||
|
@ -205,7 +205,7 @@
|
|||
-- in "CCControlState".
|
||||
-- @function [parent=#ControlButton] setBackgroundSpriteForState
|
||||
-- @param self
|
||||
-- @param #cc.Scale9Sprite sprite
|
||||
-- @param #ccui.Scale9Sprite sprite
|
||||
-- @param #int state
|
||||
|
||||
--------------------------------
|
||||
|
@ -218,7 +218,7 @@
|
|||
--
|
||||
-- @function [parent=#ControlButton] setBackgroundSprite
|
||||
-- @param self
|
||||
-- @param #cc.Scale9Sprite var
|
||||
-- @param #ccui.Scale9Sprite var
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
|
@ -288,9 +288,9 @@
|
|||
-- @return string#string ret (return value: string)
|
||||
|
||||
--------------------------------
|
||||
-- @overload self, cc.Scale9Sprite
|
||||
-- @overload self, ccui.Scale9Sprite
|
||||
-- @overload self
|
||||
-- @overload self, cc.Node, cc.Scale9Sprite
|
||||
-- @overload self, cc.Node, ccui.Scale9Sprite
|
||||
-- @overload self, string, string, float
|
||||
-- @function [parent=#ControlButton] create
|
||||
-- @param self
|
||||
|
|
|
@ -1,182 +0,0 @@
|
|||
|
||||
--------------------------------
|
||||
-- @module EditBox
|
||||
-- @extend ControlButton,IMEDelegate
|
||||
-- @parent_module cc
|
||||
|
||||
--------------------------------
|
||||
-- Get the text entered in the edit box.<br>
|
||||
-- return The text entered in the edit box.
|
||||
-- @function [parent=#EditBox] getText
|
||||
-- @param self
|
||||
-- @return char#char ret (return value: char)
|
||||
|
||||
--------------------------------
|
||||
-- Set the placeholder's font name.<br>
|
||||
-- param pFontName The font name.
|
||||
-- @function [parent=#EditBox] setPlaceholderFontName
|
||||
-- @param self
|
||||
-- @param #char pFontName
|
||||
|
||||
--------------------------------
|
||||
-- Get a text in the edit box that acts as a placeholder when an<br>
|
||||
-- edit box is empty.
|
||||
-- @function [parent=#EditBox] getPlaceHolder
|
||||
-- @param self
|
||||
-- @return char#char ret (return value: char)
|
||||
|
||||
--------------------------------
|
||||
-- Set the font name.<br>
|
||||
-- param pFontName The font name.
|
||||
-- @function [parent=#EditBox] setFontName
|
||||
-- @param self
|
||||
-- @param #char pFontName
|
||||
|
||||
--------------------------------
|
||||
-- Set the placeholder's font size.<br>
|
||||
-- param fontSize The font size.
|
||||
-- @function [parent=#EditBox] setPlaceholderFontSize
|
||||
-- @param self
|
||||
-- @param #int fontSize
|
||||
|
||||
--------------------------------
|
||||
-- Set the input mode of the edit box.<br>
|
||||
-- param inputMode One of the EditBox::InputMode constants.
|
||||
-- @function [parent=#EditBox] setInputMode
|
||||
-- @param self
|
||||
-- @param #int inputMode
|
||||
|
||||
--------------------------------
|
||||
-- Set the font color of the placeholder text when the edit box is empty.<br>
|
||||
-- Not supported on IOS.
|
||||
-- @function [parent=#EditBox] setPlaceholderFontColor
|
||||
-- @param self
|
||||
-- @param #color3b_table color
|
||||
|
||||
--------------------------------
|
||||
-- Set the font color of the widget's text.
|
||||
-- @function [parent=#EditBox] setFontColor
|
||||
-- @param self
|
||||
-- @param #color3b_table color
|
||||
|
||||
--------------------------------
|
||||
-- Set the placeholder's font.<br>
|
||||
-- param pFontName The font name.<br>
|
||||
-- param fontSize The font size.
|
||||
-- @function [parent=#EditBox] setPlaceholderFont
|
||||
-- @param self
|
||||
-- @param #char pFontName
|
||||
-- @param #int fontSize
|
||||
|
||||
--------------------------------
|
||||
-- Set the font size.<br>
|
||||
-- param fontSize The font size.
|
||||
-- @function [parent=#EditBox] setFontSize
|
||||
-- @param self
|
||||
-- @param #int fontSize
|
||||
|
||||
--------------------------------
|
||||
-- Init edit box with specified size. This method should be invoked right after constructor.<br>
|
||||
-- param size The size of edit box.
|
||||
-- @function [parent=#EditBox] initWithSizeAndBackgroundSprite
|
||||
-- @param self
|
||||
-- @param #size_table size
|
||||
-- @param #cc.Scale9Sprite pNormal9SpriteBg
|
||||
-- @return bool#bool ret (return value: bool)
|
||||
|
||||
--------------------------------
|
||||
-- Set a text in the edit box that acts as a placeholder when an<br>
|
||||
-- edit box is empty.<br>
|
||||
-- param pText The given text.
|
||||
-- @function [parent=#EditBox] setPlaceHolder
|
||||
-- @param self
|
||||
-- @param #char pText
|
||||
|
||||
--------------------------------
|
||||
-- Set the return type that are to be applied to the edit box.<br>
|
||||
-- param returnType One of the EditBox::KeyboardReturnType constants.
|
||||
-- @function [parent=#EditBox] setReturnType
|
||||
-- @param self
|
||||
-- @param #int returnType
|
||||
|
||||
--------------------------------
|
||||
-- Set the input flags that are to be applied to the edit box.<br>
|
||||
-- param inputFlag One of the EditBox::InputFlag constants.
|
||||
-- @function [parent=#EditBox] setInputFlag
|
||||
-- @param self
|
||||
-- @param #int inputFlag
|
||||
|
||||
--------------------------------
|
||||
-- Gets the maximum input length of the edit box.<br>
|
||||
-- return Maximum input length.
|
||||
-- @function [parent=#EditBox] getMaxLength
|
||||
-- @param self
|
||||
-- @return int#int ret (return value: int)
|
||||
|
||||
--------------------------------
|
||||
-- Set the text entered in the edit box.<br>
|
||||
-- param pText The given text.
|
||||
-- @function [parent=#EditBox] setText
|
||||
-- @param self
|
||||
-- @param #char pText
|
||||
|
||||
--------------------------------
|
||||
-- Sets the maximum input length of the edit box.<br>
|
||||
-- Setting this value enables multiline input mode by default.<br>
|
||||
-- Available on Android, iOS and Windows Phone.<br>
|
||||
-- param maxLength The maximum length.
|
||||
-- @function [parent=#EditBox] setMaxLength
|
||||
-- @param self
|
||||
-- @param #int maxLength
|
||||
|
||||
--------------------------------
|
||||
-- Set the font.<br>
|
||||
-- param pFontName The font name.<br>
|
||||
-- param fontSize The font size.
|
||||
-- @function [parent=#EditBox] setFont
|
||||
-- @param self
|
||||
-- @param #char pFontName
|
||||
-- @param #int fontSize
|
||||
|
||||
--------------------------------
|
||||
-- create a edit box with size.<br>
|
||||
-- return An autorelease pointer of EditBox, you don't need to release it only if you retain it again.
|
||||
-- @function [parent=#EditBox] create
|
||||
-- @param self
|
||||
-- @param #size_table size
|
||||
-- @param #cc.Scale9Sprite pNormal9SpriteBg
|
||||
-- @param #cc.Scale9Sprite pPressed9SpriteBg
|
||||
-- @param #cc.Scale9Sprite pDisabled9SpriteBg
|
||||
-- @return EditBox#EditBox ret (return value: cc.EditBox)
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#EditBox] setAnchorPoint
|
||||
-- @param self
|
||||
-- @param #vec2_table anchorPoint
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#EditBox] setPosition
|
||||
-- @param self
|
||||
-- @param #vec2_table pos
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#EditBox] setVisible
|
||||
-- @param self
|
||||
-- @param #bool visible
|
||||
|
||||
--------------------------------
|
||||
--
|
||||
-- @function [parent=#EditBox] setContentSize
|
||||
-- @param self
|
||||
-- @param #size_table size
|
||||
|
||||
--------------------------------
|
||||
-- Constructor.<br>
|
||||
-- js ctor
|
||||
-- @function [parent=#EditBox] EditBox
|
||||
-- @param self
|
||||
|
||||
return nil
|
|
@ -1,11 +1,6 @@
|
|||
--------------------------------
|
||||
-- @module cc
|
||||
|
||||
--------------------------------------------------------
|
||||
-- the cc Scale9Sprite
|
||||
-- @field [parent=#cc] Scale9Sprite#Scale9Sprite Scale9Sprite preloaded module
|
||||
|
||||
|
||||
--------------------------------------------------------
|
||||
-- the cc Control
|
||||
-- @field [parent=#cc] Control#Control Control preloaded module
|
||||
|
@ -66,11 +61,6 @@
|
|||
-- @field [parent=#cc] TableView#TableView TableView preloaded module
|
||||
|
||||
|
||||
--------------------------------------------------------
|
||||
-- the cc EditBox
|
||||
-- @field [parent=#cc] EditBox#EditBox EditBox preloaded module
|
||||
|
||||
|
||||
--------------------------------------------------------
|
||||
-- the cc AssetsManager
|
||||
-- @field [parent=#cc] AssetsManager#AssetsManager AssetsManager preloaded module
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -243,53 +243,6 @@ int register_all_cocos2dx_extension(lua_State* tolua_S);
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1995,23 +1995,23 @@ void vec3_to_luaval(lua_State* L,const cocos2d::Vec3& vec3)
|
|||
lua_rawset(L, -3);
|
||||
}
|
||||
|
||||
void vec4_to_luaval(lua_State* L,const cocos2d::Vec4& vec3)
|
||||
void vec4_to_luaval(lua_State* L,const cocos2d::Vec4& vec4)
|
||||
{
|
||||
if (NULL == L)
|
||||
return;
|
||||
|
||||
lua_newtable(L); /* L: table */
|
||||
lua_pushstring(L, "x"); /* L: table key */
|
||||
lua_pushnumber(L, (lua_Number) vec3.x); /* L: table key value*/
|
||||
lua_pushnumber(L, (lua_Number) vec4.x); /* L: table key value*/
|
||||
lua_rawset(L, -3); /* table[key] = value, L: table */
|
||||
lua_pushstring(L, "y"); /* L: table key */
|
||||
lua_pushnumber(L, (lua_Number) vec3.y); /* L: table key value*/
|
||||
lua_pushnumber(L, (lua_Number) vec4.y); /* L: table key value*/
|
||||
lua_rawset(L, -3);
|
||||
lua_pushstring(L, "z"); /* L: table key */
|
||||
lua_pushnumber(L, (lua_Number) vec3.z); /* L: table key value*/
|
||||
lua_pushnumber(L, (lua_Number) vec4.z); /* L: table key value*/
|
||||
lua_rawset(L, -3);
|
||||
lua_pushstring(L, "w"); /* L: table key */
|
||||
lua_pushnumber(L, (lua_Number) vec3.z); /* L: table key value*/
|
||||
lua_pushnumber(L, (lua_Number) vec4.w); /* L: table key value*/
|
||||
lua_rawset(L, -3);
|
||||
}
|
||||
|
||||
|
|
|
@ -240,7 +240,7 @@ extern bool luaval_to_std_vector_ushort(lua_State* L, int lo, std::vector<unsign
|
|||
// from native
|
||||
extern void vec2_to_luaval(lua_State* L,const cocos2d::Vec2& vec2);
|
||||
extern void vec3_to_luaval(lua_State* L,const cocos2d::Vec3& vec3);
|
||||
extern void vec4_to_luaval(lua_State* L,const cocos2d::Vec4& vec3);
|
||||
extern void vec4_to_luaval(lua_State* L,const cocos2d::Vec4& vec4);
|
||||
extern void vec2_array_to_luaval(lua_State* L,const cocos2d::Vec2* points, int count);
|
||||
extern void size_to_luaval(lua_State* L,const Size& sz);
|
||||
extern void rect_to_luaval(lua_State* L,const Rect& rt);
|
||||
|
|
|
@ -0,0 +1,87 @@
|
|||
#include "CustomGUIReader.h"
|
||||
#include "CCLuaEngine.h"
|
||||
#include "base/ObjectFactory.h"
|
||||
#include "json/document.h"
|
||||
#include "json/writer.h"
|
||||
#include "json/stringbuffer.h"
|
||||
|
||||
USING_NS_CC;
|
||||
|
||||
namespace cocostudio
|
||||
{
|
||||
|
||||
CustomGUIReader* CustomGUIReader::create(std::string &className, int createFunc, int setPropsFunc)
|
||||
{
|
||||
auto reader = new CustomGUIReader();
|
||||
reader->init(className, createFunc, setPropsFunc);
|
||||
return reader;
|
||||
}
|
||||
|
||||
Ref* CustomGUIReader::createInstance()
|
||||
{
|
||||
Ref* result = nullptr;
|
||||
LuaStack* stack = LuaEngine::getInstance()->getLuaStack();
|
||||
stack->executeFunction(_createFunc, 0, 1, [&result](lua_State* L,int numReturn){
|
||||
result = static_cast<Ref*>(tolua_tousertype(L, -1, nullptr));
|
||||
lua_pop(L, 1);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
CustomGUIReader::CustomGUIReader()
|
||||
:_className()
|
||||
,_createFunc(0)
|
||||
,_setPropsFunc(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CustomGUIReader::~CustomGUIReader()
|
||||
{
|
||||
if (_createFunc)
|
||||
{
|
||||
LuaEngine::getInstance()->removeScriptHandler(_createFunc);
|
||||
_createFunc = 0;
|
||||
}
|
||||
if (_setPropsFunc)
|
||||
{
|
||||
LuaEngine::getInstance()->removeScriptHandler(_setPropsFunc);
|
||||
_setPropsFunc = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void CustomGUIReader::init(std::string &className, int createFunc, int setPropsFunc)
|
||||
{
|
||||
_className = className;
|
||||
_createFunc = createFunc;
|
||||
_setPropsFunc = setPropsFunc;
|
||||
|
||||
ObjectFactory* factoryCreate = ObjectFactory::getInstance();
|
||||
ObjectFactory::TInfo t;
|
||||
t._class = className;
|
||||
t._func = CC_CALLBACK_0(CustomGUIReader::createInstance, this);
|
||||
factoryCreate->registerType(t);
|
||||
|
||||
auto guiReader = GUIReader::getInstance();
|
||||
auto objMap = guiReader->getParseObjectMap();
|
||||
(*objMap)[className] = this;
|
||||
auto callbackMap = guiReader->getParseCallBackMap();
|
||||
(*callbackMap)[className] = parseselector(CustomGUIReader::setCustomProps);
|
||||
}
|
||||
|
||||
void CustomGUIReader::setCustomProps(const std::string &classType, cocos2d::Ref *widget, const rapidjson::Value &customOptions)
|
||||
{
|
||||
if (_setPropsFunc != 0)
|
||||
{
|
||||
rapidjson::StringBuffer buffer;
|
||||
rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
|
||||
customOptions.Accept(writer);
|
||||
|
||||
auto stack = LuaEngine::getInstance()->getLuaStack();
|
||||
stack->pushString(classType.c_str(), classType.size());
|
||||
stack->pushObject(widget, "cc.Ref");
|
||||
stack->pushString(buffer.GetString(), buffer.Size());
|
||||
stack->executeFunctionByHandler(_setPropsFunc, 3);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
#ifndef COCOS_SCRIPTING_LUA_BINDINGS_LUA_COCOS2DX_CUSTOM_GUI_READER_H
|
||||
#define COCOS_SCRIPTING_LUA_BINDINGS_LUA_COCOS2DX_CUSTOM_GUI_READER_H
|
||||
|
||||
#include "cocostudio/WidgetReader/WidgetReader.h"
|
||||
|
||||
USING_NS_CC;
|
||||
|
||||
namespace cocostudio
|
||||
{
|
||||
class CustomGUIReader : public Ref
|
||||
{
|
||||
public:
|
||||
|
||||
CustomGUIReader();
|
||||
virtual ~CustomGUIReader();
|
||||
|
||||
static CustomGUIReader* create(std::string &className, int createFunc, int setPropsFunc);
|
||||
|
||||
void init(std::string &className, int createFunc, int setPropsFunc);
|
||||
|
||||
Ref* createInstance();
|
||||
|
||||
void setCustomProps(const std::string &classType, cocos2d::Ref *widget, const rapidjson::Value &customOptions);
|
||||
|
||||
private:
|
||||
std::string _className;
|
||||
int _createFunc;
|
||||
int _setPropsFunc;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -30,6 +30,7 @@
|
|||
#include "CCLuaValue.h"
|
||||
#include "CocoStudio.h"
|
||||
#include "CCLuaEngine.h"
|
||||
#include "CustomGUIReader.h"
|
||||
|
||||
using namespace cocostudio;
|
||||
|
||||
|
@ -554,6 +555,53 @@ static void extendActionTimeline(lua_State* L)
|
|||
lua_pop(L, 1);
|
||||
}
|
||||
|
||||
int lua_cocos2dx_CustomGUIReader_create(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
bool ok = true;
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertable(tolua_S,1,"ccs.CustomGUIReader",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
|
||||
do
|
||||
{
|
||||
if (argc == 3)
|
||||
{
|
||||
std::string arg0;
|
||||
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccs.CustomGUIReader:create");
|
||||
if (!ok) { break; }
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!toluafix_isfunction(tolua_S,3,"LUA_FUNCTION",0,&tolua_err)) {
|
||||
goto tolua_lerror;
|
||||
}
|
||||
#endif
|
||||
LUA_FUNCTION arg1 = toluafix_ref_function(tolua_S,3,0);
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!toluafix_isfunction(tolua_S,4,"LUA_FUNCTION",0,&tolua_err)) {
|
||||
goto tolua_lerror;
|
||||
}
|
||||
#endif
|
||||
LUA_FUNCTION arg2 = toluafix_ref_function(tolua_S,4,0);
|
||||
|
||||
cocostudio::CustomGUIReader* ret = cocostudio::CustomGUIReader::create(arg0, arg1, arg2);
|
||||
object_to_luaval<cocostudio::CustomGUIReader>(tolua_S, "ccs.CustomGUIReader",(cocostudio::CustomGUIReader*)ret);
|
||||
return 1;
|
||||
}
|
||||
} while (0);
|
||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d", "ccs.CustomGUIReader:create",argc, 1);
|
||||
return 0;
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_CustomGUIReader_create'.",&tolua_err);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
int register_all_cocos2dx_coco_studio_manual(lua_State* L)
|
||||
{
|
||||
|
@ -569,6 +617,26 @@ int register_all_cocos2dx_coco_studio_manual(lua_State* L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int lua_register_cocos2dx_coco_studio_CustomGUIReader(lua_State* tolua_S)
|
||||
{
|
||||
tolua_module(tolua_S,"ccs",0);
|
||||
tolua_beginmodule(tolua_S,"ccs");
|
||||
|
||||
|
||||
tolua_usertype(tolua_S,"ccs.CustomGUIReader");
|
||||
tolua_cclass(tolua_S,"CustomGUIReader","ccs.CustomGUIReader","cc.Ref",nullptr);
|
||||
|
||||
tolua_beginmodule(tolua_S,"CustomGUIReader");
|
||||
tolua_function(tolua_S,"create",lua_cocos2dx_CustomGUIReader_create);
|
||||
tolua_endmodule(tolua_S);
|
||||
std::string typeName = typeid(cocostudio::CustomGUIReader).name();
|
||||
g_luaType[typeName] = "ccs.CustomGUIReader";
|
||||
g_typeCast["CustomGUIReader"] = "ccs.CustomGUIReader";
|
||||
|
||||
tolua_endmodule(tolua_S);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int register_cocostudio_module(lua_State* L)
|
||||
{
|
||||
lua_getglobal(L, "_G");
|
||||
|
@ -576,6 +644,7 @@ int register_cocostudio_module(lua_State* L)
|
|||
{
|
||||
register_all_cocos2dx_studio(L);
|
||||
register_all_cocos2dx_coco_studio_manual(L);
|
||||
lua_register_cocos2dx_coco_studio_CustomGUIReader(L);
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
|
||||
|
|
|
@ -1045,7 +1045,7 @@ static void extendTableView(lua_State* L)
|
|||
int register_all_cocos2dx_extension_manual(lua_State* tolua_S)
|
||||
{
|
||||
extendControl(tolua_S);
|
||||
extendEditBox(tolua_S);
|
||||
/* extendEditBox(tolua_S); */
|
||||
extendAssetsManager(tolua_S);
|
||||
extendScrollView(tolua_S);
|
||||
extendTableView(tolua_S);
|
||||
|
|
|
@ -66,6 +66,7 @@ LOCAL_SRC_FILES += ../manual/cocosbuilder/lua_cocos2dx_cocosbuilder_manual.cpp \
|
|||
|
||||
#cocostudio
|
||||
LOCAL_SRC_FILES += ../manual/cocostudio/lua_cocos2dx_coco_studio_manual.cpp \
|
||||
../manual/cocostudio/CustomGUIReader.cpp \
|
||||
../auto/lua_cocos2dx_studio_auto.cpp
|
||||
|
||||
#spine
|
||||
|
|
|
@ -236,6 +236,10 @@
|
|||
15EFA64E198B3342000C57D3 /* lua.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA1E718CD8F470087CE3A /* lua.h */; };
|
||||
15EFA64F198B3342000C57D3 /* luaconf.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA1E818CD8F470087CE3A /* luaconf.h */; };
|
||||
15EFA650198B3342000C57D3 /* lualib.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA1E918CD8F470087CE3A /* lualib.h */; };
|
||||
566F015F19B5EB0F00FCA620 /* CustomGUIReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 566F015D19B5EB0F00FCA620 /* CustomGUIReader.cpp */; };
|
||||
566F016019B5EB0F00FCA620 /* CustomGUIReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 566F015D19B5EB0F00FCA620 /* CustomGUIReader.cpp */; };
|
||||
566F016119B5EB0F00FCA620 /* CustomGUIReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 566F015E19B5EB0F00FCA620 /* CustomGUIReader.h */; };
|
||||
566F016219B5EB0F00FCA620 /* CustomGUIReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 566F015E19B5EB0F00FCA620 /* CustomGUIReader.h */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
|
@ -364,6 +368,8 @@
|
|||
1ABCA1FF18CD8F6E0087CE3A /* tolua++.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "tolua++.h"; path = "../../../../external/lua/tolua/tolua++.h"; sourceTree = "<group>"; };
|
||||
2905FACE18CF12E600240AA3 /* lua_cocos2dx_ui_auto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lua_cocos2dx_ui_auto.cpp; sourceTree = "<group>"; };
|
||||
2905FACF18CF12E600240AA3 /* lua_cocos2dx_ui_auto.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = lua_cocos2dx_ui_auto.hpp; sourceTree = "<group>"; };
|
||||
566F015D19B5EB0F00FCA620 /* CustomGUIReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CustomGUIReader.cpp; sourceTree = "<group>"; };
|
||||
566F015E19B5EB0F00FCA620 /* CustomGUIReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustomGUIReader.h; sourceTree = "<group>"; };
|
||||
C0D9BAFA1974D30000EC35BB /* liblua.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = liblua.a; path = ../../../../external/lua/lua/prebuilt/ios/liblua.a; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
|
@ -507,6 +513,8 @@
|
|||
15EFA400198B2AB2000C57D3 /* cocostudio */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
566F015D19B5EB0F00FCA620 /* CustomGUIReader.cpp */,
|
||||
566F015E19B5EB0F00FCA620 /* CustomGUIReader.h */,
|
||||
15EFA401198B2AB2000C57D3 /* lua_cocos2dx_coco_studio_manual.cpp */,
|
||||
15EFA402198B2AB2000C57D3 /* lua_cocos2dx_coco_studio_manual.hpp */,
|
||||
);
|
||||
|
@ -738,6 +746,7 @@
|
|||
15C1C2EE19874CBE00A46ACC /* tolua_fix.h in Headers */,
|
||||
155C7E2019A71CCC00F08B25 /* LuaSkeletonAnimation.h in Headers */,
|
||||
15415AB719A71A53004F1E71 /* io.h in Headers */,
|
||||
566F016119B5EB0F00FCA620 /* CustomGUIReader.h in Headers */,
|
||||
15C1C2DC19874B4400A46ACC /* xxtea.h in Headers */,
|
||||
15415AD319A71A53004F1E71 /* timeout.h in Headers */,
|
||||
15C1C2D5198749BC00A46ACC /* LuaOpengl.h in Headers */,
|
||||
|
@ -798,6 +807,7 @@
|
|||
15EFA642198B32BB000C57D3 /* tolua_fix.h in Headers */,
|
||||
155C7E2119A71CCE00F08B25 /* LuaSkeletonAnimation.h in Headers */,
|
||||
15415AB819A71A53004F1E71 /* io.h in Headers */,
|
||||
566F016219B5EB0F00FCA620 /* CustomGUIReader.h in Headers */,
|
||||
15EFA62B198B3220000C57D3 /* LuaOpengl.h in Headers */,
|
||||
15415AD419A71A53004F1E71 /* timeout.h in Headers */,
|
||||
15EFA62C198B3220000C57D3 /* lua_cocos2dx_deprecated.h in Headers */,
|
||||
|
@ -928,6 +938,7 @@
|
|||
155C7E1E19A71CC700F08B25 /* LuaSkeletonAnimation.cpp in Sources */,
|
||||
15415AB519A71A53004F1E71 /* io.c in Sources */,
|
||||
15C1C2CE1987498B00A46ACC /* LuaOpengl.cpp in Sources */,
|
||||
566F015F19B5EB0F00FCA620 /* CustomGUIReader.cpp in Sources */,
|
||||
15415AC119A71A53004F1E71 /* options.c in Sources */,
|
||||
155C7E0A19A71C8B00F08B25 /* lua_cocos2dx_network_manual.cpp in Sources */,
|
||||
15415AD119A71A53004F1E71 /* timeout.c in Sources */,
|
||||
|
@ -995,6 +1006,7 @@
|
|||
155C7E1F19A71CC800F08B25 /* LuaSkeletonAnimation.cpp in Sources */,
|
||||
15415ACA19A71A53004F1E71 /* serial.c in Sources */,
|
||||
155C7DEA19A71BDA00F08B25 /* lua_cocos2dx_3d_auto.cpp in Sources */,
|
||||
566F016019B5EB0F00FCA620 /* CustomGUIReader.cpp in Sources */,
|
||||
155C7DF119A71C2300F08B25 /* lua_cocos2dx_studio_auto.cpp in Sources */,
|
||||
155C7E0B19A71C8D00F08B25 /* lua_cocos2dx_network_manual.cpp in Sources */,
|
||||
15415AAE19A71A53004F1E71 /* except.c in Sources */,
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
<ClCompile Include="..\manual\cocosbuilder\CCBProxy.cpp" />
|
||||
<ClCompile Include="..\manual\cocosbuilder\lua_cocos2dx_cocosbuilder_manual.cpp" />
|
||||
<ClCompile Include="..\manual\cocosdenshion\lua_cocos2dx_cocosdenshion_manual.cpp" />
|
||||
<ClCompile Include="..\manual\cocostudio\CustomGUIReader.cpp" />
|
||||
<ClCompile Include="..\manual\cocostudio\lua_cocos2dx_coco_studio_manual.cpp" />
|
||||
<ClCompile Include="..\manual\extension\lua_cocos2dx_extension_manual.cpp" />
|
||||
<ClCompile Include="..\manual\LuaBasicConversions.cpp" />
|
||||
|
@ -117,6 +118,7 @@
|
|||
<ClInclude Include="..\manual\cocosbuilder\CCBProxy.h" />
|
||||
<ClInclude Include="..\manual\cocosbuilder\lua_cocos2dx_cocosbuilder_manual.h" />
|
||||
<ClInclude Include="..\manual\cocosdenshion\lua_cocos2dx_cocosdenshion_manual.h" />
|
||||
<ClInclude Include="..\manual\cocostudio\CustomGUIReader.h" />
|
||||
<ClInclude Include="..\manual\cocostudio\lua_cocos2dx_coco_studio_manual.hpp" />
|
||||
<ClInclude Include="..\manual\extension\lua_cocos2dx_extension_manual.h" />
|
||||
<ClInclude Include="..\manual\LuaBasicConversions.h" />
|
||||
|
|
|
@ -243,6 +243,9 @@
|
|||
<ClCompile Include="..\..\..\..\external\lua\luasocket\wsocket.c">
|
||||
<Filter>luasocket</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\manual\cocostudio\CustomGUIReader.cpp">
|
||||
<Filter>manual\cocostudio</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\auto\lua_cocos2dx_auto.hpp">
|
||||
|
@ -422,6 +425,9 @@
|
|||
<ClInclude Include="..\..\..\..\external\lua\luasocket\wsocket.h">
|
||||
<Filter>luasocket</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\manual\cocostudio\CustomGUIReader.h">
|
||||
<Filter>manual\cocostudio</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\script\CCBReaderLoad.lua">
|
||||
|
|
|
@ -33,6 +33,9 @@ UIDeprecated.cpp \
|
|||
UIScale9Sprite.cpp \
|
||||
UIWebView.cpp \
|
||||
UIWebViewImpl_android.cpp \
|
||||
UIEditBox/UIEditBox.cpp \
|
||||
UIEditBox/UIEditBoxImplAndroid.cpp \
|
||||
|
||||
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/.. \
|
||||
$(LOCAL_PATH)/../editor-support
|
||||
|
|
|
@ -52,7 +52,7 @@ THE SOFTWARE.
|
|||
#include "ui/UIDeprecated.h"
|
||||
#include "ui/GUIExport.h"
|
||||
#include "ui/UIScale9Sprite.h"
|
||||
|
||||
#include "ui/UIEditBox/UIEditBox.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
namespace ui {
|
||||
|
|
|
@ -23,10 +23,12 @@
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "CCEditBox.h"
|
||||
#include "CCEditBoxImpl.h"
|
||||
#include "UIEditBox.h"
|
||||
#include "UIEditBoxImpl.h"
|
||||
|
||||
NS_CC_EXT_BEGIN
|
||||
NS_CC_BEGIN
|
||||
|
||||
namespace ui {
|
||||
|
||||
static const float CHECK_EDITBOX_POSITION_INTERVAL = 0.1f;
|
||||
|
||||
|
@ -42,6 +44,7 @@ EditBox::EditBox(void)
|
|||
, _colPlaceHolder(Color3B::GRAY)
|
||||
, _maxLength(0)
|
||||
, _adjustHeight(0.0f)
|
||||
, _backgroundSprite(nullptr)
|
||||
#if CC_ENABLE_SCRIPT_BINDING
|
||||
, _scriptEditBoxHandler(0)
|
||||
#endif
|
||||
|
@ -57,26 +60,21 @@ EditBox::~EditBox(void)
|
|||
}
|
||||
|
||||
|
||||
void EditBox::touchDownAction(Ref *sender, Control::EventType controlEvent)
|
||||
void EditBox::touchDownAction(Ref *sender, TouchEventType controlEvent)
|
||||
{
|
||||
_editBoxImpl->openKeyboard();
|
||||
if (controlEvent == Widget::TouchEventType::ENDED) {
|
||||
_editBoxImpl->openKeyboard();
|
||||
}
|
||||
}
|
||||
|
||||
EditBox* EditBox::create(const Size& size, Scale9Sprite* pNormal9SpriteBg, Scale9Sprite* pPressed9SpriteBg/* = nullptr*/, Scale9Sprite* pDisabled9SpriteBg/* = nullptr*/)
|
||||
EditBox* EditBox::create(const Size& size,
|
||||
const std::string& normalSprite,
|
||||
TextureResType texType /*= TextureResType::LOCAL*/)
|
||||
{
|
||||
EditBox* pRet = new (std::nothrow) EditBox();
|
||||
EditBox* pRet = new EditBox();
|
||||
|
||||
if (pRet != nullptr && pRet->initWithSizeAndBackgroundSprite(size, pNormal9SpriteBg))
|
||||
if (pRet != nullptr && pRet->initWithSizeAndBackgroundSprite(size, normalSprite, texType))
|
||||
{
|
||||
if (pPressed9SpriteBg != nullptr)
|
||||
{
|
||||
pRet->setBackgroundSpriteForState(pPressed9SpriteBg, Control::State::HIGH_LIGHTED);
|
||||
}
|
||||
|
||||
if (pDisabled9SpriteBg != nullptr)
|
||||
{
|
||||
pRet->setBackgroundSpriteForState(pDisabled9SpriteBg, Control::State::DISABLED);
|
||||
}
|
||||
pRet->autorelease();
|
||||
}
|
||||
else
|
||||
|
@ -86,19 +84,79 @@ EditBox* EditBox::create(const Size& size, Scale9Sprite* pNormal9SpriteBg, Scale
|
|||
|
||||
return pRet;
|
||||
}
|
||||
|
||||
bool EditBox::initWithSizeAndBackgroundSprite(const Size& size, Scale9Sprite* pPressed9SpriteBg)
|
||||
|
||||
|
||||
EditBox* EditBox::create(const cocos2d::Size &size, cocos2d::ui::Scale9Sprite *normalSprite, ui::Scale9Sprite *pressedSprite, Scale9Sprite* disabledSprite)
|
||||
{
|
||||
if (ControlButton::initWithBackgroundSprite(pPressed9SpriteBg))
|
||||
EditBox* pRet = new (std::nothrow) EditBox();
|
||||
|
||||
if (pRet != nullptr && pRet->initWithSizeAndBackgroundSprite(size, normalSprite))
|
||||
{
|
||||
pRet->autorelease();
|
||||
}
|
||||
else
|
||||
{
|
||||
CC_SAFE_DELETE(pRet);
|
||||
}
|
||||
|
||||
return pRet;
|
||||
}
|
||||
|
||||
bool EditBox::initWithSizeAndBackgroundSprite(const cocos2d::Size &size, cocos2d::ui::Scale9Sprite *pNormal9SpriteBg)
|
||||
{
|
||||
if (Widget::init())
|
||||
{
|
||||
_editBoxImpl = __createSystemEditBox(this);
|
||||
_editBoxImpl->initWithSize(size);
|
||||
_editBoxImpl->setInputMode(EditBox::InputMode::ANY);
|
||||
|
||||
this->setZoomOnTouchDown(false);
|
||||
this->setPreferredSize(size);
|
||||
_backgroundSprite = pNormal9SpriteBg;
|
||||
|
||||
this->setContentSize(size);
|
||||
this->setPosition(Vec2(0, 0));
|
||||
this->addTargetWithActionForControlEvent(this, cccontrol_selector(EditBox::touchDownAction), Control::EventType::TOUCH_UP_INSIDE);
|
||||
|
||||
_backgroundSprite->setPosition(Vec2(_contentSize.width/2, _contentSize.height/2));
|
||||
_backgroundSprite->setContentSize(size);
|
||||
this->addProtectedChild(_backgroundSprite);
|
||||
|
||||
this->setTouchEnabled(true);
|
||||
|
||||
this->addTouchEventListener(CC_CALLBACK_2(EditBox::touchDownAction, this));
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool EditBox::initWithSizeAndBackgroundSprite(const Size& size,
|
||||
const std::string& pNormal9SpriteBg,
|
||||
TextureResType texType)
|
||||
{
|
||||
if (Widget::init())
|
||||
{
|
||||
_editBoxImpl = __createSystemEditBox(this);
|
||||
_editBoxImpl->initWithSize(size);
|
||||
_editBoxImpl->setInputMode(EditBox::InputMode::ANY);
|
||||
|
||||
if (texType == Widget::TextureResType::LOCAL)
|
||||
{
|
||||
_backgroundSprite = Scale9Sprite::create(pNormal9SpriteBg);
|
||||
}
|
||||
else
|
||||
{
|
||||
_backgroundSprite = Scale9Sprite::createWithSpriteFrameName(pNormal9SpriteBg);
|
||||
}
|
||||
this->setContentSize(size);
|
||||
this->setPosition(Vec2(0, 0));
|
||||
|
||||
_backgroundSprite->setPosition(Vec2(_contentSize.width/2, _contentSize.height/2));
|
||||
_backgroundSprite->setContentSize(size);
|
||||
this->addProtectedChild(_backgroundSprite);
|
||||
|
||||
this->setTouchEnabled(true);
|
||||
|
||||
this->addTouchEventListener(CC_CALLBACK_2(EditBox::touchDownAction, this));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -210,7 +268,7 @@ void EditBox::setPlaceholderFontSize(int fontSize)
|
|||
_placeholderFontSize = fontSize;
|
||||
if (_editBoxImpl != nullptr && _placeholderFontName.length() > 0)
|
||||
{
|
||||
_editBoxImpl->setPlaceholderFont(_placeholderFontName.c_str(), _fontSize);
|
||||
_editBoxImpl->setPlaceholderFont(_placeholderFontName.c_str(), fontSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -284,7 +342,7 @@ void EditBox::setReturnType(EditBox::KeyboardReturnType returnType)
|
|||
/* override function */
|
||||
void EditBox::setPosition(const Vec2& pos)
|
||||
{
|
||||
ControlButton::setPosition(pos);
|
||||
Widget::setPosition(pos);
|
||||
if (_editBoxImpl != nullptr)
|
||||
{
|
||||
_editBoxImpl->setPosition(pos);
|
||||
|
@ -293,7 +351,7 @@ void EditBox::setPosition(const Vec2& pos)
|
|||
|
||||
void EditBox::setVisible(bool visible)
|
||||
{
|
||||
ControlButton::setVisible(visible);
|
||||
Widget::setVisible(visible);
|
||||
if (_editBoxImpl != nullptr)
|
||||
{
|
||||
_editBoxImpl->setVisible(visible);
|
||||
|
@ -302,16 +360,25 @@ void EditBox::setVisible(bool visible)
|
|||
|
||||
void EditBox::setContentSize(const Size& size)
|
||||
{
|
||||
ControlButton::setContentSize(size);
|
||||
Widget::setContentSize(size);
|
||||
if (_editBoxImpl != nullptr)
|
||||
{
|
||||
_editBoxImpl->setContentSize(size);
|
||||
}
|
||||
}
|
||||
|
||||
void EditBox::adaptRenderers()
|
||||
{
|
||||
if (_contentSizeDirty)
|
||||
{
|
||||
_backgroundSprite->setContentSize(_contentSize);
|
||||
_backgroundSprite->setPosition(Vec2(_contentSize.width/2, _contentSize.height/2));
|
||||
}
|
||||
}
|
||||
|
||||
void EditBox::setAnchorPoint(const Vec2& anchorPoint)
|
||||
{
|
||||
ControlButton::setAnchorPoint(anchorPoint);
|
||||
Widget::setAnchorPoint(anchorPoint);
|
||||
if (_editBoxImpl != nullptr)
|
||||
{
|
||||
_editBoxImpl->setAnchorPoint(anchorPoint);
|
||||
|
@ -320,7 +387,7 @@ void EditBox::setAnchorPoint(const Vec2& anchorPoint)
|
|||
|
||||
void EditBox::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags)
|
||||
{
|
||||
ControlButton::visit(renderer, parentTransform, parentFlags);
|
||||
Widget::visit(renderer, parentTransform, parentFlags);
|
||||
if (_editBoxImpl != nullptr)
|
||||
{
|
||||
_editBoxImpl->visit();
|
||||
|
@ -337,7 +404,7 @@ void EditBox::onEnter(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
ControlButton::onEnter();
|
||||
Widget::onEnter();
|
||||
if (_editBoxImpl != nullptr)
|
||||
{
|
||||
_editBoxImpl->onEnter();
|
||||
|
@ -357,7 +424,7 @@ void EditBox::updatePosition(float dt)
|
|||
|
||||
void EditBox::onExit(void)
|
||||
{
|
||||
ControlButton::onExit();
|
||||
Widget::onExit();
|
||||
if (_editBoxImpl != nullptr)
|
||||
{
|
||||
// remove system edit control
|
||||
|
@ -432,4 +499,6 @@ void EditBox::unregisterScriptEditBoxHandler(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
NS_CC_EXT_END
|
||||
}
|
||||
|
||||
NS_CC_END
|
|
@ -0,0 +1,474 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2012 James Chen
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __UIEDITTEXT_H__
|
||||
#define __UIEDITTEXT_H__
|
||||
|
||||
#include "base/CCIMEDelegate.h"
|
||||
#include "ui/GUIDefine.h"
|
||||
#include "ui/UIButton.h"
|
||||
#include "ui/UIScale9Sprite.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
namespace ui {
|
||||
|
||||
class EditBox;
|
||||
class EditBoxImpl;
|
||||
|
||||
|
||||
class CC_GUI_DLL EditBoxDelegate
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~EditBoxDelegate() {};
|
||||
|
||||
/**
|
||||
* This method is called when an edit box gains focus after keyboard is shown.
|
||||
* @param editBox The edit box object that generated the event.
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void editBoxEditingDidBegin(EditBox* editBox) {};
|
||||
|
||||
|
||||
/**
|
||||
* This method is called when an edit box loses focus after keyboard is hidden.
|
||||
* @param editBox The edit box object that generated the event.
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void editBoxEditingDidEnd(EditBox* editBox) {};
|
||||
|
||||
/**
|
||||
* This method is called when the edit box text was changed.
|
||||
* @param editBox The edit box object that generated the event.
|
||||
* @param text The new text.
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void editBoxTextChanged(EditBox* editBox, const std::string& text) {};
|
||||
|
||||
/**
|
||||
* This method is called when the return button was pressed or the outside area of keyboard was touched.
|
||||
* @param editBox The edit box object that generated the event.
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void editBoxReturn(EditBox* editBox) = 0;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Class for edit box.
|
||||
*
|
||||
* You can use this widget to gather small amounts of text from the user.
|
||||
*
|
||||
*/
|
||||
|
||||
class CC_GUI_DLL EditBox
|
||||
: public Widget
|
||||
, public IMEDelegate
|
||||
{
|
||||
public:
|
||||
enum class KeyboardReturnType
|
||||
{
|
||||
DEFAULT,
|
||||
DONE,
|
||||
SEND,
|
||||
SEARCH,
|
||||
GO
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief The EditBox::InputMode defines the type of text that the user is allowed
|
||||
* to enter.
|
||||
*/
|
||||
enum class InputMode
|
||||
{
|
||||
/**
|
||||
* The user is allowed to enter any text, including line breaks.
|
||||
*/
|
||||
ANY,
|
||||
|
||||
/**
|
||||
* The user is allowed to enter an e-mail address.
|
||||
*/
|
||||
EMAIL_ADDRESS,
|
||||
|
||||
/**
|
||||
* The user is allowed to enter an integer value.
|
||||
*/
|
||||
NUMERIC,
|
||||
|
||||
/**
|
||||
* The user is allowed to enter a phone number.
|
||||
*/
|
||||
PHONE_NUMBER,
|
||||
|
||||
/**
|
||||
* The user is allowed to enter a URL.
|
||||
*/
|
||||
URL,
|
||||
|
||||
/**
|
||||
* The user is allowed to enter a real number value.
|
||||
* This extends kEditBoxInputModeNumeric by allowing a decimal point.
|
||||
*/
|
||||
DECIMAL,
|
||||
|
||||
/**
|
||||
* The user is allowed to enter any text, except for line breaks.
|
||||
*/
|
||||
SINGLE_LINE,
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief The EditBox::InputFlag defines how the input text is displayed/formatted.
|
||||
*/
|
||||
enum class InputFlag
|
||||
{
|
||||
/**
|
||||
* Indicates that the text entered is confidential data that should be
|
||||
* obscured whenever possible. This implies EDIT_BOX_INPUT_FLAG_SENSITIVE.
|
||||
*/
|
||||
PASSWORD,
|
||||
|
||||
/**
|
||||
* Indicates that the text entered is sensitive data that the
|
||||
* implementation must never store into a dictionary or table for use
|
||||
* in predictive, auto-completing, or other accelerated input schemes.
|
||||
* A credit card number is an example of sensitive data.
|
||||
*/
|
||||
SENSITIVE,
|
||||
|
||||
/**
|
||||
* This flag is a hint to the implementation that during text editing,
|
||||
* the initial letter of each word should be capitalized.
|
||||
*/
|
||||
INITIAL_CAPS_WORD,
|
||||
|
||||
/**
|
||||
* This flag is a hint to the implementation that during text editing,
|
||||
* the initial letter of each sentence should be capitalized.
|
||||
*/
|
||||
INITIAL_CAPS_SENTENCE,
|
||||
|
||||
/**
|
||||
* Capitalize all characters automatically.
|
||||
*/
|
||||
INTIAL_CAPS_ALL_CHARACTERS,
|
||||
};
|
||||
|
||||
/**
|
||||
* create a edit box with size.
|
||||
* @return An autorelease pointer of EditBox, you don't need to release it only if you retain it again.
|
||||
*/
|
||||
static EditBox* create(const Size& size,
|
||||
Scale9Sprite* normalSprite,
|
||||
Scale9Sprite* pressedSprite = nullptr,
|
||||
Scale9Sprite* disabledSprite = nullptr);
|
||||
|
||||
|
||||
/**
|
||||
* create a edit box with size.
|
||||
* @return An autorelease pointer of EditBox, you don't need to release it only if you retain it again.
|
||||
*/
|
||||
static EditBox* create(const Size& size,
|
||||
const std::string& pNormal9SpriteBg,
|
||||
TextureResType texType = TextureResType::LOCAL);
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @js ctor
|
||||
*/
|
||||
EditBox(void);
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~EditBox(void);
|
||||
|
||||
/**
|
||||
* Init edit box with specified size. This method should be invoked right after constructor.
|
||||
* @param size The size of edit box.
|
||||
*/
|
||||
bool initWithSizeAndBackgroundSprite(const Size& size,
|
||||
const std::string& pNormal9SpriteBg,
|
||||
TextureResType texType = TextureResType::LOCAL);
|
||||
|
||||
bool initWithSizeAndBackgroundSprite(const Size& size, Scale9Sprite* pNormal9SpriteBg);
|
||||
|
||||
/**
|
||||
* Gets/Sets the delegate for edit box.
|
||||
* @lua NA
|
||||
*/
|
||||
void setDelegate(EditBoxDelegate* pDelegate);
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
EditBoxDelegate* getDelegate();
|
||||
|
||||
#if CC_ENABLE_SCRIPT_BINDING
|
||||
/**
|
||||
* Registers a script function that will be called for EditBox events.
|
||||
*
|
||||
* This handler will be removed automatically after onExit() called.
|
||||
* @code
|
||||
* -- lua sample
|
||||
* local function editboxEventHandler(eventType)
|
||||
* if eventType == "began" then
|
||||
* -- triggered when an edit box gains focus after keyboard is shown
|
||||
* elseif eventType == "ended" then
|
||||
* -- triggered when an edit box loses focus after keyboard is hidden.
|
||||
* elseif eventType == "changed" then
|
||||
* -- triggered when the edit box text was changed.
|
||||
* elseif eventType == "return" then
|
||||
* -- triggered when the return button was pressed or the outside area of keyboard was touched.
|
||||
* end
|
||||
* end
|
||||
*
|
||||
* local editbox = EditBox:create(Size(...), Scale9Sprite:create(...))
|
||||
* editbox = registerScriptEditBoxHandler(editboxEventHandler)
|
||||
* @endcode
|
||||
*
|
||||
* @param handler A number that indicates a lua function.
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
void registerScriptEditBoxHandler(int handler);
|
||||
|
||||
/**
|
||||
* Unregisters a script function that will be called for EditBox events.
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
void unregisterScriptEditBoxHandler(void);
|
||||
/**
|
||||
* get a script Handler
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
int getScriptEditBoxHandler(void){ return _scriptEditBoxHandler ;}
|
||||
|
||||
#endif // #if CC_ENABLE_SCRIPT_BINDING
|
||||
|
||||
/**
|
||||
* Set the text entered in the edit box.
|
||||
* @param pText The given text.
|
||||
*/
|
||||
void setText(const char* pText);
|
||||
|
||||
/**
|
||||
* Get the text entered in the edit box.
|
||||
* @return The text entered in the edit box.
|
||||
*/
|
||||
const char* getText(void);
|
||||
|
||||
/**
|
||||
* Set the font.
|
||||
* @param pFontName The font name.
|
||||
* @param fontSize The font size.
|
||||
*/
|
||||
void setFont(const char* pFontName, int fontSize);
|
||||
|
||||
/**
|
||||
* Set the font name.
|
||||
* @param pFontName The font name.
|
||||
*/
|
||||
void setFontName(const char* pFontName);
|
||||
|
||||
/**
|
||||
* Set the font size.
|
||||
* @param fontSize The font size.
|
||||
*/
|
||||
void setFontSize(int fontSize);
|
||||
|
||||
/**
|
||||
* Set the font color of the widget's text.
|
||||
*/
|
||||
void setFontColor(const Color3B& color);
|
||||
|
||||
/**
|
||||
* Set the placeholder's font.
|
||||
* @param pFontName The font name.
|
||||
* @param fontSize The font size.
|
||||
*/
|
||||
void setPlaceholderFont(const char* pFontName, int fontSize);
|
||||
|
||||
/**
|
||||
* Set the placeholder's font name.
|
||||
* @param pFontName The font name.
|
||||
*/
|
||||
void setPlaceholderFontName(const char* pFontName);
|
||||
|
||||
/**
|
||||
* Set the placeholder's font size.
|
||||
* @param fontSize The font size.
|
||||
*/
|
||||
void setPlaceholderFontSize(int fontSize);
|
||||
|
||||
/**
|
||||
* Set the font color of the placeholder text when the edit box is empty.
|
||||
* Not supported on IOS.
|
||||
*/
|
||||
void setPlaceholderFontColor(const Color3B& color);
|
||||
|
||||
/**
|
||||
* Set a text in the edit box that acts as a placeholder when an
|
||||
* edit box is empty.
|
||||
* @param pText The given text.
|
||||
*/
|
||||
void setPlaceHolder(const char* pText);
|
||||
|
||||
/**
|
||||
* Get a text in the edit box that acts as a placeholder when an
|
||||
* edit box is empty.
|
||||
*/
|
||||
const char* getPlaceHolder(void);
|
||||
|
||||
/**
|
||||
* Set the input mode of the edit box.
|
||||
* @param inputMode One of the EditBox::InputMode constants.
|
||||
*/
|
||||
void setInputMode(InputMode inputMode);
|
||||
|
||||
/**
|
||||
* Sets the maximum input length of the edit box.
|
||||
* Setting this value enables multiline input mode by default.
|
||||
* Available on Android, iOS and Windows Phone.
|
||||
*
|
||||
* @param maxLength The maximum length.
|
||||
*/
|
||||
void setMaxLength(int maxLength);
|
||||
|
||||
/**
|
||||
* Gets the maximum input length of the edit box.
|
||||
*
|
||||
* @return Maximum input length.
|
||||
*/
|
||||
int getMaxLength();
|
||||
|
||||
/**
|
||||
* Set the input flags that are to be applied to the edit box.
|
||||
* @param inputFlag One of the EditBox::InputFlag constants.
|
||||
*/
|
||||
void setInputFlag(InputFlag inputFlag);
|
||||
|
||||
/**
|
||||
* Set the return type that are to be applied to the edit box.
|
||||
* @param returnType One of the EditBox::KeyboardReturnType constants.
|
||||
*/
|
||||
void setReturnType(EditBox::KeyboardReturnType returnType);
|
||||
|
||||
/* override functions */
|
||||
virtual void setPosition(const Vec2& pos) override;
|
||||
virtual void setVisible(bool visible) override;
|
||||
virtual void setContentSize(const Size& size) override;
|
||||
virtual void setAnchorPoint(const Vec2& anchorPoint) override;
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags) override;
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void onEnter(void) override;
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void onExit(void) override;
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void keyboardWillShow(IMEKeyboardNotificationInfo& info) override;
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void keyboardDidShow(IMEKeyboardNotificationInfo& info) override;
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void keyboardWillHide(IMEKeyboardNotificationInfo& info) override;
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void keyboardDidHide(IMEKeyboardNotificationInfo& info) override;
|
||||
|
||||
/* callback funtions
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
void touchDownAction(Ref *sender, TouchEventType controlEvent);
|
||||
|
||||
protected:
|
||||
virtual void adaptRenderers();
|
||||
|
||||
void updatePosition(float dt);
|
||||
EditBoxImpl* _editBoxImpl;
|
||||
EditBoxDelegate* _delegate;
|
||||
|
||||
InputMode _editBoxInputMode;
|
||||
InputFlag _editBoxInputFlag;
|
||||
EditBox::KeyboardReturnType _keyboardReturnType;
|
||||
|
||||
Scale9Sprite *_backgroundSprite;
|
||||
std::string _text;
|
||||
std::string _placeHolder;
|
||||
|
||||
std::string _fontName;
|
||||
std::string _placeholderFontName;
|
||||
|
||||
int _fontSize;
|
||||
int _placeholderFontSize;
|
||||
|
||||
Color3B _colText;
|
||||
Color3B _colPlaceHolder;
|
||||
|
||||
int _maxLength;
|
||||
float _adjustHeight;
|
||||
#if CC_ENABLE_SCRIPT_BINDING
|
||||
int _scriptEditBoxHandler;
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif /* __UIEDITTEXT_H__ */
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2012 James Chen
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __UIEditBoxIMPL_H__
|
||||
#define __UIEditBoxIMPL_H__
|
||||
|
||||
#include "UIEditBox.h"
|
||||
|
||||
|
||||
namespace cocos2d {
|
||||
namespace ui{
|
||||
|
||||
class CC_GUI_DLL EditBoxImpl
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @js NA
|
||||
*/
|
||||
EditBoxImpl(EditBox* pEditBox) : _delegate(nullptr),_editBox(pEditBox) {}
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~EditBoxImpl() {}
|
||||
|
||||
virtual bool initWithSize(const Size& size) = 0;
|
||||
virtual void setFont(const char* pFontName, int fontSize) = 0;
|
||||
virtual void setFontColor(const Color3B& color) = 0;
|
||||
virtual void setPlaceholderFont(const char* pFontName, int fontSize) = 0;
|
||||
virtual void setPlaceholderFontColor(const Color3B& color) = 0;
|
||||
virtual void setInputMode(EditBox::InputMode inputMode) = 0;
|
||||
virtual void setInputFlag(EditBox::InputFlag inputFlag) = 0;
|
||||
virtual void setMaxLength(int maxLength) = 0;
|
||||
virtual int getMaxLength() = 0;
|
||||
virtual void setReturnType(EditBox::KeyboardReturnType returnType) = 0;
|
||||
virtual bool isEditing() = 0;
|
||||
|
||||
virtual void setText(const char* pText) = 0;
|
||||
virtual const char* getText(void) = 0;
|
||||
virtual void setPlaceHolder(const char* pText) = 0;
|
||||
virtual void doAnimationWhenKeyboardMove(float duration, float distance) = 0;
|
||||
|
||||
virtual void openKeyboard() = 0;
|
||||
virtual void closeKeyboard() = 0;
|
||||
|
||||
virtual void setPosition(const Vec2& pos) = 0;
|
||||
virtual void setVisible(bool visible) = 0;
|
||||
virtual void setContentSize(const Size& size) = 0;
|
||||
virtual void setAnchorPoint(const Vec2& anchorPoint) = 0;
|
||||
|
||||
/**
|
||||
* check the editbox's position, update it when needed
|
||||
*/
|
||||
virtual void updatePosition(float dt){};
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void visit(void) = 0;
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void onEnter(void) = 0;
|
||||
|
||||
|
||||
void setDelegate(EditBoxDelegate* pDelegate) { _delegate = pDelegate; };
|
||||
EditBoxDelegate* getDelegate() { return _delegate; };
|
||||
EditBox* getEditBox() { return _editBox; };
|
||||
protected:
|
||||
EditBoxDelegate* _delegate;
|
||||
EditBox* _editBox;
|
||||
};
|
||||
|
||||
// This method must be implemented at each subclass of EditBoxImpl.
|
||||
extern EditBoxImpl* __createSystemEditBox(EditBox* pEditBox);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* __UIEditBoxIMPL_H__ */
|
|
@ -23,16 +23,18 @@
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "CCEditBoxImplAndroid.h"
|
||||
#include "UIEditBoxImplAndroid.h"
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||
|
||||
#include "CCEditBox.h"
|
||||
#include "UIEditBox.h"
|
||||
#include "jni/Java_org_cocos2dx_lib_Cocos2dxBitmap.h"
|
||||
#include "jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h"
|
||||
|
||||
|
||||
NS_CC_EXT_BEGIN
|
||||
NS_CC_BEGIN
|
||||
|
||||
namespace ui {
|
||||
|
||||
EditBoxImpl* __createSystemEditBox(EditBox* pEditBox)
|
||||
{
|
||||
|
@ -309,7 +311,9 @@ void EditBoxImplAndroid::closeKeyboard()
|
|||
|
||||
}
|
||||
|
||||
NS_CC_EXT_END
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif /* #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) */
|
||||
|
|
@ -23,17 +23,18 @@
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __CCEDITBOXIMPLANDROID_H__
|
||||
#define __CCEDITBOXIMPLANDROID_H__
|
||||
#ifndef __UIEDITBOXIMPLANDROID_H__
|
||||
#define __UIEDITBOXIMPLANDROID_H__
|
||||
|
||||
#include "cocos2d.h"
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||
|
||||
#include "extensions/ExtensionMacros.h"
|
||||
#include "CCEditBoxImpl.h"
|
||||
#include "UIEditBoxImpl.h"
|
||||
|
||||
NS_CC_EXT_BEGIN
|
||||
NS_CC_BEGIN
|
||||
|
||||
namespace ui {
|
||||
|
||||
class EditBox;
|
||||
|
||||
|
@ -78,7 +79,7 @@ public:
|
|||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void onEnter(void);
|
||||
virtual void onEnter(void);
|
||||
virtual void doAnimationWhenKeyboardMove(float duration, float distance);
|
||||
virtual void openKeyboard();
|
||||
virtual void closeKeyboard();
|
||||
|
@ -101,9 +102,11 @@ private:
|
|||
};
|
||||
|
||||
|
||||
NS_CC_EXT_END
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif /* #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) */
|
||||
|
||||
#endif /* __CCEDITBOXIMPLANDROID_H__ */
|
||||
#endif /* __UIEDITBOXIMPLANDROID_H__ */
|
||||
|
|
@ -23,29 +23,29 @@
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __CCEditBoxIMPLIOS_H__
|
||||
#define __CCEditBoxIMPLIOS_H__
|
||||
#ifndef __UIEditBoxIMPLIOS_H__
|
||||
#define __UIEditBoxIMPLIOS_H__
|
||||
|
||||
#include "cocos2d.h"
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
||||
|
||||
#include "extensions/ExtensionMacros.h"
|
||||
#include "CCEditBoxImpl.h"
|
||||
#include "UIEditBoxImpl.h"
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface CCCustomUITextField : UITextField
|
||||
@interface UICustomUITextField : UITextField
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface CCEditBoxImplIOS_objc : NSObject <UITextFieldDelegate>
|
||||
@interface UIEditBoxImplIOS_objc : NSObject <UITextFieldDelegate>
|
||||
{
|
||||
CCCustomUITextField* textField_;
|
||||
UICustomUITextField* textField_;
|
||||
void* editBox_;
|
||||
BOOL editState_;
|
||||
}
|
||||
|
@ -64,7 +64,9 @@
|
|||
|
||||
@end
|
||||
|
||||
NS_CC_EXT_BEGIN
|
||||
NS_CC_BEGIN
|
||||
|
||||
namespace ui {
|
||||
|
||||
class EditBox;
|
||||
|
||||
|
@ -128,16 +130,18 @@ private:
|
|||
Size _contentSize;
|
||||
Vec2 _position;
|
||||
Vec2 _anchorPoint;
|
||||
CCEditBoxImplIOS_objc* _systemControl;
|
||||
UIEditBoxImplIOS_objc* _systemControl;
|
||||
int _maxTextLength;
|
||||
bool _inRetinaMode;
|
||||
};
|
||||
|
||||
|
||||
NS_CC_EXT_END
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
|
||||
#endif /* #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) */
|
||||
|
||||
#endif /* __CCEditBoxIMPLIOS_H__ */
|
||||
#endif /* __UIEditBoxIMPLIOS_H__ */
|
||||
|
|
@ -22,20 +22,20 @@
|
|||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
#include "CCEditBoxImplIOS.h"
|
||||
#include "UIEditBoxImplIOS.h"
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
||||
|
||||
#define kLabelZOrder 9999
|
||||
|
||||
#include "CCEditBox.h"
|
||||
#include "UIEditBox.h"
|
||||
#import "CCEAGLView.h"
|
||||
|
||||
#define getEditBoxImplIOS() ((cocos2d::extension::EditBoxImplIOS*)editBox_)
|
||||
#define getEditBoxImplIOS() ((cocos2d::ui::EditBoxImplIOS*)editBox_)
|
||||
|
||||
static const int CC_EDIT_BOX_PADDING = 5;
|
||||
|
||||
@implementation CCCustomUITextField
|
||||
@implementation UICustomUITextField
|
||||
- (CGRect)textRectForBounds:(CGRect)bounds
|
||||
{
|
||||
auto glview = cocos2d::Director::getInstance()->getOpenGLView();
|
||||
|
@ -50,7 +50,7 @@ static const int CC_EDIT_BOX_PADDING = 5;
|
|||
@end
|
||||
|
||||
|
||||
@implementation CCEditBoxImplIOS_objc
|
||||
@implementation UIEditBoxImplIOS_objc
|
||||
|
||||
@synthesize textField = textField_;
|
||||
@synthesize editState = editState_;
|
||||
|
@ -71,7 +71,7 @@ static const int CC_EDIT_BOX_PADDING = 5;
|
|||
if (self)
|
||||
{
|
||||
editState_ = NO;
|
||||
self.textField = [[[CCCustomUITextField alloc] initWithFrame: frameRect] autorelease];
|
||||
self.textField = [[[UICustomUITextField alloc] initWithFrame: frameRect] autorelease];
|
||||
|
||||
[textField_ setTextColor:[UIColor whiteColor]];
|
||||
//TODO: need to delete hard code here.
|
||||
|
@ -159,14 +159,14 @@ static const int CC_EDIT_BOX_PADDING = 5;
|
|||
{
|
||||
[self performSelector:@selector(animationSelector) withObject:nil afterDelay:0.0f];
|
||||
}
|
||||
cocos2d::extension::EditBoxDelegate* pDelegate = getEditBoxImplIOS()->getDelegate();
|
||||
cocos2d::ui::EditBoxDelegate* pDelegate = getEditBoxImplIOS()->getDelegate();
|
||||
if (pDelegate != NULL)
|
||||
{
|
||||
pDelegate->editBoxEditingDidBegin(getEditBoxImplIOS()->getEditBox());
|
||||
}
|
||||
|
||||
#if CC_ENABLE_SCRIPT_BINDING
|
||||
cocos2d::extension::EditBox* pEditBox= getEditBoxImplIOS()->getEditBox();
|
||||
cocos2d::ui::EditBox* pEditBox= getEditBoxImplIOS()->getEditBox();
|
||||
if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
|
||||
{
|
||||
cocos2d::CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "began",pEditBox);
|
||||
|
@ -183,7 +183,7 @@ static const int CC_EDIT_BOX_PADDING = 5;
|
|||
editState_ = NO;
|
||||
getEditBoxImplIOS()->refreshInactiveText();
|
||||
|
||||
cocos2d::extension::EditBoxDelegate* pDelegate = getEditBoxImplIOS()->getDelegate();
|
||||
cocos2d::ui::EditBoxDelegate* pDelegate = getEditBoxImplIOS()->getDelegate();
|
||||
if (pDelegate != NULL)
|
||||
{
|
||||
pDelegate->editBoxEditingDidEnd(getEditBoxImplIOS()->getEditBox());
|
||||
|
@ -191,7 +191,7 @@ static const int CC_EDIT_BOX_PADDING = 5;
|
|||
}
|
||||
|
||||
#if CC_ENABLE_SCRIPT_BINDING
|
||||
cocos2d::extension::EditBox* pEditBox= getEditBoxImplIOS()->getEditBox();
|
||||
cocos2d::ui::EditBox* pEditBox= getEditBoxImplIOS()->getEditBox();
|
||||
if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
|
||||
{
|
||||
cocos2d::CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "ended",pEditBox);
|
||||
|
@ -240,14 +240,14 @@ static const int CC_EDIT_BOX_PADDING = 5;
|
|||
- (void) textChanged
|
||||
{
|
||||
// NSLog(@"text is %@", self.textField.text);
|
||||
cocos2d::extension::EditBoxDelegate* pDelegate = getEditBoxImplIOS()->getDelegate();
|
||||
cocos2d::ui::EditBoxDelegate* pDelegate = getEditBoxImplIOS()->getDelegate();
|
||||
if (pDelegate != NULL)
|
||||
{
|
||||
pDelegate->editBoxTextChanged(getEditBoxImplIOS()->getEditBox(), getEditBoxImplIOS()->getText());
|
||||
}
|
||||
|
||||
#if CC_ENABLE_SCRIPT_BINDING
|
||||
cocos2d::extension::EditBox* pEditBox= getEditBoxImplIOS()->getEditBox();
|
||||
cocos2d::ui::EditBox* pEditBox= getEditBoxImplIOS()->getEditBox();
|
||||
if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
|
||||
{
|
||||
cocos2d::CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "changed",pEditBox);
|
||||
|
@ -260,7 +260,9 @@ static const int CC_EDIT_BOX_PADDING = 5;
|
|||
@end
|
||||
|
||||
|
||||
NS_CC_EXT_BEGIN
|
||||
NS_CC_BEGIN
|
||||
|
||||
namespace ui {
|
||||
|
||||
EditBoxImpl* __createSystemEditBox(EditBox* pEditBox)
|
||||
{
|
||||
|
@ -307,7 +309,7 @@ bool EditBoxImplIOS::initWithSize(const Size& size)
|
|||
rect.size.height /= 2.0f;
|
||||
}
|
||||
|
||||
_systemControl = [[CCEditBoxImplIOS_objc alloc] initWithFrame:rect editBox:this];
|
||||
_systemControl = [[UIEditBoxImplIOS_objc alloc] initWithFrame:rect editBox:this];
|
||||
if (!_systemControl) break;
|
||||
|
||||
initInactiveLabels(size);
|
||||
|
@ -393,8 +395,6 @@ void EditBoxImplIOS::setFont(const char* pFontName, int fontSize)
|
|||
|
||||
_label->setSystemFontName(pFontName);
|
||||
_label->setSystemFontSize(fontSize);
|
||||
_labelPlaceHolder->setSystemFontName(pFontName);
|
||||
_labelPlaceHolder->setSystemFontSize(fontSize);
|
||||
}
|
||||
|
||||
void EditBoxImplIOS::setFontColor(const Color3B& color)
|
||||
|
@ -405,7 +405,8 @@ void EditBoxImplIOS::setFontColor(const Color3B& color)
|
|||
|
||||
void EditBoxImplIOS::setPlaceholderFont(const char* pFontName, int fontSize)
|
||||
{
|
||||
// TODO: need to be implemented.
|
||||
_labelPlaceHolder->setSystemFontName(pFontName);
|
||||
_labelPlaceHolder->setSystemFontSize(fontSize);
|
||||
}
|
||||
|
||||
void EditBoxImplIOS::setPlaceholderFontColor(const Color3B& color)
|
||||
|
@ -668,7 +669,9 @@ void EditBoxImplIOS::onEndEditing()
|
|||
}
|
||||
}
|
||||
|
||||
NS_CC_EXT_END
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif /* #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) */
|
||||
|
|
@ -23,8 +23,8 @@
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __CCEditBoxIMPLMAC_H__
|
||||
#define __CCEditBoxIMPLMAC_H__
|
||||
#ifndef __UIEditBoxIMPLMAC_H__
|
||||
#define __UIEditBoxIMPLMAC_H__
|
||||
|
||||
#include "cocos2d.h"
|
||||
|
||||
|
@ -33,11 +33,10 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
#import <AppKit/AppKit.h>
|
||||
|
||||
#include "extensions/ExtensionMacros.h"
|
||||
#include "CCEditBoxImpl.h"
|
||||
#include "UIEditBoxImpl.h"
|
||||
|
||||
|
||||
@interface CCEditBoxImplMac : NSObject <NSTextFieldDelegate>
|
||||
@interface UIEditBoxImplMac : NSObject <NSTextFieldDelegate>
|
||||
{
|
||||
NSTextField* textField_;
|
||||
NSSecureTextField* secureTextField_;
|
||||
|
@ -62,8 +61,11 @@
|
|||
|
||||
@end
|
||||
|
||||
NS_CC_EXT_BEGIN
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
namespace ui {
|
||||
|
||||
class EditBox;
|
||||
|
||||
class EditBoxImplMac : public EditBoxImpl
|
||||
|
@ -120,13 +122,15 @@ private:
|
|||
Vec2 _anchorPoint;
|
||||
int _maxTextLength;
|
||||
bool _inRetinaMode;
|
||||
CCEditBoxImplMac* _sysEdit;
|
||||
UIEditBoxImplMac* _sysEdit;
|
||||
};
|
||||
|
||||
|
||||
NS_CC_EXT_END
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif // #if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
|
||||
|
||||
#endif /* __CCEditBoxIMPLMAC_H__ */
|
||||
#endif /* __UIEditBoxIMPLMAC_H__ */
|
||||
|
|
@ -23,19 +23,19 @@
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "CCEditBoxImplMac.h"
|
||||
#include "UIEditBoxImplMac.h"
|
||||
#include "base/CCDirector.h"
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
|
||||
|
||||
#include "CCEditBox.h"
|
||||
#include "UIEditBox.h"
|
||||
|
||||
|
||||
#define getEditBoxImplMac() ((cocos2d::extension::EditBoxImplMac*)editBox_)
|
||||
#define getEditBoxImplMac() ((cocos2d::ui::EditBoxImplMac*)editBox_)
|
||||
|
||||
|
||||
|
||||
@implementation CCEditBoxImplMac
|
||||
@implementation UIEditBoxImplMac
|
||||
|
||||
@synthesize textField = textField_;
|
||||
@synthesize secureTextField = secureTextField_;
|
||||
|
@ -163,14 +163,14 @@
|
|||
- (void)controlTextDidBeginEditing:(NSNotification *)notification
|
||||
{
|
||||
editState_ = YES;
|
||||
cocos2d::extension::EditBoxDelegate* pDelegate = getEditBoxImplMac()->getDelegate();
|
||||
cocos2d::ui::EditBoxDelegate* pDelegate = getEditBoxImplMac()->getDelegate();
|
||||
if (pDelegate != NULL)
|
||||
{
|
||||
pDelegate->editBoxEditingDidBegin(getEditBoxImplMac()->getEditBox());
|
||||
}
|
||||
|
||||
#if CC_ENABLE_SCRIPT_BINDING
|
||||
cocos2d::extension::EditBox* pEditBox= getEditBoxImplMac()->getEditBox();
|
||||
cocos2d::ui::EditBox* pEditBox= getEditBoxImplMac()->getEditBox();
|
||||
if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
|
||||
{
|
||||
cocos2d::CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "began",pEditBox);
|
||||
|
@ -183,7 +183,7 @@
|
|||
- (void)controlTextDidEndEditing:(NSNotification *)notification
|
||||
{
|
||||
editState_ = NO;
|
||||
cocos2d::extension::EditBoxDelegate* pDelegate = getEditBoxImplMac()->getDelegate();
|
||||
cocos2d::ui::EditBoxDelegate* pDelegate = getEditBoxImplMac()->getDelegate();
|
||||
if (pDelegate != NULL)
|
||||
{
|
||||
pDelegate->editBoxEditingDidEnd(getEditBoxImplMac()->getEditBox());
|
||||
|
@ -191,7 +191,7 @@
|
|||
}
|
||||
|
||||
#if CC_ENABLE_SCRIPT_BINDING
|
||||
cocos2d::extension::EditBox* pEditBox= getEditBoxImplMac()->getEditBox();
|
||||
cocos2d::ui::EditBox* pEditBox= getEditBoxImplMac()->getEditBox();
|
||||
if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
|
||||
{
|
||||
cocos2d::CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "ended",pEditBox);
|
||||
|
@ -233,14 +233,14 @@
|
|||
*/
|
||||
- (void)controlTextDidChange:(NSNotification *)notification
|
||||
{
|
||||
cocos2d::extension::EditBoxDelegate* pDelegate = getEditBoxImplMac()->getDelegate();
|
||||
cocos2d::ui::EditBoxDelegate* pDelegate = getEditBoxImplMac()->getDelegate();
|
||||
if (pDelegate != NULL)
|
||||
{
|
||||
pDelegate->editBoxTextChanged(getEditBoxImplMac()->getEditBox(), getEditBoxImplMac()->getText());
|
||||
}
|
||||
|
||||
#if CC_ENABLE_SCRIPT_BINDING
|
||||
cocos2d::extension::EditBox* pEditBox= getEditBoxImplMac()->getEditBox();
|
||||
cocos2d::ui::EditBox* pEditBox= getEditBoxImplMac()->getEditBox();
|
||||
if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
|
||||
{
|
||||
cocos2d::CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "changed",pEditBox);
|
||||
|
@ -252,7 +252,9 @@
|
|||
|
||||
@end
|
||||
|
||||
NS_CC_EXT_BEGIN
|
||||
NS_CC_BEGIN
|
||||
|
||||
namespace ui {
|
||||
|
||||
EditBoxImpl* __createSystemEditBox(EditBox* pEditBox)
|
||||
{
|
||||
|
@ -292,7 +294,7 @@ bool EditBoxImplMac::initWithSize(const Size& size)
|
|||
rect.size.height /= 2.0f;
|
||||
}
|
||||
|
||||
_sysEdit = [[CCEditBoxImplMac alloc] initWithFrame:rect editBox:this];
|
||||
_sysEdit = [[UIEditBoxImplMac alloc] initWithFrame:rect editBox:this];
|
||||
|
||||
if (!_sysEdit)
|
||||
return false;
|
||||
|
@ -514,7 +516,9 @@ void EditBoxImplMac::onEnter(void)
|
|||
adjustTextFieldPosition();
|
||||
}
|
||||
|
||||
NS_CC_EXT_END
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif // #if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
|
||||
|
|
@ -1,14 +1,18 @@
|
|||
#include "CCEditBox.h"
|
||||
#include "UIEditBox.h"
|
||||
|
||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID ) && (CC_TARGET_PLATFORM != CC_PLATFORM_IOS ) && (CC_TARGET_PLATFORM != CC_PLATFORM_WIN32) && (CC_TARGET_PLATFORM != CC_PLATFORM_MAC) && (CC_TARGET_PLATFORM != CC_PLATFORM_TIZEN)
|
||||
|
||||
NS_CC_EXT_BEGIN
|
||||
NS_CC_BEGIN
|
||||
|
||||
namespace ui {
|
||||
|
||||
EditBoxImpl* __createSystemEditBox(EditBox* pEditBox)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NS_CC_EXT_END
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif /* #if (..) */
|
|
@ -22,14 +22,16 @@
|
|||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
#include "CCEditBoxImplWin.h"
|
||||
#include "UIEditBoxImplWin.h"
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
||||
|
||||
#include "CCEditBox.h"
|
||||
#include "UIEditBox.h"
|
||||
#include "proj.win32/Win32InputBox.h"
|
||||
|
||||
NS_CC_EXT_BEGIN
|
||||
NS_CC_BEGIN
|
||||
|
||||
namespace ui {
|
||||
|
||||
EditBoxImpl* __createSystemEditBox(EditBox* pEditBox)
|
||||
{
|
||||
|
@ -293,6 +295,8 @@ void EditBoxImplWin::onEnter(void)
|
|||
|
||||
}
|
||||
|
||||
NS_CC_EXT_END
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif /* (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) */
|
|
@ -23,22 +23,22 @@
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __CCEditBoxIMPLWIN_H__
|
||||
#define __CCEditBoxIMPLWIN_H__
|
||||
#ifndef __UIEditBoxIMPLWIN_H__
|
||||
#define __UIEditBoxIMPLWIN_H__
|
||||
|
||||
#include "cocos2d.h"
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
||||
|
||||
#include "extensions/ExtensionMacros.h"
|
||||
#include "CCEditBoxImpl.h"
|
||||
#include "extensions/ExtensionExport.h"
|
||||
#include "UIEditBoxImpl.h"
|
||||
|
||||
NS_CC_EXT_BEGIN
|
||||
NS_CC_BEGIN
|
||||
|
||||
namespace ui {
|
||||
|
||||
class EditBox;
|
||||
|
||||
class CC_EX_DLL EditBoxImplWin : public EditBoxImpl
|
||||
class CC_GUI_DLL EditBoxImplWin : public EditBoxImpl
|
||||
{
|
||||
public:
|
||||
/**
|
||||
|
@ -108,9 +108,11 @@ private:
|
|||
};
|
||||
|
||||
|
||||
NS_CC_EXT_END
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif /* (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) */
|
||||
|
||||
#endif /* __CCEditBoxIMPLWIN_H__ */
|
||||
#endif /* __UIEditBoxIMPLWIN_H__ */
|
||||
|
|
@ -22,20 +22,22 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "CCEditBoxImplWp8.h"
|
||||
#include "CCEditBox.h"
|
||||
#include "UIEditBoxImplWp8.h"
|
||||
#include "UIEditBox.h"
|
||||
#include "CCGLViewImpl.h"
|
||||
#include "base/CCScriptSupport.h"
|
||||
#include "base/ccUTF8.h"
|
||||
|
||||
NS_CC_EXT_BEGIN
|
||||
NS_CC_BEGIN
|
||||
|
||||
namespace ui {
|
||||
|
||||
EditBoxImpl* __createSystemEditBox(EditBox* pEditBox)
|
||||
{
|
||||
return new CCEditBoxImplWp8(pEditBox);
|
||||
return new UIEditBoxImplWp8(pEditBox);
|
||||
}
|
||||
|
||||
CCEditBoxImplWp8::CCEditBoxImplWp8( EditBox* pEditText )
|
||||
UIEditBoxImplWp8::UIEditBoxImplWp8( EditBox* pEditText )
|
||||
: EditBoxImpl(pEditText)
|
||||
, m_pLabel(NULL)
|
||||
, m_pLabelPlaceHolder(NULL)
|
||||
|
@ -49,12 +51,12 @@ CCEditBoxImplWp8::CCEditBoxImplWp8( EditBox* pEditText )
|
|||
|
||||
}
|
||||
|
||||
CCEditBoxImplWp8::~CCEditBoxImplWp8()
|
||||
UIEditBoxImplWp8::~UIEditBoxImplWp8()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CCEditBoxImplWp8::openKeyboard()
|
||||
void UIEditBoxImplWp8::openKeyboard()
|
||||
{
|
||||
if (_delegate != NULL)
|
||||
{
|
||||
|
@ -92,7 +94,7 @@ void CCEditBoxImplWp8::openKeyboard()
|
|||
GLViewImpl::sharedOpenGLView()->OpenXamlEditBox(stringToPlatformString(placeHolder), stringToPlatformString(getText()), m_nMaxLength, (int)m_eEditBoxInputMode, (int)m_eEditBoxInputFlag, receiveHandler);
|
||||
}
|
||||
|
||||
bool CCEditBoxImplWp8::initWithSize( const Size& size )
|
||||
bool UIEditBoxImplWp8::initWithSize( const Size& size )
|
||||
{
|
||||
//! int fontSize = getFontSizeAccordingHeightJni(size.height-12);
|
||||
m_pLabel = Label::createWithSystemFont("", "", size.height-12);
|
||||
|
@ -114,7 +116,7 @@ bool CCEditBoxImplWp8::initWithSize( const Size& size )
|
|||
return true;
|
||||
}
|
||||
|
||||
void CCEditBoxImplWp8::setFont( const char* pFontName, int fontSize )
|
||||
void UIEditBoxImplWp8::setFont( const char* pFontName, int fontSize )
|
||||
{
|
||||
if(m_pLabel != NULL) {
|
||||
m_pLabel->setSystemFontName(pFontName);
|
||||
|
@ -127,13 +129,13 @@ void CCEditBoxImplWp8::setFont( const char* pFontName, int fontSize )
|
|||
}
|
||||
}
|
||||
|
||||
void CCEditBoxImplWp8::setFontColor( const Color3B& color )
|
||||
void UIEditBoxImplWp8::setFontColor( const Color3B& color )
|
||||
{
|
||||
m_colText = color;
|
||||
m_pLabel->setColor(color);
|
||||
}
|
||||
|
||||
void CCEditBoxImplWp8::setPlaceholderFont( const char* pFontName, int fontSize )
|
||||
void UIEditBoxImplWp8::setPlaceholderFont( const char* pFontName, int fontSize )
|
||||
{
|
||||
if(m_pLabelPlaceHolder != NULL) {
|
||||
m_pLabelPlaceHolder->setSystemFontName(pFontName);
|
||||
|
@ -141,43 +143,43 @@ void CCEditBoxImplWp8::setPlaceholderFont( const char* pFontName, int fontSize )
|
|||
}
|
||||
}
|
||||
|
||||
void CCEditBoxImplWp8::setPlaceholderFontColor( const Color3B& color )
|
||||
void UIEditBoxImplWp8::setPlaceholderFontColor( const Color3B& color )
|
||||
{
|
||||
m_colPlaceHolder = color;
|
||||
m_pLabelPlaceHolder->setColor(color);
|
||||
}
|
||||
|
||||
void CCEditBoxImplWp8::setInputMode( EditBox::InputMode inputMode )
|
||||
void UIEditBoxImplWp8::setInputMode( EditBox::InputMode inputMode )
|
||||
{
|
||||
m_eEditBoxInputMode = inputMode;
|
||||
}
|
||||
|
||||
void CCEditBoxImplWp8::setInputFlag(EditBox::InputFlag inputFlag )
|
||||
void UIEditBoxImplWp8::setInputFlag(EditBox::InputFlag inputFlag )
|
||||
{
|
||||
m_eEditBoxInputFlag = inputFlag;
|
||||
}
|
||||
|
||||
void CCEditBoxImplWp8::setMaxLength( int maxLength )
|
||||
void UIEditBoxImplWp8::setMaxLength( int maxLength )
|
||||
{
|
||||
m_nMaxLength = maxLength;
|
||||
}
|
||||
|
||||
int CCEditBoxImplWp8::getMaxLength()
|
||||
int UIEditBoxImplWp8::getMaxLength()
|
||||
{
|
||||
return m_nMaxLength;
|
||||
}
|
||||
|
||||
void CCEditBoxImplWp8::setReturnType( EditBox::KeyboardReturnType returnType )
|
||||
void UIEditBoxImplWp8::setReturnType( EditBox::KeyboardReturnType returnType )
|
||||
{
|
||||
m_eKeyboardReturnType = returnType;
|
||||
}
|
||||
|
||||
bool CCEditBoxImplWp8::isEditing()
|
||||
bool UIEditBoxImplWp8::isEditing()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void CCEditBoxImplWp8::setText( const char* pText )
|
||||
void UIEditBoxImplWp8::setText( const char* pText )
|
||||
{
|
||||
if (pText != NULL)
|
||||
{
|
||||
|
@ -215,12 +217,12 @@ void CCEditBoxImplWp8::setText( const char* pText )
|
|||
}
|
||||
}
|
||||
|
||||
const char* CCEditBoxImplWp8::getText( void )
|
||||
const char* UIEditBoxImplWp8::getText( void )
|
||||
{
|
||||
return m_strText.c_str();
|
||||
}
|
||||
|
||||
void CCEditBoxImplWp8::setPlaceHolder( const char* pText )
|
||||
void UIEditBoxImplWp8::setPlaceHolder( const char* pText )
|
||||
{
|
||||
if (pText != NULL)
|
||||
{
|
||||
|
@ -234,47 +236,47 @@ void CCEditBoxImplWp8::setPlaceHolder( const char* pText )
|
|||
}
|
||||
}
|
||||
|
||||
void CCEditBoxImplWp8::setPosition( const Vec2& pos )
|
||||
void UIEditBoxImplWp8::setPosition( const Vec2& pos )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CCEditBoxImplWp8::setVisible( bool visible )
|
||||
void UIEditBoxImplWp8::setVisible( bool visible )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CCEditBoxImplWp8::setContentSize( const Size& size )
|
||||
void UIEditBoxImplWp8::setContentSize( const Size& size )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CCEditBoxImplWp8::setAnchorPoint( const Vec2& anchorPoint )
|
||||
void UIEditBoxImplWp8::setAnchorPoint( const Vec2& anchorPoint )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CCEditBoxImplWp8::visit( void )
|
||||
void UIEditBoxImplWp8::visit( void )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CCEditBoxImplWp8::doAnimationWhenKeyboardMove( float duration, float distance )
|
||||
void UIEditBoxImplWp8::doAnimationWhenKeyboardMove( float duration, float distance )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CCEditBoxImplWp8::closeKeyboard()
|
||||
void UIEditBoxImplWp8::closeKeyboard()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CCEditBoxImplWp8::onEnter( void )
|
||||
void UIEditBoxImplWp8::onEnter( void )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Platform::String^ CCEditBoxImplWp8::stringToPlatformString( std::string strSrc )
|
||||
Platform::String^ UIEditBoxImplWp8::stringToPlatformString( std::string strSrc )
|
||||
{
|
||||
// to wide char
|
||||
int nStrLen = MultiByteToWideChar(CP_UTF8, 0, strSrc.c_str(), -1, NULL, 0);
|
||||
|
@ -286,7 +288,7 @@ Platform::String^ CCEditBoxImplWp8::stringToPlatformString( std::string strSrc )
|
|||
return strDst;
|
||||
}
|
||||
|
||||
std::string CCEditBoxImplWp8::PlatformStringTostring( Platform::String^ strSrc )
|
||||
std::string UIEditBoxImplWp8::PlatformStringTostring( Platform::String^ strSrc )
|
||||
{
|
||||
const wchar_t* pWStr = strSrc->Data();
|
||||
int nStrLen = WideCharToMultiByte(CP_UTF8, 0, pWStr, -1, NULL, 0, NULL, NULL);
|
||||
|
@ -300,4 +302,6 @@ std::string CCEditBoxImplWp8::PlatformStringTostring( Platform::String^ strSrc )
|
|||
return strDst;
|
||||
}
|
||||
|
||||
NS_CC_EXT_END
|
||||
}
|
||||
|
||||
NS_CC_END
|
|
@ -0,0 +1,88 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2014 cocos2d-x.org
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
#ifndef __UIEditBoxIMPLWP8_H__
|
||||
#define __UIEditBoxIMPLWP8_H__
|
||||
|
||||
#include "UIEditBoxImpl.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
namespace ui {
|
||||
class EditBox;
|
||||
|
||||
class CC_GUI_DLL UIEditBoxImplWp8 : public EditBoxImpl
|
||||
{
|
||||
public:
|
||||
UIEditBoxImplWp8(EditBox* pEditText);
|
||||
virtual ~UIEditBoxImplWp8();
|
||||
|
||||
virtual bool initWithSize(const Size& size);
|
||||
virtual void setFont(const char* pFontName, int fontSize);
|
||||
virtual void setFontColor(const Color3B& color);
|
||||
virtual void setPlaceholderFont(const char* pFontName, int fontSize);
|
||||
virtual void setPlaceholderFontColor(const Color3B& color);
|
||||
virtual void setInputMode(EditBox::InputMode inputMode);
|
||||
virtual void setInputFlag(EditBox::InputFlag inputFlag);
|
||||
virtual void setMaxLength(int maxLength);
|
||||
virtual int getMaxLength();
|
||||
virtual void setReturnType(EditBox::KeyboardReturnType returnType);
|
||||
virtual bool isEditing();
|
||||
|
||||
virtual void setText(const char* pText);
|
||||
virtual const char* getText(void);
|
||||
virtual void setPlaceHolder(const char* pText);
|
||||
virtual void setPosition(const Vec2& pos);
|
||||
virtual void setVisible(bool visible);
|
||||
virtual void setContentSize(const Size& size);
|
||||
virtual void setAnchorPoint(const Vec2& anchorPoint);
|
||||
virtual void visit(void);
|
||||
virtual void doAnimationWhenKeyboardMove(float duration, float distance);
|
||||
virtual void openKeyboard();
|
||||
virtual void closeKeyboard();
|
||||
virtual void onEnter(void);
|
||||
private:
|
||||
Platform::String^ stringToPlatformString(std::string strSrc);
|
||||
std::string PlatformStringTostring(Platform::String^ strSrc);
|
||||
private:
|
||||
|
||||
Label* m_pLabel;
|
||||
Label* m_pLabelPlaceHolder;
|
||||
EditBox::InputMode m_eEditBoxInputMode;
|
||||
EditBox::InputFlag m_eEditBoxInputFlag;
|
||||
(EditBox::KeyboardReturnType m_eKeyboardReturnType;
|
||||
|
||||
std::string m_strText;
|
||||
std::string m_strPlaceHolder;
|
||||
|
||||
Color3B m_colText;
|
||||
Color3B m_colPlaceHolder;
|
||||
|
||||
int m_nMaxLength;
|
||||
Size m_EditSize;
|
||||
};
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif
|
|
@ -140,11 +140,28 @@ namespace ui {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Scale9Sprite::initWithBatchNode(cocos2d::SpriteBatchNode *batchnode, const cocos2d::Rect &rect, bool rotated, const cocos2d::Rect &capInsets)
|
||||
{
|
||||
Sprite *sprite = Sprite::createWithTexture(batchnode->getTexture());
|
||||
return init(sprite, rect, rotated, capInsets);
|
||||
}
|
||||
|
||||
bool Scale9Sprite::initWithBatchNode(cocos2d::SpriteBatchNode *batchnode, const cocos2d::Rect &rect, const cocos2d::Rect &capInsets)
|
||||
{
|
||||
return initWithBatchNode(batchnode, rect, false, capInsets);
|
||||
}
|
||||
|
||||
#define TRANSLATE_X(x, y, xtranslate) \
|
||||
x+=xtranslate; \
|
||||
|
||||
#define TRANSLATE_Y(x, y, ytranslate) \
|
||||
y+=ytranslate; \
|
||||
y+=ytranslate; \
|
||||
|
||||
bool Scale9Sprite::updateWithBatchNode(cocos2d::SpriteBatchNode *batchnode, const cocos2d::Rect &originalRect, bool rotated, const cocos2d::Rect &capInsets)
|
||||
{
|
||||
Sprite *sprite = Sprite::createWithTexture(batchnode->getTexture());
|
||||
return this->updateWithSprite(sprite, originalRect, rotated, capInsets);
|
||||
}
|
||||
|
||||
bool Scale9Sprite::updateWithSprite(Sprite* sprite, const Rect& originalRect, bool rotated, const Rect& capInsets)
|
||||
{
|
||||
|
|
|
@ -69,6 +69,7 @@ namespace ui {
|
|||
*/
|
||||
static Scale9Sprite* create(const std::string& file, const Rect& rect, const Rect& capInsets);
|
||||
|
||||
|
||||
/**
|
||||
* Creates a 9-slice sprite with a texture file. The whole texture will be
|
||||
* broken down into a 3×3 grid of equal blocks.
|
||||
|
@ -233,6 +234,9 @@ namespace ui {
|
|||
virtual bool init();
|
||||
virtual bool init(Sprite* sprite, const Rect& rect, bool rotated, const Rect& capInsets);
|
||||
virtual bool init(Sprite* sprite, const Rect& rect, const Rect& capInsets);
|
||||
CC_DEPRECATED_ATTRIBUTE virtual bool initWithBatchNode(SpriteBatchNode* batchnode, const Rect& rect, bool rotated, const Rect& capInsets);
|
||||
CC_DEPRECATED_ATTRIBUTE virtual bool initWithBatchNode(SpriteBatchNode* batchnode, const Rect& rect, const Rect& capInsets);
|
||||
|
||||
/**
|
||||
* Creates and returns a new sprite object with the specified cap insets.
|
||||
* You use this method to add cap insets to a sprite or to change the existing
|
||||
|
@ -244,6 +248,8 @@ namespace ui {
|
|||
Scale9Sprite* resizableSpriteWithCapInsets(const Rect& capInsets);
|
||||
|
||||
virtual bool updateWithSprite(Sprite* sprite, const Rect& rect, bool rotated, const Rect& capInsets);
|
||||
CC_DEPRECATED_ATTRIBUTE bool updateWithBatchNode(SpriteBatchNode* batchnode, const Rect& originalRect, bool rotated, const Rect& capInsets);
|
||||
|
||||
virtual void setSpriteFrame(SpriteFrame * spriteFrame);
|
||||
|
||||
// overrides
|
||||
|
|
|
@ -0,0 +1,383 @@
|
|||
#include "Win32InputBox.h"
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#pragma warning (disable: 4312)
|
||||
|
||||
typedef struct _MSDN_DLGTEMPLATEEX
|
||||
{
|
||||
WORD dlgVer;
|
||||
WORD signature;
|
||||
DWORD helpID;
|
||||
DWORD exStyle;
|
||||
DWORD style;
|
||||
WORD cDlgItems;
|
||||
short x;
|
||||
short y;
|
||||
short cx;
|
||||
short cy;
|
||||
BYTE _rest[1]; // rest of structure
|
||||
} MSDN_DLGTEMPLATEEX;
|
||||
|
||||
static bool IsDlgTemplateExtended(DLGTEMPLATE *dlgTemplate)
|
||||
{
|
||||
MSDN_DLGTEMPLATEEX *dgExTemplate = (MSDN_DLGTEMPLATEEX *) dlgTemplate;
|
||||
|
||||
// MSDN excerpt:
|
||||
//* dlgVer
|
||||
// Specifies the version number of the extended dialog box template. This member must be 1.
|
||||
//* signature
|
||||
// Indicates whether a template is an extended dialog box template.
|
||||
// If signature is 0xFFFF, this is an extended dialog box template.
|
||||
// In this case, the dlgVer member specifies the template version number.
|
||||
// If signature is any value other than 0xFFFF, this is a standard dialog box template that uses the DLGTEMPLATE and DLGITEMTEMPLATE structures.
|
||||
|
||||
return (dgExTemplate->dlgVer == 1) && (dgExTemplate->signature == 0xFFFF);
|
||||
}
|
||||
|
||||
// Use alignment if supported by the compiler
|
||||
#ifdef _MSC_VER
|
||||
#if _MSC_VER > 1200
|
||||
__declspec(align(4))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// per the MSDN, the DLGTEMPLATE must be DWORD aligned
|
||||
// this was generated by the DlgResToDlgTemplate tool
|
||||
static unsigned char definputbox_dlg[] =
|
||||
{
|
||||
0x01,0x00,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc8,0x00,0xc8,0x00,0x06,
|
||||
0x00,0x16,0x00,0x11,0x00,0xe7,0x00,0x6d,0x00,0x00,0x00,0x00,0x00,0x57,0x00,0x69,
|
||||
0x00,0x6e,0x00,0x33,0x00,0x32,0x00,0x49,0x00,0x6e,0x00,0x70,0x00,0x75,0x00,0x74,
|
||||
0x00,0x42,0x00,0x6f,0x00,0x78,0x00,0x00,0x00,0x08,0x00,0xbc,0x02,0x00,0x00,0x4d,
|
||||
0x00,0x53,0x00,0x20,0x00,0x53,0x00,0x68,0x00,0x65,0x00,0x6c,0x00,0x6c,0x00,0x20,
|
||||
0x00,0x44,0x00,0x6c,0x00,0x67,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x80,0x00,0x02,0x50,0x06,0x00,0x04,0x00,0x9d,0x00,0x21,0x00,0xe8,
|
||||
0x03,0x00,0x00,0xff,0xff,0x82,0x00,0x50,0x00,0x72,0x00,0x6f,0x00,0x6d,0x00,0x70,
|
||||
0x00,0x74,0x00,0x3a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x80,0x00,0x81,0x50,0x06,0x00,0x25,0x00,0xd8,0x00,0x0e,0x00,0xe9,
|
||||
0x03,0x00,0x00,0xff,0xff,0x81,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x84,0x10,0xa1,0x50,0x06,0x00,0x37,0x00,0xd8,0x00,0x31,0x00,0xea,
|
||||
0x03,0x00,0x00,0xff,0xff,0x81,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x01,0x00,0x03,0x50,0xab,0x00,0x04,0x00,0x33,0x00,0x0e,0x00,0x01,
|
||||
0x00,0x00,0x00,0xff,0xff,0x80,0x00,0x4f,0x00,0x4b,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x50,0xab,0x00,0x15,0x00,0x33,
|
||||
0x00,0x0e,0x00,0x02,0x00,0x00,0x00,0xff,0xff,0x80,0x00,0x43,0x00,0x41,0x00,0x4e,
|
||||
0x00,0x43,0x00,0x45,0x00,0x4c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x02,0x40,0x00,0x00,0x27,0x00,0x08,0x00,0x08,0x00,0xff,
|
||||
0xff,0xff,0xff,0xff,0xff,0x82,0x00,0x00,0x00,0x00,0x00
|
||||
};
|
||||
|
||||
static LPCTSTR definputbox_buttonnames[] = { _T("OK"), _T("CANCEL") };
|
||||
static const INT_PTR definputbox_buttonids[] = { IDOK, IDCANCEL };
|
||||
|
||||
static const INT
|
||||
definputbox_id_prompt = 1000,
|
||||
definputbox_id_edit1 = 1001,
|
||||
definputbox_id_edit2 = 1002;
|
||||
|
||||
WIN32INPUTBOX_PARAM::WIN32INPUTBOX_PARAM()
|
||||
{
|
||||
bMultiline = false;
|
||||
hwndOwner = 0;
|
||||
DlgTemplateName = 0;
|
||||
hInstance = (HINSTANCE) ::GetModuleHandle(0);
|
||||
DlgTemplateData = definputbox_dlg;
|
||||
|
||||
bCenter = true;
|
||||
|
||||
dwStylesPlus = 0;
|
||||
dwExStylesPlus = 0;
|
||||
dwStylesMinus = 0xFFFFFFFF;
|
||||
dwExStylesMinus = 0xFFFFFFFF;
|
||||
|
||||
xPos = yPos = -1;
|
||||
|
||||
szResult = 0;
|
||||
nResultSize = 0;
|
||||
}
|
||||
|
||||
CWin32InputBox::CWin32InputBox(WIN32INPUTBOX_PARAM *param)
|
||||
{
|
||||
_param = param;
|
||||
}
|
||||
|
||||
CWin32InputBox::~CWin32InputBox()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CWin32InputBox::SetParam(WIN32INPUTBOX_PARAM *param)
|
||||
{
|
||||
_param = param;
|
||||
}
|
||||
|
||||
WIN32INPUTBOX_PARAM *CWin32InputBox::GetParam()
|
||||
{
|
||||
return _param;
|
||||
}
|
||||
|
||||
INT_PTR CWin32InputBox::InputBoxEx(WIN32INPUTBOX_PARAM *param)
|
||||
{
|
||||
// Check mandatory parameters
|
||||
if (param->szResult == 0)
|
||||
{
|
||||
::SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return 0;
|
||||
}
|
||||
|
||||
LPDLGTEMPLATE dlgTemplate;
|
||||
|
||||
if (param->DlgTemplateName != 0)
|
||||
{
|
||||
HMODULE hModule = (HMODULE)param->hInstance;
|
||||
#ifdef __MINGW32__
|
||||
HRSRC rcDlg = ::FindResource(hModule, (LPWSTR)(ULONG_PTR)(size_t)(param->DlgTemplateName), RT_DIALOG);
|
||||
#else
|
||||
HRSRC rcDlg = ::FindResource(hModule, MAKEINTRESOURCE(param->DlgTemplateName), RT_DIALOG);
|
||||
#endif
|
||||
if (rcDlg == nullptr)
|
||||
return 0;
|
||||
|
||||
HGLOBAL hglobalDlg = ::LoadResource(hModule, rcDlg);
|
||||
if (hglobalDlg == nullptr)
|
||||
return 0;
|
||||
|
||||
dlgTemplate = (LPDLGTEMPLATE) hglobalDlg;
|
||||
}
|
||||
else if (param->DlgTemplateData != 0)
|
||||
{
|
||||
dlgTemplate = (LPDLGTEMPLATE) param->DlgTemplateData;
|
||||
}
|
||||
|
||||
MSDN_DLGTEMPLATEEX *dlgTemplateEx =
|
||||
IsDlgTemplateExtended((LPDLGTEMPLATE) dlgTemplate) ? (MSDN_DLGTEMPLATEEX *) dlgTemplate : 0;
|
||||
|
||||
if (dlgTemplateEx != 0)
|
||||
{
|
||||
dlgTemplateEx->exStyle |= param->dwExStylesPlus;
|
||||
dlgTemplateEx->style |= param->dwStylesPlus;
|
||||
dlgTemplateEx->exStyle &= param->dwExStylesMinus;
|
||||
dlgTemplateEx->style &= param->dwStylesMinus;
|
||||
|
||||
if (param->bCenter)
|
||||
dlgTemplateEx->style |= DS_CENTER;
|
||||
|
||||
if (param->xPos != -1)
|
||||
dlgTemplateEx->x = param->xPos;
|
||||
if (param->yPos != -1)
|
||||
dlgTemplateEx->y = param->yPos;
|
||||
}
|
||||
else
|
||||
{
|
||||
dlgTemplate->dwExtendedStyle |= param->dwExStylesPlus;
|
||||
dlgTemplate->style |= param->dwStylesPlus;
|
||||
dlgTemplate->dwExtendedStyle &= param->dwExStylesMinus;
|
||||
dlgTemplate->style &= param->dwStylesMinus;
|
||||
|
||||
if (param->bCenter)
|
||||
dlgTemplate->style |= DS_CENTER;
|
||||
|
||||
if (param->xPos != -1)
|
||||
dlgTemplate->x = param->xPos;
|
||||
|
||||
if (param->yPos != -1)
|
||||
dlgTemplate->y = param->yPos;
|
||||
}
|
||||
|
||||
CWin32InputBox inputbox(param);
|
||||
|
||||
// Resize dialog and SHOW or HIDE multiline
|
||||
INT_PTR r = ::DialogBoxIndirectParam(param->hInstance, dlgTemplate, param->hwndOwner, (DLGPROC)DlgProc, (LPARAM)&inputbox);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
INT_PTR CWin32InputBox::InputBox(
|
||||
LPCSTR szTitle,
|
||||
LPCSTR szPrompt,
|
||||
LPSTR szResult,
|
||||
DWORD nResultSize,
|
||||
bool bMultiLine,
|
||||
HWND hwndParent)
|
||||
{
|
||||
WIN32INPUTBOX_PARAM param;
|
||||
|
||||
param.szTitle = szTitle;
|
||||
param.szPrompt = szPrompt;
|
||||
param.szResult = szResult;
|
||||
param.nResultSize = nResultSize;
|
||||
param.bMultiline = bMultiLine;
|
||||
param.hwndOwner = hwndParent;
|
||||
return InputBoxEx(¶m);
|
||||
}
|
||||
|
||||
void CWin32InputBox::InitDialog()
|
||||
{
|
||||
// Set the button captions
|
||||
for (size_t i=0;i<sizeof(definputbox_buttonids)/sizeof(definputbox_buttonids[0]);i++)
|
||||
::SetDlgItemText(_param->hDlg, (int) definputbox_buttonids[i], definputbox_buttonnames[i]);
|
||||
|
||||
// Set other controls
|
||||
::SetWindowTextA(_param->hDlg, Utf8ToAnsi(_param->szTitle).c_str());
|
||||
::SetDlgItemTextA(_param->hDlg, definputbox_id_prompt, Utf8ToAnsi(_param->szPrompt).c_str());
|
||||
|
||||
HWND hwndEdit1 = ::GetDlgItem(_param->hDlg, definputbox_id_edit1);
|
||||
HWND hwndEdit2 = ::GetDlgItem(_param->hDlg, definputbox_id_edit2);
|
||||
|
||||
if (_param->bMultiline)
|
||||
_hwndEditCtrl = hwndEdit2;
|
||||
else
|
||||
_hwndEditCtrl = hwndEdit1;
|
||||
|
||||
::SetWindowTextA(_hwndEditCtrl, Utf8ToAnsi(_param->szResult).c_str());
|
||||
|
||||
RECT rectDlg, rectEdit1, rectEdit2;
|
||||
|
||||
::GetWindowRect(_param->hDlg, &rectDlg);
|
||||
::GetWindowRect(hwndEdit1, &rectEdit1);
|
||||
::GetWindowRect(hwndEdit2, &rectEdit2);
|
||||
|
||||
if (_param->bMultiline)
|
||||
{
|
||||
::ShowWindow(hwndEdit1, SW_HIDE);
|
||||
::SetWindowPos(
|
||||
hwndEdit2,
|
||||
HWND_NOTOPMOST,
|
||||
rectEdit1.left - rectDlg.left,
|
||||
(rectEdit1.top - rectDlg.top) - (rectEdit1.bottom - rectEdit1.top),
|
||||
0,
|
||||
0,
|
||||
SWP_NOSIZE | SWP_NOZORDER);
|
||||
|
||||
::SetWindowPos(
|
||||
_param->hDlg,
|
||||
HWND_NOTOPMOST,
|
||||
0,
|
||||
0,
|
||||
rectDlg.right - rectDlg.left,
|
||||
rectDlg.bottom - rectDlg.top - (rectEdit1.bottom - rectEdit1.top),
|
||||
SWP_NOMOVE);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
::SetWindowPos(
|
||||
_param->hDlg,
|
||||
HWND_NOTOPMOST,
|
||||
0,
|
||||
0,
|
||||
rectDlg.right - rectDlg.left,
|
||||
rectEdit1.bottom - rectDlg.top + 5,
|
||||
SWP_NOMOVE);
|
||||
|
||||
::ShowWindow(hwndEdit2, SW_HIDE);
|
||||
}
|
||||
}
|
||||
|
||||
// Message handler for about box.
|
||||
LRESULT CALLBACK CWin32InputBox::DlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
CWin32InputBox *_this = (CWin32InputBox *) ::GetWindowLongPtr(hDlg, GWLP_USERDATA);
|
||||
WIN32INPUTBOX_PARAM *param = _this ? _this->GetParam() : 0;
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
SetWindowLongPtr(hDlg, GWLP_USERDATA, (LONG_PTR) lParam);
|
||||
|
||||
_this = (CWin32InputBox *) lParam;
|
||||
_this->_param->hDlg = hDlg;
|
||||
_this->InitDialog();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case WM_COMMAND:
|
||||
{
|
||||
#ifdef _MY_DEBUG
|
||||
CHAR buf[1024];
|
||||
static int i=0;
|
||||
sprintf(buf, "WM_COMMAND: %09d wParam=%08X lParam=%08X\n", i++, wParam, lParam);
|
||||
OutputDebugString(buf);
|
||||
#endif
|
||||
INT_PTR buttonId = LOWORD(wParam);
|
||||
for (size_t i=0;
|
||||
i<sizeof(definputbox_buttonids)/sizeof(definputbox_buttonids[0]);
|
||||
i++)
|
||||
{
|
||||
if (buttonId == definputbox_buttonids[i])
|
||||
{
|
||||
::GetWindowTextA(
|
||||
_this->_hwndEditCtrl,
|
||||
_this->_param->szResult,
|
||||
_this->_param->nResultSize);
|
||||
|
||||
std::string strUtf8 = AnsiToUtf8(_this->_param->szResult);
|
||||
|
||||
memset(_this->_param->szResult, 0, _this->_param->nResultSize);
|
||||
strncpy(_this->_param->szResult, strUtf8.c_str(), _this->_param->nResultSize-1);
|
||||
|
||||
::EndDialog(hDlg, buttonId);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
std::string CWin32InputBox::AnsiToUtf8(std::string strAnsi)
|
||||
{
|
||||
std::string ret;
|
||||
if (strAnsi.length() > 0)
|
||||
{
|
||||
int nWideStrLength = MultiByteToWideChar(CP_ACP, 0, strAnsi.c_str(), -1, nullptr, 0);
|
||||
WCHAR* pwszBuf = (WCHAR*)malloc((nWideStrLength+1)*sizeof(WCHAR));
|
||||
memset(pwszBuf, 0, (nWideStrLength+1)*sizeof(WCHAR));
|
||||
MultiByteToWideChar(CP_ACP, 0, strAnsi.c_str(), -1, pwszBuf, (nWideStrLength+1)*sizeof(WCHAR));
|
||||
|
||||
int nUtf8Length = WideCharToMultiByte( CP_UTF8,0,pwszBuf,-1,nullptr,0,nullptr,FALSE );
|
||||
char* pszUtf8Buf = (char*)malloc((nUtf8Length+1)*sizeof(char));
|
||||
memset(pszUtf8Buf, 0, (nUtf8Length+1)*sizeof(char));
|
||||
|
||||
WideCharToMultiByte(CP_UTF8, 0, pwszBuf, -1, pszUtf8Buf, (nUtf8Length+1)*sizeof(char), nullptr, FALSE);
|
||||
ret = pszUtf8Buf;
|
||||
|
||||
free(pszUtf8Buf);
|
||||
free(pwszBuf);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::string CWin32InputBox::Utf8ToAnsi(std::string strUTF8)
|
||||
{
|
||||
std::string ret;
|
||||
if (strUTF8.length() > 0)
|
||||
{
|
||||
int nWideStrLength = MultiByteToWideChar(CP_UTF8, 0, strUTF8.c_str(), -1, nullptr, 0);
|
||||
WCHAR* pwszBuf = (WCHAR*)malloc((nWideStrLength+1)*sizeof(WCHAR));
|
||||
memset(pwszBuf, 0, (nWideStrLength+1)*sizeof(WCHAR));
|
||||
MultiByteToWideChar(CP_UTF8, 0, strUTF8.c_str(), -1, pwszBuf, (nWideStrLength+1)*sizeof(WCHAR));
|
||||
|
||||
int nAnsiStrLength = WideCharToMultiByte( CP_ACP,0,pwszBuf,-1,nullptr,0,nullptr,FALSE );
|
||||
char* pszAnsiBuf = (char*)malloc((nAnsiStrLength+1)*sizeof(char));
|
||||
memset(pszAnsiBuf, 0, (nAnsiStrLength+1)*sizeof(char));
|
||||
|
||||
WideCharToMultiByte(CP_ACP, 0, pwszBuf, -1, pszAnsiBuf, (nAnsiStrLength+1)*sizeof(char), nullptr, FALSE);
|
||||
ret = pszAnsiBuf;
|
||||
|
||||
free(pszAnsiBuf);
|
||||
free(pwszBuf);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif /* #if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) */
|
|
@ -0,0 +1,106 @@
|
|||
#ifndef __03022006__WIN32INPUTBOX__
|
||||
#define __03022006__WIN32INPUTBOX__
|
||||
|
||||
#include "cocos2d.h"
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
||||
/*
|
||||
|
||||
This library is (c) Elias Bachaalany aka lallous <lallousx86@yahoo.com>
|
||||
You may use this library under the following license agreement:
|
||||
|
||||
The zlib/libpng License.
|
||||
---------------------------
|
||||
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose, including commercial applications,
|
||||
and to alter it and redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented;
|
||||
you must not claim that you wrote the original software.
|
||||
If you use this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such,
|
||||
and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
|
||||
class CWin32InputBox;
|
||||
|
||||
// Structure used to orient the inputbox behavior
|
||||
struct WIN32INPUTBOX_PARAM
|
||||
{
|
||||
friend class CWin32InputBox;
|
||||
|
||||
//
|
||||
IN OPTIONAL bool bMultiline;
|
||||
|
||||
// Pass this as none zero so to use this memory dlg template
|
||||
IN OPTIONAL LPVOID DlgTemplateData;
|
||||
|
||||
// Pass this as none ZERO so to load DLGTEMPLATE from resources
|
||||
IN OPTIONAL LPCSTR DlgTemplateName;
|
||||
|
||||
// passing both "DlgTemplateName" and "DlgTemplateData" ZERO will cause
|
||||
// the dialog to use his default embedded resource
|
||||
|
||||
// Center on monitor or owner window?
|
||||
IN OPTIONAL bool bCenter;
|
||||
|
||||
// Want to add more styles to the dialog?
|
||||
IN OPTIONAL DWORD dwStylesPlus, dwStylesMinus;
|
||||
IN OPTIONAL DWORD dwExStylesPlus, dwExStylesMinus;
|
||||
|
||||
IN LPCSTR szTitle, szPrompt;
|
||||
|
||||
// Return buffer
|
||||
OUT LPSTR szResult;
|
||||
IN DWORD nResultSize;
|
||||
|
||||
// Owner window
|
||||
HWND hwndOwner;
|
||||
HINSTANCE hInstance;
|
||||
|
||||
short xPos, yPos;
|
||||
|
||||
WIN32INPUTBOX_PARAM();
|
||||
private:
|
||||
HWND hDlg;
|
||||
};
|
||||
|
||||
class CWin32InputBox
|
||||
{
|
||||
private:
|
||||
WIN32INPUTBOX_PARAM *_param;
|
||||
static LRESULT CALLBACK DlgProc(HWND, UINT, WPARAM, LPARAM);
|
||||
HWND _hwndEditCtrl;
|
||||
|
||||
void InitDialog();
|
||||
void SetParam(WIN32INPUTBOX_PARAM *);
|
||||
WIN32INPUTBOX_PARAM * GetParam();
|
||||
|
||||
public:
|
||||
|
||||
CWin32InputBox(WIN32INPUTBOX_PARAM *);
|
||||
~CWin32InputBox();
|
||||
|
||||
static INT_PTR InputBoxEx(WIN32INPUTBOX_PARAM *);
|
||||
static INT_PTR InputBox(
|
||||
LPCSTR szTitle,
|
||||
LPCSTR szPrompt,
|
||||
LPSTR szResult,
|
||||
DWORD nResultSize,
|
||||
bool bMultiLine = false,
|
||||
HWND hwndParent = 0);
|
||||
|
||||
static std::string AnsiToUtf8(std::string strAnsi);
|
||||
static std::string Utf8ToAnsi(std::string strUTF8);
|
||||
};
|
||||
|
||||
#endif /* (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) */
|
||||
|
||||
#endif
|
|
@ -0,0 +1,171 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\CocosGUI.h" />
|
||||
<ClInclude Include="..\GUIExport.h" />
|
||||
<ClInclude Include="..\UIButton.h" />
|
||||
<ClInclude Include="..\UICheckBox.h" />
|
||||
<ClInclude Include="..\UIDeprecated.h" />
|
||||
<ClInclude Include="..\UIEditBox\UIEditBox.h" />
|
||||
<ClInclude Include="..\UIEditBox\UIEditBoxImpl.h" />
|
||||
<ClInclude Include="..\UIEditBox\UIEditBoxImplWin.h" />
|
||||
<ClInclude Include="..\UIHBox.h" />
|
||||
<ClInclude Include="..\UIHelper.h" />
|
||||
<ClInclude Include="..\UIImageView.h" />
|
||||
<ClInclude Include="..\UILayout.h" />
|
||||
<ClInclude Include="..\UILayoutManager.h" />
|
||||
<ClInclude Include="..\UILayoutParameter.h" />
|
||||
<ClInclude Include="..\UIListView.h" />
|
||||
<ClInclude Include="..\UILoadingBar.h" />
|
||||
<ClInclude Include="..\UIPageView.h" />
|
||||
<ClInclude Include="..\UIRelativeBox.h" />
|
||||
<ClInclude Include="..\UIRichText.h" />
|
||||
<ClInclude Include="..\UIScale9Sprite.h" />
|
||||
<ClInclude Include="..\UIScrollView.h" />
|
||||
<ClInclude Include="..\UISlider.h" />
|
||||
<ClInclude Include="..\UIText.h" />
|
||||
<ClInclude Include="..\UITextAtlas.h" />
|
||||
<ClInclude Include="..\UITextBMFont.h" />
|
||||
<ClInclude Include="..\UITextField.h" />
|
||||
<ClInclude Include="..\UIVBox.h" />
|
||||
<ClInclude Include="..\UIWidget.h" />
|
||||
<ClInclude Include="Win32InputBox.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\CocosGUI.cpp" />
|
||||
<ClCompile Include="..\UIButton.cpp" />
|
||||
<ClCompile Include="..\UICheckBox.cpp" />
|
||||
<ClCompile Include="..\UIDeprecated.cpp" />
|
||||
<ClCompile Include="..\UIEditBox\UIEditBox.cpp" />
|
||||
<ClCompile Include="..\UIEditBox\UIEditBoxImplWin.cpp" />
|
||||
<ClCompile Include="..\UIHBox.cpp" />
|
||||
<ClCompile Include="..\UIHelper.cpp" />
|
||||
<ClCompile Include="..\UIImageView.cpp" />
|
||||
<ClCompile Include="..\UILayout.cpp" />
|
||||
<ClCompile Include="..\UILayoutManager.cpp" />
|
||||
<ClCompile Include="..\UILayoutParameter.cpp" />
|
||||
<ClCompile Include="..\UIListView.cpp" />
|
||||
<ClCompile Include="..\UILoadingBar.cpp" />
|
||||
<ClCompile Include="..\UIPageView.cpp" />
|
||||
<ClCompile Include="..\UIRelativeBox.cpp" />
|
||||
<ClCompile Include="..\UIRichText.cpp" />
|
||||
<ClCompile Include="..\UIScale9Sprite.cpp" />
|
||||
<ClCompile Include="..\UIScrollView.cpp" />
|
||||
<ClCompile Include="..\UISlider.cpp" />
|
||||
<ClCompile Include="..\UIText.cpp" />
|
||||
<ClCompile Include="..\UITextAtlas.cpp" />
|
||||
<ClCompile Include="..\UITextBMFont.cpp" />
|
||||
<ClCompile Include="..\UITextField.cpp" />
|
||||
<ClCompile Include="..\UIVBox.cpp" />
|
||||
<ClCompile Include="..\UIWidget.cpp" />
|
||||
<ClCompile Include="Win32InputBox.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\extensions\proj.win32\libextension.vcxproj">
|
||||
<Project>{21b2c324-891f-48ea-ad1a-5ae13de12e28}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\2d\libcocos2d.vcxproj">
|
||||
<Project>{98a51ba8-fc3a-415b-ac8f-8c7bd464e93e}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{7E06E92C-537A-442B-9E4A-4761C84F8A1A}</ProjectGuid>
|
||||
<RootNamespace>libui</RootNamespace>
|
||||
<ProjectName>libui</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v120_xp</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v120_xp</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\2d\cocos2d_headers.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\2d\cocos2d_headers.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>$(SolutionDir)$(Configuration).win32\</OutDir>
|
||||
<IntDir>$(Configuration).win32\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>$(SolutionDir)$(Configuration).win32\</OutDir>
|
||||
<IntDir>$(Configuration).win32\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>
|
||||
</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support;$(EngineRoot)external;$(EngineRoot)extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_USEGUIDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<DisableSpecificWarnings>4267;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>opengl32.lib;glew32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>
|
||||
</SDLCheck>
|
||||
<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>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>opengl32.lib;glew32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -0,0 +1,195 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="BaseClasses">
|
||||
<UniqueIdentifier>{e31ab7d3-b8b2-467f-9e08-fd5fe168b491}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Layouts">
|
||||
<UniqueIdentifier>{f9d13563-9e5e-4b35-b0e7-d41f587efa42}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="System">
|
||||
<UniqueIdentifier>{ed8a2ae0-5690-4d0d-829b-7c07164c0597}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="UIWidgets">
|
||||
<UniqueIdentifier>{5f6e9e52-fbe7-4073-ac71-98632f9e6781}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="UIWidgets\ScrollWidget">
|
||||
<UniqueIdentifier>{b59b178a-b7e0-4826-ba07-44c46cd29a10}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="UIWidgets\UIEditBox">
|
||||
<UniqueIdentifier>{08fb4468-821b-4e5c-9298-8b57a3152a5b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\UIScrollView.h">
|
||||
<Filter>UIWidgets\ScrollWidget</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\UIListView.h">
|
||||
<Filter>UIWidgets\ScrollWidget</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\UIPageView.h">
|
||||
<Filter>UIWidgets\ScrollWidget</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\UIButton.h">
|
||||
<Filter>UIWidgets</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\UICheckBox.h">
|
||||
<Filter>UIWidgets</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\UIImageView.h">
|
||||
<Filter>UIWidgets</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\UISlider.h">
|
||||
<Filter>UIWidgets</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\UITextField.h">
|
||||
<Filter>UIWidgets</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\UILoadingBar.h">
|
||||
<Filter>UIWidgets</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\UIHelper.h">
|
||||
<Filter>System</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\CocosGUI.h">
|
||||
<Filter>System</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\UIWidget.h">
|
||||
<Filter>BaseClasses</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\UILayout.h">
|
||||
<Filter>Layouts</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\UILayoutParameter.h">
|
||||
<Filter>Layouts</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\UITextBMFont.h">
|
||||
<Filter>UIWidgets</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\UIText.h">
|
||||
<Filter>UIWidgets</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\UITextAtlas.h">
|
||||
<Filter>UIWidgets</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\UIRichText.h">
|
||||
<Filter>UIWidgets</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\UIHBox.h">
|
||||
<Filter>Layouts</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\UIRelativeBox.h">
|
||||
<Filter>Layouts</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\UIVBox.h">
|
||||
<Filter>Layouts</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\UILayoutManager.h">
|
||||
<Filter>Layouts</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\UIDeprecated.h">
|
||||
<Filter>System</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\GUIExport.h">
|
||||
<Filter>System</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\UIScale9Sprite.h">
|
||||
<Filter>BaseClasses</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\UIEditBox\UIEditBox.h">
|
||||
<Filter>UIWidgets\UIEditBox</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\UIEditBox\UIEditBoxImpl.h">
|
||||
<Filter>UIWidgets\UIEditBox</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\UIEditBox\UIEditBoxImplWin.h">
|
||||
<Filter>UIWidgets\UIEditBox</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Win32InputBox.h">
|
||||
<Filter>UIWidgets\UIEditBox</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\UIScrollView.cpp">
|
||||
<Filter>UIWidgets\ScrollWidget</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\UIListView.cpp">
|
||||
<Filter>UIWidgets\ScrollWidget</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\UIPageView.cpp">
|
||||
<Filter>UIWidgets\ScrollWidget</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\UIButton.cpp">
|
||||
<Filter>UIWidgets</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\UICheckBox.cpp">
|
||||
<Filter>UIWidgets</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\UIImageView.cpp">
|
||||
<Filter>UIWidgets</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\UISlider.cpp">
|
||||
<Filter>UIWidgets</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\UITextField.cpp">
|
||||
<Filter>UIWidgets</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\UILoadingBar.cpp">
|
||||
<Filter>UIWidgets</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\UIHelper.cpp">
|
||||
<Filter>System</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\CocosGUI.cpp">
|
||||
<Filter>System</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\UIWidget.cpp">
|
||||
<Filter>BaseClasses</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\UILayout.cpp">
|
||||
<Filter>Layouts</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\UILayoutParameter.cpp">
|
||||
<Filter>Layouts</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\UITextBMFont.cpp">
|
||||
<Filter>UIWidgets</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\UIText.cpp">
|
||||
<Filter>UIWidgets</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\UITextAtlas.cpp">
|
||||
<Filter>UIWidgets</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\UIRichText.cpp">
|
||||
<Filter>UIWidgets</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\UIHBox.cpp">
|
||||
<Filter>Layouts</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\UIRelativeBox.cpp">
|
||||
<Filter>Layouts</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\UIVBox.cpp">
|
||||
<Filter>Layouts</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\UILayoutManager.cpp">
|
||||
<Filter>Layouts</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\UIDeprecated.cpp">
|
||||
<Filter>System</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\UIScale9Sprite.cpp">
|
||||
<Filter>BaseClasses</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\UIEditBox\UIEditBox.cpp">
|
||||
<Filter>UIWidgets\UIEditBox</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\UIEditBox\UIEditBoxImplWin.cpp">
|
||||
<Filter>UIWidgets\UIEditBox</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Win32InputBox.cpp">
|
||||
<Filter>UIWidgets\UIEditBox</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -184,6 +184,9 @@
|
|||
<ClInclude Include="..\..\ui\UIVBox.h" />
|
||||
<ClInclude Include="..\..\ui\UIWidget.h" />
|
||||
<ClInclude Include="..\UIDeprecated.h" />
|
||||
<ClInclude Include="..\UIEditBox\UIEditBox.h" />
|
||||
<ClInclude Include="..\UIEditBox\UIEditBoxImpl.h" />
|
||||
<ClInclude Include="..\UIEditBox\UIEditBoxImplWp8.h" />
|
||||
<ClInclude Include="..\UIHBox.h" />
|
||||
<ClInclude Include="..\UILayoutManager.h" />
|
||||
<ClInclude Include="..\UIRelativeBox.h" />
|
||||
|
@ -210,6 +213,8 @@
|
|||
<ClCompile Include="..\..\ui\UIVBox.cpp" />
|
||||
<ClCompile Include="..\..\ui\UIWidget.cpp" />
|
||||
<ClCompile Include="..\UIDeprecated.cpp" />
|
||||
<ClCompile Include="..\UIEditBox\UIEditBox.cpp" />
|
||||
<ClCompile Include="..\UIEditBox\UIEditBoxImplWp8.cpp" />
|
||||
<ClCompile Include="..\UIHBox.cpp" />
|
||||
<ClCompile Include="..\UILayoutManager.cpp" />
|
||||
<ClCompile Include="..\UIRelativeBox.cpp" />
|
||||
|
|
|
@ -87,6 +87,15 @@
|
|||
<ClInclude Include="..\UIScale9Sprite.h">
|
||||
<Filter>BaseClasses</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\UIEditBox\UIEditBox.h">
|
||||
<Filter>UIWidgets</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\UIEditBox\UIEditBoxImpl.h">
|
||||
<Filter>UIWidgets</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\UIEditBox\UIEditBoxImplWp8.h">
|
||||
<Filter>UIWidgets</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\ui\UILayout.cpp">
|
||||
|
@ -161,5 +170,11 @@
|
|||
<ClCompile Include="..\UIScale9Sprite.cpp">
|
||||
<Filter>BaseClasses</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\UIEditBox\UIEditBox.cpp">
|
||||
<Filter>UIWidgets</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\UIEditBox\UIEditBoxImplWp8.cpp">
|
||||
<Filter>UIWidgets</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -18,11 +18,6 @@ GUI/CCControlExtension/CCControlStepper.cpp \
|
|||
GUI/CCControlExtension/CCControlSwitch.cpp \
|
||||
GUI/CCControlExtension/CCControlUtils.cpp \
|
||||
GUI/CCControlExtension/CCInvocation.cpp \
|
||||
GUI/CCControlExtension/CCScale9Sprite.cpp \
|
||||
GUI/CCEditBox/CCEditBox.cpp \
|
||||
GUI/CCEditBox/CCEditBoxImplAndroid.cpp \
|
||||
GUI/CCEditBox/CCEditBoxImplNone.cpp \
|
||||
GUI/CCEditBox/CCEditBoxImplWin.cpp \
|
||||
GUI/CCScrollView/CCScrollView.cpp \
|
||||
GUI/CCScrollView/CCTableView.cpp \
|
||||
GUI/CCScrollView/CCTableViewCell.cpp \
|
||||
|
@ -33,6 +28,10 @@ LOCAL_STATIC_LIBRARIES := cocos2dx_internal_static
|
|||
LOCAL_STATIC_LIBRARIES += cocos_curl_static
|
||||
LOCAL_STATIC_LIBRARIES += box2d_static
|
||||
|
||||
GU/CCEditBox/CCEditBox.cpp \
|
||||
GUI/CCEditBox/CCEditBoxImplAndroid.cpp \
|
||||
GUI/CCEditBox/CCEditBoxImplNone.cpp \
|
||||
GUI/CCEditBox/CCEditBoxImplWin.cpp \
|
||||
LOCAL_CXXFLAGS += -fexceptions
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/.. \
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
set(EXTENSIONS_SRC
|
||||
assets-manager/AssetsManager.cpp
|
||||
GUI/CCControlExtension/CCControl.cpp
|
||||
GUI/CCControlExtension/CCControlButton.cpp
|
||||
GUI/CCControlExtension/CCControlColourPicker.cpp
|
||||
GUI/CCControlExtension/CCControlHuePicker.cpp
|
||||
GUI/CCControlExtension/CCControlPotentiometer.cpp
|
||||
GUI/CCControlExtension/CCControlSaturationBrightnessPicker.cpp
|
||||
GUI/CCControlExtension/CCControlSlider.cpp
|
||||
GUI/CCControlExtension/CCControlStepper.cpp
|
||||
GUI/CCControlExtension/CCControlSwitch.cpp
|
||||
GUI/CCControlExtension/CCControlUtils.cpp
|
||||
GUI/CCControlExtension/CCInvocation.cpp
|
||||
GUI/CCControlExtension/CCScale9Sprite.cpp
|
||||
GUI/CCEditBox/CCEditBox.cpp
|
||||
GUI/CCEditBox/CCEditBoxImplAndroid.cpp
|
||||
GUI/CCEditBox/CCEditBoxImplNone.cpp
|
||||
GUI/CCEditBox/CCEditBoxImplWin.cpp
|
||||
GUI/CCScrollView/CCScrollView.cpp
|
||||
GUI/CCScrollView/CCTableView.cpp
|
||||
GUI/CCScrollView/CCTableViewCell.cpp
|
||||
physics-nodes/CCPhysicsDebugNode.cpp
|
||||
physics-nodes/CCPhysicsSprite.cpp
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
ADD_DEFINITIONS(-DUNICODE -D_UNICODE)
|
||||
|
||||
set(PLATFORM_EXTENSIONS_SRC
|
||||
proj.win32/Win32InputBox.cpp
|
||||
)
|
||||
elseif(APPLE)
|
||||
|
||||
else()
|
||||
|
||||
endif()
|
||||
|
||||
include_directories(
|
||||
..
|
||||
)
|
||||
|
||||
add_library(extensions STATIC
|
||||
${EXTENSIONS_SRC}
|
||||
${PLATFORM_EXTENSIONS_SRC}
|
||||
)
|
||||
|
||||
set_target_properties(extensions
|
||||
PROPERTIES
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
||||
)
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "ExtensionDeprecated.h"
|
|
@ -0,0 +1,39 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __cocos2d_libs__ExtensionDeprecated__
|
||||
#define __cocos2d_libs__ExtensionDeprecated__
|
||||
|
||||
#include "ui/UIEditBox/UIEditBox.h"
|
||||
#include "ExtensionMacros.h"
|
||||
|
||||
NS_CC_EXT_BEGIN
|
||||
|
||||
CC_DEPRECATED_ATTRIBUTE typedef ui::EditBox EditBox;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef ui::EditBoxDelegate EditBoxDelegate;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef ui::Scale9Sprite Scale9Sprite;
|
||||
|
||||
NS_CC_EXT_END
|
||||
|
||||
#endif /* defined(__cocos2d_libs__ExtensionDeprecated__) */
|
|
@ -26,7 +26,6 @@
|
|||
*/
|
||||
|
||||
#include "CCControlButton.h"
|
||||
#include "CCScale9Sprite.h"
|
||||
#include "2d/CCLabel.h"
|
||||
#include "2d/CCAction.h"
|
||||
#include "2d/CCActionInterval.h"
|
||||
|
@ -64,10 +63,10 @@ ControlButton::~ControlButton()
|
|||
|
||||
bool ControlButton::init()
|
||||
{
|
||||
return this->initWithLabelAndBackgroundSprite(Label::createWithSystemFont("", "Helvetica", 12), Scale9Sprite::create());
|
||||
return this->initWithLabelAndBackgroundSprite(Label::createWithSystemFont("", "Helvetica", 12), cocos2d::ui::Scale9Sprite::create());
|
||||
}
|
||||
|
||||
bool ControlButton::initWithLabelAndBackgroundSprite(Node* node, Scale9Sprite* backgroundSprite)
|
||||
bool ControlButton::initWithLabelAndBackgroundSprite(Node* node, ui::Scale9Sprite* backgroundSprite)
|
||||
{
|
||||
if (Control::init())
|
||||
{
|
||||
|
@ -121,7 +120,7 @@ bool ControlButton::initWithLabelAndBackgroundSprite(Node* node, Scale9Sprite* b
|
|||
}
|
||||
}
|
||||
|
||||
ControlButton* ControlButton::create(Node* label, Scale9Sprite* backgroundSprite)
|
||||
ControlButton* ControlButton::create(Node* label, cocos2d::ui::Scale9Sprite* backgroundSprite)
|
||||
{
|
||||
ControlButton *pRet = new (std::nothrow) ControlButton();
|
||||
pRet->initWithLabelAndBackgroundSprite(label, backgroundSprite);
|
||||
|
@ -131,7 +130,7 @@ ControlButton* ControlButton::create(Node* label, Scale9Sprite* backgroundSprite
|
|||
|
||||
bool ControlButton::initWithTitleAndFontNameAndFontSize(const std::string& title, const std::string& fontName, float fontSize)
|
||||
{
|
||||
return initWithLabelAndBackgroundSprite(Label::createWithSystemFont(title, fontName, fontSize), Scale9Sprite::create());
|
||||
return initWithLabelAndBackgroundSprite(Label::createWithSystemFont(title, fontName, fontSize), cocos2d::ui::Scale9Sprite::create());
|
||||
}
|
||||
|
||||
ControlButton* ControlButton::create(const std::string& title, const std::string& fontName, float fontSize)
|
||||
|
@ -142,13 +141,13 @@ ControlButton* ControlButton::create(const std::string& title, const std::string
|
|||
return pRet;
|
||||
}
|
||||
|
||||
bool ControlButton::initWithBackgroundSprite(Scale9Sprite* sprite)
|
||||
bool ControlButton::initWithBackgroundSprite(cocos2d::ui::Scale9Sprite* sprite)
|
||||
{
|
||||
Label *label = Label::createWithSystemFont("", "Arial", 30);//
|
||||
return initWithLabelAndBackgroundSprite(label, sprite);
|
||||
}
|
||||
|
||||
ControlButton* ControlButton::create(Scale9Sprite* sprite)
|
||||
ControlButton* ControlButton::create(cocos2d::ui::Scale9Sprite* sprite)
|
||||
{
|
||||
ControlButton *pRet = new (std::nothrow) ControlButton();
|
||||
pRet->initWithBackgroundSprite(sprite);
|
||||
|
@ -423,7 +422,7 @@ const std::string& ControlButton::getTitleBMFontForState(State state)
|
|||
}
|
||||
|
||||
|
||||
Scale9Sprite* ControlButton::getBackgroundSpriteForState(State state)
|
||||
ui::Scale9Sprite* ControlButton::getBackgroundSpriteForState(State state)
|
||||
{
|
||||
auto backgroundSprite = _backgroundSpriteDispatchTable.at((int)state);
|
||||
if (backgroundSprite)
|
||||
|
@ -434,7 +433,7 @@ Scale9Sprite* ControlButton::getBackgroundSpriteForState(State state)
|
|||
}
|
||||
|
||||
|
||||
void ControlButton::setBackgroundSpriteForState(Scale9Sprite* sprite, State state)
|
||||
void ControlButton::setBackgroundSpriteForState(ui::Scale9Sprite* sprite, State state)
|
||||
{
|
||||
Size oldPreferredSize = _preferredSize;
|
||||
|
||||
|
@ -470,7 +469,7 @@ void ControlButton::setBackgroundSpriteForState(Scale9Sprite* sprite, State stat
|
|||
|
||||
void ControlButton::setBackgroundSpriteFrameForState(SpriteFrame * spriteFrame, State state)
|
||||
{
|
||||
Scale9Sprite * sprite = Scale9Sprite::createWithSpriteFrame(spriteFrame);
|
||||
ui::Scale9Sprite * sprite = ui::Scale9Sprite::createWithSpriteFrame(spriteFrame);
|
||||
this->setBackgroundSpriteForState(sprite, state);
|
||||
}
|
||||
|
||||
|
|
|
@ -32,9 +32,8 @@
|
|||
|
||||
#include "CCControl.h"
|
||||
#include "CCInvocation.h"
|
||||
#include "CCScale9Sprite.h"
|
||||
#include "base/CCMap.h"
|
||||
#include "extensions/ExtensionExport.h"
|
||||
#include "ui/UIScale9Sprite.h"
|
||||
|
||||
NS_CC_EXT_BEGIN
|
||||
|
||||
|
@ -56,8 +55,8 @@ class CC_EX_DLL ControlButton : public Control
|
|||
{
|
||||
public:
|
||||
static ControlButton* create();
|
||||
static ControlButton* create(Scale9Sprite* sprite);
|
||||
static ControlButton* create(Node* label, Scale9Sprite* backgroundSprite);
|
||||
static ControlButton* create(cocos2d::ui::Scale9Sprite* sprite);
|
||||
static ControlButton* create(Node* label, cocos2d::ui::Scale9Sprite* backgroundSprite);
|
||||
static ControlButton* create(const std::string& title, const std::string& fontName, float fontSize);
|
||||
|
||||
virtual void needsLayout(void);
|
||||
|
@ -149,7 +148,7 @@ public:
|
|||
* @param state The state that uses the background sprite. Possible values are
|
||||
* described in "CCControlState".
|
||||
*/
|
||||
virtual Scale9Sprite* getBackgroundSpriteForState(State state);
|
||||
virtual cocos2d::ui::Scale9Sprite* getBackgroundSpriteForState(State state);
|
||||
|
||||
/**
|
||||
* Sets the background sprite to use for the specified button state.
|
||||
|
@ -158,7 +157,7 @@ public:
|
|||
* @param state The state that uses the specified image. The values are described
|
||||
* in "CCControlState".
|
||||
*/
|
||||
virtual void setBackgroundSpriteForState(Scale9Sprite* sprite, State state);
|
||||
virtual void setBackgroundSpriteForState(cocos2d::ui::Scale9Sprite* sprite, State state);
|
||||
|
||||
/**
|
||||
* Sets the background spriteFrame to use for the specified button state.
|
||||
|
@ -203,8 +202,8 @@ CC_CONSTRUCTOR_ACCESS:
|
|||
virtual ~ControlButton();
|
||||
|
||||
virtual bool init() override;
|
||||
virtual bool initWithLabelAndBackgroundSprite(Node* label, Scale9Sprite* backgroundSprite);
|
||||
virtual bool initWithBackgroundSprite(Scale9Sprite* sprite);
|
||||
virtual bool initWithLabelAndBackgroundSprite(Node* label, cocos2d::ui::Scale9Sprite* backgroundSprite);
|
||||
virtual bool initWithBackgroundSprite(cocos2d::ui::Scale9Sprite* sprite);
|
||||
virtual bool initWithTitleAndFontNameAndFontSize(const std::string& title, const std::string& fontName, float fontSize);
|
||||
|
||||
protected:
|
||||
|
@ -222,7 +221,7 @@ protected:
|
|||
CC_SYNTHESIZE_RETAIN(Node*, _titleLabel, TitleLabel);
|
||||
|
||||
/** The current background sprite. */
|
||||
CC_SYNTHESIZE_RETAIN(Scale9Sprite*, _backgroundSprite, BackgroundSprite);
|
||||
CC_SYNTHESIZE_RETAIN(cocos2d::ui::Scale9Sprite*, _backgroundSprite, BackgroundSprite);
|
||||
|
||||
/** The prefered size of the button, if label is larger it will be expanded. */
|
||||
CC_PROPERTY_PASS_BY_REF(Size, _preferredSize, PreferredSize);
|
||||
|
@ -238,7 +237,7 @@ protected:
|
|||
std::unordered_map<int, Color3B> _titleColorDispatchTable;
|
||||
|
||||
Map<int, Node*> _titleLabelDispatchTable;
|
||||
Map<int, Scale9Sprite*> _backgroundSpriteDispatchTable;
|
||||
Map<int, cocos2d::ui::Scale9Sprite*> _backgroundSpriteDispatchTable;
|
||||
|
||||
/* Define the button margin for Top/Bottom edge */
|
||||
CC_SYNTHESIZE_READONLY(int, _marginV, VerticalMargin);
|
||||
|
|
|
@ -25,7 +25,6 @@ THE SOFTWARE.
|
|||
#ifndef __CCCONTROL_EXTENSIONS_H__
|
||||
#define __CCCONTROL_EXTENSIONS_H__
|
||||
|
||||
#include "CCScale9Sprite.h"
|
||||
#include "CCControl.h"
|
||||
#include "CCControlButton.h"
|
||||
#include "CCControlColourPicker.h"
|
||||
|
|
|
@ -1,816 +0,0 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2012 cocos2d-x.org
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Created by Jung Sang-Taik on 12. 3. 16..
|
||||
Copyright (c) 2012 Neofect. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "CCScale9Sprite.h"
|
||||
#include "base/CCPlatformMacros.h"
|
||||
#include "2d/CCSprite.h"
|
||||
#include "2d/CCSpriteFrameCache.h"
|
||||
|
||||
NS_CC_EXT_BEGIN
|
||||
|
||||
Scale9Sprite::Scale9Sprite()
|
||||
: _spritesGenerated(false)
|
||||
, _spriteFrameRotated(false)
|
||||
, _positionsAreDirty(false)
|
||||
, _scale9Image(nullptr)
|
||||
, _topLeft(nullptr)
|
||||
, _top(nullptr)
|
||||
, _topRight(nullptr)
|
||||
, _left(nullptr)
|
||||
, _centre(nullptr)
|
||||
, _right(nullptr)
|
||||
, _bottomLeft(nullptr)
|
||||
, _bottom(nullptr)
|
||||
, _bottomRight(nullptr)
|
||||
, _opacityModifyRGB(false)
|
||||
, _insetLeft(0)
|
||||
, _insetTop(0)
|
||||
, _insetRight(0)
|
||||
, _insetBottom(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Scale9Sprite::~Scale9Sprite()
|
||||
{
|
||||
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);
|
||||
CC_SAFE_RELEASE(_scale9Image);
|
||||
}
|
||||
|
||||
bool Scale9Sprite::init()
|
||||
{
|
||||
return this->initWithBatchNode(nullptr, Rect::ZERO, Rect::ZERO);
|
||||
}
|
||||
|
||||
bool Scale9Sprite::initWithBatchNode(SpriteBatchNode* batchnode, const Rect& rect, const Rect& capInsets)
|
||||
{
|
||||
return this->initWithBatchNode(batchnode, rect, false, capInsets);
|
||||
}
|
||||
|
||||
bool Scale9Sprite::initWithBatchNode(SpriteBatchNode* batchnode, const Rect& rect, bool rotated, const Rect& capInsets)
|
||||
{
|
||||
if(batchnode)
|
||||
{
|
||||
this->updateWithBatchNode(batchnode, rect, rotated, capInsets);
|
||||
}
|
||||
this->setCascadeColorEnabled(true);
|
||||
this->setCascadeOpacityEnabled(true);
|
||||
this->setAnchorPoint(Vec2(0.5f, 0.5f));
|
||||
this->_positionsAreDirty = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#define TRANSLATE_X(x, y, xtranslate) \
|
||||
x+=xtranslate; \
|
||||
|
||||
#define TRANSLATE_Y(x, y, ytranslate) \
|
||||
y+=ytranslate; \
|
||||
|
||||
bool Scale9Sprite::updateWithBatchNode(SpriteBatchNode* batchnode, const Rect& originalRect, bool rotated, const Rect& capInsets)
|
||||
{
|
||||
GLubyte opacity = getOpacity();
|
||||
Color3B color = getColor();
|
||||
Rect rect(originalRect);
|
||||
|
||||
// Release old sprites
|
||||
this->removeAllChildrenWithCleanup(true);
|
||||
|
||||
CC_SAFE_RELEASE(this->_centre);
|
||||
CC_SAFE_RELEASE(this->_top);
|
||||
CC_SAFE_RELEASE(this->_topLeft);
|
||||
CC_SAFE_RELEASE(this->_topRight);
|
||||
CC_SAFE_RELEASE(this->_left);
|
||||
CC_SAFE_RELEASE(this->_right);
|
||||
CC_SAFE_RELEASE(this->_bottomLeft);
|
||||
CC_SAFE_RELEASE(this->_bottom);
|
||||
CC_SAFE_RELEASE(this->_bottomRight);
|
||||
|
||||
|
||||
if(this->_scale9Image != batchnode)
|
||||
{
|
||||
CC_SAFE_RELEASE(this->_scale9Image);
|
||||
_scale9Image = batchnode;
|
||||
CC_SAFE_RETAIN(_scale9Image);
|
||||
}
|
||||
|
||||
if (!_scale9Image)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
_capInsets = capInsets;
|
||||
_spriteFrameRotated = rotated;
|
||||
|
||||
// If there is no given rect
|
||||
if ( rect.equals(Rect::ZERO) )
|
||||
{
|
||||
// Get the texture size as original
|
||||
Size textureSize = _scale9Image->getTextureAtlas()->getTexture()->getContentSize();
|
||||
|
||||
rect = Rect(0, 0, textureSize.width, textureSize.height);
|
||||
}
|
||||
|
||||
// Set the given rect's size as original size
|
||||
_spriteRect = rect;
|
||||
_originalSize = rect.size;
|
||||
_preferredSize = _originalSize;
|
||||
_capInsetsInternal = capInsets;
|
||||
|
||||
float w = rect.size.width;
|
||||
float h = rect.size.height;
|
||||
|
||||
// If there is no specified center region
|
||||
if ( _capInsetsInternal.equals(Rect::ZERO) )
|
||||
{
|
||||
// log("... cap insets not specified : using default cap insets ...");
|
||||
_capInsetsInternal = Rect(w/3, h/3, w/3, h/3);
|
||||
}
|
||||
|
||||
float left_w = _capInsetsInternal.origin.x;
|
||||
float center_w = _capInsetsInternal.size.width;
|
||||
float right_w = rect.size.width - (left_w + center_w);
|
||||
|
||||
float top_h = _capInsetsInternal.origin.y;
|
||||
float center_h = _capInsetsInternal.size.height;
|
||||
float bottom_h = rect.size.height - (top_h + center_h);
|
||||
|
||||
// calculate rects
|
||||
|
||||
// ... top row
|
||||
float x = 0.0;
|
||||
float y = 0.0;
|
||||
|
||||
// top left
|
||||
Rect lefttopbounds = Rect(x, y, left_w, top_h);
|
||||
|
||||
// top center
|
||||
TRANSLATE_X(x, y, left_w);
|
||||
Rect centertopbounds = Rect(x, y, center_w, top_h);
|
||||
|
||||
// top right
|
||||
TRANSLATE_X(x, y, center_w);
|
||||
Rect righttopbounds = Rect(x, y, right_w, top_h);
|
||||
|
||||
// ... center row
|
||||
x = 0.0;
|
||||
y = 0.0;
|
||||
TRANSLATE_Y(x, y, top_h);
|
||||
|
||||
// center left
|
||||
Rect leftcenterbounds = Rect(x, y, left_w, center_h);
|
||||
|
||||
// center center
|
||||
TRANSLATE_X(x, y, left_w);
|
||||
Rect centerbounds = Rect(x, y, center_w, center_h);
|
||||
|
||||
// center right
|
||||
TRANSLATE_X(x, y, center_w);
|
||||
Rect rightcenterbounds = Rect(x, y, right_w, center_h);
|
||||
|
||||
// ... bottom row
|
||||
x = 0.0;
|
||||
y = 0.0;
|
||||
TRANSLATE_Y(x, y, top_h);
|
||||
TRANSLATE_Y(x, y, center_h);
|
||||
|
||||
// bottom left
|
||||
Rect leftbottombounds = Rect(x, y, left_w, bottom_h);
|
||||
|
||||
// bottom center
|
||||
TRANSLATE_X(x, y, left_w);
|
||||
Rect centerbottombounds = Rect(x, y, center_w, bottom_h);
|
||||
|
||||
// bottom right
|
||||
TRANSLATE_X(x, y, center_w);
|
||||
Rect rightbottombounds = Rect(x, y, right_w, bottom_h);
|
||||
|
||||
if (!rotated) {
|
||||
// log("!rotated");
|
||||
|
||||
AffineTransform t = AffineTransform::IDENTITY;
|
||||
t = AffineTransformTranslate(t, rect.origin.x, rect.origin.y);
|
||||
|
||||
centerbounds = RectApplyAffineTransform(centerbounds, t);
|
||||
rightbottombounds = RectApplyAffineTransform(rightbottombounds, t);
|
||||
leftbottombounds = RectApplyAffineTransform(leftbottombounds, t);
|
||||
righttopbounds = RectApplyAffineTransform(righttopbounds, t);
|
||||
lefttopbounds = RectApplyAffineTransform(lefttopbounds, t);
|
||||
rightcenterbounds = RectApplyAffineTransform(rightcenterbounds, t);
|
||||
leftcenterbounds = RectApplyAffineTransform(leftcenterbounds, t);
|
||||
centerbottombounds = RectApplyAffineTransform(centerbottombounds, t);
|
||||
centertopbounds = RectApplyAffineTransform(centertopbounds, t);
|
||||
|
||||
// Centre
|
||||
_centre = Sprite::createWithTexture(_scale9Image->getTexture(), centerbounds);
|
||||
_centre->retain();
|
||||
this->addChild(_centre);
|
||||
|
||||
|
||||
// Top
|
||||
_top = Sprite::createWithTexture(_scale9Image->getTexture(), centertopbounds);
|
||||
_top->retain();
|
||||
this->addChild(_top);
|
||||
|
||||
// Bottom
|
||||
_bottom = Sprite::createWithTexture(_scale9Image->getTexture(), centerbottombounds);
|
||||
_bottom->retain();
|
||||
this->addChild(_bottom);
|
||||
|
||||
// Left
|
||||
_left = Sprite::createWithTexture(_scale9Image->getTexture(), leftcenterbounds);
|
||||
_left->retain();
|
||||
this->addChild(_left);
|
||||
|
||||
// Right
|
||||
_right = Sprite::createWithTexture(_scale9Image->getTexture(), rightcenterbounds);
|
||||
_right->retain();
|
||||
this->addChild(_right);
|
||||
|
||||
// Top left
|
||||
_topLeft = Sprite::createWithTexture(_scale9Image->getTexture(), lefttopbounds);
|
||||
_topLeft->retain();
|
||||
this->addChild(_topLeft);
|
||||
|
||||
// Top right
|
||||
_topRight = Sprite::createWithTexture(_scale9Image->getTexture(), righttopbounds);
|
||||
_topRight->retain();
|
||||
this->addChild(_topRight);
|
||||
|
||||
// Bottom left
|
||||
_bottomLeft = Sprite::createWithTexture(_scale9Image->getTexture(), leftbottombounds);
|
||||
_bottomLeft->retain();
|
||||
this->addChild(_bottomLeft);
|
||||
|
||||
// Bottom right
|
||||
_bottomRight = Sprite::createWithTexture(_scale9Image->getTexture(), rightbottombounds);
|
||||
_bottomRight->retain();
|
||||
this->addChild(_bottomRight);
|
||||
} else {
|
||||
// set up transformation of coordinates
|
||||
// to handle the case where the sprite is stored rotated
|
||||
// in the spritesheet
|
||||
// log("rotated");
|
||||
|
||||
AffineTransform t = AffineTransform::IDENTITY;
|
||||
|
||||
Rect rotatedcenterbounds = centerbounds;
|
||||
Rect rotatedrightbottombounds = rightbottombounds;
|
||||
Rect rotatedleftbottombounds = leftbottombounds;
|
||||
Rect rotatedrighttopbounds = righttopbounds;
|
||||
Rect rotatedlefttopbounds = lefttopbounds;
|
||||
Rect rotatedrightcenterbounds = rightcenterbounds;
|
||||
Rect rotatedleftcenterbounds = leftcenterbounds;
|
||||
Rect rotatedcenterbottombounds = centerbottombounds;
|
||||
Rect rotatedcentertopbounds = centertopbounds;
|
||||
|
||||
t = AffineTransformTranslate(t, rect.size.height+rect.origin.x, rect.origin.y);
|
||||
t = AffineTransformRotate(t, 1.57079633f);
|
||||
|
||||
centerbounds = RectApplyAffineTransform(centerbounds, t);
|
||||
rightbottombounds = RectApplyAffineTransform(rightbottombounds, t);
|
||||
leftbottombounds = RectApplyAffineTransform(leftbottombounds, t);
|
||||
righttopbounds = RectApplyAffineTransform(righttopbounds, t);
|
||||
lefttopbounds = RectApplyAffineTransform(lefttopbounds, t);
|
||||
rightcenterbounds = RectApplyAffineTransform(rightcenterbounds, t);
|
||||
leftcenterbounds = RectApplyAffineTransform(leftcenterbounds, t);
|
||||
centerbottombounds = RectApplyAffineTransform(centerbottombounds, t);
|
||||
centertopbounds = RectApplyAffineTransform(centertopbounds, t);
|
||||
|
||||
rotatedcenterbounds.origin = centerbounds.origin;
|
||||
rotatedrightbottombounds.origin = rightbottombounds.origin;
|
||||
rotatedleftbottombounds.origin = leftbottombounds.origin;
|
||||
rotatedrighttopbounds.origin = righttopbounds.origin;
|
||||
rotatedlefttopbounds.origin = lefttopbounds.origin;
|
||||
rotatedrightcenterbounds.origin = rightcenterbounds.origin;
|
||||
rotatedleftcenterbounds.origin = leftcenterbounds.origin;
|
||||
rotatedcenterbottombounds.origin = centerbottombounds.origin;
|
||||
rotatedcentertopbounds.origin = centertopbounds.origin;
|
||||
|
||||
// Centre
|
||||
_centre = Sprite::createWithTexture(_scale9Image->getTexture(), rotatedcenterbounds, true);
|
||||
_centre->retain();
|
||||
this->addChild(_centre, 0);
|
||||
|
||||
// Top
|
||||
_top = Sprite::createWithTexture(_scale9Image->getTexture(), rotatedcentertopbounds, true);
|
||||
_top->retain();
|
||||
this->addChild(_top);
|
||||
|
||||
// Bottom
|
||||
_bottom = Sprite::createWithTexture(_scale9Image->getTexture(), rotatedcenterbottombounds, true);
|
||||
_bottom->retain();
|
||||
this->addChild(_bottom);
|
||||
|
||||
// Left
|
||||
_left = Sprite::createWithTexture(_scale9Image->getTexture(), rotatedleftcenterbounds, true);
|
||||
_left->retain();
|
||||
this->addChild(_left);
|
||||
|
||||
// Right
|
||||
_right = Sprite::createWithTexture(_scale9Image->getTexture(), rotatedrightcenterbounds, true);
|
||||
_right->retain();
|
||||
this->addChild(_right);
|
||||
|
||||
// Top left
|
||||
_topLeft = Sprite::createWithTexture(_scale9Image->getTexture(), rotatedlefttopbounds, true);
|
||||
_topLeft->retain();
|
||||
this->addChild(_topLeft);
|
||||
|
||||
// Top right
|
||||
_topRight = Sprite::createWithTexture(_scale9Image->getTexture(), rotatedrighttopbounds, true);
|
||||
_topRight->retain();
|
||||
this->addChild(_topRight);
|
||||
|
||||
// Bottom left
|
||||
_bottomLeft = Sprite::createWithTexture(_scale9Image->getTexture(), rotatedleftbottombounds, true);
|
||||
_bottomLeft->retain();
|
||||
this->addChild(_bottomLeft);
|
||||
|
||||
// Bottom right
|
||||
_bottomRight = Sprite::createWithTexture(_scale9Image->getTexture(), rotatedrightbottombounds, true);
|
||||
_bottomRight->retain();
|
||||
this->addChild(_bottomRight);
|
||||
}
|
||||
|
||||
this->setContentSize(rect.size);
|
||||
// this->addChild(_scale9Image);
|
||||
|
||||
if (_spritesGenerated)
|
||||
{
|
||||
// Restore color and opacity
|
||||
this->setOpacity(opacity);
|
||||
this->setColor(color);
|
||||
}
|
||||
_spritesGenerated = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Scale9Sprite::setContentSize(const Size &size)
|
||||
{
|
||||
Node::setContentSize(size);
|
||||
this->_positionsAreDirty = true;
|
||||
}
|
||||
|
||||
void Scale9Sprite::updatePositions()
|
||||
{
|
||||
// Check that instances are non-nullptr
|
||||
if(!((_topLeft) &&
|
||||
(_topRight) &&
|
||||
(_bottomRight) &&
|
||||
(_bottomLeft) &&
|
||||
(_centre))) {
|
||||
// if any of the above sprites are nullptr, return
|
||||
return;
|
||||
}
|
||||
|
||||
Size size = this->_contentSize;
|
||||
|
||||
float sizableWidth = size.width - _topLeft->getContentSize().width - _topRight->getContentSize().width;
|
||||
float sizableHeight = size.height - _topLeft->getContentSize().height - _bottomRight->getContentSize().height;
|
||||
|
||||
float horizontalScale = sizableWidth/_centre->getContentSize().width;
|
||||
float verticalScale = sizableHeight/_centre->getContentSize().height;
|
||||
|
||||
_centre->setScaleX(horizontalScale);
|
||||
_centre->setScaleY(verticalScale);
|
||||
|
||||
float rescaledWidth = _centre->getContentSize().width * horizontalScale;
|
||||
float rescaledHeight = _centre->getContentSize().height * verticalScale;
|
||||
|
||||
float leftWidth = _bottomLeft->getContentSize().width;
|
||||
float bottomHeight = _bottomLeft->getContentSize().height;
|
||||
|
||||
_bottomLeft->setAnchorPoint(Vec2(0,0));
|
||||
_bottomRight->setAnchorPoint(Vec2(0,0));
|
||||
_topLeft->setAnchorPoint(Vec2(0,0));
|
||||
_topRight->setAnchorPoint(Vec2(0,0));
|
||||
_left->setAnchorPoint(Vec2(0,0));
|
||||
_right->setAnchorPoint(Vec2(0,0));
|
||||
_top->setAnchorPoint(Vec2(0,0));
|
||||
_bottom->setAnchorPoint(Vec2(0,0));
|
||||
_centre->setAnchorPoint(Vec2(0,0));
|
||||
|
||||
// Position corners
|
||||
_bottomLeft->setPosition(0,0);
|
||||
_bottomRight->setPosition(leftWidth+rescaledWidth,0);
|
||||
_topLeft->setPosition(0, bottomHeight+rescaledHeight);
|
||||
_topRight->setPosition(leftWidth+rescaledWidth, bottomHeight+rescaledHeight);
|
||||
|
||||
// Scale and position borders
|
||||
_left->setPosition(0, bottomHeight);
|
||||
_left->setScaleY(verticalScale);
|
||||
_right->setPosition(leftWidth+rescaledWidth,bottomHeight);
|
||||
_right->setScaleY(verticalScale);
|
||||
_bottom->setPosition(leftWidth,0);
|
||||
_bottom->setScaleX(horizontalScale);
|
||||
_top->setPosition(leftWidth,bottomHeight+rescaledHeight);
|
||||
_top->setScaleX(horizontalScale);
|
||||
|
||||
// Position centre
|
||||
_centre->setPosition(leftWidth, bottomHeight);
|
||||
}
|
||||
|
||||
bool Scale9Sprite::initWithFile(const std::string& file, const Rect& rect, const Rect& capInsets)
|
||||
{
|
||||
SpriteBatchNode *batchnode = SpriteBatchNode::create(file, 9);
|
||||
bool pReturn = this->initWithBatchNode(batchnode, rect, capInsets);
|
||||
return pReturn;
|
||||
}
|
||||
|
||||
Scale9Sprite* Scale9Sprite::create(const std::string& file, const Rect& rect, const Rect& capInsets)
|
||||
{
|
||||
Scale9Sprite* pReturn = new (std::nothrow) Scale9Sprite();
|
||||
if ( pReturn && pReturn->initWithFile(file, rect, capInsets) )
|
||||
{
|
||||
pReturn->autorelease();
|
||||
return pReturn;
|
||||
}
|
||||
CC_SAFE_DELETE(pReturn);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool Scale9Sprite::initWithFile(const std::string& file, const Rect& rect)
|
||||
{
|
||||
bool pReturn = this->initWithFile(file, rect, Rect::ZERO);
|
||||
return pReturn;
|
||||
}
|
||||
|
||||
Scale9Sprite* Scale9Sprite::create(const std::string& file, const Rect& rect)
|
||||
{
|
||||
Scale9Sprite* pReturn = new (std::nothrow) Scale9Sprite();
|
||||
if ( pReturn && pReturn->initWithFile(file, rect) )
|
||||
{
|
||||
pReturn->autorelease();
|
||||
return pReturn;
|
||||
}
|
||||
CC_SAFE_DELETE(pReturn);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
bool Scale9Sprite::initWithFile(const Rect& capInsets, const std::string& file)
|
||||
{
|
||||
bool pReturn = this->initWithFile(file, Rect::ZERO, capInsets);
|
||||
return pReturn;
|
||||
}
|
||||
|
||||
Scale9Sprite* Scale9Sprite::create(const Rect& capInsets, const std::string& file)
|
||||
{
|
||||
Scale9Sprite* pReturn = new (std::nothrow) Scale9Sprite();
|
||||
if ( pReturn && pReturn->initWithFile(capInsets, file) )
|
||||
{
|
||||
pReturn->autorelease();
|
||||
return pReturn;
|
||||
}
|
||||
CC_SAFE_DELETE(pReturn);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool Scale9Sprite::initWithFile(const std::string& file)
|
||||
{
|
||||
bool pReturn = this->initWithFile(file, Rect::ZERO);
|
||||
return pReturn;
|
||||
|
||||
}
|
||||
|
||||
Scale9Sprite* Scale9Sprite::create(const std::string& file)
|
||||
{
|
||||
Scale9Sprite* pReturn = new (std::nothrow) Scale9Sprite();
|
||||
if ( pReturn && pReturn->initWithFile(file) )
|
||||
{
|
||||
pReturn->autorelease();
|
||||
return pReturn;
|
||||
}
|
||||
CC_SAFE_DELETE(pReturn);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool Scale9Sprite::initWithSpriteFrame(SpriteFrame* spriteFrame, const Rect& capInsets)
|
||||
{
|
||||
Texture2D* texture = spriteFrame->getTexture();
|
||||
CCASSERT(texture != nullptr, "CCTexture must be not nil");
|
||||
|
||||
SpriteBatchNode *batchnode = SpriteBatchNode::createWithTexture(texture, 9);
|
||||
CCASSERT(batchnode != nullptr, "CCSpriteBatchNode must be not nil");
|
||||
|
||||
bool pReturn = this->initWithBatchNode(batchnode, spriteFrame->getRect(), spriteFrame->isRotated(), capInsets);
|
||||
return pReturn;
|
||||
}
|
||||
|
||||
Scale9Sprite* Scale9Sprite::createWithSpriteFrame(SpriteFrame* spriteFrame, const Rect& capInsets)
|
||||
{
|
||||
Scale9Sprite* pReturn = new (std::nothrow) Scale9Sprite();
|
||||
if ( pReturn && pReturn->initWithSpriteFrame(spriteFrame, capInsets) )
|
||||
{
|
||||
pReturn->autorelease();
|
||||
return pReturn;
|
||||
}
|
||||
CC_SAFE_DELETE(pReturn);
|
||||
return nullptr;
|
||||
}
|
||||
bool Scale9Sprite::initWithSpriteFrame(SpriteFrame* spriteFrame)
|
||||
{
|
||||
CCASSERT(spriteFrame != nullptr, "Invalid spriteFrame for sprite");
|
||||
bool pReturn = this->initWithSpriteFrame(spriteFrame, Rect::ZERO);
|
||||
return pReturn;
|
||||
}
|
||||
|
||||
Scale9Sprite* Scale9Sprite::createWithSpriteFrame(SpriteFrame* spriteFrame)
|
||||
{
|
||||
Scale9Sprite* pReturn = new (std::nothrow) Scale9Sprite();
|
||||
if ( pReturn && pReturn->initWithSpriteFrame(spriteFrame) )
|
||||
{
|
||||
pReturn->autorelease();
|
||||
return pReturn;
|
||||
}
|
||||
CC_SAFE_DELETE(pReturn);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool Scale9Sprite::initWithSpriteFrameName(const std::string& spriteFrameName, const Rect& capInsets)
|
||||
{
|
||||
CCASSERT((SpriteFrameCache::getInstance()) != nullptr, "SpriteFrameCache::getInstance() must be non-nullptr");
|
||||
|
||||
SpriteFrame *frame = SpriteFrameCache::getInstance()->getSpriteFrameByName(spriteFrameName);
|
||||
CCASSERT(frame != nullptr, "CCSpriteFrame must be non-nullptr");
|
||||
|
||||
if (nullptr == frame) return false;
|
||||
|
||||
bool pReturn = this->initWithSpriteFrame(frame, capInsets);
|
||||
return pReturn;
|
||||
}
|
||||
|
||||
Scale9Sprite* Scale9Sprite::createWithSpriteFrameName(const std::string& spriteFrameName, const Rect& capInsets)
|
||||
{
|
||||
Scale9Sprite* pReturn = new (std::nothrow) Scale9Sprite();
|
||||
if ( pReturn && pReturn->initWithSpriteFrameName(spriteFrameName, capInsets) )
|
||||
{
|
||||
pReturn->autorelease();
|
||||
return pReturn;
|
||||
}
|
||||
CC_SAFE_DELETE(pReturn);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool Scale9Sprite::initWithSpriteFrameName(const std::string& spriteFrameName)
|
||||
{
|
||||
bool pReturn = this->initWithSpriteFrameName(spriteFrameName, Rect::ZERO);
|
||||
return pReturn;
|
||||
}
|
||||
|
||||
Scale9Sprite* Scale9Sprite::createWithSpriteFrameName(const std::string& spriteFrameName)
|
||||
{
|
||||
Scale9Sprite* pReturn = new (std::nothrow) Scale9Sprite();
|
||||
if ( pReturn && pReturn->initWithSpriteFrameName(spriteFrameName) )
|
||||
{
|
||||
pReturn->autorelease();
|
||||
return pReturn;
|
||||
}
|
||||
CC_SAFE_DELETE(pReturn);
|
||||
|
||||
log("Could not allocate Scale9Sprite()");
|
||||
return nullptr;
|
||||
|
||||
}
|
||||
|
||||
Scale9Sprite* Scale9Sprite::resizableSpriteWithCapInsets(const Rect& capInsets)
|
||||
{
|
||||
Scale9Sprite* pReturn = new (std::nothrow) Scale9Sprite();
|
||||
if ( pReturn && pReturn->initWithBatchNode(_scale9Image, _spriteRect, capInsets) )
|
||||
{
|
||||
pReturn->autorelease();
|
||||
return pReturn;
|
||||
}
|
||||
CC_SAFE_DELETE(pReturn);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Scale9Sprite* Scale9Sprite::create()
|
||||
{
|
||||
Scale9Sprite *pReturn = new (std::nothrow) Scale9Sprite();
|
||||
if (pReturn && pReturn->init())
|
||||
{
|
||||
pReturn->autorelease();
|
||||
return pReturn;
|
||||
}
|
||||
CC_SAFE_DELETE(pReturn);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/** sets the opacity.
|
||||
@warning If the the texture has premultiplied alpha then, the R, G and B channels will be modifed.
|
||||
Values goes from 0 to 255, where 255 means fully opaque.
|
||||
*/
|
||||
|
||||
void Scale9Sprite::setPreferredSize(Size preferedSize)
|
||||
{
|
||||
this->setContentSize(preferedSize);
|
||||
this->_preferredSize = preferedSize;
|
||||
}
|
||||
|
||||
Size Scale9Sprite::getPreferredSize()
|
||||
{
|
||||
return this->_preferredSize;
|
||||
}
|
||||
|
||||
void Scale9Sprite::setCapInsets(Rect capInsets)
|
||||
{
|
||||
Size contentSize = this->_contentSize;
|
||||
this->updateWithBatchNode(this->_scale9Image, this->_spriteRect, _spriteFrameRotated, capInsets);
|
||||
this->setContentSize(contentSize);
|
||||
}
|
||||
|
||||
Rect Scale9Sprite::getCapInsets()
|
||||
{
|
||||
return _capInsets;
|
||||
}
|
||||
|
||||
void Scale9Sprite::updateCapInset()
|
||||
{
|
||||
Rect insets;
|
||||
if (this->_insetLeft == 0 && this->_insetTop == 0 && this->_insetRight == 0 && this->_insetBottom == 0)
|
||||
{
|
||||
insets = Rect::ZERO;
|
||||
}
|
||||
else
|
||||
{
|
||||
insets = Rect(_insetLeft,
|
||||
_insetTop,
|
||||
_spriteRect.size.width-_insetLeft-_insetRight,
|
||||
_spriteRect.size.height-_insetTop-_insetBottom);
|
||||
}
|
||||
this->setCapInsets(insets);
|
||||
}
|
||||
|
||||
void Scale9Sprite::setOpacityModifyRGB(bool var)
|
||||
{
|
||||
if (!_scale9Image)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_opacityModifyRGB = var;
|
||||
|
||||
for(auto child : _scale9Image->getChildren()){
|
||||
child->setOpacityModifyRGB(_opacityModifyRGB);
|
||||
}
|
||||
}
|
||||
|
||||
bool Scale9Sprite::isOpacityModifyRGB() const
|
||||
{
|
||||
return _opacityModifyRGB;
|
||||
}
|
||||
|
||||
void Scale9Sprite::setSpriteFrame(SpriteFrame * spriteFrame)
|
||||
{
|
||||
SpriteBatchNode * batchnode = SpriteBatchNode::createWithTexture(spriteFrame->getTexture(), 9);
|
||||
this->updateWithBatchNode(batchnode, spriteFrame->getRect(), spriteFrame->isRotated(), Rect::ZERO);
|
||||
|
||||
// Reset insets
|
||||
this->_insetLeft = 0;
|
||||
this->_insetTop = 0;
|
||||
this->_insetRight = 0;
|
||||
this->_insetBottom = 0;
|
||||
}
|
||||
|
||||
float Scale9Sprite::getInsetLeft()
|
||||
{
|
||||
return this->_insetLeft;
|
||||
}
|
||||
|
||||
float Scale9Sprite::getInsetTop()
|
||||
{
|
||||
return this->_insetTop;
|
||||
}
|
||||
|
||||
float Scale9Sprite::getInsetRight()
|
||||
{
|
||||
return this->_insetRight;
|
||||
}
|
||||
|
||||
float Scale9Sprite::getInsetBottom()
|
||||
{
|
||||
return this->_insetBottom;
|
||||
}
|
||||
|
||||
void Scale9Sprite::setInsetLeft(float insetLeft)
|
||||
{
|
||||
this->_insetLeft = insetLeft;
|
||||
this->updateCapInset();
|
||||
}
|
||||
|
||||
void Scale9Sprite::setInsetTop(float insetTop)
|
||||
{
|
||||
this->_insetTop = insetTop;
|
||||
this->updateCapInset();
|
||||
}
|
||||
|
||||
void Scale9Sprite::setInsetRight(float insetRight)
|
||||
{
|
||||
this->_insetRight = insetRight;
|
||||
this->updateCapInset();
|
||||
}
|
||||
|
||||
void Scale9Sprite::setInsetBottom(float insetBottom)
|
||||
{
|
||||
this->_insetBottom = insetBottom;
|
||||
this->updateCapInset();
|
||||
}
|
||||
|
||||
void Scale9Sprite::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags)
|
||||
{
|
||||
if(this->_positionsAreDirty)
|
||||
{
|
||||
this->updatePositions();
|
||||
this->_positionsAreDirty = false;
|
||||
}
|
||||
Node::visit(renderer, parentTransform, parentFlags);
|
||||
}
|
||||
|
||||
void Scale9Sprite::setColor(const Color3B& color)
|
||||
{
|
||||
if (!_scale9Image)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Node::setColor(color);
|
||||
|
||||
for(auto child : _scale9Image->getChildren()){
|
||||
child->setColor(color);
|
||||
}
|
||||
}
|
||||
|
||||
void Scale9Sprite::setOpacity(GLubyte opacity)
|
||||
{
|
||||
if (!_scale9Image)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Node::setOpacity(opacity);
|
||||
|
||||
for(auto child : _scale9Image->getChildren()){
|
||||
child->setOpacity(opacity);
|
||||
}
|
||||
}
|
||||
|
||||
void Scale9Sprite::updateDisplayedColor(const cocos2d::Color3B &parentColor)
|
||||
{
|
||||
if (!_scale9Image)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Node::updateDisplayedColor(parentColor);
|
||||
|
||||
for(auto child : _scale9Image->getChildren()){
|
||||
child->updateDisplayedColor(parentColor);
|
||||
}
|
||||
}
|
||||
|
||||
void Scale9Sprite::updateDisplayedOpacity(GLubyte parentOpacity)
|
||||
{
|
||||
if (!_scale9Image)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Node::updateDisplayedOpacity(parentOpacity);
|
||||
|
||||
for(auto child : _scale9Image->getChildren()){
|
||||
child->updateDisplayedOpacity(parentOpacity);
|
||||
}
|
||||
}
|
||||
|
||||
NS_CC_EXT_END
|
|
@ -1,323 +0,0 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2012 cocos2d-x.org
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Created by Jung Sang-Taik on 12. 3. 16..
|
||||
Copyright (c) 2012 Neofect. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __CCScale9Sprite_H__
|
||||
#define __CCScale9Sprite_H__
|
||||
|
||||
#include "2d/CCNode.h"
|
||||
#include "2d/CCSpriteFrame.h"
|
||||
#include "2d/CCSpriteBatchNode.h"
|
||||
#include "extensions/ExtensionExport.h"
|
||||
#include "../../ExtensionMacros.h"
|
||||
|
||||
NS_CC_EXT_BEGIN
|
||||
|
||||
/**
|
||||
* @addtogroup GUI
|
||||
* @{
|
||||
* @addtogroup control_extension
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* A 9-slice sprite for cocos2d.
|
||||
*
|
||||
* 9-slice scaling allows you to specify how scaling is applied
|
||||
* to specific areas of a sprite. With 9-slice scaling (3x3 grid),
|
||||
* you can ensure that the sprite does not become distorted when
|
||||
* scaled.
|
||||
*
|
||||
* @see http://yannickloriot.com/library/ios/cccontrolextension/Classes/CCScale9Sprite.html
|
||||
*/
|
||||
class CC_EX_DLL Scale9Sprite : public Node
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
Scale9Sprite();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~Scale9Sprite();
|
||||
|
||||
public:
|
||||
static Scale9Sprite* create();
|
||||
|
||||
/**
|
||||
* Creates a 9-slice sprite with a texture file, a delimitation zone and
|
||||
* with the specified cap insets.
|
||||
*
|
||||
* @see initWithFile(const char *file, const Rect& rect, const Rect& capInsets)
|
||||
*/
|
||||
static Scale9Sprite* create(const std::string& file, const Rect& rect, const Rect& capInsets);
|
||||
|
||||
/**
|
||||
* Creates a 9-slice sprite with a texture file. The whole texture will be
|
||||
* broken down into a 3×3 grid of equal blocks.
|
||||
*
|
||||
* @see initWithFile(const Rect& capInsets, const char *file)
|
||||
*/
|
||||
static Scale9Sprite* create(const Rect& capInsets, const std::string& file);
|
||||
|
||||
/**
|
||||
* Creates a 9-slice sprite with a texture file and a delimitation zone. The
|
||||
* texture will be broken down into a 3×3 grid of equal blocks.
|
||||
*
|
||||
* @see initWithFile(const char *file, const Rect& rect)
|
||||
*/
|
||||
static Scale9Sprite* create(const std::string& file, const Rect& rect);
|
||||
|
||||
/**
|
||||
* Creates a 9-slice sprite with a texture file. The whole texture will be
|
||||
* broken down into a 3×3 grid of equal blocks.
|
||||
*
|
||||
* @see initWithFile(const char *file)
|
||||
*/
|
||||
static Scale9Sprite* create(const std::string& file);
|
||||
|
||||
/**
|
||||
* Creates a 9-slice sprite with an sprite frame.
|
||||
* Once the sprite is created, you can then call its "setContentSize:" method
|
||||
* to resize the sprite will all it's 9-slice goodness intract.
|
||||
* It respects the anchorPoint too.
|
||||
*
|
||||
* @see initWithSpriteFrame(SpriteFrame *spriteFrame)
|
||||
*/
|
||||
static Scale9Sprite* createWithSpriteFrame(SpriteFrame* spriteFrame);
|
||||
|
||||
/**
|
||||
* Creates a 9-slice sprite with an sprite frame and the centre of its zone.
|
||||
* Once the sprite is created, you can then call its "setContentSize:" method
|
||||
* to resize the sprite will all it's 9-slice goodness intract.
|
||||
* It respects the anchorPoint too.
|
||||
*
|
||||
* @see initWithSpriteFrame(SpriteFrame *spriteFrame, const Rect& capInsets)
|
||||
*/
|
||||
static Scale9Sprite* createWithSpriteFrame(SpriteFrame* spriteFrame, const Rect& capInsets);
|
||||
|
||||
/**
|
||||
* Creates a 9-slice sprite with an sprite frame name.
|
||||
* Once the sprite is created, you can then call its "setContentSize:" method
|
||||
* to resize the sprite will all it's 9-slice goodness intract.
|
||||
* It respects the anchorPoint too.
|
||||
*
|
||||
* @see initWithSpriteFrameName(const char *spriteFrameName)
|
||||
*/
|
||||
static Scale9Sprite* createWithSpriteFrameName(const std::string& spriteFrameName);
|
||||
|
||||
/**
|
||||
* Creates a 9-slice sprite with an sprite frame name and the centre of its
|
||||
* zone.
|
||||
* Once the sprite is created, you can then call its "setContentSize:" method
|
||||
* to resize the sprite will all it's 9-slice goodness intract.
|
||||
* It respects the anchorPoint too.
|
||||
*
|
||||
* @see initWithSpriteFrameName(const char *spriteFrameName, const Rect& capInsets)
|
||||
*/
|
||||
static Scale9Sprite* createWithSpriteFrameName(const std::string& spriteFrameName, const Rect& capInsets);
|
||||
|
||||
/**
|
||||
* Initializes a 9-slice sprite with a texture file, a delimitation zone and
|
||||
* with the specified cap insets.
|
||||
* Once the sprite is created, you can then call its "setContentSize:" method
|
||||
* to resize the sprite will all it's 9-slice goodness intract.
|
||||
* It respects the anchorPoint too.
|
||||
*
|
||||
* @param file The name of the texture file.
|
||||
* @param rect The rectangle that describes the sub-part of the texture that
|
||||
* is the whole image. If the shape is the whole texture, set this to the
|
||||
* texture's full rect.
|
||||
* @param capInsets The values to use for the cap insets.
|
||||
*/
|
||||
virtual bool initWithFile(const std::string& file, const Rect& rect, const Rect& capInsets);
|
||||
|
||||
/**
|
||||
* Initializes a 9-slice sprite with a texture file and a delimitation zone. The
|
||||
* texture will be broken down into a 3×3 grid of equal blocks.
|
||||
* Once the sprite is created, you can then call its "setContentSize:" method
|
||||
* to resize the sprite will all it's 9-slice goodness intract.
|
||||
* It respects the anchorPoint too.
|
||||
*
|
||||
* @param file The name of the texture file.
|
||||
* @param rect The rectangle that describes the sub-part of the texture that
|
||||
* is the whole image. If the shape is the whole texture, set this to the
|
||||
* texture's full rect.
|
||||
*/
|
||||
virtual bool initWithFile(const std::string& file, const Rect& rect);
|
||||
|
||||
/**
|
||||
* Initializes a 9-slice sprite with a texture file and with the specified cap
|
||||
* insets.
|
||||
* Once the sprite is created, you can then call its "setContentSize:" method
|
||||
* to resize the sprite will all it's 9-slice goodness intract.
|
||||
* It respects the anchorPoint too.
|
||||
*
|
||||
* @param file The name of the texture file.
|
||||
* @param capInsets The values to use for the cap insets.
|
||||
*/
|
||||
virtual bool initWithFile(const Rect& capInsets, const std::string& file);
|
||||
|
||||
/**
|
||||
* Initializes a 9-slice sprite with a texture file. The whole texture will be
|
||||
* broken down into a 3×3 grid of equal blocks.
|
||||
* Once the sprite is created, you can then call its "setContentSize:" method
|
||||
* to resize the sprite will all it's 9-slice goodness intract.
|
||||
* It respects the anchorPoint too.
|
||||
*
|
||||
* @param file The name of the texture file.
|
||||
*/
|
||||
virtual bool initWithFile(const std::string& file);
|
||||
|
||||
/**
|
||||
* Initializes a 9-slice sprite with an sprite frame and with the specified
|
||||
* cap insets.
|
||||
* Once the sprite is created, you can then call its "setContentSize:" method
|
||||
* to resize the sprite will all it's 9-slice goodness intract.
|
||||
* It respects the anchorPoint too.
|
||||
*
|
||||
* @param spriteFrame The sprite frame object.
|
||||
* @param capInsets The values to use for the cap insets.
|
||||
*/
|
||||
virtual bool initWithSpriteFrame(SpriteFrame* spriteFrame, const Rect& capInsets);
|
||||
|
||||
/**
|
||||
* Initializes a 9-slice sprite with an sprite frame.
|
||||
* Once the sprite is created, you can then call its "setContentSize:" method
|
||||
* to resize the sprite will all it's 9-slice goodness intract.
|
||||
* It respects the anchorPoint too.
|
||||
*
|
||||
* @param spriteFrame The sprite frame object.
|
||||
*/
|
||||
virtual bool initWithSpriteFrame(SpriteFrame* spriteFrame);
|
||||
|
||||
/**
|
||||
* Initializes a 9-slice sprite with an sprite frame name and with the specified
|
||||
* cap insets.
|
||||
* Once the sprite is created, you can then call its "setContentSize:" method
|
||||
* to resize the sprite will all it's 9-slice goodness intract.
|
||||
* It respects the anchorPoint too.
|
||||
*
|
||||
* @param spriteFrameName The sprite frame name.
|
||||
* @param capInsets The values to use for the cap insets.
|
||||
*/
|
||||
virtual bool initWithSpriteFrameName(const std::string& spriteFrameName, const Rect& capInsets);
|
||||
|
||||
/**
|
||||
* Initializes a 9-slice sprite with an sprite frame name.
|
||||
* Once the sprite is created, you can then call its "setContentSize:" method
|
||||
* to resize the sprite will all it's 9-slice goodness intract.
|
||||
* It respects the anchorPoint too.
|
||||
*
|
||||
* @param spriteFrameName The sprite frame name.
|
||||
*/
|
||||
virtual bool initWithSpriteFrameName(const std::string& spriteFrameName);
|
||||
|
||||
virtual bool init();
|
||||
virtual bool initWithBatchNode(SpriteBatchNode* batchnode, const Rect& rect, bool rotated, const Rect& capInsets);
|
||||
virtual bool initWithBatchNode(SpriteBatchNode* batchnode, const Rect& rect, const Rect& capInsets);
|
||||
|
||||
/**
|
||||
* Creates and returns a new sprite object with the specified cap insets.
|
||||
* You use this method to add cap insets to a sprite or to change the existing
|
||||
* cap insets of a sprite. In both cases, you get back a new image and the
|
||||
* original sprite remains untouched.
|
||||
*
|
||||
* @param capInsets The values to use for the cap insets.
|
||||
*/
|
||||
Scale9Sprite* resizableSpriteWithCapInsets(const Rect& capInsets);
|
||||
|
||||
virtual bool updateWithBatchNode(SpriteBatchNode* batchnode, const Rect& rect, bool rotated, const Rect& capInsets);
|
||||
virtual void setSpriteFrame(SpriteFrame * spriteFrame);
|
||||
|
||||
// overrides
|
||||
virtual void setContentSize(const Size & size) override;
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags) override;
|
||||
virtual void setOpacityModifyRGB(bool bValue) override;
|
||||
virtual bool isOpacityModifyRGB(void) const override;
|
||||
virtual void setOpacity(GLubyte opacity) override;
|
||||
virtual void setColor(const Color3B& color) override;
|
||||
virtual void updateDisplayedOpacity(GLubyte parentOpacity) override;
|
||||
virtual void updateDisplayedColor(const Color3B& parentColor) override;
|
||||
|
||||
protected:
|
||||
void updateCapInset();
|
||||
void updatePositions();
|
||||
|
||||
bool _spritesGenerated;
|
||||
Rect _spriteRect;
|
||||
bool _spriteFrameRotated;
|
||||
Rect _capInsetsInternal;
|
||||
bool _positionsAreDirty;
|
||||
|
||||
SpriteBatchNode* _scale9Image;
|
||||
Sprite* _topLeft;
|
||||
Sprite* _top;
|
||||
Sprite* _topRight;
|
||||
Sprite* _left;
|
||||
Sprite* _centre;
|
||||
Sprite* _right;
|
||||
Sprite* _bottomLeft;
|
||||
Sprite* _bottom;
|
||||
Sprite* _bottomRight;
|
||||
|
||||
bool _opacityModifyRGB;
|
||||
|
||||
/** Original sprite's size. */
|
||||
CC_SYNTHESIZE_READONLY(Size, _originalSize, OriginalSize);
|
||||
/** Prefered sprite's size. By default the prefered size is the original size. */
|
||||
|
||||
//if the preferredSize component is given as -1, it is ignored
|
||||
CC_PROPERTY(Size, _preferredSize, PreferredSize);
|
||||
/**
|
||||
* The end-cap insets.
|
||||
* On a non-resizeable sprite, this property is set to CGRect::ZERO; the sprite
|
||||
* does not use end caps and the entire sprite is subject to stretching.
|
||||
*/
|
||||
CC_PROPERTY(Rect, _capInsets, CapInsets);
|
||||
/** Sets the left side inset */
|
||||
CC_PROPERTY(float, _insetLeft, InsetLeft);
|
||||
/** Sets the top side inset */
|
||||
CC_PROPERTY(float, _insetTop, InsetTop);
|
||||
/** Sets the right side inset */
|
||||
CC_PROPERTY(float, _insetRight, InsetRight);
|
||||
/** Sets the bottom side inset */
|
||||
CC_PROPERTY(float, _insetBottom, InsetBottom);
|
||||
};
|
||||
|
||||
// end of GUI group
|
||||
/// @}
|
||||
/// @}
|
||||
|
||||
NS_CC_EXT_END
|
||||
|
||||
#endif // __CCScale9Sprite_H__
|
|
@ -1,452 +0,0 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2012 James Chen
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __CCEDITTEXT_H__
|
||||
#define __CCEDITTEXT_H__
|
||||
|
||||
#include "base/CCIMEDelegate.h"
|
||||
#include "extensions/ExtensionMacros.h"
|
||||
#include "../CCControlExtension/CCControlExtensions.h"
|
||||
#include "extensions/ExtensionExport.h"
|
||||
|
||||
NS_CC_EXT_BEGIN
|
||||
|
||||
class EditBox;
|
||||
class EditBoxImpl;
|
||||
|
||||
|
||||
class CC_EX_DLL EditBoxDelegate
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~EditBoxDelegate() {};
|
||||
|
||||
/**
|
||||
* This method is called when an edit box gains focus after keyboard is shown.
|
||||
* @param editBox The edit box object that generated the event.
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void editBoxEditingDidBegin(EditBox* editBox) {};
|
||||
|
||||
|
||||
/**
|
||||
* This method is called when an edit box loses focus after keyboard is hidden.
|
||||
* @param editBox The edit box object that generated the event.
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void editBoxEditingDidEnd(EditBox* editBox) {};
|
||||
|
||||
/**
|
||||
* This method is called when the edit box text was changed.
|
||||
* @param editBox The edit box object that generated the event.
|
||||
* @param text The new text.
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void editBoxTextChanged(EditBox* editBox, const std::string& text) {};
|
||||
|
||||
/**
|
||||
* This method is called when the return button was pressed or the outside area of keyboard was touched.
|
||||
* @param editBox The edit box object that generated the event.
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void editBoxReturn(EditBox* editBox) = 0;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Class for edit box.
|
||||
*
|
||||
* You can use this widget to gather small amounts of text from the user.
|
||||
*
|
||||
*/
|
||||
|
||||
class CC_EX_DLL EditBox
|
||||
: public ControlButton
|
||||
, public IMEDelegate
|
||||
{
|
||||
public:
|
||||
enum class KeyboardReturnType
|
||||
{
|
||||
DEFAULT,
|
||||
DONE,
|
||||
SEND,
|
||||
SEARCH,
|
||||
GO
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief The EditBox::InputMode defines the type of text that the user is allowed
|
||||
* to enter.
|
||||
*/
|
||||
enum class InputMode
|
||||
{
|
||||
/**
|
||||
* The user is allowed to enter any text, including line breaks.
|
||||
*/
|
||||
ANY,
|
||||
|
||||
/**
|
||||
* The user is allowed to enter an e-mail address.
|
||||
*/
|
||||
EMAIL_ADDRESS,
|
||||
|
||||
/**
|
||||
* The user is allowed to enter an integer value.
|
||||
*/
|
||||
NUMERIC,
|
||||
|
||||
/**
|
||||
* The user is allowed to enter a phone number.
|
||||
*/
|
||||
PHONE_NUMBER,
|
||||
|
||||
/**
|
||||
* The user is allowed to enter a URL.
|
||||
*/
|
||||
URL,
|
||||
|
||||
/**
|
||||
* The user is allowed to enter a real number value.
|
||||
* This extends kEditBoxInputModeNumeric by allowing a decimal point.
|
||||
*/
|
||||
DECIMAL,
|
||||
|
||||
/**
|
||||
* The user is allowed to enter any text, except for line breaks.
|
||||
*/
|
||||
SINGLE_LINE,
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief The EditBox::InputFlag defines how the input text is displayed/formatted.
|
||||
*/
|
||||
enum class InputFlag
|
||||
{
|
||||
/**
|
||||
* Indicates that the text entered is confidential data that should be
|
||||
* obscured whenever possible. This implies EDIT_BOX_INPUT_FLAG_SENSITIVE.
|
||||
*/
|
||||
PASSWORD,
|
||||
|
||||
/**
|
||||
* Indicates that the text entered is sensitive data that the
|
||||
* implementation must never store into a dictionary or table for use
|
||||
* in predictive, auto-completing, or other accelerated input schemes.
|
||||
* A credit card number is an example of sensitive data.
|
||||
*/
|
||||
SENSITIVE,
|
||||
|
||||
/**
|
||||
* This flag is a hint to the implementation that during text editing,
|
||||
* the initial letter of each word should be capitalized.
|
||||
*/
|
||||
INITIAL_CAPS_WORD,
|
||||
|
||||
/**
|
||||
* This flag is a hint to the implementation that during text editing,
|
||||
* the initial letter of each sentence should be capitalized.
|
||||
*/
|
||||
INITIAL_CAPS_SENTENCE,
|
||||
|
||||
/**
|
||||
* Capitalize all characters automatically.
|
||||
*/
|
||||
INTIAL_CAPS_ALL_CHARACTERS,
|
||||
};
|
||||
|
||||
/**
|
||||
* create a edit box with size.
|
||||
* @return An autorelease pointer of EditBox, you don't need to release it only if you retain it again.
|
||||
*/
|
||||
static EditBox* create(const Size& size, Scale9Sprite* pNormal9SpriteBg, Scale9Sprite* pPressed9SpriteBg = NULL, Scale9Sprite* pDisabled9SpriteBg = NULL);
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @js ctor
|
||||
*/
|
||||
EditBox(void);
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~EditBox(void);
|
||||
|
||||
/**
|
||||
* Init edit box with specified size. This method should be invoked right after constructor.
|
||||
* @param size The size of edit box.
|
||||
*/
|
||||
bool initWithSizeAndBackgroundSprite(const Size& size, Scale9Sprite* pNormal9SpriteBg);
|
||||
|
||||
/**
|
||||
* Gets/Sets the delegate for edit box.
|
||||
* @lua NA
|
||||
*/
|
||||
void setDelegate(EditBoxDelegate* pDelegate);
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
EditBoxDelegate* getDelegate();
|
||||
|
||||
#if CC_ENABLE_SCRIPT_BINDING
|
||||
/**
|
||||
* Registers a script function that will be called for EditBox events.
|
||||
*
|
||||
* This handler will be removed automatically after onExit() called.
|
||||
* @code
|
||||
* -- lua sample
|
||||
* local function editboxEventHandler(eventType)
|
||||
* if eventType == "began" then
|
||||
* -- triggered when an edit box gains focus after keyboard is shown
|
||||
* elseif eventType == "ended" then
|
||||
* -- triggered when an edit box loses focus after keyboard is hidden.
|
||||
* elseif eventType == "changed" then
|
||||
* -- triggered when the edit box text was changed.
|
||||
* elseif eventType == "return" then
|
||||
* -- triggered when the return button was pressed or the outside area of keyboard was touched.
|
||||
* end
|
||||
* end
|
||||
*
|
||||
* local editbox = EditBox:create(Size(...), Scale9Sprite:create(...))
|
||||
* editbox = registerScriptEditBoxHandler(editboxEventHandler)
|
||||
* @endcode
|
||||
*
|
||||
* @param handler A number that indicates a lua function.
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
void registerScriptEditBoxHandler(int handler);
|
||||
|
||||
/**
|
||||
* Unregisters a script function that will be called for EditBox events.
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
void unregisterScriptEditBoxHandler(void);
|
||||
/**
|
||||
* get a script Handler
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
int getScriptEditBoxHandler(void){ return _scriptEditBoxHandler ;}
|
||||
|
||||
#endif // #if CC_ENABLE_SCRIPT_BINDING
|
||||
|
||||
/**
|
||||
* Set the text entered in the edit box.
|
||||
* @param pText The given text.
|
||||
*/
|
||||
void setText(const char* pText);
|
||||
|
||||
/**
|
||||
* Get the text entered in the edit box.
|
||||
* @return The text entered in the edit box.
|
||||
*/
|
||||
const char* getText(void);
|
||||
|
||||
/**
|
||||
* Set the font.
|
||||
* @param pFontName The font name.
|
||||
* @param fontSize The font size.
|
||||
*/
|
||||
void setFont(const char* pFontName, int fontSize);
|
||||
|
||||
/**
|
||||
* Set the font name.
|
||||
* @param pFontName The font name.
|
||||
*/
|
||||
void setFontName(const char* pFontName);
|
||||
|
||||
/**
|
||||
* Set the font size.
|
||||
* @param fontSize The font size.
|
||||
*/
|
||||
void setFontSize(int fontSize);
|
||||
|
||||
/**
|
||||
* Set the font color of the widget's text.
|
||||
*/
|
||||
void setFontColor(const Color3B& color);
|
||||
|
||||
/**
|
||||
* Set the placeholder's font.
|
||||
* @param pFontName The font name.
|
||||
* @param fontSize The font size.
|
||||
*/
|
||||
void setPlaceholderFont(const char* pFontName, int fontSize);
|
||||
|
||||
/**
|
||||
* Set the placeholder's font name.
|
||||
* @param pFontName The font name.
|
||||
*/
|
||||
void setPlaceholderFontName(const char* pFontName);
|
||||
|
||||
/**
|
||||
* Set the placeholder's font size.
|
||||
* @param fontSize The font size.
|
||||
*/
|
||||
void setPlaceholderFontSize(int fontSize);
|
||||
|
||||
/**
|
||||
* Set the font color of the placeholder text when the edit box is empty.
|
||||
* Not supported on IOS.
|
||||
*/
|
||||
void setPlaceholderFontColor(const Color3B& color);
|
||||
|
||||
/**
|
||||
* Set a text in the edit box that acts as a placeholder when an
|
||||
* edit box is empty.
|
||||
* @param pText The given text.
|
||||
*/
|
||||
void setPlaceHolder(const char* pText);
|
||||
|
||||
/**
|
||||
* Get a text in the edit box that acts as a placeholder when an
|
||||
* edit box is empty.
|
||||
*/
|
||||
const char* getPlaceHolder(void);
|
||||
|
||||
/**
|
||||
* Set the input mode of the edit box.
|
||||
* @param inputMode One of the EditBox::InputMode constants.
|
||||
*/
|
||||
void setInputMode(InputMode inputMode);
|
||||
|
||||
/**
|
||||
* Sets the maximum input length of the edit box.
|
||||
* Setting this value enables multiline input mode by default.
|
||||
* Available on Android, iOS and Windows Phone.
|
||||
*
|
||||
* @param maxLength The maximum length.
|
||||
*/
|
||||
void setMaxLength(int maxLength);
|
||||
|
||||
/**
|
||||
* Gets the maximum input length of the edit box.
|
||||
*
|
||||
* @return Maximum input length.
|
||||
*/
|
||||
int getMaxLength();
|
||||
|
||||
/**
|
||||
* Set the input flags that are to be applied to the edit box.
|
||||
* @param inputFlag One of the EditBox::InputFlag constants.
|
||||
*/
|
||||
void setInputFlag(InputFlag inputFlag);
|
||||
|
||||
/**
|
||||
* Set the return type that are to be applied to the edit box.
|
||||
* @param returnType One of the EditBox::KeyboardReturnType constants.
|
||||
*/
|
||||
void setReturnType(EditBox::KeyboardReturnType returnType);
|
||||
|
||||
/* override functions */
|
||||
virtual void setPosition(const Vec2& pos) override;
|
||||
virtual void setVisible(bool visible) override;
|
||||
virtual void setContentSize(const Size& size) override;
|
||||
virtual void setAnchorPoint(const Vec2& anchorPoint) override;
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags) override;
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void onEnter(void) override;
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void onExit(void) override;
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void keyboardWillShow(IMEKeyboardNotificationInfo& info) override;
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void keyboardDidShow(IMEKeyboardNotificationInfo& info) override;
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void keyboardWillHide(IMEKeyboardNotificationInfo& info) override;
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void keyboardDidHide(IMEKeyboardNotificationInfo& info) override;
|
||||
|
||||
/* callback funtions
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
void touchDownAction(Ref *sender, Control::EventType controlEvent);
|
||||
|
||||
protected:
|
||||
void updatePosition(float dt);
|
||||
EditBoxImpl* _editBoxImpl;
|
||||
EditBoxDelegate* _delegate;
|
||||
|
||||
InputMode _editBoxInputMode;
|
||||
InputFlag _editBoxInputFlag;
|
||||
EditBox::KeyboardReturnType _keyboardReturnType;
|
||||
|
||||
std::string _text;
|
||||
std::string _placeHolder;
|
||||
|
||||
std::string _fontName;
|
||||
std::string _placeholderFontName;
|
||||
|
||||
int _fontSize;
|
||||
int _placeholderFontSize;
|
||||
|
||||
Color3B _colText;
|
||||
Color3B _colPlaceHolder;
|
||||
|
||||
int _maxLength;
|
||||
float _adjustHeight;
|
||||
#if CC_ENABLE_SCRIPT_BINDING
|
||||
int _scriptEditBoxHandler;
|
||||
#endif
|
||||
};
|
||||
|
||||
NS_CC_EXT_END
|
||||
|
||||
#endif /* __CCEDITTEXT_H__ */
|
||||
|
|
@ -1,104 +0,0 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2012 James Chen
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __CCEditBoxIMPL_H__
|
||||
#define __CCEditBoxIMPL_H__
|
||||
|
||||
#include "extensions/ExtensionMacros.h"
|
||||
#include "CCEditBox.h"
|
||||
#include "extensions/ExtensionExport.h"
|
||||
|
||||
NS_CC_EXT_BEGIN
|
||||
|
||||
|
||||
class CC_EX_DLL EditBoxImpl
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @js NA
|
||||
*/
|
||||
EditBoxImpl(EditBox* pEditBox) : _delegate(nullptr),_editBox(pEditBox) {}
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~EditBoxImpl() {}
|
||||
|
||||
virtual bool initWithSize(const Size& size) = 0;
|
||||
virtual void setFont(const char* pFontName, int fontSize) = 0;
|
||||
virtual void setFontColor(const Color3B& color) = 0;
|
||||
virtual void setPlaceholderFont(const char* pFontName, int fontSize) = 0;
|
||||
virtual void setPlaceholderFontColor(const Color3B& color) = 0;
|
||||
virtual void setInputMode(EditBox::InputMode inputMode) = 0;
|
||||
virtual void setInputFlag(EditBox::InputFlag inputFlag) = 0;
|
||||
virtual void setMaxLength(int maxLength) = 0;
|
||||
virtual int getMaxLength() = 0;
|
||||
virtual void setReturnType(EditBox::KeyboardReturnType returnType) = 0;
|
||||
virtual bool isEditing() = 0;
|
||||
|
||||
virtual void setText(const char* pText) = 0;
|
||||
virtual const char* getText(void) = 0;
|
||||
virtual void setPlaceHolder(const char* pText) = 0;
|
||||
virtual void doAnimationWhenKeyboardMove(float duration, float distance) = 0;
|
||||
|
||||
virtual void openKeyboard() = 0;
|
||||
virtual void closeKeyboard() = 0;
|
||||
|
||||
virtual void setPosition(const Vec2& pos) = 0;
|
||||
virtual void setVisible(bool visible) = 0;
|
||||
virtual void setContentSize(const Size& size) = 0;
|
||||
virtual void setAnchorPoint(const Vec2& anchorPoint) = 0;
|
||||
|
||||
/**
|
||||
* check the editbox's position, update it when needed
|
||||
*/
|
||||
virtual void updatePosition(float dt){};
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void visit(void) = 0;
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void onEnter(void) = 0;
|
||||
|
||||
|
||||
void setDelegate(EditBoxDelegate* pDelegate) { _delegate = pDelegate; };
|
||||
EditBoxDelegate* getDelegate() { return _delegate; };
|
||||
EditBox* getEditBox() { return _editBox; };
|
||||
protected:
|
||||
EditBoxDelegate* _delegate;
|
||||
EditBox* _editBox;
|
||||
};
|
||||
|
||||
// This method must be implemented at each subclass of EditBoxImpl.
|
||||
extern EditBoxImpl* __createSystemEditBox(EditBox* pEditBox);
|
||||
|
||||
|
||||
NS_CC_EXT_END
|
||||
|
||||
#endif /* __CCEditBoxIMPL_H__ */
|
|
@ -1,87 +0,0 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2014 cocos2d-x.org
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
#ifndef __CCEditBoxIMPLWP8_H__
|
||||
#define __CCEditBoxIMPLWP8_H__
|
||||
|
||||
#include "ExtensionMacros.h"
|
||||
#include "CCEditBoxImpl.h"
|
||||
|
||||
NS_CC_EXT_BEGIN
|
||||
|
||||
class CCEditBox;
|
||||
|
||||
class CCEditBoxImplWp8 : public EditBoxImpl
|
||||
{
|
||||
public:
|
||||
CCEditBoxImplWp8(EditBox* pEditText);
|
||||
virtual ~CCEditBoxImplWp8();
|
||||
|
||||
virtual bool initWithSize(const Size& size);
|
||||
virtual void setFont(const char* pFontName, int fontSize);
|
||||
virtual void setFontColor(const Color3B& color);
|
||||
virtual void setPlaceholderFont(const char* pFontName, int fontSize);
|
||||
virtual void setPlaceholderFontColor(const Color3B& color);
|
||||
virtual void setInputMode(EditBox::InputMode inputMode);
|
||||
virtual void setInputFlag(EditBox::InputFlag inputFlag);
|
||||
virtual void setMaxLength(int maxLength);
|
||||
virtual int getMaxLength();
|
||||
virtual void setReturnType(EditBox::KeyboardReturnType returnType);
|
||||
virtual bool isEditing();
|
||||
|
||||
virtual void setText(const char* pText);
|
||||
virtual const char* getText(void);
|
||||
virtual void setPlaceHolder(const char* pText);
|
||||
virtual void setPosition(const Vec2& pos);
|
||||
virtual void setVisible(bool visible);
|
||||
virtual void setContentSize(const Size& size);
|
||||
virtual void setAnchorPoint(const Vec2& anchorPoint);
|
||||
virtual void visit(void);
|
||||
virtual void doAnimationWhenKeyboardMove(float duration, float distance);
|
||||
virtual void openKeyboard();
|
||||
virtual void closeKeyboard();
|
||||
virtual void onEnter(void);
|
||||
private:
|
||||
Platform::String^ stringToPlatformString(std::string strSrc);
|
||||
std::string PlatformStringTostring(Platform::String^ strSrc);
|
||||
private:
|
||||
|
||||
Label* m_pLabel;
|
||||
Label* m_pLabelPlaceHolder;
|
||||
EditBox::InputMode m_eEditBoxInputMode;
|
||||
EditBox::InputFlag m_eEditBoxInputFlag;
|
||||
(EditBox::KeyboardReturnType m_eKeyboardReturnType;
|
||||
|
||||
std::string m_strText;
|
||||
std::string m_strPlaceHolder;
|
||||
|
||||
Color3B m_colText;
|
||||
Color3B m_colPlaceHolder;
|
||||
|
||||
int m_nMaxLength;
|
||||
Size m_EditSize;
|
||||
};
|
||||
|
||||
NS_CC_EXT_END
|
||||
|
||||
#endif
|
|
@ -7,12 +7,12 @@
|
|||
#include "GUI/CCControlExtension/CCControlExtensions.h"
|
||||
#include "GUI/CCScrollView/CCScrollView.h"
|
||||
#include "GUI/CCScrollView/CCTableView.h"
|
||||
#include "GUI/CCEditBox/CCEditBox.h"
|
||||
|
||||
// Physics integration
|
||||
#include "physics-nodes/CCPhysicsDebugNode.h"
|
||||
#include "physics-nodes/CCPhysicsSprite.h"
|
||||
|
||||
#include "assets-manager/AssetsManager.h"
|
||||
#include "ExtensionDeprecated.h"
|
||||
|
||||
#endif /* __COCOS2D_EXT_H__ */
|
||||
|
|
|
@ -764,7 +764,6 @@
|
|||
"cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxAccelerometer.java",
|
||||
"cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java",
|
||||
"cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxBitmap.java",
|
||||
"cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxETCLoader.java",
|
||||
"cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxEditBoxDialog.java",
|
||||
"cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxEditText.java",
|
||||
"cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxGLSurfaceView.java",
|
||||
|
@ -997,6 +996,20 @@
|
|||
"cocos/ui/UICheckBox.h",
|
||||
"cocos/ui/UIDeprecated.cpp",
|
||||
"cocos/ui/UIDeprecated.h",
|
||||
"cocos/ui/UIEditBox/UIEditBox.cpp",
|
||||
"cocos/ui/UIEditBox/UIEditBox.h",
|
||||
"cocos/ui/UIEditBox/UIEditBoxImpl.h",
|
||||
"cocos/ui/UIEditBox/UIEditBoxImplAndroid.cpp",
|
||||
"cocos/ui/UIEditBox/UIEditBoxImplAndroid.h",
|
||||
"cocos/ui/UIEditBox/UIEditBoxImplIOS.h",
|
||||
"cocos/ui/UIEditBox/UIEditBoxImplIOS.mm",
|
||||
"cocos/ui/UIEditBox/UIEditBoxImplMac.h",
|
||||
"cocos/ui/UIEditBox/UIEditBoxImplMac.mm",
|
||||
"cocos/ui/UIEditBox/UIEditBoxImplNone.cpp",
|
||||
"cocos/ui/UIEditBox/UIEditBoxImplWin.cpp",
|
||||
"cocos/ui/UIEditBox/UIEditBoxImplWin.h",
|
||||
"cocos/ui/UIEditBox/UIEditBoxImplWp8.cpp",
|
||||
"cocos/ui/UIEditBox/UIEditBoxImplWp8.h",
|
||||
"cocos/ui/UIHBox.cpp",
|
||||
"cocos/ui/UIHBox.h",
|
||||
"cocos/ui/UIHelper.cpp",
|
||||
|
@ -1048,6 +1061,10 @@
|
|||
"cocos/ui/UIWebViewImpl_iOS.mm",
|
||||
"cocos/ui/UIWidget.cpp",
|
||||
"cocos/ui/UIWidget.h",
|
||||
"cocos/ui/proj.win32/Win32InputBox.cpp",
|
||||
"cocos/ui/proj.win32/Win32InputBox.h",
|
||||
"cocos/ui/proj.win32/libui.vcxproj",
|
||||
"cocos/ui/proj.win32/libui.vcxproj.filters",
|
||||
"cocos/ui/proj.wp8/libGUI.vcxproj",
|
||||
"cocos/ui/proj.wp8/libGUI.vcxproj.filters",
|
||||
"docs/CODING_STYLE.md",
|
||||
|
@ -1058,7 +1075,8 @@
|
|||
"docs/doxygen.config",
|
||||
"download-deps.py",
|
||||
"extensions/Android.mk",
|
||||
"extensions/CMakeLists.txt",
|
||||
"extensions/ExtensionDeprecated.cpp",
|
||||
"extensions/ExtensionDeprecated.h",
|
||||
"extensions/ExtensionExport.h",
|
||||
"extensions/ExtensionMacros.h",
|
||||
"extensions/GUI/CCControlExtension/CCControl.cpp",
|
||||
|
@ -1084,22 +1102,6 @@
|
|||
"extensions/GUI/CCControlExtension/CCControlUtils.h",
|
||||
"extensions/GUI/CCControlExtension/CCInvocation.cpp",
|
||||
"extensions/GUI/CCControlExtension/CCInvocation.h",
|
||||
"extensions/GUI/CCControlExtension/CCScale9Sprite.cpp",
|
||||
"extensions/GUI/CCControlExtension/CCScale9Sprite.h",
|
||||
"extensions/GUI/CCEditBox/CCEditBox.cpp",
|
||||
"extensions/GUI/CCEditBox/CCEditBox.h",
|
||||
"extensions/GUI/CCEditBox/CCEditBoxImpl.h",
|
||||
"extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp",
|
||||
"extensions/GUI/CCEditBox/CCEditBoxImplAndroid.h",
|
||||
"extensions/GUI/CCEditBox/CCEditBoxImplIOS.h",
|
||||
"extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm",
|
||||
"extensions/GUI/CCEditBox/CCEditBoxImplMac.h",
|
||||
"extensions/GUI/CCEditBox/CCEditBoxImplMac.mm",
|
||||
"extensions/GUI/CCEditBox/CCEditBoxImplNone.cpp",
|
||||
"extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp",
|
||||
"extensions/GUI/CCEditBox/CCEditBoxImplWin.h",
|
||||
"extensions/GUI/CCEditBox/CCEditBoxImplWp8.cpp",
|
||||
"extensions/GUI/CCEditBox/CCEditBoxImplWp8.h",
|
||||
"extensions/GUI/CCScrollView/CCScrollView.cpp",
|
||||
"extensions/GUI/CCScrollView/CCScrollView.h",
|
||||
"extensions/GUI/CCScrollView/CCTableView.cpp",
|
||||
|
@ -3694,7 +3696,6 @@
|
|||
"cocos/scripting/lua-bindings/auto/api/EaseSineIn.lua",
|
||||
"cocos/scripting/lua-bindings/auto/api/EaseSineInOut.lua",
|
||||
"cocos/scripting/lua-bindings/auto/api/EaseSineOut.lua",
|
||||
"cocos/scripting/lua-bindings/auto/api/EditBox.lua",
|
||||
"cocos/scripting/lua-bindings/auto/api/Event.lua",
|
||||
"cocos/scripting/lua-bindings/auto/api/EventAcceleration.lua",
|
||||
"cocos/scripting/lua-bindings/auto/api/EventController.lua",
|
||||
|
@ -4029,6 +4030,8 @@
|
|||
"cocos/scripting/lua-bindings/manual/cocosbuilder/lua_cocos2dx_cocosbuilder_manual.h",
|
||||
"cocos/scripting/lua-bindings/manual/cocosdenshion/lua_cocos2dx_cocosdenshion_manual.cpp",
|
||||
"cocos/scripting/lua-bindings/manual/cocosdenshion/lua_cocos2dx_cocosdenshion_manual.h",
|
||||
"cocos/scripting/lua-bindings/manual/cocostudio/CustomGUIReader.cpp",
|
||||
"cocos/scripting/lua-bindings/manual/cocostudio/CustomGUIReader.h",
|
||||
"cocos/scripting/lua-bindings/manual/cocostudio/lua_cocos2dx_coco_studio_manual.cpp",
|
||||
"cocos/scripting/lua-bindings/manual/cocostudio/lua_cocos2dx_coco_studio_manual.hpp",
|
||||
"cocos/scripting/lua-bindings/manual/controller/lua_cocos2dx_controller_manual.cpp",
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
## Prerequisites:
|
||||
|
||||
* Android NDK
|
||||
* Android SDK **OR** Eclipse ADT Bundle
|
||||
* Android AVD target installed
|
||||
|
||||
## Building project
|
||||
|
||||
There are two ways of building Android projects.
|
||||
|
||||
1. Eclipse
|
||||
2. Command Line
|
||||
|
||||
### Import Project in Eclipse
|
||||
|
||||
####Step 1: C/C++ Environment Variable `NDK_ROOT`
|
||||
|
||||
* Eclipse->Preferences->C/C++->Build->**Environment**.
|
||||
* Click **Add** button and add a new variable `NDK_ROOT` pointing to the root NDK directory.
|
||||
![Example](https://lh3.googleusercontent.com/-AVcY8IAT0_g/UUOYltoRobI/AAAAAAAAsdM/22D2J9u3sig/s400/cocos2d-x-eclipse-ndk.png)
|
||||
* Only for Windows: Add new variables **CYGWIN** with value `nodosfilewarning` and **SHELLOPTS** with value `igncr`
|
||||
|
||||
####Step 2: Adding and running from Eclipse
|
||||
|
||||
![Example](https://lh3.googleusercontent.com/-SLBOu6e3QbE/UUOcOXYaGqI/AAAAAAAAsdo/tYBY2SylOSM/s288/cocos2d-x-eclipse-project-from-code.png) ![Import](https://lh5.googleusercontent.com/-XzC9Pn65USc/UUOcOTAwizI/AAAAAAAAsdk/4b6YM-oim9Y/s400/cocos2d-x-eclipse-import-project.png)
|
||||
|
||||
1. File->New->Project->Android Project From Existing Code
|
||||
2. **Browse** to your project directory and Add the project
|
||||
3. Click **Run as Android Application** to run on connected device or emulator.
|
||||
|
||||
That's all !!!
|
||||
|
||||
### Running project from Command Line
|
||||
|
||||
$ cd NEW_PROJECTS_DIR/MyGame
|
||||
$ cocos run -p android -j 4
|
|
@ -65,12 +65,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
auto engine = LuaEngine::getInstance();
|
||||
ScriptEngineManager::getInstance()->setScriptEngine(engine);
|
||||
lua_State* L = engine->getLuaStack()->getLuaState();
|
||||
lua_getglobal(L, "_G");
|
||||
if (lua_istable(L,-1))//stack:...,_G,
|
||||
{
|
||||
lua_module_register(L);
|
||||
}
|
||||
lua_pop(L, 1);//statck:...
|
||||
lua_module_register(L);
|
||||
|
||||
LuaStack* stack = engine->getLuaStack();
|
||||
stack->setXXTEAKeyAndSign("2dxLua", strlen("2dxLua"), "XXTEA", strlen("XXTEA"));
|
||||
|
|
|
@ -1,87 +0,0 @@
|
|||
## Prerequisites:
|
||||
|
||||
* Android NDK
|
||||
* Android SDK **OR** Eclipse ADT Bundle
|
||||
* Android AVD target installed
|
||||
|
||||
## Building project
|
||||
|
||||
There are two ways of building Android projects.
|
||||
|
||||
1. Eclipse
|
||||
2. Command Line
|
||||
|
||||
### Import Project in Eclipse
|
||||
|
||||
#### Features:
|
||||
|
||||
1. Complete workflow from Eclipse, including:
|
||||
* Build C++.
|
||||
* Clean C++.
|
||||
* Build and Run whole project.
|
||||
* Logcat view.
|
||||
* Debug Java code.
|
||||
* Javascript editor.
|
||||
* Project management.
|
||||
2. True C++ editing, including:
|
||||
* Code completion.
|
||||
* Jump to definition.
|
||||
* Refactoring tools etc.
|
||||
* Quick open C++ files.
|
||||
|
||||
|
||||
#### Setup Eclipse Environment (only once)
|
||||
|
||||
|
||||
**NOTE:** This step needs to be done only once to setup the Eclipse environment for cocos2d-x projects. Skip this section if you've done this before.
|
||||
|
||||
1. Download Eclipse ADT bundle from [Google ADT homepage](http://developer.android.com/sdk/index.html)
|
||||
|
||||
**OR**
|
||||
|
||||
Install Eclipse with Java. Add ADT and CDT plugins.
|
||||
|
||||
2. Only for Windows
|
||||
1. Install [Cygwin](http://www.cygwin.com/) with make (select make package from the list during the install).
|
||||
2. Add `Cygwin\bin` directory to system PATH variable.
|
||||
3. Add this line `none /cygdrive cygdrive binary,noacl,posix=0,user 0 0` to `Cygwin\etc\fstab` file.
|
||||
|
||||
3. Set up Variables:
|
||||
1. Path Variable `COCOS2DX`:
|
||||
* Eclipse->Preferences->General->Workspace->**Linked Resources**
|
||||
* Click **New** button to add a Path Variable `COCOS2DX` pointing to the root cocos2d-x directory.
|
||||
![Example](https://lh5.googleusercontent.com/-oPpk9kg3e5w/UUOYlq8n7aI/AAAAAAAAsdQ/zLA4eghBH9U/s400/cocos2d-x-eclipse-vars.png)
|
||||
|
||||
2. C/C++ Environment Variable `NDK_ROOT`:
|
||||
* Eclipse->Preferences->C/C++->Build->**Environment**.
|
||||
* Click **Add** button and add a new variable `NDK_ROOT` pointing to the root NDK directory.
|
||||
![Example](https://lh3.googleusercontent.com/-AVcY8IAT0_g/UUOYltoRobI/AAAAAAAAsdM/22D2J9u3sig/s400/cocos2d-x-eclipse-ndk.png)
|
||||
* Only for Windows: Add new variables **CYGWIN** with value `nodosfilewarning` and **SHELLOPTS** with value `igncr`
|
||||
|
||||
4. Import libcocos2dx library project:
|
||||
1. File->New->Project->Android Project From Existing Code.
|
||||
2. Click **Browse** button and open `cocos2d-x/cocos2dx/platform/android/java` directory.
|
||||
3. Click **Finish** to add project.
|
||||
|
||||
#### Adding and running from Eclipse
|
||||
|
||||
![Example](https://lh3.googleusercontent.com/-SLBOu6e3QbE/UUOcOXYaGqI/AAAAAAAAsdo/tYBY2SylOSM/s288/cocos2d-x-eclipse-project-from-code.png) ![Import](https://lh5.googleusercontent.com/-XzC9Pn65USc/UUOcOTAwizI/AAAAAAAAsdk/4b6YM-oim9Y/s400/cocos2d-x-eclipse-import-project.png)
|
||||
|
||||
1. File->New->Project->Android Project From Existing Code
|
||||
2. **Browse** to your project directory. eg: `cocos2d-x/cocos2dx/samples/Cpp/TestCpp/proj.android/`
|
||||
3. Add the project
|
||||
4. Click **Run** or **Debug** to compile C++ followed by Java and to run on connected device or emulator.
|
||||
|
||||
|
||||
### Running project from Command Line
|
||||
|
||||
$ cd cocos2d-x/samples/Cpp/TestCpp/proj.android/
|
||||
$ export NDK_ROOT=/path/to/ndk
|
||||
$ ./build_native.sh
|
||||
$ ant debug install
|
||||
|
||||
If the last command results in sdk.dir missing error then do:
|
||||
|
||||
$ android list target
|
||||
$ android update project -p . -t (id from step 6)
|
||||
$ android update project -p cocos2d-x/cocos2dx/platform/android/java/ -t (id from step 6)
|
|
@ -70,6 +70,7 @@ Classes/UITest/CocoStudioGUITest/GUIEditorTest.cpp \
|
|||
Classes/UITest/CocoStudioGUITest/CustomGUIScene.cpp \
|
||||
Classes/UITest/CocoStudioGUITest/UIScene.cpp \
|
||||
Classes/UITest/CocoStudioGUITest/UIScale9SpriteTest.cpp \
|
||||
Classes/UITest/CocoStudioGUITest/UIEditBoxTest.cpp \
|
||||
Classes/UITest/CocoStudioGUITest/UISceneManager.cpp \
|
||||
Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest.cpp \
|
||||
Classes/UITest/CocoStudioGUITest/UIFocusTest/UIFocusTest.cpp \
|
||||
|
@ -123,12 +124,10 @@ Classes/ExtensionsTest/ControlExtensionTest/CCControlPotentiometerTest/CCControl
|
|||
Classes/ExtensionsTest/ControlExtensionTest/CCControlSliderTest/CCControlSliderTest.cpp \
|
||||
Classes/ExtensionsTest/ControlExtensionTest/CCControlStepperTest/CCControlStepperTest.cpp \
|
||||
Classes/ExtensionsTest/ControlExtensionTest/CCControlSwitchTest/CCControlSwitchTest.cpp \
|
||||
Classes/ExtensionsTest/EditBoxTest/EditBoxTest.cpp \
|
||||
Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp \
|
||||
Classes/ExtensionsTest/NetworkTest/SocketIOTest.cpp \
|
||||
Classes/ExtensionsTest/NetworkTest/WebSocketTest.cpp \
|
||||
Classes/ExtensionsTest/NotificationCenterTest/NotificationCenterTest.cpp \
|
||||
Classes/ExtensionsTest/Scale9SpriteTest/Scale9SpriteTest.cpp \
|
||||
Classes/ExtensionsTest/TableViewTest/CustomTableViewCell.cpp \
|
||||
Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp \
|
||||
Classes/FileUtilsTest/FileUtilsTest.cpp \
|
||||
|
|
|
@ -2,7 +2,6 @@ set(APP_NAME cpp-tests)
|
|||
|
||||
if(WIN32)
|
||||
set(PLATFORM_SRC
|
||||
Classes/ExtensionsTest/EditBoxTest/EditBoxTest.cpp
|
||||
Classes/ExtensionsTest/NetworkTest/WebSocketTest.cpp
|
||||
Classes/ExtensionsTest/NetworkTest/SocketIOTest.cpp
|
||||
proj.win32/main.cpp
|
||||
|
@ -124,7 +123,6 @@ set(SAMPLE_SRC
|
|||
Classes/UITest/CocoStudioGUITest/CustomWidget/CustomReader.cpp
|
||||
Classes/UITest/CocoStudioGUITest/CustomTest/CustomImageTest/CustomImageTest.cpp
|
||||
Classes/UITest/CocoStudioGUITest/CustomTest/CustomParticleWidgetTest/CustomParticleWidgetTest.cpp
|
||||
Classes/ExtensionsTest/Scale9SpriteTest/Scale9SpriteTest.cpp
|
||||
Classes/NewRendererTest/NewRendererTest.cpp
|
||||
Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp
|
||||
Classes/FontTest/FontTest.cpp
|
||||
|
|
|
@ -91,8 +91,8 @@ bool ControlButtonTest_HelloVariableSize::init()
|
|||
ControlButton *ControlButtonTest_HelloVariableSize::standardButtonWithTitle(const char * title)
|
||||
{
|
||||
/** Creates and return a button with a default background and title color. */
|
||||
auto backgroundButton = Scale9Sprite::create("extensions/button.png");
|
||||
auto backgroundHighlightedButton = Scale9Sprite::create("extensions/buttonHighlighted.png");
|
||||
auto backgroundButton = cocos2d::extension::Scale9Sprite::create("extensions/button.png");
|
||||
auto backgroundHighlightedButton = cocos2d::extension::Scale9Sprite::create("extensions/buttonHighlighted.png");
|
||||
|
||||
auto titleButton = Label::createWithTTF(title, "fonts/Marker Felt.ttf", 30);
|
||||
|
||||
|
@ -258,7 +258,7 @@ bool ControlButtonTest_Styling::init()
|
|||
layer->setPosition(screenSize.width / 2.0f, screenSize.height / 2.0f);
|
||||
|
||||
// Add the black background
|
||||
auto backgroundButton = Scale9Sprite::create("extensions/buttonBackground.png");
|
||||
auto backgroundButton = cocos2d::extension::Scale9Sprite::create("extensions/buttonBackground.png");
|
||||
backgroundButton->setContentSize(Size(max_w + 14, max_h + 14));
|
||||
backgroundButton->setPosition(screenSize.width / 2.0f, screenSize.height / 2.0f);
|
||||
addChild(backgroundButton);
|
||||
|
|
|
@ -1,134 +0,0 @@
|
|||
//
|
||||
// EditBoxTest.cpp
|
||||
// TestCpp
|
||||
//
|
||||
// Created by James on 8/14/12.
|
||||
//
|
||||
//
|
||||
|
||||
#include "EditBoxTest.h"
|
||||
#include "../ExtensionsTest.h"
|
||||
|
||||
USING_NS_CC;
|
||||
USING_NS_CC_EXT;
|
||||
|
||||
|
||||
EditBoxTest::EditBoxTest()
|
||||
{
|
||||
auto glview = Director::getInstance()->getOpenGLView();
|
||||
auto visibleOrigin = glview->getVisibleOrigin();
|
||||
auto visibleSize = glview->getVisibleSize();
|
||||
|
||||
auto pBg = Sprite::create("Images/HelloWorld.png");
|
||||
pBg->setPosition(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/2);
|
||||
addChild(pBg);
|
||||
|
||||
_TTFShowEditReturn = Label::createWithSystemFont("No edit control return!", "", 30);
|
||||
_TTFShowEditReturn->setPosition(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y + visibleSize.height - 50);
|
||||
addChild(_TTFShowEditReturn);
|
||||
|
||||
// Back Menu
|
||||
auto itemBack = MenuItemFont::create("Back", CC_CALLBACK_1(EditBoxTest::toExtensionsMainLayer, this));
|
||||
itemBack->setPosition(visibleOrigin.x+visibleSize.width - 50, visibleOrigin.y+25);
|
||||
auto menuBack = Menu::create(itemBack, nullptr);
|
||||
menuBack->setPosition(Vec2::ZERO);
|
||||
addChild(menuBack);
|
||||
|
||||
auto editBoxSize = Size(visibleSize.width - 100, 60);
|
||||
|
||||
// top
|
||||
_editName = EditBox::create(editBoxSize, Scale9Sprite::create("extensions/green_edit.png"));
|
||||
_editName->setPosition(Vec2(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height*3/4));
|
||||
_editName->setFontName("Paint Boy");
|
||||
_editName->setFontSize(25);
|
||||
_editName->setFontColor(Color3B::RED);
|
||||
_editName->setPlaceHolder("Name:");
|
||||
_editName->setPlaceholderFontColor(Color3B::WHITE);
|
||||
_editName->setMaxLength(8);
|
||||
_editName->setReturnType(EditBox::KeyboardReturnType::DONE);
|
||||
_editName->setDelegate(this);
|
||||
addChild(_editName);
|
||||
|
||||
// middle
|
||||
_editPassword = EditBox::create(editBoxSize, Scale9Sprite::create("extensions/orange_edit.png"));
|
||||
_editPassword->setPosition(Vec2(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/2));
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
||||
_editPassword->setFont("American Typewriter", 30);
|
||||
#else
|
||||
_editPassword->setFont("American Typewriter", 80);
|
||||
_editPassword->setPlaceholderFont("American Typewriter", 80);
|
||||
#endif
|
||||
_editPassword->setFontColor(Color3B::GREEN);
|
||||
_editPassword->setPlaceHolder("Password:");
|
||||
_editPassword->setMaxLength(6);
|
||||
_editPassword->setInputFlag(EditBox::InputFlag::PASSWORD);
|
||||
_editPassword->setInputMode(EditBox::InputMode::SINGLE_LINE);
|
||||
_editPassword->setDelegate(this);
|
||||
addChild(_editPassword);
|
||||
|
||||
// bottom
|
||||
_editEmail = EditBox::create(Size(editBoxSize.width, editBoxSize.height), Scale9Sprite::create("extensions/yellow_edit.png"));
|
||||
_editEmail->setPosition(Vec2(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/4));
|
||||
_editEmail->setAnchorPoint(Vec2(0.5, 1.0f));
|
||||
_editEmail->setPlaceHolder("Email:");
|
||||
_editEmail->setInputMode(EditBox::InputMode::EMAIL_ADDRESS);
|
||||
_editEmail->setDelegate(this);
|
||||
addChild(_editEmail);
|
||||
|
||||
this->setPosition(10, 20);
|
||||
}
|
||||
|
||||
EditBoxTest::~EditBoxTest()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void EditBoxTest::toExtensionsMainLayer(cocos2d::Ref *sender)
|
||||
{
|
||||
auto scene = new (std::nothrow) ExtensionsTestScene();
|
||||
scene->runThisTest();
|
||||
scene->release();
|
||||
}
|
||||
|
||||
void EditBoxTest::editBoxEditingDidBegin(cocos2d::extension::EditBox* editBox)
|
||||
{
|
||||
log("editBox %p DidBegin !", editBox);
|
||||
}
|
||||
|
||||
void EditBoxTest::editBoxEditingDidEnd(cocos2d::extension::EditBox* editBox)
|
||||
{
|
||||
log("editBox %p DidEnd !", editBox);
|
||||
}
|
||||
|
||||
void EditBoxTest::editBoxTextChanged(cocos2d::extension::EditBox* editBox, const std::string& text)
|
||||
{
|
||||
log("editBox %p TextChanged, text: %s ", editBox, text.c_str());
|
||||
}
|
||||
|
||||
void EditBoxTest::editBoxReturn(EditBox* editBox)
|
||||
{
|
||||
log("editBox %p was returned !",editBox);
|
||||
|
||||
if (_editName == editBox)
|
||||
{
|
||||
_TTFShowEditReturn->setString("Name EditBox return !");
|
||||
}
|
||||
else if (_editPassword == editBox)
|
||||
{
|
||||
_TTFShowEditReturn->setString("Password EditBox return !");
|
||||
}
|
||||
else if (_editEmail == editBox)
|
||||
{
|
||||
_TTFShowEditReturn->setString("Email EditBox return !");
|
||||
}
|
||||
}
|
||||
|
||||
void runEditBoxTest()
|
||||
{
|
||||
auto scene = Scene::create();
|
||||
EditBoxTest *layer = new (std::nothrow) EditBoxTest();
|
||||
scene->addChild(layer);
|
||||
|
||||
Director::getInstance()->replaceScene(scene);
|
||||
layer->release();
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
//
|
||||
// EditBoxTest.h
|
||||
// TestCpp
|
||||
//
|
||||
// Created by James on 8/14/12.
|
||||
//
|
||||
//
|
||||
|
||||
#ifndef __TestCpp__CCEditBoxTest__
|
||||
#define __TestCpp__CCEditBoxTest__
|
||||
|
||||
#include "cocos2d.h"
|
||||
#include "extensions/cocos-ext.h"
|
||||
|
||||
class EditBoxTest : public cocos2d::Layer, public cocos2d::extension::EditBoxDelegate
|
||||
{
|
||||
public:
|
||||
EditBoxTest();
|
||||
virtual ~EditBoxTest();
|
||||
void toExtensionsMainLayer(cocos2d::Ref *sender);
|
||||
|
||||
virtual void editBoxEditingDidBegin(cocos2d::extension::EditBox* editBox);
|
||||
virtual void editBoxEditingDidEnd(cocos2d::extension::EditBox* editBox);
|
||||
virtual void editBoxTextChanged(cocos2d::extension::EditBox* editBox, const std::string& text);
|
||||
virtual void editBoxReturn(cocos2d::extension::EditBox* editBox);
|
||||
private:
|
||||
cocos2d::Label* _TTFShowEditReturn;
|
||||
cocos2d::extension::EditBox* _editName;
|
||||
cocos2d::extension::EditBox* _editPassword;
|
||||
cocos2d::extension::EditBox* _editEmail;
|
||||
};
|
||||
|
||||
void runEditBoxTest();
|
||||
|
||||
#endif /* defined(__TestCpp__CCEditBoxTest__) */
|
|
@ -18,11 +18,6 @@
|
|||
#include "NetworkTest/SocketIOTest.h"
|
||||
#endif
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
|
||||
#include "EditBoxTest/EditBoxTest.h"
|
||||
#endif
|
||||
|
||||
#include "Scale9SpriteTest/Scale9SpriteTest.h"
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -36,15 +31,6 @@ static struct {
|
|||
} g_extensionsTests[] = {
|
||||
{ "NotificationCenterTest", [](Ref* sender) { runNotificationCenterTest(); }
|
||||
},
|
||||
{ "Scale9SpriteTest", [](Ref* sender) {
|
||||
auto scene = new (std::nothrow) S9SpriteTestScene();
|
||||
if (scene)
|
||||
{
|
||||
scene->runThisTest();
|
||||
scene->release();
|
||||
}
|
||||
}
|
||||
},
|
||||
{ "CCControlButtonTest", [](Ref *sender){
|
||||
ControlSceneManager* pManager = ControlSceneManager::sharedControlSceneManager();
|
||||
auto scene = pManager->currentControlScene();
|
||||
|
@ -68,10 +54,7 @@ static struct {
|
|||
{ "SocketIOTest", [](Ref *sender){ runSocketIOTest();}
|
||||
},
|
||||
#endif
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
|
||||
{ "EditBoxTest", [](Ref *sender){ runEditBoxTest();}
|
||||
},
|
||||
#endif
|
||||
|
||||
{ "TableViewTest", [](Ref *sender){ runTableViewTest();}
|
||||
},
|
||||
{ "CocoStudioArmatureTest", [](Ref *sender) { ArmatureTestScene *scene = new (std::nothrow) ArmatureTestScene();
|
||||
|
|
|
@ -1,784 +0,0 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
Copyright (c) 2013 Surith Thekkiam
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "Scale9SpriteTest.h"
|
||||
#include "testResource.h"
|
||||
#include "cocos2d.h"
|
||||
#include "extensions/cocos-ext.h"
|
||||
|
||||
USING_NS_CC_EXT;
|
||||
|
||||
static std::function<Layer*()> createFunctions[] = {
|
||||
CL(S9BatchNodeBasic),
|
||||
CL(S9FrameNameSpriteSheet),
|
||||
CL(S9FrameNameSpriteSheetRotated),
|
||||
CL(S9BatchNodeScaledNoInsets),
|
||||
CL(S9FrameNameSpriteSheetScaledNoInsets),
|
||||
CL(S9FrameNameSpriteSheetRotatedScaledNoInsets),
|
||||
CL(S9BatchNodeScaleWithCapInsets),
|
||||
CL(S9FrameNameSpriteSheetInsets),
|
||||
CL(S9FrameNameSpriteSheetInsetsScaled),
|
||||
CL(S9FrameNameSpriteSheetRotatedInsets),
|
||||
CL(S9_TexturePacker),
|
||||
CL(S9FrameNameSpriteSheetRotatedInsetsScaled),
|
||||
CL(S9FrameNameSpriteSheetRotatedSetCapInsetLater),
|
||||
CL(S9CascadeOpacityAndColor),
|
||||
CL(S9ZOrder),
|
||||
CL(S9Flip)
|
||||
};
|
||||
|
||||
static int sceneIdx=-1;
|
||||
#define MAX_LAYER (sizeof(createFunctions) / sizeof(createFunctions[0]))
|
||||
|
||||
static Layer* nextAction()
|
||||
{
|
||||
sceneIdx++;
|
||||
sceneIdx = sceneIdx % MAX_LAYER;
|
||||
|
||||
auto layer = (createFunctions[sceneIdx])();
|
||||
return layer;
|
||||
}
|
||||
|
||||
static Layer* backAction()
|
||||
{
|
||||
sceneIdx--;
|
||||
int total = MAX_LAYER;
|
||||
if( sceneIdx < 0 )
|
||||
sceneIdx += total;
|
||||
|
||||
auto layer = (createFunctions[sceneIdx])();
|
||||
return layer;
|
||||
}
|
||||
|
||||
static Layer* restartAction()
|
||||
{
|
||||
auto layer = (createFunctions[sceneIdx])();
|
||||
return layer;
|
||||
}
|
||||
|
||||
void S9SpriteTestScene::runThisTest()
|
||||
{
|
||||
sceneIdx = -1;
|
||||
addChild(nextAction());
|
||||
|
||||
Director::getInstance()->replaceScene(this);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
//
|
||||
// S9SpriteTestDemo
|
||||
//
|
||||
//------------------------------------------------------------------
|
||||
|
||||
void S9SpriteTestDemo::onEnter()
|
||||
{
|
||||
BaseTest::onEnter();
|
||||
SpriteFrameCache::getInstance()->addSpriteFramesWithFile(s_s9s_blocks9_plist);
|
||||
CCLOG("sprite frames added to sprite frame cache...");
|
||||
}
|
||||
|
||||
void S9SpriteTestDemo::restartCallback(Ref* sender)
|
||||
{
|
||||
auto s = new (std::nothrow) S9SpriteTestScene();
|
||||
s->addChild( restartAction() );
|
||||
Director::getInstance()->replaceScene(s);
|
||||
s->release();
|
||||
}
|
||||
|
||||
void S9SpriteTestDemo::nextCallback(Ref* sender)
|
||||
{
|
||||
auto s = new (std::nothrow) S9SpriteTestScene();
|
||||
s->addChild( nextAction() );
|
||||
Director::getInstance()->replaceScene(s);
|
||||
s->release();
|
||||
}
|
||||
|
||||
void S9SpriteTestDemo::backCallback(Ref* sender)
|
||||
{
|
||||
auto s = new (std::nothrow) S9SpriteTestScene();
|
||||
s->addChild( backAction() );
|
||||
Director::getInstance()->replaceScene(s);
|
||||
s->release();
|
||||
}
|
||||
|
||||
|
||||
// S9BatchNodeBasic
|
||||
|
||||
void S9BatchNodeBasic::onEnter()
|
||||
{
|
||||
S9SpriteTestDemo::onEnter();
|
||||
auto winSize = Director::getInstance()->getWinSize();
|
||||
float x = winSize.width / 2;
|
||||
float y = 0 + (winSize.height / 2);
|
||||
|
||||
log("S9BatchNodeBasic ...");
|
||||
|
||||
auto batchNode = SpriteBatchNode::create("Images/blocks9.png");
|
||||
log("batchNode created with : Images/blocks9.png");
|
||||
|
||||
auto blocks = Scale9Sprite::create();
|
||||
log("... created");
|
||||
|
||||
blocks->updateWithBatchNode(batchNode, Rect(0, 0, 96, 96), false, Rect(0, 0, 96, 96));
|
||||
log("... updateWithBatchNode");
|
||||
|
||||
blocks->setPosition(Vec2(x, y));
|
||||
log("... setPosition");
|
||||
|
||||
this->addChild(blocks);
|
||||
log("this->addChild");
|
||||
|
||||
log("... S9BatchNodeBasic done.");
|
||||
}
|
||||
|
||||
std::string S9BatchNodeBasic::title() const
|
||||
{
|
||||
return "Scale9Sprite created empty and updated from SpriteBatchNode";
|
||||
}
|
||||
|
||||
std::string S9BatchNodeBasic::subtitle() const
|
||||
{
|
||||
return "updateWithBatchNode(); capInsets=full size";
|
||||
}
|
||||
|
||||
|
||||
// S9FrameNameSpriteSheet
|
||||
|
||||
void S9FrameNameSpriteSheet::onEnter()
|
||||
{
|
||||
S9SpriteTestDemo::onEnter();
|
||||
auto winSize = Director::getInstance()->getWinSize();
|
||||
float x = winSize.width / 2;
|
||||
float y = 0 + (winSize.height / 2);
|
||||
|
||||
log("S9FrameNameSpriteSheet ...");
|
||||
|
||||
auto blocks = Scale9Sprite::createWithSpriteFrameName("blocks9.png");
|
||||
log("... created");
|
||||
|
||||
blocks->setPosition(Vec2(x, y));
|
||||
log("... setPosition");
|
||||
|
||||
this->addChild(blocks);
|
||||
log("this->addChild");
|
||||
|
||||
log("... S9FrameNameSpriteSheet done.");
|
||||
}
|
||||
|
||||
std::string S9FrameNameSpriteSheet::title() const
|
||||
{
|
||||
return "Scale9Sprite from sprite sheet";
|
||||
}
|
||||
|
||||
std::string S9FrameNameSpriteSheet::subtitle() const
|
||||
{
|
||||
return "createWithSpriteFrameName(); default cap insets";
|
||||
}
|
||||
|
||||
//
|
||||
//// S9FrameNameSpriteSheetRotated
|
||||
//
|
||||
void S9FrameNameSpriteSheetRotated::onEnter()
|
||||
{
|
||||
S9SpriteTestDemo::onEnter();
|
||||
auto winSize = Director::getInstance()->getWinSize();
|
||||
float x = winSize.width / 2;
|
||||
float y = 0 + (winSize.height / 2);
|
||||
|
||||
log("S9FrameNameSpriteSheetRotated ...");
|
||||
|
||||
auto blocks = Scale9Sprite::createWithSpriteFrameName("blocks9r.png");
|
||||
log("... created");
|
||||
|
||||
blocks->setPosition(Vec2(x, y));
|
||||
log("... setPosition");
|
||||
|
||||
this->addChild(blocks);
|
||||
log("this->addChild");
|
||||
|
||||
log("... S9FrameNameSpriteSheetRotated done.");
|
||||
}
|
||||
|
||||
std::string S9FrameNameSpriteSheetRotated::title() const
|
||||
{
|
||||
return "Scale9Sprite from sprite sheet (stored rotated)";
|
||||
}
|
||||
|
||||
std::string S9FrameNameSpriteSheetRotated::subtitle() const
|
||||
{
|
||||
return "createWithSpriteFrameName(); default cap insets";
|
||||
}
|
||||
|
||||
//
|
||||
//// S9BatchNodeScaledNoInsets
|
||||
//
|
||||
|
||||
void S9BatchNodeScaledNoInsets::onEnter()
|
||||
{
|
||||
S9SpriteTestDemo::onEnter();
|
||||
auto winSize = Director::getInstance()->getWinSize();
|
||||
float x = winSize.width / 2;
|
||||
float y = 0 + (winSize.height / 2);
|
||||
|
||||
log("S9BatchNodeScaledNoInsets ...");
|
||||
|
||||
// scaled without insets
|
||||
auto batchNode_scaled = SpriteBatchNode::create("Images/blocks9.png");
|
||||
log("batchNode_scaled created with : Images/blocks9.png");
|
||||
|
||||
auto blocks_scaled = Scale9Sprite::create();
|
||||
log("... created");
|
||||
blocks_scaled->updateWithBatchNode(batchNode_scaled, Rect(0, 0, 96, 96), false, Rect(0, 0, 96, 96));
|
||||
log("... updateWithBatchNode");
|
||||
|
||||
blocks_scaled->setPosition(Vec2(x, y));
|
||||
log("... setPosition");
|
||||
|
||||
blocks_scaled->setContentSize(Size(96 * 4, 96*2));
|
||||
log("... setContentSize");
|
||||
|
||||
this->addChild(blocks_scaled);
|
||||
log("this->addChild");
|
||||
|
||||
log("... S9BtchNodeScaledNoInsets done.");
|
||||
}
|
||||
|
||||
std::string S9BatchNodeScaledNoInsets::title() const
|
||||
{
|
||||
return "Scale9Sprite created empty and updated from SpriteBatchNode";
|
||||
}
|
||||
|
||||
std::string S9BatchNodeScaledNoInsets::subtitle() const
|
||||
{
|
||||
return "updateWithBatchNode(); capInsets=full size; rendered 4 X width, 2 X height";
|
||||
}
|
||||
|
||||
//
|
||||
//// S9FrameNameSpriteSheetScaledNoInsets
|
||||
//
|
||||
|
||||
void S9FrameNameSpriteSheetScaledNoInsets::onEnter()
|
||||
{
|
||||
S9SpriteTestDemo::onEnter();
|
||||
auto winSize = Director::getInstance()->getWinSize();
|
||||
float x = winSize.width / 2;
|
||||
float y = 0 + (winSize.height / 2);
|
||||
|
||||
log("S9FrameNameSpriteSheetScaledNoInsets ...");
|
||||
|
||||
auto blocks_scaled = Scale9Sprite::createWithSpriteFrameName("blocks9.png");
|
||||
log("... created");
|
||||
|
||||
blocks_scaled->setPosition(Vec2(x, y));
|
||||
log("... setPosition");
|
||||
|
||||
blocks_scaled->setContentSize(Size(96 * 4, 96*2));
|
||||
log("... setContentSize");
|
||||
|
||||
this->addChild(blocks_scaled);
|
||||
log("this->addChild");
|
||||
|
||||
log("... S9FrameNameSpriteSheetScaledNoInsets done.");
|
||||
}
|
||||
|
||||
std::string S9FrameNameSpriteSheetScaledNoInsets::title() const
|
||||
{
|
||||
return "Scale9Sprite from sprite sheet";
|
||||
}
|
||||
|
||||
std::string S9FrameNameSpriteSheetScaledNoInsets::subtitle() const
|
||||
{
|
||||
return "createWithSpriteFrameName(); default cap insets; rendered 4 X width, 2 X height";
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
//// S9FrameNameSpriteSheetRotatedScaledNoInsets
|
||||
//
|
||||
|
||||
void S9FrameNameSpriteSheetRotatedScaledNoInsets::onEnter()
|
||||
{
|
||||
S9SpriteTestDemo::onEnter();
|
||||
auto winSize = Director::getInstance()->getWinSize();
|
||||
float x = winSize.width / 2;
|
||||
float y = 0 + (winSize.height / 2);
|
||||
|
||||
log("S9FrameNameSpriteSheetRotatedScaledNoInsets ...");
|
||||
|
||||
auto blocks_scaled = Scale9Sprite::createWithSpriteFrameName("blocks9r.png");
|
||||
log("... created");
|
||||
|
||||
blocks_scaled->setPosition(Vec2(x, y));
|
||||
log("... setPosition");
|
||||
|
||||
blocks_scaled->setContentSize(Size(96 * 4, 96*2));
|
||||
log("... setContentSize");
|
||||
|
||||
this->addChild(blocks_scaled);
|
||||
log("this->addChild");
|
||||
|
||||
log("... S9FrameNameSpriteSheetRotatedScaledNoInsets done.");
|
||||
}
|
||||
|
||||
std::string S9FrameNameSpriteSheetRotatedScaledNoInsets::title() const
|
||||
{
|
||||
return "Scale9Sprite from sprite sheet (stored rotated)";
|
||||
}
|
||||
|
||||
std::string S9FrameNameSpriteSheetRotatedScaledNoInsets::subtitle() const
|
||||
{
|
||||
return "createWithSpriteFrameName(); default cap insets; rendered 4 X width, 2 X height";
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//// S9BatchNodeScaleWithCapInsets
|
||||
//
|
||||
|
||||
void S9BatchNodeScaleWithCapInsets::onEnter()
|
||||
{
|
||||
S9SpriteTestDemo::onEnter();
|
||||
auto winSize = Director::getInstance()->getWinSize();
|
||||
float x = winSize.width / 2;
|
||||
float y = 0 + (winSize.height / 2);
|
||||
|
||||
log("S9BatchNodeScaleWithCapInsets ...");
|
||||
|
||||
auto batchNode_scaled_with_insets = SpriteBatchNode::create("Images/blocks9.png");
|
||||
log("batchNode_scaled_with_insets created with : Images/blocks9.png");
|
||||
|
||||
auto blocks_scaled_with_insets = Scale9Sprite::create();
|
||||
log("... created");
|
||||
|
||||
blocks_scaled_with_insets->updateWithBatchNode(batchNode_scaled_with_insets, Rect(0, 0, 96, 96), false, Rect(32, 32, 32, 32));
|
||||
log("... updateWithBatchNode");
|
||||
|
||||
blocks_scaled_with_insets->setContentSize(Size(96 * 4.5, 96 * 2.5));
|
||||
log("... setContentSize");
|
||||
|
||||
blocks_scaled_with_insets->setPosition(Vec2(x, y));
|
||||
log("... setPosition");
|
||||
|
||||
this->addChild(blocks_scaled_with_insets);
|
||||
log("this->addChild");
|
||||
|
||||
log("... S9BatchNodeScaleWithCapInsets done.");
|
||||
}
|
||||
|
||||
std::string S9BatchNodeScaleWithCapInsets::title() const
|
||||
{
|
||||
return "Scale9Sprite created empty and updated from SpriteBatchNode";
|
||||
}
|
||||
|
||||
std::string S9BatchNodeScaleWithCapInsets::subtitle() const
|
||||
{
|
||||
return "updateWithBatchNode(); capInsets=(32, 32, 32, 32)";
|
||||
}
|
||||
|
||||
//
|
||||
//// S9FrameNameSpriteSheetInsets
|
||||
//
|
||||
|
||||
void S9FrameNameSpriteSheetInsets::onEnter()
|
||||
{
|
||||
S9SpriteTestDemo::onEnter();
|
||||
auto winSize = Director::getInstance()->getWinSize();
|
||||
float x = winSize.width / 2;
|
||||
float y = 0 + (winSize.height / 2);
|
||||
|
||||
log("S9FrameNameSpriteSheetInsets ...");
|
||||
|
||||
auto blocks_with_insets = Scale9Sprite::createWithSpriteFrameName("blocks9.png", Rect(32, 32, 32, 32));
|
||||
log("... created");
|
||||
|
||||
blocks_with_insets->setPosition(Vec2(x, y));
|
||||
log("... setPosition");
|
||||
|
||||
this->addChild(blocks_with_insets);
|
||||
log("this->addChild");
|
||||
|
||||
log("... S9FrameNameSpriteSheetInsets done.");
|
||||
}
|
||||
|
||||
std::string S9FrameNameSpriteSheetInsets::title() const
|
||||
{
|
||||
return "Scale9Sprite scaled with insets sprite sheet";
|
||||
}
|
||||
|
||||
std::string S9FrameNameSpriteSheetInsets::subtitle() const
|
||||
{
|
||||
return "createWithSpriteFrameName(); cap insets=(32, 32, 32, 32)";
|
||||
}
|
||||
|
||||
//
|
||||
//// S9FrameNameSpriteSheetInsetsScaled
|
||||
//
|
||||
void S9FrameNameSpriteSheetInsetsScaled::onEnter()
|
||||
{
|
||||
S9SpriteTestDemo::onEnter();
|
||||
auto winSize = Director::getInstance()->getWinSize();
|
||||
float x = winSize.width / 2;
|
||||
float y = 0 + (winSize.height / 2);
|
||||
|
||||
log("S9FrameNameSpriteSheetInsetsScaled ...");
|
||||
|
||||
auto blocks_scaled_with_insets = Scale9Sprite::createWithSpriteFrameName("blocks9.png", Rect(32, 32, 32, 32));
|
||||
log("... created");
|
||||
|
||||
blocks_scaled_with_insets->setContentSize(Size(96 * 4.5, 96 * 2.5));
|
||||
log("... setContentSize");
|
||||
|
||||
blocks_scaled_with_insets->setPosition(Vec2(x, y));
|
||||
log("... setPosition");
|
||||
|
||||
this->addChild(blocks_scaled_with_insets);
|
||||
log("this->addChild");
|
||||
|
||||
log("... S9FrameNameSpriteSheetInsetsScaled done.");
|
||||
}
|
||||
|
||||
std::string S9FrameNameSpriteSheetInsetsScaled::title() const
|
||||
{
|
||||
return "Scale9Sprite scaled with insets sprite sheet";
|
||||
}
|
||||
|
||||
std::string S9FrameNameSpriteSheetInsetsScaled::subtitle() const
|
||||
{
|
||||
return "createWithSpriteFrameName(); default cap insets; rendered scaled 4.5 X width, 2.5 X height";
|
||||
}
|
||||
|
||||
//// S9FrameNameSpriteSheetRotatedInsets
|
||||
//
|
||||
|
||||
void S9FrameNameSpriteSheetRotatedInsets::onEnter()
|
||||
{
|
||||
S9SpriteTestDemo::onEnter();
|
||||
auto winSize = Director::getInstance()->getWinSize();
|
||||
float x = winSize.width / 2;
|
||||
float y = 0 + (winSize.height / 2);
|
||||
|
||||
log("S9FrameNameSpriteSheetRotatedInsets ...");
|
||||
|
||||
auto blocks_with_insets = Scale9Sprite::createWithSpriteFrameName("blocks9r.png", Rect(32, 32, 32, 32));
|
||||
log("... created");
|
||||
|
||||
blocks_with_insets->setPosition(Vec2(x, y));
|
||||
log("... setPosition");
|
||||
|
||||
this->addChild(blocks_with_insets);
|
||||
log("this->addChild");
|
||||
|
||||
log("... S9FrameNameSpriteSheetRotatedInsets done.");
|
||||
}
|
||||
|
||||
std::string S9FrameNameSpriteSheetRotatedInsets::title() const
|
||||
{
|
||||
return "Scale9Sprite scaled with insets sprite sheet (stored rotated)";
|
||||
}
|
||||
|
||||
std::string S9FrameNameSpriteSheetRotatedInsets::subtitle() const
|
||||
{
|
||||
return "createWithSpriteFrameName(); cap insets=(32, 32, 32, 32)";
|
||||
}
|
||||
|
||||
//
|
||||
//// S9_TexturePacker
|
||||
//
|
||||
|
||||
void S9_TexturePacker::onEnter()
|
||||
{
|
||||
S9SpriteTestDemo::onEnter();
|
||||
auto winSize = Director::getInstance()->getWinSize();
|
||||
SpriteFrameCache::getInstance()->addSpriteFramesWithFile(s_s9s_ui_plist);
|
||||
|
||||
float x = winSize.width / 4;
|
||||
float y = 0 + (winSize.height / 2);
|
||||
|
||||
log("S9_TexturePacker ...");
|
||||
|
||||
auto s = Scale9Sprite::createWithSpriteFrameName("button_normal.png");
|
||||
log("... created");
|
||||
|
||||
s->setPosition(Vec2(x, y));
|
||||
log("... setPosition");
|
||||
|
||||
s->setContentSize(Size(14 * 16, 10 * 16));
|
||||
log("... setContentSize");
|
||||
|
||||
this->addChild(s);
|
||||
log("this->addChild");
|
||||
|
||||
x = winSize.width * 3/4;
|
||||
|
||||
auto s2 = Scale9Sprite::createWithSpriteFrameName("button_actived.png");
|
||||
log("... created");
|
||||
|
||||
s2->setPosition(Vec2(x, y));
|
||||
log("... setPosition");
|
||||
|
||||
s2->setContentSize(Size(14 * 16, 10 * 16));
|
||||
log("... setContentSize");
|
||||
|
||||
this->addChild(s2);
|
||||
log("this->addChild");
|
||||
|
||||
log("... S9_TexturePacker done.");
|
||||
}
|
||||
|
||||
std::string S9_TexturePacker::title() const
|
||||
{
|
||||
return "Scale9Sprite from a spritesheet created with TexturePacker";
|
||||
}
|
||||
|
||||
std::string S9_TexturePacker::subtitle() const
|
||||
{
|
||||
return "createWithSpriteFrameName('button_normal.png');createWithSpriteFrameName('button_actived.png');";
|
||||
}
|
||||
|
||||
//
|
||||
//// S9FrameNameSpriteSheetRotatedInsetsScaled
|
||||
//
|
||||
|
||||
void S9FrameNameSpriteSheetRotatedInsetsScaled::onEnter()
|
||||
{
|
||||
S9SpriteTestDemo::onEnter();
|
||||
auto winSize = Director::getInstance()->getWinSize();
|
||||
float x = winSize.width / 2;
|
||||
float y = 0 + (winSize.height / 2);
|
||||
|
||||
log("S9FrameNameSpriteSheetRotatedInsetsScaled ...");
|
||||
|
||||
auto blocks_scaled_with_insets = Scale9Sprite::createWithSpriteFrameName("blocks9.png", Rect(32, 32, 32, 32));
|
||||
log("... created");
|
||||
|
||||
blocks_scaled_with_insets->setContentSize(Size(96 * 4.5, 96 * 2.5));
|
||||
log("... setContentSize");
|
||||
|
||||
blocks_scaled_with_insets->setPosition(Vec2(x, y));
|
||||
log("... setPosition");
|
||||
|
||||
this->addChild(blocks_scaled_with_insets);
|
||||
log("this->addChild");
|
||||
|
||||
log("... S9FrameNameSpriteSheetRotatedInsetsScaled done.");
|
||||
}
|
||||
|
||||
std::string S9FrameNameSpriteSheetRotatedInsetsScaled::title() const
|
||||
{
|
||||
return "Scale9Sprite scaled with insets sprite sheet (stored rotated)";
|
||||
}
|
||||
|
||||
std::string S9FrameNameSpriteSheetRotatedInsetsScaled::subtitle() const
|
||||
{
|
||||
return "createWithSpriteFrameName(); default cap insets; rendered scaled 4.5 X width, 2.5 X height";
|
||||
}
|
||||
|
||||
//
|
||||
//// Scale9FrameNameSpriteSheetRotatedSetCapInsetLater
|
||||
//
|
||||
|
||||
void S9FrameNameSpriteSheetRotatedSetCapInsetLater::onEnter()
|
||||
{
|
||||
S9SpriteTestDemo::onEnter();
|
||||
auto winSize = Director::getInstance()->getWinSize();
|
||||
float x = winSize.width / 2;
|
||||
float y = 0 + (winSize.height / 2);
|
||||
|
||||
log("Scale9FrameNameSpriteSheetRotatedSetCapInsetLater ...");
|
||||
|
||||
auto blocks_scaled_with_insets = Scale9Sprite::createWithSpriteFrameName("blocks9r.png");
|
||||
log("... created");
|
||||
|
||||
blocks_scaled_with_insets->setInsetLeft(32);
|
||||
blocks_scaled_with_insets->setInsetRight(32);
|
||||
|
||||
blocks_scaled_with_insets->setPreferredSize(Size(32*5.5f, 32*4));
|
||||
blocks_scaled_with_insets->setPosition(Vec2(x, y));
|
||||
log("... setPosition");
|
||||
|
||||
this->addChild(blocks_scaled_with_insets);
|
||||
log("this->addChild");
|
||||
|
||||
log("... Scale9FrameNameSpriteSheetRotatedSetCapInsetLater done.");
|
||||
}
|
||||
|
||||
std::string S9FrameNameSpriteSheetRotatedSetCapInsetLater::title() const
|
||||
{
|
||||
return "Scale9Sprite from sprite sheet (stored rotated), with setting CapInset later";
|
||||
}
|
||||
|
||||
std::string S9FrameNameSpriteSheetRotatedSetCapInsetLater::subtitle() const
|
||||
{
|
||||
return "createWithSpriteFrameName(); setInsetLeft(32); setInsetRight(32);";
|
||||
}
|
||||
|
||||
//
|
||||
//// S9CascadeOpacityAndColor
|
||||
//
|
||||
|
||||
void S9CascadeOpacityAndColor::onEnter()
|
||||
{
|
||||
S9SpriteTestDemo::onEnter();
|
||||
auto winSize = Director::getInstance()->getWinSize();
|
||||
float x = winSize.width / 2;
|
||||
float y = 0 + (winSize.height / 2);
|
||||
auto rgba = Layer::create();
|
||||
rgba->setCascadeColorEnabled(true);
|
||||
rgba->setCascadeOpacityEnabled(true);
|
||||
this->addChild(rgba);
|
||||
|
||||
log("S9CascadeOpacityAndColor ...");
|
||||
|
||||
auto blocks_scaled_with_insets = Scale9Sprite::createWithSpriteFrameName("blocks9r.png");
|
||||
log("... created");
|
||||
|
||||
blocks_scaled_with_insets->setPosition(Vec2(x, y));
|
||||
log("... setPosition");
|
||||
|
||||
rgba->addChild(blocks_scaled_with_insets);
|
||||
auto actions = Sequence::create(FadeIn::create(1),
|
||||
TintTo::create(1, 0, 255, 0),
|
||||
TintTo::create(1, 255, 255, 255),
|
||||
FadeOut::create(1),
|
||||
nullptr);
|
||||
auto repeat = RepeatForever::create(actions);
|
||||
rgba->runAction(repeat);
|
||||
log("this->addChild");
|
||||
|
||||
log("... S9CascadeOpacityAndColor done.");
|
||||
}
|
||||
|
||||
std::string S9CascadeOpacityAndColor::title() const
|
||||
{
|
||||
return "Scale9Sprite and a Layer parent with setCascadeOpacityEnable(true) and setCascadeColorEnable(true)";
|
||||
}
|
||||
|
||||
std::string S9CascadeOpacityAndColor::subtitle() const
|
||||
{
|
||||
return "when parent change color/opacity, Scale9Sprite should also change";
|
||||
}
|
||||
|
||||
//
|
||||
//// S9ZOrder
|
||||
//
|
||||
|
||||
void S9ZOrder::onEnter()
|
||||
{
|
||||
S9SpriteTestDemo::onEnter();
|
||||
auto winSize = Director::getInstance()->getWinSize();
|
||||
float x = winSize.width / 2;
|
||||
float y = 0 + (winSize.height / 2);
|
||||
|
||||
auto blocks_scaled_with_insets = Scale9Sprite::createWithSpriteFrameName("blocks9r.png");
|
||||
|
||||
blocks_scaled_with_insets->setPosition(Vec2(x, y));
|
||||
this->addChild(blocks_scaled_with_insets);
|
||||
|
||||
Sprite *normalSprite = Sprite::createWithSpriteFrameName("blocks9r.png");
|
||||
normalSprite->setColor(Color3B::RED);
|
||||
blocks_scaled_with_insets->addChild(normalSprite);
|
||||
|
||||
auto topLabel = Label::createWithSystemFont("I Must be On the Top", "Arial", 15);
|
||||
topLabel->setPosition(Vec2(20,20));
|
||||
blocks_scaled_with_insets->addChild(topLabel);
|
||||
|
||||
auto bottomLabel = Label::createWithSystemFont("I Must be On the Bottom", "Arial", 15);
|
||||
bottomLabel->setPosition(Vec2(80,80));
|
||||
bottomLabel->setColor(Color3B::BLUE);
|
||||
blocks_scaled_with_insets->addChild(bottomLabel,-1);
|
||||
|
||||
}
|
||||
|
||||
std::string S9ZOrder::title() const
|
||||
{
|
||||
return "Scale9Sprite ZOrder issue";
|
||||
}
|
||||
|
||||
std::string S9ZOrder::subtitle() const
|
||||
{
|
||||
return "When adding nodes to Scale9Sprite, it should be added on top itself";
|
||||
}
|
||||
|
||||
//
|
||||
//// S9Flip
|
||||
//
|
||||
|
||||
void S9Flip::onEnter()
|
||||
{
|
||||
S9SpriteTestDemo::onEnter();
|
||||
auto winSize = Director::getInstance()->getWinSize();
|
||||
float x = winSize.width / 2;
|
||||
float y = 0 + (winSize.height / 2);
|
||||
|
||||
|
||||
auto normalSprite = Scale9Sprite::createWithSpriteFrameName("blocks9r.png");
|
||||
|
||||
normalSprite->setPosition(Vec2(x, y ));
|
||||
this->addChild(normalSprite);
|
||||
|
||||
|
||||
auto normalLabel = Label::createWithSystemFont("Normal Sprite","Airal",10);
|
||||
normalLabel->setPosition(normalSprite->getPosition() + Vec2(0, normalSprite->getContentSize().height/2 + 10));
|
||||
this->addChild(normalLabel);
|
||||
|
||||
|
||||
|
||||
auto flipXSprite = Scale9Sprite::createWithSpriteFrameName("blocks9r.png");
|
||||
|
||||
flipXSprite->setPosition(Vec2(x - 120, y ));
|
||||
this->addChild(flipXSprite);
|
||||
|
||||
flipXSprite->setScaleX(-1);
|
||||
|
||||
auto flipXLabel = Label::createWithSystemFont("Sprite FlipX","Airal",10);
|
||||
flipXLabel->setPosition(flipXSprite->getPosition() + Vec2(0, flipXSprite->getContentSize().height/2 + 10));
|
||||
this->addChild(flipXLabel);
|
||||
|
||||
|
||||
auto flipYSprite = Scale9Sprite::createWithSpriteFrameName("blocks9r.png");
|
||||
|
||||
flipYSprite->setPosition(Vec2(x + 120, y));
|
||||
this->addChild(flipYSprite);
|
||||
|
||||
flipYSprite->setScaleY(-1);
|
||||
|
||||
auto flipYLabel = Label::createWithSystemFont("Sprite FlipY","Airal",10);
|
||||
flipYLabel->setPosition(flipYSprite->getPosition() + Vec2(0, flipYSprite->getContentSize().height/2 + 10));
|
||||
this->addChild(flipYLabel);
|
||||
|
||||
|
||||
}
|
||||
|
||||
std::string S9Flip::title() const
|
||||
{
|
||||
return "Scale9Sprite Flip issue";
|
||||
}
|
||||
|
||||
std::string S9Flip::subtitle() const
|
||||
{
|
||||
return "When Flipped, the scale9Sprite should behavior like a normal node";
|
||||
}
|
|
@ -1,255 +0,0 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
Copyright (c) 2013 Surith Thekkiam
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "testBasic.h"
|
||||
#include "BaseTest.h"
|
||||
|
||||
|
||||
class S9SpriteTestScene : public TestScene
|
||||
{
|
||||
public:
|
||||
virtual void runThisTest();
|
||||
};
|
||||
|
||||
class S9SpriteTestDemo : public BaseTest
|
||||
{
|
||||
public:
|
||||
virtual void onEnter() override;
|
||||
|
||||
virtual void restartCallback(Ref* sender);
|
||||
virtual void nextCallback(Ref* sender);
|
||||
virtual void backCallback(Ref* sender);
|
||||
};
|
||||
|
||||
// S9BatchNodeBasic
|
||||
|
||||
class S9BatchNodeBasic : public S9SpriteTestDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(S9BatchNodeBasic);
|
||||
|
||||
virtual void onEnter() override;
|
||||
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
// S9FrameNameSpriteSheet
|
||||
|
||||
class S9FrameNameSpriteSheet : public S9SpriteTestDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(S9FrameNameSpriteSheet);
|
||||
|
||||
virtual void onEnter() override;
|
||||
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
// S9FrameNameSpriteSheetRotated
|
||||
|
||||
class S9FrameNameSpriteSheetRotated : public S9SpriteTestDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(S9FrameNameSpriteSheetRotated);
|
||||
|
||||
virtual void onEnter() override;
|
||||
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
// S9BatchNodeScaledNoInsets
|
||||
|
||||
class S9BatchNodeScaledNoInsets : public S9SpriteTestDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(S9BatchNodeScaledNoInsets);
|
||||
|
||||
virtual void onEnter() override;
|
||||
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
// S9FrameNameSpriteSheetScaledNoInsets
|
||||
|
||||
class S9FrameNameSpriteSheetScaledNoInsets : public S9SpriteTestDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(S9FrameNameSpriteSheetScaledNoInsets);
|
||||
|
||||
virtual void onEnter() override;
|
||||
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
// S9FrameNameSpriteSheetRotatedScaledNoInsets
|
||||
|
||||
class S9FrameNameSpriteSheetRotatedScaledNoInsets : public S9SpriteTestDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(S9FrameNameSpriteSheetRotatedScaledNoInsets);
|
||||
|
||||
virtual void onEnter() override;
|
||||
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
|
||||
// S9BatchNodeScaleWithCapInsets
|
||||
|
||||
class S9BatchNodeScaleWithCapInsets : public S9SpriteTestDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(S9BatchNodeScaleWithCapInsets);
|
||||
|
||||
virtual void onEnter() override;
|
||||
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
// S9FrameNameSpriteSheetInsets
|
||||
|
||||
class S9FrameNameSpriteSheetInsets : public S9SpriteTestDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(S9FrameNameSpriteSheetInsets);
|
||||
|
||||
virtual void onEnter() override;
|
||||
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
// S9FrameNameSpriteSheetInsetsScaled
|
||||
|
||||
class S9FrameNameSpriteSheetInsetsScaled : public S9SpriteTestDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(S9FrameNameSpriteSheetInsetsScaled);
|
||||
|
||||
virtual void onEnter() override;
|
||||
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
// S9FrameNameSpriteSheetRotatedInsets
|
||||
|
||||
class S9FrameNameSpriteSheetRotatedInsets : public S9SpriteTestDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(S9FrameNameSpriteSheetRotatedInsets);
|
||||
|
||||
virtual void onEnter() override;
|
||||
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
// S9_TexturePacker
|
||||
|
||||
class S9_TexturePacker : public S9SpriteTestDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(S9_TexturePacker);
|
||||
|
||||
virtual void onEnter() override;
|
||||
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
// S9FrameNameSpriteSheetRotatedInsetsScaled
|
||||
|
||||
class S9FrameNameSpriteSheetRotatedInsetsScaled : public S9SpriteTestDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(S9FrameNameSpriteSheetRotatedInsetsScaled);
|
||||
|
||||
virtual void onEnter() override;
|
||||
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
// S9FrameNameSpriteSheetRotatedInsetsScaled
|
||||
|
||||
class S9FrameNameSpriteSheetRotatedSetCapInsetLater : public S9SpriteTestDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(S9FrameNameSpriteSheetRotatedSetCapInsetLater);
|
||||
|
||||
virtual void onEnter() override;
|
||||
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
// S9CascadeOpacityAndColor
|
||||
|
||||
class S9CascadeOpacityAndColor : public S9SpriteTestDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(S9CascadeOpacityAndColor);
|
||||
|
||||
virtual void onEnter() override;
|
||||
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
// Scale9Sprite ZOrder
|
||||
|
||||
class S9ZOrder : public S9SpriteTestDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(S9ZOrder);
|
||||
|
||||
virtual void onEnter() override;
|
||||
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
// Scale9Sprite Flip
|
||||
|
||||
class S9Flip : public S9SpriteTestDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(S9Flip);
|
||||
|
||||
virtual void onEnter() override;
|
||||
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
|
@ -73,6 +73,7 @@ static std::function<Layer*()> createFunctions[] =
|
|||
CL(NodeGlobalZValueTest),
|
||||
CL(NodeNormalizedPositionTest1),
|
||||
CL(NodeNormalizedPositionTest2),
|
||||
CL(NodeNormalizedPositionBugTest),
|
||||
CL(NodeNameTest),
|
||||
};
|
||||
|
||||
|
@ -1227,11 +1228,49 @@ void NodeNormalizedPositionTest2::update(float dt)
|
|||
|
||||
Size s = Size(_copyContentSize.width*norm, _copyContentSize.height*norm);
|
||||
setContentSize(s);
|
||||
|
||||
CCLOG("s: %f,%f", s.width, s.height);
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
//
|
||||
// NodeNormalizedPositionBugTest
|
||||
//
|
||||
//------------------------------------------------------------------
|
||||
NodeNormalizedPositionBugTest::NodeNormalizedPositionBugTest()
|
||||
: _accum(0)
|
||||
{
|
||||
Vec2 position;
|
||||
|
||||
position = Vec2(0.5,0.5);
|
||||
|
||||
|
||||
sprite = Sprite::create("Images/grossini.png");
|
||||
sprite->setNormalizedPosition(position);
|
||||
addChild(sprite);
|
||||
|
||||
scheduleUpdate();
|
||||
}
|
||||
|
||||
std::string NodeNormalizedPositionBugTest::title() const
|
||||
{
|
||||
return "NodeNormalizedPositionBugTest";
|
||||
}
|
||||
|
||||
std::string NodeNormalizedPositionBugTest::subtitle() const
|
||||
{
|
||||
return "When changing sprite normalizedPosition, the sprite doesn't move!";
|
||||
}
|
||||
|
||||
void NodeNormalizedPositionBugTest::update(float dt)
|
||||
{
|
||||
_accum += dt;
|
||||
|
||||
// for 5 seconds
|
||||
float norm = clampf(sinf(_accum), 0, 1.0);
|
||||
sprite->setNormalizedPosition(Vec2(norm,norm));
|
||||
}
|
||||
|
||||
std::string NodeNameTest::title() const
|
||||
{
|
||||
return "getName()/setName()/getChildByName()/enumerateChildren()";
|
||||
|
|
|
@ -295,6 +295,21 @@ protected:
|
|||
float _accum;
|
||||
};
|
||||
|
||||
class NodeNormalizedPositionBugTest : public TestCocosNodeDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(NodeNormalizedPositionBugTest);
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
|
||||
protected:
|
||||
NodeNormalizedPositionBugTest();
|
||||
|
||||
void update(float dt);
|
||||
float _accum;
|
||||
Sprite *sprite;
|
||||
};
|
||||
|
||||
class NodeNameTest : public TestCocosNodeDemo
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -44,6 +44,18 @@ g_guisTests[] =
|
|||
}
|
||||
},
|
||||
#endif
|
||||
{
|
||||
"EditBox Test",
|
||||
[](Ref* sender)
|
||||
{
|
||||
UISceneManager* sceneManager = UISceneManager::sharedUISceneManager();
|
||||
sceneManager->setCurrentUISceneId(kUIEditBoxTest);
|
||||
sceneManager->setMinUISceneId(kUIEditBoxTest);
|
||||
sceneManager->setMaxUISceneId(kUIEditBoxTest);
|
||||
Scene* scene = sceneManager->currentUIScene();
|
||||
Director::getInstance()->replaceScene(scene);
|
||||
}
|
||||
},
|
||||
{
|
||||
"focus test",
|
||||
[](Ref* sender)
|
||||
|
|
|
@ -0,0 +1,137 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "UIEditBoxTest.h"
|
||||
#include "testResource.h"
|
||||
|
||||
// UIEditBoxTest
|
||||
UIEditBoxTest::UIEditBoxTest()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
UIEditBoxTest::~UIEditBoxTest()
|
||||
{
|
||||
}
|
||||
|
||||
bool UIEditBoxTest::init()
|
||||
{
|
||||
if (UIScene::init())
|
||||
{
|
||||
auto glview = Director::getInstance()->getOpenGLView();
|
||||
auto visibleOrigin = glview->getVisibleOrigin();
|
||||
auto visibleSize = glview->getVisibleSize();
|
||||
|
||||
auto pBg = Sprite::create("Images/HelloWorld.png");
|
||||
pBg->setPosition(Vec2(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/2));
|
||||
addChild(pBg);
|
||||
|
||||
_TTFShowEditReturn = Label::createWithSystemFont("No edit control return!", "Arial", 30);
|
||||
_TTFShowEditReturn->setPosition(Vec2(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y + visibleSize.height - 50));
|
||||
addChild(_TTFShowEditReturn);
|
||||
|
||||
|
||||
auto editBoxSize = Size(visibleSize.width - 100, 60);
|
||||
|
||||
// top
|
||||
std::string pNormalSprite = "extensions/green_edit.png";
|
||||
_editName = ui::EditBox::create(editBoxSize, ui::Scale9Sprite::create(pNormalSprite));
|
||||
_editName->setPosition(Vec2(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height*3/4));
|
||||
_editName->setFontName("Paint Boy");
|
||||
_editName->setFontSize(25);
|
||||
_editName->setFontColor(Color3B::RED);
|
||||
_editName->setPlaceHolder("Name:");
|
||||
_editName->setPlaceholderFontColor(Color3B::WHITE);
|
||||
_editName->setMaxLength(8);
|
||||
_editName->setReturnType(ui::EditBox::KeyboardReturnType::DONE);
|
||||
_editName->setDelegate(this);
|
||||
addChild(_editName);
|
||||
|
||||
// middle
|
||||
_editPassword = ui::EditBox::create(editBoxSize, "extensions/orange_edit.png");
|
||||
_editPassword->setPosition(Vec2(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/2));
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
||||
_editPassword->setFont("American Typewriter", 30);
|
||||
#else
|
||||
_editPassword->setFont("American Typewriter", 80);
|
||||
_editPassword->setPlaceholderFont("American Typewriter", 80);
|
||||
#endif
|
||||
_editPassword->setFontColor(Color3B::GREEN);
|
||||
_editPassword->setPlaceHolder("Password:");
|
||||
_editPassword->setMaxLength(6);
|
||||
_editPassword->setInputFlag(ui::EditBox::InputFlag::PASSWORD);
|
||||
_editPassword->setInputMode(ui::EditBox::InputMode::SINGLE_LINE);
|
||||
_editPassword->setDelegate(this);
|
||||
addChild(_editPassword);
|
||||
|
||||
// bottom
|
||||
_editEmail = ui::EditBox::create(Size(editBoxSize.width, editBoxSize.height), "extensions/yellow_edit.png");
|
||||
_editEmail->setPosition(Vec2(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/4));
|
||||
_editEmail->setAnchorPoint(Vec2(0.5, 1.0f));
|
||||
_editEmail->setPlaceHolder("Email:");
|
||||
_editEmail->setInputMode(ui::EditBox::InputMode::EMAIL_ADDRESS);
|
||||
_editEmail->setDelegate(this);
|
||||
addChild(_editEmail);
|
||||
|
||||
this->setPosition(Vec2(10, 20));
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void UIEditBoxTest::editBoxEditingDidBegin(cocos2d::ui::EditBox* editBox)
|
||||
{
|
||||
log("editBox %p DidBegin !", editBox);
|
||||
}
|
||||
|
||||
void UIEditBoxTest::editBoxEditingDidEnd(cocos2d::ui::EditBox* editBox)
|
||||
{
|
||||
log("editBox %p DidEnd !", editBox);
|
||||
}
|
||||
|
||||
void UIEditBoxTest::editBoxTextChanged(cocos2d::ui::EditBox* editBox, const std::string& text)
|
||||
{
|
||||
log("editBox %p TextChanged, text: %s ", editBox, text.c_str());
|
||||
}
|
||||
|
||||
void UIEditBoxTest::editBoxReturn(ui::EditBox* editBox)
|
||||
{
|
||||
log("editBox %p was returned !",editBox);
|
||||
|
||||
if (_editName == editBox)
|
||||
{
|
||||
_TTFShowEditReturn->setString("Name EditBox return !");
|
||||
}
|
||||
else if (_editPassword == editBox)
|
||||
{
|
||||
_TTFShowEditReturn->setString("Password EditBox return !");
|
||||
}
|
||||
else if (_editEmail == editBox)
|
||||
{
|
||||
_TTFShowEditReturn->setString("Email EditBox return !");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __cocos2d_tests__UIEditBoxTest__
|
||||
#define __cocos2d_tests__UIEditBoxTest__
|
||||
|
||||
#include "UIScene.h"
|
||||
|
||||
class UIEditBoxTest : public UIScene, public cocos2d::ui::EditBoxDelegate
|
||||
{
|
||||
public:
|
||||
UIEditBoxTest();
|
||||
~UIEditBoxTest();
|
||||
bool init();
|
||||
|
||||
virtual void editBoxEditingDidBegin(cocos2d::ui::EditBox* editBox);
|
||||
virtual void editBoxEditingDidEnd(cocos2d::ui::EditBox* editBox);
|
||||
virtual void editBoxTextChanged(cocos2d::ui::EditBox* editBox, const std::string& text);
|
||||
virtual void editBoxReturn(cocos2d::ui::EditBox* editBox);
|
||||
|
||||
|
||||
protected:
|
||||
cocos2d::Label* _TTFShowEditReturn;
|
||||
cocos2d::ui::EditBox* _editName;
|
||||
cocos2d::ui::EditBox* _editPassword;
|
||||
cocos2d::ui::EditBox* _editEmail;
|
||||
|
||||
UI_SCENE_CREATE_FUNC(UIEditBoxTest)
|
||||
};
|
||||
|
||||
#endif /* defined(__cocos2d_tests__UIEditBoxTest__) */
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
USING_NS_CC;
|
||||
USING_NS_CC_EXT;
|
||||
using namespace ui;
|
||||
using namespace cocos2d::ui;
|
||||
|
||||
#define UI_SCENE_CREATE_FUNC(UIScene) \
|
||||
public: \
|
||||
|
|
|
@ -23,6 +23,9 @@
|
|||
#include "UIWebViewTest/UIWebViewTest.h"
|
||||
#endif
|
||||
#include "UIScale9SpriteTest.h"
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
|
||||
#include "UIEditBoxTest.h"
|
||||
#endif
|
||||
|
||||
|
||||
USING_NS_CC;
|
||||
|
@ -36,6 +39,9 @@ static const char* s_testArray[] =
|
|||
"UIButtonTest_RemoveSelf",
|
||||
"UIButtonTestSwitchScale9",
|
||||
"UIButtonTestZoomScale",
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
|
||||
"UIEditBoxTest",
|
||||
#endif
|
||||
"UICheckBoxTest",
|
||||
"UISliderTest",
|
||||
"UISliderTest_Scale9",
|
||||
|
@ -373,6 +379,11 @@ Scene *UISceneManager::currentUIScene()
|
|||
return UIS9Flip::sceneWithTitle(s_testArray[_currentUISceneId]);
|
||||
case kUIS9ChangeAnchorPoint:
|
||||
return UIS9ChangeAnchorPoint::sceneWithTitle(s_testArray[_currentUISceneId]);
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
|
||||
case kUIEditBoxTest:
|
||||
return UIEditBoxTest::sceneWithTitle(s_testArray[_currentUISceneId]);
|
||||
#endif
|
||||
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ enum
|
|||
kUIButtonTest_RemoveSelf,
|
||||
kUIButtonTestSwitchScale9,
|
||||
kUIButtonTestZoomScale,
|
||||
kUIEditBoxTest,
|
||||
kUICheckBoxTest,
|
||||
kUISliderTest,
|
||||
kUISliderTest_Scale9,
|
||||
|
|
|
@ -1,87 +0,0 @@
|
|||
## Prerequisites:
|
||||
|
||||
* Android NDK
|
||||
* Android SDK **OR** Eclipse ADT Bundle
|
||||
* Android AVD target installed
|
||||
|
||||
## Building project
|
||||
|
||||
There are two ways of building Android projects.
|
||||
|
||||
1. Eclipse
|
||||
2. Command Line
|
||||
|
||||
### Import Project in Eclipse
|
||||
|
||||
#### Features:
|
||||
|
||||
1. Complete workflow from Eclipse, including:
|
||||
* Build C++.
|
||||
* Clean C++.
|
||||
* Build and Run whole project.
|
||||
* Logcat view.
|
||||
* Debug Java code.
|
||||
* Javascript editor.
|
||||
* Project management.
|
||||
2. True C++ editing, including:
|
||||
* Code completion.
|
||||
* Jump to definition.
|
||||
* Refactoring tools etc.
|
||||
* Quick open C++ files.
|
||||
|
||||
|
||||
#### Setup Eclipse Environment (only once)
|
||||
|
||||
|
||||
**NOTE:** This step needs to be done only once to setup the Eclipse environment for cocos2d-x projects. Skip this section if you've done this before.
|
||||
|
||||
1. Download Eclipse ADT bundle from [Google ADT homepage](http://developer.android.com/sdk/index.html)
|
||||
|
||||
**OR**
|
||||
|
||||
Install Eclipse with Java. Add ADT and CDT plugins.
|
||||
|
||||
2. Only for Windows
|
||||
1. Install [Cygwin](http://www.cygwin.com/) with make (select make package from the list during the install).
|
||||
2. Add `Cygwin\bin` directory to system PATH variable.
|
||||
3. Add this line `none /cygdrive cygdrive binary,noacl,posix=0,user 0 0` to `Cygwin\etc\fstab` file.
|
||||
|
||||
3. Set up Variables:
|
||||
1. Path Variable `COCOS2DX`:
|
||||
* Eclipse->Preferences->General->Workspace->**Linked Resources**
|
||||
* Click **New** button to add a Path Variable `COCOS2DX` pointing to the root cocos2d-x directory.
|
||||
![Example](https://lh5.googleusercontent.com/-oPpk9kg3e5w/UUOYlq8n7aI/AAAAAAAAsdQ/zLA4eghBH9U/s400/cocos2d-x-eclipse-vars.png)
|
||||
|
||||
2. C/C++ Environment Variable `NDK_ROOT`:
|
||||
* Eclipse->Preferences->C/C++->Build->**Environment**.
|
||||
* Click **Add** button and add a new variable `NDK_ROOT` pointing to the root NDK directory.
|
||||
![Example](https://lh3.googleusercontent.com/-AVcY8IAT0_g/UUOYltoRobI/AAAAAAAAsdM/22D2J9u3sig/s400/cocos2d-x-eclipse-ndk.png)
|
||||
* Only for Windows: Add new variables **CYGWIN** with value `nodosfilewarning` and **SHELLOPTS** with value `igncr`
|
||||
|
||||
4. Import libcocos2dx library project:
|
||||
1. File->New->Project->Android Project From Existing Code.
|
||||
2. Click **Browse** button and open `cocos2d-x/cocos2dx/platform/android/java` directory.
|
||||
3. Click **Finish** to add project.
|
||||
|
||||
#### Adding and running from Eclipse
|
||||
|
||||
![Example](https://lh3.googleusercontent.com/-SLBOu6e3QbE/UUOcOXYaGqI/AAAAAAAAsdo/tYBY2SylOSM/s288/cocos2d-x-eclipse-project-from-code.png) ![Import](https://lh5.googleusercontent.com/-XzC9Pn65USc/UUOcOTAwizI/AAAAAAAAsdk/4b6YM-oim9Y/s400/cocos2d-x-eclipse-import-project.png)
|
||||
|
||||
1. File->New->Project->Android Project From Existing Code
|
||||
2. **Browse** to your project directory. eg: `cocos2d-x/cocos2dx/samples/Cpp/CppTests/proj.android/`
|
||||
3. Add the project
|
||||
4. Click **Run** or **Debug** to compile C++ followed by Java and to run on connected device or emulator.
|
||||
|
||||
|
||||
### Running project from Command Line
|
||||
|
||||
$ cd cocos2d-x/samples/Cpp/CppTests/proj.android/
|
||||
$ export NDK_ROOT=/path/to/ndk
|
||||
$ ./build_native.sh
|
||||
$ ant debug install
|
||||
|
||||
If the last command results in sdk.dir missing error then do:
|
||||
|
||||
$ android list target
|
||||
$ android update project -p . -t (id from step 6)
|
||||
$ android update project -p cocos2d-x/cocos2dx/platform/android/java/ -t (id from step 6)
|
|
@ -159,11 +159,9 @@
|
|||
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioSceneTest\TriggerCode\cons.cpp" />
|
||||
<ClCompile Include="..\Classes\ExtensionsTest\ControlExtensionTest\CCControlPotentiometerTest\CCControlPotentiometerTest.cpp" />
|
||||
<ClCompile Include="..\Classes\ExtensionsTest\ControlExtensionTest\CCControlStepperTest\CCControlStepperTest.cpp" />
|
||||
<ClCompile Include="..\Classes\ExtensionsTest\EditBoxTest\EditBoxTest.cpp" />
|
||||
<ClCompile Include="..\Classes\ExtensionsTest\NetworkTest\HttpClientTest.cpp" />
|
||||
<ClCompile Include="..\Classes\ExtensionsTest\NetworkTest\SocketIOTest.cpp" />
|
||||
<ClCompile Include="..\Classes\ExtensionsTest\NetworkTest\WebSocketTest.cpp" />
|
||||
<ClCompile Include="..\Classes\ExtensionsTest\Scale9SpriteTest\Scale9SpriteTest.cpp" />
|
||||
<ClCompile Include="..\Classes\ExtensionsTest\TableViewTest\CustomTableViewCell.cpp" />
|
||||
<ClCompile Include="..\Classes\ExtensionsTest\TableViewTest\TableViewTestScene.cpp" />
|
||||
<ClCompile Include="..\Classes\FileUtilsTest\FileUtilsTest.cpp" />
|
||||
|
@ -202,6 +200,7 @@
|
|||
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UIButtonTest\UIButtonTest_Editor.cpp" />
|
||||
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UICheckBoxTest\UICheckBoxTest.cpp" />
|
||||
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UICheckBoxTest\UICheckBoxTest_Editor.cpp" />
|
||||
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UIEditBoxTest.cpp" />
|
||||
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UIFocusTest\UIFocusTest.cpp" />
|
||||
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UIImageViewTest\UIImageViewTest.cpp" />
|
||||
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UIImageViewTest\UIImageViewTest_Editor.cpp" />
|
||||
|
@ -347,11 +346,9 @@
|
|||
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioSceneTest\TriggerCode\EventDef.h" />
|
||||
<ClInclude Include="..\Classes\ExtensionsTest\ControlExtensionTest\CCControlPotentiometerTest\CCControlPotentiometerTest.h" />
|
||||
<ClInclude Include="..\Classes\ExtensionsTest\ControlExtensionTest\CCControlStepperTest\CCControlStepperTest.h" />
|
||||
<ClInclude Include="..\Classes\ExtensionsTest\EditBoxTest\EditBoxTest.h" />
|
||||
<ClInclude Include="..\Classes\ExtensionsTest\NetworkTest\HttpClientTest.h" />
|
||||
<ClInclude Include="..\Classes\ExtensionsTest\NetworkTest\SocketIOTest.h" />
|
||||
<ClInclude Include="..\Classes\ExtensionsTest\NetworkTest\WebSocketTest.h" />
|
||||
<ClInclude Include="..\Classes\ExtensionsTest\Scale9SpriteTest\Scale9SpriteTest.h" />
|
||||
<ClInclude Include="..\Classes\ExtensionsTest\TableViewTest\CustomTableViewCell.h" />
|
||||
<ClInclude Include="..\Classes\ExtensionsTest\TableViewTest\TableViewTestScene.h" />
|
||||
<ClInclude Include="..\Classes\FileUtilsTest\FileUtilsTest.h" />
|
||||
|
@ -390,6 +387,7 @@
|
|||
<ClInclude Include="..\Classes\UITest\CocoStudioGUITest\UIButtonTest\UIButtonTest_Editor.h" />
|
||||
<ClInclude Include="..\Classes\UITest\CocoStudioGUITest\UICheckBoxTest\UICheckBoxTest.h" />
|
||||
<ClInclude Include="..\Classes\UITest\CocoStudioGUITest\UICheckBoxTest\UICheckBoxTest_Editor.h" />
|
||||
<ClInclude Include="..\Classes\UITest\CocoStudioGUITest\UIEditBoxTest.h" />
|
||||
<ClInclude Include="..\Classes\UITest\CocoStudioGUITest\UIFocusTest\UIFocusTest.h" />
|
||||
<ClInclude Include="..\Classes\UITest\CocoStudioGUITest\UIImageViewTest\UIImageViewTest.h" />
|
||||
<ClInclude Include="..\Classes\UITest\CocoStudioGUITest\UIImageViewTest\UIImageViewTest_Editor.h" />
|
||||
|
|
|
@ -202,9 +202,6 @@
|
|||
<Filter Include="Classes\FileUtilsTest">
|
||||
<UniqueIdentifier>{a4c2111f-cf9f-492c-884d-3de24715adce}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Classes\ExtensionsTest\EditBoxTest">
|
||||
<UniqueIdentifier>{18a69e7e-8ca7-475a-bfbb-7296baab16ce}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Classes\ExtensionsTest\CocosBuilderTest\TimelineCallbackTest">
|
||||
<UniqueIdentifier>{0ef55f53-411a-4661-b5d5-13930da52e68}</UniqueIdentifier>
|
||||
</Filter>
|
||||
|
@ -220,9 +217,6 @@
|
|||
<Filter Include="Classes\ConfigurationTest">
|
||||
<UniqueIdentifier>{81ec2355-7efd-49e0-b6cb-b1bba23fbbc8}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Classes\ExtensionsTest\Scale9SpriteTest">
|
||||
<UniqueIdentifier>{3d73aa04-d66e-43d3-921f-b867a753c113}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Classes\ExtensionsTest\CocoStudioArmatureTest">
|
||||
<UniqueIdentifier>{a6e7d28e-46a3-46c4-9735-b39e96f776f0}</UniqueIdentifier>
|
||||
</Filter>
|
||||
|
@ -594,9 +588,6 @@
|
|||
<ClCompile Include="..\Classes\FileUtilsTest\FileUtilsTest.cpp">
|
||||
<Filter>Classes\FileUtilsTest</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Classes\ExtensionsTest\EditBoxTest\EditBoxTest.cpp">
|
||||
<Filter>Classes\ExtensionsTest\EditBoxTest</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Classes\ExtensionsTest\CocosBuilderTest\TimelineCallbackTest\TimelineCallbackTestLayer.cpp">
|
||||
<Filter>Classes\ExtensionsTest\CocosBuilderTest\TimelineCallbackTest</Filter>
|
||||
</ClCompile>
|
||||
|
@ -618,9 +609,6 @@
|
|||
<ClCompile Include="..\Classes\BaseTest.cpp">
|
||||
<Filter>Classes</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Classes\ExtensionsTest\Scale9SpriteTest\Scale9SpriteTest.cpp">
|
||||
<Filter>Classes\ExtensionsTest\Scale9SpriteTest</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Classes\ExtensionsTest\NetworkTest\SocketIOTest.cpp">
|
||||
<Filter>Classes\ExtensionsTest\NetworkTest</Filter>
|
||||
</ClCompile>
|
||||
|
@ -867,6 +855,9 @@
|
|||
<ClCompile Include="..\Classes\Sprite3DTest\DrawNode3D.cpp">
|
||||
<Filter>Classes\Sprite3DTest</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UIEditBoxTest.cpp">
|
||||
<Filter>Classes\UITest\CocostudioGUISceneTest</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="main.h">
|
||||
|
@ -1307,9 +1298,6 @@
|
|||
<ClInclude Include="..\Classes\FileUtilsTest\FileUtilsTest.h">
|
||||
<Filter>Classes\FileUtilsTest</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Classes\ExtensionsTest\EditBoxTest\EditBoxTest.h">
|
||||
<Filter>Classes\ExtensionsTest\EditBoxTest</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Classes\ExtensionsTest\CocosBuilderTest\TimelineCallbackTest\TimelineCallbackLayerLoader.h">
|
||||
<Filter>Classes\ExtensionsTest\CocosBuilderTest\TimelineCallbackTest</Filter>
|
||||
</ClInclude>
|
||||
|
@ -1334,9 +1322,6 @@
|
|||
<ClInclude Include="..\Classes\BaseTest.h">
|
||||
<Filter>Classes</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Classes\ExtensionsTest\Scale9SpriteTest\Scale9SpriteTest.h">
|
||||
<Filter>Classes\ExtensionsTest\Scale9SpriteTest</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Classes\ExtensionsTest\NetworkTest\SocketIOTest.h">
|
||||
<Filter>Classes\ExtensionsTest\NetworkTest</Filter>
|
||||
</ClInclude>
|
||||
|
@ -1601,5 +1586,8 @@
|
|||
<ClInclude Include="..\Classes\Sprite3DTest\DrawNode3D.h">
|
||||
<Filter>Classes\Sprite3DTest</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Classes\UITest\CocoStudioGUITest\UIEditBoxTest.h">
|
||||
<Filter>Classes\UITest\CocostudioGUISceneTest</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -250,6 +250,7 @@
|
|||
<ClCompile Include="..\..\Classes\UITest\CocoStudioGUITest\UIButtonTest\UIButtonTest_Editor.cpp" />
|
||||
<ClCompile Include="..\..\Classes\UITest\CocoStudioGUITest\UICheckBoxTest\UICheckBoxTest.cpp" />
|
||||
<ClCompile Include="..\..\Classes\UITest\CocoStudioGUITest\UICheckBoxTest\UICheckBoxTest_Editor.cpp" />
|
||||
<ClCompile Include="..\..\Classes\UITest\CocoStudioGUITest\UIEditBoxTest.cpp" />
|
||||
<ClCompile Include="..\..\Classes\UITest\CocoStudioGUITest\UIFocusTest\UIFocusTest.cpp" />
|
||||
<ClCompile Include="..\..\Classes\UITest\CocoStudioGUITest\UIImageViewTest\UIImageViewTest.cpp" />
|
||||
<ClCompile Include="..\..\Classes\UITest\CocoStudioGUITest\UIImageViewTest\UIImageViewTest_Editor.cpp" />
|
||||
|
@ -453,6 +454,7 @@
|
|||
<ClInclude Include="..\..\Classes\UITest\CocoStudioGUITest\UIButtonTest\UIButtonTest_Editor.h" />
|
||||
<ClInclude Include="..\..\Classes\UITest\CocoStudioGUITest\UICheckBoxTest\UICheckBoxTest.h" />
|
||||
<ClInclude Include="..\..\Classes\UITest\CocoStudioGUITest\UICheckBoxTest\UICheckBoxTest_Editor.h" />
|
||||
<ClInclude Include="..\..\Classes\UITest\CocoStudioGUITest\UIEditBoxTest.h" />
|
||||
<ClInclude Include="..\..\Classes\UITest\CocoStudioGUITest\UIFocusTest\UIFocusTest.h" />
|
||||
<ClInclude Include="..\..\Classes\UITest\CocoStudioGUITest\UIImageViewTest\UIImageViewTest.h" />
|
||||
<ClInclude Include="..\..\Classes\UITest\CocoStudioGUITest\UIImageViewTest\UIImageViewTest_Editor.h" />
|
||||
|
|
|
@ -1,87 +0,0 @@
|
|||
## Prerequisites:
|
||||
|
||||
* Android NDK
|
||||
* Android SDK **OR** Eclipse ADT Bundle
|
||||
* Android AVD target installed
|
||||
|
||||
## Building project
|
||||
|
||||
There are two ways of building Android projects.
|
||||
|
||||
1. Eclipse
|
||||
2. Command Line
|
||||
|
||||
### Import Project in Eclipse
|
||||
|
||||
#### Features:
|
||||
|
||||
1. Complete workflow from Eclipse, including:
|
||||
* Build C++.
|
||||
* Clean C++.
|
||||
* Build and Run whole project.
|
||||
* Logcat view.
|
||||
* Debug Java code.
|
||||
* Javascript editor.
|
||||
* Project management.
|
||||
2. True C++ editing, including:
|
||||
* Code completion.
|
||||
* Jump to definition.
|
||||
* Refactoring tools etc.
|
||||
* Quick open C++ files.
|
||||
|
||||
|
||||
#### Setup Eclipse Environment (only once)
|
||||
|
||||
|
||||
**NOTE:** This step needs to be done only once to setup the Eclipse environment for cocos2d-x projects. Skip this section if you've done this before.
|
||||
|
||||
1. Download Eclipse ADT bundle from [Google ADT homepage](http://developer.android.com/sdk/index.html)
|
||||
|
||||
**OR**
|
||||
|
||||
Install Eclipse with Java. Add ADT and CDT plugins.
|
||||
|
||||
2. Only for Windows
|
||||
1. Install [Cygwin](http://www.cygwin.com/) with make (select make package from the list during the install).
|
||||
2. Add `Cygwin\bin` directory to system PATH variable.
|
||||
3. Add this line `none /cygdrive cygdrive binary,noacl,posix=0,user 0 0` to `Cygwin\etc\fstab` file.
|
||||
|
||||
3. Set up Variables:
|
||||
1. Path Variable `COCOS2DX`:
|
||||
* Eclipse->Preferences->General->Workspace->**Linked Resources**
|
||||
* Click **New** button to add a Path Variable `COCOS2DX` pointing to the root cocos2d-x directory.
|
||||
![Example](https://lh5.googleusercontent.com/-oPpk9kg3e5w/UUOYlq8n7aI/AAAAAAAAsdQ/zLA4eghBH9U/s400/cocos2d-x-eclipse-vars.png)
|
||||
|
||||
2. C/C++ Environment Variable `NDK_ROOT`:
|
||||
* Eclipse->Preferences->C/C++->Build->**Environment**.
|
||||
* Click **Add** button and add a new variable `NDK_ROOT` pointing to the root NDK directory.
|
||||
![Example](https://lh3.googleusercontent.com/-AVcY8IAT0_g/UUOYltoRobI/AAAAAAAAsdM/22D2J9u3sig/s400/cocos2d-x-eclipse-ndk.png)
|
||||
* Only for Windows: Add new variables **CYGWIN** with value `nodosfilewarning` and **SHELLOPTS** with value `igncr`
|
||||
|
||||
4. Import libcocos2dx library project:
|
||||
1. File->New->Project->Android Project From Existing Code.
|
||||
2. Click **Browse** button and open `cocos2d-x/cocos2dx/platform/android/java` directory.
|
||||
3. Click **Finish** to add project.
|
||||
|
||||
#### Adding and running from Eclipse
|
||||
|
||||
![Example](https://lh3.googleusercontent.com/-SLBOu6e3QbE/UUOcOXYaGqI/AAAAAAAAsdo/tYBY2SylOSM/s288/cocos2d-x-eclipse-project-from-code.png) ![Import](https://lh5.googleusercontent.com/-XzC9Pn65USc/UUOcOTAwizI/AAAAAAAAsdk/4b6YM-oim9Y/s400/cocos2d-x-eclipse-import-project.png)
|
||||
|
||||
1. File->New->Project->Android Project From Existing Code
|
||||
2. **Browse** to your project directory. eg: `cocos2d-x/cocos2dx/samples/Cpp/TestCpp/proj.android/`
|
||||
3. Add the project
|
||||
4. Click **Run** or **Debug** to compile C++ followed by Java and to run on connected device or emulator.
|
||||
|
||||
|
||||
### Running project from Command Line
|
||||
|
||||
$ cd cocos2d-x/samples/Cpp/TestCpp/proj.android/
|
||||
$ export NDK_ROOT=/path/to/ndk
|
||||
$ ./build_native.sh
|
||||
$ ant debug install
|
||||
|
||||
If the last command results in sdk.dir missing error then do:
|
||||
|
||||
$ android list target
|
||||
$ android update project -p . -t (id from step 6)
|
||||
$ android update project -p cocos2d-x/cocos2dx/platform/android/java/ -t (id from step 6)
|
|
@ -27,7 +27,7 @@ headers = %(cocosdir)s/extensions/cocos-ext.h
|
|||
|
||||
# what classes to produce code for. You can use regular expressions here. When testing the regular
|
||||
# expression, it will be enclosed in "^$", like this: "^Menu*$".
|
||||
classes = AssetsManager.* Scale9Sprite Control.* ControlButton.* EditBox$ ScrollView$ TableView$ TableViewCell$
|
||||
classes = AssetsManager.* Control.* ControlButton.* ScrollView$ TableView$ TableViewCell$
|
||||
|
||||
# what should we skip? in the format ClassName::[function function]
|
||||
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
|
||||
|
@ -39,7 +39,6 @@ classes = AssetsManager.* Scale9Sprite Control.* ControlButton.* EditBox$ Scroll
|
|||
skip = .*Delegate::[*],
|
||||
.*Loader.*::[*],
|
||||
*::[^visit$ copyWith.* onEnter.* onExit.* ^description$ getObjectType (g|s)etDelegate .*HSV],
|
||||
EditBox::[(g|s)etDelegate ^keyboard.* touchDownAction getScriptEditBoxHandler registerScriptEditBoxHandler unregisterScriptEditBoxHandler],
|
||||
AssetsManager::[(g|s)etDelegate],
|
||||
AssetsManagerDelegateProtocol::[*],
|
||||
Control::[removeHandleOfControlEvent addHandleOfControlEvent],
|
||||
|
|
|
@ -48,7 +48,7 @@ skip = *::[^visit$ copyWith.* onEnter.* onExit.* ^description$ getObjectType .*
|
|||
ActionManagerEx::[initWithDictionary initWithBinary],
|
||||
DisplayManager::[initDisplayList (s|g)etCurrentDecorativeDisplay getDecorativeDisplayByIndex],
|
||||
Tween::[(s|g)etMovementBoneData],
|
||||
GUIReader::[storeFileDesignSize getFileDesignSize getParseCallBackMap getParseObjectMap],
|
||||
GUIReader::[registerTypeAndCallBack storeFileDesignSize getFileDesignSize getParseCallBackMap getParseObjectMap],
|
||||
ActionNode::[initWithDictionary],
|
||||
ActionObject::[initWithDictionary initWithBinary],
|
||||
BaseData::[copy subtract],
|
||||
|
|
Loading…
Reference in New Issue