亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
欧美午夜影院一区| 精品1区2区在线观看| 日韩欧美在线网站| 亚洲欧美另类久久久精品2019| 天天影视涩香欲综合网| 粉嫩av一区二区三区| 欧美一区二区三区视频| 国产精品高清亚洲| 国产在线精品免费av| 久久久青草青青国产亚洲免观| 成人免费在线播放视频| 国产在线精品一区二区三区不卡| 欧美日韩亚洲不卡| 亚洲日本va午夜在线电影| 国产一区在线精品| 欧美一区二区三区在线观看视频 | www.av亚洲| 日韩一本二本av| 亚洲香肠在线观看| 91在线视频官网| 国产精品的网站| 国产成人精品1024| 久久综合狠狠综合久久激情| 日本欧美一区二区三区| 欧美日韩色综合| 亚洲国产成人精品视频| 日本精品裸体写真集在线观看 | 欧美人与性动xxxx| 一区二区久久久久久| 91麻豆精东视频| 亚洲欧美日韩一区二区| 成人午夜视频在线观看| 欧美激情自拍偷拍| a4yy欧美一区二区三区| 国产精品日产欧美久久久久| 国产成人一区二区精品非洲| 久久精品视频在线看| 成人妖精视频yjsp地址| 亚洲国产精品v| 91亚洲精品乱码久久久久久蜜桃| 国产精品免费视频观看| 99天天综合性| 亚洲一区二区影院| 欧美日韩成人高清| 久久 天天综合| 国产女人18水真多18精品一级做 | 91亚洲国产成人精品一区二区三 | 国产福利91精品一区二区三区| 精品乱人伦一区二区三区| 国产美女视频一区| 国产精品美日韩| 欧美性感一类影片在线播放| 亚洲3atv精品一区二区三区| 日韩亚洲欧美综合| 国产成人aaa| 亚洲精品写真福利| 91精品国产免费| 国产精品一区在线观看你懂的| 国产日产欧美精品一区二区三区| 成人不卡免费av| 亚洲国产精品一区二区久久| 欧美一级精品在线| 成人激情动漫在线观看| 亚洲在线观看免费| 精品国产乱码91久久久久久网站| 国产99久久精品| 亚洲二区视频在线| 国产午夜一区二区三区| 在线视频一区二区三| 久久精品国产成人一区二区三区| 国产欧美精品区一区二区三区| 色94色欧美sute亚洲线路二| 久久精品国产精品亚洲精品| 国产精品短视频| 制服.丝袜.亚洲.中文.综合| 国产成人免费视频精品含羞草妖精| 亚洲视频图片小说| 欧美成人精品二区三区99精品| 91小视频免费看| 久久99精品久久久久久久久久久久| 亚洲欧美在线高清| 欧美mv和日韩mv的网站| 色网站国产精品| 国产精品一区二区久久不卡| 亚洲电影一级片| 亚洲欧洲精品一区二区精品久久久| 91麻豆精品国产91久久久久久| 粉嫩高潮美女一区二区三区| 蜜臀久久久99精品久久久久久| 亚洲精品中文在线| 欧美韩国日本不卡| 26uuuu精品一区二区| 欧美久久久久久久久久| av在线不卡电影| 国产乱码一区二区三区| 日本最新不卡在线| 五月综合激情婷婷六月色窝| 亚洲精品国产a| 国产精品国产三级国产三级人妇| 日韩欧美国产三级电影视频| 欧美日韩中文字幕一区| 色av成人天堂桃色av| 不卡av在线网| 国产99一区视频免费| 精品一区二区免费视频| 青青国产91久久久久久| 亚洲国产精品久久艾草纯爱| 一二三四社区欧美黄| 亚洲日本免费电影| 中文字幕一区二区在线播放| 中文在线一区二区| 久久久久97国产精华液好用吗| 日韩视频在线观看一区二区| 欧美一区二区私人影院日本| 9191久久久久久久久久久| 欧美日韩在线观看一区二区| 欧美亚州韩日在线看免费版国语版| av电影在线观看一区| 99精品久久99久久久久| av一区二区久久| 色婷婷综合久久久中文一区二区| 99久久777色| 欧美自拍丝袜亚洲| 欧美人妇做爰xxxⅹ性高电影| 欧美日韩一区在线观看| 在线综合视频播放| 精品国产青草久久久久福利| 久久婷婷久久一区二区三区| 国产日韩精品一区二区浪潮av| 国产三级一区二区| 中文字幕一区二区在线观看| 亚洲精品第一国产综合野| 亚洲国产裸拍裸体视频在线观看乱了| 亚洲一区二区五区| 蜜桃精品视频在线| 国产福利精品一区| 91视频免费看| 制服丝袜亚洲色图| 国产免费久久精品| 夜夜揉揉日日人人青青一国产精品| 亚洲电影在线播放| 国产一区二区三区精品欧美日韩一区二区三区 | 美女脱光内衣内裤视频久久影院| 卡一卡二国产精品| 成人三级伦理片| 在线免费观看日本一区| 欧美一区二区三区在线| 久久精品亚洲麻豆av一区二区 | 国产三级欧美三级| 一区二区成人在线视频| 久久国产精品99精品国产| 成人免费看视频| 欧美一区二区三区在| 国产精品久久久久久久久晋中| 亚洲一区二区欧美激情| 国产伦精品一区二区三区免费| 91原创在线视频| 精品理论电影在线| 亚洲精品国产成人久久av盗摄| 蜜臀a∨国产成人精品| 91一区二区在线观看| 337p日本欧洲亚洲大胆色噜噜| 最新国产成人在线观看| 麻豆freexxxx性91精品| 91网站最新地址| www一区二区| 日韩精品国产精品| www.亚洲色图.com| 精品国产一区二区三区四区四| 日韩精品电影在线观看| 懂色av一区二区在线播放| 日韩一二三区视频| 亚洲一区欧美一区| 不卡一区中文字幕| 2023国产精品视频| 免费高清在线一区| 欧美男同性恋视频网站| 亚洲日本丝袜连裤袜办公室| 国产电影精品久久禁18| 91精品国产欧美一区二区| 亚洲一区中文在线| 99久久精品99国产精品| 国产女主播视频一区二区| 美女久久久精品| 在线观看91av| 亚洲福利一区二区| 色系网站成人免费| 亚洲欧美精品午睡沙发| 丰满亚洲少妇av| 久久亚洲影视婷婷| 精品在线亚洲视频| 欧美一二三区在线观看| 爽好久久久欧美精品| 91久久精品一区二区二区| 1024国产精品| 9人人澡人人爽人人精品| 国产精品视频在线看| 国产99久久精品| 国产精品卡一卡二| www.日韩精品|