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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? demo7_10.cpp

?? windows游戲編程大師源代碼
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
		} break;
   
	case WM_PAINT: 
		{
		// simply validate the window 
   	    hdc = BeginPaint(hwnd,&ps);	 
        
        // end painting
        EndPaint(hwnd,&ps);

        // return success
		return(0);
   		} break;

	case WM_DESTROY: 
		{

		// kill the application, this sends a WM_QUIT message 
		PostQuitMessage(0);

        // return success
		return(0);
		} break;

	default:break;

    } // end switch

// process any messages that we didn't take care of 
return (DefWindowProc(hwnd, msg, wparam, lparam));

} // end WinProc

///////////////////////////////////////////////////////////

int Game_Main(void *parms = NULL, int num_parms = 0)
{
// this is the main loop of the game, do all your processing
// here

// make sure this isn't executed again
if (window_closed)
   return(0);

// for now test if user is hitting ESC and send WM_CLOSE
if (KEYDOWN(VK_ESCAPE))
   {
   PostMessage(main_window_handle,WM_CLOSE,0,0);
   window_closed = 1;
   } // end if

// do nothing -- look at pretty picture

// return success or failure or your own return code here
return(1);

} // end Game_Main

////////////////////////////////////////////////////////////

int Game_Init(void *parms = NULL, int num_parms = 0)
{
// this is called once after the initial window is created and
// before the main event loop is entered, do all your initialization
// here

// first create base IDirectDraw interface
if (FAILED(DirectDrawCreate(NULL, &lpdd, NULL)))
   return(0);

// now query for IDirectDraw4
if (FAILED(lpdd->QueryInterface(IID_IDirectDraw4,
                               (LPVOID *)&lpdd4)))
   return(0);

// set cooperation to full screen
if (FAILED(lpdd4->SetCooperativeLevel(main_window_handle, 
                                      DDSCL_FULLSCREEN | DDSCL_ALLOWMODEX | 
                                      DDSCL_EXCLUSIVE | DDSCL_ALLOWREBOOT)))
   return(0);

// set display mode to 640x480x8
if (FAILED(lpdd4->SetDisplayMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP,0,0)))
   return(0);

// clear ddsd and set size
DDRAW_INIT_STRUCT(ddsd); 

// enable valid fields
ddsd.dwFlags = DDSD_CAPS;

// request primary surface
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;

// create the primary surface
if (FAILED(lpdd4->CreateSurface(&ddsd, &lpddsprimary, NULL)))
   return(0);

// build up the palette data array
for (int color=1; color < 255; color++)
    {
    // fill with random RGB values
    palette[color].peRed   = rand()%256;
    palette[color].peGreen = rand()%256;
    palette[color].peBlue  = rand()%256;

    // set flags field to PC_NOCOLLAPSE
    palette[color].peFlags = PC_NOCOLLAPSE;
    } // end for color

// now fill in entry 0 and 255 with black and white
palette[0].peRed     = 0;
palette[0].peGreen   = 0;
palette[0].peBlue    = 0;
palette[0].peFlags   = PC_NOCOLLAPSE;

palette[255].peRed   = 255;
palette[255].peGreen = 255;
palette[255].peBlue  = 255;
palette[255].peFlags = PC_NOCOLLAPSE;

// create the palette object
if (FAILED(lpdd4->CreatePalette(DDPCAPS_8BIT | DDPCAPS_ALLOW256 | 
                                DDPCAPS_INITIALIZE, 
                                palette,&lpddpal, NULL)))
return(0);

// finally attach the palette to the primary surface
if (FAILED(lpddsprimary->SetPalette(lpddpal)))
   return(0);

// load the 8-bit image
if (!Load_Bitmap_File(&bitmap,"bitmap8.bmp"))
   return(0);

// load it's palette into directdraw
if (FAILED(lpddpal->SetEntries(0,0,MAX_COLORS_PALETTE,bitmap.palette)))
   return(0);

// clean the surface
DDraw_Fill_Surface(lpddsprimary,0);

// copy the bitmap image to the primary buffer line by line
// note this is a good candidate operation to make into a function - hint!

// lock the primary surface
lpddsprimary->Lock(NULL,&ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT,NULL);

// get video pointer to primary surfce
UCHAR *primary_buffer = (UCHAR *)ddsd.lpSurface;       

// test if memory is linear
if (ddsd.lPitch == SCREEN_WIDTH)
   {
   // copy memory from double buffer to primary buffer
   memcpy((void *)primary_buffer, (void *)bitmap.buffer, SCREEN_WIDTH*SCREEN_HEIGHT);
   } // end if
else
   { // non-linear

   // make copy of source and destination addresses
   UCHAR *dest_ptr = primary_buffer;
   UCHAR *src_ptr  = bitmap.buffer;

   // memory is non-linear, copy line by line
   for (int y=0; y < SCREEN_HEIGHT; y++)
       {
       // copy line
       memcpy((void *)dest_ptr, (void *)src_ptr, SCREEN_WIDTH);

       // advance pointers to next line
       dest_ptr+=ddsd.lPitch;
       src_ptr +=SCREEN_WIDTH;
       } // end for

   } // end else

// now unlock the primary surface
if (FAILED(lpddsprimary->Unlock(NULL)))
   return(0);

// unload the bitmap file, we no longer need it
Unload_Bitmap_File(&bitmap);

// return success or failure or your own return code here
return(1);

} // end Game_Init

/////////////////////////////////////////////////////////////

int Game_Shutdown(void *parms = NULL, int num_parms = 0)
{
// this is called after the game is exited and the main event
// loop while is exited, do all you cleanup and shutdown here


// first the palette
if (lpddpal)
   {
   lpddpal->Release();
   lpddpal = NULL;
   } // end if

// now the primary surface
if (lpddsprimary)
   {
   lpddsprimary->Release();
   lpddsprimary = NULL;
   } // end if

// now blow away the IDirectDraw4 interface
if (lpdd4)
   {
   lpdd4->Release();
   lpdd4 = NULL;
   } // end if

// return success or failure or your own return code here
return(1);

} // end Game_Shutdown

// WINMAIN ////////////////////////////////////////////////

int WINAPI WinMain(	HINSTANCE hinstance,
					HINSTANCE hprevinstance,
					LPSTR lpcmdline,
					int ncmdshow)
{

WNDCLASSEX winclass; // this will hold the class we create
HWND	   hwnd;	 // generic window handle
MSG		   msg;		 // generic message
HDC        hdc;      // graphics device context

// first fill in the window class stucture
winclass.cbSize         = sizeof(WNDCLASSEX);
winclass.style			= CS_DBLCLKS | CS_OWNDC | 
                          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(BLACK_BRUSH);
winclass.lpszMenuName	= NULL;
winclass.lpszClassName	= WINDOW_CLASS_NAME;
winclass.hIconSm        = LoadIcon(NULL, IDI_APPLICATION);

// save hinstance in global
hinstance_app = hinstance;

// register the window class
if (!RegisterClassEx(&winclass))
	return(0);

// create the window
if (!(hwnd = CreateWindowEx(NULL,                  // extended style
                            WINDOW_CLASS_NAME,     // class
						    "DirectDraw 8-Bit Bitmap Loading", // title
						    WS_POPUP | WS_VISIBLE,
					 	    0,0,	  // initial x,y
						    SCREEN_WIDTH,SCREEN_HEIGHT,  // initial width, height
						    NULL,	  // handle to parent 
						    NULL,	  // handle to menu
						    hinstance,// instance of this application
						    NULL)))	// extra creation parms
return(0);

// save main window handle
main_window_handle = hwnd;

// initialize game here
Game_Init();

// enter main event loop
while(TRUE)
	{
    // test if there is a message in queue, if so get it
	if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
	   { 
	   // test if this is a quit
       if (msg.message == WM_QUIT)
           break;
	
	   // translate any accelerator keys
	   TranslateMessage(&msg);

	   // send the message to the window proc
	   DispatchMessage(&msg);
	   } // end if
    
       // main game processing goes here
       Game_Main();
       
	} // end while

// closedown game here
Game_Shutdown();

// return to Windows like this
return(msg.wParam);

} // end WinMain

///////////////////////////////////////////////////////////

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久精品亚洲一区二区三区浴池 | 日本亚洲免费观看| 欧美精品乱人伦久久久久久| 韩国精品一区二区| 亚洲人成在线播放网站岛国| 日韩精品在线看片z| 91免费国产在线| 日本不卡视频一二三区| 久久婷婷国产综合精品青草| 色婷婷精品大视频在线蜜桃视频| 免费欧美在线视频| 亚洲视频狠狠干| xvideos.蜜桃一区二区| 91成人国产精品| 国产一区亚洲一区| 中文av字幕一区| 制服.丝袜.亚洲.中文.综合| 成人精品国产一区二区4080| 亚洲国产美国国产综合一区二区| 国产清纯在线一区二区www| 欧美日韩一区三区四区| 成人免费毛片嘿嘿连载视频| 秋霞电影网一区二区| 亚洲精品大片www| 欧美mv和日韩mv国产网站| 在线视频综合导航| 成人激情免费网站| 国产在线播精品第三| 亚洲线精品一区二区三区八戒| 国产精品久久久一区麻豆最新章节| 色婷婷综合中文久久一本| 国产精品一区二区三区99| 视频在线观看91| 一区二区三区四区激情 | 日韩欧美色综合| 欧美人与性动xxxx| 国产成人在线视频播放| 精油按摩中文字幕久久| 日韩av中文字幕一区二区| 亚洲丝袜另类动漫二区| 国产日韩影视精品| 久久综合色8888| 日韩欧美一区在线观看| 欧美精三区欧美精三区| 成人18精品视频| 成人午夜在线视频| 日本不卡1234视频| 免费观看久久久4p| 美国一区二区三区在线播放| 天天综合日日夜夜精品| 午夜精品久久久久久久久久久| 亚洲伊人伊色伊影伊综合网| 成人欧美一区二区三区白人 | 欧美精品在线一区二区三区| 欧美性猛片aaaaaaa做受| 一本色道久久综合亚洲精品按摩| 99久久国产综合精品色伊| 99国内精品久久| 一本色道久久综合亚洲91| 91亚洲国产成人精品一区二区三 | 国产精品久久久久婷婷二区次| 久久先锋影音av| 国产亚洲成年网址在线观看| 国产日韩欧美激情| 最新中文字幕一区二区三区| 久久一夜天堂av一区二区三区| 91精品国产麻豆国产自产在线| 欧美精品v国产精品v日韩精品| 欧美精品三级日韩久久| 欧美在线看片a免费观看| 欧美区一区二区三区| 337p亚洲精品色噜噜狠狠| 日韩欧美中文一区| 久久久久成人黄色影片| 国产精品美日韩| 自拍偷拍亚洲激情| 亚洲第一成年网| 奇米精品一区二区三区四区| 久久99久久99| 成人高清视频免费观看| av一区二区三区四区| 在线精品亚洲一区二区不卡| 在线不卡a资源高清| 久久亚洲二区三区| 亚洲欧洲制服丝袜| 亚洲成人免费在线观看| 日本午夜一区二区| 国产**成人网毛片九色| 91精品福利视频| 欧美一级午夜免费电影| 欧美一区二区精品在线| 国产视频视频一区| 亚洲二区在线视频| 国产一区二区0| 91麻豆6部合集magnet| 色综合激情五月| 日韩欧美www| 欧美性生活一区| 久久久久久黄色| 亚洲成av人片| 国产精品911| 欧美日韩精品二区第二页| 久久久久久久久岛国免费| 一区二区三区日韩欧美| 毛片av中文字幕一区二区| 国产91精品免费| 欧美日韩国产大片| 国产精品丝袜91| 麻豆免费看一区二区三区| 国产成人自拍网| 91精品国产日韩91久久久久久| 一区在线观看免费| 国产在线精品一区二区三区不卡 | av一区二区不卡| 精品成人一区二区三区| 日韩中文字幕亚洲一区二区va在线| 99久久精品国产一区二区三区| 国产片一区二区| 黄一区二区三区| 日韩精品中文字幕一区| 日本vs亚洲vs韩国一区三区二区| 欧美亚洲动漫制服丝袜| 一区二区三区中文字幕电影| www.日韩av| 亚洲欧洲精品一区二区三区| 国产超碰在线一区| 国产精品私人影院| 成人性生交大片免费看中文网站| 久久久国产精品麻豆| 国产高清在线精品| 国产视频一区二区在线| 岛国精品在线播放| 中文字幕 久热精品 视频在线| 高清在线成人网| 国产精品国产三级国产三级人妇 | 欧美揉bbbbb揉bbbbb| 午夜视频在线观看一区| 777亚洲妇女| 奇米影视一区二区三区| 日韩精品专区在线影院重磅| 狠狠狠色丁香婷婷综合久久五月| 欧美一区二区三区视频在线观看| 爽好多水快深点欧美视频| 日韩一区二区麻豆国产| 精品一区二区在线看| 国产网站一区二区| av综合在线播放| 亚洲精品中文字幕在线观看| 欧美午夜寂寞影院| 天堂久久久久va久久久久| 国产成人免费av在线| 洋洋av久久久久久久一区| 国产欧美一区二区三区在线看蜜臀 | 欧美精品久久一区| jlzzjlzz亚洲日本少妇| 日韩有码一区二区三区| 亚洲一级不卡视频| 国产精品日日摸夜夜摸av| 精品国产乱码久久久久久闺蜜| 欧美福利一区二区| 在线精品视频免费观看| 国产免费成人在线视频| 91影院在线免费观看| 亚洲成年人影院| 精品裸体舞一区二区三区| 成人免费黄色在线| 亚洲第一狼人社区| 欧美精品一区在线观看| 91性感美女视频| 奇米一区二区三区av| 日本一区二区三区在线不卡| 一本大道久久a久久综合婷婷| 欧美精品久久一区| 天天色综合成人网| 久久理论电影网| 91国在线观看| 久久不见久久见中文字幕免费| 国产女人aaa级久久久级| 欧美在线不卡视频| 国产在线一区二区| 亚洲一级二级在线| 国产日韩亚洲欧美综合| 欧美日韩精品是欧美日韩精品| 国产一区在线视频| 亚洲曰韩产成在线| 中文字幕乱码久久午夜不卡| 91精品在线一区二区| 成人av在线播放网址| 爽爽淫人综合网网站| 日韩理论片一区二区| 精品av久久707| 在线看一区二区| 成人动漫一区二区三区| 日本不卡视频一二三区| 亚洲欧美日韩国产成人精品影院| 精品国产乱码久久久久久浪潮| 欧美三级视频在线| 99精品久久只有精品| 久久精品国产精品亚洲精品| 亚洲免费观看视频|