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

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

?? demo7_14.cpp

?? 一本外國人寫的關于3D游戲編程的書的源碼
?? CPP
?? 第 1 頁 / 共 3 頁
字號:
// all is well, so release memory and send back the pointer to the new clipper
free(region_data);
return(lpddclipper);

} // end DDraw_Attach_Clipper

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

int DDraw_Fill_Surface(LPDIRECTDRAWSURFACE7 lpdds,int color)
{
DDBLTFX ddbltfx; // this contains the DDBLTFX structure

// clear out the structure and set the size field 
DDRAW_INIT_STRUCT(ddbltfx);

// set the dwfillcolor field to the desired color
ddbltfx.dwFillColor = color; 

// ready to blt to surface
lpdds->Blt(NULL,       // ptr to dest rectangle
           NULL,       // ptr to source surface, NA            
           NULL,       // ptr to source rectangle, NA
           DDBLT_COLORFILL | DDBLT_WAIT,   // fill and wait                   
           &ddbltfx);  // ptr to DDBLTFX structure

// return success
return(1);
} // end DDraw_Fill_Surface

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

int DDraw_Draw_Surface(LPDIRECTDRAWSURFACE7 source, // source surface to draw
                      int x, int y,                 // position to draw at
                      int width, int height,        // size of source surface
                      LPDIRECTDRAWSURFACE7 dest,    // surface to draw the surface on
                      int transparent = 1)          // transparency flag
{
// draw the surface at the x,y defined by dest, note that we are sending
// the size of the surface, we could query for it, but that takes time
// basically, we are really lacking datastructure as this point, since
// you would create a datastructure that keep important info about the
// surface, so you did't have to query it from directdraw

RECT dest_rect,   // the destination rectangle
     source_rect; // the source rectangle                             

// fill in the destination rect
dest_rect.left   = x;
dest_rect.top    = y;
dest_rect.right  = x+width-1;
dest_rect.bottom = y+height-1;

// fill in the source rect
source_rect.left    = 0;
source_rect.top     = 0;
source_rect.right   = width-1;
source_rect.bottom  = height-1;

// test transparency flag

if (transparent)
   {
   // enable color key blit
   // blt to destination surface
   if (FAILED(dest->Blt(&dest_rect, source,
                     &source_rect,(DDBLT_WAIT | DDBLT_KEYSRC),
                     NULL)))
           return(0);

   } // end if
else
   {
   // perform blit without color key
   // blt to destination surface
   if (FAILED(dest->Blt(&dest_rect, source,
                     &source_rect,(DDBLT_WAIT),
                     NULL)))
           return(0);

   } // end if

// return success
return(1);

} // end DDraw_Draw_Surface

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

int DDraw_Draw_Surface_Scaled(LPDIRECTDRAWSURFACE7 source, // source surface to draw
                      int x, int y,                 // position to draw at
                      int width_src, int height_src,// size of source surface
                      int width_dest, int height_dest,// size of dest surface
                      LPDIRECTDRAWSURFACE7 dest,    // surface to draw the surface on
                      int transparent = 1)          // transparency flag
{
// draw the surface at the x,y defined by dest, send both the original
// source size of surface, along with the desired size, if they are 
// different then directdraw will scale the bitmap for you
// note that we are sending
// the size of the surface, we could query for it, but that takes time
// basically, we are really lacking datastructure as this point, since
// you would create a datastructure that keep important info about the
// surface, so you did't have to query it from directdraw


RECT dest_rect,   // the destination rectangle
     source_rect; // the source rectangle                             

// fill in the destination rect
dest_rect.left   = x;
dest_rect.top    = y;
dest_rect.right  = x+width_dest-1;
dest_rect.bottom = y+height_dest-1;

// fill in the source rect
source_rect.left    = 0;
source_rect.top     = 0;
source_rect.right   = width_src-1;
source_rect.bottom  = height_src-1;

// test transparency flag

if (transparent)
   {
   // enable color key blit
   // blt to destination surface
   if (FAILED(dest->Blt(&dest_rect, source,
                     &source_rect,(DDBLT_WAIT | DDBLT_KEYSRC),
                     NULL)))
           return(0);

   } // end if
else
   {
   // perform blit without color key
   // blt to destination surface
   if (FAILED(dest->Blt(&dest_rect, source,
                     &source_rect,(DDBLT_WAIT),
                     NULL)))
           return(0);

   } // end if

// return success
return(1);

} // end DDraw_Draw_Surface_Scaled

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

int Scan_Image_Bitmap(BITMAP_FILE_PTR bitmap,     // bitmap file to scan image data from
                      LPDIRECTDRAWSURFACE7 lpdds, // surface to hold data
                      int cx, int cy)             // cell to scan image from
{
// this function extracts a bitmap out of a bitmap file

UCHAR *source_ptr,   // working pointers
      *dest_ptr;

DDSURFACEDESC2 ddsd;  //  direct draw surface description 

// get the addr to destination surface memory

// set size of the structure
ddsd.dwSize = sizeof(ddsd);

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

// compute position to start scanning bits from
cx = cx*(ddsd.dwWidth+1) + 1;
cy = cy*(ddsd.dwHeight+1) + 1;

gwidth  = ddsd.dwWidth;
gheight = ddsd.dwHeight;

// extract bitmap data
source_ptr = bitmap->buffer + cy*bitmap->bitmapinfoheader.biWidth+cx;

// assign a pointer to the memory surface for manipulation
dest_ptr = (UCHAR *)ddsd.lpSurface;

// iterate thru each scanline and copy bitmap
for (int index_y=0; index_y < ddsd.dwHeight; index_y++)
    {
    // copy next line of data to destination
    memcpy(dest_ptr, source_ptr, ddsd.dwWidth);

    // advance pointers
    dest_ptr   += (ddsd.lPitch);
    source_ptr += bitmap->bitmapinfoheader.biWidth;
    } // end for index_y

// unlock the surface 
lpdds->Unlock(NULL);

// return success
return(1);

} // end Scan_Image_Bitmap

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

LPDIRECTDRAWSURFACE7 DDraw_Create_Surface(int width, int height, int mem_flags, int color_key = 0)
{
// this function creates an offscreen plain surface

DDSURFACEDESC2 ddsd;         // working description
LPDIRECTDRAWSURFACE7 lpdds;  // temporary surface
    
// set to access caps, width, and height
memset(&ddsd,0,sizeof(ddsd));
ddsd.dwSize  = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;

// set dimensions of the new bitmap surface
ddsd.dwWidth  =  width;
ddsd.dwHeight =  height;

// set surface to offscreen plain
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | mem_flags;

// create the surface
if (FAILED(lpdd->CreateSurface(&ddsd,&lpdds,NULL)))
   return(NULL);

// test if user wants a color key
if (color_key >= 0)
   {
   // set color key to color 0
   DDCOLORKEY color_key; // used to set color key
   color_key.dwColorSpaceLowValue  = 0;
   color_key.dwColorSpaceHighValue = 0;

   // now set the color key for source blitting
   lpdds->SetColorKey(DDCKEY_SRCBLT, &color_key);
   } // end if

// return surface
return(lpdds);
} // end DDraw_Create_Surface


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

LRESULT CALLBACK WindowProc(HWND hwnd, 
						    UINT msg, 
                            WPARAM wparam, 
                            LPARAM lparam)
{
// this is the main message handler of the system
PAINTSTRUCT		ps;		// used in WM_PAINT
HDC				hdc;	// handle to a device context
char buffer[80];        // used to print strings

// what is the message 
switch(msg)
	{	
	case WM_CREATE: 
        {
		// do initialization stuff here
        // return success
		return(0);
		} 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 Draw_Text_GDI(char *text, int x,int y,COLORREF color, LPDIRECTDRAWSURFACE7 lpdds)
{
// this function draws the sent text on the sent surface 
// using color index as the color in the palette

HDC xdc; // the working dc

// get the dc from surface
if (FAILED(lpdds->GetDC(&xdc)))
   return(0);

// set the colors for the text up
SetTextColor(xdc,color);

// set background mode to transparent so black isn't copied
SetBkMode(xdc, TRANSPARENT);

// draw the text a
TextOut(xdc,x,y,text,strlen(text));

// release the dc
lpdds->ReleaseDC(xdc);

// return success
return(1);
} // end Draw_Text_GDI

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

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

// lookup for proper walking sequence
static int animation_seq[4] = {0,1,0,2};

int index; // general looping variable

// 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

// copy background to back buffer
DDraw_Draw_Surface(lpddsbackground,0,0, SCREEN_WIDTH,SCREEN_HEIGHT, lpddsback,0);    

// move objects around

for (index=0; index < 3; index++)
    {
    // move each object to the right at its given velocity
    aliens[index].x++; // =aliens[index].velocity;

    // test if off screen edge, and wrap around
    if (aliens[index].x > SCREEN_WIDTH)
       aliens[index].x = - 80;

    // animate bot
    if (++aliens[index].counter >= (8 - aliens[index].velocity))
        {
        // reset counter
        aliens[index].counter = 0;

        // advance to next frame
        if (++aliens[index].current_frame > 3)
           aliens[index].current_frame = 0;
  
        } // end if

    } // end for index

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产成人福利片| 国产日韩欧美激情| 国产午夜亚洲精品不卡| 亚洲最大成人综合| 高潮精品一区videoshd| 91精品国产福利在线观看| 亚洲欧美在线aaa| 免费不卡在线观看| 欧美精品在线观看播放| 亚洲色图另类专区| 成人国产电影网| 日韩精品影音先锋| 日本欧美大码aⅴ在线播放| 色综合天天综合网天天狠天天| 日韩免费一区二区三区在线播放| 亚洲一区二区三区四区五区黄| 不卡视频一二三| 国产精品嫩草99a| 国产一区二区不卡在线| 日韩三级中文字幕| 日韩高清国产一区在线| 欧美日韩精品福利| 婷婷一区二区三区| 欧美日韩一卡二卡| 日韩国产精品91| 日韩欧美国产麻豆| 日本中文字幕一区二区视频| 欧美日韩另类国产亚洲欧美一级| 亚洲激情av在线| 色94色欧美sute亚洲线路二| 亚洲欧洲精品天堂一级 | 天堂午夜影视日韩欧美一区二区| 94-欧美-setu| 亚洲综合免费观看高清在线观看| 不卡一区中文字幕| 一区二区三区在线免费视频 | 亚洲美女免费在线| 欧美在线视频你懂得| 亚洲资源中文字幕| 91精品国产入口| 久久99国产精品尤物| 久久久精品免费免费| 风间由美性色一区二区三区| 国产精品日韩精品欧美在线| 97精品视频在线观看自产线路二| 一区二区三区中文字幕精品精品| 欧美性色欧美a在线播放| 亚洲成人动漫精品| 26uuu亚洲综合色| va亚洲va日韩不卡在线观看| 一区二区三区高清不卡| 欧美丰满美乳xxx高潮www| 另类小说视频一区二区| 国产三级一区二区| 欧美日韩亚洲另类| 国产综合色视频| 亚洲日本乱码在线观看| 欧美日韩亚洲国产综合| 国产精品一二三区在线| 悠悠色在线精品| 欧美精品一区二区三区很污很色的| 国产不卡视频一区二区三区| 亚洲精品久久嫩草网站秘色| 3751色影院一区二区三区| 国产福利视频一区二区三区| 亚洲综合色噜噜狠狠| 久久精品人人做| 91福利区一区二区三区| 紧缚捆绑精品一区二区| 日韩久久一区二区| 精品乱人伦小说| 色综合天天视频在线观看| 日本成人中文字幕在线视频| 中文字幕一区二区三区乱码在线| 欧美精品日韩一本| 99视频超级精品| 麻豆国产91在线播放| 亚洲另类在线视频| 国产亚洲午夜高清国产拍精品| 欧美日本精品一区二区三区| 大胆欧美人体老妇| 捆绑变态av一区二区三区| 一区二区三区国产| 中文字幕日韩一区| 久久久精品综合| 日韩欧美一级片| 欧美日韩亚洲综合在线 | 国产高清精品在线| 奇米色一区二区| 亚洲亚洲人成综合网络| 国产精品免费观看视频| 久久久久久久综合色一本| 91麻豆精品91久久久久同性| 欧美亚洲一区二区在线| av在线播放成人| 高清在线观看日韩| 国产麻豆精品久久一二三| 精彩视频一区二区| 蜜桃视频一区二区三区| 天天综合色天天综合| 夜夜嗨av一区二区三区四季av| 欧美国产一区二区在线观看| 久久日韩粉嫩一区二区三区 | 国产精品美女久久久久久久久久久| 日韩欧美国产精品| 日韩一区二区三区电影在线观看 | 久久久.com| 精品国产乱码久久久久久浪潮| 在线综合视频播放| 6080国产精品一区二区| 欧美在线制服丝袜| 色综合久久综合网欧美综合网| 99热这里都是精品| 91精品福利在线| 欧美亚洲丝袜传媒另类| 欧美三级电影网站| 欧美日韩国产一区| 欧美一区二区三区在| 精品久久久久久久久久久久久久久久久 | 91精品国产手机| 7777精品伊人久久久大香线蕉最新版| 欧洲一区在线观看| 欧美日韩一卡二卡三卡 | 狠狠色综合播放一区二区| 国内精品在线播放| 成人午夜av影视| 欧美综合久久久| 日韩一区二区在线免费观看| 久久婷婷成人综合色| 中文字幕一区二区三中文字幕| 亚洲欧美一区二区三区久本道91| 亚洲男女毛片无遮挡| 一区二区三区欧美在线观看| 日韩黄色片在线观看| 韩国av一区二区三区| 粉嫩蜜臀av国产精品网站| 色综合久久99| 制服丝袜亚洲色图| 国产日韩欧美高清| 亚洲一区二区欧美| 毛片av中文字幕一区二区| 国产成+人+日韩+欧美+亚洲| 欧美在线综合视频| 久久欧美一区二区| 亚洲国产一区视频| 国产老女人精品毛片久久| 色天使色偷偷av一区二区| 日韩欧美视频一区| 最新日韩av在线| 日本成人超碰在线观看| 99热在这里有精品免费| 日韩一区二区精品在线观看| 中文字幕乱码亚洲精品一区 | 伊人夜夜躁av伊人久久| 免费成人你懂的| 色综合天天综合网国产成人综合天| 日韩亚洲欧美成人一区| 中文字幕亚洲不卡| 精品一区二区免费在线观看| hitomi一区二区三区精品| 日韩欧美黄色影院| 亚洲电影你懂得| 成人午夜精品一区二区三区| 日韩美女天天操| 亚洲国产日日夜夜| 成人视屏免费看| 欧美精品一区二区三区很污很色的| 亚洲精品第一国产综合野| 国产成人综合亚洲网站| 欧美老肥妇做.爰bbww| 日韩一区日韩二区| 丁香亚洲综合激情啪啪综合| 日韩精品专区在线| 日韩激情av在线| 欧美色倩网站大全免费| 中文字幕永久在线不卡| 国产精品亚洲视频| 精品美女一区二区| 麻豆精品国产91久久久久久| 欧美日韩亚洲国产综合| 樱桃视频在线观看一区| 91免费看`日韩一区二区| 欧美韩国日本一区| 粉嫩嫩av羞羞动漫久久久| 精品处破学生在线二十三| 婷婷六月综合亚洲| 欧美二区三区的天堂| 亚洲一区av在线| 日本韩国视频一区二区| 亚洲人成亚洲人成在线观看图片 | 国产在线播放一区三区四| 欧美一卡二卡三卡四卡| 午夜精品一区二区三区三上悠亚| 91污片在线观看| 亚洲品质自拍视频| 在线国产电影不卡| 亚洲高清免费在线| 欧美电影影音先锋| 欧美aa在线视频| 久久久精品免费网站|