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)
kmGLPushMatrix()
kmGLTranslatef(50, 50, 0)
ccDrawCardinalSpline(array, 0, 100)
CCDrawPrimitives.ccDrawCardinalSpline(array, 0, 100)
kmGLPopMatrix()
kmGLPushMatrix()
kmGLTranslatef(size.width / 2, 50, 0)
ccDrawCardinalSpline(array, 1, 100)
CCDrawPrimitives.ccDrawCardinalSpline(array, 1, 100)
kmGLPopMatrix()
end
@ -336,10 +336,10 @@ end
local function drawCatmullRom(array1, array2)
kmGLPushMatrix()
kmGLTranslatef(50, 50, 0)
ccDrawCatmullRom(array1, 50)
CCDrawPrimitives.ccDrawCatmullRom(array1, 50)
kmGLPopMatrix()
ccDrawCatmullRom(array2,50)
CCDrawPrimitives.ccDrawCatmullRom(array2,50)
end
local function ActionCatmullRom()

View File

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

View File

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

View File

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

View File

@ -775,18 +775,109 @@ rawset(CCTMXObjectGroup,"objectNamed", CCTMXObjectGroupDeprecated.objectNamed)
--functions of WebSocket will be deprecated begin
local WebSocketDeprecated = { }
function WebSocketDeprecated.sendTextMsg(self, string)
local targetPlatform = CCApplication:getInstance():getTargetPlatform()
if (kTargetIphone == targetPlatform) or (kTargetIpad == targetPlatform) or (kTargetAndroid == targetPlatform) or (kTargetWindows == targetPlatform) then
local WebSocketDeprecated = { }
function WebSocketDeprecated.sendTextMsg(self, string)
deprecatedTip("WebSocket:sendTextMsg","WebSocket:sendString")
return self:sendString(string)
end
rawset(WebSocket,"sendTextMsg", WebSocketDeprecated.sendTextMsg)
end
rawset(WebSocket,"sendTextMsg", WebSocketDeprecated.sendTextMsg)
function WebSocketDeprecated.sendBinaryMsg(self, table,tablesize)
function WebSocketDeprecated.sendBinaryMsg(self, table,tablesize)
deprecatedTip("WebSocket:sendBinaryMsg","WebSocket:sendString")
string.char(unpack(table))
return self:sendString(string.char(unpack(table)))
end
rawset(WebSocket,"sendBinaryMsg", WebSocketDeprecated.sendBinaryMsg)
end
rawset(WebSocket,"sendBinaryMsg", WebSocketDeprecated.sendBinaryMsg)
--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