// Update the screen with new coordinates |
static void UpdateFrame(char* direction) |
{ |
HRESULT hr; |
HDC hdc; |
LPDPID lpmsgFrom = new DPID; //ID of player sending the message |
LPDPID lpmsgTo = new DPID; //ID of player who will receive the message |
MESSAGE *pMessage = new MESSAGE; |
DWORD msgSize = 8; |
static SIZE size; //To store text size |
static int xchange = 1; //Change along x direction |
static int ychange = 1; //Change along y direction |
//My initial coordinates |
static int x = window_width/2; |
static int y = window_height/2; |
//The other player's initial coordinate |
static int x1 = window_width/2; |
static int y1 = window_height/2; |
//-------- To introduce delay in updating screen----------- |
static DWORD lastTickCount = 0; |
DWORD thisTickCount; |
thisTickCount = GetTickCount(); |
if((thisTickCount - lastTickCount) <= UpdateDelay) |
return; |
lastTickCount = thisTickCount; |
//---------------------------------------------------------- |
UpdateFrame(): |
Redraws the objects at |
their new position |
Since we have used an |
update delay of 0, this |
doesn't take effect. |
If we had used, say, 5ms, |
this function wouldn't |
continue execution until |
5ms had elapsed |
Continued... |