<form id="hz9zz"></form>
  • <form id="hz9zz"></form>

      <nobr id="hz9zz"></nobr>

      <form id="hz9zz"></form>

    1. 明輝手游網中心:是一個免費提供流行視頻軟件教程、在線學習分享的學習平臺!

      完成爆炸后的振動效果

      [摘要](長春 石琳)   在許多游戲軟件中,我們經常能看到這樣的場面:當某一設施爆炸后,屏幕畫面會伴隨著輕微的振動,使人感到身臨其境。筆者編寫了一個函數void MoveView(int x,int y)...
      (長春 石琳)

        在許多游戲軟件中,我們經常能看到這樣的場面:當某一設施爆炸后,屏幕畫面會伴隨著輕微的振動,使人感到身臨其境。筆者編寫了一個函數void MoveView(int x,int y);通過CRT控制器將屏幕視角左上角坐標移至 (x,y)處,使畫面相對移動,從而產生振動效果。程序由Borland C++ 2.0編寫,采用VGA 12H模式,代碼小、速度快、運行效果形象逼真。
        // filename: SHAKE.cpp
        // maker: ShiLin
        #include
       。nclude
        #include
       。nclude
        void MoveView(int x,int y);
        void main(void){
         int gdriver,gmode;
         gdriver=DETECT,gmode=0;
         initgraph(&gdriver,&gmode,"BORLANDCBGI");
         rectangle(100,100,200,200);
         outtextxy(100,250,"Press Any Key to SHAKE ...");
         getch();
         for(int i=0;i<20;i++){
         MoveView(10-random(20),5-random(10));
         delay(50);
         }
         MoveView(0,0);
         getch();
         closegraph();
         }
        void MoveView(int x,int y){
         union{
         unsigned int whole;
         char low;
         }adr;
         unsigned char high,low;
         adr.whole=y*80+x/8,
         low=adr.low,
         high=(unsigned char)(adr.whole>>8);
         outportb(0x3D4,0X0C);
         outportb(0x3D5,high);
         outportb(0x3D4,0x0D);
         outportb(0x3D5,low);
         } 


      日韩精品一区二区三区高清