// Helper function - Creates a player |
static HRESULT MakePlayer() |
{ |
HRESULT hr; |
// Create a player |
hr = lpDirectPlay1->CreatePlayer(&playerID, "Billy", "Bill Clinton", NULL); |
if(FAILED(hr)) |
::MessageBox(NULL,"CreatePlayer Failed", "HelloWorld", MB_OK); |
return(hr); |
} |
// Clean up before exiting |
static void CleanUp() |
{ |
//Done with DirectDraw |
if( lpFrontBuffer ) |
{ |
lpFrontBuffer->Release(); |
lpFrontBuffer = NULL; |
} |
lpdd->RestoreDisplayMode(); |
lpdd->Release(); |
//Done with DirectPlay |
if (lpDirectPlay1) |
{ |
lpDirectPlay1->DestroyPlayer(playerID); |
lpDirectPlay1->Close(); |
lpDirectPlay1->Release(); |
} |
PostQuitMessage( 0 ); |
} |
MakePlayer():Creates a new player |
CleanUp(): Releases DirectX objects & buffers |