//Entry point for the windows program |
int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) |
{ |
MSG msg; |
joinSession = FALSE; //By default create new session |
if(strcmp(lpCmdLine,"join")==0) |
joinSession=TRUE; |
if( !WinInit( hInstance, nCmdShow ) ) // Initialize & set up Windows |
return FALSE; |
if( !DXInit() ) // Initialize & set up DirectX |
return FALSE; |
ShowCursor(FALSE); //Hide the mouse pointer |
// Start windows loop |
while( 1 ) |
{ |
if( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) ) |
{ |
if( !GetMessage( &msg, NULL, 0, 0 ) ) |
return msg.wParam; |
TranslateMessage(&msg); |
DispatchMessage(&msg); |
} |
else |
{ |
UpdateFrame("NONE"); //Update the screen |
} |
} |
} |
The main Function - WinMain() |
A command line argument |
`join' must be supplied |
to join an already existing |
session |
We update the screen even when |
no keys are pressed because the |
other player might have changed |
position. |