Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: earlwood on Fri 20/02/2004 00:55:16

Title: ScreenTint
Post by: earlwood on Fri 20/02/2004 00:55:16
Is there any way to do the screen tint while a character is moving, like a ScreenTintBackround?  :P
Title: Re:ScreenTint
Post by: Squinky on Fri 20/02/2004 01:22:42
From the manual:

TintScreen
TintScreen (int red, int green, int blue)

Tints the screen with the specified RGB values. RED, GREEN and BLUE range from 1 to 100.
Pass (0, 0, 0) to turn off the tinting and go back to how the screen normally looks.

NOTE: This command is currently experimental, since it causes a massive slowdown in the engine, especially at high resolutions. If you use it, you should provide an option for the player to turn it off.

NOTE: This feature only works in hi-colour games.

Example:

TintScreen (100, 50, 50);

will tint a heavy dose of red.


I think that should do it...
Title: Re:ScreenTint
Post by: earlwood on Fri 20/02/2004 01:42:19
Oh I know how to do it, thanks anyway man, but I can't infer that you probably can't do it without pausing the game engine..it's a shame.  :-\

I had TintScreen(10,0,0)
TintScreen(20,0,0)
TintScreen(30,0,0)
TintScreen(40,0,0)
TintScreen(50,0,0)
Then I went back to 0 then I did the same thing with blue, Ok I guess I will have to find a new way to do what I need.

Thanks for saving me about 7 hours of moping and failure,
Earlwood
Title: Re:ScreenTint
Post by: Squinky on Fri 20/02/2004 02:05:25
Sorry I couldn't help ya. I'm sure someone smarter will come along and show me up...heh
Title: Re:ScreenTint
Post by: a-v-o on Fri 20/02/2004 17:52:13
it seems to me that you want to change the tinting of the screen by the time, like in a loop.
But you don't want a script like...

int a = 0;
while (a <= 50)
{
TintScreen (a, 0, 0);
a += 10;
}

...because this is blocking and you want it happen in the background. Then you better do it like this:

int tr, tg, tb;
int tt = 0;
int tc;

function StartTintScreen ()
{
 tr = 0;
tg = 0;
tb = 0;
tt = 1;
tc = 0;
}

function repeatedly_execute ()
{
if (tt > 0)
{
if (tc > 10)
{
tc = 0;
if (tt == 1)
{
// red
tr += 10;
if (tr > 50)
{
 tr = 40;
tt++;
}
}
if (tt == 2)
{
tr -= 10;
if (tr < 50)
{
 tr = 0;
tt++;
}
// blue
if (tt == 3)
{
tb += 10;
if (tb > 50)
{
 tb = 40;
tt++;
}
}
if (tt == 4)
{
tb -= 10;
if (tb < 50)
{
 tb = 0;
tt = 0; // switch off
}
TintScreen (tr, tg, tb);
}
tc++;
}

}