issue #2433:Modify lua binding generator template and releated action test

This commit is contained in:
samuele3hu 2013-08-14 21:35:55 +08:00
parent 980bea8a97
commit 13fd369beb
22 changed files with 1841 additions and 962 deletions

View File

@ -179,10 +179,10 @@ public:
virtual void setMargins(int marginH, int marginV); virtual void setMargins(int marginH, int marginV);
// Overrides // Overrides
virtual bool ccTouchBegan(Touch *pTouch, cocos2d::Event *pEvent) override; virtual bool ccTouchBegan(Touch *pTouch, Event *pEvent) override;
virtual void ccTouchMoved(Touch *pTouch, cocos2d::Event *pEvent) override; virtual void ccTouchMoved(Touch *pTouch, Event *pEvent) override;
virtual void ccTouchEnded(Touch *pTouch, cocos2d::Event *pEvent) override; virtual void ccTouchEnded(Touch *pTouch, Event *pEvent) override;
virtual void ccTouchCancelled(Touch *pTouch, cocos2d::Event *pEvent) override; virtual void ccTouchCancelled(Touch *pTouch, Event *pEvent) override;
virtual GLubyte getOpacity(void) const override; virtual GLubyte getOpacity(void) const override;
virtual void setOpacity(GLubyte var) override; virtual void setOpacity(GLubyte var) override;
virtual const Color3B& getColor(void) const override; virtual const Color3B& getColor(void) const override;

View File

@ -1,7 +1,4 @@
cc = cc or {} require "Cocos2d"
function cc.rect(_x,_y,_width,_height)
return { x = _x, y = _y, width = _width, height = _height }
end
-- cclog -- cclog
cclog = function(...) cclog = function(...)
print(string.format(...)) print(string.format(...))

View File

@ -1,7 +1,7 @@
local kTagNode = 0 local kTagNode = 0
local kTagGrossini = 1 local kTagGrossini = 1
local kTagSequence = 2 local kTagSequence = 2
local scheduler = CCDirector:getInstance():getScheduler() local scheduler = cc.Director:getInstance():getScheduler()
-------------------------------------------------------------------- --------------------------------------------------------------------
-- --
-- Test1 -- Test1
@ -11,28 +11,33 @@ local scheduler = CCDirector:getInstance():getScheduler()
local function CrashTest() local function CrashTest()
local ret = createTestLayer("Test 1. Should not crash") local ret = createTestLayer("Test 1. Should not crash")
local child = CCSprite:create(s_pPathGrossini) local child = cc.Sprite:create(s_pPathGrossini)
child:setPosition( VisibleRect:center() ) child:setPosition( 200,200 )
ret:addChild(child, 1) ret:addChild(child, 1)
--Sum of all action's duration is 1.5 second. --Sum of all action's duration is 1.5 second.
child:runAction(CCRotateBy:create(1.5, 90)) child:runAction(cc.RotateBy:create(1.5, 90))
--[[
local arr = CCArray:create() local arr = CCArray:create()
arr:addObject(CCDelayTime:create(1.4)) arr:addObject(CCDelayTime:create(1.4))
arr:addObject(CCFadeOut:create(1.1)) arr:addObject(CCFadeOut:create(1.1))
child:runAction(CCSequence:create(arr)) ]]--
child:runAction(cc.Sequence:create(cc.DelayTime:create(1.4),cc.FadeOut:create(1.1)))
--[[
arr = CCArray:create() arr = CCArray:create()
arr:addObject(CCDelayTime:create(1.4)) arr:addObject(CCDelayTime:create(1.4))
]]--
local function removeThis() local function removeThis()
ret:getParent():removeChild(ret, true) ret:getParent():removeChild(ret, true)
Helper.nextAction() Helper.nextAction()
end end
--[[
local callfunc = CCCallFunc:create(removeThis) local callfunc = CCCallFunc:create(removeThis)
arr:addObject(callfunc) arr:addObject(callfunc)
]]--
--After 1.5 second, self will be removed. --After 1.5 second, self will be removed.
ret:runAction( CCSequence:create(arr)) ret:runAction( cc.Sequence:create(cc.DelayTime:create(1.4),cc.CallFunc:create(removeThis)))
return ret return ret
end end
@ -44,21 +49,22 @@ end
-------------------------------------------------------------------- --------------------------------------------------------------------
local function LogicTest() local function LogicTest()
local ret = createTestLayer("Logic test") local ret = createTestLayer("Logic test")
local grossini = CCSprite:create(s_pPathGrossini) local grossini = cc.Sprite:create(s_pPathGrossini)
ret:addChild(grossini, 0, 2) ret:addChild(grossini, 0, 2)
grossini:setPosition(VisibleRect:center()) grossini:setPosition(200,200)
--[[
local arr = CCArray:create() local arr = CCArray:create()
arr:addObject(CCMoveBy:create(1, CCPoint(150,0))) arr:addObject(CCMoveBy:create(1, CCPoint(150,0)))
]]--
local function bugMe(node) local function bugMe(node)
node:stopAllActions() --After this stop next action not working, if remove this stop everything is working node:stopAllActions() --After this stop next action not working, if remove this stop everything is working
node:runAction(CCScaleTo:create(2, 2)) node:runAction(cc.ScaleTo:create(2, 2))
end end
--[[
local callfunc = CCCallFunc:create(bugMe) local callfunc = CCCallFunc:create(bugMe)
arr:addObject(callfunc) arr:addObject(callfunc)
grossini:runAction( CCSequence:create(arr)); ]]--
grossini:runAction( cc.Sequence:create(cc.MoveBy:create(1, cc.p(150,0)) ,cc.CallFunc:create(bugMe)))
return ret return ret
end end
@ -75,23 +81,24 @@ local function PauseTest()
scheduler:unscheduleScriptEntry(schedulerEntry) scheduler:unscheduleScriptEntry(schedulerEntry)
schedulerEntry = nil schedulerEntry = nil
local node = ret:getChildByTag( kTagGrossini ) local node = ret:getChildByTag( kTagGrossini )
local pDirector = CCDirector:getInstance() local pDirector = cc.Director:getInstance()
pDirector:getActionManager():resumeTarget(node) pDirector:getActionManager():resumeTarget(node)
end end
local function onNodeEvent(event) local function onNodeEvent(event)
if event == "enter" then if event == "enter" then
local l = CCLabelTTF:create("After 3 seconds grossini should move", "Thonburi", 16) local s = cc.Director:getInstance():getWinSize()
local l = cc.LabelTTF:create("After 3 seconds grossini should move", "Thonburi", 16)
ret:addChild(l) ret:addChild(l)
l:setPosition( CCPoint(VisibleRect:center().x, VisibleRect:top().y-75) ) l:setPosition( cc.p(s.width / 2, 245) )
local grossini = CCSprite:create(s_pPathGrossini) local grossini = cc.Sprite:create(s_pPathGrossini)
ret:addChild(grossini, 0, kTagGrossini) ret:addChild(grossini, 0, kTagGrossini)
grossini:setPosition(VisibleRect:center() ) grossini:setPosition(cc.p(200,200))
local action = CCMoveBy:create(1, CCPoint(150,0)) local action = cc.MoveBy:create(1, cc.p(150,0))
local pDirector = CCDirector:getInstance() local pDirector = cc.Director:getInstance()
pDirector:getActionManager():addAction(action, grossini, true) pDirector:getActionManager():addAction(action, grossini, true)
schedulerEntry = scheduler:scheduleScriptFunc(unpause, 3.0, false) schedulerEntry = scheduler:scheduleScriptFunc(unpause, 3.0, false)
@ -114,25 +121,28 @@ end
-------------------------------------------------------------------- --------------------------------------------------------------------
local function RemoveTest() local function RemoveTest()
local ret = createTestLayer("Remove Test") local ret = createTestLayer("Remove Test")
local l = CCLabelTTF:create("Should not crash", "Thonburi", 16) local l = cc.LabelTTF:create("Should not crash", "Thonburi", 16)
local s = cc.Director:getInstance():getWinSize()
ret:addChild(l) ret:addChild(l)
l:setPosition( CCPoint(VisibleRect:center().x, VisibleRect:top().y - 75) ) l:setPosition( cc.p(s.width / 2, 245))
local pMove = CCMoveBy:create(2, CCPoint(200, 0)) local pMove = cc.MoveBy:create(2, cc.p(200, 0))
local function stopAction() local function stopAction()
local pSprite = ret:getChildByTag(kTagGrossini) local pSprite = ret:getChildByTag(kTagGrossini)
pSprite:stopActionByTag(kTagSequence) pSprite:stopActionByTag(kTagSequence)
end end
local callfunc = CCCallFunc:create(stopAction) local callfunc = cc.CallFunc:create(stopAction)
--[[
local arr = CCArray:create() local arr = CCArray:create()
arr:addObject(pMove) arr:addObject(pMove)
arr:addObject(callfunc) arr:addObject(callfunc)
local pSequence = CCSequence:create(arr) ]]--
local pSequence = cc.Sequence:create(pMove,callfunc)
pSequence:setTag(kTagSequence) pSequence:setTag(kTagSequence)
local pChild = CCSprite:create(s_pPathGrossini) local pChild = cc.Sprite:create(s_pPathGrossini)
pChild:setPosition( VisibleRect:center() ) pChild:setPosition( 200, 200 )
ret:addChild(pChild, 1, kTagGrossini) ret:addChild(pChild, 1, kTagGrossini)
pChild:runAction(pSequence) pChild:runAction(pSequence)
@ -153,26 +163,27 @@ local function ResumeTest()
scheduler:unscheduleScriptEntry(schedulerEntry) scheduler:unscheduleScriptEntry(schedulerEntry)
schedulerEntry = nil schedulerEntry = nil
local pGrossini = ret:getChildByTag(kTagGrossini) local pGrossini = ret:getChildByTag(kTagGrossini)
local pDirector = CCDirector:getInstance() local pDirector = cc.Director:getInstance()
pDirector:getActionManager():resumeTarget(pGrossini) pDirector:getActionManager():resumeTarget(pGrossini)
end end
local function onNodeEvent(event) local function onNodeEvent(event)
if event == "enter" then if event == "enter" then
local l = CCLabelTTF:create("Grossini only rotate/scale in 3 seconds", "Thonburi", 16) local l = cc.LabelTTF:create("Grossini only rotate/scale in 3 seconds", "Thonburi", 16)
ret:addChild(l) ret:addChild(l)
l:setPosition( CCPoint(VisibleRect:center().x, VisibleRect:top().y - 75)) local s = cc.Director:getInstance():getWinSize()
l:setPosition( s.width / 2, 245)
local pGrossini = CCSprite:create(s_pPathGrossini) local pGrossini = cc.Sprite:create(s_pPathGrossini)
ret:addChild(pGrossini, 0, kTagGrossini) ret:addChild(pGrossini, 0, kTagGrossini)
pGrossini:setPosition(VisibleRect:center()) pGrossini:setPosition(200,200)
pGrossini:runAction(CCScaleBy:create(2, 2)) pGrossini:runAction(cc.ScaleBy:create(2, 2))
local pDirector = CCDirector:getInstance() local pDirector = cc.Director:getInstance()
pDirector:getActionManager():pauseTarget(pGrossini) pDirector:getActionManager():pauseTarget(pGrossini)
pGrossini:runAction(CCRotateBy:create(2, 360)) pGrossini:runAction(cc.RotateBy:create(2, 360))
schedulerEntry = scheduler:scheduleScriptFunc(resumeGrossini, 3.0, false) schedulerEntry = scheduler:scheduleScriptFunc(resumeGrossini, 3.0, false)
elseif event == "exit" then elseif event == "exit" then
@ -191,8 +202,8 @@ end
function ActionManagerTestMain() function ActionManagerTestMain()
cclog("ActionManagerTestMain") cclog("ActionManagerTestMain")
Helper.index = 1 Helper.index = 1
CCDirector:getInstance():setDepthTest(true) cc.Director:getInstance():setDepthTest(true)
local scene = CCScene:create() local scene = cc.Scene:create()
Helper.createFunctionTable = { Helper.createFunctionTable = {
CrashTest, CrashTest,

View File

@ -2,37 +2,37 @@ local kTagAction1 = 1
local kTagAction2 = 2 local kTagAction2 = 2
local kTagSlider = 1 local kTagSlider = 1
local s = CCDirector:getInstance():getWinSize() local s = cc.Director:getInstance():getWinSize()
local scheduler = CCDirector:getInstance():getScheduler() local scheduler = cc.Director:getInstance():getScheduler()
local function createSimpleMoveBy() local function createSimpleMoveBy()
return CCMoveBy:create(3, CCPoint(s.width - 130, 0)) return cc.MoveBy:create(3, cc.p(s.width - 130, 0))
end end
local function createSimpleDelayTime() local function createSimpleDelayTime()
return CCDelayTime:create(0.25) return cc.DelayTime:create(0.25)
end end
local function positionForTwo() local function positionForTwo()
grossini:setPosition(CCPoint(60, s.height * 1 / 5)) grossini:setPosition(cc.p(60, s.height * 1 / 5))
tamara:setPosition(CCPoint(60, s.height * 4 / 5)) tamara:setPosition(cc.p(60, s.height * 4 / 5))
kathia:setVisible(false) kathia:setVisible(false)
end end
local function getBaseLayer() local function getBaseLayer()
local layer = CCLayer:create() local layer = cc.Layer:create()
grossini = CCSprite:create(s_pPathGrossini) grossini = cc.Sprite:create(s_pPathGrossini)
tamara = CCSprite:create(s_pPathSister1) tamara = cc.Sprite:create(s_pPathSister1)
kathia = CCSprite:create(s_pPathSister2) kathia = cc.Sprite:create(s_pPathSister2)
layer:addChild(grossini, 3) layer:addChild(grossini, 3)
layer:addChild(kathia, 2) layer:addChild(kathia, 2)
layer:addChild(tamara, 1) layer:addChild(tamara, 1)
grossini:setPosition(CCPoint(60, s.height * 1 / 5)) grossini:setPosition(cc.p(60, s.height * 1 / 5))
kathia:setPosition(CCPoint(60, s.height * 2.5 / 5)) kathia:setPosition(cc.p(60, s.height * 2.5 / 5))
tamara:setPosition(CCPoint(60, s.height * 4 / 5)) tamara:setPosition(cc.p(60, s.height * 4 / 5))
Helper.initWithLayer(layer) Helper.initWithLayer(layer)
@ -65,40 +65,43 @@ local function SpriteEase()
local move = createSimpleMoveBy() local move = createSimpleMoveBy()
local move_back = move:reverse() local move_back = move:reverse()
local move_ease_in = CCEaseIn:create(createSimpleMoveBy(), 2.5) local move_ease_in = cc.EaseIn:create(createSimpleMoveBy(), 2.5)
local move_ease_in_back = move_ease_in:reverse() local move_ease_in_back = move_ease_in:reverse()
local move_ease_out = CCEaseOut:create(createSimpleMoveBy(), 2.5) local move_ease_out = cc.EaseOut:create(createSimpleMoveBy(), 2.5)
local move_ease_out_back = move_ease_out:reverse() local move_ease_out_back = move_ease_out:reverse()
local delay = createSimpleDelayTime() local delay = createSimpleDelayTime()
--[[
local arr1 = CCArray:create() local arr1 = CCArray:create()
arr1:addObject(move) arr1:addObject(move)
arr1:addObject(delay) arr1:addObject(delay)
arr1:addObject(move_back) arr1:addObject(move_back)
arr1:addObject(createSimpleDelayTime()) arr1:addObject(createSimpleDelayTime())
local seq1 = CCSequence:create(arr1) ]]--
local seq1 = cc.Sequence:create(move, delay, move_back, createSimpleDelayTime())
--[[
local arr2 = CCArray:create() local arr2 = CCArray:create()
arr2:addObject(move_ease_in) arr2:addObject(move_ease_in)
arr2:addObject(createSimpleDelayTime()) arr2:addObject(createSimpleDelayTime())
arr2:addObject(move_ease_in_back) arr2:addObject(move_ease_in_back)
arr2:addObject(createSimpleDelayTime()) arr2:addObject(createSimpleDelayTime())
local seq2 = CCSequence:create(arr2) ]]--
local seq2 = cc.Sequence:create(move_ease_in,createSimpleDelayTime(),move_ease_in_back,createSimpleDelayTime())
--[[
local arr3 = CCArray:create() local arr3 = CCArray:create()
arr3:addObject(move_ease_out) arr3:addObject(move_ease_out)
arr3:addObject(createSimpleDelayTime()) arr3:addObject(createSimpleDelayTime())
arr3:addObject(move_ease_out_back) arr3:addObject(move_ease_out_back)
arr3:addObject(createSimpleDelayTime()) arr3:addObject(createSimpleDelayTime())
local seq3 = CCSequence:create(arr3) ]]--
local seq3 = cc.Sequence:create(move_ease_out,createSimpleDelayTime(),move_ease_out_back,createSimpleDelayTime())
local a2 = grossini:runAction(CCRepeatForever:create(seq1)) local a2 = grossini:runAction(cc.RepeatForever:create(seq1))
a2:setTag(1) a2:setTag(1)
local a1 = tamara:runAction(CCRepeatForever:create(seq2)) local a1 = tamara:runAction(cc.RepeatForever:create(seq2))
a1:setTag(1) a1:setTag(1)
local a = kathia:runAction(CCRepeatForever:create(seq3)) local a = kathia:runAction(cc.RepeatForever:create(seq3))
a:setTag(1) a:setTag(1)
layer:registerScriptHandler(SpriteEase_onEnterOrExit) layer:registerScriptHandler(SpriteEase_onEnterOrExit)
@ -115,41 +118,45 @@ local function SpriteEaseInOut()
local move = createSimpleMoveBy() local move = createSimpleMoveBy()
local move_ease_inout1 = CCEaseInOut:create(createSimpleMoveBy(), 0.65) local move_ease_inout1 = cc.EaseInOut:create(createSimpleMoveBy(), 0.65)
local move_ease_inout_back1 = move_ease_inout1:reverse() local move_ease_inout_back1 = move_ease_inout1:reverse()
local move_ease_inout2 = CCEaseInOut:create(createSimpleMoveBy(), 1.35) local move_ease_inout2 = cc.EaseInOut:create(createSimpleMoveBy(), 1.35)
local move_ease_inout_back2 = move_ease_inout2:reverse() local move_ease_inout_back2 = move_ease_inout2:reverse()
local move_ease_inout3 = CCEaseInOut:create(createSimpleMoveBy(), 1.0) local move_ease_inout3 = cc.EaseInOut:create(createSimpleMoveBy(), 1.0)
local move_ease_inout_back3 = move_ease_inout3:reverse() local move_ease_inout_back3 = move_ease_inout3:reverse()
local delay = createSimpleDelayTime() local delay = createSimpleDelayTime()
--[[
local arr1 = CCArray:create() local arr1 = CCArray:create()
arr1:addObject(move_ease_inout1) arr1:addObject(move_ease_inout1)
arr1:addObject(delay) arr1:addObject(delay)
arr1:addObject(move_ease_inout_back1) arr1:addObject(move_ease_inout_back1)
arr1:addObject(createSimpleDelayTime()) arr1:addObject(createSimpleDelayTime())
local seq1 = CCSequence:create(arr1) ]]--
local seq1 = cc.Sequence:create(move_ease_inout1,delay,move_ease_inout_back1,createSimpleDelayTime())
--[[
local arr2 = CCArray:create() local arr2 = CCArray:create()
arr2:addObject(move_ease_inout2) arr2:addObject(move_ease_inout2)
arr2:addObject(createSimpleDelayTime()) arr2:addObject(createSimpleDelayTime())
arr2:addObject(move_ease_inout_back2) arr2:addObject(move_ease_inout_back2)
arr2:addObject(createSimpleDelayTime()) arr2:addObject(createSimpleDelayTime())
local seq2 = CCSequence:create(arr2) ]]--
local seq2 = cc.Sequence:create(move_ease_inout2,createSimpleDelayTime(),move_ease_inout_back2,createSimpleDelayTime())
--[[
local arr3 = CCArray:create() local arr3 = CCArray:create()
arr3:addObject(move_ease_inout3) arr3:addObject(move_ease_inout3)
arr3:addObject(createSimpleDelayTime()) arr3:addObject(createSimpleDelayTime())
arr3:addObject(move_ease_inout_back3) arr3:addObject(move_ease_inout_back3)
arr3:addObject(createSimpleDelayTime()) arr3:addObject(createSimpleDelayTime())
local seq3 = CCSequence:create(arr3) ]]--
local seq3 = cc.Sequence:create(move_ease_inout3, createSimpleDelayTime(), move_ease_inout_back3, createSimpleDelayTime() )
tamara:runAction(CCRepeatForever:create(seq1)) tamara:runAction(cc.RepeatForever:create(seq1))
kathia:runAction(CCRepeatForever:create(seq2)) kathia:runAction(cc.RepeatForever:create(seq2))
grossini:runAction(CCRepeatForever:create(seq3)) grossini:runAction(cc.RepeatForever:create(seq3))
Helper.titleLabel:setString("EaseInOut and rates") Helper.titleLabel:setString("EaseInOut and rates")
return layer return layer
@ -164,22 +171,24 @@ local function SpriteEaseExponential()
local move = createSimpleMoveBy() local move = createSimpleMoveBy()
local move_back = move:reverse() local move_back = move:reverse()
local move_ease_in = CCEaseExponentialIn:create(createSimpleMoveBy()) local move_ease_in = cc.EaseExponentialIn:create(createSimpleMoveBy())
local move_ease_in_back = move_ease_in:reverse() local move_ease_in_back = move_ease_in:reverse()
local move_ease_out = CCEaseExponentialOut:create(createSimpleMoveBy()) local move_ease_out = cc.EaseExponentialOut:create(createSimpleMoveBy())
local move_ease_out_back = move_ease_out:reverse() local move_ease_out_back = move_ease_out:reverse()
local delay = createSimpleDelayTime() local delay = createSimpleDelayTime()
--[[
local arr1 = CCArray:create() local arr1 = CCArray:create()
arr1:addObject(move) arr1:addObject(move)
arr1:addObject(delay) arr1:addObject(delay)
arr1:addObject(move_back) arr1:addObject(move_back)
arr1:addObject(createSimpleDelayTime()) arr1:addObject(createSimpleDelayTime())
local seq1 = CCSequence:create(arr1) ]]--
local seq1 = cc.Sequence:create(move, delay, move_back, createSimpleDelayTime() )
--[[
local arr2 = CCArray:create() local arr2 = CCArray:create()
arr2:addObject(move_ease_in) arr2:addObject(move_ease_in)
@ -187,8 +196,10 @@ local function SpriteEaseExponential()
arr2:addObject(move_ease_in_back) arr2:addObject(move_ease_in_back)
arr2:addObject(createSimpleDelayTime()) arr2:addObject(createSimpleDelayTime())
local seq2 = CCSequence:create(arr2) ]]--
local seq2 = cc.Sequence:create(move_ease_in, createSimpleDelayTime(), move_ease_in_back, createSimpleDelayTime() )
--[[
local arr3 = CCArray:create() local arr3 = CCArray:create()
arr3:addObject(move_ease_out) arr3:addObject(move_ease_out)
@ -196,11 +207,12 @@ local function SpriteEaseExponential()
arr3:addObject(move_ease_out_back) arr3:addObject(move_ease_out_back)
arr3:addObject(createSimpleDelayTime()) arr3:addObject(createSimpleDelayTime())
local seq3 = CCSequence:create(arr3) ]]--
local seq3 = cc.Sequence:create(move_ease_out, createSimpleDelayTime(), move_ease_out_back, createSimpleDelayTime() )
grossini:runAction(CCRepeatForever:create(seq1)) grossini:runAction(cc.RepeatForever:create(seq1))
tamara:runAction(CCRepeatForever:create(seq2)) tamara:runAction(cc.RepeatForever:create(seq2))
kathia:runAction(CCRepeatForever:create(seq3)) kathia:runAction(cc.RepeatForever:create(seq3))
Helper.titleLabel:setString("ExpIn - ExpOut actions") Helper.titleLabel:setString("ExpIn - ExpOut actions")
return layer return layer
@ -215,19 +227,21 @@ local function SpriteEaseExponentialInOut()
local move = createSimpleMoveBy() local move = createSimpleMoveBy()
local move_back = move:reverse() local move_back = move:reverse()
local move_ease = CCEaseExponentialInOut:create(createSimpleMoveBy()) local move_ease = cc.EaseExponentialInOut:create(createSimpleMoveBy())
local move_ease_back = move_ease:reverse() local move_ease_back = move_ease:reverse()
local delay = createSimpleDelayTime() local delay = createSimpleDelayTime()
--[[
local arr1 = CCArray:create() local arr1 = CCArray:create()
arr1:addObject(move) arr1:addObject(move)
arr1:addObject(delay) arr1:addObject(delay)
arr1:addObject(move_back) arr1:addObject(move_back)
arr1:addObject(createSimpleDelayTime()) arr1:addObject(createSimpleDelayTime())
local seq1 = CCSequence:create(arr1) ]]--
local seq1 = cc.Sequence:create(move, delay, move_back, createSimpleDelayTime())
--[[
local arr2 = CCArray:create() local arr2 = CCArray:create()
arr2:addObject(move_ease) arr2:addObject(move_ease)
@ -235,12 +249,13 @@ local function SpriteEaseExponentialInOut()
arr2:addObject(move_ease_back) arr2:addObject(move_ease_back)
arr2:addObject(createSimpleDelayTime()) arr2:addObject(createSimpleDelayTime())
local seq2 = CCSequence:create(arr2) ]]--
local seq2 = cc.Sequence:create(move_ease, createSimpleDelayTime(), move_ease_back, createSimpleDelayTime() )
positionForTwo() positionForTwo()
grossini:runAction(CCRepeatForever:create(seq1)) grossini:runAction(cc.RepeatForever:create(seq1))
tamara:runAction(CCRepeatForever:create(seq2)) tamara:runAction(cc.RepeatForever:create(seq2))
Helper.titleLabel:setString("EaseExponentialInOut action") Helper.titleLabel:setString("EaseExponentialInOut action")
return layer return layer
@ -255,38 +270,41 @@ local function SpriteEaseSine()
local move = createSimpleMoveBy() local move = createSimpleMoveBy()
local move_back = move:reverse() local move_back = move:reverse()
local move_ease_in = CCEaseSineIn:create(createSimpleMoveBy()) local move_ease_in = cc.EaseSineIn:create(createSimpleMoveBy())
local move_ease_in_back = move_ease_in:reverse() local move_ease_in_back = move_ease_in:reverse()
local move_ease_out = CCEaseSineOut:create(createSimpleMoveBy()) local move_ease_out = cc.EaseSineOut:create(createSimpleMoveBy())
local move_ease_out_back = move_ease_out:reverse() local move_ease_out_back = move_ease_out:reverse()
local delay = createSimpleDelayTime() local delay = createSimpleDelayTime()
--[[
local arr1 = CCArray:create() local arr1 = CCArray:create()
arr1:addObject(move) arr1:addObject(move)
arr1:addObject(delay) arr1:addObject(delay)
arr1:addObject(move_back) arr1:addObject(move_back)
arr1:addObject(createSimpleDelayTime()) arr1:addObject(createSimpleDelayTime())
local seq1 = CCSequence:create(arr1) ]]--
local seq1 = cc.Sequence:create(move, delay, move_back, createSimpleDelayTime() )
--[[
local arr2 = CCArray:create() local arr2 = CCArray:create()
arr2:addObject(move_ease_in) arr2:addObject(move_ease_in)
arr2:addObject(createSimpleDelayTime()) arr2:addObject(createSimpleDelayTime())
arr2:addObject(move_ease_in_back) arr2:addObject(move_ease_in_back)
arr2:addObject(createSimpleDelayTime()) arr2:addObject(createSimpleDelayTime())
local seq2 = CCSequence:create(arr2) ]]--
local seq2 = cc.Sequence:create(move_ease_in, createSimpleDelayTime(), move_ease_in_back, createSimpleDelayTime() )
--[[
local arr3 = CCArray:create() local arr3 = CCArray:create()
arr3:addObject(move_ease_out) arr3:addObject(move_ease_out)
arr3:addObject(createSimpleDelayTime()) arr3:addObject(createSimpleDelayTime())
arr3:addObject(move_ease_out_back) arr3:addObject(move_ease_out_back)
arr3:addObject(createSimpleDelayTime()) arr3:addObject(createSimpleDelayTime())
local seq3 = CCSequence:create(arr3) ]]--
local seq3 = cc.Sequence:create(move_ease_out, createSimpleDelayTime(), move_ease_out_back,createSimpleDelayTime() )
grossini:runAction(CCRepeatForever:create(seq1)) grossini:runAction(cc.RepeatForever:create(seq1))
tamara:runAction(CCRepeatForever:create(seq2)) tamara:runAction(cc.RepeatForever:create(seq2))
kathia:runAction(CCRepeatForever:create(seq3)) kathia:runAction(cc.RepeatForever:create(seq3))
Helper.titleLabel:setString("EaseSineIn - EaseSineOut") Helper.titleLabel:setString("EaseSineIn - EaseSineOut")
return layer return layer
@ -301,29 +319,31 @@ local function SpriteEaseSineInOut()
local move = createSimpleMoveBy() local move = createSimpleMoveBy()
local move_back = move:reverse() local move_back = move:reverse()
local move_ease = CCEaseSineInOut:create(createSimpleMoveBy()) local move_ease = cc.EaseSineInOut:create(createSimpleMoveBy())
local move_ease_back = move_ease:reverse() local move_ease_back = move_ease:reverse()
local delay = createSimpleDelayTime() local delay = createSimpleDelayTime()
--[[
local arr1 = CCArray:create() local arr1 = CCArray:create()
arr1:addObject(move) arr1:addObject(move)
arr1:addObject(delay) arr1:addObject(delay)
arr1:addObject(move_back) arr1:addObject(move_back)
arr1:addObject(createSimpleDelayTime()) arr1:addObject(createSimpleDelayTime())
local seq1 = CCSequence:create(arr1) ]]--
local seq1 = cc.Sequence:create(move, delay, move_back, createSimpleDelayTime() )
--[[
local arr2 = CCArray:create() local arr2 = CCArray:create()
arr2:addObject(move_ease) arr2:addObject(move_ease)
arr2:addObject(createSimpleDelayTime()) arr2:addObject(createSimpleDelayTime())
arr2:addObject(move_ease_back) arr2:addObject(move_ease_back)
arr2:addObject(createSimpleDelayTime()) arr2:addObject(createSimpleDelayTime())
local seq2 = CCSequence:create(arr2) ]]--
local seq2 = cc.Sequence:create(move_ease, createSimpleDelayTime(), move_ease_back, createSimpleDelayTime())
positionForTwo() positionForTwo()
grossini:runAction(CCRepeatForever:create(seq1)) grossini:runAction(cc.RepeatForever:create(seq1))
tamara:runAction(CCRepeatForever:create(seq2)) tamara:runAction(cc.RepeatForever:create(seq2))
Helper.titleLabel:setString("EaseSineInOut action") Helper.titleLabel:setString("EaseSineInOut action")
return layer return layer
@ -338,38 +358,41 @@ local function SpriteEaseElastic()
local move = createSimpleMoveBy() local move = createSimpleMoveBy()
local move_back = move:reverse() local move_back = move:reverse()
local move_ease_in = CCEaseElasticIn:create(createSimpleMoveBy()) local move_ease_in = cc.EaseElasticIn:create(createSimpleMoveBy())
local move_ease_in_back = move_ease_in:reverse() local move_ease_in_back = move_ease_in:reverse()
local move_ease_out = CCEaseElasticOut:create(createSimpleMoveBy()) local move_ease_out = cc.EaseElasticOut:create(createSimpleMoveBy())
local move_ease_out_back = move_ease_out:reverse() local move_ease_out_back = move_ease_out:reverse()
local delay = createSimpleDelayTime() local delay = createSimpleDelayTime()
--[[
local arr1 = CCArray:create() local arr1 = CCArray:create()
arr1:addObject(move) arr1:addObject(move)
arr1:addObject(delay) arr1:addObject(delay)
arr1:addObject(move_back) arr1:addObject(move_back)
arr1:addObject(createSimpleDelayTime()) arr1:addObject(createSimpleDelayTime())
local seq1 = CCSequence:create(arr1) ]]--
local seq1 = cc.Sequence:create(move, delay, move_back, createSimpleDelayTime() )
--[[
local arr2 = CCArray:create() local arr2 = CCArray:create()
arr2:addObject(move_ease_in) arr2:addObject(move_ease_in)
arr2:addObject(createSimpleDelayTime()) arr2:addObject(createSimpleDelayTime())
arr2:addObject(move_ease_in_back) arr2:addObject(move_ease_in_back)
arr2:addObject(createSimpleDelayTime()) arr2:addObject(createSimpleDelayTime())
local seq2 = CCSequence:create(arr2) ]]--
local seq2 = cc.Sequence:create(move_ease_in, createSimpleDelayTime(), move_ease_in_back, createSimpleDelayTime())
--[[
local arr3 = CCArray:create() local arr3 = CCArray:create()
arr3:addObject(move_ease_out) arr3:addObject(move_ease_out)
arr3:addObject(createSimpleDelayTime()) arr3:addObject(createSimpleDelayTime())
arr3:addObject(move_ease_out_back) arr3:addObject(move_ease_out_back)
arr3:addObject(createSimpleDelayTime()) arr3:addObject(createSimpleDelayTime())
local seq3 = CCSequence:create(arr3) ]]--
local seq3 = cc.Sequence:create(move_ease_out, createSimpleDelayTime(), move_ease_out_back, createSimpleDelayTime())
grossini:runAction(CCRepeatForever:create(seq1)) grossini:runAction(cc.RepeatForever:create(seq1))
tamara:runAction(CCRepeatForever:create(seq2)) tamara:runAction(cc.RepeatForever:create(seq2))
kathia:runAction(CCRepeatForever:create(seq3)) kathia:runAction(cc.RepeatForever:create(seq3))
Helper.titleLabel:setString("Elastic In - Out actions") Helper.titleLabel:setString("Elastic In - Out actions")
return layer return layer
@ -383,41 +406,44 @@ local function SpriteEaseElasticInOut()
local move = createSimpleMoveBy() local move = createSimpleMoveBy()
local move_ease_inout1 = CCEaseElasticInOut:create(createSimpleMoveBy(), 0.3) local move_ease_inout1 = cc.EaseElasticInOut:create(createSimpleMoveBy(), 0.3)
local move_ease_inout_back1 = move_ease_inout1:reverse() local move_ease_inout_back1 = move_ease_inout1:reverse()
local move_ease_inout2 = CCEaseElasticInOut:create(createSimpleMoveBy(), 0.45) local move_ease_inout2 = cc.EaseElasticInOut:create(createSimpleMoveBy(), 0.45)
local move_ease_inout_back2 = move_ease_inout2:reverse() local move_ease_inout_back2 = move_ease_inout2:reverse()
local move_ease_inout3 = CCEaseElasticInOut:create(createSimpleMoveBy(), 0.6) local move_ease_inout3 = cc.EaseElasticInOut:create(createSimpleMoveBy(), 0.6)
local move_ease_inout_back3 = move_ease_inout3:reverse() local move_ease_inout_back3 = move_ease_inout3:reverse()
local delay = createSimpleDelayTime() local delay = createSimpleDelayTime()
--[[
local arr1 = CCArray:create() local arr1 = CCArray:create()
arr1:addObject(move_ease_inout1) arr1:addObject(move_ease_inout1)
arr1:addObject(delay) arr1:addObject(delay)
arr1:addObject(move_ease_inout_back1) arr1:addObject(move_ease_inout_back1)
arr1:addObject(createSimpleDelayTime()) arr1:addObject(createSimpleDelayTime())
local seq1 = CCSequence:create(arr1) ]]--
local seq1 = cc.Sequence:create(move_ease_inout1, delay, move_ease_inout_back1, createSimpleDelayTime())
--[[
local arr2 = CCArray:create() local arr2 = CCArray:create()
arr2:addObject(move_ease_inout2) arr2:addObject(move_ease_inout2)
arr2:addObject(createSimpleDelayTime()) arr2:addObject(createSimpleDelayTime())
arr2:addObject(move_ease_inout_back2) arr2:addObject(move_ease_inout_back2)
arr2:addObject(createSimpleDelayTime()) arr2:addObject(createSimpleDelayTime())
local seq2 = CCSequence:create(arr2) ]]--
local seq2 = cc.Sequence:create(move_ease_inout2, createSimpleDelayTime(), move_ease_inout_back2, createSimpleDelayTime())
--[[
local arr3 = CCArray:create() local arr3 = CCArray:create()
arr3:addObject(move_ease_inout3) arr3:addObject(move_ease_inout3)
arr3:addObject(createSimpleDelayTime()) arr3:addObject(createSimpleDelayTime())
arr3:addObject(move_ease_inout_back3) arr3:addObject(move_ease_inout_back3)
arr3:addObject(createSimpleDelayTime()) arr3:addObject(createSimpleDelayTime())
local seq3 = CCSequence:create(arr3) ]]--
local seq3 = cc.Sequence:create(move_ease_inout3, createSimpleDelayTime(), move_ease_inout_back3, createSimpleDelayTime())
tamara:runAction(CCRepeatForever:create(seq1)) tamara:runAction(cc.RepeatForever:create(seq1))
kathia:runAction(CCRepeatForever:create(seq2)) kathia:runAction(cc.RepeatForever:create(seq2))
grossini:runAction(CCRepeatForever:create(seq3)) grossini:runAction(cc.RepeatForever:create(seq3))
Helper.titleLabel:setString("EaseElasticInOut action") Helper.titleLabel:setString("EaseElasticInOut action")
return layer return layer
@ -432,38 +458,41 @@ local function SpriteEaseBounce()
local move = createSimpleMoveBy() local move = createSimpleMoveBy()
local move_back = move:reverse() local move_back = move:reverse()
local move_ease_in = CCEaseBounceIn:create(createSimpleMoveBy()) local move_ease_in = cc.EaseBounceIn:create(createSimpleMoveBy())
local move_ease_in_back = move_ease_in:reverse() local move_ease_in_back = move_ease_in:reverse()
local move_ease_out = CCEaseBounceOut:create(createSimpleMoveBy()) local move_ease_out = cc.EaseBounceOut:create(createSimpleMoveBy())
local move_ease_out_back = move_ease_out:reverse() local move_ease_out_back = move_ease_out:reverse()
local delay = createSimpleDelayTime() local delay = createSimpleDelayTime()
--[[
local arr1 = CCArray:create() local arr1 = CCArray:create()
arr1:addObject(move) arr1:addObject(move)
arr1:addObject(delay) arr1:addObject(delay)
arr1:addObject(move_back) arr1:addObject(move_back)
arr1:addObject(createSimpleDelayTime()) arr1:addObject(createSimpleDelayTime())
local seq1 = CCSequence:create(arr1) ]]--
local seq1 = cc.Sequence:create(move, delay, move_back, createSimpleDelayTime() )
--[[
local arr2 = CCArray:create() local arr2 = CCArray:create()
arr2:addObject(move_ease_in) arr2:addObject(move_ease_in)
arr2:addObject(createSimpleDelayTime()) arr2:addObject(createSimpleDelayTime())
arr2:addObject(move_ease_in_back) arr2:addObject(move_ease_in_back)
arr2:addObject(createSimpleDelayTime()) arr2:addObject(createSimpleDelayTime())
local seq2 = CCSequence:create(arr2) ]]--
local seq2 = cc.Sequence:create(move_ease_in, createSimpleDelayTime(), move_ease_in_back, createSimpleDelayTime() )
--[[
local arr3 = CCArray:create() local arr3 = CCArray:create()
arr3:addObject(move_ease_out) arr3:addObject(move_ease_out)
arr3:addObject(createSimpleDelayTime()) arr3:addObject(createSimpleDelayTime())
arr3:addObject(move_ease_out_back) arr3:addObject(move_ease_out_back)
arr3:addObject(createSimpleDelayTime()) arr3:addObject(createSimpleDelayTime())
local seq3 = CCSequence:create(arr3) ]]--
local seq3 = cc.Sequence:create(move_ease_out, createSimpleDelayTime(), move_ease_out_back, createSimpleDelayTime())
grossini:runAction(CCRepeatForever:create(seq1)) grossini:runAction(cc.RepeatForever:create(seq1))
tamara:runAction(CCRepeatForever:create(seq2)) tamara:runAction(cc.RepeatForever:create(seq2))
kathia:runAction(CCRepeatForever:create(seq3)) kathia:runAction(cc.RepeatForever:create(seq3))
Helper.titleLabel:setString("Bounce In - Out actions") Helper.titleLabel:setString("Bounce In - Out actions")
return layer return layer
@ -478,29 +507,31 @@ local function SpriteEaseBounceInOut()
local move = createSimpleMoveBy() local move = createSimpleMoveBy()
local move_back = move:reverse() local move_back = move:reverse()
local move_ease = CCEaseBounceInOut:create(createSimpleMoveBy()) local move_ease = cc.EaseBounceInOut:create(createSimpleMoveBy())
local move_ease_back = move_ease:reverse() local move_ease_back = move_ease:reverse()
local delay = createSimpleDelayTime() local delay = createSimpleDelayTime()
--[[
local arr1 = CCArray:create() local arr1 = CCArray:create()
arr1:addObject(move) arr1:addObject(move)
arr1:addObject(delay) arr1:addObject(delay)
arr1:addObject(move_back) arr1:addObject(move_back)
arr1:addObject(createSimpleDelayTime()) arr1:addObject(createSimpleDelayTime())
local seq1 = CCSequence:create(arr1) ]]--
local seq1 = cc.Sequence:create(move, delay, move_back, createSimpleDelayTime())
--[[
local arr2 = CCArray:create() local arr2 = CCArray:create()
arr2:addObject(move_ease) arr2:addObject(move_ease)
arr2:addObject(createSimpleDelayTime()) arr2:addObject(createSimpleDelayTime())
arr2:addObject(move_ease_back) arr2:addObject(move_ease_back)
arr2:addObject(createSimpleDelayTime()) arr2:addObject(createSimpleDelayTime())
local seq2 = CCSequence:create(arr2) ]]--
local seq2 = cc.Sequence:create(move_ease, createSimpleDelayTime(), move_ease_back, createSimpleDelayTime())
positionForTwo() positionForTwo()
grossini:runAction(CCRepeatForever:create(seq1)) grossini:runAction(cc.RepeatForever:create(seq1))
tamara:runAction(CCRepeatForever:create(seq2)) tamara:runAction(cc.RepeatForever:create(seq2))
Helper.titleLabel:setString("EaseBounceInOut action") Helper.titleLabel:setString("EaseBounceInOut action")
return layer return layer
@ -515,38 +546,41 @@ local function SpriteEaseBack()
local move = createSimpleMoveBy() local move = createSimpleMoveBy()
local move_back = move:reverse() local move_back = move:reverse()
local move_ease_in = CCEaseBackIn:create(createSimpleMoveBy()) local move_ease_in = cc.EaseBackIn:create(createSimpleMoveBy())
local move_ease_in_back = move_ease_in:reverse() local move_ease_in_back = move_ease_in:reverse()
local move_ease_out = CCEaseBackOut:create(createSimpleMoveBy()) local move_ease_out = cc.EaseBackOut:create(createSimpleMoveBy())
local move_ease_out_back = move_ease_out:reverse() local move_ease_out_back = move_ease_out:reverse()
local delay = createSimpleDelayTime() local delay = createSimpleDelayTime()
--[[
local arr1 = CCArray:create() local arr1 = CCArray:create()
arr1:addObject(move) arr1:addObject(move)
arr1:addObject(delay) arr1:addObject(delay)
arr1:addObject(move_back) arr1:addObject(move_back)
arr1:addObject(createSimpleDelayTime()) arr1:addObject(createSimpleDelayTime())
local seq1 = CCSequence:create(arr1) ]]--
local seq1 = cc.Sequence:create(move, delay, move_back, createSimpleDelayTime())
--[[
local arr2 = CCArray:create() local arr2 = CCArray:create()
arr2:addObject(move_ease_in) arr2:addObject(move_ease_in)
arr2:addObject(createSimpleDelayTime()) arr2:addObject(createSimpleDelayTime())
arr2:addObject(move_ease_in_back) arr2:addObject(move_ease_in_back)
arr2:addObject(createSimpleDelayTime()) arr2:addObject(createSimpleDelayTime())
local seq2 = CCSequence:create(arr2) ]]--
local seq2 = cc.Sequence:create(move_ease_in, createSimpleDelayTime(), move_ease_in_back, createSimpleDelayTime())
--[[
local arr3 = CCArray:create() local arr3 = CCArray:create()
arr3:addObject(move_ease_out) arr3:addObject(move_ease_out)
arr3:addObject(createSimpleDelayTime()) arr3:addObject(createSimpleDelayTime())
arr3:addObject(move_ease_out_back) arr3:addObject(move_ease_out_back)
arr3:addObject(createSimpleDelayTime()) arr3:addObject(createSimpleDelayTime())
local seq3 = CCSequence:create(arr3) ]]--
local seq3 = cc.Sequence:create(move_ease_out, createSimpleDelayTime(), move_ease_out_back, createSimpleDelayTime())
grossini:runAction(CCRepeatForever:create(seq1)) grossini:runAction(cc.RepeatForever:create(seq1))
tamara:runAction(CCRepeatForever:create(seq2)) tamara:runAction(cc.RepeatForever:create(seq2))
kathia:runAction(CCRepeatForever:create(seq3)) kathia:runAction(cc.RepeatForever:create(seq3))
Helper.titleLabel:setString("Back In - Out actions") Helper.titleLabel:setString("Back In - Out actions")
return layer return layer
@ -561,29 +595,31 @@ local function SpriteEaseBackInOut()
local move = createSimpleMoveBy() local move = createSimpleMoveBy()
local move_back = move:reverse() local move_back = move:reverse()
local move_ease = CCEaseBackInOut:create(createSimpleMoveBy()) local move_ease = cc.EaseBackInOut:create(createSimpleMoveBy())
local move_ease_back = move_ease:reverse() local move_ease_back = move_ease:reverse()
local delay = createSimpleDelayTime() local delay = createSimpleDelayTime()
--[[
local arr1 = CCArray:create() local arr1 = CCArray:create()
arr1:addObject(move) arr1:addObject(move)
arr1:addObject(delay) arr1:addObject(delay)
arr1:addObject(move_back) arr1:addObject(move_back)
arr1:addObject(createSimpleDelayTime()) arr1:addObject(createSimpleDelayTime())
local seq1 = CCSequence:create(arr1) ]]--
local seq1 = cc.Sequence:create(move, delay, move_back, createSimpleDelayTime())
--[[
local arr2 = CCArray:create() local arr2 = CCArray:create()
arr2:addObject(move_ease) arr2:addObject(move_ease)
arr2:addObject(createSimpleDelayTime()) arr2:addObject(createSimpleDelayTime())
arr2:addObject(move_ease_back) arr2:addObject(move_ease_back)
arr2:addObject(createSimpleDelayTime()) arr2:addObject(createSimpleDelayTime())
local seq2 = CCSequence:create(arr2) ]]--
local seq2 = cc.Sequence:create(move_ease,createSimpleDelayTime(), move_ease_back, createSimpleDelayTime())
positionForTwo() positionForTwo()
grossini:runAction(CCRepeatForever:create(seq1)) grossini:runAction(cc.RepeatForever:create(seq1))
tamara:runAction(CCRepeatForever:create(seq2)) tamara:runAction(cc.RepeatForever:create(seq2))
Helper.titleLabel:setString("EaseBackInOut action") Helper.titleLabel:setString("EaseBackInOut action")
return layer return layer
@ -614,22 +650,22 @@ end
local function SpeedTest() local function SpeedTest()
local layer = getBaseLayer() local layer = getBaseLayer()
local jump1 = CCJumpBy:create(4, CCPoint(- s.width + 80, 0), 100, 4) local jump1 = cc.JumpBy:create(4, cc.p(- s.width + 80, 0), 100, 4)
local jump2 = jump1:reverse() local jump2 = jump1:reverse()
local rot1 = CCRotateBy:create(4, 360 * 2) local rot1 = cc.RotateBy:create(4, 360 * 2)
local rot2 = rot1:reverse() local rot2 = rot1:reverse()
local seq3_1 = CCSequence:createWithTwoActions(jump2, jump1) local seq3_1 = cc.Sequence:create(jump2, jump1)
local seq3_2 = CCSequence:createWithTwoActions(rot1, rot2) local seq3_2 = cc.Sequence:create(rot1, rot2)
local spawn = CCSpawn:createWithTwoActions(seq3_1, seq3_2) local spawn = cc.Spawn:create(seq3_1, seq3_2)
SpeedTest_action1 = CCSpeed:create(CCRepeatForever:create(spawn), 1.0) SpeedTest_action1 = cc.Speed:create(cc.RepeatForever:create(spawn), 1.0)
local spawn2 = tolua.cast(spawn:clone(), "CCSpawn") local spawn2 = tolua.cast(spawn:clone(), "Spawn")
SpeedTest_action2 = CCSpeed:create(CCRepeatForever:create(spawn2), 1.0) SpeedTest_action2 = cc.Speed:create(cc.RepeatForever:create(spawn2), 1.0)
local spawn3 = tolua.cast(spawn:clone(), "CCSpawn") local spawn3 = tolua.cast(spawn:clone(), "Spawn")
SpeedTest_action3 = CCSpeed:create(CCRepeatForever:create(spawn3), 1.0) SpeedTest_action3 = cc.Speed:create(cc.RepeatForever:create(spawn3), 1.0)
grossini:runAction(SpeedTest_action2) grossini:runAction(SpeedTest_action2)
tamara:runAction(SpeedTest_action3) tamara:runAction(SpeedTest_action3)
@ -642,7 +678,7 @@ local function SpeedTest()
end end
function EaseActionsTest() function EaseActionsTest()
local scene = CCScene:create() local scene = cc.Scene:create()
cclog("EaseActionsTest") cclog("EaseActionsTest")
Helper.createFunctionTable = { Helper.createFunctionTable = {

View File

@ -1,28 +1,28 @@
local s = CCDirector:getInstance():getWinSize() local s = cc.Director:getInstance():getWinSize()
------------------------------------ ------------------------------------
-- SpriteProgressToRadial -- SpriteProgressToRadial
------------------------------------ ------------------------------------
local function SpriteProgressToRadial() local function SpriteProgressToRadial()
local layer = CCLayer:create() local layer = cc.Layer:create()
Helper.initWithLayer(layer) Helper.initWithLayer(layer)
local to1 = CCProgressTo:create(2, 100) local to1 = cc.ProgressTo:create(2, 100)
local to2 = CCProgressTo:create(2, 100) local to2 = cc.ProgressTo:create(2, 100)
local left = CCProgressTimer:create(CCSprite:create(s_pPathSister1)) local left = cc.ProgressTimer:create(cc.Sprite:create(s_pPathSister1))
left:setType(kCCProgressTimerTypeRadial) left:setType(cc.PROGRESS_TIMER_TYPE_RADIAL)
left:setPosition(CCPoint(100, s.height / 2)) left:setPosition(cc.p(100, s.height / 2))
left:runAction(CCRepeatForever:create(to1)) left:runAction(cc.RepeatForever:create(to1))
layer:addChild(left) layer:addChild(left)
local right = CCProgressTimer:create(CCSprite:create(s_pPathBlock)) local right = cc.ProgressTimer:create(cc.Sprite:create(s_pPathBlock))
right:setType(kCCProgressTimerTypeRadial) right:setType(cc.PROGRESS_TIMER_TYPE_RADIAL)
-- Makes the ridial CCW -- Makes the ridial CCW
right:setReverseProgress(true) right:setReverseDirection(true)
right:setPosition(CCPoint(s.width - 100, s.height / 2)) right:setPosition(cc.p(s.width - 100, s.height / 2))
right:runAction(CCRepeatForever:create(to2)) right:runAction(cc.RepeatForever:create(to2))
layer:addChild(right) layer:addChild(right)
Helper.subtitleLabel:setString("ProgressTo Radial") Helper.subtitleLabel:setString("ProgressTo Radial")
@ -33,30 +33,30 @@ end
-- SpriteProgressToHorizontal -- SpriteProgressToHorizontal
------------------------------------ ------------------------------------
local function SpriteProgressToHorizontal() local function SpriteProgressToHorizontal()
local layer = CCLayer:create() local layer = cc.Layer:create()
Helper.initWithLayer(layer) Helper.initWithLayer(layer)
local to1 = CCProgressTo:create(2, 100) local to1 = cc.ProgressTo:create(2, 100)
local to2 = CCProgressTo:create(2, 100) local to2 = cc.ProgressTo:create(2, 100)
local left = CCProgressTimer:create(CCSprite:create(s_pPathSister1)) local left = cc.ProgressTimer:create(cc.Sprite:create(s_pPathSister1))
left:setType(kCCProgressTimerTypeBar) left:setType(cc.PROGRESS_TIMER_TYPE_BAR)
-- Setup for a bar starting from the left since the midpoint is 0 for the x -- Setup for a bar starting from the left since the midpoint is 0 for the x
left:setMidpoint(CCPoint(0, 0)) left:setMidpoint(cc.p(0, 0))
-- Setup for a horizontal bar since the bar change rate is 0 for y meaning no vertical change -- Setup for a horizontal bar since the bar change rate is 0 for y meaning no vertical change
left:setBarChangeRate(CCPoint(1, 0)) left:setBarChangeRate(cc.p(1, 0))
left:setPosition(CCPoint(100, s.height / 2)) left:setPosition(cc.p(100, s.height / 2))
left:runAction(CCRepeatForever:create(to1)) left:runAction(cc.RepeatForever:create(to1))
layer:addChild(left) layer:addChild(left)
local right = CCProgressTimer:create(CCSprite:create(s_pPathSister2)) local right = cc.ProgressTimer:create(cc.Sprite:create(s_pPathSister2))
right:setType(kCCProgressTimerTypeBar) right:setType(cc.PROGRESS_TIMER_TYPE_BAR)
-- Setup for a bar starting from the left since the midpoint is 1 for the x -- Setup for a bar starting from the left since the midpoint is 1 for the x
right:setMidpoint(CCPoint(1, 0)) right:setMidpoint(cc.p(1, 0))
-- Setup for a horizontal bar since the bar change rate is 0 for y meaning no vertical change -- Setup for a horizontal bar since the bar change rate is 0 for y meaning no vertical change
right:setBarChangeRate(CCPoint(1, 0)) right:setBarChangeRate(cc.p(1, 0))
right:setPosition(CCPoint(s.width - 100, s.height / 2)) right:setPosition(cc.p(s.width - 100, s.height / 2))
right:runAction(CCRepeatForever:create(to2)) right:runAction(cc.RepeatForever:create(to2))
layer:addChild(right) layer:addChild(right)
Helper.subtitleLabel:setString("ProgressTo Horizontal") Helper.subtitleLabel:setString("ProgressTo Horizontal")
@ -67,31 +67,31 @@ end
-- SpriteProgressToVertical -- SpriteProgressToVertical
------------------------------------ ------------------------------------
local function SpriteProgressToVertical() local function SpriteProgressToVertical()
local layer = CCLayer:create() local layer = cc.Layer:create()
Helper.initWithLayer(layer) Helper.initWithLayer(layer)
local to1 = CCProgressTo:create(2, 100) local to1 = cc.ProgressTo:create(2, 100)
local to2 = CCProgressTo:create(2, 100) local to2 = cc.ProgressTo:create(2, 100)
local left = CCProgressTimer:create(CCSprite:create(s_pPathSister1)) local left = cc.ProgressTimer:create(cc.Sprite:create(s_pPathSister1))
left:setType(kCCProgressTimerTypeBar) left:setType(cc.PROGRESS_TIMER_TYPE_BAR)
-- Setup for a bar starting from the bottom since the midpoint is 0 for the y -- Setup for a bar starting from the bottom since the midpoint is 0 for the y
left:setMidpoint(CCPoint(0,0)) left:setMidpoint(cc.p(0,0))
-- Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change -- Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
left:setBarChangeRate(CCPoint(0, 1)) left:setBarChangeRate(cc.p(0, 1))
left:setPosition(CCPoint(100, s.height / 2)) left:setPosition(cc.p(100, s.height / 2))
left:runAction(CCRepeatForever:create(to1)) left:runAction(cc.RepeatForever:create(to1))
layer:addChild(left) layer:addChild(left)
local right = CCProgressTimer:create(CCSprite:create(s_pPathSister2)) local right = cc.ProgressTimer:create(cc.Sprite:create(s_pPathSister2))
right:setType(kCCProgressTimerTypeBar) right:setType(cc.PROGRESS_TIMER_TYPE_BAR)
-- Setup for a bar starting from the bottom since the midpoint is 0 for the y -- Setup for a bar starting from the bottom since the midpoint is 0 for the y
right:setMidpoint(CCPoint(0, 1)) right:setMidpoint(cc.p(0, 1))
-- Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change -- Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
right:setBarChangeRate(CCPoint(0, 1)) right:setBarChangeRate(cc.p(0, 1))
right:setPosition(CCPoint(s.width - 100, s.height / 2)) right:setPosition(cc.p(s.width - 100, s.height / 2))
right:runAction(CCRepeatForever:create(to2)) right:runAction(cc.RepeatForever:create(to2))
layer:addChild(right) layer:addChild(right)
Helper.subtitleLabel:setString("ProgressTo Vertical") Helper.subtitleLabel:setString("ProgressTo Vertical")
@ -102,30 +102,30 @@ end
-- SpriteProgressToRadialMidpointChanged -- SpriteProgressToRadialMidpointChanged
------------------------------------ ------------------------------------
local function SpriteProgressToRadialMidpointChanged() local function SpriteProgressToRadialMidpointChanged()
local layer = CCLayer:create() local layer = cc.Layer:create()
Helper.initWithLayer(layer) Helper.initWithLayer(layer)
local action = CCProgressTo:create(2, 100) local action = cc.ProgressTo:create(2, 100)
-- Our image on the left should be a radial progress indicator, clockwise -- Our image on the left should be a radial progress indicator, clockwise
local left = CCProgressTimer:create(CCSprite:create(s_pPathBlock)) local left = cc.ProgressTimer:create(cc.Sprite:create(s_pPathBlock))
left:setType(kCCProgressTimerTypeRadial) left:setType(cc.PROGRESS_TIMER_TYPE_RADIAL)
left:setMidpoint(CCPoint(0.25, 0.75)) left:setMidpoint(cc.p(0.25, 0.75))
left:setPosition(CCPoint(100, s.height / 2)) left:setPosition(cc.p(100, s.height / 2))
left:runAction(CCRepeatForever:create(CCProgressTo:create(2, 100))) left:runAction(cc.RepeatForever:create(cc.ProgressTo:create(2, 100)))
layer:addChild(left) layer:addChild(left)
-- Our image on the left should be a radial progress indicator, counter clockwise -- Our image on the left should be a radial progress indicator, counter clockwise
local right = CCProgressTimer:create(CCSprite:create(s_pPathBlock)) local right = cc.ProgressTimer:create(cc.Sprite:create(s_pPathBlock))
right:setType(kCCProgressTimerTypeRadial) right:setType(cc.PROGRESS_TIMER_TYPE_RADIAL)
right:setMidpoint(CCPoint(0.75, 0.25)) right:setMidpoint(cc.p(0.75, 0.25))
--[[ --[[
Note the reverse property (default=NO) is only added to the right image. That's how Note the reverse property (default=NO) is only added to the right image. That's how
we get a counter clockwise progress. we get a counter clockwise progress.
]] ]]
right:setPosition(CCPoint(s.width - 100, s.height / 2)) right:setPosition(cc.p(s.width - 100, s.height / 2))
right:runAction(CCRepeatForever:create(CCProgressTo:create(2, 100))) right:runAction(cc.RepeatForever:create(cc.ProgressTo:create(2, 100)))
layer:addChild(right) layer:addChild(right)
Helper.subtitleLabel:setString("Radial w/ Different Midpoints") Helper.subtitleLabel:setString("Radial w/ Different Midpoints")
@ -136,40 +136,40 @@ end
-- SpriteProgressBarVarious -- SpriteProgressBarVarious
------------------------------------ ------------------------------------
local function SpriteProgressBarVarious() local function SpriteProgressBarVarious()
local layer = CCLayer:create() local layer = cc.Layer:create()
Helper.initWithLayer(layer) Helper.initWithLayer(layer)
local to = CCProgressTo:create(2, 100) local to = cc.ProgressTo:create(2, 100)
local left = CCProgressTimer:create(CCSprite:create(s_pPathSister1)) local left = cc.ProgressTimer:create(cc.Sprite:create(s_pPathSister1))
left:setType(kCCProgressTimerTypeBar) left:setType(cc.PROGRESS_TIMER_TYPE_BAR)
-- Setup for a bar starting from the bottom since the midpoint is 0 for the y -- Setup for a bar starting from the bottom since the midpoint is 0 for the y
left:setMidpoint(CCPoint(0.5, 0.5)) left:setMidpoint(cc.p(0.5, 0.5))
-- Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change -- Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
left:setBarChangeRate(CCPoint(1, 0)) left:setBarChangeRate(cc.p(1, 0))
left:setPosition(CCPoint(100, s.height / 2)) left:setPosition(cc.p(100, s.height / 2))
left:runAction(CCRepeatForever:create(CCProgressTo:create(2, 100))) left:runAction(cc.RepeatForever:create(cc.ProgressTo:create(2, 100)))
layer:addChild(left) layer:addChild(left)
local middle = CCProgressTimer:create(CCSprite:create(s_pPathSister2)) local middle = cc.ProgressTimer:create(cc.Sprite:create(s_pPathSister2))
middle:setType(kCCProgressTimerTypeBar) middle:setType(cc.PROGRESS_TIMER_TYPE_BAR)
-- Setup for a bar starting from the bottom since the midpoint is 0 for the y -- Setup for a bar starting from the bottom since the midpoint is 0 for the y
middle:setMidpoint(CCPoint(0.5, 0.5)) middle:setMidpoint(cc.p(0.5, 0.5))
-- Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change -- Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
middle:setBarChangeRate(CCPoint(1, 1)) middle:setBarChangeRate(cc.p(1, 1))
middle:setPosition(CCPoint(s.width/2, s.height/2)) middle:setPosition(cc.p(s.width/2, s.height/2))
middle:runAction(CCRepeatForever:create(CCProgressTo:create(2, 100))) middle:runAction(cc.RepeatForever:create(cc.ProgressTo:create(2, 100)))
layer:addChild(middle) layer:addChild(middle)
local right = CCProgressTimer:create(CCSprite:create(s_pPathSister2)) local right = cc.ProgressTimer:create(cc.Sprite:create(s_pPathSister2))
right:setType(kCCProgressTimerTypeBar) right:setType(cc.PROGRESS_TIMER_TYPE_BAR)
-- Setup for a bar starting from the bottom since the midpoint is 0 for the y -- Setup for a bar starting from the bottom since the midpoint is 0 for the y
right:setMidpoint(CCPoint(0.5, 0.5)) right:setMidpoint(cc.p(0.5, 0.5))
-- Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change -- Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
right:setBarChangeRate(CCPoint(0, 1)) right:setBarChangeRate(cc.p(0, 1))
right:setPosition(CCPoint(s.width-100, s.height/2)) right:setPosition(cc.p(s.width-100, s.height/2))
right:runAction(CCRepeatForever:create(CCProgressTo:create(2, 100))) right:runAction(cc.RepeatForever:create(cc.ProgressTo:create(2, 100)))
layer:addChild(right) layer:addChild(right)
Helper.subtitleLabel:setString("ProgressTo Bar Mid") Helper.subtitleLabel:setString("ProgressTo Bar Mid")
@ -180,65 +180,60 @@ end
-- SpriteProgressBarTintAndFade -- SpriteProgressBarTintAndFade
------------------------------------ ------------------------------------
local function SpriteProgressBarTintAndFade() local function SpriteProgressBarTintAndFade()
local layer = CCLayer:create() local layer = cc.Layer:create()
Helper.initWithLayer(layer) Helper.initWithLayer(layer)
local to = CCProgressTo:create(6, 100) local to = cc.ProgressTo:create(6, 100)
--[[
local array = CCArray:create() local array = CCArray:create()
array:addObject(CCTintTo:create(1, 255, 0, 0)) array:addObject(CCTintTo:create(1, 255, 0, 0))
array:addObject(CCTintTo:create(1, 0, 255, 0)) array:addObject(CCTintTo:create(1, 0, 255, 0))
array:addObject(CCTintTo:create(1, 0, 0, 255)) array:addObject(CCTintTo:create(1, 0, 0, 255))
local tint = CCSequence:create(array) ]]--
local fade = CCSequence:createWithTwoActions( local tint = cc.Sequence:create(cc.TintTo:create(1, 255, 0, 0), cc.TintTo:create(1, 0, 255, 0), cc.TintTo:create(1, 0, 0, 255))
CCFadeTo:create(1.0, 0), local fade = cc.Sequence:create(cc.FadeTo:create(1.0, 0),cc.FadeTo:create(1.0, 255))
CCFadeTo:create(1.0, 255)) local left = cc.ProgressTimer:create(cc.Sprite:create(s_pPathSister1))
left:setType(cc.PROGRESS_TIMER_TYPE_BAR)
local left = CCProgressTimer:create(CCSprite:create(s_pPathSister1))
left:setType(kCCProgressTimerTypeBar)
-- Setup for a bar starting from the bottom since the midpoint is 0 for the y -- Setup for a bar starting from the bottom since the midpoint is 0 for the y
left:setMidpoint(CCPoint(0.5, 0.5)) left:setMidpoint(cc.p(0.5, 0.5))
-- Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change -- Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
left:setBarChangeRate(CCPoint(1, 0)) left:setBarChangeRate(cc.p(1, 0))
left:setPosition(CCPoint(100, s.height / 2)) left:setPosition(cc.p(100, s.height / 2))
left:runAction(CCRepeatForever:create(CCProgressTo:create(6, 100))) left:runAction(cc.RepeatForever:create(cc.ProgressTo:create(6, 100)))
left:runAction(CCRepeatForever:create(CCSequence:create(array))) left:runAction(cc.RepeatForever:create(cc.Sequence:create(cc.TintTo:create(1, 255, 0, 0), cc.TintTo:create(1, 0, 255, 0), cc.TintTo:create(1, 0, 0, 255))))
layer:addChild(left) layer:addChild(left)
left:addChild(CCLabelTTF:create("Tint", "Marker Felt", 20.0)) left:addChild(cc.LabelTTF:create("Tint", "Marker Felt", 20.0))
local middle = CCProgressTimer:create(CCSprite:create(s_pPathSister2)) local middle = cc.ProgressTimer:create(cc.Sprite:create(s_pPathSister2))
middle:setType(kCCProgressTimerTypeBar) middle:setType(cc.PROGRESS_TIMER_TYPE_BAR)
-- Setup for a bar starting from the bottom since the midpoint is 0 for the y -- Setup for a bar starting from the bottom since the midpoint is 0 for the y
middle:setMidpoint(CCPoint(0.5, 0.5)) middle:setMidpoint(cc.p(0.5, 0.5))
-- Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change -- Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
middle:setBarChangeRate(CCPoint(1, 1)) middle:setBarChangeRate(cc.p(1, 1))
middle:setPosition(CCPoint(s.width / 2, s.height / 2)) middle:setPosition(cc.p(s.width / 2, s.height / 2))
middle:runAction(CCRepeatForever:create(CCProgressTo:create(6, 100))) middle:runAction(cc.RepeatForever:create(cc.ProgressTo:create(6, 100)))
local fade2 = CCSequence:createWithTwoActions( local fade2 = cc.Sequence:create(cc.FadeTo:create(1.0, 0), cc.FadeTo:create(1.0, 255))
CCFadeTo:create(1.0, 0), middle:runAction(cc.RepeatForever:create(fade2))
CCFadeTo:create(1.0, 255))
middle:runAction(CCRepeatForever:create(fade2))
layer:addChild(middle) layer:addChild(middle)
middle:addChild(CCLabelTTF:create("Fade", "Marker Felt", 20.0)) middle:addChild(cc.LabelTTF:create("Fade", "Marker Felt", 20.0))
local right = CCProgressTimer:create(CCSprite:create(s_pPathSister2)) local right = cc.ProgressTimer:create(cc.Sprite:create(s_pPathSister2))
right:setType(kCCProgressTimerTypeBar) right:setType(cc.PROGRESS_TIMER_TYPE_BAR)
-- Setup for a bar starting from the bottom since the midpoint is 0 for the y -- Setup for a bar starting from the bottom since the midpoint is 0 for the y
right:setMidpoint(CCPoint(0.5, 0.5)) right:setMidpoint(cc.p(0.5, 0.5))
-- Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change -- Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
right:setBarChangeRate(CCPoint(0, 1)) right:setBarChangeRate(cc.p(0, 1))
right:setPosition(CCPoint(s.width - 100, s.height / 2)) right:setPosition(cc.p(s.width - 100, s.height / 2))
right:runAction(CCRepeatForever:create(CCProgressTo:create(6, 100))) right:runAction(cc.RepeatForever:create(cc.ProgressTo:create(6, 100)))
right:runAction(CCRepeatForever:create(CCSequence:create(array))) right:runAction(cc.RepeatForever:create(cc.Sequence:create(cc.TintTo:create(1, 255, 0, 0), cc.TintTo:create(1, 0, 255, 0), cc.TintTo:create(1, 0, 0, 255))))
right:runAction(CCRepeatForever:create(CCSequence:createWithTwoActions( right:runAction(cc.RepeatForever:create(cc.Sequence:create(cc.FadeTo:create(1.0, 0), cc.FadeTo:create(1.0, 255))))
CCFadeTo:create(1.0, 0),
CCFadeTo:create(1.0, 255))))
layer:addChild(right) layer:addChild(right)
right:addChild(CCLabelTTF:create("Tint and Fade", "Marker Felt", 20.0)) right:addChild(cc.LabelTTF:create("Tint and Fade", "Marker Felt", 20.0))
Helper.subtitleLabel:setString("ProgressTo Bar Mid") Helper.subtitleLabel:setString("ProgressTo Bar Mid")
return layer return layer
@ -248,41 +243,41 @@ end
-- SpriteProgressWithSpriteFrame -- SpriteProgressWithSpriteFrame
------------------------------------ ------------------------------------
local function SpriteProgressWithSpriteFrame() local function SpriteProgressWithSpriteFrame()
local layer = CCLayer:create() local layer = cc.Layer:create()
Helper.initWithLayer(layer) Helper.initWithLayer(layer)
local to = CCProgressTo:create(6, 100) local to = cc.ProgressTo:create(6, 100)
CCSpriteFrameCache:getInstance():addSpriteFramesWithFile("zwoptex/grossini.plist") cc.SpriteFrameCache:getInstance():addSpriteFrames("zwoptex/grossini.plist")
local left = CCProgressTimer:create(CCSprite:createWithSpriteFrameName("grossini_dance_01.png")) local left = cc.ProgressTimer:create(cc.Sprite:createWithSpriteFrameName("grossini_dance_01.png"))
left:setType(kCCProgressTimerTypeBar) left:setType(cc.PROGRESS_TIMER_TYPE_BAR)
-- Setup for a bar starting from the bottom since the midpoint is 0 for the y -- Setup for a bar starting from the bottom since the midpoint is 0 for the y
left:setMidpoint(CCPoint(0.5, 0.5)) left:setMidpoint(cc.p(0.5, 0.5))
-- Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change -- Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
left:setBarChangeRate(CCPoint(1, 0)) left:setBarChangeRate(cc.p(1, 0))
left:setPosition(CCPoint(100, s.height / 2)) left:setPosition(cc.p(100, s.height / 2))
left:runAction(CCRepeatForever:create(CCProgressTo:create(6, 100))) left:runAction(cc.RepeatForever:create(cc.ProgressTo:create(6, 100)))
layer:addChild(left) layer:addChild(left)
local middle = CCProgressTimer:create(CCSprite:createWithSpriteFrameName("grossini_dance_02.png")) local middle = cc.ProgressTimer:create(cc.Sprite:createWithSpriteFrameName("grossini_dance_02.png"))
middle:setType(kCCProgressTimerTypeBar) middle:setType(cc.PROGRESS_TIMER_TYPE_BAR)
-- Setup for a bar starting from the bottom since the midpoint is 0 for the y -- Setup for a bar starting from the bottom since the midpoint is 0 for the y
middle:setMidpoint(CCPoint(0.5, 0.5)) middle:setMidpoint(cc.p(0.5, 0.5))
-- Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change -- Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
middle:setBarChangeRate(CCPoint(1, 1)) middle:setBarChangeRate(cc.p(1, 1))
middle:setPosition(CCPoint(s.width / 2, s.height / 2)) middle:setPosition(cc.p(s.width / 2, s.height / 2))
middle:runAction(CCRepeatForever:create(CCProgressTo:create(6, 100))) middle:runAction(cc.RepeatForever:create(cc.ProgressTo:create(6, 100)))
layer:addChild(middle) layer:addChild(middle)
local right = CCProgressTimer:create(CCSprite:createWithSpriteFrameName("grossini_dance_03.png")) local right = cc.ProgressTimer:create(cc.Sprite:createWithSpriteFrameName("grossini_dance_03.png"))
right:setType(kCCProgressTimerTypeRadial) right:setType(cc.PROGRESS_TIMER_TYPE_BAR)
-- Setup for a bar starting from the bottom since the midpoint is 0 for the y -- Setup for a bar starting from the bottom since the midpoint is 0 for the y
right:setMidpoint(CCPoint(0.5, 0.5)) right:setMidpoint(cc.p(0.5, 0.5))
-- Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change -- Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
right:setBarChangeRate(CCPoint(0, 1)) right:setBarChangeRate(cc.p(0, 1))
right:setPosition(CCPoint(s.width - 100, s.height / 2)) right:setPosition(cc.p(s.width - 100, s.height / 2))
right:runAction(CCRepeatForever:create(CCProgressTo:create(6, 100))) right:runAction(cc.RepeatForever:create(cc.ProgressTo:create(6, 100)))
layer:addChild(right) layer:addChild(right)
Helper.subtitleLabel:setString("Progress With Sprite Frame") Helper.subtitleLabel:setString("Progress With Sprite Frame")
@ -290,7 +285,7 @@ local function SpriteProgressWithSpriteFrame()
end end
function ProgressActionsTest() function ProgressActionsTest()
local scene = CCScene:create() local scene = cc.Scene:create()
Helper.createFunctionTable = { Helper.createFunctionTable = {
SpriteProgressToRadial, SpriteProgressToRadial,
@ -305,5 +300,5 @@ function ProgressActionsTest()
scene:addChild(SpriteProgressToRadial()) scene:addChild(SpriteProgressToRadial())
scene:addChild(CreateBackMenuItem()) scene:addChild(CreateBackMenuItem())
CCDirector:getInstance():replaceScene(scene) cc.Director:getInstance():replaceScene(scene)
end end

View File

@ -1,65 +1,72 @@
require "luaScript/extern" require "luaScript/extern"
require "Cocos2d"
VisibleRect = class("VisibleRect") VisibleRect = class("VisibleRect")
VisibleRect.__index = VisibleRect VisibleRect.__index = VisibleRect
VisibleRect.s_visibleRect = CCRect:new() VisibleRect.s_visibleRect = cc.rect(0,0,0,0)
function VisibleRect:lazyInit() function VisibleRect:lazyInit()
if (self.s_visibleRect.size.width == 0.0 and self.s_visibleRect.size.height == 0.0) then if (self.s_visibleRect.width == 0.0 and self.s_visibleRect.height == 0.0) then
local pEGLView = CCEGLView:getInstance(); --[[
self.s_visibleRect.origin = pEGLView:getVisibleOrigin(); local pEGLView = cc.EGLView:getInstance()
self.s_visibleRect.size = pEGLView:getVisibleSize(); local origin = pEGLView:getVisibleOrigin()
]]--
self.s_visibleRect.x = 0
self.s_visibleRect.y = 0
local size = cc.Director:getInstance():getWinSize()
self.s_visibleRect.width = size.width
self.s_visibleRect.height = size.height
end end
end end
function VisibleRect:getVisibleRect() function VisibleRect:getVisibleRect()
self:lazyInit(); self:lazyInit()
return CCRect(self.s_visibleRect.origin.x, self.s_visibleRect.origin.y, self.s_visibleRect.size.width, self.s_visibleRect.size.height); return cc.Rect(self.s_visibleRect.x, self.s_visibleRect.y, self.s_visibleRect.width, self.s_visibleRect.height)
end end
function VisibleRect:left() function VisibleRect:left()
self:lazyInit(); self:lazyInit()
return CCPoint(self.s_visibleRect.origin.x, self.s_visibleRect.origin.y+self.s_visibleRect.size.height/2); return cc.p(self.s_visibleRect.x, self.s_visibleRect.y+self.s_visibleRect.height/2)
end end
function VisibleRect:right() function VisibleRect:right()
self:lazyInit(); self:lazyInit()
return CCPoint(self.s_visibleRect.origin.x+self.s_visibleRect.size.width, self.s_visibleRect.origin.y+self.s_visibleRect.size.height/2); return cc.p(self.s_visibleRect.x+self.s_visibleRect.width, self.s_visibleRect.y+self.s_visibleRect.height/2)
end end
function VisibleRect:top() function VisibleRect:top()
self:lazyInit(); self:lazyInit()
return CCPoint(self.s_visibleRect.origin.x+self.s_visibleRect.size.width/2, self.s_visibleRect.origin.y+self.s_visibleRect.size.height); return cc.p(self.s_visibleRect.x+self.s_visibleRect.width/2, self.s_visibleRect.y+self.s_visibleRect.height)
end end
function VisibleRect:bottom() function VisibleRect:bottom()
self:lazyInit(); self:lazyInit()
return CCPoint(self.s_visibleRect.origin.x+self.s_visibleRect.size.width/2, self.s_visibleRect.origin.y); return cc.p(self.s_visibleRect.x+self.s_visibleRect.width/2, self.s_visibleRect.y)
end end
function VisibleRect:center() function VisibleRect:center()
self:lazyInit(); self:lazyInit()
return CCPoint(self.s_visibleRect.origin.x+self.s_visibleRect.size.width/2, self.s_visibleRect.origin.y+self.s_visibleRect.size.height/2); return cc.p(self.s_visibleRect.x+self.s_visibleRect.width/2, self.s_visibleRect.y+self.s_visibleRect.height/2)
end end
function VisibleRect:leftTop() function VisibleRect:leftTop()
self:lazyInit(); self:lazyInit()
return CCPoint(self.s_visibleRect.origin.x, self.s_visibleRect.origin.y+self.s_visibleRect.size.height); return cc.p(self.s_visibleRect.x, self.s_visibleRect.y+self.s_visibleRect.height)
end end
function VisibleRect:rightTop() function VisibleRect:rightTop()
self:lazyInit(); self:lazyInit()
return CCPoint(self.s_visibleRect.origin.x+self.s_visibleRect.size.width, self.s_visibleRect.origin.y+self.s_visibleRect.size.height); return cc.p(self.s_visibleRect.x+self.s_visibleRect.width, self.s_visibleRect.y+self.s_visibleRect.height)
end end
function VisibleRect:leftBottom() function VisibleRect:leftBottom()
self:lazyInit(); self:lazyInit()
return self.s_visibleRect.origin; return cc.p(self.s_visibleRect.x,self.s_visibleRect.y)
end end
function VisibleRect:rightBottom() function VisibleRect:rightBottom()
self:lazyInit(); self:lazyInit()
return CCPoint(self.s_visibleRect.origin.x+self.s_visibleRect.size.width, self.s_visibleRect.origin.y); return cc.p(self.s_visibleRect.x+self.s_visibleRect.width, self.s_visibleRect.y)
end end

View File

@ -8,6 +8,6 @@ require "luaScript/mainMenu"
-- run -- run
local scene = CCScene:create() local scene = cc.Scene:create()
scene:addChild(CreateTestMenu()) scene:addChild(CreateTestMenu())
CCDirector:getInstance():runWithScene(scene) cc.Director:getInstance():runWithScene(scene)

View File

@ -1,14 +1,16 @@
require "Cocos2d"
CC_CONTENT_SCALE_FACTOR = function() CC_CONTENT_SCALE_FACTOR = function()
return CCDirector:getInstance():getContentScaleFactor() return cc.Director:getInstance():getContentScaleFactor()
end end
CC_POINT_PIXELS_TO_POINTS = function(pixels) CC_POINT_PIXELS_TO_POINTS = function(pixels)
return CCPoint(pixels.x/CC_CONTENT_SCALE_FACTOR(), pixels.y/CC_CONTENT_SCALE_FACTOR()) return cc.p(pixels.x/CC_CONTENT_SCALE_FACTOR(), pixels.y/CC_CONTENT_SCALE_FACTOR())
end end
CC_POINT_POINTS_TO_PIXELS = function(points) CC_POINT_POINTS_TO_PIXELS = function(points)
return CCPoint(points.x*CC_CONTENT_SCALE_FACTOR(), points.y*CC_CONTENT_SCALE_FACTOR()) return cc.p(points.x*CC_CONTENT_SCALE_FACTOR(), points.y*CC_CONTENT_SCALE_FACTOR())
end end
@ -29,20 +31,20 @@ end
-- back menu callback -- back menu callback
local function MainMenuCallback() local function MainMenuCallback()
local scene = CCScene:create() local scene = cc.Scene:create()
scene:addChild(CreateTestMenu()) scene:addChild(CreateTestMenu())
CCDirector:getInstance():replaceScene(scene) cc.Director:getInstance():replaceScene(scene)
end end
-- add the menu item for back to main menu -- add the menu item for back to main menu
function CreateBackMenuItem() function CreateBackMenuItem()
local label = CCLabelTTF:create("MainMenu", "Arial", 20) local label = cc.LabelTTF:create("MainMenu", "Arial", 20)
local MenuItem = CCMenuItemLabel:create(label) local MenuItem = cc.MenuItemLabel:create(label)
MenuItem:registerScriptTapHandler(MainMenuCallback) MenuItem:registerScriptTapHandler(MainMenuCallback)
local s = CCDirector:getInstance():getWinSize() local s = cc.Director:getInstance():getWinSize()
local Menu = CCMenu:create() local Menu = cc.Menu:create()
Menu:addChild(MenuItem) Menu:addChild(MenuItem)
Menu:setPosition(0, 0) Menu:setPosition(0, 0)
MenuItem:setPosition(s.width - 50, 25) MenuItem:setPosition(s.width - 50, 25)
@ -80,50 +82,50 @@ function Helper.restartAction()
end end
function Helper.newScene() function Helper.newScene()
local scene = CCScene:create() local scene = cc.Scene:create()
Helper.currentLayer = Helper.createFunctionTable[Helper.index]() Helper.currentLayer = Helper.createFunctionTable[Helper.index]()
scene:addChild(Helper.currentLayer) scene:addChild(Helper.currentLayer)
scene:addChild(CreateBackMenuItem()) scene:addChild(CreateBackMenuItem())
CCDirector:getInstance():replaceScene(scene) cc.Director:getInstance():replaceScene(scene)
end end
function Helper.initWithLayer(layer) function Helper.initWithLayer(layer)
Helper.currentLayer = layer Helper.currentLayer = layer
local size = CCDirector:getInstance():getWinSize() local size = cc.Director:getInstance():getWinSize()
Helper.titleLabel = CCLabelTTF:create("", "Arial", 28) Helper.titleLabel = cc.LabelTTF:create("", "Arial", 28)
layer:addChild(Helper.titleLabel, 1) layer:addChild(Helper.titleLabel, 1)
Helper.titleLabel:setPosition(size.width / 2, size.height - 50) Helper.titleLabel:setPosition(size.width / 2, size.height - 50)
Helper.subtitleLabel = CCLabelTTF:create("", "Thonburi", 16) Helper.subtitleLabel = cc.LabelTTF:create("", "Thonburi", 16)
layer:addChild(Helper.subtitleLabel, 1) layer:addChild(Helper.subtitleLabel, 1)
Helper.subtitleLabel:setPosition(size.width / 2, size.height - 80) Helper.subtitleLabel:setPosition(size.width / 2, size.height - 80)
-- menu -- menu
local item1 = CCMenuItemImage:create(s_pPathB1, s_pPathB2) local item1 = cc.MenuItemImage:create(s_pPathB1, s_pPathB2)
local item2 = CCMenuItemImage:create(s_pPathR1, s_pPathR2) local item2 = cc.MenuItemImage:create(s_pPathR1, s_pPathR2)
local item3 = CCMenuItemImage:create(s_pPathF1, s_pPathF2) local item3 = cc.MenuItemImage:create(s_pPathF1, s_pPathF2)
item1:registerScriptTapHandler(Helper.backAction) item1:registerScriptTapHandler(Helper.backAction)
item2:registerScriptTapHandler(Helper.restartAction) item2:registerScriptTapHandler(Helper.restartAction)
item3:registerScriptTapHandler(Helper.nextAction) item3:registerScriptTapHandler(Helper.nextAction)
local menu = CCMenu:create() local menu = cc.Menu:create()
menu:addChild(item1) menu:addChild(item1)
menu:addChild(item2) menu:addChild(item2)
menu:addChild(item3) menu:addChild(item3)
menu:setPosition(CCPoint(0, 0)) menu:setPosition(cc.p(0, 0))
item1:setPosition(CCPoint(size.width / 2 - item2:getContentSize().width * 2, item2:getContentSize().height / 2)) item1:setPosition(cc.p(size.width / 2 - item2:getContentSize().width * 2, item2:getContentSize().height / 2))
item2:setPosition(CCPoint(size.width / 2, item2:getContentSize().height / 2)) item2:setPosition(cc.p(size.width / 2, item2:getContentSize().height / 2))
item3:setPosition(CCPoint(size.width / 2 + item2:getContentSize().width * 2, item2:getContentSize().height / 2)) item3:setPosition(cc.p(size.width / 2 + item2:getContentSize().width * 2, item2:getContentSize().height / 2))
layer:addChild(menu, 1) layer:addChild(menu, 1)
local background = CCLayer:create() local background = cc.Layer:create()
layer:addChild(background, -10) layer:addChild(background, -10)
end end
function createTestLayer(title, subtitle) function createTestLayer(title, subtitle)
local layer = CCLayer:create() local layer = cc.Layer:create()
Helper.initWithLayer(layer) Helper.initWithLayer(layer)
local titleStr = title == nil and "No title" or title local titleStr = title == nil and "No title" or title
local subTitleStr = subtitle == nil and "" or subtitle local subTitleStr = subtitle == nil and "" or subtitle

View File

@ -1,14 +1,23 @@
require "Cocos2d"
require "Cocos2dConstants"
require "Opengl"
require "OpenglConstants"
require "luaScript/helper" require "luaScript/helper"
require "luaScript/testResource" require "luaScript/testResource"
require "luaScript/ActionsTest/ActionsTest" require "luaScript/ActionManagerTest/ActionManagerTest"
require "luaScript/TransitionsTest/TransitionsTest" require "luaScript/ActionsEaseTest/ActionsEaseTest"
require "luaScript/ActionsProgressTest/ActionsProgressTest" require "luaScript/ActionsProgressTest/ActionsProgressTest"
require "luaScript/ActionsTest/ActionsTest"
--[[
require "luaScript/TransitionsTest/TransitionsTest"
require "luaScript/EffectsTest/EffectsTest" require "luaScript/EffectsTest/EffectsTest"
require "luaScript/ClickAndMoveTest/ClickAndMoveTest" require "luaScript/ClickAndMoveTest/ClickAndMoveTest"
require "luaScript/RotateWorldTest/RotateWorldTest" require "luaScript/RotateWorldTest/RotateWorldTest"
require "luaScript/ParticleTest/ParticleTest" require "luaScript/ParticleTest/ParticleTest"
require "luaScript/ActionsEaseTest/ActionsEaseTest"
require "luaScript/MotionStreakTest/MotionStreakTest" require "luaScript/MotionStreakTest/MotionStreakTest"
require "luaScript/DrawPrimitivesTest/DrawPrimitivesTest" require "luaScript/DrawPrimitivesTest/DrawPrimitivesTest"
require "luaScript/NodeTest/NodeTest" require "luaScript/NodeTest/NodeTest"
@ -19,7 +28,7 @@ require "luaScript/PerformanceTest/PerformanceTest"
require "luaScript/LabelTest/LabelTest" require "luaScript/LabelTest/LabelTest"
require "luaScript/ParallaxTest/ParallaxTest" require "luaScript/ParallaxTest/ParallaxTest"
require "luaScript/TileMapTest/TileMapTest" require "luaScript/TileMapTest/TileMapTest"
require "luaScript/ActionManagerTest/ActionManagerTest"
require "luaScript/MenuTest/MenuTest" require "luaScript/MenuTest/MenuTest"
require "luaScript/IntervalTest/IntervalTest" require "luaScript/IntervalTest/IntervalTest"
require "luaScript/SceneTest/SceneTest" require "luaScript/SceneTest/SceneTest"
@ -36,7 +45,7 @@ require "luaScript/ExtensionTest/ExtensionTest"
require "luaScript/AccelerometerTest/AccelerometerTest" require "luaScript/AccelerometerTest/AccelerometerTest"
require "luaScript/KeypadTest/KeypadTest" require "luaScript/KeypadTest/KeypadTest"
require "luaScript/OpenGLTest/OpenGLTest" require "luaScript/OpenGLTest/OpenGLTest"
]]--
local LINE_SPACE = 40 local LINE_SPACE = 40
@ -96,15 +105,15 @@ local TESTS_COUNT = table.getn(_allTests)
-- create scene -- create scene
local function CreateTestScene(nIdx) local function CreateTestScene(nIdx)
local scene = _allTests[nIdx].create_func() local scene = _allTests[nIdx].create_func()
CCDirector:getInstance():purgeCachedData() cc.Director:getInstance():purgeCachedData()
return scene return scene
end end
-- create menu -- create menu
function CreateTestMenu() function CreateTestMenu()
local menuLayer = CCLayer:create() local menuLayer = cc.Layer:create()
local function closeCallback() local function closeCallback()
CCDirector:getInstance():endToLua() cc.Director:getInstance():endToLua()
end end
local function menuCallback(tag) local function menuCallback(tag)
@ -112,37 +121,37 @@ function CreateTestMenu()
local Idx = tag - 10000 local Idx = tag - 10000
local testScene = CreateTestScene(Idx) local testScene = CreateTestScene(Idx)
if testScene then if testScene then
CCDirector:getInstance():replaceScene(testScene) cc.Director:getInstance():replaceScene(testScene)
end end
end end
-- add close menu -- add close menu
local s = CCDirector:getInstance():getWinSize() local s = cc.Director:getInstance():getWinSize()
local CloseItem = CCMenuItemImage:create(s_pPathClose, s_pPathClose) local CloseItem = cc.MenuItemImage:create(s_pPathClose, s_pPathClose)
CloseItem:registerScriptTapHandler(closeCallback) CloseItem:registerScriptTapHandler(closeCallback)
CloseItem:setPosition(CCPoint(s.width - 30, s.height - 30)) CloseItem:setPosition(cc.p(s.width - 30, s.height - 30))
local CloseMenu = CCMenu:create() local CloseMenu = cc.Menu:create()
CloseMenu:setPosition(0, 0) CloseMenu:setPosition(0, 0)
CloseMenu:addChild(CloseItem) CloseMenu:addChild(CloseItem)
menuLayer:addChild(CloseMenu) menuLayer:addChild(CloseMenu)
-- add menu items for tests -- add menu items for tests
local MainMenu = CCMenu:create() local MainMenu = cc.Menu:create()
local index = 0 local index = 0
local obj = nil local obj = nil
for index, obj in pairs(_allTests) do for index, obj in pairs(_allTests) do
local testLabel = CCLabelTTF:create(obj.name, "Arial", 24) local testLabel = cc.LabelTTF:create(obj.name, "Arial", 24)
local testMenuItem = CCMenuItemLabel:create(testLabel) local testMenuItem = cc.MenuItemLabel:create(testLabel)
if not obj.isSupported then if not obj.isSupported then
testMenuItem:setEnabled(false) testMenuItem:setEnabled(false)
end end
testMenuItem:registerScriptTapHandler(menuCallback) testMenuItem:registerScriptTapHandler(menuCallback)
testMenuItem:setPosition(CCPoint(s.width / 2, (s.height - (index) * LINE_SPACE))) testMenuItem:setPosition(cc.p(s.width / 2, (s.height - (index) * LINE_SPACE)))
MainMenu:addChild(testMenuItem, index + 10000, index + 10000) MainMenu:addChild(testMenuItem, index + 10000, index + 10000)
end end
MainMenu:setContentSize(CCSize(s.width, (TESTS_COUNT + 1) * (LINE_SPACE))) MainMenu:setContentSize(cc.size(s.width, (TESTS_COUNT + 1) * (LINE_SPACE)))
MainMenu:setPosition(CurPos.x, CurPos.y) MainMenu:setPosition(CurPos.x, CurPos.y)
menuLayer:addChild(MainMenu) menuLayer:addChild(MainMenu)
@ -155,9 +164,10 @@ function CreateTestMenu()
local function onTouchMoved(x, y) local function onTouchMoved(x, y)
local nMoveY = y - BeginPos.y local nMoveY = y - BeginPos.y
local curPosx, curPosy = MainMenu:getPosition() local curPos = MainMenu:getPosition()
local curPosx, curPosy = curPos.x,curPos.y
local nextPosy = curPosy + nMoveY local nextPosy = curPosy + nMoveY
local winSize = CCDirector:getInstance():getWinSize() local winSize = cc.Director:getInstance():getWinSize()
if nextPosy < 0 then if nextPosy < 0 then
MainMenu:setPosition(0, 0) MainMenu:setPosition(0, 0)
return return

View File

@ -1 +1 @@
daaf13ab82feffbd1c8e201d76cb83ed8f2dabca 1cee6156624b42a16c97a0095a036f0b51b68e48

View File

@ -312,7 +312,7 @@ int LuaEngine::handleMenuClickedEvent(void* data)
return 0; return 0;
_stack->pushInt(menuItem->getTag()); _stack->pushInt(menuItem->getTag());
_stack->pushObject(menuItem, "CCMenuItem"); _stack->pushObject(menuItem, "MenuItem");
int ret = _stack->executeFunctionByHandler(handler, 2); int ret = _stack->executeFunctionByHandler(handler, 2);
_stack->clean(); _stack->clean();
return ret; return ret;
@ -357,7 +357,7 @@ int LuaEngine::handleCallFuncActionEvent(void* data)
Object* target = static_cast<Object*>(basicScriptData->value); Object* target = static_cast<Object*>(basicScriptData->value);
if (NULL != target) if (NULL != target)
{ {
_stack->pushObject(target, "CCNode"); _stack->pushObject(target, "Node");
} }
int ret = _stack->executeFunctionByHandler(handler, target ? 1 : 0); int ret = _stack->executeFunctionByHandler(handler, target ? 1 : 0);
_stack->clean(); _stack->clean();

View File

@ -126,6 +126,7 @@ bool LuaStack::init(void)
}; };
luaL_register(_state, "_G", global_functions); luaL_register(_state, "_G", global_functions);
register_all_cocos2dx(_state); register_all_cocos2dx(_state);
tolua_opengl_open(_state);
register_all_cocos2dx_extension(_state); register_all_cocos2dx_extension(_state);
register_all_cocos2dx_manual(_state); register_all_cocos2dx_manual(_state);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC) #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
@ -135,7 +136,6 @@ bool LuaStack::init(void)
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
tolua_web_socket_open(_state); tolua_web_socket_open(_state);
#endif #endif
tolua_opengl_open(_state);
tolua_scroll_view_open(_state); tolua_scroll_view_open(_state);
tolua_script_handler_mgr_open(_state); tolua_script_handler_mgr_open(_state);

View File

@ -829,6 +829,58 @@ bool luaval_to_dictionary(lua_State* L,int lo, Dictionary** outValue)
return ok; return ok;
} }
bool luaval_to_array_of_Point(lua_State* L,int lo,Point **points, int *numPoints)
{
if (NULL == L)
return false;
bool ok = true;
#if COCOS2D_DEBUG >=1
tolua_Error tolua_err;
if (!tolua_istable(L, lo, 0, &tolua_err) )
{
luaval_to_native_err(L,"#ferror:",&tolua_err);
ok = false;
}
#endif
if (ok)
{
size_t len = lua_objlen(L, lo);
if (len > 0)
{
Point* array = (Point*)malloc(sizeof(Point) * len);
if (NULL == array)
return false;
for (uint32_t i = 0; i < len; ++i)
{
lua_pushnumber(L,i + 1);
lua_gettable(L,lo);
if (!tolua_istable(L,-1, 0, &tolua_err))
{
luaval_to_native_err(L,"#ferror:",&tolua_err);
lua_pop(L, 1);
free(array);
return false;
}
ok &= luaval_to_point(L, lua_gettop(L), &array[i]);
if (!ok)
{
lua_pop(L, 1);
free(array);
return false;
}
lua_pop(L, 1);
}
*numPoints = len;
*points = array;
}
}
return ok;
}
void point_to_luaval(lua_State* L,const Point& pt) void point_to_luaval(lua_State* L,const Point& pt)
{ {
if (NULL == L) if (NULL == L)

View File

@ -28,6 +28,7 @@ extern bool luaval_to_affinetransform(lua_State* L,int lo, AffineTransform* outV
extern bool luaval_to_fontdefinition(lua_State* L, int lo, FontDefinition* outValue ); extern bool luaval_to_fontdefinition(lua_State* L, int lo, FontDefinition* outValue );
extern bool luaval_to_array(lua_State* L,int lo, Array** outValue); extern bool luaval_to_array(lua_State* L,int lo, Array** outValue);
extern bool luaval_to_dictionary(lua_State* L,int lo, Dictionary** outValue); extern bool luaval_to_dictionary(lua_State* L,int lo, Dictionary** outValue);
extern bool luaval_to_array_of_Point(lua_State* L,int lo,Point **points, int *numPoints);
// from native // from native
extern void point_to_luaval(lua_State* L,const Point& pt); extern void point_to_luaval(lua_State* L,const Point& pt);

View File

@ -1 +1 @@
db5d393a48a8e12b2a8a0fefef11c4bb7c494d56 b3460818609e566b063e1c9b7404650048c81121

View File

@ -15,6 +15,9 @@ extern "C" {
static int tolua_cocos2d_MenuItemImage_create(lua_State* tolua_S) static int tolua_cocos2d_MenuItemImage_create(lua_State* tolua_S)
{ {
if (NULL == tolua_S)
return 0;
int argc = 0; int argc = 0;
bool ok = true; bool ok = true;
@ -90,8 +93,48 @@ tolua_lerror:
} }
static int tolua_cocos2d_MenuItemLabel_create(lua_State* tolua_S)
{
if (NULL == tolua_S)
return 0;
int argc = 0;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertable(tolua_S,1,"MenuItemLabel",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
if(1 == argc)
{
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,2,"Node",0,&tolua_err) )
{
goto tolua_lerror;
}
#endif
Node* label = ((Node*) tolua_tousertype(tolua_S,2,0));
MenuItemLabel* tolua_ret = (MenuItemLabel*) MenuItemLabel::create(label);
int nID = (tolua_ret) ? (int)tolua_ret->_ID : -1;
int* pLuaID = (tolua_ret) ? &tolua_ret->_luaID : NULL;
toluafix_pushusertype_ccobject(tolua_S, nID, pLuaID, (void*)tolua_ret,"MenuItemLabel");
return 1;
}
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'create'.",&tolua_err);
return 0;
#endif
}
static int tolua_cocos2d_Menu_create(lua_State* tolua_S) static int tolua_cocos2d_Menu_create(lua_State* tolua_S)
{ {
if (NULL == tolua_S)
return 0;
int argc = 0; int argc = 0;
#if COCOS2D_DEBUG >= 1 #if COCOS2D_DEBUG >= 1
@ -105,13 +148,13 @@ static int tolua_cocos2d_Menu_create(lua_State* tolua_S)
cocos2d::Array* array = cocos2d::Array::create(); cocos2d::Array* array = cocos2d::Array::create();
if (NULL == array) if (NULL == array)
{ {
printf("Menu create method create array fail\n"); CCLOG("Menu create method create array fail\n");
return 0; return 0;
} }
uint32_t i = 1; uint32_t i = 1;
while (i <= argc) while (i <= argc)
{ {
if (!tolua_isuserdata(tolua_S, 1 + i, 0, &tolua_err) ) if (!tolua_isusertype(tolua_S, 1 + i, "Object", 0, &tolua_err))
{ {
goto tolua_lerror; goto tolua_lerror;
return 0; return 0;
@ -153,6 +196,9 @@ tolua_lerror:
//tolua_cocos2d_Menu_create //tolua_cocos2d_Menu_create
static int tolua_cocos2d_MenuItem_registerScriptTapHandler(lua_State* tolua_S) static int tolua_cocos2d_MenuItem_registerScriptTapHandler(lua_State* tolua_S)
{ {
if (NULL == tolua_S)
return 0;
int argc = 0; int argc = 0;
MenuItem* cobj = nullptr; MenuItem* cobj = nullptr;
#if COCOS2D_DEBUG >= 1 #if COCOS2D_DEBUG >= 1
@ -184,13 +230,16 @@ static int tolua_cocos2d_MenuItem_registerScriptTapHandler(lua_State* tolua_S)
#if COCOS2D_DEBUG >= 1 #if COCOS2D_DEBUG >= 1
tolua_lerror: tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'registerScriptHandler'.",&tolua_err); tolua_error(tolua_S,"#ferror in function 'registerScriptTapHandler'.",&tolua_err);
return 0; return 0;
#endif #endif
} }
static int tolua_cocos2d_MenuItem_unregisterScriptTapHandler(lua_State* tolua_S) static int tolua_cocos2d_MenuItem_unregisterScriptTapHandler(lua_State* tolua_S)
{ {
if (NULL == tolua_S)
return 0;
int argc = 0; int argc = 0;
MenuItem* cobj = nullptr; MenuItem* cobj = nullptr;
@ -228,6 +277,9 @@ tolua_lerror:
static int tolua_cocos2d_Layer_registerScriptTouchHandler(lua_State* tolua_S) static int tolua_cocos2d_Layer_registerScriptTouchHandler(lua_State* tolua_S)
{ {
if (NULL == tolua_S)
return 0;
int argc = 0; int argc = 0;
Layer* self = nullptr; Layer* self = nullptr;
@ -307,6 +359,9 @@ tolua_lerror:
static int tolua_cocos2d_Layer_unregisterScriptTouchHandler(lua_State* tolua_S) static int tolua_cocos2d_Layer_unregisterScriptTouchHandler(lua_State* tolua_S)
{ {
if (NULL == tolua_S)
return 0;
int argc = 0; int argc = 0;
Layer* self = nullptr; Layer* self = nullptr;
@ -343,8 +398,11 @@ tolua_lerror:
} }
static int tolua_cocos2d_Scheduler_scheduleScriptFunc00(lua_State* tolua_S) static int tolua_cocos2d_Scheduler_scheduleScriptFunc(lua_State* tolua_S)
{ {
if (NULL == tolua_S)
return 0;
int argc = 0; int argc = 0;
Scheduler* self = nullptr; Scheduler* self = nullptr;
@ -357,7 +415,7 @@ static int tolua_cocos2d_Scheduler_scheduleScriptFunc00(lua_State* tolua_S)
#if COCOS2D_DEBUG >= 1 #if COCOS2D_DEBUG >= 1
if (nullptr == self) { if (nullptr == self) {
tolua_error(tolua_S,"invalid 'self' in function 'tolua_cocos2d_Scheduler_scheduleScriptFunc00'\n", NULL); tolua_error(tolua_S,"invalid 'self' in function 'tolua_cocos2d_Scheduler_scheduleScriptFunc'\n", NULL);
return 0; return 0;
} }
#endif #endif
@ -393,6 +451,9 @@ tolua_lerror:
static int tolua_cocos2d_Scheduler_unscheduleScriptEntry(lua_State* tolua_S) static int tolua_cocos2d_Scheduler_unscheduleScriptEntry(lua_State* tolua_S)
{ {
if (NULL == tolua_S)
return 0;
int argc = 0; int argc = 0;
Scheduler* self = nullptr; Scheduler* self = nullptr;
@ -434,6 +495,547 @@ tolua_lerror:
#endif #endif
} }
static int tolua_cocos2d_Sequence_create(lua_State* tolua_S)
{
if (NULL == tolua_S)
return 0;
int argc = 0;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertable(tolua_S,1,"Sequence",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
if(argc > 0)
{
cocos2d::Array* array = cocos2d::Array::create();
if (NULL == array)
{
CCLOG("Sequence create method create array fail\n");
return 0;
}
uint32_t i = 1;
while (i <= argc)
{
if (!tolua_isusertype(tolua_S, 1 + i, "Object", 0, &tolua_err))
{
goto tolua_lerror;
return 0;
}
cocos2d::Object* item = static_cast<cocos2d::Object*>(tolua_tousertype(tolua_S, 1 + i, NULL));
if (NULL != item)
{
array->addObject(item);
++i;
}
}
cocos2d::Sequence* tolua_ret = cocos2d::Sequence::create(array);
//issue 2433 uncheck
int nID = (tolua_ret) ? (int)tolua_ret->_ID : -1;
int* pLuaID = (tolua_ret) ? &tolua_ret->_luaID : NULL;
toluafix_pushusertype_ccobject(tolua_S, nID, pLuaID, (void*)tolua_ret,"Sequence");
return 1;
}
CCLOG("wrong number of arguments: %d, was expecting %d\n", argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'create'.",&tolua_err);
return 0;
#endif
}
static int tolua_cocos2d_CallFunc_create(lua_State* tolua_S)
{
if (NULL == tolua_S)
return 0;
int argc = 0;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertable(tolua_S,1,"CallFunc",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
if (argc == 1)
{
#if COCOS2D_DEBUG >= 1
if(!toluafix_isfunction(tolua_S,2,"LUA_FUNCTION",0,&tolua_err))
goto tolua_lerror;
#endif
LUA_FUNCTION funcID = ( toluafix_ref_function(tolua_S,2,0));
LuaCallFunc* tolua_ret = (LuaCallFunc*) LuaCallFunc::create(funcID);
int nID = (tolua_ret) ? (int)tolua_ret->_ID : -1;
int* pLuaID = (tolua_ret) ? &tolua_ret->_luaID : NULL;
toluafix_pushusertype_ccobject(tolua_S, nID, pLuaID, (void*)tolua_ret,"CallFunc");
return 1;
}
CCLOG("wrong number of arguments: %d, was expecting %d\n", argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'create'.",&tolua_err);
return 0;
#endif
}
static int tolua_cocos2d_Node_registerScriptHandler(lua_State* tolua_S)
{
if (NULL == tolua_S)
return 0;
int argc = 0;
Node* node = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(tolua_S,1,"Node",0,&tolua_err)) goto tolua_lerror;
#endif
node = static_cast<cocos2d::Node*>(tolua_tousertype(tolua_S,1,0));
argc = lua_gettop(tolua_S) - 1;
if (argc == 1)
{
#if COCOS2D_DEBUG >= 1
if(!toluafix_isfunction(tolua_S,2,"LUA_FUNCTION",0,&tolua_err))
goto tolua_lerror;
#endif
LUA_FUNCTION handler = ( toluafix_ref_function(tolua_S,2,0));
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)node, handler, ScriptHandlerMgr::kNodeHandler);
return 0;
}
CCLOG("wrong number of arguments: %d, was expecting %d\n", argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'registerScriptHandler'.",&tolua_err);
return 0;
#endif
}
static int tolua_cocos2d_Node_unregisterScriptHandler(lua_State* tolua_S)
{
if (NULL == tolua_S)
return 0;
int argc = 0;
Node* node = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(tolua_S,1,"Node",0,&tolua_err)) goto tolua_lerror;
#endif
node = static_cast<cocos2d::Node*>(tolua_tousertype(tolua_S,1,0));
argc = lua_gettop(tolua_S) - 1;
if (argc == 0)
{
ScriptHandlerMgr::getInstance()->removeObjectHandler((void*)node, ScriptHandlerMgr::kNodeHandler);
return 0;
}
CCLOG("wrong number of arguments: %d, was expecting %d\n", argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'unregisterScriptHandler'.",&tolua_err);
return 0;
#endif
}
static int tolua_cocos2d_Spawn_create(lua_State* tolua_S)
{
if (NULL == tolua_S)
return 0;
int argc = 0;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertable(tolua_S,1,"Spawn",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
if (argc > 0)
{
cocos2d::Array* array = cocos2d::Array::create();
if (NULL == array)
{
CCLOG("Spawn create method create array fail\n");
return 0;
}
uint32_t i = 1;
while (i <= argc)
{
if (!tolua_isusertype(tolua_S, 1 + i, "Object", 0, &tolua_err))
{
goto tolua_lerror;
return 0;
}
cocos2d::Object* item = static_cast<cocos2d::Object*>(tolua_tousertype(tolua_S, 1 + i, NULL));
if (NULL != item)
{
array->addObject(item);
++i;
}
}
cocos2d::Spawn * tolua_ret = cocos2d::Spawn::create(array);
int nID = (tolua_ret) ? (int)tolua_ret->_ID : -1;
int* pLuaID = (tolua_ret) ? &tolua_ret->_luaID : NULL;
toluafix_pushusertype_ccobject(tolua_S, nID, pLuaID, (void*)tolua_ret,"Spawn");
return 1;
}
CCLOG("wrong number of arguments: %d, was expecting %d\n", argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'create'.",&tolua_err);
return 0;
#endif
}
static int tolua_cocos2d_CardinalSplineBy_create(lua_State* tolua_S)
{
if (NULL == tolua_S)
return 0;
int argc = 0;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertable(tolua_S,1,"CardinalSplineBy",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
if (argc == 3)
{
double dur = 0.0;
ok &= luaval_to_number(tolua_S, 2, &dur);
if (!ok)
return false;
int num = 0;
Point *arr = NULL;
ok &= luaval_to_array_of_Point(tolua_S, 3, &arr, &num);
if (!ok)
return false;
double ten = 0.0;
ok &= luaval_to_number(tolua_S, 4, &ten);
if (!ok)
return false;
if (num > 0)
{
PointArray* points = PointArray::create(num);
if (NULL == points)
{
free(arr);
return 0;
}
for( int i = 0; i < num; i++) {
points->addControlPoint(arr[i]);
}
free(arr);
CardinalSplineBy* tolua_ret = CardinalSplineBy::create(dur, points, ten);
if (NULL != tolua_ret)
{
int nID = (tolua_ret) ? (int)tolua_ret->_ID : -1;
int* pLuaID = (tolua_ret) ? &tolua_ret->_luaID : NULL;
toluafix_pushusertype_ccobject(tolua_S, nID, pLuaID, (void*)tolua_ret,"CardinalSplineBy");
return 1;
}
}
}
CCLOG("wrong number of arguments: %d, was expecting %d\n", argc, 3);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'create'.",&tolua_err);
return 0;
#endif
}
static int tolua_cocos2d_CatmullRomBy_create(lua_State* tolua_S)
{
if (NULL == tolua_S)
return 0;
int argc = 0;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertable(tolua_S,1,"CatmullRomBy",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
if (argc == 2)
{
double dur = 0.0;
ok &= luaval_to_number(tolua_S, 2, &dur);
if (!ok)
return false;
int num = 0;
Point *arr = NULL;
ok &= luaval_to_array_of_Point(tolua_S, 3, &arr, &num);
if (!ok)
return false;
if (num > 0)
{
PointArray* points = PointArray::create(num);
if (NULL == points)
{
free(arr);
return 0;
}
for( int i = 0; i < num; i++) {
points->addControlPoint(arr[i]);
}
free(arr);
CatmullRomBy* tolua_ret = CatmullRomBy::create(dur, points);
if (NULL != tolua_ret)
{
int nID = (tolua_ret) ? (int)tolua_ret->_ID : -1;
int* pLuaID = (tolua_ret) ? &tolua_ret->_luaID : NULL;
toluafix_pushusertype_ccobject(tolua_S, nID, pLuaID, (void*)tolua_ret,"CatmullRomBy");
return 1;
}
}
}
CCLOG("wrong number of arguments: %d, was expecting %d\n", argc, 2);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'create'.",&tolua_err);
return 0;
#endif
}
static int tolua_cocos2d_CatmullRomTo_create(lua_State* tolua_S)
{
if (NULL == tolua_S)
return 0;
int argc = 0;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertable(tolua_S,1,"CatmullRomTo",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
if (argc == 2)
{
double dur = 0.0;
ok &= luaval_to_number(tolua_S, 2, &dur);
if (!ok)
return false;
int num = 0;
Point *arr = NULL;
ok &= luaval_to_array_of_Point(tolua_S, 3, &arr, &num);
if (!ok)
return false;
if (num > 0)
{
PointArray* points = PointArray::create(num);
if (NULL == points)
{
free(arr);
return 0;
}
for( int i = 0; i < num; i++) {
points->addControlPoint(arr[i]);
}
free(arr);
CatmullRomTo* tolua_ret = CatmullRomTo::create(dur, points);
if (NULL != tolua_ret)
{
int nID = (tolua_ret) ? (int)tolua_ret->_ID : -1;
int* pLuaID = (tolua_ret) ? &tolua_ret->_luaID : NULL;
toluafix_pushusertype_ccobject(tolua_S, nID, pLuaID, (void*)tolua_ret,"CatmullRomTo");
return 1;
}
}
}
CCLOG("wrong number of arguments: %d, was expecting %d\n", argc, 2);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'create'.",&tolua_err);
return 0;
#endif
}
static int tolua_cocos2d_BezierBy_create(lua_State* tolua_S)
{
if (NULL == tolua_S)
return 0;
int argc = 0;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertable(tolua_S,1,"BezierBy",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
if (argc == 2)
{
double t = 0.0;
ok &= luaval_to_number(tolua_S, 2, &t);
if (!ok)
return false;
int num = 0;
Point *arr = NULL;
ok &= luaval_to_array_of_Point(tolua_S, 3, &arr, &num);
if (!ok)
return false;
if (num < 3)
{
free(arr);
return false;
}
ccBezierConfig config;
config.controlPoint_1 = arr[0];
config.controlPoint_2 = arr[1];
config.endPosition = arr[2];
free(arr);
BezierBy* tolua_ret = BezierBy::create(t, config);
if (NULL != tolua_ret)
{
int nID = (tolua_ret) ? (int)tolua_ret->_ID : -1;
int* pLuaID = (tolua_ret) ? &tolua_ret->_luaID : NULL;
toluafix_pushusertype_ccobject(tolua_S, nID, pLuaID, (void*)tolua_ret,"BezierBy");
return 1;
}
}
CCLOG("wrong number of arguments: %d, was expecting %d\n", argc, 2);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'create'.",&tolua_err);
return 0;
#endif
}
static int tolua_cocos2d_BezierTo_create(lua_State* tolua_S)
{
if (NULL == tolua_S)
return 0;
int argc = 0;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertable(tolua_S,1,"BezierTo",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
if (argc == 2)
{
double t = 0.0;
ok &= luaval_to_number(tolua_S, 2, &t);
if (!ok)
return false;
int num = 0;
Point *arr = NULL;
ok &= luaval_to_array_of_Point(tolua_S, 3, &arr, &num);
if (!ok)
return false;
if (num < 3)
{
free(arr);
return false;
}
ccBezierConfig config;
config.controlPoint_1 = arr[0];
config.controlPoint_2 = arr[1];
config.endPosition = arr[2];
free(arr);
BezierTo* tolua_ret = BezierTo::create(t, config);
if (NULL != tolua_ret)
{
int nID = (tolua_ret) ? (int)tolua_ret->_ID : -1;
int* pLuaID = (tolua_ret) ? &tolua_ret->_luaID : NULL;
toluafix_pushusertype_ccobject(tolua_S, nID, pLuaID, (void*)tolua_ret,"BezierTo");
return 1;
}
}
CCLOG("wrong number of arguments: %d, was expecting %d\n", argc, 2);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'create'.",&tolua_err);
return 0;
#endif
}
//void lua_extend_cocos2dx_MenuItem //void lua_extend_cocos2dx_MenuItem
//{ //{
// //
@ -465,6 +1067,15 @@ int register_all_cocos2dx_manual(lua_State* tolua_S)
lua_rawset(tolua_S,-3); lua_rawset(tolua_S,-3);
} }
lua_pushstring(tolua_S, "MenuItemLabel");
lua_rawget(tolua_S,LUA_REGISTRYINDEX);
if (lua_istable(tolua_S,-1))
{
lua_pushstring(tolua_S,"create");
lua_pushcfunction(tolua_S,tolua_cocos2d_MenuItemLabel_create);
lua_rawset(tolua_S,-3);
}
lua_pushstring(tolua_S, "Menu"); lua_pushstring(tolua_S, "Menu");
lua_rawget(tolua_S, LUA_REGISTRYINDEX); lua_rawget(tolua_S, LUA_REGISTRYINDEX);
if (lua_istable(tolua_S, -1)) if (lua_istable(tolua_S, -1))
@ -474,6 +1085,18 @@ int register_all_cocos2dx_manual(lua_State* tolua_S)
lua_rawset(tolua_S,-3); lua_rawset(tolua_S,-3);
} }
lua_pushstring(tolua_S,"Node");
lua_rawget(tolua_S,LUA_REGISTRYINDEX);
if (lua_istable(tolua_S,-1))
{
lua_pushstring(tolua_S,"registerScriptHandler");
lua_pushcfunction(tolua_S,tolua_cocos2d_Node_registerScriptHandler);
lua_rawset(tolua_S,-3);
lua_pushstring(tolua_S,"unregisterScriptHandler");
lua_pushcfunction(tolua_S,tolua_cocos2d_Node_unregisterScriptHandler);
lua_rawset(tolua_S, -3);
}
lua_pushstring(tolua_S,"Layer"); lua_pushstring(tolua_S,"Layer");
lua_rawget(tolua_S,LUA_REGISTRYINDEX); lua_rawget(tolua_S,LUA_REGISTRYINDEX);
if (lua_istable(tolua_S,-1)) if (lua_istable(tolua_S,-1))
@ -503,11 +1126,86 @@ int register_all_cocos2dx_manual(lua_State* tolua_S)
if (lua_istable(tolua_S,-1)) if (lua_istable(tolua_S,-1))
{ {
lua_pushstring(tolua_S,"scheduleScriptFunc"); lua_pushstring(tolua_S,"scheduleScriptFunc");
lua_pushcfunction(tolua_S,tolua_cocos2d_Scheduler_scheduleScriptFunc00); lua_pushcfunction(tolua_S,tolua_cocos2d_Scheduler_scheduleScriptFunc);
lua_rawset(tolua_S,-3); lua_rawset(tolua_S,-3);
lua_pushstring(tolua_S, "unscheduleScriptEntry"); lua_pushstring(tolua_S, "unscheduleScriptEntry");
lua_pushcfunction(tolua_S,tolua_cocos2d_Scheduler_unscheduleScriptEntry); lua_pushcfunction(tolua_S,tolua_cocos2d_Scheduler_unscheduleScriptEntry);
lua_rawset(tolua_S, -3); lua_rawset(tolua_S, -3);
} }
lua_pushstring(tolua_S,"Sequence");
lua_rawget(tolua_S,LUA_REGISTRYINDEX);
if (lua_istable(tolua_S,-1))
{
lua_pushstring(tolua_S,"create");
lua_pushcfunction(tolua_S,tolua_cocos2d_Sequence_create);
lua_rawset(tolua_S,-3);
}
lua_pushstring(tolua_S,"CallFunc");
lua_rawget(tolua_S,LUA_REGISTRYINDEX);
if (lua_istable(tolua_S,-1))
{
lua_pushstring(tolua_S,"create");
lua_pushcfunction(tolua_S,tolua_cocos2d_CallFunc_create);
lua_rawset(tolua_S,-3);
}
lua_pushstring(tolua_S,"Spawn");
lua_rawget(tolua_S,LUA_REGISTRYINDEX);
if (lua_istable(tolua_S,-1))
{
lua_pushstring(tolua_S,"create");
lua_pushcfunction(tolua_S,tolua_cocos2d_Spawn_create);
lua_rawset(tolua_S,-3);
}
lua_pushstring(tolua_S,"CardinalSplineBy");
lua_rawget(tolua_S,LUA_REGISTRYINDEX);
if (lua_istable(tolua_S,-1))
{
lua_pushstring(tolua_S,"create");
lua_pushcfunction(tolua_S,tolua_cocos2d_CardinalSplineBy_create);
lua_rawset(tolua_S,-3);
}
lua_pushstring(tolua_S,"CatmullRomBy");
lua_rawget(tolua_S,LUA_REGISTRYINDEX);
if (lua_istable(tolua_S,-1))
{
lua_pushstring(tolua_S,"create");
lua_pushcfunction(tolua_S,tolua_cocos2d_CatmullRomBy_create);
lua_rawset(tolua_S,-3);
}
lua_pushstring(tolua_S,"CatmullRomTo");
lua_rawget(tolua_S,LUA_REGISTRYINDEX);
if (lua_istable(tolua_S,-1))
{
lua_pushstring(tolua_S,"create");
lua_pushcfunction(tolua_S,tolua_cocos2d_CatmullRomTo_create);
lua_rawset(tolua_S,-3);
}
lua_pushstring(tolua_S,"BezierBy");
lua_rawget(tolua_S,LUA_REGISTRYINDEX);
if (lua_istable(tolua_S,-1))
{
lua_pushstring(tolua_S,"create");
lua_pushcfunction(tolua_S,tolua_cocos2d_BezierBy_create);
lua_rawset(tolua_S,-3);
}
lua_pushstring(tolua_S,"BezierTo");
lua_rawget(tolua_S,LUA_REGISTRYINDEX);
if (lua_istable(tolua_S,-1))
{
lua_pushstring(tolua_S,"create");
lua_pushcfunction(tolua_S,tolua_cocos2d_BezierTo_create);
lua_rawset(tolua_S,-3);
}
return 0; return 0;
} }

View File

@ -0,0 +1,28 @@
cc = cc or {}
--Point
function cc.p(_x,_y)
return { x = _x, y = _y }
end
--Size
function cc.size( _width,_height )
return { width = _width, height = _height }
end
--Rect
function cc.rect(_x,_y,_width,_height)
return { x = _x, y = _y, width = _width, height = _height }
end
--Color3B
function cc.c3b( _r,_g,_b )
return { r = _r, g = _g, b = _b }
end
--Color4B
function cc.c4b( _r,_g,_b,_a )
return { r = _r, g = _g, b = _b, a = _a }
end

View File

@ -1,178 +1,165 @@
local CCConstants = {} cc = cc or {}
CCConstants.SPRITE_INDEX_NOT_INITIALIZED = 0xffffffff cc.SPRITE_INDEX_NOT_INITIALIZED = 0xffffffff
CCConstants.TMX_ORIENTATION_HEX = 0x1 cc.TMX_ORIENTATION_HEX = 0x1
CCConstants.TMX_ORIENTATION_ISO = 0x2 cc.TMX_ORIENTATION_ISO = 0x2
CCConstants.TMX_ORIENTATION_ORTHO = 0x0 cc.TMX_ORIENTATION_ORTHO = 0x0
CCConstants.Z_COMPRESSION_BZIP2 = 0x1 cc.Z_COMPRESSION_BZIP2 = 0x1
CCConstants.Z_COMPRESSION_GZIP = 0x2 cc.Z_COMPRESSION_GZIP = 0x2
CCConstants.Z_COMPRESSION_NONE = 0x3 cc.Z_COMPRESSION_NONE = 0x3
CCConstants.Z_COMPRESSION_ZLIB = 0x0 cc.Z_COMPRESSION_ZLIB = 0x0
CCConstants.BLEND_DST = 0x303 cc.BLEND_DST = 0x303
CCConstants.BLEND_SRC = 0x1 cc.BLEND_SRC = 0x1
CCConstants.DIRECTOR_IOS_USE_BACKGROUND_THREAD = 0x0 cc.DIRECTOR_IOS_USE_BACKGROUND_THREAD = 0x0
CCConstants.DIRECTOR_MAC_THREAD = 0x0 cc.DIRECTOR_MAC_THREAD = 0x0
CCConstants.DIRECTOR_STATS_INTERVAL = 0.1 cc.DIRECTOR_STATS_INTERVAL = 0.1
CCConstants.ENABLE_BOX2_D_INTEGRATION = 0x0 cc.ENABLE_BOX2_D_INTEGRATION = 0x0
CCConstants.ENABLE_DEPRECATED = 0x1 cc.ENABLE_DEPRECATED = 0x1
CCConstants.ENABLE_GL_STATE_CACHE = 0x1 cc.ENABLE_GL_STATE_CACHE = 0x1
CCConstants.ENABLE_PROFILERS = 0x0 cc.ENABLE_PROFILERS = 0x0
CCConstants.ENABLE_STACKABLE_ACTIONS = 0x1 cc.ENABLE_STACKABLE_ACTIONS = 0x1
CCConstants.FIX_ARTIFACTS_BY_STRECHING_TEXEL = 0x0 cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL = 0x0
CCConstants.GL_ALL = 0x0 cc.GL_ALL = 0x0
CCConstants.LABELATLAS_DEBUG_DRAW = 0x0 cc.LABELATLAS_DEBUG_DRAW = 0x0
CCConstants.LABELBMFONT_DEBUG_DRAW = 0x0 cc.LABELBMFONT_DEBUG_DRAW = 0x0
CCConstants.MAC_USE_DISPLAY_LINK_THREAD = 0x0 cc.MAC_USE_DISPLAY_LINK_THREAD = 0x0
CCConstants.MAC_USE_MAIN_THREAD = 0x2 cc.MAC_USE_MAIN_THREAD = 0x2
CCConstants.MAC_USE_OWN_THREAD = 0x1 cc.MAC_USE_OWN_THREAD = 0x1
CCConstants.NODE_RENDER_SUBPIXEL = 0x1 cc.NODE_RENDER_SUBPIXEL = 0x1
CCConstants.PVRMIPMAP_MAX = 0x10 cc.PVRMIPMAP_MAX = 0x10
CCConstants.SPRITEBATCHNODE_RENDER_SUBPIXEL = 0x1 cc.SPRITEBATCHNODE_RENDER_SUBPIXEL = 0x1
CCConstants.SPRITE_DEBUG_DRAW = 0x0 cc.SPRITE_DEBUG_DRAW = 0x0
CCConstants.TEXTURE_ATLAS_USE_TRIANGLE_STRIP = 0x0 cc.TEXTURE_ATLAS_USE_TRIANGLE_STRIP = 0x0
CCConstants.TEXTURE_ATLAS_USE_VAO = 0x1 cc.TEXTURE_ATLAS_USE_VAO = 0x1
CCConstants.USE_L_A88_LABELS = 0x1 cc.USE_L_A88_LABELS = 0x1
CCConstants.ACTION_TAG_INVALID = -1 cc.ACTION_TAG_INVALID = -1
CCConstants.DEVICE_MAC = 0x6 cc.DEVICE_MAC = 0x6
CCConstants.DEVICE_MAC_RETINA_DISPLAY = 0x7 cc.DEVICE_MAC_RETINA_DISPLAY = 0x7
CCConstants.DEVICEI_PAD = 0x4 cc.DEVICEI_PAD = 0x4
CCConstants.DEVICEI_PAD_RETINA_DISPLAY = 0x5 cc.DEVICEI_PAD_RETINA_DISPLAY = 0x5
CCConstants.DEVICEI_PHONE = 0x0 cc.DEVICEI_PHONE = 0x0
CCConstants.DEVICEI_PHONE5 = 0x2 cc.DEVICEI_PHONE5 = 0x2
CCConstants.DEVICEI_PHONE5_RETINA_DISPLAY = 0x3 cc.DEVICEI_PHONE5_RETINA_DISPLAY = 0x3
CCConstants.DEVICEI_PHONE_RETINA_DISPLAY = 0x1 cc.DEVICEI_PHONE_RETINA_DISPLAY = 0x1
CCConstants.DIRECTOR_PROJECTION2_D = 0x0 cc.DIRECTOR_PROJECTION2_D = 0x0
CCConstants.DIRECTOR_PROJECTION3_D = 0x1 cc.DIRECTOR_PROJECTION3_D = 0x1
CCConstants.DIRECTOR_PROJECTION_CUSTOM = 0x2 cc.DIRECTOR_PROJECTION_CUSTOM = 0x2
CCConstants.DIRECTOR_PROJECTION_DEFAULT = 0x1 cc.DIRECTOR_PROJECTION_DEFAULT = 0x1
CCConstants.FILE_UTILS_SEARCH_DIRECTORY_MODE = 0x1 cc.FILE_UTILS_SEARCH_DIRECTORY_MODE = 0x1
CCConstants.FILE_UTILS_SEARCH_SUFFIX_MODE = 0x0 cc.FILE_UTILS_SEARCH_SUFFIX_MODE = 0x0
CCConstants.FLIPED_ALL = 0xe0000000 cc.FLIPED_ALL = 0xe0000000
CCConstants.FLIPPED_MASK = 0x1fffffff cc.FLIPPED_MASK = 0x1fffffff
CCConstants.IMAGE_FORMAT_JPEG = 0x0 cc.IMAGE_FORMAT_JPEG = 0x0
CCConstants.IMAGE_FORMAT_PNG = 0x1 cc.IMAGE_FORMAT_PNG = 0x1
CCConstants.ITEM_SIZE = 0x20 cc.ITEM_SIZE = 0x20
CCConstants.LABEL_AUTOMATIC_WIDTH = -1 cc.LABEL_AUTOMATIC_WIDTH = -1
CCConstants.LINE_BREAK_MODE_CHARACTER_WRAP = 0x1 cc.LINE_BREAK_MODE_CHARACTER_WRAP = 0x1
CCConstants.LINE_BREAK_MODE_CLIP = 0x2 cc.LINE_BREAK_MODE_CLIP = 0x2
CCConstants.LINE_BREAK_MODE_HEAD_TRUNCATION = 0x3 cc.LINE_BREAK_MODE_HEAD_TRUNCATION = 0x3
CCConstants.LINE_BREAK_MODE_MIDDLE_TRUNCATION = 0x5 cc.LINE_BREAK_MODE_MIDDLE_TRUNCATION = 0x5
CCConstants.LINE_BREAK_MODE_TAIL_TRUNCATION = 0x4 cc.LINE_BREAK_MODE_TAIL_TRUNCATION = 0x4
CCConstants.LINE_BREAK_MODE_WORD_WRAP = 0x0 cc.LINE_BREAK_MODE_WORD_WRAP = 0x0
CCConstants.MAC_VERSION_10_6 = 0xa060000 cc.MAC_VERSION_10_6 = 0xa060000
CCConstants.MAC_VERSION_10_7 = 0xa070000 cc.MAC_VERSION_10_7 = 0xa070000
CCConstants.MAC_VERSION_10_8 = 0xa080000 cc.MAC_VERSION_10_8 = 0xa080000
CCConstants.MENU_HANDLER_PRIORITY = -128 cc.MENU_HANDLER_PRIORITY = -128
CCConstants.MENU_STATE_TRACKING_TOUCH = 0x1 cc.MENU_STATE_TRACKING_TOUCH = 0x1
CCConstants.MENU_STATE_WAITING = 0x0 cc.MENU_STATE_WAITING = 0x0
CCConstants.NODE_TAG_INVALID = -1 cc.NODE_TAG_INVALID = -1
CCConstants.PARTICLE_DURATION_INFINITY = -1 cc.PARTICLE_DURATION_INFINITY = -1
CCConstants.PARTICLE_MODE_GRAVITY = 0x0 cc.PARTICLE_MODE_GRAVITY = 0x0
CCConstants.PARTICLE_MODE_RADIUS = 0x1 cc.PARTICLE_MODE_RADIUS = 0x1
CCConstants.PARTICLE_START_RADIUS_EQUAL_TO_END_RADIUS = -1 cc.PARTICLE_START_RADIUS_EQUAL_TO_END_RADIUS = -1
CCConstants.PARTICLE_START_SIZE_EQUAL_TO_END_SIZE = -1 cc.PARTICLE_START_SIZE_EQUAL_TO_END_SIZE = -1
CCConstants.POSITION_TYPE_FREE = 0x0 cc.POSITION_TYPE_FREE = 0x0
CCConstants.POSITION_TYPE_GROUPED = 0x2 cc.POSITION_TYPE_GROUPED = 0x2
CCConstants.POSITION_TYPE_RELATIVE = 0x1 cc.POSITION_TYPE_RELATIVE = 0x1
CCConstants.PRIORITY_NON_SYSTEM_MIN = -2147483647 cc.PRIORITY_NON_SYSTEM_MIN = -2147483647
CCConstants.PRIORITY_SYSTEM = -2147483648 cc.PRIORITY_SYSTEM = -2147483648
CCConstants.PROGRESS_TIMER_TYPE_BAR = 0x1 cc.PROGRESS_TIMER_TYPE_BAR = 0x1
CCConstants.PROGRESS_TIMER_TYPE_RADIAL = 0x0 cc.PROGRESS_TIMER_TYPE_RADIAL = 0x0
CCConstants.REPEAT_FOREVER = 0xfffffffe cc.REPEAT_FOREVER = 0xfffffffe
CCConstants.RESOLUTION_MAC = 0x1 cc.RESOLUTION_MAC = 0x1
CCConstants.RESOLUTION_MAC_RETINA_DISPLAY = 0x2 cc.RESOLUTION_MAC_RETINA_DISPLAY = 0x2
CCConstants.RESOLUTION_UNKNOWN = 0x0 cc.RESOLUTION_UNKNOWN = 0x0
CCConstants.TMX_TILE_DIAGONAL_FLAG = 0x20000000 cc.TMX_TILE_DIAGONAL_FLAG = 0x20000000
CCConstants.TMX_TILE_HORIZONTAL_FLAG = 0x80000000 cc.TMX_TILE_HORIZONTAL_FLAG = 0x80000000
CCConstants.TMX_TILE_VERTICAL_FLAG = 0x40000000 cc.TMX_TILE_VERTICAL_FLAG = 0x40000000
CCConstants.TEXT_ALIGNMENT_CENTER = 0x1 cc.TEXT_ALIGNMENT_CENTER = 0x1
CCConstants.TEXT_ALIGNMENT_LEFT = 0x0 cc.TEXT_ALIGNMENT_LEFT = 0x0
CCConstants.TEXT_ALIGNMENT_RIGHT = 0x2 cc.TEXT_ALIGNMENT_RIGHT = 0x2
CCConstants.TEXTURE2_D_PIXEL_FORMAT_A8 = 0x3 cc.TEXTURE2_D_PIXEL_FORMAT_A8 = 0x3
CCConstants.TEXTURE2_D_PIXEL_FORMAT_A_I88 = 0x5 cc.TEXTURE2_D_PIXEL_FORMAT_A_I88 = 0x5
CCConstants.TEXTURE2_D_PIXEL_FORMAT_DEFAULT = 0x0 cc.TEXTURE2_D_PIXEL_FORMAT_DEFAULT = 0x0
CCConstants.TEXTURE2_D_PIXEL_FORMAT_I8 = 0x4 cc.TEXTURE2_D_PIXEL_FORMAT_I8 = 0x4
CCConstants.TEXTURE2_D_PIXEL_FORMAT_PVRTC2 = 0x9 cc.TEXTURE2_D_PIXEL_FORMAT_PVRTC2 = 0x9
CCConstants.TEXTURE2_D_PIXEL_FORMAT_PVRTC4 = 0x8 cc.TEXTURE2_D_PIXEL_FORMAT_PVRTC4 = 0x8
CCConstants.TEXTURE2_D_PIXEL_FORMAT_RG_B565 = 0x2 cc.TEXTURE2_D_PIXEL_FORMAT_RG_B565 = 0x2
CCConstants.TEXTURE2_D_PIXEL_FORMAT_RGB5_A1 = 0x7 cc.TEXTURE2_D_PIXEL_FORMAT_RGB5_A1 = 0x7
CCConstants.TEXTURE2_D_PIXEL_FORMAT_RG_B888 = 0x1 cc.TEXTURE2_D_PIXEL_FORMAT_RG_B888 = 0x1
CCConstants.TEXTURE2_D_PIXEL_FORMAT_RGB_A4444 = 0x6 cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A4444 = 0x6
CCConstants.TEXTURE2_D_PIXEL_FORMAT_RGB_A8888 = 0x0 cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A8888 = 0x0
CCConstants.TOUCHES_ALL_AT_ONCE = 0x0 cc.TOUCHES_ALL_AT_ONCE = 0x0
CCConstants.TOUCHES_ONE_BY_ONE = 0x1 cc.TOUCHES_ONE_BY_ONE = 0x1
CCConstants.TRANSITION_ORIENTATION_DOWN_OVER = 0x1 cc.TRANSITION_ORIENTATION_DOWN_OVER = 0x1
CCConstants.TRANSITION_ORIENTATION_LEFT_OVER = 0x0 cc.TRANSITION_ORIENTATION_LEFT_OVER = 0x0
CCConstants.TRANSITION_ORIENTATION_RIGHT_OVER = 0x1 cc.TRANSITION_ORIENTATION_RIGHT_OVER = 0x1
CCConstants.TRANSITION_ORIENTATION_UP_OVER = 0x0 cc.TRANSITION_ORIENTATION_UP_OVER = 0x0
CCConstants.UNIFORM_COS_TIME = 0x5 cc.UNIFORM_COS_TIME = 0x5
CCConstants.UNIFORM_MV_MATRIX = 0x1 cc.UNIFORM_MV_MATRIX = 0x1
CCConstants.UNIFORM_MVP_MATRIX = 0x2 cc.UNIFORM_MVP_MATRIX = 0x2
CCConstants.UNIFORM_P_MATRIX = 0x0 cc.UNIFORM_P_MATRIX = 0x0
CCConstants.UNIFORM_RANDOM01 = 0x6 cc.UNIFORM_RANDOM01 = 0x6
CCConstants.UNIFORM_SAMPLER = 0x7 cc.UNIFORM_SAMPLER = 0x7
CCConstants.UNIFORM_SIN_TIME = 0x4 cc.UNIFORM_SIN_TIME = 0x4
CCConstants.UNIFORM_TIME = 0x3 cc.UNIFORM_TIME = 0x3
CCConstants.UNIFORM_MAX = 0x8 cc.UNIFORM_MAX = 0x8
CCConstants.VERTEX_ATTRIB_FLAG_COLOR = 0x2 cc.VERTEX_ATTRIB_FLAG_COLOR = 0x2
CCConstants.VERTEX_ATTRIB_FLAG_NONE = 0x0 cc.VERTEX_ATTRIB_FLAG_NONE = 0x0
CCConstants.VERTEX_ATTRIB_FLAG_POS_COLOR_TEX = 0x7 cc.VERTEX_ATTRIB_FLAG_POS_COLOR_TEX = 0x7
CCConstants.VERTEX_ATTRIB_FLAG_POSITION = 0x1 cc.VERTEX_ATTRIB_FLAG_POSITION = 0x1
CCConstants.VERTEX_ATTRIB_FLAG_TEX_COORDS = 0x4 cc.VERTEX_ATTRIB_FLAG_TEX_COORDS = 0x4
CCConstants.VERTEX_ATTRIB_COLOR = 0x1 cc.VERTEX_ATTRIB_COLOR = 0x1
CCConstants.VERTEX_ATTRIB_MAX = 0x3 cc.VERTEX_ATTRIB_MAX = 0x3
CCConstants.VERTEX_ATTRIB_POSITION = 0x0 cc.VERTEX_ATTRIB_POSITION = 0x0
CCConstants.VERTEX_ATTRIB_TEX_COORDS = 0x2 cc.VERTEX_ATTRIB_TEX_COORDS = 0x2
CCConstants.VERTICAL_TEXT_ALIGNMENT_BOTTOM = 0x2 cc.VERTICAL_TEXT_ALIGNMENT_BOTTOM = 0x2
CCConstants.VERTICAL_TEXT_ALIGNMENT_CENTER = 0x1 cc.VERTICAL_TEXT_ALIGNMENT_CENTER = 0x1
CCConstants.VERTICAL_TEXT_ALIGNMENT_TOP = 0x0 cc.VERTICAL_TEXT_ALIGNMENT_TOP = 0x0
CCConstants.OS_VERSION_4_0 = 0x4000000 cc.OS_VERSION_4_0 = 0x4000000
CCConstants.OS_VERSION_4_0_1 = 0x4000100 cc.OS_VERSION_4_0_1 = 0x4000100
CCConstants.OS_VERSION_4_1 = 0x4010000 cc.OS_VERSION_4_1 = 0x4010000
CCConstants.OS_VERSION_4_2 = 0x4020000 cc.OS_VERSION_4_2 = 0x4020000
CCConstants.OS_VERSION_4_2_1 = 0x4020100 cc.OS_VERSION_4_2_1 = 0x4020100
CCConstants.OS_VERSION_4_3 = 0x4030000 cc.OS_VERSION_4_3 = 0x4030000
CCConstants.OS_VERSION_4_3_1 = 0x4030100 cc.OS_VERSION_4_3_1 = 0x4030100
CCConstants.OS_VERSION_4_3_2 = 0x4030200 cc.OS_VERSION_4_3_2 = 0x4030200
CCConstants.OS_VERSION_4_3_3 = 0x4030300 cc.OS_VERSION_4_3_3 = 0x4030300
CCConstants.OS_VERSION_4_3_4 = 0x4030400 cc.OS_VERSION_4_3_4 = 0x4030400
CCConstants.OS_VERSION_4_3_5 = 0x4030500 cc.OS_VERSION_4_3_5 = 0x4030500
CCConstants.OS_VERSION_5_0 = 0x5000000 cc.OS_VERSION_5_0 = 0x5000000
CCConstants.OS_VERSION_5_0_1 = 0x5000100 cc.OS_VERSION_5_0_1 = 0x5000100
CCConstants.OS_VERSION_5_1_0 = 0x5010000 cc.OS_VERSION_5_1_0 = 0x5010000
CCConstants.OS_VERSION_6_0_0 = 0x6000000 cc.OS_VERSION_6_0_0 = 0x6000000
CCConstants.ANIMATION_FRAME_DISPLAYED_NOTIFICATION = 'CCAnimationFrameDisplayedNotification' cc.ANIMATION_FRAME_DISPLAYED_NOTIFICATION = 'CCAnimationFrameDisplayedNotification'
CCConstants.CHIPMUNK_IMPORT = 'chipmunk.h' cc.CHIPMUNK_IMPORT = 'chipmunk.h'
CCConstants.ATTRIBUTE_NAME_COLOR = 'a_color' cc.ATTRIBUTE_NAME_COLOR = 'a_color'
CCConstants.ATTRIBUTE_NAME_POSITION = 'a_position' cc.ATTRIBUTE_NAME_POSITION = 'a_position'
CCConstants.ATTRIBUTE_NAME_TEX_COORD = 'a_texCoord' cc.ATTRIBUTE_NAME_TEX_COORD = 'a_texCoord'
CCConstants.SHADER_POSITION_COLOR = 'ShaderPositionColor' cc.SHADER_POSITION_COLOR = 'ShaderPositionColor'
CCConstants.SHADER_POSITION_LENGTH_TEXURE_COLOR = 'ShaderPositionLengthTextureColor' cc.SHADER_POSITION_LENGTH_TEXURE_COLOR = 'ShaderPositionLengthTextureColor'
CCConstants.SHADER_POSITION_TEXTURE = 'ShaderPositionTexture' cc.SHADER_POSITION_TEXTURE = 'ShaderPositionTexture'
CCConstants.SHADER_POSITION_TEXTURE_A8_COLOR = 'ShaderPositionTextureA8Color' cc.SHADER_POSITION_TEXTURE_A8_COLOR = 'ShaderPositionTextureA8Color'
CCConstants.SHADER_POSITION_TEXTURE_COLOR = 'ShaderPositionTextureColor' cc.SHADER_POSITION_TEXTURE_COLOR = 'ShaderPositionTextureColor'
CCConstants.SHADER_POSITION_TEXTURE_COLOR_ALPHA_TEST = 'ShaderPositionTextureColorAlphaTest' cc.SHADER_POSITION_TEXTURE_COLOR_ALPHA_TEST = 'ShaderPositionTextureColorAlphaTest'
CCConstants.SHADER_POSITION_TEXTURE_U_COLOR = 'ShaderPositionTexture_uColor' cc.SHADER_POSITION_TEXTURE_U_COLOR = 'ShaderPositionTexture_uColor'
CCConstants.SHADER_POSITION_U_COLOR = 'ShaderPosition_uColor' cc.SHADER_POSITION_U_COLOR = 'ShaderPosition_uColor'
CCConstants.UNIFORM_ALPHA_TEST_VALUE_S = 'CC_AlphaValue' cc.UNIFORM_ALPHA_TEST_VALUE_S = 'CC_AlphaValue'
CCConstants.UNIFORM_COS_TIME_S = 'CC_CosTime' cc.UNIFORM_COS_TIME_S = 'CC_CosTime'
CCConstants.UNIFORM_MV_MATRIX_S = 'CC_MVMatrix' cc.UNIFORM_MV_MATRIX_S = 'CC_MVMatrix'
CCConstants.UNIFORM_MVP_MATRIX_S = 'CC_MVPMatrix' cc.UNIFORM_MVP_MATRIX_S = 'CC_MVPMatrix'
CCConstants.UNIFORM_P_MATRIX_S = 'CC_PMatrix' cc.UNIFORM_P_MATRIX_S = 'CC_PMatrix'
CCConstants.UNIFORM_RANDOM01_S = 'CC_Random01' cc.UNIFORM_RANDOM01_S = 'CC_Random01'
CCConstants.UNIFORM_SAMPLER_S = 'CC_Texture0' cc.UNIFORM_SAMPLER_S = 'CC_Texture0'
CCConstants.UNIFORM_SIN_TIME_S = 'CC_SinTime' cc.UNIFORM_SIN_TIME_S = 'CC_SinTime'
CCConstants.UNIFORM_TIME_S = 'CC_Time' cc.UNIFORM_TIME_S = 'CC_Time'
local modename = "CCConstants"
local CCConstantsproxy = {}
local CCConstantsMt = {
__index = CCConstants,
__newindex = function (t ,k ,v)
print("attemp to update a read-only table")
end
}
setmetatable(CCConstantsproxy,CCConstantsMt)
_G[modename] = CCConstantsproxy
package.loaded[modename] = CCConstantsproxy

View File

@ -294,6 +294,6 @@ function gl.getAttachedShaders(program)
end end
function gl.glNodeCreate() function gl.glNodeCreate()
return GLNode:create() return cc.GLNode:create()
end end

View File

@ -26,7 +26,7 @@ headers = %(cocosdir)s/cocos2dx/include/cocos2d.h %(cocosdir)s/CocosDenshion/inc
# what classes to produce code for. You can use regular expressions here. When testing the regular # what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^Menu*$". # expression, it will be enclosed in "^$", like this: "^Menu*$".
classes = Sprite.* Scene Node.* Director Layer.* Menu.* Touch .*Action.* Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Transition.* Spawn Animat.* Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* PointArray ToggleVisibility.* RemoveSelf Hide Particle.* Label.* Atlas.* TextureCache.* Texture2D Cardinal.* CatmullRom.* ParallaxNode TileMap.* TMX.* CallFunc RenderTexture GridAction Grid3DAction GridBase$ .+Grid Shaky3D Waves3D FlipX3D FlipY3D Speed ActionManager Set Data SimpleAudioEngine Scheduler Timer Orbit.* Follow.* Bezier.* CardinalSpline.* Camera.* DrawNode .*3D$ Liquid$ Waves$ ShuffleTiles$ TurnOffTiles$ Split.* Twirl$ FileUtils$ GLProgram ShaderCache Application ClippingNode MotionStreak classes = Sprite.* Scene Node.* Director Layer.* Menu.* Touch .*Action.* Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Transition.* Spawn Animat.* Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* PointArray ToggleVisibility.* RemoveSelf Hide Particle.* Label.* Atlas.* TextureCache.* Texture2D Cardinal.* CatmullRom.* ParallaxNode TileMap.* TMX.* CallFunc RenderTexture GridAction Grid3DAction GridBase$ .+Grid Shaky3D Waves3D FlipX3D FlipY3D Speed ActionManager Set Data SimpleAudioEngine Scheduler Timer Orbit.* Follow.* Bezier.* CardinalSpline.* Camera.* DrawNode .*3D$ Liquid$ Waves$ ShuffleTiles$ TurnOffTiles$ Split.* Twirl$ FileUtils$ GLProgram ShaderCache Application ClippingNode MotionStreak ^Object$
# what should we skip? in the format ClassName::[function function] # what should we skip? in the format ClassName::[function function]
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also # ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
@ -97,12 +97,13 @@ skip = Node::[getGrid setGLServerState description getUserObject .*UserData getG
Scheduler::[pause resume unschedule schedule update isTargetPaused], Scheduler::[pause resume unschedule schedule update isTargetPaused],
TextureCache::[addPVRTCImage], TextureCache::[addPVRTCImage],
Timer::[getSelector createWithScriptHandler], Timer::[getSelector createWithScriptHandler],
*::[copyWith.* onEnter.* onExit.* ^description$ getObjectType], *::[copyWith.* onEnter.* onExit.* ^description$ getObjectType (g|s)etDelegate],
FileUtils::[(g|s)etSearchResolutionsOrder$ (g|s)etSearchPaths$ getClassTypeInfo], FileUtils::[(g|s)etSearchResolutionsOrder$ (g|s)etSearchPaths$ getClassTypeInfo],
SimpleAudioEngine::[getClassTypeInfo], SimpleAudioEngine::[getClassTypeInfo],
Application::[^application.* ^run$], Application::[^application.* ^run$],
Camera::[getEyeXYZ getCenterXYZ getUpXYZ], Camera::[getEyeXYZ getCenterXYZ getUpXYZ],
ccFontDefinition::[*] ccFontDefinition::[*],
Object::[autorelease isEqual acceptVisitor update]
rename_functions = SpriteFrameCache::[addSpriteFramesWithFile=addSpriteFrames getSpriteFrameByName=getSpriteFrame isFlipX=isFlippedX isFlipY=isFlippedY], rename_functions = SpriteFrameCache::[addSpriteFramesWithFile=addSpriteFrames getSpriteFrameByName=getSpriteFrame isFlipX=isFlippedX isFlipY=isFlippedY],
MenuItemFont::[setFontNameObj=setFontName setFontSizeObj=setFontSize getFontSizeObj=getFontSize getFontNameObj=getFontName], MenuItemFont::[setFontNameObj=setFontName setFontSizeObj=setFontSize getFontSizeObj=getFontSize getFontNameObj=getFontName],
@ -134,7 +135,7 @@ remove_prefix =
classes_have_no_parents = Node Director SimpleAudioEngine FileUtils TMXMapInfo Application classes_have_no_parents = Node Director SimpleAudioEngine FileUtils TMXMapInfo Application
# base classes which will be skipped when their sub-classes found them. # base classes which will be skipped when their sub-classes found them.
base_classes_to_skip = Object Clonable base_classes_to_skip = Clonable
# classes that create no constructor # classes that create no constructor
# Set is special and we will use a hand-written constructor # Set is special and we will use a hand-written constructor

View File

@ -40,7 +40,7 @@ skip = CCBReader::[^CCBReader$ addOwnerCallbackName isJSControlled readByte getC
ScrollView::[(g|s)etDelegate$], ScrollView::[(g|s)etDelegate$],
.*Delegate::[*], .*Delegate::[*],
.*Loader.*::[*], .*Loader.*::[*],
*::[^visit$ copyWith.* onEnter.* onExit.* ^description$ getObjectType], *::[^visit$ copyWith.* onEnter.* onExit.* ^description$ getObjectType (g|s)etDelegate],
EditBox::[(g|s)etDelegate ^keyboard.* touchDownAction getScriptEditBoxHandler registerScriptEditBoxHandler unregisterScriptEditBoxHandler], EditBox::[(g|s)etDelegate ^keyboard.* touchDownAction getScriptEditBoxHandler registerScriptEditBoxHandler unregisterScriptEditBoxHandler],
TableView::[create (g|s)etDataSource$ (g|s)etDelegate], TableView::[create (g|s)etDataSource$ (g|s)etDelegate],
Control::[removeHandleOfControlEvent addHandleOfControlEvent] Control::[removeHandleOfControlEvent addHandleOfControlEvent]