issue #1425:exist lua test case is ok!

1.add some lua test case
2.add ccset.pkg
3.fixed ParticleSystem error in lua test case
This commit is contained in:
wangshuai 2013-03-05 14:46:18 +08:00
parent f7802a0794
commit bdbdbc27f5
12 changed files with 219 additions and 126 deletions

View File

@ -124,9 +124,9 @@ local function testStopAction(dt)
end
local function SpriteEase_onEnterOrExit(tag)
if tag == 0 then
if tag == "enter" then
SpriteEase_entry = scheduler:scheduleScriptFunc(testStopAction, 6.25, false)
elseif tag == 1 then
elseif tag == "exit" then
scheduler:unscheduleScriptEntry(SpriteEase_entry)
end
end
@ -697,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 = CCSpawn:createWithTwoActions(seq3_1, seq3_2)
local spawn2 = tolua.cast(spawn:copy():autorelease(), "CCSpawn")
SpeedTest_action2 = CCSpeed:create(CCRepeatForever:create(spawn2), 1.0)
local spawn3 = CCSpawn:createWithTwoActions(seq3_1, seq3_2)
local spawn3 = tolua.cast(spawn:copy():autorelease(), "CCSpawn")
SpeedTest_action3 = CCSpeed:create(CCRepeatForever:create(spawn3), 1.0)
grossini:runAction(SpeedTest_action2)

View File

@ -8,6 +8,7 @@ Action_Table =
"ACTION_SCALE_LAYER",
"ACTION_ROTATE_LAYER",
"ACTION_SKEW_LAYER",
"ACTION_SKEW_STANDER",
"ACTION_SKEWROTATE_LAYER",
"ACTION_JUMP_LAYER",
"ACTION_CARDINALSPLINE_LAYER",
@ -35,7 +36,7 @@ Action_Table =
"ACTION_FOLLOW_LAYER",
"ACTION_TARGETED_LAYER",
-- problem: crash
-- "PAUSERESUMEACTIONS_LAYER",
"PAUSERESUMEACTIONS_LAYER",
"ACTION_ISSUE1305_LAYER",
"ACTION_ISSUE1305_2_LAYER",
"ACTION_ISSUE1288_LAYER",

View File

@ -244,6 +244,51 @@ local function ActionSkew()
return layer
end
--ActionRotationalSkewVSStandardSkew
local function ActionRotationalSkewVSStandardSkew()
local layer = CCLayer:create()
initWithLayer(layer)
tamara:removeFromParentAndCleanup(true);
grossini:removeFromParentAndCleanup(true);
kathia:removeFromParentAndCleanup(true);
local s = CCDirector:sharedDirector():getWinSize();
local boxSize = CCSizeMake(100.0, 100.0);
local box = CCLayerColor:create(ccc4(255,255,0,255));
box:setAnchorPoint(ccp(0.5,0.5));
box:setContentSize( boxSize );
box:ignoreAnchorPointForPosition(false);
box:setPosition(ccp(s.width/2, s.height - 100 - box:getContentSize().height/2));
layer:addChild(box);
local label = CCLabelTTF:create("Standard cocos2d Skew", "Marker Felt", 16);
label:setPosition(ccp(s.width/2, s.height - 100 + label:getContentSize().height));
layer:addChild(label);
local actionTo = CCSkewBy:create(2, 360, 0);
local actionToBack = CCSkewBy:create(2, -360, 0);
local seq = CCSequence:createWithTwoActions(actionTo, actionToBack)
box:runAction(seq);
box = CCLayerColor:create(ccc4(255,255,0,255));
box:setAnchorPoint(ccp(0.5,0.5));
box:setContentSize(boxSize);
box:ignoreAnchorPointForPosition(false);
box:setPosition(ccp(s.width/2, s.height - 250 - box:getContentSize().height/2));
layer:addChild(box);
label = CCLabelTTF:create("Rotational Skew", "Marker Felt", 16);
label:setPosition(ccp(s.width/2, s.height - 250 + label:getContentSize().height/2));
layer:addChild(label);
local actionTo2 = CCRotateBy:create(2, 360);
local actionToBack2 = CCRotateBy:create(2, -360);
seq = CCSequence:createWithTwoActions(actionTo2, actionToBack2)
box:runAction(seq);
subtitleLabel:setString("Skew Comparison")
return layer;
end
--------------------------------------
-- ActionSkewRotate
--------------------------------------
@ -555,10 +600,9 @@ local function ActionAnimate()
local action2 = CCAnimate:create(animation2)
tamara:runAction(CCSequence:createWithTwoActions(action2, action2:reverse()))
local animation3 = animation2:copy()
animation3:autorelease()
local animation3 = animation2:copy():autorelease()
-- problem
animation3:setLoops(4)
tolua.cast(animation3,"CCAnimation"):setLoops(4)
local action3 = CCAnimate:create(animation3)
kathia:runAction(action3)
@ -605,7 +649,14 @@ local function ActionSequenceCallback2(sender)
local label = CCLabelTTF:create("callback 2 called", "Marker Felt", 16)
label:setPosition(ccp(size.width / 4 * 2, size.height / 2))
sender:addChild(label)
actionSequenceLayer:addChild(label)
end
local function ActionSequenceCallback3(sender)
local label = CCLabelTTF:create("callback 3 called", "Marker Felt", 16)
label:setPosition(ccp(size.width / 4 * 3, size.height / 2))
actionSequenceLayer:addChild(label)
end
local function ActionSequence2()
@ -621,6 +672,7 @@ local function ActionSequence2()
array:addObject(CCMoveBy:create(1, ccp(100,0)))
array:addObject(CCCallFunc:create(ActionSequenceCallback1))
array:addObject(CCCallFuncN:create(ActionSequenceCallback2))
array:addObject(CCCallFuncN:create(ActionSequenceCallback3))
local action = CCSequence:create(array)
grossini:runAction(action)
@ -750,8 +802,7 @@ local function ActionRotateToRepeat()
local act2 = CCRotateTo:create(1, 0)
local seq = CCSequence:createWithTwoActions(act1, act2)
local rep1 = CCRepeatForever:create(seq)
local seq2 = CCSequence:createWithTwoActions(act1, act2)
local rep2 = CCRepeat:create(seq2, 10)
local rep2 = CCRepeat:create(tolua.cast(seq:copy():autorelease(), "CCSequence"), 10)
tamara:runAction(rep1)
kathia:runAction(rep2)
@ -803,7 +854,14 @@ end
local function CallFucnCallback2(sender)
local label = CCLabelTTF:create("callback 2 called", "Marker Felt", 16)
label:setPosition(size.width / 2, size.height / 2)
label:setPosition(size.width / 4 * 2, size.height / 2)
callFuncLayer:addChild(label)
end
local function CallFucnCallback3(sender)
local label = CCLabelTTF:create("callback 3 called", "Marker Felt", 16)
label:setPosition(size.width / 4 * 3, size.height / 2)
callFuncLayer:addChild(label)
end
@ -812,7 +870,7 @@ local function ActionCallFunc()
callFuncLayer = CCLayer:create()
initWithLayer(callFuncLayer)
centerSprites(2)
centerSprites(3)
local action = CCSequence:createWithTwoActions(
CCMoveBy:create(2, ccp(200,0)),
@ -824,8 +882,15 @@ local function ActionCallFunc()
array:addObject(CCCallFuncN:create(CallFucnCallback2))
local action2 = CCSequence:create(array)
kathia:runAction(action)
local array2 = CCArray:create()
array2:addObject(CCRotateBy:create(3 , 360))
array2:addObject(CCFadeOut:create(2))
array2:addObject(CCCallFuncN:create(CallFucnCallback3))
local action3 = CCSequence:create(array2)
grossini:runAction(action)
tamara:runAction(action2)
kathia:runAction(action3)
subtitleLabel:setString("Callbacks: CallFunc and friends")
return callFuncLayer
@ -1021,6 +1086,7 @@ local function ActionPause(dt)
local director = CCDirector:sharedDirector()
pausedTargets = director:getActionManager():pauseAllRunningActions()
pausedTargets:retain()
end
local function ActionResume(dt)
@ -1033,15 +1099,16 @@ local function ActionResume(dt)
if pausedTargets ~= nil then
-- problem: will crash here. Try fixing me!
director:getActionManager():resumeTargets(pausedTargets)
pausedTargets:release()
end
end
local function PauseResumeActions_onEnterOrExit(tag)
local scheduler = CCDirector:sharedDirector():getScheduler()
if tag == 0 then
if tag == "enter" then
PauseResumeActions_pauseEntry = scheduler:scheduleScriptFunc(ActionPause, 3, false)
PauseResumeActions_resumeEntry = scheduler:scheduleScriptFunc(ActionResume, 5, false)
elseif tag == 1 then
elseif tag == "exit" then
scheduler:unscheduleScriptEntry(PauseResumeActions_pauseEntry)
scheduler:unscheduleScriptEntry(PauseResumeActions_resumeEntry)
end
@ -1078,15 +1145,15 @@ local function addSprite(dt)
local scheduler = CCDirector:sharedDirector():getScheduler()
scheduler:unscheduleScriptEntry(Issue1305_entry)
spriteTmp:setPosition(ccp(250, 150))
spriteTmp:setPosition(ccp(250, 250))
Issue1305_layer:addChild(spriteTmp)
end
local function Issue1305_onEnterOrExit(tag)
local scheduler = CCDirector:sharedDirector():getScheduler()
if tag == 0 then
if tag == "enter" then
Issue1305_entry = scheduler:scheduleScriptFunc(addSprite, 2, false)
elseif tag == 1 then
elseif tag == "exit" then
scheduler:unscheduleScriptEntry(Issue1305_entry)
end
end
@ -1268,6 +1335,8 @@ function CreateActionTestLayer()
layer = ActionRotate()
elseif ActionIdx == Action_Table.ACTION_SKEW_LAYER then
layer = ActionSkew()
elseif ActionIdx == Action_Table.ACTION_SKEW_STANDER then
layer = ActionRotationalSkewVSStandardSkew()
elseif ActionIdx == Action_Table.ACTION_SKEWROTATE_LAYER then
layer = ActionSkewRotate()
elseif ActionIdx == Action_Table.ACTION_JUMP_LAYER then

View File

@ -14,9 +14,9 @@ local entry = nil
local function onEnterOrExit(tag)
local scheduler = CCDirector:sharedDirector():getScheduler()
if tag == 0 then
if tag == "enter" then
entry = scheduler:scheduleScriptFunc(checkAnim, 0, false)
elseif tag == 1 then
elseif tag == "exit" then
scheduler:unscheduleScriptEntry(entry)
end
end

View File

@ -125,9 +125,9 @@ local function MotionStreakTest1_update(dt)
end
local function MotionStreakTest1_onEnterOrExit(tag)
if tag == 0 then
if tag == "enter" then
MotionStreakTest1_entry = scheduler:scheduleScriptFunc(MotionStreakTest1_update, 0, false)
elseif tag == 1 then
elseif tag == "exit" then
scheduler:unscheduleScriptEntry(MotionStreakTest1_entry)
end
end

View File

@ -1,6 +1,6 @@
local SceneIdx = -1
local MAX_LAYER = 11
local MAX_LAYER = 13
local kTagSprite1 = 1
local kTagSprite2 = 2
@ -262,9 +262,9 @@ local function Test5_addAndRemove(dt)
end
local function Test5_onEnterOrExit(tag)
if tag == 0 then
if tag == "enter" then
Test5_entry = scheduler:scheduleScriptFunc(Test5_addAndRemove, 2.0, false)
elseif tag == 1 then
elseif tag == "exit" then
scheduler:unscheduleScriptEntry(Test5_entry)
end
end
@ -325,9 +325,9 @@ local function Test6_addAndRemove(dt)
end
local function Test6_onEnterOrExit(tag)
if tag == 0 then
if tag == "enter" then
Test6_entry = scheduler:scheduleScriptFunc(Test6_addAndRemove, 2.0, false)
elseif tag == 1 then
elseif tag == "exit" then
scheduler:unscheduleScriptEntry(Test6_entry)
end
end
@ -347,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 = CCRepeatForever:create(CCSequence:createWithTwoActions(rot, rot_back))
local forever11 = tolua.cast(forever1:copy():autorelease(), "CCRepeatForever")
local forever2 = CCRepeatForever:create(CCSequence:createWithTwoActions(rot, rot_back))
local forever21 = CCRepeatForever:create(CCSequence:createWithTwoActions(rot, rot_back))
local forever2 = tolua.cast(forever1:copy():autorelease(), "CCRepeatForever")
local forever21 = tolua.cast(forever1:copy():autorelease(), "CCRepeatForever")
Test6_layer:addChild(sp1, 0, kTagSprite1)
sp1:addChild(sp11)
@ -396,9 +396,9 @@ local function shouldNotCrash(dt)
end
local function StressTest1_onEnterOrExit(tag)
if tag == 0 then
if tag == "enter" then
StressTest1_entry = scheduler:scheduleScriptFunc(shouldNotCrash, 1.0, false)
elseif tag == 1 then
elseif tag == "exit" then
scheduler:unscheduleScriptEntry(StressTest1_entry)
end
end
@ -431,9 +431,9 @@ local function shouldNotLeak(dt)
end
local function StressTest2_onEnterOrExit(tag)
if tag == 0 then
if tag == "enter" then
StressTest2_entry = scheduler:scheduleScriptFunc(shouldNotLeak, 6.0, false)
elseif tag == 1 then
elseif tag == "exit" then
scheduler:unscheduleScriptEntry(StressTest2_entry)
end
end
@ -458,7 +458,7 @@ local function StressTest2()
fire = tolua.cast(fire, "CCNode")
fire:setPosition(80, s.height / 2 - 50)
local copy_seq3 = CCSequence:createWithTwoActions(move_ease_inout3, move_ease_inout_back3)
local copy_seq3 = tolua.cast(seq3:copy():autorelease(), "CCSequence")
fire:runAction(CCRepeatForever:create(copy_seq3))
sublayer:addChild(fire, 2)
@ -510,9 +510,9 @@ end
-- CameraOrbitTest
-----------------------------------
local function CameraOrbitTest_onEnterOrExit(tag)
if tag == 0 then
if tag == "enter" then
CCDirector:sharedDirector():setProjection(kCCDirectorProjection3D)
elseif tag == 1 then
elseif tag == "exit" then
CCDirector:sharedDirector():setProjection(kCCDirectorProjection2D)
end
end
@ -582,10 +582,10 @@ local function CameraZoomTest_update(dt)
end
local function CameraZoomTest_onEnterOrExit(tag)
if tag == 0 then
if tag == "enter" then
CCDirector:sharedDirector():setProjection(kCCDirectorProjection3D)
CameraZoomTest_entry = scheduler:scheduleScriptFunc(CameraZoomTest_update, 0.0, false)
elseif tag == 1 then
elseif tag == "exit" then
CCDirector:sharedDirector():setProjection(kCCDirectorProjection2D)
scheduler:unscheduleScriptEntry(CameraZoomTest_entry)
end
@ -650,7 +650,7 @@ local function ConvertToNode()
point:setPosition(sprite:getPosition())
local copy = CCRepeatForever:create(rotate)
local copy = tolua.cast(action:copy():autorelease(), "CCRepeatForever")
sprite:runAction(copy)
ConvertToNode_layer:addChild(sprite, i)
end
@ -667,9 +667,9 @@ local function ConvertToNode()
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
@ -690,7 +690,10 @@ local function NodeOpaqueTest()
for i = 0, 49 do
local background = CCSprite:create("Images/background1.png")
--background:setGLServerState(background:getGLServerState() & (~CC_GL_BLEND))
local blendFunc = ccBlendFunc:new()
blendFunc.src = GL_ONE
blendFunc.dst = GL_ONE_MINUS_SRC_ALPHA
background:setBlendFunc(blendFunc)
background:setAnchorPoint(ccp(0, 0))
layer:addChild(background)
end
@ -708,11 +711,13 @@ local function NodeNonOpaqueTest()
for i = 0, 49 do
background = CCSprite:create("Images/background1.jpg")
--background:setGLServerState(background:getGLServerState() | CC_GL_BLEND)
local blendFunc = ccBlendFunc:new()
blendFunc.src = GL_ONE
blendFunc.dst = GL_ZERO
background:setBlendFunc(blendFunc)
background:setAnchorPoint(ccp(0, 0))
layer:addChild(background)
end
titleLabel:setString("Node Non Opaque Test")
subTitleLabel:setString("Node rendered with GL_BLEND enabled")
return layer
@ -744,6 +749,10 @@ function CreateNodeTestLayer()
return CameraZoomTest()
elseif SceneIdx == 10 then
return ConvertToNode()
elseif SceneIdx == 11 then
return NodeOpaqueTest()
elseif SceneIdx == 12 then
return NodeNonOpaqueTest()
end
end

View File

@ -73,23 +73,22 @@ end
local function setEmitterPosition()
if emitter ~= nil then
nodeEmitter = tolua.cast(emitter, "CCNode")
nodeEmitter:setPosition(s.width / 2, s.height / 2)
emitter:setPosition(s.width / 2, s.height / 2)
end
end
local function update(dt)
if emitter ~= nil then
local str = "" .. emitter:getParticleCount()
labelAtlas:setString("" .. str)
-- labelAtlas:setString("" .. str)
end
end
local function baseLayer_onEnterOrExit(tag)
local scheduler = CCDirector:sharedDirector():getScheduler()
if tag == 0 then
if tag == "enter" then
baseLayer_entry = scheduler:scheduleScriptFunc(update, 0, false)
elseif tag == 1 then
elseif tag == "exit" then
scheduler:unscheduleScriptEntry(baseLayer_entry)
end
end
@ -161,7 +160,7 @@ local function getBaseLayer()
end
local function onTouch(eventType, x, y)
if eventType == CCTOUCHBEGAN then
if eventType == "began" then
return true
else
return onTouchEnded(x, y)
@ -213,9 +212,9 @@ end
local function ParticleReorder_onEnterOrExit(tag)
local scheduler = CCDirector:sharedDirector():getScheduler()
if tag == 0 then
if tag == "enter" then
ParticleReorder_entry = scheduler:scheduleScriptFunc(reorderParticles, 1.0, false)
elseif tag == 1 then
elseif tag == "exit" then
scheduler:unscheduleScriptEntry(ParticleReorder_entry)
end
end
@ -303,9 +302,9 @@ end
local function ParticleBatchHybrid_onEnterOrExit(tag)
local scheduler = CCDirector:sharedDirector():getScheduler()
if tag == 0 then
if tag == "enter" then
ParticleBatchHybrid_entry = scheduler:scheduleScriptFunc(switchRender, 2.0, false)
elseif tag == 1 then
elseif tag == "exit" then
scheduler:unscheduleScriptEntry(ParticleBatchHybrid_entry)
--emitter:release()
end
@ -378,7 +377,7 @@ local function DemoFlower()
emitter = CCParticleFlower:create()
-- emitter:retain()
background:addChild(tolua.cast(emitter, "CCNode"), 10)
background:addChild(emitter, 10)
emitter:setTexture(CCTextureCache:sharedTextureCache():addImage(s_stars1))
setEmitterPosition()
@ -395,7 +394,7 @@ local function DemoGalaxy()
emitter = CCParticleGalaxy:create()
-- emitter:retain()
background:addChild(tolua.cast(emitter,"CCNode"), 10)
background:addChild(emitter, 10)
emitter:setTexture(CCTextureCache:sharedTextureCache():addImage(s_fire))
@ -413,7 +412,7 @@ local function DemoFirework()
emitter = CCParticleFireworks:create()
-- emitter:retain()
background:addChild(tolua.cast(emitter,"CCNode"), 10)
background:addChild(emitter, 10)
emitter:setTexture(CCTextureCache:sharedTextureCache():addImage(s_stars1))
@ -431,7 +430,7 @@ local function DemoSpiral()
emitter = CCParticleSpiral:create()
-- emitter:retain()
background:addChild(tolua.cast(emitter,"CCNode"), 10)
background:addChild(emitter, 10)
emitter:setTexture(CCTextureCache:sharedTextureCache():addImage(s_fire))
@ -449,7 +448,7 @@ local function DemoSun()
emitter = CCParticleSun:create()
-- emitter:retain()
background:addChild(tolua.cast(emitter,"CCNode"), 10)
background:addChild(emitter, 10)
emitter:setTexture(CCTextureCache:sharedTextureCache():addImage(s_fire))
@ -467,7 +466,7 @@ local function DemoMeteor()
emitter = CCParticleMeteor:create()
-- emitter:retain()
background:addChild(tolua.cast(emitter,"CCNode"), 10)
background:addChild(emitter, 10)
emitter:setTexture(CCTextureCache:sharedTextureCache():addImage(s_fire))
@ -485,11 +484,11 @@ local function DemoFire()
emitter = CCParticleFire:create()
-- emitter:retain()
background:addChild(tolua.cast(emitter,"CCNode"), 10)
background:addChild(emitter, 10)
emitter:setTexture(CCTextureCache:sharedTextureCache():addImage(s_fire))
local pos_x, pos_y = tolua.cast(emitter,"CCNode"):getPosition()
tolua.cast(emitter,"CCNode"):setPosition(pos_x, 100)
local pos_x, pos_y = emitter:getPosition()
emitter:setPosition(pos_x, 100)
titleLabel:setString("ParticleFire")
return layer
@ -503,11 +502,11 @@ local function DemoSmoke()
emitter = CCParticleSmoke:create()
-- emitter:retain()
background:addChild(tolua.cast(emitter,"CCNode"), 10)
background:addChild(emitter, 10)
emitter:setTexture(CCTextureCache:sharedTextureCache():addImage(s_fire))
local pos_x, pos_y = tolua.cast(emitter,"CCNode"):getPosition()
tolua.cast(emitter,"CCNode"):setPosition(pos_x, 100)
local pos_x, pos_y = emitter:getPosition()
emitter:setPosition(pos_x, 100)
setEmitterPosition()
@ -523,11 +522,11 @@ local function DemoExplosion()
emitter = CCParticleExplosion:create()
-- emitter:retain()
background:addChild(tolua.cast(emitter,"CCNode"), 10)
background:addChild(emitter, 10)
emitter:setTexture(CCTextureCache:sharedTextureCache():addImage(s_stars1))
tolua.cast(emitter, "CCParticleSystem"):setAutoRemoveOnFinish(true)
emitter:setAutoRemoveOnFinish(true)
setEmitterPosition()
@ -543,36 +542,33 @@ local function DemoSnow()
emitter = CCParticleSnow:create()
-- emitter:retain()
local nodeEmitter = tolua.cast(emitter, "CCNode")
background:addChild(nodeEmitter, 10)
background:addChild(emitter, 10)
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)
local pos_x, pos_y = emitter:getPosition()
emitter:setPosition(pos_x, pos_y - 110)
emitter:setLife(3)
emitter:setLifeVar(1)
-- gravity
systemEmitter:setGravity(CCPointMake(0, -10))
emitter:setGravity(CCPointMake(0, -10))
-- speed of particles
systemEmitter:setSpeed(130)
systemEmitter:setSpeedVar(30)
emitter:setSpeed(130)
emitter:setSpeedVar(30)
local startColor = systemEmitter:getStartColor()
local startColor = emitter:getStartColor()
startColor.r = 0.9
startColor.g = 0.9
startColor.b = 0.9
systemEmitter:setStartColor(startColor)
emitter:setStartColor(startColor)
local startColorVar = systemEmitter:getStartColorVar()
local startColorVar = emitter:getStartColorVar()
startColorVar.b = 0.1
systemEmitter:setStartColorVar(startColorVar)
emitter:setStartColorVar(startColorVar)
systemEmitter:setEmissionRate(systemEmitter:getTotalParticles() / systemEmitter:getLife())
emitter:setEmissionRate(emitter:getTotalParticles() / emitter:getLife())
systemEmitter:setTexture(CCTextureCache:sharedTextureCache():addImage(s_snow))
emitter:setTexture(CCTextureCache:sharedTextureCache():addImage(s_snow))
setEmitterPosition()
@ -588,13 +584,11 @@ local function DemoRain()
emitter = CCParticleRain:create()
-- emitter:retain()
background:addChild(emitter, 10)
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)
local pos_x, pos_y = emitter:getPosition()
emitter:setPosition(pos_x, pos_y - 100)
emitter:setLife(4)
emitter:setTexture(CCTextureCache:sharedTextureCache():addImage(s_fire))
@ -827,17 +821,14 @@ local function DemoRing()
emitter = CCParticleFlower:create()
-- emitter:retain()
local nodeEmitter = tolua.cast(emitter, "CCNode")
background:addChild(nodeEmitter, 10)
background:addChild(emitter, 10)
emitter:setTexture(CCTextureCache:sharedTextureCache():addImage(s_stars1))
local systemEmitter = tolua.cast(emitter, "CCParticleSystem")
systemEmitter:setLifeVar(0)
systemEmitter:setLife(10)
systemEmitter:setSpeed(100)
systemEmitter:setSpeedVar(0)
systemEmitter:setEmissionRate(10000)
emitter:setLifeVar(0)
emitter:setLife(10)
emitter:setSpeed(100)
emitter:setSpeedVar(0)
emitter:setEmissionRate(10000)
setEmitterPosition()
@ -867,12 +858,11 @@ local function ParallaxParticle()
-- emitter:retain()
emitter:setTexture(CCTextureCache:sharedTextureCache():addImage(s_fire))
local nodeEmitter = tolua.cast(emitter, "CCNode")
p1:addChild(nodeEmitter, 10)
nodeEmitter:setPosition(250, 200)
p1:addChild(emitter, 10)
emitter:setPosition(250, 200)
local par = CCParticleSun:create()
p2:addChild(tolua.cast(par,"CCNode"), 10)
p2:addChild(par, 10)
par:setTexture(CCTextureCache:sharedTextureCache():addImage(s_fire))
local move = CCMoveBy:create(4, CCPointMake(300,0))
@ -1138,9 +1128,9 @@ end
local function Issue870_onEnterOrExit(tag)
local scheduler = CCDirector:sharedDirector():getScheduler()
if tag == 0 then
if tag == "enter" then
Issue870_entry = scheduler:scheduleScriptFunc(updateQuads, 2.0, false)
elseif tag == 1 then
elseif tag == "exit" then
scheduler:unscheduleScriptEntry(Issue870_entry)
end
end
@ -1250,9 +1240,9 @@ end
local function AddAndDeleteParticleSystems_onEnterOrExit(tag)
local scheduler = CCDirector:sharedDirector():getScheduler()
if tag == 0 then
if tag == "enter" then
AddAndDeleteParticleSystems_entry = scheduler:scheduleScriptFunc(removeSystem, 2.0, false)
elseif tag == 1 then
elseif tag == "exit" then
scheduler:unscheduleScriptEntry(AddAndDeleteParticleSystems_entry)
end
end
@ -1308,9 +1298,9 @@ end
local function ReorderParticleSystems_onEnterOrExit(tag)
local scheduler = CCDirector:sharedDirector():getScheduler()
if tag == 0 then
if tag == "enter" then
ReorderParticleSystems_entry = scheduler:scheduleScriptFunc(reorderSystem, 2.0, false)
elseif tag == 1 then
elseif tag == "exit" then
scheduler:unscheduleScriptEntry(ReorderParticleSystems_entry)
end
end
@ -1494,18 +1484,19 @@ function CreateParticleLayer()
elseif SceneIdx == 29 then return DemoParticleFromFile("Spiral")
elseif SceneIdx == 30 then return DemoParticleFromFile("Galaxy")
elseif SceneIdx == 31 then return DemoParticleFromFile("Phoenix")
elseif SceneIdx == 32 then return RadiusMode1()
elseif SceneIdx == 33 then return RadiusMode2()
elseif SceneIdx == 34 then return Issue704()
elseif SceneIdx == 35 then return Issue870()
elseif SceneIdx == 32 then return DemoParticleFromFile("lines")
elseif SceneIdx == 33 then return RadiusMode1()
elseif SceneIdx == 34 then return RadiusMode2()
elseif SceneIdx == 35 then return Issue704()
elseif SceneIdx == 36 then return Issue870()
--elseif SceneIdx == 36 then return Issue1201()
-- v1.1 tests
elseif SceneIdx == 36 then return MultipleParticleSystems()
elseif SceneIdx == 37 then return MultipleParticleSystemsBatched()
elseif SceneIdx == 38 then return AddAndDeleteParticleSystems()
elseif SceneIdx == 39 then return ReorderParticleSystems()
elseif SceneIdx == 40 then return PremultipliedAlphaTest()
elseif SceneIdx == 41 then return PremultipliedAlphaTest2()
elseif SceneIdx == 37 then return MultipleParticleSystems()
elseif SceneIdx == 38 then return MultipleParticleSystemsBatched()
elseif SceneIdx == 39 then return AddAndDeleteParticleSystems()
elseif SceneIdx == 40 then return ReorderParticleSystems()
elseif SceneIdx == 41 then return PremultipliedAlphaTest()
elseif SceneIdx == 42 then return PremultipliedAlphaTest2()
end
end

View File

@ -20,9 +20,9 @@ local s = CCDirector:sharedDirector():getWinSize()
----------------------------------
local function menuCallback(tag)
local scene = nil
tag = tag - kItemTagBasic
-- tag = tag - kItemTagBasic
if tag == 0 then
if tag == "enter" then
scene = PerformanceSpriteTest()
elseif tag == 1 then

View File

@ -1 +1 @@
3c831a2c7337edf8167b0ce7755dbfc684101679
0aa3ba8dd2ff9f99cb66b8a8f301a46816dcd75b

10
tools/tolua++/CCSet.pkg Normal file
View File

@ -0,0 +1,10 @@
class CCSet : public CCObject
{
CCSet* copy();
int count();
void addObject(CCObject *pObject);
void removeObject(CCObject *pObject);
void removeAllObjects();
bool containsObject(CCObject *pObject);
CCObject* anyObject();
};

View File

@ -60,8 +60,8 @@ $pfile "CCLabelTTF.pkg"
$pfile "CCMenu.pkg"
$pfile "CCMenuItem.pkg"
$pfile "CCParallaxNode.pkg"
$pfile "CCParticleExamples.pkg"
$pfile "CCParticleSystem.pkg"
$pfile "CCParticleExamples.pkg"
$pfile "CCParticleBatchNode.pkg"
$pfile "CCProgressTimer.pkg"
$pfile "CCTextFieldTTF.pkg"
@ -72,4 +72,6 @@ $pfile "CCTMXTiledMap.pkg"
$pfile "CCTMXXMLParser.pkg"
$pfile "CCTouch.pkg"
$pfile "CCSet.pkg"
$pfile "SimpleAudioEngine.pkg"

View File

@ -1,4 +1,15 @@
#define GL_ZERO 0
#define GL_ONE 1
#define GL_SRC_COLOR 0x0300
#define GL_ONE_MINUS_SRC_COLOR 0x0301
#define GL_SRC_ALPHA 0x0302
#define GL_ONE_MINUS_SRC_ALPHA 0x0303
#define GL_DST_ALPHA 0x0304
#define GL_ONE_MINUS_DST_ALPHA 0x0305
#define GL_DST_COLOR 0x0306
#define GL_ONE_MINUS_DST_COLOR 0x0307
typedef unsigned char GLubyte;
typedef int GLint;
typedef int GLsizei;