1 | // Helper function - Creates a player |
2 | static HRESULT MakePlayer() |
3 | { |
4 | HRESULT hr; |
5 | // Create a player |
6 | hr = lpDirectPlay1->CreatePlayer(&playerID, "Billy", "Bill Clinton", NULL); |
7 | if(FAILED(hr)) |
8 | ::MessageBox(NULL,"CreatePlayer Failed", "HelloWorld", MB_OK); |
9 | return(hr); |
10 | } |
11 | // Clean up before exiting |
12 | static void CleanUp() |
13 | { |
14 | //Done with DirectDraw |
15 | if( lpFrontBuffer ) |
16 | { |
17 | lpFrontBuffer->Release(); |
18 | lpFrontBuffer = NULL; |
19 | } |
20 | lpdd->RestoreDisplayMode(); |
21 | lpdd->Release(); |
22 | //Done with DirectPlay |
23 | if (lpDirectPlay1) |
24 | { |
25 | lpDirectPlay1->DestroyPlayer(playerID); |
26 | lpDirectPlay1->Close(); |
27 | lpDirectPlay1->Release(); |
28 | } |
29 | PostQuitMessage( 0 ); |
30 | } |
31 | MakePlayer():Creates a new player |
32 | CleanUp(): Releases DirectX objects & buffers |