PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Need help with opacity

Hello all. I'm trying to do a simple fade-out of a menu screen, and my thinking was that I would use the opacity setting in the GDBLTFASTFX structure as so:

--------------------
GDBLTFASTFX gdbltfastfx;
gdbltfastfx.dwFXopacity = fade_value;

backbuffer.BltFast(xl_title, 1, menu_title, NULL, GDBLTFAST_KEYSRC | GDBLTFAST_FXOPACITY, &gdbltfastfx;);

// other blts for the menu are here, left out for brevity

if (fadingout) {
fade_value--;
if (fade_value == 0) { switchscreens(); }
}
--------------------

fade_value starts out at 255 before this. I thought this work would, however, when I run this code, none of my blts do anything. If I remove the GDBLTFAST_FXOPACITY flag, everything works, except for the fading (as one would expect).

Any ideas why the blts do nothing when that flag is set?

Or let me ask it this way: what incredibly stupid and obvious mistake am I making here?!? :) In my defense, I had to be in to work at 6am this morning, and before today I wasn't even aware there WAS a 6am in the morning
Pejo Software - Per · 12 Jan 2004, 15:59 UTC
I am also using opacity to create fade-outs and fade-ins and I am essentially doing just like you described and everything works perfectly.
Have you verified that the values are what you expect them to be when you shall blit? Maybe you have forgotten some initialization or something, check the opacity value. You can use the debugger to check the values.
Problem solved! Notice that I was using the GDBLTFAST_FXOPACITY flag and the dwFXopacity member? Well, that ain't correct. I have to go read on what the difference is, but once I switched these to GDBLTFAST_OPACITY and dwOpacity respectively, everything worked as expected. Thanks for the attempt Pejo!