Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Possible bug in Matrix:getElements() or setElements() — Gideros Forum

Possible bug in Matrix:getElements() or setElements()

bowerandybowerandy Guru
edited April 2012 in Bugs and issues
I think there may be a bug in the setting/getting of matrix elements. From my brief test any rotation component seems to get negated. Try this in a main.lua:
local function onMouseDown(self, event)
	-- Print the current matrix. If you try this several times it appears that m21 and 
        -- m12 are being negated each time
	local m11, m12, m21, m22, tx, ty=self:getMatrix():getElements()
	print(string.format("m11=%f, m12=%f, m21=%f, m22=%f, tx=%f, ty=%f", 
                 m11, m12, m21, m22, tx, ty))
 
	-- Set the matrix with a copy of the existing one and watch the shape flip
	self:setMatrix(Matrix.new(self:getMatrix():getElements()))
end
 
local shape = Shape.new()
 
shape:setLineStyle(3, 0x000000)
shape:setFillStyle(Shape.SOLID, 0xff0000, 0.5)
shape:beginPath()
shape:moveTo(0, 0)
shape:lineTo(100, 0)
shape:lineTo(100, 50)
shape:lineTo(0, 50)
shape:closePath()
shape:endPath()
stage:addChild(shape)
 
shape:setPosition(application:getContentWidth()/2, application:getContentHeight()/2)
shape:setRotation(45)
 
shape:addEventListener(Event.MOUSE_DOWN, onMouseDown, shape)
Best regards

Likes: jack0088

+1 -1 (+1 / -0 )Share on Facebook

Comments

Sign In or Register to comment.