From 04c5800ee82316b46708a958558185860df68498 Mon Sep 17 00:00:00 2001 From: Mazyad Alabduljaleel Date: Sun, 13 Jul 2014 05:01:13 +0400 Subject: [PATCH 01/19] [FIX]: When getting the string value, check which textfield is in use [FIX]: when setting the string value, change both textfields. --- extensions/GUI/CCEditBox/CCEditBoxImplMac.mm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplMac.mm b/extensions/GUI/CCEditBox/CCEditBoxImplMac.mm index fbeed2ee37..8ca0fd5d25 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplMac.mm +++ b/extensions/GUI/CCEditBox/CCEditBoxImplMac.mm @@ -404,11 +404,15 @@ void EditBoxImplMac::setText(const char* pText) { NSString *string = [NSString stringWithUTF8String:pText]; _sysEdit.textField.stringValue = string; - _sysEdit.textField.stringValue = string; + _sysEdit.secureTextField.stringValue = string; } const char* EditBoxImplMac::getText(void) { + if (_sysEdit.secureTextField.superview) { + return [_sysEdit.secureTextField.stringValue UTF8String]; + } + return [_sysEdit.textField.stringValue UTF8String]; } From 7757df222a06ea42da37d9d05e6a89a2f5e85821 Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Mon, 14 Jul 2014 18:26:39 +0800 Subject: [PATCH 02/19] Add bit extend module --- build/cocos2d_tests.xcodeproj/project.pbxproj | 6 ++ .../manual/lua_cocos2dx_manual.cpp | 12 ++- .../lua-bindings/script/bitExtend.lua | 95 +++++++++++++++++++ 3 files changed, 109 insertions(+), 4 deletions(-) create mode 100644 cocos/scripting/lua-bindings/script/bitExtend.lua diff --git a/build/cocos2d_tests.xcodeproj/project.pbxproj b/build/cocos2d_tests.xcodeproj/project.pbxproj index a76759dc2b..22be96797e 100644 --- a/build/cocos2d_tests.xcodeproj/project.pbxproj +++ b/build/cocos2d_tests.xcodeproj/project.pbxproj @@ -58,6 +58,8 @@ 1503FAC418DA8B6C00F6518C /* tp.lua in Resources */ = {isa = PBXBuildFile; fileRef = 1503FAB118DA8B6C00F6518C /* tp.lua */; }; 1503FAC518DA8B6C00F6518C /* url.lua in Resources */ = {isa = PBXBuildFile; fileRef = 1503FAB218DA8B6C00F6518C /* url.lua */; }; 1503FAC618DA8B6C00F6518C /* url.lua in Resources */ = {isa = PBXBuildFile; fileRef = 1503FAB218DA8B6C00F6518C /* url.lua */; }; + 156229331973D400009C9067 /* bitExtend.lua in Resources */ = {isa = PBXBuildFile; fileRef = 156229321973D400009C9067 /* bitExtend.lua */; }; + 156229341973D400009C9067 /* bitExtend.lua in Resources */ = {isa = PBXBuildFile; fileRef = 156229321973D400009C9067 /* bitExtend.lua */; }; 15AECE0B195C0F8A00907DB0 /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3EA0FB65191B933000B170C8 /* MediaPlayer.framework */; }; 15AECE0F195C1FDD00907DB0 /* cocosvideo.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 3EA0FB5D191B92F100B170C8 /* cocosvideo.mp4 */; }; 15AECE1F195D0EC500907DB0 /* experimentalConstants.lua in Resources */ = {isa = PBXBuildFile; fileRef = 15AECE1E195D0EC500907DB0 /* experimentalConstants.lua */; }; @@ -1393,6 +1395,7 @@ 1503FAB018DA8B6C00F6518C /* socket.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = socket.lua; path = ../external/lua/luasocket/socket.lua; sourceTree = ""; }; 1503FAB118DA8B6C00F6518C /* tp.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = tp.lua; path = ../external/lua/luasocket/tp.lua; sourceTree = ""; }; 1503FAB218DA8B6C00F6518C /* url.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = url.lua; path = ../external/lua/luasocket/url.lua; sourceTree = ""; }; + 156229321973D400009C9067 /* bitExtend.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = bitExtend.lua; path = "../cocos/scripting/lua-bindings/script/bitExtend.lua"; sourceTree = ""; }; 15AECE1E195D0EC500907DB0 /* experimentalConstants.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = experimentalConstants.lua; path = "../cocos/scripting/lua-bindings/script/experimentalConstants.lua"; sourceTree = ""; }; 15C64822165F391E007D4F18 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/Cocoa.framework; sourceTree = DEVELOPER_DIR; }; 15C64824165F3934007D4F18 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/OpenGL.framework; sourceTree = DEVELOPER_DIR; }; @@ -5531,6 +5534,7 @@ 1ABCA36418CD9E060087CE3A /* Lua Common */ = { isa = PBXGroup; children = ( + 156229321973D400009C9067 /* bitExtend.lua */, 15AECE1E195D0EC500907DB0 /* experimentalConstants.lua */, 1503FAA918DA8B6C00F6518C /* ftp.lua */, 1503FAAA18DA8B6C00F6518C /* headers.lua */, @@ -7897,6 +7901,7 @@ 15C90B4918E66C2A00D69802 /* tp.lua in Resources */, 1AC35DE918CEE65900F37B72 /* effect1.wav in Resources */, 1ABCA38E18CD9E180087CE3A /* GuiConstants.lua in Resources */, + 156229331973D400009C9067 /* bitExtend.lua in Resources */, 15C90B3F18E66C0C00D69802 /* ltn12.lua in Resources */, 15C90B4718E66C2400D69802 /* socket.lua in Resources */, 15C90B3A18E66BE200D69802 /* ftp.lua in Resources */, @@ -7939,6 +7944,7 @@ 15B0870D195AD52000D6F62B /* ActionTimeline in Resources */, 15E66FC8192D957100C20A52 /* Sprite3DTest in Resources */, 15C90B4418E66C1800D69802 /* mime.lua in Resources */, + 156229341973D400009C9067 /* bitExtend.lua in Resources */, 15C90B4C18E66C3100D69802 /* url.lua in Resources */, 1AC35DD618CEE65200F37B72 /* Misc in Resources */, 1ABCA37B18CD9E180087CE3A /* CCBReaderLoad.lua in Resources */, diff --git a/cocos/scripting/lua-bindings/manual/lua_cocos2dx_manual.cpp b/cocos/scripting/lua-bindings/manual/lua_cocos2dx_manual.cpp index c153ceec74..d41334cf54 100644 --- a/cocos/scripting/lua-bindings/manual/lua_cocos2dx_manual.cpp +++ b/cocos/scripting/lua-bindings/manual/lua_cocos2dx_manual.cpp @@ -6090,7 +6090,8 @@ int lua_cocos2dx_TMXLayer_getTileGIDAt(lua_State* tolua_S) return 0; unsigned int ret = cobj->getTileGIDAt(arg0); tolua_pushnumber(tolua_S,(lua_Number)ret); - return 1; + tolua_pushnumber(tolua_S,(lua_Number)0); + return 2; } if (argc == 2) { @@ -6105,7 +6106,8 @@ int lua_cocos2dx_TMXLayer_getTileGIDAt(lua_State* tolua_S) unsigned int ret = cobj->getTileGIDAt(arg0, (cocos2d::TMXTileFlags*)&arg1); tolua_pushnumber(tolua_S,(lua_Number)ret); - return 1; + tolua_pushnumber(tolua_S,(lua_Number)arg1); + return 2; } CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getTileGIDAt",argc, 1); return 0; @@ -6471,7 +6473,8 @@ static int lua_cocos2dx_FastTMXLayer_getTileGIDAt(lua_State* tolua_S) return 0; int ret = cobj->getTileGIDAt(arg0); tolua_pushnumber(tolua_S,(lua_Number)ret); - return 1; + tolua_pushnumber(tolua_S,(lua_Number)0); + return 2; } if (argc == 2) { @@ -6486,7 +6489,8 @@ static int lua_cocos2dx_FastTMXLayer_getTileGIDAt(lua_State* tolua_S) unsigned int ret = cobj->getTileGIDAt(arg0, (cocos2d::TMXTileFlags*)&arg1); tolua_pushnumber(tolua_S,(lua_Number)ret); - return 1; + tolua_pushnumber(tolua_S,(lua_Number)arg1); + return 2; } CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getTileGIDAt",argc, 1); return 0; diff --git a/cocos/scripting/lua-bindings/script/bitExtend.lua b/cocos/scripting/lua-bindings/script/bitExtend.lua new file mode 100644 index 0000000000..1f152bb895 --- /dev/null +++ b/cocos/scripting/lua-bindings/script/bitExtend.lua @@ -0,0 +1,95 @@ +-- bit operation + +bit = bit or {} +bit.data32 = {} +for i=1,32 do + bit.data32[i]=2^(32-i) +end + +function bit._b2d(arg) + local nr=0 + for i=1,32 do + if arg[i] ==1 then + nr=nr+bit.data32[i] + end + end + return nr +end + +function bit._d2b(arg) + arg = arg >= 0 and arg or (0xFFFFFFFF + arg + 1) + local tr={} + for i=1,32 do + if arg >= bit.data32[i] then + tr[i]=1 + arg=arg-bit.data32[i] + else + tr[i]=0 + end + end + return tr +end + +function bit._and(a,b) + local op1=bit._d2b(a) + local op2=bit._d2b(b) + local r={} + + for i=1,32 do + if op1[i]==1 and op2[i]==1 then + r[i]=1 + else + r[i]=0 + end + end + return bit._b2d(r) + +end + +function bit._rshift(a,n) + local op1=bit._d2b(a) + n = n <= 32 and n or 32 + n = n >= 0 and n or 0 + + for i=32, n+1, -1 do + op1[i] = op1[i-n] + end + for i=1, n do + op1[i] = 0 + end + + return bit._b2d(op1) +end + +function bit._not(a) + local op1=bit._d2b(a) + local r={} + + for i=1,32 do + if op1[i]==1 then + r[i]=0 + else + r[i]=1 + end + end + return bit._b2d(r) +end + +function bit._or(a,b) + local op1=bit._d2b(a) + local op2=bit._d2b(b) + local r={} + + for i=1,32 do + if op1[i]==1 or op2[i]==1 then + r[i]=1 + else + r[i]=0 + end + end + return bit._b2d(r) +end + +bit.band = bit.band or bit._and +bit.rshift = bit.rshift or bit._rshift +bit.bnot = bit.bnot or bit._not \ No newline at end of file From f1ed090f4fdea87cf47b8afcd5f85fb0e8c94b40 Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Mon, 14 Jul 2014 18:30:02 +0800 Subject: [PATCH 03/19] Fix the OpenGLTest display bugs. --- tests/lua-tests/src/OpenGLTest/OpenGLTest.lua | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/lua-tests/src/OpenGLTest/OpenGLTest.lua b/tests/lua-tests/src/OpenGLTest/OpenGLTest.lua index f6c6860efb..428ba1d3aa 100644 --- a/tests/lua-tests/src/OpenGLTest/OpenGLTest.lua +++ b/tests/lua-tests/src/OpenGLTest/OpenGLTest.lua @@ -20,6 +20,8 @@ local vertDefaultSource = "\n".."\n" .. " v_texCoord = a_texCoord;\n" .. "} \n" +local scaleFactor = cc.Director:getInstance():getContentScaleFactor() + local function OpenGLTestMainLayer() local kItemTagBasic = 1000 local testCount = 16 @@ -231,6 +233,8 @@ local function OpenGLTestMainLayer() time = 0 majorLayer:addChild(glNode,-10) glNode:setPosition( size.width/2, size.height/2) + local center = cc.p( size.width / 2 * scaleFactor, size.height / 2 * scaleFactor) + glNode:getGLProgramState():setUniformVec2("center", center) return majorLayer end @@ -272,6 +276,8 @@ local function OpenGLTestMainLayer() time = 0 mandelbrotLayer:addChild(glNode,-10) glNode:setPosition( size.width/2, size.height/2) + local center = cc.p( size.width / 2 * scaleFactor, size.height / 2 * scaleFactor) + glNode:getGLProgramState():setUniformVec2("center", center) return mandelbrotLayer end @@ -314,6 +320,8 @@ local function OpenGLTestMainLayer() time = 0 heartLayer:addChild(glNode,-10) glNode:setPosition( size.width/2, size.height/2) + local center = cc.p( size.width / 2 * scaleFactor, size.height / 2 * scaleFactor) + glNode:getGLProgramState():setUniformVec2("center", center) return heartLayer end @@ -357,6 +365,8 @@ local function OpenGLTestMainLayer() time = 0 plasmaLayer:addChild(glNode,-10) glNode:setPosition( size.width/2, size.height/2) + local center = cc.p( size.width / 2 * scaleFactor, size.height / 2 * scaleFactor) + glNode:getGLProgramState():setUniformVec2("center", center) return plasmaLayer end @@ -399,6 +409,8 @@ local function OpenGLTestMainLayer() time = 0 flowerLayer:addChild(glNode,-10) glNode:setPosition( size.width/2, size.height/2) + local center = cc.p( size.width / 2 * scaleFactor, size.height / 2 * scaleFactor) + glNode:getGLProgramState():setUniformVec2("center", center) return flowerLayer end @@ -441,6 +453,8 @@ local function OpenGLTestMainLayer() time = 0 juliaLayer:addChild(glNode,-10) glNode:setPosition( size.width/2, size.height/2) + local center = cc.p( size.width / 2 * scaleFactor, size.height / 2 * scaleFactor) + glNode:getGLProgramState():setUniformVec2("center", center) return juliaLayer end @@ -545,7 +559,7 @@ local function OpenGLTestMainLayer() shader:setUniformsForBuiltins(transform) gl.bindTexture(gl.TEXTURE_2D, texture.texture_id) - gl.glEnableVertexAttribs(cc.VERTEX_ATTRIB_FLAG_TEX_COORDS or cc.VERTEX_ATTRIB_FLAG_POSITION) + gl.glEnableVertexAttribs(bit._or(cc.VERTEX_ATTRIB_FLAG_TEX_COORDS, cc.VERTEX_ATTRIB_FLAG_POSITION)) gl.bindBuffer(gl.ARRAY_BUFFER, squareVertexPositionBuffer.buffer_id) gl.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,gl.FLOAT,false,0,0) From b3bfa87f513ac55ec69abbfe24b2d662ed59c160 Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Mon, 14 Jul 2014 18:30:59 +0800 Subject: [PATCH 04/19] Fix the TMXOrthoFlipRunTimeTest bugs. --- .../src/FastTiledMapTest/FastTiledMapTest.lua | 63 +++++++------- .../lua-tests/src/PhysicsTest/PhysicsTest.lua | 83 ------------------- .../lua-tests/src/TileMapTest/TileMapTest.lua | 62 +++++++------- tests/lua-tests/src/mainMenu.lua | 1 + 4 files changed, 65 insertions(+), 144 deletions(-) diff --git a/tests/lua-tests/src/FastTiledMapTest/FastTiledMapTest.lua b/tests/lua-tests/src/FastTiledMapTest/FastTiledMapTest.lua index 9af3d41c98..d3ee245bd5 100644 --- a/tests/lua-tests/src/FastTiledMapTest/FastTiledMapTest.lua +++ b/tests/lua-tests/src/FastTiledMapTest/FastTiledMapTest.lua @@ -1012,39 +1012,37 @@ local function TMXOrthoFlipRunTimeTest() map:runAction(action) local function flipIt(dt) - -- local map = tolua.cast(ret:getChildByTag(kTagTileMap), "TMXTiledMap") - -- local layer = map:getLayer("Layer 0") + local map = ret:getChildByTag(kTagTileMap) + local layer = map:getLayer("Layer 0") + + local tileCoord = cc.p(1, 10) + local flags = 0 + local GID, flags = layer:getTileGIDAt(tileCoord, flags) + if 0 ~= bit._and(flags, cc.TMX_TILE_VERTICAL_FLAG) then + flags = bit._and(flags, bit._not(cc.TMX_TILE_VERTICAL_FLAG)) + else + flags = bit._or(flags, cc.TMX_TILE_VERTICAL_FLAG) + end + layer:setTileGID(GID, tileCoord, flags) - -- --blue diamond - -- local tileCoord = cc.p(1,10) - -- local flags = 0 - -- local GID = layer:getTileGIDAt(tileCoord, (ccTMXTileFlags*)&flags) - -- -- Vertical - -- if( flags & kcc.TMXTileVerticalFlag ) - -- flags &= ~kcc.TMXTileVerticalFlag - -- else - -- flags |= kcc.TMXTileVerticalFlag - -- layer:setTileGID(GID ,tileCoord, (ccTMXTileFlags)flags) + tileCoord = cc.p(1,8) + GID, flags = layer:getTileGIDAt(tileCoord, flags) + if 0 ~= bit._and(flags, cc.TMX_TILE_VERTICAL_FLAG) then + flags = bit._and(flags, bit._not(cc.TMX_TILE_VERTICAL_FLAG)) + else + flags = bit._or(flags, cc.TMX_TILE_VERTICAL_FLAG) + end + layer:setTileGID(GID ,tileCoord, flags) - - -- tileCoord = cc.p(1,8) - -- GID = layer:getTileGIDAt(tileCoord, (ccTMXTileFlags*)&flags) - -- -- Vertical - -- if( flags & kcc.TMXTileVerticalFlag ) - -- flags &= ~kcc.TMXTileVerticalFlag - -- else - -- flags |= kcc.TMXTileVerticalFlag - -- layer:setTileGID(GID ,tileCoord, (ccTMXTileFlags)flags) - - - -- tileCoord = cc.p(2,8) - -- GID = layer:getTileGIDAt(tileCoord, (ccTMXTileFlags*)&flags) - -- -- Horizontal - -- if( flags & kcc.TMXTileHorizontalFlag ) - -- flags &= ~kcc.TMXTileHorizontalFlag - -- else - -- flags |= kcc.TMXTileHorizontalFlag - -- layer:setTileGID(GID, tileCoord, (ccTMXTileFlags)flags) + tileCoord = cc.p(2,8) + GID, flags = layer:getTileGIDAt(tileCoord, flags) + -- Horizontal + if 0~= bit._and(flags, cc.TMX_TILE_HORIZONTAL_FLAG) then + flags = bit._and(flags, bit._not(cc.TMX_TILE_HORIZONTAL_FLAG)) + else + flags = bit._or(flags, cc.TMX_TILE_HORIZONTAL_FLAG) + end + layer:setTileGID(GID, tileCoord, flags) end local schedulerEntry = nil local function onNodeEvent(event) @@ -1054,6 +1052,9 @@ local function TMXOrthoFlipRunTimeTest() scheduler:unscheduleScriptEntry(schedulerEntry) end end + + ret:registerScriptHandler(onNodeEvent) + return ret end diff --git a/tests/lua-tests/src/PhysicsTest/PhysicsTest.lua b/tests/lua-tests/src/PhysicsTest/PhysicsTest.lua index 9043a42c8d..725744fe5d 100644 --- a/tests/lua-tests/src/PhysicsTest/PhysicsTest.lua +++ b/tests/lua-tests/src/PhysicsTest/PhysicsTest.lua @@ -16,89 +16,6 @@ local function range(from, to, step) end, nil, from - step end --- bit operation - -bit = bit or {} -bit.data32 = {} -for i=1,32 do - bit.data32[i]=2^(32-i) -end - -function bit._b2d(arg) - local nr=0 - for i=1,32 do - if arg[i] ==1 then - nr=nr+bit.data32[i] - end - end - return nr -end - -function bit._d2b(arg) - arg = arg >= 0 and arg or (0xFFFFFFFF + arg + 1) - local tr={} - for i=1,32 do - if arg >= bit.data32[i] then - tr[i]=1 - arg=arg-bit.data32[i] - else - tr[i]=0 - end - end - return tr -end - -function bit._and(a,b) - local op1=bit._d2b(a) - local op2=bit._d2b(b) - local r={} - - for i=1,32 do - if op1[i]==1 and op2[i]==1 then - r[i]=1 - else - r[i]=0 - end - end - return bit._b2d(r) - -end - -function bit._rshift(a,n) - local op1=bit._d2b(a) - n = n <= 32 and n or 32 - n = n >= 0 and n or 0 - - for i=32, n+1, -1 do - op1[i] = op1[i-n] - end - for i=1, n do - op1[i] = 0 - end - - return bit._b2d(op1) -end - -function bit._not(a) - local op1=bit._d2b(a) - local r={} - - for i=1,32 do - if op1[i]==1 then - r[i]=0 - else - r[i]=1 - end - end - return bit._b2d(r) -end - -bit.band = bit.band or bit._and -bit.rshift = bit.rshift or bit._rshift -bit.bnot = bit.bnot or bit._not - --- bit operation end - local function initWithLayer(layer, callback) curLayer = layer layer.spriteTexture = cc.SpriteBatchNode:create("Images/grossini_dance_atlas.png", 100):getTexture() diff --git a/tests/lua-tests/src/TileMapTest/TileMapTest.lua b/tests/lua-tests/src/TileMapTest/TileMapTest.lua index b356b7cdf9..54c138e87c 100644 --- a/tests/lua-tests/src/TileMapTest/TileMapTest.lua +++ b/tests/lua-tests/src/TileMapTest/TileMapTest.lua @@ -1106,41 +1106,40 @@ local function TMXOrthoFlipRunTimeTest() local action = cc.ScaleBy:create(2, 0.5) map:runAction(action) local function flipIt(dt) + local map = ret:getChildByTag(kTagTileMap) + local layer = map:getLayer("Layer 0") - -- local map = tolua.cast(ret:getChildByTag(kTagTileMap), "TMXTiledMap") - -- local layer = map:getLayer("Layer 0") + local tileCoord = cc.p(1, 10) + local flags = 0 + local GID, flags = layer:getTileGIDAt(tileCoord, flags) - -- --blue diamond - -- local tileCoord = cc.p(1,10) - -- local flags = 0 - -- local GID = layer:getTileGIDAt(tileCoord, (ccTMXTileFlags*)&flags) - -- -- Vertical - -- if( flags & kcc.TMXTileVerticalFlag ) - -- flags &= ~kcc.TMXTileVerticalFlag - -- else - -- flags |= kcc.TMXTileVerticalFlag - -- layer:setTileGID(GID ,tileCoord, (ccTMXTileFlags)flags) + if 0 ~= bit._and(flags, cc.TMX_TILE_VERTICAL_FLAG) then + flags = bit._and(flags, bit._not(cc.TMX_TILE_VERTICAL_FLAG)) + else + flags = bit._or(flags, cc.TMX_TILE_VERTICAL_FLAG) + end + layer:setTileGID(GID, tileCoord, flags) + tileCoord = cc.p(1,8) + GID, flags = layer:getTileGIDAt(tileCoord, flags) + if 0 ~= bit._and(flags, cc.TMX_TILE_VERTICAL_FLAG) then + flags = bit._and(flags, bit._not(cc.TMX_TILE_VERTICAL_FLAG)) + else + flags = bit._or(flags, cc.TMX_TILE_VERTICAL_FLAG) + end + layer:setTileGID(GID ,tileCoord, flags) - -- tileCoord = cc.p(1,8) - -- GID = layer:getTileGIDAt(tileCoord, (ccTMXTileFlags*)&flags) - -- -- Vertical - -- if( flags & kcc.TMXTileVerticalFlag ) - -- flags &= ~kcc.TMXTileVerticalFlag - -- else - -- flags |= kcc.TMXTileVerticalFlag - -- layer:setTileGID(GID ,tileCoord, (ccTMXTileFlags)flags) - - - -- tileCoord = cc.p(2,8) - -- GID = layer:getTileGIDAt(tileCoord, (ccTMXTileFlags*)&flags) - -- -- Horizontal - -- if( flags & kcc.TMXTileHorizontalFlag ) - -- flags &= ~kcc.TMXTileHorizontalFlag - -- else - -- flags |= kcc.TMXTileHorizontalFlag - -- layer:setTileGID(GID, tileCoord, (ccTMXTileFlags)flags) + tileCoord = cc.p(2,8) + GID, flags = layer:getTileGIDAt(tileCoord, flags) + -- Horizontal + if 0~= bit._and(flags, cc.TMX_TILE_HORIZONTAL_FLAG) then + flags = bit._and(flags, bit._not(cc.TMX_TILE_HORIZONTAL_FLAG)) + else + flags = bit._or(flags, cc.TMX_TILE_HORIZONTAL_FLAG) + end + layer:setTileGID(GID, tileCoord, flags) end + local schedulerEntry = nil local function onNodeEvent(event) if event == "enter" then @@ -1149,6 +1148,9 @@ local function TMXOrthoFlipRunTimeTest() scheduler:unscheduleScriptEntry(schedulerEntry) end end + + ret:registerScriptHandler(onNodeEvent) + return ret end diff --git a/tests/lua-tests/src/mainMenu.lua b/tests/lua-tests/src/mainMenu.lua index 7aea67ebbb..858aad51b9 100644 --- a/tests/lua-tests/src/mainMenu.lua +++ b/tests/lua-tests/src/mainMenu.lua @@ -4,6 +4,7 @@ require "Opengl" require "OpenglConstants" require "StudioConstants" require "GuiConstants" +require "bitExtend" require "src/helper" require "src/testResource" require "src/VisibleRect" From 67c07f94f4a2b2bac345ce3274f2dc07f80f2a9c Mon Sep 17 00:00:00 2001 From: pandamicro Date: Tue, 15 Jul 2014 11:30:36 +0800 Subject: [PATCH 05/19] Issue #5724: Correction of property name in CCBone --- cocos/editor-support/cocostudio/CCBone.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cocos/editor-support/cocostudio/CCBone.cpp b/cocos/editor-support/cocostudio/CCBone.cpp index 5c0daf2e79..7a446d1521 100644 --- a/cocos/editor-support/cocostudio/CCBone.cpp +++ b/cocos/editor-support/cocostudio/CCBone.cpp @@ -201,8 +201,8 @@ void Bone::update(float delta) _worldInfo->y = _tweenData->y + _position.y; _worldInfo->scaleX = _tweenData->scaleX * _scaleX; _worldInfo->scaleY = _tweenData->scaleY * _scaleY; - _worldInfo->skewX = _tweenData->skewX + _skewX + _rotationX; - _worldInfo->skewY = _tweenData->skewY + _skewY - _rotationY; + _worldInfo->skewX = _tweenData->skewX + _skewX + _rotationZ_X; + _worldInfo->skewY = _tweenData->skewY + _skewY - _rotationZ_Y; if(_parentBone) { From db8f0ea3ab7a9ee1d3f3d8f44112138b2d3c7f77 Mon Sep 17 00:00:00 2001 From: pandamicro Date: Tue, 15 Jul 2014 11:31:10 +0800 Subject: [PATCH 06/19] Fixed #5724: Use correct transform in CCSkin's updateTransform function --- cocos/editor-support/cocostudio/CCSkin.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/cocos/editor-support/cocostudio/CCSkin.cpp b/cocos/editor-support/cocostudio/CCSkin.cpp index d7d7a3feab..ac61c1a104 100644 --- a/cocos/editor-support/cocostudio/CCSkin.cpp +++ b/cocos/editor-support/cocostudio/CCSkin.cpp @@ -160,6 +160,7 @@ void Skin::updateTransform() // // calculate the Quad based on the Affine Matrix // + Mat4 transform = getNodeToParentTransform(); Size &size = _rect.size; @@ -169,13 +170,13 @@ void Skin::updateTransform() float x2 = x1 + size.width; float y2 = y1 + size.height; - float x = _transform.m[12]; - float y = _transform.m[13]; + float x = transform.m[12]; + float y = transform.m[13]; - float cr = _transform.m[0]; - float sr = _transform.m[1]; - float cr2 = _transform.m[5]; - float sr2 = -_transform.m[4]; + float cr = transform.m[0]; + float sr = transform.m[1]; + float cr2 = transform.m[5]; + float sr2 = -transform.m[4]; float ax = x1 * cr - y1 * sr2 + x; float ay = x1 * sr + y1 * cr2 + y; From 3ab7520667ae51520197c399ac897689c440f33a Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Tue, 15 Jul 2014 11:34:24 +0800 Subject: [PATCH 07/19] Delete SceneEditorTest from ExtensionTest and add related binary loading to CocoStudioSceneTest --- .../CocoStudioSceneTest.lua | 243 +++++++++++++--- .../src/ExtensionTest/ExtensionTest.lua | 6 +- .../src/ExtensionTest/SceneEditorTest.lua | 270 ------------------ 3 files changed, 210 insertions(+), 309 deletions(-) delete mode 100644 tests/lua-tests/src/ExtensionTest/SceneEditorTest.lua diff --git a/tests/lua-tests/src/CocoStudioTest/CocoStudioSceneTest/CocoStudioSceneTest.lua b/tests/lua-tests/src/CocoStudioTest/CocoStudioSceneTest/CocoStudioSceneTest.lua index b64aad32b8..2201ce740e 100644 --- a/tests/lua-tests/src/CocoStudioTest/CocoStudioSceneTest/CocoStudioSceneTest.lua +++ b/tests/lua-tests/src/CocoStudioTest/CocoStudioSceneTest/CocoStudioSceneTest.lua @@ -25,6 +25,15 @@ SceneEditorTestLayer.title = "Trigger Test", } +SceneEditorTestLayer.loadtypeStr= +{ + "change to load \nwith binary file", + "change to load \nwith json file" +} + +SceneEditorTestLayer.fileName = "" +SceneEditorTestLayer.rootNode = nil + function SceneEditorTestLayer.extend(target) local t = tolua.getpeer(target) if not t then @@ -70,9 +79,44 @@ function SceneEditorTestLayer:createTitle() title:setPosition( cc.p(VisibleRect:center().x, VisibleRect:top().y - 30)) end +function SceneEditorTestLayer:loadFileChangeHelper(filePathName) + local indexTable = {} + local index = 0 + + while true do + index = string.find(filePathName, "%.", index + 1) + if nil == index then + break + end + + indexTable[#indexTable + 1] = index + end + + if #indexTable == 0 then + return filePathName + end + + local lastIndex = indexTable[#indexTable] + if lastIndex == 1 then + return filePathName + end + local renamePathName= string.sub(filePathName, 1, lastIndex - 1) + + if self.isCsbLoad then + renamePathName = renamePathName .. ".csb" + else + renamePathName = renamePathName .. ".json" + end + print("renamePath is", renamePathName) + return renamePathName +end + +function SceneEditorTestLayer:defaultPlay() + +end + function SceneEditorTestLayer:createMenu() local menu = cc.Menu:create() - local function pre() local scene = cc.Scene:create() scene:addChild(backSceneEditorTest()) @@ -118,6 +162,37 @@ function SceneEditorTestLayer:createMenu() end end + self.isCsbLoad = false + self.loadtypeLabel = cc.Label:createWithSystemFont(self.loadtypeStr[1], "Arial", 12) + local function changeLoadTypeCallback(tag,sender) + self.isCsbLoad = not self.isCsbLoad + if self.isCsbLoad then + self.loadtypeLabel:setString(self.loadtypeStr[2]) + else + self.loadtypeLabel:setString(self.loadtypeStr[1]) + end + + SceneEditorTestLayer.fileName = self:loadFileChangeHelper(SceneEditorTestLayer.fileName) + + if SceneEditorTestLayer.rootNode ~= nil then + self:removeChild(SceneEditorTestLayer.rootNode, true) + SceneEditorTestLayer.rootNode = ccs.SceneReader:getInstance():createNodeWithSceneFile(SceneEditorTestLayer.fileName) + if SceneEditorTestLayer.rootNode == nil then + return + end + self:defaultPlay() + self:addChild(SceneEditorTestLayer.rootNode, 0, 1) + end + end + + local loadTypeItem = cc.MenuItemLabel:create(self.loadtypeLabel) + loadTypeItem:registerScriptTapHandler(changeLoadTypeCallback) + local loadtypeMenu = cc.Menu:create() + loadtypeMenu:addChild(loadTypeItem) + loadtypeMenu:setPosition(cc.p(0,0)) + loadTypeItem:setPosition(cc.p(VisibleRect:rightTop().x -80,VisibleRect:rightTop().y -30)) + self:addChild(loadtypeMenu, 100) + local backMenu = cc.Menu:create() cc.MenuItemFont:setFontName("Arial") cc.MenuItemFont:setFontSize(24) @@ -145,9 +220,16 @@ end function LoadSceneEdtiorFileTest:createGameScene() local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/LoadSceneEdtiorFileTest/FishJoy2.json") + SceneEditorTestLayer.fileName = "scenetest/LoadSceneEdtiorFileTest/FishJoy2.json" + SceneEditorTestLayer.rootNode = node + self:defaultPlay() return node end +function LoadSceneEdtiorFileTest:defaultPlay() + +end + function LoadSceneEdtiorFileTest:onEnter() self:createMenu() self:createTitle() @@ -191,13 +273,9 @@ end function SpriteComponentTest:createGameScene() local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/SpriteComponentTest/SpriteComponentTest.json") if nil ~= node then - local action1 = cc.Blink:create(2, 10) - local action2 = cc.Blink:create(2, 5) - - local sister1 = node:getChildByTag(10003):getComponent("CCSprite") - sister1:getNode():runAction(action1) - local sister2 = node:getChildByTag(10004):getComponent("CCSprite") - sister2:getNode():runAction(action2) + SceneEditorTestLayer.fileName = "scenetest/SpriteComponentTest/SpriteComponentTest.json" + SceneEditorTestLayer.rootNode = node + self:defaultPlay() end return node @@ -209,8 +287,19 @@ function SpriteComponentTest:onEnter() local root = self:createGameScene() if nil ~= root then self:addChild(root, 0, 1) + end +end + +function SpriteComponentTest:defaultPlay() + if SceneEditorTestLayer.rootNode ~= nil then + local action1 = cc.Blink:create(2, 10) + local action2 = cc.Blink:create(2, 5) + + local sister1 = SceneEditorTestLayer.rootNode:getChildByTag(10003):getComponent("CCSprite") + sister1:getNode():runAction(action1) + local sister2 = SceneEditorTestLayer.rootNode:getChildByTag(10004):getComponent("CCSprite") + sister2:getNode():runAction(action2) end - end function SpriteComponentTest.create() @@ -246,14 +335,23 @@ end function ArmatureComponentTest:createGameScene() local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/ArmatureComponentTest/ArmatureComponentTest.json") if nil ~= node then + SceneEditorTestLayer.fileName = "scenetest/ArmatureComponentTest/ArmatureComponentTest.json" + SceneEditorTestLayer.rootNode = node + + self:defaultPlay() + end + + return node +end + +function ArmatureComponentTest:defaultPlay() + if SceneEditorTestLayer.rootName ~= nil then local blowFish = node:getChildByTag(10007):getComponent("CCArmature") blowFish:getNode():runAction(cc.MoveBy:create(10.0, cc.p(-1000.0, 0))) local butterflyfish = node:getChildByTag(10008):getComponent("CCArmature") - butterflyfish:getNode():runAction(CCMoveBy:create(10.0, cc.p(-1000.0, 0))) + butterflyfish:getNode():runAction(cc.MoveBy:create(10.0, cc.p(-1000.0, 0))) end - - return node end function ArmatureComponentTest:onEnter() @@ -299,23 +397,31 @@ end function UIComponentTest:createGameScene() local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/UIComponentTest/UIComponentTest.json") if nil ~= node then - local render = node:getChildByTag(10025):getComponent("GUIComponent") + SceneEditorTestLayer.fileName = "scenetest/UIComponentTest/UIComponentTest.json" + SceneEditorTestLayer.rootNode = node + self:defaultPlay() + end + + return node +end + +function UIComponentTest:defaultPlay() + if SceneEditorTestLayer.rootNode ~= nil then + local render = SceneEditorTestLayer.rootNode:getChildByTag(10025):getComponent("GUIComponent") local widget = render:getNode() local button = widget:getChildByName("Button_156") local function onTouch(sender, eventType) if eventType == ccui.TouchEventType.began then - local blowFish = node:getChildByTag(10010):getComponent("CCArmature") + local blowFish = SceneEditorTestLayer.rootNode:getChildByTag(10010):getComponent("CCArmature") blowFish:getNode():runAction(cc.MoveBy:create(10.0, cc.p(-1000.0, 0))) - local butterflyfish = node:getChildByTag(10011):getComponent("CCArmature") + local butterflyfish = SceneEditorTestLayer.rootNode:getChildByTag(10011):getComponent("CCArmature") butterflyfish:getNode():runAction(cc.MoveBy:create(10.0, cc.p(-1000.0, 0))) end end button:addTouchEventListener(onTouch) end - - return node end function UIComponentTest:onEnter() @@ -361,7 +467,18 @@ end function TmxMapComponentTest:createGameScene() local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/TmxMapComponentTest/TmxMapComponentTest.json") if nil ~= node then - local tmxMap = node:getChildByTag(10015):getComponent("CCTMXTiledMap") + SceneEditorTestLayer.fileName = "scenetest/TmxMapComponentTest/TmxMapComponentTest.json" + SceneEditorTestLayer.rootNode = node + + self:defaultPlay() + end + + return node +end + +function TmxMapComponentTest:defaultPlay() + if SceneEditorTestLayer.rootNode ~= nil then + local tmxMap = SceneEditorTestLayer.rootNode:getChildByTag(10015):getComponent("CCTMXTiledMap") local actionTo = cc.SkewTo:create(2, 0.0, 2.0) local rotateTo = cc.RotateTo:create(2, 61.0) local actionScaleTo = cc.ScaleTo:create(2, -0.44, 0.47) @@ -374,8 +491,6 @@ function TmxMapComponentTest:createGameScene() tmxMap:getNode():runAction(cc.Sequence:create(rotateTo, rotateToBack)) tmxMap:getNode():runAction(cc.Sequence:create(actionScaleTo, actionScaleToBack)) end - - return node end function TmxMapComponentTest:onEnter() @@ -421,13 +536,22 @@ end function ParticleComponentTest:createGameScene() local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/ParticleComponentTest/ParticleComponentTest.json") if nil ~= node then - local particle = node:getChildByTag(10020):getComponent("CCParticleSystemQuad") + SceneEditorTestLayer.fileName = "scenetest/ParticleComponentTest/ParticleComponentTest.json" + SceneEditorTestLayer.rootNode = node + + self:defaultPlay() + end + + return node +end + +function ParticleComponentTest:defaultPlay() + if SceneEditorTestLayer.rootNode ~= nil then + local particle = SceneEditorTestLayer.rootNode:getChildByTag(10020):getComponent("CCParticleSystemQuad") local jump = cc.JumpBy:create(5, cc.p(-500,0), 50, 4) local action = cc.Sequence:create( jump, jump:reverse()) particle:getNode():runAction(action) end - - return node end function ParticleComponentTest:onEnter() @@ -473,13 +597,24 @@ end function EffectComponentTest:createGameScene() local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/EffectComponentTest/EffectComponentTest.json") if nil ~= node then - local render = node:getChildByTag(10015):getComponent("CCArmature") + SceneEditorTestLayer.fileName = "scenetest/EffectComponentTest/EffectComponentTest.json" + SceneEditorTestLayer.rootNode = node + + self:defaultPlay() + end + + return node +end + +function EffectComponentTest:defaultPlay() + if SceneEditorTestLayer.rootNode ~= nil then + local render = SceneEditorTestLayer.rootNode:getChildByTag(10015):getComponent("CCArmature") local armature = render:getNode() local function animationEvent(armatureBack,movementType,movementID) local id = movementID if movementType == ccs.MovementEventType.loopComplete then if id == "Fire" then - local audio = node:getChildByTag(10015):getComponent("CCComAudio") + local audio = SceneEditorTestLayer.rootNode:getChildByTag(10015):getComponent("CCComAudio") audio:playEffect() end end @@ -487,8 +622,6 @@ function EffectComponentTest:createGameScene() armature:getAnimation():setMovementEventCallFunc(animationEvent) end - - return node end function EffectComponentTest:onEnter() @@ -534,13 +667,22 @@ end function BackgroundComponentTest:createGameScene() local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/BackgroundComponentTest/BackgroundComponentTest.json") if nil ~= node then - local audio = node:getComponent("CCBackgroundAudio") - audio:playBackgroundMusic() + SceneEditorTestLayer.fileName = "scenetest/BackgroundComponentTest/BackgroundComponentTest.json" + SceneEditorTestLayer.rootNode = node + + self:defaultPlay() end return node end +function BackgroundComponentTest:defaultPlay() + if SceneEditorTestLayer.rootNode ~= nil then + local audio = SceneEditorTestLayer.rootNode:getComponent("CCBackgroundAudio") + audio:playBackgroundMusic() + end +end + function BackgroundComponentTest:onEnter() self:createMenu() self:createTitle() @@ -583,11 +725,21 @@ end function AttributeComponentTest:createGameScene() local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/AttributeComponentTest/AttributeComponentTest.json") - local attribute = node:getChildByTag(10015):getComponent("CCComAttribute") - print(string.format("Name: %s, HP: %f, MP: %f", attribute:getString("name"), attribute:getFloat("maxHP"), attribute:getFloat("maxMP"))) + if nil ~= node then + SceneEditorTestLayer.fileName = "scenetest/AttributeComponentTest/AttributeComponentTest.json" + SceneEditorTestLayer.rootNode = node + self:defaultPlay() + end return node end +function AttributeComponentTest:defaultPlay() + if SceneEditorTestLayer.rootNode ~= nil then + local attribute = SceneEditorTestLayer.rootNode:getChildByTag(10015):getComponent("CCComAttribute") + print(string.format("Name: %s, HP: %f, MP: %f", attribute:getString("name"), attribute:getFloat("maxHP"), attribute:getFloat("maxMP"))) + end +end + function AttributeComponentTest:onEnter() self:createMenu() self:createTitle() @@ -631,7 +783,12 @@ end function TriggerTest:createGameScene() local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/TriggerTest/TriggerTest.json") + if nil ~= node then + SceneEditorTestLayer.fileName = "scenetest/TriggerTest/TriggerTest.json" + SceneEditorTestLayer.rootNode = node + self:defaultPlay() + end return node end @@ -658,6 +815,17 @@ function TriggerTest:onEnter() local root = self:createGameScene() if nil ~= root then self:addChild(root, 0, 1) + local function onTouchEvent(touch, event) + if eventType == "began" then + return self:onTouchBegan(touch, event) + elseif eventType == "moved" then + self:onTouchMoved(touch, event) + elseif eventType == "ended" then + self:onTouchEnded(touch, event) + elseif eventType == "cancelled" then + self:onTouchCancelled(touch, event) + end + end self._touchListener = nil local listener = cc.EventListenerTouchOneByOne:create() listener:setSwallowTouches(true) @@ -668,20 +836,27 @@ function TriggerTest:onEnter() local eventDispatcher = self:getEventDispatcher() eventDispatcher:addEventListenerWithSceneGraphPriority(listener, self) self._touchListener = listener + + self:unscheduleUpdate() local function update(dt) ccs.sendTriggerEvent(triggerEventDef.TRIGGEREVENT_UPDATESCENE) end self:scheduleUpdateWithPriorityLua(update,0) + ccs.sendTriggerEvent(triggerEventDef.TRIGGEREVENT_ENTERSCENE) - end - + end +end + +function TriggerTest:defaultPlay() + end function TriggerTest:onExit() - ccs.sendTriggerEvent(triggerEventDef.TRIGGEREVENT_LEAVESCENE) self:unscheduleUpdate() + ccs.sendTriggerEvent(triggerEventDef.TRIGGEREVENT_LEAVESCENE) local dispatcher = self:getEventDispatcher() dispatcher:removeEventListener(self._touchListener) + self._touchListener = nil ccs.TriggerMng.destroyInstance() ccs.ArmatureDataManager:destroyInstance() ccs.SceneReader:destroyInstance() diff --git a/tests/lua-tests/src/ExtensionTest/ExtensionTest.lua b/tests/lua-tests/src/ExtensionTest/ExtensionTest.lua index 22cf4fad6a..d0b5b72def 100644 --- a/tests/lua-tests/src/ExtensionTest/ExtensionTest.lua +++ b/tests/lua-tests/src/ExtensionTest/ExtensionTest.lua @@ -1,6 +1,5 @@ require "src/ExtensionTest/CocosBuilderTest" require "src/ExtensionTest/WebProxyTest" -require "src/ExtensionTest/SceneEditorTest" local LINE_SPACE = 40 local kItemTagBasic = 1000 @@ -14,8 +13,7 @@ local ExtensionTestEnum = TEST_EDITBOX = 4, TEST_TABLEVIEW = 5, TEST_SCROLLVIEW = 6, - TEST_STUDIOSCENE = 7, - TEST_MAX_COUNT = 8, + TEST_MAX_COUNT = 7, } local testsName = @@ -27,7 +25,6 @@ local testsName = "EditBoxTest", "TableViewTest", "ScrollViewTest", - "CocoStudioSceneTest", } @@ -1190,7 +1187,6 @@ local CreateExtensionsTestTable = runEditBoxTest, runTableViewTest, runScrollViewTest, - runStudioSceneTest, } diff --git a/tests/lua-tests/src/ExtensionTest/SceneEditorTest.lua b/tests/lua-tests/src/ExtensionTest/SceneEditorTest.lua deleted file mode 100644 index 625db70527..0000000000 --- a/tests/lua-tests/src/ExtensionTest/SceneEditorTest.lua +++ /dev/null @@ -1,270 +0,0 @@ -require "CCBReaderLoad" - -function SceneEditorTestLayer(filename) - - local layer = cc.Layer:create() - local isCsbLoad = false; - local loadtypeStr = {"change to load \nwith binary file","change to load \nwith json file"} - local loadtypelb = cc.Label:createWithSystemFont(loadtypeStr[1], "Arial", 12); - local filePath = filename - layer.rootNode = nil - function layer:defaultPlay()end - - local loadFileChangeHelper = function(filename) - if filename ~= nil then - if isCsbLoad then - return filename .. ".csb" - else - return filename .. ".json" - end - end - - return filename - end - - local changeLoadTypeCallback = function(sender) - isCsbLoad = not isCsbLoad - loadtypelb:setString(loadtypeStr[isCsbLoad == false and 1 or 2]) - local file = loadFileChangeHelper(filePath) - - if layer.rootNode ~= nil then - layer:removeChild(layer.rootNode) - layer.rootNode = SceneReader:getInstance():createNodeWithSceneFile(file) - layer:addChild(layer.rootNode, 0, 1) - layer:defaultPlay() - end - end - - function layer:enter() - layer.rootNode = SceneReader:getInstance():createNodeWithSceneFile(loadFileChangeHelper(filePath)) - layer:addChild(layer.rootNode, 0, 1) - layer:defaultPlay() - end - - function layer:exit() - ccs.ArmatureDataManager:destroyInstance() - ccs.SceneReader:destroyInstance() - ccs.ActionManagerEx:destroyInstance() - ccs.GUIReader:destroyInstance() - end - - local function onNodeEvent(event) - if "enter" == event then - layer:enter() - elseif "exit" == event then - layer:exit() - end - end - layer:registerScriptHandler(onNodeEvent) - - local itemlb = cc.MenuItemLabel:create(loadtypelb) - itemlb:registerScriptTapHandler(changeLoadTypeCallback) - local loadtypemenu = cc.Menu:create(itemlb) - loadtypemenu:setPosition(cc.p(VisibleRect:rightTop().x -50,VisibleRect:rightTop().y -20)); - layer:addChild(loadtypemenu,100); - - Helper.initWithLayer(layer) - Helper.titleLabel:setString("SceneReader Test LoadSceneEditorFile") - return layer -end - -function LoadSceneEdtiorFileTest() - local layer = SceneEditorTestLayer("scenetest/LoadSceneEdtiorFileTest/FishJoy2") - Helper.titleLabel:setString("loadSceneEdtiorFile Test") - - return layer -end - -function SpriteComponentTest() - local layer = SceneEditorTestLayer("scenetest/SpriteComponentTest/SpriteComponentTest") - Helper.titleLabel:setString("Sprite Component Test") - - function layer:defaultPlay() - layer.rootNode:getChildByTag(10003):getComponent("CCSprite"):getNode():runAction(cc.Blink:create(2, 10)); - layer.rootNode:getChildByTag(10004):getComponent("CCSprite"):getNode():runAction(cc.Blink:create(2, 5)); - end - - return layer -end - -function ArmatureComponentTest() - local layer = SceneEditorTestLayer("scenetest/ArmatureComponentTest/ArmatureComponentTest") - Helper.titleLabel:setString("Armature Component Test") - - function layer:defaultPlay() - layer.rootNode:getChildByTag(10007):getComponent("CCArmature"):getNode():runAction(cc.MoveBy:create(10.0, cc.p(-1000.0, 0))) - layer.rootNode:getChildByTag(10008):getComponent("CCArmature"):getNode():runAction(cc.MoveBy:create(10.0, cc.p(-1000.0, 0))) - end - - return layer -end - -function UIComponentTest() - local layer = SceneEditorTestLayer("scenetest/UIComponentTest/UIComponentTest") - Helper.titleLabel:setString("UI Component Test") - - local function touchEvent(sender,eventType) - if eventType == ccui.TouchEventType.began then - layer.rootNode:getChildByTag(10010):getComponent("CCArmature"):getNode():runAction(cc.MoveBy:create(10.0, cc.p(-1000.0, 0))) - layer.rootNode:getChildByTag(10011):getComponent("CCArmature"):getNode():runAction(cc.MoveBy:create(10.0, cc.p(-1000.0, 0))) - end - end - - function layer:defaultPlay() - local render = layer.rootNode:getChildByTag(10025):getComponent("GUIComponent") - local widget = render:getNode() - local button = widget:getChildByName("Button_156") - button:addTouchEventListener(touchEvent) - end - - return layer -end - -function TmxMapComponentTest() - local layer = SceneEditorTestLayer("scenetest/TmxMapComponentTest/TmxMapComponentTest") - Helper.titleLabel:setString("TmxMap Component Test") - - function layer:defaultPlay() - local render = layer.rootNode:getChildByTag(10015):getComponent("CCTMXTiledMap") - - local skewTo = cc.SkewTo:create(2, 0, 2); - local rotateTo = cc.RotateTo:create(2, 61); - local scaleTo = cc.ScaleTo:create(2, -0.44, 0.47); - local scaleBack = cc.ScaleTo:create(2, 1, 1); - local rotateBack = cc.RotateTo:create(2, 0); - local skewBack = cc.SkewTo:create(2, 0, 0); - render:getNode():runAction(cc.Sequence:create(skewTo, skewBack)); - render:getNode():runAction(cc.Sequence:create(rotateTo, rotateBack)); - render:getNode():runAction(cc.Sequence:create(scaleTo, scaleBack)); - end - - return layer -end - -function ParticleComponentTest() - local layer = SceneEditorTestLayer("scenetest/ParticleComponentTest/ParticleComponentTest") - Helper.titleLabel:setString("Particle Component Test") - - function layer:defaultPlay() - local render = layer.rootNode:getChildByTag(10020):getComponent("CCParticleSystemQuad") - - local action = cc.JumpBy:create(5, cc.p(-500,0), 50, 4); - render:getNode():runAction(cc.Sequence:create(action, action:reverse())) - end - - return layer -end - -function EffectComponentTest() - local layer = SceneEditorTestLayer("scenetest/EffectComponentTest/EffectComponentTest") - Helper.titleLabel:setString("Effect Component Test") - - local animationEvent = function(armature,movementType,movementID) - if movementType == ccs.MovementEventType.loopComplete then - if movementID == "Fire" then - layer.rootNode:getChildByTag(10015):getComponent("CCComAudio"):playEffect() - end - end - end - - function layer:defaultPlay() - local render = layer.rootNode:getChildByTag(10015):getComponent("CCArmature") - - render:getNode():getAnimation():setMovementEventCallFunc(animationEvent); - end - - return layer -end - -function BackgroundComponentTest() - local layer = SceneEditorTestLayer("scenetest/BackgroundComponentTest/BackgroundComponentTest") - Helper.titleLabel:setString("Background Component Test") - - function layer:defaultPlay() - layer.rootNode:getComponent("CCBackgroundAudio"):playBackgroundMusic(); - end - - return layer -end - -function AttributeComponentTest() - local layer = SceneEditorTestLayer("scenetest/AttributeComponentTest/AttributeComponentTest") - Helper.titleLabel:setString("Attribute Component Test") - - function layer:defaultPlay() - local attribute = layer.rootNode:getChildByTag(10015):getComponent("CCComAttribute") - cclog("Name: " .. attribute:getString("name") .. ", HP: " .. attribute:getFloat("maxHP") .. ", MP: " .. attribute:getFloat("maxMP")) - end - - return layer -end - -function TriggerTest() - local layer = SceneEditorTestLayer("scenetest/TriggerTest/TriggerTest") - Helper.titleLabel:setString("Trigger Test") - - local function onTouchBegan(touch, event) - ccs.sendTriggerEvent(triggerEventDef.TRIGGEREVENT_TOUCHBEGAN) - end - local function onTouchMoved(touch, event) - ccs.sendTriggerEvent(triggerEventDef.TRIGGEREVENT_TOUCHMOVED) - end - local function onTouchEnded(touch, event) - ccs.sendTriggerEvent(triggerEventDef.TRIGGEREVENT_TOUCHENDED) - end - local function onTouchCancelled(touch, event) - ccs.sendTriggerEvent(triggerEventDef.TRIGGEREVENT_TOUCHCANCELLED) - end - - - local touchListener = cc.EventListenerTouchOneByOne:create() - touchListener:setSwallowTouches(true) - touchListener:registerScriptHandler(onTouchBegan, cc.Handler.EVENT_TOUCH_BEGAN) - touchListener:registerScriptHandler(onTouchMoved, cc.Handler.EVENT_TOUCH_MOVED) - touchListener:registerScriptHandler(onTouchEnded, cc.Handler.EVENT_TOUCH_ENDED) - touchListener:registerScriptHandler(onTouchCancelled, cc.Handler.EVENT_TOUCH_CANCELLED) - local eventDispatcher = layer:getEventDispatcher() - eventDispatcher:addEventListenerWithFixedPriority(touchListener, 1) - - - local function gameLogic(dt) - ccs.sendTriggerEvent(triggerEventDef.TRIGGEREVENT_UPDATESCENE) - end - - local layerExit = layer.exit - function layer:exit() - ccs.sendTriggerEvent(triggerEventDef.TRIGGEREVENT_LEAVESCENE) - layer:unschedule(gameLogic) - eventDispatcher:removeEventListener(touchListener) - layerExit(layer) - end - - schedule(layer,gameLogic) - - function layer:defaultPlay() - ccs.sendTriggerEvent(triggerEventDef.TRIGGEREVENT_ENTERSCENE); - end - - return layer -end - -function runStudioSceneTest() - local scene = cc.Scene:create() - - Helper.createFunctionTable = { - LoadSceneEdtiorFileTest, - SpriteComponentTest, - ArmatureComponentTest, - UIComponentTest, - TmxMapComponentTest, - ParticleComponentTest, - EffectComponentTest, - BackgroundComponentTest, - AttributeComponentTest, - TriggerTest, - } - - scene:addChild(Helper.createFunctionTable[1]()) - scene:addChild(CreateBackMenuItem()) - return scene -end From 52596dc97f9cc7a8b17d9e6f934a61bf5a6f80bf Mon Sep 17 00:00:00 2001 From: andyque Date: Tue, 15 Jul 2014 11:46:53 +0800 Subject: [PATCH 08/19] fix Text line wrap issue --- cocos/ui/UIText.cpp | 1 - cocos/ui/UIWidget.h | 18 +++++++----------- .../UITextTest/UITextTest.cpp | 17 ++++++++++++++++- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/cocos/ui/UIText.cpp b/cocos/ui/UIText.cpp index e0d0f1ae38..2a0cd717b8 100644 --- a/cocos/ui/UIText.cpp +++ b/cocos/ui/UIText.cpp @@ -296,7 +296,6 @@ void Text::labelScaleChangedWithSize() { if (_ignoreSize) { - _labelRenderer->setDimensions(0,0); _labelRenderer->setScale(1.0f); _normalScaleValueX = _normalScaleValueY = 1.0f; } diff --git a/cocos/ui/UIWidget.h b/cocos/ui/UIWidget.h index 935d6f8628..ecb8c375c4 100644 --- a/cocos/ui/UIWidget.h +++ b/cocos/ui/UIWidget.h @@ -456,16 +456,18 @@ public: /** - * Ignore the widget size * - * @param ignore, true that widget will ignore it's size, use texture size, false otherwise. Default value is true. + * Note: when you set _ignoreSize to true, no matther you call setContentSize or not, + * the widget size is always equal to the return value of the member function getVirtualRendererSize. + * + * @param ignore, set member variabl _ignoreSize to ignore */ virtual void ignoreContentAdaptWithSize(bool ignore); /** - * Gets the widget if is ignore it's size. + * Query whether the widget ignores user deinfed content size or not * - * @param ignore, true that widget will ignore it's size, use texture size, false otherwise. Default value is true. + * @return bool */ bool isIgnoreContentAdaptWithSize() const; @@ -485,15 +487,9 @@ public: */ virtual Node* getVirtualRenderer(); -// /** -// * Gets the content size of widget. -// * -// * Content size is widget's texture size. -// */ -// virtual const Size& getContentSize() const; + virtual const Size& getVirtualRendererSize() const; - /** * Returns the "class name" of widget. diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextTest/UITextTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextTest/UITextTest.cpp index 98dcbfba44..3496c455b2 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextTest/UITextTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextTest/UITextTest.cpp @@ -40,10 +40,25 @@ bool UITextTest_LineWrap::init() _uiLayer->addChild(alert); // Create the line wrap - Text* text = Text::create("Text can line wrap","AmericanTypewriter",32); + Text* text = Text::create("TextArea Widget can line wrap","AmericanTypewriter",32); text->ignoreContentAdaptWithSize(false); text->setContentSize(Size(280, 150)); text->setTextHorizontalAlignment(TextHAlignment::CENTER); + text->setTouchScaleChangeEnabled(true); + text->setTouchEnabled(true); + text->addTouchEventListener([=](Ref* sender, Widget::TouchEventType type) + { + if (type == Widget::TouchEventType::ENDED) + { + if ((int)text->getContentSize().width == 280) + { + text->setContentSize(Size(380,100)); + }else + { + text->setContentSize(Size(280, 150)); + } + } + }); text->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f - text->getContentSize().height / 8.0f)); _uiLayer->addChild(text); From e2bbc3d54d92ca2e642b4062d6421e11cd6bcc33 Mon Sep 17 00:00:00 2001 From: minggo Date: Tue, 15 Jul 2014 11:48:55 +0800 Subject: [PATCH 09/19] [ci skip] --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index ad5c3e1d42..ed3a595aa7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -10,6 +10,7 @@ cocos2d-x-3.2 ?? [FIX] SpriteBatchNode: opacity can not work [FIX] Sprite3D: may crash on Android if playing animation and replace Scene after come from background [FIX] UIdget: opacity is wrong when replace texture + [FIX] UIText: can not wrap words automatically [FIX] UITextField: keyboard can not hide if touching space outside of keyboard [FIX] Others: don't release singleton objects correctly that are needed in the whole game, which will be treated From 15a7ab8450cc658b2affb44ae44c7815d5c3366a Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Tue, 15 Jul 2014 13:33:36 +0800 Subject: [PATCH 10/19] Update the TextureAsyncTest --- .../CocoStudioSceneTest/CocoStudioSceneTest.lua | 4 ++++ tests/lua-tests/src/Texture2dTest/Texture2dTest.lua | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/lua-tests/src/CocoStudioTest/CocoStudioSceneTest/CocoStudioSceneTest.lua b/tests/lua-tests/src/CocoStudioTest/CocoStudioSceneTest/CocoStudioSceneTest.lua index 2201ce740e..8e4e375b97 100644 --- a/tests/lua-tests/src/CocoStudioTest/CocoStudioSceneTest/CocoStudioSceneTest.lua +++ b/tests/lua-tests/src/CocoStudioTest/CocoStudioSceneTest/CocoStudioSceneTest.lua @@ -172,6 +172,10 @@ function SceneEditorTestLayer:createMenu() self.loadtypeLabel:setString(self.loadtypeStr[1]) end + if sceneEditorTestIdx == #SceneEditorTestLayer.title then + self:unscheduleUpdate() + end + SceneEditorTestLayer.fileName = self:loadFileChangeHelper(SceneEditorTestLayer.fileName) if SceneEditorTestLayer.rootNode ~= nil then diff --git a/tests/lua-tests/src/Texture2dTest/Texture2dTest.lua b/tests/lua-tests/src/Texture2dTest/Texture2dTest.lua index 1d698019d3..c54fc74691 100644 --- a/tests/lua-tests/src/Texture2dTest/Texture2dTest.lua +++ b/tests/lua-tests/src/Texture2dTest/Texture2dTest.lua @@ -1001,14 +1001,15 @@ local function TextureAsync() cc.Director:getInstance():getTextureCache():addImageAsync("Images/background.png", imageLoaded) cc.Director:getInstance():getTextureCache():addImageAsync("Images/atlastest.png", imageLoaded) cc.Director:getInstance():getTextureCache():addImageAsync("Images/grossini_dance_atlas.png",imageLoaded) + + ret:unscheduleUpdate() end - local schedulerEntry = nil local function onNodeEvent(event) if event == "enter" then - schedulerEntry = scheduler:scheduleScriptFunc(loadImages, 1.0, false) + ret:scheduleUpdateWithPriorityLua(loadImages,0) elseif event == "exit" then - scheduler:unscheduleScriptEntry(schedulerEntry) + ret:unscheduleUpdate() cc.Director:getInstance():getTextureCache():removeAllTextures() end end From d90effbe095f4a4aa6ce07629c75e31a38cce485 Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Tue, 15 Jul 2014 05:46:51 +0000 Subject: [PATCH 11/19] [AUTO][ci skip]: updating cocos2dx_files.json --- templates/cocos2dx_files.json | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/cocos2dx_files.json b/templates/cocos2dx_files.json index d34076a41e..65ddcdae71 100644 --- a/templates/cocos2dx_files.json +++ b/templates/cocos2dx_files.json @@ -4038,6 +4038,7 @@ "cocos/scripting/lua-bindings/script/Opengl.lua", "cocos/scripting/lua-bindings/script/OpenglConstants.lua", "cocos/scripting/lua-bindings/script/StudioConstants.lua", + "cocos/scripting/lua-bindings/script/bitExtend.lua", "cocos/scripting/lua-bindings/script/experimentalConstants.lua", "cocos/scripting/lua-bindings/script/extern.lua", "cocos/scripting/lua-bindings/script/json.lua", From 28dd76615919379be189ee5a1fe91484337e1a84 Mon Sep 17 00:00:00 2001 From: zhangbin Date: Tue, 15 Jul 2014 14:36:57 +0800 Subject: [PATCH 12/19] Update the reference of submodule cocos2d-console. --- tools/cocos2d-console | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/cocos2d-console b/tools/cocos2d-console index 79ba55769e..55c1733c8b 160000 --- a/tools/cocos2d-console +++ b/tools/cocos2d-console @@ -1 +1 @@ -Subproject commit 79ba55769e56d4119b0968bbbaae0ce2390e0a2a +Subproject commit 55c1733c8b522573994dae1c6787189addef8651 From 4bf6c7dc5a97c357cf443974581cc5f9f5c40b43 Mon Sep 17 00:00:00 2001 From: minggo Date: Tue, 15 Jul 2014 14:43:40 +0800 Subject: [PATCH 13/19] update release note --- docs/RELEASE_NOTES.md | 86 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 72 insertions(+), 14 deletions(-) diff --git a/docs/RELEASE_NOTES.md b/docs/RELEASE_NOTES.md index 0ebf4815cd..537b9f8161 100644 --- a/docs/RELEASE_NOTES.md +++ b/docs/RELEASE_NOTES.md @@ -1,4 +1,4 @@ -# cocos2d-x v3.2rc0 Release Notes # +# cocos2d-x v3.2 Release Notes # **Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)* @@ -114,14 +114,22 @@ Run Please refer to this document: [ReadMe](../README.md) -# Highlights of v3.2rc0 +# Highlights of v3.2 -* `fbx-conv` support generating binary format, and `Sprite3D` support it -* about 20% performance improved in `Sprite3D` -* game controller support -* fast tilemap support, it is faster for static tilemap -* physics body supports scale and rotation -* added Node::enumearteChildren(), and support c++ 11 regular expression +* `Animation3D`/`Animate3D`, new nodes for 3d animation +* `fbx-conv` supports generating binary format which is supported by `Sprite3D` +* Game controller support +* Fast tilemap support +* Added `utils::cpatureScreen` to take screenshot +* Physics body supports scale and rotation +* Added `Node::enumerateChildren` and `utils::findChildren`, and support c++ 11 regular expression +* Added `Node::setNormalizedPosition`, `Node`'s position in pixel will be calculated according its parent's content size + +# Documents + +* [Sprite3D & Animation3D](http://cocos2d-x.org/wiki/Sprite3D) +* [Game controller](http://www.cocos2d-x.org/wiki/Game_Controller) +* [How to compile shader on WP8](http://cocos2d-x.org/wiki/How_to_update_wp8_shader) # Toolchain requirement changed @@ -133,14 +141,19 @@ Please refer to this document: [ReadMe](../README.md) # Features in detail -## Sprite3d +## Sprite3D & Animation3D Sample code to use binary version ```c++ auto sprite3d = Sprite3D::create("filename.c3b"); addChild(sprite3d); + +auto animation3d = Animation3D("filename.c3b"); +auto animate3d = Animate3D::create(animation3d); +sprite3d->runAction(RepeatForEver::create(animate)); ``` +Detail information please refer to [Sprite3D & Animation3D](http://cocos2d-x.org/wiki/Sprite3D). ### `fbx-conv` usage @@ -164,19 +177,43 @@ Options: * -b: export binary format * -t: export text format -## Controller support +## Game controller Supported controller type: -* amazon tv +* Android standard controllers +* Amazon tv * OUYA * Moga * Nibiru * iOS standard controllers -In order to use controller on Android, you should refer to this Android project(`COCOS2DX_ROOT/cocos/platform/android/ControllerManualAdapter`). +Sample codes +```c++ +// register event listener +auto listener = EventListenerController::create(); +listner->onKeyDown = ... +... +eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); -Full demo please refer to `COCOS2DX_ROOT/tests/game-controler-test`. +// start connecting controller +Controller::startDiscoveryController(); + +// handler key down/ key up event +void GameControllerTest::onKeyDown(Controller *controller, int keyCode, Event *event) +{ + switch (keyCode) + { + case Controller::Key::BUTTON_A: + ... + break; + + ... + } +} +``` + +Detail information please refer to [Game controller](http://www.cocos2d-x.org/wiki/Game_Controller). ## Fast tilemap @@ -192,7 +229,7 @@ Full demo please refer to `COCOS2DX_ROOT/tests/cpp-tests/Classes/TileMapTest/Til ## Node::enumerateChildren -This functions is used to enumerate children of a `Node` recursively. It supports c++ 11 regular expression. +This functions is used to enumerate children of a `Node`. It supports c++ 11 regular expression. ```c++ // Find nodes whose name is 'nameToFind' and end with digits. @@ -200,6 +237,12 @@ node->enumerateChildren("nameToFind[[:digit:]]+", [](Node* node) -> bool { ... return false; // return true to stop at first match }); + +// Find nodes whose name is 'nameToFind' and end with digits recursively. +node->enumerateChildren("nameToFind[[:digit:]]+", [](Node* node) -> bool { + ... + return false; // return true to stop at first match +}); ``` Full test please refer to `NodeNameTest` in `COCOS2DX_ROOT/tests/cpp-tests/NodeTest/NodeTest.cpp`. @@ -215,3 +258,18 @@ auto children = utils::findChildren(node, "nameToFind"); ... ``` + +## Node::setNormalizedPosition + +Can use this function to set Node's position(x,y) using value between 0 and 1. `Can use this function when it has a parent node.` The positions in pixels is calculated like the following: + +```c++ +// pseudo code +void setNormalizedPosition(Vec2 pos) +{ + Size s = getParent()->getContentSize(); + _position = pos * s; +} +``` + +Full test please refer to `NodeNormalizedPositionTest1/2` in `tests/cpp-tests/Classes/NodeTest/NodeTest.cpp`. \ No newline at end of file From 7fab7cdd1568d3e03b2799ccf4b3ef3bc3f1849e Mon Sep 17 00:00:00 2001 From: minggo Date: Tue, 15 Jul 2014 14:46:56 +0800 Subject: [PATCH 14/19] Update RELEASE_NOTES.md --- docs/RELEASE_NOTES.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/RELEASE_NOTES.md b/docs/RELEASE_NOTES.md index 537b9f8161..58fe8d3ef1 100644 --- a/docs/RELEASE_NOTES.md +++ b/docs/RELEASE_NOTES.md @@ -2,7 +2,7 @@ **Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)* -- [cocos2d-x v3.2rc0 Release Notes](#user-content-cocos2d-x-v32rc0-release-notes) +- [cocos2d-x v3.2 Release Notes](#user-content-cocos2d-x-v32-release-notes) - [Misc Information](#user-content-misc-information) - [Requirements](#user-content-requirements) - [Runtime Requirements](#user-content-runtime-requirements) @@ -13,15 +13,17 @@ - [Windows](#user-content-windows) - [Linux](#user-content-linux) - [How to start a new game](#user-content-how-to-start-a-new-game) -- [Highlights of v3.2rc0](#user-content-highlights-of-v32rc0) +- [Highlights of v3.2](#user-content-highlights-of-v32) +- [Documents](#user-content-documents) - [Toolchain requirement changed](#user-content-toolchain-requirement-changed) - [Features in detail](#user-content-features-in-detail) - - [Sprite3d](#user-content-sprite3d) + - [Sprite3D & Animation3D](#user-content-sprite3d--animation3d) - [fbx-conv usage](#user-content-fbx-conv-usage) - - [Controller support](#user-content-controller-support) + - [Game controller](#user-content-game-controller) - [Fast tilemap](#user-content-fast-tilemap) - [Node::enumerateChildren](#user-content-nodeenumeratechildren) - [utils::findChildren](#user-content-utilsfindchildren) + - [Node::setNormalizedPosition](#user-content-nodesetnormalizedposition) # Misc Information @@ -272,4 +274,4 @@ void setNormalizedPosition(Vec2 pos) } ``` -Full test please refer to `NodeNormalizedPositionTest1/2` in `tests/cpp-tests/Classes/NodeTest/NodeTest.cpp`. \ No newline at end of file +Full test please refer to `NodeNormalizedPositionTest1/2` in `tests/cpp-tests/Classes/NodeTest/NodeTest.cpp`. From c921926528757b762e5a6f36982b4ec2c69e1616 Mon Sep 17 00:00:00 2001 From: minggo Date: Tue, 15 Jul 2014 14:48:00 +0800 Subject: [PATCH 15/19] Update RELEASE_NOTES.md --- docs/RELEASE_NOTES.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/RELEASE_NOTES.md b/docs/RELEASE_NOTES.md index 58fe8d3ef1..5c0f66fa93 100644 --- a/docs/RELEASE_NOTES.md +++ b/docs/RELEASE_NOTES.md @@ -27,9 +27,9 @@ # Misc Information -* Download: http://cdn.cocos2d-x.org/cocos2d-x-3.2rc0.zip -* Full Changelog: https://github.com/cocos2d/cocos2d-x/blob/cocos2d-x-3.2rc0/CHANGELOG -* API Reference: http://www.cocos2d-x.org/reference/native-cpp/V3.2rc0/index.html +* Download: http://cdn.cocos2d-x.org/cocos2d-x-3.2.zip +* Full Changelog: https://github.com/cocos2d/cocos2d-x/blob/cocos2d-x-3.2/CHANGELOG +* API Reference: http://www.cocos2d-x.org/reference/native-cpp/V3.2/index.html * v3.0 Release Notes can be found here: [v3.0 Release Notes](https://github.com/cocos2d/cocos2d-x/blob/cocos2d-x-3.0/docs/RELEASE_NOTES.md) # Requirements From 1dc1df0827991de13762c78b66ba3d47f65f1da0 Mon Sep 17 00:00:00 2001 From: andyque Date: Tue, 15 Jul 2014 14:57:10 +0800 Subject: [PATCH 16/19] fix Layout typo --- cocos/ui/UILayout.cpp | 16 ++++++++-------- cocos/ui/UILayout.h | 12 ++++++------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cocos/ui/UILayout.cpp b/cocos/ui/UILayout.cpp index 7064ec73d5..50074ae5ae 100644 --- a/cocos/ui/UILayout.cpp +++ b/cocos/ui/UILayout.cpp @@ -1137,7 +1137,7 @@ float Layout::calculateNearestDistance(Widget* baseWidget) return distance; } -float Layout::calculateFarestDistance(cocos2d::ui::Widget *baseWidget) +float Layout::calculateFarthestDistance(cocos2d::ui::Widget *baseWidget) { float distance = -FLT_MAX; @@ -1147,7 +1147,7 @@ float Layout::calculateFarestDistance(cocos2d::ui::Widget *baseWidget) Layout *layout = dynamic_cast(node); int length; if (layout) { - length = layout->calculateFarestDistance(baseWidget); + length = layout->calculateFarthestDistance(baseWidget); } else { @@ -1231,7 +1231,7 @@ int Layout::findNearestChildWidgetIndex(FocusDirection direction, Widget* baseWi return 0; } -int Layout::findFarestChildWidgetIndex(FocusDirection direction, cocos2d::ui::Widget *baseWidget) +int Layout::findFarthestChildWidgetIndex(FocusDirection direction, cocos2d::ui::Widget *baseWidget) { if (baseWidget == nullptr || baseWidget == this) { @@ -1256,7 +1256,7 @@ int Layout::findFarestChildWidgetIndex(FocusDirection direction, cocos2d::ui::Wi Layout *layout = dynamic_cast(w); if (layout) { - length = layout->calculateFarestDistance(baseWidget); + length = layout->calculateFarthestDistance(baseWidget); } else { @@ -1337,11 +1337,11 @@ void Layout::findProperSearchingFunctor(FocusDirection dir, Widget* baseWidget) onPassFocusToChild = CC_CALLBACK_2(Layout::findNearestChildWidgetIndex, this); } else{ - onPassFocusToChild = CC_CALLBACK_2(Layout::findFarestChildWidgetIndex, this); + onPassFocusToChild = CC_CALLBACK_2(Layout::findFarthestChildWidgetIndex, this); } }else if(dir == FocusDirection::RIGHT){ if (previousWidgetPosition.x > widgetPosition.x) { - onPassFocusToChild = CC_CALLBACK_2(Layout::findFarestChildWidgetIndex, this); + onPassFocusToChild = CC_CALLBACK_2(Layout::findFarthestChildWidgetIndex, this); } else{ onPassFocusToChild = CC_CALLBACK_2(Layout::findNearestChildWidgetIndex, this); @@ -1350,13 +1350,13 @@ void Layout::findProperSearchingFunctor(FocusDirection dir, Widget* baseWidget) if (previousWidgetPosition.y > widgetPosition.y) { onPassFocusToChild = CC_CALLBACK_2(Layout::findNearestChildWidgetIndex, this); }else{ - onPassFocusToChild = CC_CALLBACK_2(Layout::findFarestChildWidgetIndex, this); + onPassFocusToChild = CC_CALLBACK_2(Layout::findFarthestChildWidgetIndex, this); } }else if(dir == FocusDirection::UP){ if (previousWidgetPosition.y < widgetPosition.y) { onPassFocusToChild = CC_CALLBACK_2(Layout::findNearestChildWidgetIndex, this); }else{ - onPassFocusToChild = CC_CALLBACK_2(Layout::findFarestChildWidgetIndex, this); + onPassFocusToChild = CC_CALLBACK_2(Layout::findFarthestChildWidgetIndex, this); } }else{ CCASSERT(0, "invalid direction!"); diff --git a/cocos/ui/UILayout.h b/cocos/ui/UILayout.h index e2c9798d37..c6075adf8f 100644 --- a/cocos/ui/UILayout.h +++ b/cocos/ui/UILayout.h @@ -365,11 +365,11 @@ protected: /** * When the layout get focused, it the layout pass the focus to its child, it will use this method to determine which child - * will get the focus. The current algorithm to determine which child will get focus is farest-distance-priority algorithm + * will get the focus. The current algorithm to determine which child will get focus is farthest-distance-priority algorithm *@param dir next focused widget direction *@return The index of child widget in the container */ - int findFarestChildWidgetIndex(FocusDirection direction, Widget* baseWidget); + int findFarthestChildWidgetIndex(FocusDirection direction, Widget* baseWidget); /** * caculate the nearest distance between the baseWidget and the children of the layout @@ -379,15 +379,15 @@ protected: float calculateNearestDistance(Widget* baseWidget); /** - * caculate the farest distance between the baseWidget and the children of the layout + * caculate the farthest distance between the baseWidget and the children of the layout *@param the base widget which will be used to caculate the distance between the layout's children and itself - *@return return the farest distance between the baseWidget and the layout's children + *@return return the farthest distance between the baseWidget and the layout's children */ - float calculateFarestDistance(Widget* baseWidget); + float calculateFarthestDistance(Widget* baseWidget); /** - * when a layout pass the focus to it's child, use this method to determine which algorithm to use, nearest or farest distance algorithm or not + * when a layout pass the focus to it's child, use this method to determine which algorithm to use, nearest or farthest distance algorithm or not */ void findProperSearchingFunctor(FocusDirection dir, Widget* baseWidget); From 65f252785ee8b5a1ac249ce4f924b747be4886a7 Mon Sep 17 00:00:00 2001 From: minggo Date: Tue, 15 Jul 2014 15:02:23 +0800 Subject: [PATCH 17/19] [ci skip] --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index ed3a595aa7..d2f8375f6c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ cocos2d-x-3.2 ?? [FIX] Animation3D: getOrCreate is deprecated and replaced with Animation3D::create [FIX] Animate3D: setSpeed() accept negtive value, which means play reverse, getPlayback and setPlayBack are deprecated + [FIX] EditBox: can not set/get text in password mode on Mac OS X [FIX] GLView: cursor position is not correct if design resolution is different from device resolution [FIX] Label: color can not be set correctly if using system font [FIX] Lua-binding: support UIVideoPlayer From 415fcfd4abd50461858e4703b4f308873e03bc57 Mon Sep 17 00:00:00 2001 From: minggo Date: Tue, 15 Jul 2014 15:09:40 +0800 Subject: [PATCH 18/19] [ci skip] --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index 647c31718a..0db85c3f16 100644 --- a/AUTHORS +++ b/AUTHORS @@ -828,6 +828,7 @@ Developers: Added missing Text Font and Placeholder feature of EditBox for Mac platform HttpRequest uses std::function as callback EditBox: mac secure input + Fix a bug that can not get/set text in password mode on Mac OS X iSevenDays Fixed a bug that the result of 'malloc' is incompatible with type 'unsigned char *' in Image::saveImageToPNG From b2829708334eb69779ba9d558709d845833c683c Mon Sep 17 00:00:00 2001 From: minggo Date: Tue, 15 Jul 2014 15:11:17 +0800 Subject: [PATCH 19/19] [ci skip] --- cocos/cocos2d.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos/cocos2d.cpp b/cocos/cocos2d.cpp index 34b671cd8e..d96b55ce20 100644 --- a/cocos/cocos2d.cpp +++ b/cocos/cocos2d.cpp @@ -31,7 +31,7 @@ NS_CC_BEGIN const char* cocos2dVersion() { - return "cocos2d-x 3.2beta0"; + return "cocos2d-x 3.2"; } NS_CC_END