ALT - Tabbing in DirectX,
Members - Reputation: 115
Posted 13 February 2000 - 06:17 AM
Posted 13 February 2000 - 06:59 AM
Members - Reputation: 122
Posted 13 February 2000 - 07:25 AM
Setting other cooperative settings doesn''t work,
but I actually found a way to get out by using
Trouble is I can''t get back in...sorta locked myself out...that is, I do get back in but the screens all black (Er...did someone blow the fuse ?)
Well anyway, if you have any idea concerning that tell me...
Posted 13 February 2000 - 07:59 AM
Members - Reputation: 110
Posted 13 February 2000 - 09:25 AM
All surfaces created in vid memory WILL need to be restored, so if you have textyures in video memory you will need to first restore them then reload the texture. If the surface is in system memory, then no reload/restore is needed.
Hope that helps, and as far as I know it''s correct.
Members - Reputation: 122
Posted 15 February 2000 - 11:06 AM
SystemParametersInfo(SPI_SCREENSAVERRUNNING, TRUE, NULL, 0);
Then after the loop to restore the old config:
SystemParametersInfo(SPI_SCREENSAVERRUNNING, FALSE, NULL, 0);
But I wouldn't recommend using that because some users want to ALT-TAB to look stuff up while playing your game, which makes everything a pain in the ass. First you have to force the game to pause by checking with the WM_ACTIVEAPP message, then when the user tries to go back to the game you'll have to restore all the surfaces. I do it like this:
// restore surfaces if necessary
if(lpddsprimary->IsLost()) // check if primary surface is lost
lpdd->RestoreAllSurfaces(); // restore all surfaces
lpdd is the DirectDraw object and lpddsprimary is my primary surface.
And if you have any little offscreen surfaces (like sprites) in video memory, you'll probably to have to reload them all, so you should have a function that loads all your graphics. Look up the message on this board called something like 'Restoring surfaces' for more info on that.
Edited by - Bigshot on 2/15/00 5:11:21 PM
Members - Reputation: 230
Posted 15 February 2000 - 08:28 PM
You might find what you are after if you read the DirectInput Mouse tutorials (part of the DirectX SDK) which details both Exclusive and Non-Exclusive mode.
CooperativeLevel comes into it too, because you can specify this for the mouse and keyboard. You also have to make sure your window is handling messages either with Translate/Dispatch or in a WindowProc message handler.
Edited by - paulcoz on 2/16/00 2:30:34 AM
Members - Reputation: 289
Posted 16 February 2000 - 01:38 AM
Conceptually, you''re linking DirectDraw to your main window with that code.
And you''ll probably have to take extra steps for DirectInput, DirectSound, etc.