zandegran wrote:I tried using the attributes as parameters to setpencolor and it is not working..
- Code: Select all
color=MOAIColor.new()
color:setColor(1,1,1)
I just tried the method pygy79 suggested, and it works. However, using setPenColor in the draw function overrides the color value (as it probably should).
- Code: Select all
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)
print("Col",color.ATTR_R_COL)[/code] This code prints nil.
As you said it should work...
An instance of MOAIColor doesn't have this attribute. If you want the current red value of color, it would be:
- Code: Select all
print(color:getAttr(MOAIColor.ATTR_R_COL))
zandegran wrote:is there some requirement that makes it necessary for you to draw a circle this way?
yes there is. I need to seek color for a specific time..It also gives me the flexibility of choosing EaseTypes
I was referring to why you were using a MOAIScriptDeck and the MOAIDraw methods for drawing the circle. Rendering a texture of a circle, via a MOAIProp and MOAIGfxQuad2D, is a far superior method in nearly every way. It also allows the use of MOAIColor, and is somewhat easier to boot.