|
||
|
GP Mailing List
ATXGPSIG List
|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: GameProgrammer: DirectDraw
Hi Anfaroth,
>Here is the problem: Every time I put the
>program in the background (via an Alt+tab), when I come back into my
>program, the screen goes black and DirectDraw doesn't work.
You should evaluate the return codes from the DD calls every time. If you
did, you would have gotten the error DDERR_SURFACELOST. The following
code snippet will show:
HRESULT hRes = lpDDSurf->Flip();
if( FAILED( hRes))
{
if( hRes == DDERR_SURFACELOST )
{
lpDDSurf->Restore();
}
else
{
// whatever error checking you want to do here.
}
}
You should also keep in mind that once a surface becomes lost (i.e. it is no
longer in the video cards memory) all graphics that where in the surface are
lost too, so you need to reload all used bitmaps and redraw any custom
painting.
It is very likely that after someone presses alt-tab, the display is now in
the
original desktop resolution. So unless you use the same resolution (or "mode"
in MS speak), you will get the error DDERR_WRONGMODE when you call
lpDDSurf->Restore(). In that case you will have to rebuild all your
DirectDraw
objects.
Karel.
-------------------------====#### Class Logic ####====---------------------
Software Development
Microsoft Certified Professional
Karel Bagchus
mailto:karel@classlogic.com
http://www.classlogic.com
Transvaalstraat 15 / 3-hoog
1092 HA Amsterdam
the Netherlands
Tel: +31 (0)20 - 77 75 344
Fax: +31 (0)20 - 77 75 344
GSM: 06 - 22 987 327
-------------------------====###################====---------------------
=================================================================
To SUBSCRIBE or UNSUBSCRIBE please visit
http://gameprogrammer.com/mailinglist.html
|
|