issue #1425: exist lua test case is ok.

1.fixed some bugs in some lua test case;
2.modify touch event and node event type;
3.fixed some bugs in CCParticleSystem.pkg
This commit is contained in:
wangshuai 2013-03-01 17:09:42 +08:00
parent b4e13af460
commit 8867766241
11 changed files with 213 additions and 184 deletions

View File

@ -10,6 +10,14 @@ local titleLabel = nil
local s = CCDirector:sharedDirector():getWinSize()
local scheduler = CCDirector:sharedDirector():getScheduler()
local function createSimpleMoveBy()
return CCMoveBy:create(3, CCPointMake(s.width - 130, 0))
end
local function createSimpleDelayTime()
return CCDelayTime:create(0.25)
end
local function backAction()
SceneIdx = SceneIdx - 1
if SceneIdx < 0 then
@ -126,36 +134,36 @@ end
local function SpriteEase()
local layer = getBaseLayer()
local move = CCMoveBy:create(3, CCPointMake(s.width - 130, 0))
local move = createSimpleMoveBy()
local move_back = move:reverse()
local move_ease_in = CCEaseIn:create(move:copy():autorelease(), 2.5)
local move_ease_in = CCEaseIn:create(createSimpleMoveBy(), 2.5)
local move_ease_in_back = move_ease_in:reverse()
local move_ease_out = CCEaseOut:create(move:copy():autorelease(), 2.5)
local move_ease_out = CCEaseOut:create(createSimpleMoveBy(), 2.5)
local move_ease_out_back = move_ease_out:reverse()
local delay = CCDelayTime:create(0.25)
local delay = createSimpleDelayTime()
local arr1 = CCArray:create()
arr1:addObject(move)
arr1:addObject(delay)
arr1:addObject(move_back)
arr1:addObject(delay:copy():autorelease())
arr1:addObject(createSimpleDelayTime())
local seq1 = CCSequence:create(arr1)
local arr2 = CCArray:create()
arr2:addObject(move_ease_in)
arr2:addObject(delay:copy():autorelease())
arr2:addObject(createSimpleDelayTime())
arr2:addObject(move_ease_in_back)
arr2:addObject(delay:copy():autorelease())
arr2:addObject(createSimpleDelayTime())
local seq2 = CCSequence:create(arr2)
local arr3 = CCArray:create()
arr3:addObject(move_ease_out)
arr3:addObject(delay:copy():autorelease())
arr3:addObject(createSimpleDelayTime())
arr3:addObject(move_ease_out_back)
arr3:addObject(delay:copy():autorelease())
arr3:addObject(createSimpleDelayTime())
local seq3 = CCSequence:create(arr3)
local a2 = grossini:runAction(CCRepeatForever:create(seq1))
@ -177,38 +185,38 @@ end
local function SpriteEaseInOut()
local layer = getBaseLayer()
local move = CCMoveBy:create(3, CCPointMake(s.width - 130, 0))
local move = createSimpleMoveBy()
local move_ease_inout1 = CCEaseInOut:create(move:copy():autorelease(), 0.65)
local move_ease_inout1 = CCEaseInOut:create(createSimpleMoveBy(), 0.65)
local move_ease_inout_back1 = move_ease_inout1:reverse()
local move_ease_inout2 = CCEaseInOut:create(move:copy():autorelease(), 1.35)
local move_ease_inout2 = CCEaseInOut:create(createSimpleMoveBy(), 1.35)
local move_ease_inout_back2 = move_ease_inout2:reverse()
local move_ease_inout3 = CCEaseInOut:create(move:copy():autorelease(), 1.0)
local move_ease_inout3 = CCEaseInOut:create(createSimpleMoveBy(), 1.0)
local move_ease_inout_back3 = move_ease_inout3:reverse()
local delay = CCDelayTime:create(0.25)
local delay = createSimpleDelayTime()
local arr1 = CCArray:create()
arr1:addObject(move_ease_inout1)
arr1:addObject(delay)
arr1:addObject(move_ease_inout_back1)
arr1:addObject(delay:copy():autorelease())
arr1:addObject(createSimpleDelayTime())
local seq1 = CCSequence:create(arr1)
local arr2 = CCArray:create()
arr2:addObject(move_ease_inout2)
arr2:addObject(delay:copy():autorelease())
arr2:addObject(createSimpleDelayTime())
arr2:addObject(move_ease_inout_back2)
arr2:addObject(delay:copy():autorelease())
arr2:addObject(createSimpleDelayTime())
local seq2 = CCSequence:create(arr2)
local arr3 = CCArray:create()
arr3:addObject(move_ease_inout3)
arr3:addObject(delay:copy():autorelease())
arr3:addObject(createSimpleDelayTime())
arr3:addObject(move_ease_inout_back3)
arr3:addObject(delay:copy():autorelease())
arr3:addObject(createSimpleDelayTime())
local seq3 = CCSequence:create(arr3)
tamara:runAction(CCRepeatForever:create(seq1))
@ -225,36 +233,41 @@ end
local function SpriteEaseExponential()
local layer = getBaseLayer()
local move = CCMoveBy:create(3, CCPointMake(s.width - 130, 0))
local move = createSimpleMoveBy()
local move_back = move:reverse()
local move_ease_in = CCEaseExponentialIn:create(move:copy():autorelease())
local move_ease_in = CCEaseExponentialIn:create(createSimpleMoveBy())
local move_ease_in_back = move_ease_in:reverse()
local move_ease_out = CCEaseExponentialOut:create(move:copy():autorelease())
local move_ease_out = CCEaseExponentialOut:create(createSimpleMoveBy())
local move_ease_out_back = move_ease_out:reverse()
local delay = CCDelayTime:create(0.25)
local delay = createSimpleDelayTime()
local arr1 = CCArray:create()
arr1:addObject(move)
arr1:addObject(delay)
arr1:addObject(move_back)
arr1:addObject(delay:copy():autorelease())
arr1:addObject(createSimpleDelayTime())
local seq1 = CCSequence:create(arr1)
local arr2 = CCArray:create()
arr2:addObject(move_ease_in)
arr2:addObject(delay:copy():autorelease())
arr2:addObject(createSimpleDelayTime())
arr2:addObject(move_ease_in_back)
arr2:addObject(delay:copy():autorelease())
arr2:addObject(createSimpleDelayTime())
local seq2 = CCSequence:create(arr2)
local arr3 = CCArray:create()
arr3:addObject(move_ease_out)
arr3:addObject(delay:copy():autorelease())
arr3:addObject(createSimpleDelayTime())
arr3:addObject(move_ease_out_back)
arr3:addObject(delay:copy():autorelease())
arr3:addObject(createSimpleDelayTime())
local seq3 = CCSequence:create(arr3)
grossini:runAction(CCRepeatForever:create(seq1))
@ -271,26 +284,29 @@ end
local function SpriteEaseExponentialInOut()
local layer = getBaseLayer()
local move = CCMoveBy:create(3, CCPointMake(s.width - 130, 0))
local move = createSimpleMoveBy()
local move_back = move:reverse()
local move_ease = CCEaseExponentialInOut:create(move:copy():autorelease())
local move_ease = CCEaseExponentialInOut:create(createSimpleMoveBy())
local move_ease_back = move_ease:reverse()
local delay = CCDelayTime:create(0.25)
local delay = createSimpleDelayTime()
local arr1 = CCArray:create()
arr1:addObject(move)
arr1:addObject(delay)
arr1:addObject(move_back)
arr1:addObject(delay:copy():autorelease())
arr1:addObject(createSimpleDelayTime())
local seq1 = CCSequence:create(arr1)
local arr2 = CCArray:create()
arr2:addObject(move_ease)
arr2:addObject(delay:copy():autorelease())
arr2:addObject(createSimpleDelayTime())
arr2:addObject(move_ease_back)
arr2:addObject(delay:copy():autorelease())
arr2:addObject(createSimpleDelayTime())
local seq2 = CCSequence:create(arr2)
positionForTwo()
@ -308,36 +324,36 @@ end
local function SpriteEaseSine()
local layer = getBaseLayer()
local move = CCMoveBy:create(3, CCPointMake(s.width - 130, 0))
local move = createSimpleMoveBy()
local move_back = move:reverse()
local move_ease_in = CCEaseSineIn:create(move:copy():autorelease())
local move_ease_in = CCEaseSineIn:create(createSimpleMoveBy())
local move_ease_in_back = move_ease_in:reverse()
local move_ease_out = CCEaseSineOut:create(move:copy():autorelease())
local move_ease_out = CCEaseSineOut:create(createSimpleMoveBy())
local move_ease_out_back = move_ease_out:reverse()
local delay = CCDelayTime:create(0.25)
local delay = createSimpleDelayTime()
local arr1 = CCArray:create()
arr1:addObject(move)
arr1:addObject(delay)
arr1:addObject(move_back)
arr1:addObject(delay:copy():autorelease())
arr1:addObject(createSimpleDelayTime())
local seq1 = CCSequence:create(arr1)
local arr2 = CCArray:create()
arr2:addObject(move_ease_in)
arr2:addObject(delay:copy():autorelease())
arr2:addObject(createSimpleDelayTime())
arr2:addObject(move_ease_in_back)
arr2:addObject(delay:copy():autorelease())
arr2:addObject(createSimpleDelayTime())
local seq2 = CCSequence:create(arr2)
local arr3 = CCArray:create()
arr3:addObject(move_ease_out)
arr3:addObject(delay:copy():autorelease())
arr3:addObject(createSimpleDelayTime())
arr3:addObject(move_ease_out_back)
arr3:addObject(delay:copy():autorelease())
arr3:addObject(createSimpleDelayTime())
local seq3 = CCSequence:create(arr3)
grossini:runAction(CCRepeatForever:create(seq1))
@ -354,26 +370,26 @@ end
local function SpriteEaseSineInOut()
local layer = getBaseLayer()
local move = CCMoveBy:create(3, CCPointMake(s.width - 130, 0))
local move = createSimpleMoveBy()
local move_back = move:reverse()
local move_ease = CCEaseSineInOut:create(move:copy():autorelease())
local move_ease = CCEaseSineInOut:create(createSimpleMoveBy())
local move_ease_back = move_ease:reverse()
local delay = CCDelayTime:create(0.25)
local delay = createSimpleDelayTime()
local arr1 = CCArray:create()
arr1:addObject(move)
arr1:addObject(delay)
arr1:addObject(move_back)
arr1:addObject(delay:copy():autorelease())
arr1:addObject(createSimpleDelayTime())
local seq1 = CCSequence:create(arr1)
local arr2 = CCArray:create()
arr2:addObject(move_ease)
arr2:addObject(delay:copy():autorelease())
arr2:addObject(createSimpleDelayTime())
arr2:addObject(move_ease_back)
arr2:addObject(delay:copy():autorelease())
arr2:addObject(createSimpleDelayTime())
local seq2 = CCSequence:create(arr2)
positionForTwo()
@ -391,36 +407,36 @@ end
local function SpriteEaseElastic()
local layer = getBaseLayer()
local move = CCMoveBy:create(3, CCPointMake(s.width - 130, 0))
local move = createSimpleMoveBy()
local move_back = move:reverse()
local move_ease_in = CCEaseElasticIn:create(move:copy():autorelease())
local move_ease_in = CCEaseElasticIn:create(createSimpleMoveBy())
local move_ease_in_back = move_ease_in:reverse()
local move_ease_out = CCEaseElasticOut:create(move:copy():autorelease())
local move_ease_out = CCEaseElasticOut:create(createSimpleMoveBy())
local move_ease_out_back = move_ease_out:reverse()
local delay = CCDelayTime:create(0.25)
local delay = createSimpleDelayTime()
local arr1 = CCArray:create()
arr1:addObject(move)
arr1:addObject(delay)
arr1:addObject(move_back)
arr1:addObject(delay:copy():autorelease())
arr1:addObject(createSimpleDelayTime())
local seq1 = CCSequence:create(arr1)
local arr2 = CCArray:create()
arr2:addObject(move_ease_in)
arr2:addObject(delay:copy():autorelease())
arr2:addObject(createSimpleDelayTime())
arr2:addObject(move_ease_in_back)
arr2:addObject(delay:copy():autorelease())
arr2:addObject(createSimpleDelayTime())
local seq2 = CCSequence:create(arr2)
local arr3 = CCArray:create()
arr3:addObject(move_ease_out)
arr3:addObject(delay:copy():autorelease())
arr3:addObject(createSimpleDelayTime())
arr3:addObject(move_ease_out_back)
arr3:addObject(delay:copy():autorelease())
arr3:addObject(createSimpleDelayTime())
local seq3 = CCSequence:create(arr3)
grossini:runAction(CCRepeatForever:create(seq1))
@ -437,38 +453,38 @@ end
local function SpriteEaseElasticInOut()
local layer = getBaseLayer()
local move = CCMoveBy:create(3, CCPointMake(s.width - 130, 0))
local move = createSimpleMoveBy()
local move_ease_inout1 = CCEaseElasticInOut:create(move:copy():autorelease(), 0.3)
local move_ease_inout1 = CCEaseElasticInOut:create(createSimpleMoveBy(), 0.3)
local move_ease_inout_back1 = move_ease_inout1:reverse()
local move_ease_inout2 = CCEaseElasticInOut:create(move:copy():autorelease(), 0.45)
local move_ease_inout2 = CCEaseElasticInOut:create(createSimpleMoveBy(), 0.45)
local move_ease_inout_back2 = move_ease_inout2:reverse()
local move_ease_inout3 = CCEaseElasticInOut:create(move:copy():autorelease(), 0.6)
local move_ease_inout3 = CCEaseElasticInOut:create(createSimpleMoveBy(), 0.6)
local move_ease_inout_back3 = move_ease_inout3:reverse()
local delay = CCDelayTime:create(0.25)
local delay = createSimpleDelayTime()
local arr1 = CCArray:create()
arr1:addObject(move_ease_inout1)
arr1:addObject(delay)
arr1:addObject(move_ease_inout_back1)
arr1:addObject(delay:copy():autorelease())
arr1:addObject(createSimpleDelayTime())
local seq1 = CCSequence:create(arr1)
local arr2 = CCArray:create()
arr2:addObject(move_ease_inout2)
arr2:addObject(delay:copy():autorelease())
arr2:addObject(createSimpleDelayTime())
arr2:addObject(move_ease_inout_back2)
arr2:addObject(delay:copy():autorelease())
arr2:addObject(createSimpleDelayTime())
local seq2 = CCSequence:create(arr2)
local arr3 = CCArray:create()
arr3:addObject(move_ease_inout3)
arr3:addObject(delay:copy():autorelease())
arr3:addObject(createSimpleDelayTime())
arr3:addObject(move_ease_inout_back3)
arr3:addObject(delay:copy():autorelease())
arr3:addObject(createSimpleDelayTime())
local seq3 = CCSequence:create(arr3)
tamara:runAction(CCRepeatForever:create(seq1))
@ -485,36 +501,36 @@ end
local function SpriteEaseBounce()
local layer = getBaseLayer()
local move = CCMoveBy:create(3, CCPointMake(s.width - 130, 0))
local move = createSimpleMoveBy()
local move_back = move:reverse()
local move_ease_in = CCEaseBounceIn:create(move:copy():autorelease())
local move_ease_in = CCEaseBounceIn:create(createSimpleMoveBy())
local move_ease_in_back = move_ease_in:reverse()
local move_ease_out = CCEaseBounceOut:create(move:copy():autorelease())
local move_ease_out = CCEaseBounceOut:create(createSimpleMoveBy())
local move_ease_out_back = move_ease_out:reverse()
local delay = CCDelayTime:create(0.25)
local delay = createSimpleDelayTime()
local arr1 = CCArray:create()
arr1:addObject(move)
arr1:addObject(delay)
arr1:addObject(move_back)
arr1:addObject(delay:copy():autorelease())
arr1:addObject(createSimpleDelayTime())
local seq1 = CCSequence:create(arr1)
local arr2 = CCArray:create()
arr2:addObject(move_ease_in)
arr2:addObject(delay:copy():autorelease())
arr2:addObject(createSimpleDelayTime())
arr2:addObject(move_ease_in_back)
arr2:addObject(delay:copy():autorelease())
arr2:addObject(createSimpleDelayTime())
local seq2 = CCSequence:create(arr2)
local arr3 = CCArray:create()
arr3:addObject(move_ease_out)
arr3:addObject(delay:copy():autorelease())
arr3:addObject(createSimpleDelayTime())
arr3:addObject(move_ease_out_back)
arr3:addObject(delay:copy():autorelease())
arr3:addObject(createSimpleDelayTime())
local seq3 = CCSequence:create(arr3)
grossini:runAction(CCRepeatForever:create(seq1))
@ -531,26 +547,26 @@ end
local function SpriteEaseBounceInOut()
local layer = getBaseLayer()
local move = CCMoveBy:create(3, CCPointMake(s.width - 130, 0))
local move = createSimpleMoveBy()
local move_back = move:reverse()
local move_ease = CCEaseBounceInOut:create(move:copy():autorelease())
local move_ease = CCEaseBounceInOut:create(createSimpleMoveBy())
local move_ease_back = move_ease:reverse()
local delay = CCDelayTime:create(0.25)
local delay = createSimpleDelayTime()
local arr1 = CCArray:create()
arr1:addObject(move)
arr1:addObject(delay)
arr1:addObject(move_back)
arr1:addObject(delay:copy():autorelease())
arr1:addObject(createSimpleDelayTime())
local seq1 = CCSequence:create(arr1)
local arr2 = CCArray:create()
arr2:addObject(move_ease)
arr2:addObject(delay:copy():autorelease())
arr2:addObject(createSimpleDelayTime())
arr2:addObject(move_ease_back)
arr2:addObject(delay:copy():autorelease())
arr2:addObject(createSimpleDelayTime())
local seq2 = CCSequence:create(arr2)
positionForTwo()
@ -568,36 +584,36 @@ end
local function SpriteEaseBack()
local layer = getBaseLayer()
local move = CCMoveBy:create(3, CCPointMake(s.width - 130, 0))
local move = createSimpleMoveBy()
local move_back = move:reverse()
local move_ease_in = CCEaseBackIn:create(move:copy():autorelease())
local move_ease_in = CCEaseBackIn:create(createSimpleMoveBy())
local move_ease_in_back = move_ease_in:reverse()
local move_ease_out = CCEaseBackOut:create(move:copy():autorelease())
local move_ease_out = CCEaseBackOut:create(createSimpleMoveBy())
local move_ease_out_back = move_ease_out:reverse()
local delay = CCDelayTime:create(0.25)
local delay = createSimpleDelayTime()
local arr1 = CCArray:create()
arr1:addObject(move)
arr1:addObject(delay)
arr1:addObject(move_back)
arr1:addObject(delay:copy():autorelease())
arr1:addObject(createSimpleDelayTime())
local seq1 = CCSequence:create(arr1)
local arr2 = CCArray:create()
arr2:addObject(move_ease_in)
arr2:addObject(delay:copy():autorelease())
arr2:addObject(createSimpleDelayTime())
arr2:addObject(move_ease_in_back)
arr2:addObject(delay:copy():autorelease())
arr2:addObject(createSimpleDelayTime())
local seq2 = CCSequence:create(arr2)
local arr3 = CCArray:create()
arr3:addObject(move_ease_out)
arr3:addObject(delay:copy():autorelease())
arr3:addObject(createSimpleDelayTime())
arr3:addObject(move_ease_out_back)
arr3:addObject(delay:copy():autorelease())
arr3:addObject(createSimpleDelayTime())
local seq3 = CCSequence:create(arr3)
grossini:runAction(CCRepeatForever:create(seq1))
@ -614,26 +630,26 @@ end
local function SpriteEaseBackInOut()
local layer = getBaseLayer()
local move = CCMoveBy:create(3, CCPointMake(s.width - 130, 0))
local move = createSimpleMoveBy()
local move_back = move:reverse()
local move_ease = CCEaseBackInOut:create(move:copy():autorelease())
local move_ease = CCEaseBackInOut:create(createSimpleMoveBy())
local move_ease_back = move_ease:reverse()
local delay = CCDelayTime:create(0.25)
local delay = createSimpleDelayTime()
local arr1 = CCArray:create()
arr1:addObject(move)
arr1:addObject(delay)
arr1:addObject(move_back)
arr1:addObject(delay:copy():autorelease())
arr1:addObject(createSimpleDelayTime())
local seq1 = CCSequence:create(arr1)
local arr2 = CCArray:create()
arr2:addObject(move_ease)
arr2:addObject(delay:copy():autorelease())
arr2:addObject(createSimpleDelayTime())
arr2:addObject(move_ease_back)
arr2:addObject(delay:copy():autorelease())
arr2:addObject(createSimpleDelayTime())
local seq2 = CCSequence:create(arr2)
positionForTwo()
@ -660,9 +676,9 @@ local function altertime(dt)
end
local function SpeedTest_onEnterOrExit(tag)
if tag == 0 then
if tag == "enter" then
SpeedTest_entry = scheduler:scheduleScriptFunc(altertime, 1.0, false)
elseif tag == 1 then
elseif tag == "exit" then
scheduler:unscheduleScriptEntry(SpeedTest_entry)
end
end
@ -681,10 +697,10 @@ local function SpeedTest()
local spawn = CCSpawn:createWithTwoActions(seq3_1, seq3_2)
SpeedTest_action1 = CCSpeed:create(CCRepeatForever:create(spawn), 1.0)
local spawn2 = spawn:copy():autorelease()
local spawn2 = CCSpawn:createWithTwoActions(seq3_1, seq3_2)
SpeedTest_action2 = CCSpeed:create(CCRepeatForever:create(spawn2), 1.0)
local spawn3 = spawn:copy():autorelease()
local spawn3 = CCSpawn:createWithTwoActions(seq3_1, seq3_2)
SpeedTest_action3 = CCSpeed:create(CCRepeatForever:create(spawn3), 1.0)
grossini:runAction(SpeedTest_action2)

View File

@ -942,12 +942,8 @@ local function ActionOrbit()
local seq = CCSequence:createWithTwoActions(move, move_back)
local rfe = CCRepeatForever:create(seq)
kathia:runAction(rfe)
local rfe2 = CCRepeatForever:create(seq)
tamara:runAction(rfe2)
local rfe3 = CCRepeatForever:create(seq)
grossini:runAction(rfe3)
tamara:runAction(tolua.cast(rfe:copy():autorelease(), "CCActionInterval"))
grossini:runAction(tolua.cast(rfe:copy():autorelease(), "CCActionInterval"))
subtitleLabel:setString("OrbitCamera action")

View File

@ -38,9 +38,9 @@ local function initWithLayer()
end
local function onTouch(eventType, x, y)
if eventType == CCTOUCHBEGAN then
if eventType == "began" then
return true
elseif eventType == CCTOUCHENDED then
elseif eventType == "ended" then
return onTouchEnded(x, y)
end
end

View File

@ -192,9 +192,9 @@ local function MotionStreakTest2()
end
local function onTouch(eventType, x, y)
if eventType == CCTOUCHBEGAN then
if eventType == "began" then
return true
elseif eventType == CCTOUCHMOVED then
elseif eventType == "moved" then
return onTouchMoved(x, y)
end
end
@ -227,9 +227,9 @@ local function Issue1358_update(dt)
end
local function Issue1358_onEnterOrExit(tag)
if tag == 0 then
if tag == "enter" then
Issue1358_entry = scheduler:scheduleScriptFunc(Issue1358_update, 0, false)
elseif tag == 1 then
elseif tag == "exit" then
scheduler:unscheduleScriptEntry(Issue1358_entry)
end
end
@ -266,7 +266,6 @@ function CreateMotionLayer()
end
function MotionStreakTest()
cclog("MotionStreakTest")
local scene = CCScene:create()
SceneIdx = -1

View File

@ -212,10 +212,10 @@ local function delay4(dt)
end
local function Test4_onEnterOrExit(tag)
if tag == 0 then
if tag == "enter" then
Test4_delay2Entry = scheduler:scheduleScriptFunc(delay2, 2.0, false)
Test4_delay4Entry = scheduler:scheduleScriptFunc(delay4, 4.0, false)
elseif tag == 1 then
elseif tag == "exit" then
scheduler:unscheduleScriptEntry(Test4_delay2Entry)
scheduler:unscheduleScriptEntry(Test4_delay4Entry)
end
@ -281,7 +281,10 @@ local function Test5()
local rot = CCRotateBy:create(2, 360)
local rot_back = rot:reverse()
local forever = CCRepeatForever:create(CCSequence:createWithTwoActions(rot, rot_back))
local forever2 = CCRepeatForever:create(CCSequence:createWithTwoActions(rot:copy():autorelease(), rot_back:copy():autorelease()))
local rot2 = CCRotateBy:create(2, 360)
local rot2_back = rot2:reverse()
local forever2 = CCRepeatForever:create(CCSequence:createWithTwoActions(rot2, rot2_back))
forever:setTag(101)
forever2:setTag(102)
@ -344,10 +347,10 @@ local function Test6()
local rot = CCRotateBy:create(2, 360)
local rot_back = rot:reverse()
local forever1 = CCRepeatForever:create(CCSequence:createWithTwoActions(rot, rot_back))
local forever11 = forever1:copy():autorelease()
local forever11 = CCRepeatForever:create(CCSequence:createWithTwoActions(rot, rot_back))
local forever2 = forever1:copy():autorelease()
local forever21 = forever1:copy():autorelease()
local forever2 = CCRepeatForever:create(CCSequence:createWithTwoActions(rot, rot_back))
local forever21 = CCRepeatForever:create(CCSequence:createWithTwoActions(rot, rot_back))
Test6_layer:addChild(sp1, 0, kTagSprite1)
sp1:addChild(sp11)
@ -444,7 +447,7 @@ local function StressTest2()
sp1:setPosition(CCPointMake(80, s.height / 2))
local move = CCMoveBy:create(3, CCPointMake(350, 0))
local move_ease_inout3 = CCEaseInOut:create(move:copy():autorelease(), 2.0)
local move_ease_inout3 = CCEaseInOut:create(CCMoveBy:create(3, CCPointMake(350, 0)), 2.0)
local move_ease_inout_back3 = move_ease_inout3:reverse()
local seq3 = CCSequence:createWithTwoActions(move_ease_inout3, move_ease_inout_back3)
sp1:runAction(CCRepeatForever:create(seq3))
@ -452,9 +455,10 @@ local function StressTest2()
local fire = CCParticleFire:create()
fire:setTexture(CCTextureCache:sharedTextureCache():addImage("Images/fire.png"))
fire = tolua.cast(fire, "CCNode")
fire:setPosition(80, s.height / 2 - 50)
local copy_seq3 = seq3:copy():autorelease()
local copy_seq3 = CCSequence:createWithTwoActions(move_ease_inout3, move_ease_inout_back3)
fire:runAction(CCRepeatForever:create(copy_seq3))
sublayer:addChild(fire, 2)
@ -610,7 +614,7 @@ local function CameraZoomTest()
CameraZoomTest_layer:addChild(sprite, 0, 20)
sprite:setPosition(ccp(s.width / 4 * 3, s.height / 2))
CameraZoomTest_layer:scheduleUpdate()
CameraZoomTest_layer:scheduleUpdateWithPriorityLua(CameraZoomTest_update, 0)
CameraZoomTest_layer:registerScriptHandler(CameraZoomTest_onEnterOrExit)
titleLabel:setString("Camera Zoom test")
@ -646,8 +650,7 @@ local function ConvertToNode()
point:setPosition(sprite:getPosition())
local copy = action:copy()
copy:autorelease()
local copy = CCRepeatForever:create(rotate)
sprite:runAction(copy)
ConvertToNode_layer:addChild(sprite, i)
end

View File

@ -73,7 +73,8 @@ end
local function setEmitterPosition()
if emitter ~= nil then
emitter:setPosition(s.width / 2, s.height / 2)
nodeEmitter = tolua.cast(emitter, "CCNode")
nodeEmitter:setPosition(s.width / 2, s.height / 2)
end
end
@ -133,7 +134,7 @@ local function getBaseLayer()
layer:addChild(menu, 100)
labelAtlas = CCLabelAtlas:create("0000", "fps_images.png", 12, 32, '.')
labelAtlas = CCLabelAtlas:create("0000", "fps_images.png", 12, 32, string.byte('.'))
layer:addChild(labelAtlas, 100)
labelAtlas:setPosition(ccp(s.width - 66, 50))
@ -147,8 +148,6 @@ local function getBaseLayer()
local seq = CCSequence:createWithTwoActions(move, move_back)
background:runAction(CCRepeatForever:create(seq))
layer:scheduleUpdate()
local function onTouchEnded(x, y)
local pos = CCPointMake(0, 0)
if background ~= nil then
@ -379,7 +378,7 @@ local function DemoFlower()
emitter = CCParticleFlower:create()
-- emitter:retain()
background:addChild(emitter, 10)
background:addChild(tolua.cast(emitter, "CCNode"), 10)
emitter:setTexture(CCTextureCache:sharedTextureCache():addImage(s_stars1))
setEmitterPosition()
@ -396,7 +395,7 @@ local function DemoGalaxy()
emitter = CCParticleGalaxy:create()
-- emitter:retain()
background:addChild(emitter, 10)
background:addChild(tolua.cast(emitter,"CCNode"), 10)
emitter:setTexture(CCTextureCache:sharedTextureCache():addImage(s_fire))
@ -414,7 +413,7 @@ local function DemoFirework()
emitter = CCParticleFireworks:create()
-- emitter:retain()
background:addChild(emitter, 10)
background:addChild(tolua.cast(emitter,"CCNode"), 10)
emitter:setTexture(CCTextureCache:sharedTextureCache():addImage(s_stars1))
@ -432,7 +431,7 @@ local function DemoSpiral()
emitter = CCParticleSpiral:create()
-- emitter:retain()
background:addChild(emitter, 10)
background:addChild(tolua.cast(emitter,"CCNode"), 10)
emitter:setTexture(CCTextureCache:sharedTextureCache():addImage(s_fire))
@ -450,7 +449,7 @@ local function DemoSun()
emitter = CCParticleSun:create()
-- emitter:retain()
background:addChild(emitter, 10)
background:addChild(tolua.cast(emitter,"CCNode"), 10)
emitter:setTexture(CCTextureCache:sharedTextureCache():addImage(s_fire))
@ -468,7 +467,7 @@ local function DemoMeteor()
emitter = CCParticleMeteor:create()
-- emitter:retain()
background:addChild(emitter, 10)
background:addChild(tolua.cast(emitter,"CCNode"), 10)
emitter:setTexture(CCTextureCache:sharedTextureCache():addImage(s_fire))
@ -486,11 +485,11 @@ local function DemoFire()
emitter = CCParticleFire:create()
-- emitter:retain()
background:addChild(emitter, 10)
background:addChild(tolua.cast(emitter,"CCNode"), 10)
emitter:setTexture(CCTextureCache:sharedTextureCache():addImage(s_fire))
local pos_x, pos_y = emitter:getPosition()
emitter:setPosition(pos_x, 100)
local pos_x, pos_y = tolua.cast(emitter,"CCNode"):getPosition()
tolua.cast(emitter,"CCNode"):setPosition(pos_x, 100)
titleLabel:setString("ParticleFire")
return layer
@ -504,11 +503,11 @@ local function DemoSmoke()
emitter = CCParticleSmoke:create()
-- emitter:retain()
background:addChild(emitter, 10)
background:addChild(tolua.cast(emitter,"CCNode"), 10)
emitter:setTexture(CCTextureCache:sharedTextureCache():addImage(s_fire))
local pos_x, pos_y = emitter:getPosition()
emitter:setPosition(pos_x, 100)
local pos_x, pos_y = tolua.cast(emitter,"CCNode"):getPosition()
tolua.cast(emitter,"CCNode"):setPosition(pos_x, 100)
setEmitterPosition()
@ -524,11 +523,11 @@ local function DemoExplosion()
emitter = CCParticleExplosion:create()
-- emitter:retain()
background:addChild(emitter, 10)
background:addChild(tolua.cast(emitter,"CCNode"), 10)
emitter:setTexture(CCTextureCache:sharedTextureCache():addImage(s_stars1))
emitter:setAutoRemoveOnFinish(true)
tolua.cast(emitter, "CCParticleSystem"):setAutoRemoveOnFinish(true)
setEmitterPosition()
@ -544,33 +543,36 @@ local function DemoSnow()
emitter = CCParticleSnow:create()
-- emitter:retain()
background:addChild(emitter, 10)
local nodeEmitter = tolua.cast(emitter, "CCNode")
background:addChild(nodeEmitter, 10)
local pos_x, pos_y = emitter:getPosition()
emitter:setPosition(pos_x, pos_y - 110)
emitter:setLife(3)
emitter:setLifeVar(1)
local pos_x, pos_y = nodeEmitter:getPosition()
nodeEmitter:setPosition(pos_x, pos_y - 110)
local systemEmitter = tolua.cast(emitter, "CCParticleSystem")
systemEmitter:setLife(3)
systemEmitter:setLifeVar(1)
-- gravity
emitter:setGravity(CCPointMake(0, -10))
systemEmitter:setGravity(CCPointMake(0, -10))
-- speed of particles
emitter:setSpeed(130)
emitter:setSpeedVar(30)
systemEmitter:setSpeed(130)
systemEmitter:setSpeedVar(30)
local startColor = emitter:getStartColor()
local startColor = systemEmitter:getStartColor()
startColor.r = 0.9
startColor.g = 0.9
startColor.b = 0.9
emitter:setStartColor(startColor)
systemEmitter:setStartColor(startColor)
local startColorVar = emitter:getStartColorVar()
local startColorVar = systemEmitter:getStartColorVar()
startColorVar.b = 0.1
emitter:setStartColorVar(startColorVar)
systemEmitter:setStartColorVar(startColorVar)
emitter:setEmissionRate(emitter:getTotalParticles() / emitter:getLife())
systemEmitter:setEmissionRate(systemEmitter:getTotalParticles() / systemEmitter:getLife())
emitter:setTexture(CCTextureCache:sharedTextureCache():addImage(s_snow))
systemEmitter:setTexture(CCTextureCache:sharedTextureCache():addImage(s_snow))
setEmitterPosition()
@ -586,11 +588,13 @@ local function DemoRain()
emitter = CCParticleRain:create()
-- emitter:retain()
background:addChild(emitter, 10)
local pos_x, pos_y = emitter:getPosition()
emitter:setPosition(pos_x, pos_y - 100)
emitter:setLife(4)
local nodeEmitter = tolua.cast(emitter, "CCNode")
background:addChild(nodeEmitter, 10)
local pos_x, pos_y = nodeEmitter:getPosition()
nodeEmitter:setPosition(pos_x, pos_y - 100)
tolua.cast(emitter, "CCParticleSystem"):setLife(4)
emitter:setTexture(CCTextureCache:sharedTextureCache():addImage(s_fire))
@ -823,14 +827,17 @@ local function DemoRing()
emitter = CCParticleFlower:create()
-- emitter:retain()
background:addChild(emitter, 10)
local nodeEmitter = tolua.cast(emitter, "CCNode")
background:addChild(nodeEmitter, 10)
emitter:setTexture(CCTextureCache:sharedTextureCache():addImage(s_stars1))
emitter:setLifeVar(0)
emitter:setLife(10)
emitter:setSpeed(100)
emitter:setSpeedVar(0)
emitter:setEmissionRate(10000)
local systemEmitter = tolua.cast(emitter, "CCParticleSystem")
systemEmitter:setLifeVar(0)
systemEmitter:setLife(10)
systemEmitter:setSpeed(100)
systemEmitter:setSpeedVar(0)
systemEmitter:setEmissionRate(10000)
setEmitterPosition()
@ -860,11 +867,12 @@ local function ParallaxParticle()
-- emitter:retain()
emitter:setTexture(CCTextureCache:sharedTextureCache():addImage(s_fire))
p1:addChild(emitter, 10)
emitter:setPosition(250, 200)
local nodeEmitter = tolua.cast(emitter, "CCNode")
p1:addChild(nodeEmitter, 10)
nodeEmitter:setPosition(250, 200)
local par = CCParticleSun:create()
p2:addChild(par, 10)
p2:addChild(tolua.cast(par,"CCNode"), 10)
par:setTexture(CCTextureCache:sharedTextureCache():addImage(s_fire))
local move = CCMoveBy:create(4, CCPointMake(300,0))

View File

@ -33,11 +33,16 @@ local function CreateSpriteLayer()
local rot1 = CCRotateBy:create(4, 360 * 2)
local rot2 = rot1:reverse()
local jump3 = CCJumpBy:create(4, CCPointMake(-400, 0), 100, 4)
local jump4 = jump3:reverse()
local rot3 = CCRotateBy:create(4, 360 * 2)
local rot4 = rot3:reverse()
spriteSister1:runAction(CCRepeat:create(CCSequence:createWithTwoActions(jump2, jump1), 5))
spriteSister2:runAction(CCRepeat:create(CCSequence:createWithTwoActions(jump1:copy():autorelease(), jump2:copy():autorelease()), 5))
spriteSister2:runAction(CCRepeat:create(CCSequence:createWithTwoActions(jump3, jump4), 5))
spriteSister1:runAction(CCRepeat:create(CCSequence:createWithTwoActions(rot1, rot2), 5))
spriteSister2:runAction(CCRepeat:create(CCSequence:createWithTwoActions(rot2:copy():autorelease(), rot1:copy():autorelease()), 5))
spriteSister2:runAction(CCRepeat:create(CCSequence:createWithTwoActions(rot4, rot3), 5))
return layer
end
@ -90,11 +95,14 @@ local function CreateRotateWorldLayer()
layer:addChild(red)
local rot = CCRotateBy:create(8, 720)
local rot1 = CCRotateBy:create(8, 720)
local rot2 = CCRotateBy:create(8, 720)
local rot3 = CCRotateBy:create(8, 720)
blue:runAction(rot)
red:runAction(rot:copy():autorelease())
green:runAction(rot:copy():autorelease())
white:runAction(rot:copy():autorelease())
red:runAction(rot1)
green:runAction(rot2)
white:runAction(rot3)
return layer
end

View File

@ -193,9 +193,9 @@ function CreateTestMenu()
end
local function onTouch(eventType, x, y)
if eventType == CCTOUCHBEGAN then
if eventType == "began" then
return onTouchBegan(x, y)
elseif eventType == CCTOUCHMOVED then
elseif eventType == "moved" then
return onTouchMoved(x, y)
end
end

View File

@ -1 +1 @@
c789948fe4f395f9c7d4591e2b864ee72a50a917
3c831a2c7337edf8167b0ce7755dbfc684101679

View File

@ -28,7 +28,6 @@ class CCActionInterval : public CCFiniteTimeAction
bool isDone(void);
void setAmplitudeRate(float amp);
float getAmplitudeRate(void);
CCObject* copyWithZone(CCZone* pZone);
CCActionInterval* reverse(void);
CCActionInterval* create(float d);

View File

@ -87,13 +87,13 @@ class CCParticleSystem : public CCNode
float getEndSizeVar();
void setEndSizeVar(float size);
void setStartColor(ccColor4F var);
void setStartColor(const ccColor4F var);
const ccColor4F & getStartColor();
void setStartColorVar(ccColor4F var);
void setStartColorVar(const ccColor4F var);
const ccColor4F & getStartColorVar();
void setEndColor(ccColor4F var);
void setEndColor(const ccColor4F var);
const ccColor4F & getEndColor();
void setEndColorVar(ccColor4F var);
void setEndColorVar(const ccColor4F var);
const ccColor4F & getEndColorVar();
void setStartSpin(float var);
float getStartSpin();