Page 1 of 1

Color masking possible?

Posted: Mon Oct 19, 2009 10:54 pm
by ecliptic
Hello. I'm thinking about doing a puzzle game, but one of the key things I need to make the presentation correct is allow color masking on all drawn objects, to simulate the user putting red goggles, green goggles, blue goggles, etc. thus giving everything a tint of the proper color when the proper glasses are being worn.

I checked through the documentation but couldn't seem to find anything to do that, unless one of the blending modes could help me, but the documentation regarding that functionality is somewhat sparse. If there's a way to do it at the rendered screen level too, that's fine, but again I didn't see anything indicating post-processing of this sort is doable at this point.

Thanks for your help!

Re: Color masking possible?

Posted: Tue Oct 20, 2009 12:42 am
by Almost
love.graphics.setColorMode(love.color_modulate) --see http://love2d.org/docs/Constants.html for the values of things like colormode

love.graphics.setColor(255,200,200) --slightly red color
love.graphics.draw(image,100,100) --image will now be drawn with a red tint (rather, the green and blue values of the image will be lessened)


That allows for tinting when drawing images, you still have to set colors before you draw stuff to make it the right color. The alternate solution is, of course, to just draw a massive transparent rectangle in front of everything.

love.graphics.setColor(255,0,0,32) --transparent red
love.graphics.rectangle(love.draw_fill,0,0,love.graphics.getWidth(),love.graphics.getHeight())

Re: Color masking possible?

Posted: Thu Oct 22, 2009 12:52 am
by ecliptic
Perfect! Thank you so much! :)