在Moai sdk画一条圆形虚线

时间:2017-09-11 02:26:18

标签: lua moai

我不知道如何使用MoaiDraw在moai中绘制圆形虚线?谁能告诉我怎么做?抱歉,我是moai的新手。

1 个答案:

答案 0 :(得分:0)

你可以尝试使用你的MOAI版本

MOAISim.openWindow ( "test", 320, 480 )



viewport = MOAIViewport.new ()

viewport:setSize ( 320, 480 )

viewport:setScale ( 320, 480 )



layer = MOAILayer2D.new ()

layer:setViewport ( viewport )

MOAISim.pushRenderPass ( layer )



function onDraw ( index, xOff, yOff, xFlip, yFlip )

        MOAIDraw.fillCircle ( 0, 0, 64, 32 )

end



scriptDeck = MOAIScriptDeck.new ()

scriptDeck:setRect ( -64, -64, 64, 64 )

scriptDeck:setDrawCallback ( onDraw )



color = MOAIColor.new()

color:setColor(1, 0, 0, 1)



prop = MOAIProp2D.new ()

prop:setDeck ( scriptDeck )

layer:insertProp ( prop )



prop:setAttrLink(MOAIColor.INHERIT_COLOR, color, MOAIColor.COLOR_TRAIT)