亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? main.cpp

?? 《游戲編程中的人工智能技術》書中源代碼和可執行文件
?? CPP
字號:
//-----------------------------------------------------------------------
//  
//  Name: GDI_Backbuffer example project
//  
//  Author: Mat Buckland 2002
//
//  Desc: Code demonstrating screen flashing/tearing/flickering
//
//------------------------------------------------------------------------

#include <windows.h>
#include <time.h>

#include "defines.h"
#include "utils.h"



//--------------------------------- Globals ------------------------------
//
//------------------------------------------------------------------------

char* g_szApplicationName = "Bouncing Balls - Without Backbuffer";
char*	g_szWindowClassName = "MyWindowClass";

//--------------------------------SBall------------------------------------
//
//  define a simple structure for the balls
//-------------------------------------------------------------------------
struct SBall
{
  //to hold the balls coordinates
  int posX;
  int posY;

  //and velocity
  int velX;
  int velY;

  SBall(){}
  
};

//---------------------------- WindowProc ---------------------------------
//	
//	This is the callback function which handles all the windows messages
//-------------------------------------------------------------------------

LRESULT CALLBACK WindowProc (HWND   hwnd,
                             UINT   msg,
                             WPARAM wParam,
                             LPARAM lParam)
{
    //create some pens to use for drawing
    static HPEN BluePen  = CreatePen(PS_SOLID, 1, RGB(0, 0, 255));
    static HPEN OldPen   = NULL;

    //create a solid brush
    static HBRUSH RedBrush = CreateSolidBrush(RGB(255, 0, 0));
    static HBRUSH OldBrush = NULL;
  
    //these hold the dimensions of the client window area
	  static int cxClient, cyClient;
  
    //create some balls
    static SBall* balls = new SBall[NUM_BALLS];

    switch (msg)
    {
	
		//A WM_CREATE msg is sent when your application window is first
		//created
    case WM_CREATE:
      {
         //to get get the size of the client window first we need  to create
         //a RECT and then ask Windows to fill in our RECT structure with
         //the client window size. Then we assign to cxClient and cyClient 
         //accordingly
			   RECT rect;

			   GetClientRect(hwnd, &rect);

			   cxClient = rect.right;
			   cyClient = rect.bottom;

         //seed random number generator
         srand((unsigned) time(NULL));
         
         //set up the balls with random positions and velocities
         for (int i=0; i<NUM_BALLS; ++i)
         {
           balls[i].posX = RandInt(0, cxClient);
           balls[i].posY = RandInt(0, cyClient);
           balls[i].velX = RandInt(0, MAX_VELOCITY);
           balls[i].velY = RandInt(0, MAX_VELOCITY);
         }
      }

      break;

    case WM_KEYUP:
      {
        switch(wParam)
        {
         case VK_ESCAPE:
          {
            PostQuitMessage(0);
          }
          
          break;
        }
      }
    
    case WM_PAINT:
      {
 		       
         PAINTSTRUCT ps;
          
         BeginPaint (hwnd, &ps);
          
         //first select a pen to draw with and store a copy
         //of the pen we are swapping it with
         OldPen = (HPEN)SelectObject(ps.hdc, BluePen);

         //do the same for our brush
         OldBrush = (HBRUSH)SelectObject(ps.hdc, RedBrush);

         //update and draw the balls
         for (int i=0; i<NUM_BALLS; ++i)
         {

          //check to see if they have hit any walls and reverse velocity 
           //accordingly
           if ( (balls[i].posX >= cxClient) || (balls[i].posX <0))
           {
             balls[i].velX = -balls[i].velX;
           }

           if ( (balls[i].posY >= cyClient) || (balls[i].posY <0))
           {
             balls[i].velY = -balls[i].velY;
           }

           // update their position
           balls[i].posX += balls[i].velX;
           balls[i].posY += balls[i].velY;

       
          
           
           //render to display
           Ellipse(ps.hdc,
                   balls[i].posX - RADIUS,
                   balls[i].posY - RADIUS,
                   balls[i].posX + RADIUS,
                   balls[i].posY + RADIUS);
 

         }
        
         //replace the original pen
         SelectObject(ps.hdc, OldPen);
         //and brush
         SelectObject(ps.hdc, OldBrush);
          
         EndPaint (hwnd, &ps);

         //delay a little
         Sleep(10);

      }

      break;

    //has the user resized the client area?
		case WM_SIZE:
		  {
        //if so we need to update our variables so that any drawing
        //we do using cxClient and cyClient is scaled accordingly
			  cxClient = LOWORD(lParam);
			  cyClient = HIWORD(lParam);

      }

      break;
          
		 case WM_DESTROY:
			 {
				 //delete the pens        
         DeleteObject(BluePen);
         DeleteObject(OldPen);

         //and the brushes
         DeleteObject(RedBrush);
         DeleteObject(OldBrush);

         //and the balls
         delete[] balls;
         
         // kill the application, this sends a WM_QUIT message  
				 PostQuitMessage (0);
			 }

       break;

     }//end switch

     //this is where all the messages not specifically handled by our 
		 //winproc are sent to be processed
		 return DefWindowProc (hwnd, msg, wParam, lParam);
}

//-------------------------------- WinMain -------------------------------
//
//	The entry point of the windows program
//------------------------------------------------------------------------
int WINAPI WinMain (HINSTANCE hInstance,
                    HINSTANCE hPrevInstance,
                    LPSTR     szCmdLine, 
                    int       iCmdShow)
{
     //handle to our window
		 HWND						hWnd;
    
		 //our window class structure
		 WNDCLASSEX     winclass;
		 
     // first fill in the window class stucture
	   winclass.cbSize        = sizeof(WNDCLASSEX);
	   winclass.style         = CS_HREDRAW | CS_VREDRAW;
     winclass.lpfnWndProc   = WindowProc;
     winclass.cbClsExtra    = 0;
     winclass.cbWndExtra    = 0;
     winclass.hInstance     = hInstance;
     winclass.hIcon         = LoadIcon(NULL, IDI_APPLICATION);
     winclass.hCursor       = LoadCursor(NULL, IDC_ARROW);
     winclass.hbrBackground = (HBRUSH)GetStockObject (WHITE_BRUSH);
     winclass.lpszMenuName  = NULL;
     winclass.lpszClassName = g_szWindowClassName;
	   winclass.hIconSm       = LoadIcon(NULL, IDI_APPLICATION);

		 //register the window class
		if (!RegisterClassEx(&winclass))
		{
			MessageBox(NULL, "Registration Failed!", "Error", 0);

			//exit the application
			return 0;
		}

		 //create the window and assign its ID to hwnd    
     hWnd = CreateWindowEx (NULL,                 // extended style
                            g_szWindowClassName,  // window class name
                            g_szApplicationName,  // window caption
                            WS_OVERLAPPEDWINDOW,  // window style
                            0,                    // initial x position
                            0,                    // initial y position
                            WINDOW_WIDTH,         // initial x size
                            WINDOW_HEIGHT,        // initial y size
                            NULL,                 // parent window handle
                            NULL,                 // window menu handle
                            hInstance,            // program instance handle
                            NULL);                // creation parameters

     //make sure the window creation has gone OK
     if(!hWnd)
     {
       MessageBox(NULL, "CreateWindowEx Failed!", "Error!", 0);
     }
         
     //make the window visible
		 ShowWindow (hWnd, iCmdShow);
     UpdateWindow (hWnd);

	   // Enter the message loop
	   bool bDone = false;

     MSG msg;

	   while(!bDone)
     {
					
		  while( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) ) 
		  {
			  if( msg.message == WM_QUIT ) 
			  {
				  // Stop loop if it's a quit message
				  bDone = true;
			  } 

			  else 
			  {
				  TranslateMessage( &msg );
				  DispatchMessage( &msg );
			  }
		  }

			//this will call WM_PAINT which will render our scene
			InvalidateRect(hWnd, NULL, TRUE);
			UpdateWindow(hWnd);

      //*** your game loop goes here ***//
   					
    }//end while

     UnregisterClass( g_szWindowClassName, winclass.hInstance );

     return msg.wParam;
}


?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
在线一区二区三区四区| 久久综合九色欧美综合狠狠 | 久草精品在线观看| 国模少妇一区二区三区| 99久久婷婷国产精品综合| 欧美综合亚洲图片综合区| 欧美一级国产精品| 亚洲欧美在线aaa| 欧美aaaaaa午夜精品| 黄色精品一二区| 欧美在线观看视频在线| 国产丝袜美腿一区二区三区| 一区二区三区在线高清| 久久99九九99精品| 欧美一卡二卡三卡四卡| 亚洲成va人在线观看| 91无套直看片红桃| 国产精品久久久久婷婷| 国产呦萝稀缺另类资源| 欧美xxxxx牲另类人与| 日本成人中文字幕| 欧美日韩另类国产亚洲欧美一级| 国产精品久线在线观看| 国产99精品在线观看| 久久天天做天天爱综合色| 精品在线免费观看| 欧美电影精品一区二区| 久久se这里有精品| 精品欧美一区二区在线观看| 蜜桃91丨九色丨蝌蚪91桃色| 欧美一区二区三区在线看| 日本欧美加勒比视频| 欧美一区二区在线免费观看| 日韩高清在线电影| 精品少妇一区二区三区免费观看 | 宅男噜噜噜66一区二区66| 一区二区日韩av| 日本久久电影网| 亚洲精品成人悠悠色影视| 色哟哟精品一区| 亚洲午夜av在线| 欧美一区二区视频在线观看2020| 免费欧美日韩国产三级电影| 日韩欧美不卡一区| 国产91综合网| 亚洲精品免费在线观看| 欧美日韩一区 二区 三区 久久精品| 一区二区三区四区五区视频在线观看| 欧美在线你懂得| 另类小说一区二区三区| 26uuuu精品一区二区| caoporen国产精品视频| 亚洲愉拍自拍另类高清精品| 欧美日韩国产bt| 激情六月婷婷久久| 中文字幕一区在线观看| 欧美日韩精品一区二区三区四区 | 日韩在线播放一区二区| 欧美大胆人体bbbb| www.成人在线| 奇米在线7777在线精品| 国产色婷婷亚洲99精品小说| 91久久精品日日躁夜夜躁欧美| 日韩在线a电影| 国产欧美精品一区| 欧美日韩精品系列| 国产一区二区三区综合| 亚洲卡通动漫在线| 国产日韩一级二级三级| 国产精品一区二区在线观看网站| 综合网在线视频| 欧美福利电影网| 成人免费看的视频| 亚洲bt欧美bt精品777| 国产日韩欧美不卡在线| 欧美日本一区二区在线观看| 国产成人在线视频免费播放| 亚洲成人激情综合网| 日本一区二区三区四区在线视频| 欧美日韩免费在线视频| 成人午夜激情影院| 免费成人小视频| 亚洲综合久久久| 国产精品久久网站| 久久综合色综合88| 欧美理论片在线| 色久优优欧美色久优优| 国产高清亚洲一区| 久久精品国产精品亚洲红杏| 亚洲一区二区三区中文字幕| 中文字幕不卡在线观看| 亚洲精品一区二区三区四区高清| 欧美亚洲日本国产| av在线不卡电影| 国产精品69毛片高清亚洲| 免费看日韩a级影片| 亚洲一区二区不卡免费| 国产精品理伦片| 欧美国产欧美综合| 久久久国产精华| 精品区一区二区| 精品少妇一区二区三区视频免付费 | 欧美理论片在线| 在线免费观看日本欧美| av在线免费不卡| 成人av午夜影院| 国产成人午夜电影网| 极品少妇xxxx偷拍精品少妇| 亚洲444eee在线观看| 一区二区三区成人| 亚洲午夜免费电影| 亚洲狠狠丁香婷婷综合久久久| 国产精品网友自拍| 国产欧美日韩另类一区| 久久精品一级爱片| 欧美极品美女视频| 国产欧美一区视频| 国产精品美女一区二区三区 | 亚洲一级二级三级在线免费观看| 亚洲视频一区二区在线| 亚洲欧洲制服丝袜| 亚洲精品欧美二区三区中文字幕| 亚洲日本丝袜连裤袜办公室| 亚洲少妇最新在线视频| 亚洲乱码一区二区三区在线观看| 一区二区三区在线视频免费| 亚洲自拍偷拍图区| 五月婷婷综合网| 久久 天天综合| 国产成人在线观看| 99re热这里只有精品视频| 在线欧美小视频| 日韩一区二区在线看片| 久久婷婷国产综合国色天香 | 99国产精品久| 欧美日韩国产片| 精品福利视频一区二区三区| 中文字幕国产一区| 一区二区三区小说| 美美哒免费高清在线观看视频一区二区 | 欧美一级久久久| 国产三级久久久| 亚洲自拍偷拍欧美| 国产一区二区三区免费看| 91丝袜美女网| 日韩女优制服丝袜电影| 国产精品美女久久久久久久久| 一区二区三区精品在线观看| 乱中年女人伦av一区二区| av电影在线观看一区| 6080国产精品一区二区| 国产三级精品三级| 日韩av成人高清| aaa国产一区| 欧美刺激脚交jootjob| 亚洲欧洲精品天堂一级| 裸体歌舞表演一区二区| 91小视频在线| 久久久精品国产99久久精品芒果 | 91精品一区二区三区久久久久久 | 欧美三级一区二区| 久久久久久夜精品精品免费| 一区二区三区电影在线播| 国产剧情一区二区| 欧美肥胖老妇做爰| 18成人在线观看| 久久er99热精品一区二区| 一本色道久久综合亚洲91 | 综合精品久久久| 久久国产精品无码网站| 在线精品亚洲一区二区不卡| 欧美zozo另类异族| 日韩综合在线视频| 91免费国产在线观看| 国产免费成人在线视频| 激情成人午夜视频| 欧美日韩免费高清一区色橹橹| 国产精品久久久久久久第一福利| 久久www免费人成看片高清| 91精品综合久久久久久| 亚洲超丰满肉感bbw| 色www精品视频在线观看| 国产精品不卡一区二区三区| 国产一区二区三区免费| 欧美一区二区三区男人的天堂| 亚洲综合一区在线| 91污在线观看| 亚洲另类春色国产| 色综合久久中文综合久久97| 国产精品美女久久久久久久网站| 国产精品一级二级三级| 久久久久久久av麻豆果冻| 狠狠色综合播放一区二区| 精品久久久久久亚洲综合网| 久久精品国产99| 精品少妇一区二区三区在线播放| 理论片日本一区| 久久一留热品黄| 国产电影一区二区三区| 中文字幕第一区二区|