DIV CSS 佈局教程網

game_main(32)
編輯:AJAX詳解     
int Game_Main(void *parms = NULL, int num_parms = 0)
{
 //按ESC鍵退出
 if (KEYDOWN(VK_ESCAPE))
    SendMessage(main_window_handle,WM_CLOSE,0,0);

 memset(&ddsd,0,sizeof(ddsd));
 ddsd.dwSize=sizeof(ddsd);

 //鎖定主顯示表面
 if (FAILED(lpddsprimary->Lock(NULL, &ddsd,
        DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT,
        NULL)))
    return(0);

 int lpitch32 = (int)(ddsd.lPitch >> 2);
 UINT *video_buffer = (UINT *)ddsd.lpSurface;

 for (int index=0; index < 1000; index++)
 {
  // select random position and color for 640x480x32
  int red   = rand()%256;
  int green = rand()%256;
  int blue  = rand()%256;
  int x = rand()%640;
  int y = rand()%480;

  UINT pixel = ((blue) + ((green) << 8) + ((red) << 16) + ((0) << 24));
  //寫色
  video_buffer[x + y*lpitch32] = pixel;
  } // end for index

 //解鎖主顯示表面
 if (FAILED(lpddsprimary->Unlock(NULL)))
    return(0);

 return(1);

} // end Game_Main

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved