Minimizing fullscreen apps

Started by
5 comments, last by GunnarSteinn 24 years, 7 months ago
Depends on what you're using ? Are you using Direct3D / DirectDraw ? ... ? If you're using DirectDraw, your surfaces will be lost, so you gotta restore anything. There are some more problems, so some details would be fine.

CU

------------------
Skullpture Entertainment
#40842461

Graphix Coding @Skullpture Entertainmenthttp://www.skullpture.de
Advertisement
I'm using DDraw in 800x600 8-bit mode.
I set the cooperation level like this
lpdd->SetCooperativeLevel(main_window_handle,
DDSCL_ALLOWMODEX | DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE | DDSCL_ALLOWREBOOT)

I'm using the WGPFD engine

Hi,
then you've got to restore your surfaces, it's explained in the sources in the sdk. Just a few lines of code.

CU

------------------
Skullpture Entertainment
#40842461

Graphix Coding @Skullpture Entertainmenthttp://www.skullpture.de
Also, if you have loaded anything at all into Video memory, after you restore the surface you will have to reload them with the graphics that go in them.


- Chris

In my program based on DX5 Fullscreen,
iv'e controlled minimizing by creating a bActive variable which equals FALSE if the app is non active (iconized),TRUE if the app is FullScreen. (pretty standard)
My bActive is controlled by two WM_ messages (WM_LOSTFOCUS and WM_GAINFOCUS ??), and I have coded my main loop as:

WinMain(bla bla)
{
while(bla bla..
{
{
....translatemessages...
}
if(bActive) DoGameUpdate();
}
}


Make sure when calling DDraw functions, you check the results (ddrval).
If the result is DDRVAL_LOSTSURFACE, imediatelly restore ALL Surfaces using ->restore(), and exit your screen drawing function if ddrval is not DD_OK.
Otherwise if you try to flip and blit to a lost surface, the system will hang!

-=SikCiv=-

  Downloads:  ZeroOne Realm

I'm having a little problem with my game. If I minimize it everything is ok but when I try to maximize it again the program halts and I have to use ctrl+alt+del.
I know I have to use the WM_SIZE message but how?
This should do it, just call it before you start rendering anything. (Therefore, it's in my render-function() )

code:
if (FrontBuffer->IsLost() == DDERR_SURFACELOST){	FrontBuffer->Restore();     }

------------------
Dance with me......

This topic is closed to new replies.

Advertisement