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

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

?? t3dlib1.cpp

?? 一本外國人寫的關于3D游戲編程的書的源碼
?? CPP
?? 第 1 頁 / 共 5 頁
字號:
int Load_Frame_BOB(BOB_PTR bob, // bob to load with data
                   BITMAP_FILE_PTR bitmap, // bitmap to scan image data from
                   int frame,       // frame to load
                   int cx,int cy,   // cell or absolute pos. to scan image from
                   int mode)        // if 0 then cx,cy is cell position, else 
                                    // cx,cy are absolute coords
{
// this function extracts a bitmap out of a bitmap file

DDSURFACEDESC2 ddsd;  //  direct draw surface description 

// is this a valid bob
if (!bob)
   return(0);

UCHAR *source_ptr,   // working pointers
      *dest_ptr;

// test the mode of extraction, cell based or absolute
if (mode==BITMAP_EXTRACT_MODE_CELL)
   {
   // re-compute x,y
   cx = cx*(bob->width+1) + 1;
   cy = cy*(bob->height+1) + 1;
   } // end if

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

// get the addr to destination surface memory

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

// lock the display surface
(bob->images[frame])->Lock(NULL,
                           &ddsd,
                           DDLOCK_WAIT | DDLOCK_SURFACEMEMORYPTR,
                           NULL);

// 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<bob->height; index_y++)
    {
    // copy next line of data to destination
    memcpy(dest_ptr, source_ptr,bob->width);

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

// unlock the surface 
(bob->images[frame])->Unlock(NULL);

// set state to loaded
bob->attr |= BOB_ATTR_LOADED;

// return success
return(1);

} // end Load_Frame_BOB

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

int Load_Frame_BOB16(BOB_PTR bob, // bob to load with data
                     BITMAP_FILE_PTR bitmap, // bitmap to scan image data from
                     int frame,       // frame to load
                     int cx,int cy,   // cell or absolute pos. to scan image from
                     int mode)        // if 0 then cx,cy is cell position, else 
                                    // cx,cy are absolute coords
{
// this function extracts a 16-bit bitmap out of a 16-bit bitmap file

DDSURFACEDESC2 ddsd;  //  direct draw surface description 

// is this a valid bob
if (!bob)
   return(0);

USHORT *source_ptr,   // working pointers
       *dest_ptr;

// test the mode of extraction, cell based or absolute
if (mode==BITMAP_EXTRACT_MODE_CELL)
   {
   // re-compute x,y
   cx = cx*(bob->width+1) + 1;
   cy = cy*(bob->height+1) + 1;
   } // end if

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

// get the addr to destination surface memory

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

// lock the display surface
(bob->images[frame])->Lock(NULL,
                           &ddsd,
                           DDLOCK_WAIT | DDLOCK_SURFACEMEMORYPTR,
                           NULL);

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

// iterate thru each scanline and copy bitmap
for (int index_y=0; index_y<bob->height; index_y++)
    {
    // copy next line of data to destination
    memcpy(dest_ptr, source_ptr,(bob->width*2));

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

// unlock the surface 
(bob->images[frame])->Unlock(NULL);

// set state to loaded
bob->attr |= BOB_ATTR_LOADED;

// return success
return(1);

} // end Load_Frame_BOB16

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

int Animate_BOB(BOB_PTR bob)
{
// this function animates a bob, basically it takes a look at
// the attributes of the bob and determines if the bob is 
// a single frame, multiframe, or multi animation, updates
// the counters and frames appropriately

// is this a valid bob
if (!bob)
   return(0);

// test the level of animation
if (bob->attr & BOB_ATTR_SINGLE_FRAME)
    {
    // current frame always = 0
    bob->curr_frame = 0;
    return(1);
    } // end if
else
if (bob->attr & BOB_ATTR_MULTI_FRAME)
   {
   // update the counter and test if its time to increment frame
   if (++bob->anim_counter >= bob->anim_count_max)
      {
      // reset counter
      bob->anim_counter = 0;

      // move to next frame
      if (++bob->curr_frame >= bob->num_frames)
         bob->curr_frame = 0;

      } // end if
  
   } // end elseif
else
if (bob->attr & BOB_ATTR_MULTI_ANIM)
   {
   // this is the most complex of the animations it must look up the
   // next frame in the animation sequence

   // first test if its time to animate
   if (++bob->anim_counter >= bob->anim_count_max)
      {
      // reset counter
      bob->anim_counter = 0;

      // increment the animation frame index
      bob->anim_index++;
      
      // extract the next frame from animation list 
      bob->curr_frame = bob->animations[bob->curr_animation][bob->anim_index];
     
      // is this and end sequence flag -1
      if (bob->curr_frame == -1)
         {
         // test if this is a single shot animation
         if (bob->attr & BOB_ATTR_ANIM_ONE_SHOT)
            {
            // set animation state message to done
            bob->anim_state = BOB_STATE_ANIM_DONE;
            
            // reset frame back one
            bob->anim_index--;

            // extract animation frame
            bob->curr_frame = bob->animations[bob->curr_animation][bob->anim_index];    

            } // end if
        else
           {
           // reset animation index
           bob->anim_index = 0;

           // extract first animation frame
           bob->curr_frame = bob->animations[bob->curr_animation][bob->anim_index];
           } // end else

         }  // end if
      
      } // end if

   } // end elseif

// return success
return(1);

} // end Amimate_BOB

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

int Scroll_BOB(void)
{
// this function scrolls a bob 
// not implemented

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

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

int Move_BOB(BOB_PTR bob)
{
// this function moves the bob based on its current velocity
// also, the function test for various motion attributes of the'
// bob and takes the appropriate actions
   

// is this a valid bob
if (!bob)
   return(0);

// translate the bob
bob->x+=bob->xv;
bob->y+=bob->yv;

// test for wrap around
if (bob->attr & BOB_ATTR_WRAPAROUND)
   {
   // test x extents first
   if (bob->x > max_clip_x)
       bob->x = min_clip_x - bob->width;
   else
   if (bob->x < min_clip_x-bob->width)
       bob->x = max_clip_x;
   
   // now y extents
   if (bob->x > max_clip_x)
       bob->x = min_clip_x - bob->width;
   else
   if (bob->x < min_clip_x-bob->width)
       bob->x = max_clip_x;

   } // end if
else
// test for bounce
if (bob->attr & BOB_ATTR_BOUNCE)
   {
   // test x extents first
   if ((bob->x > max_clip_x - bob->width) || (bob->x < min_clip_x) )
       bob->xv = -bob->xv;
    
   // now y extents 
   if ((bob->y > max_clip_y - bob->height) || (bob->y < min_clip_y) )
       bob->yv = -bob->yv;

   } // end if

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

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

int Load_Animation_BOB(BOB_PTR bob, 
                       int anim_index, 
                       int num_frames, 
                       int *sequence)
{
// this function load an animation sequence for a bob
// the sequence consists of frame indices, the function
// will append a -1 to the end of the list so the display
// software knows when to restart the animation sequence

// is this bob valid
if (!bob)
   return(0);

// allocate memory for bob animation
if (!(bob->animations[anim_index] = (int *)malloc((num_frames+1)*sizeof(int))))
   return(0);

// load data into 
for (int index=0; index<num_frames; index++)
    bob->animations[anim_index][index] = sequence[index];

// set the end of the list to a -1
bob->animations[anim_index][index] = -1;

// return success
return(1);

} // end Load_Animation_BOB

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

int Set_Pos_BOB(BOB_PTR bob, int x, int y)
{
// this functions sets the postion of a bob

// is this a valid bob
if (!bob)
   return(0);

// set positin
bob->x = x;
bob->y = y;

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

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

int Set_Anim_Speed_BOB(BOB_PTR bob,int speed)
{
// this function simply sets the animation speed of a bob
    
// is this a valid bob
if (!bob)
   return(0);

// set speed
bob->anim_count_max = speed;

// return success
return(1);

} // end Set_Anim_Speed

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

int Set_Animation_BOB(BOB_PTR bob, int anim_index)
{
// this function sets the animation to play

// is this a valid bob
if (!bob)
   return(0);

// set the animation index
bob->curr_animation = anim_index;

// reset animation 
bob->anim_index = 0;

// return success
return(1);

} // end Set_Animation_BOB

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

int Set_Vel_BOB(BOB_PTR bob,int xv, int yv)
{
// this function sets the velocity of a bob

// is this a valid bob
if (!bob)
   return(0);

// set velocity
bob->xv = xv;
bob->yv = yv;

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

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

int Hide_BOB(BOB_PTR bob)
{
// this functions hides bob 

// is this a valid bob
if (!bob)
   return(0);

// reset the visibility bit
RESET_BIT(bob->attr, BOB_ATTR_VISIBLE);

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

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

int Show_BOB(BOB_PTR bob)
{
// this function shows a bob

// is this a valid bob
if (!bob)
   return(0);

// set the visibility bit
SET_BIT(bob->attr, BOB_ATTR_VISIBLE);

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

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

int Collision_BOBS(BOB_PTR bob1, BOB_PTR bob2)
{
// are these a valid bobs
if (!bob1 || !bob2)
   return(0);

// get the radi of each rect
int width1  = (bob1->width>>1) - (bob1->width>>3);
int height1 = (bob1->height>>1) - (bob1->height>>3);

int width2  = (bob2->width>>1) - (bob2->width>>3);
int height2 = (bob2->height>>1) - (bob2->height>>3);

// compute center of each rect
int cx1 = bob1->x + width1;
int cy1 = bob1->y + height1;

int cx2 = bob2->x + width2;
int cy2 = bob2->y + height2;

// compute deltas
int dx = abs(cx2 - cx1);
int dy = abs(cy2 - cy1);

// test if rects overlap
if (dx < (width1+width2) && dy < (height1+height2))
   return(1);
else
// else no collision
return(0);

} // end Collision_BOBS

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

int DDraw_Init(int width, int height, int bpp, int windowed)
{
// this function initializes directdraw
int index; // looping variable

// create IDirectDraw interface 7.0 object and test for error
if (FAILED(DirectDrawCreateEx(NULL, (void **)&lpdd, IID_IDirectDraw7, NULL)))
   return(0);

// based on windowed or fullscreen set coorperation level
if (windowed)
   {
   // set cooperation level to windowed mode 
   if (FAILED(lpdd->SetCooperativeLevel(main_window_handle,DDSCL_NORMAL)))
       return(0);

   } // end if
else
   {
   // set cooperation level to fullscreen mode 
   if (FAILED(lpdd->SetCooperativeLevel(main_window_handle,
              DDSCL_ALLOWMODEX | DDSCL_FULLSCREEN | 
              DDSCL_EXCLUSIVE | DDSCL_ALLOWREBOOT | DDSCL_MULTITHREADED )))
       return(0);

   // set the display mode
   if (FAILED(lpdd->SetDisplayMode(width,height,bpp,0,0)))
      return(0);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区二区调教| 一区二区在线观看不卡| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 一区二区三区日韩精品| 水野朝阳av一区二区三区| 国产麻豆精品95视频| 91免费视频观看| 日韩女优电影在线观看| 亚洲欧洲成人av每日更新| 五月激情综合色| 国产激情一区二区三区四区 | 亚洲夂夂婷婷色拍ww47| 奇米一区二区三区av| eeuss影院一区二区三区| 欧美久久久一区| 中文字幕成人av| 天天综合日日夜夜精品| 成人一区二区三区在线观看| 欧美综合久久久| 久久久久久久久久看片| 亚洲电影一区二区| 丁香婷婷深情五月亚洲| 欧美巨大另类极品videosbest| 欧美激情中文字幕| 日本欧美一区二区在线观看| 成人午夜激情在线| 日韩三级伦理片妻子的秘密按摩| 亚洲欧美国产高清| 国产成人精品影院| 欧美日韩高清一区二区| 18成人在线视频| 捆绑变态av一区二区三区| 欧洲亚洲国产日韩| 国产精品不卡一区| 国产自产v一区二区三区c| 欧美色精品天天在线观看视频| 中文字幕的久久| 美女任你摸久久| 欧美老年两性高潮| 亚洲一区在线视频| 成人高清视频在线观看| 精品日韩欧美在线| 日韩激情中文字幕| 欧美熟乱第一页| 亚洲欧美视频在线观看视频| 懂色一区二区三区免费观看| 精品国产一区二区在线观看| 亚洲成a天堂v人片| 欧美亚洲另类激情小说| 亚洲色图欧洲色图婷婷| 粗大黑人巨茎大战欧美成人| 精品久久久久久久久久久久久久久 | 极品少妇一区二区三区精品视频 | 肉丝袜脚交视频一区二区| 一本色道久久综合精品竹菊| 国产免费观看久久| 国产成人自拍网| 久久久久久久久久久99999| 精品一区二区三区av| 日韩精品一区二区三区在线播放| 日韩电影在线免费看| 777欧美精品| 五月婷婷激情综合网| 欧美人与禽zozo性伦| 调教+趴+乳夹+国产+精品| 欧美区在线观看| 免费一级欧美片在线观看| 欧美一区二区三区白人| 美腿丝袜亚洲一区| 亚洲精品在线免费观看视频| 韩国精品主播一区二区在线观看 | 国产九色sp调教91| 国产性做久久久久久| 国产不卡高清在线观看视频| 中文一区二区在线观看| 丁香激情综合五月| 国产精品久久久久久久久免费桃花| 高清av一区二区| 国产精品久久久久婷婷| 99久免费精品视频在线观看| 亚洲日本va午夜在线影院| 色婷婷av一区二区三区之一色屋| 一区二区视频在线| 666欧美在线视频| 极品尤物av久久免费看| 中文无字幕一区二区三区| 99久久er热在这里只有精品66| 国产精品成人一区二区艾草 | 亚洲国产精品久久人人爱| 欧美午夜一区二区三区| 日韩电影一二三区| 久久综合色8888| 波多野结衣在线aⅴ中文字幕不卡| 中文字幕在线一区免费| 日本韩国欧美一区二区三区| 五月婷婷久久丁香| 久久人人97超碰com| aaa国产一区| 天堂va蜜桃一区二区三区漫画版| 日韩一区二区三区免费看 | 最新日韩在线视频| 欧美日韩在线亚洲一区蜜芽| 蜜桃av一区二区在线观看| 久久久一区二区| 日本久久电影网| 日韩av电影免费观看高清完整版| 久久精品夜色噜噜亚洲aⅴ| 色综合久久久久网| 人妖欧美一区二区| 国产日韩综合av| 欧美日韩精品久久久| 国内精品视频一区二区三区八戒| 亚洲欧美中日韩| 欧美电视剧免费观看| 99精品久久久久久| 免费人成在线不卡| 亚洲色图视频网站| 欧美tickling网站挠脚心| 91在线视频免费观看| 日韩极品在线观看| 亚洲欧洲一区二区在线播放| 欧美高清一级片在线| 高清视频一区二区| 首页欧美精品中文字幕| 国产精品传媒入口麻豆| 日韩一区二区免费电影| 99这里只有久久精品视频| 日本伊人精品一区二区三区观看方式| 久久香蕉国产线看观看99| 在线视频中文字幕一区二区| 国产伦精品一区二区三区免费| 亚洲国产视频在线| 国产精品女同一区二区三区| 日韩一区二区三区在线观看 | 亚洲精品ww久久久久久p站| 精品奇米国产一区二区三区| 日本丶国产丶欧美色综合| 国产一二精品视频| 五月天视频一区| 最新日韩在线视频| 国产无人区一区二区三区| 4438亚洲最大| 91高清视频免费看| 成人国产在线观看| 国产精品伊人色| 人人狠狠综合久久亚洲| 亚洲精品久久久久久国产精华液| 国产亚洲精品aa| 精品黑人一区二区三区久久| 欧美日韩精品高清| 在线免费不卡电影| 99久久99久久精品免费看蜜桃| 国产精品一品二品| 久久国产精品72免费观看| 亚洲午夜一区二区| 玉米视频成人免费看| 中文字幕一区在线观看视频| 亚洲精品在线免费观看视频| 欧美一区二区三区视频免费| 欧美日韩高清一区二区三区| 91国产成人在线| 一本色道久久综合亚洲91| av电影天堂一区二区在线| 福利电影一区二区| 国产+成+人+亚洲欧洲自线| 国产一区激情在线| 精品亚洲成av人在线观看| 日本三级亚洲精品| 秋霞影院一区二区| 男男视频亚洲欧美| 日韩高清在线电影| 日韩激情视频在线观看| 亚洲国产综合色| 午夜欧美大尺度福利影院在线看| 亚洲夂夂婷婷色拍ww47| 亚洲综合另类小说| 亚洲一区二区三区小说| 亚洲免费观看高清在线观看| ...av二区三区久久精品| 亚洲欧美日韩在线不卡| 亚洲精品国产品国语在线app| 亚洲精品老司机| 亚洲va国产va欧美va观看| 亚洲成人一区二区| 日本三级韩国三级欧美三级| 蓝色福利精品导航| 国产精品一色哟哟哟| 成人动漫在线一区| 99re热视频这里只精品| 在线国产电影不卡| 欧美精品久久一区二区三区| 91精品国产综合久久久久久久 | 久久成人精品无人区| 精品中文av资源站在线观看| 国产精品18久久久久久久久 | 中文字幕一区在线| 一区二区三区不卡在线观看| 一区二区三区波多野结衣在线观看| 一区二区三区四区五区视频在线观看| 亚洲国产精品一区二区久久|