The DesignMany parts of DirectDraw initialization are different for windowed mode. The best way to do it is first to create the DirectDraw object when your program starts up. Second, you create all your surfaces, set the cooperative level, set the display mode, fill out any variables you need, etc. This second stage is where all the changes between exclusive mode and windowed mode are found. So, your functions are set up like this:
and
The first set (CreateDirectDraw and DestroyDirectDraw) create the DirectDraw object and destroy it, respectively. You should be able to fill those out yourself. The second set (CreateSurfaces and DestroySurfaces) handle everything else associated with setting up and shutting down DirectDraw. Looking at the parameter, bExclusive, you'll see that they create either the exclusive mode surfaces or the windowed mode surfaces, along with all the other objects necessary to use them. The width, height, and bpp parameters specify the display mode to use, if bExclusive is true. We'll need to modify the game loop a little to handle windowed mode. We'll also need a function that handles switching modes that'll get it up and running:
Read on for the implementation of these functions!
|
||||||||||||||||||||