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

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

?? demo7_9.cpp

?? 一本外國人寫的關(guān)于3D游戲編程的書的源碼
?? CPP
?? 第 1 頁 / 共 2 頁
字號:

// now create and attach clipper
RECT rect_list[3] = {{10,10,50,50},
                     {100,100,200,200},
                     {300,300, 500, 450}};

if (FAILED(lpddclipper = DDraw_Attach_Clipper(lpddsprimary,3,rect_list)))
   return(0);

// 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 back buffer surface
if (lpddsback)
   {
   lpddsback->Release();
   lpddsback = NULL;
   } // end if

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

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

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

} // end Game_Shutdown

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

LPDIRECTDRAWCLIPPER DDraw_Attach_Clipper(LPDIRECTDRAWSURFACE7 lpdds,
                                         int num_rects,
                                         LPRECT clip_list)

{
// this function creates a clipper from the sent clip list and attaches
// it to the sent surface

int index;                         // looping var
LPDIRECTDRAWCLIPPER lpddclipper;   // pointer to the newly created dd clipper
LPRGNDATA region_data;             // pointer to the region data that contains
                                   // the header and clip list

// first create the direct draw clipper
if (FAILED(lpdd->CreateClipper(0,&lpddclipper,NULL)))
   return(NULL);

// now create the clip list from the sent data

// first allocate memory for region data
region_data = (LPRGNDATA)malloc(sizeof(RGNDATAHEADER)+num_rects*sizeof(RECT));

// now copy the rects into region data
memcpy(region_data->Buffer, clip_list, sizeof(RECT)*num_rects);

// set up fields of header
region_data->rdh.dwSize          = sizeof(RGNDATAHEADER);
region_data->rdh.iType           = RDH_RECTANGLES;
region_data->rdh.nCount          = num_rects;
region_data->rdh.nRgnSize        = num_rects*sizeof(RECT);

region_data->rdh.rcBound.left    =  64000;
region_data->rdh.rcBound.top     =  64000;
region_data->rdh.rcBound.right   = -64000;
region_data->rdh.rcBound.bottom  = -64000;

// find bounds of all clipping regions
for (index=0; index<num_rects; index++)
    {
    // test if the next rectangle unioned with the current bound is larger
    if (clip_list[index].left < region_data->rdh.rcBound.left)
       region_data->rdh.rcBound.left = clip_list[index].left;

    if (clip_list[index].right > region_data->rdh.rcBound.right)
       region_data->rdh.rcBound.right = clip_list[index].right;

    if (clip_list[index].top < region_data->rdh.rcBound.top)
       region_data->rdh.rcBound.top = clip_list[index].top;

    if (clip_list[index].bottom > region_data->rdh.rcBound.bottom)
       region_data->rdh.rcBound.bottom = clip_list[index].bottom;

    } // end for index

// now we have computed the bounding rectangle region and set up the data
// now let's set the clipping list

if (FAILED(lpddclipper->SetClipList(region_data, 0)))
   {
   // release memory and return error
   free(region_data);
   return(NULL);
   } // end if

// now attach the clipper to the surface
if (FAILED(lpdds->SetClipper(lpddclipper)))
   {
   // release memory and return error
   free(region_data);
   return(NULL);
   } // end if

// all is well, so release memory and send back the pointer to the new clipper
free(region_data);
return(lpddclipper);

} // end DDraw_Attach_Clipper


// 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 Clipping Demo", // 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

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

void Blit_clipped(int x, int y,          // position to draw bitmap
                  int width, int height, // size of bitmap in pixels
                  UCHAR *bitmap,         // pointer to bitmap data
                  UCHAR *video_buffer)   // pointer to video buffer surface
                
{
// this function blits and clips the image sent in bitmap to the 
// destination surface pointed to by video_buffer
// the function assumes a 640x480x8 mode with linear pitch

// first do trivial rejections of bitmap, is it totally invisible?
if ((x >= SCREEN_WIDTH) || (y>= SCREEN_HEIGHT) ||
    ((x + width) <= 0) || ((y + height) <= 0))
return;

// clip source rectangle
// pre-compute the bounding rect to make life easy
int x1 = x;
int y1 = y;
int x2 = x1 + width - 1;
int y2 = y1 + height -1;

// upper left hand corner first
if (x1 < 0)
   x1 = 0;

if (y1 < 0)
   y1 = 0;

// now lower left hand corner
if (x2 >= SCREEN_WIDTH)
    x2 = SCREEN_WIDTH-1;

if (y2 >= SCREEN_HEIGHT)
    y2 = SCREEN_HEIGHT-1;

// now we know to draw only the portions of the bitmap from (x1,y1) to (x2,y2)
// compute offsets into bitmap on x,y axes, we need this to compute starting point
// to rasterize from
int x_off = x1 - x;
int y_off = y1 - y;

// compute number of columns and rows to blit
int dx = x2 - x1 + 1;
int dy = y2 - y1 + 1;

// compute starting address in video_buffer 
video_buffer += (x1 + y1*640);

// compute starting address in bitmap to scan data from
bitmap += (x_off + y_off*width);

// at this point bitmap is pointing to the first pixel in the bitmap that needs to
// be blitted, and video_buffer is pointing to the memory location on the destination
// buffer to put it, so now enter rasterizer loop

UCHAR pixel; // used to read/write pixels

for (int index_y = 0; index_y < dy; index_y++)
     {
     // inner loop, where the action takes place
     for (int index_x = 0; index_x < dx; index_x++)
          {
          // read pixel from source bitmap, test for transparency and plot
          if ((pixel = bitmap[index_x]))
              video_buffer[index_x] = pixel;

          } // end for index_x
     
          // advance pointers
          video_buffer+=640;   // bytes per scanline
          bitmap      +=width; // bytes per bitmap row

     } // end for index_y

} // end Blit_Clipped

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产亚洲一本大道中文在线| 91麻豆精品国产无毒不卡在线观看 | 在线精品视频一区二区三四| 亚洲欧美另类图片小说| 色婷婷av一区二区三区之一色屋| 亚洲精品你懂的| 欧美男男青年gay1069videost| 亚洲国产成人91porn| 91 com成人网| 国产成人午夜99999| 亚洲欧美偷拍卡通变态| 欧美人与性动xxxx| 久久不见久久见中文字幕免费| 国产亚洲成av人在线观看导航| 成人国产精品免费观看动漫| 亚洲同性gay激情无套| 欧美三级视频在线| 国产伦精品一区二区三区视频青涩| 国产亚洲一区二区三区四区| 99r精品视频| 青青青伊人色综合久久| 久久亚区不卡日本| 色香蕉久久蜜桃| 老司机精品视频一区二区三区| 国产日产精品一区| 精品视频一区二区不卡| 国产麻豆视频一区| 一区二区三区美女| 久久美女艺术照精彩视频福利播放| eeuss鲁片一区二区三区| 视频一区二区欧美| 亚洲欧洲日产国产综合网| 91麻豆精品91久久久久久清纯| 国产精品一二三四区| 亚洲国产综合在线| 日本一区二区综合亚洲| 在线综合+亚洲+欧美中文字幕| 国产精品原创巨作av| 亚洲一区二区五区| 国产精品午夜久久| 欧美一级在线视频| 日本韩国欧美三级| 国产91露脸合集magnet| 日本欧美大码aⅴ在线播放| 一区精品在线播放| 久久无码av三级| 欧美一区二区三区在线观看视频| 91在线看国产| 国产精品99久久久久久似苏梦涵| 亚洲一区av在线| 亚洲日穴在线视频| 久久精品人人做| 欧美一级爆毛片| 欧美久久久影院| 色狠狠桃花综合| 99视频在线精品| 夫妻av一区二区| 国产麻豆午夜三级精品| 另类的小说在线视频另类成人小视频在线| 亚洲美女电影在线| 国产精品国产精品国产专区不蜜| 精品国产乱码久久久久久夜甘婷婷| 欧美日韩免费不卡视频一区二区三区| 91在线国内视频| 国产成人av电影在线| 国产一区二区三区不卡在线观看| 美女视频黄久久| 麻豆传媒一区二区三区| 日韩av不卡在线观看| 亚洲一卡二卡三卡四卡五卡| 自拍av一区二区三区| 久久精品一区二区三区四区| 日韩网站在线看片你懂的| 欧美一区2区视频在线观看| 欧美日韩国产欧美日美国产精品| 欧美视频三区在线播放| 欧美性猛片xxxx免费看久爱| 日本道免费精品一区二区三区| 不卡视频免费播放| 不卡区在线中文字幕| 成人美女视频在线看| 成人黄页毛片网站| 99久久国产综合精品女不卡| 波多野结衣在线一区| 99这里只有精品| 色婷婷国产精品| 欧美日韩国产一级| 欧美一区二区三区男人的天堂| 欧美一级二级在线观看| 亚洲精品在线免费观看视频| 国产清纯白嫩初高生在线观看91 | 亚洲国产日韩在线一区模特| 五月婷婷久久综合| 久久精品99久久久| 国产成人午夜精品影院观看视频| 成人激情小说网站| 色琪琪一区二区三区亚洲区| 欧美嫩在线观看| 久久久欧美精品sm网站| 1区2区3区欧美| 亚洲成a人片在线观看中文| 免费人成网站在线观看欧美高清| 国产专区综合网| 99国产精品久久| 欧美一区中文字幕| 久久久综合九色合综国产精品| 国产精品无人区| 一区二区三区美女| 寂寞少妇一区二区三区| 成人动漫一区二区| 欧美精品777| 久久精品视频一区二区| 一区二区激情小说| 国内外成人在线| 91国内精品野花午夜精品| 日韩免费观看高清完整版在线观看| 欧美精品一区视频| 亚洲一区欧美一区| 国产精品456| 91精品免费在线观看| 中文字幕一区二区三区蜜月| 日本最新不卡在线| 成人高清免费观看| 日韩精品一区二区三区视频| 综合在线观看色| 蜜臂av日日欢夜夜爽一区| 成人精品一区二区三区中文字幕| 3d成人动漫网站| 亚洲精品水蜜桃| 国产麻豆精品在线观看| 欧洲精品在线观看| 中文字幕av一区二区三区免费看| 青青国产91久久久久久| 色综合久久88色综合天天免费| 精品福利视频一区二区三区| 亚洲国产日韩精品| 宅男噜噜噜66一区二区66| ㊣最新国产の精品bt伙计久久| 国产呦精品一区二区三区网站| 欧美日韩一级大片网址| 中文字幕综合网| 国产一区二区三区电影在线观看| 欧美男男青年gay1069videost| 亚洲人成网站在线| 成人性视频免费网站| 2023国产精品| 免费观看日韩电影| 欧美肥妇free| 亚洲综合久久久久| 色综合婷婷久久| 一区在线中文字幕| 国产91对白在线观看九色| 精品久久久久99| 精品一区二区在线播放| 日韩写真欧美这视频| 日韩和欧美的一区| 91行情网站电视在线观看高清版| 国产精品久久久久影院色老大 | 亚洲最色的网站| av影院午夜一区| 欧美国产日本视频| 国产成人av电影在线播放| 久久久影视传媒| 国产成人综合视频| 久久一区二区视频| 国产福利一区在线观看| 欧美极品少妇xxxxⅹ高跟鞋| 国产成人亚洲综合色影视| 亚洲国产精品精华液ab| 波多野结衣中文一区| 日韩一区日韩二区| 91视频91自| 一区二区免费看| 欧美日韩一区二区三区四区五区 | 毛片一区二区三区| 制服丝袜中文字幕亚洲| 裸体健美xxxx欧美裸体表演| 精品少妇一区二区三区| 国产精品一区二区在线观看不卡 | 夜夜揉揉日日人人青青一国产精品 | 亚洲欧美色综合| 欧美日韩亚洲综合在线 欧美亚洲特黄一级| 一区二区三区四区在线播放| 欧美日韩国产美女| 美国十次了思思久久精品导航| 精品不卡在线视频| 成人午夜激情片| 亚洲激情五月婷婷| 欧美一区二区三区人| 国产精一区二区三区| 亚洲欧洲精品一区二区三区| 欧美性生交片4| 久久66热偷产精品| 国产精品久久久久久久久免费丝袜 | 国产日韩精品视频一区| 一本一道久久a久久精品| 亚洲777理论| 国产欧美综合在线观看第十页| 色综合久久88色综合天天6 | 欧美乱妇一区二区三区不卡视频|