Hello there !
Yesterday I created that thing bellow (all 2D using only Gosu drawing methods) :
The idea is that the background is rendered illuminated, then the player is drawn and a torchlight sprite is drawn on top of it. The noise effect is another layer drawn on top of everything. The torchlight is made like this :
The surrounding black is partially transparent and the "light part" is even more transparent. The sprite is drawn using Gosu::Image.draw_rot. I created a method that draws the corners so that when the sprite is rotated, the global image is still a rectangle. The fill color for the edges is the same partially transparent black used before. Finally, from this englobing rectangle, 4 rectangles are drawn the same color to cover the entire screen.
Things are working great, there are some frames where I see glitches, really one or two frames a minute, randomly, which is annoying but I can live with that.
The only problem here is that I can't use this technique if I want to add other "light layers". It works here because everything is dark except the torlight area, but I would like to add other light sources and it would be really hard to use the same technique, taking care of other rectangles intersecting the ones drawn for the torchlight.
Is there another way to create this effect ? I would really like to use only Gosu drawing techniques. Thanks for your precious help.