Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu / Gosu Exchange / Can I draw an image reversed on the horizontal axis?
- By geo Date 2009-09-17 20:00
I have some sprites for character movement, and I'd like to use the same set for moving front & back. Is there a way to draw an image reversed?
- By deps Date 2009-09-17 21:20
The manual said:
image.draw( x,y,0, -1 )
I think.
- By geo Date 2009-09-18 16:43
That worked! Thanks!

Where did you read that?
- By deps Date 2009-09-18 17:46
... In the manual? ;)

http://www.libgosu.org/rdoc
- By geo Date 2009-09-18 18:08
I noticed the method was there. It has the following signature:

draw (x, y, z, factor_x=1, factor_y=1, color=0xffffffff, mode=:default)

Draws the image so its upper left corner is at (x; y).

How do you interpret the factor_x,factor_y,color and mode parameters?
- By deps Date 2009-09-18 18:37 Edited 2009-09-18 18:40
factor_* is pretty easy. 1.0 is the default size (in x and y), change factor_x to 0.5 and it's half it's original size. 0.25 would be a quater of its original size. 2.0 would be double it's original size. etc.. (same for y obviously)

I have no idea what you can put in mode.

The color is default set to white in order to display the image using it's default colours. Change it to 0xaaffffff to draw a transparent image, and/or change the rgb values to tint the image to another colour, like red: 0xffff0000
The format is 0xAARRGGBB, where each pair can be anything from 00 to ff, in hexadecimal.
Therefore, 0xffffffff is Alpha: FF (fully opaque), Red: FF (very red), Green: FF (very green) and Blue: FF (very blue). Add these together and you get bright white.

I'm sure someone can give you a better explanation... I'm having a cold and fever and isn't thinking straight. :P
- By jlnr (dev) Date 2009-09-18 19:13
Mode can be either :additive or :default. :additive will just add the new colors to the underlying ones, so if you draw a lot of grey additive particles over each other, they will eventually become white. Not so with :default, but it looks nice for e.g. smoke effects.
- By geo Date 2009-09-18 21:12
Thanks for the details guys!
Up Topic Gosu / Gosu Exchange / Can I draw an image reversed on the horizontal axis?

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill