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

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

?? demo12_5.cpp

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

// acquire the keyboard only
DInput_Init_Keyboard();

// initilize DirectSound
DSound_Init();

// load background sounds
engines_id = DSound_Load_WAV("ENGINES.WAV");

// start the sounds
DSound_Play(engines_id, DSBPLAY_LOOPING);

// set clipping rectangle to screen extents so objects dont
// mess up at edges
RECT screen_rect = {0,0,screen_width,screen_height};
lpddclipper = DDraw_Attach_Clipper(lpddsback,1,&screen_rect);

// hide the mouse
ShowCursor(FALSE);

// seed random number generate
srand(Start_Clock());

// return success
return(1);

} // end Game_Init

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

int Game_Shutdown(void *parms)
{
// this function is where you shutdown your game and
// release all resources that you allocated

// shut everything down

// kill all the bobs
Destroy_BOB(&bot);

// shutdown directdraw last
DDraw_Shutdown();

// now directsound
DSound_Stop_All_Sounds();
DSound_Shutdown();

// shut down directinput
DInput_Shutdown();

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

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

void Bot_AI(void)
{
// this function controls the ai of the bot and the pattern
// processing

static int opcode,  // current pattern opcode
           operand; // current operand 

// test if it's time to process a new instruction
if (curr_pattern==NULL)
   {
   // select a random pattern in pattern bank
   bot_pattern_index = rand()%NUM_PATTERNS;
   curr_pattern = patterns[bot_pattern_index];
   
   // now reset instuction pointer
   bot_ip = 0;

   // reset counter
   bot_counter = 0;
 
   } // end if

// process next instruction if it's time
if (--bot_counter <= 0)
    {
    // get next instruction
    opcode  = curr_pattern[bot_ip++];
    operand = curr_pattern[bot_ip++];

    // test what the opcode is
    switch(opcode)
        {
        case OPC_E:
            {
            // set direction to east
            Set_Vel_BOB(&bot,6,0);
  
            // set animation to east
            Set_Animation_BOB(&bot,opcode);
            
            // set counter to instuction operand
            bot_counter = operand;

            } break;

        case OPC_NE:
            {
            // set direction to northeast
            Set_Vel_BOB(&bot,6,-6);
  
            // set animation to northeast
            Set_Animation_BOB(&bot,opcode);
            
            // set counter to instuction operand
            bot_counter = operand;

            } break;

        case OPC_N: 
            {
            // set direction to north
            Set_Vel_BOB(&bot,0,-6);
  
            // set animation to north
            Set_Animation_BOB(&bot,opcode);
            
            // set counter to instuction operand
            bot_counter = operand;

            } break;            

        case OPC_NW:
            {
            // set direction to northwest
            Set_Vel_BOB(&bot,-6,-6);
  
            // set animation to northwest
            Set_Animation_BOB(&bot,opcode);
            
            // set counter to instuction operand
            bot_counter = operand;

            } break;            

        case OPC_W: 
            {
            // set direction to west
            Set_Vel_BOB(&bot,-6,0);
  
            // set animation to west
            Set_Animation_BOB(&bot,opcode);
            
            // set counter to instuction operand
            bot_counter = operand;
			 
            } break;            

        case OPC_SW:
            {
            // set direction to southwest
            Set_Vel_BOB(&bot,-6,6);
  
            // set animation to southwest
            Set_Animation_BOB(&bot,opcode);
            
            // set counter to instuction operand
            bot_counter = operand;

            } break;            

        case OPC_S: 
            {
            // set direction to south
            Set_Vel_BOB(&bot,0,6);
  
            // set animation to south
            Set_Animation_BOB(&bot,opcode);
            
            // set counter to instuction operand
            bot_counter = operand;

            } break;            

        case OPC_SE:
            {
            // set direction to southeast
            Set_Vel_BOB(&bot,6,6);
  
            // set animation to southeast
            Set_Animation_BOB(&bot,opcode);
            
            // set counter to instuction operand
            bot_counter = operand;

            } break;            

        case OPC_STOP: 
            {
            // stop motion
            Set_Vel_BOB(&bot,0,0);
            
            // set counter to instuction operand
            bot_counter = operand;

            } break;

        case OPC_RAND:
            {
            // set direction randomly
            Set_Vel_BOB(&bot,-4+rand()%9,-4+rand()%9);
  
            // set animation to south
            Set_Animation_BOB(&bot,OPC_S);
            
            // set counter to instuction operand
            bot_counter = operand;

            } break;

        case OPC_END: 
            {
            // stop motion
            Set_Vel_BOB(&bot,0,0);
            
            // select a random pattern in pattern bank
            bot_pattern_index = rand()%NUM_PATTERNS;
            curr_pattern = patterns[bot_pattern_index];
   
            // now reset instuction pointer
            bot_ip = 0;

            // reset counter
            bot_counter = 0;

            } break;
        
        default: break;

        } // end switch

    } // end if


// draw stats
sprintf(buffer,"Pattern #%d",bot_pattern_index);
Draw_Text_GDI(buffer,10, 400,RGB(0,255,0), lpddsback);

sprintf(buffer,"Opcode=%s Operand=%d",opcode_names[opcode],operand);
Draw_Text_GDI(buffer,10, 416,RGB(0,255,0), lpddsback);

sprintf(buffer,"Instruction Ptr=%d ", bot_ip);
Draw_Text_GDI(buffer,10, 432,RGB(0,255,0), lpddsback);

sprintf(buffer,"Counter=%d ", bot_counter);
Draw_Text_GDI(buffer,10, 448,RGB(0,255,0), lpddsback);

} // end Bot_AI

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

int Game_Main(void *parms)
{
// this is the workhorse of your game it will be called
// continuously in real-time this is like main() in C
// all the calls for you game go here!

int index; // looping var

// start the timing clock
Start_Clock();

// clear the drawing surface
DDraw_Fill_Surface(lpddsback, 0);

// lock back buffer and copy background into it
DDraw_Lock_Back_Surface();

// draw background
Draw_Bitmap(&background_bmp, back_buffer, back_lpitch,0);

// unlock back surface
DDraw_Unlock_Back_Surface();

// read keyboard
DInput_Read_Keyboard();

// do the ai on bot
Bot_AI();

// the animate the bot
Animate_BOB(&bot);

// move bot
Move_BOB(&bot);

// test if bot is off screen, if so wrap around
if (bot.x >= SCREEN_WIDTH)
   bot.x = -bot.width;
else
if (bot.x < -bot.width)
   bot.x = SCREEN_WIDTH;

if (bot.y >= SCREEN_HEIGHT)
   bot.y = -bot.height;
else
if (bot.y < -bot.height)
   bot.y = SCREEN_HEIGHT;

// draw the bot
Draw_BOB(&bot, lpddsback);

// draw title
Draw_Text_GDI("I-ROBOT 3D - Pattern Demo",10, 10,RGB(0,255,255), lpddsback);

// flip the surfaces
DDraw_Flip();

// sync to 30ish fps
Wait_Clock(30);

// check of user is trying to exit
if (KEY_DOWN(VK_ESCAPE) || keyboard_state[DIK_ESCAPE])
    {
    PostMessage(main_window_handle, WM_DESTROY,0,0);

    // stop all sounds
    DSound_Stop_All_Sounds();

    // do a screen transition
    Screen_Transitions(SCREEN_BLUENESS,NULL,0);

    } // end if

// return success
return(1);

} // end Game_Main

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

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲国产你懂的| 中文字幕中文在线不卡住| 亚洲成人tv网| 69堂国产成人免费视频| 久久精品72免费观看| 久久久噜噜噜久噜久久综合| 粉嫩一区二区三区性色av| 一区在线中文字幕| 在线中文字幕不卡| 日韩国产精品久久| 久久先锋影音av鲁色资源网| 国产iv一区二区三区| 亚洲精品国产精华液| 欧美久久高跟鞋激| 国产一区二区三区国产| 中文字幕一区二区5566日韩| 欧美日韩免费一区二区三区 | 亚洲精品写真福利| 欧美高清你懂得| 国产黑丝在线一区二区三区| 亚洲精品视频在线观看网站| 欧美一区二区精美| jiyouzz国产精品久久| 亚洲尤物视频在线| 精品福利一区二区三区免费视频| 成人av在线影院| 奇米综合一区二区三区精品视频| 亚洲大片一区二区三区| 国产亚洲欧美一级| 欧美日本不卡视频| 不卡的av电影在线观看| 日韩av在线发布| 中文字幕一区二区三区在线播放| 日韩写真欧美这视频| 福利一区二区在线| 日韩电影在线观看网站| 国产精品久久久久久久久快鸭| 欧美日韩免费电影| 99在线精品免费| 美女久久久精品| 亚洲午夜国产一区99re久久| 国产亲近乱来精品视频| 欧美人体做爰大胆视频| 91亚洲男人天堂| 国产一区二区福利| 日韩国产精品久久| 国产福利一区二区三区| 亚洲成av人影院| 精品乱人伦小说| 91国产免费观看| www.激情成人| 国产剧情一区二区| 蜜臀精品一区二区三区在线观看| 亚洲靠逼com| 中文字幕中文乱码欧美一区二区| 欧美精品一区二区三区蜜臀| 欧美年轻男男videosbes| 91麻豆精品秘密| 成人免费视频一区二区| 国内精品国产三级国产a久久| 亚洲不卡一区二区三区| 亚洲女人小视频在线观看| 国产精品三级电影| 国产欧美精品一区二区色综合| 日韩欧美在线123| 欧美一级搡bbbb搡bbbb| 91精品国产高清一区二区三区| 欧美偷拍一区二区| 欧美午夜在线一二页| 在线看国产一区| 欧美综合天天夜夜久久| 欧洲国内综合视频| 精品视频一区二区不卡| 欧美亚洲国产一区在线观看网站| 91久久人澡人人添人人爽欧美| 99久久伊人久久99| 91麻豆视频网站| 不卡免费追剧大全电视剧网站| 成年人网站91| 一本大道av伊人久久综合| 欧洲一区二区三区免费视频| 欧美视频中文字幕| 69p69国产精品| 精品国产精品网麻豆系列| 久久婷婷久久一区二区三区| 久久久亚洲高清| 中文字幕一区在线| 伊人开心综合网| 日日噜噜夜夜狠狠视频欧美人| 日本sm残虐另类| 国产成人在线影院| 91亚洲永久精品| 欧美美女网站色| 2021国产精品久久精品| 国产精品久久久久影院色老大| 一区二区三区蜜桃网| 日韩高清不卡一区| 在线不卡免费欧美| 久久一区二区视频| 国产精品国产馆在线真实露脸 | 欧美日韩精品一区二区三区四区 | 日韩av网站在线观看| 黄色资源网久久资源365| www.色综合.com| 色婷婷av一区二区三区大白胸 | 国产视频一区在线播放| 成人欧美一区二区三区1314| 性久久久久久久久久久久 | 成人黄色av电影| 欧美日韩大陆在线| 国产三级久久久| 亚洲一线二线三线久久久| 美腿丝袜在线亚洲一区 | 欧美亚洲尤物久久| 26uuu另类欧美| 亚洲天堂av老司机| 日本少妇一区二区| 97久久超碰国产精品电影| 69p69国产精品| 亚洲欧洲无码一区二区三区| 免费在线观看成人| 91在线精品秘密一区二区| 欧美一区二区女人| 一区二区三区在线免费播放| 国产又粗又猛又爽又黄91精品| 91福利在线看| 国产日产欧美一区| 美女视频一区二区| 在线观看欧美精品| 国产精品久久久久婷婷二区次| 日本vs亚洲vs韩国一区三区二区 | 日本丶国产丶欧美色综合| 精品成人一区二区三区四区| 亚洲综合av网| 成人丝袜高跟foot| 精品久久免费看| 午夜精品久久久久久不卡8050| av不卡免费电影| 国产欧美日韩综合| 精品午夜一区二区三区在线观看| 欧美亚洲综合网| 亚洲人快播电影网| 国产91精品一区二区| 精品日韩一区二区| 日韩主播视频在线| 色婷婷综合久久久久中文一区二区| 久久一区二区视频| 欧美bbbbb| 欧美日韩不卡在线| 亚洲一区精品在线| 色婷婷亚洲一区二区三区| 国产精品美女一区二区在线观看| 国产一区二区三区视频在线播放| 欧美精品一二三四| 午夜欧美2019年伦理| 91国产免费观看| 亚洲综合免费观看高清完整版| 久久久久久久久久美女| 精品一区二区国语对白| 日韩一区二区三区四区五区六区| 五月天欧美精品| 91精品婷婷国产综合久久竹菊| 午夜激情久久久| 欧美精品免费视频| 午夜成人免费视频| 制服丝袜中文字幕亚洲| 日本成人在线网站| 欧美刺激午夜性久久久久久久| 日本系列欧美系列| 欧美mv日韩mv亚洲| 国产精品一区二区三区99| 国产无人区一区二区三区| 国产91清纯白嫩初高中在线观看| 国产欧美一区二区三区在线看蜜臀 | 国产欧美日韩在线| 成人一级片网址| 自拍偷拍国产精品| 色欧美片视频在线观看在线视频| 亚洲精品中文在线影院| 在线日韩国产精品| 日韩电影在线免费看| 精品三级av在线| 成人动漫一区二区| 一区二区三区在线免费| 欧美精选午夜久久久乱码6080| 日本sm残虐另类| 国产日韩欧美在线一区| 93久久精品日日躁夜夜躁欧美| 一区二区三区高清在线| 欧美一卡在线观看| 高清在线不卡av| 樱花影视一区二区| 日韩欧美色电影| 成人av电影在线网| 天堂一区二区在线免费观看| 久久久久亚洲蜜桃| 色婷婷av一区二区三区gif| 奇米精品一区二区三区四区| 国产欧美日韩在线看| 欧美性色黄大片|