Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu / Gosu Exchange / Resizing Images
- - By il mietitore Date 2011-10-19 22:01
A quick nooby question: how can i resize images?

here I have a 1600x900 image called riquadro.png . "Riquadro" means panel, in italian.

I had in mind to use that panel during almost the entire game, by altering its size and using it as background for all the various menus of the games. But I see that i can't alter its size with the .draw method.

Basically I'm trying to do what in HTML you do with the attributes height and width:  <img src="..." height="..." width="...">. And I see in the documentation that also with Gosu there are those attributes, so I suppose there must be a similar solution >.<
Parent - - By Jwosty Date 2011-10-19 23:03
In Gosu::Image's :draw method, you can use the parameters "factor_x" and "factor_y". These are set to 1 by default. Basically, they are like the numerator of a fraction when the denominator is always 1. So the value 2 would draw a size of 2/1 of your original size. Hope this helps!
Parent - - By il mietitore Date 2011-10-19 23:21
I have always wondered what was the purpose of those "factor_x" and "factor_y".

Well, thanks a lot, problem solved ;)
Parent - By Jwosty Date 2011-10-19 23:47
Sure, no problem! :)
Up Topic Gosu / Gosu Exchange / Resizing Images

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill