diff --git a/CHANGELOG b/CHANGELOG index e1d11ab98c..0108fbd1df 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,27 @@ -cocos2d-x-3.9 beta0 October.20 2015 +cocos2d-x-3.10 December ? 2015 +[NEW] Core: Added Application::getVersion() to get the app version. +[NEW] UI: Add PageView indicator. + +[REFINE] UI: RichText support new line element. +[REFINE] UI: Set focus to Widget when touched. +[REFINE] UI: Change PageView to derived from ListView. +[REFINE] UI: Rewrite Scale9Sprite and improve the scale9sprite performance and reduce memory consumption. +[REFINE] 3D: Change char* to string in Terrain. +[REFINE] Editor: Merge Studio ActionTimeLine change back into engine. +[REFINe] Mac: Make engine compatible for 32bit Mac. + +[FIX] Core: Fix premultiplyAlpha for mipmaps and compressed textures. +[FIX] UI: Fix Scale9sprite rendering error when content size smaller than the sum of leftInset and rightInset. +[FIX] Win32: Fix EditBox crash when removing an EditBox in a scheduler. +[FIX] Android: Fix cannot add view to mFrameLayout when extends Cocos2dxActivity. +[FIX] 2D: Fixed actionNode position error bug. +[FIX] 3D: Fix the movement of PUParticle lags one frame. +[FIX] UI: Fix the wront argument of setPlaceholderFontName in EditBox. +[FIX] UI: Fix EditBox editBoxEditingDidEnd may use the original text after change the text of EditBox in user script. +[FIX] Audio: Fix `FinishCallback` never be called in Windows. +[FIX] UI: Fix Layout stencil clipping nested with Clipping Node rendering issue. + +cocos2d-x-3.9 November.09 2015 [NEW] Label: Added line spacing/leading feature to Label. [NEW] ListView: Added APIs to scroll to specific item in list. @@ -124,6 +147,10 @@ cocos2d-x-3.9 beta0 October.20 2015 [TEST] JS: Fixed crash bug when click "remove ui" in "native test-JSBExtendTest" under project js-test. [TEST] JS: Updated testcase in js-test to show notificationNode to runAction. +cocos2d-x-3.8.1 September.17 2015 + + [HIGHLIGHT] platform: Supported Xcode 7 for iOS 9 deployment + cocos2d-x-3.8 final September.6 2015 cocos2d-x-3.8 rc0 August.26 2015 cocos2d-x-3.8 beta0 August.14 2015 diff --git a/README.md b/README.md index cb13bfb315..ec9aca0708 100644 --- a/README.md +++ b/README.md @@ -182,7 +182,7 @@ Build Requirements Runtime Requirements -------------------- - * iOS 5.0+ for iPhone / iPad games + * iOS 6.0+ for iPhone / iPad games * Android 2.3+ for Android games * Windows 8.1 or Windows 10.0 for Windows Phone/Store 8.1 games * Windows 10.0 for Windows Phone/Store 10.0 games diff --git a/build/cocos2d_libs.xcodeproj/project.pbxproj b/build/cocos2d_libs.xcodeproj/project.pbxproj index b88510442d..027713d954 100644 --- a/build/cocos2d_libs.xcodeproj/project.pbxproj +++ b/build/cocos2d_libs.xcodeproj/project.pbxproj @@ -1234,6 +1234,11 @@ 2980F02B1BA9A5550059E678 /* UITextView+CCUITextInput.h in Headers */ = {isa = PBXBuildFile; fileRef = 2980F0201BA9A5550059E678 /* UITextView+CCUITextInput.h */; }; 2980F02C1BA9A5550059E678 /* UITextView+CCUITextInput.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2980F0211BA9A5550059E678 /* UITextView+CCUITextInput.mm */; }; 2986667F18B1B246000E39CA /* CCTweenFunction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2986667818B1B079000E39CA /* CCTweenFunction.cpp */; }; + 298C75D51C0465D0006BAE63 /* CCStencilStateManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 298C75D31C0465D0006BAE63 /* CCStencilStateManager.cpp */; }; + 298C75D61C0465D1006BAE63 /* CCStencilStateManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 298C75D31C0465D0006BAE63 /* CCStencilStateManager.cpp */; }; + 298C75D71C0465D1006BAE63 /* CCStencilStateManager.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 298C75D41C0465D0006BAE63 /* CCStencilStateManager.hpp */; }; + 298C75D81C0465D1006BAE63 /* CCStencilStateManager.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 298C75D41C0465D0006BAE63 /* CCStencilStateManager.hpp */; }; + 298C75D91C04681F006BAE63 /* CCStencilStateManager.hpp in Sources */ = {isa = PBXBuildFile; fileRef = 298C75D41C0465D0006BAE63 /* CCStencilStateManager.hpp */; }; 299754F4193EC95400A54AC3 /* ObjectFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 299754F2193EC95400A54AC3 /* ObjectFactory.cpp */; }; 299754F5193EC95400A54AC3 /* ObjectFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 299754F2193EC95400A54AC3 /* ObjectFactory.cpp */; }; 299754F6193EC95400A54AC3 /* ObjectFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 299754F3193EC95400A54AC3 /* ObjectFactory.h */; }; @@ -2072,6 +2077,10 @@ B5668D7E1B3838E4003CBD5E /* UIScrollViewBar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5668D7B1B3838E4003CBD5E /* UIScrollViewBar.cpp */; }; B5668D7F1B3838E4003CBD5E /* UIScrollViewBar.h in Headers */ = {isa = PBXBuildFile; fileRef = B5668D7C1B3838E4003CBD5E /* UIScrollViewBar.h */; }; B5668D801B3838E4003CBD5E /* UIScrollViewBar.h in Headers */ = {isa = PBXBuildFile; fileRef = B5668D7C1B3838E4003CBD5E /* UIScrollViewBar.h */; }; + B5A738961BB0051F00BAAEF8 /* UIPageViewIndicator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5A738941BB0051F00BAAEF8 /* UIPageViewIndicator.cpp */; }; + B5A738971BB0051F00BAAEF8 /* UIPageViewIndicator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5A738941BB0051F00BAAEF8 /* UIPageViewIndicator.cpp */; }; + B5A738981BB0051F00BAAEF8 /* UIPageViewIndicator.h in Headers */ = {isa = PBXBuildFile; fileRef = B5A738951BB0051F00BAAEF8 /* UIPageViewIndicator.h */; }; + B5A738991BB0051F00BAAEF8 /* UIPageViewIndicator.h in Headers */ = {isa = PBXBuildFile; fileRef = B5A738951BB0051F00BAAEF8 /* UIPageViewIndicator.h */; }; B5CE6DBE1B3BF2B1002B0419 /* UIAbstractCheckButton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5CE6DBC1B3BF2B1002B0419 /* UIAbstractCheckButton.cpp */; }; B5CE6DBF1B3BF2B1002B0419 /* UIAbstractCheckButton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5CE6DBC1B3BF2B1002B0419 /* UIAbstractCheckButton.cpp */; }; B5CE6DC01B3BF2B1002B0419 /* UIAbstractCheckButton.h in Headers */ = {isa = PBXBuildFile; fileRef = B5CE6DBD1B3BF2B1002B0419 /* UIAbstractCheckButton.h */; }; @@ -4140,6 +4149,8 @@ 2980F0211BA9A5550059E678 /* UITextView+CCUITextInput.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UITextView+CCUITextInput.mm"; sourceTree = ""; }; 2986667818B1B079000E39CA /* CCTweenFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCTweenFunction.cpp; sourceTree = ""; }; 2986667918B1B079000E39CA /* CCTweenFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCTweenFunction.h; sourceTree = ""; }; + 298C75D31C0465D0006BAE63 /* CCStencilStateManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CCStencilStateManager.cpp; path = ../base/CCStencilStateManager.cpp; sourceTree = ""; }; + 298C75D41C0465D0006BAE63 /* CCStencilStateManager.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = CCStencilStateManager.hpp; path = ../base/CCStencilStateManager.hpp; sourceTree = ""; }; 299754F2193EC95400A54AC3 /* ObjectFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ObjectFactory.cpp; path = ../base/ObjectFactory.cpp; sourceTree = ""; }; 299754F3193EC95400A54AC3 /* ObjectFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ObjectFactory.h; path = ../base/ObjectFactory.h; sourceTree = ""; }; 299CF1F919A434BC00C378C1 /* ccRandom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ccRandom.cpp; path = ../base/ccRandom.cpp; sourceTree = ""; }; @@ -4805,6 +4816,8 @@ B3AF019F1842FBA400A98B85 /* b2MotorJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2MotorJoint.h; sourceTree = ""; }; B5668D7B1B3838E4003CBD5E /* UIScrollViewBar.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIScrollViewBar.cpp; sourceTree = ""; }; B5668D7C1B3838E4003CBD5E /* UIScrollViewBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIScrollViewBar.h; sourceTree = ""; }; + B5A738941BB0051F00BAAEF8 /* UIPageViewIndicator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIPageViewIndicator.cpp; sourceTree = ""; }; + B5A738951BB0051F00BAAEF8 /* UIPageViewIndicator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIPageViewIndicator.h; sourceTree = ""; }; B5CE6DBC1B3BF2B1002B0419 /* UIAbstractCheckButton.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIAbstractCheckButton.cpp; sourceTree = ""; }; B5CE6DBD1B3BF2B1002B0419 /* UIAbstractCheckButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIAbstractCheckButton.h; sourceTree = ""; }; B5CE6DC61B3C05BA002B0419 /* UIRadioButton.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIRadioButton.cpp; sourceTree = ""; }; @@ -6031,6 +6044,8 @@ 50ABBE1C1925AB6F00A911A9 /* utlist.h */, 50ABBE1D1925AB6F00A911A9 /* ZipUtils.cpp */, 50ABBE1E1925AB6F00A911A9 /* ZipUtils.h */, + 298C75D31C0465D0006BAE63 /* CCStencilStateManager.cpp */, + 298C75D41C0465D0006BAE63 /* CCStencilStateManager.hpp */, ); name = base; path = ../cocos/2d; @@ -6971,6 +6986,8 @@ 2905FA0118CF08D000240AA3 /* UILoadingBar.h */, 2905FA0218CF08D000240AA3 /* UIPageView.cpp */, 2905FA0318CF08D000240AA3 /* UIPageView.h */, + B5A738941BB0051F00BAAEF8 /* UIPageViewIndicator.cpp */, + B5A738951BB0051F00BAAEF8 /* UIPageViewIndicator.h */, 2905FA0418CF08D000240AA3 /* UIRichText.cpp */, 2905FA0518CF08D000240AA3 /* UIRichText.h */, 2905FA0718CF08D000240AA3 /* UIScrollView.cpp */, @@ -9221,6 +9238,7 @@ 15AE182A19AAD2F700C27E9E /* CCMeshSkin.h in Headers */, B276EF5F1988D1D500CD400F /* CCVertexIndexData.h in Headers */, 1A57007F180BC5A10088DEC7 /* CCActionInterval.h in Headers */, + 298C75D71C0465D1006BAE63 /* CCStencilStateManager.hpp in Headers */, B6DD2FDB1B04825B00E47F5F /* DetourLocalBoundary.h in Headers */, B6CAB3491AF9AA1A00B9B856 /* gim_clip_polygon.h in Headers */, B677B0DB1B18492D006762CB /* CCNavMeshUtils.h in Headers */, @@ -9481,6 +9499,7 @@ B665E3F41AA80A6600DDB1C5 /* CCPUSlaveEmitter.h in Headers */, 15AE1B6919AADA9900C27E9E /* UIDeprecated.h in Headers */, 1A570223180BCC1A0088DEC7 /* CCParticleBatchNode.h in Headers */, + B5A738981BB0051F00BAAEF8 /* UIPageViewIndicator.h in Headers */, B6CAB53F1AF9AA1A00B9B856 /* cl_platform.h in Headers */, 15AE1A8319AAD40300C27E9E /* b2GearJoint.h in Headers */, 15AE1BD519AAE01E00C27E9E /* CCControlSaturationBrightnessPicker.h in Headers */, @@ -10660,6 +10679,7 @@ 85505F051B60E3B2003F2CD4 /* CCBoneNode.h in Headers */, B665E2491AA80A6500DDB1C5 /* CCPUCollisionAvoidanceAffectorTranslator.h in Headers */, B6CAB4461AF9AA1A00B9B856 /* btParallelConstraintSolver.h in Headers */, + 298C75D81C0465D1006BAE63 /* CCStencilStateManager.hpp in Headers */, 15AE18D119AAD33D00C27E9E /* CCNodeLoaderLibrary.h in Headers */, 15AE1AC319AAD40300C27E9E /* b2DistanceJoint.h in Headers */, B6CAB5261AF9AA1A00B9B856 /* btQuickprof.h in Headers */, @@ -10984,6 +11004,7 @@ B665E2951AA80A6500DDB1C5 /* CCPUEmitter.h in Headers */, B6CAB3BE1AF9AA1A00B9B856 /* btGeneric6DofSpringConstraint.h in Headers */, B6CAB3521AF9AA1A00B9B856 /* gim_geometry.h in Headers */, + B5A738991BB0051F00BAAEF8 /* UIPageViewIndicator.h in Headers */, 15AE1BED19AAE01E00C27E9E /* CCControlColourPicker.h in Headers */, 15AE195019AAD35100C27E9E /* CCDatas.h in Headers */, 15AE18B319AAD33D00C27E9E /* CCBReader.h in Headers */, @@ -11169,6 +11190,7 @@ ED9C6A9418599AD8000A5232 /* CCNodeGrid.cpp in Sources */, 15AE1A2C19AAD3D500C27E9E /* b2DynamicTree.cpp in Sources */, B665E36A1AA80A6500DDB1C5 /* CCPUOnVelocityObserver.cpp in Sources */, + B5A738961BB0051F00BAAEF8 /* UIPageViewIndicator.cpp in Sources */, B665E3961AA80A6500DDB1C5 /* CCPUPointEmitter.cpp in Sources */, 15AE184019AAD2F700C27E9E /* CCSprite3D.cpp in Sources */, B6CAB2E51AF9AA1A00B9B856 /* btSphereShape.cpp in Sources */, @@ -11819,6 +11841,7 @@ B665E2EE1AA80A6500DDB1C5 /* CCPULineEmitter.cpp in Sources */, B6CAB2DD1AF9AA1A00B9B856 /* btScaledBvhTriangleMeshShape.cpp in Sources */, B665E4121AA80A6600DDB1C5 /* CCPUTextureAnimator.cpp in Sources */, + 298C75D51C0465D0006BAE63 /* CCStencilStateManager.cpp in Sources */, B665E3D21AA80A6600DDB1C5 /* CCPUScriptLexer.cpp in Sources */, B665E4021AA80A6600DDB1C5 /* CCPUSphereColliderTranslator.cpp in Sources */, 15AE1A3619AAD3D500C27E9E /* b2PolygonShape.cpp in Sources */, @@ -11953,6 +11976,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 298C75D91C04681F006BAE63 /* CCStencilStateManager.hpp in Sources */, D0FD03541A3B51AA00825BB5 /* CCAllocatorGlobalNewDelete.cpp in Sources */, 15AE1B9819AADAA100C27E9E /* UIVideoPlayer-ios.mm in Sources */, B665E38F1AA80A6500DDB1C5 /* CCPUPlaneCollider.cpp in Sources */, @@ -12103,6 +12127,7 @@ 15AE193C19AAD35100C27E9E /* CCArmatureDefine.cpp in Sources */, B665E35F1AA80A6500DDB1C5 /* CCPUOnRandomObserverTranslator.cpp in Sources */, B29594B51926D5EC003EEF37 /* CCMeshCommand.cpp in Sources */, + 298C75D61C0465D1006BAE63 /* CCStencilStateManager.cpp in Sources */, 15AE194B19AAD35100C27E9E /* CCComRender.cpp in Sources */, 382384451A25915C002C4610 /* SpriteReader.cpp in Sources */, B6CAB2321AF9AA1A00B9B856 /* btCollisionWorld.cpp in Sources */, @@ -12644,6 +12669,7 @@ B665E1FB1AA80A6500DDB1C5 /* CCPUAffectorTranslator.cpp in Sources */, B665E3931AA80A6500DDB1C5 /* CCPUPlaneColliderTranslator.cpp in Sources */, 382383F71A258FA7002C4610 /* idl_gen_fbs.cpp in Sources */, + B5A738971BB0051F00BAAEF8 /* UIPageViewIndicator.cpp in Sources */, B665E24B1AA80A6500DDB1C5 /* CCPUColorAffector.cpp in Sources */, B665E20F1AA80A6500DDB1C5 /* CCPUBaseForceAffector.cpp in Sources */, 15AE1B7419AADA9A00C27E9E /* UILoadingBar.cpp in Sources */, diff --git a/cocos/2d/CCAutoPolygon.cpp b/cocos/2d/CCAutoPolygon.cpp index a1e40ef77c..2781894b9a 100644 --- a/cocos/2d/CCAutoPolygon.cpp +++ b/cocos/2d/CCAutoPolygon.cpp @@ -87,6 +87,17 @@ void PolygonInfo::setQuad(V3F_C4B_T2F_Quad *quad) triangles.verts = (V3F_C4B_T2F*)quad; } +void PolygonInfo::setTriangles(TrianglesCommand::Triangles other) +{ + this->releaseVertsAndIndices(); + isVertsOwner = false; + + this->triangles.vertCount = other.vertCount; + this->triangles.indexCount = other.indexCount; + this->triangles.verts = other.verts; + this->triangles.indices = other.indices; +} + void PolygonInfo::releaseVertsAndIndices() { if(isVertsOwner) diff --git a/cocos/2d/CCAutoPolygon.h b/cocos/2d/CCAutoPolygon.h index 0190ade06b..7dc7a17749 100644 --- a/cocos/2d/CCAutoPolygon.h +++ b/cocos/2d/CCAutoPolygon.h @@ -89,6 +89,14 @@ public: */ void setQuad(V3F_C4B_T2F_Quad *quad); + /** + * set the data to be a pointer to a triangles + * the member verts will not be released when this PolygonInfo destructs + * as the verts memory are managed by other objects + * @param triangles a pointer to the TrianglesCommand::Triangles object + */ + void setTriangles(TrianglesCommand::Triangles triangles); + /** * get vertex count * @return number of vertices @@ -110,7 +118,6 @@ public: Rect rect; std::string filename; TrianglesCommand::Triangles triangles; - protected: bool isVertsOwner; @@ -267,4 +274,4 @@ protected: NS_CC_END -#endif // #ifndef COCOS_2D_CCAUTOPOLYGON_H__ \ No newline at end of file +#endif // #ifndef COCOS_2D_CCAUTOPOLYGON_H__ diff --git a/cocos/2d/CCClippingNode.cpp b/cocos/2d/CCClippingNode.cpp index fa1a5fdd55..8557203765 100644 --- a/cocos/2d/CCClippingNode.cpp +++ b/cocos/2d/CCClippingNode.cpp @@ -32,6 +32,7 @@ #include "renderer/CCRenderer.h" #include "renderer/CCRenderState.h" #include "base/CCDirector.h" +#include "base/CCStencilStateManager.hpp" #if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_LINUX) #define CC_CLIPPING_NODE_OPENGLES 0 @@ -41,12 +42,6 @@ NS_CC_BEGIN -static GLint g_sStencilBits = -1; -// store the current stencil layer (position in the stencil buffer), -// this will allow nesting up to n ClippingNode, -// where n is the number of bits of the stencil buffer. -static GLint s_layer = -1; - #if CC_CLIPPING_NODE_OPENGLES static void setProgram(Node *n, GLProgram *p) { @@ -61,22 +56,8 @@ static void setProgram(Node *n, GLProgram *p) ClippingNode::ClippingNode() : _stencil(nullptr) -, _alphaThreshold(0.0f) -, _inverted(false) -, _currentStencilEnabled(GL_FALSE) -, _currentStencilWriteMask(~0) -, _currentStencilFunc(GL_ALWAYS) -, _currentStencilRef(0) -, _currentStencilValueMask(~0) -, _currentStencilFail(GL_KEEP) -, _currentStencilPassDepthFail(GL_KEEP) -, _currentStencilPassDepthPass(GL_KEEP) -, _currentDepthWriteMask(GL_TRUE) -, _currentAlphaTestEnabled(GL_FALSE) -, _currentAlphaTestFunc(GL_ALWAYS) -, _currentAlphaTestRef(1) +,_stencilStateManager(new StencilStateManager()) { - } ClippingNode::~ClippingNode() @@ -128,21 +109,6 @@ bool ClippingNode::init(Node *stencil) CC_SAFE_RELEASE(_stencil); _stencil = stencil; CC_SAFE_RETAIN(_stencil); - - _alphaThreshold = 1; - _inverted = false; - // get (only once) the number of bits of the stencil buffer - static bool once = true; - if (once) - { - glGetIntegerv(GL_STENCIL_BITS, &g_sStencilBits); - if (g_sStencilBits <= 0) - { - CCLOG("Stencil buffer is not enabled."); - } - once = false; - } - return true; } @@ -222,45 +188,6 @@ void ClippingNode::onExit() Node::onExit(); } -void ClippingNode::drawFullScreenQuadClearStencil() -{ - Director* director = Director::getInstance(); - CCASSERT(nullptr != director, "Director is null when setting matrix stack"); - - director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); - director->loadIdentityMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); - - director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION); - director->loadIdentityMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION); - - Vec2 vertices[] = { - Vec2(-1.0f, -1.0f), - Vec2(1.0f, -1.0f), - Vec2(1.0f, 1.0f), - Vec2(-1.0f, 1.0f) - }; - - auto glProgram = GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_NAME_POSITION_U_COLOR); - - int colorLocation = glProgram->getUniformLocation("u_color"); - CHECK_GL_ERROR_DEBUG(); - - Color4F color(1, 1, 1, 1); - - glProgram->use(); - glProgram->setUniformsForBuiltins(); - glProgram->setUniformLocationWith4fv(colorLocation, (GLfloat*) &color.r, 1); - - glBindBuffer(GL_ARRAY_BUFFER, 0); - GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION ); - glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices); - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - - CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, 4); - - director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION); - director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); -} void ClippingNode::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags) { @@ -285,9 +212,11 @@ void ClippingNode::visit(Renderer *renderer, const Mat4 &parentTransform, uint32 renderer->pushGroup(_groupCommand.getRenderQueueID()); _beforeVisitCmd.init(_globalZOrder); - _beforeVisitCmd.func = CC_CALLBACK_0(ClippingNode::onBeforeVisit, this); + _beforeVisitCmd.func = CC_CALLBACK_0(StencilStateManager::onBeforeVisit, _stencilStateManager); renderer->addCommand(&_beforeVisitCmd); - if (_alphaThreshold < 1) + + auto alphaThreshold = this->getAlphaThreshold(); + if (alphaThreshold < 1) { #if CC_CLIPPING_NODE_OPENGLES // since glAlphaTest do not exists in OES, use a shader that writes @@ -296,7 +225,7 @@ void ClippingNode::visit(Renderer *renderer, const Mat4 &parentTransform, uint32 GLint alphaValueLocation = glGetUniformLocation(program->getProgram(), GLProgram::UNIFORM_NAME_ALPHA_TEST_VALUE); // set our alphaThreshold program->use(); - program->setUniformLocationWith1f(alphaValueLocation, _alphaThreshold); + program->setUniformLocationWith1f(alphaValueLocation, alphaThreshold); // we need to recursively apply this shader to all the nodes in the stencil node // FIXME: we should have a way to apply shader to all nodes without having to do this setProgram(_stencil, program); @@ -307,7 +236,7 @@ void ClippingNode::visit(Renderer *renderer, const Mat4 &parentTransform, uint32 _stencil->visit(renderer, _modelViewTransform, flags); _afterDrawStencilCmd.init(_globalZOrder); - _afterDrawStencilCmd.func = CC_CALLBACK_0(ClippingNode::onAfterDrawStencil, this); + _afterDrawStencilCmd.func = CC_CALLBACK_0(StencilStateManager::onAfterDrawStencil, _stencilStateManager); renderer->addCommand(&_afterDrawStencilCmd); int i = 0; @@ -339,7 +268,7 @@ void ClippingNode::visit(Renderer *renderer, const Mat4 &parentTransform, uint32 } _afterVisitCmd.init(_globalZOrder); - _afterVisitCmd.func = CC_CALLBACK_0(ClippingNode::onAfterVisit, this); + _afterVisitCmd.func = CC_CALLBACK_0(StencilStateManager::onAfterVisit, _stencilStateManager); renderer->addCommand(&_afterVisitCmd); renderer->popGroup(); @@ -374,196 +303,23 @@ bool ClippingNode::hasContent() const GLfloat ClippingNode::getAlphaThreshold() const { - return _alphaThreshold; + return _stencilStateManager->getAlphaThreshold(); } void ClippingNode::setAlphaThreshold(GLfloat alphaThreshold) { - _alphaThreshold = alphaThreshold; + _stencilStateManager->setAlphaThreshold(alphaThreshold); } bool ClippingNode::isInverted() const { - return _inverted; + return _stencilStateManager->isInverted(); } void ClippingNode::setInverted(bool inverted) { - _inverted = inverted; + _stencilStateManager->setInverted(inverted); } -void ClippingNode::onBeforeVisit() -{ - /////////////////////////////////// - // INIT - - // increment the current layer - s_layer++; - - // mask of the current layer (ie: for layer 3: 00000100) - GLint mask_layer = 0x1 << s_layer; - // mask of all layers less than the current (ie: for layer 3: 00000011) - GLint mask_layer_l = mask_layer - 1; - // mask of all layers less than or equal to the current (ie: for layer 3: 00000111) - _mask_layer_le = mask_layer | mask_layer_l; - - // manually save the stencil state - - _currentStencilEnabled = glIsEnabled(GL_STENCIL_TEST); - glGetIntegerv(GL_STENCIL_WRITEMASK, (GLint *)&_currentStencilWriteMask); - glGetIntegerv(GL_STENCIL_FUNC, (GLint *)&_currentStencilFunc); - glGetIntegerv(GL_STENCIL_REF, &_currentStencilRef); - glGetIntegerv(GL_STENCIL_VALUE_MASK, (GLint *)&_currentStencilValueMask); - glGetIntegerv(GL_STENCIL_FAIL, (GLint *)&_currentStencilFail); - glGetIntegerv(GL_STENCIL_PASS_DEPTH_FAIL, (GLint *)&_currentStencilPassDepthFail); - glGetIntegerv(GL_STENCIL_PASS_DEPTH_PASS, (GLint *)&_currentStencilPassDepthPass); - - // enable stencil use - glEnable(GL_STENCIL_TEST); -// RenderState::StateBlock::_defaultState->setStencilTest(true); - - // check for OpenGL error while enabling stencil test - CHECK_GL_ERROR_DEBUG(); - - // all bits on the stencil buffer are readonly, except the current layer bit, - // this means that operation like glClear or glStencilOp will be masked with this value - glStencilMask(mask_layer); -// RenderState::StateBlock::_defaultState->setStencilWrite(mask_layer); - - // manually save the depth test state - - glGetBooleanv(GL_DEPTH_WRITEMASK, &_currentDepthWriteMask); - - // disable depth test while drawing the stencil - //glDisable(GL_DEPTH_TEST); - // disable update to the depth buffer while drawing the stencil, - // as the stencil is not meant to be rendered in the real scene, - // it should never prevent something else to be drawn, - // only disabling depth buffer update should do - glDepthMask(GL_FALSE); - RenderState::StateBlock::_defaultState->setDepthWrite(false); - - /////////////////////////////////// - // CLEAR STENCIL BUFFER - - // manually clear the stencil buffer by drawing a fullscreen rectangle on it - // setup the stencil test func like this: - // for each pixel in the fullscreen rectangle - // never draw it into the frame buffer - // if not in inverted mode: set the current layer value to 0 in the stencil buffer - // if in inverted mode: set the current layer value to 1 in the stencil buffer - glStencilFunc(GL_NEVER, mask_layer, mask_layer); - glStencilOp(!_inverted ? GL_ZERO : GL_REPLACE, GL_KEEP, GL_KEEP); - - // draw a fullscreen solid rectangle to clear the stencil buffer - //ccDrawSolidRect(Vec2::ZERO, ccpFromSize([[Director sharedDirector] winSize]), Color4F(1, 1, 1, 1)); - drawFullScreenQuadClearStencil(); - - /////////////////////////////////// - // DRAW CLIPPING STENCIL - - // setup the stencil test func like this: - // for each pixel in the stencil node - // never draw it into the frame buffer - // if not in inverted mode: set the current layer value to 1 in the stencil buffer - // if in inverted mode: set the current layer value to 0 in the stencil buffer - glStencilFunc(GL_NEVER, mask_layer, mask_layer); -// RenderState::StateBlock::_defaultState->setStencilFunction(RenderState::STENCIL_NEVER, mask_layer, mask_layer); - - glStencilOp(!_inverted ? GL_REPLACE : GL_ZERO, GL_KEEP, GL_KEEP); -// RenderState::StateBlock::_defaultState->setStencilOperation( -// !_inverted ? RenderState::STENCIL_OP_REPLACE : RenderState::STENCIL_OP_ZERO, -// RenderState::STENCIL_OP_KEEP, -// RenderState::STENCIL_OP_KEEP); - - - // enable alpha test only if the alpha threshold < 1, - // indeed if alpha threshold == 1, every pixel will be drawn anyways - if (_alphaThreshold < 1) { -#if !CC_CLIPPING_NODE_OPENGLES - // manually save the alpha test state - _currentAlphaTestEnabled = glIsEnabled(GL_ALPHA_TEST); - glGetIntegerv(GL_ALPHA_TEST_FUNC, (GLint *)&_currentAlphaTestFunc); - glGetFloatv(GL_ALPHA_TEST_REF, &_currentAlphaTestRef); - // enable alpha testing - glEnable(GL_ALPHA_TEST); - // check for OpenGL error while enabling alpha test - CHECK_GL_ERROR_DEBUG(); - // pixel will be drawn only if greater than an alpha threshold - glAlphaFunc(GL_GREATER, _alphaThreshold); -#endif - } - - //Draw _stencil -} - -void ClippingNode::onAfterDrawStencil() -{ - // restore alpha test state - if (_alphaThreshold < 1) - { -#if CC_CLIPPING_NODE_OPENGLES - // FIXME: we need to find a way to restore the shaders of the stencil node and its children -#else - // manually restore the alpha test state - glAlphaFunc(_currentAlphaTestFunc, _currentAlphaTestRef); - if (!_currentAlphaTestEnabled) - { - glDisable(GL_ALPHA_TEST); - } -#endif - } - - // restore the depth test state - glDepthMask(_currentDepthWriteMask); - RenderState::StateBlock::_defaultState->setDepthWrite(_currentDepthWriteMask != 0); - - //if (currentDepthTestEnabled) { - // glEnable(GL_DEPTH_TEST); - //} - - /////////////////////////////////// - // DRAW CONTENT - - // setup the stencil test function like this: - // for each pixel of this node and its children - // if all layers less than or equals to the current are set to 1 in the stencil buffer - // draw the pixel and keep the current layer in the stencil buffer - // else - // do not draw the pixel but keep the current layer in the stencil buffer - glStencilFunc(GL_EQUAL, _mask_layer_le, _mask_layer_le); -// RenderState::StateBlock::_defaultState->setStencilFunction(RenderState::STENCIL_EQUAL, _mask_layer_le, _mask_layer_le); - - glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); -// RenderState::StateBlock::_defaultState->setStencilOperation(RenderState::STENCIL_OP_KEEP, RenderState::STENCIL_OP_KEEP, RenderState::STENCIL_OP_KEEP); - - // draw (according to the stencil test function) this node and its children -} - - -void ClippingNode::onAfterVisit() -{ - /////////////////////////////////// - // CLEANUP - - // manually restore the stencil state - glStencilFunc(_currentStencilFunc, _currentStencilRef, _currentStencilValueMask); -// RenderState::StateBlock::_defaultState->setStencilFunction((RenderState::StencilFunction)_currentStencilFunc, _currentStencilRef, _currentStencilValueMask); - - glStencilOp(_currentStencilFail, _currentStencilPassDepthFail, _currentStencilPassDepthPass); -// RenderState::StateBlock::_defaultState->setStencilOperation((RenderState::StencilOperation)_currentStencilFail, -// (RenderState::StencilOperation)_currentStencilPassDepthFail, -// (RenderState::StencilOperation)_currentStencilPassDepthPass); - - glStencilMask(_currentStencilWriteMask); - if (!_currentStencilEnabled) - { - glDisable(GL_STENCIL_TEST); -// RenderState::StateBlock::_defaultState->setStencilTest(false); - } - - // we are done using this layer, decrement - s_layer--; -} NS_CC_END diff --git a/cocos/2d/CCClippingNode.h b/cocos/2d/CCClippingNode.h index 63ea9140ca..faba9dfd3b 100644 --- a/cocos/2d/CCClippingNode.h +++ b/cocos/2d/CCClippingNode.h @@ -34,6 +34,8 @@ #include "renderer/CCCustomCommand.h" NS_CC_BEGIN + +class StencilStateManager; /** * @addtogroup _2d * @{ @@ -153,34 +155,9 @@ CC_CONSTRUCTOR_ACCESS: virtual bool init(Node *stencil); protected: - /**draw fullscreen quad to clear stencil bits - */ - void drawFullScreenQuadClearStencil(); - Node* _stencil; - GLfloat _alphaThreshold; - bool _inverted; - - //renderData and callback - void onBeforeVisit(); - void onAfterDrawStencil(); - void onAfterVisit(); - - GLboolean _currentStencilEnabled; - GLuint _currentStencilWriteMask; - GLenum _currentStencilFunc; - GLint _currentStencilRef; - GLuint _currentStencilValueMask; - GLenum _currentStencilFail; - GLenum _currentStencilPassDepthFail; - GLenum _currentStencilPassDepthPass; - GLboolean _currentDepthWriteMask; - - GLboolean _currentAlphaTestEnabled; - GLenum _currentAlphaTestFunc; - GLclampf _currentAlphaTestRef; - - GLint _mask_layer_le; + + StencilStateManager* _stencilStateManager; GroupCommand _groupCommand; CustomCommand _beforeVisitCmd; diff --git a/cocos/2d/CCSprite.cpp b/cocos/2d/CCSprite.cpp index 04366bd4d1..d89b1d6811 100644 --- a/cocos/2d/CCSprite.cpp +++ b/cocos/2d/CCSprite.cpp @@ -1135,7 +1135,7 @@ std::string Sprite::getDescription() const return StringUtils::format("", _tag, texture_id ); } -PolygonInfo Sprite::getPolygonInfo() const +PolygonInfo& Sprite::getPolygonInfo() { return _polyInfo; } diff --git a/cocos/2d/CCSprite.h b/cocos/2d/CCSprite.h index 555fb0a5e3..bcb5655b67 100644 --- a/cocos/2d/CCSprite.h +++ b/cocos/2d/CCSprite.h @@ -403,6 +403,19 @@ public: */ CC_DEPRECATED_ATTRIBUTE void setFlipY(bool flippedY) { setFlippedY(flippedY); }; + /** + * returns a reference of the polygon information associated with this sprite + * + * @return a copy of PolygonInfo + */ + PolygonInfo& getPolygonInfo(); + + /** + * set the sprite to use this new PolygonInfo + * + * @param PolygonInfo the polygon information object + */ + void setPolygonInfo(const PolygonInfo& info); // // Overrides // @@ -564,20 +577,6 @@ CC_CONSTRUCTOR_ACCESS: */ virtual bool initWithFile(const std::string& filename, const Rect& rect); - /** - * returns a copy of the polygon information associated with this sprite - * because this is a copy process it is slower than getting the reference, so use wisely - * - * @return a copy of PolygonInfo - */ - PolygonInfo getPolygonInfo() const; - - /** - * set the sprite to use this new PolygonInfo - * - * @param PolygonInfo the polygon information object - */ - void setPolygonInfo(const PolygonInfo& info); protected: void updateColor() override; diff --git a/cocos/2d/CocosStudioExtension.h b/cocos/2d/CocosStudioExtension.h new file mode 100644 index 0000000000..aa8ad9b4a5 --- /dev/null +++ b/cocos/2d/CocosStudioExtension.h @@ -0,0 +1,44 @@ + +#ifndef __COCOSSTUDIOEXTENSION_H__ +#define __COCOSSTUDIOEXTENSION_H__ + +#include "math/CCAffineTransform.h" + +NS_CC_BEGIN + +struct CC_DLL ResouceData +{ + int type; + std::string file; + std::string plist; + + ResouceData() + { + type = 0; + file = ""; + plist = ""; + } + + ResouceData(int iType, std::string sFile, std::string sPlist) + { + type = iType; + file = sFile; + plist = sPlist; + } +}; + +class CC_DLL NodeExtension +{ +public: + NodeExtension(); + ~NodeExtension(); + +private: + +}; + + +NS_CC_END + + +#endif \ No newline at end of file diff --git a/cocos/2d/libcocos2d.vcxproj b/cocos/2d/libcocos2d.vcxproj index 387c3bd9e7..edbe75585f 100644 --- a/cocos/2d/libcocos2d.vcxproj +++ b/cocos/2d/libcocos2d.vcxproj @@ -1,4 +1,4 @@ - + @@ -433,6 +433,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.* + @@ -652,6 +653,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.* + @@ -1014,6 +1016,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.* + @@ -1254,6 +1257,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.* + @@ -1382,4 +1386,4 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.* - \ No newline at end of file + diff --git a/cocos/2d/libcocos2d.vcxproj.filters b/cocos/2d/libcocos2d.vcxproj.filters index b80fd19400..f8223d660d 100644 --- a/cocos/2d/libcocos2d.vcxproj.filters +++ b/cocos/2d/libcocos2d.vcxproj.filters @@ -1,4 +1,4 @@ - + @@ -934,6 +934,9 @@ ui\UIWidgets\ScrollWidget + + ui\UIWidgets\ScrollWidget + ui\UIWidgets\ScrollWidget @@ -1893,6 +1896,9 @@ base + + base + renderer @@ -3725,6 +3731,9 @@ base + + base + renderer @@ -3776,6 +3785,9 @@ network\Header Files + + ui + @@ -3804,4 +3816,4 @@ 3d - \ No newline at end of file + diff --git a/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems b/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems index b95e166138..31c39d506c 100644 --- a/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems +++ b/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems @@ -1,4 +1,4 @@ - + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) @@ -286,6 +286,7 @@ + @@ -917,6 +918,7 @@ + @@ -1153,6 +1155,7 @@ + @@ -1285,4 +1288,4 @@ - \ No newline at end of file + diff --git a/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems.filters b/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems.filters index fe73a72db5..b82b2259d5 100644 --- a/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems.filters +++ b/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems.filters @@ -1,4 +1,4 @@ - + @@ -1812,6 +1812,9 @@ base + + base + physics3d @@ -2325,6 +2328,9 @@ ui\UIWidgets\ScrollWidget + + ui\UIWidgets\ScrollWidget + ui\UIWidgets\ScrollWidget @@ -3522,6 +3528,9 @@ base + + base + physics3d @@ -3976,4 +3985,4 @@ - \ No newline at end of file + diff --git a/cocos/2d/libcocos2d_win10/libcocos2d.vcxproj b/cocos/2d/libcocos2d_win10/libcocos2d.vcxproj index 96520bb4b2..43532a8b82 100644 --- a/cocos/2d/libcocos2d_win10/libcocos2d.vcxproj +++ b/cocos/2d/libcocos2d_win10/libcocos2d.vcxproj @@ -1,4 +1,4 @@ - + @@ -415,6 +415,7 @@ + @@ -653,6 +654,7 @@ + @@ -1012,6 +1014,7 @@ + @@ -1672,4 +1675,4 @@ - \ No newline at end of file + diff --git a/cocos/2d/libcocos2d_win10/libcocos2d.vcxproj.filters b/cocos/2d/libcocos2d_win10/libcocos2d.vcxproj.filters index 5574ea40b1..4bfeeae4aa 100644 --- a/cocos/2d/libcocos2d_win10/libcocos2d.vcxproj.filters +++ b/cocos/2d/libcocos2d_win10/libcocos2d.vcxproj.filters @@ -1,4 +1,4 @@ - + @@ -1689,6 +1689,9 @@ ui\UIWidgets\ScrollWidget + + ui\UIWidgets\ScrollWidget + ui\UIWidgets\ScrollWidget @@ -1764,6 +1767,9 @@ base + + base + renderer @@ -3632,6 +3638,9 @@ base + + base + renderer @@ -4014,4 +4023,4 @@ 3d - \ No newline at end of file + diff --git a/cocos/3d/CCTerrain.cpp b/cocos/3d/CCTerrain.cpp index 8ea2a04726..79b4731a5e 100644 --- a/cocos/3d/CCTerrain.cpp +++ b/cocos/3d/CCTerrain.cpp @@ -223,7 +223,7 @@ void Terrain::onDraw(const Mat4 &transform, uint32_t flags) #endif } -bool Terrain::initHeightMap(const char * heightMap) +bool Terrain::initHeightMap(const std::string& heightMap) { _heightMapImage = new Image(); _heightMapImage->initWithImageFile(heightMap); @@ -548,7 +548,7 @@ bool Terrain::getIntersectionPoint(const Ray & ray_, Vec3 & intersectionPoint) c getWorldToNodeTransform().transformPoint(&(ray._origin)); std::set closeList; - Vec2 start = Vec2(ray._origin.x,ray._origin.z); + Vec2 start = Vec2(ray_._origin.x,ray_._origin.z); Vec2 dir = Vec2(ray._direction.x,ray._direction.z); start = convertToTerrainSpace(start); start.x /=(_terrainData._chunkSize.width+1); @@ -630,7 +630,7 @@ cocos2d::Vec2 Terrain::convertToTerrainSpace(Vec2 worldSpaceXZ) const return Vec2(image_x,image_y); } -void Terrain::resetHeightMap(const char * heightMap) +void Terrain::resetHeightMap(const std::string& heightMap) { _heightMapImage->release(); _vertices.clear(); @@ -857,7 +857,7 @@ bool Terrain::initTextures() Texture2D::TexParams texParam; texParam.wrapS = GL_REPEAT; texParam.wrapT = GL_REPEAT; - if(!_terrainData._alphaMapSrc) + if(_terrainData._alphaMapSrc.empty()) { auto textImage = new (std::nothrow)Image(); textImage->initWithImageFile(_terrainData._detailMaps[0]._detailMapSrc); @@ -1581,21 +1581,21 @@ Terrain::QuadTree::~QuadTree() if(_br) delete _br; } -Terrain::TerrainData::TerrainData(const char * heightMapsrc , const char * textureSrc, const Size & chunksize, float height, float scale) +Terrain::TerrainData::TerrainData(const std::string& heightMapsrc , const std::string& textureSrc, const Size & chunksize, float height, float scale) { this->_heightMapSrc = heightMapsrc; this->_detailMaps[0]._detailMapSrc = textureSrc; - this->_alphaMapSrc = nullptr; + this->_alphaMapSrc = ""; this->_chunkSize = chunksize; this->_mapHeight = height; this->_mapScale = scale; _skirtHeightRatio = 1; } -Terrain::TerrainData::TerrainData(const char * heightMapsrc, const char * alphamap, const DetailMap& detail1, const DetailMap& detail2, const DetailMap& detail3, const DetailMap& detail4, const Size & chunksize, float height, float scale) +Terrain::TerrainData::TerrainData(const std::string& heightMapsrc, const std::string& alphamap, const DetailMap& detail1, const DetailMap& detail2, const DetailMap& detail3, const DetailMap& detail4, const Size & chunksize, float height, float scale) { this->_heightMapSrc = heightMapsrc; - this->_alphaMapSrc = const_cast(alphamap); + this->_alphaMapSrc = alphamap; this->_detailMaps[0] = detail1; this->_detailMaps[1] = detail2; this->_detailMaps[2] = detail3; @@ -1607,14 +1607,13 @@ Terrain::TerrainData::TerrainData(const char * heightMapsrc, const char * alpham _skirtHeightRatio = 1; } -Terrain::TerrainData::TerrainData(const char* heightMapsrc, const char * alphamap, const DetailMap& detail1, const DetailMap& detail2, const DetailMap& detail3, const Size & chunksize /*= Size(32,32)*/, float height /*= 2*/, float scale /*= 0.1*/) +Terrain::TerrainData::TerrainData(const std::string& heightMapsrc, const std::string& alphamap, const DetailMap& detail1, const DetailMap& detail2, const DetailMap& detail3, const Size & chunksize /*= Size(32,32)*/, float height /*= 2*/, float scale /*= 0.1*/) { this->_heightMapSrc = heightMapsrc; - this->_alphaMapSrc = const_cast(alphamap); + this->_alphaMapSrc = alphamap; this->_detailMaps[0] = detail1; this->_detailMaps[1] = detail2; this->_detailMaps[2] = detail3; - this->_detailMaps[3] = nullptr; this->_chunkSize = chunksize; this->_mapHeight = height; this->_mapScale = scale; @@ -1627,7 +1626,7 @@ Terrain::TerrainData::TerrainData() } -Terrain::DetailMap::DetailMap(const char * detailMapPath, float size /*= 35*/) +Terrain::DetailMap::DetailMap(const std::string& detailMapPath, float size /*= 35*/) { this->_detailMapSrc = detailMapPath; this->_detailMapSize = size; diff --git a/cocos/3d/CCTerrain.h b/cocos/3d/CCTerrain.h index 2220fecbd5..71ea6e0902 100644 --- a/cocos/3d/CCTerrain.h +++ b/cocos/3d/CCTerrain.h @@ -102,7 +102,7 @@ public: struct CC_DLL DetailMap{ /*Constructors*/ DetailMap(); - DetailMap(const char * detailMapSrc, float size = 35); + DetailMap(const std::string& detailMapSrc, float size = 35); /*detail Image source file path*/ std::string _detailMapSrc; /*detailMapSize determine how many tiles that Terrain represent*/ @@ -130,11 +130,11 @@ public: /**empty constructor*/ TerrainData(); /**constructor, this constructor construct a simple terrain which only have 1 detailmap*/ - TerrainData(const char* heightMapsrc, const char * textureSrc, const Size & chunksize = Size(32,32), float mapHeight = 2, float mapScale = 0.1); + TerrainData(const std::string& heightMapsrc, const std::string& textureSrc, const Size & chunksize = Size(32,32), float mapHeight = 2, float mapScale = 0.1); /**constructor, this constructor construct a terrain which have 4 detailmaps, 1 alpha map*/ - TerrainData(const char* heightMapsrc, const char * alphamap, const DetailMap& detail1,const DetailMap& detail2, const DetailMap& detail3, const DetailMap& detail4, const Size & chunksize = Size(32,32), float mapHeight = 2, float mapScale = 0.1); + TerrainData(const std::string& heightMapsrc, const std::string& alphamap, const DetailMap& detail1,const DetailMap& detail2, const DetailMap& detail3, const DetailMap& detail4, const Size & chunksize = Size(32,32), float mapHeight = 2, float mapScale = 0.1); /**constructor, this constructor construct a terrain which have 3 detailmaps, 1 alpha map*/ - TerrainData(const char* heightMapsrc, const char * alphamap, const DetailMap& detail1,const DetailMap& detail2, const DetailMap& detail3, const Size & chunksize = Size(32,32), float mapHeight = 2, float mapScale = 0.1); + TerrainData(const std::string& heightMapsrc, const std::string& alphamap, const DetailMap& detail1,const DetailMap& detail2, const DetailMap& detail3, const Size & chunksize = Size(32,32), float mapHeight = 2, float mapScale = 0.1); /** *determine the chunk size,chunk is the minimal subdivision of the Terrain */ @@ -142,7 +142,7 @@ public: /**height Map source path*/ std::string _heightMapSrc; /**the source path of the alpha map*/ - char* _alphaMapSrc; + std::string _alphaMapSrc; /**detail maps*/ DetailMap _detailMaps[4]; /**terrain Maximum height*/ @@ -316,7 +316,7 @@ public: /**initialize all Properties which terrain need */ bool initProperties(); /**initialize heightMap data */ - bool initHeightMap(const char* heightMap); + bool initHeightMap(const std::string& heightMap); /**initialize alphaMap ,detailMaps textures*/ bool initTextures(); /**create entry*/ @@ -392,7 +392,7 @@ public: /** * reset the heightmap data. */ - void resetHeightMap(const char * heightMap); + void resetHeightMap(const std::string& heightMap); /** * get the terrain's minimal height. diff --git a/cocos/Android.mk b/cocos/Android.mk index c8bbba2b0e..70afa67aa7 100644 --- a/cocos/Android.mk +++ b/cocos/Android.mk @@ -107,6 +107,7 @@ math/Vec2.cpp \ math/Vec3.cpp \ math/Vec4.cpp \ base/CCNinePatchImageParser.cpp \ +base/CCStencilStateManager.cpp \ base/CCAsyncTaskPool.cpp \ base/CCAutoreleasePool.cpp \ base/CCConfiguration.cpp \ diff --git a/cocos/audio/win32/AudioEngine-win32.cpp b/cocos/audio/win32/AudioEngine-win32.cpp index 8eb83c11bc..ad0e851bc3 100644 --- a/cocos/audio/win32/AudioEngine-win32.cpp +++ b/cocos/audio/win32/AudioEngine-win32.cpp @@ -322,6 +322,7 @@ bool AudioEngineImpl::stop(int audioID) _alSourceUsed[player._alSource] = false; if (player._streamingSource) { + player._ready = false; player.notifyExitThread(); } else @@ -346,6 +347,7 @@ void AudioEngineImpl::stopAll() auto& player = it->second; if (player._streamingSource) { + player._ready = false; player.notifyExitThread(); ++it; } @@ -457,7 +459,7 @@ void AudioEngineImpl::update(float dt) auto& player = it->second; alGetSourcei(player._alSource, AL_SOURCE_STATE, &sourceState); - if (player._readForRemove) + if (player._readForRemove && !player._ready) { it = _audioPlayers.erase(it); } @@ -472,6 +474,7 @@ void AudioEngineImpl::update(float dt) if (player._streamingSource) { + player._ready = false; player.notifyExitThread(); ++it; } diff --git a/cocos/base/CCStencilStateManager.cpp b/cocos/base/CCStencilStateManager.cpp new file mode 100644 index 0000000000..0525054780 --- /dev/null +++ b/cocos/base/CCStencilStateManager.cpp @@ -0,0 +1,309 @@ +/**************************************************************************** + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2014 Chukong Technologies Inc. + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#include "CCStencilStateManager.hpp" +#include "base/CCDirector.h" +#include "renderer/CCGLProgramCache.h" +#include "renderer/ccGLStateCache.h" +#include "renderer/CCRenderer.h" +#include "renderer/CCRenderState.h" +#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_LINUX) +#define CC_CLIPPING_NODE_OPENGLES 0 +#else +#define CC_CLIPPING_NODE_OPENGLES 1 +#endif + +NS_CC_BEGIN + +GLint StencilStateManager::s_layer = -1; +static GLint g_sStencilBits = -1; + +StencilStateManager::StencilStateManager() +: _alphaThreshold(1.0f) +, _inverted(false) +, _currentStencilEnabled(GL_FALSE) +, _currentStencilWriteMask(~0) +, _currentStencilFunc(GL_ALWAYS) +, _currentStencilRef(0) +, _currentStencilValueMask(~0) +, _currentStencilFail(GL_KEEP) +, _currentStencilPassDepthFail(GL_KEEP) +, _currentStencilPassDepthPass(GL_KEEP) +, _currentDepthWriteMask(GL_TRUE) +, _currentAlphaTestEnabled(GL_FALSE) +, _currentAlphaTestFunc(GL_ALWAYS) +, _currentAlphaTestRef(1) + +{ + // get (only once) the number of bits of the stencil buffer + static bool once = true; + if (once) + { + glGetIntegerv(GL_STENCIL_BITS, &g_sStencilBits); + if (g_sStencilBits <= 0) + { + CCLOG("Stencil buffer is not enabled."); + } + once = false; + } +} + +void StencilStateManager::drawFullScreenQuadClearStencil() +{ + Director* director = Director::getInstance(); + CCASSERT(nullptr != director, "Director is null when setting matrix stack"); + + director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); + director->loadIdentityMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); + + director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION); + director->loadIdentityMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION); + + Vec2 vertices[] = { + Vec2(-1.0f, -1.0f), + Vec2(1.0f, -1.0f), + Vec2(1.0f, 1.0f), + Vec2(-1.0f, 1.0f) + }; + + auto glProgram = GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_NAME_POSITION_U_COLOR); + + int colorLocation = glProgram->getUniformLocation("u_color"); + CHECK_GL_ERROR_DEBUG(); + + Color4F color(1, 1, 1, 1); + + glProgram->use(); + glProgram->setUniformsForBuiltins(); + glProgram->setUniformLocationWith4fv(colorLocation, (GLfloat*) &color.r, 1); + + glBindBuffer(GL_ARRAY_BUFFER, 0); + GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION ); + glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + + CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, 4); + + director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION); + director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); +} + + +void StencilStateManager::setAlphaThreshold(GLfloat alphaThreshold) +{ + _alphaThreshold = alphaThreshold; +} + +GLfloat StencilStateManager::getAlphaThreshold()const +{ + return _alphaThreshold; +} + +void StencilStateManager::setInverted(bool inverted) +{ + _inverted = inverted; +} + +bool StencilStateManager::isInverted()const +{ + return _inverted; +} + +void StencilStateManager::onBeforeVisit() +{ + /////////////////////////////////// + // INIT + + // increment the current layer + s_layer++; + + // mask of the current layer (ie: for layer 3: 00000100) + GLint mask_layer = 0x1 << s_layer; + // mask of all layers less than the current (ie: for layer 3: 00000011) + GLint mask_layer_l = mask_layer - 1; + // mask of all layers less than or equal to the current (ie: for layer 3: 00000111) + _mask_layer_le = mask_layer | mask_layer_l; + + // manually save the stencil state + + _currentStencilEnabled = glIsEnabled(GL_STENCIL_TEST); + glGetIntegerv(GL_STENCIL_WRITEMASK, (GLint *)&_currentStencilWriteMask); + glGetIntegerv(GL_STENCIL_FUNC, (GLint *)&_currentStencilFunc); + glGetIntegerv(GL_STENCIL_REF, &_currentStencilRef); + glGetIntegerv(GL_STENCIL_VALUE_MASK, (GLint *)&_currentStencilValueMask); + glGetIntegerv(GL_STENCIL_FAIL, (GLint *)&_currentStencilFail); + glGetIntegerv(GL_STENCIL_PASS_DEPTH_FAIL, (GLint *)&_currentStencilPassDepthFail); + glGetIntegerv(GL_STENCIL_PASS_DEPTH_PASS, (GLint *)&_currentStencilPassDepthPass); + + // enable stencil use + glEnable(GL_STENCIL_TEST); + // RenderState::StateBlock::_defaultState->setStencilTest(true); + + // check for OpenGL error while enabling stencil test + CHECK_GL_ERROR_DEBUG(); + + // all bits on the stencil buffer are readonly, except the current layer bit, + // this means that operation like glClear or glStencilOp will be masked with this value + glStencilMask(mask_layer); + // RenderState::StateBlock::_defaultState->setStencilWrite(mask_layer); + + // manually save the depth test state + + glGetBooleanv(GL_DEPTH_WRITEMASK, &_currentDepthWriteMask); + + // disable depth test while drawing the stencil + //glDisable(GL_DEPTH_TEST); + // disable update to the depth buffer while drawing the stencil, + // as the stencil is not meant to be rendered in the real scene, + // it should never prevent something else to be drawn, + // only disabling depth buffer update should do + glDepthMask(GL_FALSE); + RenderState::StateBlock::_defaultState->setDepthWrite(false); + + /////////////////////////////////// + // CLEAR STENCIL BUFFER + + // manually clear the stencil buffer by drawing a fullscreen rectangle on it + // setup the stencil test func like this: + // for each pixel in the fullscreen rectangle + // never draw it into the frame buffer + // if not in inverted mode: set the current layer value to 0 in the stencil buffer + // if in inverted mode: set the current layer value to 1 in the stencil buffer + glStencilFunc(GL_NEVER, mask_layer, mask_layer); + glStencilOp(!_inverted ? GL_ZERO : GL_REPLACE, GL_KEEP, GL_KEEP); + + // draw a fullscreen solid rectangle to clear the stencil buffer + //ccDrawSolidRect(Vec2::ZERO, ccpFromSize([[Director sharedDirector] winSize]), Color4F(1, 1, 1, 1)); + drawFullScreenQuadClearStencil(); + + /////////////////////////////////// + // DRAW CLIPPING STENCIL + + // setup the stencil test func like this: + // for each pixel in the stencil node + // never draw it into the frame buffer + // if not in inverted mode: set the current layer value to 1 in the stencil buffer + // if in inverted mode: set the current layer value to 0 in the stencil buffer + glStencilFunc(GL_NEVER, mask_layer, mask_layer); + // RenderState::StateBlock::_defaultState->setStencilFunction(RenderState::STENCIL_NEVER, mask_layer, mask_layer); + + glStencilOp(!_inverted ? GL_REPLACE : GL_ZERO, GL_KEEP, GL_KEEP); + // RenderState::StateBlock::_defaultState->setStencilOperation( + // !_inverted ? RenderState::STENCIL_OP_REPLACE : RenderState::STENCIL_OP_ZERO, + // RenderState::STENCIL_OP_KEEP, + // RenderState::STENCIL_OP_KEEP); + + + // enable alpha test only if the alpha threshold < 1, + // indeed if alpha threshold == 1, every pixel will be drawn anyways + if (_alphaThreshold < 1) { +#if !CC_CLIPPING_NODE_OPENGLES + // manually save the alpha test state + _currentAlphaTestEnabled = glIsEnabled(GL_ALPHA_TEST); + glGetIntegerv(GL_ALPHA_TEST_FUNC, (GLint *)&_currentAlphaTestFunc); + glGetFloatv(GL_ALPHA_TEST_REF, &_currentAlphaTestRef); + // enable alpha testing + glEnable(GL_ALPHA_TEST); + // check for OpenGL error while enabling alpha test + CHECK_GL_ERROR_DEBUG(); + // pixel will be drawn only if greater than an alpha threshold + glAlphaFunc(GL_GREATER, _alphaThreshold); +#endif + } + + //Draw _stencil +} + +void StencilStateManager::onAfterDrawStencil() +{ + // restore alpha test state + if (_alphaThreshold < 1) + { +#if CC_CLIPPING_NODE_OPENGLES + // FIXME: we need to find a way to restore the shaders of the stencil node and its children +#else + // manually restore the alpha test state + glAlphaFunc(_currentAlphaTestFunc, _currentAlphaTestRef); + if (!_currentAlphaTestEnabled) + { + glDisable(GL_ALPHA_TEST); + } +#endif + } + + // restore the depth test state + glDepthMask(_currentDepthWriteMask); + RenderState::StateBlock::_defaultState->setDepthWrite(_currentDepthWriteMask != 0); + + //if (currentDepthTestEnabled) { + // glEnable(GL_DEPTH_TEST); + //} + + /////////////////////////////////// + // DRAW CONTENT + + // setup the stencil test function like this: + // for each pixel of this node and its children + // if all layers less than or equals to the current are set to 1 in the stencil buffer + // draw the pixel and keep the current layer in the stencil buffer + // else + // do not draw the pixel but keep the current layer in the stencil buffer + glStencilFunc(GL_EQUAL, _mask_layer_le, _mask_layer_le); + // RenderState::StateBlock::_defaultState->setStencilFunction(RenderState::STENCIL_EQUAL, _mask_layer_le, _mask_layer_le); + + glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); + // RenderState::StateBlock::_defaultState->setStencilOperation(RenderState::STENCIL_OP_KEEP, RenderState::STENCIL_OP_KEEP, RenderState::STENCIL_OP_KEEP); + + // draw (according to the stencil test function) this node and its children + +} + +void StencilStateManager::onAfterVisit() +{ + /////////////////////////////////// + // CLEANUP + + // manually restore the stencil state + glStencilFunc(_currentStencilFunc, _currentStencilRef, _currentStencilValueMask); + // RenderState::StateBlock::_defaultState->setStencilFunction((RenderState::StencilFunction)_currentStencilFunc, _currentStencilRef, _currentStencilValueMask); + + glStencilOp(_currentStencilFail, _currentStencilPassDepthFail, _currentStencilPassDepthPass); + // RenderState::StateBlock::_defaultState->setStencilOperation((RenderState::StencilOperation)_currentStencilFail, + // (RenderState::StencilOperation)_currentStencilPassDepthFail, + // (RenderState::StencilOperation)_currentStencilPassDepthPass); + + glStencilMask(_currentStencilWriteMask); + if (!_currentStencilEnabled) + { + glDisable(GL_STENCIL_TEST); + // RenderState::StateBlock::_defaultState->setStencilTest(false); + } + + // we are done using this layer, decrement + s_layer--; +} + + +NS_CC_END diff --git a/cocos/base/CCStencilStateManager.hpp b/cocos/base/CCStencilStateManager.hpp new file mode 100644 index 0000000000..82e0c2ee0f --- /dev/null +++ b/cocos/base/CCStencilStateManager.hpp @@ -0,0 +1,79 @@ +/**************************************************************************** + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2015 Chukong Technologies Inc. + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ +#ifndef StencilStateManager_hpp +#define StencilStateManager_hpp +#include "base/ccConfig.h" +#include "platform/CCPlatformMacros.h" +#include "platform/CCGL.h" + +/** + * @addtogroup base + * @{ + */ +NS_CC_BEGIN + +class CC_DLL StencilStateManager +{ +public: + StencilStateManager(); + void onBeforeVisit(); + void onAfterDrawStencil(); + void onAfterVisit(); + void setAlphaThreshold(GLfloat alphaThreshold); + void setInverted(bool inverted); + bool isInverted()const; + GLfloat getAlphaThreshold()const; +private: + CC_DISALLOW_COPY_AND_ASSIGN(StencilStateManager); + static GLint s_layer; + /**draw fullscreen quad to clear stencil bits + */ + void drawFullScreenQuadClearStencil(); + + + GLfloat _alphaThreshold; + bool _inverted; + + GLboolean _currentStencilEnabled; + GLuint _currentStencilWriteMask; + GLenum _currentStencilFunc; + GLint _currentStencilRef; + GLuint _currentStencilValueMask; + GLenum _currentStencilFail; + GLenum _currentStencilPassDepthFail; + GLenum _currentStencilPassDepthPass; + GLboolean _currentDepthWriteMask; + + GLboolean _currentAlphaTestEnabled; + GLenum _currentAlphaTestFunc; + GLclampf _currentAlphaTestRef; + + GLint _mask_layer_le; +}; + +NS_CC_END +// end of base group +/** @} */ +#endif /* StencilStateManager_hpp */ diff --git a/cocos/base/CMakeLists.txt b/cocos/base/CMakeLists.txt index ec3884ddeb..8e2881e7cc 100644 --- a/cocos/base/CMakeLists.txt +++ b/cocos/base/CMakeLists.txt @@ -45,6 +45,7 @@ set(COCOS_BASE_SRC base/CCUserDefault.cpp base/CCValue.cpp base/ObjectFactory.cpp + base/CCStencilStateManager.cpp base/TGAlib.cpp base/ZipUtils.cpp base/allocator/CCAllocatorDiagnostics.cpp diff --git a/cocos/base/ccUtils.cpp b/cocos/base/ccUtils.cpp index c303472d5f..9a9e1304ae 100644 --- a/cocos/base/ccUtils.cpp +++ b/cocos/base/ccUtils.cpp @@ -30,10 +30,12 @@ THE SOFTWARE. #include "base/CCDirector.h" #include "base/CCAsyncTaskPool.h" #include "base/CCEventDispatcher.h" +#include "base/base64.h" #include "renderer/CCCustomCommand.h" #include "renderer/CCRenderer.h" #include "platform/CCImage.h" #include "platform/CCFileUtils.h" +#include "2d/CCSprite.h" NS_CC_BEGIN @@ -263,7 +265,28 @@ Rect getCascadeBoundingBox(Node *node) return cbb; } + +Sprite* createSpriteFromBase64(const char* base64String) +{ + unsigned char* decoded; + int length = base64Decode((const unsigned char*) base64String, (unsigned int) strlen(base64String), &decoded); + + Image *image = new Image(); + bool imageResult = image->initWithImageData(decoded, length); + CCASSERT(imageResult, "Failed to create image from base64!"); + free(decoded); + + Texture2D *texture = new Texture2D(); + texture->initWithImage(image); + texture->setAliasTexParameters(); + image->release(); + + Sprite* sprite = Sprite::createWithTexture(texture); + texture->release(); + return sprite; +} + } NS_CC_END diff --git a/cocos/base/ccUtils.h b/cocos/base/ccUtils.h index 4740f17240..1617e413aa 100644 --- a/cocos/base/ccUtils.h +++ b/cocos/base/ccUtils.h @@ -52,6 +52,8 @@ Examples: int ccNextPOT(int value); +class Sprite; + namespace utils { /** Capture the entire screen. @@ -100,6 +102,14 @@ namespace utils * @return Returns unionof bounding box of a node and its children. */ Rect CC_DLL getCascadeBoundingBox(Node *node); + + /** + * Create a sprite instance from base64 encoded image. + + * @return Returns an instance of sprite + */ + Sprite* createSpriteFromBase64(const char* base64String); + } NS_CC_END diff --git a/cocos/cocos2d.h b/cocos/cocos2d.h index 282321f4fb..1f3a539d2c 100644 --- a/cocos/cocos2d.h +++ b/cocos/cocos2d.h @@ -30,7 +30,7 @@ THE SOFTWARE. // 0x00 HI ME LO // 00 03 08 00 -#define COCOS2D_VERSION 0x00030800 +#define COCOS2D_VERSION 0x00030900 // // all cocos2d include files diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.cpp index 1cbc10f4b6..125b649936 100644 --- a/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.cpp +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.cpp @@ -618,20 +618,44 @@ void InnerActionFrame::onEnter(Frame *nextFrame, int currentFrameIndex) void InnerActionFrame::setStartFrameIndex(int frameIndex) { +#ifdef CC_STUDIO_ENABLED_VIEW // for cocostudio only + if (_enterWithName) + { + CCLOG(" cannot set start when enter frame with name. setEnterWithName false firstly!"); + throw std::exception(); + } +#else CCASSERT(!_enterWithName, " cannot setStartFrameIndex when enterWithName is set"); +#endif _startFrameIndex = frameIndex; } void InnerActionFrame::setEndFrameIndex(int frameIndex) { +#ifdef CC_STUDIO_ENABLED_VIEW // for cocostudio only + if (_enterWithName) + { + CCLOG(" cannot set end when enter frame with name. setEnterWithName false firstly!"); + throw std::exception(); + } +#else CCASSERT(!_enterWithName, " cannot setEndFrameIndex when enterWithName is set"); +#endif _endFrameIndex = frameIndex; } void InnerActionFrame::setAnimationName(const std::string& animationName) { +#ifdef CC_STUDIO_ENABLED_VIEW // for cocostudio only + if (!_enterWithName) + { + CCLOG(" cannot set aniamtioname when enter frame with index. setEnterWithName true firstly!"); + throw std::exception(); + } +#else CCASSERT(_enterWithName, " cannot set aniamtioname when enter frame with index. setEnterWithName true firstly!"); +#endif _animationName = animationName; } diff --git a/cocos/editor-support/cocostudio/CCActionNode.cpp b/cocos/editor-support/cocostudio/CCActionNode.cpp index f963a242f2..a879cd61f6 100644 --- a/cocos/editor-support/cocostudio/CCActionNode.cpp +++ b/cocos/editor-support/cocostudio/CCActionNode.cpp @@ -26,6 +26,7 @@ THE SOFTWARE. #include "cocostudio/CCActionFrameEasing.h" #include "ui/UIWidget.h" #include "ui/UIHelper.h" +#include "ui/UILayout.h" #include "cocostudio/CocoLoader.h" #include "base/ccUtils.h" @@ -73,7 +74,14 @@ ActionNode::~ActionNode() void ActionNode::initWithDictionary(const rapidjson::Value& dic, Ref* root) { + Widget * rw = dynamic_cast(root); + if (nullptr == rw) + return; + setActionTag(DICTOOL->getIntValue_json(dic, "ActionTag")); + Widget* node = Helper::seekActionWidgetByActionTag(rw, getActionTag()); + bool positionOffset = node && (nullptr == (dynamic_cast(node))); + int actionFrameCount = DICTOOL->getArrayCount_json(dic, "actionframelist"); for (int i=0; igetFloatValue_json(actionFrameDic, "positionx"); float positionY = DICTOOL->getFloatValue_json(actionFrameDic, "positiony"); + if (positionOffset && (nullptr != node->getParent())) + { + Vec2 AnchorPointIn = node->getParent()->getAnchorPointInPoints(); + positionX += AnchorPointIn.x; + positionY += AnchorPointIn.y; + } ActionMoveFrame* actionFrame = new (std::nothrow) ActionMoveFrame(); actionFrame->setFrameIndex(frameInex); actionFrame->setEasingType(frameTweenType); diff --git a/cocos/editor-support/cocostudio/CCArmatureDataManager.cpp b/cocos/editor-support/cocostudio/CCArmatureDataManager.cpp index d0d7639a6e..5638bbbbb9 100644 --- a/cocos/editor-support/cocostudio/CCArmatureDataManager.cpp +++ b/cocos/editor-support/cocostudio/CCArmatureDataManager.cpp @@ -250,7 +250,7 @@ const cocos2d::Map& ArmatureDataManager::getTextureDa return _textureDatas; } -void CCArmatureDataManager::addRelativeData(const std::string& configFilePath) +void ArmatureDataManager::addRelativeData(const std::string& configFilePath) { if (_relativeDatas.find(configFilePath) == _relativeDatas.end()) { @@ -258,7 +258,7 @@ void CCArmatureDataManager::addRelativeData(const std::string& configFilePath) } } -RelativeData *CCArmatureDataManager::getRelativeData(const std::string& configFilePath) +RelativeData *ArmatureDataManager::getRelativeData(const std::string& configFilePath) { return &_relativeDatas[configFilePath]; } diff --git a/cocos/editor-support/cocostudio/WidgetReader/ArmatureNodeReader/ArmatureNodeReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/ArmatureNodeReader/ArmatureNodeReader.cpp index 27ff13c4cf..4c2eeda87b 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/ArmatureNodeReader/ArmatureNodeReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/ArmatureNodeReader/ArmatureNodeReader.cpp @@ -165,7 +165,7 @@ void ArmatureNodeReader::setPropsWithFlatBuffers(cocos2d::Node *node, cocos2d::Node* ArmatureNodeReader::createNodeWithFlatBuffers(const flatbuffers::Table *nodeOptions) { - auto node = CCArmature::create(); + auto node = Armature::create(); // self auto options = (flatbuffers::CSArmatureNodeOption*)nodeOptions; diff --git a/cocos/network/HttpAsynConnection-apple.h b/cocos/network/HttpAsynConnection-apple.h index 3de2b9b6db..3995cf2c09 100644 --- a/cocos/network/HttpAsynConnection-apple.h +++ b/cocos/network/HttpAsynConnection-apple.h @@ -34,6 +34,18 @@ /// @cond @interface HttpAsynConnection : NSObject { + NSString *srcURL; + NSString *sslFile; + NSDictionary *responseHeader; + NSMutableData *responseData; + NSInteger getDataTime; + NSInteger responseCode; + NSString *statusString; + NSError *responseError; + NSError *connError; + NSURLConnection *conn; + bool finish; + NSRunLoop *runLoop; } // The original URL to download. Due to redirects the actual content may come from another URL diff --git a/cocos/network/HttpAsynConnection-apple.m b/cocos/network/HttpAsynConnection-apple.m index b119d781cf..4f1faa9efe 100755 --- a/cocos/network/HttpAsynConnection-apple.m +++ b/cocos/network/HttpAsynConnection-apple.m @@ -35,18 +35,18 @@ @implementation HttpAsynConnection -@synthesize srcURL; -@synthesize sslFile; -@synthesize responseHeader; -@synthesize responseData; -@synthesize getDataTime; -@synthesize responseCode; -@synthesize statusString; -@synthesize responseError; -@synthesize connError; -@synthesize conn; -@synthesize finish; -@synthesize runLoop; +@synthesize srcURL = srcURL; +@synthesize sslFile = sslFile; +@synthesize responseHeader = responseHeader; +@synthesize responseData = responseData; +@synthesize getDataTime = getDataTime; +@synthesize responseCode = responseCode; +@synthesize statusString = statusString; +@synthesize responseError = responseError; +@synthesize connError = connError; +@synthesize conn = conn; +@synthesize finish = finish; +@synthesize runLoop = runLoop; - (void)dealloc { diff --git a/cocos/network/HttpRequest.h b/cocos/network/HttpRequest.h index eafe52538a..ea3de64a2d 100644 --- a/cocos/network/HttpRequest.h +++ b/cocos/network/HttpRequest.h @@ -242,7 +242,7 @@ public: */ CC_DEPRECATED_ATTRIBUTE inline void setResponseCallback(Ref* pTarget, SEL_CallFuncND pSelector) { - setResponseCallback(pTarget, (SEL_HttpResponse) pSelector); + doSetResponseCallback(pTarget, (SEL_HttpResponse)pSelector); } /** @@ -254,13 +254,7 @@ public: */ CC_DEPRECATED_ATTRIBUTE inline void setResponseCallback(Ref* pTarget, SEL_HttpResponse pSelector) { - _pTarget = pTarget; - _pSelector = pSelector; - - if (_pTarget) - { - _pTarget->retain(); - } + doSetResponseCallback(pTarget, pSelector); } /** * Set response callback function of HttpRequest object. @@ -342,6 +336,18 @@ public: return _headers; } +private: + inline void doSetResponseCallback(Ref* pTarget, SEL_HttpResponse pSelector) + { + _pTarget = pTarget; + _pSelector = pSelector; + + if (_pTarget) + { + _pTarget->retain(); + } + } + protected: // properties Type _requestType; /// kHttpRequestGet, kHttpRequestPost or other enums diff --git a/cocos/physics/CCPhysicsWorld.cpp b/cocos/physics/CCPhysicsWorld.cpp index 73545d658b..a1d2c538f5 100644 --- a/cocos/physics/CCPhysicsWorld.cpp +++ b/cocos/physics/CCPhysicsWorld.cpp @@ -826,10 +826,6 @@ void PhysicsWorld::update(float delta, bool userCall/* = false*/) if (userCall) { cpSpaceStep(_cpSpace, delta); - for (auto& body : _bodies) - { - body->update(delta); - } } else { @@ -840,10 +836,6 @@ void PhysicsWorld::update(float delta, bool userCall/* = false*/) for (int i = 0; i < _substeps; ++i) { cpSpaceStep(_cpSpace, dt); - for (auto& body : _bodies) - { - body->update(dt); - } } _updateRateCount = 0; _updateTime = 0.0f; diff --git a/cocos/platform/CCApplicationProtocol.h b/cocos/platform/CCApplicationProtocol.h index 2b78c0b92f..9ac60baa2b 100644 --- a/cocos/platform/CCApplicationProtocol.h +++ b/cocos/platform/CCApplicationProtocol.h @@ -136,6 +136,13 @@ public: */ virtual Platform getTargetPlatform() = 0; + /** + @brief Get application version. + * @js NA + * @lua NA + */ + virtual std::string getVersion() = 0; + /** @brief Open url in default browser. @param String with url to open. diff --git a/cocos/platform/android/CCApplication-android.cpp b/cocos/platform/android/CCApplication-android.cpp index 57f82f50c9..6778ff8906 100644 --- a/cocos/platform/android/CCApplication-android.cpp +++ b/cocos/platform/android/CCApplication-android.cpp @@ -192,6 +192,11 @@ Application::Platform Application::getTargetPlatform() return Platform::OS_ANDROID; } +std::string Application::getVersion() +{ + return JniHelper::callStaticStringMethod(helperClassName, "getVersion"); +} + bool Application::openURL(const std::string &url) { return JniHelper::callStaticBooleanMethod(helperClassName, "openURL", url); diff --git a/cocos/platform/android/CCApplication-android.h b/cocos/platform/android/CCApplication-android.h index d1f8c47c48..3555255d0e 100644 --- a/cocos/platform/android/CCApplication-android.h +++ b/cocos/platform/android/CCApplication-android.h @@ -84,6 +84,11 @@ public: */ virtual Platform getTargetPlatform(); + /** + @brief Get application version. + */ + virtual std::string getVersion() override; + /** @brief Open url in default browser @param String with url to open. diff --git a/cocos/platform/android/CCGLViewImpl-android.cpp b/cocos/platform/android/CCGLViewImpl-android.cpp index 55d0910fe8..2fc9b01d39 100644 --- a/cocos/platform/android/CCGLViewImpl-android.cpp +++ b/cocos/platform/android/CCGLViewImpl-android.cpp @@ -29,7 +29,7 @@ THE SOFTWARE. #include "CCGLViewImpl-android.h" #include "base/CCDirector.h" #include "base/ccMacros.h" -#include "jni/JniHelper.h" +#include "platform/android/jni/JniHelper.h" #include "CCGL.h" #include diff --git a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java index cadabac2e2..851e1b4bfe 100644 --- a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java +++ b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java @@ -50,46 +50,6 @@ import javax.microedition.khronos.egl.EGL10; import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.egl.EGLDisplay; -class ResizeLayout extends FrameLayout{ - private boolean mEnableForceDoLayout = false; - - public ResizeLayout(Context context){ - super(context); - } - - public ResizeLayout(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public void setEnableForceDoLayout(boolean flag){ - mEnableForceDoLayout = flag; - } - - @Override - protected void onLayout(boolean changed, int l, int t, int r, int b) { - super.onLayout(changed, l, t, r, b); - if(mEnableForceDoLayout){ - /*This is a hot-fix for some android devices which don't do layout when the main window - * is paned. We refersh the layout in 24 frames per seconds. - * When the editBox is lose focus or when user begin to type, the do layout is disabled. - */ - final Handler handler = new Handler(); - handler.postDelayed(new Runnable() { - @Override - public void run() { - //Do something after 100ms - requestLayout(); - invalidate(); - } - }, 1000 / 24); - - } - - } - -} - - public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelperListener { // =========================================================== // Constants diff --git a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxHelper.java b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxHelper.java index 8bd35f4980..282382da6f 100644 --- a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxHelper.java +++ b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxHelper.java @@ -212,6 +212,15 @@ public class Cocos2dxHelper { sVibrateService.vibrate((long)(duration * 1000)); } + public static String getVersion() { + try { + String version = Cocos2dxActivity.getContext().getPackageManager().getPackageInfo(Cocos2dxActivity.getContext().getPackageName(), 0).versionName; + return version; + } catch(Exception e) { + return ""; + } + } + public static boolean openURL(String url) { boolean ret = false; try { diff --git a/cocos/platform/android/java/src/org/cocos2dx/lib/ResizeLayout.java b/cocos/platform/android/java/src/org/cocos2dx/lib/ResizeLayout.java new file mode 100644 index 0000000000..0c9b2fdf78 --- /dev/null +++ b/cocos/platform/android/java/src/org/cocos2dx/lib/ResizeLayout.java @@ -0,0 +1,68 @@ +/**************************************************************************** + Copyright (c) 2010-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 android.content.Context; +import android.os.Handler; +import android.util.AttributeSet; +import android.widget.FrameLayout; + +public class ResizeLayout extends FrameLayout { + private boolean mEnableForceDoLayout = false; + + public ResizeLayout(Context context){ + super(context); + } + + public ResizeLayout(Context context, AttributeSet attrs) { + super(context, attrs); + } + + public void setEnableForceDoLayout(boolean flag){ + mEnableForceDoLayout = flag; + } + + @Override + protected void onLayout(boolean changed, int l, int t, int r, int b) { + super.onLayout(changed, l, t, r, b); + if(mEnableForceDoLayout){ + /*This is a hot-fix for some android devices which don't do layout when the main window + * is paned. We refersh the layout in 24 frames per seconds. + * When the editBox is lose focus or when user begin to type, the do layout is disabled. + */ + final Handler handler = new Handler(); + handler.postDelayed(new Runnable() { + @Override + public void run() { + //Do something after 100ms + requestLayout(); + invalidate(); + } + }, 1000 / 24); + + } + + } + +} diff --git a/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp b/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp index 58c7dc19b4..3e0e70331f 100644 --- a/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp +++ b/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp @@ -83,6 +83,10 @@ const char * getApkPath() { return g_apkPath.c_str(); } +std::string getPackageNameJNI() { + return JniHelper::callStaticStringMethod(className, "getCocos2dxPackageName"); +} + void conversionEncodingJNI(const char* src, int byteSize, const char* fromCharset, char* dst, const char* newCharset) { JniMethodInfo methodInfo; diff --git a/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h b/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h index 82e40001a3..e32a8e79c9 100644 --- a/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h +++ b/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h @@ -30,39 +30,7 @@ THE SOFTWARE. typedef void (*EditTextCallback)(const char* text, void* ctx); extern const char * getApkPath(); -extern void showDialogJNI(const char * message, const char * title); -// extern void terminateProcessJNI(); -// extern std::string getCurrentLanguageJNI(); -// extern std::string getPackageNameJNI(); -extern std::string getFileDirectoryJNI(); -// functions for UserDefault -// extern bool getBoolForKeyJNI(const char* key, bool defaultValue); -// extern int getIntegerForKeyJNI(const char* key, int defaultValue); -// extern float getFloatForKeyJNI(const char* key, float defaultValue); -// extern double getDoubleForKeyJNI(const char* key, double defaultValue); -// extern std::string getStringForKeyJNI(const char* key, const char* defaultValue); -// extern void setBoolForKeyJNI(const char* key, bool value); -// extern void setIntegerForKeyJNI(const char* key, int value); -// extern void setFloatForKeyJNI(const char* key, float value); -// extern void setDoubleForKeyJNI(const char* key, double value); -// extern void setStringForKeyJNI(const char* key, const char* value); -// extern void deleteValueForKeyJNI(const char* key); +extern std::string getPackageNameJNI(); extern void conversionEncodingJNI(const char* src, int byteSize, const char* fromCharset, char* dst, const char* newCharset); -//Added for new Android EditBox -extern int addEditBoxJNI(int left, int top, int width, int height, float scaleX); -extern void removeEditBoxJNI(int index); -extern void setEditBoxViewRectJNI(int index, int left, int top, int width, int height); -extern void setMaxLengthJNI(int index, int maxLength); -extern void openEditBoxKeyboardJNI(int index); -extern void closeEditBoxKeyboardJNI(int index); -extern void setVisibleEditBoxJNI(int index, bool visibility); -extern void setReturnTypeEditBoxJNI(int index, int returnType); -extern void setInputFlagEditBoxJNI(int index, int inputFlag); -extern void setInputModeEditBoxJNI(int index, int inputMode); -extern void setTextEditBoxJNI(int index, const char* text); -extern void setFontEditBoxJNI(int index, const char* fontName, float fontSize); -extern void setFontColorEditBoxJNI(int index, int red, int green, int blue, int alpha); -extern void setPlaceHolderTextEditBoxJNI(int index, const char* text); -extern void setPlaceHolderTextColorEditBoxJNI(int index, int red, int green, int blue, int alpha); #endif /* __Java_org_cocos2dx_lib_Cocos2dxHelper_H__ */ diff --git a/cocos/platform/ios/CCApplication-ios.h b/cocos/platform/ios/CCApplication-ios.h index ae93c83d4d..ea9f95d59a 100644 --- a/cocos/platform/ios/CCApplication-ios.h +++ b/cocos/platform/ios/CCApplication-ios.h @@ -67,31 +67,36 @@ public: @brief Callback by Director for limit FPS. @param interval The time, expressed in seconds, between current frame and next. */ - virtual void setAnimationInterval(float interval); + virtual void setAnimationInterval(float interval) override; /** @brief Get current language config @return Current language config */ - virtual LanguageType getCurrentLanguage(); + virtual LanguageType getCurrentLanguage() override; /** @brief Get current language iso 639-1 code @return Current language iso 639-1 code */ - virtual const char * getCurrentLanguageCode(); + virtual const char * getCurrentLanguageCode() override; /** @brief Get target platform */ - virtual Platform getTargetPlatform(); + virtual Platform getTargetPlatform() override; + + /** + @brief Get application version. + */ + virtual std::string getVersion() override; /** @brief Open url in default browser @param String with url to open. @return true if the resource located by the URL was successfully opened; otherwise false. */ - virtual bool openURL(const std::string &url); + virtual bool openURL(const std::string &url) override; /** @brief This function will be called when the application screen size is changed. diff --git a/cocos/platform/ios/CCApplication-ios.mm b/cocos/platform/ios/CCApplication-ios.mm index 7411478060..69bc93c895 100644 --- a/cocos/platform/ios/CCApplication-ios.mm +++ b/cocos/platform/ios/CCApplication-ios.mm @@ -139,6 +139,14 @@ Application::Platform Application::getTargetPlatform() } } +std::string Application::getVersion() { + NSString* version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]; + if (version) { + return [version UTF8String]; + } + return ""; +} + bool Application::openURL(const std::string &url) { NSString* msg = [NSString stringWithCString:url.c_str() encoding:NSUTF8StringEncoding]; diff --git a/cocos/platform/ios/CCGLViewImpl-ios.h b/cocos/platform/ios/CCGLViewImpl-ios.h index f7ec641d17..83a7607df8 100644 --- a/cocos/platform/ios/CCGLViewImpl-ios.h +++ b/cocos/platform/ios/CCGLViewImpl-ios.h @@ -58,16 +58,16 @@ public: static int _depthFormat; /** sets the content scale factor */ - bool setContentScaleFactor(float contentScaleFactor) override; + virtual bool setContentScaleFactor(float contentScaleFactor) override; /** returns the content scale factor */ - float getContentScaleFactor() const override; + virtual float getContentScaleFactor() const override; /** returns whether or not the view is in Retina Display mode */ - bool isRetinaDisplay() const override { return getContentScaleFactor() == 2.0; } + virtual bool isRetinaDisplay() const override { return getContentScaleFactor() == 2.0; } /** returns the objective-c CCEAGLView instance */ - void* getEAGLView() const override { return _eaglview; } + virtual void* getEAGLView() const override { return _eaglview; } // overrides virtual bool isOpenGLReady() override; diff --git a/cocos/platform/linux/CCApplication-linux.cpp b/cocos/platform/linux/CCApplication-linux.cpp index 12f1e89228..8f19a553fb 100644 --- a/cocos/platform/linux/CCApplication-linux.cpp +++ b/cocos/platform/linux/CCApplication-linux.cpp @@ -136,6 +136,11 @@ Application::Platform Application::getTargetPlatform() return Platform::OS_LINUX; } +std::string Application::getVersion() +{ + return ""; +} + bool Application::openURL(const std::string &url) { std::string op = std::string("open ").append(url); diff --git a/cocos/platform/linux/CCApplication-linux.h b/cocos/platform/linux/CCApplication-linux.h index c827023af1..d96cb61115 100644 --- a/cocos/platform/linux/CCApplication-linux.h +++ b/cocos/platform/linux/CCApplication-linux.h @@ -78,6 +78,11 @@ public: */ virtual const char * getCurrentLanguageCode(); + /** + @brief Get application version + */ + virtual std::string getVersion() override; + /** @brief Open url in default browser @param String with url to open. diff --git a/cocos/platform/mac/CCApplication-mac.h b/cocos/platform/mac/CCApplication-mac.h index 2a243a7624..c056d73fe3 100644 --- a/cocos/platform/mac/CCApplication-mac.h +++ b/cocos/platform/mac/CCApplication-mac.h @@ -52,7 +52,7 @@ public: @brief Callback by Director for limit FPS. @param interval The time, which expressed in second in second, between current frame and next. */ - virtual void setAnimationInterval(float interval); + virtual void setAnimationInterval(float interval) override; /** @brief Get status bar rectangle in GLView window. @@ -78,25 +78,30 @@ public: @brief Get current language config @return Current language config */ - virtual LanguageType getCurrentLanguage(); + virtual LanguageType getCurrentLanguage() override; /** @brief Get current language iso 639-1 code @return Current language iso 639-1 code */ - virtual const char * getCurrentLanguageCode(); + virtual const char * getCurrentLanguageCode() override; /** @brief Get target platform */ - virtual Platform getTargetPlatform(); + virtual Platform getTargetPlatform() override; + /** + @brief Get application version. + */ + virtual std::string getVersion() override; + /** @brief Open url in default browser @param String with url to open. @return true if the resource located by the URL was successfully opened; otherwise false. */ - virtual bool openURL(const std::string &url); + virtual bool openURL(const std::string &url) override; /** * Sets the Resource root path. diff --git a/cocos/platform/mac/CCApplication-mac.mm b/cocos/platform/mac/CCApplication-mac.mm index 1666776a5c..47c55a8b07 100644 --- a/cocos/platform/mac/CCApplication-mac.mm +++ b/cocos/platform/mac/CCApplication-mac.mm @@ -118,6 +118,14 @@ Application::Platform Application::getTargetPlatform() return Platform::OS_MAC; } +std::string Application::getVersion() { + NSString* version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]; + if (version) { + return [version UTF8String]; + } + return ""; +} + ///////////////////////////////////////////////////////////////////////////////////////////////// // static member function ////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/cocos/platform/win32/CCApplication-win32.cpp b/cocos/platform/win32/CCApplication-win32.cpp index 9ee4b56f3f..1c752094ef 100644 --- a/cocos/platform/win32/CCApplication-win32.cpp +++ b/cocos/platform/win32/CCApplication-win32.cpp @@ -217,6 +217,11 @@ Application::Platform Application::getTargetPlatform() return Platform::OS_WINDOWS; } +std::string Application::getVersion() +{ + return ""; +} + bool Application::openURL(const std::string &url) { WCHAR *temp = new WCHAR[url.size() + 1]; diff --git a/cocos/platform/win32/CCApplication-win32.h b/cocos/platform/win32/CCApplication-win32.h index 71013eca9e..84b858c706 100644 --- a/cocos/platform/win32/CCApplication-win32.h +++ b/cocos/platform/win32/CCApplication-win32.h @@ -75,6 +75,11 @@ public: */ virtual Platform getTargetPlatform(); + /** + @brief Get application version + */ + virtual std::string getVersion() override; + /** @brief Open url in default browser @param String with url to open. diff --git a/cocos/platform/win32/CCFileUtils-win32.cpp b/cocos/platform/win32/CCFileUtils-win32.cpp index ea3f9e6f12..c4c376ded1 100644 --- a/cocos/platform/win32/CCFileUtils-win32.cpp +++ b/cocos/platform/win32/CCFileUtils-win32.cpp @@ -136,8 +136,9 @@ static void _checkPath() { if (s_resourcePath.empty()) { - WCHAR *pUtf16ExePath = nullptr; - _get_wpgmptr(&pUtf16ExePath); + WCHAR utf16Path[CC_MAX_PATH] = { 0 }; + GetModuleFileNameW(NULL, utf16Path, CC_MAX_PATH - 1); + WCHAR *pUtf16ExePath = &(utf16Path[0]); // We need only directory part without exe WCHAR *pUtf16DirEnd = wcsrchr(pUtf16ExePath, L'\\'); diff --git a/cocos/platform/winrt/CCApplication.cpp b/cocos/platform/winrt/CCApplication.cpp index 374445a554..65a583994a 100644 --- a/cocos/platform/winrt/CCApplication.cpp +++ b/cocos/platform/winrt/CCApplication.cpp @@ -36,6 +36,7 @@ using namespace Windows::Foundation; #include "platform/CCFileUtils.h" #include "CCWinRTUtils.h" #include "platform/CCApplication.h" +#include "tinyxml2/tinyxml2.h" /** @brief This function change the PVRFrame show/hide setting in register. @@ -225,6 +226,25 @@ Application::Platform Application::getTargetPlatform() } } +std::string Application::getVersion() +{ + std::string r(""); + std::string s = FileUtils::getInstance()->getStringFromFile("WMAppManifest.xml"); + if (!s.empty()) { + tinyxml2::XMLDocument doc; + if (!doc.Parse(s.c_str())) { + tinyxml2::XMLElement *app = doc.RootElement()->FirstChildElement("App"); + if (app) { + const char* version = app->Attribute("Version"); + if (version) { + r = version; + } + } + } + } + return r; +} + bool Application::openURL(const std::string &url) { #if CC_TARGET_PLATFORM == CC_PLATFORM_WINRT diff --git a/cocos/platform/winrt/CCApplication.h b/cocos/platform/winrt/CCApplication.h index 453aa196fa..f2e9856ecb 100644 --- a/cocos/platform/winrt/CCApplication.h +++ b/cocos/platform/winrt/CCApplication.h @@ -63,6 +63,11 @@ public: @brief Get target platform */ virtual Platform getTargetPlatform() override; + + /** + @brief Get application version + */ + virtual std::string getVersion() override; /** @brief Open url in default browser diff --git a/cocos/renderer/CCFrameBuffer.cpp b/cocos/renderer/CCFrameBuffer.cpp index 7d679261bd..fbff5ed432 100644 --- a/cocos/renderer/CCFrameBuffer.cpp +++ b/cocos/renderer/CCFrameBuffer.cpp @@ -397,7 +397,6 @@ FrameBuffer::FrameBuffer() FrameBuffer::~FrameBuffer() { - if(!isDefaultFBO()) { CC_SAFE_RELEASE_NULL(_rt); CC_SAFE_RELEASE_NULL(_rtDepthStencil); @@ -407,6 +406,8 @@ FrameBuffer::~FrameBuffer() #if CC_ENABLE_CACHE_TEXTURE_DATA Director::getInstance()->getEventDispatcher()->removeEventListener(_dirtyFBOListener); #endif + if (isDefaultFBO()) + _defaultFBO = nullptr; } } diff --git a/cocos/renderer/CCRenderer.cpp b/cocos/renderer/CCRenderer.cpp index acda214a5a..50f27d1dbb 100644 --- a/cocos/renderer/CCRenderer.cpp +++ b/cocos/renderer/CCRenderer.cpp @@ -557,6 +557,9 @@ void Renderer::visitRenderQueue(RenderQueue& queue) RenderState::StateBlock::_defaultState->setDepthWrite(false); RenderState::StateBlock::_defaultState->setBlend(true); } + glDisable(GL_CULL_FACE); + RenderState::StateBlock::_defaultState->setCullFace(false); + for (auto it = zNegQueue.cbegin(); it != zNegQueue.cend(); ++it) { processRenderCommand(*it); @@ -574,9 +577,11 @@ void Renderer::visitRenderQueue(RenderQueue& queue) glEnable(GL_DEPTH_TEST); glDepthMask(true); glDisable(GL_BLEND); + glEnable(GL_CULL_FACE); RenderState::StateBlock::_defaultState->setDepthTest(true); RenderState::StateBlock::_defaultState->setDepthWrite(true); RenderState::StateBlock::_defaultState->setBlend(false); + RenderState::StateBlock::_defaultState->setCullFace(true); for (auto it = opaqueQueue.cbegin(); it != opaqueQueue.cend(); ++it) @@ -595,10 +600,12 @@ void Renderer::visitRenderQueue(RenderQueue& queue) glEnable(GL_DEPTH_TEST); glDepthMask(false); glEnable(GL_BLEND); + glEnable(GL_CULL_FACE); RenderState::StateBlock::_defaultState->setDepthTest(true); RenderState::StateBlock::_defaultState->setDepthWrite(false); RenderState::StateBlock::_defaultState->setBlend(true); + RenderState::StateBlock::_defaultState->setCullFace(true); for (auto it = transQueue.cbegin(); it != transQueue.cend(); ++it) @@ -636,6 +643,9 @@ void Renderer::visitRenderQueue(RenderQueue& queue) RenderState::StateBlock::_defaultState->setBlend(true); } + glDisable(GL_CULL_FACE); + RenderState::StateBlock::_defaultState->setCullFace(false); + for (auto it = zZeroQueue.cbegin(); it != zZeroQueue.cend(); ++it) { processRenderCommand(*it); @@ -671,6 +681,8 @@ void Renderer::visitRenderQueue(RenderQueue& queue) RenderState::StateBlock::_defaultState->setBlend(true); } + glDisable(GL_CULL_FACE); + RenderState::StateBlock::_defaultState->setCullFace(false); for (auto it = zPosQueue.cbegin(); it != zPosQueue.cend(); ++it) { diff --git a/cocos/renderer/CCTexture2D.cpp b/cocos/renderer/CCTexture2D.cpp index a67d44d38c..e2ef8610e3 100644 --- a/cocos/renderer/CCTexture2D.cpp +++ b/cocos/renderer/CCTexture2D.cpp @@ -756,6 +756,9 @@ bool Texture2D::initWithImage(Image *image, PixelFormat format) initWithMipmaps(image->getMipmaps(), image->getNumberOfMipmaps(), image->getRenderFormat(), imageWidth, imageHeight); + // set the premultiplied tag + _hasPremultipliedAlpha = image->hasPremultipliedAlpha(); + return true; } else if (image->isCompressed()) @@ -766,6 +769,10 @@ bool Texture2D::initWithImage(Image *image, PixelFormat format) } initWithData(tempData, tempDataLen, image->getRenderFormat(), imageWidth, imageHeight, imageSize); + + // set the premultiplied tag + _hasPremultipliedAlpha = image->hasPremultipliedAlpha(); + return true; } else diff --git a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_3d_auto_api.js b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_3d_auto_api.js index 92337a2a8f..5a78dd38db 100644 --- a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_3d_auto_api.js +++ b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_3d_auto_api.js @@ -1329,11 +1329,11 @@ jsb.Terrain = { /** * @method initHeightMap - * @param {char} arg0 + * @param {String} arg0 * @return {bool} */ initHeightMap : function ( -char +str ) { return false; @@ -1373,10 +1373,10 @@ map /** * @method resetHeightMap - * @param {char} arg0 + * @param {String} arg0 */ resetHeightMap : function ( -char +str ) { }, diff --git a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_3d_extension_auto_api.js b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_3d_extension_auto_api.js index 2a5567ec3b..a8e7c2e3d9 100644 --- a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_3d_extension_auto_api.js +++ b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_3d_extension_auto_api.js @@ -474,6 +474,18 @@ removeAllListener : function ( { }, +/** + * @method initSystem + * @param {String} arg0 + * @return {bool} + */ +initSystem : function ( +str +) +{ + return false; +}, + /** * @method setDefaultDepth * @param {float} arg0 diff --git a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_auto_api.js b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_auto_api.js index 71ea0c5668..993733e0c6 100644 --- a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_auto_api.js +++ b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_auto_api.js @@ -20948,18 +20948,6 @@ char */ cc.Application = { -/** - * @method openURL - * @param {String} arg0 - * @return {bool} - */ -openURL : function ( -str -) -{ - return false; -}, - /** * @method getTargetPlatform * @return {cc.ApplicationProtocol::Platform} @@ -20980,6 +20968,28 @@ getCurrentLanguage : function ( return 0; }, +/** + * @method openURL + * @param {String} arg0 + * @return {bool} + */ +openURL : function ( +str +) +{ + return false; +}, + +/** + * @method getVersion + * @return {String} + */ +getVersion : function ( +) +{ + return ; +}, + /** * @method getInstance * @return {cc.Application} diff --git a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_ui_auto_api.js b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_ui_auto_api.js index 5e4e35e850..a1ac1bd1b4 100644 --- a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_ui_auto_api.js +++ b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_ui_auto_api.js @@ -692,16 +692,6 @@ isPropagateTouchEvents : function ( return false; }, -/** - * @method getCurrentFocusedWidget - * @return {ccui.Widget} - */ -getCurrentFocusedWidget : function ( -) -{ - return ccui.Widget; -}, - /** * @method hitTest * @param {vec2_object} arg0 @@ -928,6 +918,16 @@ bool { }, +/** + * @method getCurrentFocusedWidget + * @return {ccui.Widget} + */ +getCurrentFocusedWidget : function ( +) +{ + return ccui.Widget; +}, + /** * @method create * @return {ccui.Widget} @@ -1024,6 +1024,16 @@ getClippingType : function ( return 0; }, +/** + * @method getRenderFile + * @return {cc.ResouceData} + */ +getRenderFile : function ( +) +{ + return cc.ResouceData; +}, + /** * @method isLoopFocus * @return {bool} @@ -1348,6 +1358,14 @@ float { }, +/** + * @method resetPressedRender + */ +resetPressedRender : function ( +) +{ +}, + /** * @method setScale9Enabled * @param {bool} arg0 @@ -1358,6 +1376,14 @@ bool { }, +/** + * @method resetDisabledRender + */ +resetDisabledRender : function ( +) +{ +}, + /** * @method getTitleRenderer * @return {cc.Label} @@ -1378,6 +1404,16 @@ getRendererClicked : function ( return ccui.Scale9Sprite; }, +/** + * @method getDisabledFile + * @return {cc.ResouceData} + */ +getDisabledFile : function ( +) +{ + return cc.ResouceData; +}, + /** * @method getZoomScale * @return {float} @@ -1408,6 +1444,24 @@ color3b { }, +/** + * @method getNormalFile + * @return {cc.ResouceData} + */ +getNormalFile : function ( +) +{ + return cc.ResouceData; +}, + +/** + * @method resetNormalRender + */ +resetNormalRender : function ( +) +{ +}, + /** * @method getRendererDisabled * @return {ccui.Scale9Sprite} @@ -1590,6 +1644,16 @@ rect { }, +/** + * @method getPressedFile + * @return {cc.ResouceData} + */ +getPressedFile : function ( +) +{ + return cc.ResouceData; +}, + /** * @method getTitleFontSize * @return {float} @@ -1694,6 +1758,26 @@ Button : function ( */ ccui.AbstractCheckButton = { +/** + * @method getBackDisabledFile + * @return {cc.ResouceData} + */ +getBackDisabledFile : function ( +) +{ + return cc.ResouceData; +}, + +/** + * @method getCrossDisabeldFile + * @return {cc.ResouceData} + */ +getCrossDisabeldFile : function ( +) +{ + return cc.ResouceData; +}, + /** * @method loadTextureBackGroundSelected * @param {String} arg0 @@ -1718,6 +1802,16 @@ texturerestype { }, +/** + * @method getCrossNormalFile + * @return {cc.ResouceData} + */ +getCrossNormalFile : function ( +) +{ + return cc.ResouceData; +}, + /** * @method setSelected * @param {bool} arg0 @@ -1728,6 +1822,16 @@ bool { }, +/** + * @method getBackPressedFile + * @return {cc.ResouceData} + */ +getBackPressedFile : function ( +) +{ + return cc.ResouceData; +}, + /** * @method getRendererFrontCrossDisabled * @return {cc.Sprite} @@ -1802,6 +1906,16 @@ texturerestype return false; }, +/** + * @method getBackNormalFile + * @return {cc.ResouceData} + */ +getBackNormalFile : function ( +) +{ + return cc.ResouceData; +}, + /** * @method loadTextures * @param {String} arg0 @@ -2171,6 +2285,16 @@ rect { }, +/** + * @method getRenderFile + * @return {cc.ResouceData} + */ +getRenderFile : function ( +) +{ + return cc.ResouceData; +}, + /** * @method getCapInsets * @return {rect_object} @@ -2549,6 +2673,16 @@ str { }, +/** + * @method getRenderFile + * @return {cc.ResouceData} + */ +getRenderFile : function ( +) +{ + return cc.ResouceData; +}, + /** * @method setProperty * @param {String} arg0 @@ -2653,6 +2787,16 @@ direction { }, +/** + * @method getRenderFile + * @return {cc.ResouceData} + */ +getRenderFile : function ( +) +{ + return cc.ResouceData; +}, + /** * @method setScale9Enabled * @param {bool} arg0 @@ -3353,12 +3497,12 @@ getItemsMargin : function ( /** * @method jumpToItem - * @param {int} arg0 + * @param {long} arg0 * @param {vec2_object} arg1 * @param {vec2_object} arg2 */ jumpToItem : function ( -int, +long, vec2, vec2 ) @@ -3517,13 +3661,13 @@ long /** * @method scrollToItem -* @param {int|int} int +* @param {long|long} long * @param {vec2_object|vec2_object} vec2 * @param {vec2_object|vec2_object} vec2 * @param {float} float */ scrollToItem : function( -int, +long, vec2, vec2, float @@ -3645,16 +3789,6 @@ ListView : function ( */ ccui.Slider = { -/** - * @method setMaxPercent - * @param {int} arg0 - */ -setMaxPercent : function ( -int -) -{ -}, - /** * @method setPercent * @param {int} arg0 @@ -3665,18 +3799,6 @@ int { }, -/** - * @method loadSlidBallTextureDisabled - * @param {String} arg0 - * @param {ccui.Widget::TextureResType} arg1 - */ -loadSlidBallTextureDisabled : function ( -str, -texturerestype -) -{ -}, - /** * @method getMaxPercent * @return {int} @@ -3699,18 +3821,6 @@ texturerestype { }, -/** - * @method loadBarTexture - * @param {String} arg0 - * @param {ccui.Widget::TextureResType} arg1 - */ -loadBarTexture : function ( -str, -texturerestype -) -{ -}, - /** * @method loadProgressBarTexture * @param {String} arg0 @@ -3724,39 +3834,13 @@ texturerestype }, /** - * @method loadSlidBallTextures - * @param {String} arg0 - * @param {String} arg1 - * @param {String} arg2 - * @param {ccui.Widget::TextureResType} arg3 + * @method getBallNormalFile + * @return {cc.ResouceData} */ -loadSlidBallTextures : function ( -str, -str, -str, -texturerestype -) -{ -}, - -/** - * @method setCapInsetProgressBarRebderer - * @param {rect_object} arg0 - */ -setCapInsetProgressBarRebderer : function ( -rect -) -{ -}, - -/** - * @method setCapInsetsBarRenderer - * @param {rect_object} arg0 - */ -setCapInsetsBarRenderer : function ( -rect +getBallNormalFile : function ( ) { + return cc.ResouceData; }, /** @@ -3780,23 +3864,13 @@ bool }, /** - * @method setZoomScale - * @param {float} arg0 + * @method getBallPressedFile + * @return {cc.ResouceData} */ -setZoomScale : function ( -float -) -{ -}, - -/** - * @method setCapInsets - * @param {rect_object} arg0 - */ -setCapInsets : function ( -rect +getBallPressedFile : function ( ) { + return cc.ResouceData; }, /** @@ -3809,6 +3883,64 @@ getZoomScale : function ( return 0; }, +/** + * @method loadSlidBallTextures + * @param {String} arg0 + * @param {String} arg1 + * @param {String} arg2 + * @param {ccui.Widget::TextureResType} arg3 + */ +loadSlidBallTextures : function ( +str, +str, +str, +texturerestype +) +{ +}, + +/** + * @method setMaxPercent + * @param {int} arg0 + */ +setMaxPercent : function ( +int +) +{ +}, + +/** + * @method loadBarTexture + * @param {String} arg0 + * @param {ccui.Widget::TextureResType} arg1 + */ +loadBarTexture : function ( +str, +texturerestype +) +{ +}, + +/** + * @method getProgressBarFile + * @return {cc.ResouceData} + */ +getProgressBarFile : function ( +) +{ + return cc.ResouceData; +}, + +/** + * @method getCapInsetsBarRenderer + * @return {rect_object} + */ +getCapInsetsBarRenderer : function ( +) +{ + return cc.Rect; +}, + /** * @method loadSlidBallTexturePressed * @param {String} arg0 @@ -3821,6 +3953,16 @@ texturerestype { }, +/** + * @method getBackFile + * @return {cc.ResouceData} + */ +getBackFile : function ( +) +{ + return cc.ResouceData; +}, + /** * @method isScale9Enabled * @return {bool} @@ -3832,13 +3974,33 @@ isScale9Enabled : function ( }, /** - * @method getCapInsetsBarRenderer - * @return {rect_object} + * @method setCapInsetProgressBarRebderer + * @param {rect_object} arg0 */ -getCapInsetsBarRenderer : function ( +setCapInsetProgressBarRebderer : function ( +rect ) { - return cc.Rect; +}, + +/** + * @method setCapInsetsBarRenderer + * @param {rect_object} arg0 + */ +setCapInsetsBarRenderer : function ( +rect +) +{ +}, + +/** + * @method getBallDisabeldFile + * @return {cc.ResouceData} + */ +getBallDisabeldFile : function ( +) +{ + return cc.ResouceData; }, /** @@ -3851,6 +4013,38 @@ getPercent : function ( return 0; }, +/** + * @method setCapInsets + * @param {rect_object} arg0 + */ +setCapInsets : function ( +rect +) +{ +}, + +/** + * @method loadSlidBallTextureDisabled + * @param {String} arg0 + * @param {ccui.Widget::TextureResType} arg1 + */ +loadSlidBallTextureDisabled : function ( +str, +texturerestype +) +{ +}, + +/** + * @method setZoomScale + * @param {float} arg0 + */ +setZoomScale : function ( +float +) +{ +}, + /** * @method create * @param {String} str @@ -4625,16 +4819,6 @@ TextField : function ( */ ccui.TextBMFont = { -/** - * @method setFntFile - * @param {String} arg0 - */ -setFntFile : function ( -str -) -{ -}, - /** * @method getStringLength * @return {long} @@ -4645,6 +4829,16 @@ getStringLength : function ( return 0; }, +/** + * @method getString + * @return {String} + */ +getString : function ( +) +{ + return ; +}, + /** * @method setString * @param {String} arg0 @@ -4656,13 +4850,23 @@ str }, /** - * @method getString - * @return {String} + * @method getRenderFile + * @return {cc.ResouceData} */ -getString : function ( +getRenderFile : function ( +) +{ + return cc.ResouceData; +}, + +/** + * @method setFntFile + * @param {String} arg0 + */ +setFntFile : function ( +str ) { - return ; }, /** @@ -4706,121 +4910,117 @@ TextBMFont : function ( ccui.PageView = { /** - * @method getCustomScrollThreshold - * @return {float} - */ -getCustomScrollThreshold : function ( -) -{ - return 0; -}, - -/** - * @method getCurPageIndex - * @return {long} - */ -getCurPageIndex : function ( -) -{ - return 0; -}, - -/** - * @method setDirection - * @param {ccui.PageView::Direction} arg0 - */ -setDirection : function ( -direction -) -{ -}, - -/** - * @method addWidgetToPage - * @param {ccui.Widget} arg0 - * @param {long} arg1 - * @param {bool} arg2 - */ -addWidgetToPage : function ( -widget, -long, -bool -) -{ -}, - -/** - * @method isUsingCustomScrollThreshold - * @return {bool} - */ -isUsingCustomScrollThreshold : function ( -) -{ - return false; -}, - -/** - * @method setCurPageIndex - * @param {long} arg0 - */ -setCurPageIndex : function ( -long -) -{ -}, - -/** - * @method removePage - * @param {ccui.Layout} arg0 - */ -removePage : function ( -layout -) -{ -}, - -/** - * @method setUsingCustomScrollThreshold - * @param {bool} arg0 - */ -setUsingCustomScrollThreshold : function ( -bool -) -{ -}, - -/** - * @method setCustomScrollThreshold + * @method setIndicatorSpaceBetweenIndexNodes * @param {float} arg0 */ -setCustomScrollThreshold : function ( +setIndicatorSpaceBetweenIndexNodes : function ( float ) { }, +/** + * @method setIndicatorSelectedIndexColor + * @param {color3b_object} arg0 + */ +setIndicatorSelectedIndexColor : function ( +color3b +) +{ +}, + +/** + * @method getIndicatorSelectedIndexColor + * @return {color3b_object} + */ +getIndicatorSelectedIndexColor : function ( +) +{ + return cc.Color3B; +}, + +/** + * @method getIndicatorPositionAsAnchorPoint + * @return {vec2_object} + */ +getIndicatorPositionAsAnchorPoint : function ( +) +{ + return cc.Vec2; +}, + +/** + * @method setIndicatorPosition + * @param {vec2_object} arg0 + */ +setIndicatorPosition : function ( +vec2 +) +{ +}, + +/** + * @method getIndicatorPosition + * @return {vec2_object} + */ +getIndicatorPosition : function ( +) +{ + return cc.Vec2; +}, + /** * @method insertPage - * @param {ccui.Layout} arg0 + * @param {ccui.Widget} arg0 * @param {int} arg1 */ insertPage : function ( -layout, +widget, int ) { }, /** - * @method getDirection - * @return {ccui.PageView::Direction} + * @method getCurrentPageIndex + * @return {long} */ -getDirection : function ( +getCurrentPageIndex : function ( ) { return 0; }, +/** + * @method removePage + * @param {ccui.Widget} arg0 + */ +removePage : function ( +widget +) +{ +}, + +/** + * @method setCurrentPageIndex + * @param {long} arg0 + */ +setCurrentPageIndex : function ( +long +) +{ +}, + +/** + * @method getIndicatorEnabled + * @return {bool} + */ +getIndicatorEnabled : function ( +) +{ + return false; +}, + /** * @method scrollToPage * @param {long} arg0 @@ -4832,35 +5032,53 @@ long }, /** - * @method getPage - * @param {long} arg0 - * @return {ccui.Layout} + * @method setIndicatorPositionAsAnchorPoint + * @param {vec2_object} arg0 */ -getPage : function ( -long +setIndicatorPositionAsAnchorPoint : function ( +vec2 ) { - return ccui.Layout; }, /** - * @method removePageAtIndex + * @method scrollToItem * @param {long} arg0 */ -removePageAtIndex : function ( +scrollToItem : function ( long ) { }, /** - * @method getPages - * @return {Array} + * @method setIndicatorEnabled + * @param {bool} arg0 */ -getPages : function ( +setIndicatorEnabled : function ( +bool ) { - return new Array(); +}, + +/** + * @method addPage + * @param {ccui.Widget} arg0 + */ +addPage : function ( +widget +) +{ +}, + +/** + * @method getIndicatorSpaceBetweenIndexNodes + * @return {float} + */ +getIndicatorSpaceBetweenIndexNodes : function ( +) +{ + return 0; }, /** @@ -4872,11 +5090,11 @@ removeAllPages : function ( }, /** - * @method addPage - * @param {ccui.Layout} arg0 + * @method removePageAtIndex + * @param {long} arg0 */ -addPage : function ( -layout +removePageAtIndex : function ( +long ) { }, @@ -5574,6 +5792,16 @@ float { }, +/** + * @method setRenderingType + * @param {ccui.Scale9Sprite::RenderingType} arg0 + */ +setRenderingType : function ( +renderingtype +) +{ +}, + /** * @method init * @param {cc.Sprite|cc.Sprite|cc.Sprite} sprite @@ -5658,6 +5886,24 @@ isScale9Enabled : function ( return false; }, +/** + * @method resetRender + */ +resetRender : function ( +) +{ +}, + +/** + * @method getRenderingType + * @return {ccui.Scale9Sprite::RenderingType} + */ +getRenderingType : function ( +) +{ + return 0; +}, + /** * @method getInsetRight * @return {float} diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_auto.cpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_auto.cpp index ec78c50728..f5e50cb934 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_auto.cpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_auto.cpp @@ -3823,8 +3823,8 @@ bool js_cocos2dx_3d_Terrain_initHeightMap(JSContext *cx, uint32_t argc, jsval *v cocos2d::Terrain* cobj = (cocos2d::Terrain *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Terrain_initHeightMap : Invalid Native Object"); if (argc == 1) { - const char* arg0 = nullptr; - std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); + std::string arg0; + ok &= jsval_to_std_string(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Terrain_initHeightMap : Error processing arguments"); bool ret = cobj->initHeightMap(arg0); jsval jsret = JSVAL_NULL; @@ -3908,8 +3908,8 @@ bool js_cocos2dx_3d_Terrain_resetHeightMap(JSContext *cx, uint32_t argc, jsval * cocos2d::Terrain* cobj = (cocos2d::Terrain *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Terrain_resetHeightMap : Invalid Native Object"); if (argc == 1) { - const char* arg0 = nullptr; - std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str(); + std::string arg0; + ok &= jsval_to_std_string(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Terrain_resetHeightMap : Error processing arguments"); cobj->resetHeightMap(arg0); args.rval().setUndefined(); diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_extension_auto.cpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_extension_auto.cpp index fe3e492a08..d87d9dc80b 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_extension_auto.cpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_extension_auto.cpp @@ -1020,6 +1020,28 @@ bool js_cocos2dx_3d_extension_PUParticleSystem3D_removeAllListener(JSContext *cx JS_ReportError(cx, "js_cocos2dx_3d_extension_PUParticleSystem3D_removeAllListener : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } +bool js_cocos2dx_3d_extension_PUParticleSystem3D_initSystem(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_initSystem : Invalid Native Object"); + if (argc == 1) { + std::string arg0; + ok &= jsval_to_std_string(cx, args.get(0), &arg0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_initSystem : Error processing arguments"); + bool ret = cobj->initSystem(arg0); + jsval jsret = JSVAL_NULL; + jsret = BOOLEAN_TO_JSVAL(ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_3d_extension_PUParticleSystem3D_initSystem : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} bool js_cocos2dx_3d_extension_PUParticleSystem3D_setDefaultDepth(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -1191,6 +1213,7 @@ void js_register_cocos2dx_3d_extension_PUParticleSystem3D(JSContext *cx, JS::Han JS_FN("getDerivedScale", js_cocos2dx_3d_extension_PUParticleSystem3D_getDerivedScale, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setDefaultHeight", js_cocos2dx_3d_extension_PUParticleSystem3D_setDefaultHeight, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("removeAllListener", js_cocos2dx_3d_extension_PUParticleSystem3D_removeAllListener, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("initSystem", js_cocos2dx_3d_extension_PUParticleSystem3D_initSystem, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setDefaultDepth", js_cocos2dx_3d_extension_PUParticleSystem3D_setDefaultDepth, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_extension_auto.hpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_extension_auto.hpp index e71c2a6f30..a10e2073e3 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_extension_auto.hpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_extension_auto.hpp @@ -67,6 +67,7 @@ bool js_cocos2dx_3d_extension_PUParticleSystem3D_setParticleSystemScaleVelocity( bool js_cocos2dx_3d_extension_PUParticleSystem3D_getDerivedScale(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_3d_extension_PUParticleSystem3D_setDefaultHeight(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_3d_extension_PUParticleSystem3D_removeAllListener(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_3d_extension_PUParticleSystem3D_initSystem(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_3d_extension_PUParticleSystem3D_setDefaultDepth(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_3d_extension_PUParticleSystem3D_create(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_3d_extension_PUParticleSystem3D_PUParticleSystem3D(JSContext *cx, uint32_t argc, jsval *vp); diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp index 6f89ef7989..5b6c247352 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp @@ -65525,28 +65525,6 @@ void js_register_cocos2dx_SAXParser(JSContext *cx, JS::HandleObject global) { JSClass *jsb_cocos2d_Application_class; JSObject *jsb_cocos2d_Application_prototype; -bool js_cocos2dx_Application_openURL(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::Application* cobj = (cocos2d::Application *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Application_openURL : Invalid Native Object"); - if (argc == 1) { - std::string arg0; - ok &= jsval_to_std_string(cx, args.get(0), &arg0); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Application_openURL : Error processing arguments"); - bool ret = cobj->openURL(arg0); - jsval jsret = JSVAL_NULL; - jsret = BOOLEAN_TO_JSVAL(ret); - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_Application_openURL : wrong number of arguments: %d, was expecting %d", argc, 1); - return false; -} bool js_cocos2dx_Application_getTargetPlatform(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -65583,6 +65561,46 @@ bool js_cocos2dx_Application_getCurrentLanguage(JSContext *cx, uint32_t argc, js JS_ReportError(cx, "js_cocos2dx_Application_getCurrentLanguage : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } +bool js_cocos2dx_Application_openURL(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::Application* cobj = (cocos2d::Application *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Application_openURL : Invalid Native Object"); + if (argc == 1) { + std::string arg0; + ok &= jsval_to_std_string(cx, args.get(0), &arg0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Application_openURL : Error processing arguments"); + bool ret = cobj->openURL(arg0); + jsval jsret = JSVAL_NULL; + jsret = BOOLEAN_TO_JSVAL(ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_Application_openURL : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} +bool js_cocos2dx_Application_getVersion(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::Application* cobj = (cocos2d::Application *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Application_getVersion : Invalid Native Object"); + if (argc == 0) { + std::string ret = cobj->getVersion(); + jsval jsret = JSVAL_NULL; + jsret = std_string_to_jsval(cx, ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_Application_getVersion : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_Application_getInstance(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -65627,9 +65645,10 @@ void js_register_cocos2dx_Application(JSContext *cx, JS::HandleObject global) { }; static JSFunctionSpec funcs[] = { - JS_FN("openURL", js_cocos2dx_Application_openURL, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getTargetPlatform", js_cocos2dx_Application_getTargetPlatform, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getCurrentLanguage", js_cocos2dx_Application_getCurrentLanguage, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("openURL", js_cocos2dx_Application_openURL, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getVersion", js_cocos2dx_Application_getVersion, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp index 8ee7d60804..5cb07c92a4 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp @@ -3763,9 +3763,10 @@ bool js_cocos2dx_Application_constructor(JSContext *cx, uint32_t argc, jsval *vp void js_cocos2dx_Application_finalize(JSContext *cx, JSObject *obj); void js_register_cocos2dx_Application(JSContext *cx, JS::HandleObject global); void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj); -bool js_cocos2dx_Application_openURL(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Application_getTargetPlatform(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Application_getCurrentLanguage(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_Application_openURL(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_Application_getVersion(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Application_getInstance(JSContext *cx, uint32_t argc, jsval *vp); extern JSClass *jsb_cocos2d_AnimationCache_class; diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.cpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.cpp index 74538c2334..be7803f52b 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.cpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.cpp @@ -1642,31 +1642,6 @@ bool js_cocos2dx_ui_Widget_isPropagateTouchEvents(JSContext *cx, uint32_t argc, JS_ReportError(cx, "js_cocos2dx_ui_Widget_isPropagateTouchEvents : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } -bool js_cocos2dx_ui_Widget_getCurrentFocusedWidget(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::ui::Widget* cobj = (cocos2d::ui::Widget *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Widget_getCurrentFocusedWidget : Invalid Native Object"); - if (argc == 0) { - cocos2d::ui::Widget* ret = cobj->getCurrentFocusedWidget(); - jsval jsret = JSVAL_NULL; - do { - if (ret) { - js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::ui::Widget*)ret); - jsret = OBJECT_TO_JSVAL(jsProxy->obj); - } else { - jsret = JSVAL_NULL; - } - } while (0); - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_ui_Widget_getCurrentFocusedWidget : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} bool js_cocos2dx_ui_Widget_hitTest(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -2184,6 +2159,27 @@ bool js_cocos2dx_ui_Widget_enableDpadNavigation(JSContext *cx, uint32_t argc, js return false; } +bool js_cocos2dx_ui_Widget_getCurrentFocusedWidget(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + if (argc == 0) { + cocos2d::ui::Widget* ret = cocos2d::ui::Widget::getCurrentFocusedWidget(); + jsval jsret = JSVAL_NULL; + do { + if (ret) { + js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::ui::Widget*)ret); + jsret = OBJECT_TO_JSVAL(jsProxy->obj); + } else { + jsret = JSVAL_NULL; + } + } while (0); + args.rval().set(jsret); + return true; + } + JS_ReportError(cx, "js_cocos2dx_ui_Widget_getCurrentFocusedWidget : wrong number of arguments"); + return false; +} + bool js_cocos2dx_ui_Widget_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -2321,7 +2317,6 @@ void js_register_cocos2dx_ui_Widget(JSContext *cx, JS::HandleObject global) { JS_FN("dispatchFocusEvent", js_cocos2dx_ui_Widget_dispatchFocusEvent, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setUnifySizeEnabled", js_cocos2dx_ui_Widget_setUnifySizeEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("isPropagateTouchEvents", js_cocos2dx_ui_Widget_isPropagateTouchEvents, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("getCurrentFocusedWidget", js_cocos2dx_ui_Widget_getCurrentFocusedWidget, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("hitTest", js_cocos2dx_ui_Widget_hitTest, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("isLayoutComponentEnabled", js_cocos2dx_ui_Widget_isLayoutComponentEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("requestFocus", js_cocos2dx_ui_Widget_requestFocus, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -2348,6 +2343,7 @@ void js_register_cocos2dx_ui_Widget(JSContext *cx, JS::HandleObject global) { static JSFunctionSpec st_funcs[] = { JS_FN("enableDpadNavigation", js_cocos2dx_ui_Widget_enableDpadNavigation, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getCurrentFocusedWidget", js_cocos2dx_ui_Widget_getCurrentFocusedWidget, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("create", js_cocos2dx_ui_Widget_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -2520,6 +2516,24 @@ bool js_cocos2dx_ui_Layout_getClippingType(JSContext *cx, uint32_t argc, jsval * JS_ReportError(cx, "js_cocos2dx_ui_Layout_getClippingType : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } +bool js_cocos2dx_ui_Layout_getRenderFile(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::Layout* cobj = (cocos2d::ui::Layout *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Layout_getRenderFile : Invalid Native Object"); + if (argc == 0) { + cocos2d::ResouceData ret = cobj->getRenderFile(); + jsval jsret = JSVAL_NULL; + #pragma warning NO CONVERSION FROM NATIVE FOR ResouceData; + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_Layout_getRenderFile : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_ui_Layout_isLoopFocus(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -3146,6 +3160,7 @@ void js_register_cocos2dx_ui_Layout(JSContext *cx, JS::HandleObject global) { JS_FN("setBackGroundImageColor", js_cocos2dx_ui_Layout_setBackGroundImageColor, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getBackGroundColorVector", js_cocos2dx_ui_Layout_getBackGroundColorVector, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getClippingType", js_cocos2dx_ui_Layout_getClippingType, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getRenderFile", js_cocos2dx_ui_Layout_getRenderFile, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("isLoopFocus", js_cocos2dx_ui_Layout_isLoopFocus, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("removeBackGroundImage", js_cocos2dx_ui_Layout_removeBackGroundImage, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getBackGroundColorOpacity", js_cocos2dx_ui_Layout_getBackGroundColorOpacity, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -3270,6 +3285,22 @@ bool js_cocos2dx_ui_Button_setTitleFontSize(JSContext *cx, uint32_t argc, jsval JS_ReportError(cx, "js_cocos2dx_ui_Button_setTitleFontSize : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } +bool js_cocos2dx_ui_Button_resetPressedRender(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::Button* cobj = (cocos2d::ui::Button *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Button_resetPressedRender : Invalid Native Object"); + if (argc == 0) { + cobj->resetPressedRender(); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_Button_resetPressedRender : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_ui_Button_setScale9Enabled(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -3290,6 +3321,22 @@ bool js_cocos2dx_ui_Button_setScale9Enabled(JSContext *cx, uint32_t argc, jsval JS_ReportError(cx, "js_cocos2dx_ui_Button_setScale9Enabled : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } +bool js_cocos2dx_ui_Button_resetDisabledRender(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::Button* cobj = (cocos2d::ui::Button *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Button_resetDisabledRender : Invalid Native Object"); + if (argc == 0) { + cobj->resetDisabledRender(); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_Button_resetDisabledRender : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_ui_Button_getTitleRenderer(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -3340,6 +3387,24 @@ bool js_cocos2dx_ui_Button_getRendererClicked(JSContext *cx, uint32_t argc, jsva JS_ReportError(cx, "js_cocos2dx_ui_Button_getRendererClicked : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } +bool js_cocos2dx_ui_Button_getDisabledFile(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::Button* cobj = (cocos2d::ui::Button *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Button_getDisabledFile : Invalid Native Object"); + if (argc == 0) { + cocos2d::ResouceData ret = cobj->getDisabledFile(); + jsval jsret = JSVAL_NULL; + #pragma warning NO CONVERSION FROM NATIVE FOR ResouceData; + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_Button_getDisabledFile : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_ui_Button_getZoomScale(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -3396,6 +3461,40 @@ bool js_cocos2dx_ui_Button_setTitleColor(JSContext *cx, uint32_t argc, jsval *vp JS_ReportError(cx, "js_cocos2dx_ui_Button_setTitleColor : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } +bool js_cocos2dx_ui_Button_getNormalFile(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::Button* cobj = (cocos2d::ui::Button *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Button_getNormalFile : Invalid Native Object"); + if (argc == 0) { + cocos2d::ResouceData ret = cobj->getNormalFile(); + jsval jsret = JSVAL_NULL; + #pragma warning NO CONVERSION FROM NATIVE FOR ResouceData; + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_Button_getNormalFile : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_ui_Button_resetNormalRender(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::Button* cobj = (cocos2d::ui::Button *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Button_resetNormalRender : Invalid Native Object"); + if (argc == 0) { + cobj->resetNormalRender(); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_Button_resetNormalRender : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_ui_Button_getRendererDisabled(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -3836,6 +3935,24 @@ bool js_cocos2dx_ui_Button_setCapInsetsPressedRenderer(JSContext *cx, uint32_t a JS_ReportError(cx, "js_cocos2dx_ui_Button_setCapInsetsPressedRenderer : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } +bool js_cocos2dx_ui_Button_getPressedFile(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::Button* cobj = (cocos2d::ui::Button *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Button_getPressedFile : Invalid Native Object"); + if (argc == 0) { + cocos2d::ResouceData ret = cobj->getPressedFile(); + jsval jsret = JSVAL_NULL; + #pragma warning NO CONVERSION FROM NATIVE FOR ResouceData; + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_Button_getPressedFile : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_ui_Button_getTitleFontSize(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -4166,12 +4283,17 @@ void js_register_cocos2dx_ui_Button(JSContext *cx, JS::HandleObject global) { JS_FN("getNormalTextureSize", js_cocos2dx_ui_Button_getNormalTextureSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getTitleText", js_cocos2dx_ui_Button_getTitleText, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setTitleFontSize", js_cocos2dx_ui_Button_setTitleFontSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("resetPressedRender", js_cocos2dx_ui_Button_resetPressedRender, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setScale9Enabled", js_cocos2dx_ui_Button_setScale9Enabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("resetDisabledRender", js_cocos2dx_ui_Button_resetDisabledRender, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getTitleRenderer", js_cocos2dx_ui_Button_getTitleRenderer, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getRendererClicked", js_cocos2dx_ui_Button_getRendererClicked, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getDisabledFile", js_cocos2dx_ui_Button_getDisabledFile, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getZoomScale", js_cocos2dx_ui_Button_getZoomScale, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getCapInsetsDisabledRenderer", js_cocos2dx_ui_Button_getCapInsetsDisabledRenderer, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setTitleColor", js_cocos2dx_ui_Button_setTitleColor, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getNormalFile", js_cocos2dx_ui_Button_getNormalFile, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("resetNormalRender", js_cocos2dx_ui_Button_resetNormalRender, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getRendererDisabled", js_cocos2dx_ui_Button_getRendererDisabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setCapInsetsDisabledRenderer", js_cocos2dx_ui_Button_setCapInsetsDisabledRenderer, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setCapInsets", js_cocos2dx_ui_Button_setCapInsets, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -4188,6 +4310,7 @@ void js_register_cocos2dx_ui_Button(JSContext *cx, JS::HandleObject global) { JS_FN("isScale9Enabled", js_cocos2dx_ui_Button_isScale9Enabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("loadTextureNormal", js_cocos2dx_ui_Button_loadTextureNormal, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setCapInsetsPressedRenderer", js_cocos2dx_ui_Button_setCapInsetsPressedRenderer, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getPressedFile", js_cocos2dx_ui_Button_getPressedFile, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getTitleFontSize", js_cocos2dx_ui_Button_getTitleFontSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getRendererNormal", js_cocos2dx_ui_Button_getRendererNormal, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getTitleFontName", js_cocos2dx_ui_Button_getTitleFontName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -4236,6 +4359,42 @@ void js_register_cocos2dx_ui_Button(JSContext *cx, JS::HandleObject global) { JSClass *jsb_cocos2d_ui_AbstractCheckButton_class; JSObject *jsb_cocos2d_ui_AbstractCheckButton_prototype; +bool js_cocos2dx_ui_AbstractCheckButton_getBackDisabledFile(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::AbstractCheckButton* cobj = (cocos2d::ui::AbstractCheckButton *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_AbstractCheckButton_getBackDisabledFile : Invalid Native Object"); + if (argc == 0) { + cocos2d::ResouceData ret = cobj->getBackDisabledFile(); + jsval jsret = JSVAL_NULL; + #pragma warning NO CONVERSION FROM NATIVE FOR ResouceData; + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_AbstractCheckButton_getBackDisabledFile : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_ui_AbstractCheckButton_getCrossDisabeldFile(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::AbstractCheckButton* cobj = (cocos2d::ui::AbstractCheckButton *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_AbstractCheckButton_getCrossDisabeldFile : Invalid Native Object"); + if (argc == 0) { + cocos2d::ResouceData ret = cobj->getCrossDisabeldFile(); + jsval jsret = JSVAL_NULL; + #pragma warning NO CONVERSION FROM NATIVE FOR ResouceData; + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_AbstractCheckButton_getCrossDisabeldFile : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_ui_AbstractCheckButton_loadTextureBackGroundSelected(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -4296,6 +4455,24 @@ bool js_cocos2dx_ui_AbstractCheckButton_loadTextureBackGroundDisabled(JSContext JS_ReportError(cx, "js_cocos2dx_ui_AbstractCheckButton_loadTextureBackGroundDisabled : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } +bool js_cocos2dx_ui_AbstractCheckButton_getCrossNormalFile(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::AbstractCheckButton* cobj = (cocos2d::ui::AbstractCheckButton *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_AbstractCheckButton_getCrossNormalFile : Invalid Native Object"); + if (argc == 0) { + cocos2d::ResouceData ret = cobj->getCrossNormalFile(); + jsval jsret = JSVAL_NULL; + #pragma warning NO CONVERSION FROM NATIVE FOR ResouceData; + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_AbstractCheckButton_getCrossNormalFile : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_ui_AbstractCheckButton_setSelected(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -4316,6 +4493,24 @@ bool js_cocos2dx_ui_AbstractCheckButton_setSelected(JSContext *cx, uint32_t argc JS_ReportError(cx, "js_cocos2dx_ui_AbstractCheckButton_setSelected : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } +bool js_cocos2dx_ui_AbstractCheckButton_getBackPressedFile(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::AbstractCheckButton* cobj = (cocos2d::ui::AbstractCheckButton *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_AbstractCheckButton_getBackPressedFile : Invalid Native Object"); + if (argc == 0) { + cocos2d::ResouceData ret = cobj->getBackPressedFile(); + jsval jsret = JSVAL_NULL; + #pragma warning NO CONVERSION FROM NATIVE FOR ResouceData; + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_AbstractCheckButton_getBackPressedFile : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_ui_AbstractCheckButton_getRendererFrontCrossDisabled(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -4489,6 +4684,24 @@ bool js_cocos2dx_ui_AbstractCheckButton_init(JSContext *cx, uint32_t argc, jsval JS_ReportError(cx, "js_cocos2dx_ui_AbstractCheckButton_init : wrong number of arguments: %d, was expecting %d", argc, 5); return false; } +bool js_cocos2dx_ui_AbstractCheckButton_getBackNormalFile(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::AbstractCheckButton* cobj = (cocos2d::ui::AbstractCheckButton *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_AbstractCheckButton_getBackNormalFile : Invalid Native Object"); + if (argc == 0) { + cocos2d::ResouceData ret = cobj->getBackNormalFile(); + jsval jsret = JSVAL_NULL; + #pragma warning NO CONVERSION FROM NATIVE FOR ResouceData; + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_AbstractCheckButton_getBackNormalFile : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_ui_AbstractCheckButton_loadTextures(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -4708,15 +4921,20 @@ void js_register_cocos2dx_ui_AbstractCheckButton(JSContext *cx, JS::HandleObject }; static JSFunctionSpec funcs[] = { + JS_FN("getBackDisabledFile", js_cocos2dx_ui_AbstractCheckButton_getBackDisabledFile, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getCrossDisabeldFile", js_cocos2dx_ui_AbstractCheckButton_getCrossDisabeldFile, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("loadTextureBackGroundSelected", js_cocos2dx_ui_AbstractCheckButton_loadTextureBackGroundSelected, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("loadTextureBackGroundDisabled", js_cocos2dx_ui_AbstractCheckButton_loadTextureBackGroundDisabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getCrossNormalFile", js_cocos2dx_ui_AbstractCheckButton_getCrossNormalFile, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setSelected", js_cocos2dx_ui_AbstractCheckButton_setSelected, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getBackPressedFile", js_cocos2dx_ui_AbstractCheckButton_getBackPressedFile, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getRendererFrontCrossDisabled", js_cocos2dx_ui_AbstractCheckButton_getRendererFrontCrossDisabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getRendererBackground", js_cocos2dx_ui_AbstractCheckButton_getRendererBackground, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("loadTextureFrontCross", js_cocos2dx_ui_AbstractCheckButton_loadTextureFrontCross, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getRendererBackgroundDisabled", js_cocos2dx_ui_AbstractCheckButton_getRendererBackgroundDisabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("isSelected", js_cocos2dx_ui_AbstractCheckButton_isSelected, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("init", js_cocos2dx_ui_AbstractCheckButton_init, 5, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getBackNormalFile", js_cocos2dx_ui_AbstractCheckButton_getBackNormalFile, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("loadTextures", js_cocos2dx_ui_AbstractCheckButton_loadTextures, 5, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getZoomScale", js_cocos2dx_ui_AbstractCheckButton_getZoomScale, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getRendererFrontCross", js_cocos2dx_ui_AbstractCheckButton_getRendererFrontCross, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -5825,6 +6043,24 @@ bool js_cocos2dx_ui_ImageView_setCapInsets(JSContext *cx, uint32_t argc, jsval * JS_ReportError(cx, "js_cocos2dx_ui_ImageView_setCapInsets : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } +bool js_cocos2dx_ui_ImageView_getRenderFile(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::ImageView* cobj = (cocos2d::ui::ImageView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ImageView_getRenderFile : Invalid Native Object"); + if (argc == 0) { + cocos2d::ResouceData ret = cobj->getRenderFile(); + jsval jsret = JSVAL_NULL; + #pragma warning NO CONVERSION FROM NATIVE FOR ResouceData; + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_ImageView_getRenderFile : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_ui_ImageView_getCapInsets(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -6021,6 +6257,7 @@ void js_register_cocos2dx_ui_ImageView(JSContext *cx, JS::HandleObject global) { JS_FN("setScale9Enabled", js_cocos2dx_ui_ImageView_setScale9Enabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setTextureRect", js_cocos2dx_ui_ImageView_setTextureRect, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setCapInsets", js_cocos2dx_ui_ImageView_setCapInsets, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getRenderFile", js_cocos2dx_ui_ImageView_getRenderFile, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getCapInsets", js_cocos2dx_ui_ImageView_getCapInsets, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("isScale9Enabled", js_cocos2dx_ui_ImageView_isScale9Enabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("ctor", js_cocos2dx_ui_ImageView_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -6840,6 +7077,24 @@ bool js_cocos2dx_ui_TextAtlas_setString(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_ui_TextAtlas_setString : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } +bool js_cocos2dx_ui_TextAtlas_getRenderFile(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::TextAtlas* cobj = (cocos2d::ui::TextAtlas *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_TextAtlas_getRenderFile : Invalid Native Object"); + if (argc == 0) { + cocos2d::ResouceData ret = cobj->getRenderFile(); + jsval jsret = JSVAL_NULL; + #pragma warning NO CONVERSION FROM NATIVE FOR ResouceData; + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_TextAtlas_getRenderFile : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_ui_TextAtlas_setProperty(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -7032,6 +7287,7 @@ void js_register_cocos2dx_ui_TextAtlas(JSContext *cx, JS::HandleObject global) { JS_FN("getStringLength", js_cocos2dx_ui_TextAtlas_getStringLength, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getString", js_cocos2dx_ui_TextAtlas_getString, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setString", js_cocos2dx_ui_TextAtlas_setString, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getRenderFile", js_cocos2dx_ui_TextAtlas_getRenderFile, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setProperty", js_cocos2dx_ui_TextAtlas_setProperty, 5, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("adaptRenderers", js_cocos2dx_ui_TextAtlas_adaptRenderers, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("ctor", js_cocos2dx_ui_TextAtlas_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -7146,6 +7402,24 @@ bool js_cocos2dx_ui_LoadingBar_setDirection(JSContext *cx, uint32_t argc, jsval JS_ReportError(cx, "js_cocos2dx_ui_LoadingBar_setDirection : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } +bool js_cocos2dx_ui_LoadingBar_getRenderFile(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::LoadingBar* cobj = (cocos2d::ui::LoadingBar *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_LoadingBar_getRenderFile : Invalid Native Object"); + if (argc == 0) { + cocos2d::ResouceData ret = cobj->getRenderFile(); + jsval jsret = JSVAL_NULL; + #pragma warning NO CONVERSION FROM NATIVE FOR ResouceData; + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_LoadingBar_getRenderFile : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_ui_LoadingBar_setScale9Enabled(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -7464,6 +7738,7 @@ void js_register_cocos2dx_ui_LoadingBar(JSContext *cx, JS::HandleObject global) JS_FN("setPercent", js_cocos2dx_ui_LoadingBar_setPercent, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("loadTexture", js_cocos2dx_ui_LoadingBar_loadTexture, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setDirection", js_cocos2dx_ui_LoadingBar_setDirection, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getRenderFile", js_cocos2dx_ui_LoadingBar_getRenderFile, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setScale9Enabled", js_cocos2dx_ui_LoadingBar_setScale9Enabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setCapInsets", js_cocos2dx_ui_LoadingBar_setCapInsets, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getDirection", js_cocos2dx_ui_LoadingBar_getDirection, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -8795,10 +9070,10 @@ bool js_cocos2dx_ui_ListView_jumpToItem(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::ui::ListView* cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_jumpToItem : Invalid Native Object"); if (argc == 3) { - int arg0 = 0; + ssize_t arg0 = 0; cocos2d::Vec2 arg1; cocos2d::Vec2 arg2; - ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); + ok &= jsval_to_ssize(cx, args.get(0), &arg0); ok &= jsval_to_vector2(cx, args.get(1), &arg1); ok &= jsval_to_vector2(cx, args.get(2), &arg2); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_ListView_jumpToItem : Error processing arguments"); @@ -9153,8 +9428,8 @@ bool js_cocos2dx_ui_ListView_scrollToItem(JSContext *cx, uint32_t argc, jsval *v JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_scrollToItem : Invalid Native Object"); do { if (argc == 4) { - int arg0 = 0; - ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); + ssize_t arg0 = 0; + ok &= jsval_to_ssize(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } cocos2d::Vec2 arg1; ok &= jsval_to_vector2(cx, args.get(1), &arg1); @@ -9173,8 +9448,8 @@ bool js_cocos2dx_ui_ListView_scrollToItem(JSContext *cx, uint32_t argc, jsval *v do { if (argc == 3) { - int arg0 = 0; - ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); + ssize_t arg0 = 0; + ok &= jsval_to_ssize(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } cocos2d::Vec2 arg1; ok &= jsval_to_vector2(cx, args.get(1), &arg1); @@ -9551,26 +9826,6 @@ void js_register_cocos2dx_ui_ListView(JSContext *cx, JS::HandleObject global) { JSClass *jsb_cocos2d_ui_Slider_class; JSObject *jsb_cocos2d_ui_Slider_prototype; -bool js_cocos2dx_ui_Slider_setMaxPercent(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::ui::Slider* cobj = (cocos2d::ui::Slider *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_setMaxPercent : Invalid Native Object"); - if (argc == 1) { - int arg0 = 0; - ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_Slider_setMaxPercent : Error processing arguments"); - cobj->setMaxPercent(arg0); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_ui_Slider_setMaxPercent : wrong number of arguments: %d, was expecting %d", argc, 1); - return false; -} bool js_cocos2dx_ui_Slider_setPercent(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -9591,36 +9846,6 @@ bool js_cocos2dx_ui_Slider_setPercent(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_ui_Slider_setPercent : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } -bool js_cocos2dx_ui_Slider_loadSlidBallTextureDisabled(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::ui::Slider* cobj = (cocos2d::ui::Slider *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_loadSlidBallTextureDisabled : Invalid Native Object"); - if (argc == 1) { - std::string arg0; - ok &= jsval_to_std_string(cx, args.get(0), &arg0); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_Slider_loadSlidBallTextureDisabled : Error processing arguments"); - cobj->loadSlidBallTextureDisabled(arg0); - args.rval().setUndefined(); - return true; - } - if (argc == 2) { - std::string arg0; - cocos2d::ui::Widget::TextureResType arg1; - ok &= jsval_to_std_string(cx, args.get(0), &arg0); - ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_Slider_loadSlidBallTextureDisabled : Error processing arguments"); - cobj->loadSlidBallTextureDisabled(arg0, arg1); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_ui_Slider_loadSlidBallTextureDisabled : wrong number of arguments: %d, was expecting %d", argc, 1); - return false; -} bool js_cocos2dx_ui_Slider_getMaxPercent(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -9669,36 +9894,6 @@ bool js_cocos2dx_ui_Slider_loadSlidBallTextureNormal(JSContext *cx, uint32_t arg JS_ReportError(cx, "js_cocos2dx_ui_Slider_loadSlidBallTextureNormal : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } -bool js_cocos2dx_ui_Slider_loadBarTexture(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::ui::Slider* cobj = (cocos2d::ui::Slider *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_loadBarTexture : Invalid Native Object"); - if (argc == 1) { - std::string arg0; - ok &= jsval_to_std_string(cx, args.get(0), &arg0); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_Slider_loadBarTexture : Error processing arguments"); - cobj->loadBarTexture(arg0); - args.rval().setUndefined(); - return true; - } - if (argc == 2) { - std::string arg0; - cocos2d::ui::Widget::TextureResType arg1; - ok &= jsval_to_std_string(cx, args.get(0), &arg0); - ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_Slider_loadBarTexture : Error processing arguments"); - cobj->loadBarTexture(arg0, arg1); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_ui_Slider_loadBarTexture : wrong number of arguments: %d, was expecting %d", argc, 1); - return false; -} bool js_cocos2dx_ui_Slider_loadProgressBarTexture(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -9729,6 +9924,98 @@ bool js_cocos2dx_ui_Slider_loadProgressBarTexture(JSContext *cx, uint32_t argc, JS_ReportError(cx, "js_cocos2dx_ui_Slider_loadProgressBarTexture : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } +bool js_cocos2dx_ui_Slider_getBallNormalFile(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::Slider* cobj = (cocos2d::ui::Slider *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_getBallNormalFile : Invalid Native Object"); + if (argc == 0) { + cocos2d::ResouceData ret = cobj->getBallNormalFile(); + jsval jsret = JSVAL_NULL; + #pragma warning NO CONVERSION FROM NATIVE FOR ResouceData; + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_Slider_getBallNormalFile : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::Slider* cobj = (cocos2d::ui::Slider *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer : Invalid Native Object"); + if (argc == 0) { + const cocos2d::Rect& ret = cobj->getCapInsetsProgressBarRebderer(); + jsval jsret = JSVAL_NULL; + jsret = ccrect_to_jsval(cx, ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_ui_Slider_setScale9Enabled(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::Slider* cobj = (cocos2d::ui::Slider *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_setScale9Enabled : Invalid Native Object"); + if (argc == 1) { + bool arg0; + arg0 = JS::ToBoolean(args.get(0)); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_Slider_setScale9Enabled : Error processing arguments"); + cobj->setScale9Enabled(arg0); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_Slider_setScale9Enabled : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} +bool js_cocos2dx_ui_Slider_getBallPressedFile(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::Slider* cobj = (cocos2d::ui::Slider *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_getBallPressedFile : Invalid Native Object"); + if (argc == 0) { + cocos2d::ResouceData ret = cobj->getBallPressedFile(); + jsval jsret = JSVAL_NULL; + #pragma warning NO CONVERSION FROM NATIVE FOR ResouceData; + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_Slider_getBallPressedFile : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_ui_Slider_getZoomScale(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::Slider* cobj = (cocos2d::ui::Slider *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_getZoomScale : Invalid Native Object"); + if (argc == 0) { + double ret = cobj->getZoomScale(); + jsval jsret = JSVAL_NULL; + jsret = DOUBLE_TO_JSVAL(ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_Slider_getZoomScale : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_ui_Slider_loadSlidBallTextures(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -9785,6 +10072,158 @@ bool js_cocos2dx_ui_Slider_loadSlidBallTextures(JSContext *cx, uint32_t argc, js JS_ReportError(cx, "js_cocos2dx_ui_Slider_loadSlidBallTextures : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } +bool js_cocos2dx_ui_Slider_setMaxPercent(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::Slider* cobj = (cocos2d::ui::Slider *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_setMaxPercent : Invalid Native Object"); + if (argc == 1) { + int arg0 = 0; + ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_Slider_setMaxPercent : Error processing arguments"); + cobj->setMaxPercent(arg0); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_Slider_setMaxPercent : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} +bool js_cocos2dx_ui_Slider_loadBarTexture(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::Slider* cobj = (cocos2d::ui::Slider *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_loadBarTexture : Invalid Native Object"); + if (argc == 1) { + std::string arg0; + ok &= jsval_to_std_string(cx, args.get(0), &arg0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_Slider_loadBarTexture : Error processing arguments"); + cobj->loadBarTexture(arg0); + args.rval().setUndefined(); + return true; + } + if (argc == 2) { + std::string arg0; + cocos2d::ui::Widget::TextureResType arg1; + ok &= jsval_to_std_string(cx, args.get(0), &arg0); + ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_Slider_loadBarTexture : Error processing arguments"); + cobj->loadBarTexture(arg0, arg1); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_Slider_loadBarTexture : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} +bool js_cocos2dx_ui_Slider_getProgressBarFile(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::Slider* cobj = (cocos2d::ui::Slider *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_getProgressBarFile : Invalid Native Object"); + if (argc == 0) { + cocos2d::ResouceData ret = cobj->getProgressBarFile(); + jsval jsret = JSVAL_NULL; + #pragma warning NO CONVERSION FROM NATIVE FOR ResouceData; + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_Slider_getProgressBarFile : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_ui_Slider_getCapInsetsBarRenderer(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::Slider* cobj = (cocos2d::ui::Slider *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_getCapInsetsBarRenderer : Invalid Native Object"); + if (argc == 0) { + const cocos2d::Rect& ret = cobj->getCapInsetsBarRenderer(); + jsval jsret = JSVAL_NULL; + jsret = ccrect_to_jsval(cx, ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_Slider_getCapInsetsBarRenderer : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_ui_Slider_loadSlidBallTexturePressed(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::Slider* cobj = (cocos2d::ui::Slider *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_loadSlidBallTexturePressed : Invalid Native Object"); + if (argc == 1) { + std::string arg0; + ok &= jsval_to_std_string(cx, args.get(0), &arg0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_Slider_loadSlidBallTexturePressed : Error processing arguments"); + cobj->loadSlidBallTexturePressed(arg0); + args.rval().setUndefined(); + return true; + } + if (argc == 2) { + std::string arg0; + cocos2d::ui::Widget::TextureResType arg1; + ok &= jsval_to_std_string(cx, args.get(0), &arg0); + ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_Slider_loadSlidBallTexturePressed : Error processing arguments"); + cobj->loadSlidBallTexturePressed(arg0, arg1); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_Slider_loadSlidBallTexturePressed : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} +bool js_cocos2dx_ui_Slider_getBackFile(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::Slider* cobj = (cocos2d::ui::Slider *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_getBackFile : Invalid Native Object"); + if (argc == 0) { + cocos2d::ResouceData ret = cobj->getBackFile(); + jsval jsret = JSVAL_NULL; + #pragma warning NO CONVERSION FROM NATIVE FOR ResouceData; + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_Slider_getBackFile : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_ui_Slider_isScale9Enabled(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::Slider* cobj = (cocos2d::ui::Slider *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_isScale9Enabled : Invalid Native Object"); + if (argc == 0) { + bool ret = cobj->isScale9Enabled(); + jsval jsret = JSVAL_NULL; + jsret = BOOLEAN_TO_JSVAL(ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_Slider_isScale9Enabled : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_ui_Slider_setCapInsetProgressBarRebderer(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -9825,62 +10264,40 @@ bool js_cocos2dx_ui_Slider_setCapInsetsBarRenderer(JSContext *cx, uint32_t argc, JS_ReportError(cx, "js_cocos2dx_ui_Slider_setCapInsetsBarRenderer : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } -bool js_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer(JSContext *cx, uint32_t argc, jsval *vp) +bool js_cocos2dx_ui_Slider_getBallDisabeldFile(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); js_proxy_t *proxy = jsb_get_js_proxy(obj); cocos2d::ui::Slider* cobj = (cocos2d::ui::Slider *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer : Invalid Native Object"); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_getBallDisabeldFile : Invalid Native Object"); if (argc == 0) { - const cocos2d::Rect& ret = cobj->getCapInsetsProgressBarRebderer(); + cocos2d::ResouceData ret = cobj->getBallDisabeldFile(); jsval jsret = JSVAL_NULL; - jsret = ccrect_to_jsval(cx, ret); + #pragma warning NO CONVERSION FROM NATIVE FOR ResouceData; args.rval().set(jsret); return true; } - JS_ReportError(cx, "js_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer : wrong number of arguments: %d, was expecting %d", argc, 0); + JS_ReportError(cx, "js_cocos2dx_ui_Slider_getBallDisabeldFile : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } -bool js_cocos2dx_ui_Slider_setScale9Enabled(JSContext *cx, uint32_t argc, jsval *vp) +bool js_cocos2dx_ui_Slider_getPercent(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); js_proxy_t *proxy = jsb_get_js_proxy(obj); cocos2d::ui::Slider* cobj = (cocos2d::ui::Slider *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_setScale9Enabled : Invalid Native Object"); - if (argc == 1) { - bool arg0; - arg0 = JS::ToBoolean(args.get(0)); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_Slider_setScale9Enabled : Error processing arguments"); - cobj->setScale9Enabled(arg0); - args.rval().setUndefined(); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_getPercent : Invalid Native Object"); + if (argc == 0) { + int ret = cobj->getPercent(); + jsval jsret = JSVAL_NULL; + jsret = int32_to_jsval(cx, ret); + args.rval().set(jsret); return true; } - JS_ReportError(cx, "js_cocos2dx_ui_Slider_setScale9Enabled : wrong number of arguments: %d, was expecting %d", argc, 1); - return false; -} -bool js_cocos2dx_ui_Slider_setZoomScale(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::ui::Slider* cobj = (cocos2d::ui::Slider *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_setZoomScale : Invalid Native Object"); - if (argc == 1) { - double arg0 = 0; - ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_Slider_setZoomScale : Error processing arguments"); - cobj->setZoomScale(arg0); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_ui_Slider_setZoomScale : wrong number of arguments: %d, was expecting %d", argc, 1); + JS_ReportError(cx, "js_cocos2dx_ui_Slider_getPercent : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } bool js_cocos2dx_ui_Slider_setCapInsets(JSContext *cx, uint32_t argc, jsval *vp) @@ -9903,37 +10320,19 @@ bool js_cocos2dx_ui_Slider_setCapInsets(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_ui_Slider_setCapInsets : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } -bool js_cocos2dx_ui_Slider_getZoomScale(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::ui::Slider* cobj = (cocos2d::ui::Slider *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_getZoomScale : Invalid Native Object"); - if (argc == 0) { - double ret = cobj->getZoomScale(); - jsval jsret = JSVAL_NULL; - jsret = DOUBLE_TO_JSVAL(ret); - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_ui_Slider_getZoomScale : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} -bool js_cocos2dx_ui_Slider_loadSlidBallTexturePressed(JSContext *cx, uint32_t argc, jsval *vp) +bool js_cocos2dx_ui_Slider_loadSlidBallTextureDisabled(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); js_proxy_t *proxy = jsb_get_js_proxy(obj); cocos2d::ui::Slider* cobj = (cocos2d::ui::Slider *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_loadSlidBallTexturePressed : Invalid Native Object"); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_loadSlidBallTextureDisabled : Invalid Native Object"); if (argc == 1) { std::string arg0; ok &= jsval_to_std_string(cx, args.get(0), &arg0); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_Slider_loadSlidBallTexturePressed : Error processing arguments"); - cobj->loadSlidBallTexturePressed(arg0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_Slider_loadSlidBallTextureDisabled : Error processing arguments"); + cobj->loadSlidBallTextureDisabled(arg0); args.rval().setUndefined(); return true; } @@ -9942,67 +10341,33 @@ bool js_cocos2dx_ui_Slider_loadSlidBallTexturePressed(JSContext *cx, uint32_t ar cocos2d::ui::Widget::TextureResType arg1; ok &= jsval_to_std_string(cx, args.get(0), &arg0); ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_Slider_loadSlidBallTexturePressed : Error processing arguments"); - cobj->loadSlidBallTexturePressed(arg0, arg1); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_Slider_loadSlidBallTextureDisabled : Error processing arguments"); + cobj->loadSlidBallTextureDisabled(arg0, arg1); args.rval().setUndefined(); return true; } - JS_ReportError(cx, "js_cocos2dx_ui_Slider_loadSlidBallTexturePressed : wrong number of arguments: %d, was expecting %d", argc, 1); + JS_ReportError(cx, "js_cocos2dx_ui_Slider_loadSlidBallTextureDisabled : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } -bool js_cocos2dx_ui_Slider_isScale9Enabled(JSContext *cx, uint32_t argc, jsval *vp) +bool js_cocos2dx_ui_Slider_setZoomScale(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); js_proxy_t *proxy = jsb_get_js_proxy(obj); cocos2d::ui::Slider* cobj = (cocos2d::ui::Slider *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_isScale9Enabled : Invalid Native Object"); - if (argc == 0) { - bool ret = cobj->isScale9Enabled(); - jsval jsret = JSVAL_NULL; - jsret = BOOLEAN_TO_JSVAL(ret); - args.rval().set(jsret); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_setZoomScale : Invalid Native Object"); + if (argc == 1) { + double arg0 = 0; + ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_Slider_setZoomScale : Error processing arguments"); + cobj->setZoomScale(arg0); + args.rval().setUndefined(); return true; } - JS_ReportError(cx, "js_cocos2dx_ui_Slider_isScale9Enabled : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} -bool js_cocos2dx_ui_Slider_getCapInsetsBarRenderer(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::ui::Slider* cobj = (cocos2d::ui::Slider *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_getCapInsetsBarRenderer : Invalid Native Object"); - if (argc == 0) { - const cocos2d::Rect& ret = cobj->getCapInsetsBarRenderer(); - jsval jsret = JSVAL_NULL; - jsret = ccrect_to_jsval(cx, ret); - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_ui_Slider_getCapInsetsBarRenderer : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} -bool js_cocos2dx_ui_Slider_getPercent(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::ui::Slider* cobj = (cocos2d::ui::Slider *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_getPercent : Invalid Native Object"); - if (argc == 0) { - int ret = cobj->getPercent(); - jsval jsret = JSVAL_NULL; - jsret = int32_to_jsval(cx, ret); - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_ui_Slider_getPercent : wrong number of arguments: %d, was expecting %d", argc, 0); + JS_ReportError(cx, "js_cocos2dx_ui_Slider_setZoomScale : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } bool js_cocos2dx_ui_Slider_create(JSContext *cx, uint32_t argc, jsval *vp) @@ -10166,25 +10531,30 @@ void js_register_cocos2dx_ui_Slider(JSContext *cx, JS::HandleObject global) { }; static JSFunctionSpec funcs[] = { - JS_FN("setMaxPercent", js_cocos2dx_ui_Slider_setMaxPercent, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setPercent", js_cocos2dx_ui_Slider_setPercent, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("loadSlidBallTextureDisabled", js_cocos2dx_ui_Slider_loadSlidBallTextureDisabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getMaxPercent", js_cocos2dx_ui_Slider_getMaxPercent, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("loadSlidBallTextureNormal", js_cocos2dx_ui_Slider_loadSlidBallTextureNormal, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("loadBarTexture", js_cocos2dx_ui_Slider_loadBarTexture, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("loadProgressBarTexture", js_cocos2dx_ui_Slider_loadProgressBarTexture, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("loadSlidBallTextures", js_cocos2dx_ui_Slider_loadSlidBallTextures, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("setCapInsetProgressBarRebderer", js_cocos2dx_ui_Slider_setCapInsetProgressBarRebderer, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("setCapInsetsBarRenderer", js_cocos2dx_ui_Slider_setCapInsetsBarRenderer, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getBallNormalFile", js_cocos2dx_ui_Slider_getBallNormalFile, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getCapInsetsProgressBarRebderer", js_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setScale9Enabled", js_cocos2dx_ui_Slider_setScale9Enabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("setZoomScale", js_cocos2dx_ui_Slider_setZoomScale, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("setCapInsets", js_cocos2dx_ui_Slider_setCapInsets, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getBallPressedFile", js_cocos2dx_ui_Slider_getBallPressedFile, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getZoomScale", js_cocos2dx_ui_Slider_getZoomScale, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("loadSlidBallTexturePressed", js_cocos2dx_ui_Slider_loadSlidBallTexturePressed, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("isScale9Enabled", js_cocos2dx_ui_Slider_isScale9Enabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("loadSlidBallTextures", js_cocos2dx_ui_Slider_loadSlidBallTextures, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("setMaxPercent", js_cocos2dx_ui_Slider_setMaxPercent, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("loadBarTexture", js_cocos2dx_ui_Slider_loadBarTexture, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getProgressBarFile", js_cocos2dx_ui_Slider_getProgressBarFile, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getCapInsetsBarRenderer", js_cocos2dx_ui_Slider_getCapInsetsBarRenderer, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("loadSlidBallTexturePressed", js_cocos2dx_ui_Slider_loadSlidBallTexturePressed, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getBackFile", js_cocos2dx_ui_Slider_getBackFile, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("isScale9Enabled", js_cocos2dx_ui_Slider_isScale9Enabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("setCapInsetProgressBarRebderer", js_cocos2dx_ui_Slider_setCapInsetProgressBarRebderer, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("setCapInsetsBarRenderer", js_cocos2dx_ui_Slider_setCapInsetsBarRenderer, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getBallDisabeldFile", js_cocos2dx_ui_Slider_getBallDisabeldFile, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getPercent", js_cocos2dx_ui_Slider_getPercent, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("setCapInsets", js_cocos2dx_ui_Slider_setCapInsets, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("loadSlidBallTextureDisabled", js_cocos2dx_ui_Slider_loadSlidBallTextureDisabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("setZoomScale", js_cocos2dx_ui_Slider_setZoomScale, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("ctor", js_cocos2dx_ui_Slider_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -11885,26 +12255,6 @@ void js_register_cocos2dx_ui_TextField(JSContext *cx, JS::HandleObject global) { JSClass *jsb_cocos2d_ui_TextBMFont_class; JSObject *jsb_cocos2d_ui_TextBMFont_prototype; -bool js_cocos2dx_ui_TextBMFont_setFntFile(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::ui::TextBMFont* cobj = (cocos2d::ui::TextBMFont *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_TextBMFont_setFntFile : Invalid Native Object"); - if (argc == 1) { - std::string arg0; - ok &= jsval_to_std_string(cx, args.get(0), &arg0); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_TextBMFont_setFntFile : Error processing arguments"); - cobj->setFntFile(arg0); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_ui_TextBMFont_setFntFile : wrong number of arguments: %d, was expecting %d", argc, 1); - return false; -} bool js_cocos2dx_ui_TextBMFont_getStringLength(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -11923,6 +12273,24 @@ bool js_cocos2dx_ui_TextBMFont_getStringLength(JSContext *cx, uint32_t argc, jsv JS_ReportError(cx, "js_cocos2dx_ui_TextBMFont_getStringLength : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } +bool js_cocos2dx_ui_TextBMFont_getString(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::TextBMFont* cobj = (cocos2d::ui::TextBMFont *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_TextBMFont_getString : Invalid Native Object"); + if (argc == 0) { + const std::string& ret = cobj->getString(); + jsval jsret = JSVAL_NULL; + jsret = std_string_to_jsval(cx, ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_TextBMFont_getString : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_ui_TextBMFont_setString(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -11943,22 +12311,42 @@ bool js_cocos2dx_ui_TextBMFont_setString(JSContext *cx, uint32_t argc, jsval *vp JS_ReportError(cx, "js_cocos2dx_ui_TextBMFont_setString : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } -bool js_cocos2dx_ui_TextBMFont_getString(JSContext *cx, uint32_t argc, jsval *vp) +bool js_cocos2dx_ui_TextBMFont_getRenderFile(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); js_proxy_t *proxy = jsb_get_js_proxy(obj); cocos2d::ui::TextBMFont* cobj = (cocos2d::ui::TextBMFont *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_TextBMFont_getString : Invalid Native Object"); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_TextBMFont_getRenderFile : Invalid Native Object"); if (argc == 0) { - const std::string& ret = cobj->getString(); + cocos2d::ResouceData ret = cobj->getRenderFile(); jsval jsret = JSVAL_NULL; - jsret = std_string_to_jsval(cx, ret); + #pragma warning NO CONVERSION FROM NATIVE FOR ResouceData; args.rval().set(jsret); return true; } - JS_ReportError(cx, "js_cocos2dx_ui_TextBMFont_getString : wrong number of arguments: %d, was expecting %d", argc, 0); + JS_ReportError(cx, "js_cocos2dx_ui_TextBMFont_getRenderFile : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_ui_TextBMFont_setFntFile(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::TextBMFont* cobj = (cocos2d::ui::TextBMFont *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_TextBMFont_setFntFile : Invalid Native Object"); + if (argc == 1) { + std::string arg0; + ok &= jsval_to_std_string(cx, args.get(0), &arg0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_TextBMFont_setFntFile : Error processing arguments"); + cobj->setFntFile(arg0); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_TextBMFont_setFntFile : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } bool js_cocos2dx_ui_TextBMFont_create(JSContext *cx, uint32_t argc, jsval *vp) @@ -12097,10 +12485,11 @@ void js_register_cocos2dx_ui_TextBMFont(JSContext *cx, JS::HandleObject global) }; static JSFunctionSpec funcs[] = { - JS_FN("setFntFile", js_cocos2dx_ui_TextBMFont_setFntFile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getStringLength", js_cocos2dx_ui_TextBMFont_getStringLength, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("setString", js_cocos2dx_ui_TextBMFont_setString, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getString", js_cocos2dx_ui_TextBMFont_getString, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("setString", js_cocos2dx_ui_TextBMFont_setString, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getRenderFile", js_cocos2dx_ui_TextBMFont_getRenderFile, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("setFntFile", js_cocos2dx_ui_TextBMFont_setFntFile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("ctor", js_cocos2dx_ui_TextBMFont_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -12143,198 +12532,118 @@ void js_register_cocos2dx_ui_TextBMFont(JSContext *cx, JS::HandleObject global) JSClass *jsb_cocos2d_ui_PageView_class; JSObject *jsb_cocos2d_ui_PageView_prototype; -bool js_cocos2dx_ui_PageView_getCustomScrollThreshold(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::ui::PageView* cobj = (cocos2d::ui::PageView *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_getCustomScrollThreshold : Invalid Native Object"); - if (argc == 0) { - double ret = cobj->getCustomScrollThreshold(); - jsval jsret = JSVAL_NULL; - jsret = DOUBLE_TO_JSVAL(ret); - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_ui_PageView_getCustomScrollThreshold : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} -bool js_cocos2dx_ui_PageView_getCurPageIndex(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::ui::PageView* cobj = (cocos2d::ui::PageView *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_getCurPageIndex : Invalid Native Object"); - if (argc == 0) { - ssize_t ret = cobj->getCurPageIndex(); - jsval jsret = JSVAL_NULL; - jsret = ssize_to_jsval(cx, ret); - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_ui_PageView_getCurPageIndex : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} -bool js_cocos2dx_ui_PageView_setDirection(JSContext *cx, uint32_t argc, jsval *vp) +bool js_cocos2dx_ui_PageView_setIndicatorSpaceBetweenIndexNodes(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); js_proxy_t *proxy = jsb_get_js_proxy(obj); cocos2d::ui::PageView* cobj = (cocos2d::ui::PageView *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_setDirection : Invalid Native Object"); - if (argc == 1) { - cocos2d::ui::PageView::Direction arg0; - ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_PageView_setDirection : Error processing arguments"); - cobj->setDirection(arg0); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_ui_PageView_setDirection : wrong number of arguments: %d, was expecting %d", argc, 1); - return false; -} -bool js_cocos2dx_ui_PageView_addWidgetToPage(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::ui::PageView* cobj = (cocos2d::ui::PageView *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_addWidgetToPage : Invalid Native Object"); - if (argc == 3) { - cocos2d::ui::Widget* arg0 = nullptr; - ssize_t arg1 = 0; - bool arg2; - do { - if (args.get(0).isNull()) { arg0 = nullptr; break; } - if (!args.get(0).isObject()) { ok = false; break; } - js_proxy_t *jsProxy; - JSObject *tmpObj = args.get(0).toObjectOrNull(); - jsProxy = jsb_get_js_proxy(tmpObj); - arg0 = (cocos2d::ui::Widget*)(jsProxy ? jsProxy->ptr : NULL); - JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); - } while (0); - ok &= jsval_to_ssize(cx, args.get(1), &arg1); - arg2 = JS::ToBoolean(args.get(2)); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_PageView_addWidgetToPage : Error processing arguments"); - cobj->addWidgetToPage(arg0, arg1, arg2); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_ui_PageView_addWidgetToPage : wrong number of arguments: %d, was expecting %d", argc, 3); - return false; -} -bool js_cocos2dx_ui_PageView_isUsingCustomScrollThreshold(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::ui::PageView* cobj = (cocos2d::ui::PageView *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_isUsingCustomScrollThreshold : Invalid Native Object"); - if (argc == 0) { - bool ret = cobj->isUsingCustomScrollThreshold(); - jsval jsret = JSVAL_NULL; - jsret = BOOLEAN_TO_JSVAL(ret); - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_ui_PageView_isUsingCustomScrollThreshold : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} -bool js_cocos2dx_ui_PageView_setCurPageIndex(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::ui::PageView* cobj = (cocos2d::ui::PageView *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_setCurPageIndex : Invalid Native Object"); - if (argc == 1) { - ssize_t arg0 = 0; - ok &= jsval_to_ssize(cx, args.get(0), &arg0); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_PageView_setCurPageIndex : Error processing arguments"); - cobj->setCurPageIndex(arg0); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_ui_PageView_setCurPageIndex : wrong number of arguments: %d, was expecting %d", argc, 1); - return false; -} -bool js_cocos2dx_ui_PageView_removePage(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::ui::PageView* cobj = (cocos2d::ui::PageView *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_removePage : Invalid Native Object"); - if (argc == 1) { - cocos2d::ui::Layout* arg0 = nullptr; - do { - if (args.get(0).isNull()) { arg0 = nullptr; break; } - if (!args.get(0).isObject()) { ok = false; break; } - js_proxy_t *jsProxy; - JSObject *tmpObj = args.get(0).toObjectOrNull(); - jsProxy = jsb_get_js_proxy(tmpObj); - arg0 = (cocos2d::ui::Layout*)(jsProxy ? jsProxy->ptr : NULL); - JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); - } while (0); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_PageView_removePage : Error processing arguments"); - cobj->removePage(arg0); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_ui_PageView_removePage : wrong number of arguments: %d, was expecting %d", argc, 1); - return false; -} -bool js_cocos2dx_ui_PageView_setUsingCustomScrollThreshold(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::ui::PageView* cobj = (cocos2d::ui::PageView *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_setUsingCustomScrollThreshold : Invalid Native Object"); - if (argc == 1) { - bool arg0; - arg0 = JS::ToBoolean(args.get(0)); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_PageView_setUsingCustomScrollThreshold : Error processing arguments"); - cobj->setUsingCustomScrollThreshold(arg0); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_ui_PageView_setUsingCustomScrollThreshold : wrong number of arguments: %d, was expecting %d", argc, 1); - return false; -} -bool js_cocos2dx_ui_PageView_setCustomScrollThreshold(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::ui::PageView* cobj = (cocos2d::ui::PageView *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_setCustomScrollThreshold : Invalid Native Object"); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_setIndicatorSpaceBetweenIndexNodes : Invalid Native Object"); if (argc == 1) { double arg0 = 0; ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_PageView_setCustomScrollThreshold : Error processing arguments"); - cobj->setCustomScrollThreshold(arg0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_PageView_setIndicatorSpaceBetweenIndexNodes : Error processing arguments"); + cobj->setIndicatorSpaceBetweenIndexNodes(arg0); args.rval().setUndefined(); return true; } - JS_ReportError(cx, "js_cocos2dx_ui_PageView_setCustomScrollThreshold : wrong number of arguments: %d, was expecting %d", argc, 1); + JS_ReportError(cx, "js_cocos2dx_ui_PageView_setIndicatorSpaceBetweenIndexNodes : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} +bool js_cocos2dx_ui_PageView_setIndicatorSelectedIndexColor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::PageView* cobj = (cocos2d::ui::PageView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_setIndicatorSelectedIndexColor : Invalid Native Object"); + if (argc == 1) { + cocos2d::Color3B arg0; + ok &= jsval_to_cccolor3b(cx, args.get(0), &arg0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_PageView_setIndicatorSelectedIndexColor : Error processing arguments"); + cobj->setIndicatorSelectedIndexColor(arg0); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_PageView_setIndicatorSelectedIndexColor : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} +bool js_cocos2dx_ui_PageView_getIndicatorSelectedIndexColor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::PageView* cobj = (cocos2d::ui::PageView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_getIndicatorSelectedIndexColor : Invalid Native Object"); + if (argc == 0) { + const cocos2d::Color3B& ret = cobj->getIndicatorSelectedIndexColor(); + jsval jsret = JSVAL_NULL; + jsret = cccolor3b_to_jsval(cx, ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_PageView_getIndicatorSelectedIndexColor : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_ui_PageView_getIndicatorPositionAsAnchorPoint(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::PageView* cobj = (cocos2d::ui::PageView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_getIndicatorPositionAsAnchorPoint : Invalid Native Object"); + if (argc == 0) { + const cocos2d::Vec2& ret = cobj->getIndicatorPositionAsAnchorPoint(); + jsval jsret = JSVAL_NULL; + jsret = vector2_to_jsval(cx, ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_PageView_getIndicatorPositionAsAnchorPoint : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_ui_PageView_setIndicatorPosition(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::PageView* cobj = (cocos2d::ui::PageView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_setIndicatorPosition : Invalid Native Object"); + if (argc == 1) { + cocos2d::Vec2 arg0; + ok &= jsval_to_vector2(cx, args.get(0), &arg0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_PageView_setIndicatorPosition : Error processing arguments"); + cobj->setIndicatorPosition(arg0); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_PageView_setIndicatorPosition : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} +bool js_cocos2dx_ui_PageView_getIndicatorPosition(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::PageView* cobj = (cocos2d::ui::PageView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_getIndicatorPosition : Invalid Native Object"); + if (argc == 0) { + const cocos2d::Vec2& ret = cobj->getIndicatorPosition(); + jsval jsret = JSVAL_NULL; + jsret = vector2_to_jsval(cx, ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_PageView_getIndicatorPosition : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } bool js_cocos2dx_ui_PageView_insertPage(JSContext *cx, uint32_t argc, jsval *vp) @@ -12346,7 +12655,7 @@ bool js_cocos2dx_ui_PageView_insertPage(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::ui::PageView* cobj = (cocos2d::ui::PageView *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_insertPage : Invalid Native Object"); if (argc == 2) { - cocos2d::ui::Layout* arg0 = nullptr; + cocos2d::ui::Widget* arg0 = nullptr; int arg1 = 0; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } @@ -12354,7 +12663,7 @@ bool js_cocos2dx_ui_PageView_insertPage(JSContext *cx, uint32_t argc, jsval *vp) js_proxy_t *jsProxy; JSObject *tmpObj = args.get(0).toObjectOrNull(); jsProxy = jsb_get_js_proxy(tmpObj); - arg0 = (cocos2d::ui::Layout*)(jsProxy ? jsProxy->ptr : NULL); + arg0 = (cocos2d::ui::Widget*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); @@ -12367,22 +12676,88 @@ bool js_cocos2dx_ui_PageView_insertPage(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_ui_PageView_insertPage : wrong number of arguments: %d, was expecting %d", argc, 2); return false; } -bool js_cocos2dx_ui_PageView_getDirection(JSContext *cx, uint32_t argc, jsval *vp) +bool js_cocos2dx_ui_PageView_getCurrentPageIndex(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); js_proxy_t *proxy = jsb_get_js_proxy(obj); cocos2d::ui::PageView* cobj = (cocos2d::ui::PageView *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_getDirection : Invalid Native Object"); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_getCurrentPageIndex : Invalid Native Object"); if (argc == 0) { - int ret = (int)cobj->getDirection(); + ssize_t ret = cobj->getCurrentPageIndex(); jsval jsret = JSVAL_NULL; - jsret = int32_to_jsval(cx, ret); + jsret = ssize_to_jsval(cx, ret); args.rval().set(jsret); return true; } - JS_ReportError(cx, "js_cocos2dx_ui_PageView_getDirection : wrong number of arguments: %d, was expecting %d", argc, 0); + JS_ReportError(cx, "js_cocos2dx_ui_PageView_getCurrentPageIndex : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_ui_PageView_removePage(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::PageView* cobj = (cocos2d::ui::PageView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_removePage : Invalid Native Object"); + if (argc == 1) { + cocos2d::ui::Widget* arg0 = nullptr; + do { + if (args.get(0).isNull()) { arg0 = nullptr; break; } + if (!args.get(0).isObject()) { ok = false; break; } + js_proxy_t *jsProxy; + JSObject *tmpObj = args.get(0).toObjectOrNull(); + jsProxy = jsb_get_js_proxy(tmpObj); + arg0 = (cocos2d::ui::Widget*)(jsProxy ? jsProxy->ptr : NULL); + JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); + } while (0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_PageView_removePage : Error processing arguments"); + cobj->removePage(arg0); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_PageView_removePage : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} +bool js_cocos2dx_ui_PageView_setCurrentPageIndex(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::PageView* cobj = (cocos2d::ui::PageView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_setCurrentPageIndex : Invalid Native Object"); + if (argc == 1) { + ssize_t arg0 = 0; + ok &= jsval_to_ssize(cx, args.get(0), &arg0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_PageView_setCurrentPageIndex : Error processing arguments"); + cobj->setCurrentPageIndex(arg0); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_PageView_setCurrentPageIndex : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} +bool js_cocos2dx_ui_PageView_getIndicatorEnabled(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::PageView* cobj = (cocos2d::ui::PageView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_getIndicatorEnabled : Invalid Native Object"); + if (argc == 0) { + bool ret = cobj->getIndicatorEnabled(); + jsval jsret = JSVAL_NULL; + jsret = BOOLEAN_TO_JSVAL(ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_PageView_getIndicatorEnabled : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } bool js_cocos2dx_ui_PageView_scrollToPage(JSContext *cx, uint32_t argc, jsval *vp) @@ -12405,33 +12780,126 @@ bool js_cocos2dx_ui_PageView_scrollToPage(JSContext *cx, uint32_t argc, jsval *v JS_ReportError(cx, "js_cocos2dx_ui_PageView_scrollToPage : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } -bool js_cocos2dx_ui_PageView_getPage(JSContext *cx, uint32_t argc, jsval *vp) +bool js_cocos2dx_ui_PageView_setIndicatorPositionAsAnchorPoint(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); js_proxy_t *proxy = jsb_get_js_proxy(obj); cocos2d::ui::PageView* cobj = (cocos2d::ui::PageView *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_getPage : Invalid Native Object"); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_setIndicatorPositionAsAnchorPoint : Invalid Native Object"); + if (argc == 1) { + cocos2d::Vec2 arg0; + ok &= jsval_to_vector2(cx, args.get(0), &arg0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_PageView_setIndicatorPositionAsAnchorPoint : Error processing arguments"); + cobj->setIndicatorPositionAsAnchorPoint(arg0); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_PageView_setIndicatorPositionAsAnchorPoint : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} +bool js_cocos2dx_ui_PageView_scrollToItem(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::PageView* cobj = (cocos2d::ui::PageView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_scrollToItem : Invalid Native Object"); if (argc == 1) { ssize_t arg0 = 0; ok &= jsval_to_ssize(cx, args.get(0), &arg0); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_PageView_getPage : Error processing arguments"); - cocos2d::ui::Layout* ret = cobj->getPage(arg0); - jsval jsret = JSVAL_NULL; + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_PageView_scrollToItem : Error processing arguments"); + cobj->scrollToItem(arg0); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_PageView_scrollToItem : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} +bool js_cocos2dx_ui_PageView_setIndicatorEnabled(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::PageView* cobj = (cocos2d::ui::PageView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_setIndicatorEnabled : Invalid Native Object"); + if (argc == 1) { + bool arg0; + arg0 = JS::ToBoolean(args.get(0)); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_PageView_setIndicatorEnabled : Error processing arguments"); + cobj->setIndicatorEnabled(arg0); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_PageView_setIndicatorEnabled : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} +bool js_cocos2dx_ui_PageView_addPage(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::PageView* cobj = (cocos2d::ui::PageView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_addPage : Invalid Native Object"); + if (argc == 1) { + cocos2d::ui::Widget* arg0 = nullptr; do { - if (ret) { - js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::ui::Layout*)ret); - jsret = OBJECT_TO_JSVAL(jsProxy->obj); - } else { - jsret = JSVAL_NULL; - } + if (args.get(0).isNull()) { arg0 = nullptr; break; } + if (!args.get(0).isObject()) { ok = false; break; } + js_proxy_t *jsProxy; + JSObject *tmpObj = args.get(0).toObjectOrNull(); + jsProxy = jsb_get_js_proxy(tmpObj); + arg0 = (cocos2d::ui::Widget*)(jsProxy ? jsProxy->ptr : NULL); + JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); } while (0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_PageView_addPage : Error processing arguments"); + cobj->addPage(arg0); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_PageView_addPage : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} +bool js_cocos2dx_ui_PageView_getIndicatorSpaceBetweenIndexNodes(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::PageView* cobj = (cocos2d::ui::PageView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_getIndicatorSpaceBetweenIndexNodes : Invalid Native Object"); + if (argc == 0) { + double ret = cobj->getIndicatorSpaceBetweenIndexNodes(); + jsval jsret = JSVAL_NULL; + jsret = DOUBLE_TO_JSVAL(ret); args.rval().set(jsret); return true; } - JS_ReportError(cx, "js_cocos2dx_ui_PageView_getPage : wrong number of arguments: %d, was expecting %d", argc, 1); + JS_ReportError(cx, "js_cocos2dx_ui_PageView_getIndicatorSpaceBetweenIndexNodes : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_ui_PageView_removeAllPages(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::PageView* cobj = (cocos2d::ui::PageView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_removeAllPages : Invalid Native Object"); + if (argc == 0) { + cobj->removeAllPages(); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_PageView_removeAllPages : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } bool js_cocos2dx_ui_PageView_removePageAtIndex(JSContext *cx, uint32_t argc, jsval *vp) @@ -12454,68 +12922,6 @@ bool js_cocos2dx_ui_PageView_removePageAtIndex(JSContext *cx, uint32_t argc, jsv JS_ReportError(cx, "js_cocos2dx_ui_PageView_removePageAtIndex : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } -bool js_cocos2dx_ui_PageView_getPages(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::ui::PageView* cobj = (cocos2d::ui::PageView *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_getPages : Invalid Native Object"); - if (argc == 0) { - cocos2d::Vector& ret = cobj->getPages(); - jsval jsret = JSVAL_NULL; - jsret = ccvector_to_jsval(cx, ret); - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_ui_PageView_getPages : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} -bool js_cocos2dx_ui_PageView_removeAllPages(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::ui::PageView* cobj = (cocos2d::ui::PageView *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_removeAllPages : Invalid Native Object"); - if (argc == 0) { - cobj->removeAllPages(); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_ui_PageView_removeAllPages : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} -bool js_cocos2dx_ui_PageView_addPage(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::ui::PageView* cobj = (cocos2d::ui::PageView *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_PageView_addPage : Invalid Native Object"); - if (argc == 1) { - cocos2d::ui::Layout* arg0 = nullptr; - do { - if (args.get(0).isNull()) { arg0 = nullptr; break; } - if (!args.get(0).isObject()) { ok = false; break; } - js_proxy_t *jsProxy; - JSObject *tmpObj = args.get(0).toObjectOrNull(); - jsProxy = jsb_get_js_proxy(tmpObj); - arg0 = (cocos2d::ui::Layout*)(jsProxy ? jsProxy->ptr : NULL); - JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); - } while (0); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_PageView_addPage : Error processing arguments"); - cobj->addPage(arg0); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_ui_PageView_addPage : wrong number of arguments: %d, was expecting %d", argc, 1); - return false; -} bool js_cocos2dx_ui_PageView_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -12601,7 +13007,7 @@ bool js_cocos2dx_ui_PageView_constructor(JSContext *cx, uint32_t argc, jsval *vp return true; } -extern JSObject *jsb_cocos2d_ui_Layout_prototype; +extern JSObject *jsb_cocos2d_ui_ListView_prototype; void js_cocos2d_ui_PageView_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (PageView)", obj); @@ -12626,23 +13032,25 @@ void js_register_cocos2dx_ui_PageView(JSContext *cx, JS::HandleObject global) { }; static JSFunctionSpec funcs[] = { - JS_FN("getCustomScrollThreshold", js_cocos2dx_ui_PageView_getCustomScrollThreshold, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("getCurPageIndex", js_cocos2dx_ui_PageView_getCurPageIndex, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("setDirection", js_cocos2dx_ui_PageView_setDirection, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("addWidgetToPage", js_cocos2dx_ui_PageView_addWidgetToPage, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("isUsingCustomScrollThreshold", js_cocos2dx_ui_PageView_isUsingCustomScrollThreshold, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("setCurPageIndex", js_cocos2dx_ui_PageView_setCurPageIndex, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("removePage", js_cocos2dx_ui_PageView_removePage, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("setUsingCustomScrollThreshold", js_cocos2dx_ui_PageView_setUsingCustomScrollThreshold, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("setCustomScrollThreshold", js_cocos2dx_ui_PageView_setCustomScrollThreshold, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("setIndicatorSpaceBetweenIndexNodes", js_cocos2dx_ui_PageView_setIndicatorSpaceBetweenIndexNodes, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("setIndicatorSelectedIndexColor", js_cocos2dx_ui_PageView_setIndicatorSelectedIndexColor, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getIndicatorSelectedIndexColor", js_cocos2dx_ui_PageView_getIndicatorSelectedIndexColor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getIndicatorPositionAsAnchorPoint", js_cocos2dx_ui_PageView_getIndicatorPositionAsAnchorPoint, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("setIndicatorPosition", js_cocos2dx_ui_PageView_setIndicatorPosition, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getIndicatorPosition", js_cocos2dx_ui_PageView_getIndicatorPosition, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("insertPage", js_cocos2dx_ui_PageView_insertPage, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("getDirection", js_cocos2dx_ui_PageView_getDirection, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getCurrentPageIndex", js_cocos2dx_ui_PageView_getCurrentPageIndex, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("removePage", js_cocos2dx_ui_PageView_removePage, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("setCurrentPageIndex", js_cocos2dx_ui_PageView_setCurrentPageIndex, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getIndicatorEnabled", js_cocos2dx_ui_PageView_getIndicatorEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("scrollToPage", js_cocos2dx_ui_PageView_scrollToPage, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("getPage", js_cocos2dx_ui_PageView_getPage, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("removePageAtIndex", js_cocos2dx_ui_PageView_removePageAtIndex, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("getPages", js_cocos2dx_ui_PageView_getPages, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("removeAllPages", js_cocos2dx_ui_PageView_removeAllPages, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("setIndicatorPositionAsAnchorPoint", js_cocos2dx_ui_PageView_setIndicatorPositionAsAnchorPoint, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("scrollToItem", js_cocos2dx_ui_PageView_scrollToItem, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("setIndicatorEnabled", js_cocos2dx_ui_PageView_setIndicatorEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("addPage", js_cocos2dx_ui_PageView_addPage, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getIndicatorSpaceBetweenIndexNodes", js_cocos2dx_ui_PageView_getIndicatorSpaceBetweenIndexNodes, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("removeAllPages", js_cocos2dx_ui_PageView_removeAllPages, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("removePageAtIndex", js_cocos2dx_ui_PageView_removePageAtIndex, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("ctor", js_cocos2dx_ui_PageView_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -12655,7 +13063,7 @@ void js_register_cocos2dx_ui_PageView(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_ui_PageView_prototype = JS_InitClass( cx, global, - JS::RootedObject(cx, jsb_cocos2d_ui_Layout_prototype), + JS::RootedObject(cx, jsb_cocos2d_ui_ListView_prototype), jsb_cocos2d_ui_PageView_class, js_cocos2dx_ui_PageView_constructor, 0, // constructor properties, @@ -12676,7 +13084,7 @@ void js_register_cocos2dx_ui_PageView(JSContext *cx, JS::HandleObject global) { p = (js_type_class_t *)malloc(sizeof(js_type_class_t)); p->jsclass = jsb_cocos2d_ui_PageView_class; p->proto = jsb_cocos2d_ui_PageView_prototype; - p->parentProto = jsb_cocos2d_ui_Layout_prototype; + p->parentProto = jsb_cocos2d_ui_ListView_prototype; _js_global_type_map.insert(std::make_pair(typeName, p)); } anonEvaluate(cx, global, "(function () { ccui.PageView.extend = cc.Class.extend; })()"); @@ -14793,6 +15201,26 @@ bool js_cocos2dx_ui_Scale9Sprite_setInsetTop(JSContext *cx, uint32_t argc, jsval JS_ReportError(cx, "js_cocos2dx_ui_Scale9Sprite_setInsetTop : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } +bool js_cocos2dx_ui_Scale9Sprite_setRenderingType(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::Scale9Sprite* cobj = (cocos2d::ui::Scale9Sprite *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Scale9Sprite_setRenderingType : Invalid Native Object"); + if (argc == 1) { + cocos2d::ui::Scale9Sprite::RenderingType arg0; + ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_Scale9Sprite_setRenderingType : Error processing arguments"); + cobj->setRenderingType(arg0); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_Scale9Sprite_setRenderingType : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} bool js_cocos2dx_ui_Scale9Sprite_init(JSContext *cx, uint32_t argc, jsval *vp) { bool ok = true; @@ -15036,6 +15464,40 @@ bool js_cocos2dx_ui_Scale9Sprite_isScale9Enabled(JSContext *cx, uint32_t argc, j JS_ReportError(cx, "js_cocos2dx_ui_Scale9Sprite_isScale9Enabled : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } +bool js_cocos2dx_ui_Scale9Sprite_resetRender(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::Scale9Sprite* cobj = (cocos2d::ui::Scale9Sprite *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Scale9Sprite_resetRender : Invalid Native Object"); + if (argc == 0) { + cobj->resetRender(); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_Scale9Sprite_resetRender : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_ui_Scale9Sprite_getRenderingType(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::Scale9Sprite* cobj = (cocos2d::ui::Scale9Sprite *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Scale9Sprite_getRenderingType : Invalid Native Object"); + if (argc == 0) { + int ret = (int)cobj->getRenderingType(); + jsval jsret = JSVAL_NULL; + jsret = int32_to_jsval(cx, ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_Scale9Sprite_getRenderingType : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_ui_Scale9Sprite_getInsetRight(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -15675,6 +16137,7 @@ void js_register_cocos2dx_ui_Scale9Sprite(JSContext *cx, JS::HandleObject global JS_FN("initWithSpriteFrameName", js_cocos2dx_ui_Scale9Sprite_initWithSpriteFrameName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getSprite", js_cocos2dx_ui_Scale9Sprite_getSprite, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setInsetTop", js_cocos2dx_ui_Scale9Sprite_setInsetTop, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("setRenderingType", js_cocos2dx_ui_Scale9Sprite_setRenderingType, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("init", js_cocos2dx_ui_Scale9Sprite_init, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setPreferredSize", js_cocos2dx_ui_Scale9Sprite_setPreferredSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setSpriteFrame", js_cocos2dx_ui_Scale9Sprite_setSpriteFrame, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -15682,6 +16145,8 @@ void js_register_cocos2dx_ui_Scale9Sprite(JSContext *cx, JS::HandleObject global JS_FN("getInsetBottom", js_cocos2dx_ui_Scale9Sprite_getInsetBottom, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getCapInsets", js_cocos2dx_ui_Scale9Sprite_getCapInsets, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("isScale9Enabled", js_cocos2dx_ui_Scale9Sprite_isScale9Enabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("resetRender", js_cocos2dx_ui_Scale9Sprite_resetRender, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getRenderingType", js_cocos2dx_ui_Scale9Sprite_getRenderingType, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getInsetRight", js_cocos2dx_ui_Scale9Sprite_getInsetRight, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getOriginalSize", js_cocos2dx_ui_Scale9Sprite_getOriginalSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("initWithFile", js_cocos2dx_ui_Scale9Sprite_initWithFile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.hpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.hpp index 08017797bc..5ff1f071f9 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.hpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.hpp @@ -102,7 +102,6 @@ bool js_cocos2dx_ui_Widget_isBright(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Widget_dispatchFocusEvent(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Widget_setUnifySizeEnabled(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Widget_isPropagateTouchEvents(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ui_Widget_getCurrentFocusedWidget(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Widget_hitTest(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Widget_isLayoutComponentEnabled(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Widget_requestFocus(JSContext *cx, uint32_t argc, jsval *vp); @@ -124,6 +123,7 @@ bool js_cocos2dx_ui_Widget_setBright(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Widget_setCallbackType(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Widget_isSwallowTouches(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Widget_enableDpadNavigation(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Widget_getCurrentFocusedWidget(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Widget_create(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Widget_Widget(JSContext *cx, uint32_t argc, jsval *vp); @@ -141,6 +141,7 @@ bool js_cocos2dx_ui_Layout_setLoopFocus(JSContext *cx, uint32_t argc, jsval *vp) bool js_cocos2dx_ui_Layout_setBackGroundImageColor(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Layout_getBackGroundColorVector(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Layout_getClippingType(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Layout_getRenderFile(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Layout_isLoopFocus(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Layout_removeBackGroundImage(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Layout_getBackGroundColorOpacity(JSContext *cx, uint32_t argc, jsval *vp); @@ -181,12 +182,17 @@ void register_all_cocos2dx_ui(JSContext* cx, JS::HandleObject obj); bool js_cocos2dx_ui_Button_getNormalTextureSize(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Button_getTitleText(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Button_setTitleFontSize(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Button_resetPressedRender(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Button_setScale9Enabled(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Button_resetDisabledRender(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Button_getTitleRenderer(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Button_getRendererClicked(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Button_getDisabledFile(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Button_getZoomScale(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Button_getCapInsetsDisabledRenderer(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Button_setTitleColor(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Button_getNormalFile(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Button_resetNormalRender(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Button_getRendererDisabled(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Button_setCapInsetsDisabledRenderer(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Button_setCapInsets(JSContext *cx, uint32_t argc, jsval *vp); @@ -203,6 +209,7 @@ bool js_cocos2dx_ui_Button_loadTextures(JSContext *cx, uint32_t argc, jsval *vp) bool js_cocos2dx_ui_Button_isScale9Enabled(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Button_loadTextureNormal(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Button_setCapInsetsPressedRenderer(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Button_getPressedFile(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Button_getTitleFontSize(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Button_getRendererNormal(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Button_getTitleFontName(JSContext *cx, uint32_t argc, jsval *vp); @@ -220,15 +227,20 @@ bool js_cocos2dx_ui_AbstractCheckButton_constructor(JSContext *cx, uint32_t argc void js_cocos2dx_ui_AbstractCheckButton_finalize(JSContext *cx, JSObject *obj); void js_register_cocos2dx_ui_AbstractCheckButton(JSContext *cx, JS::HandleObject global); void register_all_cocos2dx_ui(JSContext* cx, JS::HandleObject obj); +bool js_cocos2dx_ui_AbstractCheckButton_getBackDisabledFile(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_AbstractCheckButton_getCrossDisabeldFile(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_AbstractCheckButton_loadTextureBackGroundSelected(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_AbstractCheckButton_loadTextureBackGroundDisabled(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_AbstractCheckButton_getCrossNormalFile(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_AbstractCheckButton_setSelected(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_AbstractCheckButton_getBackPressedFile(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_AbstractCheckButton_getRendererFrontCrossDisabled(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_AbstractCheckButton_getRendererBackground(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_AbstractCheckButton_loadTextureFrontCross(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_AbstractCheckButton_getRendererBackgroundDisabled(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_AbstractCheckButton_isSelected(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_AbstractCheckButton_init(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_AbstractCheckButton_getBackNormalFile(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_AbstractCheckButton_loadTextures(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_AbstractCheckButton_getZoomScale(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_AbstractCheckButton_getRendererFrontCross(JSContext *cx, uint32_t argc, jsval *vp); @@ -291,6 +303,7 @@ bool js_cocos2dx_ui_ImageView_init(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_ImageView_setScale9Enabled(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_ImageView_setTextureRect(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_ImageView_setCapInsets(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_ImageView_getRenderFile(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_ImageView_getCapInsets(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_ImageView_isScale9Enabled(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_ImageView_create(JSContext *cx, uint32_t argc, jsval *vp); @@ -342,6 +355,7 @@ void register_all_cocos2dx_ui(JSContext* cx, JS::HandleObject obj); bool js_cocos2dx_ui_TextAtlas_getStringLength(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_TextAtlas_getString(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_TextAtlas_setString(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_TextAtlas_getRenderFile(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_TextAtlas_setProperty(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_TextAtlas_adaptRenderers(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_TextAtlas_create(JSContext *cx, uint32_t argc, jsval *vp); @@ -358,6 +372,7 @@ void register_all_cocos2dx_ui(JSContext* cx, JS::HandleObject obj); bool js_cocos2dx_ui_LoadingBar_setPercent(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_LoadingBar_loadTexture(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_LoadingBar_setDirection(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_LoadingBar_getRenderFile(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_LoadingBar_setScale9Enabled(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_LoadingBar_setCapInsets(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_LoadingBar_getDirection(JSContext *cx, uint32_t argc, jsval *vp); @@ -476,25 +491,30 @@ bool js_cocos2dx_ui_Slider_constructor(JSContext *cx, uint32_t argc, jsval *vp); void js_cocos2dx_ui_Slider_finalize(JSContext *cx, JSObject *obj); void js_register_cocos2dx_ui_Slider(JSContext *cx, JS::HandleObject global); void register_all_cocos2dx_ui(JSContext* cx, JS::HandleObject obj); -bool js_cocos2dx_ui_Slider_setMaxPercent(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Slider_setPercent(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ui_Slider_loadSlidBallTextureDisabled(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Slider_getMaxPercent(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Slider_loadSlidBallTextureNormal(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ui_Slider_loadBarTexture(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Slider_loadProgressBarTexture(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ui_Slider_loadSlidBallTextures(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ui_Slider_setCapInsetProgressBarRebderer(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ui_Slider_setCapInsetsBarRenderer(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Slider_getBallNormalFile(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Slider_setScale9Enabled(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ui_Slider_setZoomScale(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ui_Slider_setCapInsets(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Slider_getBallPressedFile(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Slider_getZoomScale(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ui_Slider_loadSlidBallTexturePressed(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ui_Slider_isScale9Enabled(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Slider_loadSlidBallTextures(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Slider_setMaxPercent(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Slider_loadBarTexture(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Slider_getProgressBarFile(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Slider_getCapInsetsBarRenderer(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Slider_loadSlidBallTexturePressed(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Slider_getBackFile(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Slider_isScale9Enabled(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Slider_setCapInsetProgressBarRebderer(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Slider_setCapInsetsBarRenderer(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Slider_getBallDisabeldFile(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Slider_getPercent(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Slider_setCapInsets(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Slider_loadSlidBallTextureDisabled(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Slider_setZoomScale(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Slider_create(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Slider_createInstance(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Slider_Slider(JSContext *cx, uint32_t argc, jsval *vp); @@ -592,10 +612,11 @@ bool js_cocos2dx_ui_TextBMFont_constructor(JSContext *cx, uint32_t argc, jsval * void js_cocos2dx_ui_TextBMFont_finalize(JSContext *cx, JSObject *obj); void js_register_cocos2dx_ui_TextBMFont(JSContext *cx, JS::HandleObject global); void register_all_cocos2dx_ui(JSContext* cx, JS::HandleObject obj); -bool js_cocos2dx_ui_TextBMFont_setFntFile(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_TextBMFont_getStringLength(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ui_TextBMFont_setString(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_TextBMFont_getString(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_TextBMFont_setString(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_TextBMFont_getRenderFile(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_TextBMFont_setFntFile(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_TextBMFont_create(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_TextBMFont_createInstance(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_TextBMFont_TextBMFont(JSContext *cx, uint32_t argc, jsval *vp); @@ -607,23 +628,25 @@ bool js_cocos2dx_ui_PageView_constructor(JSContext *cx, uint32_t argc, jsval *vp void js_cocos2dx_ui_PageView_finalize(JSContext *cx, JSObject *obj); void js_register_cocos2dx_ui_PageView(JSContext *cx, JS::HandleObject global); void register_all_cocos2dx_ui(JSContext* cx, JS::HandleObject obj); -bool js_cocos2dx_ui_PageView_getCustomScrollThreshold(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ui_PageView_getCurPageIndex(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ui_PageView_setDirection(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ui_PageView_addWidgetToPage(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ui_PageView_isUsingCustomScrollThreshold(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ui_PageView_setCurPageIndex(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ui_PageView_removePage(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ui_PageView_setUsingCustomScrollThreshold(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ui_PageView_setCustomScrollThreshold(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_PageView_setIndicatorSpaceBetweenIndexNodes(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_PageView_setIndicatorSelectedIndexColor(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_PageView_getIndicatorSelectedIndexColor(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_PageView_getIndicatorPositionAsAnchorPoint(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_PageView_setIndicatorPosition(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_PageView_getIndicatorPosition(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_PageView_insertPage(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ui_PageView_getDirection(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_PageView_getCurrentPageIndex(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_PageView_removePage(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_PageView_setCurrentPageIndex(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_PageView_getIndicatorEnabled(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_PageView_scrollToPage(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ui_PageView_getPage(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ui_PageView_removePageAtIndex(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ui_PageView_getPages(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ui_PageView_removeAllPages(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_PageView_setIndicatorPositionAsAnchorPoint(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_PageView_scrollToItem(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_PageView_setIndicatorEnabled(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_PageView_addPage(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_PageView_getIndicatorSpaceBetweenIndexNodes(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_PageView_removeAllPages(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_PageView_removePageAtIndex(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_PageView_create(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_PageView_createInstance(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_PageView_PageView(JSContext *cx, uint32_t argc, jsval *vp); @@ -756,6 +779,7 @@ bool js_cocos2dx_ui_Scale9Sprite_setInsetBottom(JSContext *cx, uint32_t argc, js bool js_cocos2dx_ui_Scale9Sprite_initWithSpriteFrameName(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Scale9Sprite_getSprite(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Scale9Sprite_setInsetTop(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Scale9Sprite_setRenderingType(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Scale9Sprite_init(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Scale9Sprite_setPreferredSize(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Scale9Sprite_setSpriteFrame(JSContext *cx, uint32_t argc, jsval *vp); @@ -763,6 +787,8 @@ bool js_cocos2dx_ui_Scale9Sprite_getBlendFunc(JSContext *cx, uint32_t argc, jsva bool js_cocos2dx_ui_Scale9Sprite_getInsetBottom(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Scale9Sprite_getCapInsets(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Scale9Sprite_isScale9Enabled(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Scale9Sprite_resetRender(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Scale9Sprite_getRenderingType(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Scale9Sprite_getInsetRight(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Scale9Sprite_getOriginalSize(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Scale9Sprite_initWithFile(JSContext *cx, uint32_t argc, jsval *vp); diff --git a/cocos/scripting/js-bindings/manual/component/CCComponentJS.cpp b/cocos/scripting/js-bindings/manual/component/CCComponentJS.cpp index 29f98078f1..643a3abde3 100644 --- a/cocos/scripting/js-bindings/manual/component/CCComponentJS.cpp +++ b/cocos/scripting/js-bindings/manual/component/CCComponentJS.cpp @@ -94,7 +94,7 @@ ComponentJS::ComponentJS(const std::string& scriptFileName) ComponentJS::~ComponentJS() { mozilla::Maybe* jsObj = static_cast*>(_jsObj); - if (jsObj == nullptr) + if (jsObj != nullptr) { delete jsObj; } diff --git a/cocos/scripting/js-bindings/manual/js_manual_conversions.cpp b/cocos/scripting/js-bindings/manual/js_manual_conversions.cpp index 24097f76b9..3a9908949c 100644 --- a/cocos/scripting/js-bindings/manual/js_manual_conversions.cpp +++ b/cocos/scripting/js-bindings/manual/js_manual_conversions.cpp @@ -27,6 +27,7 @@ #include "js_manual_conversions.h" #include "cocos2d_specifics.hpp" #include "math/TransformUtils.h" +#include "2d/CocosStudioExtension.h" USING_NS_CC; @@ -2865,3 +2866,43 @@ jsval std_map_string_string_to_jsval(JSContext* cx, const std::maptype = (int)t; + ret->file = file; + ret->plist = plist; + return true; +} + +jsval resoucedata_to_jsval(JSContext* cx, const ResouceData& v) +{ + JS::RootedObject proto(cx); + JS::RootedObject parent(cx); + JS::RootedObject tmp(cx, JS_NewObject(cx, NULL, proto, parent)); + if (!tmp) return JSVAL_NULL; + bool ok = JS_DefineProperty(cx, tmp, "type", v.type, JSPROP_ENUMERATE | JSPROP_PERMANENT) && + JS_DefineProperty(cx, tmp, "file", JS::RootedValue(cx, std_string_to_jsval(cx, v.file)), JSPROP_ENUMERATE | JSPROP_PERMANENT) && + JS_DefineProperty(cx, tmp, "plist", JS::RootedValue(cx, std_string_to_jsval(cx, v.plist)), JSPROP_ENUMERATE | JSPROP_PERMANENT); + if (ok) { + return OBJECT_TO_JSVAL(tmp); + } + return JSVAL_NULL; +} diff --git a/cocos/scripting/js-bindings/manual/js_manual_conversions.h b/cocos/scripting/js-bindings/manual/js_manual_conversions.h index ae99be38f3..cd60c4d62c 100644 --- a/cocos/scripting/js-bindings/manual/js_manual_conversions.h +++ b/cocos/scripting/js-bindings/manual/js_manual_conversions.h @@ -34,6 +34,10 @@ #define JSB_COMPATIBLE_WITH_COCOS2D_HTML5_BASIC_TYPES +NS_CC_BEGIN +struct CC_DLL ResouceData; +NS_CC_END + // just a simple utility to avoid mem leaking when using JSString class JSStringWrapper { @@ -110,6 +114,7 @@ bool jsvals_variadic_to_ccarray( JSContext *cx, jsval *vp, int argc, cocos2d::__ bool jsval_to_quaternion(JSContext *cx, JS::HandleValue vp, cocos2d::Quaternion* ret); bool jsval_to_obb(JSContext *cx, JS::HandleValue vp, cocos2d::OBB* ret); bool jsval_to_ray(JSContext *cx, JS::HandleValue vp, cocos2d::Ray* ret); +bool jsval_to_resoucedata(JSContext *cx, JS::HandleValue v, cocos2d::ResouceData* ret); // forward declaration js_proxy_t* jsb_get_js_proxy(JSObject* jsObj); @@ -272,6 +277,7 @@ jsval FontDefinition_to_jsval(JSContext* cx, const cocos2d::FontDefinition& t); jsval quaternion_to_jsval(JSContext* cx, const cocos2d::Quaternion& q); jsval meshVertexAttrib_to_jsval(JSContext* cx, const cocos2d::MeshVertexAttrib& q); jsval uniform_to_jsval(JSContext* cx, const cocos2d::Uniform* uniform); +jsval resoucedata_to_jsval(JSContext* cx, const cocos2d::ResouceData& v); template js_proxy_t *js_get_or_create_proxy(JSContext *cx, T *native_obj); diff --git a/cocos/scripting/js-bindings/script/studio/parsers/uiParser-1.x.js b/cocos/scripting/js-bindings/script/studio/parsers/uiParser-1.x.js index c14763e875..4f88976592 100644 --- a/cocos/scripting/js-bindings/script/studio/parsers/uiParser-1.x.js +++ b/cocos/scripting/js-bindings/script/studio/parsers/uiParser-1.x.js @@ -662,6 +662,13 @@ var va = options["vAlignment"]; if(va) widget.setTextVerticalAlignment(va); + + var r = options["colorR"]; + var g = options["colorG"]; + var b = options["colorB"]; + if (r !== undefined && g !== undefined && b !== undefined) { + widget.setTextColor(cc.color(r, g, b)); + } }; var register = [ diff --git a/cocos/scripting/lua-bindings/auto/api/AbstractCheckButton.lua b/cocos/scripting/lua-bindings/auto/api/AbstractCheckButton.lua index de1000aee4..be87a3aeea 100644 --- a/cocos/scripting/lua-bindings/auto/api/AbstractCheckButton.lua +++ b/cocos/scripting/lua-bindings/auto/api/AbstractCheckButton.lua @@ -4,6 +4,18 @@ -- @extend Widget -- @parent_module ccui +-------------------------------- +-- +-- @function [parent=#AbstractCheckButton] getBackDisabledFile +-- @param self +-- @return ResouceData#ResouceData ret (return value: cc.ResouceData) + +-------------------------------- +-- +-- @function [parent=#AbstractCheckButton] getCrossDisabeldFile +-- @param self +-- @return ResouceData#ResouceData ret (return value: cc.ResouceData) + -------------------------------- -- Load background selected state texture for check button.
-- param backGroundSelected The background selected state image name.
@@ -24,6 +36,12 @@ -- @param #int texType -- @return AbstractCheckButton#AbstractCheckButton self (return value: ccui.AbstractCheckButton) +-------------------------------- +-- +-- @function [parent=#AbstractCheckButton] getCrossNormalFile +-- @param self +-- @return ResouceData#ResouceData ret (return value: cc.ResouceData) + -------------------------------- -- Change CheckBox state.
-- Set to true will cause the CheckBox's state to "selected", false otherwise.
@@ -33,6 +51,12 @@ -- @param #bool selected -- @return AbstractCheckButton#AbstractCheckButton self (return value: ccui.AbstractCheckButton) +-------------------------------- +-- +-- @function [parent=#AbstractCheckButton] getBackPressedFile +-- @param self +-- @return ResouceData#ResouceData ret (return value: cc.ResouceData) + -------------------------------- -- brief Return the sprite instance of front cross when disabled
-- return the sprite instance of front cross when disabled @@ -83,6 +107,12 @@ -- @param #int texType -- @return bool#bool ret (return value: bool) +-------------------------------- +-- +-- @function [parent=#AbstractCheckButton] getBackNormalFile +-- @param self +-- @return ResouceData#ResouceData ret (return value: cc.ResouceData) + -------------------------------- -- Load all textures for initializing a check button.
-- param background The background image name.
diff --git a/cocos/scripting/lua-bindings/auto/api/Application.lua b/cocos/scripting/lua-bindings/auto/api/Application.lua index b1ebdffc20..1b14874a9c 100644 --- a/cocos/scripting/lua-bindings/auto/api/Application.lua +++ b/cocos/scripting/lua-bindings/auto/api/Application.lua @@ -3,15 +3,6 @@ -- @module Application -- @parent_module cc --------------------------------- --- brief Open url in default browser
--- param String with url to open.
--- return true if the resource located by the URL was successfully opened; otherwise false. --- @function [parent=#Application] openURL --- @param self --- @param #string url --- @return bool#bool ret (return value: bool) - -------------------------------- -- brief Get target platform -- @function [parent=#Application] getTargetPlatform @@ -32,6 +23,21 @@ -- @param self -- @return char#char ret (return value: char) +-------------------------------- +-- brief Open url in default browser
+-- param String with url to open.
+-- return true if the resource located by the URL was successfully opened; otherwise false. +-- @function [parent=#Application] openURL +-- @param self +-- @param #string url +-- @return bool#bool ret (return value: bool) + +-------------------------------- +-- brief Get application version. +-- @function [parent=#Application] getVersion +-- @param self +-- @return string#string ret (return value: string) + -------------------------------- -- brief Callback by Director to limit FPS.
-- param interval The time, expressed in seconds, between current frame and next. diff --git a/cocos/scripting/lua-bindings/auto/api/Button.lua b/cocos/scripting/lua-bindings/auto/api/Button.lua index b5cff2b758..cfdcffc243 100644 --- a/cocos/scripting/lua-bindings/auto/api/Button.lua +++ b/cocos/scripting/lua-bindings/auto/api/Button.lua @@ -25,6 +25,12 @@ -- @param #float size -- @return Button#Button self (return value: ccui.Button) +-------------------------------- +-- +-- @function [parent=#Button] resetPressedRender +-- @param self +-- @return Button#Button self (return value: ccui.Button) + -------------------------------- -- Enable scale9 renderer.
-- param enable Set to true will use scale9 renderer, false otherwise. @@ -33,6 +39,12 @@ -- @param #bool enable -- @return Button#Button self (return value: ccui.Button) +-------------------------------- +-- +-- @function [parent=#Button] resetDisabledRender +-- @param self +-- @return Button#Button self (return value: ccui.Button) + -------------------------------- -- Return the inner title renderer of Button.
-- return The button title.
@@ -49,6 +61,12 @@ -- @param self -- @return Scale9Sprite#Scale9Sprite ret (return value: ccui.Scale9Sprite) +-------------------------------- +-- +-- @function [parent=#Button] getDisabledFile +-- @param self +-- @return ResouceData#ResouceData ret (return value: cc.ResouceData) + -------------------------------- -- brief Return a zoom scale
-- return the zoom scale in float
@@ -72,6 +90,18 @@ -- @param #color3b_table color -- @return Button#Button self (return value: ccui.Button) +-------------------------------- +-- +-- @function [parent=#Button] getNormalFile +-- @param self +-- @return ResouceData#ResouceData ret (return value: cc.ResouceData) + +-------------------------------- +-- +-- @function [parent=#Button] resetNormalRender +-- @param self +-- @return Button#Button self (return value: ccui.Button) + -------------------------------- -- brief Return the nine-patch sprite of disabled state
-- return the nine-patch sprite of disabled state
@@ -213,6 +243,12 @@ -- @param #rect_table capInsets -- @return Button#Button self (return value: ccui.Button) +-------------------------------- +-- +-- @function [parent=#Button] getPressedFile +-- @param self +-- @return ResouceData#ResouceData ret (return value: cc.ResouceData) + -------------------------------- -- Query the font size of button title
-- return font size in float. diff --git a/cocos/scripting/lua-bindings/auto/api/ImageView.lua b/cocos/scripting/lua-bindings/auto/api/ImageView.lua index ce23c347e8..022c4fde48 100644 --- a/cocos/scripting/lua-bindings/auto/api/ImageView.lua +++ b/cocos/scripting/lua-bindings/auto/api/ImageView.lua @@ -47,6 +47,12 @@ -- @param #rect_table capInsets -- @return ImageView#ImageView self (return value: ccui.ImageView) +-------------------------------- +-- +-- @function [parent=#ImageView] getRenderFile +-- @param self +-- @return ResouceData#ResouceData ret (return value: cc.ResouceData) + -------------------------------- -- Get ImageView's capInsets size.
-- return Query capInsets size in Rect
diff --git a/cocos/scripting/lua-bindings/auto/api/Layout.lua b/cocos/scripting/lua-bindings/auto/api/Layout.lua index 9671f39ae0..e949770e9e 100644 --- a/cocos/scripting/lua-bindings/auto/api/Layout.lua +++ b/cocos/scripting/lua-bindings/auto/api/Layout.lua @@ -60,6 +60,12 @@ -- @param self -- @return int#int ret (return value: int) +-------------------------------- +-- +-- @function [parent=#Layout] getRenderFile +-- @param self +-- @return ResouceData#ResouceData ret (return value: cc.ResouceData) + -------------------------------- -- return If focus loop is enabled, then it will return true, otherwise it returns false. The default value is false. -- @function [parent=#Layout] isLoopFocus diff --git a/cocos/scripting/lua-bindings/auto/api/ListView.lua b/cocos/scripting/lua-bindings/auto/api/ListView.lua index 9710529b45..46a57edddc 100644 --- a/cocos/scripting/lua-bindings/auto/api/ListView.lua +++ b/cocos/scripting/lua-bindings/auto/api/ListView.lua @@ -46,7 +46,7 @@ -- param itemAnchorPoint Specifies an anchor point of each item for position to calculate distance. -- @function [parent=#ListView] jumpToItem -- @param self --- @param #int itemIndex +-- @param #long itemIndex -- @param #vec2_table positionRatioInView -- @param #vec2_table itemAnchorPoint -- @return ListView#ListView self (return value: ccui.ListView) @@ -171,11 +171,11 @@ -- @return ListView#ListView self (return value: ccui.ListView) -------------------------------- --- @overload self, int, vec2_table, vec2_table, float --- @overload self, int, vec2_table, vec2_table +-- @overload self, long, vec2_table, vec2_table, float +-- @overload self, long, vec2_table, vec2_table -- @function [parent=#ListView] scrollToItem -- @param self --- @param #int itemIndex +-- @param #long itemIndex -- @param #vec2_table positionRatioInView -- @param #vec2_table itemAnchorPoint -- @param #float timeInSec diff --git a/cocos/scripting/lua-bindings/auto/api/LoadingBar.lua b/cocos/scripting/lua-bindings/auto/api/LoadingBar.lua index 1e4ef4d088..a3c3dfbeeb 100644 --- a/cocos/scripting/lua-bindings/auto/api/LoadingBar.lua +++ b/cocos/scripting/lua-bindings/auto/api/LoadingBar.lua @@ -31,6 +31,12 @@ -- @param #int direction -- @return LoadingBar#LoadingBar self (return value: ccui.LoadingBar) +-------------------------------- +-- +-- @function [parent=#LoadingBar] getRenderFile +-- @param self +-- @return ResouceData#ResouceData ret (return value: cc.ResouceData) + -------------------------------- -- Enable scale9 renderer.
-- param enabled Set to true will use scale9 renderer, false otherwise. diff --git a/cocos/scripting/lua-bindings/auto/api/PUParticleSystem3D.lua b/cocos/scripting/lua-bindings/auto/api/PUParticleSystem3D.lua index fd0a4e634d..bb7a484be9 100644 --- a/cocos/scripting/lua-bindings/auto/api/PUParticleSystem3D.lua +++ b/cocos/scripting/lua-bindings/auto/api/PUParticleSystem3D.lua @@ -247,6 +247,13 @@ -- @param self -- @return PUParticleSystem3D#PUParticleSystem3D self (return value: cc.PUParticleSystem3D) +-------------------------------- +-- +-- @function [parent=#PUParticleSystem3D] initSystem +-- @param self +-- @param #string filePath +-- @return bool#bool ret (return value: bool) + -------------------------------- -- -- @function [parent=#PUParticleSystem3D] makeParticleLocal diff --git a/cocos/scripting/lua-bindings/auto/api/PageView.lua b/cocos/scripting/lua-bindings/auto/api/PageView.lua index 496a94045b..f323541202 100644 --- a/cocos/scripting/lua-bindings/auto/api/PageView.lua +++ b/cocos/scripting/lua-bindings/auto/api/PageView.lua @@ -1,67 +1,77 @@ -------------------------------- -- @module PageView --- @extend Layout +-- @extend ListView -- @parent_module ccui -------------------------------- --- brief Query the custom scroll threshold of the PageView.
--- return Custom scroll threshold in float. --- @function [parent=#PageView] getCustomScrollThreshold +-- brief Set space between page indicator's index nodes.
+-- param spaceBetweenIndexNodes Space between nodes in pixel. +-- @function [parent=#PageView] setIndicatorSpaceBetweenIndexNodes -- @param self --- @return float#float ret (return value: float) +-- @param #float spaceBetweenIndexNodes +-- @return PageView#PageView self (return value: ccui.PageView) + +-------------------------------- +-- brief Set color of page indicator's selected index.
+-- param spaceBetweenIndexNodes Space between nodes in pixel. +-- @function [parent=#PageView] setIndicatorSelectedIndexColor +-- @param self +-- @param #color3b_table color +-- @return PageView#PageView self (return value: ccui.PageView) + +-------------------------------- +-- brief Get the color of page indicator's selected index.
+-- return color +-- @function [parent=#PageView] getIndicatorSelectedIndexColor +-- @param self +-- @return color3b_table#color3b_table ret (return value: color3b_table) + +-------------------------------- +-- brief Get the page indicator's position as anchor point.
+-- return positionAsAnchorPoint +-- @function [parent=#PageView] getIndicatorPositionAsAnchorPoint +-- @param self +-- @return vec2_table#vec2_table ret (return value: vec2_table) + +-------------------------------- +-- brief Set the page indicator's position in page view.
+-- param position The position in page view +-- @function [parent=#PageView] setIndicatorPosition +-- @param self +-- @param #vec2_table position +-- @return PageView#PageView self (return value: ccui.PageView) + +-------------------------------- +-- brief Get the page indicator's position.
+-- return positionAsAnchorPoint +-- @function [parent=#PageView] getIndicatorPosition +-- @param self +-- @return vec2_table#vec2_table ret (return value: vec2_table) + +-------------------------------- +-- Insert a page into PageView at a given index.
+-- param page Page to be inserted.
+-- param idx A given index. +-- @function [parent=#PageView] insertPage +-- @param self +-- @param #ccui.Widget page +-- @param #int idx +-- @return PageView#PageView self (return value: ccui.PageView) -------------------------------- -- Gets current displayed page index.
-- return current page index. --- @function [parent=#PageView] getCurPageIndex +-- @function [parent=#PageView] getCurrentPageIndex -- @param self -- @return long#long ret (return value: long) --------------------------------- --- Changes scroll direction of PageView
--- see `Direction`
--- param direction Scroll direction enum.
--- since v3.8 --- @function [parent=#PageView] setDirection --- @param self --- @param #int direction --- @return PageView#PageView self (return value: ccui.PageView) - --------------------------------- --- Add a widget as a page of PageView in a given index.
--- param widget Widget to be added to pageview.
--- param pageIdx A given index.
--- param forceCreate If `forceCreate` is true and `widget` isn't exists, pageview would create a default page and add it. --- @function [parent=#PageView] addWidgetToPage --- @param self --- @param #ccui.Widget widget --- @param #long pageIdx --- @param #bool forceCreate --- @return PageView#PageView self (return value: ccui.PageView) - --------------------------------- --- brief Query whether use user defined scroll page threshold or not.
--- return True if using custom scroll threshold, false otherwise. --- @function [parent=#PageView] isUsingCustomScrollThreshold --- @param self --- @return bool#bool ret (return value: bool) - --------------------------------- --- Jump to a page with a given index without scrolling.
--- This is the different between scrollToPage.
--- param index A given index in PageView. Index start from 0 to pageCount -1. --- @function [parent=#PageView] setCurPageIndex --- @param self --- @param #long index --- @return PageView#PageView self (return value: ccui.PageView) - -------------------------------- -- Remove a page of PageView.
-- param page Page to be removed. -- @function [parent=#PageView] removePage -- @param self --- @param #ccui.Layout page +-- @param #ccui.Widget page -- @return PageView#PageView self (return value: ccui.PageView) -------------------------------- @@ -73,40 +83,20 @@ -- @return PageView#PageView self (return value: ccui.PageView) -------------------------------- --- brief Set using user defined scroll page threshold or not.
--- If you set it to false, then the default scroll threshold is pageView.width / 2
--- param flag True if using custom scroll threshold, false otherwise. --- @function [parent=#PageView] setUsingCustomScrollThreshold +-- Jump to a page with a given index without scrolling.
+-- This is the different between scrollToPage.
+-- param index A given index in PageView. Index start from 0 to pageCount -1. +-- @function [parent=#PageView] setCurrentPageIndex -- @param self --- @param #bool flag +-- @param #long index -- @return PageView#PageView self (return value: ccui.PageView) -------------------------------- --- brief If you don't specify the value, the pageView will turn page when scrolling at the half width of a page.
--- param threshold A threshold in float. --- @function [parent=#PageView] setCustomScrollThreshold +-- brief Query page indicator state.
+-- return True if page indicator is enabled, false otherwise. +-- @function [parent=#PageView] getIndicatorEnabled -- @param self --- @param #float threshold --- @return PageView#PageView self (return value: ccui.PageView) - --------------------------------- --- Insert a page into PageView at a given index.
--- param page Page to be inserted.
--- param idx A given index. --- @function [parent=#PageView] insertPage --- @param self --- @param #ccui.Layout page --- @param #int idx --- @return PageView#PageView self (return value: ccui.PageView) - --------------------------------- --- Query scroll direction of PageView.
--- see `Direction`
--- since v3.8
--- return PageView scroll direction. --- @function [parent=#PageView] getDirection --- @param self --- @return int#int ret (return value: int) +-- @return bool#bool ret (return value: bool) -------------------------------- -- Scroll to a page with a given index.
@@ -117,28 +107,43 @@ -- @return PageView#PageView self (return value: ccui.PageView) -------------------------------- --- brief Get a page at a given index
--- param index A given index.
--- return A layout pointer in PageView container. --- @function [parent=#PageView] getPage +-- brief Set the page indicator's position using anchor point.
+-- param positionAsAnchorPoint The position as anchor point. +-- @function [parent=#PageView] setIndicatorPositionAsAnchorPoint -- @param self --- @param #long index --- @return Layout#Layout ret (return value: ccui.Layout) - --------------------------------- --- Remove a page at a given index of PageView.
--- param index A given index. --- @function [parent=#PageView] removePageAtIndex --- @param self --- @param #long index +-- @param #vec2_table positionAsAnchorPoint -- @return PageView#PageView self (return value: ccui.PageView) -------------------------------- --- brief Get all the pages in the PageView.
--- return A vector of Layout pointers. --- @function [parent=#PageView] getPages +-- Scroll to a page with a given index.
+-- param idx A given index in the PageView. Index start from 0 to pageCount -1. +-- @function [parent=#PageView] scrollToItem -- @param self --- @return array_table#array_table ret (return value: array_table) +-- @param #long itemIndex +-- @return PageView#PageView self (return value: ccui.PageView) + +-------------------------------- +-- brief Toggle page indicator enabled.
+-- param enabled True if enable page indicator, false otherwise. +-- @function [parent=#PageView] setIndicatorEnabled +-- @param self +-- @param #bool enabled +-- @return PageView#PageView self (return value: ccui.PageView) + +-------------------------------- +-- Insert a page into the end of PageView.
+-- param page Page to be inserted. +-- @function [parent=#PageView] addPage +-- @param self +-- @param #ccui.Widget page +-- @return PageView#PageView self (return value: ccui.PageView) + +-------------------------------- +-- brief Get the space between page indicator's index nodes.
+-- return spaceBetweenIndexNodes +-- @function [parent=#PageView] getIndicatorSpaceBetweenIndexNodes +-- @param self +-- @return float#float ret (return value: float) -------------------------------- -- brief Remove all pages of the PageView. @@ -147,11 +152,11 @@ -- @return PageView#PageView self (return value: ccui.PageView) -------------------------------- --- Insert a page into the end of PageView.
--- param page Page to be inserted. --- @function [parent=#PageView] addPage +-- Remove a page at a given index of PageView.
+-- param index A given index. +-- @function [parent=#PageView] removePageAtIndex -- @param self --- @param #ccui.Layout page +-- @param #long index -- @return PageView#PageView self (return value: ccui.PageView) -------------------------------- @@ -169,21 +174,8 @@ -------------------------------- -- --- @function [parent=#PageView] getLayoutType +-- @function [parent=#PageView] doLayout -- @param self --- @return int#int ret (return value: int) - --------------------------------- --- --- @function [parent=#PageView] getDescription --- @param self --- @return string#string ret (return value: string) - --------------------------------- --- --- @function [parent=#PageView] update --- @param self --- @param #float dt -- @return PageView#PageView self (return value: ccui.PageView) -------------------------------- @@ -194,9 +186,17 @@ -------------------------------- -- --- @function [parent=#PageView] setLayoutType +-- @function [parent=#PageView] getDescription -- @param self --- @param #int type +-- @return string#string ret (return value: string) + +-------------------------------- +-- Changes direction
+-- Direction Direction::VERTICAL means vertical scroll, Direction::HORIZONTAL means horizontal scroll.
+-- param direction Set the page view's scroll direction. +-- @function [parent=#PageView] setDirection +-- @param self +-- @param #int direction -- @return PageView#PageView self (return value: ccui.PageView) -------------------------------- diff --git a/cocos/scripting/lua-bindings/auto/api/PolygonInfo.lua b/cocos/scripting/lua-bindings/auto/api/PolygonInfo.lua index 2be391e4b5..7a8be292b7 100644 --- a/cocos/scripting/lua-bindings/auto/api/PolygonInfo.lua +++ b/cocos/scripting/lua-bindings/auto/api/PolygonInfo.lua @@ -34,6 +34,16 @@ -- @param #cc.V3F_C4B_T2F_Quad quad -- @return PolygonInfo#PolygonInfo self (return value: cc.PolygonInfo) +-------------------------------- +-- set the data to be a pointer to a triangles
+-- the member verts will not be released when this PolygonInfo destructs
+-- as the verts memory are managed by other objects
+-- param triangles a pointer to the TrianglesCommand::Triangles object +-- @function [parent=#PolygonInfo] setTriangles +-- @param self +-- @param #cc.TrianglesCommand::Triangles triangles +-- @return PolygonInfo#PolygonInfo self (return value: cc.PolygonInfo) + -------------------------------- -- / @name Creators/ @{
-- Creates an empty Polygon info
diff --git a/cocos/scripting/lua-bindings/auto/api/RichElementNewLine.lua b/cocos/scripting/lua-bindings/auto/api/RichElementNewLine.lua new file mode 100644 index 0000000000..2d8483454f --- /dev/null +++ b/cocos/scripting/lua-bindings/auto/api/RichElementNewLine.lua @@ -0,0 +1,28 @@ + +-------------------------------- +-- @module RichElementNewLine +-- @extend RichElement +-- @parent_module ccui + +-------------------------------- +-- brief Create a RichElementNewLine with various arguments.
+-- param tag A integer tag value.
+-- param color A color in Color3B.
+-- param opacity A opacity in GLubyte.
+-- return A RichElementNewLine instance. +-- @function [parent=#RichElementNewLine] create +-- @param self +-- @param #int tag +-- @param #color3b_table color +-- @param #unsigned char opacity +-- @return RichElementNewLine#RichElementNewLine ret (return value: ccui.RichElementNewLine) + +-------------------------------- +-- brief Default constructor.
+-- js ctor
+-- lua new +-- @function [parent=#RichElementNewLine] RichElementNewLine +-- @param self +-- @return RichElementNewLine#RichElementNewLine self (return value: ccui.RichElementNewLine) + +return nil diff --git a/cocos/scripting/lua-bindings/auto/api/Scale9Sprite.lua b/cocos/scripting/lua-bindings/auto/api/Scale9Sprite.lua index 82476db54f..fa10b5dc92 100644 --- a/cocos/scripting/lua-bindings/auto/api/Scale9Sprite.lua +++ b/cocos/scripting/lua-bindings/auto/api/Scale9Sprite.lua @@ -128,6 +128,16 @@ -- @param #float topInset -- @return Scale9Sprite#Scale9Sprite self (return value: ccui.Scale9Sprite) +-------------------------------- +-- Set the slice sprite rendering type.
+-- When setting to SIMPLE, only 4 vertexes is used to rendering.
+-- otherwise 16 vertexes will be used to rendering.
+-- see RenderingType +-- @function [parent=#Scale9Sprite] setRenderingType +-- @param self +-- @param #int type +-- @return Scale9Sprite#Scale9Sprite self (return value: ccui.Scale9Sprite) + -------------------------------- -- @overload self, cc.Sprite, rect_table, rect_table -- @overload self, cc.Sprite, rect_table, bool, rect_table @@ -191,6 +201,18 @@ -- @param self -- @return bool#bool ret (return value: bool) +-------------------------------- +-- +-- @function [parent=#Scale9Sprite] resetRender +-- @param self +-- @return Scale9Sprite#Scale9Sprite self (return value: ccui.Scale9Sprite) + +-------------------------------- +-- Return the slice sprite rendering type. +-- @function [parent=#Scale9Sprite] getRenderingType +-- @param self +-- @return int#int ret (return value: int) + -------------------------------- -- brief Query the right sprite's cap inset.
-- return The right sprite's cap inset. @@ -344,6 +366,14 @@ -- @param #float scaleX -- @return Scale9Sprite#Scale9Sprite self (return value: ccui.Scale9Sprite) +-------------------------------- +-- +-- @function [parent=#Scale9Sprite] setCameraMask +-- @param self +-- @param #unsigned short mask +-- @param #bool applyChildren +-- @return Scale9Sprite#Scale9Sprite self (return value: ccui.Scale9Sprite) + -------------------------------- -- -- @function [parent=#Scale9Sprite] getScaleY @@ -356,25 +386,6 @@ -- @param self -- @return float#float ret (return value: float) --------------------------------- --- --- @function [parent=#Scale9Sprite] updateDisplayedOpacity --- @param self --- @param #unsigned char parentOpacity --- @return Scale9Sprite#Scale9Sprite self (return value: ccui.Scale9Sprite) - --------------------------------- --- --- @function [parent=#Scale9Sprite] init --- @param self --- @return bool#bool ret (return value: bool) - --------------------------------- --- --- @function [parent=#Scale9Sprite] cleanup --- @param self --- @return Scale9Sprite#Scale9Sprite self (return value: ccui.Scale9Sprite) - -------------------------------- -- @overload self, float, float -- @overload self, float @@ -386,12 +397,17 @@ -------------------------------- -- --- @function [parent=#Scale9Sprite] setCameraMask +-- @function [parent=#Scale9Sprite] updateDisplayedOpacity -- @param self --- @param #unsigned short mask --- @param #bool applyChildren +-- @param #unsigned char parentOpacity -- @return Scale9Sprite#Scale9Sprite self (return value: ccui.Scale9Sprite) +-------------------------------- +-- +-- @function [parent=#Scale9Sprite] init +-- @param self +-- @return bool#bool ret (return value: bool) + -------------------------------- -- -- @function [parent=#Scale9Sprite] updateDisplayedColor diff --git a/cocos/scripting/lua-bindings/auto/api/Slider.lua b/cocos/scripting/lua-bindings/auto/api/Slider.lua index 0690c50002..f7dc568e37 100644 --- a/cocos/scripting/lua-bindings/auto/api/Slider.lua +++ b/cocos/scripting/lua-bindings/auto/api/Slider.lua @@ -4,15 +4,6 @@ -- @extend Widget -- @parent_module ccui --------------------------------- --- Set a large value could give more control to the precision.
--- since v3.7
--- param percent The max percent of Slider. --- @function [parent=#Slider] setMaxPercent --- @param self --- @param #int percent --- @return Slider#Slider self (return value: ccui.Slider) - -------------------------------- -- Changes the progress direction of slider.
-- param percent Percent value from 1 to 100. @@ -21,16 +12,6 @@ -- @param #int percent -- @return Slider#Slider self (return value: ccui.Slider) --------------------------------- --- Load disabled state texture for slider ball.
--- param disabled Disabled state texture.
--- param resType @see TextureResType . --- @function [parent=#Slider] loadSlidBallTextureDisabled --- @param self --- @param #string disabled --- @param #int resType --- @return Slider#Slider self (return value: ccui.Slider) - -------------------------------- -- Query the maximum percent of Slider. The default value is 100.
-- since v3.7
@@ -49,16 +30,6 @@ -- @param #int resType -- @return Slider#Slider self (return value: ccui.Slider) --------------------------------- --- Load texture for slider bar.
--- param fileName File name of texture.
--- param resType @see TextureResType . --- @function [parent=#Slider] loadBarTexture --- @param self --- @param #string fileName --- @param #int resType --- @return Slider#Slider self (return value: ccui.Slider) - -------------------------------- -- Load dark state texture for slider progress bar.
-- param fileName File path of texture.
@@ -69,6 +40,41 @@ -- @param #int resType -- @return Slider#Slider self (return value: ccui.Slider) +-------------------------------- +-- +-- @function [parent=#Slider] getBallNormalFile +-- @param self +-- @return ResouceData#ResouceData ret (return value: cc.ResouceData) + +-------------------------------- +-- Gets capinsets for progress bar slider, if slider is using scale9 renderer.
+-- return Capinsets for progress bar slider.
+-- js NA +-- @function [parent=#Slider] getCapInsetsProgressBarRebderer +-- @param self +-- @return rect_table#rect_table ret (return value: rect_table) + +-------------------------------- +-- Sets if slider is using scale9 renderer.
+-- param able True that using scale9 renderer, false otherwise. +-- @function [parent=#Slider] setScale9Enabled +-- @param self +-- @param #bool able +-- @return Slider#Slider self (return value: ccui.Slider) + +-------------------------------- +-- +-- @function [parent=#Slider] getBallPressedFile +-- @param self +-- @return ResouceData#ResouceData ret (return value: cc.ResouceData) + +-------------------------------- +-- brief Return a zoom scale
+-- since v3.3 +-- @function [parent=#Slider] getZoomScale +-- @param self +-- @return float#float ret (return value: float) + -------------------------------- -- Load textures for slider ball.
-- param normal Normal state texture.
@@ -83,6 +89,69 @@ -- @param #int texType -- @return Slider#Slider self (return value: ccui.Slider) +-------------------------------- +-- Add call back function called when slider's percent has changed to slider.
+-- param callback An given call back function called when slider's percent has changed to slider. +-- @function [parent=#Slider] addEventListener +-- @param self +-- @param #function callback +-- @return Slider#Slider self (return value: ccui.Slider) + +-------------------------------- +-- Set a large value could give more control to the precision.
+-- since v3.7
+-- param percent The max percent of Slider. +-- @function [parent=#Slider] setMaxPercent +-- @param self +-- @param #int percent +-- @return Slider#Slider self (return value: ccui.Slider) + +-------------------------------- +-- Load texture for slider bar.
+-- param fileName File name of texture.
+-- param resType @see TextureResType . +-- @function [parent=#Slider] loadBarTexture +-- @param self +-- @param #string fileName +-- @param #int resType +-- @return Slider#Slider self (return value: ccui.Slider) + +-------------------------------- +-- +-- @function [parent=#Slider] getProgressBarFile +-- @param self +-- @return ResouceData#ResouceData ret (return value: cc.ResouceData) + +-------------------------------- +-- Gets capinsets for bar slider, if slider is using scale9 renderer.
+-- return capInsets Capinsets for bar slider. +-- @function [parent=#Slider] getCapInsetsBarRenderer +-- @param self +-- @return rect_table#rect_table ret (return value: rect_table) + +-------------------------------- +-- Load pressed state texture for slider ball.
+-- param pressed Pressed state texture.
+-- param resType @see TextureResType . +-- @function [parent=#Slider] loadSlidBallTexturePressed +-- @param self +-- @param #string pressed +-- @param #int resType +-- @return Slider#Slider self (return value: ccui.Slider) + +-------------------------------- +-- +-- @function [parent=#Slider] getBackFile +-- @param self +-- @return ResouceData#ResouceData ret (return value: cc.ResouceData) + +-------------------------------- +-- Gets If slider is using scale9 renderer.
+-- return True that using scale9 renderer, false otherwise. +-- @function [parent=#Slider] isScale9Enabled +-- @param self +-- @return bool#bool ret (return value: bool) + -------------------------------- -- Sets capinsets for progress bar slider, if slider is using scale9 renderer.
-- param capInsets Capinsets for progress bar slider.
@@ -101,29 +170,17 @@ -- @return Slider#Slider self (return value: ccui.Slider) -------------------------------- --- Gets capinsets for progress bar slider, if slider is using scale9 renderer.
--- return Capinsets for progress bar slider.
--- js NA --- @function [parent=#Slider] getCapInsetsProgressBarRebderer +-- +-- @function [parent=#Slider] getBallDisabeldFile -- @param self --- @return rect_table#rect_table ret (return value: rect_table) +-- @return ResouceData#ResouceData ret (return value: cc.ResouceData) -------------------------------- --- Sets if slider is using scale9 renderer.
--- param able True that using scale9 renderer, false otherwise. --- @function [parent=#Slider] setScale9Enabled +-- Gets the progress direction of slider.
+-- return percent Percent value from 1 to 100. +-- @function [parent=#Slider] getPercent -- @param self --- @param #bool able --- @return Slider#Slider self (return value: ccui.Slider) - --------------------------------- --- When user pressed the button, the button will zoom to a scale.
--- The final scale of the button equals (button original scale + _zoomScale)
--- since v3.3 --- @function [parent=#Slider] setZoomScale --- @param self --- @param #float scale --- @return Slider#Slider self (return value: ccui.Slider) +-- @return int#int ret (return value: int) -------------------------------- -- Sets capinsets for slider, if slider is using scale9 renderer.
@@ -134,50 +191,23 @@ -- @return Slider#Slider self (return value: ccui.Slider) -------------------------------- --- brief Return a zoom scale
--- since v3.3 --- @function [parent=#Slider] getZoomScale --- @param self --- @return float#float ret (return value: float) - --------------------------------- --- Add call back function called when slider's percent has changed to slider.
--- param callback An given call back function called when slider's percent has changed to slider. --- @function [parent=#Slider] addEventListener --- @param self --- @param #function callback --- @return Slider#Slider self (return value: ccui.Slider) - --------------------------------- --- Load pressed state texture for slider ball.
--- param pressed Pressed state texture.
+-- Load disabled state texture for slider ball.
+-- param disabled Disabled state texture.
-- param resType @see TextureResType . --- @function [parent=#Slider] loadSlidBallTexturePressed +-- @function [parent=#Slider] loadSlidBallTextureDisabled -- @param self --- @param #string pressed +-- @param #string disabled -- @param #int resType -- @return Slider#Slider self (return value: ccui.Slider) -------------------------------- --- Gets If slider is using scale9 renderer.
--- return True that using scale9 renderer, false otherwise. --- @function [parent=#Slider] isScale9Enabled +-- When user pressed the button, the button will zoom to a scale.
+-- The final scale of the button equals (button original scale + _zoomScale)
+-- since v3.3 +-- @function [parent=#Slider] setZoomScale -- @param self --- @return bool#bool ret (return value: bool) - --------------------------------- --- Gets capinsets for bar slider, if slider is using scale9 renderer.
--- return capInsets Capinsets for bar slider. --- @function [parent=#Slider] getCapInsetsBarRenderer --- @param self --- @return rect_table#rect_table ret (return value: rect_table) - --------------------------------- --- Gets the progress direction of slider.
--- return percent Percent value from 1 to 100. --- @function [parent=#Slider] getPercent --- @param self --- @return int#int ret (return value: int) +-- @param #float scale +-- @return Slider#Slider self (return value: ccui.Slider) -------------------------------- -- @overload self, string, string, int diff --git a/cocos/scripting/lua-bindings/auto/api/Terrain.lua b/cocos/scripting/lua-bindings/auto/api/Terrain.lua index 385372f31b..357fceef0f 100644 --- a/cocos/scripting/lua-bindings/auto/api/Terrain.lua +++ b/cocos/scripting/lua-bindings/auto/api/Terrain.lua @@ -8,7 +8,7 @@ -- initialize heightMap data -- @function [parent=#Terrain] initHeightMap -- @param self --- @param #char heightMap +-- @param #string heightMap -- @return bool#bool ret (return value: bool) -------------------------------- @@ -44,7 +44,7 @@ -- reset the heightmap data. -- @function [parent=#Terrain] resetHeightMap -- @param self --- @param #char heightMap +-- @param #string heightMap -- @return Terrain#Terrain self (return value: cc.Terrain) -------------------------------- diff --git a/cocos/scripting/lua-bindings/auto/api/TextAtlas.lua b/cocos/scripting/lua-bindings/auto/api/TextAtlas.lua index a1b2c1e83b..fd8cbf3523 100644 --- a/cocos/scripting/lua-bindings/auto/api/TextAtlas.lua +++ b/cocos/scripting/lua-bindings/auto/api/TextAtlas.lua @@ -26,6 +26,12 @@ -- @param #string value -- @return TextAtlas#TextAtlas self (return value: ccui.TextAtlas) +-------------------------------- +-- +-- @function [parent=#TextAtlas] getRenderFile +-- @param self +-- @return ResouceData#ResouceData ret (return value: cc.ResouceData) + -------------------------------- -- Initializes the LabelAtlas with a string, a char map file(the atlas), the width and height of each element and the starting char of the atlas.
-- param stringValue A given string needs to be displayed.
diff --git a/cocos/scripting/lua-bindings/auto/api/TextBMFont.lua b/cocos/scripting/lua-bindings/auto/api/TextBMFont.lua index 0d65d3eeb3..aa7b1e8157 100644 --- a/cocos/scripting/lua-bindings/auto/api/TextBMFont.lua +++ b/cocos/scripting/lua-bindings/auto/api/TextBMFont.lua @@ -4,13 +4,6 @@ -- @extend Widget -- @parent_module ccui --------------------------------- --- init a bitmap font atlas with an initial string and the FNT file --- @function [parent=#TextBMFont] setFntFile --- @param self --- @param #string fileName --- @return TextBMFont#TextBMFont self (return value: ccui.TextBMFont) - -------------------------------- -- Gets the string length of the label.
-- Note: This length will be larger than the raw string length,
@@ -20,6 +13,12 @@ -- @param self -- @return long#long ret (return value: long) +-------------------------------- +-- +-- @function [parent=#TextBMFont] getString +-- @param self +-- @return string#string ret (return value: string) + -------------------------------- -- -- @function [parent=#TextBMFont] setString @@ -29,9 +28,16 @@ -------------------------------- -- --- @function [parent=#TextBMFont] getString +-- @function [parent=#TextBMFont] getRenderFile -- @param self --- @return string#string ret (return value: string) +-- @return ResouceData#ResouceData ret (return value: cc.ResouceData) + +-------------------------------- +-- init a bitmap font atlas with an initial string and the FNT file +-- @function [parent=#TextBMFont] setFntFile +-- @param self +-- @param #string fileName +-- @return TextBMFont#TextBMFont self (return value: ccui.TextBMFont) -------------------------------- -- @overload self, string, string diff --git a/cocos/scripting/lua-bindings/auto/api/Widget.lua b/cocos/scripting/lua-bindings/auto/api/Widget.lua index 0a035ad5bd..e4cdc1ea47 100644 --- a/cocos/scripting/lua-bindings/auto/api/Widget.lua +++ b/cocos/scripting/lua-bindings/auto/api/Widget.lua @@ -376,13 +376,6 @@ -- @param self -- @return bool#bool ret (return value: bool) --------------------------------- --- Return a current focused widget in your UI scene.
--- No matter what widget object you call this method on , it will return you the exact one focused widget. --- @function [parent=#Widget] getCurrentFocusedWidget --- @param self --- @return Widget#Widget ret (return value: ccui.Widget) - -------------------------------- -- Checks a point is in widget's content space.
-- This function is used for determining touch area of widget.
@@ -551,6 +544,13 @@ -- @param #bool enable -- @return Widget#Widget self (return value: ccui.Widget) +-------------------------------- +-- Return a current focused widget in your UI scene.
+-- No matter what widget object you call this method on , it will return you the exact one focused widget. +-- @function [parent=#Widget] getCurrentFocusedWidget +-- @param self +-- @return Widget#Widget ret (return value: ccui.Widget) + -------------------------------- -- Create and return a empty Widget instance pointer. -- @function [parent=#Widget] create diff --git a/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_ui_auto_api.lua b/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_ui_auto_api.lua index 18f8e8be60..d41e40a9dc 100644 --- a/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_ui_auto_api.lua +++ b/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_ui_auto_api.lua @@ -126,6 +126,11 @@ -- @field [parent=#ccui] RichElementCustomNode#RichElementCustomNode RichElementCustomNode preloaded module +-------------------------------------------------------- +-- the ccui RichElementNewLine +-- @field [parent=#ccui] RichElementNewLine#RichElementNewLine RichElementNewLine preloaded module + + -------------------------------------------------------- -- the ccui RichText -- @field [parent=#ccui] RichText#RichText RichText preloaded module diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.cpp index 7200ac1752..03954153d2 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.cpp @@ -4969,9 +4969,9 @@ int lua_cocos2dx_3d_Terrain_initHeightMap(lua_State* tolua_S) argc = lua_gettop(tolua_S)-1; if (argc == 1) { - const char* arg0; + std::string arg0; - std::string arg0_tmp; ok &= luaval_to_std_string(tolua_S, 2, &arg0_tmp, "cc.Terrain:initHeightMap"); arg0 = arg0_tmp.c_str(); + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Terrain:initHeightMap"); if(!ok) { tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_3d_Terrain_initHeightMap'", nullptr); @@ -5220,9 +5220,9 @@ int lua_cocos2dx_3d_Terrain_resetHeightMap(lua_State* tolua_S) argc = lua_gettop(tolua_S)-1; if (argc == 1) { - const char* arg0; + std::string arg0; - std::string arg0_tmp; ok &= luaval_to_std_string(tolua_S, 2, &arg0_tmp, "cc.Terrain:resetHeightMap"); arg0 = arg0_tmp.c_str(); + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Terrain:resetHeightMap"); if(!ok) { tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_3d_Terrain_resetHeightMap'", nullptr); diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp index 6eead82ba4..53bbc062c0 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp @@ -20395,6 +20395,57 @@ int lua_cocos2dx_PolygonInfo_setQuad(lua_State* tolua_S) return 0; } +int lua_cocos2dx_PolygonInfo_setTriangles(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::PolygonInfo* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.PolygonInfo",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::PolygonInfo*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_PolygonInfo_setTriangles'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + cocos2d::TrianglesCommand::Triangles arg0; + + #pragma warning NO CONVERSION TO NATIVE FOR Triangles + ok = false; + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_PolygonInfo_setTriangles'", nullptr); + return 0; + } + cobj->setTriangles(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.PolygonInfo:setTriangles",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_PolygonInfo_setTriangles'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_PolygonInfo_constructor(lua_State* tolua_S) { int argc = 0; @@ -20447,6 +20498,7 @@ int lua_register_cocos2dx_PolygonInfo(lua_State* tolua_S) tolua_function(tolua_S,"getTriaglesCount",lua_cocos2dx_PolygonInfo_getTriaglesCount); tolua_function(tolua_S,"getVertCount",lua_cocos2dx_PolygonInfo_getVertCount); tolua_function(tolua_S,"setQuad",lua_cocos2dx_PolygonInfo_setQuad); + tolua_function(tolua_S,"setTriangles",lua_cocos2dx_PolygonInfo_setTriangles); tolua_endmodule(tolua_S); std::string typeName = typeid(cocos2d::PolygonInfo).name(); g_luaType[typeName] = "cc.PolygonInfo"; @@ -87288,56 +87340,6 @@ int lua_register_cocos2dx_Device(lua_State* tolua_S) return 1; } -int lua_cocos2dx_Application_openURL(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Application* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Application",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Application*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Application_openURL'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - std::string arg0; - - ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Application:openURL"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Application_openURL'", nullptr); - return 0; - } - bool ret = cobj->openURL(arg0); - tolua_pushboolean(tolua_S,(bool)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Application:openURL",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Application_openURL'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_Application_getTargetPlatform(lua_State* tolua_S) { int argc = 0; @@ -87479,6 +87481,103 @@ int lua_cocos2dx_Application_getCurrentLanguageCode(lua_State* tolua_S) return 0; } +int lua_cocos2dx_Application_openURL(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Application* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Application",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Application*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Application_openURL'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + std::string arg0; + + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Application:openURL"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Application_openURL'", nullptr); + return 0; + } + bool ret = cobj->openURL(arg0); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Application:openURL",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Application_openURL'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Application_getVersion(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Application* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Application",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Application*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Application_getVersion'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Application_getVersion'", nullptr); + return 0; + } + std::string ret = cobj->getVersion(); + tolua_pushcppstring(tolua_S,ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Application:getVersion",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Application_getVersion'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_Application_setAnimationInterval(lua_State* tolua_S) { int argc = 0; @@ -87575,10 +87674,11 @@ int lua_register_cocos2dx_Application(lua_State* tolua_S) tolua_cclass(tolua_S,"Application","cc.Application","",nullptr); tolua_beginmodule(tolua_S,"Application"); - tolua_function(tolua_S,"openURL",lua_cocos2dx_Application_openURL); tolua_function(tolua_S,"getTargetPlatform",lua_cocos2dx_Application_getTargetPlatform); tolua_function(tolua_S,"getCurrentLanguage",lua_cocos2dx_Application_getCurrentLanguage); tolua_function(tolua_S,"getCurrentLanguageCode",lua_cocos2dx_Application_getCurrentLanguageCode); + tolua_function(tolua_S,"openURL",lua_cocos2dx_Application_openURL); + tolua_function(tolua_S,"getVersion",lua_cocos2dx_Application_getVersion); tolua_function(tolua_S,"setAnimationInterval",lua_cocos2dx_Application_setAnimationInterval); tolua_function(tolua_S,"getInstance", lua_cocos2dx_Application_getInstance); tolua_endmodule(tolua_S); diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp index 7bb4e20b98..9cc34867e0 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp @@ -2148,6 +2148,8 @@ int register_all_cocos2dx(lua_State* tolua_S); + + diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_extension_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_extension_auto.cpp index 4b8b6b0660..895c676c35 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_extension_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_extension_auto.cpp @@ -15800,6 +15800,56 @@ int lua_cocos2dx_extension_PUParticleSystem3D_removeAllListener(lua_State* tolua return 0; } +int lua_cocos2dx_extension_PUParticleSystem3D_initSystem(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::PUParticleSystem3D* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.PUParticleSystem3D",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::PUParticleSystem3D*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_extension_PUParticleSystem3D_initSystem'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + std::string arg0; + + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.PUParticleSystem3D:initSystem"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_extension_PUParticleSystem3D_initSystem'", nullptr); + return 0; + } + bool ret = cobj->initSystem(arg0); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.PUParticleSystem3D:initSystem",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_extension_PUParticleSystem3D_initSystem'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_extension_PUParticleSystem3D_makeParticleLocal(lua_State* tolua_S) { int argc = 0; @@ -16146,6 +16196,7 @@ int lua_register_cocos2dx_extension_PUParticleSystem3D(lua_State* tolua_S) tolua_function(tolua_S,"getDerivedScale",lua_cocos2dx_extension_PUParticleSystem3D_getDerivedScale); tolua_function(tolua_S,"setDefaultHeight",lua_cocos2dx_extension_PUParticleSystem3D_setDefaultHeight); tolua_function(tolua_S,"removeAllListener",lua_cocos2dx_extension_PUParticleSystem3D_removeAllListener); + tolua_function(tolua_S,"initSystem",lua_cocos2dx_extension_PUParticleSystem3D_initSystem); tolua_function(tolua_S,"makeParticleLocal",lua_cocos2dx_extension_PUParticleSystem3D_makeParticleLocal); tolua_function(tolua_S,"removerAllObserver",lua_cocos2dx_extension_PUParticleSystem3D_removerAllObserver); tolua_function(tolua_S,"setDefaultDepth",lua_cocos2dx_extension_PUParticleSystem3D_setDefaultDepth); diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_extension_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_extension_auto.hpp index f309a39591..c7a29df579 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_extension_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_extension_auto.hpp @@ -341,6 +341,7 @@ int register_all_cocos2dx_extension(lua_State* tolua_S); + #endif // __cocos2dx_extension_h__ diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp index c956bd8395..ca84a01a97 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp @@ -3102,53 +3102,6 @@ int lua_cocos2dx_ui_Widget_isPropagateTouchEvents(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_Widget_getCurrentFocusedWidget(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::ui::Widget* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"ccui.Widget",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::ui::Widget*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getCurrentFocusedWidget'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Widget_getCurrentFocusedWidget'", nullptr); - return 0; - } - cocos2d::ui::Widget* ret = cobj->getCurrentFocusedWidget(); - object_to_luaval(tolua_S, "ccui.Widget",(cocos2d::ui::Widget*)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Widget:getCurrentFocusedWidget",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getCurrentFocusedWidget'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_ui_Widget_hitTest(lua_State* tolua_S) { int argc = 0; @@ -4127,6 +4080,40 @@ int lua_cocos2dx_ui_Widget_enableDpadNavigation(lua_State* tolua_S) #endif return 0; } +int lua_cocos2dx_ui_Widget_getCurrentFocusedWidget(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,"ccui.Widget",0,&tolua_err)) goto tolua_lerror; +#endif + + argc = lua_gettop(tolua_S) - 1; + + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Widget_getCurrentFocusedWidget'", nullptr); + return 0; + } + cocos2d::ui::Widget* ret = cocos2d::ui::Widget::getCurrentFocusedWidget(); + object_to_luaval(tolua_S, "ccui.Widget",(cocos2d::ui::Widget*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d\n ", "ccui.Widget:getCurrentFocusedWidget",argc, 0); + return 0; +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getCurrentFocusedWidget'.",&tolua_err); +#endif + return 0; +} int lua_cocos2dx_ui_Widget_create(lua_State* tolua_S) { int argc = 0; @@ -4257,7 +4244,6 @@ int lua_register_cocos2dx_ui_Widget(lua_State* tolua_S) tolua_function(tolua_S,"dispatchFocusEvent",lua_cocos2dx_ui_Widget_dispatchFocusEvent); tolua_function(tolua_S,"setUnifySizeEnabled",lua_cocos2dx_ui_Widget_setUnifySizeEnabled); tolua_function(tolua_S,"isPropagateTouchEvents",lua_cocos2dx_ui_Widget_isPropagateTouchEvents); - tolua_function(tolua_S,"getCurrentFocusedWidget",lua_cocos2dx_ui_Widget_getCurrentFocusedWidget); tolua_function(tolua_S,"hitTest",lua_cocos2dx_ui_Widget_hitTest); tolua_function(tolua_S,"isLayoutComponentEnabled",lua_cocos2dx_ui_Widget_isLayoutComponentEnabled); tolua_function(tolua_S,"requestFocus",lua_cocos2dx_ui_Widget_requestFocus); @@ -4278,6 +4264,7 @@ int lua_register_cocos2dx_ui_Widget(lua_State* tolua_S) tolua_function(tolua_S,"setCallbackType",lua_cocos2dx_ui_Widget_setCallbackType); tolua_function(tolua_S,"isSwallowTouches",lua_cocos2dx_ui_Widget_isSwallowTouches); tolua_function(tolua_S,"enableDpadNavigation", lua_cocos2dx_ui_Widget_enableDpadNavigation); + tolua_function(tolua_S,"getCurrentFocusedWidget", lua_cocos2dx_ui_Widget_getCurrentFocusedWidget); tolua_function(tolua_S,"create", lua_cocos2dx_ui_Widget_create); tolua_endmodule(tolua_S); std::string typeName = typeid(cocos2d::ui::Widget).name(); @@ -4630,6 +4617,53 @@ int lua_cocos2dx_ui_Layout_getClippingType(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_Layout_getRenderFile(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Layout* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Layout",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Layout*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Layout_getRenderFile'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Layout_getRenderFile'", nullptr); + return 0; + } + cocos2d::ResouceData ret = cobj->getRenderFile(); + #pragma warning NO CONVERSION FROM NATIVE FOR ResouceData; + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Layout:getRenderFile",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Layout_getRenderFile'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_Layout_isLoopFocus(lua_State* tolua_S) { int argc = 0; @@ -6030,6 +6064,7 @@ int lua_register_cocos2dx_ui_Layout(lua_State* tolua_S) tolua_function(tolua_S,"setBackGroundImageColor",lua_cocos2dx_ui_Layout_setBackGroundImageColor); tolua_function(tolua_S,"getBackGroundColorVector",lua_cocos2dx_ui_Layout_getBackGroundColorVector); tolua_function(tolua_S,"getClippingType",lua_cocos2dx_ui_Layout_getClippingType); + tolua_function(tolua_S,"getRenderFile",lua_cocos2dx_ui_Layout_getRenderFile); tolua_function(tolua_S,"isLoopFocus",lua_cocos2dx_ui_Layout_isLoopFocus); tolua_function(tolua_S,"removeBackGroundImage",lua_cocos2dx_ui_Layout_removeBackGroundImage); tolua_function(tolua_S,"getBackGroundColorOpacity",lua_cocos2dx_ui_Layout_getBackGroundColorOpacity); @@ -6209,6 +6244,53 @@ int lua_cocos2dx_ui_Button_setTitleFontSize(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_Button_resetPressedRender(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Button* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Button",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Button*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Button_resetPressedRender'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Button_resetPressedRender'", nullptr); + return 0; + } + cobj->resetPressedRender(); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Button:resetPressedRender",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Button_resetPressedRender'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_Button_setScale9Enabled(lua_State* tolua_S) { int argc = 0; @@ -6259,6 +6341,53 @@ int lua_cocos2dx_ui_Button_setScale9Enabled(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_Button_resetDisabledRender(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Button* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Button",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Button*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Button_resetDisabledRender'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Button_resetDisabledRender'", nullptr); + return 0; + } + cobj->resetDisabledRender(); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Button:resetDisabledRender",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Button_resetDisabledRender'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_Button_getTitleRenderer(lua_State* tolua_S) { int argc = 0; @@ -6353,6 +6482,53 @@ int lua_cocos2dx_ui_Button_getRendererClicked(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_Button_getDisabledFile(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Button* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Button",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Button*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Button_getDisabledFile'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Button_getDisabledFile'", nullptr); + return 0; + } + cocos2d::ResouceData ret = cobj->getDisabledFile(); + #pragma warning NO CONVERSION FROM NATIVE FOR ResouceData; + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Button:getDisabledFile",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Button_getDisabledFile'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_Button_getZoomScale(lua_State* tolua_S) { int argc = 0; @@ -6497,6 +6673,100 @@ int lua_cocos2dx_ui_Button_setTitleColor(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_Button_getNormalFile(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Button* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Button",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Button*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Button_getNormalFile'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Button_getNormalFile'", nullptr); + return 0; + } + cocos2d::ResouceData ret = cobj->getNormalFile(); + #pragma warning NO CONVERSION FROM NATIVE FOR ResouceData; + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Button:getNormalFile",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Button_getNormalFile'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_Button_resetNormalRender(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Button* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Button",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Button*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Button_resetNormalRender'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Button_resetNormalRender'", nullptr); + return 0; + } + cobj->resetNormalRender(); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Button:resetNormalRender",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Button_resetNormalRender'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_Button_getRendererDisabled(lua_State* tolua_S) { int argc = 0; @@ -7451,6 +7721,53 @@ int lua_cocos2dx_ui_Button_setCapInsetsPressedRenderer(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_Button_getPressedFile(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Button* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Button",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Button*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Button_getPressedFile'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Button_getPressedFile'", nullptr); + return 0; + } + cocos2d::ResouceData ret = cobj->getPressedFile(); + #pragma warning NO CONVERSION FROM NATIVE FOR ResouceData; + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Button:getPressedFile",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Button_getPressedFile'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_Button_getTitleFontSize(lua_State* tolua_S) { int argc = 0; @@ -7928,12 +8245,17 @@ int lua_register_cocos2dx_ui_Button(lua_State* tolua_S) tolua_function(tolua_S,"getNormalTextureSize",lua_cocos2dx_ui_Button_getNormalTextureSize); tolua_function(tolua_S,"getTitleText",lua_cocos2dx_ui_Button_getTitleText); tolua_function(tolua_S,"setTitleFontSize",lua_cocos2dx_ui_Button_setTitleFontSize); + tolua_function(tolua_S,"resetPressedRender",lua_cocos2dx_ui_Button_resetPressedRender); tolua_function(tolua_S,"setScale9Enabled",lua_cocos2dx_ui_Button_setScale9Enabled); + tolua_function(tolua_S,"resetDisabledRender",lua_cocos2dx_ui_Button_resetDisabledRender); tolua_function(tolua_S,"getTitleRenderer",lua_cocos2dx_ui_Button_getTitleRenderer); tolua_function(tolua_S,"getRendererClicked",lua_cocos2dx_ui_Button_getRendererClicked); + tolua_function(tolua_S,"getDisabledFile",lua_cocos2dx_ui_Button_getDisabledFile); tolua_function(tolua_S,"getZoomScale",lua_cocos2dx_ui_Button_getZoomScale); tolua_function(tolua_S,"getCapInsetsDisabledRenderer",lua_cocos2dx_ui_Button_getCapInsetsDisabledRenderer); tolua_function(tolua_S,"setTitleColor",lua_cocos2dx_ui_Button_setTitleColor); + tolua_function(tolua_S,"getNormalFile",lua_cocos2dx_ui_Button_getNormalFile); + tolua_function(tolua_S,"resetNormalRender",lua_cocos2dx_ui_Button_resetNormalRender); tolua_function(tolua_S,"getRendererDisabled",lua_cocos2dx_ui_Button_getRendererDisabled); tolua_function(tolua_S,"setCapInsetsDisabledRenderer",lua_cocos2dx_ui_Button_setCapInsetsDisabledRenderer); tolua_function(tolua_S,"setCapInsets",lua_cocos2dx_ui_Button_setCapInsets); @@ -7950,6 +8272,7 @@ int lua_register_cocos2dx_ui_Button(lua_State* tolua_S) tolua_function(tolua_S,"isScale9Enabled",lua_cocos2dx_ui_Button_isScale9Enabled); tolua_function(tolua_S,"loadTextureNormal",lua_cocos2dx_ui_Button_loadTextureNormal); tolua_function(tolua_S,"setCapInsetsPressedRenderer",lua_cocos2dx_ui_Button_setCapInsetsPressedRenderer); + tolua_function(tolua_S,"getPressedFile",lua_cocos2dx_ui_Button_getPressedFile); tolua_function(tolua_S,"getTitleFontSize",lua_cocos2dx_ui_Button_getTitleFontSize); tolua_function(tolua_S,"getRendererNormal",lua_cocos2dx_ui_Button_getRendererNormal); tolua_function(tolua_S,"getTitleFontName",lua_cocos2dx_ui_Button_getTitleFontName); @@ -7965,6 +8288,100 @@ int lua_register_cocos2dx_ui_Button(lua_State* tolua_S) return 1; } +int lua_cocos2dx_ui_AbstractCheckButton_getBackDisabledFile(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::AbstractCheckButton* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.AbstractCheckButton",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::AbstractCheckButton*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_AbstractCheckButton_getBackDisabledFile'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_AbstractCheckButton_getBackDisabledFile'", nullptr); + return 0; + } + cocos2d::ResouceData ret = cobj->getBackDisabledFile(); + #pragma warning NO CONVERSION FROM NATIVE FOR ResouceData; + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.AbstractCheckButton:getBackDisabledFile",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_AbstractCheckButton_getBackDisabledFile'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_AbstractCheckButton_getCrossDisabeldFile(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::AbstractCheckButton* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.AbstractCheckButton",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::AbstractCheckButton*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_AbstractCheckButton_getCrossDisabeldFile'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_AbstractCheckButton_getCrossDisabeldFile'", nullptr); + return 0; + } + cocos2d::ResouceData ret = cobj->getCrossDisabeldFile(); + #pragma warning NO CONVERSION FROM NATIVE FOR ResouceData; + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.AbstractCheckButton:getCrossDisabeldFile",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_AbstractCheckButton_getCrossDisabeldFile'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_AbstractCheckButton_loadTextureBackGroundSelected(lua_State* tolua_S) { int argc = 0; @@ -8099,6 +8516,53 @@ int lua_cocos2dx_ui_AbstractCheckButton_loadTextureBackGroundDisabled(lua_State* return 0; } +int lua_cocos2dx_ui_AbstractCheckButton_getCrossNormalFile(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::AbstractCheckButton* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.AbstractCheckButton",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::AbstractCheckButton*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_AbstractCheckButton_getCrossNormalFile'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_AbstractCheckButton_getCrossNormalFile'", nullptr); + return 0; + } + cocos2d::ResouceData ret = cobj->getCrossNormalFile(); + #pragma warning NO CONVERSION FROM NATIVE FOR ResouceData; + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.AbstractCheckButton:getCrossNormalFile",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_AbstractCheckButton_getCrossNormalFile'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_AbstractCheckButton_setSelected(lua_State* tolua_S) { int argc = 0; @@ -8149,6 +8613,53 @@ int lua_cocos2dx_ui_AbstractCheckButton_setSelected(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_AbstractCheckButton_getBackPressedFile(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::AbstractCheckButton* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.AbstractCheckButton",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::AbstractCheckButton*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_AbstractCheckButton_getBackPressedFile'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_AbstractCheckButton_getBackPressedFile'", nullptr); + return 0; + } + cocos2d::ResouceData ret = cobj->getBackPressedFile(); + #pragma warning NO CONVERSION FROM NATIVE FOR ResouceData; + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.AbstractCheckButton:getBackPressedFile",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_AbstractCheckButton_getBackPressedFile'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_AbstractCheckButton_getRendererFrontCrossDisabled(lua_State* tolua_S) { int argc = 0; @@ -8495,6 +9006,53 @@ int lua_cocos2dx_ui_AbstractCheckButton_init(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_AbstractCheckButton_getBackNormalFile(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::AbstractCheckButton* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.AbstractCheckButton",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::AbstractCheckButton*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_AbstractCheckButton_getBackNormalFile'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_AbstractCheckButton_getBackNormalFile'", nullptr); + return 0; + } + cocos2d::ResouceData ret = cobj->getBackNormalFile(); + #pragma warning NO CONVERSION FROM NATIVE FOR ResouceData; + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.AbstractCheckButton:getBackNormalFile",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_AbstractCheckButton_getBackNormalFile'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_AbstractCheckButton_loadTextures(lua_State* tolua_S) { int argc = 0; @@ -8923,15 +9481,20 @@ int lua_register_cocos2dx_ui_AbstractCheckButton(lua_State* tolua_S) tolua_cclass(tolua_S,"AbstractCheckButton","ccui.AbstractCheckButton","ccui.Widget",nullptr); tolua_beginmodule(tolua_S,"AbstractCheckButton"); + tolua_function(tolua_S,"getBackDisabledFile",lua_cocos2dx_ui_AbstractCheckButton_getBackDisabledFile); + tolua_function(tolua_S,"getCrossDisabeldFile",lua_cocos2dx_ui_AbstractCheckButton_getCrossDisabeldFile); tolua_function(tolua_S,"loadTextureBackGroundSelected",lua_cocos2dx_ui_AbstractCheckButton_loadTextureBackGroundSelected); tolua_function(tolua_S,"loadTextureBackGroundDisabled",lua_cocos2dx_ui_AbstractCheckButton_loadTextureBackGroundDisabled); + tolua_function(tolua_S,"getCrossNormalFile",lua_cocos2dx_ui_AbstractCheckButton_getCrossNormalFile); tolua_function(tolua_S,"setSelected",lua_cocos2dx_ui_AbstractCheckButton_setSelected); + tolua_function(tolua_S,"getBackPressedFile",lua_cocos2dx_ui_AbstractCheckButton_getBackPressedFile); tolua_function(tolua_S,"getRendererFrontCrossDisabled",lua_cocos2dx_ui_AbstractCheckButton_getRendererFrontCrossDisabled); tolua_function(tolua_S,"getRendererBackground",lua_cocos2dx_ui_AbstractCheckButton_getRendererBackground); tolua_function(tolua_S,"loadTextureFrontCross",lua_cocos2dx_ui_AbstractCheckButton_loadTextureFrontCross); tolua_function(tolua_S,"getRendererBackgroundDisabled",lua_cocos2dx_ui_AbstractCheckButton_getRendererBackgroundDisabled); tolua_function(tolua_S,"isSelected",lua_cocos2dx_ui_AbstractCheckButton_isSelected); tolua_function(tolua_S,"init",lua_cocos2dx_ui_AbstractCheckButton_init); + tolua_function(tolua_S,"getBackNormalFile",lua_cocos2dx_ui_AbstractCheckButton_getBackNormalFile); tolua_function(tolua_S,"loadTextures",lua_cocos2dx_ui_AbstractCheckButton_loadTextures); tolua_function(tolua_S,"getZoomScale",lua_cocos2dx_ui_AbstractCheckButton_getZoomScale); tolua_function(tolua_S,"getRendererFrontCross",lua_cocos2dx_ui_AbstractCheckButton_getRendererFrontCross); @@ -10421,6 +10984,53 @@ int lua_cocos2dx_ui_ImageView_setCapInsets(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_ImageView_getRenderFile(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::ImageView* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.ImageView",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::ImageView*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ImageView_getRenderFile'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ImageView_getRenderFile'", nullptr); + return 0; + } + cocos2d::ResouceData ret = cobj->getRenderFile(); + #pragma warning NO CONVERSION FROM NATIVE FOR ResouceData; + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ImageView:getRenderFile",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ImageView_getRenderFile'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_ImageView_getCapInsets(lua_State* tolua_S) { int argc = 0; @@ -10665,6 +11275,7 @@ int lua_register_cocos2dx_ui_ImageView(lua_State* tolua_S) tolua_function(tolua_S,"setScale9Enabled",lua_cocos2dx_ui_ImageView_setScale9Enabled); tolua_function(tolua_S,"setTextureRect",lua_cocos2dx_ui_ImageView_setTextureRect); tolua_function(tolua_S,"setCapInsets",lua_cocos2dx_ui_ImageView_setCapInsets); + tolua_function(tolua_S,"getRenderFile",lua_cocos2dx_ui_ImageView_getRenderFile); tolua_function(tolua_S,"getCapInsets",lua_cocos2dx_ui_ImageView_getCapInsets); tolua_function(tolua_S,"isScale9Enabled",lua_cocos2dx_ui_ImageView_isScale9Enabled); tolua_function(tolua_S,"create", lua_cocos2dx_ui_ImageView_create); @@ -12227,6 +12838,53 @@ int lua_cocos2dx_ui_TextAtlas_setString(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_TextAtlas_getRenderFile(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::TextAtlas* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.TextAtlas",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::TextAtlas*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_TextAtlas_getRenderFile'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_TextAtlas_getRenderFile'", nullptr); + return 0; + } + cocos2d::ResouceData ret = cobj->getRenderFile(); + #pragma warning NO CONVERSION FROM NATIVE FOR ResouceData; + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.TextAtlas:getRenderFile",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_TextAtlas_getRenderFile'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_TextAtlas_setProperty(lua_State* tolua_S) { int argc = 0; @@ -12480,6 +13138,7 @@ int lua_register_cocos2dx_ui_TextAtlas(lua_State* tolua_S) tolua_function(tolua_S,"getStringLength",lua_cocos2dx_ui_TextAtlas_getStringLength); tolua_function(tolua_S,"getString",lua_cocos2dx_ui_TextAtlas_getString); tolua_function(tolua_S,"setString",lua_cocos2dx_ui_TextAtlas_setString); + tolua_function(tolua_S,"getRenderFile",lua_cocos2dx_ui_TextAtlas_getRenderFile); tolua_function(tolua_S,"setProperty",lua_cocos2dx_ui_TextAtlas_setProperty); tolua_function(tolua_S,"adaptRenderers",lua_cocos2dx_ui_TextAtlas_adaptRenderers); tolua_function(tolua_S,"create", lua_cocos2dx_ui_TextAtlas_create); @@ -12658,6 +13317,53 @@ int lua_cocos2dx_ui_LoadingBar_setDirection(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_LoadingBar_getRenderFile(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::LoadingBar* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.LoadingBar",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::LoadingBar*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_LoadingBar_getRenderFile'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_LoadingBar_getRenderFile'", nullptr); + return 0; + } + cocos2d::ResouceData ret = cobj->getRenderFile(); + #pragma warning NO CONVERSION FROM NATIVE FOR ResouceData; + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.LoadingBar:getRenderFile",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_LoadingBar_getRenderFile'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_LoadingBar_setScale9Enabled(lua_State* tolua_S) { int argc = 0; @@ -13129,6 +13835,7 @@ int lua_register_cocos2dx_ui_LoadingBar(lua_State* tolua_S) tolua_function(tolua_S,"setPercent",lua_cocos2dx_ui_LoadingBar_setPercent); tolua_function(tolua_S,"loadTexture",lua_cocos2dx_ui_LoadingBar_loadTexture); tolua_function(tolua_S,"setDirection",lua_cocos2dx_ui_LoadingBar_setDirection); + tolua_function(tolua_S,"getRenderFile",lua_cocos2dx_ui_LoadingBar_getRenderFile); tolua_function(tolua_S,"setScale9Enabled",lua_cocos2dx_ui_LoadingBar_setScale9Enabled); tolua_function(tolua_S,"setCapInsets",lua_cocos2dx_ui_LoadingBar_setCapInsets); tolua_function(tolua_S,"getDirection",lua_cocos2dx_ui_LoadingBar_getDirection); @@ -16118,11 +16825,11 @@ int lua_cocos2dx_ui_ListView_jumpToItem(lua_State* tolua_S) argc = lua_gettop(tolua_S)-1; if (argc == 3) { - int arg0; + ssize_t arg0; cocos2d::Vec2 arg1; cocos2d::Vec2 arg2; - ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccui.ListView:jumpToItem"); + ok &= luaval_to_ssize(tolua_S, 2, &arg0, "ccui.ListView:jumpToItem"); ok &= luaval_to_vec2(tolua_S, 3, &arg1, "ccui.ListView:jumpToItem"); @@ -16952,8 +17659,8 @@ int lua_cocos2dx_ui_ListView_scrollToItem(lua_State* tolua_S) argc = lua_gettop(tolua_S)-1; do{ if (argc == 4) { - int arg0; - ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccui.ListView:scrollToItem"); + ssize_t arg0; + ok &= luaval_to_ssize(tolua_S, 2, &arg0, "ccui.ListView:scrollToItem"); if (!ok) { break; } cocos2d::Vec2 arg1; @@ -16976,8 +17683,8 @@ int lua_cocos2dx_ui_ListView_scrollToItem(lua_State* tolua_S) ok = true; do{ if (argc == 3) { - int arg0; - ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccui.ListView:scrollToItem"); + ssize_t arg0; + ok &= luaval_to_ssize(tolua_S, 2, &arg0, "ccui.ListView:scrollToItem"); if (!ok) { break; } cocos2d::Vec2 arg1; @@ -17511,56 +18218,6 @@ int lua_register_cocos2dx_ui_ListView(lua_State* tolua_S) return 1; } -int lua_cocos2dx_ui_Slider_setMaxPercent(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::ui::Slider* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"ccui.Slider",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::ui::Slider*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_setMaxPercent'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - int arg0; - - ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccui.Slider:setMaxPercent"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_setMaxPercent'", nullptr); - return 0; - } - cobj->setMaxPercent(arg0); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:setMaxPercent",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_setMaxPercent'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_ui_Slider_setPercent(lua_State* tolua_S) { int argc = 0; @@ -17611,73 +18268,6 @@ int lua_cocos2dx_ui_Slider_setPercent(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_Slider_loadSlidBallTextureDisabled(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::ui::Slider* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"ccui.Slider",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::ui::Slider*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_loadSlidBallTextureDisabled'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - std::string arg0; - - ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccui.Slider:loadSlidBallTextureDisabled"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_loadSlidBallTextureDisabled'", nullptr); - return 0; - } - cobj->loadSlidBallTextureDisabled(arg0); - lua_settop(tolua_S, 1); - return 1; - } - if (argc == 2) - { - std::string arg0; - cocos2d::ui::Widget::TextureResType arg1; - - ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccui.Slider:loadSlidBallTextureDisabled"); - - ok &= luaval_to_int32(tolua_S, 3,(int *)&arg1, "ccui.Slider:loadSlidBallTextureDisabled"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_loadSlidBallTextureDisabled'", nullptr); - return 0; - } - cobj->loadSlidBallTextureDisabled(arg0, arg1); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:loadSlidBallTextureDisabled",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_loadSlidBallTextureDisabled'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_ui_Slider_getMaxPercent(lua_State* tolua_S) { int argc = 0; @@ -17792,73 +18382,6 @@ int lua_cocos2dx_ui_Slider_loadSlidBallTextureNormal(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_Slider_loadBarTexture(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::ui::Slider* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"ccui.Slider",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::ui::Slider*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_loadBarTexture'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - std::string arg0; - - ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccui.Slider:loadBarTexture"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_loadBarTexture'", nullptr); - return 0; - } - cobj->loadBarTexture(arg0); - lua_settop(tolua_S, 1); - return 1; - } - if (argc == 2) - { - std::string arg0; - cocos2d::ui::Widget::TextureResType arg1; - - ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccui.Slider:loadBarTexture"); - - ok &= luaval_to_int32(tolua_S, 3,(int *)&arg1, "ccui.Slider:loadBarTexture"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_loadBarTexture'", nullptr); - return 0; - } - cobj->loadBarTexture(arg0, arg1); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:loadBarTexture",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_loadBarTexture'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_ui_Slider_loadProgressBarTexture(lua_State* tolua_S) { int argc = 0; @@ -17926,6 +18449,244 @@ int lua_cocos2dx_ui_Slider_loadProgressBarTexture(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_Slider_getBallNormalFile(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Slider* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Slider",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Slider*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_getBallNormalFile'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_getBallNormalFile'", nullptr); + return 0; + } + cocos2d::ResouceData ret = cobj->getBallNormalFile(); + #pragma warning NO CONVERSION FROM NATIVE FOR ResouceData; + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:getBallNormalFile",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_getBallNormalFile'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Slider* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Slider",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Slider*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer'", nullptr); + return 0; + } + const cocos2d::Rect& ret = cobj->getCapInsetsProgressBarRebderer(); + rect_to_luaval(tolua_S, ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:getCapInsetsProgressBarRebderer",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_Slider_setScale9Enabled(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Slider* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Slider",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Slider*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_setScale9Enabled'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + bool arg0; + + ok &= luaval_to_boolean(tolua_S, 2,&arg0, "ccui.Slider:setScale9Enabled"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_setScale9Enabled'", nullptr); + return 0; + } + cobj->setScale9Enabled(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:setScale9Enabled",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_setScale9Enabled'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_Slider_getBallPressedFile(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Slider* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Slider",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Slider*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_getBallPressedFile'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_getBallPressedFile'", nullptr); + return 0; + } + cocos2d::ResouceData ret = cobj->getBallPressedFile(); + #pragma warning NO CONVERSION FROM NATIVE FOR ResouceData; + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:getBallPressedFile",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_getBallPressedFile'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_Slider_getZoomScale(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Slider* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Slider",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Slider*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_getZoomScale'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_getZoomScale'", nullptr); + return 0; + } + double ret = cobj->getZoomScale(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:getZoomScale",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_getZoomScale'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_Slider_loadSlidBallTextures(lua_State* tolua_S) { int argc = 0; @@ -18036,6 +18797,432 @@ int lua_cocos2dx_ui_Slider_loadSlidBallTextures(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_Slider_addEventListener(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Slider* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Slider",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Slider*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_addEventListener'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + std::function arg0; + + do { + // Lambda binding for lua is not supported. + assert(false); + } while(0) + ; + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_addEventListener'", nullptr); + return 0; + } + cobj->addEventListener(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:addEventListener",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_addEventListener'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_Slider_setMaxPercent(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Slider* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Slider",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Slider*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_setMaxPercent'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + int arg0; + + ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccui.Slider:setMaxPercent"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_setMaxPercent'", nullptr); + return 0; + } + cobj->setMaxPercent(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:setMaxPercent",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_setMaxPercent'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_Slider_loadBarTexture(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Slider* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Slider",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Slider*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_loadBarTexture'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + std::string arg0; + + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccui.Slider:loadBarTexture"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_loadBarTexture'", nullptr); + return 0; + } + cobj->loadBarTexture(arg0); + lua_settop(tolua_S, 1); + return 1; + } + if (argc == 2) + { + std::string arg0; + cocos2d::ui::Widget::TextureResType arg1; + + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccui.Slider:loadBarTexture"); + + ok &= luaval_to_int32(tolua_S, 3,(int *)&arg1, "ccui.Slider:loadBarTexture"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_loadBarTexture'", nullptr); + return 0; + } + cobj->loadBarTexture(arg0, arg1); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:loadBarTexture",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_loadBarTexture'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_Slider_getProgressBarFile(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Slider* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Slider",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Slider*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_getProgressBarFile'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_getProgressBarFile'", nullptr); + return 0; + } + cocos2d::ResouceData ret = cobj->getProgressBarFile(); + #pragma warning NO CONVERSION FROM NATIVE FOR ResouceData; + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:getProgressBarFile",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_getProgressBarFile'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_Slider_getCapInsetsBarRenderer(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Slider* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Slider",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Slider*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_getCapInsetsBarRenderer'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_getCapInsetsBarRenderer'", nullptr); + return 0; + } + const cocos2d::Rect& ret = cobj->getCapInsetsBarRenderer(); + rect_to_luaval(tolua_S, ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:getCapInsetsBarRenderer",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_getCapInsetsBarRenderer'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_Slider_loadSlidBallTexturePressed(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Slider* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Slider",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Slider*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_loadSlidBallTexturePressed'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + std::string arg0; + + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccui.Slider:loadSlidBallTexturePressed"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_loadSlidBallTexturePressed'", nullptr); + return 0; + } + cobj->loadSlidBallTexturePressed(arg0); + lua_settop(tolua_S, 1); + return 1; + } + if (argc == 2) + { + std::string arg0; + cocos2d::ui::Widget::TextureResType arg1; + + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccui.Slider:loadSlidBallTexturePressed"); + + ok &= luaval_to_int32(tolua_S, 3,(int *)&arg1, "ccui.Slider:loadSlidBallTexturePressed"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_loadSlidBallTexturePressed'", nullptr); + return 0; + } + cobj->loadSlidBallTexturePressed(arg0, arg1); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:loadSlidBallTexturePressed",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_loadSlidBallTexturePressed'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_Slider_getBackFile(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Slider* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Slider",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Slider*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_getBackFile'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_getBackFile'", nullptr); + return 0; + } + cocos2d::ResouceData ret = cobj->getBackFile(); + #pragma warning NO CONVERSION FROM NATIVE FOR ResouceData; + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:getBackFile",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_getBackFile'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_Slider_isScale9Enabled(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Slider* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Slider",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Slider*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_isScale9Enabled'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_isScale9Enabled'", nullptr); + return 0; + } + bool ret = cobj->isScale9Enabled(); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:isScale9Enabled",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_isScale9Enabled'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_Slider_setCapInsetProgressBarRebderer(lua_State* tolua_S) { int argc = 0; @@ -18136,7 +19323,7 @@ int lua_cocos2dx_ui_Slider_setCapInsetsBarRenderer(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer(lua_State* tolua_S) +int lua_cocos2dx_ui_Slider_getBallDisabeldFile(lua_State* tolua_S) { int argc = 0; cocos2d::ui::Slider* cobj = nullptr; @@ -18156,7 +19343,7 @@ int lua_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_getBallDisabeldFile'", nullptr); return 0; } #endif @@ -18166,24 +19353,24 @@ int lua_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer(lua_State* tolua_S) { if(!ok) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer'", nullptr); + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_getBallDisabeldFile'", nullptr); return 0; } - const cocos2d::Rect& ret = cobj->getCapInsetsProgressBarRebderer(); - rect_to_luaval(tolua_S, ret); + cocos2d::ResouceData ret = cobj->getBallDisabeldFile(); + #pragma warning NO CONVERSION FROM NATIVE FOR ResouceData; return 1; } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:getCapInsetsProgressBarRebderer",argc, 0); + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:getBallDisabeldFile",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_getBallDisabeldFile'.",&tolua_err); #endif return 0; } -int lua_cocos2dx_ui_Slider_setScale9Enabled(lua_State* tolua_S) +int lua_cocos2dx_ui_Slider_getPercent(lua_State* tolua_S) { int argc = 0; cocos2d::ui::Slider* cobj = nullptr; @@ -18203,82 +19390,29 @@ int lua_cocos2dx_ui_Slider_setScale9Enabled(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_setScale9Enabled'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_getPercent'", nullptr); return 0; } #endif argc = lua_gettop(tolua_S)-1; - if (argc == 1) + if (argc == 0) { - bool arg0; - - ok &= luaval_to_boolean(tolua_S, 2,&arg0, "ccui.Slider:setScale9Enabled"); if(!ok) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_setScale9Enabled'", nullptr); + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_getPercent'", nullptr); return 0; } - cobj->setScale9Enabled(arg0); - lua_settop(tolua_S, 1); + int ret = cobj->getPercent(); + tolua_pushnumber(tolua_S,(lua_Number)ret); return 1; } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:setScale9Enabled",argc, 1); + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:getPercent",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_setScale9Enabled'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_ui_Slider_setZoomScale(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::ui::Slider* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"ccui.Slider",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::ui::Slider*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_setZoomScale'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - double arg0; - - ok &= luaval_to_number(tolua_S, 2,&arg0, "ccui.Slider:setZoomScale"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_setZoomScale'", nullptr); - return 0; - } - cobj->setZoomScale(arg0); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:setZoomScale",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_setZoomScale'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_getPercent'.",&tolua_err); #endif return 0; @@ -18333,7 +19467,7 @@ int lua_cocos2dx_ui_Slider_setCapInsets(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_Slider_getZoomScale(lua_State* tolua_S) +int lua_cocos2dx_ui_Slider_loadSlidBallTextureDisabled(lua_State* tolua_S) { int argc = 0; cocos2d::ui::Slider* cobj = nullptr; @@ -18353,108 +19487,7 @@ int lua_cocos2dx_ui_Slider_getZoomScale(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_getZoomScale'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_getZoomScale'", nullptr); - return 0; - } - double ret = cobj->getZoomScale(); - tolua_pushnumber(tolua_S,(lua_Number)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:getZoomScale",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_getZoomScale'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_ui_Slider_addEventListener(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::ui::Slider* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"ccui.Slider",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::ui::Slider*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_addEventListener'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - std::function arg0; - - do { - // Lambda binding for lua is not supported. - assert(false); - } while(0) - ; - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_addEventListener'", nullptr); - return 0; - } - cobj->addEventListener(arg0); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:addEventListener",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_addEventListener'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_ui_Slider_loadSlidBallTexturePressed(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::ui::Slider* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"ccui.Slider",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::ui::Slider*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_loadSlidBallTexturePressed'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_loadSlidBallTextureDisabled'", nullptr); return 0; } #endif @@ -18464,13 +19497,13 @@ int lua_cocos2dx_ui_Slider_loadSlidBallTexturePressed(lua_State* tolua_S) { std::string arg0; - ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccui.Slider:loadSlidBallTexturePressed"); + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccui.Slider:loadSlidBallTextureDisabled"); if(!ok) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_loadSlidBallTexturePressed'", nullptr); + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_loadSlidBallTextureDisabled'", nullptr); return 0; } - cobj->loadSlidBallTexturePressed(arg0); + cobj->loadSlidBallTextureDisabled(arg0); lua_settop(tolua_S, 1); return 1; } @@ -18479,29 +19512,29 @@ int lua_cocos2dx_ui_Slider_loadSlidBallTexturePressed(lua_State* tolua_S) std::string arg0; cocos2d::ui::Widget::TextureResType arg1; - ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccui.Slider:loadSlidBallTexturePressed"); + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccui.Slider:loadSlidBallTextureDisabled"); - ok &= luaval_to_int32(tolua_S, 3,(int *)&arg1, "ccui.Slider:loadSlidBallTexturePressed"); + ok &= luaval_to_int32(tolua_S, 3,(int *)&arg1, "ccui.Slider:loadSlidBallTextureDisabled"); if(!ok) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_loadSlidBallTexturePressed'", nullptr); + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_loadSlidBallTextureDisabled'", nullptr); return 0; } - cobj->loadSlidBallTexturePressed(arg0, arg1); + cobj->loadSlidBallTextureDisabled(arg0, arg1); lua_settop(tolua_S, 1); return 1; } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:loadSlidBallTexturePressed",argc, 1); + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:loadSlidBallTextureDisabled",argc, 1); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_loadSlidBallTexturePressed'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_loadSlidBallTextureDisabled'.",&tolua_err); #endif return 0; } -int lua_cocos2dx_ui_Slider_isScale9Enabled(lua_State* tolua_S) +int lua_cocos2dx_ui_Slider_setZoomScale(lua_State* tolua_S) { int argc = 0; cocos2d::ui::Slider* cobj = nullptr; @@ -18521,123 +19554,32 @@ int lua_cocos2dx_ui_Slider_isScale9Enabled(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_isScale9Enabled'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_setZoomScale'", nullptr); return 0; } #endif argc = lua_gettop(tolua_S)-1; - if (argc == 0) + if (argc == 1) { + double arg0; + + ok &= luaval_to_number(tolua_S, 2,&arg0, "ccui.Slider:setZoomScale"); if(!ok) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_isScale9Enabled'", nullptr); + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_setZoomScale'", nullptr); return 0; } - bool ret = cobj->isScale9Enabled(); - tolua_pushboolean(tolua_S,(bool)ret); + cobj->setZoomScale(arg0); + lua_settop(tolua_S, 1); return 1; } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:isScale9Enabled",argc, 0); + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:setZoomScale",argc, 1); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_isScale9Enabled'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_ui_Slider_getCapInsetsBarRenderer(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::ui::Slider* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"ccui.Slider",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::ui::Slider*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_getCapInsetsBarRenderer'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_getCapInsetsBarRenderer'", nullptr); - return 0; - } - const cocos2d::Rect& ret = cobj->getCapInsetsBarRenderer(); - rect_to_luaval(tolua_S, ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:getCapInsetsBarRenderer",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_getCapInsetsBarRenderer'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_ui_Slider_getPercent(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::ui::Slider* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"ccui.Slider",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::ui::Slider*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_getPercent'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_getPercent'", nullptr); - return 0; - } - int ret = cobj->getPercent(); - tolua_pushnumber(tolua_S,(lua_Number)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:getPercent",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_getPercent'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_setZoomScale'.",&tolua_err); #endif return 0; @@ -18793,26 +19735,31 @@ int lua_register_cocos2dx_ui_Slider(lua_State* tolua_S) tolua_beginmodule(tolua_S,"Slider"); tolua_function(tolua_S,"new",lua_cocos2dx_ui_Slider_constructor); - tolua_function(tolua_S,"setMaxPercent",lua_cocos2dx_ui_Slider_setMaxPercent); tolua_function(tolua_S,"setPercent",lua_cocos2dx_ui_Slider_setPercent); - tolua_function(tolua_S,"loadSlidBallTextureDisabled",lua_cocos2dx_ui_Slider_loadSlidBallTextureDisabled); tolua_function(tolua_S,"getMaxPercent",lua_cocos2dx_ui_Slider_getMaxPercent); tolua_function(tolua_S,"loadSlidBallTextureNormal",lua_cocos2dx_ui_Slider_loadSlidBallTextureNormal); - tolua_function(tolua_S,"loadBarTexture",lua_cocos2dx_ui_Slider_loadBarTexture); tolua_function(tolua_S,"loadProgressBarTexture",lua_cocos2dx_ui_Slider_loadProgressBarTexture); - tolua_function(tolua_S,"loadSlidBallTextures",lua_cocos2dx_ui_Slider_loadSlidBallTextures); - tolua_function(tolua_S,"setCapInsetProgressBarRebderer",lua_cocos2dx_ui_Slider_setCapInsetProgressBarRebderer); - tolua_function(tolua_S,"setCapInsetsBarRenderer",lua_cocos2dx_ui_Slider_setCapInsetsBarRenderer); + tolua_function(tolua_S,"getBallNormalFile",lua_cocos2dx_ui_Slider_getBallNormalFile); tolua_function(tolua_S,"getCapInsetsProgressBarRebderer",lua_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer); tolua_function(tolua_S,"setScale9Enabled",lua_cocos2dx_ui_Slider_setScale9Enabled); - tolua_function(tolua_S,"setZoomScale",lua_cocos2dx_ui_Slider_setZoomScale); - tolua_function(tolua_S,"setCapInsets",lua_cocos2dx_ui_Slider_setCapInsets); + tolua_function(tolua_S,"getBallPressedFile",lua_cocos2dx_ui_Slider_getBallPressedFile); tolua_function(tolua_S,"getZoomScale",lua_cocos2dx_ui_Slider_getZoomScale); + tolua_function(tolua_S,"loadSlidBallTextures",lua_cocos2dx_ui_Slider_loadSlidBallTextures); tolua_function(tolua_S,"addEventListener",lua_cocos2dx_ui_Slider_addEventListener); - tolua_function(tolua_S,"loadSlidBallTexturePressed",lua_cocos2dx_ui_Slider_loadSlidBallTexturePressed); - tolua_function(tolua_S,"isScale9Enabled",lua_cocos2dx_ui_Slider_isScale9Enabled); + tolua_function(tolua_S,"setMaxPercent",lua_cocos2dx_ui_Slider_setMaxPercent); + tolua_function(tolua_S,"loadBarTexture",lua_cocos2dx_ui_Slider_loadBarTexture); + tolua_function(tolua_S,"getProgressBarFile",lua_cocos2dx_ui_Slider_getProgressBarFile); tolua_function(tolua_S,"getCapInsetsBarRenderer",lua_cocos2dx_ui_Slider_getCapInsetsBarRenderer); + tolua_function(tolua_S,"loadSlidBallTexturePressed",lua_cocos2dx_ui_Slider_loadSlidBallTexturePressed); + tolua_function(tolua_S,"getBackFile",lua_cocos2dx_ui_Slider_getBackFile); + tolua_function(tolua_S,"isScale9Enabled",lua_cocos2dx_ui_Slider_isScale9Enabled); + tolua_function(tolua_S,"setCapInsetProgressBarRebderer",lua_cocos2dx_ui_Slider_setCapInsetProgressBarRebderer); + tolua_function(tolua_S,"setCapInsetsBarRenderer",lua_cocos2dx_ui_Slider_setCapInsetsBarRenderer); + tolua_function(tolua_S,"getBallDisabeldFile",lua_cocos2dx_ui_Slider_getBallDisabeldFile); tolua_function(tolua_S,"getPercent",lua_cocos2dx_ui_Slider_getPercent); + tolua_function(tolua_S,"setCapInsets",lua_cocos2dx_ui_Slider_setCapInsets); + tolua_function(tolua_S,"loadSlidBallTextureDisabled",lua_cocos2dx_ui_Slider_loadSlidBallTextureDisabled); + tolua_function(tolua_S,"setZoomScale",lua_cocos2dx_ui_Slider_setZoomScale); tolua_function(tolua_S,"create", lua_cocos2dx_ui_Slider_create); tolua_function(tolua_S,"createInstance", lua_cocos2dx_ui_Slider_createInstance); tolua_endmodule(tolua_S); @@ -21003,56 +21950,6 @@ int lua_register_cocos2dx_ui_TextField(lua_State* tolua_S) return 1; } -int lua_cocos2dx_ui_TextBMFont_setFntFile(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::ui::TextBMFont* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"ccui.TextBMFont",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::ui::TextBMFont*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_TextBMFont_setFntFile'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - std::string arg0; - - ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccui.TextBMFont:setFntFile"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_TextBMFont_setFntFile'", nullptr); - return 0; - } - cobj->setFntFile(arg0); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.TextBMFont:setFntFile",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_TextBMFont_setFntFile'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_ui_TextBMFont_getStringLength(lua_State* tolua_S) { int argc = 0; @@ -21100,6 +21997,53 @@ int lua_cocos2dx_ui_TextBMFont_getStringLength(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_TextBMFont_getString(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::TextBMFont* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.TextBMFont",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::TextBMFont*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_TextBMFont_getString'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_TextBMFont_getString'", nullptr); + return 0; + } + const std::string& ret = cobj->getString(); + tolua_pushcppstring(tolua_S,ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.TextBMFont:getString",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_TextBMFont_getString'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_TextBMFont_setString(lua_State* tolua_S) { int argc = 0; @@ -21150,7 +22094,7 @@ int lua_cocos2dx_ui_TextBMFont_setString(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_TextBMFont_getString(lua_State* tolua_S) +int lua_cocos2dx_ui_TextBMFont_getRenderFile(lua_State* tolua_S) { int argc = 0; cocos2d::ui::TextBMFont* cobj = nullptr; @@ -21170,7 +22114,7 @@ int lua_cocos2dx_ui_TextBMFont_getString(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_TextBMFont_getString'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_TextBMFont_getRenderFile'", nullptr); return 0; } #endif @@ -21180,19 +22124,69 @@ int lua_cocos2dx_ui_TextBMFont_getString(lua_State* tolua_S) { if(!ok) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_TextBMFont_getString'", nullptr); + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_TextBMFont_getRenderFile'", nullptr); return 0; } - const std::string& ret = cobj->getString(); - tolua_pushcppstring(tolua_S,ret); + cocos2d::ResouceData ret = cobj->getRenderFile(); + #pragma warning NO CONVERSION FROM NATIVE FOR ResouceData; return 1; } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.TextBMFont:getString",argc, 0); + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.TextBMFont:getRenderFile",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_TextBMFont_getString'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_TextBMFont_getRenderFile'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_TextBMFont_setFntFile(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::TextBMFont* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.TextBMFont",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::TextBMFont*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_TextBMFont_setFntFile'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + std::string arg0; + + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccui.TextBMFont:setFntFile"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_TextBMFont_setFntFile'", nullptr); + return 0; + } + cobj->setFntFile(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.TextBMFont:setFntFile",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_TextBMFont_setFntFile'.",&tolua_err); #endif return 0; @@ -21329,10 +22323,11 @@ int lua_register_cocos2dx_ui_TextBMFont(lua_State* tolua_S) tolua_beginmodule(tolua_S,"TextBMFont"); tolua_function(tolua_S,"new",lua_cocos2dx_ui_TextBMFont_constructor); - tolua_function(tolua_S,"setFntFile",lua_cocos2dx_ui_TextBMFont_setFntFile); tolua_function(tolua_S,"getStringLength",lua_cocos2dx_ui_TextBMFont_getStringLength); - tolua_function(tolua_S,"setString",lua_cocos2dx_ui_TextBMFont_setString); tolua_function(tolua_S,"getString",lua_cocos2dx_ui_TextBMFont_getString); + tolua_function(tolua_S,"setString",lua_cocos2dx_ui_TextBMFont_setString); + tolua_function(tolua_S,"getRenderFile",lua_cocos2dx_ui_TextBMFont_getRenderFile); + tolua_function(tolua_S,"setFntFile",lua_cocos2dx_ui_TextBMFont_setFntFile); tolua_function(tolua_S,"create", lua_cocos2dx_ui_TextBMFont_create); tolua_function(tolua_S,"createInstance", lua_cocos2dx_ui_TextBMFont_createInstance); tolua_endmodule(tolua_S); @@ -21342,7 +22337,7 @@ int lua_register_cocos2dx_ui_TextBMFont(lua_State* tolua_S) return 1; } -int lua_cocos2dx_ui_PageView_getCustomScrollThreshold(lua_State* tolua_S) +int lua_cocos2dx_ui_PageView_setIndicatorSpaceBetweenIndexNodes(lua_State* tolua_S) { int argc = 0; cocos2d::ui::PageView* cobj = nullptr; @@ -21362,101 +22357,7 @@ int lua_cocos2dx_ui_PageView_getCustomScrollThreshold(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_PageView_getCustomScrollThreshold'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_PageView_getCustomScrollThreshold'", nullptr); - return 0; - } - double ret = cobj->getCustomScrollThreshold(); - tolua_pushnumber(tolua_S,(lua_Number)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.PageView:getCustomScrollThreshold",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_PageView_getCustomScrollThreshold'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_ui_PageView_getCurPageIndex(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::ui::PageView* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"ccui.PageView",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::ui::PageView*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_PageView_getCurPageIndex'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_PageView_getCurPageIndex'", nullptr); - return 0; - } - ssize_t ret = cobj->getCurPageIndex(); - tolua_pushnumber(tolua_S,(lua_Number)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.PageView:getCurPageIndex",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_PageView_getCurPageIndex'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_ui_PageView_setDirection(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::ui::PageView* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"ccui.PageView",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::ui::PageView*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_PageView_setDirection'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_PageView_setIndicatorSpaceBetweenIndexNodes'", nullptr); return 0; } #endif @@ -21464,29 +22365,29 @@ int lua_cocos2dx_ui_PageView_setDirection(lua_State* tolua_S) argc = lua_gettop(tolua_S)-1; if (argc == 1) { - cocos2d::ui::PageView::Direction arg0; + double arg0; - ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccui.PageView:setDirection"); + ok &= luaval_to_number(tolua_S, 2,&arg0, "ccui.PageView:setIndicatorSpaceBetweenIndexNodes"); if(!ok) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_PageView_setDirection'", nullptr); + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_PageView_setIndicatorSpaceBetweenIndexNodes'", nullptr); return 0; } - cobj->setDirection(arg0); + cobj->setIndicatorSpaceBetweenIndexNodes(arg0); lua_settop(tolua_S, 1); return 1; } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.PageView:setDirection",argc, 1); + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.PageView:setIndicatorSpaceBetweenIndexNodes",argc, 1); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_PageView_setDirection'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_PageView_setIndicatorSpaceBetweenIndexNodes'.",&tolua_err); #endif return 0; } -int lua_cocos2dx_ui_PageView_addWidgetToPage(lua_State* tolua_S) +int lua_cocos2dx_ui_PageView_setIndicatorSelectedIndexColor(lua_State* tolua_S) { int argc = 0; cocos2d::ui::PageView* cobj = nullptr; @@ -21506,43 +22407,281 @@ int lua_cocos2dx_ui_PageView_addWidgetToPage(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_PageView_addWidgetToPage'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_PageView_setIndicatorSelectedIndexColor'", nullptr); return 0; } #endif argc = lua_gettop(tolua_S)-1; - if (argc == 3) + if (argc == 1) + { + cocos2d::Color3B arg0; + + ok &= luaval_to_color3b(tolua_S, 2, &arg0, "ccui.PageView:setIndicatorSelectedIndexColor"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_PageView_setIndicatorSelectedIndexColor'", nullptr); + return 0; + } + cobj->setIndicatorSelectedIndexColor(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.PageView:setIndicatorSelectedIndexColor",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_PageView_setIndicatorSelectedIndexColor'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_PageView_getIndicatorSelectedIndexColor(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::PageView* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.PageView",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::PageView*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_PageView_getIndicatorSelectedIndexColor'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_PageView_getIndicatorSelectedIndexColor'", nullptr); + return 0; + } + const cocos2d::Color3B& ret = cobj->getIndicatorSelectedIndexColor(); + color3b_to_luaval(tolua_S, ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.PageView:getIndicatorSelectedIndexColor",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_PageView_getIndicatorSelectedIndexColor'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_PageView_getIndicatorPositionAsAnchorPoint(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::PageView* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.PageView",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::PageView*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_PageView_getIndicatorPositionAsAnchorPoint'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_PageView_getIndicatorPositionAsAnchorPoint'", nullptr); + return 0; + } + const cocos2d::Vec2& ret = cobj->getIndicatorPositionAsAnchorPoint(); + vec2_to_luaval(tolua_S, ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.PageView:getIndicatorPositionAsAnchorPoint",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_PageView_getIndicatorPositionAsAnchorPoint'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_PageView_setIndicatorPosition(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::PageView* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.PageView",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::PageView*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_PageView_setIndicatorPosition'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + cocos2d::Vec2 arg0; + + ok &= luaval_to_vec2(tolua_S, 2, &arg0, "ccui.PageView:setIndicatorPosition"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_PageView_setIndicatorPosition'", nullptr); + return 0; + } + cobj->setIndicatorPosition(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.PageView:setIndicatorPosition",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_PageView_setIndicatorPosition'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_PageView_getIndicatorPosition(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::PageView* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.PageView",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::PageView*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_PageView_getIndicatorPosition'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_PageView_getIndicatorPosition'", nullptr); + return 0; + } + const cocos2d::Vec2& ret = cobj->getIndicatorPosition(); + vec2_to_luaval(tolua_S, ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.PageView:getIndicatorPosition",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_PageView_getIndicatorPosition'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_PageView_insertPage(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::PageView* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.PageView",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::PageView*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_PageView_insertPage'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 2) { cocos2d::ui::Widget* arg0; - ssize_t arg1; - bool arg2; + int arg1; - ok &= luaval_to_object(tolua_S, 2, "ccui.Widget",&arg0, "ccui.PageView:addWidgetToPage"); + ok &= luaval_to_object(tolua_S, 2, "ccui.Widget",&arg0, "ccui.PageView:insertPage"); - ok &= luaval_to_ssize(tolua_S, 3, &arg1, "ccui.PageView:addWidgetToPage"); - - ok &= luaval_to_boolean(tolua_S, 4,&arg2, "ccui.PageView:addWidgetToPage"); + ok &= luaval_to_int32(tolua_S, 3,(int *)&arg1, "ccui.PageView:insertPage"); if(!ok) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_PageView_addWidgetToPage'", nullptr); + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_PageView_insertPage'", nullptr); return 0; } - cobj->addWidgetToPage(arg0, arg1, arg2); + cobj->insertPage(arg0, arg1); lua_settop(tolua_S, 1); return 1; } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.PageView:addWidgetToPage",argc, 3); + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.PageView:insertPage",argc, 2); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_PageView_addWidgetToPage'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_PageView_insertPage'.",&tolua_err); #endif return 0; } -int lua_cocos2dx_ui_PageView_isUsingCustomScrollThreshold(lua_State* tolua_S) +int lua_cocos2dx_ui_PageView_getCurrentPageIndex(lua_State* tolua_S) { int argc = 0; cocos2d::ui::PageView* cobj = nullptr; @@ -21562,7 +22701,7 @@ int lua_cocos2dx_ui_PageView_isUsingCustomScrollThreshold(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_PageView_isUsingCustomScrollThreshold'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_PageView_getCurrentPageIndex'", nullptr); return 0; } #endif @@ -21572,69 +22711,19 @@ int lua_cocos2dx_ui_PageView_isUsingCustomScrollThreshold(lua_State* tolua_S) { if(!ok) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_PageView_isUsingCustomScrollThreshold'", nullptr); + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_PageView_getCurrentPageIndex'", nullptr); return 0; } - bool ret = cobj->isUsingCustomScrollThreshold(); - tolua_pushboolean(tolua_S,(bool)ret); + ssize_t ret = cobj->getCurrentPageIndex(); + tolua_pushnumber(tolua_S,(lua_Number)ret); return 1; } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.PageView:isUsingCustomScrollThreshold",argc, 0); + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.PageView:getCurrentPageIndex",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_PageView_isUsingCustomScrollThreshold'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_ui_PageView_setCurPageIndex(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::ui::PageView* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"ccui.PageView",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::ui::PageView*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_PageView_setCurPageIndex'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - ssize_t arg0; - - ok &= luaval_to_ssize(tolua_S, 2, &arg0, "ccui.PageView:setCurPageIndex"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_PageView_setCurPageIndex'", nullptr); - return 0; - } - cobj->setCurPageIndex(arg0); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.PageView:setCurPageIndex",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_PageView_setCurPageIndex'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_PageView_getCurrentPageIndex'.",&tolua_err); #endif return 0; @@ -21667,9 +22756,9 @@ int lua_cocos2dx_ui_PageView_removePage(lua_State* tolua_S) argc = lua_gettop(tolua_S)-1; if (argc == 1) { - cocos2d::ui::Layout* arg0; + cocos2d::ui::Widget* arg0; - ok &= luaval_to_object(tolua_S, 2, "ccui.Layout",&arg0, "ccui.PageView:removePage"); + ok &= luaval_to_object(tolua_S, 2, "ccui.Widget",&arg0, "ccui.PageView:removePage"); if(!ok) { tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_PageView_removePage'", nullptr); @@ -21743,7 +22832,7 @@ int lua_cocos2dx_ui_PageView_addEventListener(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_PageView_setUsingCustomScrollThreshold(lua_State* tolua_S) +int lua_cocos2dx_ui_PageView_setCurrentPageIndex(lua_State* tolua_S) { int argc = 0; cocos2d::ui::PageView* cobj = nullptr; @@ -21763,7 +22852,7 @@ int lua_cocos2dx_ui_PageView_setUsingCustomScrollThreshold(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_PageView_setUsingCustomScrollThreshold'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_PageView_setCurrentPageIndex'", nullptr); return 0; } #endif @@ -21771,29 +22860,29 @@ int lua_cocos2dx_ui_PageView_setUsingCustomScrollThreshold(lua_State* tolua_S) argc = lua_gettop(tolua_S)-1; if (argc == 1) { - bool arg0; + ssize_t arg0; - ok &= luaval_to_boolean(tolua_S, 2,&arg0, "ccui.PageView:setUsingCustomScrollThreshold"); + ok &= luaval_to_ssize(tolua_S, 2, &arg0, "ccui.PageView:setCurrentPageIndex"); if(!ok) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_PageView_setUsingCustomScrollThreshold'", nullptr); + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_PageView_setCurrentPageIndex'", nullptr); return 0; } - cobj->setUsingCustomScrollThreshold(arg0); + cobj->setCurrentPageIndex(arg0); lua_settop(tolua_S, 1); return 1; } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.PageView:setUsingCustomScrollThreshold",argc, 1); + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.PageView:setCurrentPageIndex",argc, 1); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_PageView_setUsingCustomScrollThreshold'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_PageView_setCurrentPageIndex'.",&tolua_err); #endif return 0; } -int lua_cocos2dx_ui_PageView_setCustomScrollThreshold(lua_State* tolua_S) +int lua_cocos2dx_ui_PageView_getIndicatorEnabled(lua_State* tolua_S) { int argc = 0; cocos2d::ui::PageView* cobj = nullptr; @@ -21813,110 +22902,7 @@ int lua_cocos2dx_ui_PageView_setCustomScrollThreshold(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_PageView_setCustomScrollThreshold'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - double arg0; - - ok &= luaval_to_number(tolua_S, 2,&arg0, "ccui.PageView:setCustomScrollThreshold"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_PageView_setCustomScrollThreshold'", nullptr); - return 0; - } - cobj->setCustomScrollThreshold(arg0); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.PageView:setCustomScrollThreshold",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_PageView_setCustomScrollThreshold'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_ui_PageView_insertPage(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::ui::PageView* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"ccui.PageView",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::ui::PageView*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_PageView_insertPage'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 2) - { - cocos2d::ui::Layout* arg0; - int arg1; - - ok &= luaval_to_object(tolua_S, 2, "ccui.Layout",&arg0, "ccui.PageView:insertPage"); - - ok &= luaval_to_int32(tolua_S, 3,(int *)&arg1, "ccui.PageView:insertPage"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_PageView_insertPage'", nullptr); - return 0; - } - cobj->insertPage(arg0, arg1); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.PageView:insertPage",argc, 2); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_PageView_insertPage'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_ui_PageView_getDirection(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::ui::PageView* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"ccui.PageView",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::ui::PageView*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_PageView_getDirection'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_PageView_getIndicatorEnabled'", nullptr); return 0; } #endif @@ -21926,19 +22912,19 @@ int lua_cocos2dx_ui_PageView_getDirection(lua_State* tolua_S) { if(!ok) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_PageView_getDirection'", nullptr); + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_PageView_getIndicatorEnabled'", nullptr); return 0; } - int ret = (int)cobj->getDirection(); - tolua_pushnumber(tolua_S,(lua_Number)ret); + bool ret = cobj->getIndicatorEnabled(); + tolua_pushboolean(tolua_S,(bool)ret); return 1; } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.PageView:getDirection",argc, 0); + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.PageView:getIndicatorEnabled",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_PageView_getDirection'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_PageView_getIndicatorEnabled'.",&tolua_err); #endif return 0; @@ -21993,7 +22979,7 @@ int lua_cocos2dx_ui_PageView_scrollToPage(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_PageView_getPage(lua_State* tolua_S) +int lua_cocos2dx_ui_PageView_setIndicatorPositionAsAnchorPoint(lua_State* tolua_S) { int argc = 0; cocos2d::ui::PageView* cobj = nullptr; @@ -22013,7 +22999,7 @@ int lua_cocos2dx_ui_PageView_getPage(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_PageView_getPage'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_PageView_setIndicatorPositionAsAnchorPoint'", nullptr); return 0; } #endif @@ -22021,79 +23007,29 @@ int lua_cocos2dx_ui_PageView_getPage(lua_State* tolua_S) argc = lua_gettop(tolua_S)-1; if (argc == 1) { - ssize_t arg0; + cocos2d::Vec2 arg0; - ok &= luaval_to_ssize(tolua_S, 2, &arg0, "ccui.PageView:getPage"); + ok &= luaval_to_vec2(tolua_S, 2, &arg0, "ccui.PageView:setIndicatorPositionAsAnchorPoint"); if(!ok) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_PageView_getPage'", nullptr); + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_PageView_setIndicatorPositionAsAnchorPoint'", nullptr); return 0; } - cocos2d::ui::Layout* ret = cobj->getPage(arg0); - object_to_luaval(tolua_S, "ccui.Layout",(cocos2d::ui::Layout*)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.PageView:getPage",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_PageView_getPage'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_ui_PageView_removePageAtIndex(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::ui::PageView* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"ccui.PageView",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::ui::PageView*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_PageView_removePageAtIndex'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - ssize_t arg0; - - ok &= luaval_to_ssize(tolua_S, 2, &arg0, "ccui.PageView:removePageAtIndex"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_PageView_removePageAtIndex'", nullptr); - return 0; - } - cobj->removePageAtIndex(arg0); + cobj->setIndicatorPositionAsAnchorPoint(arg0); lua_settop(tolua_S, 1); return 1; } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.PageView:removePageAtIndex",argc, 1); + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.PageView:setIndicatorPositionAsAnchorPoint",argc, 1); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_PageView_removePageAtIndex'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_PageView_setIndicatorPositionAsAnchorPoint'.",&tolua_err); #endif return 0; } -int lua_cocos2dx_ui_PageView_getPages(lua_State* tolua_S) +int lua_cocos2dx_ui_PageView_scrollToItem(lua_State* tolua_S) { int argc = 0; cocos2d::ui::PageView* cobj = nullptr; @@ -22113,7 +23049,157 @@ int lua_cocos2dx_ui_PageView_getPages(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_PageView_getPages'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_PageView_scrollToItem'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + ssize_t arg0; + + ok &= luaval_to_ssize(tolua_S, 2, &arg0, "ccui.PageView:scrollToItem"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_PageView_scrollToItem'", nullptr); + return 0; + } + cobj->scrollToItem(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.PageView:scrollToItem",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_PageView_scrollToItem'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_PageView_setIndicatorEnabled(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::PageView* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.PageView",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::PageView*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_PageView_setIndicatorEnabled'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + bool arg0; + + ok &= luaval_to_boolean(tolua_S, 2,&arg0, "ccui.PageView:setIndicatorEnabled"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_PageView_setIndicatorEnabled'", nullptr); + return 0; + } + cobj->setIndicatorEnabled(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.PageView:setIndicatorEnabled",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_PageView_setIndicatorEnabled'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_PageView_addPage(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::PageView* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.PageView",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::PageView*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_PageView_addPage'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + cocos2d::ui::Widget* arg0; + + ok &= luaval_to_object(tolua_S, 2, "ccui.Widget",&arg0, "ccui.PageView:addPage"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_PageView_addPage'", nullptr); + return 0; + } + cobj->addPage(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.PageView:addPage",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_PageView_addPage'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_PageView_getIndicatorSpaceBetweenIndexNodes(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::PageView* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.PageView",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::PageView*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_PageView_getIndicatorSpaceBetweenIndexNodes'", nullptr); return 0; } #endif @@ -22123,19 +23209,19 @@ int lua_cocos2dx_ui_PageView_getPages(lua_State* tolua_S) { if(!ok) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_PageView_getPages'", nullptr); + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_PageView_getIndicatorSpaceBetweenIndexNodes'", nullptr); return 0; } - cocos2d::Vector& ret = cobj->getPages(); - ccvector_to_luaval(tolua_S, ret); + double ret = cobj->getIndicatorSpaceBetweenIndexNodes(); + tolua_pushnumber(tolua_S,(lua_Number)ret); return 1; } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.PageView:getPages",argc, 0); + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.PageView:getIndicatorSpaceBetweenIndexNodes",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_PageView_getPages'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_PageView_getIndicatorSpaceBetweenIndexNodes'.",&tolua_err); #endif return 0; @@ -22187,7 +23273,7 @@ int lua_cocos2dx_ui_PageView_removeAllPages(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_PageView_addPage(lua_State* tolua_S) +int lua_cocos2dx_ui_PageView_removePageAtIndex(lua_State* tolua_S) { int argc = 0; cocos2d::ui::PageView* cobj = nullptr; @@ -22207,7 +23293,7 @@ int lua_cocos2dx_ui_PageView_addPage(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_PageView_addPage'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_PageView_removePageAtIndex'", nullptr); return 0; } #endif @@ -22215,24 +23301,24 @@ int lua_cocos2dx_ui_PageView_addPage(lua_State* tolua_S) argc = lua_gettop(tolua_S)-1; if (argc == 1) { - cocos2d::ui::Layout* arg0; + ssize_t arg0; - ok &= luaval_to_object(tolua_S, 2, "ccui.Layout",&arg0, "ccui.PageView:addPage"); + ok &= luaval_to_ssize(tolua_S, 2, &arg0, "ccui.PageView:removePageAtIndex"); if(!ok) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_PageView_addPage'", nullptr); + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_PageView_removePageAtIndex'", nullptr); return 0; } - cobj->addPage(arg0); + cobj->removePageAtIndex(arg0); lua_settop(tolua_S, 1); return 1; } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.PageView:addPage",argc, 1); + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.PageView:removePageAtIndex",argc, 1); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_PageView_addPage'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_PageView_removePageAtIndex'.",&tolua_err); #endif return 0; @@ -22351,28 +23437,30 @@ static int lua_cocos2dx_ui_PageView_finalize(lua_State* tolua_S) int lua_register_cocos2dx_ui_PageView(lua_State* tolua_S) { tolua_usertype(tolua_S,"ccui.PageView"); - tolua_cclass(tolua_S,"PageView","ccui.PageView","ccui.Layout",nullptr); + tolua_cclass(tolua_S,"PageView","ccui.PageView","ccui.ListView",nullptr); tolua_beginmodule(tolua_S,"PageView"); tolua_function(tolua_S,"new",lua_cocos2dx_ui_PageView_constructor); - tolua_function(tolua_S,"getCustomScrollThreshold",lua_cocos2dx_ui_PageView_getCustomScrollThreshold); - tolua_function(tolua_S,"getCurPageIndex",lua_cocos2dx_ui_PageView_getCurPageIndex); - tolua_function(tolua_S,"setDirection",lua_cocos2dx_ui_PageView_setDirection); - tolua_function(tolua_S,"addWidgetToPage",lua_cocos2dx_ui_PageView_addWidgetToPage); - tolua_function(tolua_S,"isUsingCustomScrollThreshold",lua_cocos2dx_ui_PageView_isUsingCustomScrollThreshold); - tolua_function(tolua_S,"setCurPageIndex",lua_cocos2dx_ui_PageView_setCurPageIndex); + tolua_function(tolua_S,"setIndicatorSpaceBetweenIndexNodes",lua_cocos2dx_ui_PageView_setIndicatorSpaceBetweenIndexNodes); + tolua_function(tolua_S,"setIndicatorSelectedIndexColor",lua_cocos2dx_ui_PageView_setIndicatorSelectedIndexColor); + tolua_function(tolua_S,"getIndicatorSelectedIndexColor",lua_cocos2dx_ui_PageView_getIndicatorSelectedIndexColor); + tolua_function(tolua_S,"getIndicatorPositionAsAnchorPoint",lua_cocos2dx_ui_PageView_getIndicatorPositionAsAnchorPoint); + tolua_function(tolua_S,"setIndicatorPosition",lua_cocos2dx_ui_PageView_setIndicatorPosition); + tolua_function(tolua_S,"getIndicatorPosition",lua_cocos2dx_ui_PageView_getIndicatorPosition); + tolua_function(tolua_S,"insertPage",lua_cocos2dx_ui_PageView_insertPage); + tolua_function(tolua_S,"getCurrentPageIndex",lua_cocos2dx_ui_PageView_getCurrentPageIndex); tolua_function(tolua_S,"removePage",lua_cocos2dx_ui_PageView_removePage); tolua_function(tolua_S,"addEventListener",lua_cocos2dx_ui_PageView_addEventListener); - tolua_function(tolua_S,"setUsingCustomScrollThreshold",lua_cocos2dx_ui_PageView_setUsingCustomScrollThreshold); - tolua_function(tolua_S,"setCustomScrollThreshold",lua_cocos2dx_ui_PageView_setCustomScrollThreshold); - tolua_function(tolua_S,"insertPage",lua_cocos2dx_ui_PageView_insertPage); - tolua_function(tolua_S,"getDirection",lua_cocos2dx_ui_PageView_getDirection); + tolua_function(tolua_S,"setCurrentPageIndex",lua_cocos2dx_ui_PageView_setCurrentPageIndex); + tolua_function(tolua_S,"getIndicatorEnabled",lua_cocos2dx_ui_PageView_getIndicatorEnabled); tolua_function(tolua_S,"scrollToPage",lua_cocos2dx_ui_PageView_scrollToPage); - tolua_function(tolua_S,"getPage",lua_cocos2dx_ui_PageView_getPage); - tolua_function(tolua_S,"removePageAtIndex",lua_cocos2dx_ui_PageView_removePageAtIndex); - tolua_function(tolua_S,"getPages",lua_cocos2dx_ui_PageView_getPages); - tolua_function(tolua_S,"removeAllPages",lua_cocos2dx_ui_PageView_removeAllPages); + tolua_function(tolua_S,"setIndicatorPositionAsAnchorPoint",lua_cocos2dx_ui_PageView_setIndicatorPositionAsAnchorPoint); + tolua_function(tolua_S,"scrollToItem",lua_cocos2dx_ui_PageView_scrollToItem); + tolua_function(tolua_S,"setIndicatorEnabled",lua_cocos2dx_ui_PageView_setIndicatorEnabled); tolua_function(tolua_S,"addPage",lua_cocos2dx_ui_PageView_addPage); + tolua_function(tolua_S,"getIndicatorSpaceBetweenIndexNodes",lua_cocos2dx_ui_PageView_getIndicatorSpaceBetweenIndexNodes); + tolua_function(tolua_S,"removeAllPages",lua_cocos2dx_ui_PageView_removeAllPages); + tolua_function(tolua_S,"removePageAtIndex",lua_cocos2dx_ui_PageView_removePageAtIndex); tolua_function(tolua_S,"create", lua_cocos2dx_ui_PageView_create); tolua_function(tolua_S,"createInstance", lua_cocos2dx_ui_PageView_createInstance); tolua_endmodule(tolua_S); @@ -23313,6 +24401,104 @@ int lua_register_cocos2dx_ui_RichElementCustomNode(lua_State* tolua_S) return 1; } +int lua_cocos2dx_ui_RichElementNewLine_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,"ccui.RichElementNewLine",0,&tolua_err)) goto tolua_lerror; +#endif + + argc = lua_gettop(tolua_S) - 1; + + if (argc == 3) + { + int arg0; + cocos2d::Color3B arg1; + uint16_t arg2; + ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccui.RichElementNewLine:create"); + ok &= luaval_to_color3b(tolua_S, 3, &arg1, "ccui.RichElementNewLine:create"); + ok &= luaval_to_uint16(tolua_S, 4,&arg2, "ccui.RichElementNewLine:create"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_RichElementNewLine_create'", nullptr); + return 0; + } + cocos2d::ui::RichElementNewLine* ret = cocos2d::ui::RichElementNewLine::create(arg0, arg1, arg2); + object_to_luaval(tolua_S, "ccui.RichElementNewLine",(cocos2d::ui::RichElementNewLine*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d\n ", "ccui.RichElementNewLine:create",argc, 3); + return 0; +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_RichElementNewLine_create'.",&tolua_err); +#endif + return 0; +} +int lua_cocos2dx_ui_RichElementNewLine_constructor(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::RichElementNewLine* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_RichElementNewLine_constructor'", nullptr); + return 0; + } + cobj = new cocos2d::ui::RichElementNewLine(); + cobj->autorelease(); + int ID = (int)cobj->_ID ; + int* luaID = &cobj->_luaID ; + toluafix_pushusertype_ccobject(tolua_S, ID, luaID, (void*)cobj,"ccui.RichElementNewLine"); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.RichElementNewLine:RichElementNewLine",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_RichElementNewLine_constructor'.",&tolua_err); +#endif + + return 0; +} + +static int lua_cocos2dx_ui_RichElementNewLine_finalize(lua_State* tolua_S) +{ + printf("luabindings: finalizing LUA object (RichElementNewLine)"); + return 0; +} + +int lua_register_cocos2dx_ui_RichElementNewLine(lua_State* tolua_S) +{ + tolua_usertype(tolua_S,"ccui.RichElementNewLine"); + tolua_cclass(tolua_S,"RichElementNewLine","ccui.RichElementNewLine","ccui.RichElement",nullptr); + + tolua_beginmodule(tolua_S,"RichElementNewLine"); + tolua_function(tolua_S,"new",lua_cocos2dx_ui_RichElementNewLine_constructor); + tolua_function(tolua_S,"create", lua_cocos2dx_ui_RichElementNewLine_create); + tolua_endmodule(tolua_S); + std::string typeName = typeid(cocos2d::ui::RichElementNewLine).name(); + g_luaType[typeName] = "ccui.RichElementNewLine"; + g_typeCast["RichElementNewLine"] = "ccui.RichElementNewLine"; + return 1; +} + int lua_cocos2dx_ui_RichText_insertElement(lua_State* tolua_S) { int argc = 0; @@ -24858,6 +26044,56 @@ int lua_cocos2dx_ui_Scale9Sprite_setInsetTop(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_Scale9Sprite_setRenderingType(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Scale9Sprite* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Scale9Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Scale9Sprite*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Scale9Sprite_setRenderingType'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + cocos2d::ui::Scale9Sprite::RenderingType arg0; + + ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccui.Scale9Sprite:setRenderingType"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Scale9Sprite_setRenderingType'", nullptr); + return 0; + } + cobj->setRenderingType(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Scale9Sprite:setRenderingType",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Scale9Sprite_setRenderingType'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_Scale9Sprite_init(lua_State* tolua_S) { int argc = 0; @@ -25270,6 +26506,100 @@ int lua_cocos2dx_ui_Scale9Sprite_isScale9Enabled(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_Scale9Sprite_resetRender(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Scale9Sprite* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Scale9Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Scale9Sprite*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Scale9Sprite_resetRender'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Scale9Sprite_resetRender'", nullptr); + return 0; + } + cobj->resetRender(); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Scale9Sprite:resetRender",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Scale9Sprite_resetRender'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_ui_Scale9Sprite_getRenderingType(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Scale9Sprite* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Scale9Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Scale9Sprite*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Scale9Sprite_getRenderingType'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Scale9Sprite_getRenderingType'", nullptr); + return 0; + } + int ret = (int)cobj->getRenderingType(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Scale9Sprite:getRenderingType",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Scale9Sprite_getRenderingType'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_Scale9Sprite_getInsetRight(lua_State* tolua_S) { int argc = 0; @@ -26168,6 +27498,7 @@ int lua_register_cocos2dx_ui_Scale9Sprite(lua_State* tolua_S) tolua_function(tolua_S,"initWithSpriteFrameName",lua_cocos2dx_ui_Scale9Sprite_initWithSpriteFrameName); tolua_function(tolua_S,"getSprite",lua_cocos2dx_ui_Scale9Sprite_getSprite); tolua_function(tolua_S,"setInsetTop",lua_cocos2dx_ui_Scale9Sprite_setInsetTop); + tolua_function(tolua_S,"setRenderingType",lua_cocos2dx_ui_Scale9Sprite_setRenderingType); tolua_function(tolua_S,"init",lua_cocos2dx_ui_Scale9Sprite_init); tolua_function(tolua_S,"setPreferredSize",lua_cocos2dx_ui_Scale9Sprite_setPreferredSize); tolua_function(tolua_S,"setSpriteFrame",lua_cocos2dx_ui_Scale9Sprite_setSpriteFrame); @@ -26175,6 +27506,8 @@ int lua_register_cocos2dx_ui_Scale9Sprite(lua_State* tolua_S) tolua_function(tolua_S,"getInsetBottom",lua_cocos2dx_ui_Scale9Sprite_getInsetBottom); tolua_function(tolua_S,"getCapInsets",lua_cocos2dx_ui_Scale9Sprite_getCapInsets); tolua_function(tolua_S,"isScale9Enabled",lua_cocos2dx_ui_Scale9Sprite_isScale9Enabled); + tolua_function(tolua_S,"resetRender",lua_cocos2dx_ui_Scale9Sprite_resetRender); + tolua_function(tolua_S,"getRenderingType",lua_cocos2dx_ui_Scale9Sprite_getRenderingType); tolua_function(tolua_S,"getInsetRight",lua_cocos2dx_ui_Scale9Sprite_getInsetRight); tolua_function(tolua_S,"getOriginalSize",lua_cocos2dx_ui_Scale9Sprite_getOriginalSize); tolua_function(tolua_S,"initWithFile",lua_cocos2dx_ui_Scale9Sprite_initWithFile); @@ -30315,6 +31648,7 @@ TOLUA_API int register_all_cocos2dx_ui(lua_State* tolua_S) lua_register_cocos2dx_ui_RadioButtonGroup(tolua_S); lua_register_cocos2dx_ui_ScrollView(tolua_S); lua_register_cocos2dx_ui_ListView(tolua_S); + lua_register_cocos2dx_ui_RichElementNewLine(tolua_S); lua_register_cocos2dx_ui_LayoutComponent(tolua_S); lua_register_cocos2dx_ui_Button(tolua_S); lua_register_cocos2dx_ui_LayoutParameter(tolua_S); diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp index 4901bde69f..53e67879ca 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp @@ -608,6 +608,35 @@ int register_all_cocos2dx_ui(lua_State* tolua_S); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cocos/scripting/lua-bindings/manual/3d/lua_cocos2dx_3d_manual.cpp b/cocos/scripting/lua-bindings/manual/3d/lua_cocos2dx_3d_manual.cpp index 4a2d049931..1fae2d5b69 100644 --- a/cocos/scripting/lua-bindings/manual/3d/lua_cocos2dx_3d_manual.cpp +++ b/cocos/scripting/lua-bindings/manual/3d/lua_cocos2dx_3d_manual.cpp @@ -319,10 +319,10 @@ void terraindata_to_luaval(lua_State* L,const cocos2d::Terrain::TerrainData& inV lua_rawset(L, -3); } - if (nullptr != inValue._alphaMapSrc) + if (!inValue._alphaMapSrc.empty()) { lua_pushstring(L, "_alphaMapSrc"); - lua_pushstring(L, inValue._alphaMapSrc); + lua_pushstring(L, inValue._alphaMapSrc.c_str()); lua_rawset(L, -3); } diff --git a/cocos/ui/Android.mk b/cocos/ui/Android.mk index 4031741943..710bb7ac79 100644 --- a/cocos/ui/Android.mk +++ b/cocos/ui/Android.mk @@ -18,6 +18,7 @@ CocosGUI.cpp \ UIHelper.cpp \ UIListView.cpp \ UIPageView.cpp \ +UIPageViewIndicator.cpp \ UIScrollView.cpp \ UIScrollViewBar.cpp \ UIButton.cpp \ diff --git a/cocos/ui/CMakeLists.txt b/cocos/ui/CMakeLists.txt index 0fb18b8496..876487760c 100644 --- a/cocos/ui/CMakeLists.txt +++ b/cocos/ui/CMakeLists.txt @@ -38,6 +38,7 @@ set(COCOS_UI_SRC ui/UIListView.cpp ui/UILoadingBar.cpp ui/UIPageView.cpp + ui/UIPageViewIndicator.cpp ui/UIRelativeBox.cpp ui/UIRichText.cpp ui/UIScale9Sprite.cpp diff --git a/cocos/ui/CocosGUI.h b/cocos/ui/CocosGUI.h index 375bf9da10..856b6fed28 100644 --- a/cocos/ui/CocosGUI.h +++ b/cocos/ui/CocosGUI.h @@ -57,6 +57,7 @@ THE SOFTWARE. #include "ui/UIScale9Sprite.h" #include "ui/UIEditBox/UIEditBox.h" #include "ui/UILayoutComponent.h" +#include "2d/CocosStudioExtension.h" /** * @addtogroup ui diff --git a/cocos/ui/GUIExport.h b/cocos/ui/GUIExport.h index 717a0ad9e4..7b86aeaf3b 100644 --- a/cocos/ui/GUIExport.h +++ b/cocos/ui/GUIExport.h @@ -24,6 +24,8 @@ #define NULL ((void *)0) #endif #endif +#elif defined(_SHARED_) + #define CC_GUI_DLL __attribute__((visibility("default"))) #else #define CC_GUI_DLL #endif diff --git a/cocos/ui/UIAbstractCheckButton.cpp b/cocos/ui/UIAbstractCheckButton.cpp index 2edb24910e..cfff50539f 100644 --- a/cocos/ui/UIAbstractCheckButton.cpp +++ b/cocos/ui/UIAbstractCheckButton.cpp @@ -24,6 +24,7 @@ THE SOFTWARE. #include "ui/UIAbstractCheckButton.h" #include "2d/CCSprite.h" +#include "2d/CocosStudioExtension.h" NS_CC_BEGIN @@ -53,6 +54,11 @@ _frontCrossDisabledTexType(TextureResType::LOCAL), _zoomScale(0.1f), _backgroundTextureScaleX(1.0), _backgroundTextureScaleY(1.0), +_backGroundFileName(""), +_backGroundSelectedFileName(""), +_frontCrossFileName(""), +_backGroundDisabledFileName(""), +_frontCrossDisabledFileName(""), _backGroundBoxRendererAdaptDirty(true), _backGroundSelectedBoxRendererAdaptDirty(true), _frontCrossRendererAdaptDirty(true), @@ -129,10 +135,8 @@ void AbstractCheckButton::loadTextures(const std::string& backGround, void AbstractCheckButton::loadTextureBackGround(const std::string& backGround,TextureResType texType) { - if (backGround.empty()) - { - return; - } + _backGroundFileName = backGround; + _backGroundTexType = texType; switch (_backGroundTexType) { @@ -166,13 +170,10 @@ void AbstractCheckButton::loadTextureBackGround(SpriteFrame* spriteFrame) void AbstractCheckButton::loadTextureBackGroundSelected(const std::string& backGroundSelected,TextureResType texType) { - if (backGroundSelected.empty()) - { - return; - } - + _backGroundSelectedFileName = backGroundSelected; + _isBackgroundSelectedTextureLoaded = !backGroundSelected.empty(); + _backGroundSelectedTexType = texType; - _isBackgroundSelectedTextureLoaded = true; switch (_backGroundSelectedTexType) { case TextureResType::LOCAL: @@ -201,10 +202,8 @@ void AbstractCheckButton::setupBackgroundSelectedTexture() void AbstractCheckButton::loadTextureFrontCross(const std::string& cross,TextureResType texType) { - if (cross.empty()) - { - return; - } + _frontCrossFileName = cross; + _frontCrossTexType = texType; switch (_frontCrossTexType) { @@ -234,12 +233,10 @@ void AbstractCheckButton::setupFrontCrossTexture() void AbstractCheckButton::loadTextureBackGroundDisabled(const std::string& backGroundDisabled,TextureResType texType) { - if (backGroundDisabled.empty()) - { - return; - } + _backGroundDisabledFileName = backGroundDisabled; + _isBackgroundDisabledTextureLoaded = !backGroundDisabled.empty(); + _backGroundDisabledTexType = texType; - _isBackgroundDisabledTextureLoaded = true; switch (_backGroundDisabledTexType) { case TextureResType::LOCAL: @@ -269,12 +266,10 @@ void AbstractCheckButton::setupBackgroundDisable() void AbstractCheckButton::loadTextureFrontCrossDisabled(const std::string& frontCrossDisabled,TextureResType texType) { - if (frontCrossDisabled.empty()) - { - return; - } + _frontCrossDisabledFileName = frontCrossDisabled; + _isFrontCrossDisabledTextureLoaded = !frontCrossDisabled.empty(); + _frontCrossDisabledTexType = texType; - _isFrontCrossDisabledTextureLoaded = true; switch (_frontCrossDisabledTexType) { case TextureResType::LOCAL: @@ -579,6 +574,47 @@ void AbstractCheckButton::copySpecialProperties(Widget *widget) } } + +ResouceData AbstractCheckButton::getBackNormalFile() +{ + ResouceData rData; + rData.type = (int)_backGroundTexType; + rData.file = _backGroundFileName; + return rData; +} + +ResouceData AbstractCheckButton::getBackPressedFile() +{ + ResouceData rData; + rData.type = (int)_backGroundSelectedTexType; + rData.file = _backGroundSelectedFileName; + return rData; +} + +ResouceData AbstractCheckButton::getBackDisabledFile() +{ + ResouceData rData; + rData.type = (int)_backGroundDisabledTexType; + rData.file = _backGroundDisabledFileName; + return rData; +} + +ResouceData AbstractCheckButton::getCrossNormalFile() +{ + ResouceData rData; + rData.type = (int)_frontCrossTexType; + rData.file = _frontCrossFileName; + return rData; +} + +ResouceData AbstractCheckButton::getCrossDisabeldFile() +{ + ResouceData rData; + rData.type = (int)_frontCrossDisabledTexType; + rData.file = _frontCrossDisabledFileName; + return rData; +} + } NS_CC_END diff --git a/cocos/ui/UIAbstractCheckButton.h b/cocos/ui/UIAbstractCheckButton.h index bef259688e..3cf3e679c6 100644 --- a/cocos/ui/UIAbstractCheckButton.h +++ b/cocos/ui/UIAbstractCheckButton.h @@ -34,6 +34,7 @@ THE SOFTWARE. */ NS_CC_BEGIN class Sprite; +struct CC_DLL ResouceData; namespace ui { @@ -160,7 +161,13 @@ public: * @return the sprite instance of front cross when disabled */ Sprite* getRendererFrontCrossDisabled() const { return _frontCrossDisabledRenderer; } - + + ResouceData getBackNormalFile(); + ResouceData getBackPressedFile(); + ResouceData getBackDisabledFile(); + ResouceData getCrossNormalFile(); + ResouceData getCrossDisabeldFile(); + CC_CONSTRUCTOR_ACCESS: virtual bool init() override; virtual bool init(const std::string& backGround, @@ -237,6 +244,12 @@ protected: bool _frontCrossRendererAdaptDirty; bool _backGroundBoxDisabledRendererAdaptDirty; bool _frontCrossDisabledRendererAdaptDirty; + + std::string _backGroundFileName; + std::string _backGroundSelectedFileName; + std::string _frontCrossFileName; + std::string _backGroundDisabledFileName; + std::string _frontCrossDisabledFileName; }; } diff --git a/cocos/ui/UIButton.cpp b/cocos/ui/UIButton.cpp index 2e785a5e14..bfdd983805 100644 --- a/cocos/ui/UIButton.cpp +++ b/cocos/ui/UIButton.cpp @@ -30,6 +30,7 @@ THE SOFTWARE. #include "platform/CCFileUtils.h" #include "ui/UIHelper.h" #include +#include "2d/CocosStudioExtension.h" NS_CC_BEGIN @@ -49,6 +50,13 @@ _buttonClickedRenderer(nullptr), _buttonDisabledRenderer(nullptr), _titleRenderer(nullptr), _zoomScale(0.1f), +_normalFileName(""), +_clickedFileName(""), +_disabledFileName(""), +_normalTexType(TextureResType::LOCAL), +_pressedTexType(TextureResType::LOCAL), +_disabledTexType(TextureResType::LOCAL), +_fontName(""), _prevIgnoreSize(true), _scale9Enabled(false), _pressedActionEnabled(false), @@ -222,12 +230,18 @@ void Button::loadTextures(const std::string& normal, void Button::loadTextureNormal(const std::string& normal,TextureResType texType) { - if(normal.empty()) + _normalFileName = normal; + _normalTexType = texType; + bool textureLoaded = true; + if (normal.empty()) { - return; + _buttonNormalRenderer->init(); + textureLoaded = false; } - switch (texType) + else { + switch (texType) + { case TextureResType::LOCAL: _buttonNormalRenderer->initWithFile(normal); break; @@ -236,12 +250,12 @@ void Button::loadTextureNormal(const std::string& normal,TextureResType texType) break; default: break; + } } - this->setupNormalTexture(); - + this->setupNormalTexture(textureLoaded); } -void Button::setupNormalTexture() +void Button::setupNormalTexture(bool textureLoaded) { _normalTextureSize = _buttonNormalRenderer->getContentSize(); // force update _customSize, fixed issue: @@ -261,25 +275,30 @@ void Button::setupNormalTexture() { updateContentSizeWithTextureSize(_normalTextureSize); } - _normalTextureLoaded = true; + _normalTextureLoaded = textureLoaded; _normalTextureAdaptDirty = true; } void Button::loadTextureNormal(SpriteFrame* normalSpriteFrame) { _buttonNormalRenderer->initWithSpriteFrame(normalSpriteFrame); - this->setupNormalTexture(); + this->setupNormalTexture(nullptr != normalSpriteFrame); } void Button::loadTexturePressed(const std::string& selected,TextureResType texType) { + _clickedFileName = selected; + _pressedTexType = texType; + bool textureLoade = true; if (selected.empty()) { - return; + _buttonClickedRenderer->init(); + textureLoade = false; } - - switch (texType) + else { + switch (texType) + { case TextureResType::LOCAL: _buttonClickedRenderer->initWithFile(selected); break; @@ -288,36 +307,41 @@ void Button::loadTexturePressed(const std::string& selected,TextureResType texTy break; default: break; + } } - - this->setupPressedTexture(); + this->setupPressedTexture(textureLoade); } -void Button::setupPressedTexture() +void Button::setupPressedTexture(bool textureLoaded) { _pressedTextureSize = _buttonClickedRenderer->getContentSize(); this->updateChildrenDisplayedRGBA(); - _pressedTextureLoaded = true; + _pressedTextureLoaded = textureLoaded; _pressedTextureAdaptDirty = true; } void Button::loadTexturePressed(SpriteFrame* pressedSpriteFrame) { _buttonClickedRenderer->initWithSpriteFrame(pressedSpriteFrame); - this->setupPressedTexture(); + this->setupPressedTexture(nullptr != pressedSpriteFrame); } void Button::loadTextureDisabled(const std::string& disabled,TextureResType texType) { + _disabledFileName = disabled; + _disabledTexType = texType; + bool textureLoaded = true; if (disabled.empty()) { - return; + _buttonDisabledRenderer->init(); + textureLoaded = false; } - - switch (texType) + else { + switch (texType) + { case TextureResType::LOCAL: _buttonDisabledRenderer->initWithFile(disabled); break; @@ -326,24 +350,25 @@ void Button::loadTextureDisabled(const std::string& disabled,TextureResType texT break; default: break; + } } - this->setupDisabledTexture(); + this->setupDisabledTexture(textureLoaded); } -void Button::setupDisabledTexture() +void Button::setupDisabledTexture(bool textureLoaded) { _disabledTextureSize = _buttonDisabledRenderer->getContentSize(); this->updateChildrenDisplayedRGBA(); - _disabledTextureLoaded = true; + _disabledTextureLoaded = textureLoaded; _disabledTextureAdaptDirty = true; } void Button::loadTextureDisabled(SpriteFrame* disabledSpriteFrame) { _buttonDisabledRenderer->initWithSpriteFrame(disabledSpriteFrame); - this->setupDisabledTexture(); + this->setupDisabledTexture(nullptr != disabledSpriteFrame); } void Button::setCapInsets(const Rect &capInsets) @@ -876,6 +901,7 @@ void Button::setTitleFontName(const std::string& fontName) _titleRenderer->setSystemFontSize(_fontSize); _type = FontType::SYSTEM; } + _fontName = fontName; this->updateContentSize(); } @@ -903,7 +929,7 @@ const std::string Button::getTitleFontName() const } else { - return ""; + return _fontName; } } @@ -976,6 +1002,67 @@ Size Button::getNormalTextureSize() const { return _normalTextureSize; } + +void Button::resetNormalRender() +{ + _normalFileName = ""; + _normalTexType = TextureResType::LOCAL; + + _normalTextureSize = Size(0, 0); + + _normalTextureLoaded = false; + _normalTextureAdaptDirty = false; + + _buttonNormalRenderer->resetRender(); +} +void Button::resetPressedRender() +{ + _clickedFileName = ""; + _pressedTexType = TextureResType::LOCAL; + + _pressedTextureSize = Size(0, 0); + + _pressedTextureLoaded = false; + _pressedTextureAdaptDirty = false; + + _buttonClickedRenderer->resetRender(); +} + +void Button::resetDisabledRender() +{ + _disabledFileName = ""; + _disabledTexType = TextureResType::LOCAL; + + _disabledTextureSize = Size(0, 0); + + _disabledTextureLoaded = false; + _disabledTextureAdaptDirty = false; + + _buttonDisabledRenderer->resetRender(); +} + +ResouceData Button::getNormalFile() +{ + ResouceData rData; + rData.type = (int)_normalTexType; + rData.file = _normalFileName; + return rData; +} +ResouceData Button::getPressedFile() +{ + ResouceData rData; + rData.type = (int)_pressedTexType; + rData.file = _clickedFileName; + return rData; +} +ResouceData Button::getDisabledFile() +{ + ResouceData rData; + rData.type = (int)_disabledTexType; + rData.file = _disabledFileName; + return rData; +} + } NS_CC_END diff --git a/cocos/ui/UIButton.h b/cocos/ui/UIButton.h index aac84bbf21..1cb996f3ef 100644 --- a/cocos/ui/UIButton.h +++ b/cocos/ui/UIButton.h @@ -36,6 +36,7 @@ NS_CC_BEGIN class Label; class SpriteFrame; +struct CC_DLL ResouceData; namespace ui{ @@ -296,6 +297,14 @@ public: */ Scale9Sprite* getRendererDisabled() const { return _buttonDisabledRenderer; } + void resetNormalRender(); + void resetPressedRender(); + void resetDisabledRender(); + + ResouceData getNormalFile(); + ResouceData getPressedFile(); + ResouceData getDisabledFile(); + CC_CONSTRUCTOR_ACCESS: virtual bool init() override; virtual bool init(const std::string& normalImage, @@ -313,11 +322,11 @@ protected: virtual void onSizeChanged() override; void loadTextureNormal(SpriteFrame* normalSpriteFrame); - void setupNormalTexture(); + void setupNormalTexture(bool textureLoaded); void loadTexturePressed(SpriteFrame* pressedSpriteFrame); - void setupPressedTexture(); + void setupPressedTexture(bool textureLoaded); void loadTextureDisabled(SpriteFrame* disabledSpriteFrame); - void setupDisabledTexture(); + void setupDisabledTexture(bool textureLoaded); void normalTextureScaleChangedWithSize(); void pressedTextureScaleChangedWithSize(); @@ -363,6 +372,13 @@ protected: bool _pressedTextureAdaptDirty; bool _disabledTextureAdaptDirty; + std::string _normalFileName; + std::string _clickedFileName; + std::string _disabledFileName; + TextureResType _normalTexType; + TextureResType _pressedTexType; + TextureResType _disabledTexType; + private: enum class FontType { @@ -373,6 +389,7 @@ private: int _fontSize; FontType _type; + std::string _fontName; }; } diff --git a/cocos/ui/UIEditBox/UIEditBox.cpp b/cocos/ui/UIEditBox/UIEditBox.cpp index 32e4c708df..d87e6a64f4 100644 --- a/cocos/ui/UIEditBox/UIEditBox.cpp +++ b/cocos/ui/UIEditBox/UIEditBox.cpp @@ -268,7 +268,7 @@ void EditBox::setPlaceholderFontName(const char* pFontName) _placeholderFontName = pFontName; if (_editBoxImpl != nullptr) { - _editBoxImpl->setPlaceholderFont(pFontName, _fontSize); + _editBoxImpl->setPlaceholderFont(pFontName, _placeholderFontSize); } } diff --git a/cocos/ui/UIEditBox/UIEditBoxImpl-common.cpp b/cocos/ui/UIEditBox/UIEditBoxImpl-common.cpp index c44dec4468..364ceb2981 100644 --- a/cocos/ui/UIEditBox/UIEditBoxImpl-common.cpp +++ b/cocos/ui/UIEditBox/UIEditBoxImpl-common.cpp @@ -124,7 +124,7 @@ void EditBoxImplCommon::setInactiveText(const char* pText) void EditBoxImplCommon::setFont(const char* pFontName, int fontSize) { - this->setNativeFont(pFontName, fontSize); + this->setNativeFont(pFontName, fontSize * _label->getNodeToWorldAffineTransform().a); if(strlen(pFontName) > 0) { @@ -145,7 +145,7 @@ void EditBoxImplCommon::setFontColor(const Color4B& color) void EditBoxImplCommon::setPlaceholderFont(const char* pFontName, int fontSize) { - this->setNativePlaceholderFont(pFontName, fontSize); + this->setNativePlaceholderFont(pFontName, fontSize * _labelPlaceHolder->getNodeToWorldAffineTransform().a); if( strlen(pFontName) > 0) { @@ -249,7 +249,7 @@ void EditBoxImplCommon::setContentSize(const Size& size) auto director = cocos2d::Director::getInstance(); auto glview = director->getOpenGLView(); - Size controlSize = Size(size.width * glview->getScaleX(),size.height * glview->getScaleY()); + Size controlSize = Size(size.width * glview->getScaleX() * _label->getNodeToWorldAffineTransform().a,size.height * glview->getScaleY() * _label->getNodeToWorldAffineTransform().a); this->setNativeContentSize(controlSize); @@ -350,7 +350,7 @@ void EditBoxImplCommon::editBoxEditingDidEnd(const std::string& text) if (_editBox != nullptr) { - this->onEndEditing(text); + this->onEndEditing(_text); } } diff --git a/cocos/ui/UIEditBox/UIEditBoxImpl-mac.mm b/cocos/ui/UIEditBox/UIEditBoxImpl-mac.mm index 230a3e00b3..b5afaadf98 100644 --- a/cocos/ui/UIEditBox/UIEditBoxImpl-mac.mm +++ b/cocos/ui/UIEditBox/UIEditBoxImpl-mac.mm @@ -41,12 +41,16 @@ /** TODO: Missing doc - What does "CustomTextFieldFormatter" do? */ @interface CustomTextFieldFormatter : NSFormatter +{ + int _maximumLength; +} @property (nonatomic, assign) int maximumLength; @end @implementation CustomTextFieldFormatter +@synthesize maximumLength = _maximumLength; - (instancetype)init { @@ -88,6 +92,16 @@ #pragma mark - UIEditBox mac implementation @interface UIEditBoxImplMac : NSObject +{ + NSTextField* _textField; + NSSecureTextField* _secureTextField; + NSMutableDictionary* _placeholderAttributes; + NSWindow* _window; + + BOOL _editState; + BOOL _secure; + void* _editBox; +} @property (nonatomic, retain) NSTextField* textField; @property (nonatomic, retain) NSSecureTextField *secureTextField; @@ -110,6 +124,13 @@ @implementation UIEditBoxImplMac +@synthesize textField = _textField; +@synthesize secureTextField = _secureTextField; +@synthesize placeholderAttributes = _placeholderAttributes; +@synthesize window = _window; +@synthesize editState = _editState; +@synthesize secure = _secure; +@synthesize editBox = _editBox; - (instancetype)initWithFrame:(NSRect)frameRect editBox:(void *)editBox { diff --git a/cocos/ui/UIEditBox/UIEditBoxImpl-win32.cpp b/cocos/ui/UIEditBox/UIEditBoxImpl-win32.cpp index a311ea0075..9ad5332c85 100644 --- a/cocos/ui/UIEditBox/UIEditBoxImpl-win32.cpp +++ b/cocos/ui/UIEditBox/UIEditBoxImpl-win32.cpp @@ -37,10 +37,6 @@ #pragma warning (disable: 4312) -class CWin32InputBox; - -typedef void (*Win32InputBoxTextChange)(const char *pText, cocos2d::ui::EditBoxImplWin *ctx); - // Structure used to orient the inputbox behavior struct WIN32INPUTBOX_PARAM { @@ -72,12 +68,6 @@ struct WIN32INPUTBOX_PARAM IN DWORD nMaxLength; - IN OPTIONAL cocos2d::ui::EditBox::KeyboardReturnType eReturnType; - IN OPTIONAL cocos2d::ui::EditBox::InputMode eInputMode; - IN OPTIONAL cocos2d::ui::EditBox::InputFlag eInputFlag; - IN OPTIONAL Win32InputBoxTextChange lpfnOnTextChange; - IN OPTIONAL cocos2d::ui::EditBoxImplWin* lpCtx; - // Owner window HWND hwndOwner; HINSTANCE hInstance; @@ -96,17 +86,29 @@ private: static LRESULT CALLBACK DlgProc(HWND, UINT, WPARAM, LPARAM); HWND _hwndEditCtrl; int _recursionDepth; + HHOOK _getMsgHook; + + cocos2d::ui::EditBox::KeyboardReturnType _returnType; + cocos2d::ui::EditBox::InputMode _inputMode; + cocos2d::ui::EditBox::InputFlag _inputFlag; + std::function _onTextChange; + std::function _onClose; void InitDialog(); - void SetParam(WIN32INPUTBOX_PARAM *); - WIN32INPUTBOX_PARAM * GetParam(); + static LRESULT CALLBACK GetMsgProc(int code, WPARAM wParam, LPARAM lParam); public: CWin32InputBox(WIN32INPUTBOX_PARAM *); ~CWin32InputBox(); - static INT_PTR InputBoxEx(WIN32INPUTBOX_PARAM *); + static INT_PTR InputBoxEx(WIN32INPUTBOX_PARAM *, + cocos2d::ui::EditBox::KeyboardReturnType eReturnType, + cocos2d::ui::EditBox::InputMode eInputMode, + cocos2d::ui::EditBox::InputFlag eInputFlag, + const std::function &onTextChange, + const std::function &onClose); + static INT_PTR InputBox( LPCSTR szTitle, LPCSTR szPrompt, @@ -117,11 +119,11 @@ public: cocos2d::ui::EditBox::KeyboardReturnType eReturnType, cocos2d::ui::EditBox::InputMode eInputMode, cocos2d::ui::EditBox::InputFlag eInputFlag, - Win32InputBoxTextChange lpfnOnTextChange, - cocos2d::ui::EditBoxImplWin *ctx); + const std::function &onTextChange, + const std::function &onClose); void SetText(const char *pText); - void Close(); + void Close(INT_PTR buttonId); }; @@ -221,27 +223,23 @@ WIN32INPUTBOX_PARAM::WIN32INPUTBOX_PARAM() CWin32InputBox::CWin32InputBox(WIN32INPUTBOX_PARAM *param) { - _param = param; + _param = new (std::nothrow) WIN32INPUTBOX_PARAM(*param); _hwndEditCtrl = NULL; _recursionDepth = 0; + _getMsgHook = NULL; } CWin32InputBox::~CWin32InputBox() { - + CC_SAFE_DELETE(_param); } -void CWin32InputBox::SetParam(WIN32INPUTBOX_PARAM *param) -{ - _param = param; -} - -WIN32INPUTBOX_PARAM *CWin32InputBox::GetParam() -{ - return _param; -} - -INT_PTR CWin32InputBox::InputBoxEx(WIN32INPUTBOX_PARAM *param) +INT_PTR CWin32InputBox::InputBoxEx(WIN32INPUTBOX_PARAM *param, + cocos2d::ui::EditBox::KeyboardReturnType eReturnType, + cocos2d::ui::EditBox::InputMode eInputMode, + cocos2d::ui::EditBox::InputFlag eInputFlag, + const std::function &onTextChange, + const std::function &onClose) { // Check mandatory parameters if (param->pstrResult == nullptr) @@ -309,15 +307,20 @@ INT_PTR CWin32InputBox::InputBoxEx(WIN32INPUTBOX_PARAM *param) dlgTemplate->y = param->yPos; } - CWin32InputBox inputbox(param); - s_win32InputBox = &inputbox; + CCAssert(s_win32InputBox == nullptr, "Only one instance of Win32InputBox allowed"); - // Resize dialog and SHOW or HIDE multiline - INT_PTR r = ::DialogBoxIndirectParam(param->hInstance, dlgTemplate, param->hwndOwner, (DLGPROC)DlgProc, (LPARAM)&inputbox); - param->hDlg = NULL; - s_win32InputBox = nullptr; + s_win32InputBox = new (std::nothrow) CWin32InputBox(param); + s_win32InputBox->_returnType = eReturnType; + s_win32InputBox->_inputMode = eInputMode; + s_win32InputBox->_inputFlag = eInputFlag; + s_win32InputBox->_onTextChange = onTextChange; + s_win32InputBox->_onClose = onClose; - return r; + HWND hDlg = ::CreateDialogIndirectParam(param->hInstance, dlgTemplate, param->hwndOwner, (DLGPROC)DlgProc, (LPARAM)s_win32InputBox); + ::ShowWindow(hDlg, SW_SHOW); + ::EnableWindow(param->hwndOwner, FALSE); + + return TRUE; } INT_PTR CWin32InputBox::InputBox( @@ -330,8 +333,8 @@ INT_PTR CWin32InputBox::InputBox( cocos2d::ui::EditBox::KeyboardReturnType eReturnType, cocos2d::ui::EditBox::InputMode eInputMode, cocos2d::ui::EditBox::InputFlag eInputFlag, - Win32InputBoxTextChange lpfnOnTextChange, - cocos2d::ui::EditBoxImplWin *ctx) + const std::function &onTextChange, + const std::function &onClose) { WIN32INPUTBOX_PARAM param; @@ -341,18 +344,14 @@ INT_PTR CWin32InputBox::InputBox( param.nMaxLength = nResultSize; param.bMultiline = bMultiLine; param.hwndOwner = hwndParent; - param.eReturnType = eReturnType; - param.eInputMode = eInputMode; - param.eInputFlag = eInputFlag; - param.lpfnOnTextChange = lpfnOnTextChange; - param.lpCtx = ctx; - return InputBoxEx(¶m); + + return InputBoxEx(¶m, eReturnType, eInputMode, eInputFlag, onTextChange, onClose); } void CWin32InputBox::InitDialog() { // Set the button captions, associated with ReturnType - switch (_param->eReturnType) + switch (_returnType) { case cocos2d::ui::EditBox::KeyboardReturnType::DEFAULT: ::SetDlgItemTextW(_param->hDlg, IDOK, L"OK"); @@ -444,7 +443,7 @@ void CWin32InputBox::InitDialog() ::SendMessageW(hwndEdit2, EM_LIMITTEXT, (WPARAM)_param->nMaxLength, 0); } - switch (_param->eInputFlag) + switch (_inputFlag) { case cocos2d::ui::EditBox::InputFlag::PASSWORD: // Sets a password character displayed in a edit control when the user types text. @@ -468,7 +467,7 @@ void CWin32InputBox::InitDialog() break; } - switch (_param->eInputMode) + switch (_inputMode) { case cocos2d::ui::EditBox::InputMode::ANY: break; @@ -492,81 +491,91 @@ void CWin32InputBox::InitDialog() default: break; } + + CCAssert(_getMsgHook == NULL, "Windows Message hook already set"); + + // To make the enter key work, here need a Windows Message hook. + // Please refer to https://support.microsoft.com/en-us/kb/187988 + _getMsgHook = ::SetWindowsHookEx(WH_GETMESSAGE, &CWin32InputBox::GetMsgProc, ::GetModuleHandle(nullptr), ::GetCurrentThreadId()); } -#define REDNERING_TIMER_ID 2015 +LRESULT CALLBACK CWin32InputBox::GetMsgProc(int code, WPARAM wParam, LPARAM lParam) +{ + if (code == HC_ACTION) + { + LPMSG lpMsg = (LPMSG)lParam; + if (lpMsg->message == WM_KEYDOWN) + { + if (lpMsg->wParam == VK_RETURN) // User has hit the ENTER key. + { + // Translate the message manually. + lpMsg->hwnd = s_win32InputBox->_param->hDlg; + lpMsg->message = WM_COMMAND; + lpMsg->wParam = IDOK; + } + } + } + return ::CallNextHookEx(s_win32InputBox->_getMsgHook, code, wParam, lParam); +} // 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); + SetWindowLongPtr(hDlg, GWLP_USERDATA, (LONG_PTR)lParam); - _this = (CWin32InputBox *)lParam; - _this->_param->hDlg = hDlg; - _this->InitDialog(); - - // Set timer for rendering - TIMERPROC lpTimerFunc = [](HWND, UINT, UINT, DWORD) { - auto director = cocos2d::Director::getInstance(); - auto glview = director->getOpenGLView(); - director->mainLoop(); - glview->pollEvents(); - }; - ::SetTimer(hDlg, REDNERING_TIMER_ID, USER_TIMER_MINIMUM, lpTimerFunc); - return TRUE; + _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); - OutputDebugStringA(buf); + CHAR buf[1024]; + static int i = 0; + sprintf(buf, "WM_COMMAND: %09d wParam=%08X lParam=%08X\n", i++, wParam, lParam); + OutputDebugStringA(buf); #endif - INT_PTR buttonId = LOWORD(wParam); - if (buttonId == IDOK || buttonId == IDCANCEL) - { - // Yes! Just close the dialog box simply, - // because the text of EditBox has been already synced at the moment of text altered in the edit control - ::EndDialog(hDlg, buttonId); - return TRUE; - } + INT_PTR buttonId = LOWORD(wParam); + if (buttonId == IDOK || buttonId == IDCANCEL) + { + // Yes! Just close the dialog box simply, + // because the text of EditBox has been already synced at the moment of text altered in the edit control + _this->Close(buttonId); + return TRUE; + } - // text altered in the edit control - // Please refer to https://msdn.microsoft.com/en-us/library/bb761676%28v=vs.85%29.aspx - if (HIWORD(wParam) == EN_CHANGE && _this->_recursionDepth == 0 && _this->_param->lpfnOnTextChange != nullptr) - { - std::u16string wstrResult; - std::string utf8Result; + // text altered in the edit control + // Please refer to https://msdn.microsoft.com/en-us/library/bb761676%28v=vs.85%29.aspx + if (HIWORD(wParam) == EN_CHANGE && _this->_recursionDepth == 0) + { + std::u16string wstrResult; + std::string utf8Result; - int inputLength = ::GetWindowTextLengthW(_this->_hwndEditCtrl); - wstrResult.resize(inputLength); + int inputLength = ::GetWindowTextLengthW(_this->_hwndEditCtrl); + wstrResult.resize(inputLength); - ::GetWindowTextW( - _this->_hwndEditCtrl, - (LPWSTR) const_cast(wstrResult.c_str()), - inputLength+1); + ::GetWindowTextW(_this->_hwndEditCtrl, (LPWSTR) const_cast(wstrResult.c_str()), inputLength+1); + bool conversionResult = cocos2d::StringUtils::UTF16ToUTF8(wstrResult, utf8Result); + _this->_param->pstrResult->clear(); + ++_this->_recursionDepth; // Prevent recursive calls + if (conversionResult) + { + *(_this->_param->pstrResult) = std::move(utf8Result); + } - bool conversionResult = cocos2d::StringUtils::UTF16ToUTF8(wstrResult, utf8Result); - _this->_param->pstrResult->clear(); - ++_this->_recursionDepth; // Prevent recursive calls - if (conversionResult) - { - *(_this->_param->pstrResult) = std::move(utf8Result); - } - // Invoke editBoxTextChanged indirectly - _this->_param->lpfnOnTextChange(_this->_param->pstrResult->c_str(), _this->_param->lpCtx); - --_this->_recursionDepth; - return TRUE; - } + // Invoke editBoxTextChanged indirectly + _this->_onTextChange(_this->_param->pstrResult->c_str()); + --_this->_recursionDepth; + return TRUE; + } } break; } @@ -592,12 +601,22 @@ void CWin32InputBox::SetText(const char* pText) } } -void CWin32InputBox::Close() +void CWin32InputBox::Close(INT_PTR buttonId) { + if (_getMsgHook != NULL) + { + ::UnhookWindowsHookEx(_getMsgHook); + _getMsgHook = NULL; + } + if (_param->hDlg != NULL) { - ::EndDialog(_param->hDlg, IDCANCEL); + ::EnableWindow(_param->hwndOwner, TRUE); + ::SetFocus(_param->hwndOwner); + ::DestroyWindow(_param->hDlg); _param->hDlg = NULL; + + _onClose(buttonId); } } @@ -622,7 +641,7 @@ EditBoxImplWin::EditBoxImplWin(EditBox* pEditText) , _maxLength(-1) , _isEditing(false) { - + } EditBoxImplWin::~EditBoxImplWin() @@ -640,7 +659,7 @@ bool EditBoxImplWin::initWithSize(const Size& size) //! int fontSize = getFontSizeAccordingHeightJni(size.height-12); _label = Label::create(); _label->setSystemFontSize(size.height-12); - // align the text vertically center + // align the text vertically center _label->setAnchorPoint(Vec2(0, 0.5f)); _label->setPosition(Vec2(CC_EDIT_BOX_PADDING, size.height / 2.0f)); _label->setTextColor(_colText); @@ -648,42 +667,42 @@ bool EditBoxImplWin::initWithSize(const Size& size) _labelPlaceHolder = Label::create(); _labelPlaceHolder->setSystemFontSize(size.height-12); - // align the text vertically center + // align the text vertically center _labelPlaceHolder->setAnchorPoint(Vec2(0, 0.5f)); _labelPlaceHolder->setPosition(CC_EDIT_BOX_PADDING, size.height / 2.0f); _labelPlaceHolder->setVisible(false); _labelPlaceHolder->setTextColor(_colPlaceHolder); _editBox->addChild(_labelPlaceHolder); - + _editSize = size; return true; } void EditBoxImplWin::setFont(const char* pFontName, int fontSize) { - if (_label != nullptr) - { - if(strlen(pFontName) > 0) - { - _label->setSystemFontName(pFontName); - } - if(fontSize > 0) - { - _label->setSystemFontSize(fontSize); - } - } - - if (_labelPlaceHolder != nullptr) - { - if(strlen(pFontName) > 0) - { - _labelPlaceHolder->setSystemFontName(pFontName); - } - if(fontSize > 0) - { - _labelPlaceHolder->setSystemFontSize(fontSize); - } - } + if (_label != nullptr) + { + if (pFontName[0] != '\0') // To determine whether a string is empty quickly + { + _label->setSystemFontName(pFontName); + } + if (fontSize > 0) + { + _label->setSystemFontSize(fontSize); + } + } + + if (_labelPlaceHolder != nullptr) + { + if (pFontName[0] != '\0') // To determine whether a string is empty quickly + { + _labelPlaceHolder->setSystemFontName(pFontName); + } + if (fontSize > 0) + { + _labelPlaceHolder->setSystemFontSize(fontSize); + } + } } void EditBoxImplWin::setFontColor(const Color4B& color) @@ -694,17 +713,17 @@ void EditBoxImplWin::setFontColor(const Color4B& color) void EditBoxImplWin::setPlaceholderFont(const char* pFontName, int fontSize) { - if (_labelPlaceHolder != nullptr) - { - if(strlen(pFontName) > 0) - { - _labelPlaceHolder->setSystemFontName(pFontName); - } - if(fontSize > 0) - { - _labelPlaceHolder->setSystemFontSize(fontSize); - } - } + if (_labelPlaceHolder != nullptr) + { + if (pFontName[0] != '\0') // To determine whether a string is empty quickly + { + _labelPlaceHolder->setSystemFontName(pFontName); + } + if (fontSize > 0) + { + _labelPlaceHolder->setSystemFontSize(fontSize); + } + } } void EditBoxImplWin::setPlaceholderFontColor(const Color4B& color) @@ -762,9 +781,9 @@ void EditBoxImplWin::setText(const char* pText) { _labelPlaceHolder->setVisible(false); - if (EditBox::InputFlag::PASSWORD == _editBoxInputFlag) + if (EditBox::InputFlag::PASSWORD == _editBoxInputFlag) { - long length = StringUtils::getCharacterCountInUTF8String(_text); + long length = StringUtils::getCharacterCountInUTF8String(_text); std::string strToShow(length, '*'); // Fills strToShow with length consecutive copies of character '*' _label->setString(strToShow); } @@ -772,7 +791,7 @@ void EditBoxImplWin::setText(const char* pText) { _label->setString(_text); } - + float maxWidth = _editSize.width - 2 * CC_EDIT_BOX_PADDING; auto labelSize = _label->getContentSize(); if (labelSize.width > maxWidth) @@ -810,8 +829,8 @@ void EditBoxImplWin::setPlaceHolder(const char* pText) void EditBoxImplWin::setPosition(const Vec2& pos) { - //_label->setPosition(pos); - //_labelPlaceHolder->setPosition(pos); + //_label->setPosition(pos); + //_labelPlaceHolder->setPosition(pos); } void EditBoxImplWin::setVisible(bool visible) @@ -824,15 +843,19 @@ void EditBoxImplWin::setContentSize(const Size& size) void EditBoxImplWin::setAnchorPoint(const Vec2& anchorPoint) { // don't need to be implemented on win32 platform. - } void EditBoxImplWin::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) -{ +{ } void EditBoxImplWin::openKeyboard() { + if (s_win32InputBox != nullptr) + { + return; + } + if (_delegate != nullptr) { _delegate->editBoxEditingDidBegin(_editBox); @@ -843,38 +866,45 @@ void EditBoxImplWin::openKeyboard() auto editBox = this->getEditBox(); if (nullptr != editBox && 0 != editBox->getScriptEditBoxHandler()) { - CommonScriptData data(editBox->getScriptEditBoxHandler(), "began",editBox); - ScriptEvent event(kCommonEvent,(void*)&data); + CommonScriptData data(editBox->getScriptEditBoxHandler(), "began", editBox); + ScriptEvent event(kCommonEvent, (void*)&data); ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event); } #endif - - std::string placeHolder = _labelPlaceHolder->getString(); - if (placeHolder.length() == 0) - placeHolder = "Enter value"; - std::string text = getText(); - std::string originalText = text; - auto glView = Director::getInstance()->getOpenGLView(); - HWND hwnd = glView->getWin32Window(); - bool didChange = CWin32InputBox::InputBox("Input", placeHolder.c_str(), &text, _maxLength, false, hwnd, + std::string placeHolder = _labelPlaceHolder->getString(); + if (placeHolder.length() == 0) + placeHolder = "Enter value"; + + _editingText = getText(); + _originalText = _editingText; + auto glView = Director::getInstance()->getOpenGLView(); + HWND hwnd = glView->getWin32Window(); + CWin32InputBox::InputBox("Input", placeHolder.c_str(), &_editingText, _maxLength, false, hwnd, _keyboardReturnType, _editBoxInputMode, _editBoxInputFlag, - &EditBoxImplWin::onWin32InputBoxTextChange, this) == IDOK; - _isEditing = false; - - setText(didChange ? text.c_str() : originalText.c_str()); + std::bind(&EditBoxImplWin::onWin32InputBoxTextChange, this, std::placeholders::_1), + std::bind(&EditBoxImplWin::onWin32InputBoxClose, this, std::placeholders::_1)); +} + +void EditBoxImplWin::onWin32InputBoxClose(INT_PTR buttonId) +{ + bool didChange = buttonId == IDOK; + CC_SAFE_DELETE(s_win32InputBox); + _isEditing = false; + + setText(didChange ? _editingText.c_str() : _originalText.c_str()); + + if (_delegate != nullptr) + { + _delegate->editBoxTextChanged(_editBox, getText()); + _delegate->editBoxEditingDidEnd(_editBox); + _delegate->editBoxReturn(_editBox); + } - if (_delegate != nullptr) - { - _delegate->editBoxTextChanged(_editBox, getText()); - _delegate->editBoxEditingDidEnd(_editBox); - _delegate->editBoxReturn(_editBox); - } - #if CC_ENABLE_SCRIPT_BINDING if (nullptr != _editBox && 0 != _editBox->getScriptEditBoxHandler()) { - CommonScriptData data(_editBox->getScriptEditBoxHandler(), "changed",_editBox); + CommonScriptData data(_editBox->getScriptEditBoxHandler(), "changed", _editBox); ScriptEvent event(kCommonEvent,(void*)&data); ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event); memset(data.eventName,0,sizeof(data.eventName)); @@ -889,23 +919,21 @@ void EditBoxImplWin::openKeyboard() #endif // #if CC_ENABLE_SCRIPT_BINDING } -void EditBoxImplWin::onWin32InputBoxTextChange(const char *pText, EditBoxImplWin* thiz) +void EditBoxImplWin::onWin32InputBoxTextChange(const char *pText) { - thiz->_isEditing = false; // Prevent recursive calls - thiz->setText(pText); - thiz->_isEditing = true; + _isEditing = false; // Prevent recursive calls + setText(pText); + _isEditing = true; - auto delegate = thiz->getDelegate(); - if (delegate != nullptr) + if (_delegate != nullptr) { - delegate->editBoxTextChanged(thiz->_editBox, thiz->_text); + _delegate->editBoxTextChanged(_editBox, _text); } #if CC_ENABLE_SCRIPT_BINDING - auto editBox = thiz->getEditBox(); - if (nullptr != editBox && 0 != editBox->getScriptEditBoxHandler()) + if (nullptr != _editBox && 0 != _editBox->getScriptEditBoxHandler()) { - CommonScriptData data(editBox->getScriptEditBoxHandler(), "changed", editBox); + CommonScriptData data(_editBox->getScriptEditBoxHandler(), "changed", _editBox); ScriptEvent event(kCommonEvent, (void*)&data); ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event); } @@ -917,8 +945,8 @@ void EditBoxImplWin::closeKeyboard() // close the running Win32InputBox if (s_win32InputBox != nullptr) { - s_win32InputBox->Close(); - s_win32InputBox = nullptr; + s_win32InputBox->Close(IDCANCEL); + CC_SAFE_DELETE(s_win32InputBox); _isEditing = false; } } diff --git a/cocos/ui/UIEditBox/UIEditBoxImpl-win32.h b/cocos/ui/UIEditBox/UIEditBoxImpl-win32.h index 9ebfa94162..f18bd145df 100644 --- a/cocos/ui/UIEditBox/UIEditBoxImpl-win32.h +++ b/cocos/ui/UIEditBox/UIEditBoxImpl-win32.h @@ -105,8 +105,12 @@ private: HWND _sysEdit; int _maxTextLength; */ + std::string _editingText; + std::string _originalText; bool _isEditing; - static void onWin32InputBoxTextChange(const char *pText, EditBoxImplWin *thiz); + + void onWin32InputBoxTextChange(const char *pText); + void onWin32InputBoxClose(INT_PTR buttonId); }; diff --git a/cocos/ui/UIImageView.cpp b/cocos/ui/UIImageView.cpp index 3bda9b3fc8..9eb5619dda 100644 --- a/cocos/ui/UIImageView.cpp +++ b/cocos/ui/UIImageView.cpp @@ -26,6 +26,7 @@ THE SOFTWARE. #include "ui/UIScale9Sprite.h" #include "ui/UIHelper.h" #include "2d/CCSprite.h" +#include "2d/CocosStudioExtension.h" NS_CC_BEGIN @@ -39,6 +40,7 @@ ImageView::ImageView(): _scale9Enabled(false), _prevIgnoreSize(true), _capInsets(Rect::ZERO), +_textureFile(""), _imageRenderer(nullptr), _imageTexType(TextureResType::LOCAL), _imageTextureSize(_contentSize), @@ -121,6 +123,7 @@ void ImageView::loadTexture(const std::string& fileName, TextureResType texType) { return; } + _textureFile = fileName; _imageTexType = texType; switch (_imageTexType) { @@ -311,6 +314,14 @@ void ImageView::copySpecialProperties(Widget *widget) } } +ResouceData ImageView::getRenderFile() +{ + ResouceData rData; + rData.type = (int)_imageTexType; + rData.file = _textureFile; + return rData; +} + } NS_CC_END diff --git a/cocos/ui/UIImageView.h b/cocos/ui/UIImageView.h index 8289fea104..bcd3f700a5 100644 --- a/cocos/ui/UIImageView.h +++ b/cocos/ui/UIImageView.h @@ -34,6 +34,8 @@ THE SOFTWARE. */ NS_CC_BEGIN +struct CC_DLL ResouceData; + namespace ui { class Scale9Sprite; /** @@ -121,7 +123,9 @@ public: virtual std::string getDescription() const override; virtual Size getVirtualRendererSize() const override; virtual Node* getVirtualRenderer() override; - + + ResouceData getRenderFile(); + CC_CONSTRUCTOR_ACCESS: //initializes state of widget. virtual bool init() override; @@ -146,6 +150,7 @@ protected: TextureResType _imageTexType; Size _imageTextureSize; bool _imageRendererAdaptDirty; + std::string _textureFile; }; } diff --git a/cocos/ui/UILayout.cpp b/cocos/ui/UILayout.cpp index 3f8cc02db8..6603846d9b 100644 --- a/cocos/ui/UILayout.cpp +++ b/cocos/ui/UILayout.cpp @@ -37,6 +37,8 @@ THE SOFTWARE. #include "2d/CCLayer.h" #include "2d/CCSprite.h" #include "base/CCEventFocus.h" +#include "base/CCStencilStateManager.hpp" +#include "2d/CocosStudioExtension.h" NS_CC_BEGIN @@ -45,9 +47,6 @@ namespace ui { static const int BACKGROUNDIMAGE_Z = (-1); static const int BCAKGROUNDCOLORRENDERER_Z = (-2); - -static GLint g_sStencilBits = -1; -static GLint s_layer = -1; IMPLEMENT_CLASS_GUI_INFO(Layout) @@ -75,18 +74,7 @@ _clippingStencil(nullptr), _clippingRect(Rect::ZERO), _clippingParent(nullptr), _clippingRectDirty(true), -_currentStencilEnabled(GL_FALSE), -_currentStencilWriteMask(~0), -_currentStencilFunc(GL_ALWAYS), -_currentStencilRef(0), -_currentStencilValueMask(~0), -_currentStencilFail(GL_KEEP), -_currentStencilPassDepthFail(GL_KEEP), -_currentStencilPassDepthPass(GL_KEEP), -_currentDepthWriteMask(GL_TRUE), -_currentAlphaTestEnabled(GL_FALSE), -_currentAlphaTestFunc(GL_ALWAYS), -_currentAlphaTestRef(1), +_stencileStateManager(new StencilStateManager()), _doLayoutDirty(true), _isInterceptTouch(false), _loopFocus(false), @@ -265,13 +253,13 @@ void Layout::stencilClippingVisit(Renderer *renderer, const Mat4& parentTransfor renderer->pushGroup(_groupCommand.getRenderQueueID()); _beforeVisitCmdStencil.init(_globalZOrder); - _beforeVisitCmdStencil.func = CC_CALLBACK_0(Layout::onBeforeVisitStencil, this); + _beforeVisitCmdStencil.func = CC_CALLBACK_0(StencilStateManager::onBeforeVisit, _stencileStateManager); renderer->addCommand(&_beforeVisitCmdStencil); _clippingStencil->visit(renderer, _modelViewTransform, flags); _afterDrawStencilCmd.init(_globalZOrder); - _afterDrawStencilCmd.func = CC_CALLBACK_0(Layout::onAfterDrawStencil, this); + _afterDrawStencilCmd.func = CC_CALLBACK_0(StencilStateManager::onAfterDrawStencil, _stencileStateManager); renderer->addCommand(&_afterDrawStencilCmd); int i = 0; // used by _children @@ -319,7 +307,7 @@ void Layout::stencilClippingVisit(Renderer *renderer, const Mat4& parentTransfor _afterVisitCmdStencil.init(_globalZOrder); - _afterVisitCmdStencil.func = CC_CALLBACK_0(Layout::onAfterVisitStencil, this); + _afterVisitCmdStencil.func = CC_CALLBACK_0(StencilStateManager::onAfterVisit, _stencileStateManager); renderer->addCommand(&_afterVisitCmdStencil); renderer->popGroup(); @@ -327,136 +315,6 @@ void Layout::stencilClippingVisit(Renderer *renderer, const Mat4& parentTransfor director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); } -void Layout::onBeforeVisitStencil() -{ - s_layer++; - GLint mask_layer = 0x1 << s_layer; - GLint mask_layer_l = mask_layer - 1; - _mask_layer_le = mask_layer | mask_layer_l; - _currentStencilEnabled = glIsEnabled(GL_STENCIL_TEST); - glGetIntegerv(GL_STENCIL_WRITEMASK, (GLint *)&_currentStencilWriteMask); - glGetIntegerv(GL_STENCIL_FUNC, (GLint *)&_currentStencilFunc); - glGetIntegerv(GL_STENCIL_REF, &_currentStencilRef); - glGetIntegerv(GL_STENCIL_VALUE_MASK, (GLint *)&_currentStencilValueMask); - glGetIntegerv(GL_STENCIL_FAIL, (GLint *)&_currentStencilFail); - glGetIntegerv(GL_STENCIL_PASS_DEPTH_FAIL, (GLint *)&_currentStencilPassDepthFail); - glGetIntegerv(GL_STENCIL_PASS_DEPTH_PASS, (GLint *)&_currentStencilPassDepthPass); - - glEnable(GL_STENCIL_TEST); -// RenderState::StateBlock::_defaultState->setStencilTest(true); - - CHECK_GL_ERROR_DEBUG(); - glStencilMask(mask_layer); -// RenderState::StateBlock::_defaultState->setStencilWrite(mask_layer); - - glGetBooleanv(GL_DEPTH_WRITEMASK, &_currentDepthWriteMask); - - glDepthMask(GL_FALSE); - RenderState::StateBlock::_defaultState->setDepthWrite(false); - - glStencilFunc(GL_NEVER, mask_layer, mask_layer); - glStencilOp(GL_ZERO, GL_KEEP, GL_KEEP); - - - this->drawFullScreenQuadClearStencil(); - - glStencilFunc(GL_NEVER, mask_layer, mask_layer); -// RenderState::StateBlock::_defaultState->setStencilFunction( -// RenderState::STENCIL_NEVER, -// mask_layer, -// mask_layer); - - glStencilOp(GL_REPLACE, GL_KEEP, GL_KEEP); -// RenderState::StateBlock::_defaultState->setStencilOperation( -// RenderState::STENCIL_OP_REPLACE, -// RenderState::STENCIL_OP_KEEP, -// RenderState::STENCIL_OP_KEEP); -} - -void Layout::drawFullScreenQuadClearStencil() -{ - Director* director = Director::getInstance(); - CCASSERT(nullptr != director, "Director is null when setting matrix stack"); - - director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); - director->loadIdentityMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); - - director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION); - director->loadIdentityMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION); - - Vec2 vertices[] = - { - Vec2(-1, -1), - Vec2(1, -1), - Vec2(1, 1), - Vec2(-1, 1) - }; - - auto glProgram = GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_NAME_POSITION_U_COLOR); - - int colorLocation = glProgram->getUniformLocation("u_color"); - CHECK_GL_ERROR_DEBUG(); - - Color4F color(1, 1, 1, 1); - - glProgram->use(); - glProgram->setUniformsForBuiltins(); - glProgram->setUniformLocationWith4fv(colorLocation, (GLfloat*) &color.r, 1); - - GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION ); - - glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices); - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - - CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, 4); - - director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION); - director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); -} - -void Layout::onAfterDrawStencil() -{ - glDepthMask(_currentDepthWriteMask); - RenderState::StateBlock::_defaultState->setDepthWrite(_currentDepthWriteMask != 0); - - glStencilFunc(GL_EQUAL, _mask_layer_le, _mask_layer_le); -// RenderState::StateBlock::_defaultState->setStencilFunction( -// RenderState::STENCIL_EQUAL, -// _mask_layer_le, -// _mask_layer_le); - - glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); -// RenderState::StateBlock::_defaultState->setStencilOperation( -// RenderState::STENCIL_OP_KEEP, -// RenderState::STENCIL_OP_KEEP, -// RenderState::STENCIL_OP_KEEP); - -} - - -void Layout::onAfterVisitStencil() -{ - glStencilFunc(_currentStencilFunc, _currentStencilRef, _currentStencilValueMask); -// RenderState::StateBlock::_defaultState->setStencilFunction( -// (RenderState::StencilFunction)_currentStencilFunc, -// _currentStencilRef, -// _currentStencilValueMask); - - glStencilOp(_currentStencilFail, _currentStencilPassDepthFail, _currentStencilPassDepthPass); -// RenderState::StateBlock::_defaultState->setStencilOperation( -// (RenderState::StencilOperation)_currentStencilFail, -// (RenderState::StencilOperation)_currentStencilPassDepthFail, -// (RenderState::StencilOperation)_currentStencilPassDepthPass); - - glStencilMask(_currentStencilWriteMask); - if (!_currentStencilEnabled) - { - glDisable(GL_STENCIL_TEST); -// RenderState::StateBlock::_defaultState->setStencilTest(false); - } - s_layer--; -} - void Layout::onBeforeVisitScissor() { auto glview = Director::getInstance()->getOpenGLView(); @@ -529,16 +387,6 @@ void Layout::setClippingEnabled(bool able) case ClippingType::STENCIL: if (able) { - static bool once = true; - if (once) - { - glGetIntegerv(GL_STENCIL_BITS, &g_sStencilBits); - if (g_sStencilBits <= 0) - { - CCLOG("Stencil buffer is not enabled."); - } - once = false; - } _clippingStencil = DrawNode::create(); if (_running) { @@ -2032,5 +1880,13 @@ void Layout::setCameraMask(unsigned short mask, bool applyChildren) } } +ResouceData Layout::getRenderFile() +{ + ResouceData rData; + rData.type = (int)_bgImageTexType; + rData.file = _backGroundImageFileName; + return rData; +} + } NS_CC_END diff --git a/cocos/ui/UILayout.h b/cocos/ui/UILayout.h index f98c37bcdf..20379b848a 100644 --- a/cocos/ui/UILayout.h +++ b/cocos/ui/UILayout.h @@ -39,7 +39,8 @@ NS_CC_BEGIN class DrawNode; class LayerColor; class LayerGradient; - +class StencilStateManager; +struct CC_DLL ResouceData; namespace ui { @@ -458,6 +459,8 @@ public: */ virtual void setCameraMask(unsigned short mask, bool applyChildren = true) override; + ResouceData getRenderFile(); + CC_CONSTRUCTOR_ACCESS: //override "init" method of widget. virtual bool init() override; @@ -486,12 +489,6 @@ protected: virtual const Vector& getLayoutElements()const override; //clipping - void onBeforeVisitStencil(); - void onAfterDrawStencil(); - void onAfterVisitStencil(); - /**draw fullscreen quad to clear stencil bits - */ - void drawFullScreenQuadClearStencil(); void onBeforeVisitScissor(); void onAfterVisitScissor(); @@ -635,23 +632,8 @@ protected: bool _clippingRectDirty; //clipping + StencilStateManager *_stencileStateManager; - GLboolean _currentStencilEnabled; - GLuint _currentStencilWriteMask; - GLenum _currentStencilFunc; - GLint _currentStencilRef; - GLuint _currentStencilValueMask; - GLenum _currentStencilFail; - GLenum _currentStencilPassDepthFail; - GLenum _currentStencilPassDepthPass; - GLboolean _currentDepthWriteMask; - - GLboolean _currentAlphaTestEnabled; - GLenum _currentAlphaTestFunc; - GLclampf _currentAlphaTestRef; - - - GLint _mask_layer_le; GroupCommand _groupCommand; CustomCommand _beforeVisitCmdStencil; CustomCommand _afterDrawStencilCmd; diff --git a/cocos/ui/UILayoutComponent.cpp b/cocos/ui/UILayoutComponent.cpp index 56fbee58a7..892d242522 100644 --- a/cocos/ui/UILayoutComponent.cpp +++ b/cocos/ui/UILayoutComponent.cpp @@ -184,7 +184,7 @@ namespace ui { else { _positionPercentX = 0; - if (_usingPositionPercentX) + if (_usingPositionPercentX || _horizontalEdge == HorizontalEdge::Center) ownerPoint.x = 0; } @@ -193,7 +193,7 @@ namespace ui { else { _positionPercentY = 0; - if (_usingPositionPercentY) + if (_usingPositionPercentY || _verticalEdge == VerticalEdge::Center) ownerPoint.y = 0; } @@ -227,11 +227,14 @@ namespace ui { { _positionPercentX = percentMargin; - Node* parent = this->getOwnerParent(); - if (parent != nullptr) + if (_usingPositionPercentX || _horizontalEdge == HorizontalEdge::Center) { - _owner->setPositionX(parent->getContentSize().width * _positionPercentX); - this->refreshHorizontalMargin(); + Node* parent = this->getOwnerParent(); + if (parent != nullptr) + { + _owner->setPositionX(parent->getContentSize().width * _positionPercentX); + this->refreshHorizontalMargin(); + } } } @@ -256,11 +259,14 @@ namespace ui { { _positionPercentY = percentMargin; - Node* parent = this->getOwnerParent(); - if (parent != nullptr) + if (_usingPositionPercentY || _verticalEdge == VerticalEdge::Center) { - _owner->setPositionY(parent->getContentSize().height * _positionPercentY); - this->refreshVerticalMargin(); + Node* parent = this->getOwnerParent(); + if (parent != nullptr) + { + _owner->setPositionY(parent->getContentSize().height * _positionPercentY); + this->refreshVerticalMargin(); + } } } @@ -275,24 +281,6 @@ namespace ui { { _usingPositionPercentX = false; } - - Node* parent = this->getOwnerParent(); - if (parent != nullptr) - { - Point ownerPoint = _owner->getPosition(); - const Size& parentSize = parent->getContentSize(); - if (parentSize.width != 0) - _positionPercentX = ownerPoint.x / parentSize.width; - else - { - _positionPercentX = 0; - ownerPoint.x = 0; - if (_usingPositionPercentX) - _owner->setPosition(ownerPoint); - } - - this->refreshHorizontalMargin(); - } } LayoutComponent::VerticalEdge LayoutComponent::getVerticalEdge()const @@ -306,24 +294,6 @@ namespace ui { { _usingPositionPercentY = false; } - - Node* parent = this->getOwnerParent(); - if (parent != nullptr) - { - Point ownerPoint = _owner->getPosition(); - const Size& parentSize = parent->getContentSize(); - if (parentSize.height != 0) - _positionPercentY = ownerPoint.y / parentSize.height; - else - { - _positionPercentY = 0; - ownerPoint.y = 0; - if (_usingPositionPercentY) - _owner->setPosition(ownerPoint); - } - - this->refreshVerticalMargin(); - } } float LayoutComponent::getLeftMargin()const @@ -380,7 +350,7 @@ namespace ui { else { _percentWidth = 0; - if (_usingPercentWidth) + if (_usingPercentWidth || (this->_horizontalEdge != HorizontalEdge::Center && this->_usingStretchWidth)) ownerSize.width = 0; } @@ -389,7 +359,7 @@ namespace ui { else { _percentHeight = 0; - if (_usingPercentHeight) + if (_usingPercentHeight || (this->_verticalEdge != VerticalEdge::Center && this->_usingStretchHeight)) ownerSize.height = 0; } @@ -451,14 +421,17 @@ namespace ui { { _percentWidth = percentWidth; - Node* parent = this->getOwnerParent(); - if (parent != nullptr) + if (_usingPercentWidth) { - Size ownerSize = _owner->getContentSize(); - ownerSize.width = parent->getContentSize().width * _percentWidth; - _owner->setContentSize(ownerSize); + Node* parent = this->getOwnerParent(); + if (parent != nullptr) + { + Size ownerSize = _owner->getContentSize(); + ownerSize.width = parent->getContentSize().width * _percentWidth; + _owner->setContentSize(ownerSize); - this->refreshHorizontalMargin(); + this->refreshHorizontalMargin(); + } } } @@ -511,14 +484,17 @@ namespace ui { { _percentHeight = percentHeight; - Node* parent = this->getOwnerParent(); - if (parent != nullptr) + if (_usingPercentHeight) { - Size ownerSize = _owner->getContentSize(); - ownerSize.height = parent->getContentSize().height * _percentHeight; - _owner->setContentSize(ownerSize); + Node* parent = this->getOwnerParent(); + if (parent != nullptr) + { + Size ownerSize = _owner->getContentSize(); + ownerSize.height = parent->getContentSize().height * _percentHeight; + _owner->setContentSize(ownerSize); - this->refreshVerticalMargin(); + this->refreshVerticalMargin(); + } } } @@ -672,8 +648,8 @@ namespace ui { PageView* page = static_cast(_owner); page->forceDoLayout(); - Vector _layoutVector = page->getPages(); - for(auto& item : _layoutVector) + Vector _widgetVector = page->getItems(); + for(auto& item : _widgetVector) { ui::Helper::doLayout(item); } diff --git a/cocos/ui/UIListView.cpp b/cocos/ui/UIListView.cpp index aab0418ff2..3fe85a218a 100644 --- a/cocos/ui/UIListView.cpp +++ b/cocos/ui/UIListView.cpp @@ -72,7 +72,7 @@ bool ListView::init() { if (ScrollView::init()) { - setLayoutType(Type::VERTICAL); + setDirection(Direction::VERTICAL); return true; } return false; @@ -100,6 +100,11 @@ void ListView::handleReleaseLogic(Touch *touch) } } +void ListView::onItemListChanged() +{ + _outOfBoundaryAmountDirty = true; +} + void ListView::updateInnerContainerSize() { switch (_direction) @@ -263,7 +268,7 @@ void ListView::addChild(cocos2d::Node *child, int zOrder, int tag) if (nullptr != widget) { _items.pushBack(widget); - _outOfBoundaryAmountDirty = true; + onItemListChanged(); } } @@ -285,7 +290,7 @@ void ListView::addChild(Node* child, int zOrder, const std::string &name) if (nullptr != widget) { _items.pushBack(widget); - _outOfBoundaryAmountDirty = true; + onItemListChanged(); } } @@ -307,7 +312,7 @@ void ListView::removeChild(cocos2d::Node *child, bool cleaup) } } _items.eraseObject(widget); - _outOfBoundaryAmountDirty = true; + onItemListChanged(); } ScrollView::removeChild(child, cleaup); @@ -321,9 +326,9 @@ void ListView::removeAllChildren() void ListView::removeAllChildrenWithCleanup(bool cleanup) { ScrollView::removeAllChildrenWithCleanup(cleanup); - _items.clear(); _curSelectedIndex = -1; - _outOfBoundaryAmountDirty = true; + _items.clear(); + onItemListChanged(); } void ListView::insertCustomItem(Widget* item, ssize_t index) @@ -336,8 +341,8 @@ void ListView::insertCustomItem(Widget* item, ssize_t index) } } _items.insert(index, item); - _outOfBoundaryAmountDirty = true; - + onItemListChanged(); + ScrollView::addChild(item); remedyLayoutParameter(item); @@ -365,7 +370,7 @@ void ListView::removeAllItems() removeAllChildren(); } -Widget* ListView::getItem(ssize_t index)const +Widget* ListView::getItem(ssize_t index) const { if (index < 0 || index >= _items.size()) { @@ -479,8 +484,8 @@ void ListView::doLayout() item->setLocalZOrder(i); remedyLayoutParameter(item); } - _innerContainer->forceDoLayout(); updateInnerContainerSize(); + _innerContainer->forceDoLayout(); _innerContainerDoLayoutDirty = false; } @@ -738,8 +743,9 @@ void ListView::jumpToPercentBothDirection(const Vec2& percent) ScrollView::jumpToPercentBothDirection(percent); } -static Vec2 calculateItemDestination(const Size& contentSize, Widget* item, const Vec2& positionRatioInView, const Vec2& itemAnchorPoint) +Vec2 ListView::calculateItemDestination(const Vec2& positionRatioInView, Widget* item, const Vec2& itemAnchorPoint) { + const Size& contentSize = getContentSize(); Vec2 positionInView; positionInView.x += contentSize.width * positionRatioInView.x; positionInView.y += contentSize.height * positionRatioInView.y; @@ -748,7 +754,7 @@ static Vec2 calculateItemDestination(const Size& contentSize, Widget* item, cons return -(itemPosition - positionInView); } -void ListView::jumpToItem(int itemIndex, const Vec2& positionRatioInView, const Vec2& itemAnchorPoint) +void ListView::jumpToItem(ssize_t itemIndex, const Vec2& positionRatioInView, const Vec2& itemAnchorPoint) { Widget* item = getItem(itemIndex); if (item == nullptr) @@ -757,27 +763,29 @@ void ListView::jumpToItem(int itemIndex, const Vec2& positionRatioInView, const } doLayout(); - Vec2 destination = calculateItemDestination(getContentSize(), item, positionRatioInView, itemAnchorPoint); - destination = flattenVectorByDirection(destination); - Vec2 delta = destination - getInnerContainerPosition(); - Vec2 outOfBoundary = getHowMuchOutOfBoundary(delta); - destination += outOfBoundary; - moveChildrenToPosition(destination); + Vec2 destination = calculateItemDestination(positionRatioInView, item, itemAnchorPoint); + if(!_bounceEnabled) + { + Vec2 delta = destination - getInnerContainerPosition(); + Vec2 outOfBoundary = getHowMuchOutOfBoundary(delta); + destination += outOfBoundary; + } + jumpToDestination(destination); } -void ListView::scrollToItem(int itemIndex, const Vec2& positionRatioInView, const Vec2& itemAnchorPoint) +void ListView::scrollToItem(ssize_t itemIndex, const Vec2& positionRatioInView, const Vec2& itemAnchorPoint) { scrollToItem(itemIndex, positionRatioInView, itemAnchorPoint, DEFAULT_TIME_IN_SEC_FOR_SCROLL_TO_ITEM); } -void ListView::scrollToItem(int itemIndex, const Vec2& positionRatioInView, const Vec2& itemAnchorPoint, float timeInSec) +void ListView::scrollToItem(ssize_t itemIndex, const Vec2& positionRatioInView, const Vec2& itemAnchorPoint, float timeInSec) { Widget* item = getItem(itemIndex); if (item == nullptr) { return; } - Vec2 destination = calculateItemDestination(getContentSize(), item, positionRatioInView, itemAnchorPoint); + Vec2 destination = calculateItemDestination(positionRatioInView, item, itemAnchorPoint); startAutoScrollToDestination(destination, timeInSec, true); } @@ -847,7 +855,7 @@ Vec2 ListView::getHowMuchOutOfBoundary(const Vec2& addition) float topBoundary = _topBoundary; float bottomBoundary = _bottomBoundary; { - int lastItemIndex = _items.size() - 1; + ssize_t lastItemIndex = _items.size() - 1; Size contentSize = getContentSize(); Vec2 firstItemAdjustment, lastItemAdjustment; if(_magneticType == MagneticType::CENTER) diff --git a/cocos/ui/UIListView.h b/cocos/ui/UIListView.h index 72ddcdb4c3..0112cf585a 100644 --- a/cocos/ui/UIListView.h +++ b/cocos/ui/UIListView.h @@ -172,8 +172,7 @@ public: * @param index A given index in ssize_t. */ void removeItem(ssize_t index); - - + /** * @brief Remove all items in current ListView. * @@ -256,25 +255,25 @@ public: virtual void removeAllChildrenWithCleanup(bool cleanup) override; virtual void removeChild(Node* child, bool cleaup = true) override; - /** - * @brief Query the closest item to a specific position in inner container. - * - * @param targetPosition Specifies the target position in inner container's coordinates. - * @param itemAnchorPoint Specifies an anchor point of each item for position to calculate distance. - * @return A item instance if list view is not empty. Otherwise, returns null. - */ - Widget* getClosestItemToPosition(const Vec2& targetPosition, const Vec2& itemAnchorPoint) const; - - /** - * @brief Query the closest item to a specific position in current view. + /** + * @brief Query the closest item to a specific position in inner container. + * + * @param targetPosition Specifies the target position in inner container's coordinates. + * @param itemAnchorPoint Specifies an anchor point of each item for position to calculate distance. + * @return A item instance if list view is not empty. Otherwise, returns null. + */ + Widget* getClosestItemToPosition(const Vec2& targetPosition, const Vec2& itemAnchorPoint) const; + + /** + * @brief Query the closest item to a specific position in current view. * For instance, to find the item in the center of view, call 'getClosestItemToPositionInCurrentView(Vec2::ANCHOR_MIDDLE, Vec2::ANCHOR_MIDDLE)'. - * - * @param positionRatioInView Specifies the target position with ratio in list view's content size. - * @param itemAnchorPoint Specifies an anchor point of each item for position to calculate distance. - * @return A item instance if list view is not empty. Otherwise, returns null. - */ - Widget* getClosestItemToPositionInCurrentView(const Vec2& positionRatioInView, const Vec2& itemAnchorPoint) const; - + * + * @param positionRatioInView Specifies the target position with ratio in list view's content size. + * @param itemAnchorPoint Specifies an anchor point of each item for position to calculate distance. + * @return A item instance if list view is not empty. Otherwise, returns null. + */ + Widget* getClosestItemToPositionInCurrentView(const Vec2& positionRatioInView, const Vec2& itemAnchorPoint) const; + /** * @brief Query the center item * @return A item instance. @@ -326,17 +325,17 @@ public: * @param positionRatioInView Specifies the position with ratio in list view's content size. * @param itemAnchorPoint Specifies an anchor point of each item for position to calculate distance. */ - void jumpToItem(int itemIndex, const Vec2& positionRatioInView, const Vec2& itemAnchorPoint); + void jumpToItem(ssize_t itemIndex, const Vec2& positionRatioInView, const Vec2& itemAnchorPoint); + + /** + * @brief Scroll to specific item + * @param positionRatioInView Specifies the position with ratio in list view's content size. + * @param itemAnchorPoint Specifies an anchor point of each item for position to calculate distance. + * @param timeInSec Scroll time + */ + void scrollToItem(ssize_t itemIndex, const Vec2& positionRatioInView, const Vec2& itemAnchorPoint); + void scrollToItem(ssize_t itemIndex, const Vec2& positionRatioInView, const Vec2& itemAnchorPoint, float timeInSec); - /** - * @brief Scroll to specific item - * @param positionRatioInView Specifies the position with ratio in list view's content size. - * @param itemAnchorPoint Specifies an anchor point of each item for position to calculate distance. - * @param timeInSec Scroll time - */ - void scrollToItem(int itemIndex, const Vec2& positionRatioInView, const Vec2& itemAnchorPoint); - void scrollToItem(int itemIndex, const Vec2& positionRatioInView, const Vec2& itemAnchorPoint, float timeInSec); - /** * @brief Query current selected widget's idnex. * @@ -388,7 +387,9 @@ CC_CONSTRUCTOR_ACCESS: protected: virtual void handleReleaseLogic(Touch *touch) override; - + + virtual void onItemListChanged(); + void updateInnerContainerSize(); void remedyLayoutParameter(Widget* item); void remedyVerticalLayoutParameter(LinearLayoutParameter* layoutParameter, ssize_t itemIndex); @@ -406,6 +407,7 @@ protected: virtual void startAttenuatingAutoScroll(const Vec2& deltaMove, const Vec2& initialVelocity) override; void startMagneticScroll(); + Vec2 calculateItemDestination(const Vec2& positionRatioInView, Widget* item, const Vec2& itemAnchorPoint); protected: Widget* _model; diff --git a/cocos/ui/UILoadingBar.cpp b/cocos/ui/UILoadingBar.cpp index b682dc56b8..ab403122a7 100644 --- a/cocos/ui/UILoadingBar.cpp +++ b/cocos/ui/UILoadingBar.cpp @@ -26,6 +26,7 @@ THE SOFTWARE. #include "ui/UIHelper.h" #include "ui/UIScale9Sprite.h" #include "2d/CCSprite.h" +#include "2d/CocosStudioExtension.h" NS_CC_BEGIN @@ -39,6 +40,7 @@ LoadingBar::LoadingBar(): _direction(Direction::LEFT), _percent(100.0), _totalLength(0), +_textureFile(""), _barRenderer(nullptr), _renderBarTexType(TextureResType::LOCAL), _barRendererTextureSize(Size::ZERO), @@ -146,6 +148,7 @@ void LoadingBar::loadTexture(const std::string& texture,TextureResType texType) { return; } + _textureFile = texture; _renderBarTexType = texType; switch (_renderBarTexType) { @@ -418,6 +421,14 @@ void LoadingBar::copySpecialProperties(Widget *widget) } } +ResouceData LoadingBar::getRenderFile() +{ + ResouceData rData; + rData.type = (int)_renderBarTexType; + rData.file = _textureFile; + return rData; +} + } NS_CC_END diff --git a/cocos/ui/UILoadingBar.h b/cocos/ui/UILoadingBar.h index 171b18d898..b332edc66d 100644 --- a/cocos/ui/UILoadingBar.h +++ b/cocos/ui/UILoadingBar.h @@ -34,6 +34,8 @@ NS_CC_BEGIN * @{ */ +struct CC_DLL ResouceData; + namespace ui { class Scale9Sprite; @@ -171,6 +173,9 @@ public: virtual Size getVirtualRendererSize() const override; virtual Node* getVirtualRenderer() override; virtual std::string getDescription() const override; + + ResouceData getRenderFile(); + protected: virtual void initRenderer() override; virtual void onSizeChanged() override; @@ -197,6 +202,7 @@ protected: bool _prevIgnoreSize; Rect _capInsets; bool _barRendererAdaptDirty; + std::string _textureFile; }; } diff --git a/cocos/ui/UIPageView.cpp b/cocos/ui/UIPageView.cpp index 51eadb523d..17904d2c38 100644 --- a/cocos/ui/UIPageView.cpp +++ b/cocos/ui/UIPageView.cpp @@ -23,6 +23,7 @@ THE SOFTWARE. ****************************************************************************/ #include "ui/UIPageView.h" +#include "ui/UIPageViewIndicator.h" NS_CC_BEGIN @@ -31,25 +32,14 @@ namespace ui { IMPLEMENT_CLASS_GUI_INFO(PageView) PageView::PageView(): -_isAutoScrolling(false), -_autoScrollDistance(0.0f), -_autoScrollSpeed(0.0f), -_autoScrollDirection(AutoScrollDirection::LEFT), -_direction(Direction::HORIZONTAL), -_curPageIdx(-1), -_touchMoveDirection(TouchDirection::LEFT), -_leftBoundaryChild(nullptr), -_rightBoundaryChild(nullptr), -_leftBoundary(0.0f), -_rightBoundary(0.0f), -_customScrollThreshold(0.0), -_usingCustomScrollThreshold(false), +_indicator(nullptr), +_indicatorPositionAsAnchorPoint(Vec2(0.5f, 0.1f)), +_currentPageIndex(-1), _childFocusCancelOffset(5.0f), _pageViewEventListener(nullptr), _pageViewEventSelector(nullptr), _eventCallback(nullptr) { - this->setTouchEnabled(true); } PageView::~PageView() @@ -70,680 +60,204 @@ PageView* PageView::create() return nullptr; } -void PageView::onEnter() -{ -#if CC_ENABLE_SCRIPT_BINDING - if (_scriptType == kScriptTypeJavascript) - { - if (ScriptEngineManager::sendNodeEventToJSExtended(this, kNodeOnEnter)) - return; - } -#endif - - Layout::onEnter(); - scheduleUpdate(); -} - bool PageView::init() { - if (Layout::init()) + if (ListView::init()) { - setClippingEnabled(true); + setDirection(Direction::HORIZONTAL); + setMagneticType(MagneticType::CENTER); + setScrollBarEnabled(false); return true; } return false; } +void PageView::doLayout() +{ + if(!_innerContainerDoLayoutDirty) + { + return; + } + + ListView::doLayout(); + if(_indicator != nullptr) + { + ssize_t index = getIndex(getCenterItemInCurrentView()); + _indicator->indicate(index); + } + _innerContainerDoLayoutDirty = false; +} + +void PageView::setDirection(PageView::Direction direction) +{ + ListView::setDirection(direction); + if(direction == Direction::HORIZONTAL) + { + _indicatorPositionAsAnchorPoint = Vec2(0.5f, 0.1f); + } + else if(direction == Direction::VERTICAL) + { + _indicatorPositionAsAnchorPoint = Vec2(0.1f, 0.5f); + } + + if(_indicator != nullptr) + { + _indicator->setDirection(direction); + refreshIndicatorPosition(); + } +} + void PageView::addWidgetToPage(Widget *widget, ssize_t pageIdx, bool forceCreate) { - if (!widget || pageIdx < 0) - { - return; - } - - ssize_t pageCount = this->getPageCount(); - if (pageIdx < 0 || pageIdx >= pageCount) - { - if (forceCreate) - { - if (pageIdx > pageCount) - { - CCLOG("pageIdx is %d, it will be added as page id [%d]",static_cast(pageIdx),static_cast(pageCount)); - } - Layout* newPage = createPage(); - newPage->addChild(widget); - addPage(newPage); - } - } - else - { - Node * page = _pages.at(pageIdx); - page->addChild(widget); - } + insertCustomItem(widget, pageIdx); } -Layout* PageView::createPage() +void PageView::addPage(Widget* page) { - Layout* newPage = Layout::create(); - newPage->setContentSize(getContentSize()); - return newPage; + pushBackCustomItem(page); } -void PageView::addPage(Layout* page) +void PageView::insertPage(Widget* page, int idx) { - if (!page || _pages.contains(page)) - { - return; - } - - - addChild(page); - _pages.pushBack(page); - if (_curPageIdx == -1) - { - _curPageIdx = 0; - } - _doLayoutDirty = true; + insertCustomItem(page, idx); } -void PageView::insertPage(Layout* page, int idx) +void PageView::removePage(Widget* page) { - if (idx < 0 || !page || _pages.contains(page)) - { - return; - } - - - ssize_t pageCount = this->getPageCount(); - if (idx >= pageCount) - { - addPage(page); - } - else - { - _pages.insert(idx, page); - addChild(page); - if(_curPageIdx == -1) - { - _curPageIdx = 0; - } - } - - _doLayoutDirty = true; -} - - -void PageView::removePage(Layout* page) -{ - if (!page) - { - return; - } - removeChild(page); - _pages.eraseObject(page); - auto pageCount = _pages.size(); - if (_curPageIdx >= pageCount) - { - _curPageIdx = pageCount - 1; - } - - _doLayoutDirty = true; + removeItem(getIndex(page)); } void PageView::removePageAtIndex(ssize_t index) { - if (index < 0 || index >= this->getPages().size()) - { - return; - } - Layout* page = _pages.at(index); - removePage(page); + removeItem(index); } void PageView::removeAllPages() { - for(const auto& node : _pages) - { - removeChild(node); - } - _pages.clear(); - _curPageIdx = -1; -} - -void PageView::updateBoundaryPages() -{ - if (_pages.size() <= 0) - { - _leftBoundaryChild = nullptr; - _rightBoundaryChild = nullptr; - return; - } - _leftBoundaryChild = _pages.at(0); - _rightBoundaryChild = _pages.at(this->getPageCount()-1); -} - -ssize_t PageView::getPageCount()const -{ - return _pages.size(); -} - -float PageView::getPositionXByIndex(ssize_t idx)const -{ - return (getContentSize().width * (idx-_curPageIdx)); -} - -float PageView::getPositionYByIndex(ssize_t idx)const -{ - return (getContentSize().height * (idx-_curPageIdx)); -} - -void PageView::onSizeChanged() -{ - Layout::onSizeChanged(); - if (_direction == Direction::HORIZONTAL) - { - _rightBoundary = getContentSize().width; - } - else - { - _rightBoundary = getContentSize().height; - } - - _doLayoutDirty = true; -} - -void PageView::updateAllPagesSize() -{ - Size selfSize = getContentSize(); - for (auto& page : _pages) - { - page->setContentSize(selfSize); - } -} - -void PageView::updateAllPagesPosition() -{ - ssize_t pageCount = this->getPageCount(); - - if (pageCount <= 0) - { - _curPageIdx = -1; - return; - } - - if (_curPageIdx >= pageCount) - { - _curPageIdx = pageCount-1; - } - // If the layout is dirty, don't trigger auto scroll - _isAutoScrolling = false; - - for (int i=0; isetPosition(newPosition); - } + removeAllItems(); } void PageView::setCurPageIndex( ssize_t index ) { - if (index < 0 || index >= this->getPageCount()) - { - return; - } - _curPageIdx = index; - _doLayoutDirty = true; + setCurrentPageIndex(index); +} + +void PageView::setCurrentPageIndex(ssize_t index) +{ + jumpToItem(index, Vec2::ANCHOR_MIDDLE, Vec2::ANCHOR_MIDDLE); } void PageView::scrollToPage(ssize_t idx) { - if (idx < 0 || idx >= this->getPageCount()) - { - return; - } - _curPageIdx = idx; - Layout* curPage = _pages.at(idx); - if (_direction == Direction::HORIZONTAL) - { - _autoScrollDistance = -(curPage->getPosition().x); - if (_autoScrollDistance > 0) - { - _autoScrollDirection = AutoScrollDirection::RIGHT; - } - else - { - _autoScrollDirection = AutoScrollDirection::LEFT; - } - } - else if(_direction == Direction::VERTICAL) - { - _autoScrollDistance = -curPage->getPosition().y; - if (_autoScrollDistance > 0) - { - _autoScrollDirection = AutoScrollDirection::DOWN; - } - else - { - _autoScrollDirection = AutoScrollDirection::UP; - } - } - _autoScrollSpeed = fabs(_autoScrollDistance)/0.2f; - _isAutoScrolling = true; + scrollToItem(idx); } - -void PageView::setDirection(cocos2d::ui::PageView::Direction direction) + +void PageView::scrollToItem(ssize_t itemIndex) { - this->_direction = direction; -} - -PageView::Direction PageView::getDirection()const -{ - return this->_direction; + ListView::scrollToItem(itemIndex, Vec2::ANCHOR_MIDDLE, Vec2::ANCHOR_MIDDLE); } -void PageView::update(float dt) -{ - if (_isAutoScrolling) - { - this->autoScroll(dt); - } -} - -void PageView::autoScroll(float dt) - { - float step = _autoScrollSpeed*dt; - int sign = 1; - switch (_autoScrollDirection) - { - case AutoScrollDirection::LEFT: - case AutoScrollDirection::UP: - { - if (_autoScrollDistance + step >= 0.0f) - { - step = -_autoScrollDistance; - _isAutoScrolling = false; - _autoScrollDistance = 0.0f; - } - else - { - _autoScrollDistance += step; - } - sign = -1; - break; - } - break; - case AutoScrollDirection::RIGHT: - case AutoScrollDirection::DOWN: - { - if (_autoScrollDistance - step <= 0.0f) - { - step = _autoScrollDistance; - _autoScrollDistance = 0.0f; - _isAutoScrolling = false; - } - else - { - _autoScrollDistance -= step; - } - break; - } - default: - break; - } - - if (_direction == Direction::HORIZONTAL) - { - scrollPages(Vec2(step * sign, 0)); - } - else - { - scrollPages(Vec2(0, step * sign)); - } - - if (!_isAutoScrolling) - { - pageTurningEvent(); - } - } - -bool PageView::onTouchBegan(Touch *touch, Event *unusedEvent) -{ - bool pass = Layout::onTouchBegan(touch, unusedEvent); - return pass; -} - -void PageView::onTouchMoved(Touch *touch, Event *unusedEvent) -{ - Layout::onTouchMoved(touch, unusedEvent); - if (!_isInterceptTouch) - { - handleMoveLogic(touch); - } -} - -void PageView::onTouchEnded(Touch *touch, Event *unusedEvent) -{ - Layout::onTouchEnded(touch, unusedEvent); - if (!_isInterceptTouch) - { - handleReleaseLogic(touch); - } - _isInterceptTouch = false; -} - -void PageView::onTouchCancelled(Touch *touch, Event *unusedEvent) -{ - Layout::onTouchCancelled(touch, unusedEvent); - if (!_isInterceptTouch) - { - handleReleaseLogic(touch); - } - _isInterceptTouch = false; -} - -void PageView::doLayout() -{ - if (!_doLayoutDirty) - { - return; - } - - updateAllPagesPosition(); - updateAllPagesSize(); - updateBoundaryPages(); - - - _doLayoutDirty = false; -} - -void PageView::movePages(Vec2 offset) -{ - for (auto& page : this->getPages()) - { - Vec2 oldPosition = page->getPosition(); - page->setPosition(oldPosition + offset); - } -} - -bool PageView::scrollPages(Vec2 touchOffset) -{ - if (this->getPageCount() <= 0) - { - return false; - } - - if (!_leftBoundaryChild || !_rightBoundaryChild) - { - return false; - } - - Vec2 realOffset = touchOffset; - - switch (_touchMoveDirection) - { - case TouchDirection::LEFT: // left - if (_rightBoundaryChild->getRightBoundary() + touchOffset.x <= _rightBoundary) - { - realOffset.x = _rightBoundary - _rightBoundaryChild->getRightBoundary(); - realOffset.y = 0; - movePages(realOffset); - return false; - } - break; - - case TouchDirection::RIGHT: // right - if (_leftBoundaryChild->getLeftBoundary() + touchOffset.x >= _leftBoundary) - { - realOffset.x = _leftBoundary - _leftBoundaryChild->getLeftBoundary(); - realOffset.y = 0; - movePages(realOffset); - return false; - } - break; - case TouchDirection::UP: - { - if (_rightBoundaryChild->getBottomBoundary() + touchOffset.y >= _leftBoundary) - { - realOffset.y = _leftBoundary - _rightBoundaryChild->getBottomBoundary(); - realOffset.x = 0; - movePages(realOffset); - return false; - } - - }break; - case TouchDirection::DOWN: - { - if (_leftBoundaryChild->getTopBoundary() + touchOffset.y <= _rightBoundary) - { - realOffset.y = _rightBoundary - _leftBoundaryChild->getTopBoundary(); - realOffset.x = 0; - movePages(realOffset); - return false; - } - }break; - default: - break; - } - - movePages(realOffset); - return true; -} - - -void PageView::handleMoveLogic(Touch *touch) -{ - Vec2 touchPoint = touch->getLocation(); - - Vec2 offset; - offset = touchPoint - touch->getPreviousLocation(); - - if (_direction == Direction::HORIZONTAL) - { - if (offset.x < 0) - { - _touchMoveDirection = TouchDirection::LEFT; - } - else if (offset.x > 0) - { - _touchMoveDirection = TouchDirection::RIGHT; - } - offset.y = 0; - } - else - { - offset.x = 0; - if(offset.y > 0) - { - _touchMoveDirection = TouchDirection::UP; - } - else if(offset.y < 0) - { - _touchMoveDirection = TouchDirection::DOWN; - } - } - - scrollPages(offset); -} - void PageView::setCustomScrollThreshold(float threshold) { - CCASSERT(threshold > 0, "Invalid threshold!"); - _customScrollThreshold = threshold; - this->setUsingCustomScrollThreshold(true); + CCLOG("PageView::setCustomScrollThreshold() has no effect!"); } float PageView::getCustomScrollThreshold()const { - return _customScrollThreshold; + return 0; } void PageView::setUsingCustomScrollThreshold(bool flag) { - _usingCustomScrollThreshold = flag; + CCLOG("PageView::setUsingCustomScrollThreshold() has no effect!"); } bool PageView::isUsingCustomScrollThreshold()const { - return _usingCustomScrollThreshold; + return false; +} + +void PageView::moveInnerContainer(const Vec2& deltaMove, bool canStartBounceBack) +{ + ListView::moveInnerContainer(deltaMove, canStartBounceBack); + _currentPageIndex = getIndex(getCenterItemInCurrentView()); + if(_indicator != nullptr) + { + _indicator->indicate(_currentPageIndex); + } +} + +void PageView::onItemListChanged() +{ + ListView::onItemListChanged(); + if(_indicator != nullptr) + { + _indicator->reset(_items.size()); + } +} + +void PageView::onSizeChanged() +{ + ListView::onSizeChanged(); + refreshIndicatorPosition(); +} + +void PageView::refreshIndicatorPosition() +{ + if(_indicator != nullptr) + { + const Size& contentSize = getContentSize(); + float posX = contentSize.width * _indicatorPositionAsAnchorPoint.x; + float posY = contentSize.height * _indicatorPositionAsAnchorPoint.y; + _indicator->setPosition(Vec2(posX, posY)); + } } void PageView::handleReleaseLogic(Touch *touch) { - if (this->getPageCount() <= 0) + // Use `ScrollView` method in order to avoid `startMagneticScroll()` by `ListView`. + ScrollView::handleReleaseLogic(touch); + + if(_items.empty()) { return; } - Widget* curPage = dynamic_cast(this->getPages().at(_curPageIdx)); - if (curPage) - { - Vec2 curPagePos = curPage->getPosition(); - ssize_t pageCount = this->getPageCount(); - - auto contentSize = getContentSize(); - - float moveBoundray = 0.0f; - float scrollDistance; - if (_direction == Direction::HORIZONTAL) - { - curPagePos.y = 0; - moveBoundray = curPagePos.x; - scrollDistance = contentSize.width / 2.0; - } - else if(_direction == Direction::VERTICAL) - { - curPagePos.x = 0; - moveBoundray = curPagePos.y; - scrollDistance = contentSize.height / 2.0; - } - if (!_usingCustomScrollThreshold) + Vec2 touchMoveVelocity = flattenVectorByDirection(calculateTouchMoveVelocity()); + + static const float INERTIA_THRESHOLD = 500; + if(touchMoveVelocity.length() < INERTIA_THRESHOLD) + { + startMagneticScroll(); + } + else + { + // Handle paging by inertia force. + Widget* currentPage = getItem(_currentPageIndex); + Vec2 destination = calculateItemDestination(Vec2::ANCHOR_MIDDLE, currentPage, Vec2::ANCHOR_MIDDLE); + Vec2 deltaToCurrentpage = destination - getInnerContainerPosition(); + deltaToCurrentpage = flattenVectorByDirection(deltaToCurrentpage); + + // If the direction of displacement to current page and the direction of touch are same, just start magnetic scroll to the current page. + // Otherwise, move to the next page of touch direction. + if(touchMoveVelocity.x * deltaToCurrentpage.x > 0 || touchMoveVelocity.y * deltaToCurrentpage.y > 0) { - _customScrollThreshold = scrollDistance; + startMagneticScroll(); } - float boundary = _customScrollThreshold; - - if (_direction == Direction::HORIZONTAL) + else { - if (moveBoundray <= -boundary) + if(touchMoveVelocity.x < 0 || touchMoveVelocity.y > 0) { - if (_curPageIdx >= pageCount-1) - { - scrollPages(curPagePos); - } - else - { - scrollToPage(_curPageIdx+1); - } - } - else if (moveBoundray >= boundary) - { - if (_curPageIdx <= 0) - { - scrollPages(curPagePos); - } - else - { - scrollToPage(_curPageIdx-1); - } + ++_currentPageIndex; } else { - scrollToPage(_curPageIdx); + --_currentPageIndex; } + _currentPageIndex = MIN(_currentPageIndex, _items.size()); + _currentPageIndex = MAX(_currentPageIndex, 0); + scrollToItem(_currentPageIndex); } - else if(_direction == Direction::VERTICAL) - { - if (moveBoundray >= boundary) - { - if (_curPageIdx >= pageCount-1) - { - scrollPages(curPagePos); - } - else - { - scrollToPage(_curPageIdx+1); - } - } - else if (moveBoundray <= -boundary) - { - if (_curPageIdx <= 0) - { - scrollPages(curPagePos); - } - else - { - scrollToPage(_curPageIdx-1); - } - } - else - { - scrollToPage(_curPageIdx); - } - } - } -} - - -void PageView::interceptTouchEvent(TouchEventType event, Widget *sender, Touch *touch) -{ - if (!_touchEnabled) - { - Layout::interceptTouchEvent(event, sender, touch); - return; - } - Vec2 touchPoint = touch->getLocation(); - - switch (event) - { - case TouchEventType::BEGAN: - { - _touchBeganPosition = touch->getLocation(); - _isInterceptTouch = true; - } - break; - case TouchEventType::MOVED: - { - float offset = 0; - if (_direction == Direction::HORIZONTAL) - { - offset = fabs(sender->getTouchBeganPosition().x - touchPoint.x); - } - else if(_direction == Direction::VERTICAL) - { - offset = fabs(sender->getTouchBeganPosition().y - touchPoint.y); - } - _touchMovePosition = touch->getLocation(); - if (offset > _childFocusCancelOffset) - { - sender->setHighlighted(false); - handleMoveLogic(touch); - } - } - break; - case TouchEventType::CANCELED: - case TouchEventType::ENDED: - { - _touchEndPosition = touch->getLocation(); - handleReleaseLogic(touch); - if (sender->isSwallowTouches()) - { - _isInterceptTouch = false; - } - } - break; } } @@ -778,21 +292,39 @@ void PageView::addEventListener(const ccPageViewCallback& callback) ssize_t PageView::getCurPageIndex() const { - return _curPageIdx; + Widget* widget = ListView::getCenterItemInCurrentView(); + return getIndex(widget); } Vector& PageView::getPages() { - return _pages; + CCLOG("This method is obsolete!"); + + // Temporary code to keep backward compatibility. + static Vector pages; + pages.clear(); + for(Widget* widget : getItems()) + { + pages.pushBack(dynamic_cast(widget)); + } + return pages; } - + Layout* PageView::getPage(ssize_t index) { if (index < 0 || index >= this->getPages().size()) { return nullptr; } - return _pages.at(index); + + // Temporary code to keep backward compatibility. + static Vector pages; + pages.clear(); + for(Widget* widget : getItems()) + { + pages.pushBack(dynamic_cast(widget)); + } + return pages.at(index); } std::string PageView::getDescription() const @@ -805,31 +337,97 @@ Widget* PageView::createCloneInstance() return PageView::create(); } -void PageView::copyClonedWidgetChildren(Widget* model) -{ - auto modelPages = static_cast(model)->getPages(); - for (auto& page : modelPages) - { - addPage(static_cast(page->clone())); - } -} - void PageView::copySpecialProperties(Widget *widget) { PageView* pageView = dynamic_cast(widget); if (pageView) { - Layout::copySpecialProperties(widget); + ListView::copySpecialProperties(widget); _eventCallback = pageView->_eventCallback; _ccEventCallback = pageView->_ccEventCallback; _pageViewEventListener = pageView->_pageViewEventListener; _pageViewEventSelector = pageView->_pageViewEventSelector; - _usingCustomScrollThreshold = pageView->_usingCustomScrollThreshold; - _customScrollThreshold = pageView->_customScrollThreshold; - _direction = pageView->_direction; } } +void PageView::setIndicatorEnabled(bool enabled) +{ + if(enabled == (_indicator != nullptr)) + { + return; + } + + if(!enabled) + { + removeProtectedChild(_indicator); + _indicator = nullptr; + } + else + { + _indicator = PageViewIndicator::create(); + _indicator->setDirection(getDirection()); + addProtectedChild(_indicator, 10000); + setIndicatorSelectedIndexColor(Color3B(100, 100, 255)); + refreshIndicatorPosition(); + } +} + +void PageView::setIndicatorPositionAsAnchorPoint(const Vec2& positionAsAnchorPoint) +{ + _indicatorPositionAsAnchorPoint = positionAsAnchorPoint; + refreshIndicatorPosition(); +} + +const Vec2& PageView::getIndicatorPositionAsAnchorPoint() const +{ + return _indicatorPositionAsAnchorPoint; +} + +void PageView::setIndicatorPosition(const Vec2& position) +{ + if(_indicator != nullptr) + { + const Size& contentSize = getContentSize(); + _indicatorPositionAsAnchorPoint.x = position.x / contentSize.width; + _indicatorPositionAsAnchorPoint.y = position.y / contentSize.height; + _indicator->setPosition(position); + } +} + +const Vec2& PageView::getIndicatorPosition() const +{ + CCASSERT(_indicator != nullptr, ""); + return _indicator->getPosition(); +} + +void PageView::setIndicatorSpaceBetweenIndexNodes(float spaceBetweenIndexNodes) +{ + if(_indicator != nullptr) + { + _indicator->setSpaceBetweenIndexNodes(spaceBetweenIndexNodes); + } +} +float PageView::getIndicatorSpaceBetweenIndexNodes() const +{ + CCASSERT(_indicator != nullptr, ""); + return _indicator->getSpaceBetweenIndexNodes(); +} + +void PageView::setIndicatorSelectedIndexColor(const Color3B& color) +{ + if(_indicator != nullptr) + { + _indicator->setSelectedIndexColor(color); + } +} + +const Color3B& PageView::getIndicatorSelectedIndexColor() const +{ + CCASSERT(_indicator != nullptr, ""); + return _indicator->getSelectedIndexColor(); +} + + } NS_CC_END diff --git a/cocos/ui/UIPageView.h b/cocos/ui/UIPageView.h index adfb06de74..c2129ccdda 100644 --- a/cocos/ui/UIPageView.h +++ b/cocos/ui/UIPageView.h @@ -25,7 +25,7 @@ THE SOFTWARE. #ifndef __UIPAGEVIEW_H__ #define __UIPAGEVIEW_H__ -#include "ui/UILayout.h" +#include "ui/UIListView.h" #include "ui/GUIExport.h" /** @@ -36,6 +36,8 @@ NS_CC_BEGIN namespace ui { +class PageViewIndicator; + /** *PageView page turn event type. *@deprecated Use `PageView::EventType` instead. @@ -56,7 +58,7 @@ typedef void (Ref::*SEL_PageViewEvent)(Ref*, PageViewEventType); *@brief Layout manager that allows the user to flip left & right and up & down through pages of data. * */ -class CC_GUI_DLL PageView : public Layout +class CC_GUI_DLL PageView : public ListView { DECLARE_CLASS_GUI_INFO @@ -80,17 +82,11 @@ public: UP, DOWN }; - - enum class Direction - { - HORIZONTAL, - VERTICAL - }; - + /** - *PageView page turn event callback. + * PageView page turn event callback. */ - typedef std::function ccPageViewCallback; + typedef std::function ccPageViewCallback; /** * Default constructor @@ -111,37 +107,46 @@ public: *@return A PageView instance. */ static PageView* create(); - + + /** + * Changes direction + * Direction Direction::VERTICAL means vertical scroll, Direction::HORIZONTAL means horizontal scroll. + * @param direction Set the page view's scroll direction. + */ + virtual void setDirection(Direction direction) override; + /** * Add a widget as a page of PageView in a given index. * * @param widget Widget to be added to pageview. * @param pageIdx A given index. * @param forceCreate If `forceCreate` is true and `widget` isn't exists, pageview would create a default page and add it. + * + * Since v3.9, this is deprecated. Use `insertPage(Widget* page, int idx)` instead. */ - void addWidgetToPage(Widget* widget, ssize_t pageIdx, bool forceCreate); + CC_DEPRECATED_ATTRIBUTE void addWidgetToPage(Widget* widget, ssize_t pageIdx, bool forceCreate); /** * Insert a page into the end of PageView. * * @param page Page to be inserted. */ - void addPage(Layout* page); - + void addPage(Widget* page); + /** * Insert a page into PageView at a given index. * * @param page Page to be inserted. * @param idx A given index. */ - void insertPage(Layout* page, int idx); - + void insertPage(Widget* page, int idx); + /** * Remove a page of PageView. * * @param page Page to be removed. */ - void removePage(Layout* page); + void removePage(Widget* page); /** * Remove a page at a given index of PageView. @@ -150,24 +155,6 @@ public: */ void removePageAtIndex(ssize_t index); - /** - * Changes scroll direction of PageView - * - * @see `Direction` - * @param direction Scroll direction enum. - * @since v3.8 - */ - void setDirection(Direction direction); - - /** - * Query scroll direction of PageView. - * - * @see `Direction` - * @since v3.8 - * @return PageView scroll direction. - */ - Direction getDirection()const; - /** * @brief Remove all pages of the PageView. */ @@ -180,12 +167,36 @@ public: */ void scrollToPage(ssize_t idx); + /** + * Scroll to a page with a given index. + * + * @param idx A given index in the PageView. Index start from 0 to pageCount -1. + */ + void scrollToItem(ssize_t itemIndex); + + /** + * Gets current displayed page index. + * @return current page index. + * + * Since v3.9, this is deprecated. Use `getCurrentPageIndex()` instead. + */ + CC_DEPRECATED_ATTRIBUTE ssize_t getCurPageIndex() const; /** * Gets current displayed page index. * @return current page index. */ - ssize_t getCurPageIndex() const; + ssize_t getCurrentPageIndex() const { return _currentPageIndex; } + + /** + * Jump to a page with a given index without scrolling. + * This is the different between scrollToPage. + * + * @param index A given index in PageView. Index start from 0 to pageCount -1. + * + * Since v3.9, this is deprecated. Use `setCurrentPageIndex()` instead. + */ + CC_DEPRECATED_ATTRIBUTE void setCurPageIndex(ssize_t index); /** * Jump to a page with a given index without scrolling. @@ -193,22 +204,25 @@ public: * * @param index A given index in PageView. Index start from 0 to pageCount -1. */ - void setCurPageIndex(ssize_t index); - + void setCurrentPageIndex(ssize_t index); + /** * @brief Get all the pages in the PageView. * @return A vector of Layout pointers. + * + * Since v3.9, this is obsolete. Use `Vector& ListView::getItems()` instead. */ - Vector& getPages(); - - + CC_DEPRECATED_ATTRIBUTE Vector& getPages(); + /** * @brief Get a page at a given index * * @param index A given index. * @return A layout pointer in PageView container. + * + * Since v3.9, this is obsolete. Use `Widget* ListView::getItem(index)` instead. */ - Layout* getPage(ssize_t index); + CC_DEPRECATED_ATTRIBUTE Layout* getPage(ssize_t index); /** * Add a page turn callback to PageView, then when one page is turning, the callback will be called. @@ -218,7 +232,6 @@ public: */ CC_DEPRECATED_ATTRIBUTE void addEventListenerPageView(Ref *target, SEL_PageViewEvent selector); - /** * @brief Add a page turn callback to PageView, then when one page is turning, the callback will be called. * @@ -227,100 +240,131 @@ public: void addEventListener(const ccPageViewCallback& callback); //override methods - virtual bool onTouchBegan(Touch *touch, Event *unusedEvent) override; - virtual void onTouchMoved(Touch *touch, Event *unusedEvent) override; - virtual void onTouchEnded(Touch *touch, Event *unusedEvent) override; - virtual void onTouchCancelled(Touch *touch, Event *unusedEvent) override; - virtual void update(float dt) override; - virtual void setLayoutType(Type type) override{}; - virtual Type getLayoutType() const override{return Type::ABSOLUTE;}; virtual std::string getDescription() const override; - /** - * @lua NA - */ - virtual void onEnter() override; - /** + /** + * @brief Toggle page indicator enabled. + * + * @param enabled True if enable page indicator, false otherwise. + */ + void setIndicatorEnabled(bool enabled); + + /** + * @brief Query page indicator state. + * + * @return True if page indicator is enabled, false otherwise. + */ + bool getIndicatorEnabled() const { return _indicator != nullptr; } + + /** + * @brief Set the page indicator's position using anchor point. + * + * @param positionAsAnchorPoint The position as anchor point. + */ + void setIndicatorPositionAsAnchorPoint(const Vec2& positionAsAnchorPoint); + + /** + * @brief Get the page indicator's position as anchor point. + * + * @return positionAsAnchorPoint + */ + const Vec2& getIndicatorPositionAsAnchorPoint() const; + + /** + * @brief Set the page indicator's position in page view. + * + * @param position The position in page view + */ + void setIndicatorPosition(const Vec2& position); + + /** + * @brief Get the page indicator's position. + * + * @return positionAsAnchorPoint + */ + const Vec2& getIndicatorPosition() const; + + /** + * @brief Set space between page indicator's index nodes. + * + * @param spaceBetweenIndexNodes Space between nodes in pixel. + */ + void setIndicatorSpaceBetweenIndexNodes(float spaceBetweenIndexNodes); + + /** + * @brief Get the space between page indicator's index nodes. + * + * @return spaceBetweenIndexNodes + */ + float getIndicatorSpaceBetweenIndexNodes() const; + + /** + * @brief Set color of page indicator's selected index. + * + * @param spaceBetweenIndexNodes Space between nodes in pixel. + */ + void setIndicatorSelectedIndexColor(const Color3B& color); + + /** + * @brief Get the color of page indicator's selected index. + * + * @return color + */ + const Color3B& getIndicatorSelectedIndexColor() const; + + /** *@brief If you don't specify the value, the pageView will turn page when scrolling at the half width of a page. *@param threshold A threshold in float. + *@deprecated Since v3.9, this method has no effect. */ - void setCustomScrollThreshold(float threshold); + CC_DEPRECATED_ATTRIBUTE void setCustomScrollThreshold(float threshold); /** *@brief Query the custom scroll threshold of the PageView. *@return Custom scroll threshold in float. + *@deprecated Since v3.9, this method always returns 0. */ - float getCustomScrollThreshold()const; + CC_DEPRECATED_ATTRIBUTE float getCustomScrollThreshold()const; /** *@brief Set using user defined scroll page threshold or not. * If you set it to false, then the default scroll threshold is pageView.width / 2 *@param flag True if using custom scroll threshold, false otherwise. + *@deprecated Since v3.9, this method has no effect. */ - void setUsingCustomScrollThreshold(bool flag); + CC_DEPRECATED_ATTRIBUTE void setUsingCustomScrollThreshold(bool flag); /** *@brief Query whether use user defined scroll page threshold or not. *@return True if using custom scroll threshold, false otherwise. + *@deprecated Since v3.9, this method always returns false. */ - bool isUsingCustomScrollThreshold()const; + CC_DEPRECATED_ATTRIBUTE bool isUsingCustomScrollThreshold()const; CC_CONSTRUCTOR_ACCESS: virtual bool init() override; -protected: - - Layout* createPage(); - float getPositionXByIndex(ssize_t idx)const; - float getPositionYByIndex(ssize_t idx)const; - ssize_t getPageCount()const; - - void updateBoundaryPages(); - virtual bool scrollPages(Vec2 touchOffset); - void movePages(Vec2 offset); - void pageTurningEvent(); - void updateAllPagesSize(); - void updateAllPagesPosition(); - void autoScroll(float dt); - - virtual void handleMoveLogic(Touch *touch) ; - virtual void handleReleaseLogic(Touch *touch) ; - virtual void interceptTouchEvent(TouchEventType event, Widget* sender,Touch *touch) override; - - - virtual void onSizeChanged() override; - virtual Widget* createCloneInstance() override; - virtual void copySpecialProperties(Widget* model) override; - virtual void copyClonedWidgetChildren(Widget* model) override; - + //override methods virtual void doLayout() override; protected: - enum class AutoScrollDirection - { - LEFT, - RIGHT, - UP, - DOWN - }; - bool _isAutoScrolling; - float _autoScrollDistance; - float _autoScrollSpeed; - AutoScrollDirection _autoScrollDirection; - Direction _direction; - - ssize_t _curPageIdx; - Vector _pages; + void pageTurningEvent(); - TouchDirection _touchMoveDirection; - - Widget* _leftBoundaryChild; - Widget* _rightBoundaryChild; - - float _leftBoundary; - float _rightBoundary; - float _customScrollThreshold; - bool _usingCustomScrollThreshold; + virtual void moveInnerContainer(const Vec2& deltaMove, bool canStartBounceBack) override; + virtual void onItemListChanged() override; + virtual void onSizeChanged() override; + virtual void handleReleaseLogic(Touch *touch) override; + + virtual Widget* createCloneInstance() override; + virtual void copySpecialProperties(Widget* model) override; + + void refreshIndicatorPosition(); + +protected: + PageViewIndicator* _indicator; + Vec2 _indicatorPositionAsAnchorPoint; + + ssize_t _currentPageIndex; float _childFocusCancelOffset; diff --git a/cocos/ui/UIPageViewIndicator.cpp b/cocos/ui/UIPageViewIndicator.cpp new file mode 100644 index 0000000000..6931b75ca8 --- /dev/null +++ b/cocos/ui/UIPageViewIndicator.cpp @@ -0,0 +1,170 @@ +/**************************************************************************** +Copyright (c) 2015 Neo Kim (neo.kim@neofect.com) + +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 "UIPageViewIndicator.h" +#include "2d/CCSprite.h" +#include "base/ccUtils.h" + +static const char* CIRCLE_IMAGE = "iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAQAAADZc7J/AAAA8ElEQVRIx62VyRGCQBBF+6gWRCEmYDIQkhiBCgHhSclC8YqWzOV5oVzKAYZp3r1/9fpbxAIBMTsKrjx5cqVgR0wgLhCRUWOjJiPqD56xoaGPhpRZV/iSEy6crHmw5oIrF9b/lVeMofrJgjlnxlIy/wik+JB+mme8BExbBhm+5CJC2LE2LtSEQoyGWDioBA5CoRIohJtK4CYDxzNEM4GAugR1E9VjVC+SZpXvhCJCrjomESLvc17pDGX7bWmlh6UtpjPVCWy9zaJ0TD7qfm3pwERMz2trRVZk3K3BD/L34AY+dEDCniMVBkPFkT2J/b2/AIV+dRpFLOYoAAAAAElFTkSuQmCC"; + +NS_CC_BEGIN + +static const float SPACE_BETWEEN_INDEX_NODES_DEFAULT = 23; + +namespace ui { + +PageViewIndicator* PageViewIndicator::create() +{ + PageViewIndicator* node = new (std::nothrow) PageViewIndicator(); + if (node && node->init()) + { + node->autorelease(); + return node; + } + CC_SAFE_DELETE(node); + return nullptr; +} + +PageViewIndicator::PageViewIndicator() +: _direction(PageView::Direction::HORIZONTAL) +, _currentIndexNode(nullptr) +, _spaceBetweenIndexNodes(SPACE_BETWEEN_INDEX_NODES_DEFAULT) +{ +} + +PageViewIndicator::~PageViewIndicator() +{ +} + +bool PageViewIndicator::init() +{ + _currentIndexNode = (Node*) utils::createSpriteFromBase64(CIRCLE_IMAGE); + _currentIndexNode->setVisible(false); + addProtectedChild(_currentIndexNode, 1); + return true; +} + +void PageViewIndicator::setDirection(PageView::Direction direction) +{ + _direction = direction; + rearrange(); +} + +void PageViewIndicator::reset(ssize_t numberOfTotalPages) +{ + while(_indexNodes.size() < numberOfTotalPages) + { + increaseNumberOfPages(); + } + while(_indexNodes.size() > numberOfTotalPages) + { + decreaseNumberOfPages(); + } + rearrange(); + _currentIndexNode->setVisible(!_indexNodes.empty()); +} + +void PageViewIndicator::indicate(ssize_t index) +{ + if (index < 0 || index >= _indexNodes.size()) + { + return; + } + _currentIndexNode->setPosition(_indexNodes.at(index)->getPosition()); +} + +void PageViewIndicator::rearrange() +{ + if(_indexNodes.empty()) + { + return; + } + + bool horizontal = (_direction == PageView::Direction::HORIZONTAL); + + // Calculate total size + Size indexNodeSize = _indexNodes.at(0)->getContentSize(); + float sizeValue = (horizontal ? indexNodeSize.width : indexNodeSize.height); + + ssize_t numberOfItems = _indexNodes.size(); + float totalSizeValue = sizeValue * numberOfItems + _spaceBetweenIndexNodes * (numberOfItems - 1); + + float posValue = -(totalSizeValue / 2) + (sizeValue / 2); + for(auto indexNode : _indexNodes) { + Vec2 position; + if(horizontal) + { + position = Vec2(posValue, indexNodeSize.height / 2.0f); + } + else + { + position = Vec2(indexNodeSize.width / 2.0f, -posValue); + } + indexNode->setPosition(position); + posValue += sizeValue + _spaceBetweenIndexNodes; + } + +} + +void PageViewIndicator::setSpaceBetweenIndexNodes(float spaceBetweenIndexNodes) +{ + if(_spaceBetweenIndexNodes == spaceBetweenIndexNodes) + { + return; + } + _spaceBetweenIndexNodes = spaceBetweenIndexNodes; + rearrange(); +} + +void PageViewIndicator::increaseNumberOfPages() +{ + Sprite* indexNode = utils::createSpriteFromBase64(CIRCLE_IMAGE); +// indexNode->setOpacity(255 * 0.3f); + addProtectedChild(indexNode); + _indexNodes.pushBack(indexNode); +} + +void PageViewIndicator::decreaseNumberOfPages() +{ + if(_indexNodes.empty()) + { + return; + } + removeProtectedChild(*_indexNodes.begin()); + _indexNodes.erase(_indexNodes.begin()); +} + +void PageViewIndicator::clear() +{ + for(auto indexNode : _indexNodes) + { + removeProtectedChild(indexNode); + } + _indexNodes.clear(); + _currentIndexNode->setVisible(false); +} + +} + +NS_CC_END diff --git a/cocos/ui/UIPageViewIndicator.h b/cocos/ui/UIPageViewIndicator.h new file mode 100644 index 0000000000..6adb2f7a98 --- /dev/null +++ b/cocos/ui/UIPageViewIndicator.h @@ -0,0 +1,78 @@ +/**************************************************************************** +Copyright (c) 2015 Neo Kim (neo.kim@neofect.com) + +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 __UIPAGEVIEWINDICATOR_H__ +#define __UIPAGEVIEWINDICATOR_H__ + +#include "UIPageView.h" + +NS_CC_BEGIN +/** + * @addtogroup ui + * @{ + */ + +namespace ui { + +class PageViewIndicator : public ProtectedNode +{ + +public: + /** + * Create a page view indicator with its parent page view. + * @return A page view indicator instance. + */ + static PageViewIndicator* create(); + + PageViewIndicator(); + virtual ~PageViewIndicator(); + + void setDirection(PageView::Direction direction); + void reset(ssize_t numberOfTotalPages); + void indicate(ssize_t index); + void clear(); + void setSpaceBetweenIndexNodes(float spaceBetweenIndexNodes); + float getSpaceBetweenIndexNodes() const { return _spaceBetweenIndexNodes; } + void setSelectedIndexColor(const Color3B& color) { _currentIndexNode->setColor(color); } + const Color3B& getSelectedIndexColor() const { return _currentIndexNode->getColor(); } + +protected: + bool init() override; + void increaseNumberOfPages(); + void decreaseNumberOfPages(); + void rearrange(); + + PageView::Direction _direction; + Vector _indexNodes; + Node* _currentIndexNode; + float _spaceBetweenIndexNodes; + +}; + +} +// end of ui group +/// @} +NS_CC_END + +#endif /* defined(__UIPAGEVIEWINDICATOR_H__) */ diff --git a/cocos/ui/UIRichText.cpp b/cocos/ui/UIRichText.cpp index b4091cd323..eeee8eae38 100644 --- a/cocos/ui/UIRichText.cpp +++ b/cocos/ui/UIRichText.cpp @@ -112,6 +112,18 @@ bool RichElementCustomNode::init(int tag, const Color3B &color, GLubyte opacity, return false; } +RichElementNewLine* RichElementNewLine::create(int tag, const Color3B& color, GLubyte opacity) +{ + RichElementNewLine* element = new (std::nothrow) RichElementNewLine(); + if (element && element->init(tag, color, opacity)) + { + element->autorelease(); + return element; + } + CC_SAFE_DELETE(element); + return nullptr; +} + RichText::RichText(): _formatTextDirty(true), _leftSpaceWidth(0.0f), @@ -214,6 +226,11 @@ void RichText::formatText() elementRenderer = elmtCustom->_customNode; break; } + case RichElement::Type::NEWLINE: + { + addNewLine(); + break; + } default: break; } @@ -249,6 +266,11 @@ void RichText::formatText() handleCustomRenderer(elmtCustom->_customNode); break; } + case RichElement::Type::NEWLINE: + { + addNewLine(); + break; + } default: break; } @@ -279,6 +301,44 @@ void RichText::handleTextRenderer(const std::string& text, const std::string& fo std::string curText = text; size_t stringLength = StringUtils::getCharacterCountInUTF8String(text); int leftLength = stringLength * (1.0f - overstepPercent); + + // The adjustment of the new line position + auto originalLeftSpaceWidth = _leftSpaceWidth + textRendererWidth; + auto leftStr = Helper::getSubStringOfUTF8String(curText, 0, leftLength); + textRenderer->setString(leftStr); + auto leftWidth = textRenderer->getContentSize().width; + if (originalLeftSpaceWidth < leftWidth) { + // Have protruding + for (;;) { + leftLength--; + leftStr = Helper::getSubStringOfUTF8String(curText, 0, leftLength); + textRenderer->setString(leftStr); + leftWidth = textRenderer->getContentSize().width; + if (leftWidth <= originalLeftSpaceWidth) { + break; + } + else if (leftLength <= 0) { + break; + } + } + } + else if (leftWidth < originalLeftSpaceWidth) { + // A wide margin + for (;;) { + leftLength++; + leftStr = Helper::getSubStringOfUTF8String(curText, 0, leftLength); + textRenderer->setString(leftStr); + leftWidth = textRenderer->getContentSize().width; + if (originalLeftSpaceWidth < leftWidth) { + leftLength--; + break; + } + else if (stringLength <= leftLength) { + break; + } + } + } + //The minimum cut length is 1, otherwise will cause the infinite loop. if (0 == leftLength) leftLength = 1; std::string leftWords = Helper::getSubStringOfUTF8String(curText,0,leftLength); diff --git a/cocos/ui/UIRichText.h b/cocos/ui/UIRichText.h index 00de9b18f2..4b918aac7d 100644 --- a/cocos/ui/UIRichText.h +++ b/cocos/ui/UIRichText.h @@ -50,7 +50,8 @@ public: { TEXT, IMAGE, - CUSTOM + CUSTOM, + NEWLINE }; /** @@ -243,6 +244,41 @@ protected: friend class RichText; }; +/** + *@brief Rich element for new line. + */ +class CC_GUI_DLL RichElementNewLine : public RichElement +{ +public: + + /** + * @brief Default constructor. + * @js ctor + * @lua new + * + */ + RichElementNewLine(){_type = Type::NEWLINE;}; + + /** + * @brief Default destructor. + * @js NA + * @lua NA + */ + virtual ~RichElementNewLine(){}; + + /** + * @brief Create a RichElementNewLine with various arguments. + * + * @param tag A integer tag value. + * @param color A color in Color3B. + * @param opacity A opacity in GLubyte. + * @return A RichElementNewLine instance. + */ + static RichElementNewLine* create(int tag, const Color3B& color, GLubyte opacity); +protected: + friend class RichText; +}; + /** *@brief A container for displaying various RichElements. * We could use it to display texts with images easily. diff --git a/cocos/ui/UIScale9Sprite.cpp b/cocos/ui/UIScale9Sprite.cpp index 83e0e09370..1467917a31 100644 --- a/cocos/ui/UIScale9Sprite.cpp +++ b/cocos/ui/UIScale9Sprite.cpp @@ -39,17 +39,7 @@ namespace ui { Scale9Sprite::Scale9Sprite() : _spritesGenerated(false) , _spriteFrameRotated(false) - , _positionsAreDirty(true) , _scale9Image(nullptr) - , _topLeftSprite(nullptr) - , _topSprite(nullptr) - , _topRightSprite(nullptr) - , _leftSprite(nullptr) - , _centerSprite(nullptr) - , _rightSprite(nullptr) - , _bottomLeftSprite(nullptr) - , _bottomSprite(nullptr) - , _bottomRightSprite(nullptr) , _scale9Enabled(true) , _insetLeft(0) , _insetTop(0) @@ -59,7 +49,11 @@ namespace ui { ,_flippedY(false) ,_isPatch9(false) ,_brightState(State::NORMAL) - + ,_nonSliceSpriteAnchor(Vec2::ANCHOR_MIDDLE) + ,_sliceVertices(nullptr) + ,_sliceIndices(nullptr) + ,_sliceSpriteDirty(false) + ,_renderingType(RenderingType::SLICE) { this->setAnchorPoint(Vec2(0.5,0.5)); } @@ -146,6 +140,7 @@ namespace ui { const Size &originalSize, const Rect& capInsets) { + bool ret = true; if(sprite) { auto texture = sprite->getTexture(); @@ -165,16 +160,16 @@ namespace ui { } } - - this->updateWithSprite(sprite, - rect, - rotated, - offset, - originalSize, - actualCapInsets); + + ret = this->updateWithSprite(sprite, + rect, + rotated, + offset, + originalSize, + actualCapInsets); } - return true; + return ret; } bool Scale9Sprite::initWithBatchNode(cocos2d::SpriteBatchNode *batchnode, @@ -333,58 +328,8 @@ namespace ui { void Scale9Sprite::cleanupSlicedSprites() { - if (_topLeftSprite && _topLeftSprite->isRunning()) - { - _topLeftSprite->onExit(); - } - if (_topSprite && _topSprite->isRunning()) - { - _topSprite->onExit(); - } - if (_topRightSprite && _topRightSprite->isRunning()) - { - _topRightSprite->onExit(); - } - - if (_leftSprite && _leftSprite->isRunning()) - { - _leftSprite->onExit(); - } - - if (_centerSprite && _centerSprite->isRunning()) - { - _centerSprite->onExit(); - } - - if (_rightSprite && _rightSprite->isRunning()) - { - _rightSprite->onExit(); - } - - if (_bottomLeftSprite && _bottomLeftSprite->isRunning()) - { - _bottomLeftSprite->onExit(); - } - - if (_bottomRightSprite && _bottomRightSprite->isRunning()) - { - _bottomRightSprite->onExit(); - } - - if (_bottomSprite && _bottomSprite->isRunning()) - { - _bottomSprite->onExit(); - } - - CC_SAFE_RELEASE_NULL(_topLeftSprite); - CC_SAFE_RELEASE_NULL(_topSprite); - CC_SAFE_RELEASE_NULL(_topRightSprite); - CC_SAFE_RELEASE_NULL(_leftSprite); - CC_SAFE_RELEASE_NULL(_centerSprite); - CC_SAFE_RELEASE_NULL(_rightSprite); - CC_SAFE_RELEASE_NULL(_bottomLeftSprite); - CC_SAFE_RELEASE_NULL(_bottomSprite); - CC_SAFE_RELEASE_NULL(_bottomRightSprite); + CC_SAFE_DELETE_ARRAY(_sliceIndices); + CC_SAFE_DELETE_ARRAY(_sliceVertices); } @@ -418,24 +363,6 @@ namespace ui { { if(_scale9Image) _scale9Image->setBlendFunc(_blendFunc); - if(_topLeftSprite) - _topLeftSprite->setBlendFunc(_blendFunc); - if(_topSprite) - _topSprite->setBlendFunc(_blendFunc); - if(_topRightSprite) - _topRightSprite->setBlendFunc(_blendFunc); - if(_leftSprite) - _leftSprite->setBlendFunc(_blendFunc); - if(_centerSprite) - _centerSprite->setBlendFunc(_blendFunc); - if(_rightSprite) - _rightSprite->setBlendFunc(_blendFunc); - if(_bottomLeftSprite) - _bottomLeftSprite->setBlendFunc(_blendFunc); - if(_bottomSprite) - _bottomSprite->setBlendFunc(_blendFunc); - if(_bottomRightSprite) - _bottomRightSprite->setBlendFunc(_blendFunc); } bool Scale9Sprite::updateWithBatchNode(cocos2d::SpriteBatchNode *batchnode, @@ -460,22 +387,6 @@ namespace ui { return updateWithSprite(sprite, rect, rotated, Vec2::ZERO, rect.size, capInsets); } - static Rect intersectRect(const Rect &first, const Rect &second) - { - Rect ret; - ret.origin.x = std::max(first.origin.x,second.origin.x); - ret.origin.y = std::max(first.origin.y,second.origin.y); - - float rightRealPoint = std::min(first.origin.x + first.size.width, - second.origin.x + second.size.width); - float bottomRealPoint = std::min(first.origin.y + first.size.height, - second.origin.y + second.size.height); - - ret.size.width = std::max(rightRealPoint - ret.origin.x, 0.0f); - ret.size.height = std::max(bottomRealPoint - ret.origin.y, 0.0f); - return ret; - } - bool Scale9Sprite::updateWithSprite(Sprite* sprite, const Rect& textureRect, bool rotated, @@ -483,12 +394,12 @@ namespace ui { const Size &originalSize, const Rect& capInsets) { + GLubyte opacity = getOpacity(); Color3B color = getColor(); // Release old sprites this->cleanupSlicedSprites(); - _protectedChildren.clear(); updateBlendFunc(sprite?sprite->getTexture():nullptr); @@ -509,15 +420,12 @@ namespace ui { _scale9Image->setSpriteFrame(sprite->getSpriteFrame()); } } - - if (!_scale9Image) + else { - return false; + CC_SAFE_RELEASE_NULL(_scale9Image); } - SpriteFrame *spriteFrame = _scale9Image->getSpriteFrame(); - - if (!spriteFrame) + if (!_scale9Image) { return false; } @@ -525,8 +433,6 @@ namespace ui { Rect rect(textureRect); Size size(originalSize); - _capInsets = capInsets; - // If there is no given rect if ( rect.equals(Rect::ZERO) ) { @@ -543,7 +449,6 @@ namespace ui { // Set the given rect's size as original size _spriteRect = rect; - _offset = offset; _spriteFrameRotated = rotated; _originalSize = size; _preferredSize = size; @@ -552,7 +457,9 @@ namespace ui { if (_scale9Enabled) { - this->createSlicedSprites(); + _scale9Image->setAnchorPoint(Vec2::ZERO); + _scale9Image->setPosition(Vec2::ZERO); + _sliceSpriteDirty = true; } applyBlendFunc(); @@ -574,477 +481,78 @@ namespace ui { return true; } + + void Scale9Sprite::configureSimpleModeRendering() + { + this->setInsetTop(0); + this->setInsetBottom(0); + this->setInsetLeft(0); + this->setInsetRight(0); + } void Scale9Sprite::createSlicedSprites() { - float width = _originalSize.width; - float height = _originalSize.height; - - Vec2 offsetPosition(floor(_offset.x + (_originalSize.width - _spriteRect.size.width) / 2), - floor(_offset.y + (_originalSize.height - _spriteRect.size.height) / 2)); - - // If there is no specified center region - if ( _capInsetsInternal.equals(Rect::ZERO) ) + //todo create sliced sprite + if (_scale9Enabled) { - // log("... cap insets not specified : using default cap insets ..."); - _capInsetsInternal = Rect(width /3, height /3, width /3, height /3); - } + Texture2D *tex = _scale9Image ? _scale9Image->getTexture() : nullptr; - Rect originalRect=_spriteRect; - if(_spriteFrameRotated) - originalRect = Rect(_spriteRect.origin.x - offsetPosition.y, - _spriteRect.origin.y - offsetPosition.x, - _originalSize.width, _originalSize.height); - else - originalRect = Rect(_spriteRect.origin.x - offsetPosition.x, - _spriteRect.origin.y - offsetPosition.y, - _originalSize.width, _originalSize.height); - - float leftWidth = _capInsetsInternal.origin.x; - float centerWidth = _capInsetsInternal.size.width; - float rightWidth = originalRect.size.width - (leftWidth + centerWidth); - - float topHeight = _capInsetsInternal.origin.y; - float centerHeight = _capInsetsInternal.size.height; - float bottomHeight = originalRect.size.height - (topHeight + centerHeight); - - // calculate rects - - // ... top row - float x = 0.0; - float y = 0.0; - //why do we need pixelRect? - Rect pixelRect = Rect(offsetPosition.x, offsetPosition.y, - _spriteRect.size.width, _spriteRect.size.height); - - // top left - Rect leftTopBoundsOriginal = Rect(x, y, leftWidth, topHeight); - Rect leftTopBounds = leftTopBoundsOriginal; - - // top center - x += leftWidth; - Rect centerTopBounds = Rect(x, y, centerWidth, topHeight); - - // top right - x += centerWidth; - Rect rightTopBounds = Rect(x, y, rightWidth, topHeight); - - // ... center row - x = 0.0; - y = 0.0; - y += topHeight; - - // center left - Rect leftCenterBounds = Rect(x, y, leftWidth, centerHeight); - - // center center - x += leftWidth; - Rect centerBoundsOriginal = Rect(x, y, centerWidth, centerHeight); - Rect centerBounds = centerBoundsOriginal; - - // center right - x += centerWidth; - Rect rightCenterBounds = Rect(x, y, rightWidth, centerHeight); - - // ... bottom row - x = 0.0; - y = 0.0; - y += topHeight; - y += centerHeight; - - // bottom left - Rect leftBottomBounds = Rect(x, y, leftWidth, bottomHeight); - - // bottom center - x += leftWidth; - Rect centerBottomBounds = Rect(x, y, centerWidth, bottomHeight); - - // bottom right - x += centerWidth; - Rect rightBottomBoundsOriginal = Rect(x, y, rightWidth, bottomHeight); - Rect rightBottomBounds = rightBottomBoundsOriginal; - - if((_capInsetsInternal.origin.x + _capInsetsInternal.size.width) <= _originalSize.width - || (_capInsetsInternal.origin.y + _capInsetsInternal.size.height) <= _originalSize.height) - //in general case it is error but for legacy support we will check it - { - leftTopBounds = intersectRect(leftTopBounds, pixelRect); - centerTopBounds = intersectRect(centerTopBounds, pixelRect); - rightTopBounds = intersectRect(rightTopBounds, pixelRect); - leftCenterBounds = intersectRect(leftCenterBounds, pixelRect); - centerBounds = intersectRect(centerBounds, pixelRect); - rightCenterBounds = intersectRect(rightCenterBounds, pixelRect); - leftBottomBounds = intersectRect(leftBottomBounds, pixelRect); - centerBottomBounds = intersectRect(centerBottomBounds, pixelRect); - rightBottomBounds = intersectRect(rightBottomBounds, pixelRect); - } - else - //it is error but for legacy turn off clip system - CCLOG("Scale9Sprite capInsetsInternal > originalSize"); - - Rect rotatedLeftTopBoundsOriginal = leftTopBoundsOriginal; - Rect rotatedCenterBoundsOriginal = centerBoundsOriginal; - Rect rotatedRightBottomBoundsOriginal = rightBottomBoundsOriginal; - - 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; - - if (!_spriteFrameRotated) - { - - AffineTransform t = AffineTransform::IDENTITY; - t = AffineTransformTranslate(t, originalRect.origin.x, originalRect.origin.y); - - rotatedLeftTopBoundsOriginal = RectApplyAffineTransform(rotatedLeftTopBoundsOriginal, t); - rotatedCenterBoundsOriginal = RectApplyAffineTransform(rotatedCenterBoundsOriginal, t); - rotatedRightBottomBoundsOriginal = RectApplyAffineTransform(rotatedRightBottomBoundsOriginal, t); - - rotatedCenterBounds = RectApplyAffineTransform(rotatedCenterBounds, t); - rotatedRightBottomBounds = RectApplyAffineTransform(rotatedRightBottomBounds, t); - rotatedLeftBottomBounds = RectApplyAffineTransform(rotatedLeftBottomBounds, t); - rotatedRightTopBounds = RectApplyAffineTransform(rotatedRightTopBounds, t); - rotatedLeftTopBounds = RectApplyAffineTransform(rotatedLeftTopBounds, t); - rotatedRightCenterBounds = RectApplyAffineTransform(rotatedRightCenterBounds, t); - rotatedLeftCenterBounds = RectApplyAffineTransform(rotatedLeftCenterBounds, t); - rotatedCenterBottomBounds = RectApplyAffineTransform(rotatedCenterBottomBounds, t); - rotatedCenterTopBounds = RectApplyAffineTransform(rotatedCenterTopBounds, t); - - - } - 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; - - t = AffineTransformTranslate(t, originalRect.size.height+originalRect.origin.x, originalRect.origin.y); - t = AffineTransformRotate(t, 1.57079633f); - - leftTopBoundsOriginal = RectApplyAffineTransform(leftTopBoundsOriginal, t); - centerBoundsOriginal = RectApplyAffineTransform(centerBoundsOriginal, t); - rightBottomBoundsOriginal = RectApplyAffineTransform(rightBottomBoundsOriginal, t); - - 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); - - rotatedLeftTopBoundsOriginal.origin = leftTopBoundsOriginal.origin; - rotatedCenterBoundsOriginal.origin = centerBoundsOriginal.origin; - rotatedRightBottomBoundsOriginal.origin = rightBottomBoundsOriginal.origin; - - 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; - - - } - - _topLeftSize = rotatedLeftTopBoundsOriginal.size; - _centerSize = rotatedCenterBoundsOriginal.size; - _bottomRightSize = rotatedRightBottomBoundsOriginal.size; - if(_isPatch9) - { - _topLeftSize.width = _topLeftSize.width - 1; - _topLeftSize.height = _topLeftSize.height - 1; - _bottomRightSize.width = _bottomRightSize.width - 1; - _bottomRightSize.height = _bottomRightSize.height - 1; - } - - if(_spriteFrameRotated) - { - float offsetX = (rotatedCenterBounds.origin.x + rotatedCenterBounds.size.height/2) - - (rotatedCenterBoundsOriginal.origin.x + rotatedCenterBoundsOriginal.size.height/2); - float offsetY = (rotatedCenterBoundsOriginal.origin.y + rotatedCenterBoundsOriginal.size.width/2) - - (rotatedCenterBounds.origin.y + rotatedCenterBounds.size.width/2); - _centerOffset.x = -offsetY; - _centerOffset.y = offsetX; - } - else - { - float offsetX = (rotatedCenterBounds.origin.x + rotatedCenterBounds.size.width/2) - - (rotatedCenterBoundsOriginal.origin.x + rotatedCenterBoundsOriginal.size.width/2); - float offsetY = (rotatedCenterBoundsOriginal.origin.y + rotatedCenterBoundsOriginal.size.height/2) - - (rotatedCenterBounds.origin.y + rotatedCenterBounds.size.height/2); - _centerOffset.x = offsetX; - _centerOffset.y = offsetY; - } - - //shrink the image size when it is 9-patch - if(_isPatch9) - { - float offset = 1.0f; - //Top left - if(!_spriteFrameRotated) + if (tex == nullptr) { - rotatedLeftTopBounds.origin.x+=offset; - rotatedLeftTopBounds.origin.y+=offset; - rotatedLeftTopBounds.size.width-=offset; - rotatedLeftTopBounds.size.height-=offset; - //Center left - rotatedLeftCenterBounds.origin.x+=offset; - rotatedLeftCenterBounds.size.width-=offset; - //Bottom left - rotatedLeftBottomBounds.origin.x+=offset; - rotatedLeftBottomBounds.size.width-=offset; - rotatedLeftBottomBounds.size.height-=offset; - //Top center - rotatedCenterTopBounds.size.height-=offset; - rotatedCenterTopBounds.origin.y+=offset; - //Bottom center - rotatedCenterBottomBounds.size.height-=offset; - //Top right - rotatedRightTopBounds.size.width-=offset; - rotatedRightTopBounds.size.height-=offset; - rotatedRightTopBounds.origin.y+=offset; - //Center right - rotatedRightCenterBounds.size.width-=offset; - //Bottom right - rotatedRightBottomBounds.size.width-=offset; - rotatedRightBottomBounds.size.height-=offset; + return; } - else + + if (_renderingType == RenderingType::SIMPLE) { - //Top left - rotatedLeftTopBounds.size.width-=offset; - rotatedLeftTopBounds.size.height-=offset; - rotatedLeftTopBounds.origin.y+=offset; - //Center left - rotatedLeftCenterBounds.origin.y+=offset; - rotatedLeftCenterBounds.size.width-=offset; - //Bottom left - rotatedLeftBottomBounds.origin.x+=offset; - rotatedLeftBottomBounds.origin.y+=offset; - rotatedLeftBottomBounds.size.width-=offset; - rotatedLeftBottomBounds.size.height-=offset; - //Top center - rotatedCenterTopBounds.size.height-=offset; - //Bottom center - rotatedCenterBottomBounds.size.height-=offset; - rotatedCenterBottomBounds.origin.x+=offset; - //Top right - rotatedRightTopBounds.size.width-=offset; - rotatedRightTopBounds.size.height-=offset; - //Center right - rotatedRightCenterBounds.size.width-=offset; - //Bottom right - rotatedRightBottomBounds.size.width-=offset; - rotatedRightBottomBounds.size.height-=offset; - rotatedRightBottomBounds.origin.x+=offset; + this->configureSimpleModeRendering(); } - } - // Centre - if(rotatedCenterBounds.size.width > 0 && rotatedCenterBounds.size.height > 0 ) - { - _centerSprite = Sprite::createWithTexture(_scale9Image->getTexture(), - rotatedCenterBounds, - _spriteFrameRotated); - _centerSprite->retain(); - this->addProtectedChild(_centerSprite); - } + auto capInsets = CC_RECT_POINTS_TO_PIXELS(_capInsetsInternal); + auto textureRect = CC_RECT_POINTS_TO_PIXELS(_spriteRect); + auto spriteRectSize = CC_SIZE_POINTS_TO_PIXELS(_originalSize); - // Top - if(rotatedCenterTopBounds.size.width > 0 && rotatedCenterTopBounds.size.height > 0 ) - { - _topSprite = Sprite::createWithTexture(_scale9Image->getTexture(), - rotatedCenterTopBounds, - _spriteFrameRotated); - _topSprite->retain(); - this->addProtectedChild(_topSprite); - } + //handle .9.png + if (_isPatch9) + { + spriteRectSize = Size(spriteRectSize.width - 2, spriteRectSize.height-2); + } - // Bottom - if(rotatedCenterBottomBounds.size.width > 0 && rotatedCenterBottomBounds.size.height > 0 ) - { - _bottomSprite = Sprite::createWithTexture(_scale9Image->getTexture(), - rotatedCenterBottomBounds, - _spriteFrameRotated); - _bottomSprite->retain(); - this->addProtectedChild(_bottomSprite); - } - // Left - if(rotatedLeftCenterBounds.size.width > 0 && rotatedLeftCenterBounds.size.height > 0 ) - { - _leftSprite = Sprite::createWithTexture(_scale9Image->getTexture(), - rotatedLeftCenterBounds, - _spriteFrameRotated); - _leftSprite->retain(); - this->addProtectedChild(_leftSprite); - } + if(capInsets.equals(Rect::ZERO)) + { + capInsets = Rect(spriteRectSize.width/3, spriteRectSize.height/3, + spriteRectSize.width/3, spriteRectSize.height/3); + } - // Right - if(rotatedRightCenterBounds.size.width > 0 && rotatedRightCenterBounds.size.height > 0 ) - { - _rightSprite = Sprite::createWithTexture(_scale9Image->getTexture(), - rotatedRightCenterBounds, - _spriteFrameRotated); - _rightSprite->retain(); - this->addProtectedChild(_rightSprite); - } + auto uv = this->calculateUV(tex, capInsets, spriteRectSize); + auto vertices = this->calculateVertices(capInsets, spriteRectSize); + auto triangles = this->calculateTriangles(uv, vertices); - // Top left - if(rotatedLeftTopBounds.size.width > 0 && rotatedLeftTopBounds.size.height > 0 ) - { - _topLeftSprite = Sprite::createWithTexture(_scale9Image->getTexture(), - rotatedLeftTopBounds, - _spriteFrameRotated); - _topLeftSprite->retain(); - this->addProtectedChild(_topLeftSprite); - } - - // Top right - if(rotatedRightTopBounds.size.width > 0 && rotatedRightTopBounds.size.height > 0 ) - { - _topRightSprite = Sprite::createWithTexture(_scale9Image->getTexture(), - rotatedRightTopBounds, - _spriteFrameRotated); - _topRightSprite->retain(); - this->addProtectedChild(_topRightSprite); - } - - // Bottom left - if(rotatedLeftBottomBounds.size.width > 0 && rotatedLeftBottomBounds.size.height > 0 ) - { - _bottomLeftSprite = Sprite::createWithTexture(_scale9Image->getTexture(), - rotatedLeftBottomBounds, - _spriteFrameRotated); - _bottomLeftSprite->retain(); - this->addProtectedChild(_bottomLeftSprite); - } - - // Bottom right - if(rotatedRightBottomBounds.size.width > 0 && rotatedRightBottomBounds.size.height > 0 ) - { - _bottomRightSprite = Sprite::createWithTexture(_scale9Image->getTexture(), - rotatedRightBottomBounds, - _spriteFrameRotated); - _bottomRightSprite->retain(); - this->addProtectedChild(_bottomRightSprite); + _scale9Image->getPolygonInfo().setTriangles(triangles); } } void Scale9Sprite::setContentSize(const Size &size) { + if (_contentSize.equals(size)) + { + return; + } Node::setContentSize(size); - this->_positionsAreDirty = true; + _preferredSize = size; + _sliceSpriteDirty = true; + this->adjustNoneScale9ImagePosition(); } - void Scale9Sprite::updatePositions() - { - Size size = this->_contentSize; - - float sizableWidth = size.width - _topLeftSize.width - _bottomRightSize.width; - float sizableHeight = size.height - _topLeftSize.height - _bottomRightSize.height; - - float horizontalScale = sizableWidth/_centerSize.width; - float verticalScale = sizableHeight/_centerSize.height; - - if(_centerSprite) - { - _centerSprite->setScaleX(horizontalScale); - _centerSprite->setScaleY(verticalScale); - } - - float rescaledWidth = _centerSize.width * horizontalScale; - float rescaledHeight = _centerSize.height * verticalScale; - - float leftWidth = _topLeftSize.width; - float bottomHeight = _bottomRightSize.height; - - Vec2 centerOffset(_centerOffset.x * horizontalScale, _centerOffset.y * verticalScale); - - // Position corners - if(_bottomLeftSprite) - { - _bottomLeftSprite->setAnchorPoint(Vec2(1,1)); - _bottomLeftSprite->setPosition(leftWidth,bottomHeight); - } - if(_bottomRightSprite) - { - _bottomRightSprite->setAnchorPoint(Vec2(0,1)); - _bottomRightSprite->setPosition(leftWidth+rescaledWidth,bottomHeight); - } - if(_topLeftSprite) - { - _topLeftSprite->setAnchorPoint(Vec2(1,0)); - _topLeftSprite->setPosition(leftWidth, bottomHeight+rescaledHeight); - } - if(_topRightSprite) - { - _topRightSprite->setAnchorPoint(Vec2(0,0)); - _topRightSprite->setPosition(leftWidth+rescaledWidth, bottomHeight+rescaledHeight); - } - - // Scale and position borders - if(_leftSprite) - { - _leftSprite->setAnchorPoint(Vec2(1,0.5)); - _leftSprite->setPosition(leftWidth, bottomHeight+rescaledHeight/2 + centerOffset.y); - _leftSprite->setScaleY(verticalScale); - } - if(_rightSprite) - { - _rightSprite->setAnchorPoint(Vec2(0,0.5)); - _rightSprite->setPosition(leftWidth+rescaledWidth,bottomHeight+rescaledHeight/2 + centerOffset.y); - _rightSprite->setScaleY(verticalScale); - } - if(_topSprite) - { - _topSprite->setAnchorPoint(Vec2(0.5,0)); - _topSprite->setPosition(leftWidth+rescaledWidth/2 + centerOffset.x,bottomHeight+rescaledHeight); - _topSprite->setScaleX(horizontalScale); - } - if(_bottomSprite) - { - _bottomSprite->setAnchorPoint(Vec2(0.5,1)); - _bottomSprite->setPosition(leftWidth+rescaledWidth/2 + centerOffset.x,bottomHeight); - _bottomSprite->setScaleX(horizontalScale); - } - // Position centre - if(_centerSprite) - { - _centerSprite->setAnchorPoint(Vec2(0.5,0.5)); - _centerSprite->setPosition(leftWidth+rescaledWidth/2 + centerOffset.x, - bottomHeight+rescaledHeight/2 + centerOffset.y); - _centerSprite->setScaleX(horizontalScale); - _centerSprite->setScaleY(verticalScale); - } - } - - - Scale9Sprite* Scale9Sprite::resizableSpriteWithCapInsets(const Rect& capInsets) const { Scale9Sprite* pReturn = new (std::nothrow) Scale9Sprite(); if ( pReturn && pReturn->init(_scale9Image, _spriteRect, _spriteFrameRotated, - _offset, + Vec2::ZERO, _originalSize, - _capInsets) ) + capInsets) ) { pReturn->autorelease(); return pReturn; @@ -1081,13 +589,6 @@ namespace ui { _scale9Image->setGLProgramState(glState); } - if (_scale9Enabled) - { - for (auto& sp : _protectedChildren) - { - sp->setGLProgramState(glState); - } - } _brightState = state; } @@ -1101,17 +602,10 @@ namespace ui { 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, - _originalSize.width-_insetLeft-_insetRight, - _originalSize.height-_insetTop-_insetBottom); - } + insets = Rect(_insetLeft, + _insetTop, + _originalSize.width-_insetLeft-_insetRight, + _originalSize.height-_insetTop-_insetBottom); this->setCapInsets(insets); } @@ -1136,7 +630,6 @@ namespace ui { void Scale9Sprite::setPreferredSize(const Size& preferredSize) { this->setContentSize(preferredSize); - this->_preferredSize = preferredSize; } @@ -1146,7 +639,7 @@ namespace ui { this->updateWithSprite(this->_scale9Image, _spriteRect, _spriteFrameRotated, - _offset, + Vec2::ZERO, _originalSize, capInsets); this->_insetLeft = capInsets.origin.x; @@ -1189,6 +682,10 @@ namespace ui { { return; } + if (_scale9Enabled && _sliceSpriteDirty) { + this->createSlicedSprites(); + _sliceSpriteDirty = false; + } uint32_t flags = processParentFlags(parentTransform, parentFlags); @@ -1201,10 +698,8 @@ namespace ui { director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewTransform); int i = 0; // used by _children - int j = 0; // used by _protectedChildren sortAllChildren(); - sortAllProtectedChildren(); // // draw children and protectedChildren zOrder < 0 @@ -1219,25 +714,11 @@ namespace ui { break; } - if (_scale9Enabled) + if (_scale9Image && _scale9Image->getLocalZOrder() < 0 ) { - for( ; j < _protectedChildren.size(); j++ ) - { - auto node = _protectedChildren.at(j); - - if ( node && node->getLocalZOrder() < 0 ) - node->visit(renderer, _modelViewTransform, flags); - else - break; - } - } - else - { - if (_scale9Image && _scale9Image->getLocalZOrder() < 0 ) - { - _scale9Image->visit(renderer, _modelViewTransform, flags); - } + _scale9Image->visit(renderer, _modelViewTransform, flags); } + // // draw self @@ -1248,17 +729,9 @@ namespace ui { // // draw children and protectedChildren zOrder >= 0 // - if (_scale9Enabled) + if (_scale9Image && _scale9Image->getLocalZOrder() >= 0 ) { - for(auto it=_protectedChildren.cbegin()+j; it != _protectedChildren.cend(); ++it) - (*it)->visit(renderer, _modelViewTransform, flags); - } - else - { - if (_scale9Image && _scale9Image->getLocalZOrder() >= 0 ) - { - _scale9Image->visit(renderer, _modelViewTransform, flags); - } + _scale9Image->visit(renderer, _modelViewTransform, flags); } @@ -1286,7 +759,7 @@ namespace ui { Rect Scale9Sprite::getCapInsets()const { - return _capInsets; + return _capInsetsInternal; } @@ -1319,7 +792,6 @@ namespace ui { _scale9Enabled = enabled; this->cleanupSlicedSprites(); - _protectedChildren.clear(); //we must invalide the transform when toggling scale9enabled _transformUpdated = _transformDirty = _inverseDirty = true; @@ -1331,51 +803,30 @@ namespace ui { this->updateWithSprite(this->_scale9Image, _spriteRect, _spriteFrameRotated, - _offset, + Vec2::ZERO, _originalSize, - _capInsets); + _capInsetsInternal); } } - _positionsAreDirty = true; + else + { + if (_scale9Image) + { + auto quad = _scale9Image->getQuad(); + PolygonInfo polyInfo; + polyInfo.setQuad(&quad); + _scale9Image->setPolygonInfo(polyInfo); + } + + } + this->adjustNoneScale9ImagePosition(); } bool Scale9Sprite::isScale9Enabled() const { return _scale9Enabled; } - - void Scale9Sprite::addProtectedChild(cocos2d::Node *child) - { - _reorderProtectedChildDirty = true; - _protectedChildren.pushBack(child); - } - - void Scale9Sprite::sortAllProtectedChildren() - { - if(this->_positionsAreDirty) - { - this->updatePositions(); - this->adjustScale9ImagePosition(); - this->_positionsAreDirty = false; - } - if( _reorderProtectedChildDirty ) - { - std::sort( std::begin(_protectedChildren), - std::end(_protectedChildren), - nodeComparisonLess ); - _reorderProtectedChildDirty = false; - } - } - - void Scale9Sprite::adjustScale9ImagePosition() - { - if (_scale9Image) - { - _scale9Image->setPosition(_contentSize.width * _scale9Image->getAnchorPoint().x, - _contentSize.height * _scale9Image->getAnchorPoint().y); - } - } - + void Scale9Sprite::setAnchorPoint(const cocos2d::Vec2 &position) { Node::setAnchorPoint(position); @@ -1383,85 +834,24 @@ namespace ui { { if (_scale9Image) { + _nonSliceSpriteAnchor = position; _scale9Image->setAnchorPoint(position); - _positionsAreDirty = true; + this->adjustNoneScale9ImagePosition(); } } } - void Scale9Sprite::cleanup() + void Scale9Sprite::adjustNoneScale9ImagePosition() { -#if CC_ENABLE_SCRIPT_BINDING - if (_scriptType == kScriptTypeJavascript) + if (_scale9Image) { - if (ScriptEngineManager::sendNodeEventToJSExtended(this, kNodeOnCleanup)) - return; - } -#endif // #if CC_ENABLE_SCRIPT_BINDING - - Node::cleanup(); - // timers - for( const auto &child: _protectedChildren) - child->cleanup(); - } + if (!_scale9Enabled) { + _scale9Image->setAnchorPoint(_nonSliceSpriteAnchor); + _scale9Image->setPosition(_contentSize.width * _scale9Image->getAnchorPoint().x, + _contentSize.height * _scale9Image->getAnchorPoint().y); - void Scale9Sprite::onEnter() - { -#if CC_ENABLE_SCRIPT_BINDING - if (_scriptType == kScriptTypeJavascript) - { - if (ScriptEngineManager::sendNodeEventToJSExtended(this, kNodeOnEnter)) - return; + } } -#endif - Node::onEnter(); - for( const auto &child: _protectedChildren) - child->onEnter(); - } - - void Scale9Sprite::onExit() - { -#if CC_ENABLE_SCRIPT_BINDING - if (_scriptType == kScriptTypeJavascript) - { - if (ScriptEngineManager::sendNodeEventToJSExtended(this, kNodeOnExit)) - return; - } -#endif - - Node::onExit(); - for( const auto &child: _protectedChildren) - child->onExit(); - } - - void Scale9Sprite::onEnterTransitionDidFinish() - { -#if CC_ENABLE_SCRIPT_BINDING - if (_scriptType == kScriptTypeJavascript) - { - if (ScriptEngineManager::sendNodeEventToJSExtended(this, kNodeOnEnterTransitionDidFinish)) - return; - } -#endif - - Node::onEnterTransitionDidFinish(); - for( const auto &child: _protectedChildren) - child->onEnterTransitionDidFinish(); - } - - void Scale9Sprite::onExitTransitionDidStart() - { -#if CC_ENABLE_SCRIPT_BINDING - if (_scriptType == kScriptTypeJavascript) - { - if (ScriptEngineManager::sendNodeEventToJSExtended(this, kNodeOnExitTransitionDidStart)) - return; - } -#endif - - Node::onExitTransitionDidStart(); - for( const auto &child: _protectedChildren) - child->onExitTransitionDidStart(); } void Scale9Sprite::updateDisplayedColor(const cocos2d::Color3B &parentColor) @@ -1475,12 +865,7 @@ namespace ui { { _scale9Image->updateDisplayedColor(_displayedColor); } - - for(const auto &child : _protectedChildren) - { - child->updateDisplayedColor(_displayedColor); - } - + if (_cascadeColorEnabled) { for(const auto &child : _children) @@ -1500,11 +885,6 @@ namespace ui { _scale9Image->updateDisplayedOpacity(_displayedOpacity); } - for(auto child : _protectedChildren) - { - child->updateDisplayedOpacity(_displayedOpacity); - } - if (_cascadeOpacityEnabled) { for(auto child : _children) @@ -1520,10 +900,7 @@ namespace ui { { child->updateDisplayedColor(Color3B::WHITE); } - for(auto child : _protectedChildren) - { - child->updateDisplayedColor(Color3B::WHITE); - } + if (_scale9Image) { _scale9Image->updateDisplayedColor(Color3B::WHITE); @@ -1537,10 +914,6 @@ namespace ui { for(auto child : _children){ child->updateDisplayedOpacity(255); } - - for(auto child : _protectedChildren){ - child->updateDisplayedOpacity(255); - } } Sprite* Scale9Sprite::getSprite()const @@ -1635,11 +1008,304 @@ namespace ui { if(_scale9Image) _scale9Image->setCameraMask(mask,applyChildren); + } + + // (0,0) O = capInsets.origin + // v0---------------------- + // | | | | + // | | | | + // v1-------O------+------| + // | | | | + // | | | | + // v2-------+------+------| + // | | | | + // | | | | + // v3-------------------- (1,1) (texture coordinate is flipped) + // u0 u1 u2 u3 + std::vector Scale9Sprite::calculateUV(Texture2D *tex, + const Rect& capInsets, + const Size& spriteRectSize) + { + auto atlasWidth = tex->getPixelsWide(); + auto atlasHeight = tex->getPixelsHigh(); - for(auto& iter: _protectedChildren) + //caculate texture coordinate + float leftWidth = 0, centerWidth = 0, rightWidth = 0; + float topHeight = 0, centerHeight = 0, bottomHeight = 0; + + if (_spriteFrameRotated) { - iter->setCameraMask(mask); + rightWidth = capInsets.origin.y; + centerWidth = capInsets.size.height; + leftWidth = spriteRectSize.height - centerWidth - rightWidth; + + topHeight = capInsets.origin.x; + centerHeight = capInsets.size.width; + bottomHeight = spriteRectSize.width - (topHeight + centerHeight); } + else + { + leftWidth = capInsets.origin.x; + centerWidth = capInsets.size.width; + rightWidth = spriteRectSize.width - (leftWidth + centerWidth); + + topHeight = capInsets.origin.y; + centerHeight = capInsets.size.height; + bottomHeight =spriteRectSize.height - (topHeight + centerHeight); + } + + auto textureRect = CC_RECT_POINTS_TO_PIXELS(_spriteRect); + //handle .9.png + if (_isPatch9) + { + //This magic number is used to avoiding artifact with .9.png format. + float offset = 1.3f; + textureRect = Rect(textureRect.origin.x + offset, + textureRect.origin.y + offset, + textureRect.size.width - 2, + textureRect.size.height - 2); + } + + //uv computation should take spritesheet into account. + float u0, u1, u2, u3; + float v0, v1, v2, v3; + if (_spriteFrameRotated) + { + u0 = textureRect.origin.x / atlasWidth; + u1 = (leftWidth + textureRect.origin.x) / atlasWidth; + u2 = (leftWidth + centerWidth + textureRect.origin.x) / atlasWidth; + u3 = (textureRect.origin.x + textureRect.size.height) / atlasWidth; + + v3 = textureRect.origin.y / atlasHeight; + v2 = (topHeight + textureRect.origin.y) / atlasHeight; + v1 = (topHeight + centerHeight + textureRect.origin.y) / atlasHeight; + v0 = (textureRect.origin.y + textureRect.size.width) / atlasHeight; + } + else + { + u0 = textureRect.origin.x / atlasWidth; + u1 = (leftWidth + textureRect.origin.x) / atlasWidth; + u2 = (leftWidth + centerWidth + textureRect.origin.x) / atlasWidth; + u3 = (textureRect.origin.x + textureRect.size.width) / atlasWidth; + + v0 = textureRect.origin.y / atlasHeight; + v1 = (topHeight + textureRect.origin.y) / atlasHeight; + v2 = (topHeight + centerHeight + textureRect.origin.y) / atlasHeight; + v3 = (textureRect.origin.y + textureRect.size.height) / atlasHeight; + } + + + std::vector uvCoordinates; + if (_renderingType == RenderingType::SIMPLE) + { + uvCoordinates = {Vec2(u0,v3), Vec2(u3,v0)}; + } + else + { + uvCoordinates = {Vec2(u0,v3), Vec2(u1,v2), Vec2(u2,v1), Vec2(u3,v0)}; + } + + return uvCoordinates; + } + + // + // y3----------------------(preferedSize.width, preferedSize.height) + // | | | | + // | | | | + // y2-------O------+------| + // | | | | + // | | | | + // y1-------+------+------| + // | | | | + // | | | | + //x0,y0-------------------- + // x1 x2 x3 + std::vector Scale9Sprite::calculateVertices(const Rect& capInsets, + const Size& spriteRectSize) + { + float leftWidth = 0, centerWidth = 0, rightWidth = 0; + float topHeight = 0, centerHeight = 0, bottomHeight = 0; + + leftWidth = capInsets.origin.x; + centerWidth = capInsets.size.width; + rightWidth = spriteRectSize.width - (leftWidth + centerWidth); + + topHeight = capInsets.origin.y; + centerHeight = capInsets.size.height; + bottomHeight = spriteRectSize.height - (topHeight + centerHeight); + + + leftWidth = leftWidth / CC_CONTENT_SCALE_FACTOR(); + rightWidth = rightWidth / CC_CONTENT_SCALE_FACTOR(); + topHeight = topHeight / CC_CONTENT_SCALE_FACTOR(); + bottomHeight = bottomHeight / CC_CONTENT_SCALE_FACTOR(); + float sizableWidth = _preferredSize.width - leftWidth - rightWidth; + float sizableHeight = _preferredSize.height - topHeight - bottomHeight; + float x0,x1,x2,x3; + float y0,y1,y2,y3; + if(sizableWidth >= 0) + { + x0 = 0; + x1 = leftWidth; + x2 = leftWidth + sizableWidth; + x3 = _preferredSize.width; + } + else + { + float xScale = _preferredSize.width / (leftWidth + rightWidth); + x0 = 0; + x1 = x2 = leftWidth * xScale; + x3 = (leftWidth + rightWidth) * xScale; + } + + if(sizableHeight >= 0) + { + y0 = 0; + y1 = bottomHeight; + y2 = bottomHeight + sizableHeight; + y3 = _preferredSize.height; + } + else + { + float yScale = _preferredSize.height / (topHeight + bottomHeight); + y0 = 0; + y1 = y2= bottomHeight * yScale; + y3 = (bottomHeight + topHeight) * yScale; + } + + std::vector vertices; + + if (_renderingType == RenderingType::SIMPLE) + { + vertices = {Vec2(x0,y0), Vec2(x3,y3)}; + } + else + { + vertices = {Vec2(x0,y0), Vec2(x1,y1), Vec2(x2,y2), Vec2(x3,y3)}; + } + return vertices; + } + + TrianglesCommand::Triangles Scale9Sprite::calculateTriangles(const std::vector& uv, + const std::vector& vertices) + { + const unsigned short slicedTotalVertexCount = powf(uv.size(),2); + const unsigned short slicedTotalIndices = 6 * powf(uv.size() -1, 2); + CC_SAFE_DELETE_ARRAY(_sliceVertices); + CC_SAFE_DELETE_ARRAY(_sliceIndices); + + _sliceVertices = new V3F_C4B_T2F[slicedTotalVertexCount]; + _sliceIndices = new unsigned short[slicedTotalIndices]; + + unsigned short indicesStart = 0; + const unsigned short indicesOffset = 6; + const unsigned short sliceQuadIndices[] = {4,0,5, 1,5,0}; + const unsigned short simpleQuadIndices[] = {0,1,2, 3,2,1}; + + auto displayedColor = _scale9Image->getDisplayedColor(); + auto displayedOpacity = _scale9Image->getDisplayedOpacity(); + Color4B color4( displayedColor.r, displayedColor.g, displayedColor.b, displayedOpacity ); + + // special opacity for premultiplied textures + if (_scale9Image->isOpacityModifyRGB()) + { + color4.r *= displayedOpacity/255.0f; + color4.g *= displayedOpacity/255.0f; + color4.b *= displayedOpacity/255.0f; + } + + int vertexCount = (int)(vertices.size() - 1); + + for (int j = 0; j <= vertexCount; ++j) + { + for (int i = 0; i <= vertexCount; ++i) + { + V3F_C4B_T2F vertextData; + vertextData.vertices.x = vertices[i].x; + vertextData.vertices.y = vertices[j].y; + + if (_spriteFrameRotated) + { + vertextData.texCoords.u = uv[j].x; + vertextData.texCoords.v = uv[i].y; + } + else + { + vertextData.texCoords.u = uv[i].x; + vertextData.texCoords.v = uv[j].y; + } + + vertextData.colors = color4; + + //if slice mode + if (_renderingType == RenderingType::SLICE) + { + memcpy(_sliceVertices + i + j * 4, &vertextData, sizeof(V3F_C4B_T2F)); + } + else + { + memcpy(_sliceVertices + i + j * 2, &vertextData, sizeof(V3F_C4B_T2F)); + } + } + } + + if (_renderingType == RenderingType::SLICE) + { + for (int j = 0; j <= vertexCount; ++j) + { + for (int i = 0; i <= vertexCount; ++i) + { + if (i < 3 && j < 3) + { + memcpy(_sliceIndices + indicesStart, sliceQuadIndices, indicesOffset * sizeof(unsigned short)); + + for (int k = 0; k < indicesOffset; ++k) + { + unsigned short actualIndex = (i + j * 3) * indicesOffset; + _sliceIndices[k + actualIndex] = _sliceIndices[k + actualIndex] + j * 4 + i; + } + indicesStart = indicesStart + indicesOffset; + } + + } + } + } + + if (_renderingType == RenderingType::SIMPLE) + { + memcpy(_sliceIndices, simpleQuadIndices, indicesOffset * sizeof(unsigned short)); + } + + TrianglesCommand::Triangles triangles; + triangles.vertCount = slicedTotalVertexCount; + triangles.indexCount = slicedTotalIndices; + triangles.verts = _sliceVertices; + triangles.indices = _sliceIndices; + + return triangles; + } + + void Scale9Sprite::setRenderingType(cocos2d::ui::Scale9Sprite::RenderingType type) + { + if (_renderingType == type) + { + return; + } + _renderingType = type; + _sliceSpriteDirty = true; + } + + Scale9Sprite::RenderingType Scale9Sprite::getRenderingType()const + { + return _renderingType; + } + + void Scale9Sprite::resetRender() + { + // Release old sprites + this->cleanupSlicedSprites(); + + CC_SAFE_RELEASE_NULL(this->_scale9Image); } }} diff --git a/cocos/ui/UIScale9Sprite.h b/cocos/ui/UIScale9Sprite.h index 7743d21359..7547164260 100644 --- a/cocos/ui/UIScale9Sprite.h +++ b/cocos/ui/UIScale9Sprite.h @@ -30,6 +30,7 @@ #include "2d/CCSpriteBatchNode.h" #include "platform/CCPlatformMacros.h" #include "ui/GUIExport.h" +#include "renderer/CCTrianglesCommand.h" /** * @addtogroup ui @@ -77,6 +78,12 @@ namespace ui { GRAY }; + enum class RenderingType + { + SIMPLE, + SLICE + }; + public: /** @@ -457,7 +464,7 @@ namespace ui { // overrides virtual void setContentSize(const Size & size) override; virtual void setAnchorPoint(const Vec2& anchorPoint) override; - + /** * Change the state of 9-slice sprite. * @see `State` @@ -584,38 +591,6 @@ namespace ui { /// @} end of Children and Parent virtual void visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags) override; - virtual void cleanup() override; - - /** - * @lua NA - */ - virtual void onEnter() override; - - /** Event callback that is invoked when the Node enters in the 'stage'. - * If the Node enters the 'stage' with a transition, this event is called when the transition finishes. - * If you override onEnterTransitionDidFinish, you shall call its parent's one, e.g. Node::onEnterTransitionDidFinish() - * @js NA - * @lua NA - */ - virtual void onEnterTransitionDidFinish() override; - - /** - * Event callback that is invoked every time the Node leaves the 'stage'. - * If the Node leaves the 'stage' with a transition, this event is called when the transition finishes. - * During onExit you can't access a sibling node. - * If you override onExit, you shall call its parent's one, e.g., Node::onExit(). - * @js NA - * @lua NA - */ - virtual void onExit() override; - - /** - * Event callback that is called every time the Node leaves the 'stage'. - * If the Node leaves the 'stage' with a transition, this callback is called when the transition starts. - * @js NA - * @lua NA - */ - virtual void onExitTransitionDidStart() override; virtual void updateDisplayedOpacity(GLubyte parentOpacity) override; virtual void updateDisplayedColor(const Color3B& parentColor) override; @@ -679,59 +654,53 @@ namespace ui { virtual float getScale() const override; using Node::getScaleZ; virtual void setCameraMask(unsigned short mask, bool applyChildren = true) override; + + /** + * Set the slice sprite rendering type. + * When setting to SIMPLE, only 4 vertexes is used to rendering. + * otherwise 16 vertexes will be used to rendering. + * @see RenderingType + */ + void setRenderingType(RenderingType type); + + /** + * Return the slice sprite rendering type. + */ + RenderingType getRenderingType()const; + + void resetRender(); + protected: void updateCapInset(); - void updatePositions(); void createSlicedSprites(); void cleanupSlicedSprites(); - void adjustScale9ImagePosition(); + void adjustNoneScale9ImagePosition(); + void configureSimpleModeRendering(); void applyBlendFunc(); void updateBlendFunc(Texture2D *texture); - /** - * Sorts the children array once before drawing, instead of every time when a child is added or reordered. - * This approach can improves the performance massively. - * @note Don't call this manually unless a child added needs to be removed in the same frame - */ - virtual void sortAllProtectedChildren(); + std::vector calculateUV(Texture2D *tex, const Rect& capInsets, + const Size& spriteRectSize); + std::vector calculateVertices(const Rect& capInsets, const Size& spriteRectSize); + TrianglesCommand::Triangles calculateTriangles(const std::vector& uv, + const std::vector& vertices); bool _spritesGenerated; Rect _spriteRect; bool _spriteFrameRotated; Rect _capInsetsInternal; - bool _positionsAreDirty; Sprite* _scale9Image; //the original sprite - Sprite* _topLeftSprite; - Sprite* _topSprite; - Sprite* _topRightSprite; - Sprite* _leftSprite; - Sprite* _centerSprite; - Sprite* _rightSprite; - Sprite* _bottomLeftSprite; - Sprite* _bottomSprite; - Sprite* _bottomRightSprite; bool _scale9Enabled; BlendFunc _blendFunc; - Size _topLeftSize; - Size _centerSize; - Size _bottomRightSize; - Vec2 _centerOffset; - /** Original sprite's size. */ Size _originalSize; - Vec2 _offset; /** Preferred sprite's size. By default the preferred size is the original size. */ //if the preferredSize component is given as -1, it is ignored Size _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. - */ - Rect _capInsets; + /** Sets the left side inset */ float _insetLeft; /** Sets the top side inset */ @@ -741,16 +710,16 @@ namespace ui { /** Sets the bottom side inset */ float _insetBottom; - /// helper that reorder a child - void addProtectedChild(Node* child); - - Vector _protectedChildren; ///holds the 9 sprites - bool _reorderProtectedChildDirty; - bool _flippedX; bool _flippedY; bool _isPatch9; State _brightState; + Vec2 _nonSliceSpriteAnchor; + + V3F_C4B_T2F* _sliceVertices; + unsigned short* _sliceIndices; + bool _sliceSpriteDirty; + RenderingType _renderingType; }; }} //end of namespace diff --git a/cocos/ui/UIScrollView.cpp b/cocos/ui/UIScrollView.cpp index 2cebcfb5df..81ae8b64a6 100644 --- a/cocos/ui/UIScrollView.cpp +++ b/cocos/ui/UIScrollView.cpp @@ -176,23 +176,6 @@ void ScrollView::setInnerContainerSize(const Size &size) } _innerContainer->setContentSize(Size(innerSizeWidth, innerSizeHeight)); - // move children appropriately - { - Size newInnerSize = _innerContainer->getContentSize(); - float offsetY = originalInnerSize.height - newInnerSize.height; - float offsetX = 0; - if (_innerContainer->getRightBoundary() <= _contentSize.width) - { - offsetX = originalInnerSize.width - newInnerSize.width; - } - if(offsetX != 0 || offsetY != 0) - { - Vec2 position = _innerContainer->getPosition() + Vec2(offsetX, offsetY); - setInnerContainerPosition(position); - } - } - - // Calculate and set the position of the inner container. Vec2 pos = _innerContainer->getPosition(); if (_innerContainer->getLeftBoundary() > 0.0f) @@ -319,18 +302,19 @@ Node* ScrollView::getChildByName(const std::string& name)const return _innerContainer->getChildByName(name); } -void ScrollView::moveChildren(float offsetX, float offsetY) +void ScrollView::moveInnerContainer(const Vec2& deltaMove, bool canStartBounceBack) { - Vec2 position = _innerContainer->getPosition() + Vec2(offsetX, offsetY); - moveChildrenToPosition(position); -} - -void ScrollView::moveChildrenToPosition(const Vec2& position) -{ - setInnerContainerPosition(position); - - Vec2 outOfBoundary = getHowMuchOutOfBoundary(Vec2::ZERO); + Vec2 adjustedMove = flattenVectorByDirection(deltaMove); + + setInnerContainerPosition(getInnerContainerPosition() + adjustedMove); + + Vec2 outOfBoundary = getHowMuchOutOfBoundary(); updateScrollBar(outOfBoundary); + + if(_bounceEnabled && canStartBounceBack) + { + startBounceBackIfNeeded(); + } } void ScrollView::updateScrollBar(const Vec2& outOfBoundary) @@ -352,7 +336,7 @@ Vec2 ScrollView::calculateTouchMoveVelocity() const { totalTime += timeDelta; } - if(totalTime == 0 || totalTime >= 0.1f) + if(totalTime == 0 || totalTime >= 0.5f) { return Vec2::ZERO; } @@ -553,102 +537,79 @@ void ScrollView::processAutoScrolling(float deltaTime) reachedEnd = true; } } - - moveChildrenToPosition(newPosition); - + // Finish auto scroll if it ended if(reachedEnd) { _autoScrolling = false; - startBounceBackIfNeeded(); } + + moveInnerContainer(newPosition - getInnerContainerPosition(), reachedEnd); } void ScrollView::jumpToDestination(const Vec2 &des) { - float finalOffsetX = des.x; - float finalOffsetY = des.y; - if (des.y <= 0 && _direction != Direction::HORIZONTAL) - { - finalOffsetY = MAX(des.y, _contentSize.height - _innerContainer->getContentSize().height); - } - if (des.x <= 0 && _direction != Direction::VERTICAL) - { - finalOffsetX = MAX(des.x, _contentSize.width - _innerContainer->getContentSize().width); - } - moveChildrenToPosition(Vec2(finalOffsetX, finalOffsetY)); + _autoScrolling = false; + moveInnerContainer(des - getInnerContainerPosition(), true); } -bool ScrollView::scrollChildren(float touchOffsetX, float touchOffsetY) +void ScrollView::scrollChildren(const Vec2& deltaMove) { - touchOffsetX = (_direction == Direction::VERTICAL ? 0 : touchOffsetX); - touchOffsetY = (_direction == Direction::HORIZONTAL ? 0 : touchOffsetY); + Vec2 realMove = deltaMove; if(_bounceEnabled) { // If the position of the inner container is out of the boundary, the offsets should be divided by two. Vec2 outOfBoundary = getHowMuchOutOfBoundary(); - touchOffsetX *= (outOfBoundary.x == 0 ? 1 : 0.5f); - touchOffsetY *= (outOfBoundary.y == 0 ? 1 : 0.5f); + realMove.x *= (outOfBoundary.x == 0 ? 1 : 0.5f); + realMove.y *= (outOfBoundary.y == 0 ? 1 : 0.5f); } - float realOffsetX = touchOffsetX; - float realOffsetY = touchOffsetY; - if(!_bounceEnabled) { - Vec2 outOfBoundary = getHowMuchOutOfBoundary(Vec2(realOffsetX, realOffsetY)); - realOffsetX += outOfBoundary.x; - realOffsetY += outOfBoundary.y; + Vec2 outOfBoundary = getHowMuchOutOfBoundary(realMove); + realMove += outOfBoundary; } bool scrolledToLeft = false; bool scrolledToRight = false; bool scrolledToTop = false; bool scrolledToBottom = false; - if (realOffsetY > 0.0f) // up + if (realMove.y > 0.0f) // up { float icBottomPos = _innerContainer->getBottomBoundary(); - if (icBottomPos + realOffsetY >= _bottomBoundary) + if (icBottomPos + realMove.y >= _bottomBoundary) { scrolledToBottom = true; } } - else if (realOffsetY < 0.0f) // down + else if (realMove.y < 0.0f) // down { float icTopPos = _innerContainer->getTopBoundary(); - if (icTopPos + realOffsetY <= _topBoundary) + if (icTopPos + realMove.y <= _topBoundary) { scrolledToTop = true; } } - if (realOffsetX < 0.0f) // left + if (realMove.x < 0.0f) // left { float icRightPos = _innerContainer->getRightBoundary(); - if (icRightPos + realOffsetX <= _rightBoundary) + if (icRightPos + realMove.x <= _rightBoundary) { - if(!_bounceEnabled) - { - realOffsetX = _rightBoundary - icRightPos; - } scrolledToRight = true; } } - else if (realOffsetX > 0.0f) // right + else if (realMove.x > 0.0f) // right { float icLeftPos = _innerContainer->getLeftBoundary(); - if (icLeftPos + realOffsetX >= _leftBoundary) + if (icLeftPos + realMove.x >= _leftBoundary) { - if(!_bounceEnabled) - { - realOffsetX = _leftBoundary - icLeftPos; - } scrolledToLeft = true; } } - moveChildren(realOffsetX, realOffsetY); + moveInnerContainer(realMove, false); - if(realOffsetX != 0 || realOffsetY != 0) + if(realMove.x != 0 || realMove.y != 0) { processScrollingEvent(); } @@ -668,10 +629,6 @@ bool ScrollView::scrollChildren(float touchOffsetX, float touchOffsetY) { processScrollEvent(MoveDirection::RIGHT, false); } - - bool scrollEnabledUpDown = (!scrolledToBottom && !scrolledToTop); - bool scrollEnabledLeftRight = (!scrolledToLeft && !scrolledToRight); - return scrollEnabledUpDown || scrollEnabledLeftRight; } void ScrollView::scrollToBottom(float timeInSec, bool attenuated) @@ -905,7 +862,7 @@ void ScrollView::handleMoveLogic(Touch *touch) } Vec3 delta3 = currPt - prevPt; Vec2 delta(delta3.x, delta3.y); - scrollChildren(delta.x, delta.y); + scrollChildren(delta); // Gather touch move information for speed calculation gatherTouchMove(delta); @@ -1159,11 +1116,11 @@ bool ScrollView::isInertiaScrollEnabled() const void ScrollView::setScrollBarEnabled(bool enabled) { - if(_scrollBarEnabled == enabled) - { - return; - } - + if(_scrollBarEnabled == enabled) + { + return; + } + if(_scrollBarEnabled) { removeScrollBar(); diff --git a/cocos/ui/UIScrollView.h b/cocos/ui/UIScrollView.h index d2177c2d63..0fe4c75acb 100644 --- a/cocos/ui/UIScrollView.h +++ b/cocos/ui/UIScrollView.h @@ -569,12 +569,11 @@ protected: virtual Vec2 getHowMuchOutOfBoundary(const Vec2& addition = Vec2::ZERO); bool isOutOfBoundary(MoveDirection dir); bool isOutOfBoundary(); - - void moveChildren(float offsetX, float offsetY); - void moveChildrenToPosition(const Vec2& position); - - bool calculateCurrAndPrevTouchPoints(Touch* touch, Vec3* currPt, Vec3* prevPt); - void gatherTouchMove(const Vec2& delta); + + virtual void moveInnerContainer(const Vec2& deltaMove, bool canStartBounceBack); + + bool calculateCurrAndPrevTouchPoints(Touch* touch, Vec3* currPt, Vec3* prevPt); + void gatherTouchMove(const Vec2& delta); Vec2 calculateTouchMoveVelocity() const; virtual void startAttenuatingAutoScroll(const Vec2& deltaMove, const Vec2& initialVelocity); @@ -589,7 +588,7 @@ protected: void jumpToDestination(const Vec2& des); - virtual bool scrollChildren(float touchOffsetX, float touchOffsetY); + virtual void scrollChildren(const Vec2& deltaMove); virtual void handlePressLogic(Touch *touch); virtual void handleMoveLogic(Touch *touch); diff --git a/cocos/ui/UIScrollViewBar.cpp b/cocos/ui/UIScrollViewBar.cpp index d4682d9451..7d4be10d7a 100644 --- a/cocos/ui/UIScrollViewBar.cpp +++ b/cocos/ui/UIScrollViewBar.cpp @@ -25,7 +25,7 @@ THE SOFTWARE. #include "UIScrollViewBar.h" #include "CCImage.h" #include "2d/CCSprite.h" -#include "base/base64.h" +#include "base/ccUtils.h" NS_CC_BEGIN @@ -39,27 +39,6 @@ static const float DEFAULT_MARGIN = 20; static const float DEFAULT_AUTO_HIDE_TIME = 0.2f; static const float DEFAULT_SCROLLBAR_OPACITY = 0.4f; -static Sprite* createSpriteFromBase64(const char* base64String) -{ - unsigned char* decoded; - int length = base64Decode((const unsigned char*) base64String, (unsigned int) strlen(base64String), &decoded); - - Image *image = new Image(); - bool imageResult = image->initWithImageData(decoded, length); - CCASSERT(imageResult, "Failed to create image from base64!"); - free(decoded); - - Texture2D *texture = new Texture2D(); - texture->initWithImage(image); - texture->setAliasTexParameters(); - image->release(); - - Sprite* sprite = Sprite::createWithTexture(texture); - texture->release(); - - return sprite; -} - ScrollViewBar::ScrollViewBar(ScrollView* parent, ScrollView::Direction direction): _parent(parent), _direction(direction), @@ -103,7 +82,7 @@ bool ScrollViewBar::init() return false; } - _upperHalfCircle = createSpriteFromBase64(HALF_CIRCLE_IMAGE); + _upperHalfCircle = utils::createSpriteFromBase64(HALF_CIRCLE_IMAGE); _upperHalfCircle->setAnchorPoint(Vec2::ANCHOR_MIDDLE_BOTTOM); addProtectedChild(_upperHalfCircle); @@ -112,7 +91,7 @@ bool ScrollViewBar::init() _lowerHalfCircle->setAnchorPoint(Vec2::ANCHOR_MIDDLE_BOTTOM); addProtectedChild(_lowerHalfCircle); - _body = createSpriteFromBase64(BODY_IMAGE_1_PIXEL_HEIGHT); + _body = utils::createSpriteFromBase64(BODY_IMAGE_1_PIXEL_HEIGHT); _body->setAnchorPoint(Vec2::ANCHOR_MIDDLE_BOTTOM); addProtectedChild(_body); diff --git a/cocos/ui/UIScrollViewBar.h b/cocos/ui/UIScrollViewBar.h index 8b466466da..4a40e4cbe0 100644 --- a/cocos/ui/UIScrollViewBar.h +++ b/cocos/ui/UIScrollViewBar.h @@ -59,8 +59,8 @@ public: virtual ~ScrollViewBar(); /** - * Create a ScrollView with its parent ScrollView and direction. - * @return A ScrollViewBar instance. + * Create a scroll bar with its parent scroll view and direction. + * @return A scroll bar instance. */ static ScrollViewBar* create(ScrollView* parent, ScrollView::Direction direction); @@ -157,13 +157,13 @@ private: ScrollView* _parent; ScrollView::Direction _direction; - + Sprite* _upperHalfCircle; Sprite* _lowerHalfCircle; Sprite* _body; GLubyte _opacity; - + float _marginFromBoundary; float _marginForLength; diff --git a/cocos/ui/UISlider.cpp b/cocos/ui/UISlider.cpp index 19a465b8a6..62a291e06e 100644 --- a/cocos/ui/UISlider.cpp +++ b/cocos/ui/UISlider.cpp @@ -27,6 +27,7 @@ THE SOFTWARE. #include "ui/UIHelper.h" #include "2d/CCSprite.h" #include "2d/CCCamera.h" +#include "2d/CocosStudioExtension.h" NS_CC_BEGIN @@ -68,7 +69,12 @@ _ballNTexType(TextureResType::LOCAL), _ballPTexType(TextureResType::LOCAL), _ballDTexType(TextureResType::LOCAL), _barRendererAdaptDirty(true), -_progressBarRendererDirty(true) +_progressBarRendererDirty(true), +_textureFile(""), +_progressBarTextureFile(""), +_slidBallNormalTextureFile(""), +_slidBallPressedTextureFile(""), +_slidBallDisabledTextureFile("") { setTouchEnabled(true); } @@ -147,13 +153,16 @@ void Slider::initRenderer() void Slider::loadBarTexture(const std::string& fileName, TextureResType texType) { + _textureFile = fileName; + _barTexType = texType; if (fileName.empty()) { - return; + _barRenderer->init(); } - _barTexType = texType; - switch (_barTexType) + else { + switch (_barTexType) + { case TextureResType::LOCAL: _barRenderer->initWithFile(fileName); break; @@ -162,6 +171,7 @@ void Slider::loadBarTexture(const std::string& fileName, TextureResType texType) break; default: break; + } } this->setupBarTexture(); } @@ -182,13 +192,16 @@ void Slider::setupBarTexture() void Slider::loadProgressBarTexture(const std::string& fileName, TextureResType texType) { + _progressBarTextureFile = fileName; + _progressBarTexType = texType; if (fileName.empty()) { - return; + _progressBarRenderer->init(); } - _progressBarTexType = texType; - switch (_progressBarTexType) + else { + switch (_progressBarTexType) + { case TextureResType::LOCAL: _progressBarRenderer->initWithFile(fileName); break; @@ -197,6 +210,7 @@ void Slider::loadProgressBarTexture(const std::string& fileName, TextureResType break; default: break; + } } this->setupProgressBarTexture(); } @@ -305,13 +319,16 @@ void Slider::loadSlidBallTextures(const std::string& normal, void Slider::loadSlidBallTextureNormal(const std::string& normal,TextureResType texType) { + _slidBallNormalTextureFile = normal; + _ballNTexType = texType; if (normal.empty()) { - return; + _slidBallNormalRenderer->init(); } - _ballNTexType = texType; - switch (_ballNTexType) + else { + switch (_ballNTexType) + { case TextureResType::LOCAL: _slidBallNormalRenderer->setTexture(normal); break; @@ -320,6 +337,7 @@ void Slider::loadSlidBallTextureNormal(const std::string& normal,TextureResType break; default: break; + } } this->updateChildrenDisplayedRGBA(); } @@ -331,14 +349,17 @@ void Slider::loadSlidBallTextureNormal(SpriteFrame* spriteframe) void Slider::loadSlidBallTexturePressed(const std::string& pressed,TextureResType texType) { + _slidBallPressedTextureFile = pressed; + _isSliderBallPressedTextureLoaded = !pressed.empty(); + _ballPTexType = texType; if (pressed.empty()) { - return; + _slidBallPressedRenderer->init(); } - _ballPTexType = texType; - _isSliderBallPressedTextureLoaded = true; - switch (_ballPTexType) + else { + switch (_ballPTexType) + { case TextureResType::LOCAL: _slidBallPressedRenderer->setTexture(pressed); break; @@ -347,6 +368,7 @@ void Slider::loadSlidBallTexturePressed(const std::string& pressed,TextureResTyp break; default: break; + } } this->updateChildrenDisplayedRGBA(); } @@ -360,14 +382,17 @@ void Slider::loadSlidBallTexturePressed(SpriteFrame* spriteframe) void Slider::loadSlidBallTextureDisabled(const std::string& disabled,TextureResType texType) { + _slidBallDisabledTextureFile = disabled; + _isSliderBallDisabledTexturedLoaded = !disabled.empty(); + _ballDTexType = texType; if (disabled.empty()) { - return; + _slidBallDisabledRenderer->init(); } - _isSliderBallDisabledTexturedLoaded = true; - _ballDTexType = texType; - switch (_ballDTexType) + else { + switch (_ballDTexType) + { case TextureResType::LOCAL: _slidBallDisabledRenderer->setTexture(disabled); break; @@ -376,6 +401,7 @@ void Slider::loadSlidBallTextureDisabled(const std::string& disabled,TextureResT break; default: break; + } } this->updateChildrenDisplayedRGBA(); } @@ -723,6 +749,42 @@ void Slider::copySpecialProperties(Widget *widget) } } +ResouceData Slider::getBackFile() +{ + ResouceData rData; + rData.type = (int)_barTexType; + rData.file = _textureFile; + return rData; +} +ResouceData Slider::getProgressBarFile() +{ + ResouceData rData; + rData.type = (int)_progressBarTexType; + rData.file = _progressBarTextureFile; + return rData; +} +ResouceData Slider::getBallNormalFile() +{ + ResouceData rData; + rData.type = (int)_ballNTexType; + rData.file = _slidBallNormalTextureFile; + return rData; +} +ResouceData Slider::getBallPressedFile() +{ + ResouceData rData; + rData.type = (int)_ballPTexType; + rData.file = _slidBallPressedTextureFile; + return rData; +} +ResouceData Slider::getBallDisabeldFile() +{ + ResouceData rData; + rData.type = (int)_ballDTexType; + rData.file = _slidBallDisabledTextureFile; + return rData; +} + } NS_CC_END diff --git a/cocos/ui/UISlider.h b/cocos/ui/UISlider.h index 8304870210..45fa8a6bd2 100644 --- a/cocos/ui/UISlider.h +++ b/cocos/ui/UISlider.h @@ -36,6 +36,7 @@ NS_CC_BEGIN */ class Sprite; +struct CC_DLL ResouceData; namespace ui { class Scale9Sprite; @@ -264,7 +265,12 @@ public: */ float getZoomScale()const; - + ResouceData getBackFile(); + ResouceData getProgressBarFile(); + ResouceData getBallNormalFile(); + ResouceData getBallPressedFile(); + ResouceData getBallDisabeldFile(); + CC_CONSTRUCTOR_ACCESS: virtual bool init() override; @@ -341,6 +347,12 @@ protected: TextureResType _ballDTexType; bool _barRendererAdaptDirty; bool _progressBarRendererDirty; + + std::string _textureFile; + std::string _progressBarTextureFile; + std::string _slidBallNormalTextureFile; + std::string _slidBallPressedTextureFile; + std::string _slidBallDisabledTextureFile; }; } diff --git a/cocos/ui/UITextAtlas.cpp b/cocos/ui/UITextAtlas.cpp index 64f06f4636..c448791f2e 100644 --- a/cocos/ui/UITextAtlas.cpp +++ b/cocos/ui/UITextAtlas.cpp @@ -24,6 +24,7 @@ THE SOFTWARE. #include "ui/UITextAtlas.h" #include "2d/CCLabel.h" +#include "2d/CocosStudioExtension.h" NS_CC_BEGIN @@ -190,5 +191,13 @@ void TextAtlas::copySpecialProperties(Widget *widget) } } +ResouceData TextAtlas::getRenderFile() +{ + ResouceData rData; + rData.type = 0; + rData.file = _charMapFileName; + return rData; +} + } NS_CC_END diff --git a/cocos/ui/UITextAtlas.h b/cocos/ui/UITextAtlas.h index ca3b3e3a48..f6b7cfafbc 100644 --- a/cocos/ui/UITextAtlas.h +++ b/cocos/ui/UITextAtlas.h @@ -36,6 +36,7 @@ NS_CC_BEGIN */ class Label; +struct CC_DLL ResouceData; namespace ui { @@ -138,6 +139,9 @@ public: * @js NA */ virtual void adaptRenderers() override; + + ResouceData getRenderFile(); + protected: virtual void initRenderer() override; virtual void onSizeChanged() override; diff --git a/cocos/ui/UITextBMFont.cpp b/cocos/ui/UITextBMFont.cpp index 2bc541870d..6ac518cb98 100644 --- a/cocos/ui/UITextBMFont.cpp +++ b/cocos/ui/UITextBMFont.cpp @@ -24,6 +24,7 @@ THE SOFTWARE. #include "ui/UITextBMFont.h" #include "2d/CCLabel.h" +#include "2d/CocosStudioExtension.h" NS_CC_BEGIN @@ -186,6 +187,14 @@ void TextBMFont::copySpecialProperties(Widget *widget) } } +ResouceData TextBMFont::getRenderFile() +{ + ResouceData rData; + rData.type = 0; + rData.file = _fntFileName; + return rData; +} + } NS_CC_END diff --git a/cocos/ui/UITextBMFont.h b/cocos/ui/UITextBMFont.h index 179884cb9d..994935acf5 100644 --- a/cocos/ui/UITextBMFont.h +++ b/cocos/ui/UITextBMFont.h @@ -35,6 +35,7 @@ THE SOFTWARE. NS_CC_BEGIN class Label; +struct CC_DLL ResouceData; namespace ui { @@ -94,6 +95,9 @@ public: * Returns the "class name" of widget. */ virtual std::string getDescription() const override; + + ResouceData getRenderFile(); + protected: virtual void initRenderer() override; virtual void onSizeChanged() override; diff --git a/cocos/ui/UITextField.cpp b/cocos/ui/UITextField.cpp index 89388b2c95..dc13ee6b07 100644 --- a/cocos/ui/UITextField.cpp +++ b/cocos/ui/UITextField.cpp @@ -536,6 +536,11 @@ bool TextField::onTouchBegan(Touch *touch, Event *unusedEvent) bool pass = Widget::onTouchBegan(touch, unusedEvent); if (_hitted) { + if (isFocusEnabled()) + { + requestFocus(); + } + _textFieldRenderer->attachWithIME(); } else diff --git a/cocos/ui/UIWidget.cpp b/cocos/ui/UIWidget.cpp index 3a1accbad6..e1b439d5b3 100644 --- a/cocos/ui/UIWidget.cpp +++ b/cocos/ui/UIWidget.cpp @@ -303,7 +303,7 @@ void Widget::setContentSize(const cocos2d::Size &contentSize) } else if (_ignoreSize) { - _contentSize = getVirtualRendererSize(); + ProtectedNode::setContentSize(getVirtualRendererSize()); } if (!_usingLayoutComponent && _running) { @@ -609,6 +609,11 @@ bool Widget::isHighlighted() const void Widget::setHighlighted(bool highlight) { + if (highlight == _highlight) + { + return; + } + _highlight = highlight; if (_bright) { @@ -888,6 +893,12 @@ void Widget::moveEvent() void Widget::releaseUpEvent() { this->retain(); + + if (isFocusEnabled()) + { + requestFocus(); + } + if (_touchEventCallback) { _touchEventCallback(this, TouchEventType::ENDED); @@ -1449,7 +1460,7 @@ void Widget::onFocusChange(Widget* widgetLostFocus, Widget* widgetGetFocus) } } -Widget* Widget::getCurrentFocusedWidget()const +Widget* Widget::getCurrentFocusedWidget() { return _focusedWidget; } diff --git a/cocos/ui/UIWidget.h b/cocos/ui/UIWidget.h index 8ba4236d7e..964dce5f2e 100644 --- a/cocos/ui/UIWidget.h +++ b/cocos/ui/UIWidget.h @@ -775,7 +775,7 @@ public: * Return a current focused widget in your UI scene. * No matter what widget object you call this method on , it will return you the exact one focused widget. */ - Widget* getCurrentFocusedWidget()const; + static Widget* getCurrentFocusedWidget(); /* * Call this method with parameter true to enable the Android Dpad focus navigation feature diff --git a/cocos/ui/proj.win32/libui.vcxproj b/cocos/ui/proj.win32/libui.vcxproj index 0cb39b29cf..7401576f2e 100644 --- a/cocos/ui/proj.win32/libui.vcxproj +++ b/cocos/ui/proj.win32/libui.vcxproj @@ -62,6 +62,7 @@ + diff --git a/cocos/ui/proj.win32/libui.vcxproj.filters b/cocos/ui/proj.win32/libui.vcxproj.filters index 000ab33b24..81014a0d00 100644 --- a/cocos/ui/proj.win32/libui.vcxproj.filters +++ b/cocos/ui/proj.win32/libui.vcxproj.filters @@ -131,6 +131,9 @@ UIWidgets\ScrollWidget + + UIWidgets\ScrollWidget + UIWidgets diff --git a/extensions/ExtensionExport.h b/extensions/ExtensionExport.h index 837df61c54..75380032e3 100644 --- a/extensions/ExtensionExport.h +++ b/extensions/ExtensionExport.h @@ -24,6 +24,8 @@ #define NULL ((void *)0) #endif #endif +#elif defined(_SHARED_) + #define CC_EX_DLL __attribute__((visibility("default"))) #else #define CC_EX_DLL #endif diff --git a/extensions/Particle3D/PU/CCPUMaterialManager.h b/extensions/Particle3D/PU/CCPUMaterialManager.h index fb48645e77..ea039d99f2 100644 --- a/extensions/Particle3D/PU/CCPUMaterialManager.h +++ b/extensions/Particle3D/PU/CCPUMaterialManager.h @@ -31,7 +31,7 @@ NS_CC_BEGIN -class PUMaterial : public Ref +class CC_DLL PUMaterial : public Ref { public: @@ -54,7 +54,7 @@ public: GLuint wrapMode; }; -class PUMaterialCache +class CC_DLL PUMaterialCache { public: diff --git a/extensions/Particle3D/PU/CCPUParticleSystem3D.cpp b/extensions/Particle3D/PU/CCPUParticleSystem3D.cpp index 978a2eedc5..13542a0609 100755 --- a/extensions/Particle3D/PU/CCPUParticleSystem3D.cpp +++ b/extensions/Particle3D/PU/CCPUParticleSystem3D.cpp @@ -448,6 +448,11 @@ void PUParticleSystem3D::forceUpdate( float delta ) prepared(); + Vec3 currentPos = getDerivedPosition(); + _latestPositionDiff = currentPos - _latestPosition; + _latestPosition = currentPos; + _latestOrientation = getDerivedOrientation(); + if (!_emitters.empty()){ emitParticles(delta); preUpdator(delta); @@ -455,10 +460,6 @@ void PUParticleSystem3D::forceUpdate( float delta ) postUpdator(delta); } - Vec3 currentPos = getDerivedPosition(); - _latestPositionDiff = currentPos - _latestPosition; - _latestPosition = currentPos; - _latestOrientation = getDerivedOrientation(); _timeElapsedSinceStart += delta; } diff --git a/extensions/Particle3D/PU/CCPUParticleSystem3D.h b/extensions/Particle3D/PU/CCPUParticleSystem3D.h index 470124134d..e6f46423e4 100644 --- a/extensions/Particle3D/PU/CCPUParticleSystem3D.h +++ b/extensions/Particle3D/PU/CCPUParticleSystem3D.h @@ -353,6 +353,8 @@ public: virtual PUParticleSystem3D* clone(); virtual void copyAttributesTo(PUParticleSystem3D* system); + bool initSystem(const std::string &filePath); + CC_CONSTRUCTOR_ACCESS: PUParticleSystem3D(); virtual ~PUParticleSystem3D(); @@ -379,7 +381,6 @@ protected: inline bool isExpired(PUParticle3D* particle, float timeElapsed); - bool initSystem(const std::string &filePath); static void convertToUnixStylePath(std::string &path); protected: diff --git a/extensions/Particle3D/PU/CCPUScriptCompiler.h b/extensions/Particle3D/PU/CCPUScriptCompiler.h index a2a730eca8..7523c3e163 100644 --- a/extensions/Particle3D/PU/CCPUScriptCompiler.h +++ b/extensions/Particle3D/PU/CCPUScriptCompiler.h @@ -41,10 +41,10 @@ enum PUAbstractNodeType ANT_VARIABLE_SET, ANT_VARIABLE_ACCESS }; -class PUAbstractNode; +class CC_DLL PUAbstractNode; typedef std::list PUAbstractNodeList; -class PUAbstractNode +class CC_DLL PUAbstractNode { public: std::string file; @@ -97,7 +97,7 @@ public: }; /** This abstract node represents a script property */ -class PUPropertyAbstractNode : public PUAbstractNode +class CC_DLL PUPropertyAbstractNode : public PUAbstractNode { public: std::string name; @@ -111,7 +111,7 @@ public: }; /** This is an abstract node which cannot be broken down further */ -class PUAtomAbstractNode : public PUAbstractNode +class CC_DLL PUAtomAbstractNode : public PUAbstractNode { public: std::string value; @@ -124,8 +124,8 @@ private: void parseNumber() const; }; -class PUParticleSystem3D; -class PUScriptCompiler +class CC_DLL PUParticleSystem3D; +class CC_DLL PUScriptCompiler { private: diff --git a/extensions/physics-nodes/CCPhysicsSprite.cpp b/extensions/physics-nodes/CCPhysicsSprite.cpp index 86080ad7aa..aaacbfa89b 100644 --- a/extensions/physics-nodes/CCPhysicsSprite.cpp +++ b/extensions/physics-nodes/CCPhysicsSprite.cpp @@ -195,6 +195,12 @@ float PhysicsSprite::getPositionY() const return getPosFromPhysics().y; } +Vec3 PhysicsSprite::getPosition3D() const +{ + Vec2 pos = getPosFromPhysics(); + return Vec3(pos.x, pos.y, 0); +} + // // Chipmunk only // @@ -280,19 +286,38 @@ const Vec2& PhysicsSprite::getPosFromPhysics() const return s_physicPosion; } -void PhysicsSprite::setPosition(const Vec2 &pos) +void PhysicsSprite::setPosition(float x, float y) { #if CC_ENABLE_CHIPMUNK_INTEGRATION - - cpVect cpPos = cpv(pos.x, pos.y); + + cpVect cpPos = cpv(x, y); cpBodySetPos(_CPBody, cpPos); - + #elif CC_ENABLE_BOX2D_INTEGRATION - + float angle = _pB2Body->GetAngle(); - _pB2Body->SetTransform(b2Vec2(pos.x / _PTMRatio, pos.y / _PTMRatio), angle); + _pB2Body->SetTransform(b2Vec2(x / _PTMRatio, y / _PTMRatio), angle); #endif +} +void PhysicsSprite::setPosition(const Vec2 &pos) +{ + setPosition(pos.x, pos.y); +} + +void PhysicsSprite::setPositionX(float x) +{ + setPosition(x, getPositionY()); +} + +void PhysicsSprite::setPositionY(float y) +{ + setPosition(getPositionX(), y); +} + +void PhysicsSprite::setPosition3D(const Vec3& position) +{ + setPosition(position.x, position.y); } float PhysicsSprite::getRotation() const diff --git a/extensions/physics-nodes/CCPhysicsSprite.h b/extensions/physics-nodes/CCPhysicsSprite.h index ae17b824a0..b8016f2681 100644 --- a/extensions/physics-nodes/CCPhysicsSprite.h +++ b/extensions/physics-nodes/CCPhysicsSprite.h @@ -116,7 +116,12 @@ public: virtual void getPosition(float* x, float* y) const override; virtual float getPositionX() const override; virtual float getPositionY() const override; + virtual Vec3 getPosition3D() const override; virtual void setPosition(const Vec2 &position) override; + virtual void setPosition(float x, float y) override; + virtual void setPositionX(float x) override; + virtual void setPositionY(float y) override; + virtual void setPosition3D(const Vec3& position) override; virtual float getRotation() const override; virtual void setRotation(float fRotation) override; diff --git a/templates/cocos2dx_files.json b/templates/cocos2dx_files.json index 17ccf1a17e..4a42163666 100644 --- a/templates/cocos2dx_files.json +++ b/templates/cocos2dx_files.json @@ -187,6 +187,7 @@ "cocos/2d/CCTweenFunction.cpp", "cocos/2d/CCTweenFunction.h", "cocos/2d/CMakeLists.txt", + "cocos/2d/CocosStudioExtension.h", "cocos/2d/cocos2d.def", "cocos/2d/cocos2d_headers.props", "cocos/2d/cocos2dx.props", @@ -401,6 +402,8 @@ "cocos/base/CCScheduler.h", "cocos/base/CCScriptSupport.cpp", "cocos/base/CCScriptSupport.h", + "cocos/base/CCStencilStateManager.cpp", + "cocos/base/CCStencilStateManager.hpp", "cocos/base/CCTouch.cpp", "cocos/base/CCTouch.h", "cocos/base/CCUserDefault-android.cpp", @@ -962,6 +965,7 @@ "cocos/platform/android/java/src/org/cocos2dx/lib/GameControllerAdapter.java", "cocos/platform/android/java/src/org/cocos2dx/lib/GameControllerDelegate.java", "cocos/platform/android/java/src/org/cocos2dx/lib/GameControllerUtils.java", + "cocos/platform/android/java/src/org/cocos2dx/lib/ResizeLayout.java", "cocos/platform/android/javaactivity-android.cpp", "cocos/platform/android/jni/CocosPlayClient.cpp", "cocos/platform/android/jni/CocosPlayClient.h", @@ -1255,6 +1259,8 @@ "cocos/ui/UILoadingBar.h", "cocos/ui/UIPageView.cpp", "cocos/ui/UIPageView.h", + "cocos/ui/UIPageViewIndicator.cpp", + "cocos/ui/UIPageViewIndicator.h", "cocos/ui/UIRadioButton.cpp", "cocos/ui/UIRadioButton.h", "cocos/ui/UIRelativeBox.cpp", @@ -6750,6 +6756,7 @@ "cocos/scripting/lua-bindings/auto/api/RichElement.lua", "cocos/scripting/lua-bindings/auto/api/RichElementCustomNode.lua", "cocos/scripting/lua-bindings/auto/api/RichElementImage.lua", + "cocos/scripting/lua-bindings/auto/api/RichElementNewLine.lua", "cocos/scripting/lua-bindings/auto/api/RichElementText.lua", "cocos/scripting/lua-bindings/auto/api/RichText.lua", "cocos/scripting/lua-bindings/auto/api/Ripple3D.lua", diff --git a/tests/cpp-tests/Classes/BugsTest/Bug-14327.cpp b/tests/cpp-tests/Classes/BugsTest/Bug-14327.cpp new file mode 100644 index 0000000000..1d0c2fc548 --- /dev/null +++ b/tests/cpp-tests/Classes/BugsTest/Bug-14327.cpp @@ -0,0 +1,91 @@ +// +// Bug-14327.cpp +// cocos2d_tests +// +// Issue: https://github.com/cocos2d/cocos2d-x/pull/14327 +// Please test in Windows +// +// + +#include "Bug-14327.h" + +#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) + +USING_NS_CC; + +bool Bug14327Layer::init() +{ + if (BugsTestBase::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); + + _removeTime = time(nullptr) + 20; + + _TTFShowTime = Label::createWithSystemFont("Edit control will be removed after 00:20!", "Arial", 20); + _TTFShowTime->setPosition(Vec2(visibleOrigin.x + visibleSize.width / 2, visibleOrigin.y + visibleSize.height - 60)); + this->addChild(_TTFShowTime); + + + auto editBoxSize = Size(visibleSize.width - 100, visibleSize.height * 0.1); + + std::string pNormalSprite = "extensions/green_edit.png"; + _edit = ui::EditBox::create(editBoxSize + Size(0, 20), ui::Scale9Sprite::create(pNormalSprite)); + _edit->setPosition(Vec2(visibleOrigin.x + visibleSize.width / 2, visibleOrigin.y + visibleSize.height / 2)); + _edit->setFontColor(Color3B::RED); + _edit->setReturnType(ui::EditBox::KeyboardReturnType::DONE); + _edit->setDelegate(this); + this->addChild(_edit); + + this->scheduleUpdate(); + return true; + } + + return false; +} + +void Bug14327Layer::update(float dt) +{ + long delta = _removeTime - time(nullptr); + if (delta > 0) + { + ldiv_t ret = ldiv(delta, 60L); + char str[100]; + snprintf(str, 100, "%s%.2ld:%.2ld", "Edit control will be removed after ", ret.quot, ret.rem); + _TTFShowTime->setString(str); + } + else + { + _edit->removeFromParent(); + _edit = nullptr; + _TTFShowTime->setString("Edit control has been removed!\nIt should not crash."); + this->unscheduleUpdate(); + } +} + +void Bug14327Layer::editBoxEditingDidBegin(cocos2d::ui::EditBox* editBox) +{ + log("editBox %p DidBegin !", editBox); +} + +void Bug14327Layer::editBoxEditingDidEnd(cocos2d::ui::EditBox* editBox) +{ + log("editBox %p DidEnd !", editBox); +} + +void Bug14327Layer::editBoxTextChanged(cocos2d::ui::EditBox* editBox, const std::string& text) +{ + log("editBox %p TextChanged, text: %s ", editBox, text.c_str()); +} + +void Bug14327Layer::editBoxReturn(ui::EditBox* editBox) +{ + log("editBox %p was returned !", editBox); +} + +#endif diff --git a/tests/cpp-tests/Classes/BugsTest/Bug-14327.h b/tests/cpp-tests/Classes/BugsTest/Bug-14327.h new file mode 100644 index 0000000000..2191b2b6f7 --- /dev/null +++ b/tests/cpp-tests/Classes/BugsTest/Bug-14327.h @@ -0,0 +1,31 @@ +#ifndef __cocos2d_tests__Bug_14327__ +#define __cocos2d_tests__Bug_14327__ + +#include "BugsTest.h" + +#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) + +class Bug14327Layer : public BugsTestBase, public cocos2d::ui::EditBoxDelegate +{ +public: + CREATE_FUNC(Bug14327Layer); + + virtual bool init() override; + + virtual void editBoxEditingDidBegin(cocos2d::ui::EditBox* editBox) override; + virtual void editBoxEditingDidEnd(cocos2d::ui::EditBox* editBox) override; + virtual void editBoxTextChanged(cocos2d::ui::EditBox* editBox, const std::string& text) override; + virtual void editBoxReturn(cocos2d::ui::EditBox* editBox) override; + +protected: + virtual void update(float dt) override; + +private: + time_t _removeTime; + cocos2d::Label *_TTFShowTime; + cocos2d::ui::EditBox* _edit; +}; + +#endif + +#endif /* defined(__cocos2d_tests__Bug_14327__) */ diff --git a/tests/cpp-tests/Classes/BugsTest/BugsTest.cpp b/tests/cpp-tests/Classes/BugsTest/BugsTest.cpp index 55b6a4fe10..5ea0363d20 100644 --- a/tests/cpp-tests/Classes/BugsTest/BugsTest.cpp +++ b/tests/cpp-tests/Classes/BugsTest/BugsTest.cpp @@ -13,6 +13,10 @@ #include "Bug-CCDrawNode.h" #include "Bug-PageViewLayout.h" +#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) +#include "Bug-14327.h" +#endif + BugsTests::BugsTests() { ADD_TEST_CASE(Bug350Layer); @@ -29,4 +33,8 @@ BugsTests::BugsTests() ADD_TEST_CASE(BugDrawNodeLayer); ADD_TEST_CASE(BugPageViewLayer); ADD_TEST_CASE(Bug12847Layer); + +#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) + ADD_TEST_CASE(Bug14327Layer); +#endif } diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIEditBoxTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIEditBoxTest.cpp index c6dd7d9a31..81819a5e11 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIEditBoxTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIEditBoxTest.cpp @@ -100,17 +100,25 @@ bool UIEditBoxTest::init() addChild(buttonPassword); // bottom + // Add an intermediate Node to test scaling and content size relative to world + _editEmailParent = Node::create(); + _editEmailParent->setScale(0.5); + _editEmailParent->setPosition(Vec2(visibleOrigin.x+visibleSize.width/2-50, visibleOrigin.y+visibleSize.height/4)); + addChild(_editEmailParent); + auto bottomButtonSize = Size(editBoxSize.width, editBoxSize.height + 10); _editEmail = ui::EditBox::create(bottomButtonSize, "extensions/yellow_edit.png"); - _editEmail->setPosition(Vec2(visibleOrigin.x+visibleSize.width/2-50, visibleOrigin.y+visibleSize.height/4)); _editEmail->setPlaceHolder("Email:"); _editEmail->setInputMode(ui::EditBox::InputMode::EMAIL_ADDRESS); _editEmail->setDelegate(this); - addChild(_editEmail); + _editEmailParent->addChild(_editEmail); + //It is required to use setFontSize and setContentSize after adding it to the hierarchy, so that native EditBox get the right size + _editEmail->setFontSize(30); + _editEmail->setContentSize(bottomButtonSize); auto buttonEmail = (ui::Button*)button->clone(); buttonEmail->setTitleText("Multiline"); - buttonEmail->setPosition(_editEmail->getPosition() + Vec2(editBoxSize.width/2 + buttonSize.width/2, 0 )); + buttonEmail->setPosition(_editEmailParent->getPosition() + Vec2(editBoxSize.width/2 + buttonSize.width/2, 0 )); buttonEmail->addClickEventListener([=](Ref* ref){ _editEmail->setInputMode(ui::EditBox::InputMode::ANY); }); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIEditBoxTest.h b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIEditBoxTest.h index c4680c30c6..1a07feed1c 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIEditBoxTest.h +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIEditBoxTest.h @@ -47,6 +47,7 @@ protected: cocos2d::ui::EditBox* _editName; cocos2d::ui::EditBox* _editPassword; cocos2d::ui::EditBox* _editEmail; + cocos2d::Node* _editEmailParent; }; #endif /* defined(__cocos2d_tests__UIEditBoxTest__) */ diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIListViewTest/UIListViewTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIListViewTest/UIListViewTest.cpp index b9e4655aed..7628a20ccf 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIListViewTest/UIListViewTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIListViewTest/UIListViewTest.cpp @@ -123,6 +123,16 @@ bool UIListViewTest_Vertical::init() custom_item->addChild(custom_button); listView->addChild(custom_item); + + auto clippingNode = ClippingNode::create(); + auto sprite = Sprite::create("cocosui/clippingHead.jpg"); + clippingNode->addChild(sprite); + auto stencil = Sprite::create("cocosui/clippingStencil.jpg"); + clippingNode->setStencil(stencil); + auto custom_item_contentSize = custom_item->getContentSize(); + clippingNode->setPosition(custom_item_contentSize.width/2, custom_item_contentSize.height/2); + clippingNode->setScale(0.5); + custom_item->addChild(clippingNode); } // insert custom item Vector& items = listView->getItems(); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp index 74bb50eb1f..20040dfdb2 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp @@ -8,7 +8,6 @@ UIPageViewTests::UIPageViewTests() { ADD_TEST_CASE(UIPageViewTest); ADD_TEST_CASE(UIPageViewButtonTest); - ADD_TEST_CASE(UIPageViewCustomScrollThreshold); ADD_TEST_CASE(UIPageViewTouchPropagationTest); ADD_TEST_CASE(UIPageViewDynamicAddAndRemoveTest); ADD_TEST_CASE(UIPageViewJumpToPageTest); @@ -52,25 +51,24 @@ bool UIPageViewTest::init() Layout* background = dynamic_cast(root->getChildByName("background_Panel")); // Create the page view + Size size(240, 130); PageView* pageView = PageView::create(); - pageView->setContentSize(Size(240.0f, 130.0f)); + pageView->setDirection(PageView::Direction::HORIZONTAL); + pageView->setContentSize(size); Size backgroundSize = background->getContentSize(); - pageView->setPosition(Vec2((widgetSize.width - backgroundSize.width) / 2.0f + - (backgroundSize.width - pageView->getContentSize().width) / 2.0f, - (widgetSize.height - backgroundSize.height) / 2.0f + - (backgroundSize.height - pageView->getContentSize().height) / 2.0f)); - - pageView->removeAllPages(); + pageView->setPosition((widgetSize - pageView->getContentSize()) / 2.0f); + pageView->removeAllItems(); + pageView->setIndicatorEnabled(true); int pageCount = 4; for (int i = 0; i < pageCount; ++i) { Layout* layout = Layout::create(); - layout->setContentSize(Size(240.0f, 130.0f)); + layout->setContentSize(size); ImageView* imageView = ImageView::create("cocosui/scrollviewbg.png"); imageView->setScale9Enabled(true); - imageView->setContentSize(Size(240, 130)); + imageView->setContentSize(size); imageView->setPosition(Vec2(layout->getContentSize().width / 2.0f, layout->getContentSize().height / 2.0f)); layout->addChild(imageView); @@ -79,12 +77,11 @@ bool UIPageViewTest::init() label->setPosition(Vec2(layout->getContentSize().width / 2.0f, layout->getContentSize().height / 2.0f)); layout->addChild(label); - pageView->insertPage(layout,i); + pageView->insertCustomItem(layout, i); } - pageView->removePageAtIndex(0); - pageView->scrollToPage(pageCount-2); - + pageView->removeItem(0); + pageView->scrollToItem(pageCount - 2); pageView->addEventListener(CC_CALLBACK_2(UIPageViewTest::pageViewEvent, this)); _uiLayer->addChild(pageView); @@ -102,7 +99,7 @@ void UIPageViewTest::pageViewEvent(Ref *pSender, PageView::EventType type) { PageView* pageView = dynamic_cast(pSender); - _displayValueLabel->setString(StringUtils::format("page = %ld", pageView->getCurPageIndex() + 1)); + _displayValueLabel->setString(StringUtils::format("page = %ld", pageView->getCurrentPageIndex() + 1)); } break; @@ -129,7 +126,7 @@ bool UIPageViewButtonTest::init() { Size widgetSize = _widget->getContentSize(); - // Add a label in which the dragpanel events will be displayed + // Add a label in which the drag panel events will be displayed _displayValueLabel = Text::create("Move by horizontal direction", "fonts/Marker Felt.ttf", 32); _displayValueLabel->setAnchorPoint(Vec2(0.5f, -1.0f)); _displayValueLabel->setPosition(Vec2(widgetSize.width / 2.0f, @@ -156,7 +153,7 @@ bool UIPageViewButtonTest::init() (widgetSize.height - backgroundSize.height) / 2.0f + (backgroundSize.height - pageView->getContentSize().height) / 2.0f)); - pageView->removeAllPages(); + pageView->removeAllItems(); int pageCount = 4; for (int i = 0; i < pageCount; ++i) @@ -184,10 +181,10 @@ bool UIPageViewButtonTest::init() } - pageView->insertPage(outerBox,i); + pageView->insertCustomItem(outerBox, i); } - pageView->removePageAtIndex(0); + pageView->removeItem(0); pageView->addEventListener(CC_CALLBACK_2(UIPageViewButtonTest::pageViewEvent, this)); @@ -212,7 +209,7 @@ void UIPageViewButtonTest::pageViewEvent(Ref *pSender, PageView::EventType type) { PageView* pageView = dynamic_cast(pSender); - _displayValueLabel->setString(StringUtils::format("page = %ld", pageView->getCurPageIndex() + 1)); + _displayValueLabel->setString(StringUtils::format("page = %ld", pageView->getCurrentPageIndex() + 1)); } break; @@ -222,105 +219,6 @@ void UIPageViewButtonTest::pageViewEvent(Ref *pSender, PageView::EventType type) } -// UIPageViewCustomScrollThreshold -UIPageViewCustomScrollThreshold::UIPageViewCustomScrollThreshold() -: _displayValueLabel(nullptr) -{ - -} - -UIPageViewCustomScrollThreshold::~UIPageViewCustomScrollThreshold() -{ -} - -bool UIPageViewCustomScrollThreshold::init() -{ - if (UIScene::init()) - { - Size widgetSize = _widget->getContentSize(); - - // Add a label in which the dragpanel events will be displayed - _displayValueLabel = Text::create("Scroll Threshold", "fonts/Marker Felt.ttf", 32); - _displayValueLabel->setAnchorPoint(Vec2(0.5f, -1.0f)); - _displayValueLabel->setPosition(Vec2(widgetSize.width / 2.0f, - widgetSize.height / 2.0f + - _displayValueLabel->getContentSize().height * 1.5)); - _uiLayer->addChild(_displayValueLabel); - - // Add the black background - Text* alert = Text::create("PageView", "fonts/Marker Felt.ttf", 30); - alert->setColor(Color3B(159, 168, 176)); - alert->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f - alert->getContentSize().height * 3.075f)); - _uiLayer->addChild(alert); - - Layout* root = static_cast(_uiLayer->getChildByTag(81)); - - Layout* background = dynamic_cast(root->getChildByName("background_Panel")); - - // Create the page view - PageView* pageView = PageView::create(); - pageView->setContentSize(Size(240.0f, 100.0f)); - Size backgroundSize = background->getContentSize(); - pageView->setPosition(Vec2((widgetSize.width - backgroundSize.width) / 2.0f + - (backgroundSize.width - pageView->getContentSize().width) / 2.0f, - (widgetSize.height - backgroundSize.height) / 2.0f + - (backgroundSize.height - pageView->getContentSize().height) / 2.0f + 20)); - - int pageCount = 4; - for (int i = 0; i < pageCount; ++i) - { - Layout* layout = Layout::create(); - layout->setContentSize(Size(240.0f, 130.0f)); - - ImageView* imageView = ImageView::create("cocosui/scrollviewbg.png"); - imageView->setScale9Enabled(true); - imageView->setContentSize(Size(240, 130)); - imageView->setPosition(Vec2(layout->getContentSize().width / 2.0f, layout->getContentSize().height / 2.0f)); - layout->addChild(imageView); - - Text* label = Text::create(StringUtils::format("page %d",(i+1)), "fonts/Marker Felt.ttf", 30); - label->setColor(Color3B(192, 192, 192)); - label->setPosition(Vec2(layout->getContentSize().width / 2.0f, layout->getContentSize().height / 2.0f)); - layout->addChild(label); - - pageView->insertPage(layout,i); - } - - _uiLayer->addChild(pageView); - pageView->setName("pageView"); - - Slider* slider = Slider::create(); - slider->loadBarTexture("cocosui/sliderTrack.png"); - slider->loadSlidBallTextures("cocosui/sliderThumb.png", "cocosui/sliderThumb.png", ""); - slider->loadProgressBarTexture("cocosui/sliderProgress.png"); - slider->setPosition(Vec2(widgetSize.width / 2.0f , widgetSize.height / 2.0f - 40)); - slider->addEventListener(CC_CALLBACK_2(UIPageViewCustomScrollThreshold::sliderEvent, this)); - slider->setPercent(50); - _uiLayer->addChild(slider); - - - return true; - } - return false; -} - - -void UIPageViewCustomScrollThreshold::sliderEvent(Ref *pSender, Slider::EventType type) -{ - if (type == Slider::EventType::ON_PERCENTAGE_CHANGED) - { - Slider* slider = dynamic_cast(pSender); - int percent = slider->getPercent(); - PageView* pageView = (PageView*)_uiLayer->getChildByName("pageView"); - if (percent == 0) { - percent = 1; - } - pageView->setCustomScrollThreshold(percent * 0.01 * pageView->getContentSize().width); - - _displayValueLabel->setString(StringUtils::format("Scroll Threshold: %f", pageView->getCustomScrollThreshold())); - } -} - // UIPageViewTouchPropagationTest UIPageViewTouchPropagationTest::UIPageViewTouchPropagationTest() : _displayValueLabel(nullptr) @@ -391,7 +289,7 @@ bool UIPageViewTouchPropagationTest::init() } - pageView->insertPage(outerBox,i); + pageView->insertCustomItem(outerBox, i); } pageView->addEventListener(CC_CALLBACK_2(UIPageViewTouchPropagationTest::pageViewEvent, this)); @@ -508,7 +406,7 @@ void UIPageViewTouchPropagationTest::pageViewEvent(Ref *pSender, PageView::Event { PageView* pageView = dynamic_cast(pSender); - _displayValueLabel->setString(StringUtils::format("page = %ld", pageView->getCurPageIndex() + 1)); + _displayValueLabel->setString(StringUtils::format("page = %ld", pageView->getCurrentPageIndex() + 1)); } break; @@ -554,13 +452,16 @@ bool UIPageViewDynamicAddAndRemoveTest::init() // Create the page view PageView* pageView = PageView::create(); + pageView->setDirection(ui::PageView::Direction::VERTICAL); pageView->setContentSize(Size(240.0f, 130.0f)); pageView->setAnchorPoint(Vec2(0.5,0.5)); Size backgroundSize = background->getContentSize(); pageView->setPosition(Vec2(widgetSize.width / 2.0f ,widgetSize.height / 2.0f)); pageView->setBackGroundColor(Color3B::GREEN); pageView->setBackGroundColorType(Layout::BackGroundColorType::SOLID); - + pageView->setIndicatorEnabled(true); + pageView->setIndicatorSpaceBetweenIndexNodes(10); + int pageCount = 4; for (int i = 0; i < pageCount; ++i) { @@ -588,7 +489,7 @@ bool UIPageViewDynamicAddAndRemoveTest::init() } - pageView->insertPage(outerBox,i); + pageView->insertCustomItem(outerBox, i); } pageView->addEventListener(CC_CALLBACK_2(UIPageViewDynamicAddAndRemoveTest::pageViewEvent, this)); @@ -624,9 +525,9 @@ bool UIPageViewDynamicAddAndRemoveTest::init() outerBox->addChild(innerBox); } - pageView->addPage(outerBox); - _displayValueLabel->setString(StringUtils::format("page count = %ld", pageView->getPages().size())); - CCLOG("current page index = %zd", pageView->getCurPageIndex()); + pageView->pushBackCustomItem(outerBox); + _displayValueLabel->setString(StringUtils::format("page count = %ld", pageView->getItems().size())); + CCLOG("current page index = %zd", pageView->getCurrentPageIndex()); }); _uiLayer->addChild(button); @@ -638,16 +539,16 @@ bool UIPageViewDynamicAddAndRemoveTest::init() button2->setTitleColor(Color3B::RED); button2->addClickEventListener([=](Ref* sender) { - if (pageView->getPages().size() > 0) + if (pageView->getItems().size() > 0) { - pageView->removePageAtIndex(pageView->getPages().size()-1); + pageView->removeItem(pageView->getItems().size()-1); } else { CCLOG("There is no page to remove!"); } - _displayValueLabel->setString(StringUtils::format("page count = %ld", pageView->getPages().size())); - CCLOG("current page index = %zd", pageView->getCurPageIndex()); + _displayValueLabel->setString(StringUtils::format("page count = %ld", pageView->getItems().size())); + CCLOG("current page index = %zd", pageView->getCurrentPageIndex()); }); _uiLayer->addChild(button2); @@ -660,9 +561,9 @@ bool UIPageViewDynamicAddAndRemoveTest::init() button3->setTitleColor(Color3B::RED); button3->addClickEventListener([=](Ref* sender) { - pageView->removeAllPages(); - _displayValueLabel->setString(StringUtils::format("page count = %ld", pageView->getPages().size())); - CCLOG("current page index = %zd", pageView->getCurPageIndex()); + pageView->removeAllItems(); + _displayValueLabel->setString(StringUtils::format("page count = %ld", pageView->getItems().size())); + CCLOG("current page index = %zd", pageView->getCurrentPageIndex()); }); _uiLayer->addChild(button3); @@ -671,8 +572,8 @@ bool UIPageViewDynamicAddAndRemoveTest::init() button4->setTitleText("Scroll to Page4"); button4->setNormalizedPosition(Vec2(0.85,0.5)); button4->addClickEventListener([=](Ref* sender){ - pageView->scrollToPage(3); - CCLOG("current page index = %zd", pageView->getCurPageIndex()); + pageView->scrollToItem(3); + CCLOG("current page index = %zd", pageView->getCurrentPageIndex()); }); _uiLayer->addChild(button4); @@ -690,7 +591,7 @@ void UIPageViewDynamicAddAndRemoveTest::pageViewEvent(Ref *pSender, PageView::Ev { PageView* pageView = dynamic_cast(pSender); - _displayValueLabel->setString(StringUtils::format("page = %ld", pageView->getCurPageIndex() + 1)); + _displayValueLabel->setString(StringUtils::format("page = %ld", pageView->getCurrentPageIndex() + 1)); } break; @@ -718,7 +619,7 @@ bool UIPageViewJumpToPageTest::init() Size widgetSize = _widget->getContentSize(); // Add a label in which the dragpanel events will be displayed - _displayValueLabel = Text::create("setCurPageIndex API Test", "fonts/Marker Felt.ttf", 32); + _displayValueLabel = Text::create("setCurrentPageIndex API Test", "fonts/Marker Felt.ttf", 32); _displayValueLabel->setAnchorPoint(Vec2(0.5f, -1.0f)); _displayValueLabel->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f + @@ -743,8 +644,8 @@ bool UIPageViewJumpToPageTest::init() (backgroundSize.width - pageView->getContentSize().width) / 2.0f, (widgetSize.height - backgroundSize.height) / 2.0f + (backgroundSize.height - pageView->getContentSize().height) / 2.0f)); - - pageView->removeAllPages(); + pageView->setIndicatorEnabled(true); + pageView->removeAllItems(); int pageCount = 4; for (int i = 0; i < pageCount; ++i) @@ -763,10 +664,10 @@ bool UIPageViewJumpToPageTest::init() label->setPosition(Vec2(layout->getContentSize().width / 2.0f, layout->getContentSize().height / 2.0f)); layout->addChild(label); - pageView->insertPage(layout,i); + pageView->insertCustomItem(layout, i); } - pageView->setCurPageIndex(1); + pageView->setCurrentPageIndex(1); //add buttons to jump to specific page auto button1 = ui::Button::create(); @@ -775,7 +676,7 @@ bool UIPageViewJumpToPageTest::init() CCLOG("button1 content Size = %f, %f", button1->getContentSize().width, button1->getContentSize().height); button1->addClickEventListener([=](Ref*){ - pageView->setCurPageIndex(0); + pageView->setCurrentPageIndex(0); }); _uiLayer->addChild(button1); @@ -785,7 +686,7 @@ bool UIPageViewJumpToPageTest::init() CCLOG("button2 content Size = %f, %f", button2->getContentSize().width, button2->getContentSize().height); button2->addClickEventListener([=](Ref*){ - pageView->setCurPageIndex(1); + pageView->setCurrentPageIndex(1); }); _uiLayer->addChild(button2); @@ -793,7 +694,7 @@ bool UIPageViewJumpToPageTest::init() button3->setTitleText("Jump to Page3"); button3->setNormalizedPosition(Vec2(0.9, 0.75)); button3->addClickEventListener([=](Ref*){ - pageView->setCurPageIndex(2); + pageView->setCurrentPageIndex(2); }); _uiLayer->addChild(button3); @@ -801,7 +702,7 @@ bool UIPageViewJumpToPageTest::init() button4->setTitleText("Jump to Page4"); button4->setNormalizedPosition(Vec2(0.9, 0.65)); button4->addClickEventListener([=](Ref*){ - pageView->setCurPageIndex(3); + pageView->setCurrentPageIndex(3); }); _uiLayer->addChild(button4); _uiLayer->addChild(pageView); @@ -848,15 +749,12 @@ bool UIPageViewVerticalTest::init() // Create the page view PageView* pageView = PageView::create(); + pageView->setIndicatorEnabled(true); pageView->setDirection(ui::PageView::Direction::VERTICAL); pageView->setContentSize(Size(240.0f, 130.0f)); Size backgroundSize = background->getContentSize(); - pageView->setPosition(Vec2((widgetSize.width - backgroundSize.width) / 2.0f + - (backgroundSize.width - pageView->getContentSize().width) / 2.0f, - (widgetSize.height - backgroundSize.height) / 2.0f + - (backgroundSize.height - pageView->getContentSize().height) / 2.0f)); - - pageView->removeAllPages(); + pageView->setPosition((widgetSize - pageView->getContentSize()) / 2.0f); + pageView->removeAllItems(); int pageCount = 4; for (int i = 0; i < pageCount; ++i) @@ -875,7 +773,7 @@ bool UIPageViewVerticalTest::init() label->setPosition(Vec2(layout->getContentSize().width / 2.0f, layout->getContentSize().height / 2.0f)); layout->addChild(label); - pageView->insertPage(layout,i); + pageView->insertCustomItem(layout, i); } pageView->addEventListener(CC_CALLBACK_2(UIPageViewVerticalTest::pageViewEvent, this)); @@ -895,7 +793,7 @@ void UIPageViewVerticalTest::pageViewEvent(Ref *pSender, PageView::EventType typ { PageView* pageView = dynamic_cast(pSender); - _displayValueLabel->setString(StringUtils::format("page = %ld", pageView->getCurPageIndex() + 1)); + _displayValueLabel->setString(StringUtils::format("page = %ld", pageView->getCurrentPageIndex() + 1)); } break; @@ -949,7 +847,7 @@ bool UIPageViewDisableTouchTest::init() (backgroundSize.height - pageView->getContentSize().height) / 2.0f)); pageView->setDirection(ui::PageView::Direction::VERTICAL); pageView->setTouchEnabled(false); - pageView->removeAllPages(); + pageView->removeAllItems(); int pageCount = 4; for (int i = 0; i < pageCount; ++i) @@ -968,7 +866,7 @@ bool UIPageViewDisableTouchTest::init() label->setPosition(Vec2(layout->getContentSize().width / 2.0f, layout->getContentSize().height / 2.0f)); layout->addChild(label); - pageView->insertPage(layout,i); + pageView->insertCustomItem(layout, i); } _uiLayer->addChild(pageView); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.h b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.h index ed2ccb4305..466b95673a 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.h +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.h @@ -37,11 +37,11 @@ public: UIPageViewTest(); ~UIPageViewTest(); virtual bool init() override; - + void pageViewEvent(cocos2d::Ref* sender, cocos2d::ui::PageView::EventType type); - + protected: - + cocos2d::ui::Text* _displayValueLabel; }; @@ -61,23 +61,6 @@ protected: cocos2d::ui::Text* _displayValueLabel; }; -class UIPageViewCustomScrollThreshold : public UIScene -{ -public: - CREATE_FUNC(UIPageViewCustomScrollThreshold); - - UIPageViewCustomScrollThreshold(); - ~UIPageViewCustomScrollThreshold(); - virtual bool init() override; - - void sliderEvent(cocos2d::Ref* sender, cocos2d::ui::Slider::EventType type); - - void pageViewEvent(cocos2d::Ref* sender, cocos2d::ui::PageView::EventType type); -protected: - - cocos2d::ui::Text* _displayValueLabel; -}; - class UIPageViewTouchPropagationTest : public UIScene { public: diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScale9SpriteTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScale9SpriteTest.cpp index 187ca1e2cc..408c61f91b 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScale9SpriteTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScale9SpriteTest.cpp @@ -53,6 +53,8 @@ UIScale9SpriteTests::UIScale9SpriteTests() ADD_TEST_CASE(UIS9Flip); ADD_TEST_CASE(UIS9ChangeAnchorPoint); ADD_TEST_CASE(UIS9NinePatchTest); + ADD_TEST_CASE(UIS9BatchTest); + ADD_TEST_CASE(UIS9ToggleRenderingTypeTest); } // UIScale9SpriteTest @@ -345,9 +347,9 @@ bool UIS9FrameNameSpriteSheetCropped::init() SpriteFrameCache::getInstance()->addSpriteFramesWithFile(s_s9s_blocks9_plist); auto blocks = ui::Scale9Sprite::createWithSpriteFrameName("blocks9c.png"); - + blocks->setRenderingType(Scale9Sprite::RenderingType::SIMPLE); blocks->setPosition(Vec2(x, y)); - + blocks->setCapInsets(Rect(5,5,5,5)); this->addChild(blocks); return true; @@ -366,9 +368,9 @@ bool UIS9FrameNameSpriteSheetCroppedRotated::init() SpriteFrameCache::getInstance()->addSpriteFramesWithFile(s_s9s_blocks9_plist); auto blocks = ui::Scale9Sprite::createWithSpriteFrameName("blocks9cr.png"); - + blocks->setRenderingType(Scale9Sprite::RenderingType::SIMPLE); blocks->setPosition(Vec2(x, y)); - + blocks->setInsetBottom(10); this->addChild(blocks); return true; @@ -904,3 +906,91 @@ bool UIS9NinePatchTest::init() } return false; } + +bool UIS9BatchTest::init() +{ + if (UIScene::init()) { + SpriteFrameCache::getInstance()->addSpriteFramesWithFile("Images/blocks9ss.plist"); + + auto winSize = Director::getInstance()->getVisibleSize(); + + auto label = Label::createWithSystemFont("Click Button to Add Sprite and Slice Sprite\nThe draw call should always be 19 after adding sprites", "Arial", 15); + label->setPosition(Vec2(winSize.width/2, winSize.height - 60)); + this->addChild(label); + + auto preferedSize = Size(150,99); + std::vector spriteFrameNameArray = {"blocks9.png", "blocks9r.png"}; + auto addSpriteButton = ui::Button::create("cocosui/animationbuttonnormal.png", "cocosui/animationbuttonpressed.png"); + addSpriteButton->setPosition(Vec2(winSize.width/2 - 50,winSize.height - 100)); + addSpriteButton->setTitleText("Add Normal Sprite"); + srand((unsigned)time(nullptr)); + addSpriteButton->addClickEventListener([=](Ref*){ + auto spriteFrameName = spriteFrameNameArray[rand()%2]; + auto sprite = Sprite::createWithSpriteFrameName(spriteFrameName); + sprite->setPosition(Vec2(rand() % (int)winSize.width + 50, winSize.height/2)); + this->addChild(sprite); + }); + this->addChild(addSpriteButton); + + auto addSliceSpriteButton = ui::Button::create("cocosui/animationbuttonnormal.png", "cocosui/animationbuttonpressed.png"); + addSliceSpriteButton->setPosition(Vec2(winSize.width/2 + 50,winSize.height - 100)); + addSliceSpriteButton->setTitleText("Add Slice Sprite"); + addSliceSpriteButton->addClickEventListener([=](Ref*){ + int random = rand()%2; + auto spriteFrameName = spriteFrameNameArray[random]; + auto sprite = ui::Scale9Sprite::createWithSpriteFrameName(spriteFrameName); + sprite->setPosition(Vec2(rand() % (int)winSize.width + 50, winSize.height/3)); + if (random == 0) { + sprite->setRenderingType(Scale9Sprite::RenderingType::SIMPLE); + }else{ + sprite->setRenderingType(Scale9Sprite::RenderingType::SLICE); + } + sprite->setPreferredSize(preferedSize); + this->addChild(sprite); + }); + this->addChild(addSliceSpriteButton); + + + return true; + } + return false; +} + +bool UIS9ToggleRenderingTypeTest::init() +{ + if (UIScene::init()) { + + auto winSize = Director::getInstance()->getWinSize(); + float x = winSize.width / 2; + float y = 0 + (winSize.height / 2 - 20); + + auto label = Label::createWithSystemFont("Click Button to toggle rendering type", "Arial", 15); + label->setPosition(Vec2(winSize.width/2, winSize.height - 60)); + this->addChild(label); + + auto blocks = ui::Scale9Sprite::create("Images/blocks9.png"); + + blocks->setPosition(Vec2(x, y)); + blocks->setPreferredSize(Size(96*2, 96)); + this->addChild(blocks); + + auto addSliceSpriteButton = ui::Button::create("cocosui/animationbuttonnormal.png", "cocosui/animationbuttonpressed.png"); + addSliceSpriteButton->setPosition(Vec2(winSize.width/2,winSize.height - 100)); + addSliceSpriteButton->setTitleText("Slice Rendering"); + addSliceSpriteButton->addClickEventListener([=](Ref*){ + if (blocks->getRenderingType() == Scale9Sprite::RenderingType::SLICE) { + blocks->setRenderingType(Scale9Sprite::RenderingType::SIMPLE); + addSliceSpriteButton->setTitleText("Simple Rendering"); + }else{ + blocks->setRenderingType(Scale9Sprite::RenderingType::SLICE); + addSliceSpriteButton->setTitleText("Slice Rendering"); + blocks->setCapInsets(Rect(96/3,96/3,96/3,96/3)); + } + }); + this->addChild(addSliceSpriteButton); + + return true; + } + return false; +} + diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScale9SpriteTest.h b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScale9SpriteTest.h index 4138593e26..87b328bf9c 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScale9SpriteTest.h +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScale9SpriteTest.h @@ -258,4 +258,20 @@ public: virtual bool init() override; }; +class UIS9BatchTest: public UIScene +{ +public: + CREATE_FUNC(UIS9BatchTest); + + virtual bool init() override; +}; + +class UIS9ToggleRenderingTypeTest: public UIScene +{ +public: + CREATE_FUNC(UIS9ToggleRenderingTypeTest); + + virtual bool init() override; +}; + #endif /* defined(__cocos2d_tests__UIScale9SpriteTest__) */ diff --git a/tests/cpp-tests/Resources/ccs-res b/tests/cpp-tests/Resources/ccs-res index 636129882b..e82bd71212 160000 --- a/tests/cpp-tests/Resources/ccs-res +++ b/tests/cpp-tests/Resources/ccs-res @@ -1 +1 @@ -Subproject commit 636129882b612b5fe6d1d21be1eec136a2b1340b +Subproject commit e82bd71212e53e016bf5f262f8e4bc1c50b54203 diff --git a/tests/cpp-tests/proj.win32/cpp-tests.vcxproj b/tests/cpp-tests/proj.win32/cpp-tests.vcxproj index 6214945a7f..d7e62975bc 100644 --- a/tests/cpp-tests/proj.win32/cpp-tests.vcxproj +++ b/tests/cpp-tests/proj.win32/cpp-tests.vcxproj @@ -152,6 +152,7 @@ xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y + @@ -346,6 +347,7 @@ xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y + diff --git a/tests/cpp-tests/proj.win32/cpp-tests.vcxproj.filters b/tests/cpp-tests/proj.win32/cpp-tests.vcxproj.filters index 5ac16aa2dd..ac91fe4111 100644 --- a/tests/cpp-tests/proj.win32/cpp-tests.vcxproj.filters +++ b/tests/cpp-tests/proj.win32/cpp-tests.vcxproj.filters @@ -931,6 +931,9 @@ Classes\BugsTest + + Classes\BugsTest + Classes\DownloaderTest @@ -1689,6 +1692,9 @@ Classes\BugsTest + + Classes\BugsTest + Classes\DownloaderTest diff --git a/tests/js-tests/src/ExtensionsTest/S9SpriteTest/S9SpriteTest.js b/tests/js-tests/src/ExtensionsTest/S9SpriteTest/S9SpriteTest.js index 942ff676d1..4b5669184f 100644 --- a/tests/js-tests/src/ExtensionsTest/S9SpriteTest/S9SpriteTest.js +++ b/tests/js-tests/src/ExtensionsTest/S9SpriteTest/S9SpriteTest.js @@ -570,6 +570,36 @@ var S9SpriteColorOpacityTest = S9SpriteTestDemo.extend({ } }); +var S9SpriteOpacityWithFadeActionsTest = S9SpriteTestDemo.extend({ + _title:"Test opacity cascade for Scale9Sprite with fade actions\n(fade to opacity 144, then fadeOut, then fadeIn)", + + ctor:function() { + this._super(); + + var colorLayer = new cc.LayerColor(cc.color(144,144,144)); + colorLayer.setContentSize(winSize.width / 2, winSize.height / 2); + colorLayer.x = winSize.width / 4; + colorLayer.y = winSize.height / 4; + + colorLayer.setCascadeOpacityEnabled(true); + + var blocks = new ccui.Scale9Sprite('blocks9.png'); + blocks.x = winSize.width / 4; + blocks.y = winSize.height / 4; + + colorLayer.addChild(blocks); + + var fadeToAction = cc.fadeTo(1, 144); + var delay = cc.delayTime(0.5); + var fadeOutAction = cc.fadeOut(0.8); + var fadeInAction = cc.fadeIn(0.8); + + colorLayer.runAction(cc.sequence(fadeToAction, delay, fadeOutAction, delay.clone(), fadeInAction)); + + this.addChild(colorLayer); + } +}); + var S9SpriteTestScene = TestScene.extend({ runThisTest:function (num) { sceneIdx = (num || num == 0) ? (num - 1) : -1; @@ -598,7 +628,8 @@ var arrayOfS9SpriteTest = [ S9FrameNameSpriteSheetRotatedInsetsScaled, S9_TexturePacker, S9SpriteActionTest, - S9SpriteColorOpacityTest + S9SpriteColorOpacityTest, + S9SpriteOpacityWithFadeActionsTest ]; var nextS9SpriteTest = function () { diff --git a/tools/simulator/frameworks/runtime-src/proj.ios_mac/mac/SimulatorApp.mm b/tools/simulator/frameworks/runtime-src/proj.ios_mac/mac/SimulatorApp.mm index bc5ea77aa3..0a04d97885 100755 --- a/tools/simulator/frameworks/runtime-src/proj.ios_mac/mac/SimulatorApp.mm +++ b/tools/simulator/frameworks/runtime-src/proj.ios_mac/mac/SimulatorApp.mm @@ -206,6 +206,7 @@ static void glfwDropFunc(GLFWwindow *window, int count, const char **files) // set project directory as search root path string solutionDir = tmpConfig.getProjectDir(); + string spath = solutionDir; if (!solutionDir.empty()) { for (int i = 0; i < solutionDir.size(); ++i) @@ -215,6 +216,24 @@ static void glfwDropFunc(GLFWwindow *window, int count, const char **files) solutionDir[i] = '/'; } } + + spath = solutionDir; + if (spath[spath.length() - 1] == '/') { + spath = spath.substr(0, spath.length() - 1); + } + string strExtention = FileUtils::getInstance()->getFileExtension(spath); + int pos = -1; + if(strExtention.compare(".csd") == 0) + { + pos = spath.rfind('/'); + if(pos > 0) + spath = spath.substr(0, pos); + } + pos = spath.rfind('/'); + if(pos > 0) + spath = spath.substr(0, pos+1); + FileUtils::getInstance()->addSearchPath(spath); + FileUtils::getInstance()->setDefaultResourceRootPath(solutionDir); FileUtils::getInstance()->addSearchPath(solutionDir); FileUtils::getInstance()->addSearchPath(tmpConfig.getProjectDir()); @@ -226,7 +245,9 @@ static void glfwDropFunc(GLFWwindow *window, int count, const char **files) // parse config.json auto parser = ConfigParser::getInstance(); - auto configPath = solutionDir.append(CONFIG_FILE); + auto configPath = spath.append(CONFIG_FILE); + if(!FileUtils::getInstance()->isFileExist(configPath)) + configPath = solutionDir.append(CONFIG_FILE); parser->readConfig(configPath); // set information diff --git a/web b/web index 1af39e177a..56c240983a 160000 --- a/web +++ b/web @@ -1 +1 @@ -Subproject commit 1af39e177a13bb54e1ee9c3eb60aca62b995a00e +Subproject commit 56c240983a8c7a6b221f840e3c45ed3d733ef102