Hey guys/gals! I updated the code that performs my gamma ramp
fades in DirectDraw. The problems I had were that I was using an
incrementing long value as a timer, ie:
Code:
long TimeTracker;
TimeTracker++;
if(TimeTracker==300)
{
do stuff
TimeTracker=0;
}
This obviously wasn't effecient and especially wasn't practical, as
it would run super fast on new machines and slow as molassess
on older ones.
The other problem was that I was setting the gamma ramp values
to 0 then incrementing +/- 1000 per iteration. This was bad
because if you have really low gamma settings then your screen
wouldn't fully reset to it's proper gamma settings and all you'd
see was a black screen (like TechWins).
The fix for this was a little trickier. I declared 3 global arrays of
DWORDs to hold my gamma increment value. Then every 100
milliseconds I add that value to the gamma settings. Since I set
the value to setting/8, I incremented by the DWORD value for the
first 8 iterations of the function call. On the ninth I finished the
gamma ramp transition (settings=0 or setting=original, depending
on which way I was traversing the ramp).
Code:
DWORD dwRd[256], dwGr[256], dwBl[256];
for(i=0;i<256;i++)
{
if(lpddGR.red[i]>8)
{
dwRd[i]=lpddGR.red[i]/8;
}
lpddGR.red[i]=0;
//etc. etc. for green and blue arrays
}
I'm attaching a new *.zip file. Please test it and let me know what
results you get and what you think of the fade. Thanks.
Oh, and anyone who wants more details on the gamma ramp
fading technique can just PM me or ask here and I'll go into more
detail. Also, you'll need DirectX 7 or higher to run it.
Thanks again.