1 | //Entry point for the windows program |
2 | int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) |
3 | { |
4 | MSG msg; |
5 | joinSession = FALSE; //By default create new session |
6 | if(strcmp(lpCmdLine,"join")==0) |
7 | joinSession=TRUE; |
8 | if( !WinInit( hInstance, nCmdShow ) ) // Initialize & set up Windows |
9 | return FALSE; |
10 | if( !DXInit() ) // Initialize & set up DirectX |
11 | return FALSE; |
12 | ShowCursor(FALSE); //Hide the mouse pointer |
13 | // Start windows loop |
14 | while( 1 ) |
15 | { |
16 | if( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) ) |
17 | { |
18 | if( !GetMessage( &msg, NULL, 0, 0 ) ) |
19 | return msg.wParam; |
20 | TranslateMessage(&msg); |
21 | DispatchMessage(&msg); |
22 | } |
23 | else |
24 | { |
25 | UpdateFrame("NONE"); //Update the screen |
26 | } |
27 | } |
28 | } |
29 | The main Function - WinMain() |
30 | A command line argument |
31 | `join' must be supplied |
32 | to join an already existing |
33 | session |
34 | We update the screen even when |
35 | no keys are pressed because the |
36 | other player might have changed |
37 | position. |