I am a new bie in marmalade sdk, I am following this tutorial, I read this paragraph

*Here we tell Iw2D to set the “current” transform to use when drawing “anything”. Remember that Iw2D is context based and this transform will be remembered, so if you attempt to draw something else without again changing the transform then it will be drawn in the same position, at the same angle and at the same scale. Note that you can reset the current transform back to normal using Iw2DSetTransformMatrix(CIwMat2D::g_Identity). The identity matrix is the default transformation matrix that has no rotation, no translation and no scaling.*

I am confused that what does this line mean >> Iw2D is context based and this transform will be remembered, any cute thought ? your help will be appreciate able.

有帮助吗?

解决方案 2

In Marmalade you can set the current transform matrix in every frame and then reset it into Identity. Or else you can set the transform matrix once and apply it to all future rendering/drawing.

When you call Iw2DDrawImage() or Iw2DDrawRect() or any other Iw2DDraw function, the drawing will be based on the current transform matrix. So if you've set rotation of 45 degrees on a particular drawing, every next drawing will be rotated to 45 degrees, unless you reset it again, same for scaling and other transformation. So if you want to avoid that, call Iw2DSetTransformMatrix() function and set it to identity matrix after the use is over in the current frame.

其他提示

Never heard of marmalade (except for breakfast -- and its transforms also stick), but in general:

A transform describes a geometric transformation applied to all coordinates before they are rendered. So if you draw horizontal line, and you specified a 45° rotation as your transform, then the line will be rendered at a 45° angle.

Context based means that the transform "sticks" until you either reset (= replace it with the "identity transform"), or modify it.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top