Search code examples
luamoai

Draw a circular dashed lines in Moai sdk


I don't know how to draw a circular dashed lines in moai using MoaiDraw? Could anyone tell me how to do that? sorry I'm a newbie in moai.


Solution

  • Could you try out with your version of 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)