Mojo1 to Mojo2 'Matrix' functions conversion

Community Forums/Monkey Talk/Mojo1 to Mojo2 'Matrix' functions conversion

RustyKristi(Posted 2016) [#1]
Probably the best place to ask as I'm having problems with Matrix Mojo1 to Mojo2

I got some small library that I need to convert to Mojo2, and here's the code in mojo1

	Local corners:Float[][] = New Float[4][]
	corners[0] = GetMatrix()
	Translate tileImageWidth,0
	corners[1] = GetMatrix()
	Translate 0,tileImageHeight
	corners[2] = GetMatrix()
	Translate 0,-tileImageWidth
	corners[3] = GetMatrix()


Look like GetMatrix needs to have a matrix float as param and I see corners as the matrix but don't know how to arrange them because this is my first time dealing with any Mojo framework.

I'm using BMX Mojo2 btw..


Floyd(Posted 2016) [#2]
I don't know either version of Mojo, but that code looks wrong. The next to last line seems like it is attempting to "undo" line 3 and thus should be
	Translate -tileImageWidth, 0

As to GetMatrix() needing a parameter I would guess something like this
	corners[0] = GetMatrix()   ' old style
	GetMatrix( corners[0] )    ' new?

The idea being that in the old form GetMatrix() returns a 1-d array, while the new way returns nothing but stuffs values directly into the array passed as a parameter.

If this is correct then that array would need enough "slots" for those values. I suppose corners would have to be Float[4][size] where size is however many values GetMatrix() is producing.

I really should give Monkey a second chance. When it first came out I played around with it on a Windows PC but had no real use for it. Now I have an Android tablet.


RustyKristi(Posted 2016) [#3]
I don't know either version of Mojo, but that code looks wrong.


Yes, I know but it works somehow on Monkey. I will try to look for the Mojo2 version more but thank you, I also thought of that solution when I encountered this issue.