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

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

?? freakout.cpp

?? windows游戲編程大師源代碼
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
// this function tests if the ball has hit a block or the paddle
// if so, the ball is bounced and the block is removed from 
// the playfield note: very cheesy collision algorithm :)

// first test for ball block collisions

// the algorithm basically tests the ball against each 
// block's bounding box this is inefficient, but easy to 
// implement, later we'll see a better way

int x1 = BLOCK_ORIGIN_X, // current rendering position
    y1 = BLOCK_ORIGIN_Y; 

int ball_cx = ball_x+(BALL_SIZE/2),  // computer center of ball
    ball_cy = ball_y+(BALL_SIZE/2);

// test of the ball has hit the paddle
if (ball_y > (SCREEN_HEIGHT/2) && ball_dy > 0)
   {
   // extract leading edge of ball
   int x = ball_x+(BALL_SIZE/2);
   int y = ball_y+(BALL_SIZE/2);

   // test for collision with paddle
   if ((x >= paddle_x && x <= paddle_x+PADDLE_WIDTH) &&
       (y >= paddle_y && y <= paddle_y+PADDLE_HEIGHT))
       {
       // reflect ball
       ball_dy=-ball_dy;

       // push ball out of paddle since it made contact
       ball_y+=ball_dy;

       // add a little english to ball based on motion of paddle
       if (KEY_DOWN(VK_RIGHT))
          ball_dx-=(rand()%3);
       else
       if (KEY_DOWN(VK_LEFT))
          ball_dx+=(rand()%3);
       else
          ball_dx+=(-1+rand()%3);
       
       // test if there are no blocks, if so send a message
       // to game loop to start another level
       if (blocks_hit >= (NUM_BLOCK_ROWS*NUM_BLOCK_COLUMNS))
          {
          game_state = GAME_STATE_START_LEVEL;
          level++;
          } // end if

       // make a little noise
       MessageBeep(MB_OK);

       // return
       return; 

       } // end if

   } // end if

// now scan thru all the blocks and see of ball hit blocks
for (int row=0; row < NUM_BLOCK_ROWS; row++)
    {    
    // reset column position
    x1 = BLOCK_ORIGIN_X;

    // scan this row of blocks
    for (int col=0; col < NUM_BLOCK_COLUMNS; col++)
        {
        // if there is a block here then test it against ball
        if (blocks[row][col]!=0)
           {
           // test ball against bounding box of block
           if ((ball_cx > x1) && (ball_cx < x1+BLOCK_WIDTH) &&     
               (ball_cy > y1) && (ball_cy < y1+BLOCK_HEIGHT))
               {
               // remove the block
               blocks[row][col] = 0; 

               // increment global block counter, so we know 
               // when to start another level up
               blocks_hit++;

               // bounce the ball
               ball_dy=-ball_dy;

               // add a little english
               ball_dx+=(-1+rand()%3);

               // make a little noise
               MessageBeep(MB_OK);

               // add some points
               score+=5*(level+(abs(ball_dx)));

               // that's it -- no more block
               return;

               } // end if  

           } // end if

        // advance column position
        x1+=BLOCK_X_GAP;
        } // end for col

    // advance to next row position
    y1+=BLOCK_Y_GAP;

    } // end for row

} // end Process_Ball

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

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!

char buffer[80]; // used to print text

// what state is the game in? 
if (game_state == GAME_STATE_INIT)
    {
    // initialize everything here graphics
    DD_Init(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP);

    // seed the random number generator
    // so game is different each play
    srand(Start_Clock());

    // set the paddle position here to the middle bottom
    paddle_x = PADDLE_START_X;
    paddle_y = PADDLE_START_Y;

    // set ball position and velocity
    ball_x = 8+rand()%(SCREEN_WIDTH-16);
    ball_y = BALL_START_Y;
    ball_dx = -4 + rand()%(8+1);
    ball_dy = 6 + rand()%2;

    // transition to start level state
    game_state = GAME_STATE_START_LEVEL;

    } // end if 
////////////////////////////////////////////////////////////////
else
if (game_state == GAME_STATE_START_LEVEL)
    {
    // get a new level ready to run

    // initialize the blocks
    Init_Blocks();

    // reset block counter
    blocks_hit = 0;

    // transition to run state
    game_state = GAME_STATE_RUN;

    } // end if
///////////////////////////////////////////////////////////////
else
if (game_state == GAME_STATE_RUN)
    {
    // start the timing clock
    Start_Clock();

    // clear drawing surface for the next frame of animation
    Draw_Rectangle(0,0,SCREEN_WIDTH-1, SCREEN_HEIGHT-1,200);

    // move the paddle
    if (KEY_DOWN(VK_RIGHT))
       {
       // move paddle to right
       paddle_x+=8;
 
       // make sure paddle doesn't go off screen
       if (paddle_x > (SCREEN_WIDTH-PADDLE_WIDTH))
          paddle_x = SCREEN_WIDTH-PADDLE_WIDTH;

       } // end if
    else
    if (KEY_DOWN(VK_LEFT))
       {
       // move paddle to right
       paddle_x-=8;
 
       // make sure paddle doesn't go off screen
       if (paddle_x < 0)
          paddle_x = 0;

       } // end if

    // draw blocks
    Draw_Blocks();

    // move the ball
    ball_x+=ball_dx;
    ball_y+=ball_dy;

    // keep ball on screen, if the ball hits the edge of 
    // screen then bounce it by reflecting its velocity
    if (ball_x > (SCREEN_WIDTH - BALL_SIZE) || ball_x < 0) 
       {
       // reflect x-axis velocity
       ball_dx=-ball_dx;

       // update position 
       ball_x+=ball_dx;
       } // end if

    // now y-axis
    if (ball_y < 0) 
       {
       // reflect y-axis velocity
       ball_dy=-ball_dy;

       // update position 
       ball_y+=ball_dy;
       } // end if
   else 
   // penalize player for missing the ball
   if (ball_y > (SCREEN_HEIGHT - BALL_SIZE))
       {
       // reflect y-axis velocity
       ball_dy=-ball_dy;

       // update position 
       ball_y+=ball_dy;

       // minus the score
       score-=100;

       } // end if

    // next watch out for ball velocity getting out of hand
    if (ball_dx > 8) ball_dx = 8;
    else
    if (ball_dx < -8) ball_dx = -8;    

    // test if ball hit any blocks or the paddle
    Process_Ball();

    // draw the paddle and shadow
    Draw_Rectangle(paddle_x-8, paddle_y+8, 
                   paddle_x+PADDLE_WIDTH-8, 
                   paddle_y+PADDLE_HEIGHT+8,0);

    Draw_Rectangle(paddle_x, paddle_y, 
                   paddle_x+PADDLE_WIDTH, 
                   paddle_y+PADDLE_HEIGHT,PADDLE_COLOR);

    // draw the ball
    Draw_Rectangle(ball_x-4, ball_y+4, ball_x+BALL_SIZE-4, 
                   ball_y+BALL_SIZE+4, 0);
    Draw_Rectangle(ball_x, ball_y, ball_x+BALL_SIZE, 
                   ball_y+BALL_SIZE, 255);

    // draw the info
    sprintf(buffer,"F R E A K O U T           Score %d             Level %d",score,level);
    Draw_Text_GDI(buffer, 8,SCREEN_HEIGHT-16, 127);
    
    // flip the surfaces
    DD_Flip();

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

    // check of user is trying to exit
    if (KEY_DOWN(VK_ESCAPE))
       {
       // send message to windows to exit
       PostMessage(main_window_handle, WM_DESTROY,0,0);

       // set exit state
       game_state = GAME_STATE_SHUTDOWN;

       } // end if

    } // end if
///////////////////////////////////////////////////////////////
else
if (game_state == GAME_STATE_SHUTDOWN)
   {
   // in this state shut everything down and release resources
   DD_Shutdown();

   // switch to exit state
   game_state = GAME_STATE_EXIT;

   } // end if

// return success
return(1);

} // end Game_Main

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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕亚洲区| 成人国产免费视频| 91精品在线观看入口| 亚洲午夜在线观看视频在线| 91黄色免费版| 天天色图综合网| 日韩亚洲欧美一区| 黑人巨大精品欧美黑白配亚洲| 欧美精品一区二区三区视频| 国产成人在线电影| 1024成人网| 777亚洲妇女| 国产一区在线不卡| 亚洲欧美日本韩国| 欧美男人的天堂一二区| 蜜臀久久99精品久久久久宅男| 91精品国产乱码久久蜜臀| 国产原创一区二区三区| 日韩美女啊v在线免费观看| 欧美日韩亚洲高清一区二区| 裸体健美xxxx欧美裸体表演| 国产亚洲欧美一区在线观看| 色综合婷婷久久| 美女一区二区三区| 国产精品久久久久久久蜜臀 | 91蜜桃网址入口| 五月激情六月综合| 久久无码av三级| 欧美午夜视频网站| 国产精品12区| 午夜久久久久久| 国产午夜精品久久久久久久| 欧美怡红院视频| 国产伦精品一区二区三区免费迷 | 亚洲欧美一区二区不卡| 欧美一级夜夜爽| 成人激情小说网站| 免播放器亚洲一区| 国产精品欧美精品| 日韩天堂在线观看| 91香蕉视频污在线| 国产在线一区二区综合免费视频| 亚洲欧美另类久久久精品2019| 精品人在线二区三区| 在线亚洲人成电影网站色www| 精品一区二区三区久久| 亚洲一区二区三区四区五区中文| 精品国产亚洲在线| 欧美图区在线视频| 粉嫩在线一区二区三区视频| 免费人成网站在线观看欧美高清| 一区二区在线观看视频| 欧美高清一级片在线观看| 日韩欧美中文一区二区| 欧美在线免费观看亚洲| 成人激情黄色小说| 国产一区二区三区在线观看免费| 日韩精品电影一区亚洲| 一区二区三区日韩欧美精品| 久久久久99精品国产片| 日韩欧美123| 91麻豆精品国产91久久久使用方法 | 亚洲国产精品一区二区久久恐怖片| 欧美精彩视频一区二区三区| 精品美女一区二区三区| 欧美电影在线免费观看| 欧美午夜寂寞影院| 色噜噜狠狠成人网p站| 成人精品亚洲人成在线| 成人中文字幕电影| 国产毛片一区二区| 国产真实乱偷精品视频免| 精品中文av资源站在线观看| 奇米四色…亚洲| 开心九九激情九九欧美日韩精美视频电影| 午夜亚洲国产au精品一区二区| 亚洲精品伦理在线| 亚洲狼人国产精品| 一区二区三区欧美日韩| 一区二区三区精品久久久| 亚洲图片你懂的| 亚洲欧洲一区二区在线播放| 亚洲欧洲日韩综合一区二区| 国产精品污污网站在线观看| 中文字幕欧美区| 国产精品网站导航| 国产精品福利电影一区二区三区四区 | 中文字幕欧美国产| 中文字幕在线不卡| 亚洲欧洲日产国码二区| 亚洲免费在线视频| 午夜精品一区二区三区电影天堂| 午夜精品福利一区二区三区蜜桃| 日韩av电影一区| 久久97超碰色| 国产成人鲁色资源国产91色综| 波多野结衣中文字幕一区| 91欧美一区二区| 欧美影院一区二区三区| 日韩一级大片在线| 久久蜜桃av一区二区天堂| 国产日产欧美一区二区三区| 亚洲日韩欧美一区二区在线| 亚洲午夜在线视频| 激情图片小说一区| 99久久99久久精品国产片果冻| 欧美日韩一区精品| 精品少妇一区二区三区日产乱码| 国产精品色在线| 亚洲国产中文字幕在线视频综合| 蜜桃视频一区二区三区| 国产经典欧美精品| 欧美日韩一二区| 久久天天做天天爱综合色| 亚洲同性同志一二三专区| 亚洲.国产.中文慕字在线| 黑人精品欧美一区二区蜜桃| 99riav一区二区三区| 91精品国产色综合久久不卡蜜臀| 欧美tk丨vk视频| 亚洲少妇最新在线视频| 欧美aa在线视频| 91丝袜国产在线播放| 91精品国产欧美一区二区成人| 国产精品污网站| 麻豆精品国产91久久久久久| 成人精品免费看| 日韩欧美123| 亚洲一区二区综合| 成人午夜电影网站| 制服丝袜av成人在线看| 亚洲视频在线一区观看| 美女www一区二区| 欧美在线观看一二区| 欧美国产日韩在线观看| 美脚の诱脚舐め脚责91| 在线观看国产日韩| 欧美激情一区不卡| 免费高清在线一区| 欧美日韩免费一区二区三区| 国产精品激情偷乱一区二区∴| 蜜桃视频在线观看一区| 欧美亚洲综合网| 综合久久国产九一剧情麻豆| 久久99九九99精品| 91麻豆精品国产91久久久更新时间 | 在线观看三级视频欧美| 国产精品视频一二| 国产福利一区二区三区| 日韩一区二区在线观看| 亚洲成人免费在线观看| 色婷婷综合久久久中文字幕| 国产精品美女一区二区三区 | 成人性视频网站| 精品久久一区二区三区| 日韩精品电影在线观看| 色欧美88888久久久久久影院| 国产精品久久二区二区| 成人激情免费网站| 国产精品久久久久久久蜜臀 | 色国产综合视频| 日本一区二区三区视频视频| 国产一区二区免费看| 精品福利二区三区| 国内外成人在线| 久久久久国色av免费看影院| 国产最新精品免费| 精品国产亚洲一区二区三区在线观看| 捆绑调教美女网站视频一区| 精品久久人人做人人爰| 久久疯狂做爰流白浆xx| 精品国产一区二区国模嫣然| 经典三级视频一区| 久久嫩草精品久久久精品| 国产精品一区二区三区乱码| 久久精品亚洲麻豆av一区二区 | 日韩精品一区二区三区视频播放| 日韩国产成人精品| 日韩欧美的一区| 国产一区二区成人久久免费影院| 国产拍欧美日韩视频二区| 成人中文字幕电影| 一区二区三区自拍| 欧美精品tushy高清| 久久99久久久久久久久久久| 久久免费美女视频| a4yy欧美一区二区三区| 亚洲码国产岛国毛片在线| 色94色欧美sute亚洲线路二| 性做久久久久久免费观看| 欧美一区二区三区爱爱| 国产精品一卡二卡在线观看| 国产精品丝袜91| 欧美天堂亚洲电影院在线播放| 日韩电影在线观看一区| 亚洲精品一线二线三线无人区| 成人免费高清在线| 亚洲综合成人在线视频| 日韩欧美三级在线| 99re在线精品|