screen tinting
The Master

You know how in some games the contrast of the screen decreases to give the atmosphere of twilight or darkness, and in some it tints it a certain colour? I would like to know how this could be achieved with allegro. I've seen it done before in Fenix Blade and I want to encorporate the effect into my games.


The easiest way to do this is by using 8 bit graphics and palettes. Simply shade the palette to change the overal tint.

Pedro Avelar Gontijo

Some tricks I've seen consisted in tint the screen to a dark blue / purple tone and then reduce saturation.

Padraic Hennessy

if you use Openlayer and allegroGl you will have hardware accelleration and also there is a tintscreen function that you can just pass an rgba color to which will tint the screen for you. if you do a search there are alot of threads out there with how to install these extra packages.

Synapse Jumps

As Evert said, the easiest way to do this (if you're not using AllegroGL) is to use 8-bit palletts. I can give you an excellent example for this. I find this to be the most efficent way to do things, to be honest with you; Not to mention you get really neat, high-end-looking effects with 8-bit :P

Neil Walker

FBlend all the way (assuming a simple full screen wash is all you want). Bob is god ;)

Except in the fade functions where he doesn't take into account magic pink.

The Master

I found FBlend ok.
Has anyone had any issues with installing it tho? cuz it's asking for obj files that aren't there. Does anyone have a precompiled one for msvc?


when was FBlend last updated ?

Neil Walker

Bob made an update a couple of years ago, just shows it's stable ;)

He said a while ago he might fix the magic pink problem with the fade routine.


Does anyone have a precompiled one for msvc?


I'd say do it to a double buffer. Basically you'd draw to your buffer like regular, and then draw a transparent box on top of it.

So, first you would draw everything to your bitmap named buffer. Once thats done you'd draw your rectangle onto the buffer.

Heres some code to do that:

    int col = 0;

    set_trans_blender(col, col, col, int(step * 255));

    drawing_mode(DRAW_MODE_TRANS, 0, 0, 0);
    rectfill(buffer, x, y, x + w, y + h, makeacol32(col, col, col, int(step * 255)));
    drawing_mode(DRAW_MODE_SOLID, 0, 0, 0);

The pasted code will work in 32 bpp. if step is 1.0 the screen is totaly black, if step is 0 the screen is normal.

Now blit the buffer to the screen like you would normally.

To fade to white instead of black, doint col = 255;

Beware of speed issues.

Thread #572247. Printed from