Upcoming Events
Unite 2010
11/10 - 11/12 @ Montréal, Canada

GDC China
12/5 - 12/7 @ Shanghai, China

Asia Game Show 2010
12/24 - 12/27  

GDC 2011
2/28 - 3/4 @ San Francisco, CA

More events...
Quick Stats
89 people currently visiting GDNet.
2406 articles in the reference section.

Help us fight cancer!
Join SETI Team GDNet!
Link to us Events 4 Gamers
Intel sponsors gamedev.net search:

  Contents

 Introduction
 The Design
 CreateSurfaces()
 DestroySurfaces()
 The Game Loop
 Switching Modes
 While Running


 Get the demo!
 Printable version

 


  The Series

 Part 1
 Part 2

 

DestroySurfaces(…)

Your shutdown code is also different. Instead of releasing just the DirectDraw object and the primary surface, you also have to release your back buffer and clipper. Again, use an if statement to separate the exclusive code from the windowed code:

if( bExclusive ) { // exclusive code } else { // windowed code }

Put your own exclusive code in the exclusive section, and we'll add the windowed code.

This is the code to add in the windowed code section:

if( lpddBack ) { // release the back buffer lpddBack->Release(); lpddBack = NULL; } if( lpddPrimary ) { // release the clipper (indirectly) lpddPrimary->SetClipper(NULL); lpddClipper = NULL; // release the primary surface lpddPrimary->Release(); lpddPrimary = NULL; }

Once you've added that code, we'll go on to the game loop.


Next : The Game Loop