Editing vector shape colour after creation.
Closed this issue · 1 comments
Deleted user commented
I do not understand the use of the colon, but here is the function (without the colon):
local square = RNFactory.createRect(0,0,50,50)
local circle = RNFactory.createCircle(200, 50, 25)
square.shape = "rect" -- put in RNObject when object is first made (or some other way)
circle.shape = "circle"
setColour = function(self,r,g,b)
local function onDraw()
MOAIGfxDevice.setPenColor(r * 0.00392, g * 0.00392, b * 0.00392, 1)--self.alpha)
if self.shape == "rect" then
MOAIDraw.fillRect(0,0,self.originalWidth,self.originalHeight)
else
MOAIDraw.fillCircle(0, 0, self.originalWidth*.5, 32)
end
end
self.gfxQuad:setDrawCallback(onDraw)
end
setColour(square, 255, 0 ,0)
setColour(circle, 0, 255 ,0)
Deleted user commented
Worked out colon usage and made pull request.
#23