Merge pull request #8903 from samuele3hu/v3_new_spine

Fix some lua-tests bugs
This commit is contained in:
minggo 2014-10-23 11:43:09 +08:00
commit e5ac916a17
3 changed files with 50 additions and 9 deletions

View File

@ -119,6 +119,22 @@ function BillBoardTest:init()
layer:runAction( cc.RepeatForever:create( cc.RotateBy:create( math.random(), cc.vec3(0.0, 45.0, 0.0) ) ) )
end
local billboard = cc.BillBoard:create("Images/Icon.png")
billboard:setScale(0.2)
billboard:setPosition3D(cc.vec3(0.0, 30.0, 0.0))
local billboard2 = cc.BillBoard:create("Images/r2.png")
billboard2:setPosition3D(cc.vec3(0.0, 0.0, 100.0))
billboard:addChild(billboard2)
table.insert(self._billboards, billboard)
table.insert(self._billboards, billboard2)
local sprite3d = cc.Sprite3D:create("Sprite3DTest/orc.c3t")
sprite3d:setScale(2.0)
sprite3d:addChild(billboard)
sprite3d:runAction( cc.RepeatForever:create( cc.RotateBy:create( 10.0, cc.vec3(0.0, 360.0, 0.0) ) ) )
self._layerBillBorad:addChild(sprite3d)
self:addNewBillBoradWithCoords(cc.vec3(20,5,0))
self:addNewBillBoradWithCoords(cc.vec3(60,5,0))
self:addNewBillBoradWithCoords(cc.vec3(100,5,0))

View File

@ -1113,7 +1113,7 @@ function UILoadingBarRightScale9Test:initExtend()
loadingBar:setScale9Enabled(true)
loadingBar:setCapInsets(cc.rect(0, 0, 0, 0))
loadingBar:setContentSize(cc.size(300, 30))
loadingBar:setDirection(ccui.LoadingBarDirection.LEFT)
loadingBar:setDirection(ccui.LoadingBarDirection.RIGHT)
loadingBar:setPercent(0)
loadingBar:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 + loadingBar:getContentSize().height / 4.0))
@ -1349,7 +1349,8 @@ function UITextAreaTest:initExtend()
self._uiLayer:addChild(alert)
local textArea = ccui.Text:create()
textArea:setTextAreaSize(cc.size(280, 150))
textArea:ignoreContentAdaptWithSize(false)
textArea:setContentSize(cc.size(280, 150))
textArea:setTextHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER)
textArea:setString("TextArea widget can line wrap")
textArea:setFontName("AmericanTypewriter")

View File

@ -1178,13 +1178,18 @@ local function TextureDrawAtPoint()
local ret = createTestLayer("Texture2D: drawAtPoint",
"draws 2 textures using drawAtPoint")
local function draw()
-- TextureDemo:draw()
local function draw(transform, transformUpdated)
local director = cc.Director:getInstance()
assert(nil ~= director, "Director is null when seting matrix stack")
director:pushMatrix(cc.MATRIX_STACK_TYPE.MODELVIEW)
director:loadMatrix(cc.MATRIX_STACK_TYPE.MODELVIEW, transform)
local s = cc.Director:getInstance():getWinSize()
m_pTex1:drawAtPoint(cc.p(s.width/2-50, s.height/2 - 50))
m_pTex2F:drawAtPoint(cc.p(s.width/2+50, s.height/2 - 50))
director:popMatrix(cc.MATRIX_STACK_TYPE.MODELVIEW)
end
m_pTex1 = cc.Director:getInstance():getTextureCache():addImage("Images/grossinis_sister1.png")
@ -1192,6 +1197,13 @@ local function TextureDrawAtPoint()
m_pTex1:retain()
m_pTex2F:retain()
local glNode = gl.glNodeCreate()
glNode:setContentSize(cc.size(256, 256))
glNode:setAnchorPoint(cc.p(0, 0))
glNode:registerScriptDrawHandler(draw)
ret:addChild(glNode)
local function onNodeEvent(event)
if event == "exit" then
m_pTex1:release()
@ -1207,10 +1219,15 @@ end
-- TextureDrawInRect
local function TextureDrawInRect()
local m_pTex1 = nil
local m_pTex2F = nil
local ret = createTestLayer("Texture2D: drawInRect",
"draws 2 textures using drawInRect")
local function draw()
-- TextureDemo:draw()
local function draw(transform, transformUpdated)
local director = cc.Director:getInstance()
assert(nullptr ~= director, "Director is null when seting matrix stack")
director:pushMatrix(cc.MATRIX_STACK_TYPE.MODELVIEW)
director:loadMatrix(cc.MATRIX_STACK_TYPE.MODELVIEW, transform)
local s = cc.Director:getInstance():getWinSize()
@ -1221,11 +1238,18 @@ local function TextureDrawInRect()
m_pTex2F:drawInRect(rect2)
end
local m_pTex1 = cc.Director:getInstance():getTextureCache():addImage("Images/grossinis_sister1.png")
local m_pTex2F = cc.Director:getInstance():getTextureCache():addImage("Images/grossinis_sister2.png")
m_pTex1 = cc.Director:getInstance():getTextureCache():addImage("Images/grossinis_sister1.png")
m_pTex2F = cc.Director:getInstance():getTextureCache():addImage("Images/grossinis_sister2.png")
m_pTex1:retain()
m_pTex2F:retain()
local glNode = gl.glNodeCreate()
glNode:setContentSize(cc.size(256, 256))
glNode:setAnchorPoint(cc.p(0, 0))
glNode:registerScriptDrawHandler(draw)
ret:addChild(glNode)
local function onNodeEvent(event)
if event == "exit" then
m_pTex1:release()