Merge pull request #3299 from samuele3hu/DrawNode

issue #2404:Add more deprecated function and modify some test sample
This commit is contained in:
minggo 2013-07-27 07:20:10 -07:00
commit d9cc0f4dfc
5 changed files with 118 additions and 27 deletions

View File

@ -287,12 +287,12 @@ end
local function drawCardinalSpline(array) local function drawCardinalSpline(array)
kmGLPushMatrix() kmGLPushMatrix()
kmGLTranslatef(50, 50, 0) kmGLTranslatef(50, 50, 0)
ccDrawCardinalSpline(array, 0, 100) CCDrawPrimitives.ccDrawCardinalSpline(array, 0, 100)
kmGLPopMatrix() kmGLPopMatrix()
kmGLPushMatrix() kmGLPushMatrix()
kmGLTranslatef(size.width / 2, 50, 0) kmGLTranslatef(size.width / 2, 50, 0)
ccDrawCardinalSpline(array, 1, 100) CCDrawPrimitives.ccDrawCardinalSpline(array, 1, 100)
kmGLPopMatrix() kmGLPopMatrix()
end end
@ -336,10 +336,10 @@ end
local function drawCatmullRom(array1, array2) local function drawCatmullRom(array1, array2)
kmGLPushMatrix() kmGLPushMatrix()
kmGLTranslatef(50, 50, 0) kmGLTranslatef(50, 50, 0)
ccDrawCatmullRom(array1, 50) CCDrawPrimitives.ccDrawCatmullRom(array1, 50)
kmGLPopMatrix() kmGLPopMatrix()
ccDrawCatmullRom(array2,50) CCDrawPrimitives.ccDrawCatmullRom(array2,50)
end end
local function ActionCatmullRom() local function ActionCatmullRom()

View File

@ -333,8 +333,8 @@ end
function Atlas4.draw() function Atlas4.draw()
local s = CCDirector:getInstance():getWinSize() local s = CCDirector:getInstance():getWinSize()
ccDrawLine( CCPoint(0, s.height/2), CCPoint(s.width, s.height/2) ) CCDrawPrimitives.ccDrawLine( CCPoint(0, s.height/2), CCPoint(s.width, s.height/2) )
ccDrawLine( CCPoint(s.width/2, 0), CCPoint(s.width/2, s.height) ) CCDrawPrimitives.ccDrawLine( CCPoint(s.width/2, 0), CCPoint(s.width/2, s.height) )
end end
function Atlas4.step(dt) function Atlas4.step(dt)

View File

@ -655,7 +655,7 @@ local function DemoBigFlower()
-- size, in pixels -- size, in pixels
emitter:setStartSize(80.0) emitter:setStartSize(80.0)
emitter:setStartSizeVar(40.0) emitter:setStartSizeVar(40.0)
emitter:setEndSize(kParticleStartSizeEqualToEndSize) emitter:setEndSize(kCCParticleStartSizeEqualToEndSize)
-- emits per second -- emits per second
emitter:setEmissionRate(emitter:getTotalParticles() / emitter:getLife()) emitter:setEmissionRate(emitter:getTotalParticles() / emitter:getLife())
@ -728,7 +728,7 @@ local function DemoRotFlower()
-- size, in pixels -- size, in pixels
emitter:setStartSize(30.0) emitter:setStartSize(30.0)
emitter:setStartSizeVar(0) emitter:setStartSizeVar(0)
emitter:setEndSize(kParticleStartSizeEqualToEndSize) emitter:setEndSize(kCCParticleStartSizeEqualToEndSize)
-- emits per second -- emits per second
emitter:setEmissionRate(emitter:getTotalParticles() / emitter:getLife()) emitter:setEmissionRate(emitter:getTotalParticles() / emitter:getLife())

View File

@ -695,10 +695,10 @@ local function draw()
glLineWidth(3) glLineWidth(3)
ccDrawLine( CCPoint(x, y), CCPoint((x+width), y) ) CCDrawPrimitives.ccDrawLine( CCPoint(x, y), CCPoint((x+width), y) )
ccDrawLine( CCPoint((x+width), y), CCPoint((x+width), (y+height)) ) CCDrawPrimitives.ccDrawLine( CCPoint((x+width), y), CCPoint((x+width), (y+height)) )
ccDrawLine( CCPoint((x+width), (y+height)), CCPoint(x, (y+height)) ) CCDrawPrimitives.ccDrawLine( CCPoint((x+width), (y+height)), CCPoint(x, (y+height)) )
ccDrawLine( CCPoint(x, (y+height)), CCPoint(x, y) ) CCDrawPrimitives.ccDrawLine( CCPoint(x, (y+height)), CCPoint(x, y) )
glLineWidth(1) glLineWidth(1)
end end
@ -764,10 +764,10 @@ local function draw()
glLineWidth(3) glLineWidth(3)
ccDrawLine( CCPoint(x,y), CCPoint(x+width,y) ) CCDrawPrimitives.ccDrawLine( CCPoint(x,y), CCPoint(x+width,y) )
ccDrawLine( CCPoint(x+width,y), CCPoint(x+width,y+height) ) CCDrawPrimitives.ccDrawLine( CCPoint(x+width,y), CCPoint(x+width,y+height) )
ccDrawLine( CCPoint(x+width,y+height), CCPoint(x,y+height) ) CCDrawPrimitives.ccDrawLine( CCPoint(x+width,y+height), CCPoint(x,y+height) )
ccDrawLine( CCPoint(x,y+height), CCPoint(x,y) ) CCDrawPrimitives.ccDrawLine( CCPoint(x,y+height), CCPoint(x,y) )
glLineWidth(1) glLineWidth(1)
end end

View File

@ -775,6 +775,8 @@ rawset(CCTMXObjectGroup,"objectNamed", CCTMXObjectGroupDeprecated.objectNamed)
--functions of WebSocket will be deprecated begin --functions of WebSocket will be deprecated begin
local targetPlatform = CCApplication:getInstance():getTargetPlatform()
if (kTargetIphone == targetPlatform) or (kTargetIpad == targetPlatform) or (kTargetAndroid == targetPlatform) or (kTargetWindows == targetPlatform) then
local WebSocketDeprecated = { } local WebSocketDeprecated = { }
function WebSocketDeprecated.sendTextMsg(self, string) function WebSocketDeprecated.sendTextMsg(self, string)
deprecatedTip("WebSocket:sendTextMsg","WebSocket:sendString") deprecatedTip("WebSocket:sendTextMsg","WebSocket:sendString")
@ -788,5 +790,94 @@ function WebSocketDeprecated.sendBinaryMsg(self, table,tablesize)
return self:sendString(string.char(unpack(table))) return self:sendString(string.char(unpack(table)))
end end
rawset(WebSocket,"sendBinaryMsg", WebSocketDeprecated.sendBinaryMsg) rawset(WebSocket,"sendBinaryMsg", WebSocketDeprecated.sendBinaryMsg)
end
--functions of WebSocket will be deprecated end --functions of WebSocket will be deprecated end
--functions of CCDrawPrimitives will be deprecated begin
local CCDrawPrimitivesDeprecated = { }
function CCDrawPrimitivesDeprecated.ccDrawPoint(pt)
deprecatedTip("ccDrawPoint","CCDrawPrimitives.ccDrawPoint")
return CCDrawPrimitives.ccDrawPoint(pt)
end
rawset(_G, "ccDrawPoint", CCDrawPrimitivesDeprecated.ccDrawPoint)
function CCDrawPrimitivesDeprecated.ccDrawLine(origin,destination)
deprecatedTip("ccDrawLine","CCDrawPrimitives.ccDrawLine")
return CCDrawPrimitives.ccDrawLine(origin,destination)
end
rawset(_G, "ccDrawLine", CCDrawPrimitivesDeprecated.ccDrawLine)
function CCDrawPrimitivesDeprecated.ccDrawRect(origin,destination)
deprecatedTip("ccDrawRect","CCDrawPrimitives.ccDrawRect")
return CCDrawPrimitives.ccDrawRect(origin,destination)
end
rawset(_G, "ccDrawRect", CCDrawPrimitivesDeprecated.ccDrawRect)
function CCDrawPrimitivesDeprecated.ccDrawSolidRect(origin,destination,color)
deprecatedTip("ccDrawSolidRect","CCDrawPrimitives.ccDrawSolidRect")
return CCDrawPrimitives.ccDrawSolidRect(origin,destination,color)
end
rawset(_G, "ccDrawSolidRect", CCDrawPrimitivesDeprecated.ccDrawSolidRect)
-- params:... may represent two param(xScale,yScale) or nil
function CCDrawPrimitivesDeprecated.ccDrawCircle(center,radius,angle,segments,drawLineToCenter,...)
deprecatedTip("ccDrawCircle","CCDrawPrimitives.ccDrawCircle")
return CCDrawPrimitives.ccDrawCircle(center,radius,angle,segments,drawLineToCenter,...)
end
rawset(_G, "ccDrawCircle", CCDrawPrimitivesDeprecated.ccDrawCircle)
-- params:... may represent two param(xScale,yScale) or nil
function CCDrawPrimitivesDeprecated.ccDrawSolidCircle(center,radius,angle,segments,...)
deprecatedTip("ccDrawSolidCircle","CCDrawPrimitives.ccDrawSolidCircle")
return CCDrawPrimitives.ccDrawSolidCircle(center,radius,angle,segments,...)
end
rawset(_G, "ccDrawSolidCircle", CCDrawPrimitivesDeprecated.ccDrawSolidCircle)
function CCDrawPrimitivesDeprecated.ccDrawQuadBezier(origin,control,destination,segments)
deprecatedTip("ccDrawQuadBezier","CCDrawPrimitives.ccDrawQuadBezier")
return CCDrawPrimitives.ccDrawQuadBezier(origin,control,destination,segments)
end
rawset(_G, "ccDrawQuadBezier", CCDrawPrimitivesDeprecated.ccDrawQuadBezier)
function CCDrawPrimitivesDeprecated.ccDrawCubicBezier(origin,control1,control2,destination,segments)
deprecatedTip("ccDrawCubicBezier","CCDrawPrimitives.ccDrawCubicBezier")
return CCDrawPrimitives.ccDrawCubicBezier(origin,control1,control2,destination,segments)
end
rawset(_G, "ccDrawCubicBezier", CCDrawPrimitivesDeprecated.ccDrawCubicBezier)
function CCDrawPrimitivesDeprecated.ccDrawCatmullRom(arrayOfControlPoints,segments)
deprecatedTip("ccDrawCatmullRom","CCDrawPrimitives.ccDrawCatmullRom")
return CCDrawPrimitives.ccDrawCatmullRom(arrayOfControlPoints,segments)
end
rawset(_G, "ccDrawCatmullRom", CCDrawPrimitivesDeprecated.ccDrawCatmullRom)
function CCDrawPrimitivesDeprecated.ccDrawCardinalSpline(config,tension,segments)
deprecatedTip("ccDrawCardinalSpline","CCDrawPrimitives.ccDrawCardinalSpline")
return CCDrawPrimitives.ccDrawCardinalSpline(config,tension,segments)
end
rawset(_G, "ccDrawCardinalSpline", CCDrawPrimitivesDeprecated.ccDrawCardinalSpline)
function CCDrawPrimitivesDeprecated.ccDrawColor4B(r,g,b,a)
deprecatedTip("ccDrawColor4B","CCDrawPrimitives.ccDrawColor4B")
return CCDrawPrimitives.ccDrawColor4B(r,g,b,a)
end
rawset(_G, "ccDrawColor4B", CCDrawPrimitivesDeprecated.ccDrawColor4B)
function CCDrawPrimitivesDeprecated.ccDrawColor4F(r,g,b,a)
deprecatedTip("ccDrawColor4F","CCDrawPrimitives.ccDrawColor4F")
return CCDrawPrimitives.ccDrawColor4F(r,g,b,a)
end
rawset(_G, "ccDrawColor4F", CCDrawPrimitivesDeprecated.ccDrawColor4F)
function CCDrawPrimitivesDeprecated.ccPointSize(pointSize)
deprecatedTip("ccPointSize","CCDrawPrimitives.ccPointSize")
return CCDrawPrimitives.ccPointSize(pointSize)
end
rawset(_G, "ccPointSize", CCDrawPrimitivesDeprecated.ccPointSize)
--functions of CCDrawPrimitives will be deprecated end
--enums of CCParticleSystem will be deprecated begin
_G["kParticleStartSizeEqualToEndSize"] = _G["kCCParticleStartSizeEqualToEndSize"]
_G["kParticleDurationInfinity"] = _G["kCCParticleDurationInfinity"]
--enums of CCParticleSystem will be deprecated end