Scale doesn't work as SetScale in BMX?

Monkey Forums/Monkey Programming/Scale doesn't work as SetScale in BMX?

anawiki(Posted 2011) [#1]
Does Scale work in the same way as SetScale in BMX? I don't know if I am doing something wrong or it just acts different.

Looks like porting from BMX will be a pain. Monkey seems to be using different philosophy.


slenkar(Posted 2011) [#2]
it acts VERY differently,
it makes distances larger if you scale up for starters :)

this is how you draw a scaled image:

pushmatrix
translate 20,20
scale 2,2
drawimage img,0,0
popmatrix

you have to translate before you scale if you dont want scale to affect distance


marksibly(Posted 2011) [#3]
Hi,

Easier/faster way;

DrawImage img,x,y,rotation#,scalex#,scaley#,frame=0


therevills(Posted 2011) [#4]
Looks like porting from BMX will be a pain.


Nah, not really... the main issue I have is SetColor not working with Images... it is a different language at the end of the day, but it is very similar to BlitzMax.


anawiki(Posted 2011) [#5]
Mark, thanks for help.

therevills: you are probably better than I am at it :) It's those little nuances like Scale that work so much different in both languages that make the porting process a pain. Languages are similar so it makes you feel they behave similar, and once they don't you lose all day wondering way things don't work as expected.


therevills(Posted 2011) [#6]
Languages are similar so it makes you feel they behave similar, and once they don't you lose all day wondering way things don't work as expected.


Yeah thats true... also Ive been messing with Monkey since public release now, so Ive got the basics down pat, you just got to learn the language :)


MikeHart(Posted 2011) [#7]
As I used and still use the way Mark described, I wonder which advantage someone has using the way slenkar described. Are there any?


therevills(Posted 2011) [#8]

Are there any?



None... if you look in the mojo source code graphics.monkey, you can see what DrawImage img,x,y,rotation#,scalex#,scaley#,frame=0 actually does:

	Translate x,y
	Rotate rotation
	Scale scaleX,scaleY
	Translate -image.tx,-image.ty



anawiki(Posted 2011) [#9]
Well, if short DrawImage doesn't set all of those params then using slenkar method would actually save few calls to GPU (ie. for drawing a lot of particles it can have performance impact).


therevills(Posted 2011) [#10]
Check the source code for graphics.monkey...

In the "short" drawimage it does this:

		PushMatrix
		Translate x-image.tx,y-image.ty
		ValidateMatrix


Before it does the actual draw...

There is only one less method call that only call slenkar's way and thats Rotate rotation, and wouldnt you want particles to rotate anyway?