Monkey equivalent to BlitzMax SetScale-function

Monkey Forums/Monkey Programming/Monkey equivalent to BlitzMax SetScale-function

chimaera(Posted 2013) [#1]
Hi,

I am playing around with some scaling for different images in my monkey app, and I thought that I could call Scale before the DrawImage-command and return the Scale to 1,1 afterwards. This technique worked with in Blitzmax using the SetScale-command, but it seems that the Scale-command in Monkey affects the entire current matrix.

Is there a scale-solution that works like SetScale, so that I can scale affect the draw command and not the entire matrix?

------ More in depth ------
If I have 3 objects in a List that I loop through with the following code:
Scale 0.5,0.5
DrawImage(img, 0,0)
Scale 1,1

...I will get not get 3 objects that are drawn to 50% of their original size, but actually 3 different sized object each double the size of the previous object.


Wylaryzel(Posted 2013) [#2]
I would suggest that prior to any transformation (including scaling) use the PushMatrix() and afterwards the PopMatrix() function. This way you restore the previous sets.

If you only want to scale the image itself, there is an overload function which would go:
DrawImage(img,0,0,,0.5,0.5)

Edit: Change the order of Push/PopMatrix


chimaera(Posted 2013) [#3]
Hmmm. I believe that the overload drawimage function would be the solution, but I get an error using the exact syntax that you give in your reply. Any help?

Thanks!


Xaron(Posted 2013) [#4]
DrawImage(img:Image,x#,y#,rotation#,scaleX#,scaleY#)

so in your example:
DrawImage(img,0,0,0,0.5,0.5)


chimaera(Posted 2013) [#5]
Ah! Now I understood what you meant with push and pop matrix (but I believe that they should be the other way around, right?).

I realized that I had misunderstood the pop and push matrix commands. I had them in the beginning and end of my draw routine, but in through routine I used Scale several times, that created the issues that I mentioned in my first post.

Now I realize that I need to do this:
PushMatrix
Scale 0.5,0.5
DrawImage(Img,0,0)
PopMatrix


Thanks for the help.