Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » screen tinting

This thread is locked; no one can reply to it. rss feed Print
screen tinting
The Master
Member #4,498
April 2004
avatar

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.

We can only do what we feel is right each moment as we live it.

Evert
Member #794
November 2000
avatar

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
Member #5,372
January 2005
avatar

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

----------
兩隻老虎,兩隻老虎,跑得快!

Padraic Hennessy
Member #6,968
March 2006

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
Member #3,073
December 2002

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
Member #210
April 2000
avatar

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.

Neil.
MAME Cabinet Blog / AXL LIBRARY (a games framework) / AXL Documentation and Tutorial

wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie

The Master
Member #4,498
April 2004
avatar

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?

We can only do what we feel is right each moment as we live it.

A J
Member #3,025
December 2002
avatar

when was FBlend last updated ?

___________________________
The more you talk, the more AJ is right. - ML

Neil Walker
Member #210
April 2000
avatar

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.

Quote:

Does anyone have a precompiled one for msvc?

http://retrospec.sgn.net/allegro.php

Neil.
MAME Cabinet Blog / AXL LIBRARY (a games framework) / AXL Documentation and Tutorial

wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie

Dustin Dettmer
Member #3,935
October 2003
avatar

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.

Go to: