Basic HTML version of Foils prepared July 5 98

Foil 157 PPT Slide

From FMS: Forces Modeling and Simulation Handout JSU HPC Summer Institute for Undergraduates, Jackson MS -- June 15 1998. by Wojtek Furmanski, Subhash Nair, Tom Pulikal


1 //Check if any messages were received from the other player
2 hr = lpDirectPlay1->Receive(lpmsgFrom, lpmsgTo, DPRECEIVE_ALL, pMessage, &msgSize);
3 if(SUCCEEDED(hr)) //If yes, ...
4 {
5 // Update his coordinates
6 x1 = pMessage->x;
7 y1 = pMessage->y;
8 }
9 //Erase the back buffer to remove 'Hello World!' from previous position
10 DDBLTFX ddbltfx;
11 ddbltfx.dwSize = sizeof( ddbltfx );
12 ddbltfx.dwFillColor = PALETTEINDEX(0);
13 hr = lpBackBuffer->Blt( NULL,
14 NULL,
15 NULL,
16 DDBLT_COLORFILL | DDBLT_WAIT,
17 &ddbltfx);
18 if(lpBackBuffer->GetDC(&hdc) == DD_OK)
19 {
20 GetTextExtentPoint32(hdc, msg, strlen(msg), &size );
21 //Update my coordinates
22 if(strcmp(direction,"UP")==0) //If UP arrow was pressed
23 if(yɬ) y-=ychange;
24 if(strcmp(direction,"DOWN")==0) //If DOWN arrow was pressed
25 if((y+size.cy) < window_height) y+=ychange;
26 if(strcmp(direction,"LEFT")==0) //If LEFT arrow was pressed
27 if(xɬ) x-=xchange;
28 if(strcmp(direction,"RIGHT")==0) //If RIGHT arrow was pressed
29 if((x+size.cx) < window_width) x+=xchange;
30 Continued...
31 Fills the back buffer
32 with the color specified
33 in ddbltfx.dwFillColor

in Table To:


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sat Nov 28 1998