1 | // Update the screen with new coordinates |
2 | static void UpdateFrame(char* direction) |
3 | { |
4 | HRESULT hr; |
5 | HDC hdc; |
6 | LPDPID lpmsgFrom = new DPID; //ID of player sending the message |
7 | LPDPID lpmsgTo = new DPID; //ID of player who will receive the message |
8 | MESSAGE *pMessage = new MESSAGE; |
9 | DWORD msgSize = 8; |
10 | static SIZE size; //To store text size |
11 | static int xchange = 1; //Change along x direction |
12 | static int ychange = 1; //Change along y direction |
13 | //My initial coordinates |
14 | static int x = window_width/2; |
15 | static int y = window_height/2; |
16 | //The other player's initial coordinate |
17 | static int x1 = window_width/2; |
18 | static int y1 = window_height/2; |
19 | //-------- To introduce delay in updating screen----------- |
20 | static DWORD lastTickCount = 0; |
21 | DWORD thisTickCount; |
22 | thisTickCount = GetTickCount(); |
23 | if((thisTickCount - lastTickCount) <= UpdateDelay) |
24 | return; |
25 | lastTickCount = thisTickCount; |
26 | //---------------------------------------------------------- |
27 | UpdateFrame(): |
28 | Redraws the objects at |
29 | their new position |
30 | Since we have used an |
31 | update delay of 0, this |
32 | doesn't take effect. |
33 | If we had used, say, 5ms, |
34 | this function wouldn't |
35 | continue execution until |
36 | 5ms had elapsed |
37 | Continued... |